/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/jsxgraph@1.12.2/distrib/jsxgraphcore.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/*
    JSXGraph 1.12.2

    Copyright 2008-2025
        Matthias Ehmann,
        Michael Gerhaeuser,
        Carsten Miller,
        Bianca Valentin,
        Andreas Walter,
        Alfred Wassermann,
        Peter Wilfahrt

    This file is part of JSXGraph.

    JSXGraph is free software dual licensed under the GNU LGPL or MIT License.

    You can redistribute it and/or modify it under the terms of the

      * GNU Lesser General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version
      OR
      * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT

    JSXGraph is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License and
    the MIT License along with JSXGraph. If not, see <https://www.gnu.org/licenses/>
    and <https://opensource.org/licenses/MIT/>.
*/

/**
 * UTF-8 Decoder by Bjoern Hoehrmann
 *
 * Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify, merge,
 * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
 * to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.JXG=e():t.JXG=e()}("undefined"!=typeof self?self:this,function(){return function(){"use strict";var __webpack_modules__={86:function(t,e,i){var s=i(443),r=i(561),o=i(188);s.A.GeonextParser={replacePow:function(t){var e,i,s,r,o,n,a,h,l,c,u,d;for(c=(t=t.replace(/(\s*)\^(\s*)/g,"^")).indexOf("^"),r=-1;c>=0&&c<t.length-1;){if(r===c)throw new Error("JSXGraph: Error while parsing expression '"+t+"'");if(r=c,l=t.slice(0,c),u=t.slice(c+1),")"===l.charAt(l.length-1)){for(e=1,i=l.length-2;i>=0&&e>0;)")"===(s=l.charAt(i))?e++:"("===s&&(e-=1),i-=1;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.slice(h,h+1).match(/([\w.]+)/);)o=RegExp.$1+o,h-=1;o=(o+=l.substring(i+1,l.length)).replace(/([()+*%^\-/\][])/g,"\\$1")}else o="[\\w\\.]+";if(u.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i<u.length&&e>0;)")"===(s=u.charAt(i))?e-=1:"("===s&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=(n=u.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1")}else n="[\\w\\.]+";d=new RegExp("("+o+")\\^("+n+")"),c=(t=t.replace(d,"pow($1,$2)")).indexOf("^")}return t},replaceIf:function(t){var e,i,s,r,o,n,a,h,l,c="",u=null,d=null,p=null;if((s=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");s>=0;){for(e=t.slice(0,s),i=t.slice(s+3),o=1,r=0,n=-1,a=-1;r<i.length&&o>0;)")"===(h=i.charAt(r))?o-=1:"("===h?o+=1:","===h&&1===o&&(n<0?n=r:a=r),r+=1;if(l=i.slice(0,r-1),i=i.slice(r),n<0)return"";if(a<0)return"";u=l.slice(0,n),d=l.slice(n+1,a),p=l.slice(a+1),c+=e+"(("+(u=this.replaceIf(u))+")?("+(d=this.replaceIf(d))+"):("+(p=this.replaceIf(p))+"))",u=null,d=null,s=(t=i).indexOf("If(")}return c+=i},replaceNameById:function(t,e,i){var s,r,o,n,a=0,h=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t};for(n=0;n<h.length;n++)for(a=t.indexOf(h[n]+"(");a>=0;)a>=0&&(s=t.indexOf(")",a+2))>=0&&(r=(r=t.slice(a+2,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+2)+(i?"$('":"")+l(o.id)+t.slice(s))),s=t.indexOf(")",a+2),a=t.indexOf(h[n]+"(",s);for(a=t.indexOf("Dist(");a>=0;)a>=0&&(s=t.indexOf(",",a+5))>=0&&(r=(r=t.slice(a+5,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+5)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+5),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf("Dist(",s);for(h=["Deg","Rad"],n=0;n<h.length;n++)for(a=t.indexOf(h[n]+"(");a>=0;)a>=0&&(s=t.indexOf(",",a+4))>=0&&(r=(r=t.slice(a+4,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+4)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+4),a=t.indexOf(",",s),(s=t.indexOf(",",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+1),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf(h[n]+"(",s);return t},replaceIdByObj:function(t){var e=/(X|Y|L)\(([\w_]+)\)/g;return t=t.replace(e,"$('$2').$1()"),e=/(V)\(([\w_]+)\)/g,t=t.replace(e,"$('$2').Value()"),e=/(Dist)\(([\w_]+),([\w_]+)\)/g,t=t.replace(e,"dist($('$2'), $('$3'))"),e=/(Deg)\(([\w_]+),([ \w[\w_]+),([\w_]+)\)/g,t=t.replace(e,"deg($('$2'),$('$3'),$('$4'))"),e=/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,t=t.replace(e,"rad($('$1'),$('$2'),$('$3'))"),e=/N\((.+)\)/g,t=t.replace(e,"($1)")},geonext2JS:function(t,e){var i,s,r,o=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],n=["abs","acos","asin","atan","ceil","cos","exp","factorial","floor","log","max","min","random","round","sin","sqrt","tan","ceil"];for(s=t=(t=(t=t.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&amp;/g,"&"),s=this.replaceNameById(s,e),s=this.replaceIf(s),s=this.replacePow(s),s=this.replaceIdByObj(s),r=0;r<o.length;r++)i=new RegExp(["(\\W|^)(",o[r],")"].join(""),"ig"),s=s.replace(i,["$1",n[r]].join(""));return s=(s=(s=(s=(s=s.replace(/True/g,"true")).replace(/False/g,"false")).replace(/fasle/g,"false")).replace(/Pi/g,"PI")).replace(/"/g,"'")},findDependencies:function(t,e,i){var s,n,a,h;for(n in o.A.exists(i)||(i=t.board),s=i.elementsByName)s.hasOwnProperty(n)&&n!==t.name&&(s[n].elementClass===r.A.OBJECT_CLASS_TEXT&&s[n].evalVisProp("islabel")||(h=(h=n.replace(/\[/g,"\\[")).replace(/\]/g,"\\]"),a=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+h+")(,[\\w\\[\\]'_ ]+)*\\)","g"),e.search(a)>=0&&s[n].addChild(t)))},gxt2jc:function(t,e){var i;return i=t=(t=(t=t.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&amp;/g,"&"),i=(i=(i=(i=this.replaceNameById(i,e,!0)).replace(/True/g,"true")).replace(/False/g,"false")).replace(/fasle/g,"false")}},e.A=s.A.GeonextParser},102:function(t,e,i){var s=i(443),r=i(477),o=i(571),n=i(171),a=i(588),h=i(904),l=i(561),c=i(188);s.A.CoordsElement=function(t,e){var i;for(c.A.exists(t)||(t=[1,0,0]),i=0;i<t.length;++i)t[i]=parseFloat(t[i]);this.coords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.initialCoords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.actualCoords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.position=null,this.isConstrained=!1,this.onPolygon=!1,this.slideObject=null,this.slideObjects=[],this.needsUpdateFromParent=!0,this.groups=[],this.Xjc=null,this.Yjc=null,this.methodMap=c.A.deepCopy(this.methodMap,{move:"moveTo",moveTo:"moveTo",moveAlong:"moveAlong",visit:"visit",glide:"makeGlider",makeGlider:"makeGlider",intersect:"makeIntersection",makeIntersection:"makeIntersection",X:"X",Y:"Y",Coords:"Coords",free:"free",setPosition:"setGliderPosition",setGliderPosition:"setGliderPosition",addConstraint:"addConstraint",dist:"Dist",Dist:"Dist",onPolygon:"onPolygon",startAnimation:"startAnimation",stopAnimation:"stopAnimation"}),c.A.exists(this.element)&&this.addAnchor(t,e),this.isDraggable=!0},s.A.extend(s.A.CoordsElement.prototype,{updateConstraint:function(){return this},updateCoords:function(t){return this.needsUpdate?(c.A.exists(t)||(t=!1),!0!==this.evalVisProp("frozen")&&this.updateConstraint(),this.type===l.A.OBJECT_TYPE_GLIDER&&(this.isConstrained&&(t=!1),t?this.updateGliderFromParent():this.updateGlider()),this.updateTransform(t),this):this},updateGlider:function(){var t,e,i,s,n,a,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E=2*Math.PI,O=!1,M=this.slideObject,w=[];if(this.needsUpdateFromParent=!1,M.elementClass===l.A.OBJECT_CLASS_CIRCLE)this.evalVisProp("isgeonext")&&(E=1),m=o.A.projectPointToCircle(this,M,this.board),b=o.A.rad([M.center.X()+1,M.center.Y()],M.center,this)/E;else if(M.elementClass===l.A.OBJECT_CLASS_LINE){if(this.onPolygon){if(s=M.point1.coords.usrCoords,e=(n=M.point2.coords.usrCoords)[t=1]-s[t],Math.abs(e)<r.A.eps&&(e=n[t=2]-s[t]),u=(o.A.projectPointToLine(this,M,this.board).usrCoords[t]-s[t])/e,a=M.parentPolygon,u<0){for(t=0;t<a.borders.length;t++)if(M===a.borders[t]){M=a.borders[(t-1+a.borders.length)%a.borders.length];break}}else if(u>1)for(t=0;t<a.borders.length;t++)if(M===a.borders[t]){M=a.borders[(t+1+a.borders.length)%a.borders.length];break}M.id!==this.slideObject.id&&(this.slideObject=M)}s=M.point1.coords,n=M.point2.coords,(e=s.distance(l.A.COORDS_BY_USER,n))<r.A.eps?(m=s,O=!0,b=0):(m=o.A.projectPointToLine(this,M,this.board),s=s.usrCoords.slice(0),n=n.usrCoords.slice(0),Math.abs(n[0])<r.A.eps?(e=n[t=1],Math.abs(e)<r.A.eps&&(e=n[t=2]),b=((e=(m.usrCoords[t]-s[t])/e)>=0?1:-1)*(e=Math.abs(e))/(e+1)):Math.abs(s[0])<r.A.eps?(e=s[t=1],Math.abs(e)<r.A.eps&&(e=s[t=2]),b=(e=(m.usrCoords[t]-n[t])/e)<0?(1-2*e)/(1-e):1/(e+1)):(e=n[t=1]-s[t],Math.abs(e)<r.A.eps&&(e=n[t=2]-s[t]),b=(m.usrCoords[t]-s[t])/e)),null!==(v=this.findClosestSnapValue(b))?(b=(this.evalVisProp("snapvalues")[v]-this._smin)/(this._smax-this._smin),this.update(!0)):(y=this.evalVisProp("snapwidth"))>0&&Math.abs(this._smax-this._smin)>=r.A.eps&&(i=(b=Math.max(Math.min(b,1),0))*(this._smax-this._smin),b=((i=Math.round(i/y)*y+this._smin)-this._smin)/(this._smax-this._smin),this.update(!0)),s=M.point1.coords,!M.evalVisProp("straightfirst")&&Math.abs(s.usrCoords[0])>r.A.eps&&b<0&&(m=s,O=!0,b=0),n=M.point2.coords,!M.evalVisProp("straightlast")&&Math.abs(n.usrCoords[0])>r.A.eps&&b>1&&(m=n,O=!0,b=1)}else if(M.type===l.A.OBJECT_TYPE_TURTLE)this.updateConstraint(),m=(C=o.A.projectPointToTurtle(this,M,this.board))[0],b=C[1];else if(M.elementClass===l.A.OBJECT_CLASS_CURVE)if(M.type===l.A.OBJECT_TYPE_ARC||M.type===l.A.OBJECT_TYPE_SECTOR)m=o.A.projectPointToCircle(this,M,this.board),d=o.A.rad(M.radiuspoint,M.center,this),p=0,f=o.A.rad(M.radiuspoint,M.center,M.anglepoint),b=d,("minor"===(y=M.evalVisProp("selection"))&&f>Math.PI||"major"===y&&f<Math.PI)&&(p=f,f=2*Math.PI),(d<p||d>f)&&(b=f,(d<p&&d>.5*p||d>f&&d>.5*f+Math.PI)&&(b=p),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),E=f-p,this.visProp.isgeonext&&(E=1),Math.abs(E)>r.A.eps&&(b/=E);else if(this.updateConstraint(),M.transformations.length>0){for(x=!1,(C=M.getTransformationSource())[0]&&(x=C[0],w.push(M),w.push(C[1]));C[0]&&c.A.exists(C[1]._transformationSource);)C=C[1].getTransformationSource(),w.push(C[1]);if(P=this.coords.usrCoords,x){for(t=0;t<w.length;t++)w[t].updateTransformMatrix(),A=r.A.inverse(w[t].transformMat),P=r.A.matVecMult(A,P);for(_=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,P=(g=o.A.projectCoordsToCurve(_[1],_[2],this.position||0,w[w.length-1],this.board))[0].usrCoords,t=w.length-2;t>=0;t--)P=r.A.matVecMult(w[t].transformMat,P);g[0]=new h.A(l.A.COORDS_BY_USER,P,this.board)}else M.updateTransformMatrix(),A=r.A.inverse(M.transformMat),P=r.A.matVecMult(A,P),_=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,g=o.A.projectCoordsToCurve(_[1],_[2],this.position||0,M,this.board);m=g[0],b=g[1]}else m=(C=o.A.projectPointToCurve(this,M,this.board))[0],b=C[1];else c.A.isPoint(M)&&(m=o.A.projectPointToPoint(this,M,this.board),b=this.position);this.coords.setCoordinates(l.A.COORDS_BY_USER,m.usrCoords,O),this.position=b},findClosestSnapValue:function(t){var e,i,s,o,n=null;if(s=this.evalVisProp("snapvalues"),o=this.evalVisProp("snapvaluedistance"),c.A.isArray(s)&&Math.abs(this._smax-this._smin)>=r.A.eps&&o>0)for(e=0;e<s.length;e++)(i=Math.abs(t*(this._smax-this._smin)+this._smin-s[e]))<o&&(o=i,n=e);return n},updateGliderFromParent:function(){var t,e,i,s,n,a,u,d,p,f,_,g,A=this.slideObject,m=[],b=2*Math.PI;if(this.needsUpdateFromParent){if(A.elementClass===l.A.OBJECT_CLASS_CIRCLE)i=A.Radius(),this.evalVisProp("isgeonext")&&(b=1),n=[A.center.X()+i*Math.cos(this.position*b),A.center.Y()+i*Math.sin(this.position*b)];else if(A.elementClass===l.A.OBJECT_CLASS_LINE)t=A.point1.coords.usrCoords,e=A.point2.coords.usrCoords,0===t[0]&&0===t[1]&&0===t[2]||0===e[0]&&0===e[1]&&0===e[2]?n=[0,0,0]:Math.abs(e[0])<r.A.eps?(s=Math.min(Math.abs(this.position),1-r.A.eps),s/=1-s,this.position<0&&(s=-s),n=[t[0]+s*e[0],t[1]+s*e[1],t[2]+s*e[2]]):Math.abs(t[0])<r.A.eps?(s=Math.max(this.position,r.A.eps),s=(s=Math.min(s,2-r.A.eps))>1?(s-1)/(s-2):(1-s)/s,n=[e[0]+s*t[0],e[1]+s*t[1],e[2]+s*t[2]]):(s=this.position,n=[t[0]+s*(e[0]-t[0]),t[1]+s*(e[1]-t[1]),t[2]+s*(e[2]-t[2])]);else if(A.type===l.A.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(l.A.COORDS_BY_USER,[A.Z(this.position),A.X(this.position),A.Y(this.position)]),this.updateConstraint(),n=o.A.projectPointToTurtle(this,A,this.board)[0].usrCoords;else if(A.elementClass===l.A.OBJECT_CLASS_CURVE){for(d=!1,(a=A.getTransformationSource())[0]&&(d=a[0],m.push(A),m.push(a[1]));a[0]&&c.A.exists(a[1]._transformationSource);)a=a[1].getTransformationSource(),m.push(a[1]);if(d?this.coords.setCoordinates(l.A.COORDS_BY_USER,[m[m.length-1].Z(this.position),m[m.length-1].X(this.position),m[m.length-1].Y(this.position)]):this.coords.setCoordinates(l.A.COORDS_BY_USER,[A.Z(this.position),A.X(this.position),A.Y(this.position)]),A.type===l.A.OBJECT_TYPE_ARC||A.type===l.A.OBJECT_TYPE_SECTOR)p=o.A.rad([A.center.X()+1,A.center.Y()],A.center,A.radiuspoint),f=0,g=o.A.rad(A.radiuspoint,A.center,A.anglepoint),("minor"===A.visProp.selection&&g>Math.PI||"major"===A.visProp.selection&&g<Math.PI)&&(f=g,g=2*Math.PI),b=g-f,this.evalVisProp("isgeonext")&&(b=1),((_=this.position*b)<f||_>g)&&(((_=g)<f&&_>.5*f||_>g&&_>.5*g+Math.PI)&&(_=f),this.position=_,Math.abs(b)>r.A.eps&&(this.position/=b)),i=A.Radius(),n=[A.center.X()+i*Math.cos(this.position*b+p),A.center.Y()+i*Math.sin(this.position*b+p)];else if(this.updateConstraint(),d)for(n=o.A.projectPointToCurve(this,m[m.length-1],this.board)[0].usrCoords,u=m.length-2;u>=0;u--)n=new h.A(l.A.COORDS_BY_USER,r.A.matVecMult(m[u].transformMat,n),this.board).usrCoords;else n=o.A.projectPointToCurve(this,A,this.board)[0].usrCoords}else c.A.isPoint(A)&&(n=o.A.projectPointToPoint(this,A,this.board).usrCoords);this.coords.setCoordinates(l.A.COORDS_BY_USER,n,!1)}else this.needsUpdateFromParent=!0},updateRendererGeneric:function(t){return this.needsUpdate&&this.board.renderer?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>r.A.eps&&this.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer[t](this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},Coords:function(t){return t?this.coords.usrCoords.slice():this.coords.usrCoords.slice(1)},XEval:function(){return this.coords.usrCoords[1]},YEval:function(){return this.coords.usrCoords[2]},ZEval:function(){return this.coords.usrCoords[0]},Dist:function(t){return this.isReal&&t.isReal?this.coords.distance(l.A.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,s,r,n,a,h,u,d=0,p=1/0,f=null,_=this.evalVisProp("ignoredsnaptopoints"),g=!1;if(r=this.board.objectsList.length,_&&(h=_.length),this.evalVisProp("snaptopoints")||t){for(n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance"),e=0;e<r;e++){if(i=this.board.objectsList[e],_){for(g=!1,u=0;u<h;u++)if(i===this.board.select(_[u])){g=!0;break}if(g)continue}c.A.isPoint(i)&&i!==this&&i.visPropCalc.visible&&(s=o.A.projectPointToPoint(this,i,this.board),(d="screen"===n?s.distance(l.A.COORDS_BY_SCREEN,this.coords):s.distance(l.A.COORDS_BY_USER,this.coords))<a&&d<p&&(p=d,f=s))}null!==f&&this.coords.setCoordinates(l.A.COORDS_BY_USER,f.usrCoords)}return this},snapToPoints:function(t){return this.handleSnapToPoints(t)},handleAttractors:function(){var t,e,i,s,r=0,n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance"),u=this.evalVisProp("snatchdistance"),d=this.evalVisProp("attractors"),p=d.length;if(0!==a){for(t=0;t<p;t++)if(e=this.board.select(d[t]),c.A.exists(e)&&e!==this){if(c.A.isPoint(e)?i=o.A.projectPointToPoint(this,e,this.board):e.elementClass===l.A.OBJECT_CLASS_LINE?(s=o.A.projectCoordsToSegment(this.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),i=!e.evalVisProp("straightfirst")&&s[1]<0?e.point1.coords:!e.evalVisProp("straightlast")&&s[1]>1?e.point2.coords:new h.A(l.A.COORDS_BY_USER,s[0],this.board)):e.elementClass===l.A.OBJECT_CLASS_CIRCLE?i=o.A.projectPointToCircle(this,e,this.board):e.elementClass===l.A.OBJECT_CLASS_CURVE?i=o.A.projectPointToCurve(this,e,this.board)[0]:e.type===l.A.OBJECT_TYPE_TURTLE?i=o.A.projectPointToTurtle(this,e,this.board)[0]:e.type===l.A.OBJECT_TYPE_POLYGON&&(i=new h.A(l.A.COORDS_BY_USER,o.A.projectCoordsToPolygon(this.coords.usrCoords,e),this.board)),(r="screen"===n?i.distance(l.A.COORDS_BY_SCREEN,this.coords):i.distance(l.A.COORDS_BY_USER,this.coords))<a){this.type===l.A.OBJECT_TYPE_GLIDER&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)||this.makeGlider(e);break}r>=u&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,s,o,n,c,u=this.coords;if(this.relativeCoords)return s=new h.A(t,e,this.board),this.evalVisProp("islabel")?(o=a.A.subtract(s.scrCoords,u.scrCoords),this.relativeCoords.scrCoords[1]+=o[1],this.relativeCoords.scrCoords[2]+=o[2]):(o=a.A.subtract(s.usrCoords,u.usrCoords),this.relativeCoords.usrCoords[1]+=o[1],this.relativeCoords.usrCoords[2]+=o[2]),this;if(this.coords.setCoordinates(t,e),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),this.actualCoords.setCoordinates(l.A.COORDS_BY_USER,this.coords.usrCoords),this.transformations.length>0){for(t===l.A.COORDS_BY_SCREEN?c=new h.A(t,e,this.board).usrCoords:(2===e.length&&(e=[1].concat(e)),c=e),n=[[1,0,0],[0,1,0],[0,0,1]],i=0;i<this.transformations.length;i++)n=r.A.matMatMult(this.transformations[i].matrix,n);c=r.A.matVecMult(r.A.inverse(n),c),this.initialCoords.setCoordinates(l.A.COORDS_BY_USER,c),this.elementClass!==l.A.OBJECT_CLASS_POINT&&this.coords.setCoordinates(l.A.COORDS_BY_USER,c)}return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===l.A.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(t,e){var i;return e=new h.A(t,e,this.board),i=this.board.create("transform",e.usrCoords.slice(1),{type:"translate"}),this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(i):this.addTransform(this,i),this.prepareUpdate().update(),this},setPosition:function(t,e){return this.setPositionDirectly(t,e)},setGliderPosition:function(t){return this.type===l.A.OBJECT_TYPE_GLIDER&&(this.position=t,this.board.update()),this},makeGlider:function(t){var e,i,r,o=this.board.select(t),n=!1;if(o.type===l.A.OBJECT_TYPE_POLYGON){for(e=Number.MAX_VALUE,i=0;i<o.borders.length;i++)(r=s.A.Math.Geometry.distPointLine(this.coords.usrCoords,o.borders[i].stdform))<e&&(e=r,t=o.borders[i]);o=this.board.select(t),n=!0}if(!c.A.exists(o))throw new Error("JSXGraph: slide object undefined.");if(o.type===l.A.OBJECT_TYPE_TICKS)throw new Error("JSXGraph: gliders on ticks are not possible.");return this.slideObject=this.board.select(t),this.slideObjects.push(this.slideObject),this.addParents(t),this.type=l.A.OBJECT_TYPE_GLIDER,this.elType="glider",this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.onPolygon=n,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this.updateGlider(),this.needsUpdateFromParent=!0,this.updateGliderFromParent(),this},popSlideObject:function(){this.slideObjects.length>0&&(this.slideObjects.pop(),this.slideObject.removeChild(this),0===this.slideObjects.length?(this.type=this._org_type,this.type===l.A.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===l.A.OBJECT_CLASS_TEXT?this.elType="text":this.type===l.A.OBJECT_TYPE_IMAGE?this.elType="image":this.type===l.A.OBJECT_TYPE_FOREIGNOBJECT&&(this.elType="foreignobject"),this.slideObject=null):this.slideObject=this.slideObjects[this.slideObjects.length-1])},free:function(){var t,e;if(this.type!==l.A.OBJECT_TYPE_GLIDER){if(this.transformations.length=0,delete this.updateConstraint,this.isConstrained=!1,this.isDraggable)return;this.isDraggable=!0,this.elementClass===l.A.OBJECT_CLASS_POINT&&(this.type=l.A.OBJECT_TYPE_POINT,this.elType="point"),this.XEval=function(){return this.coords.usrCoords[1]},this.YEval=function(){return this.coords.usrCoords[2]},this.ZEval=function(){return this.coords.usrCoords[0]},this.Xjc=null,this.Yjc=null}for(t in this.board.objects)this.board.objects.hasOwnProperty(t)&&(e=this.board.objects[t]).descendants&&(delete e.descendants[this.id],delete e.childElements[this.id],this.hasLabel&&(delete e.descendants[this.label.id],delete e.childElements[this.label.id]));this.ancestors={},this.parents=[],this.slideObject=null,this.slideObjects=[],this.elementClass===l.A.OBJECT_CLASS_POINT?(this.type=l.A.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===l.A.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===l.A.OBJECT_CLASS_OTHER&&(this.type=this._org_type,this.elType="image")},addConstraint:function(t){var e,i,s=[],r=["X","Y"],o=function(t){return function(){return t}},n=function(t){return function(){return t.Value()}};for(this.elementClass===l.A.OBJECT_CLASS_POINT&&(this.type=l.A.OBJECT_TYPE_CAS),this.isDraggable=!1,e=0;e<t.length;e++)i=t[e],c.A.isString(i)?(s[e]=this.board.jc.snippet(i,!0,null,!0),this.addParentsFromJCFunctions([s[e]]),2===t.length&&(this[r[e]+"jc"]=t[e])):c.A.isFunction(i)?s[e]=i:c.A.isNumber(i)?s[e]=o(i):c.A.isObject(i)&&c.A.isFunction(i.Value)&&(s[e]=n(i)),s[e].origin=i;return 1===t.length?this.updateConstraint=function(){var t=s[0]();return c.A.isArray(t)?this.coords.setCoordinates(l.A.COORDS_BY_USER,t):this.coords=t,this}:2===t.length?(this.XEval=s[0],this.YEval=s[1],this.addParents([s[0].origin,s[1].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.XEval(),this.YEval()]),this}):(this.ZEval=s[0],this.XEval=s[1],this.YEval=s[2],this.addParents([s[0].origin,s[1].origin,s[2].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()]),this}),this.isConstrained=!0,this.prepareUpdate().update(),this.board.isSuspendedUpdate||(this.updateVisibility().updateRenderer(),this.hasLabel&&this.label.fullUpdate()),this},addAnchor:function(t,e){this.relativeCoords=e?new h.A(l.A.COORDS_BY_SCREEN,t.slice(0,2),this.board):new h.A(l.A.COORDS_BY_USER,t,this.board),this.element.addChild(this),e&&this.addParents(this.element),this.XEval=function(){var t,e,i;return this.evalVisProp("islabel")?(i=this.evalVisProp("offset"),t=parseFloat(i[0]),e=this.element.getLabelAnchor(),new h.A(l.A.COORDS_BY_SCREEN,[t+this.relativeCoords.scrCoords[1]+e.scrCoords[1],0],this.board).usrCoords[1]):(e=this.element.getTextAnchor(),this.relativeCoords.usrCoords[1]+e.usrCoords[1])},this.YEval=function(){var t,e,i;return this.evalVisProp("islabel")?(i=this.evalVisProp("offset"),t=-parseFloat(i[1]),e=this.element.getLabelAnchor(),new h.A(l.A.COORDS_BY_SCREEN,[0,t+this.relativeCoords.scrCoords[2]+e.scrCoords[2]],this.board).usrCoords[2]):(e=this.element.getTextAnchor(),this.relativeCoords.usrCoords[2]+e.usrCoords[2])},this.ZEval=c.A.createFunction(1,this.board,""),this.updateConstraint=function(){this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()])},this.isConstrained=!0,this.updateConstraint()},updateTransform:function(t){var e,i;if(0===this.transformations.length)return this;for(null===this.baseElement&&(this.baseElement=this),this.transformations[0].update(),e=this===this.baseElement?this.transformations[0].apply(this,"self"):this.transformations[0].apply(this.baseElement),i=1;i<this.transformations.length;i++)this.transformations[i].update(),e=r.A.matVecMult(this.transformations[i].matrix,e);return this.actualCoords.setCoordinates(l.A.COORDS_BY_USER,e),this},addTransform:function(t,e){var i,s=c.A.isArray(e)?e:[e],r=s.length;for(0===this.transformations.length&&(this.baseElement=t),i=0;i<r;i++)this.transformations.push(s[i]);return this},startAnimation:function(t,e,i,s){var r=c.A.evaluate(t),o=c.A.evaluate(e),n=this;return i=c.A.evaluate(i)||250,s="undefined"!==(s=c.A.evaluate(s))?s:-1,this.type!==l.A.OBJECT_TYPE_GLIDER||c.A.exists(this.intervalCode)||0===s||(this.roundsCount=0,this.intervalCode=window.setInterval(function(){n._anim(r,o,s)},i),c.A.exists(this.intervalCount)||(this.intervalCount=0)),this},stopAnimation:function(){return c.A.exists(this.intervalCode)&&(window.clearInterval(this.intervalCode),delete this.intervalCode),this},moveAlong:function(t,e,i){i=i||{};var s,r,o,a,h,u=[],d=[],p=e/this.board.attr.animationdelay,f=function(e,i){return function(){return t[e][i]}};if(c.A.isArray(t)){for(o=t.length,s=0;s<o;s++)c.A.isPoint(t[s])?d[s]=t[s]:d[s]={elementClass:l.A.OBJECT_CLASS_POINT,X:f(s,0),Y:f(s,1)};if(0===(e=e||0))return this.setPosition(l.A.COORDS_BY_USER,[d[d.length-1].X(),d[d.length-1].Y()]),this.board.update(this);if(!c.A.exists(i.interpolate)||i.interpolate)for(r=n.A.Neville(d),s=0;s<p;s++)u[s]=[],u[s][0]=r[0]((p-s)/p*r[3]()),u[s][1]=r[1]((p-s)/p*r[3]());else{for(o=t.length-1,s=0;s<p;++s)h=s/p*o-(a=Math.floor(s/p*o)),u[s]=[],u[s][0]=(1-h)*d[a].X()+h*d[a+1].X(),u[s][1]=(1-h)*d[a].Y()+h*d[a+1].Y();u.push([d[o].X(),d[o].Y()]),u.reverse()}this.animationPath=u}else c.A.isFunction(t)&&(this.animationPath=t,this.animationStart=(new Date).getTime());return this.animationCallback=i.callback,this.board.addAnimation(this),this},moveTo:function(t,e,i){i=i||{},t=new h.A(l.A.COORDS_BY_USER,t,this.board);var o,n=this.board.attr.animationdelay,a=Math.ceil(e/n),u=[],d=this.coords.usrCoords[1],p=this.coords.usrCoords[2],f=t.usrCoords[1]-d,_=t.usrCoords[2]-p,g=function(t){var e=t/a;if(i.effect){if("<>"===i.effect)return Math.pow(Math.sin(e*Math.PI/2),2);if("<"===i.effect)return e*e*e;if(">"===i.effect)return 1-Math.pow(1-e,3);if("=="===i.effect||"--"===i.effect)return t/a;s.A.warn("Callback moveTo(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return t/a};if(!c.A.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>r.A.eps)return this.setPosition(l.A.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.A.exists(i.callback)&&Math.abs(f)<r.A.eps&&Math.abs(_)<r.A.eps)return this;for(o=a;o>=0;o--)u[a-o]=[t.usrCoords[0],d+f*g(o),p+_*g(o)];return this.animationPath=u,this.animationCallback=i.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new h.A(l.A.COORDS_BY_USER,t,this.board);var r,o,n,a=this.board.attr.animationdelay,u=[],d=this.coords.usrCoords[1],p=this.coords.usrCoords[2],f=t.usrCoords[1]-d,_=t.usrCoords[2]-p,g=function(t){var e=t<n/2?2*t/n:2*(n-t)/n;if(i.effect){if("<>"===i.effect)return Math.pow(Math.sin(e*Math.PI/2),2);if("<"===i.effect)return e*e*e;if(">"===i.effect)return 1-Math.pow(1-e,3);if("=="===i.effect||"--"===i.effect)return e;s.A.warn("Callback visit(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return e};for(c.A.isNumber(i)?i={repeat:i}:(i=i||{},c.A.exists(i.repeat)||(i.repeat=1)),n=Math.ceil(e/(a*i.repeat)),o=0;o<i.repeat;o++)for(r=n;r>=0;r--)u[o*(n+1)+n-r]=[t.usrCoords[0],d+f*g(r),p+_*g(r)];return this.animationPath=u,this.animationCallback=i.callback,this.board.addAnimation(this),this},moveAlongES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveAlong(t,e,i)})},moveToES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveTo(t,e,i)})},visitES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.visit(t,e,i)})},_anim:function(t,e,i){var s,r,n,a,h,c,u,d,p;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0,this.roundsCount+=1,i>0&&this.roundsCount>=i)?(this.roundsCount=0,this.stopAnimation()):(this.slideObject.elementClass===l.A.OBJECT_CLASS_LINE?(u=this.slideObject.point1.coords.scrCoords,d=this.slideObject.point2.coords.scrCoords,s=Math.round((d[1]-u[1])*this.intervalCount/e),r=Math.round((d[2]-u[2])*this.intervalCount/e),t>0?a=this.slideObject.point1:(a=this.slideObject.point2,s*=-1,r*=-1),this.coords.setCoordinates(l.A.COORDS_BY_SCREEN,[a.coords.scrCoords[1]+s,a.coords.scrCoords[2]+r])):this.slideObject.elementClass===l.A.OBJECT_CLASS_CURVE?(h=t>0?(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/e+this.slideObject.minX():-(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/e+this.slideObject.maxX(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.X(h),this.slideObject.Y(h)]),p=o.A.projectPointToCurve(this,this.slideObject,this.board),this.coords=p[0],this.position=p[1]):this.slideObject.elementClass===l.A.OBJECT_CLASS_CIRCLE&&(n=2*Math.PI,n*=t<0?this.intervalCount/e:(e-this.intervalCount)/e,c=this.slideObject.Radius(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+c*Math.cos(n),this.slideObject.center.coords.usrCoords[2]+c*Math.sin(n)])),this.board.update(this),this)},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},getParents:function(){var t=[this.Z(),this.X(),this.Y()];return 0!==this.parents.length&&(t=this.parents),this.type===l.A.OBJECT_TYPE_GLIDER&&(t=[this.X(),this.Y(),this.slideObject.id]),t}}),s.A.CoordsElement.create=function(t,e,i,s,r,o){var n,a,h=!1;for(a=0;a<i.length;a++)(c.A.isFunction(i[a])||c.A.isString(i[a]))&&(h=!0);if(h)(n=new t(e,[0,0],s,r,o)).addConstraint(i);else if(c.A.isNumber(i[0])&&c.A.isNumber(i[1]))n=new t(e,i,s,r,o),c.A.exists(s.slideobject)?n.makeGlider(s.slideobject):n.baseElement=n,n.isDraggable=!0;else{if(!c.A.isObject(i[0])||!c.A.isTransformationOrArray(i[1]))return!1;(n=new t(e,[0,0],s,r,o)).addTransform(i[0],i[1]),n.isDraggable=!1}return n.handleSnapToGrid(),n.handleSnapToPoints(),n.handleAttractors(),n.addParents(i),n},e.A=s.A.CoordsElement},133:function(t,e,i){var s=i(443),r=i(188);s.A.extendConstants(s.A,{}),s.A.extend(s.A,{isTouchEvent:function(t){return s.A.exists(t.touches)},isPointerEvent:function(t){return s.A.exists(t.pointerId)},isMouseEvent:function(t){return!s.A.isTouchEvent(t)&&!s.A.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return s.A.isTouchEvent(t)&&(e=t.touches.length),e},isFirstTouch:function(t){var e=s.A.getNumberOfTouchPoints(t);return s.A.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:r.A.exists(window)&&r.A.exists(document)&&"object"==typeof window&&"object"==typeof document,supportsES6:function(){try{return new Function("(a = 0) => a"),!0}catch(t){return!1}},supportsVML:function(){return this.isBrowser&&!!document.namespaces},supportsSVG:function(){return!!this.isBrowser&&(!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)},supportsCanvas:function(){var t=!1;return this.isNode()&&(t=!0),t||this.isBrowser&&!!document.createElement("canvas").getContext},isNode:function(){return!this.isBrowser&&"undefined"!=typeof process&&-1!==process.release.name.search(/node|io.js/)},isWebWorker:function(){return!this.isBrowser&&"object"==typeof self&&"function"==typeof self.postMessage},supportsPointerEvents:function(){return!!(this.isBrowser&&window.navigator&&(window.PointerEvent||window.navigator.pointerEnabled||window.navigator.msPointerEnabled))},isTouchDevice:function(){return this.isBrowser&&void 0!==window.ontouchstart},isAndroid:function(){return r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return r.A.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return this.isApple()&&navigator.userAgent.search(/Mobile\/[0-9A-Za-z.]*Safari/)>-1},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return r.A.exists(navigator)&&-1===navigator.userAgent.toLowerCase().indexOf("android")&&-1===navigator.userAgent.toLowerCase().indexOf("apple")&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1},isDesktop:function(){return!0},isMobile:function(){return!0},ieVersion:function(){var t,e,i=3;if(null===document||"object"!=typeof document)return 0;e=(t=document.createElement("div")).getElementsByTagName("i");do{t.innerHTML="\x3c!--[if gt IE "+ ++i+"]><i></i><![endif]--\x3e"}while(e[0]);return i>4?i:void 0}(),getDimensions:function(t,e){var i,s,o,n,a,h,l,c,u,d=/\d+(\.\d*)?px/;if(!this.isBrowser||null===t)return{width:500,height:500};if(e=e||document,i=r.A.isString(t)?e.getElementById(t):t,!r.A.exists(i))throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.");return"none"!==(s=i.style.display)&&null!==s?i.clientWidth>0&&i.clientHeight>0?{width:i.clientWidth,height:i.clientHeight}:(u=window.getComputedStyle?window.getComputedStyle(i):i.style,{width:d.test(u.width)?parseFloat(u.width):0,height:d.test(u.height)?parseFloat(u.height):0}):(n=(o=i.style).visibility,a=o.position,h=o.display,o.visibility="hidden",o.position="absolute",o.display="block",l=i.clientWidth,c=i.clientHeight,o.display=h,o.position=a,o.visibility=n,{width:l,height:c})},addEvent:function(t,e,i,s,o){var n=function(){return i.apply(s,arguments)};n.origin=i,"object"==typeof s&&r.A.exists(s.BOARD_MODE_NONE)&&(s["x_internal"+e]=s["x_internal"+e]||[],s["x_internal"+e].push(n)),r.A.exists(t)&&r.A.exists(t.addEventListener)&&(o=o||!1,t.addEventListener(e,n,o)),r.A.exists(t)&&r.A.exists(t.attachEvent)&&t.attachEvent("on"+e,n)},removeEvent:function(t,e,i,o){var n;if(r.A.exists(o))if(r.A.exists(o["x_internal"+e]))if(r.A.isArray(o["x_internal"+e]))if(-1!==(n=r.A.indexOf(o["x_internal"+e],i,"origin"))){try{r.A.exists(t)&&r.A.exists(t.removeEventListener)&&t.removeEventListener(e,o["x_internal"+e][n],!1),r.A.exists(t)&&r.A.exists(t.detachEvent)&&t.detachEvent("on"+e,o["x_internal"+e][n])}catch(t){s.A.debug("removeEvent: event not registered in browser: ("+e+" -- "+i+")")}o["x_internal"+e].splice(n,1)}else s.A.debug("removeEvent: no such event function in internal list: "+i);else s.A.debug("owner[x_internal + "+e+"] is not an array");else s.A.debug("removeEvent: no such type: "+e);else s.A.debug("no such owner")},removeAllEvents:function(t,e,i){var r;if(i["x_internal"+e]){for(r=i["x_internal"+e].length-1;r>=0;r--)s.A.removeEvent(t,e,i["x_internal"+e][r].origin,i);i["x_internal"+e].length>0&&s.A.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var s,o,n,a=0,h=0;if(t||(t=window.event),i=i||document,n=t.touches,r.A.exists(n)&&0===n.length&&(n=t.changedTouches),r.A.exists(e)&&r.A.exists(n))if(-1===e){for(o=n.length,s=0;s<o;s++)if(n[s]){t=n[s];break}}else t=n[e];return t.clientX&&(a=t.clientX,h=t.clientY),[a,h]},getOffset:function(t){var e,i=t,s=t,r=i.offsetLeft-i.scrollLeft,o=i.offsetTop-i.scrollTop;for(r=(e=this.getCSSTransform([r,o],i))[0],o=e[1],i=i.offsetParent;i;){for(r+=i.offsetLeft,o+=i.offsetTop,i.offsetParent&&(r+=i.clientLeft-i.scrollLeft,o+=i.clientTop-i.scrollTop),r=(e=this.getCSSTransform([r,o],i))[0],o=e[1],s=s.parentNode;s!==i;)r+=s.clientLeft-s.scrollLeft,o+=s.clientTop-s.scrollTop,r=(e=this.getCSSTransform([r,o],s))[0],o=e[1],s=s.parentNode;i=i.offsetParent}return[r,o]},getStyle:function(t,e){var i,r=t.ownerDocument;return r.defaultView&&r.defaultView.getComputedStyle?i=r.defaultView.getComputedStyle(t,null).getPropertyValue(e):t.currentStyle&&s.A.ieVersion>=9?i=t.currentStyle[e]:t.style&&(e=e.replace(/-([a-z]|[0-9])/gi,function(t,e){return e.toUpperCase()}),i=t.style[e]),i},getProp:function(t,e){var i=parseInt(this.getStyle(t,e),10);return isNaN(i)?0:i},getCSSTransform:function(t,e){var i,s,o,n,a,h,l,c=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(a=c.length,i=0,o="";i<a;i++)if(r.A.exists(e.style[c[i]])){o=e.style[c[i]];break}if(""!==o&&(n=o.indexOf("("))>0){for(a=o.length,s=0,h=(l=o.substring(n+1,a-1).split(",")).length;s<h;s++)l[s]=parseFloat(l[s]);0===o.indexOf("matrix")?(t[0]+=l[4],t[1]+=l[5]):0===o.indexOf("translateX")?t[0]+=l[0]:0===o.indexOf("translateY")?t[1]+=l[0]:0===o.indexOf("translate")&&(t[0]+=l[0],t[1]+=l[1])}return r.A.exists(e.style.zoom)&&""!==(o=e.style.zoom)&&(t[0]*=parseFloat(o),t[1]*=parseFloat(o)),t},getCSSTransformMatrix:function(t){var e,i,s,o,n,a,h,l,c=t.ownerDocument,u=["transform","webkitTransform","MozTransform","msTransform","oTransform"],d=[[1,0,0],[0,1,0],[0,0,1]];if(c.defaultView&&c.defaultView.getComputedStyle)s=(l=c.defaultView.getComputedStyle(t,null)).getPropertyValue("-webkit-transform")||l.getPropertyValue("-moz-transform")||l.getPropertyValue("-ms-transform")||l.getPropertyValue("-o-transform")||l.getPropertyValue("transform");else for(a=u.length,e=0,s="";e<a;e++)if(r.A.exists(t.style[u[e]])){s=t.style[u[e]];break}if(""!==s&&(n=s.indexOf("("))>0){for(a=s.length,i=0,h=(o=s.substring(n+1,a-1).split(",")).length;i<h;i++)o[i]=parseFloat(o[i]);0===s.indexOf("matrix")?d=[[1,0,0],[0,o[0],o[1]],[0,o[2],o[3]]]:0===s.indexOf("scaleX")?d[1][1]=o[0]:0===s.indexOf("scaleY")?d[2][2]=o[0]:0===s.indexOf("scale")&&(d[1][1]=o[0],d[2][2]=o[1])}return r.A.exists(t.style.zoom)&&""!==(s=t.style.zoom)&&(d[1][1]*=parseFloat(s),d[2][2]*=parseFloat(s)),d},timedChunk:function(t,e,i,s){var r=t.slice(),o=function(){var n=+new Date;do{e.call(i,r.shift())}while(r.length>0&&+new Date-n<300);r.length>0?window.setTimeout(o,1):s(t)};window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,r){var o,n,a,h,l,c,u,d,p,f,_,g,A=r;for(n=(a=i.getElementById(t).getBoundingClientRect()).height,o=a.width,c=(d=i.getElementById(e))._cssFullscreenStore.w,_=(u=d._cssFullscreenStore.h)/c,c>o*A&&(u=(c=o*A)*_),u>n*A&&(c=(u=n*A)/_),h=c,p=_<n/o?o*A/c:n*A/u,f=.5*(n-(l=u)),g=0;g<4;g++)try{d.style.width=h+"px !important",d.style.height=l+"px !important",d.style.margin="0 auto",d.style.transform=d._cssFullscreenStore.transform+" matrix("+p+",0,0,"+p+",0,"+f+")";break}catch(t){s.A.debug("JXG.scaleJSXGraphDiv:\n"+t)}4===g&&s.A.debug("JXG.scaleJSXGraphDiv: Could not set any CSS property.")}}),e.A=s.A},144:function(t,e,i){var s=i(443),r=i(561),o=i(904),n=i(477),a=i(588),h=i(378),l=i(454),c=i(873),u=i(188);s.A.GeometryElement=function(t,e,i,s){var o,n,a;if(this.needsUpdate=!0,this.isDraggable=!1,this.isReal=!0,this.childElements={},this.hasLabel=!1,this.highlighted=!1,this.notExistingParents={},this.traces={},this.numTraces=0,this.transformations=[],this.baseElement=null,this.descendants={},this.ancestors={},this.parents=[],this.symbolic={},this.rendNode=null,this.elType="",this.dump=!0,this.subs={},this.inherits=[],this._pos=-1,this.stdform=[1,0,0,0,1,1,0,0],this.methodMap={setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",Name:"getName",addTransform:"addTransform",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks",Bounds:"bounds"},this.quadraticform=[[1,0,0],[0,1,0],[0,0,1]],this.visProp={},this.visPropCalc={visible:!1},l.A.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,this.view=null,arguments.length>0){for(n in this.board=t,this.type=i,this._org_type=i,this.elementClass=s||r.A.OBJECT_CLASS_OTHER,this.id=e.id,o=e.name,u.A.exists(o)||(o=this.board.generateName(this)),""!==o&&(this.board.elementsByName[o]=this),this.name=o,this.needsRegularUpdate=e.needsregularupdate,u.A.clearVisPropOld(this),a=this.resolveShortcuts(e))a.hasOwnProperty(n)&&this._set(n,a[n]);this.visProp.draft=a.draft&&a.draft.draft}},s.A.extend(s.A.GeometryElement.prototype,{addChild:function(t){var e,i;for(e in this.childElements[t.id]=t,this.addDescendants(t),t.ancestors[this.id]=this,this.descendants)if(this.descendants.hasOwnProperty(e))for(i in this.descendants[e].ancestors[this.id]=this,this.ancestors)this.ancestors.hasOwnProperty(i)&&(this.descendants[e].ancestors[this.ancestors[i].id]=this.ancestors[i]);for(e in this.ancestors)if(this.ancestors.hasOwnProperty(e))for(i in this.descendants)this.descendants.hasOwnProperty(i)&&(this.ancestors[e].descendants[this.descendants[i].id]=this.descendants[i]);return this},addDescendants:function(t){var e;for(e in this.descendants[t.id]=t,t.childElements)t.childElements.hasOwnProperty(e)&&this.addDescendants(t.childElements[e]);return this},addParents:function(t){var e,i,s;for(i=(s=u.A.isArray(t)?t:arguments).length,e=0;e<i;++e)u.A.exists(s[e])&&(u.A.isId(this.board,s[e])?this.parents.push(s[e]):u.A.exists(s[e].id)&&this.parents.push(s[e].id));this.parents=u.A.uniqueArray(this.parents)},setParents:function(t){this.parents=[],this.addParents(t)},addParentsFromJCFunctions:function(t){var e,i,s;for(e=0;e<t.length;e++)for(i in t[e].deps)s=t[e].deps[i],this.addParents(s),s.addChild(this);return this},removeChild:function(t){return delete this.childElements[t.id],this.removeDescendants(t),delete t.ancestors[this.id],this},removeDescendants:function(t){var e;for(e in delete this.descendants[t.id],t.childElements)t.childElements.hasOwnProperty(e)&&this.removeDescendants(t.childElements[e]);return this},countChildren:function(){var t,e,i=0;for(t in e=this.childElements)e.hasOwnProperty(t)&&t.indexOf("Label")<0&&i++;return i},getName:function(){return this.name},addTransform:function(t){return this},draggable:function(){return this.isDraggable&&!this.evalVisProp("fixed")&&this.type!==r.A.OBJECT_TYPE_GLIDER},setPosition:function(t,e){var i,s,o,n,a=[];if(!u.A.exists(this.parents))return this;for(o=this.parents.length,s=0;s<o;++s)if(i=this.board.select(this.parents[s]),u.A.isPoint(i)){if(!i.draggable())return this;a.push(i)}if(3===e.length&&(e=e.slice(1)),n=this.board.create("transform",e,{type:"translate"}),(o=a.length)>0){if(n.applyOnce(a),u.A.exists(this.view)&&"view3d"===this.view.elType)for(s=0;s<this.parents.length;++s)i=this.view.select(this.parents[s]),u.A.exists(i.setPosition2D)&&i.setPosition2D(n)}else this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n);for(s=0;s<o;++s)a[s].type===r.A.OBJECT_TYPE_GLIDER&&a[s].updateGlider();return this},setPositionDirectly:function(t,e,i){var s=new o.A(t,e,this.board,!1),n=new o.A(t,i,this.board,!1),h=a.A.subtract(s.usrCoords,n.usrCoords);return this.setPosition(r.A.COORDS_BY_USER,h),this},generatePolynomial:function(){return[]},animate:function(t,e,i){i=i||{};var s,r,o,n=this.board.attr.animationdelay,a=Math.ceil(e/n),h=this,l=function(t,e,i){var s,r,n,l,u;for(s=c.A.rgb2hsv(t),n=((r=c.A.rgb2hsv(e))[0]-s[0])/a,l=(r[1]-s[1])/a,u=(r[2]-s[2])/a,h.animationData[i]=[],o=0;o<a;o++)h.animationData[i][a-o-1]=c.A.hsv2rgb(s[0]+(o+1)*n,s[1]+(o+1)*l,s[2]+(o+1)*u)},d=function(t,e,i,s){var r,n;if(t=parseFloat(t),e=parseFloat(e),!isNaN(t)&&!isNaN(e))for(n=(e-t)/a,h.animationData[i]=[],o=0;o<a;o++)r=t+(o+1)*n,h.animationData[i][a-o-1]=s?Math.floor(r):r};for(s in this.animationData={},t)if(t.hasOwnProperty(s))switch(r=s.toLowerCase()){case"strokecolor":case"fillcolor":l(this.visProp[r],t[s],r);break;case"size":if(!u.A.isPoint(this))break;d(this.visProp[r],t[s],r,!0);break;case"strokeopacity":case"strokewidth":case"fillopacity":d(this.visProp[r],t[s],r,!1)}return this.animationCallback=i.callback,this.board.addAnimation(this),this},update:function(){return this.evalVisProp("trace")&&this.cloneToBackground(),this},updateRenderer:function(){return this},fullUpdate:function(t){return this.prepareUpdate().update().updateVisibility(t).updateRenderer()},setDisplayRendNode:function(t){var e,i,s,r,o;if(void 0===t&&(t=this.visPropCalc.visible),t===this.visPropOld.visible)return this;for(this.board.renderer.display(this,t),i=this.inherits.length,s=0;s<i;s++)if(o=this.inherits[s],u.A.isArray(o))for(r=o.length,e=0;e<r;e++)u.A.exists(o[e])&&u.A.exists(o[e].rendNode)&&"inherit"===o[e].evalVisProp("visible")&&o[e].setDisplayRendNode(t);else u.A.exists(o)&&u.A.exists(o.rendNode)&&"inherit"===o.evalVisProp("visible")&&o.setDisplayRendNode(t);return this.hasLabel&&u.A.exists(this.label)&&u.A.exists(this.label.rendNode)&&"inherit"===this.label.evalVisProp("visible")&&this.label.setDisplayRendNode(t),this},hide:function(){return this.setAttribute({visible:!1}),this},hideElement:function(){return this.hide(),this},show:function(){return this.setAttribute({visible:!0}),this},showElement:function(){return this.show(),this},updateVisibility:function(t){var e,i,s,r,o,n;if(this.needsUpdate){if(u.A.exists(this.view)&&!1===this.view.evalVisProp("visible"))this.visPropCalc.visible=!1;else for(void 0!==t?this.visPropCalc.visible=t:(n=this.evalVisProp("visible"),u.A.exists(this.hiddenByParent)&&this.hiddenByParent&&(n=!1),"inherit"!==n&&(this.visPropCalc.visible=n)),i=this.inherits.length,s=0;s<i;s++)if(o=this.inherits[s],u.A.isArray(o))for(r=o.length,e=0;e<r;e++)u.A.exists(o[e])&&"inherit"===o[e].evalVisProp("visible")&&o[e].prepareUpdate().updateVisibility(this.visPropCalc.visible);else u.A.exists(o)&&"inherit"===o.evalVisProp("visible")&&o.prepareUpdate().updateVisibility(this.visPropCalc.visible);u.A.exists(this.label)&&u.A.exists(this.label.visProp)&&this.label.evalVisProp("visible")&&this.label.prepareUpdate().updateVisibility(this.visPropCalc.visible)}return this},_set:function(t,e){var i;if(t=t.toLocaleLowerCase(),this.visProp.hasOwnProperty(t)&&t.indexOf("color")>=0&&u.A.isString(e)&&9===e.length&&"#"===e.charAt(0))e=c.A.rgba2rgbo(e),this.visProp[t]=e[0],this.visProp[t.replace("color","opacity")]=e[1];else if(null===e||!u.A.isObject(e)||u.A.exists(e.id)||u.A.exists(e.name))this.visProp[t]=e;else for(i in this.visProp[t]={},e)e.hasOwnProperty(i)&&(this.visProp[t][i.toLocaleLowerCase()]=e[i])},resolveShortcuts:function(t){var e,i,s,r=["traceattributes","traceAttributes"];for(e in h.A.shortcuts)if(h.A.shortcuts.hasOwnProperty(e)){if(u.A.exists(t[e]))for(i=0;i<h.A.shortcuts[e].length;i++)u.A.exists(t[h.A.shortcuts[e][i]])||(t[h.A.shortcuts[e][i]]=t[e]);for(s=0;s<r.length;s++)u.A.isObject(t[r[s]])&&(t[r[s]]=this.resolveShortcuts(t[r[s]]))}return t},setLabel:function(t){this.hasLabel||this.setAttribute({withlabel:!0}),this.setLabelText(t)},setLabelText:function(t){return u.A.exists(this.label)&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),this.label.setText(t)),this},setName:function(t){t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){s.A.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(t){var e,i,o,n,a,l,d,p,f,_={};for(e=0;e<arguments.length;e++)l=arguments[e],u.A.isString(l)?(p=l.split(":"),_[u.A.trim(p[0])]=u.A.trim(p[1])):u.A.isArray(l)?_[l[0]]=l[1]:s.A.extend(_,l);for(e in _=this.resolveShortcuts(_))if(_.hasOwnProperty(e)){if(n=e.replace(/\s+/g,"").toLowerCase(),a=_[e],u.A.isObject(a)&&u.A.exists(this.visProp[n])){if(!u.A.isObject(this.visProp[n])&&null!==a&&u.A.isObject(a)&&(this.visProp[n]={}),u.A.mergeAttr(this.visProp[n],a),this.type===r.A.OBJECT_TYPE_TICKS&&u.A.exists(this.labels))for(o=this.labels.length,i=0;i<o;i++)this.labels[i].setAttribute(a);else if(u.A.exists(this[n]))if(u.A.isArray(this[n]))for(i=0;i<this[n].length;i++)this[n][i].setAttribute(a);else this[n].setAttribute(a);else f=null,this.triggerEventHandlers(["attribute:"+n],[f,a,this]);continue}switch(f=this.visProp[n],n){case"checked":u.A.exists(this.rendNodeTag)&&(this.rendNodeCheckbox.checked=!!a);break;case"disabled":u.A.exists(this.rendNodeTag)&&(this.rendNodeTag.disabled=!!a);break;case"face":u.A.isPoint(this)&&(this.visProp.face=a,this.board.renderer.changePointStyle(this));break;case"generatelabelvalue":this.type===r.A.OBJECT_TYPE_TICKS&&u.A.isFunction(a)&&(this.generateLabelValue=a);break;case"gradient":this.visProp.gradient=a,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":a=c.A.rgba2rgbo(a),this.visProp.gradientsecondcolor=a[0],this.visProp.gradientsecondopacity=a[1],this.board.renderer.updateGradient(this);break;case"gradientsecondopacity":this.visProp.gradientsecondopacity=a,this.board.renderer.updateGradient(this);break;case"infoboxtext":u.A.isString(a)?this.infoboxText=a:this.infoboxText=!1;break;case"labelcolor":d=(a=c.A.rgba2rgbo(a))[1],a=a[0],0===d&&u.A.exists(this.label)&&this.hasLabel&&this.label.hideElement(),u.A.exists(this.label)&&this.hasLabel&&(this.label.visProp.strokecolor=a,this.board.renderer.setObjectStrokeColor(this.label,a,d)),this.elementClass===r.A.OBJECT_CLASS_TEXT&&(this.visProp.strokecolor=a,this.visProp.strokeopacity=d,this.board.renderer.setObjectStrokeColor(this,a,d));break;case"layer":this.board.renderer.setLayer(this,this.eval(a)),this._set(n,a);break;case"maxlength":u.A.exists(this.rendNodeTag)&&(this.rendNodeTag.maxlength=!!a);break;case"name":f=this.name,delete this.board.elementsByName[this.name],this.name=a,this.board.elementsByName[this.name]=this;break;case"needsregularupdate":this.needsRegularUpdate=!("false"===a||!1===a),this.board.renderer.setBuffering(this,this.needsRegularUpdate?"auto":"static");break;case"onpolygon":this.type===r.A.OBJECT_TYPE_GLIDER&&(this.onPolygon=!!a);break;case"radius":this.type!==r.A.OBJECT_TYPE_ANGLE&&this.type!==r.A.OBJECT_TYPE_SECTOR||this.setRadius(a);break;case"rotate":(this.elementClass===r.A.OBJECT_CLASS_TEXT&&"internal"===this.evalVisProp("display")||this.type===r.A.OBJECT_TYPE_IMAGE)&&this.addRotation(a);break;case"tabindex":u.A.exists(this.rendNode)&&(this.rendNode.setAttribute("tabindex",a),this._set(n,a));break;case"trace":"false"===a||!1===a?(this.clearTrace(),this.visProp.trace=!1):this.visProp.trace="pause"!==a;break;case"visible":this.visProp.visible="false"!==a&&("true"===a||a),this.setDisplayRendNode(this.evalVisProp("visible")),this.evalVisProp("visible")&&u.A.exists(this.updateSize)&&this.updateSize();break;case"withlabel":this.visProp.withlabel=a,this.evalVisProp("withlabel")?(this.label||this.createLabel(),this.label.setAttribute({visible:"inherit"})):this.label&&this.hasLabel&&this.label.setAttribute({visible:!1}),this.hasLabel=a;break;case"straightfirst":case"straightlast":for(i in this._set(n,a),this.childElements)this.childElements.hasOwnProperty(i)&&"glider"===this.childElements[i].elType&&this.childElements[i].fullUpdate();break;default:u.A.exists(this.visProp[n])&&(!s.A.Validator[n]||s.A.Validator[n]&&s.A.Validator[n](a)||s.A.Validator[n]&&u.A.isFunction(a)&&s.A.Validator[n](a(this)))?(a=(!a.toLowerCase||"false"!==a.toLowerCase())&&a,this._set(n,a)):n in h.A.shortcuts||s.A.warn("attribute '"+n+"' does not accept type '"+typeof a+"' of value "+a+".")}this.triggerEventHandlers(["attribute:"+n],[f,a,this])}return this.triggerEventHandlers(["attribute"],[_,this]),this.evalVisProp("needsregularupdate")?this.board.update(this):this.board.fullUpdate(),this.elementClass===r.A.OBJECT_CLASS_TEXT&&this.updateSize(),this},getProperty:function(){s.A.deprecated("getProperty()","getAttribute()"),this.getProperty.apply(this,arguments)},getAttribute:function(t){var e;switch(t=t.toLowerCase()){case"needsregularupdate":e=this.needsRegularUpdate;break;case"labelcolor":e=this.label.visProp.strokecolor;break;case"infoboxtext":e=this.infoboxText;break;case"withlabel":e=this.hasLabel;break;default:e=this.visProp[t]}return e},evalVisProp:function(t){var e,i,r,o,n,a,h;if(-1===(t=t.toLowerCase()).indexOf("."))e=this.visProp[t];else for(o=(i=t.split(".")).length,e=this.visProp,r=0;r<o;r++)u.A.exists(e)&&(e=e[i[r]]);if(s.A.isFunction(e))return!0===this.visProp.islabel&&u.A.exists(this.visProp.anchor)?null!==this.visProp.anchor.visProp.element3d?e(this.visProp.anchor.visProp.element3d):e(this.visProp.anchor):s.A.exists(this.visProp.element3d)?e(this.visProp.element3d):e(this);if("inherit"===e)for(n in this.descendants)if(this.descendants.hasOwnProperty(n)){for(h=!1,o=(a=this.descendants[n]).inherits.length,r=0;r<o;r++)if(this.id===a.inherits[r].id){h=!0;break}if(h){e=a.evalVisProp(t);break}}return e},eval:function(t){return s.A.isFunction(t)?!0===this.visProp.islabel&&u.A.exists(this.visProp.anchor)?null!==this.visProp.anchor.visProp.element3d?t(this.visProp.anchor.visProp.element3d):t(this.visProp.anchor):null!==this.visProp.element3d?t(this.visProp.element3d):t(this):t},setDash:function(t){return this.setAttribute({dash:t}),this},prepareUpdate:function(){return this.needsUpdate=!0,this},remove:function(){return this.board.renderer.remove(this.rendNode),this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.id)),this},getTextAnchor:function(){return new o.A(r.A.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new o.A(r.A.COORDS_BY_USER,[0,0],this.board)},setArrow:function(t,e){return this.visProp.firstarrow=t,this.visProp.lastarrow=e,e&&(this.type=r.A.OBJECT_TYPE_VECTOR,this.elType="arrow"),this.prepareUpdate().update().updateVisibility().updateRenderer(),this},createGradient:function(){var t=this.evalVisProp("gradient");"linear"!==t&&"radial"!==t||this.board.renderer.setGradient(this)},createLabel:function(){var t,e=this;return s.A.elements.text?((t=u.A.deepCopy(this.visProp.label,null)).id=this.id+"Label",t.isLabel=!0,t.anchor=this,t.priv=this.visProp.priv,this.visProp.withlabel&&(this.label=s.A.elements.text(this.board,[0,0,function(){return u.A.isFunction(e.name)?e.name(e):e.name}],t),this.label.needsUpdate=!0,this.label.dump=!1,this.label.fullUpdate(),this.hasLabel=!0)):s.A.debug("JSXGraph: Can't create label: text element is not available. Make sure you include base/text"),this},highlight:function(t){return t=u.A.def(t,!1),!this.evalVisProp("highlight")||this.highlighted&&!t||(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this)),this},noHighlight:function(){return this.highlighted&&(this.highlighted=!1,delete this.board.highlightedObjects[this.id],this.board.renderer.noHighlight(this)),this},clearTrace:function(){var t;for(t in this.traces)this.traces.hasOwnProperty(t)&&this.board.renderer.remove(this.traces[t]);return this.numTraces=0,this},cloneToBackground:function(){return this},bounds:function(){return[0,0,0,0]},normalize:function(){return this.stdform=n.A.normalize(this.stdform),this},toJSON:function(){var t,e,i=['{"name":',this.name];for(e in i.push(', "id":'+this.id),t=[],this.visProp)this.visProp.hasOwnProperty(e)&&u.A.exists(this.visProp[e])&&t.push('"'+e+'":'+this.visProp[e]);return i.push(', "visProp":{'+t.toString()+"}"),i.push("}"),i.join("")},addRotation:function(t){var e,i,s,o,n,a=this;return this.elementClass!==r.A.OBJECT_CLASS_TEXT&&this.type!==r.A.OBJECT_TYPE_IMAGE||0===t||(e=this.board.create("transform",[function(){return-a.X()},function(){return-a.Y()}],{type:"translate"}),i=this.board.create("transform",[function(){return a.X()},function(){return a.Y()}],{type:"translate"}),s=this.board.create("transform",[function(){return a.board.unitX/a.board.unitY},function(){return 1}],{type:"scale"}),o=this.board.create("transform",[function(){return a.board.unitY/a.board.unitX},function(){return 1}],{type:"scale"}),n=this.board.create("transform",[function(){return a.eval(t)*Math.PI/180}],{type:"rotate"}),e.bindTo(this),s.bindTo(this),n.bindTo(this),o.bindTo(this),i.bindTo(this)),this},highlightStrokeColor:function(t){return s.A.deprecated("highlightStrokeColor()","setAttribute()"),this.setAttribute({highlightStrokeColor:t}),this},strokeColor:function(t){return s.A.deprecated("strokeColor()","setAttribute()"),this.setAttribute({strokeColor:t}),this},strokeWidth:function(t){return s.A.deprecated("strokeWidth()","setAttribute()"),this.setAttribute({strokeWidth:t}),this},fillColor:function(t){return s.A.deprecated("fillColor()","setAttribute()"),this.setAttribute({fillColor:t}),this},highlightFillColor:function(t){return s.A.deprecated("highlightFillColor()","setAttribute()"),this.setAttribute({highlightFillColor:t}),this},labelColor:function(t){return s.A.deprecated("labelColor()","setAttribute()"),this.setAttribute({labelColor:t}),this},dash:function(t){return s.A.deprecated("dash()","setAttribute()"),this.setAttribute({dash:t}),this},visible:function(t){return s.A.deprecated("visible()","setAttribute()"),this.setAttribute({visible:t}),this},shadow:function(t){return s.A.deprecated("shadow()","setAttribute()"),this.setAttribute({shadow:t}),this},getType:function(){return this.elType},getParents:function(){return u.A.isArray(this.parents)?this.parents:[]},snapToGrid:function(){return this},snapToPoints:function(){return this},getAttributes:function(){var t,e=u.A.deepCopy(this.visProp),i=[],s=i.length;for(e.id=this.id,e.name=this.name,t=0;t<s;t++)delete e[i[t]];return e},hasPoint:function(t,e){return!1},addTicks:function(t){return""!==t.id&&u.A.exists(t.id)||(t.id=this.id+"_ticks_"+(this.ticks.length+1)),this.board.renderer.drawTicks(t),this.ticks.push(t),t.id},removeAllTicks:function(){var t;if(u.A.exists(this.ticks)){for(t=this.ticks.length-1;t>=0;t--)this.removeTicks(this.ticks[t]);this.ticks=[],this.board.update()}},removeTicks:function(t){var e,i;if(u.A.exists(this.defaultTicks)&&this.defaultTicks===t&&(this.defaultTicks=null),u.A.exists(this.ticks))for(e=this.ticks.length-1;e>=0;e--)if(this.ticks[e]===t){if(this.board.removeObject(this.ticks[e]),this.ticks[e].ticks)for(i=0;i<this.ticks[e].ticks.length;i++)u.A.exists(this.ticks[e].labels[i])&&this.board.removeObject(this.ticks[e].labels[i]);delete this.ticks[e];break}},getSnapSizes:function(){var t,e,i;return t=this.evalVisProp("snapsizex"),e=this.evalVisProp("snapsizey"),t<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(t=(i=this.board.defaultAxes.x.defaultTicks).ticksDelta*(i.evalVisProp("minorticks")+1)),e<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(e=(i=this.board.defaultAxes.y.defaultTicks).ticksDelta*(i.evalVisProp("minorticks")+1)),[t,e]},handleSnapToGrid:function(t,e){var i,o,n,a,h,l,c,d,p,f,_,g=this.evalVisProp("attracttogrid"),A=this.evalVisProp("attractorunit"),m=this.evalVisProp("attractordistance");return!u.A.exists(this.coords)||this.evalVisProp("fixed")||(this.evalVisProp("snaptogrid")||g||!0===t)&&(i=this.coords.usrCoords[1],o=this.coords.usrCoords[2],f=(p=this.getSnapSizes())[0],_=p[1],f>0&&_>0&&(d=this.board.getBoundingBox(),n=Math.round(i/f)*f,a=Math.round(o/_)*_,h=new s.A.Coords(r.A.COORDS_BY_USER,[n,a],this.board),(!g||h.distance("screen"===A?r.A.COORDS_BY_SCREEN:r.A.COORDS_BY_USER,this.coords)<m)&&(i=n,o=a,e||(l=Math.min(d[0],d[2]),c=Math.max(d[0],d[2]),i<l&&i>l-f?i+=f:i>c&&i<c+f&&(i-=f),l=Math.min(d[1],d[3]),c=Math.max(d[1],d[3]),o<l&&o>l-_?o+=_:o>c&&o<c+_&&(o-=_)),this.coords.setCoordinates(r.A.COORDS_BY_USER,[i,o])))),this},getBoundingBox:function(){var t,e,i,s,o,n,a=[1/0,1/0,-1/0,-1/0];if(this.type===r.A.OBJECT_TYPE_POLYGON){if((e=this.vertices.length-1)<=0)return a;for(t=0;t<e;t++)i=this.vertices[t].X(),a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.vertices[t].Y(),a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3]}else if(this.elementClass===r.A.OBJECT_CLASS_CIRCLE)s=this.center.X(),o=this.center.Y(),a=[s-this.radius,o+this.radius,s+this.radius,o-this.radius];else if(this.elementClass===r.A.OBJECT_CLASS_CURVE){if(0===(e=this.points.length))return a;for(t=0;t<e;t++)i=this.points[t].usrCoords[1],a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.points[t].usrCoords[2],a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3]}else this.elementClass===r.A.OBJECT_CLASS_POINT?(s=this.X(),o=this.Y(),a=[s-(n=this.evalVisProp("size"))/this.board.unitX,o-n/this.board.unitY,s+n/this.board.unitX,o+n/this.board.unitY]):this.elementClass===r.A.OBJECT_CLASS_LINE&&(i=this.point1.coords.usrCoords[1],a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.point1.coords.usrCoords[2],a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3],i=this.point2.coords.usrCoords[1],a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.point2.coords.usrCoords[2],a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3]);return a},addEvent:s.A.shortcut(s.A.GeometryElement.prototype,"on"),removeEvent:s.A.shortcut(s.A.GeometryElement.prototype,"off"),formatNumberLocale:function(t,e){var i,s,r,o={},n={maximumfractiondigits:"maximumFractionDigits",minimumfractiondigits:"minimumFractionDigits",compactdisplay:"compactDisplay",currencydisplay:"currencyDisplay",currencysign:"currencySign",localematcher:"localeMatcher",numberingsystem:"numberingSystem",signdisplay:"signDisplay",unitdisplay:"unitDisplay",usegrouping:"useGrouping",roundingmode:"roundingMode",roundingpriority:"roundingPriority",roundingincrement:"roundingIncrement",trailingzerodisplay:"trailingZeroDisplay",minimumintegerdigits:"minimumIntegerDigits",minimumsignificantdigits:"minimumSignificantDigits",maximumsignificantdigits:"maximumSignificantDigits"};if(u.A.exists(Intl)&&this.useLocale()){for(r in i=this.evalVisProp("intl.locale")||this.eval(this.board.attr.intl.locale),s=this.evalVisProp("intl.options")||{})s.hasOwnProperty(r)&&(n.hasOwnProperty(r)?o[n[r]]=this.eval(s[r]):o[r]=this.eval(s[r]));return r="maximumfractiondigits",u.A.exists(s[r])||(o[n[r]]=e),Intl.NumberFormat(i,o).format(t)}return t},useLocale:function(){var t;return!(!u.A.exists(this.visProp.intl)||!u.A.exists(this.visProp.intl.enabled))&&(!0===(t=this.evalVisProp("intl.enabled"))||"inherit"===t&&!0===this.eval(this.board.attr.intl.enabled))},__evt__over:function(t){},__evt__mouseover:function(t){},__evt__out:function(t){},__evt__mouseout:function(t){},__evt__move:function(t){},__evt__mousemove:function(t){},__evt__drag:function(t){},__evt__mousedrag:function(t){},__evt__pendrag:function(t){},__evt__touchdrag:function(t){},__evt__keydrag:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__touchdown:function(t){},__evt__click:function(t){},__evt__dblclick:function(t){},__evt__mouseclick:function(t){},__evt__mousedblclick:function(t){},__evt__pointerclick:function(t){},__evt__pointerdblclick:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__penup:function(t){},__evt__touchup:function(t){},__evt__attribute:function(t,e){},__evt__attribute_:function(t,e,i){},__evt:function(){}}),e.A=s.A.GeometryElement},171:function(t,e,i){var s=i(443),r=i(188),o=i(133),n=i(477),a={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};n.A.Numerics={Gauss:function(t,e){var i,s,o,a,h,l=n.A.eps,c=t.length>0?t[0].length:0;if(c!==e.length||c!==t.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(a=[],h=e.slice(0,c),i=0;i<c;i++)a[i]=t[i].slice(0,c);for(s=0;s<c;s++){for(i=c-1;i>s;i--)if(Math.abs(a[i][s])>l)if(Math.abs(a[s][s])<l)r.A.swap(a,i,s),r.A.swap(h,i,s);else for(a[i][s]/=a[s][s],h[i]-=a[i][s]*h[s],o=s+1;o<c;o++)a[i][o]-=a[i][s]*a[s][o];if(Math.abs(a[s][s])<l)throw new Error("JXG.Math.Numerics.Gauss(): The given matrix seems to be singular.")}return this.backwardSolve(a,h,!0),h},backwardSolve:function(t,e,i){var s,r,o,n,a;for(s=i?e:e.slice(0,e.length),r=t.length,o=t.length>0?t[0].length:0,n=r-1;n>=0;n--){for(a=o-1;a>n;a--)s[n]-=t[n][a]*s[a];s[n]/=t[n][n]}return s},gaussBareiss:function(t){var e,i,s,r,o,a,h,l,c,u=n.A.eps;if((h=t.length)<=0)return 0;for(t[0].length<h&&(h=t[0].length),l=[],r=0;r<h;r++)l[r]=t[r].slice(0,h);for(i=1,s=1,e=0;e<h-1;e++){if(a=l[e][e],Math.abs(a)<u){for(r=e+1;r<h&&!(Math.abs(l[r][e])>=u);r++);if(r===h)return 0;for(o=e;o<h;o++)c=l[r][o],l[r][o]=l[e][o],l[e][o]=c;s=-s,a=l[e][e]}for(r=e+1;r<h;r++)for(o=e+1;o<h;o++)c=a*l[r][o]-l[r][e]*l[e][o],l[r][o]=c/i;i=a}return s*l[h-1][h-1]},det:function(t){return 2===t.length&&2===t[0].length?t[0][0]*t[1][1]-t[1][0]*t[0][1]:this.gaussBareiss(t)},Jacobi:function(t){var e,i,s,r,o,a,h,l,c,u=n.A.eps*n.A.eps,d=0,p=t.length,f=[[0,0,0],[0,0,0],[0,0,0]],_=[[0,0,0],[0,0,0],[0,0,0]],g=0;for(e=0;e<p;e++){for(i=0;i<p;i++)f[e][i]=0,_[e][i]=t[e][i],d+=Math.abs(_[e][i]);f[e][e]=1}if(1===p)return[_,f];if(d<=0)return[_,f];d/=p*p;do{for(l=0,c=0,i=1;i<p;i++)for(e=0;e<i;e++)if((r=Math.abs(_[e][i]))>c&&(c=r),l+=r,r>=u){for(r=.5*Math.atan2(2*_[e][i],_[e][e]-_[i][i]),o=Math.sin(r),a=Math.cos(r),s=0;s<p;s++)h=_[s][e],_[s][e]=a*h+o*_[s][i],_[s][i]=-o*h+a*_[s][i],h=f[s][e],f[s][e]=a*h+o*f[s][i],f[s][i]=-o*h+a*f[s][i];for(_[e][e]=a*_[e][e]+o*_[i][e],_[i][i]=-o*_[e][i]+a*_[i][i],_[e][i]=0,s=0;s<p;s++)_[e][s]=_[s][e],_[i][s]=_[s][i]}g+=1}while(Math.abs(l)/d>u&&g<2e3);return[_,f]},NewtonCotes:function(t,e,i){var s,o,n,a=0,h=i&&r.A.isNumber(i.number_of_nodes)?i.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},c=i&&i.integration_type&&l.hasOwnProperty(i.integration_type)&&l[i.integration_type]?i.integration_type:"milne",u=(t[1]-t[0])/h;switch(c){case"trapez":for(a=.5*(e(t[0])+e(t[1])),s=t[0],o=0;o<h-1;o++)a+=e(s+=u);a*=u;break;case"simpson":if(h%2>0)throw new Error("JSXGraph:  INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(n=h/2,a=e(t[0])+e(t[1]),s=t[0],o=0;o<n-1;o++)a+=2*e(s+=2*u);for(s=t[0]-u,o=0;o<n;o++)a+=4*e(s+=2*u);a*=u/3;break;default:if(h%4>0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(n=.25*h,a=7*(e(t[0])+e(t[1])),s=t[0],o=0;o<n-1;o++)a+=14*e(s+=4*u);for(s=t[0]-3*u,o=0;o<n;o++)a+=32*(e(s+=4*u)+e(s+2*u));for(s=t[0]-2*u,o=0;o<n;o++)a+=12*e(s+=4*u);a*=2*u/45}return a},Romberg:function(t,e,i){var s,o,n,a,h,l,c,u,d=[],p=0,f=1/0,_=i&&r.A.isNumber(i.max_iterations)?i.max_iterations:20,g=i&&r.A.isNumber(i.eps)?i.eps:i.eps||1e-7;for(s=t[0],n=(o=t[1])-s,h=1,d[0]=.5*n*(e(s)+e(o)),l=0;l<_;++l){for(a=0,n*=.5,h*=2,u=1,c=1;c<h;c+=2)a+=e(s+c*n);for(d[l+1]=.5*d[l]+a*n,p=d[l+1],c=l-1;c>=0;--c)u*=4,d[c]=d[c+1]+(d[c+1]-d[c])/(u-1),p=d[c];if(Math.abs(p-f)<g*Math.abs(p))break;f=p}return p},GaussLegendre:function(t,e,i){var s,o,n,a,h,l,c,u,d=0,p=[],f=[],_=i&&r.A.isNumber(i.n)?i.n:12;if(_>18&&(_=18),p[2]=[.5773502691896257],f[2]=[1],p[4]=[.33998104358485626,.8611363115940526],f[4]=[.6521451548625461,.34785484513745385],p[6]=[.2386191860831969,.6612093864662645,.932469514203152],f[6]=[.46791393457269104,.3607615730481386,.17132449237917036],p[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],f[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],p[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],f[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],p[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],f[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],p[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],f[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],p[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],f[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],p[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],f[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],p[3]=[0,.7745966692414834],f[3]=[.8888888888888888,.5555555555555556],p[5]=[0,.5384693101056831,.906179845938664],f[5]=[.5688888888888889,.47862867049936647,.23692688505618908],p[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],f[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],p[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],f[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],p[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],f[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],p[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],f[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],p[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],f[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],p[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],f[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],s=t[0],o=t[1],a=_+1>>1,c=p[_],u=f[_],l=.5*(o-s),h=.5*(o+s),!0&_)for(d=u[0]*e(h),n=1;n<a;++n)d+=u[n]*(e(h+l*c[n])+e(h-l*c[n]));else for(d=0,n=0;n<a;++n)d+=u[n]*(e(h+l*c[n])+e(h-l*c[n]));return l*d},_rescale_error:function(t,e,i){var s,r,o=2220446049250313e-31;return t=Math.abs(t),0!==i&&0!==t&&(t=(s=Math.pow(200*t/i,1.5))<1?i*s:i),e>20041683600089728e-310&&(r=50*o*e)>t&&(t=r),t},_gaussKronrod:function(t,e,i,s,r,o,n){var a,h,l,c,u,d,p,f,_,g,A,m=t[0],b=t[1],y=.5*(m+b),v=.5*(b-m),C=Math.abs(v),P=e(y),x=0,E=P*o[i-1],O=Math.abs(E),M=0,w=[],S=[];for(i%2==0&&(x=P*r[i/2-1]),a=Math.floor((i-1)/2),u=0;u<a;u++)A=(_=e(y-(f=v*s[d=2*u+1])))+(g=e(y+f)),w[d]=_,S[d]=g,x+=r[u]*A,E+=o[d]*A,O+=o[d]*(Math.abs(_)+Math.abs(g));for(a=Math.floor(i/2),u=0;u<a;u++)_=e(y-(f=v*s[p=2*u])),g=e(y+f),w[p]=_,S[p]=g,E+=o[p]*(_+g),O+=o[p]*(Math.abs(_)+Math.abs(g));for(l=.5*E,M=o[i-1]*Math.abs(P-l),u=0;u<i-1;u++)M+=o[u]*(Math.abs(w[u]-l)+Math.abs(S[u]-l));return c=(E-x)*v,O*=C,M*=C,h=E*=v,n.abserr=this._rescale_error(c,O,M),n.resabs=O,n.resasc=M,h},GaussKronrod15:function(t,e,i){return this._gaussKronrod(t,e,8,[.9914553711208126,.9491079123427585,.8648644233597691,.7415311855993945,.5860872354676911,.4058451513773972,.20778495500789848,0],[.1294849661688697,.27970539148927664,.3818300505051189,.4179591836734694],[.022935322010529224,.06309209262997856,.10479001032225019,.14065325971552592,.1690047266392679,.19035057806478542,.20443294007529889,.20948214108472782],i)},GaussKronrod21:function(t,e,i){return this._gaussKronrod(t,e,11,[.9956571630258081,.9739065285171717,.9301574913557082,.8650633666889845,.7808177265864169,.6794095682990244,.5627571346686047,.4333953941292472,.2943928627014602,.14887433898163122,0],[.06667134430868814,.1494513491505806,.21908636251598204,.26926671930999635,.29552422471475287],[.011694638867371874,.032558162307964725,.054755896574351995,.07503967481091996,.0931254545836976,.10938715880229764,.12349197626206584,.13470921731147334,.14277593857706009,.14773910490133849,.1494455540029169],i)},GaussKronrod31:function(t,e,i){return this._gaussKronrod(t,e,16,[.9980022986933971,.9879925180204854,.9677390756791391,.937273392400706,.8972645323440819,.8482065834104272,.790418501442466,.7244177313601701,.650996741297417,.5709721726085388,.4850818636402397,.3941513470775634,.29918000715316884,.20119409399743451,.1011420669187175,0],[.03075324199611727,.07036604748810812,.10715922046717194,.13957067792615432,.16626920581699392,.1861610000155622,.19843148532711158,.2025782419255613],[.005377479872923349,.015007947329316122,.02546084732671532,.03534636079137585,.04458975132476488,.05348152469092809,.06200956780067064,.06985412131872826,.07684968075772038,.08308050282313302,.08856444305621176,.09312659817082532,.09664272698362368,.09917359872179196,.10076984552387559,.10133000701479154],i)},_workspace:function(t,e){return{limit:e,size:0,nrmax:0,i:0,alist:[t[0]],blist:[t[1]],rlist:[0],elist:[0],order:[0],level:[0],qpsrt:function(){var t,e,i,s,r,o=this.size-1,n=this.limit,a=this.nrmax,h=this.order[a];if(o<2)return this.order[0]=0,this.order[1]=1,void(this.i=h);for(t=this.elist[h];a>0&&t>this.elist[this.order[a-1]];)this.order[a]=this.order[a-1],a--;for(r=o<n/2+2?o:n-o+1,i=a+1;i<r&&t<this.elist[this.order[i]];)this.order[i-1]=this.order[i],i++;for(this.order[i-1]=h,e=this.elist[o],s=r-1;s>i-2&&e>=this.elist[this.order[s]];)this.order[s+1]=this.order[s],s--;this.order[s+1]=o,h=this.order[a],this.i=h,this.nrmax=a},set_initial_result:function(t,e){this.size=1,this.rlist[0]=t,this.elist[0]=e},update:function(t,e,i,s,r,o,n,a){var h=this.i,l=this.size,c=this.level[this.i]+1;a>s?(this.alist[h]=r,this.rlist[h]=n,this.elist[h]=a,this.level[h]=c,this.alist[l]=t,this.blist[l]=e,this.rlist[l]=i,this.elist[l]=s,this.level[l]=c):(this.blist[h]=e,this.rlist[h]=i,this.elist[h]=s,this.level[h]=c,this.alist[l]=r,this.blist[l]=o,this.rlist[l]=n,this.elist[l]=a,this.level[l]=c),this.size++,c>this.maximum_level&&(this.maximum_level=c),this.qpsrt()},retrieve:function(){var t=this.i;return{a:this.alist[t],b:this.blist[t],r:this.rlist[t],e:this.elist[t]}},sum_results:function(){var t,e=this.size,i=0;for(t=0;t<e;t++)i+=this.rlist[t];return i},subinterval_too_small:function(t,e,i){var s=1.0000000000000222*(Math.abs(e)+22250738585072014e-321);return Math.abs(t)<=s&&Math.abs(i)<=s}}},Qag:function(t,e,i){var o,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x=this._workspace(t,1e3),E=i&&r.A.isNumber(i.limit)?i.limit:15,O=i&&r.A.isNumber(i.epsrel)?i.epsrel:1e-7,M=i&&r.A.isNumber(i.epsabs)?i.epsabs:1e-7,w=i&&r.A.isFunction(i.q)?i.q:this.GaussKronrod15,S={},T=0,N=0,j=0,D=0,k=0,R=0,L=0,B=0,I=0,Y=0;if(E>x.limit&&s.A.warn("iteration limit exceeds available workspace"),M<=0&&(O<50*n.A.eps||O<5e-29)&&s.A.warn("tolerance cannot be acheived with given epsabs and epsrel"),h=w.apply(this,[t,e,S]),l=S.abserr,c=S.resabs,u=S.resasc,x.set_initial_result(h,l),d=Math.max(M,O*Math.abs(h)),l<=11102230246251565e-30*c&&l>d)return s.A.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(l<=d&&l!==u||0===l)return h;if(1===E)return s.A.warn("a maximum of one iteration was insufficient"),-1/0;o=h,a=l,T=1;do{k=0,R=0,L=0,B=0,I=0,Y=0,A=(C=x.retrieve()).a,m=C.b,b=C.r,y=C.e,p=A,_=f=.5*(A+m),g=m,k=w.apply(this,[[p,f],e,S]),B=S.abserr,v=S.resasc,R=w.apply(this,[[_,g],e,S]),a+=(Y=B+(I=S.abserr))-y,o+=(L=k+R)-b,v!==B&&S.resasc!==I&&(P=b-L,Math.abs(P)<=1e-5*Math.abs(L)&&Y>=.99*y&&N++,T>=10&&Y>y&&j++),a>(d=Math.max(M,O*Math.abs(o)))&&((N>=6||j>=20)&&(D=2),x.subinterval_too_small(p,_,g)&&(D=3)),x.update(p,f,k,B,_,g,R,I),A=(C=x.retrieve()).a_i,m=C.b_i,b=C.r_i,y=C.e_i,T++}while(T<E&&!D&&a>d);return x.sum_results()},I:function(t,e){return this.Qag(t,e,{q:this.GaussKronrod15,limit:15,epsrel:1e-7,epsabs:1e-7})},Newton:function(t,e,i){var s,o=0,a=n.A.eps,h=t.apply(i,[e]);for(r.A.isArray(e)&&(e=e[0]);o<50&&Math.abs(h)>a;)s=this.D(t,i)(e),Math.abs(s)>a?e-=h/s:e+=.2*Math.random()-1,h=t.apply(i,[e]),o+=1;return e},root:function(t,e,i){return this.chandrupatla(t,e,i)},generalizedNewton:function(t,e,i,s){var r,o,a,h,l,c,u,d,p,f,_,g,A,m,b=0;for(r=i,o=s,f=(u=t.X(r)-e.X(o))*u+(d=t.Y(r)-e.Y(o))*d,_=this.D(t.X,t),g=this.D(e.X,e),A=this.D(t.Y,t),m=this.D(e.Y,e);f>n.A.eps&&b<10;)a=_(r),h=-g(o),l=A(r),r-=((c=-m(o))*u-h*d)/(p=a*c-h*l),o-=(a*d-l*u)/p,f=(u=t.X(r)-e.X(o))*u+(d=t.Y(r)-e.Y(o))*d,b+=1;return Math.abs(r)<Math.abs(o)?[t.X(r),t.Y(r)]:[e.X(o),e.Y(o)]},generalizedDampedNewtonCurves:function(t,e,i,s,r,o){var a,h,l,c,u,d,p,f,_,g,A,m,b,y,v=0;for(a=i,h=s,A=t.Ft(a),m=e.Ft(h),g=(p=A[1]-m[1])*p+(f=A[2]-m[2])*f,b=function(i,s){var r=n.A.eps,o=t.Ft(i-r),a=t.Ft(i+r),h=e.Ft(s-r),l=e.Ft(s+r);return[[(a[1]-o[1])/(2*r),-(l[1]-h[1])/(2*r)],[(a[2]-o[2])/(2*r),-(l[2]-h[2])/(2*r)]]};g>o&&v<40;)l=(y=b(a,h))[0][0],c=y[0][1],u=y[1][0],a-=r*((d=y[1][1])*p-c*f)/(_=l*d-c*u),h-=r*(l*f-u*p)/_,A=t.Ft(a),m=e.Ft(h),g=(p=A[1]-m[1])*p+(f=A[2]-m[2])*f,v+=1;return[a,h,g]},generalizedDampedNewton:function(t,e,i,s,r,o,a){var h,l,c,u,d,p,f,_,g,A,m,b,y=[],v=0;if(a=a||40,g=t(y=s.slice(0,i),i),2===i){for(m=(p=(g=t(y,i))[0])*p+(f=g[1])*f;m>o&&v<a;)l=(A=e(y,i))[0][0],c=A[0][1],u=A[1][0],_=l*(d=A[1][1])-c*u,y[0]-=r*(d*p-c*f)/_,y[1]-=r*(l*f-u*p)/_,m=(p=(g=t(y,i))[0])*p+(f=g[1])*f,v+=1;return[y,m]}for(g=t(y,i),m=n.A.innerProduct(g,g,i);m>o&&v<a;){for(A=n.A.inverse(e(y,i)),b=n.A.matVecMult(A,g),h=0;h<i;h++)y[h]-=r*b[h];g=t(y,i),m=n.A.innerProduct(g,g,i),v+=1}return[y,m]},Neville:function(t){var e=[],i=function(i){return function(s,r){var o,a,h,l=n.A.binomial,c=t.length,u=c-1,d=0,p=0;if(!r)for(h=1,o=0;o<c;o++)e[o]=l(u,o)*h,h*=-1;for(a=s,o=0;o<c;o++){if(0===a)return t[o][i]();h=e[o]/a,a-=1,d+=t[o][i]()*h,p+=h}return d/p}};return[i("X"),i("Y"),0,function(){return t.length-1}]},splineDef:function(t,e){var i,s,r,o=Math.min(t.length,e.length),n=[],a=[],h=[],l=[],c=[],u=[];if(2===o)return[0,0];for(s=0;s<o;s++)i={X:t[s],Y:e[s]},h.push(i);for(h.sort(function(t,e){return t.X-e.X}),s=0;s<o;s++)t[s]=h[s].X,e[s]=h[s].Y;for(s=0;s<o-1;s++)l.push(t[s+1]-t[s]);for(s=0;s<o-2;s++)c.push(6*(e[s+2]-e[s+1])/l[s+1]-6*(e[s+1]-e[s])/l[s]);for(n.push(2*(l[0]+l[1])),a.push(c[0]),s=0;s<o-3;s++)r=l[s+1]/n[s],n.push(2*(l[s+1]+l[s+2])-r*l[s+1]),a.push(c[s+1]-r*a[s]);for(u[o-3]=a[o-3]/n[o-3],s=o-4;s>=0;s--)u[s]=(a[s]-l[s+1]*u[s+1])/n[s];for(s=o-3;s>=0;s--)u[s+1]=u[s];return u[0]=0,u[o-1]=0,u},splineEval:function(t,e,i,s){var o,n,a,h,l,c,u,d=Math.min(e.length,i.length),p=1,f=!1,_=[];for(r.A.isArray(t)?(p=t.length,f=!0):t=[t],o=0;o<p;o++){if(t[o]<e[0]||e[o]>e[d-1])return NaN;for(n=1;n<d&&!(t[o]<=e[n]);n++);a=i[n-=1],h=(i[n+1]-i[n])/(e[n+1]-e[n])-(e[n+1]-e[n])/6*(s[n+1]+2*s[n]),l=s[n]/2,c=(s[n+1]-s[n])/(6*(e[n+1]-e[n])),u=t[o]-e[n],_.push(a+(h+(l+c*u)*u)*u)}return f?_:_[0]},generatePolynomialTerm:function(t,e,i,s){var o,n=[];for(o=e;o>=0;o--)r.A.concat(n,["(",t[o].toPrecision(s),")"]),o>1?r.A.concat(n,["*",i,"<sup>",o,"<","/sup> + "]):1===o&&r.A.concat(n,["*",i," + "]);return n.join("")},lagrangePolynomial:function(t){var e=[],i=this,s=function(i,s){var r,o,n,a,h=t.length,l=0,c=0;if(!s)for(r=0;r<h;r++){for(e[r]=1,n=t[r].X(),o=0;o<h;o++)o!==r&&(e[r]*=n-t[o].X());e[r]=1/e[r]}for(r=0;r<h;r++){if(i===(n=t[r].X()))return t[r].Y();c+=a=e[r]/(i-n),l+=a*t[r].Y()}return l/c};return s.getTerm=function(e,s,r){return i.lagrangePolynomialTerm(t,e,s,r)()},s.getCoefficients=function(){return i.lagrangePolynomialCoefficients(t)()},s},lagrangePolynomialTerm:function(t,e,i,r){var a=this;return function(){var h,l,c,u,d,p=t.length,f=!0;for(i=i||"x",void 0===r&&(r=" * "),l=p-1,h=a.lagrangePolynomialCoefficients(t)(),c="",u=0;u<h.length;u++)d=h[u],Math.abs(d)<n.A.eps||(s.A.exists(e)&&(d=o.A._round10(d,-e)),f?(c+=d>0?d:"-"+-d,f=!1):c+=d>0?" + "+d:" - "+-d,l-u>1?c+=r+i+"^"+(l-u):l-u===1&&(c+=r+i));return c}},lagrangePolynomialCoefficients:function(t){return function(){var e,i,s,r,o=t.length,a=[],h=[],l=[];for(i=0;i<o;i++)l[i]=0;for(e=0;e<o;e++){for(s=t[e].Y(),r=t[e].X(),a=[],i=0;i<o;i++)i!==e&&(s/=r-t[i].X(),a.push(t[i].X()));for(h=[1].concat(n.A.Vieta(a)),i=0;i<h.length;i++)l[i]+=(i%2==1?-1:1)*h[i]*s}return l}},_initCubicPoly:function(t,e,i,s){return[t,i,-3*t+3*e-2*i-s,2*t-2*e+i+s]},CardinalSpline:function(t,e,i){var s,o,a,h,l=[],c=this;return h=r.A.isFunction(e)?e:function(){return e},void 0===i&&(i="uniform"),o=function(e){return function(r,o){var u,d,p,f,_,g,A,m,b,y;if(t.length<2)return NaN;if(!o)for(a=h(),p={X:function(){return 2*t[0].X()-t[1].X()},Y:function(){return 2*t[0].Y()-t[1].Y()},Dist:function(t){var e=this.X()-t.X(),i=this.Y()-t.Y();return n.A.hypot(e,i)}},f={X:function(){return 2*t[t.length-1].X()-t[t.length-2].X()},Y:function(){return 2*t[t.length-1].Y()-t[t.length-2].Y()},Dist:function(t){var e=this.X()-t.X(),i=this.Y()-t.Y();return n.A.hypot(e,i)}},y=(s=[p].concat(t,[f])).length,l[e]=[],u=0;u<y-3;u++)"centripetal"===i?(A=s[u].Dist(s[u+1]),m=s[u+2].Dist(s[u+1]),b=s[u+3].Dist(s[u+2]),A=Math.sqrt(A),m=Math.sqrt(m),b=Math.sqrt(b),m<n.A.eps&&(m=1),A<n.A.eps&&(A=m),b<n.A.eps&&(b=m),_=(s[u+1][e]()-s[u][e]())/A-(s[u+2][e]()-s[u][e]())/(m+A)+(s[u+2][e]()-s[u+1][e]())/m,g=(s[u+2][e]()-s[u+1][e]())/m-(s[u+3][e]()-s[u+1][e]())/(b+m)+(s[u+3][e]()-s[u+2][e]())/b,_*=m,g*=m,l[e][u]=c._initCubicPoly(s[u+1][e](),s[u+2][e](),a*_,a*g)):l[e][u]=c._initCubicPoly(s[u+1][e](),s[u+2][e](),a*(s[u+2][e]()-s[u][e]()),a*(s[u+3][e]()-s[u+1][e]()));return isNaN(r)?NaN:(y=t.length,r<=0?t[0][e]():r>=y?t[y-1][e]():(u=Math.floor(r))===r?t[u][e]():(r-=u,void 0===(d=l[e][u])?NaN:((d[3]*r+d[2])*r+d[1])*r+d[0]))}},[o("X"),o("Y"),0,function(){return t.length-1}]},CatmullRomSpline:function(t,e){return this.CardinalSpline(t,.5,e)},regressionPolynomial:function(t,e,i){var s,o,a,h,l,c,u="";if(r.A.isPoint(t)&&r.A.isFunction(t.Value))o=function(){return t.Value()};else if(r.A.isFunction(t))o=t;else{if(!r.A.isNumber(t))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof t+"'.");o=function(){return t}}if(3===arguments.length&&r.A.isArray(e)&&r.A.isArray(i))l=0;else if(2===arguments.length&&r.A.isArray(e)&&e.length>0&&r.A.isPoint(e[0]))l=1;else{if(!(2===arguments.length&&r.A.isArray(e)&&e.length>0&&e[0].usrCoords&&e[0].scrCoords))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");l=2}return(c=function(t,c){var d,p,f,_,g,A,m,b,y,v=e.length;if(y=Math.floor(o()),!c){if(1===l)for(a=[],h=[],d=0;d<v;d++)a[d]=e[d].X(),h[d]=e[d].Y();if(2===l)for(a=[],h=[],d=0;d<v;d++)a[d]=e[d].usrCoords[1],h[d]=e[d].usrCoords[2];if(0===l)for(a=[],h=[],d=0;d<v;d++)r.A.isFunction(e[d])?a.push(e[d]()):a.push(e[d]),r.A.isFunction(i[d])?h.push(i[d]()):h.push(i[d]);for(f=[],p=0;p<v;p++)f.push([1]);for(d=1;d<=y;d++)for(p=0;p<v;p++)f[p][d]=f[p][d-1]*a[p];g=h,_=n.A.transpose(f),A=n.A.matMatMult(_,f),m=n.A.matVecMult(_,g),s=n.A.Numerics.Gauss(A,m),u=n.A.Numerics.generatePolynomialTerm(s,y,"x",3)}for(b=s[y],d=y-1;d>=0;d--)b=b*t+s[d];return b}).getTerm=function(){return u},c},bezier:function(t){var e,i,s=function(s){return function(r,o){var n=3*Math.floor(r),a=r%1,h=1-a;return o||(i=3*Math.floor((t.length-1)/3),e=Math.floor(i/3)),r<0?t[0][s]():r>=e?t[i][s]():isNaN(r)?NaN:h*h*(h*t[n][s]()+3*a*t[n+1][s]())+(3*h*t[n+2][s]()+a*t[n+3][s]())*a*a}};return[s("X"),s("Y"),0,function(){return Math.floor(t.length/3)}]},bspline:function(t,e){var i,s=function(s){return function(r,o){var n,a,h,l,c=t.length,u=c-1,d=e;if(u<=0)return NaN;if(u+2<=d&&(d=u+1),r<=0)return t[0][s]();if(r>=u-d+2)return t[u][s]();for(h=Math.floor(r)+d-1,i=function(t,e){var i,s=[];for(i=0;i<t+e+1;i++)s[i]=i<e?0:i<=t?i-e+1:t-e+2;return s}(u,d),l=function(t,e,i,s){var r,o,n,a,h,l=[];for(e[s]<=t&&t<e[s+1]?l[s]=1:l[s]=0,r=2;r<=i;r++)for(o=s-r+1;o<=s;o++)n=o<=s-r+1||o<0?0:l[o],a=o>=s?0:l[o+1],h=e[o+r-1]-e[o],l[o]=0===h?0:(t-e[o])/h*n,0!==(h=e[o+r]-e[o+1])&&(l[o]+=(e[o+r]-t)/h*a);return l}(r,i,d,h),n=0,a=h-d+1;a<=h;a++)a<c&&a>=0&&(n+=t[a][s]()*l[a]);return n}};return[s("X"),s("Y"),0,function(){return t.length-1}]},D:function(t,e){return r.A.exists(e)?function(i,s){var r=1e-5;return(t.apply(e,[i+r,s])-t.apply(e,[i-r,s]))/2e-5}:function(e,i){var s=1e-5;return(t(e+s,i)-t(e-s,i))/2e-5}},_riemannValue:function(t,e,i,s){var r,o,n,a;if(s<0&&("trapezoidal"!==i&&(t+=s),s*=-1,"lower"===i?i="upper":"upper"===i&&(i="lower")),a=.01*s,"right"===i)r=e(t+s);else if("middle"===i)r=e(t+.5*s);else if("left"===i||"trapezoidal"===i)r=e(t);else if("lower"===i){for(r=e(t),n=t+a;n<=t+s;n+=a)(o=e(n))<r&&(r=o);(o=e(t+s))<r&&(r=o)}else if("upper"===i){for(r=e(t),n=t+a;n<=t+s;n+=a)(o=e(n))>r&&(r=o);(o=e(t+s))>r&&(r=o)}else r="random"===i?e(t+s*Math.random()):"simpson"===i?(e(t)+4*e(t+.5*s)+e(t+s))/6:e(t);return r},riemann:function(t,e,i,s,o){var n,a,h,l,c,u,d,p,f,_,g,A,m,b,y=[],v=[],C=s,P=0;if(r.A.isArray(t)?(b=t[0],m=t[1]):m=t,(e=Math.floor(e))<=0)return[y,v,P];for(a=(o-s)/e,n=0;n<e;n++){if("simpson"===i){for(P+=this._riemannValue(C,m,i,a)*a,g=.5*a,d=m(C),p=m(C+g),l=((f=m(C+2*g))+d-2*p)/(g*g)*.5,c=(f-d)/(2*g),u=p,h=0;h<30;h++)_=h*a/30-g,y.push(C+_+g),v.push(l*_*_+c*_+u);C+=a,A=f}else A=this._riemannValue(C,m,i,a),y.push(C),v.push(A),C+=a,"trapezoidal"===i?(P+=.5*(A+(f=m(C)))*a,A=f):P+=A*a,y.push(C),v.push(A);y.push(C),v.push(A)}for(n=0;n<e;n++){if("simpson"===i&&b){for(P-=this._riemannValue(C,b,i,-a)*a,g=.5*a,d=b(C),p=b(C-g),l=((f=b(C-2*g))+d-2*p)/(g*g)*.5,c=(f-d)/(2*g),u=p,h=0;h<30;h++)_=h*a/30-g,y.push(C-_-g),v.push(l*_*_+c*_+u);C-=a,A=f}else A=b?this._riemannValue(C,b,i,-a):0,y.push(C),v.push(A),C-=a,b&&("trapezoidal"===i?(P-=.5*(A+(f=b(C)))*a,A=f):P-=A*a);y.push(C),v.push(A),y.push(C),v.push(m(C))}return[y,v,P]},riemannsum:function(t,e,i,r,o){return s.A.deprecated("Numerics.riemannsum()","Numerics.riemann()[2]"),this.riemann(t,e,i,r,o)[2]},rungeKutta:function(t,e,i,s,o){var n,h,l,c,u,d,p=[],f=[],_=(i[1]-i[0])/s,g=i[0],A=e.length,m=[],b=0;for(r.A.isString(t)&&(t=a[t]||a.euler),d=t.s,p=e.slice(),h=0;h<=s;h++){for(m[b]=p.slice(),b++,c=[],l=0;l<d;l++){for(n=0;n<A;n++)f[n]=0;for(u=0;u<l;u++)for(n=0;n<A;n++)f[n]+=t.A[l][u]*_*c[u][n];for(n=0;n<A;n++)f[n]+=p[n];c.push(o(g+t.c[l]*_,f))}for(n=0;n<A;n++)f[n]=0;for(u=0;u<d;u++)for(n=0;n<A;n++)f[n]+=t.b[u]*c[u][n];for(n=0;n<A;n++)p[n]=p[n]+_*f[n];g+=_}return m},maxIterationsRoot:80,maxIterationsMinimize:500,findBracket:function(t,e,i){var s,o,n,a,h,l,c,u,d,p;if(r.A.isArray(e))return e;for(s=e,n=t.call(i,s),p=(a=[s-.1*(o=0===s?1:s),s+.1*o,s-1,s+1,s-.5*o,s+.5*o,s-.6*o,s+.6*o,s-1*o,s+1*o,s-2*o,s+2*o,s-5*o,s+5*o,s-10*o,s+10*o,s-50*o,s+50*o,s-100*o,s+100*o]).length,d=0;d<p&&(h=a[d],!(n*(l=t.call(i,h))<=0));d++);return h<s&&(c=s,s=h,h=c,u=n,n=l,l=u),[s,n,h,l]},fzero:function(t,e,i){var s,o,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v=n.A.eps,C=this.maxIterationsRoot,P=0;if(r.A.isArray(e)){if(e.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");s=(d=this.findDomain(t,e,i))[0],o=d[1],h=t.call(i,s),l=t.call(i,o)}else s=(u=this.findBracket(t,e,i))[0],h=u[1],o=u[2],l=u[3];if(Math.abs(h)<=v)return s;if(Math.abs(l)<=v)return o;if(h*l>0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);for(a=s,c=h;P<C;){if(p=o-s,Math.abs(c)<Math.abs(l)&&(s=o,o=a,a=s,h=l,l=c,c=h),A=2*v*Math.abs(o)+.5*v,y=.5*(a-o),Math.abs(y)<=A||Math.abs(l)<=v)return o;Math.abs(p)>=A&&Math.abs(h)>Math.abs(l)&&(g=a-o,s===a?(m=g*(f=l/h),b=1-f):(m=(_=l/h)*(g*(b=h/c)*(b-(f=l/c))-(o-s)*(f-1)),b=(b-1)*(f-1)*(_-1)),m>0?b=-b:m=-m,m<.75*g*b-.5*Math.abs(A*b)&&m<Math.abs(p*b*.5)&&(y=m/b)),Math.abs(y)<A&&(y=y>0?A:-A),s=o,h=l,o+=y,((l=t.call(i,o))>0&&c>0||l<0&&c<0)&&(a=s,c=h),P++}return o},chandrupatla:function(t,e,i){var s,o,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E=0,O=this.maxIterationsRoot,M=1+.001*Math.random(),w=.5*M,S=n.A.eps;if(r.A.isArray(e)){if(e.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");s=e[0],a=t.call(i,s),o=e[1],h=t.call(i,o)}else s=(l=this.findBracket(t,e,i))[0],a=l[1],o=l[2],h=l[3];if(a*h>0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);c=s,u=o,f=a,_=h;do{if(p=c+w*(u-c),A=t.call(i,p),Math.sign(A)===Math.sign(f)?(d=c,c=p,g=f,f=A):(d=u,u=c,g=_,_=f),m=c=p,b=f=A,Math.abs(_)<Math.abs(f)&&(m=u,b=_),(y=(2*S*Math.abs(m)+5e-6)/Math.abs(u-c))>.5||0===b)break;v=(c-u)/(d-u),C=(f-_)/(g-_),P=1-Math.sqrt(1-v),x=Math.sqrt(v),(w=P<C&&C<x?f/(_-f)*(g/(_-g))+f/(g-f)*(_/(g-_))*((d-c)/(u-c)):.5*M)<y&&(w=y),w>1-y&&(w=1-y),E++}while(E<=O);return m},findDomain:function(t,e,i,s){var o,n,a,h,l,c,u=1-1/1.61803398875;if(void 0===s&&(s=!0),!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.findDomain: length of array x0 has to be at least two.");if(o=(l=e.slice())[0],n=l[1],h=t.call(i,o),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=(n-o)*u+o,h=t.call(i,a),isNaN(h)?o=a:n=a,c++;l[0]=s?o:n}if(o=l[0],n=l[1],h=t.call(i,n),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=n-(n-o)*u,h=t.call(i,a),isNaN(h)?n=a:o=a,c++;l[1]=s?n:o}return l},fminbr:function(t,e,i){var s,o,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C=.5*(3-Math.sqrt(5)),P=n.A.eps,x=n.A.eps,E=this.maxIterationsMinimize,O=0;if(!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(a=h=(s=(p=this.findDomain(t,e,i))[0])+C*((o=p[1])-s),l=h,c=u=t.call(i,h),d=u;O<E;){if(f=o-s,_=.5*(s+o),g=x*Math.abs(a)+P/3,Math.abs(a-_)+.5*f<=2*g)return a;A=C*(a<_?o-a:s-a),Math.abs(a-l)>=g&&(m=(a-h)*(b=(a-h)*(c-d))-(a-l)*(y=(a-l)*(c-u)),(b=2*(b-y))>0?m=-m:b=-b,Math.abs(m)<Math.abs(A*b)&&m>b*(s-a+2*g)&&m<b*(o-a-2*g)&&(A=m/b)),Math.abs(A)<g&&(A=A>0?g:-g),y=a+A,(v=t.call(i,y))<=c?(y<a?o=a:s=a,h=l,l=a,a=y,u=d,d=c,c=v):(y<a?s=y:o=y,v<=d||l===a?(h=l,l=y,u=d,d=v):(v<=u||h===a||h===l)&&(h=y,u=v)),O+=1}return a},glomin:function(t,e){var i,s,r,o,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N=1e7,j=n.A.eps,D=n.A.eps*n.A.eps,k=n.A.eps*n.A.eps*n.A.eps;if(M=e[0],w=e[1],S=t(M)<t(w)?M:w,T=i=w,s=M,P=b=t(w),b<(m=v=t(M))?m=b:T=M,w<=M)return m;for(u=.5*(1+16*k)*N,c=3,o=s-(A=S<=M||w<=S?.5*(M+w):S),l=9/11,(y=t(A))<m&&(T=A,m=y);;){if(h=A-i,O=w-s,d=_=(a=s-i)*a*(x=v-y)-o*o*(E=v-b),p=f=2*(o*E-a*x),c<1e6||v<=m)for(;p*(_*(P-v)+O*p*(v-m+j))<O*u*_*(O*p-_)&&(C=t(r=s+_/p))<m&&(T=r,m=C),p=1,!(O<=(_=1e-5*(w-M)*(c=1611*c%1048576))););else for(p=1,_=1e-5*(w-M)*(c=1611*c%1048576);_<O;)p*(_*(P-v)+O*p*(v-m+j))<O*u*_*(O*p-_)&&(C=t(r=s+_/p))<m&&(T=r,m=C),p=1,_=1e-5*(w-M)*(c=1611*c%1048576);for(d=(l=.5*(1+l))*(d+2*(_=u*o*a*h)*(g=Math.sqrt((v-m+j)/u))),_=(_=-.5*(o+(x+2.01*D)/(o*u)))<g||o<0?s+g:s+_,r=0<d*(p+=.5*f)?s+d/p:_;(w<=(r=Math.max(r,_))?(r=w,C=P):C=t(r),C<m&&(T=r,m=C),o=r-s,!(r<=_))&&(d=2*(v-C)/(N*o),!((1+9*k)*o<=Math.abs(d)))&&!(.5*u*(o*o+d*d)<=v-m+(C-m)+2*j);)r=.5*(s+r),l*=.9;if(w<=r)break;i=A,A=s,s=r,b=y,y=v,v=C}return[T,m]},polzeros:function(t,e,i,r,o){var n,a,h,l=[],c=[],u=[],d=function(t,e,i){var r,o,n=t.length-1;if(i=i||!1)for(o=s.A.C.mult(n,t[n]),r=n-1;r>0;r--)o.mult(e),o.add(s.A.C.mult(t[r],r));else for(o=s.A.C.copy(t[n]),r=n-1;r>=0;r--)o.mult(e),o.add(t[r]);return o},p=function(t,e,i){var r,o,n=t.length-1;if(i=i||!1)for(o=s.A.C.mult(n,t[0]),r=n-1;r>0;r--)o.mult(e),o.add(s.A.C.mult(t[n-r],r));else for(o=s.A.C.copy(t[0]),r=n-1;r>=0;r--)o.mult(e),o.add(t[n-r]);return o},f=function(t,e){var i,s,r=t.length-1;for(s=t[r],i=r-1;i>=0;i--)s=s*e+t[i];return s};for(i=i||Number.EPSILON,r=r||30,a=t.length,s.A.isNumber(e)&&e>=0&&e<a-1&&(a=e+1),n=0;n<a;n++)l.push(new s.A.Complex(t[n]));for(n=0;n<a;n++)if(0!==l[n].real||0!==l[n].imaginary){h=n;break}for(n=0;n<h;n++)c.push(new s.A.Complex(0));for(n=(a=(l=l.slice(h)).length)-1;n>=0&&(0===l[n].real&&0===l[n].imaginary);n--)l.pop();if(0===(a=l.length))return[];if(o)for(n=0;n<a-1;n++)u.push(new s.A.Complex(o[n]));else u=function(t){var e,i,r,o,n=t.length-1,a=2*Math.PI/n,h=Math.PI/n*.5,l=[];for((r=s.A.C.mult(-1,t[n-1])).div(s.A.C.mult(n,t[n])),o=s.A.C.div(d(t,r),t[n]),0===(i=Math.pow(s.A.C.abs(o),1/n))&&(i=1),e=0;e<n;e++)t=new s.A.Complex(i*Math.cos(a*e+h),i*Math.sin(a*e+h)),l[e]=s.A.C.add(r,t);return l}(l);return function(t,e,i,r){var o,n,a,h,l,c,u,_,g,A=[],m=[],b=0,y=r.length;for(n=0;n<y;n++)A.push(!1);for(n=0;n<t.length;n++)m.push(s.A.C.abs(t[n])*(4*n+1));for(o=0;o<i&&b<y;o++)for(n=0;n<y;n++)if(!A[n])if(c=d(t,r[n]),l=s.A.C.abs(r[n]),s.A.C.abs(c)<e*f(m,l)){if(A[n]=!0,++b===y)break}else{for(l>1?(h=s.A.C.div(1,r[n]),(g=p(t,h,!0)).div(p(t,h)),g.mult(h),c=s.A.C.sub(y,g),c=s.A.C.div(r[n],c)):c.div(d(t,r[n],!0)),u=new s.A.Complex(0),a=0;a<y;a++)a!==n&&(_=s.A.C.sub(r[n],r[a]),_=s.A.C.div(1,_),u.add(_));u.mult(c),u=s.A.C.sub(1,u),c.div(u),r[n].sub(c)}return o}(l,i,r,u),(u=c.concat(u)).sort(function(t,e){return t.real<e.real?-1:t.real>e.real?1:0}),u},RamerDouglasPeucker:function(t,e){var i,s,r,o=[],a=[],h=function(t,e,i,s,r){var o=function(t,e,i){var s,r,o,a,h,l,c,u,d,p,f,_=n.A.eps*n.A.eps,g=1e4,A=0,m=e;if(i-e<2)return[-1,0];if(o=t[e].scrCoords,a=t[i].scrCoords,isNaN(o[1])||isNaN(o[2]))return[NaN,e];if(isNaN(a[1])||isNaN(a[2]))return[NaN,i];for(r=e+1;r<i;r++){if(h=t[r].scrCoords,isNaN(h[1])||isNaN(h[2]))return[NaN,r];l=(l=(l=h[1]-o[1])===1/0?g:l)===-1/0?-g:l,c=(c=(c=h[2]-o[2])===1/0?g:c)===-1/0?-g:c,(p=(u=(u=(u=a[1]-o[1])===1/0?g:u)===-1/0?-g:u)*u+(d=(d=(d=a[2]-o[2])===1/0?g:d)===-1/0?-g:d)*d)>_?((f=(l*u+c*d)/p)<0?f=0:f>1&&(f=1),s=(l-=f*u)*l+(c-=f*d)*c):(f=0,s=l*l+c*c),s>A&&(A=s,m=r)}return[Math.sqrt(A),m]}(t,e,i),a=o[1];if(isNaN(o[0])){h(t,e,a-1,s,r),r.push(t[a]);do{++a}while(a<=i&&isNaN(t[a].scrCoords[1]+t[a].scrCoords[2]));a<=i&&r.push(t[a]),h(t,a+1,i,s,r)}else o[0]>s?(h(t,e,a,s,r),h(t,a,i,s,r)):r.push(t[i])};for(r=t.length,i=0;;){for(;i<r&&isNaN(t[i].scrCoords[1]+t[i].scrCoords[2]);)i+=1;for(s=i+1;s<r&&!isNaN(t[s].scrCoords[1]+t[s].scrCoords[2]);)s+=1;if(s--,i<r&&s>i&&((a=[])[0]=t[i],h(t,i,s,e,a),o=o.concat(a)),i>=r)break;s<r-1&&o.push(t[s+1]),i=s+1}return o},RamerDouglasPeuker:function(t,e){return s.A.deprecated("Numerics.RamerDouglasPeuker()","Numerics.RamerDouglasPeucker()"),this.RamerDouglasPeucker(t,e)},Visvalingam:function(t,e){var i,r,o,n,a,h,l,c,u,d=[],p=[],f=[];if((r=t.length)<=2)return t;for(d[0]={used:!0,lft:null,node:null},a=0,i=1;i<r-1;i++)o=Math.abs(s.A.Math.Numerics.det([t[i-1].usrCoords,t[i].usrCoords,t[i+1].usrCoords])),isNaN(o)||(u={v:o,idx:i},p.push(u),d[i]={used:!0,lft:a,node:u},d[a].rt=i,a=i);for(d[r-1]={used:!0,rt:null,lft:a,node:null},d[a].rt=r-1,n=-1/0;p.length>e;)p.sort(function(t,e){return e.v-t.v}),d[i=p.pop().idx].used=!1,n=d[i].node.v,a=d[i].lft,h=d[i].rt,d[a].rt=h,d[h].lft=a,null!==(l=d[a].lft)&&(o=Math.abs(s.A.Math.Numerics.det([t[l].usrCoords,t[a].usrCoords,t[h].usrCoords])),d[a].node.v=o>=n?o:n),null!==(c=d[h].rt)&&(o=Math.abs(s.A.Math.Numerics.det([t[a].usrCoords,t[h].usrCoords,t[c].usrCoords])),d[h].node.v=o>=n?o:n);f=[t[i=0]];do{i=d[i].rt,f.push(t[i])}while(null!==d[i].rt);return f}},e.A=n.A.Numerics},188:function(t,e,i){var s=i(443),r=i(561),o=i(477);s.A.extend(s.A,{isBoard:function(t){return null!==t&&"object"==typeof t&&this.isNumber(t.BOARD_MODE_NONE)&&this.isObject(t.objects)&&this.isObject(t.jc)&&this.isFunction(t.update)&&!!t.containerObj&&this.isString(t.id)},isId:function(t,e){return"string"==typeof e&&!!t.objects[e]},isName:function(t,e){return"string"==typeof e&&!!t.elementsByName[e]},isGroup:function(t,e){return"string"==typeof e&&!!t.groups[e]},isString:function(t){return"string"==typeof t},isNumber:function(t,e,i){var s="number"==typeof t||"[Object Number]"===Object.prototype.toString.call(t);return i=void 0===i||i,(e=e||!1)&&(s=s||""+parseFloat(t)===t),i||(s=s&&!isNaN(t)),s},isFunction:function(t){return"function"==typeof t},isArray:function(t){return Array.isArray?Array.isArray(t):null!==t&&"object"==typeof t&&"function"==typeof t.splice&&"function"==typeof t.join},isObject:function(t){return"object"==typeof t&&!this.isArray(t)},isDocumentOrFragment:function(t){return this.isObject(t)&&(9===t.nodeType||11===t.nodeType)},isPoint:function(t){return!(null===t||"object"!=typeof t||!this.exists(t.elementClass))&&t.elementClass===r.A.OBJECT_CLASS_POINT},isPoint3D:function(t){return!(null===t||"object"!=typeof t||!this.exists(t.type))&&t.type===r.A.OBJECT_TYPE_POINT3D},isPointType:function(t,e){var i,s;return!!this.isArray(e)||(!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>1))||(s=t.select(e),this.isPoint(s)))},isPointType3D:function(t,e){var i,s;return!!(this.isArray(e)&&e.length>=3)||(!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>=3))||(s=t.select(e),this.isPoint3D(s)))},isTransformationOrArray:function(t){if(null!==t){if(this.isArray(t)&&t.length>0)return this.isTransformationOrArray(t[0]);if("object"==typeof t)return t.type===r.A.OBJECT_TYPE_TRANSFORMATION}return!1},isEmpty:function(t){return 0===Object.keys(t).length},exists:function(t,e){var i=!(null==t||null===t);return(e=e||!1)?i&&""!==t:i},def:function(t,e){return this.exists(t)?t:e},str2Bool:function(t){return!this.exists(t)||("boolean"==typeof t?t:!!this.isString(t)&&"true"===t.toLowerCase())},cssParse:function(t){var e=t;return this.isString(e)?(e='{"'+(e=(e=(e=(e=e.replace(/\s*;\s*$/g,"")).replace(/\s*;\s*/g,'","')).replace(/\s*:\s*/g,'":"')).trim())+'"}',JSON.parse(e)):{}},cssStringify:function(t){var e,i,s="";if(!this.isObject(t))return"";for(e in t)t.hasOwnProperty(e)&&(i=t[e],(this.isString(i)||this.isNumber(i))&&(s+=e+":"+i+"; "));return s=s.trim()},createEvalFunction:function(t,e,i){var s,r,o,n=[],a={};for(r=0;r<i;r++)for(o in n[r]=this.createFunction(e[r],t),n[r].deps)a[o]=n[r].deps;return(s=function(t){return n[t]()}).deps=a,s},createFunction:function(t,e,i,s){var r=null;return this.isString(t)?r=e.jc.snippet(t,!0,i,!1):this.isFunction(t)?(r=t).deps=this.isObject(t.deps)?t.deps:{}:(this.isNumber(t)||this.isArray(t))&&((r=function(){return t}).deps={}),null!==r&&(r.origin=t),r},providePoints:function(t,e,i,s,r){var o,n,a,h,l,c=0,u=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(r)&&(c=r.length),0===c&&(h=this.copyAttributes(i,t.options,s)),o=0;o<a;++o)if(c>0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.options,s,r[n].toLowerCase())),this.isArray(e[o])&&e[o].length>1?(u.push(t.create("point",e[o],h)),u[u.length-1]._is_new=!0):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(u.push(t.create("point",[e[o]],h)),u[u.length-1]._is_new=!0)):u.push(t.select(e[o])),!this.isPoint(u[o]))return!1;return u},providePoints3D:function(t,e,i,s,r){var o,n,a,h,l,c=0,u=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(r)&&(c=r.length),0===c&&(h=this.copyAttributes(i,t.board.options,s)),o=0;o<a;++o){if(c>0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.board.options,s,r[n])),this.isArray(e[o])&&e[o].length>0&&e[o].every(t=>this.isArray(t)&&this.isNumber(t[0])))for(n=0;n<e[o].length;n++)u.push(t.create("point3d",e[o][n],h)),u[u.length-1]._is_new=!0;else this.isArray(e[o])&&e[o].every(t=>this.isNumber(t)||this.isFunction(t))?(u.push(t.create("point3d",e[o],h)),u[u.length-1]._is_new=!0):this.isPoint3D(e[o])?u.push(e[o]):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(u.push(t.create("point3d",[e[o]],h)),u[u.length-1]._is_new=!0)):u.push(t.select(e[o]));if(!this.isPoint3D(u[o]))return!1}return u},bind:function(t,e){return function(){return t.apply(e,arguments)}},evaluate:function(t){return this.isFunction(t)?t():t},indexOf:function(t,e,i){var s,r=this.exists(i);if(Array.indexOf&&!r)return t.indexOf(e);for(s=0;s<t.length;s++)if(r&&t[s][i]===e||!r&&t[s]===e)return s;return-1},eliminateDuplicates:function(t){var e,i=t.length,s=[],r={};for(e=0;e<i;e++)r[t[e]]=0;for(e in r)r.hasOwnProperty(e)&&s.push(e);return s},swap:function(t,e,i){var s;return s=t[e],t[e]=t[i],t[i]=s,t},uniqueArray:function(t){var e,i,r,o=[];if(0===t.length)return[];for(e=0;e<t.length;e++)if(r=this.isArray(t[e]),this.exists(t[e]))for(i=e+1;i<t.length;i++)r&&s.A.cmpArrays(t[e],t[i])?t[e]=[]:r||t[e]!==t[i]||(t[e]="");else t[e]="";for(i=0,e=0;e<t.length;e++)(r=this.isArray(t[e]))||""===t[e]?r&&0!==t[e].length&&(o[i]=t[e].slice(0),i++):(o[i]=t[e],i++);return t=o,o},toUniqueArrayFloat:function(t,e){var i,s;for((i=t.slice()).sort(function(t,e){return t-e}),s=i.length-1;s>0;s--)Math.abs(i[s]-i[s-1])<e&&i.splice(s,1);return i},isInArray:function(t,e){return s.A.indexOf(t,e)>-1},coordsArrayToMatrix:function(t,e){var i,s=[],r=[];for(i=0;i<t.length;i++)e?(s.push(t[i].usrCoords[1]),r.push(t[i].usrCoords[2])):r.push([t[i].usrCoords[1],t[i].usrCoords[2]]);return e&&(r=[s,r]),r},cmpArrays:function(t,e){var i;if(t===e)return!0;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(this.isArray(t[i])&&this.isArray(e[i])){if(!this.cmpArrays(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1;return!0},removeElementFromArray:function(t,e){var i;for(i=0;i<t.length;i++)if(t[i]===e)return t.splice(i,1),t;return t},trunc:function(t,e){return e=s.A.def(e,0),this.toFixed(t,e)},_decimalAdjust:function(t,e,i){return void 0===i||0===+i?Math[t](e):(e=+e,i=+i,isNaN(e)||"number"!=typeof i||i%1!=0?NaN:(e=e.toString().split("e"),+((e=(e=Math[t](+(e[0]+"e"+(e[1]?+e[1]-i:-i)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]+i:i))))},_round10:function(t,e){return this._decimalAdjust("round",t,e)},_floor10:function(t,e){return this._decimalAdjust("floor",t,e)},_ceil10:function(t,e){return this._decimalAdjust("ceil",t,e)},toFixed:function(t,e){return this._round10(t,-e).toFixed(e)},autoDigits:function(t){var e=Math.abs(t);return e>=.1?this.toFixed(t,2):e>=.01?this.toFixed(t,4):e>=1e-4?this.toFixed(t,6):t},parseNumber:function(t,e,i){var s;return this.isString(t)&&t.indexOf("%")>-1?(s=t.replace(/\s+%\s+/,""),parseFloat(s)*e*.01):this.isString(t)&&t.indexOf("fr")>-1?(s=t.replace(/\s+fr\s+/,""),parseFloat(s)*e):this.isString(t)&&t.indexOf("px")>-1?(s=t.replace(/\s+px\s+/,""),s=parseFloat(s),this.isFunction(i)?i(s):this.isNumber(i)?s*i:s):parseFloat(t)},parsePosition:function(t){var e,i,s="",r="";if(""!==(t=t.trim()))for(e=t.split(/[ ,]+/),i=0;i<e.length;i++)"left"===e[i]||"right"===e[i]?s=e[i]:r=e[i];return{side:s,pos:r}},keys:function(t,e){var i,s=[];for(i in t)e?t.hasOwnProperty(i)&&s.push(i):s.push(i);return s},clone:function(t){var e={};return e.prototype=t,e},cloneAndCopy:function(t,e){var i,s=function(){};for(i in s.prototype=t,e)s[i]=e[i];return s},merge:function(t,e){var i,s,r,o;for(i in e)if(e.hasOwnProperty(i))if(r=e[i],this.isArray(r))for(t[i]||(t[i]=[]),s=0;s<r.length;s++)o=e[i][s],"object"==typeof e[i][s]?t[i][s]=this.merge(t[i][s],o):t[i][s]=e[i][s];else"object"==typeof r?(t[i]||(t[i]={}),t[i]=this.merge(t[i],r)):("boolean"==typeof t&&(t={}),t[i]=r);return t},deepCopy:function(t,e,i){var s,r,o,n;if(i=i||!1,"object"!=typeof t||null===t)return t;if(this.isArray(t))for(s=[],r=0;r<t.length;r++)null!==(o=t[r])&&"object"==typeof o?this.exists(o.board)?s[r]=o.id:s[r]=this.deepCopy(o,{},i):s[r]=o;else{for(r in s={},t)t.hasOwnProperty(r)&&(n=i?r.toLowerCase():r,null!==(o=t[r])&&"object"==typeof o?this.exists(o.board)?s[n]=o.id:s[n]=this.deepCopy(o,{},i):s[n]=o);for(r in e)e.hasOwnProperty(r)&&(n=i?r.toLowerCase():r,null!==(o=e[r])&&"object"==typeof o?this.isArray(o)||!this.exists(s[n])?s[n]=this.deepCopy(o,{},i):s[n]=this.deepCopy(s[n],o,i):s[n]=o)}return s},mergeAttr:function(t,e,i,s){var r,o,n;for(r in i=i||!0,s=s||!1,e)e.hasOwnProperty(r)&&((o=i?r.toLowerCase():r)!==r&&t.hasOwnProperty(r)&&(t.hasOwnProperty(o)?this.mergeAttr(t[o],t[r],i):t[o]=t[r],delete t[r]),n=e[r],!this.isObject(n)||null===n||this.isDocumentOrFragment(n)||this.exists(n.board)||"string"==typeof n.valueOf()?s&&!this.exists(n)||(t[o]=n):(void 0!==t[o]&&null!==t[o]&&this.isObject(t[o])||(t[o]={}),this.mergeAttr(t[o],n,i)))},keysToLowerCase:function(t){var e,i,s=Object.keys(t),r=s.length,o={};if("object"!=typeof t)return t;for(;r--;)e=s[r],t.hasOwnProperty(e)&&("object"!=typeof(i=t[e])||null===i||this.isArray(i)||this.exists(i.nodeType)||this.exists(i.board)?o[e.toLowerCase()]=i:o[e.toLowerCase()]=this.keysToLowerCase(i));return o},copyAttributes:function(t,e,i){var r,o,n,a,h,l;for(r=(a=arguments.length)<3||{circle:1,curve:1,foreignobject:1,image:1,line:1,point:1,polygon:1,text:1,ticks:1,integral:1}[i]?s.A.deepCopy(e.elements,null,!0):{},a<4&&this.exists(i)&&this.exists(e.layer[i])&&(r.layer=e.layer[i]),h=e,l=!0,n=2;n<a;n++){if(o=arguments[n],!this.exists(h[o])){l=!1;break}h=h[o]}for(l&&(r=s.A.deepCopy(r,h,!0)),h="object"==typeof t?this.keysToLowerCase(t):{},l=!0,n=3;n<a;n++){if(o=arguments[n].toLowerCase(),!this.exists(h[o])){l=!1;break}h=h[o]}if(l&&this.mergeAttr(r,h,!0),"board"===arguments[2])return r;for(h=e,l=!0,n=2;n<a;n++){if(o=arguments[n],!this.exists(h[o])){l=!1;break}h=h[o]}return l&&this.exists(h.label)&&(r.label=s.A.deepCopy(h.label,r.label,!0)),r.label=s.A.deepCopy(e.label,r.label,!0),r},copyPrototypeMethods:function(t,e,i){var s;for(s in t.prototype[i]=e.prototype.constructor,e.prototype)e.prototype.hasOwnProperty(s)&&(t.prototype[s]=e.prototype[s])},getCloneObject:function(t){var e,i,s={};for(i in s.id=t.id+"T"+t.numTraces,t.numTraces+=1,s.coords=t.coords,e=this.deepCopy(t.visProp,t.visProp.traceattributes,!0),s.visProp={},e)e.hasOwnProperty(i)&&0!==i.indexOf("aria")&&0!==i.indexOf("highlight")&&0!==i.indexOf("attractor")&&"label"!==i&&"needsregularupdate"!==i&&"infoboxdigits"!==i&&(s.visProp[i]=t.eval(e[i]));return s.evalVisProp=function(t){return s.visProp[t]},s.eval=function(t){return t},s.visProp.layer=t.board.options.layer.trace,s.visProp.tabindex=null,s.visProp.highlight=!1,s.board=t.board,s.elementClass=t.elementClass,this.clearVisPropOld(s),s.visPropCalc={visible:t.evalVisProp("visible")},s},toJSON:function(t,e){var i,r,o,n;if(e=s.A.def(e,!1),void 0!==JSON&&JSON.stringify&&!e)try{return JSON.stringify(t)}catch(t){}switch(typeof t){case"object":if(t){if(i=[],this.isArray(t)){for(o=0;o<t.length;o++)i.push(s.A.toJSON(t[o],e));return"["+i.join(",")+"]"}for(r in t)if(t.hasOwnProperty(r)){try{n=s.A.toJSON(t[r],e)}catch(t){n=""}e?i.push(r+":"+n):i.push('"'+r+'":'+n)}return"{"+i.join(",")+"} "}return"null";case"string":return"'"+t.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return t.toString()}return"0"},clearVisPropOld:function(t){return t.visPropOld={cssclass:"",cssdefaultstyle:"",cssstyle:"",fillcolor:"",fillopacity:"",firstarrow:!1,fontsize:-1,lastarrow:!1,left:-1e5,linecap:"",shadow:!1,strokecolor:"",strokeopacity:"",strokewidth:"",tabindex:-1e5,transitionduration:0,top:-1e5,visible:null},t},isInObject:function(t,e){var i;for(i in t)if(t.hasOwnProperty(i)&&t[i]===e)return!0;return!1},escapeHTML:function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(t){return t.replace(/<\/?[^>]+>/gi,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()},trimNumber:function(t){return"."!==(t=(t=t.replace(/^0+/,"")).replace(/0+$/,""))[t.length-1]&&","!==t[t.length-1]||(t=t.slice(0,-1)),"."!==t[0]&&","!==t[0]||(t="0"+t),t},filterElements:function(t,e){var i,s,r,o,n,a,h,l=t.length,c=[];if(this.exists(e)&&"function"!=typeof e&&"object"!=typeof e)return c;for(i=0;i<l;i++){if(h=!0,r=t[i],"object"==typeof e){for(s in e)if(e.hasOwnProperty(s)&&(o=s.toLowerCase(),n="function"==typeof r[s]?r[s]():r[s],a=r.visProp&&"function"==typeof r.visProp[o]?r.visProp[o]():r.visProp&&r.visProp[o],!(h="function"==typeof e[s]?e[s](n)||e[s](a):n===e[s]||a===e[s])))break}else"function"==typeof e&&(h=e(r));h&&c.push(r)}return c},trim:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},toFraction:function(t,e,i){var s=o.A.decToFraction(t,i),r="";return 0===s[1]&&0===s[2]?r+="0":(s[0]<0&&(r+="-"),0===s[2]?r+=s[1]:1===s[2]&&1===s[3]||(0!==s[1]&&(r+=s[1]+" "),r+=!0===e?"\\frac{"+s[2]+"}{"+s[3]+"}":s[2]+"/"+s[3])),r},concat:function(t,e){var i,s=e.length;for(i=0;i<s;i++)t.push(e[i]);return t},sanitizeHTML:function(t,e){return"function"==typeof html_sanitize&&e?html_sanitize(t,function(){},function(t){return t}):(t&&"string"==typeof t&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;")),t)},evalSlider:function(t){return t&&t.type===r.A.OBJECT_TYPE_GLIDER&&"function"==typeof t.Value?t.Value():t},stack2jsxgraph:function(t){var e;return"["===(e=t.replace(/%pi/g,"PI").replace(/%e/g,"EULER").replace(/%phi/g,"1.618033988749895").replace(/%gamma/g,"0.5772156649015329").trim())[0]&&"]"===e[e.length-1]&&(e=e.slice(1,-1).split(/\s*,\s*/)),e}}),e.A=s.A},378:function(t,e,i){var s=i(443),r=i(561),o=i(477),n=i(873),a=i(188);s.A.Options={jc:{enabled:!0,compile:!0},board:{animationDelay:35,axis:!1,boundingBox:[-5,5,5,-5],browserPan:!1,clickDelay:600,dblClickSuppressClick:!1,defaultAxes:{x:{name:"x",fixed:!0,needsRegularUpdate:!1,ticks:{label:{visible:"inherit",anchorX:"middle",anchorY:"top",fontSize:12,offset:[0,-3]},tickEndings:[0,1],majorTickEndings:[1,1],drawZero:!1,visible:"inherit"}},y:{name:"y",fixed:!0,needsRegularUpdate:!1,ticks:{label:{visible:"inherit",anchorX:"right",anchorY:"middle",fontSize:12,offset:[-6,0]},tickEndings:[1,0],majorTickEndings:[1,1],drawZero:!1,visible:"inherit"}}},document:!1,drag:{enabled:!0},fullscreen:{symbol:'<svg height="1em" width="1em" version="1.1" viewBox="10 10 18 18"><path fill="#666" d="m 10,16 2,0 0,-4 4,0 0,-2 L 10,10 l 0,6 0,0 z"></path><path fill="#666" d="m 20,10 0,2 4,0 0,4 2,0 L 26,10 l -6,0 0,0 z"></path><path fill="#666" d="m 24,24 -4,0 0,2 L 26,26 l 0,-6 -2,0 0,4 0,0 z"></path><path fill="#666" d="M 12,20 10,20 10,26 l 6,0 0,-2 -4,0 0,-4 0,0 z"></path></svg>',scale:.85,id:null},ignoreLabels:!0,intl:{enabled:!1},keepAspectRatio:!1,keyboard:{enabled:!0,dx:10,dy:10,panShift:!0,panCtrl:!1},logging:{enabled:!1},minimizeReflow:"none",maxBoundingBox:[-1/0,1/0,1/0,-1/0],maxFrameRate:40,maxNameLength:1,moveTarget:null,offsetX:0,offsetY:0,pan:{enabled:!0,needShift:!0,needTwoFingers:!1},registerEvents:!0,renderer:"auto",resize:{enabled:!0,throttle:10},screenshot:{scale:1,type:"png",symbol:"⌘",css:"background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center",cssButton:"padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);"},selection:{enabled:!1,name:"selectionPolygon",needShift:!1,needCtrl:!0,fillColor:"#ffff00",visible:!1,withLines:!1,vertices:{visible:!1}},showClearTraces:!1,showCopyright:!0,showFullscreen:!1,showInfobox:!0,showLogo:!1,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,center:"auto",min:1e-4,max:1e4,pinch:!0,pinchHorizontal:!0,pinchVertical:!0,pinchSensitivity:7},zoomX:1,zoomY:1},navbar:{strokeColor:"#333333",fillColor:"transparent",highlightFillColor:"#aaaaaa",padding:"2px",position:"absolute",fontSize:"14px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{aria:{enabled:!1,label:"",live:"assertive"},cssClass:"",highlightCssClass:"",dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,element3D:null,fillColor:n.A.palette.red,fillOpacity:1,fixed:!1,frozen:!1,gradient:null,gradientAngle:0,gradientCX:.5,gradientCY:.5,gradientEndOffset:1,gradientFX:.5,gradientFY:.5,gradientFR:0,gradientR:.5,gradientSecondColor:"#ffffff",gradientSecondOpacity:1,gradientStartOffset:0,highlight:!0,highlightFillColor:"none",highlightFillOpacity:1,highlightStrokeColor:"#c3d9ff",highlightStrokeOpacity:1,highlightStrokeWidth:2,isLabel:!1,layer:0,lineCap:"butt",needsRegularUpdate:!0,nonnegativeOnly:!1,precision:"inherit",priv:!1,rotatable:!0,scalable:!0,shadow:{enabled:!1,color:[0,0,0],opacity:1,blur:3,blend:.1,offset:[5,5]},snapToGrid:!1,strokeColor:n.A.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:-1,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,withLabel:!1,ignoreForLabelAutoposition:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{tabindex:null,layer:7,highlight:!1,autoPosition:!1},beautifulScientificTickLabels:!1,useUnicodeMinus:!0,anchor:"left",drawZero:!1,insertTicks:!1,minTicksDistance:10,minorHeight:4,majorHeight:10,tickEndings:[1,1],majorTickEndings:[1,1],ignoreInfiniteTickEndings:!0,minorTicks:4,ticksPerLabel:!1,scale:1,scaleSymbol:"",labels:[],maxLabelLength:5,precision:3,digits:3,ticksDistance:1,face:"|",strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"none",highlightFillColor:"none",visible:"inherit",includeBoundaries:!1,type:"linear",intl:{enabled:"inherit",options:{}},minorTicksInArrow:!1,majorTicksInArrow:!0,labelInArrow:!0,minorTicksInMargin:!1,majorTicksInMargin:!0,labelInMargin:!0,ignoreForLabelAutoposition:!0},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:n.A.palette.blue,ticksDistance:.2},precision:{touch:30,touchMax:100,mouse:4,pen:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,unused9:19,unused8:18,unused7:17,unused6:16,unused5:15,unused4:14,unused3:13,unused2:12,unused1:11,unused0:10,text:9,point:9,glider:9,arc:8,line:7,circle:6,curve:5,turtle:5,polygon:3,sector:3,angle:3,integral:3,axis:2,ticks:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:"auto",type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:n.A.palette.orange,highlightFillColor:n.A.palette.orange,strokeColor:n.A.palette.orange,fillOpacity:.3,highlightFillOpacity:.3,radiuspoint:{withLabel:!1,visible:!1,name:""},pointsquare:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"#000000",size:2,face:"o",withLabel:!1,name:""},label:{position:"top",offset:[0,0],strokeColor:n.A.palette.blue},arc:{visible:!1,fillColor:"none"}},arc:{selection:"auto",hasInnerPoints:!1,label:{anchorX:"auto",anchorY:"auto"},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!1,center:{},radiusPoint:{},anglePoint:{}},arrow:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},arrowparallel:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},axis:{name:"",needsRegularUpdate:!1,strokeWidth:1,lastArrow:{type:1,highlightSize:8,size:8},strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",position:"static",anchor:"",anchorDist:"10%",ticksAutoPos:!1,ticksAutoPosThreshold:"5%",withTicks:!0,straightFirst:!0,straightLast:!0,margin:-4,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9],parse:!1,needsRegularUpdate:!1,display:"internal",visible:"inherit",layer:9},visible:"inherit",needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:5,minorHeight:10,majorHeight:-1,tickEndings:[0,1],majorTickEndings:[1,1],minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1,visible:!1},point2:{needsRegularUpdate:!1,visible:!1},tabindex:-1,label:{position:"lft",offset:[10,10]},ignoreForLabelAutoposition:!0},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"#000000"},line2:{strokeColor:"#000000"}},boxplot:{dir:"vertical",smallWidth:.5,strokeWidth:2,strokeColor:n.A.palette.blue,fillColor:n.A.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:n.A.palette.blue,highlightFillColor:n.A.palette.blue,highlightFillOpacity:.1},button:{disabled:!1,display:"html"},cardinalspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.05,fillOpacity:.05,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1,fillOpacity:.6,withLines:!1,label:{}},checkbox:{disabled:!1,checked:!1,display:"html"},circle:{hasInnerPoints:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!0,center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},strokeWidth:1,strokeColor:"#0000ff",fillColor:"none"},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",foci:{fixed:!1,visible:!1,withLabel:!1,name:""},center:{visible:!1,withLabel:!1,name:""},point:{withLabel:!1,name:""},line:{visible:!1}},curve:{strokeWidth:1,strokeColor:n.A.palette.blue,fillColor:"none",fixed:!0,curveType:null,doAdvancedPlot:!0,doAdvancedPlotOld:!1,firstArrow:!1,handDrawing:!1,label:{position:"lft"},lastArrow:!1,lineCap:"round",numberPointsHigh:1600,numberPointsLow:400,plotVersion:2,recursionDepthHigh:17,recursionDepthLow:15},foreignobject:{fixed:!0,visible:!0,needsRegularUpdate:!1,attractors:[],evaluateOnlyOnce:!1},functiongraph:{},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,highlight:!1,gridX:null,gridY:null,majorStep:"auto",minorElements:0,forceSquare:!1,includeBoundaries:!1,size:void 0,face:void 0,margin:void 0,drawZero:void 0,polygonVertices:void 0,major:{size:5,face:"line",margin:0,drawZero:!0,polygonVertices:6},minor:{visible:"inherit",size:3,face:"point",margin:0,drawZero:!0,polygonVertices:6},snapToGrid:!1,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.5,dash:0,theme:0,themes:[{},{forceSquare:"min",major:{face:"line"}},{major:{face:"line"},minor:{size:3,face:"point"},minorElements:"auto"},{major:{face:"line"},minor:{face:"line",strokeOpacity:.25},minorElements:"auto"},{major:{face:"line"},minor:{face:"+",size:"95%"},minorElements:"auto"},{major:{face:"+",size:10,strokeOpacity:1},minor:{face:"point",size:3},minorElements:"auto"},{major:{face:"circle",size:8,fillColor:"#c0c0c0"},minor:{face:"point",size:3},minorElements:"auto"}]},group:{needsRegularUpdate:!0},htmlslider:{widthRange:100,widthOut:34,step:.01,frozen:!0,isLabel:!1,strokeColor:"#000000",display:"html",anchorX:"left",anchorY:"middle",withLabel:!1},image:{imageString:null,fillOpacity:1,highlightFillOpacity:.6,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0,snapSizeX:1,snapSizeY:1,attractors:[]},implicitcurve:{margin:1,resolution_outer:5,resolution_inner:5,max_steps:1024,alpha_0:.05,tol_u0:o.A.eps,tol_newton:1e-7,tol_cusp:.05,tol_progress:1e-4,qdt_box:.2,kappa_0:.2,delta_0:.05,h_initial:.1,h_critical:.001,h_max:.5,loop_dist:.09,loop_dir:.99,loop_detection:!0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:n.A.palette.red,fillOpacity:.2,strokeColor:"none",inverse:!1},infobox:{distanceX:-20,distanceY:25,intl:{enabled:"inherit",options:{}},fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0,parse:!1,transitionDuration:0,needsRegularUpdate:!1,tabindex:null,viewport:[0,0,0,0],ignoreForLabelAutoposition:!0},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:n.A.palette.red,fillOpacity:.3,highlightFillColor:n.A.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20,digits:4,intl:{enabled:!1,options:{}}}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",strokeColor:"#000000",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"#000000",fixed:!0,tabindex:null,position:"urt",distance:1.5,offset:[10,10],autoPosition:!1,autoPositionMinDistance:12,autoPositionMaxDistance:28,autoPositionWhitelist:[]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],lineLength:1,strokeOpacity:[1],rowHeight:20,strokeWidth:5,frozen:!1},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,ticksDistance:1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},measurement:{baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",dim:null,formatCoords:function(t,e,i,s){return 1!==parseFloat(s)?"Infinit coords":"("+e+", "+i+")"},formatDirection:function(t,e,i){return"("+e+", "+i+")"}},metapostspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.5,fillOpacity:.5,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},nonreflexangle:{},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},otherintersection:{alwaysIntersect:!0,precision:.001},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},parallelogram:{parallelpoint:{withLabel:!1,name:""}},parallelpoint:{},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",strokeWidth:2,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width","width","height","rx","ry"],fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",zoom:!1,showInfobox:"inherit",infoboxDigits:"auto",draft:!1,attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGrid:!1,attractToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},highlightByStrokeWidth:!1,vertices:{layer:9,withLabel:!1,name:"",strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},reflexangle:{},regularpolygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:n.A.palette.yellow},sector:{fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,useDirection:!1,selection:"auto",arc:{visible:!1,fillColor:"none",withLabel:!1,name:"",center:{visible:!1,withLabel:!1,name:""},radiusPoint:{visible:!1,withLabel:!1,name:""},anglePoint:{visible:!1,withLabel:!1,name:""}},radiusPoint:{visible:!1,withLabel:!1},center:{visible:!1,withLabel:!1},anglePoint:{visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:n.A.palette.red,name:""}},slider:{snapWidth:-1,snapValues:[],snapValueDistance:0,precision:2,digits:2,intl:{enabled:"inherit",options:{}},firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},baseline:{needsRegularUpdate:!1,visible:"inherit",fixed:!0,scalable:!1,tabindex:null,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,drawLabels:!1,digits:2,includeBoundaries:!0,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,ticksDistance:1,minorHeight:4,majorHeight:5,minorTicks:0,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],majortickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,visible:"inherit",fixed:!0,tabindex:null,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{visible:"inherit",strokeColor:"#000000"},moveOnUp:!0},slopefield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:.125*Math.PI}},slopetriangle:{fillColor:n.A.palette.red,fillOpacity:.4,highlightFillColor:n.A.palette.red,highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:""},basepoint:{visible:!1,withLabel:!1,name:""},tangent:{visible:!1,withLabel:!1,name:""},toppoint:{visible:!1,withLabel:!1,name:""},label:{visible:!0,position:"first"}},smartlabelangle:{cssClass:"smart-label-solid smart-label-angle",highlightCssClass:"smart-label-solid smart-label-angle",anchorX:"left",anchorY:"middle",unit:"",prefix:"",suffix:"",measure:"deg",useMathJax:!0},smartlabelcircle:{cssClass:"smart-label-solid smart-label-circle",highlightCssClass:"smart-label-solid smart-label-circle",anchorX:"middle",useMathJax:!0,unit:"",prefix:"",suffix:"",measure:"radius"},smartlabelline:{cssClass:"smart-label-solid smart-label-line",highlightCssClass:"smart-label-solid smart-label-line",anchorX:"middle",useMathJax:!0,unit:"",measure:"length"},smartlabelpoint:{cssClass:"smart-label-solid smart-label-point",highlightCssClass:"smart-label-solid smart-label-point",anchorX:"middle",anchorY:"top",useMathJax:!0,dir:"row",unit:""},smartlabelpolygon:{cssClass:"smart-label-solid smart-label-polygon",highlightCssClass:"smart-label-solid smart-label-polygon",anchorX:"middle",useMathJax:!0,unit:"",measure:"area"},stepfunction:{},tangent:{},tangentto:{polar:{visible:!1,strokeWidth:1,dash:3},point:{visible:!1}},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,rotate:0,precision:2,digits:2,point1:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},ticks:{drawLabels:!1,drawZero:!0,insertTicks:!0,ticksDistance:.1,minorHeight:8,majorHeight:16,minorTicks:4,tickEndings:[0,1],majorTickEndings:[0,1],strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",visible:"inherit",label:{anchorY:"top",anchorX:"middle",offset:[0,-10]}},label:{position:"top"}},text:{fontSize:12,fontUnit:"px",formatNumber:!1,digits:2,intl:{enabled:"inherit",options:{minimumFractionDigits:0,maximumFractionDigits:2}},parse:!0,useCaja:!1,isLabel:!1,strokeColor:"#000000",highlightStrokeColor:"#000000",highlightStrokeOpacity:.666666,cssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",highlightCssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",cssStyle:"",highlightCssStyle:"",transitionProperties:["color","opacity"],useASCIIMathML:!1,useMathJax:!1,useKatex:!1,katexMacros:{},toFraction:!1,display:"html",anchor:null,anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",dragArea:"all",withLabel:!1,rotate:0,visible:!0,snapSizeX:1,snapSizeY:1,attractors:[]},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:!1,strokeColor:n.A.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}},s.A.Validator=function(){var t,e=function(t){return a.A.isString(t)},i=function(t){return a.A.isNumber(t,!0,!1)},r=function(t){return Math.abs(t-Math.round(t))<o.A.eps},n=function(t){return r(t)&&t>0},h=function(t){return t>0},l=function(t){return t>=0},c={},u={attractorDistance:l,color:e,display:function(t){return"html"===t||"internal"===t},doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:function(t){return a.A.exists(s.A.normalizePointFace(t))},factor:i,fillColor:e,fillOpacity:i,firstArrow:!1,fontSize:r,dash:r,gridX:i,gridY:i,hasGrid:!1,highlightFillColor:e,highlightFillOpacity:i,highlightStrokeColor:e,highlightStrokeOpacity:i,insertTicks:!1,lastArrow:!1,layer:function(t){return r(t)&&t>=0},majorHeight:r,minorHeight:r,minorTicks:l,minTicksDistance:n,numberPointsHigh:n,numberPointsLow:n,opacity:i,radius:i,RDPsmoothing:!1,renderer:function(t){return"vml"===t||"svg"===t||"canvas"===t||"no"===t},right:function(t){return/^[0-9]+px$/.test(t)},showCopyright:!1,showInfobox:!1,showNavigation:!1,size:l,snapSizeX:h,snapSizeY:h,snapWidth:i,snapToGrid:!1,snatchDistance:l,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:e,strokeOpacity:i,strokeWidth:l,takeFirst:!1,takeSizeFromFile:!1,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(t in u)u.hasOwnProperty(t)&&(c[t.toLowerCase()]=u[t]);return c}(),s.A.normalizePointFace=function(t){return{cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",divide:"|","|":"|",minus:"-","-":"-",diamond:"<>","<>":"<>",diamond2:"<<>>","<<>>":"<<>>",triangleup:"^",A:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"}[t]},s.A.useStandardOptions=function(t){var e,i,o,n,a=s.A.Options,h=t.hasGrid;for(e in t.options.grid.hasGrid=a.grid.hasGrid,t.options.grid.gridX=a.grid.gridX,t.options.grid.gridY=a.grid.gridY,t.options.grid.gridColor=a.grid.gridColor,t.options.grid.gridOpacity=a.grid.gridOpacity,t.options.grid.gridDash=a.grid.gridDash,t.options.grid.snapToGrid=a.grid.snapToGrid,t.options.grid.snapSizeX=a.grid.SnapSizeX,t.options.grid.snapSizeY=a.grid.SnapSizeY,t.takeSizeFromFile=a.takeSizeFromFile,n=function(t,e){t.visProp.fillcolor=e.fillColor,t.visProp.highlightfillcolor=e.highlightFillColor,t.visProp.strokecolor=e.strokeColor,t.visProp.highlightstrokecolor=e.highlightStrokeColor},t.objects)if(t.objects.hasOwnProperty(e))if((o=t.objects[e]).elementClass===r.A.OBJECT_CLASS_POINT)n(o,a.point);else if(o.elementClass===r.A.OBJECT_CLASS_LINE)for(n(o,a.line),i=0;i<o.ticks.length;i++)o.ticks[i].majorTicks=a.line.ticks.majorTicks,o.ticks[i].minTicksDistance=a.line.ticks.minTicksDistance,o.ticks[i].visProp.minorheight=a.line.ticks.minorHeight,o.ticks[i].visProp.majorheight=a.line.ticks.majorHeight;else o.elementClass===r.A.OBJECT_CLASS_CIRCLE?n(o,a.circle):o.type===r.A.OBJECT_TYPE_ANGLE?n(o,a.angle):o.type===r.A.OBJECT_TYPE_ARC?n(o,a.arc):o.type===r.A.OBJECT_TYPE_POLYGON?n(o,a.polygon):o.type===r.A.OBJECT_TYPE_CONIC?n(o,a.conic):o.type===r.A.OBJECT_TYPE_CURVE?n(o,a.curve):o.type===r.A.OBJECT_TYPE_SECTOR&&(o.arc.visProp.fillcolor=a.sector.fillColor,o.arc.visProp.highlightfillcolor=a.sector.highlightFillColor,o.arc.visProp.fillopacity=a.sector.fillOpacity,o.arc.visProp.highlightfillopacity=a.sector.highlightFillOpacity);t.fullUpdate(),h&&!t.hasGrid?t.removeGrids(t):!h&&t.hasGrid&&t.create("grid",[])},s.A.useBlackWhiteOptions=function(t){var e=s.A.Options;e.point.fillColor=n.A.rgb2bw(e.point.fillColor),e.point.highlightFillColor=n.A.rgb2bw(e.point.highlightFillColor),e.point.strokeColor=n.A.rgb2bw(e.point.strokeColor),e.point.highlightStrokeColor=n.A.rgb2bw(e.point.highlightStrokeColor),e.line.fillColor=n.A.rgb2bw(e.line.fillColor),e.line.highlightFillColor=n.A.rgb2bw(e.line.highlightFillColor),e.line.strokeColor=n.A.rgb2bw(e.line.strokeColor),e.line.highlightStrokeColor=n.A.rgb2bw(e.line.highlightStrokeColor),e.circle.fillColor=n.A.rgb2bw(e.circle.fillColor),e.circle.highlightFillColor=n.A.rgb2bw(e.circle.highlightFillColor),e.circle.strokeColor=n.A.rgb2bw(e.circle.strokeColor),e.circle.highlightStrokeColor=n.A.rgb2bw(e.circle.highlightStrokeColor),e.arc.fillColor=n.A.rgb2bw(e.arc.fillColor),e.arc.highlightFillColor=n.A.rgb2bw(e.arc.highlightFillColor),e.arc.strokeColor=n.A.rgb2bw(e.arc.strokeColor),e.arc.highlightStrokeColor=n.A.rgb2bw(e.arc.highlightStrokeColor),e.polygon.fillColor=n.A.rgb2bw(e.polygon.fillColor),e.polygon.highlightFillColor=n.A.rgb2bw(e.polygon.highlightFillColor),e.sector.fillColor=n.A.rgb2bw(e.sector.fillColor),e.sector.highlightFillColor=n.A.rgb2bw(e.sector.highlightFillColor),e.curve.strokeColor=n.A.rgb2bw(e.curve.strokeColor),e.grid.gridColor=n.A.rgb2bw(e.grid.gridColor),s.A.useStandardOptions(t)},s.A.Options.normalizePointFace=s.A.normalizePointFace,e.A=s.A.Options},428:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){var _jxg_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(443),_base_constants_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(561),_base_text_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(925),_math_math_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(733),_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(571),_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(588),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(188),_utils_env_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(133);Object.create||(Object.create=function(t,e){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object prototype may only be an Object: "+t);if(null===t)throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.");if(void 0!==e)throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument.");function i(){}return i.prototype=t,new i});var priv={modules:{math:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A,"math/geometry":_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,"math/statistics":_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__.A,"math/numerics":_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.Numerics}},r,_ccache;_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode=function(t,e){this.scope={id:0,hasChild:!0,args:[],locals:{},context:null,previous:null},this.scopes=[],this.scopes.push(this.scope),this.dpstack=[[]],this.pscope=0,this.propstack=[{}],this.propscope=0,this.lhs=[],this.isLHS=!1,this.warnLog="jcwarn",this.$log=[],this.builtIn=this.defineBuiltIn(),this.operands=this.getPossibleOperands(),this.board=null,this.forceValueCall=!1,this.lineToElement={},this.parCurLine=1,this.parCurColumn=0,this.line=1,this.col=1,_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CA&&(this.CA=new _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CA(this.node,this.createNode,this)),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS&&(this.CAS=new _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS(this.node,this.createNode,this)),this.code="","string"==typeof t&&this.parse(t,e)},_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.extend(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode.prototype,{node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i){var s,r=this.node(t,e,[]);for(s=2;s<arguments.length;s++)r.children.push(arguments[s]);return"node_const"===r.type&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(r.value)&&(r.isMath=!0),r.line=this.parCurLine,r.col=this.parCurColumn,r},pushScope:function(t){var e={args:t,locals:{},context:null,previous:this.scope};return this.scope.hasChild=!0,this.scope=e,e.id=this.scopes.push(e)-1,e},popScope:function(){var t=this.scope.previous;return this.scope=null!==t?t:this.scope,this.scope},getElementById:function(t){return this.board.objects[t]},log:function(){this.$log.push(arguments),"object"==typeof console&&console.log&&console.log.apply(console,arguments)},creator:(_ccache={},(r=function(t){var e,i;return"function"==typeof _ccache[this.board.id+t]?e=_ccache[this.board.id+t]:(i=this,(e=function(e,s){var r;return void 0===(r=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(s)?s:{}).name&&void 0===r.id&&(r.name=0!==i.lhs[i.scope.id]?i.lhs[i.scope.id]:""),i.board.create(t,e,r)}).creator=!0,_ccache[this.board.id+t]=e),e}).clearCache=function(){_ccache={}},r),letvar:function(t,e){this.builtIn[t]&&this._warn('"'+t+'" is a predefined value.'),this.scope.locals[t]=e},isLocalVariable:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e.locals[t]))return e;e=e.previous}return null},isParameter:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.indexOf(e.args,t)>-1)return e;e=e.previous}return null},isCreator:function(t){return!!_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.elements[t]},isMathMethod:function(t){return"E"!==t&&!!Math[t]},isBuiltIn:function(t){return!!this.builtIn[t]},getvar:function(t,e,i){var s;if(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),null!==(s=this.isLocalVariable(t)))return s.locals[t];if("$board"===t||"EULER"===t||"PI"===t)return this.builtIn[t];if(i){if(this.isBuiltIn(t))return this.builtIn[t];if(this.isMathMethod(t))return Math[t];if(this.isCreator(t))return this.creator(t)}return e||(s=this.board.select(t))===t?void 0:s},resolve:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e.locals[t]))return e.locals[t];e=e.previous}},getvarJS:function(t,e,i){var s,r="";return e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,!1),null!==this.isParameter(t)?t:null===this.isLocalVariable(t)||i?this.isCreator(t)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })":(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t)?(r=this.builtIn[t].src||this.builtIn[t],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(r)||r.match(/board\.select/)?r:(t=r.split(".").pop(),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLib)&&null!==(s=new RegExp("^Math."+t)).exec(r)?r.replace(s,"$jc$.board.mathLib."+t):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLibJXG)&&null!==(s=new RegExp("^JXG.Math.")).exec(r)?r.replace(s,"$jc$.board.mathLibJXG."):r)):this.isMathMethod(t)?"$jc$.board.mathLib."+t:e?"":(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isGroup(this.board,t)&&(r="$jc$.board.groups['"+t+"']"),r)):"$jc$.resolve('"+t+"')"},makeMap:function(t){return t.isMap=!0,t},functionCodeJS:function(t){var e=t.children[0].join(", "),i="",s="";return"op_map"===t.value&&(i="{ return  ",s=" }"),"function ("+e+") {\nvar $oldscope$ = $jc$.scope;\n$jc$.scope = $jc$.scopes["+this.scope.id+"];\nvar r = (function () "+i+this.compile(t.children[1],!0)+s+")();\n$jc$.scope = $oldscope$;\nreturn r;\n}"},defineFunction:function(node){var fun,i,that=this,list=node.children[0],scope=this.pushScope(list),_that;if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i<list.length;i++)scope.locals[list[i]]=list[i];this.replaceNames(node.children[1]),fun=function(jc){var fun,str="var f = function($jc$) { return "+jc.functionCodeJS(node)+"}; f;";try{for(fun=eval(str)(jc),scope.argtypes=[],i=0;i<list.length;i++)scope.argtypes.push(that.resolveType(list[i],node));return fun}catch(t){return jc._warn("error compiling function\n\n"+str+"\n\n"+t.toString()),function(){}}}(this),this.popScope()}else fun=function(t,e,i){return function(){var s,r;for(r=e.scope,e.scope=e.scopes[i],s=0;s<t.length;s++)e.scope.locals[t[s]]=arguments[s];return s=e.execute(node.children[1]),e.scope=r,s}}(list,this,scope.id);return fun.node=node,fun.scope=scope,fun.toJS=fun.toString,fun.toString=(_that=this,function(){return _that.compile(_that.replaceIDs(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(node)))}),fun.deps={},this.collectDependencies(node.children[1],node.children[0],fun.deps),fun},mergeAttributes:function(t){var e,i={};for(e=0;e<arguments.length;e++)i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(i,arguments[e],!0);return i},setProp:function(t,e,i){var s,r,o={};t.elementClass!==_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.OBJECT_CLASS_POINT||"X"!==e&&"Y"!==e?t.elementClass!==_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.OBJECT_CLASS_TEXT||"X"!==e&&"Y"!==e?t.type&&t.elementClass&&t.visProp?_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t[t.methodMap[e]])&&"function"!=typeof t[t.methodMap[e]]?t[t.methodMap[e]]=i:(o[e]=i,t.setAttribute(o)):t[e]=i:("number"==typeof i?t[e]=function(){return i}:"function"==typeof i?(t.isDraggable=!1,t[e]=i):"string"==typeof i&&(t.isDraggable=!1,t[e]=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.createFunction(i,this.board),t[e+"jc"]=i),t[e].origin=i,this.board.update()):(e=e.toLowerCase(),t.isDraggable&&"number"==typeof i?(s="x"===e?i:t.X(),r="y"===e?i:t.Y(),t.setPosition(_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.COORDS_BY_USER,[s,r])):!t.isDraggable||"function"!=typeof i&&"string"!=typeof i?t.isDraggable||(s="x"===e?i:t.XEval.origin,r="y"===e?i:t.YEval.origin,t.addConstraint([s,r])):(s="x"===e?i:t.coords.usrCoords[1],r="y"===e?i:t.coords.usrCoords[2],t.addConstraint([s,r])),this.board.update())},_genericParse:function(t,e,i,s){var r,o,n,a,h=t.replace(/\r\n/g,"\n").split("\n"),l={},c=[];s||(this.code+=t+"\n"),_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A&&(o=_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setText,_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setText=_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setTextJessieCode);try{for(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)||(i=!1),r=0;r<h.length;r++)i&&(h[r]=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.GeonextParser.geonext2JS(h[r],this.board)),c.push(h[r]);switch(t=c.join("\n"),n=parser.parse(t),this.CA&&(n=this.CA.expandDerivatives(n,null,n),n=this.CA.removeTrivialNodes(n)),this.CAS&&(n=this.CAS.expandDerivatives(n,null,n)),e){case"parse":a=this.execute(n);break;case"manipulate":a=this.compile(n);break;case"simplify":_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.CAS)?(l.method=l.method||"strong",l.form=l.form||"fractions",l.steps=l.steps||[],l.iterations=l.iterations||1e3,n=this.CAS.simplify(n,l),a=this.CAS.compile(n)):a=this.compile(n);break;case"getAst":a=n;break;default:a=!1}}catch(t){throw t}finally{_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A&&(_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setText=o)}return a},parse:function(t,e,i){return this._genericParse(t,"parse",e,i)},manipulate:function(t,e,i){return this._genericParse(t,"manipulate",e,i)},simplify:function(t){return this._genericParse(t,"simplify")},getAST:function(t,e,i){return this._genericParse(t,"getAst",e,i)},snippet:function(t,e,i,s,r){var o;return e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!0),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,""),s=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(s,!1),this.forceValueCall=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(r,!0),o=(e?" function ("+i+") { return ":"")+t+(e?"; }":"")+";",this.parse(o,s,!0)},replaceIDs:function(t){var e,i;if(t.replaced&&(i=this.board.objects[t.children[1][0].value],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)&&""!==i.name&&(t.type="node_var",t.value=i.name,t.children.length=0,delete t.replaced)),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(e=0;e<t.length;e++)t[e]=this.replaceIDs(t[e]);if(t.children)for(e=t.children.length;e>0;e--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[e-1])&&(t.children[e-1]=this.replaceIDs(t.children[e-1]));return t},replaceNames:function(t,e){var i,s,r=!1;if(void 0!==e&&(r=e),s=t.value,"node_op"===t.type&&"op_lhs"===s&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(s,!0):!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.getvar(s,!0))&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.elementsByName[s])&&(r&&"slider"!==this.board.elementsByName[s].elType&&(r=!1),t=this.createReplacementNode(t,r))),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=0;i<t.length;i++)t[i]=this.replaceNames(t[i],r);if(t.children)for(this.forceValueCall&&("op_execfun"===t.value&&"V"!==t.children[0].value&&"$"!==t.children[0].value&&(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(Math[t.children[0].value])||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A[t.children[0].value]))&&"node_var"===t.children[1][0].type||"op_return"===t.value&&1===t.children.length&&"node_var"===t.children[0].type)&&(r=!0),i=t.children.length;i>0;i--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[i-1])&&(t.children[i-1]=this.replaceNames(t.children[i-1],r));return"node_op"===t.type&&"op_lhs"===t.value&&1===t.children.length&&(this.isLHS=!1),t},createReplacementNode:function(t,e){var i=t.value,s=this.board.elementsByName[i];return(t=this.createNode("node_op","op_execfun",this.createNode("node_var",!0===e?"$value":"$"),[this.createNode("node_str",s.id)])).replaced=!0,t},collectDependencies:function(t,e,i){var s,r,o,n;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(n=t.length,s=0;s<n;s++)this.collectDependencies(t[s],e,i);else if(r=t.value,"node_var"===t.type&&e.indexOf(r)<0&&(o=this.getvar(r))&&o.visProp&&o.elType&&o.elementClass&&o.id&&(i[o.id]=o),"node_op"===t.type&&"op_execfun"===t.value&&t.children.length>1&&("$"===t.children[0].value||"$value"===t.children[0].value)&&t.children[1].length>0&&(i[o=t.children[1][0].value]=this.board.objects[o]),t.children)for(s=t.children.length;s>0;s--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[s-1])&&this.collectDependencies(t.children[s-1],e,i)},resolveProperty:function(t,e,i){return i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,!1),t&&t.methodMap&&(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.subs)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.subs[e])?t=t.subs:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.methodMap[e])?e=t.methodMap[e]:(t=t.visProp,e=e.toLowerCase())),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isFunction(t)&&this._error("Accessing function properties is not allowed."),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)||this._error(t+" is not an object"),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t[e])||this._error("unknown property "+e),i&&"function"==typeof t[e]?function(){return t[e].apply(t,arguments)}:t[e]},resolveType:function(t,e){var i,s;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0;i<e.length;i++)if("any"!==(s=this.resolveType(t,e[i])))return s;if("node_op"===e.type&&"op_execfun"===e.value&&"node_var"===e.children[0].type&&e.children[0].value===t)return"function";if("node_op"===e.type){for(i=0;i<e.children.length;i++)if("node_var"===e.children[0].type&&e.children[0].value===t&&("op_add"===e.value||"op_sub"===e.value||"op_mul"===e.value||"op_div"===e.value||"op_mod"===e.value||"op_exp"===e.value||"op_neg"===e.value))return"any";for(i=0;i<e.children.length;i++)if("any"!==(s=this.resolveType(t,e.children[i])))return s}return"any"},getLHS:function(t){var e;if("node_var"===t.type)e={o:this.scope.locals,what:t.value};else if("node_op"===t.type&&"op_property"===t.value)e={o:this.execute(t.children[0]),what:t.children[1]};else{if("node_op"!==t.type||"op_extvalue"!==t.value)throw new Error("Syntax error: Invalid left-hand side of assignment.");e={o:this.execute(t.children[0]),what:this.execute(t.children[1])}}return e},getLHSCompiler:function(t,e){var i;if("node_var"===t.type)i=t.value;else if("node_op"===t.type&&"op_property"===t.value)i=[this.compile(t.children[0],e),"'"+t.children[1]+"'"];else{if("node_op"!==t.type||"op_extvalue"!==t.value)throw new Error("Syntax error: Invalid left-hand side of assignment.");i=[this.compile(t.children[0],e),"node_const"===t.children[1].type?t.children[1].value:this.compile(t.children[1],e)]}return i},execute:function(t){var e,i,s,r,o,n,a,h,l,c,u=[];if(e=0,!t)return e;switch(this.line=t.line,this.col=t.col,t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&this.execute(t.children[0]),t.children[1]&&(e=this.execute(t.children[1]));break;case"op_assign":i=this.getLHS(t.children[0]),this.lhs[this.scope.id]=i.what,i.o.type&&i.o.elementClass&&i.o.methodMap&&"label"===i.what&&this._error("Left-hand side of assignment is read-only."),e=this.execute(t.children[1]),i.o!==this.scope.locals||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(i.o)&&"number"==typeof i.what?this.setProp(i.o,i.what,e):this.letvar(i.what,e),this.lhs[this.scope.id]=0;break;case"op_if":this.execute(t.children[0])&&(e=this.execute(t.children[1]));break;case"op_conditional":case"op_if_else":e=this.execute(t.children[0])?this.execute(t.children[1]):this.execute(t.children[2]);break;case"op_while":for(;this.execute(t.children[0]);)this.execute(t.children[1]);break;case"op_do":do{this.execute(t.children[0])}while(this.execute(t.children[1]));break;case"op_for":for(this.execute(t.children[0]);this.execute(t.children[1]);this.execute(t.children[2]))this.execute(t.children[3]);break;case"op_proplst":t.children[0]&&this.execute(t.children[0]),t.children[1]&&this.execute(t.children[1]);break;case"op_emptyobject":e={};break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(t.children[0]),e=this.propstack[this.propscope],this.propstack.pop(),this.propscope--;break;case"op_prop":this.propstack[this.propscope][t.children[0]]=this.execute(t.children[1]);break;case"op_array":for(e=[],o=t.children[0].length,s=0;s<o;s++)e.push(this.execute(t.children[0][s]));break;case"op_extvalue":e=this.execute(t.children[0]),e="number"==typeof(s=this.execute(t.children[1]))&&Math.abs(Math.round(s)-s)<1e-12?e[s]:undefined;break;case"op_return":if(0!==this.scope)return this.execute(t.children[0]);this._error("Unexpected return.");break;case"op_map":t.children[1].isMath||"node_var"===t.children[1].type||this._error("execute: In a map only function calls and mathematical expressions are allowed."),(h=this.defineFunction(t)).isMap=!0,e=h;break;case"op_function":(h=this.defineFunction(t)).isMap=!1,e=h;break;case"op_execfun":if(this.dpstack.push([]),this.pscope++,n=t.children[1],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[2]))if(t.children[3])for(a=t.children[2],l={},s=0;s<a.length;s++)l=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(l,this.execute(a[s]),!0);else l=this.execute(t.children[2]);for(t.children[0]._isFunctionName=!0,h=this.execute(t.children[0]),delete t.children[0]._isFunctionName,c=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(h)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(h.sc)?h.sc:this,!h.creator&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[2])&&this._error("Unexpected value. Only element creators are allowed to have a value after the function call."),s=0;s<n.length;s++)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(h.scope)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(h.scope.argtypes)&&"function"===h.scope.argtypes[s]?(n[s]._isFunctionName=!0,u[s]=this.execute(n[s]),delete n[s]._isFunctionName):u[s]=this.execute(n[s]),this.dpstack[this.pscope].push({line:t.children[1][s].line,col:t.children[1][s].ecol});if("function"!=typeof h||h.creator)if("function"==typeof h&&h.creator){r=this.line;try{for((e=h(u,l)).jcLineStart=r,e.jcLineEnd=t.eline,s=r;s<=t.line;s++)this.lineToElement[s]=e;e.debugParents=this.dpstack[this.pscope]}catch(t){this._error(t.toString())}}else this._error("Function '"+h+"' is undefined.");else e=h.apply(c,u);this.dpstack.pop(),this.pscope--;break;case"op_property":r=this.execute(t.children[0]),i=t.children[1],e=this.resolveProperty(r,i,!1),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)&&["number","string","boolean"].indexOf(typeof e)<0&&(e.sc=r);break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),this.use(t.children[0].toString());break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),i=this.getvar(t.children[0]),e=this.del(i);break;case"op_eq":e=this.execute(t.children[0])==this.execute(t.children[1]);break;case"op_neq":e=this.execute(t.children[0])!=this.execute(t.children[1]);break;case"op_approx":e=Math.abs(this.execute(t.children[0])-this.execute(t.children[1]))<_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.eps;break;case"op_gt":e=this.execute(t.children[0])>this.execute(t.children[1]);break;case"op_lt":e=this.execute(t.children[0])<this.execute(t.children[1]);break;case"op_geq":e=this.execute(t.children[0])>=this.execute(t.children[1]);break;case"op_leq":e=this.execute(t.children[0])<=this.execute(t.children[1]);break;case"op_or":e=this.execute(t.children[0])||this.execute(t.children[1]);break;case"op_and":e=this.execute(t.children[0])&&this.execute(t.children[1]);break;case"op_not":e=!this.execute(t.children[0]);break;case"op_add":e=this.add(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_sub":e=this.sub(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_div":e=this.div(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_mod":e=this.mod(this.execute(t.children[0]),this.execute(t.children[1]),!0);break;case"op_mul":e=this.mul(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_exp":e=this.pow(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_neg":e=this.neg(this.execute(t.children[0]))}break;case"node_var":e=this.getvar(t.value,!1,t._isFunctionName);break;case"node_const":e=null===t.value?null:Number(t.value);break;case"node_const_bool":e=t.value;break;case"node_str":e=t.value.replace(/\\(.)/g,"$1")}return e},compile:function(t,e){var i,s,r,o="";if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)||(e=!1),!t)return o;switch(t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&(o=this.compile(t.children[0],e)),t.children[1]&&(o+=this.compile(t.children[1],e));break;case"op_block":o="{\n"+this.compile(t.children[0],e)+" }\n";break;case"op_assign":e?(i=this.getLHSCompiler(t.children[0],e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(i)?o="$jc$.setProp("+i[0]+", "+i[1]+", "+this.compile(t.children[1],e)+");\n":(this.isLocalVariable(i)!==this.scope&&(this.scope.locals[i]=!0),o="$jc$.scopes["+this.scope.id+"].locals['"+i+"'] = "+this.compile(t.children[1],e)+";\n")):o=(i=this.compile(t.children[0]))+" = "+this.compile(t.children[1],e)+";\n";break;case"op_if":o=" if ("+this.compile(t.children[0],e)+") "+this.compile(t.children[1],e);break;case"op_if_else":o=" if ("+this.compile(t.children[0],e)+")"+this.compile(t.children[1],e),o+=" else "+this.compile(t.children[2],e);break;case"op_conditional":o="(("+this.compile(t.children[0],e)+")?("+this.compile(t.children[1],e),o+="):("+this.compile(t.children[2],e)+"))";break;case"op_while":o=" while ("+this.compile(t.children[0],e)+") {\n"+this.compile(t.children[1],e)+"}\n";break;case"op_do":o=" do {\n"+this.compile(t.children[0],e)+"} while ("+this.compile(t.children[1],e)+");\n";break;case"op_for":o=" for ("+this.compile(t.children[0],e)+this.compile(t.children[1],e)+"; "+this.compile(t.children[2],e).slice(0,-2)+") {\n"+this.compile(t.children[3],e)+"\n}\n";break;case"op_proplst":t.children[0]&&(o=this.compile(t.children[0],e)+", "),o+=this.compile(t.children[1],e);break;case"op_prop":o=t.children[0]+": "+this.compile(t.children[1],e);break;case"op_emptyobject":o=e?"{}":"<< >>";break;case"op_proplst_val":o=this.compile(t.children[0],e);break;case"op_array":for(r=[],s=0;s<t.children[0].length;s++)r.push(this.compile(t.children[0][s],e));o="["+r.join(", ")+"]";break;case"op_extvalue":o=this.compile(t.children[0],e)+"["+this.compile(t.children[1],e)+"]";break;case"op_return":o=" return "+this.compile(t.children[0],e)+";\n";break;case"op_map":t.children[1].isMath||"node_var"===t.children[1].type||this._error("compile: In a map only function calls and mathematical expressions are allowed."),r=t.children[0],o=e?" $jc$.makeMap(function ("+r.join(", ")+") { return "+this.compile(t.children[1],e)+"; })":"map ("+r.join(", ")+") -> "+this.compile(t.children[1],e);break;case"op_function":r=t.children[0],this.pushScope(r),o=e?this.functionCodeJS(t):" function ("+r.join(", ")+") "+this.compile(t.children[1],e),this.popScope();break;case"op_execfunmath":console.log("op_execfunmath: TODO"),o="-1";break;case"op_execfun":if(t.children[2]){for(r=[],s=0;s<t.children[2].length;s++)r.push(this.compile(t.children[2][s],e));i=e?"$jc$.mergeAttributes("+r.join(", ")+")":r.join(", ")}for(t.children[0].withProps=!!t.children[2],r=[],s=0;s<t.children[1].length;s++)r.push(this.compile(t.children[1][s],e));o=this.compile(t.children[0],e)+"("+r.join(", ")+(t.children[2]&&e?", "+i:"")+")"+(t.children[2]&&!e?" "+i:""),e&&(o+="\n"),e&&"$"===t.children[0].value&&(o="$jc$.board.objects["+this.compile(t.children[1][0],e)+"]");break;case"op_property":o=e&&"X"!==t.children[1]&&"Y"!==t.children[1]?"$jc$.resolveProperty("+this.compile(t.children[0],e)+", '"+t.children[1]+"', true)":this.compile(t.children[0],e)+"."+t.children[1];break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),o=e?"$jc$.use('":"use('",o+=t.children[0].toString()+"');";break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),o=e?"$jc$.del(":"remove(",o+=this.compile(t.children[0],e)+")";break;case"op_eq":o="("+this.compile(t.children[0],e)+" === "+this.compile(t.children[1],e)+")";break;case"op_neq":o="("+this.compile(t.children[0],e)+" !== "+this.compile(t.children[1],e)+")";break;case"op_approx":o="("+this.compile(t.children[0],e)+" ~= "+this.compile(t.children[1],e)+")";break;case"op_gt":o=e?"$jc$.gt("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" > "+this.compile(t.children[1],e)+")";break;case"op_lt":o=e?"$jc$.lt("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" < "+this.compile(t.children[1],e)+")";break;case"op_geq":o=e?"$jc$.geq("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" >= "+this.compile(t.children[1],e)+")";break;case"op_leq":o=e?"$jc$.leq("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" <= "+this.compile(t.children[1],e)+")";break;case"op_or":o="("+this.compile(t.children[0],e)+" || "+this.compile(t.children[1],e)+")";break;case"op_and":o="("+this.compile(t.children[0],e)+" && "+this.compile(t.children[1],e)+")";break;case"op_not":o="!("+this.compile(t.children[0],e)+")";break;case"op_add":o=e?"$jc$.add("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" + "+this.compile(t.children[1],e)+")";break;case"op_sub":o=e?"$jc$.sub("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" - "+this.compile(t.children[1],e)+")";break;case"op_div":o=e?"$jc$.div("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" / "+this.compile(t.children[1],e)+")";break;case"op_mod":o=e?"$jc$.mod("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+", true)":"("+this.compile(t.children[0],e)+" % "+this.compile(t.children[1],e)+")";break;case"op_mul":o=e?"$jc$.mul("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" * "+this.compile(t.children[1],e)+")";break;case"op_exp":o=e?"$jc$.pow("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+"^"+this.compile(t.children[1],e)+")";break;case"op_neg":o=e?"$jc$.neg("+this.compile(t.children[0],e)+")":"(-"+this.compile(t.children[0],e)+")"}break;case"node_var":o=e?this.getvarJS(t.value,!1,t.withProps):t.value;break;case"node_const":case"node_const_bool":o=t.value;break;case"node_str":o="'"+t.value+"'"}return t.needsAngleBrackets&&(o=e?"{\n"+o+" }\n":"<< "+o+" >>\n"),o},getName:function(t,e){var i="";return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.getName)?(i=t.getName(),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)&&""!==i||!e||(i=t.id)):e&&(i=t.id),i},X:function(t){return t.X()},Y:function(t){return t.Y()},V:function(t){return t.Value()},L:function(t){return t.L()},area:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Area)||this._error("Error: Can't calculate area."),t.Area()},perimeter:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Perimeter)||this._error("Error: Can't calculate perimeter."),t.Perimeter()},dist:function(t,e){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Dist)||this._error("Error: Can't calculate distance."),t.Dist(e)},radius:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Radius)||this._error("Error: Can't calculate radius."),t.Radius()},slope:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Slope)||this._error("Error: Can't calculate slope."),t.Slope()},add:function(t,e){var i,s,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))r=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.add(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(s=Math.min(t.length,e.length),r=[],i=0;i<s;i++)r[i]=t[i]+e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?r=t+e:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(t)||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(e)?r=t.toString()+e.toString():this._error("Operation + not defined on operands "+typeof t+" and "+typeof e);return r},sub:function(t,e){var i,s,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))r=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.sub(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(s=Math.min(t.length,e.length),r=[],i=0;i<s;i++)r[i]=t[i]-e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?r=t-e:this._error("Operation - not defined on operands "+typeof t+" and "+typeof e);return r},neg:function(t){var e,i,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t))s=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.negative(t);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=t.length,s=[],e=0;e<i;e++)s[e]=-t[e];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)?s=-t:this._error("Unary operation - not defined on operand "+typeof t);return s},mul:function(t,e){var i,s,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)&&(i=t,e=t=e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))r=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.mul(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))s=Math.min(t.length,e.length),r=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.innerProduct(t,e,s);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(s=e.length,r=[],i=0;i<s;i++)r[i]=t*e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?r=t*e:this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return r},div:function(t,e){var i,s,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))r=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.div(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e))for(s=t.length,r=[],i=0;i<s;i++)r[i]=t[i]/e;else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?r=t/e:this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return r},mod:function(t,e){var i,s,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.fmod(t,e);if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e))for(s=t.length,r=[],i=0;i<s;i++)r[i]=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.mod(t[i],e,!0);else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?r=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.mod(t,e,!0):this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return r},pow:function(t,e){return t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.pow(t,e):_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.pow(t,e)},lt:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.lt(t,e):t<e},leq:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.leq(t,e):t<=e},gt:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.gt(t,e):t>e},geq:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.geq(t,e):t>=e},randint:function(t,e,i){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)||(i=1),Math.round(Math.random()*(e-t)/i)*i+t},DDD:function(t){console.log("Dummy derivative function. This should never appear!")},ifthen:function(t,e,i){return t?e:i},del:function(t){"object"==typeof t&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t.type)&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t.elementClass)&&this.board.removeObject(t)},eval:function(t){return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.evaluate(t)},use:function(t){var e,i,s=!1;if("string"==typeof t){for(e in _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards)if(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards.hasOwnProperty(e)&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards[e].container===t){i=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards[e],s=!0;break}}else i=t,s=!0;s?(this.board=i,this.builtIn.$board=i,this.builtIn.$board.src="$jc$.board"):this._error("Board '"+t+"' not found!")},findSymbol:function(t,e){var i,s;for(s=-1===(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,-1))?this.scope:this.scopes[e];null!==s;){for(i in s.locals)if(s.locals.hasOwnProperty(i)&&s.locals[i]===t)return[i,s];s=s.previous}return[]},importModule:function(t){return priv.modules[t.toLowerCase()]},defineBuiltIn:function(){var t=this,e={PI:Math.PI,EULER:Math.E,D:t.DDD,X:t.X,Y:t.Y,V:t.V,Value:t.V,L:t.L,Length:t.L,acosh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.acosh,acot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.acot,asinh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.asinh,binomial:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.binomial,cbrt:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cbrt,cosh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cosh,cot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cot,deg:_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A.trueAngle,A:t.area,area:t.area,Area:t.area,perimeter:t.perimeter,Perimeter:t.perimeter,dist:t.dist,Dist:t.dist,R:t.radius,radius:t.radius,Radius:t.radius,erf:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erf,erfc:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erfc,erfi:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erfi,factorial:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.factorial,gcd:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.gcd,lb:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,lcm:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.lcm,ld:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,lg:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log10,ln:Math.log,log:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log,log10:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log10,log2:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,ndtr:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ndtr,ndtri:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ndtri,nthroot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.nthroot,pow:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.pow,rad:_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A.rad,ratpow:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ratpow,trunc:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.trunc,sinh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.sinh,slope:t.slope,Slope:t.slope,randint:t.randint,IfThen:t.ifthen,import:t.importModule,eval:t.eval,use:t.use,remove:t.del,$:t.getElementById,$value:function(e){return t.getElementById(e).Value()},getName:t.getName,name:t.getName,$board:t.board,$log:t.log};return e.rad.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,e.deg.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,e.factorial.sc=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A,e.X.src="$jc$.X",e.Y.src="$jc$.Y",e.V.src="$jc$.V",e.Value.src="$jc$.V",e.L.src="$jc$.L",e.Length.src="$jc$.L",e.acosh.src="JXG.Math.acosh",e.acot.src="JXG.Math.acot",e.asinh.src="JXG.Math.asinh",e.binomial.src="JXG.Math.binomial",e.cbrt.src="JXG.Math.cbrt",e.cot.src="JXG.Math.cot",e.cosh.src="JXG.Math.cosh",e.deg.src="JXG.Math.Geometry.trueAngle",e.erf.src="JXG.Math.erf",e.erfc.src="JXG.Math.erfc",e.erfi.src="JXG.Math.erfi",e.A.src="$jc$.area",e.area.src="$jc$.area",e.Area.src="$jc$.area",e.perimeter.src="$jc$.perimeter",e.Perimeter.src="$jc$.perimeter",e.dist.src="$jc$.dist",e.Dist.src="$jc$.dist",e.R.src="$jc$.radius",e.radius.src="$jc$.radius",e.Radius.src="$jc$.radius",e.factorial.src="JXG.Math.factorial",e.gcd.src="JXG.Math.gcd",e.lb.src="JXG.Math.log2",e.lcm.src="JXG.Math.lcm",e.ld.src="JXG.Math.log2",e.lg.src="JXG.Math.log10",e.ln.src="Math.log",e.log.src="JXG.Math.log",e.log10.src="JXG.Math.log10",e.log2.src="JXG.Math.log2",e.ndtr.src="JXG.Math.ndtr",e.ndtri.src="JXG.Math.ndtri",e.nthroot.src="JXG.Math.nthroot",e.pow.src="JXG.Math.pow",e.rad.src="JXG.Math.Geometry.rad",e.ratpow.src="JXG.Math.ratpow",e.trunc.src="JXG.trunc",e.sinh.src="JXG.Math.sinh",e.slope.src="$jc$.slope",e.Slope.src="$jc$.slope",e.randint.src="$jc$.randint",e.import.src="$jc$.importModule",e.eval.src="$jc$.eval",e.use.src="$jc$.use",e.remove.src="$jc$.del",e.IfThen.src="$jc$.ifthen",e.$.src="(function (n) { return $jc$.board.select(n); })",e.$value.src="(function (n) { return $jc$.board.select(n).Value(); })",e.getName.src="$jc$.getName",e.name.src="$jc$.getName",e.$board&&(e.$board.src="$jc$.board"),e.$log.src="$jc$.log",e=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.merge(e,t._addedBuiltIn)},_addedBuiltIn:{},addBuiltIn:function(t,e){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.builtIn)){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.builtIn[t]))return;this.builtIn[t]=e,this.builtIn[t].src="$jc$."+t}_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this._addedBuiltIn[t])||(this._addedBuiltIn[t]=e,this._addedBuiltIn[t].src="$jc$."+t,_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode.prototype[t]=e)},getPossibleOperands:function(){var t,e,i,s,r,o,n,a,h,l,c,u,d,p,f=["E"],_=this.builtIn||this.defineBuiltIn(),g=Math;for(d=function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())},p=function(t,e){var i=null;if("jc"===e)i=_[t];else{if("Math"!==e)return;i=g[t]}if(!(f.indexOf(t)>=0))return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isFunction(i)?{name:t,type:"function",numParams:i.length,origin:e}:_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isNumber(i)?{name:t,type:"constant",value:i,origin:e}:void(t.startsWith("$")||void 0!==i&&console.error("undefined type",i))},t=Object.getOwnPropertyNames(_).sort(d),e=Object.getOwnPropertyNames(g).sort(d),i=[],s=0,r=0;s<t.length||r<e.length;)t[s]===e[r]?(o=p(e[r],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),s++,r++):!_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(e[r])||t[s].toLowerCase().localeCompare(e[r].toLowerCase())<0?(o=p(t[s],"jc"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),s++):(o=p(e[r],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),r++);for(h=[],l=[],c=[],u={},n=i.length,s=0;s<n;s++){switch((a=i[s]).type){case"function":h.push(a.name),"jc"===a.origin&&l.push(a.name);break;case"constant":c.push(a.name)}u[a.name]=a}return{all:u,list:i,functions:h,functions_jessiecode:l,constants:c}},_debug:function(t){"object"==typeof console&&console.log?console.log(t):_utils_env_js__WEBPACK_IMPORTED_MODULE_8__.A.isBrowser&&document&&null!==document.getElementById("debug")&&(document.getElementById("debug").innerText+=t+"\n")},_error:function(t){var e=new Error("Error("+this.line+"): "+t);throw e.line=this.line,e},_warn:function(t){"object"==typeof console&&console.log?console.log("Warning("+this.line+"): "+t):_utils_env_js__WEBPACK_IMPORTED_MODULE_8__.A.isBrowser&&document&&null!==document.getElementById(this.warnLog)&&(document.getElementById(this.warnLog).innerText+="Warning("+this.line+"): "+t+"\n")},_log:function(t){"object"!=typeof window&&"object"==typeof self&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+t.toString()}):console.log("Log: ",arguments)}});var parser=function(){var t=function(t,e,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=e);return i},e=[2,14],i=[1,13],s=[1,37],r=[1,14],o=[1,15],n=[1,21],a=[1,16],h=[1,17],l=[1,33],c=[1,18],u=[1,19],d=[1,12],p=[1,59],f=[1,60],_=[1,58],g=[1,46],A=[1,48],m=[1,49],b=[1,50],y=[1,51],v=[1,52],C=[1,53],P=[1,54],x=[1,45],E=[1,38],O=[1,39],M=[5,7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],w=[5,7,8,12,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],S=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],T=[2,48],N=[1,72],j=[10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,66,83,86],D=[1,78],k=[8,10,16,32,34,35,37,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],R=[1,82],L=[8,10,16,32,34,35,37,39,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],B=[1,83],I=[1,84],Y=[1,85],V=[8,10,16,32,34,35,37,39,41,42,43,50,51,53,54,55,57,64,65,66,83,86],X=[1,89],U=[1,90],F=[1,91],z=[1,92],J=[1,97],G=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,53,54,55,57,64,65,66,83,86],W=[1,103],H=[1,104],K=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,57,64,65,66,83,86],$=[1,105],q=[1,106],Z=[1,107],Q=[1,126],tt=[1,139],et=[83,86],it=[1,150],st=[10,66,86],rt=[8,10,16,20,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,82,83,86],ot=[1,167],nt=[10,86],at={trace:function(){},yy:{},symbols_:{error:2,Program:3,StatementList:4,EOF:5,IfStatement:6,IF:7,"(":8,Expression:9,")":10,Statement:11,ELSE:12,LoopStatement:13,WHILE:14,FOR:15,";":16,DO:17,UnaryStatement:18,USE:19,IDENTIFIER:20,DELETE:21,ReturnStatement:22,RETURN:23,EmptyStatement:24,StatementBlock:25,"{":26,"}":27,ExpressionStatement:28,AssignmentExpression:29,ConditionalExpression:30,LeftHandSideExpression:31,"=":32,LogicalORExpression:33,"?":34,":":35,LogicalANDExpression:36,"||":37,EqualityExpression:38,"&&":39,RelationalExpression:40,"==":41,"!=":42,"~=":43,AdditiveExpression:44,"<":45,">":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,MemberExpression:59,CallExpression:60,PrimaryExpression:61,FunctionExpression:62,MapExpression:63,".":64,"[":65,"]":66,BasicLiteral:67,ObjectLiteral:68,ArrayLiteral:69,NullLiteral:70,BooleanLiteral:71,StringLiteral:72,NumberLiteral:73,NULL:74,TRUE:75,FALSE:76,STRING:77,NUMBER:78,NAN:79,INFINITY:80,ElementList:81,"<<":82,">>":83,PropertyList:84,Property:85,",":86,PropertyName:87,Arguments:88,AttributeList:89,Attribute:90,FUNCTION:91,ParameterDefinitionList:92,MAP:93,"->":94,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"IF",8:"(",10:")",12:"ELSE",14:"WHILE",15:"FOR",16:";",17:"DO",19:"USE",20:"IDENTIFIER",21:"DELETE",23:"RETURN",26:"{",27:"}",32:"=",34:"?",35:":",37:"||",39:"&&",41:"==",42:"!=",43:"~=",45:"<",46:">",47:"<=",48:">=",50:"+",51:"-",53:"*",54:"/",55:"%",57:"^",58:"!",64:".",65:"[",66:"]",74:"NULL",75:"TRUE",76:"FALSE",77:"STRING",78:"NUMBER",79:"NAN",80:"INFINITY",82:"<<",83:">>",86:",",91:"FUNCTION",93:"MAP",94:"->"},productions_:[0,[3,2],[6,5],[6,7],[13,5],[13,9],[13,7],[18,2],[18,2],[22,2],[22,3],[24,1],[25,3],[4,2],[4,0],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[28,2],[9,1],[29,1],[29,3],[30,1],[30,5],[33,1],[33,3],[36,1],[36,3],[38,1],[38,3],[38,3],[38,3],[40,1],[40,3],[40,3],[40,3],[40,3],[44,1],[44,3],[44,3],[49,1],[49,3],[49,3],[49,3],[56,1],[56,3],[52,1],[52,2],[52,2],[52,2],[31,1],[31,1],[59,1],[59,1],[59,1],[59,3],[59,4],[61,1],[61,1],[61,1],[61,1],[61,3],[67,1],[67,1],[67,1],[67,1],[70,1],[71,1],[71,1],[72,1],[73,1],[73,1],[73,1],[69,2],[69,3],[68,2],[68,3],[84,1],[84,3],[85,3],[87,1],[87,1],[87,1],[60,2],[60,3],[60,2],[60,4],[60,3],[88,2],[88,3],[89,1],[89,3],[90,1],[90,1],[81,1],[81,3],[62,4],[62,5],[63,5],[63,6],[92,1],[92,3]],performAction:function(t,e,i,s,r,o,n){var a=o.length-1;switch(r){case 1:return o[a-1];case 2:this.$=ht.createNode(lt(n[a-4]),"node_op","op_if",o[a-2],o[a]);break;case 3:this.$=ht.createNode(lt(n[a-6]),"node_op","op_if_else",o[a-4],o[a-2],o[a]);break;case 4:this.$=ht.createNode(lt(n[a-4]),"node_op","op_while",o[a-2],o[a]);break;case 5:this.$=ht.createNode(lt(n[a-8]),"node_op","op_for",o[a-6],o[a-4],o[a-2],o[a]);break;case 6:this.$=ht.createNode(lt(n[a-6]),"node_op","op_do",o[a-5],o[a-2]);break;case 7:this.$=ht.createNode(lt(n[a-1]),"node_op","op_use",o[a]);break;case 8:this.$=ht.createNode(lt(n[a-1]),"node_op","op_delete",o[a]);break;case 9:this.$=ht.createNode(lt(n[a-1]),"node_op","op_return",void 0);break;case 10:this.$=ht.createNode(lt(n[a-2]),"node_op","op_return",o[a-1]);break;case 11:case 14:this.$=ht.createNode(lt(n[a]),"node_op","op_none");break;case 12:this.$=ht.createNode(lt(n[a-2]),"node_op","op_block",o[a-1]);break;case 13:this.$=ht.createNode(lt(n[a-1]),"node_op","op_none",o[a-1],o[a]);break;case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 23:case 24:case 26:case 28:case 30:case 32:case 36:case 41:case 44:case 48:case 50:case 52:case 54:case 55:case 56:case 58:case 62:case 81:case 84:case 85:case 86:this.$=o[a];break;case 22:case 65:case 93:this.$=o[a-1];break;case 25:this.$=ht.createNode(lt(n[a-2]),"node_op","op_assign",o[a-2],o[a]),this.$.isMath=!1;break;case 27:this.$=ht.createNode(lt(n[a-4]),"node_op","op_conditional",o[a-4],o[a-2],o[a]),this.$.isMath=!1;break;case 29:this.$=ht.createNode(lt(n[a-2]),"node_op","op_or",o[a-2],o[a]),this.$.isMath=!1;break;case 31:this.$=ht.createNode(lt(n[a-2]),"node_op","op_and",o[a-2],o[a]),this.$.isMath=!1;break;case 33:this.$=ht.createNode(lt(n[a-2]),"node_op","op_eq",o[a-2],o[a]),this.$.isMath=!1;break;case 34:this.$=ht.createNode(lt(n[a-2]),"node_op","op_neq",o[a-2],o[a]),this.$.isMath=!1;break;case 35:this.$=ht.createNode(lt(n[a-2]),"node_op","op_approx",o[a-2],o[a]),this.$.isMath=!1;break;case 37:this.$=ht.createNode(lt(n[a-2]),"node_op","op_lt",o[a-2],o[a]),this.$.isMath=!1;break;case 38:this.$=ht.createNode(lt(n[a-2]),"node_op","op_gt",o[a-2],o[a]),this.$.isMath=!1;break;case 39:this.$=ht.createNode(lt(n[a-2]),"node_op","op_leq",o[a-2],o[a]),this.$.isMath=!1;break;case 40:this.$=ht.createNode(lt(n[a-2]),"node_op","op_geq",o[a-2],o[a]),this.$.isMath=!1;break;case 42:this.$=ht.createNode(lt(n[a-2]),"node_op","op_add",o[a-2],o[a]),this.$.isMath=!0;break;case 43:this.$=ht.createNode(lt(n[a-2]),"node_op","op_sub",o[a-2],o[a]),this.$.isMath=!0;break;case 45:this.$=ht.createNode(lt(n[a-2]),"node_op","op_mul",o[a-2],o[a]),this.$.isMath=!0;break;case 46:this.$=ht.createNode(lt(n[a-2]),"node_op","op_div",o[a-2],o[a]),this.$.isMath=!0;break;case 47:this.$=ht.createNode(lt(n[a-2]),"node_op","op_mod",o[a-2],o[a]),this.$.isMath=!0;break;case 49:this.$=ht.createNode(lt(n[a-2]),"node_op","op_exp",o[a-2],o[a]),this.$.isMath=!0;break;case 51:this.$=ht.createNode(lt(n[a-1]),"node_op","op_not",o[a]),this.$.isMath=!1;break;case 53:this.$=ht.createNode(lt(n[a-1]),"node_op","op_neg",o[a]),this.$.isMath=!0;break;case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=o[a],this.$.isMath=!1;break;case 59:case 91:this.$=ht.createNode(lt(n[a-2]),"node_op","op_property",o[a-2],o[a]),this.$.isMath=!0;break;case 60:case 90:this.$=ht.createNode(lt(n[a-3]),"node_op","op_extvalue",o[a-3],o[a-1]),this.$.isMath=!0;break;case 61:this.$=ht.createNode(lt(n[a]),"node_var",o[a]);break;case 69:this.$=o[a],this.$.isMath=!0;break;case 70:this.$=ht.createNode(lt(n[a]),"node_const",null);break;case 71:this.$=ht.createNode(lt(n[a]),"node_const_bool",!0);break;case 72:this.$=ht.createNode(lt(n[a]),"node_const_bool",!1);break;case 73:this.$=ht.createNode(lt(n[a]),"node_str",o[a].substring(1,o[a].length-1));break;case 74:this.$=ht.createNode(lt(n[a]),"node_const",parseFloat(o[a]));break;case 75:this.$=ht.createNode(lt(n[a]),"node_const",NaN);break;case 76:this.$=ht.createNode(lt(n[a]),"node_const",1/0);break;case 77:this.$=ht.createNode(lt(n[a-1]),"node_op","op_array",[]);break;case 78:this.$=ht.createNode(lt(n[a-2]),"node_op","op_array",o[a-1]);break;case 79:this.$=ht.createNode(lt(n[a-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=ht.createNode(lt(n[a-2]),"node_op","op_proplst_val",o[a-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=ht.createNode(lt(n[a-2]),"node_op","op_proplst",o[a-2],o[a]);break;case 83:this.$=ht.createNode(lt(n[a-2]),"node_op","op_prop",o[a-2],o[a]);break;case 87:case 89:this.$=ht.createNode(lt(n[a-1]),"node_op","op_execfun",o[a-1],o[a]),this.$.isMath=!0;break;case 88:this.$=ht.createNode(lt(n[a-2]),"node_op","op_execfun",o[a-2],o[a-1],o[a],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 104:this.$=[o[a]];break;case 95:case 99:case 105:this.$=o[a-2].concat(o[a]);break;case 96:this.$=ht.createNode(lt(n[a]),"node_var",o[a]),this.$.isMath=!0;break;case 100:this.$=ht.createNode(lt(n[a-3]),"node_op","op_function",[],o[a]),this.$.isMath=!1;break;case 101:this.$=ht.createNode(lt(n[a-4]),"node_op","op_function",o[a-2],o[a]),this.$.isMath=!1;break;case 102:this.$=ht.createNode(lt(n[a-4]),"node_op","op_map",[],o[a]);break;case 103:this.$=ht.createNode(lt(n[a-5]),"node_op","op_map",o[a-3],o[a])}},table:[t([5,7,8,14,15,16,17,19,20,21,23,26,50,51,58,65,74,75,76,77,78,79,80,82,91,93],e,{3:1,4:2}),{1:[3]},{5:[1,3],6:6,7:i,8:s,9:20,11:4,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{1:[2,1]},t(M,[2,13]),t(w,[2,15]),t(w,[2,16]),t(w,[2,17]),t(w,[2,18]),t(w,[2,19]),t(w,[2,20]),t(w,[2,21]),t([7,8,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],e,{4:61}),{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:i,8:s,9:20,11:65,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{20:[1,66]},{20:[1,67]},{8:s,9:69,16:[1,68],20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{16:[1,70]},t(w,[2,11]),t(S,[2,23]),t(S,[2,24]),t([8,10,16,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],T,{32:[1,71],57:N}),t([8,10,16,32,35,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],[2,26],{34:[1,73],37:[1,74]}),t(j,[2,54],{88:77,8:D,64:[1,75],65:[1,76]}),t(j,[2,55],{88:79,8:D,64:[1,81],65:[1,80]}),t(k,[2,28],{39:R}),t(S,[2,56]),t(S,[2,57]),t(S,[2,58]),t(L,[2,30],{41:B,42:I,43:Y}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),t(S,[2,64]),{8:s,9:86,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:[1,87]},{8:[1,88]},t(V,[2,32],{45:X,46:U,47:F,48:z}),t(S,[2,66]),t(S,[2,67]),t(S,[2,68]),t(S,[2,69]),{20:J,72:98,73:99,77:y,78:v,79:C,80:P,83:[1,93],84:94,85:95,87:96},{8:s,20:l,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,81:101,82:x,91:E,93:O},t(G,[2,36],{50:W,51:H}),t(S,[2,70]),t(S,[2,71]),t(S,[2,72]),t(S,[2,73]),t(S,[2,74]),t(S,[2,75]),t(S,[2,76]),t(K,[2,41],{53:$,54:q,55:Z}),t(S,[2,44]),t(S,[2,50]),{8:s,20:l,31:109,50:p,51:f,52:108,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:110,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:111,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{6:6,7:i,8:s,9:20,11:4,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:113,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:114,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:115,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{14:[1,116]},t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),{16:[1,117]},t(w,[2,22]),{8:s,20:l,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:119,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,36:121,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{20:[1,122]},{8:s,9:123,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(S,[2,87],{89:124,90:125,68:127,20:Q,82:x}),{8:s,10:[1,128],20:l,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,81:129,82:x,91:E,93:O},t(S,[2,89]),{8:s,9:130,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{20:[1,131]},{8:s,20:l,31:109,38:132,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,40:133,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,40:134,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,40:135,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{10:[1,136]},{10:[1,137],20:tt,92:138},{10:[1,140],20:tt,92:141},{8:s,20:l,31:109,44:142,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,44:143,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,44:144,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,44:145,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(S,[2,79]),{83:[1,146],86:[1,147]},t(et,[2,81]),{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},t(S,[2,77]),{66:[1,149],86:it},t(st,[2,98]),{8:s,20:l,31:109,49:151,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,49:152,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:153,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:154,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,31:109,50:p,51:f,52:155,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(S,[2,51]),t([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],T,{57:N}),t(S,[2,52]),t(S,[2,53]),t([5,7,8,10,12,14,15,16,17,19,20,21,23,26,27,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,58,64,65,66,74,75,76,77,78,79,80,82,83,86,91,93],[2,12]),{10:[1,156]},{10:[1,157]},{16:[1,158]},{8:[1,159]},t(w,[2,10]),t(S,[2,25]),t(S,[2,49]),{35:[1,160]},t(k,[2,29],{39:R}),t(S,[2,59]),{66:[1,161]},t([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83],[2,88],{86:[1,162]}),t(S,[2,94]),t(S,[2,96]),t(S,[2,97]),t(rt,[2,92]),{10:[1,163],86:it},{66:[1,164]},t(S,[2,91]),t(L,[2,31],{41:B,42:I,43:Y}),t(V,[2,33],{45:X,46:U,47:F,48:z}),t(V,[2,34],{45:X,46:U,47:F,48:z}),t(V,[2,35],{45:X,46:U,47:F,48:z}),t(S,[2,65]),{25:165,26:d},{10:[1,166],86:ot},t(nt,[2,104]),{94:[1,168]},{10:[1,169],86:ot},t(G,[2,37],{50:W,51:H}),t(G,[2,38],{50:W,51:H}),t(G,[2,39],{50:W,51:H}),t(G,[2,40],{50:W,51:H}),t(S,[2,80]),{20:J,72:98,73:99,77:y,78:v,79:C,80:P,85:170,87:96},{8:s,20:l,29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(S,[2,78]),{8:s,20:l,29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(K,[2,42],{53:$,54:q,55:Z}),t(K,[2,43],{53:$,54:q,55:Z}),t(S,[2,45]),t(S,[2,46]),t(S,[2,47]),{6:6,7:i,8:s,9:20,11:173,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{6:6,7:i,8:s,9:20,11:174,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:175,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:176,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,20:l,29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(S,[2,60]),{20:Q,68:127,82:x,90:178},t(rt,[2,93]),t(S,[2,90]),t(S,[2,100]),{25:179,26:d},{20:[1,180]},{8:s,9:181,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{94:[1,182]},t(et,[2,82]),t(et,[2,83]),t(st,[2,99]),t(M,[2,2],{12:[1,183]}),t(w,[2,4]),{16:[1,184]},{10:[1,185]},t(S,[2,27]),t(S,[2,95]),t(S,[2,101]),t(nt,[2,105]),t(S,[2,102]),{8:s,9:186,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{6:6,7:i,8:s,9:20,11:187,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{8:s,9:188,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},{16:[1,189]},t(S,[2,103]),t(w,[2,3]),{10:[1,190]},t(w,[2,6]),{6:6,7:i,8:s,9:20,11:191,13:7,14:r,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:u,24:11,25:5,26:d,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:_,59:26,60:27,61:29,62:30,63:31,65:g,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:A,75:m,76:b,77:y,78:v,79:C,80:P,82:x,91:E,93:O},t(w,[2,5])],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],o=this.table,n="",a=0,h=0,l=0,c=r.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(t,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;r.push(f);var _=u.options&&u.options.ranges;"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,A,m,b,y,v,C,P,x,E=function(){var t;return"number"!=typeof(t=u.lex()||1)&&(t=e.symbols_[t]||t),t},O={};;){if(m=i[i.length-1],this.defaultActions[m]?b=this.defaultActions[m]:(null==g&&(g=E()),b=o[m]&&o[m][g]),void 0===b||!b.length||!b[0]){var M="";for(v in x=[],o[m])this.terminals_[v]&&v>2&&x.push("'"+this.terminals_[v]+"'");M=u.showPosition?"Parse error on line "+(a+1)+":\n"+u.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(M,{text:u.match,token:this.terminals_[g]||g,line:u.yylineno,loc:f,expected:x})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+g);switch(b[0]){case 1:i.push(g),s.push(u.yytext),r.push(u.yylloc),i.push(b[1]),g=null,A?(g=A,A=null):(h=u.yyleng,n=u.yytext,a=u.yylineno,f=u.yylloc,l>0&&l--);break;case 2:if(C=this.productions_[b[1]][1],O.$=s[s.length-C],O._$={first_line:r[r.length-(C||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(C||1)].first_column,last_column:r[r.length-1].last_column},_&&(O._$.range=[r[r.length-(C||1)].range[0],r[r.length-1].range[1]]),void 0!==(y=this.performAction.apply(O,[n,h,a,d.yy,b[1],s,r].concat(c))))return y;C&&(i=i.slice(0,-1*C*2),s=s.slice(0,-1*C),r=r.slice(0,-1*C)),i.push(this.productions_[b[1]][0]),s.push(O.$),r.push(O._$),P=o[i[i.length-2]][i[i.length-1]],i.push(P);break;case 3:return!0}}return!0}},ht={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,s){var r,o=this.node(e,i,[]);for(r=3;r<arguments.length;r++)o.children.push(arguments[r]);return o.line=t[0],o.col=t[1],o.eline=t[2],o.ecol=t[3],o}},lt=function(t){return[t.first_line,t.first_column,t.last_line,t.last_column]},ct=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,s,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var o in r)this[o]=r[o];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;o<r.length;o++)if((i=this._input.match(this.rules[r[o]]))&&(!e||i[0].length>e[0].length)){if(e=i,s=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,r[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,s){switch(i){case 0:case 6:case 7:break;case 1:case 2:case 3:return 78;case 4:case 5:return 77;case 8:return 7;case 9:return 12;case 10:return 14;case 11:return 17;case 12:return 15;case 13:return 91;case 14:return 93;case 15:return 19;case 16:return 23;case 17:return 21;case 18:return 75;case 19:return 76;case 20:return 74;case 21:return 80;case 22:case 23:return 94;case 24:return 82;case 25:return 83;case 26:return 26;case 27:return 27;case 28:return 16;case 29:return"#";case 30:return 34;case 31:return 35;case 32:return 79;case 33:return 64;case 34:return 65;case 35:return 66;case 36:return 8;case 37:return 10;case 38:return 58;case 39:case 40:return 57;case 41:return 53;case 42:return 54;case 43:return 55;case 44:return 50;case 45:return 51;case 46:return 47;case 47:return 45;case 48:return 48;case 49:return 46;case 50:return 41;case 51:return 43;case 52:return 42;case 53:return 39;case 54:return 37;case 55:return 32;case 56:return 86;case 57:return 5;case 58:return 20;case 59:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]*\.?[0-9]+([eE][-+]?[0-9]+))/,/^(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+\b)/,/^(?:[0-9]+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:if\b)/,/^(?:else\b)/,/^(?:while\b)/,/^(?:do\b)/,/^(?:for\b)/,/^(?:function\b)/,/^(?:map\b)/,/^(?:use\b)/,/^(?:return\b)/,/^(?:delete\b)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:Infinity\b)/,/^(?:->)/,/^(?:=>)/,/^(?:<<)/,/^(?:>>)/,/^(?:\{)/,/^(?:\})/,/^(?:;)/,/^(?:#)/,/^(?:\?)/,/^(?::)/,/^(?:NaN\b)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:!)/,/^(?:\^)/,/^(?:\*\*)/,/^(?:\*)/,/^(?:\/)/,/^(?:%)/,/^(?:\+)/,/^(?:-)/,/^(?:<=)/,/^(?:<)/,/^(?:>=)/,/^(?:>)/,/^(?:==)/,/^(?:~=)/,/^(?:!=)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:=)/,/^(?:,)/,/^(?:$)/,/^(?:[A-Za-z_\$][A-Za-z0-9_]*)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],inclusive:!0}}};return t}();function ut(){this.yy={}}return at.lexer=ct,ut.prototype=at,at.Parser=ut,new ut}();parser.yy.parseError=parser.parseError,__webpack_exports__.A=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode},443:function(t,e){var i={};try{"object"!=typeof JXG||JXG.extend||(i=JXG)}catch(t){}i.extend=function(t,e,i,s){var r;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(t[s?r.toLowerCase():r]=e[r])},i.defineConstant=function(t,e,s,r){(r=r||!1)&&i.exists(t[e])||Object.defineProperty(t,e,{value:s,writable:!1,enumerable:!0,configurable:!1})},i.extendConstants=function(t,e,i,s){var r,o;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(o=s?r.toUpperCase():r,this.defineConstant(t,o,e[r]))},i.extend(i,{boards:{},readers:{},elements:{},registerElement:function(t,e){t=t.toLowerCase(),this.elements[t]=e},registerReader:function(t,e){var i,s;for(i=0;i<e.length;i++)s=e[i].toLowerCase(),"function"!=typeof this.readers[s]&&(this.readers[s]=t)},shortcut:function(t,e){return function(){return t[e].apply(this,arguments)}},getRef:function(t,e){return i.deprecated("JXG.getRef()","Board.select()"),t.select(e)},getReference:function(t,e){return i.deprecated("JXG.getReference()","Board.select()"),t.select(e)},getBoardByContainerId:function(t){var e;for(e in JXG.boards)if(JXG.boards.hasOwnProperty(e)&&JXG.boards[e].container===t)return JXG.boards[e];return null},deprecated:function(t,e){var s=t+" is deprecated.";e&&(s+=" Please use "+e+" instead."),i.warn(s)},warn:function(t){"object"==typeof window&&window.console&&console.warn?console.warn("WARNING:",t):"object"==typeof document&&document.getElementById("warning")&&(document.getElementById("debug").innerText+="WARNING: "+t+"\n")},debugInt:function(t){var e,i;for(e=0;e<arguments.length;e++)i=arguments[e],"object"==typeof window&&window.console&&console.log?console.log(i):"object"==typeof document&&document.getElementById("debug")&&(document.getElementById("debug").innerText+=i+"\n")},debugWST:function(t){var e=new Error;i.debugInt.apply(this,arguments),e&&e.stack&&(i.debugInt("stacktrace"),i.debugInt(e.stack.split("\n").slice(1).join("\n")))},debugLine:function(t){var e=new Error;i.debugInt.apply(this,arguments),e&&e.stack&&i.debugInt("Called from",e.stack.split("\n").slice(2,3).join("\n"))},debug:function(t){i.debugInt.apply(this,arguments)},themes:{}}),e.A=i},454:function(t,e,i){var s=i(443),r=i(188);s.A.EventEmitter={eventHandlers:{},suspended:{},trigger:function(t,e){var i,s,r,o,n,a;for(n=t.length,s=0;s<n;s++)if(o=this.eventHandlers[t[s]],!this.suspended[t[s]]){if(this.suspended[t[s]]=!0,o)for(a=o.length,i=0;i<a;i++)(r=o[i]).handler.apply(r.context,e);this.suspended[t[s]]=!1}return this},on:function(t,e,i){return r.A.isArray(this.eventHandlers[t])||(this.eventHandlers[t]=[]),i=r.A.def(i,this),this.eventHandlers[t].push({handler:e,context:i}),this},off:function(t,e){var i;return t&&r.A.isArray(this.eventHandlers[t])?(e?((i=r.A.indexOf(this.eventHandlers[t],e,"handler"))>-1&&this.eventHandlers[t].splice(i,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t],this):this},eventify:function(t){t.eventHandlers={clicks:0},t.on=this.on,t.off=this.off,t.triggerEventHandlers=this.trigger,t.trigger=this.trigger,t.suspended={}}},e.A=s.A.EventEmitter},477:function(t,e,i){var s,r=i(443),o=i(188),n=function(t){var e,i;return t.memo||(e={},i=Array.prototype.join,t.memo=function(){var r=i.call(arguments);return e[r]!==s?e[r]:e[r]=t.apply(this,arguments)}),t.memo};r.A.Math={eps:1e-6,relDif:function(t,e){var i=Math.abs(t),s=Math.abs(e);return 0===(s=Math.max(i,s))?0:Math.abs(t-e)/s},mod:function(t,e){return t-Math.floor(t/e)*e},wrap:function(t,e,i){return e+this.mod(t-e,i-e)},clamp:function(t,e,i){return Math.min(Math.max(t,e),i)},wrapAndClamp:function(t,e,i,s){var r=.5*(e+i),o=.5*s;return this.clamp(this.wrap(t,r-o,r+o),e,i)},vector:function(t,e){var i,s;for(e=e||0,i=[],s=0;s<t;s++)i[s]=e;return i},matrix:function(t,e,i){var s,r,o;for(i=i||0,e=e||t,s=[],r=0;r<t;r++)for(s[r]=[],o=0;o<e;o++)s[r][o]=i;return s},identity:function(t,e){var i,r;for(e===s&&"number"!=typeof e&&(e=t),i=this.matrix(t,e),r=0;r<Math.min(t,e);r++)i[r][r]=1;return i},frustum:function(t,e,i,s,r,o){var n=this.matrix(4,4);return n[0][0]=2*r/(e-t),n[0][1]=0,n[0][2]=(e+t)/(e-t),n[0][3]=0,n[1][0]=0,n[1][1]=2*r/(s-i),n[1][2]=(s+i)/(s-i),n[1][3]=0,n[2][0]=0,n[2][1]=0,n[2][2]=-(o+r)/(o-r),n[2][3]=-o*r*2/(o-r),n[3][0]=0,n[3][1]=0,n[3][2]=-1,n[3][3]=0,n},projection:function(t,e,i,s){var r=i*Math.tan(t/2),o=r*e;return this.frustum(-o,o,-r,r,i,s)},matVecMult:function(t,e){var i,s,r,o=t.length,n=e.length,a=[];if(3===n)for(i=0;i<o;i++)a[i]=t[i][0]*e[0]+t[i][1]*e[1]+t[i][2]*e[2];else for(i=0;i<o;i++){for(r=0,s=0;s<n;s++)r+=t[i][s]*e[s];a[i]=r}return a},vecMatMult:function(t,e){var i,s,r,o=e.length,n=t.length,a=[];if(3===n)for(i=0;i<o;i++)a[i]=t[0]*e[0][i]+t[1]*e[1][i]+t[2]*e[2][i];else for(i=0;i<n;i++){for(r=0,s=0;s<o;s++)r+=t[s]*e[s][i];a[i]=r}return a},matMatMult:function(t,e){var i,s,r,o,n=t.length,a=n>0?e[0].length:0,h=e.length,l=this.matrix(n,a);for(i=0;i<n;i++)for(s=0;s<a;s++){for(r=0,o=0;o<h;o++)r+=t[i][o]*e[o][s];l[i][s]=r}return l},matNumberMult:function(t,e){var i,s,r=t.length,o=r>0?t[0].length:0,n=this.matrix(r,o);for(i=0;i<r;i++)for(s=0;s<o;s++)n[i][s]=t[i][s]*e;return n},matMatAdd:function(t,e){var i,s,r=t.length,o=r>0?t[0].length:0,n=this.matrix(r,o);for(i=0;i<r;i++)for(s=0;s<o;s++)n[i][s]=t[i][s]+e[i][s];return n},transpose:function(t){var e,i,s,r,o;for(r=t.length,o=t.length>0?t[0].length:0,e=this.matrix(o,r),i=0;i<o;i++)for(s=0;s<r;s++)e[i][s]=t[s][i];return e},inverse:function(t){var e,i,s,o,n,a,h,l=this.eps*this.eps,c=t.length,u=[],d=[],p=[];for(e=0;e<c;e++){for(u[e]=[],i=0;i<c;i++)u[e][i]=t[e][i];d[e]=e}for(i=0;i<c;i++){for(a=Math.abs(u[i][i]),o=i,e=i+1;e<c;e++)Math.abs(u[e][i])>a&&(a=Math.abs(u[e][i]),o=e);if(a<=l)return r.A.warn("JXG.Math.inverse: singular matrix"),[];if(o>i){for(s=0;s<c;s++)h=u[i][s],u[i][s]=u[o][s],u[o][s]=h;h=d[i],d[i]=d[o],d[o]=h}for(n=1/u[i][i],e=0;e<c;e++)u[e][i]*=n;for(u[i][i]=n,s=0;s<c;s++)if(s!==i){for(e=0;e<c;e++)e!==i&&(u[e][s]-=u[e][i]*u[i][s]);u[i][s]=-n*u[i][s]}}for(e=0;e<c;e++){for(s=0;s<c;s++)p[d[s]]=u[e][s];for(s=0;s<c;s++)u[e][s]=p[s]}return u},trace:function(t){var e,i,s=0;if(t.length!==(i=t.length>0?t[0].length:0))return NaN;for(e=0;e<i;e++)s+=t[e][e];return s},innerProduct:function(t,e,i){var r,n=0;for(i!==s&&o.A.isNumber(i)||(i=t.length),r=0;r<i;r++)n+=t[r]*e[r];return n},crossProduct:function(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]},norm:function(t,e){var i,r=0;for(e!==s&&o.A.isNumber(e)||(e=t.length),i=0;i<e;i++)r+=t[i]*t[i];return Math.sqrt(r)},axpy:function(t,e,i){var s,r=e.length,o=[];for(s=0;s<r;s++)o[s]=t*e[s]+i[s];return o},factorial:n(function(t){return t<0?NaN:0===(t=Math.floor(t))||1===t?1:t*this.factorial(t-1)}),binomial:n(function(t,e){var i,s;if(e>t||e<0)return NaN;if(e=Math.round(e),t=Math.round(t),0===e||e===t)return 1;for(i=1,s=0;s<e;s++)i*=t-s,i/=s+1;return i}),cosh:Math.cosh||function(t){return.5*(Math.exp(t)+Math.exp(-t))},sinh:Math.sinh||function(t){return.5*(Math.exp(t)-Math.exp(-t))},acosh:Math.acosh||function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:Math.asinh||function(t){return t===-1/0?t:Math.log(t+Math.sqrt(t*t+1))},cot:function(t){return 1/Math.tan(t)},acot:function(t){return(t>=0?.5:-.5)*Math.PI-Math.atan(t)},nthroot:function(t,e){var i=1/e;return e<=0||Math.floor(e)!==e?NaN:0===t?0:t>0?Math.exp(i*Math.log(t)):e%2==1?-Math.exp(i*Math.log(-t)):NaN},cbrt:Math.cbrt||function(t){return this.nthroot(t,3)},pow:function(t,e){return 0===t?0===e?1:0:Math.floor(e)===e?Math.pow(t,e):t>0?Math.exp(e*Math.log(t)):NaN},ratpow:function(t,e,i){var s;return 0===e?1:0===i?NaN:(s=this.gcd(e,i),this.nthroot(this.pow(t,e/s),i/s))},log10:function(t){return Math.log(t)/Math.log(10)},log2:function(t){return Math.log(t)/Math.log(2)},log:function(t,e){return void 0!==e&&o.A.isNumber(e)?Math.log(t)/Math.log(e):Math.log(t)},sign:Math.sign||function(t){return 0===(t=+t)||isNaN(t)?t:t>0?1:-1},squampow:function(t,e){var i;if(Math.floor(e)===e){for(i=1,e<0&&(t=1/t,e*=-1);0!==e;)1&e&&(i*=t),e>>=1,t*=t;return i}return this.pow(t,e)},gcd:function(t,e){var i;if(t=Math.abs(t),e=Math.abs(e),!o.A.isNumber(t)||!o.A.isNumber(e))return NaN;for(e>t&&(i=t,t=e,e=i);;){if(0===(t%=e))return e;if(0===(e%=t))return t}},lcm:function(t,e){var i;return o.A.isNumber(t)&&o.A.isNumber(e)?0!==(i=t*e)?i/this.gcd(t,e):0:NaN},roundToStep:function(t,e,i,s){var n,a,h=t;if(!o.A.exists(e)&&!o.A.exists(i)&&!o.A.exists(s))return h;if(r.A.exists(s)&&(h=Math.min(h,s)),r.A.exists(i)&&(h=Math.max(h,i)),a=i||0,r.A.exists(e)){if(n=(h-a)/e,Number.isInteger(n))return h;h=a+(n=Math.round(n))*e}return r.A.exists(s)&&(h=Math.min(h,s)),r.A.exists(i)&&(h=Math.max(h,i)),h},erf:function(t){return this.ProbFuncs.erf(t)},erfc:function(t){return this.ProbFuncs.erfc(t)},erfi:function(t){return this.ProbFuncs.erfi(t)},ndtr:function(t){return this.ProbFuncs.ndtr(t)},ndtri:function(t){return this.ProbFuncs.ndtri(t)},hypot:function(){var t,e,i,s;for(e=arguments.length,t=0,s=0;t<e;t++)s+=(i=arguments[t])*i;return Math.sqrt(s)},hstep:function(t){return t>0?1:t<0?0:.5},gamma:function(t){var e,i,s,r,o,n=[1,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(t<.5)i=Math.PI/(Math.sin(Math.PI*t)*this.gamma(1-t));else{for(t-=1,e=n[0],o=n.length,r=1;r<o;r++)e+=n[r]/(t+r);s=t+7+.5,i=Math.sqrt(2*Math.PI)*Math.pow(s,t+.5)*Math.exp(-s)*e}return i},lt:function(t,e){return t<e},leq:function(t,e){return t<=e},gt:function(t,e){return t>e},geq:function(t,e){return t>=e},eq:function(t,e){return t===e},neq:function(t,e){return t!==e},and:function(t,e){return t&&e},not:function(t){return!t},or:function(t,e){return t||e},xor:function(t,e){return(t||e)&&!(t&&e)},decToFraction:function(t,e){var i,s,r,n,a,h,l,c,u,d=0;for(e=o.A.def(e,.001),s=(t=1e-12*Math.round(1e12*t))<0?-1:1,t=Math.abs(t),i=Math.floor(t),t-=Math.floor(t),h=1,n=a=r=0,u=0,l=c=1;t-Math.floor(t)>e&&d<20;)t=1/(t-r),n=h+(r=Math.floor(t))*a,l=u+r*c,h=a,u=c,a=n,c=l,d++;return[s,i,n,l]},normalize:function(t){var e,i,s=2*t[3],r=t[4]/s;return t[5]=r,t[6]=-t[1]/s,t[7]=-t[2]/s,isFinite(r)?Math.abs(r)>=1?(t[0]=(t[6]*t[6]+t[7]*t[7]-r*r)/(2*r),t[1]=-t[6]/r,t[2]=-t[7]/r,t[3]=1/(2*r),t[4]=1):(i=r<=0?-1:1,t[0]=i*(t[6]*t[6]+t[7]*t[7]-r*r)*.5,t[1]=-i*t[6],t[2]=-i*t[7],t[3]=i/2,t[4]=i*r):(e=this.hypot(t[1],t[2]),t[0]/=e,t[1]/=e,t[2]/=e,t[3]=0,t[4]=1),t},toGL:function(t){var e,i,s;if(e="function"==typeof Float32Array?new Float32Array(16):new Array(16),4!==t.length&&4!==t[0].length)return e;for(i=0;i<4;i++)for(s=0;s<4;s++)e[i+4*s]=t[i][s];return e},Vieta:function(t){var e,i,s,r=t.length,o=[];for(o=t.slice(),e=1;e<r;++e){for(s=o[e],o[e]*=o[e-1],i=e-1;i>=1;--i)o[i]+=o[i-1]*s;o[0]+=s}return o}},e.A=r.A.Math},561:function(t,e,i){var s,r=i(443),o="1.12.2";s={version:o,licenseText:"JSXGraph v"+o+" © jsxgraph.org",licenseLogo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ8AAACfCAYAAADnGwvgAAAACXBIWXMAAAsSAAALEgHS3X78AAAIPklEQVR4nO2d21XjSBCG/96z75ABzgBPBHgiWDLARDCeCBAZeCMYO4KFCEbOwM7AZIAjqH1QiTHGF7XUF7X6/87xw4APqodv+qaqaiMiICQGf8UOgOQL5SPRoHwkGpSPROPv2AH4whhzDWCs/xwDuI4YTu4sRGR7+MPByGeMGQG4BzBBJdtNxHDIZ0oA28MfJi2fCjfVD2VLjCTlU+kKAA9RAyGdSEo+SjcskpHPGFMAmAG4ihwKcUTv5dPR7gXAbdxIiGt6fc5njJkAWIPiDZLeymeMmQL4DU6zg6WX8ql4v2LHQfzSO/koXj70Sj6Klxd92+2uAXyPHQS5yBQOzlp7JZ+IrGPHQC6jpxCd6dW0S/KC8pFoUD4SDcpHokH5SDQoH4kG5SPRoHwkGpSPRCPaGw5jzBjACFWl2Ug/JB4LEVmEfGAw+bSO9h5/yhuZp9cvytAP9C6fvgecAfjH97NIWniTT9OjCrCelpzAuXw60hUA7lz/bTIsnMmna7oCwA9Xf5MMGyfy6c51AVaZEQs6n/Pp2q4ExSOWdBr5WHNButB65KN4pCut5KN4xAXW8ulRCsUjnbGSb69pDyGdsR35XsB3ssQRjeXT/ng8TiHOaCSfTrczr5GQ7Gg68hXgdEscc/GQWUc99kC+zArAO6p+M4fU94Aw2WKPJm84Ct9BJMorqteKpU2PGX0PPkGVVJu1jGfl46j3hTcAc1Qp5+9t/oCKugYwz/0ekUtrvmmIIBLgDcCjiIxEZN5WvENEZCsihYiMADzqc7KB8p1nB+BZpVv4fJD+/TGAZ5/P6RMn5dMpIbupYI8NgLGIFKEeKCLv+rxv+vxBc27kuw8WRf9Yisj42E2JIdB14QTAMsbzQ3FOvkmoIHrGTxGZxg5CR8EpBizgud3u+Mzvhspj6MLpS4jI1BgDDPDU4ejIp8VAua33nvsmXs1QR8BT025uo94y5MaiDSrga+w4XNKrbvSR2MBR0oS+vbjG5/VyCeDdUaf9KaoD6kHMSqfky2nkm3Y5NDbG1P1n7nE8+eJJv7dDlQ+5EJGyzbNE5H3vTrrkOTXtXgeNIh7PbUckY8y9MWYL4D9Um4FLWT9X+r3fxph127ssVNxBrP9y7s+3Q/We1gpjzLUx5gWVdG2nv1tUEi50c2fLDFX8SZOzfDPb6VbXdCXcddx6AFDaCqhxW//H6Ru5ylevvxqzJ57rUoJbtBAQlC9ZrFKiVIwF/GVz38KyOaPGn/TaL1f5bEeNAv6Lp261SMuGhYc4gpGjfG82CQO6Kw3V9u1Js4kaoTvfZDceOcpnW/Re+AjC4fOSLeLPUb6y6Rd1kxG6zuLBZvRDhEberqB855l6iuESNrmUyV6QnZ18lmd7E19xXKCxfCnfzp6bfCvL78dqD2I71Se56chNvsa0ffcaiSRHP8rXUxKTvxWUj0SD8vUXJ4XpfYbynWYb8+GWu9gk8y9zk2/U9Iv6Ci7WLtK2bUaSTTtzk882+bP0EYTL57ZMRu0FuclXvzJrSqz3pjbPTbbeJjv5YPfW4gXhp96diNjIN/EViG9ClU6+oXnu2Qh+q/MnaJjPp9Vic2gFWiBscw0nPoIIQSj5tk2LsvVw1bd8NsxRFeyE6EldN59shK73ku1umuO0e6W1to3QRISpv3A+YVtDnHQnsRzlAyw7FOga7F9PsdT8bFFMnvT1FLnKd2eZsAkRmcFfwc5SRKzWero8SfJ8ryZX+YAW6fHarMd129rHlv0AC8dxBCdn+R7aZI7oxuk7ujfv3gD41qYtm8ad7EajJmf5gJaF1yJSduggX3e2H7fJQt6rIU6e3OVrUyv7gYgsVMJvqKbjFb4eSr/pz59RjXRdO9sXGHiLtJx4Msa8dKmF2LvYxSuBa4i9k/vIV9OmV0pQ9J10sjW6x6B8FVfosYAa1+Au2qZ8f2jbLcorGk+Jgazz9qF8n6kFHEWOA8DHVLtG4ofJp6B8X7kF0LptrSv0/XOJAY54NZTvOFeo2tbOQ0/D2nZ3jqrt7qDWeIdQvvP8QDUKBske0U7zawzoOOUclO8yNwD+M8aUviQ0xky1s/0vDHiaPYSHzM25Q5UNU2dlL7rcSqmbiSmqnLxshNuH8tlzgyqt/klFLPWzBbA+lgyq68bx3meCTIXbh/J14wZVyv9H2r/eEEkawDUfiQblIyHYHvsh5SPeObUxo3zENyeL7ikf8c3JPEfKR3xD+Ug0KB+JRnnqF5SP+GRz7hUk5SM+WZz7JeUjPjlb8ET5iC9Wl7J+KB/xRXHpC5SP+GDVpN0b5SM+KJp8ifIR17w2bXJJ+YhLdrBoIUz5iEusekpTPuKKpeX9IZSPOGHTprUv5SNd2aDlRTSUj3RhA2BieXfIB70rndRtehL1h8aYEgNozN2STuIBHPlIOxboKB7Qw5GP9J8ubUL24chHasrQD6R8JBqUjwD42OgFhfIRoNq5BofyESDABTbHoHwEiLDZACgfqYhysxHlI69dD4vbEuqQ+c4YI4GeReyIdp8bR768eet4/WonKF/eLGI+nPLlyw4tb1p3BeXLl1msjUYN5cuTVcy1Xg3ly5NZ7AAAypcjP0Ukyuu0QyhfXixFJOomYx/Klw8b9GS6raF8edC52McHlG/49FI8gPINnd6KB1C+IbMUkXFfxQNYOjlEdqi6RUXLVmkKR75h8QpglIJ4AOUbCisA30Xkvs/T7CGcdtNmBaCIUfboAsqXHhtUeXgvrtpWxILy9ZsdqrLG+lOmLtw+RuRraYUxZgRgFDgW8oftkCQ7xVH5CAkBd7skGpSPRIPykWhQPhKN/wEKYnCiOMadyQAAAABJRU5ErkJggg==",COORDS_BY_USER:1,COORDS_BY_SCREEN:2,OBJECT_TYPE_ARC:1,OBJECT_TYPE_ARROW:2,OBJECT_TYPE_AXIS:3,OBJECT_TYPE_AXISPOINT:4,OBJECT_TYPE_TICKS:5,OBJECT_TYPE_CIRCLE:6,OBJECT_TYPE_CONIC:7,OBJECT_TYPE_CURVE:8,OBJECT_TYPE_GLIDER:9,OBJECT_TYPE_IMAGE:10,OBJECT_TYPE_LINE:11,OBJECT_TYPE_POINT:12,OBJECT_TYPE_SLIDER:13,OBJECT_TYPE_CAS:14,OBJECT_TYPE_GXTCAS:15,OBJECT_TYPE_POLYGON:16,OBJECT_TYPE_SECTOR:17,OBJECT_TYPE_TEXT:18,OBJECT_TYPE_ANGLE:19,OBJECT_TYPE_INTERSECTION:20,OBJECT_TYPE_TURTLE:21,OBJECT_TYPE_VECTOR:22,OBJECT_TYPE_OPROJECT:23,OBJECT_TYPE_GRID:24,OBJECT_TYPE_TANGENT:25,OBJECT_TYPE_HTMLSLIDER:26,OBJECT_TYPE_CHECKBOX:27,OBJECT_TYPE_INPUT:28,OBJECT_TYPE_BUTTON:29,OBJECT_TYPE_TRANSFORMATION:30,OBJECT_TYPE_FOREIGNOBJECT:31,OBJECT_TYPE_VIEW3D:32,OBJECT_TYPE_POINT3D:33,OBJECT_TYPE_LINE3D:34,OBJECT_TYPE_PLANE3D:35,OBJECT_TYPE_CURVE3D:36,OBJECT_TYPE_SURFACE3D:37,OBJECT_TYPE_MEASUREMENT:38,OBJECT_TYPE_INTERSECTION_LINE3D:39,OBJECT_TYPE_SPHERE3D:40,OBJECT_TYPE_CIRCLE3D:41,OBJECT_TYPE_INTERSECTION_CIRCLE3D:42,OBJECT_TYPE_TEXT3D:43,OBJECT_TYPE_FACE3D:44,OBJECT_TYPE_POLYHEDRON3D:45,OBJECT_TYPE_POLYGON3D:46,OBJECT_CLASS_POINT:1,OBJECT_CLASS_LINE:2,OBJECT_CLASS_CIRCLE:3,OBJECT_CLASS_CURVE:4,OBJECT_CLASS_AREA:5,OBJECT_CLASS_OTHER:6,OBJECT_CLASS_TEXT:7,OBJECT_CLASS_3D:8},r.A.extendConstants(r.A,s),e.A=s},571:function(t,e,i){var s=i(443),r=i(561),o=i(904),n=i(477),a=i(588),h=i(171),l=i(188),c=i(713);n.A.Geometry={},s.A.extend(n.A.Geometry,{angle:function(t,e,i){var r,o,n,a,h=[],l=[],c=[];return s.A.deprecated("Geometry.angle()","Geometry.rad()"),t.coords?(h[0]=t.coords.usrCoords[1],h[1]=t.coords.usrCoords[2]):(h[0]=t[0],h[1]=t[1]),e.coords?(l[0]=e.coords.usrCoords[1],l[1]=e.coords.usrCoords[2]):(l[0]=e[0],l[1]=e[1]),i.coords?(c[0]=i.coords.usrCoords[1],c[1]=i.coords.usrCoords[2]):(c[0]=i[0],c[1]=i[1]),r=h[0]-l[0],o=h[1]-l[1],n=c[0]-l[0],a=c[1]-l[1],Math.atan2(r*a-o*n,r*n+o*a)},trueAngle:function(t,e,i){return 57.29577951308232*this.rad(t,e,i)},rad:function(t,e,i){var s,r,o,n,a,h,l;return t.coords?(s=t.coords.usrCoords[1],r=t.coords.usrCoords[2]):(s=t[0],r=t[1]),e.coords?(o=e.coords.usrCoords[1],n=e.coords.usrCoords[2]):(o=e[0],n=e[1]),i.coords?(a=i.coords.usrCoords[1],h=i.coords.usrCoords[2]):(a=i[0],h=i[1]),(l=Math.atan2(h-n,a-o)-Math.atan2(r-n,s-o))<0&&(l+=6.283185307179586),l},angleBisector:function(t,e,i,s){var n,a,h,c,u,d=t.coords.usrCoords,p=e.coords.usrCoords,f=i.coords.usrCoords;return l.A.exists(s)||(s=t.board),0===p[0]?new o.A(r.A.COORDS_BY_USER,[1,.5*(d[1]+f[1]),.5*(d[2]+f[2])],s):(c=d[1]-p[1],u=d[2]-p[2],n=Math.atan2(u,c),c=f[1]-p[1],u=f[2]-p[2],h=.5*(n+(a=Math.atan2(u,c))),n>a&&(h+=Math.PI),c=Math.cos(h)+p[1],u=Math.sin(h)+p[2],new o.A(r.A.COORDS_BY_USER,[1,c,u],s))},reflection:function(t,e,i){var s,n,a,h,c,u,d=e.coords.usrCoords,p=t.point1.coords.usrCoords,f=t.point2.coords.usrCoords;return l.A.exists(i)||(i=e.board),h=f[1]-p[1],c=f[2]-p[2],s=d[1]-p[1],u=(h*(d[2]-p[2])-c*s)/(h*h+c*c),n=d[1]+2*u*c,a=d[2]-2*u*h,new o.A(r.A.COORDS_BY_USER,[n,a],i)},rotation:function(t,e,i,s){var n,a,h,c,u,d,p=e.coords.usrCoords,f=t.coords.usrCoords;return l.A.exists(s)||(s=e.board),n=p[1]-f[1],a=p[2]-f[2],u=n*(h=Math.cos(i))-a*(c=Math.sin(i))+f[1],d=n*c+a*h+f[2],new o.A(r.A.COORDS_BY_USER,[u,d],s)},perpendicular:function(t,e,i){var s,a,h,c,u,d=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=e.coords.usrCoords;return l.A.exists(i)||(i=e.board),e===t.point1?(s=d[1]+p[2]-d[2],a=d[2]-p[1]+d[1],u=d[0]*p[0],Math.abs(u)<n.A.eps&&(s=p[2],a=-p[1]),c=[u,s,a],h=!0):e===t.point2?(s=p[1]+d[2]-p[2],a=p[2]-d[1]+p[1],u=d[0]*p[0],Math.abs(u)<n.A.eps&&(s=d[2],a=-d[1]),c=[u,s,a],h=!1):Math.abs(n.A.innerProduct(f,t.stdform,3))<n.A.eps?(s=f[1]+p[2]-f[2],a=f[2]-p[1]+f[1],u=p[0],Math.abs(u)<n.A.eps&&(s=p[2],a=-p[1]),h=!0,Math.abs(u)>n.A.eps&&Math.abs(s-f[1])<n.A.eps&&Math.abs(a-f[2])<n.A.eps&&(s=f[1]+d[2]-f[2],a=f[2]-d[1]+f[1],h=!1),c=[u,s,a]):(c=[0,t.stdform[1],t.stdform[2]],c=n.A.crossProduct(c,f),c=n.A.crossProduct(c,t.stdform),h=!0),[new o.A(r.A.COORDS_BY_USER,c,i),h]},circumcenterMidpoint:function(){s.A.deprecated("Geometry.circumcenterMidpoint()","Geometry.circumcenter()"),this.circumcenter.apply(this,arguments)},circumcenter:function(t,e,i,s){var a,h,c,u,d=t.coords.usrCoords,p=e.coords.usrCoords,f=i.coords.usrCoords;return l.A.exists(s)||(s=t.board),a=[p[0]-d[0],-p[2]+d[2],p[1]-d[1]],h=[.5*(d[0]+p[0]),.5*(d[1]+p[1]),.5*(d[2]+p[2])],c=n.A.crossProduct(a,h),a=[f[0]-p[0],-f[2]+p[2],f[1]-p[1]],h=[.5*(p[0]+f[0]),.5*(p[1]+f[1]),.5*(p[2]+f[2])],u=n.A.crossProduct(a,h),new o.A(r.A.COORDS_BY_USER,n.A.crossProduct(c,u),s)},distance:function(t,e,i){var s,r=0;for(i||(i=Math.min(t.length,e.length)),s=0;s<i;s++)r+=(t[s]-e[s])*(t[s]-e[s]);return Math.sqrt(r)},affineDistance:function(t,e,i){var s;return(s=this.distance(t,e,i))>n.A.eps&&(Math.abs(t[0])<n.A.eps||Math.abs(e[0])<n.A.eps)?1/0:s},affineRatio:function(t,e,i){var s;return l.A.exists(t.usrCoords)&&(t=t.usrCoords),l.A.exists(e.usrCoords)&&(e=e.usrCoords),l.A.exists(i.usrCoords)&&(i=i.usrCoords),s=e[1]-t[1],Math.abs(s)>n.A.eps?(i[1]-t[1])/s:(i[2]-t[2])/(e[2]-t[2])},sortVertices:function(t){for(var e,i=c.A.each(t,c.A.coordsArray),s=i.length,r=null;i[0][0]===i[s-1][0]&&i[0][1]===i[s-1][1]&&i[0][2]===i[s-1][2];)r=i.pop(),s--;return e=i[0],i.sort(function(t,i){return(t[2]===e[2]&&t[1]===e[1]?-1/0:Math.atan2(t[2]-e[2],t[1]-e[1]))-(i[2]===e[2]&&i[1]===e[1]?-1/0:Math.atan2(i[2]-e[2],i[1]-e[1]))}),null!==r&&i.push(r),i},signedTriangle:function(t,e,i){var s=c.A.coordsArray(t),r=c.A.coordsArray(e),o=c.A.coordsArray(i);return.5*((r[1]-s[1])*(o[2]-s[2])-(r[2]-s[2])*(o[1]-s[1]))},signedPolygon:function(t,e){var i,s,r=0,o=c.A.each(t,c.A.coordsArray);for(void 0===e&&(e=!0),e?o.unshift(o[o.length-1]):o=this.sortVertices(o),s=o.length,i=1;i<s;i++)r+=o[i-1][1]*o[i][2]-o[i][1]*o[i-1][2];return.5*r},GrahamScan:function(t){var e,i,s,r,o,a,h,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M=n.A.eps*n.A.eps,w=this,S=[],T=[],N=c.A.each(t,c.A.coordsArray);if(0===(O=N.length))return[];if(O>1024)for(h=o=N[0][1],u=a=N[0][2],_=p=N[0][1]-N[0][2],f=d=N[0][1]+N[0][2],g=0,A=0,m=0,b=0,v=0,P=0,y=0,C=0,e=1;e<O;e++)(x=N[e][1])<o?(o=x,g=e):x>h&&(h=x,A=e),(x=N[e][2])<a?(a=x,m=e):x>u&&(u=x,b=e),(x=N[e][1]-N[e][2])<p?(p=x,v=e):x>_&&(_=x,P=e),(x=N[e][1]+N[e][2])<d?(d=x,y=e):x>f&&(f=x,C=e);for(e=0;e<O;e++)E=N[e],(O<=1024||e in[g,A,m,b,y,v,C,P]||g!==v&&this.signedTriangle(N[g],N[v],E)>=-M||v!==b&&this.signedTriangle(N[v],N[b],E)>=-M||b!==C&&this.signedTriangle(N[b],N[C],E)>=-M||C!==A&&this.signedTriangle(N[C],N[A],E)>=-M||A!==P&&this.signedTriangle(N[A],N[P],E)>=-M||P!==m&&this.signedTriangle(N[P],N[m],E)>=-M||m!==y&&this.signedTriangle(N[m],N[y],E)>=-M||y!==g&&this.signedTriangle(N[y],N[g],E)>=-M)&&S.push({i:e,c:E});for(O=S.length,r=0,o=S[0].c[1],a=S[0].c[2],e=1;e<O;e++)(S[e].c[2]<a||S[e].c[2]===a&&S[e].c[1]<o)&&(o=S[e].c[1],a=S[e].c[2],r=e);for(S=l.A.swap(S,r,0),s=S[0].c,S.sort(function(t,e){var i=t.c,r=e.c,o=w.signedTriangle(s,i,r);return 0===o?n.A.hypot(i[1]-s[1],i[2]-s[2])-n.A.hypot(r[1]-s[1],r[2]-s[2]):-o}),i=0,e=0;e<O;e++){for(;i>1&&this.signedTriangle(T[i-2].c,T[i-1].c,S[e].c)<=0;)T.pop(),i--;T.push(S[e]),i++}return T},convexHull:function(t,e){var i,s,r=[];for(s=this.GrahamScan(t),i=0;i<s.length;i++)e?r.push(s[i].c):r.push(t[s[i].i]);return r},isConvex:function(t){var e,i,s,o,a,h,u,d,p,f,_,g=n.A.eps*n.A.eps,A=0;if(l.A.isArray(t)?e=c.A.each(t,c.A.coordsArray):l.A.exists(t.type)&&t.type===r.A.OBJECT_TYPE_POLYGON&&(e=c.A.each(t.vertices,c.A.coordsArray)),0===(i=e.length))return!0;if(i<3)return!0;for(_=null,o=e[i-2][1],a=e[i-2][2],u=e[i-1][1],d=e[i-1][2],p=Math.atan2(d-a,u-o),s=0;s<i;s++)if(o=u,a=d,h=p,u=e[s][1],d=e[s][2],o!==u||a!==d){if((f=(p=Math.atan2(d-a,u-o))-h)<=-Math.PI?f+=2*Math.PI:f>Math.PI&&(f-=2*Math.PI),null===_){if(0===f)continue;_=f>0?1:-1}else if(_*f<-g)return!1;A+=f}return Math.abs(A/(2*Math.PI))-1<g},calcStraight:function(t,e,i,s){var o,a,h,c,u,d,p,f,_,g;if(l.A.exists(s)||(s=10),d=t.evalVisProp("straightfirst"),p=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])<n.A.eps&&(d=!0),Math.abs(i.scrCoords[0])<n.A.eps&&(p=!0),(d||p)&&((f=[])[0]=t.stdform[0]-t.stdform[1]*t.board.origin.scrCoords[1]/t.board.unitX+t.stdform[2]*t.board.origin.scrCoords[2]/t.board.unitY,f[1]=t.stdform[1]/t.board.unitX,f[2]=-t.stdform[2]/t.board.unitY,!isNaN(f[0]+f[1]+f[2]))){if(!1,!1,o=!d&&Math.abs(e.usrCoords[0])>=n.A.eps&&e.scrCoords[1]>=0&&e.scrCoords[1]<=t.board.canvasWidth&&e.scrCoords[2]>=0&&e.scrCoords[2]<=t.board.canvasHeight,a=!p&&Math.abs(i.usrCoords[0])>=n.A.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,c=(h=this.meetLineBoard(f,t.board,s))[0],u=h[1],!o&&!a){if(!d&&p&&!this.isSameDirection(e,i,c)&&!this.isSameDirection(e,i,u))return;if(d&&!p&&!this.isSameDirection(i,e,c)&&!this.isSameDirection(i,e,u))return}o?a||(g=this.isSameDir(e,i,c,u)?u:c):a?_=this.isSameDir(e,i,c,u)?c:u:this.isSameDir(e,i,c,u)?(_=c,g=u):(g=c,_=u),_&&e.setCoordinates(r.A.COORDS_BY_USER,_.usrCoords),g&&i.setCoordinates(r.A.COORDS_BY_USER,g.usrCoords)}},calcLineDelimitingPoints:function(t,e,i){var s,o,a,h,l,c,u,d,p,f,_;if(l=t.evalVisProp("straightfirst"),c=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])<n.A.eps&&(l=!0),Math.abs(i.scrCoords[0])<n.A.eps&&(c=!0),(u=[])[0]=t.stdform[0]-t.stdform[1]*t.board.origin.scrCoords[1]/t.board.unitX+t.stdform[2]*t.board.origin.scrCoords[2]/t.board.unitY,u[1]=t.stdform[1]/t.board.unitX,u[2]=-t.stdform[2]/t.board.unitY,!isNaN(u[0]+u[1]+u[2])){if(f=!l,_=!c,o=t.board.getBoundingBox(),t.getSlope()>=0?(a=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[3]]}},t,t.board)):(a=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[3]]}},t,t.board)),!f&&!_){if(!l&&!c){if(s=e.distance(r.A.COORDS_BY_USER,i),Math.abs(e.distance(r.A.COORDS_BY_USER,a)+a.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return;if(Math.abs(e.distance(r.A.COORDS_BY_USER,h)+h.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return}if(!l&&c&&!this.isSameDirection(e,i,a)&&!this.isSameDirection(e,i,h))return;if(l&&!c&&!this.isSameDirection(i,e,a)&&!this.isSameDirection(i,e,h))return}f?_||(p=this.isSameDir(e,i,a,h)?h:a):_?d=this.isSameDir(e,i,a,h)?a:h:this.isSameDir(e,i,a,h)?(d=a,p=h):(p=a,d=h),d&&e.setCoordinates(r.A.COORDS_BY_USER,d.usrCoords),p&&i.setCoordinates(r.A.COORDS_BY_USER,p.usrCoords)}},calcLabelQuadrant:function(t){return t<0&&(t+=2*Math.PI),["rt","urt","top","ulft","lft","llft","lrt"][Math.floor((t+Math.PI/8)/(Math.PI/4))%8]},isSameDir:function(t,e,i,s){var r=e.usrCoords[1]-t.usrCoords[1],o=e.usrCoords[2]-t.usrCoords[2],a=s.usrCoords[1]-i.usrCoords[1],h=s.usrCoords[2]-i.usrCoords[2];return Math.abs(e.usrCoords[0])<n.A.eps&&(r=e.usrCoords[1],o=e.usrCoords[2]),Math.abs(t.usrCoords[0])<n.A.eps&&(r=-t.usrCoords[1],o=-t.usrCoords[2]),r*a+o*h>=0},isSameDirection:function(t,e,i){var s,r,o,a,h=!1;return s=e.usrCoords[1]-t.usrCoords[1],r=e.usrCoords[2]-t.usrCoords[2],o=i.usrCoords[1]-t.usrCoords[1],a=i.usrCoords[2]-t.usrCoords[2],Math.abs(s)<n.A.eps&&(s=0),Math.abs(r)<n.A.eps&&(r=0),Math.abs(o)<n.A.eps&&(o=0),Math.abs(a)<n.A.eps&&(a=0),(s>=0&&o>=0||s<=0&&o<=0)&&(h=r>=0&&a>=0||r<=0&&a<=0),h},det3p:function(t,e,i){var s,r,o;return s=l.A.isPoint(t)?t.Coords(!0):t,r=l.A.isPoint(e)?e.Coords(!0):e,o=l.A.isPoint(i)?i.Coords(!0):i,(s[1]-o[1])*(r[2]-o[2])-(r[1]-o[1])*(s[2]-o[2])},windingNumber:function(t,e,i){var s,r,o,a,h,c,u=0,d=e.length,p=t[1],f=t[2],_=0;if(0===d)return 0;if((i=i||!1)&&(_=1),isNaN(p)||isNaN(f))return 1;if(l.A.exists(e[0].coords)?(s=e[0].coords,r=e[d-1].coords):(s=e[0],r=e[d-1]),s.usrCoords[1]===p&&s.usrCoords[2]===f)return 1;for(c=0;c<d-_;c++)if(l.A.exists(e[c].coords)?(r=e[c].coords.usrCoords,o=e[(c+1)%d].coords.usrCoords):(r=e[c].usrCoords,o=e[(c+1)%d].usrCoords),!(0===r[0]||0===o[0]||isNaN(r[1])||isNaN(o[1])||isNaN(r[2])||isNaN(o[2]))){if(o[2]===f){if(o[1]===p)return 1;if(r[2]===f&&o[1]>p==r[1]<p)return 0}if(r[2]<f!=o[2]<f)if(h=2*(o[2]>r[2]?1:0)-1,r[1]>=p)if(o[1]>p)u+=h;else{if(0===(a=this.det3p(r,o,t)))return 0;a>0+n.A.eps==o[2]>r[2]&&(u+=h)}else o[1]>p&&(a=this.det3p(r,o,t))>0+n.A.eps==o[2]>r[2]&&(u+=h)}return u},pnpoly:function(t,e,i,s,n){var a,h,c,u,d,p,f,_,g=i,A=!1;for(s===r.A.COORDS_BY_USER?(p=(_=new o.A(r.A.COORDS_BY_USER,[t,e],n)).scrCoords[1],f=_.scrCoords[2]):(p=t,f=e),a=0,h=(d=i.length)-2;a<d-1;h=a++)c=l.A.exists(g[a].coords)?g[a].coords:g[a],u=l.A.exists(g[h].coords)?g[h].coords:g[h],c.scrCoords[2]>f!=u.scrCoords[2]>f&&p<(u.scrCoords[1]-c.scrCoords[1])*(f-c.scrCoords[2])/(u.scrCoords[2]-c.scrCoords[2])+c.scrCoords[1]&&(A=!A);return A},intersectionFunction:function(t,e,i,a,h,c){var u,d,p=this;return u=e.elementClass===r.A.OBJECT_CLASS_CURVE&&(e.type===r.A.OBJECT_TYPE_ARC||e.type===r.A.OBJECT_TYPE_SECTOR),d=i.elementClass===r.A.OBJECT_CLASS_CURVE&&(i.type===r.A.OBJECT_TYPE_ARC||i.type===r.A.OBJECT_TYPE_SECTOR),e.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CURVE||e.elementClass!==r.A.OBJECT_CLASS_CURVE&&e.elementClass!==r.A.OBJECT_CLASS_CIRCLE||i.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CIRCLE?e.elementClass===r.A.OBJECT_CLASS_CURVE&&!u&&i.elementClass===r.A.OBJECT_CLASS_LINE||i.elementClass===r.A.OBJECT_CLASS_CURVE&&!d&&e.elementClass===r.A.OBJECT_CLASS_LINE?function(){return p.meetCurveLine(e,i,a,e.board,l.A.evaluate(c))}:e.type===r.A.OBJECT_TYPE_POLYGON||i.type===r.A.OBJECT_TYPE_POLYGON?e.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(i,e,a,e.board,t)}:i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(e,i,a,e.board,t)}:function(){return p.meetPathPath(e,i,a,e.board)}:e.elementClass===r.A.OBJECT_CLASS_LINE&&i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s,n=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),u=i.evalVisProp("straightfirst"),d=i.evalVisProp("straightlast");return l.A.evaluate(c)||n&&h&&u&&d?p.meet(e.stdform,i.stdform,a,e.board):(t=p.meetSegmentSegment(e.point1.coords.usrCoords,e.point2.coords.usrCoords,i.point1.coords.usrCoords,i.point2.coords.usrCoords),s=!n&&t[1]<0||!h&&t[1]>1||!u&&t[2]<0||!d&&t[2]>1?[0,NaN,NaN]:t[0],new o.A(r.A.COORDS_BY_USER,s,e.board))}:function(){var t,h,f,_=p.meet(e.stdform,i.stdform,a,e.board),g=!0;return l.A.evaluate(c)?_:(e.elementClass!==r.A.OBJECT_CLASS_LINE||(t=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(e.point1.coords,e.point2.coords,_),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))&&(i.elementClass!==r.A.OBJECT_CLASS_LINE||(t=i.evalVisProp("straightfirst"),h=i.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(i.point1.coords,i.point2.coords,_),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))?u&&((g=p.coordsOnArc(e,_))&&d&&(g=p.coordsOnArc(i,_)),!g)?new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board):_:new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board)}:function(){return p.meetCurveCurve(e,i,a,h,e.board)}},otherIntersectionFunction:function(t,e,i,o){var n,a,h,c=this;return a=t[0],h=t[1],n=a.board,function(){var t,u,d,p,f=e.length,_=l.A.evaluate(o);for(t=f;t>=0;t--)if(a.elementClass===r.A.OBJECT_CLASS_CIRCLE&&[r.A.OBJECT_CLASS_CIRCLE,r.A.OBJECT_CLASS_LINE].indexOf(h.elementClass)>=0?d=c.meet(a.stdform,h.stdform,t,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&[r.A.OBJECT_CLASS_CURVE,r.A.OBJECT_CLASS_CIRCLE].indexOf(h.elementClass)>=0?d=c.meetCurveCurve(a,h,t,0,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&h.elementClass===r.A.OBJECT_CLASS_LINE&&(d=l.A.exists(a.dataX)?s.A.Math.Geometry.meetCurveLine(a,h,t,a.board,l.A.evaluate(i)):s.A.Math.Geometry.meetCurveLineContinuous(a,h,t,a.board)),void 0!==d){for(p=!1,u=0;!p&&u<f;u++)l.A.exists(d)&&l.A.exists(d.distance)&&d.distance(s.A.COORDS_BY_USER,e[u].coords)<_&&(p=!0);if(!p)return d}return d}},coordsOnArc:function(t,e){var i=this.rad(t.radiuspoint,t.center,e.usrCoords.slice(1)),s=0,r=this.rad(t.radiuspoint,t.center,t.anglepoint),o=t.evalVisProp("selection");return("minor"===o&&r>Math.PI||"major"===o&&r<Math.PI)&&(s=r,r=2*Math.PI),!(i<s||i>r)},meet:function(t,e,i,s){var r=n.A.eps;return Math.abs(t[3])<r&&Math.abs(e[3])<r?this.meetLineLine(t,e,i,s):Math.abs(t[3])>=r&&Math.abs(e[3])<r?this.meetLineCircle(e,t,i,s):Math.abs(t[3])<r&&Math.abs(e[3])>=r?this.meetLineCircle(t,e,i,s):this.meetCircleCircle(t,e,i,s)},meetLineBoard:function(t,e,i){var s,a,h,c,u=[];for(l.A.exists(i)||(i=0),u[0]=n.A.crossProduct(t,[i,0,1]),u[1]=n.A.crossProduct(t,[i,1,0]),u[2]=n.A.crossProduct(t,[-i-e.canvasHeight,0,1]),u[3]=n.A.crossProduct(t,[-i-e.canvasWidth,1,0]),h=0;h<4;h++)if(Math.abs(u[h][0])>n.A.eps){for(c=2;c>0;c--)u[h][c]/=u[h][0];u[h][0]=1}return Math.abs(u[1][0])<n.A.eps?(s=u[0],a=u[2]):Math.abs(u[0][0])<n.A.eps?(s=u[1],a=u[3]):u[1][2]<0?(s=u[0],a=u[3][2]>e.canvasHeight?u[2]:u[3]):u[1][2]>e.canvasHeight?(s=u[2],a=u[3][2]<0?u[0]:u[3]):(s=u[1],a=u[3][2]<0?u[0]:u[3][2]>e.canvasHeight?u[2]:u[3]),[new o.A(r.A.COORDS_BY_SCREEN,s.slice(1),e),new o.A(r.A.COORDS_BY_SCREEN,a.slice(1),e)]},meetLineLine:function(t,e,i,s){var a=isNaN(t[5]+e[5])?[0,0,0]:n.A.crossProduct(t,e);return Math.abs(a[0])<1e-14&&(a[0]=0),new o.A(r.A.COORDS_BY_USER,a,s)},meetLineCircle:function(t,e,i,s){var a,h,c,u,d,p,f,_,g;return e[4]<n.A.eps?Math.abs(n.A.innerProduct([1,e[6],e[7]],t,3))<n.A.eps?new o.A(r.A.COORDS_BY_USER,e.slice(6,8),s):new o.A(r.A.COORDS_BY_USER,[NaN,NaN],s):(c=e[0],h=e.slice(1,3),a=e[3],u=t[0],d=t.slice(1,3),p=a,(_=(f=h[0]*d[1]-h[1]*d[0])*f-4*p*(a*u*u-(h[0]*d[0]+h[1]*d[1])*u+c))>-n.A.eps*n.A.eps?(g=[(-f+(_=Math.sqrt(Math.abs(_))))/(2*p),(-f-_)/(2*p)],0===l.A.evaluate(i)?new o.A(r.A.COORDS_BY_USER,[-g[0]*-d[1]-u*d[0],-g[0]*d[0]-u*d[1]],s):new o.A(r.A.COORDS_BY_USER,[-g[1]*-d[1]-u*d[0],-g[1]*d[0]-u*d[1]],s)):new o.A(r.A.COORDS_BY_USER,[0,0,0],s))},meetCircleCircle:function(t,e,i,s){var a;return t[4]<n.A.eps?Math.abs(this.distance(t.slice(6,2),e.slice(6,8))-e[4])<n.A.eps?new o.A(r.A.COORDS_BY_USER,t.slice(6,8),s):new o.A(r.A.COORDS_BY_USER,[0,0,0],s):e[4]<n.A.eps?Math.abs(this.distance(e.slice(6,2),t.slice(6,8))-t[4])<n.A.eps?new o.A(r.A.COORDS_BY_USER,e.slice(6,8),s):new o.A(r.A.COORDS_BY_USER,[0,0,0],s):(a=[e[3]*t[0]-t[3]*e[0],e[3]*t[1]-t[3]*e[1],e[3]*t[2]-t[3]*e[2],0,1,1/0,1/0,1/0],a=n.A.normalize(a),this.meetLineCircle(a,t,i,s))},meetCurveCurveDiscrete:function(t,e,i,s){var n,a=l.A.evaluate(i);return n=3===t.bezierDegree||3===e.bezierDegree?this.meetBezierCurveRedBlueSegments(t,e,a):this.meetCurveRedBlueSegments(t,e,a),new o.A(r.A.COORDS_BY_USER,n,s)},meetCurveCurveNewton:function(t,e,i,s,r){var o,a,l,c,u=.5*(Math.sqrt(5)-1),d=n.A.eps*n.A.eps*n.A.eps,p=n.A.eps*n.A.eps,f=t.maxX(),_=t.minX(),g=e.maxX(),A=e.minX();return o=i[0]+(i[1]-i[0])*(1-u),a=s[0]+(s[1]-s[0])*(1-u),o=(c=h.A.generalizedDampedNewton(function(i,s){var r=t.Ft(i[0]),o=e.Ft(i[1]);return[r[1]-o[1],r[2]-o[2]]},function(i,s){var r=n.A.eps,o=2*r,a=t.Ft(i[0]-r),h=t.Ft(i[0]+r),l=e.Ft(i[1]-r),c=e.Ft(i[1]+r);return[[(h[1]-a[1])/o,-(c[1]-l[1])/o],[(h[2]-a[2])/o,-(c[2]-l[2])/o]]},2,[o,a],.85,d,40))[0][0],a=c[0][1],l=t.Ft(o),o<i[0]-n.A.eps||o>i[1]+n.A.eps||a<s[0]-n.A.eps||a>s[1]+n.A.eps||r&&(o<_-p||o>f+p||a<A-p||a>g+p)?[l,o,a,1e4]:[l,o,a,c[1]]},_meetCurveCurveIterative:function(t,e,i,s,r,o){var a,h,c,u,d,p,f,_,g,A,m=100*n.A.eps,b=[];if(c=i[0],d=i[1],u=s[0],p=s[1],d<c||p<u)return[];for(g=(d-c)/20,A=(p-u)/20,f=0;f<20;f++)for(_=0;_<20;_++)if((a=this.meetCurveCurveNewton(t,e,[c+f*g,c+(f+1)*g],[u+_*A,u+(_+1)*A],o))[3]<n.A.eps&&(h=a[1],b=b.concat([h]),(b=l.A.toUniqueArrayFloat(b,m)).length>r))return b;return b},meetCurveCurve:function(t,e,i,s,n,a,c){var u,d,p,f,_,g,A=l.A.evaluate(i);return n=n||t.board,"segment"===a||l.A.exists(t.dataX)||l.A.exists(e.dataX)?this.meetCurveCurveDiscrete(t,e,A,n):l.A.exists(a)&&"newton"===a&&A<0||parseInt(A)!==A?(u=h.A.generalizedNewton(t,e,A,s),new o.A(r.A.COORDS_BY_USER,u,n)):(p=t.minX(),f=t.maxX(),_=e.minX(),g=e.maxX(),(d=this._meetCurveCurveIterative(t,e,[p,f],[_,g],A,c)).length>A?(u=t.Ft(d[A]),new o.A(r.A.COORDS_BY_USER,u,n)):[0,NaN,NaN])},meetCurveLine:function(t,e,i,s,o){var n,a;return l.A.exists(s)||(s=t.board),t.elementClass===r.A.OBJECT_CLASS_CURVE?(n=t,a=e):(n=e,a=t),l.A.exists(n.dataX)?this.meetCurveLineDiscrete(n,a,i,s,!o):this.meetCurveCurve(n,a,i,0,s,"newton",!o)},meetCurveLineContinuous:function(t,e,i,s,a){var l,c,u,d,p,f,_,g,A,m,b,y,v,C=n.A.eps,P=n.A.eps;for(d=this.meetCurveLineDiscrete(t,e,i,s,a),p=d.usrCoords[1],f=d.usrCoords[2],l=function(e){var i,s;return e>t.maxX()||e<t.minX()?1/0:(i=t.X(e)-p)*i+(s=t.Y(e)-f)*s},c=function(i){var s=e.stdform[0]+e.stdform[1]*t.X(i)+e.stdform[2]*t.Y(i);return s*s},g=(t.maxX()-t.minX())/50,A=t.minX(),b=1e-4,m=NaN,y=0;y<50&&(u=h.A.root(l,[Math.max(A,t.minX()),Math.min(A+g,t.maxX())]),!((v=Math.abs(l(u)))<=b&&(m=u,(b=v)<C)));y++)A+=g;return u=m,v=c(u=h.A.root(c,[Math.max(u-g,t.minX()),Math.min(u+g,t.maxX())])),_=isNaN(v)||Math.abs(v)>P?0:1,new o.A(r.A.COORDS_BY_USER,[_,t.X(u),t.Y(u)],s)},meetCurveLineDiscrete:function(t,e,i,s,a){var h,c,u,d,p,f,_,g=l.A.evaluate(i),A=e.point1.coords.usrCoords,m=e.point2.coords.usrCoords,b=0,y=t.numberPoints,v=e.evalVisProp("straightfirst"),C=e.evalVisProp("straightlast");for(f=new o.A(r.A.COORDS_BY_USER,[0,NaN,NaN],s),0===A[0]?A=[1,m[1]+e.stdform[2],m[2]-e.stdform[1]]:0===m[0]&&(m=[1,A[1]+e.stdform[2],A[2]-e.stdform[1]]),d=t.points[0].usrCoords,h=1;h<y;h+=t.bezierDegree)if(u=d.slice(0),d=t.points[h].usrCoords,this.distance(u,d)>n.A.eps)for(_=3===t.bezierDegree?this.meetBeziersegmentBeziersegment([t.points[h-1].usrCoords.slice(1),t.points[h].usrCoords.slice(1),t.points[h+1].usrCoords.slice(1),t.points[h+2].usrCoords.slice(1)],[A.slice(1),m.slice(1)],a):[this.meetSegmentSegment(u,d,A,m)],c=0;c<_.length;c++)if(0<=(p=_[c])[1]&&p[1]<=1){if(b===g)return a&&(!v&&p[2]<0||!C&&p[2]>1)?f:f=new o.A(r.A.COORDS_BY_USER,p[0],s);b+=1}return f},meetCurveRedBlueSegments:function(t,e,i){var s,r,o,n,a,h,c,u,d,p=l.A.evaluate(i),f=0,_=e.numberPoints,g=t.numberPoints;if(_<=1||g<=1)return[0,NaN,NaN];for(s=1;s<g;s++)for(o=t.points[s-1].usrCoords,n=t.points[s].usrCoords,u=Math.min(o[1],n[1]),d=Math.max(o[1],n[1]),h=e.points[0].usrCoords,r=1;r<_;r++)if(a=h,h=e.points[r].usrCoords,Math.min(a[1],h[1])<d&&Math.max(a[1],h[1])>u&&(c=this.meetSegmentSegment(o,n,a,h))[1]>=0&&c[2]>=0&&(c[1]<1&&c[2]<1||s===g-1&&1===c[1]||r===_-1&&1===c[2])){if(f===p)return c[0];f++}return[0,NaN,NaN]},meetSegmentSegment:function(t,e,i,s){var r,o,a,h=n.A.crossProduct(t,e),l=n.A.crossProduct(i,s),c=n.A.crossProduct(h,l);return Math.abs(c[0])<n.A.eps?[c,1/0,1/0]:(c[1]/=c[0],c[2]/=c[0],c[0]/=c[0],a=t[o=Math.abs(e[1]-e[0]*t[1])<n.A.eps?2:1]/t[0],r=(c[o]-a)/(0!==e[0]?e[o]/e[0]-a:e[o]),a=i[o=Math.abs(s[1]-s[0]*i[1])<n.A.eps?2:1]/i[0],[c,r,(c[o]-a)/(0!==s[0]?s[o]/s[0]-a:s[o])])},meetPathPath:function(t,e,i,a){var h,c,u,d,p=l.A.evaluate(i);return(u=(h=s.A.Math.Clip._getPath(t,a)).length)>0&&this.distance(h[0].coords.usrCoords,h[u-1].coords.usrCoords,3)<n.A.eps&&h.pop(),(u=(c=s.A.Math.Clip._getPath(e,a)).length)>0&&this.distance(c[0].coords.usrCoords,c[u-1].coords.usrCoords,3)<n.A.eps*n.A.eps&&c.pop(),i<0||s.A.Math.Clip.isEmptyCase(h,c,"intersection")?new o.A(r.A.COORDS_BY_USER,[0,0,0],a):(s.A.Math.Clip.makeDoublyLinkedList(h),s.A.Math.Clip.makeDoublyLinkedList(c),p<(d=s.A.Math.Clip.findIntersections(h,c,a)[0]).length?d[p].coords:new o.A(r.A.COORDS_BY_USER,[0,0,0],a))},meetPolygonLine:function(t,e,i,s,n){var a,h,c,u=l.A.evaluate(i),d=[0,0,0],p=t.borders.length,f=[];for(a=0;a<p;a++)c=t.borders[a],h=this.meetSegmentSegment(c.point1.coords.usrCoords,c.point2.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),(!n||h[2]>=0&&h[2]<1)&&h[1]>=0&&h[1]<1&&f.push(h[0]);return u>=0&&u<f.length&&(d=f[u]),new o.A(r.A.COORDS_BY_USER,d,s)},_bezierSplit:function(t){var e,i,s,r,o,n;return e=[.5*(t[0][0]+t[1][0]),.5*(t[0][1]+t[1][1])],i=[.5*(t[1][0]+t[2][0]),.5*(t[1][1]+t[2][1])],s=[.5*(t[2][0]+t[3][0]),.5*(t[2][1]+t[3][1])],n=[.5*((r=[.5*(e[0]+i[0]),.5*(e[1]+i[1])])[0]+(o=[.5*(i[0]+s[0]),.5*(i[1]+s[1])])[0]),.5*(r[1]+o[1])],[[t[0],e,r,n],[n,o,s,t[3]]]},_bezierBbox:function(t){var e=[];return 4===t.length?(e[0]=Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),e[1]=Math.max(t[0][1],t[1][1],t[2][1],t[3][1]),e[2]=Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),e[3]=Math.min(t[0][1],t[1][1],t[2][1],t[3][1])):(e[0]=Math.min(t[0][0],t[1][0]),e[1]=Math.max(t[0][1],t[1][1]),e[2]=Math.max(t[0][0],t[1][0]),e[3]=Math.min(t[0][1],t[1][1])),e},_bezierOverlap:function(t,e){return t[2]>=e[0]&&t[0]<=e[2]&&t[1]>=e[3]&&t[3]<=e[1]},_bezierListConcat:function(t,e,i,s){var r,o=l.A.exists(s),n=0,a=e.length,h=t.length;for(h>0&&a>0&&(1===t[h-1][1]&&0===e[0][1]||o&&1===t[h-1][2]&&0===e[0][2])&&(n=1),r=n;r<a;r++)o&&(e[r][2]*=.5,e[r][2]+=s),e[r][1]*=.5,e[r][1]+=i,t.push(e[r])},_bezierMeetSubdivision:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_=[];return r=this._bezierBbox(e),s=this._bezierBbox(t),this._bezierOverlap(r,s)?i<5?(h=(o=this._bezierSplit(t))[0],l=o[1],n=(o=this._bezierSplit(e))[0],a=o[1],this._bezierListConcat(_,this._bezierMeetSubdivision(h,n,i+1),0,0),this._bezierListConcat(_,this._bezierMeetSubdivision(h,a,i+1),0,.5),this._bezierListConcat(_,this._bezierMeetSubdivision(l,n,i+1),.5,0),this._bezierListConcat(_,this._bezierMeetSubdivision(l,a,i+1),.5,.5),_):(p=[1].concat(t[0]),f=[1].concat(t[3]),u=[1].concat(e[0]),d=[1].concat(e[3]),(c=this.meetSegmentSegment(p,f,u,d))[1]>=0&&c[2]>=0&&c[1]<=1&&c[2]<=1?[c]:[]):[]},_bezierLineMeetSubdivision:function(t,e,i,s){var r,o,n,a,h,l,c,u,d,p,f=[];return r=this._bezierBbox(e),o=this._bezierBbox(t),s&&!this._bezierOverlap(o,r)?[]:i<5?(a=(n=this._bezierSplit(t))[0],h=n[1],this._bezierListConcat(f,this._bezierLineMeetSubdivision(a,e,i+1),0),this._bezierListConcat(f,this._bezierLineMeetSubdivision(h,e,i+1),.5),f):(d=[1].concat(t[0]),p=[1].concat(t[3]),c=[1].concat(e[0]),u=[1].concat(e[1]),(l=this.meetSegmentSegment(d,p,c,u))[1]>=0&&l[1]<=1&&(!s||l[2]>=0&&l[2]<=1)?[l]:[])},meetBeziersegmentBeziersegment:function(t,e,i){var s,r,o;for((s=4===t.length&&4===e.length?this._bezierMeetSubdivision(t,e,0):this._bezierLineMeetSubdivision(t,e,0,i)).sort(function(t,e){return 1e7*(t[1]-e[1])+(t[2]-e[2])}),r=[],o=0;o<s.length;o++)0!==o&&s[o][1]===s[o-1][1]&&s[o][2]===s[o-1][2]||r.push(s[o]);return r},meetBezierCurveRedBlueSegments:function(t,e,i){var s,o,a,h,c,u,d,p,f,_,g,A,m,b=l.A.evaluate(i),y=0,v=0,C=[];if(e.numberPoints<e.bezierDegree+1||t.numberPoints<t.bezierDegree+1)return[0,NaN,NaN];for(1===t.bezierDegree&&3===e.bezierDegree&&(u=t,t=e,e=u),A=e.numberPoints-e.bezierDegree,m=t.numberPoints-t.bezierDegree,t.type===r.A.OBJECT_TYPE_SECTOR&&(y=3,m-=3),e.type===r.A.OBJECT_TYPE_SECTOR&&(v=3,A-=3),o=y;o<m;o+=t.bezierDegree)for(d=[(s=t.points)[o].usrCoords.slice(1),s[o+1].usrCoords.slice(1)],3===t.bezierDegree&&(d[2]=s[o+2].usrCoords.slice(1),d[3]=s[o+3].usrCoords.slice(1)),f=this._bezierBbox(d),a=v;a<A;a+=e.bezierDegree)if(p=[(s=e.points)[a].usrCoords.slice(1),s[a+1].usrCoords.slice(1)],3===e.bezierDegree&&(p[2]=s[a+2].usrCoords.slice(1),p[3]=s[a+3].usrCoords.slice(1)),_=this._bezierBbox(p),this._bezierOverlap(f,_)){if(0===(g=this.meetBeziersegmentBeziersegment(d,p)).length)continue;for(h=0;h<g.length;h++)(c=g[h])[1]<-n.A.eps||c[1]>1+n.A.eps||c[2]<-n.A.eps||c[2]>1+n.A.eps||C.push(c);if(C.length>b)return C[b][0]}return C.length>b?C[b][0]:[0,NaN,NaN]},bezierSegmentEval:function(t,e){var i,s,r,o=1-t;return s=0,r=0,s+=(i=o*o*o)*e[0][0],r+=i*e[0][1],s+=(i=3*t*o*o)*e[1][0],r+=i*e[1][1],s+=(i=3*t*t*o)*e[2][0],r+=i*e[2][1],[1,s+=(i=t*t*t)*e[3][0],r+=i*e[3][1]]},bezierArc:function(t,e,i,s,r){var o,a,h,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E=e[1],O=e[2],M=e[0],w=[],S=[];for(u=this.distance(e,t),E/=M,O/=M,d=this.rad(t.slice(1),e.slice(1),i.slice(1)),-1===r&&(d=2*Math.PI-d),f=d/4,(o=t)[1]/=o[0],o[2]/=o[0],o[0]/=o[0],c=o.slice(0),s?(w=[E,E+.333*(o[1]-E),E+.666*(o[1]-E),o[1]],S=[O,O+.333*(o[2]-O),O+.666*(o[2]-O),o[2]]):(w=[o[1]],S=[o[2]]);d>n.A.eps;)d>f?(p=f,d-=f):(p=d,d=0),x=[[1,0,0],[E*(1-(_=Math.cos(r*p)))+O*(g=Math.sin(r*p)),_,-g],[O*(1-_)-E*g,g,_]],c=[(C=n.A.matVecMult(x,o))[0]/C[0],C[1]/C[0],C[2]/C[0]],A=o[1]-E,m=o[2]-O,b=c[1]-E,y=c[2]-O,P=n.A.hypot(A+b,m+y),v=Math.abs(y-m)>n.A.eps?(A+b)*(u/P-.5)/(y-m)*8/3:(m+y)*(u/P-.5)/(A-b)*8/3,a=[1,o[1]-v*m,o[2]+v*A],h=[1,c[1]+v*y,c[2]-v*b],l.A.concat(w,[a[1],h[1],c[1]]),l.A.concat(S,[a[2],h[2],c[2]]),o=c.slice(0);return s&&(l.A.concat(w,[c[1]+.333*(E-c[1]),c[1]+.666*(E-c[1]),E]),l.A.concat(S,[c[2]+.333*(O-c[2]),c[2]+.666*(O-c[2]),O])),[w,S]},projectPointToCircle:function(t,e,i){var s,a,h,c,u,d=e.center.coords.usrCoords;return l.A.exists(i)||(i=t.board),l.A.isPoint(t)?(s=t.coords.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.coords.usrCoords):(s=t.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.usrCoords),Math.abs(s)<n.A.eps&&(s=n.A.eps),u=e.Radius()/s,h=d[1]+u*(a[1]-d[1]),c=d[2]+u*(a[2]-d[2]),new o.A(r.A.COORDS_BY_USER,[h,c],i)},projectPointToLine:function(t,e,i){var s,a=[0,e.stdform[1],e.stdform[2]];return l.A.exists(i)||(i=l.A.exists(t.coords)?t.board:e.board),s=l.A.exists(t.coords)?t.coords.usrCoords:t.usrCoords,a=n.A.crossProduct(a,s),new o.A(r.A.COORDS_BY_USER,n.A.crossProduct(a,e.stdform),i)},projectCoordsToSegment:function(t,e,i){var s,r=[i[1]-e[1],i[2]-e[2]],o=[t[1]-e[1],t[2]-e[2]];return Math.abs(r[0])<n.A.eps&&Math.abs(r[1])<n.A.eps?[e,0]:(s=n.A.innerProduct(o,r),[[1,(s/=n.A.innerProduct(r,r))*r[0]+e[1],s*r[1]+e[2]],s])},projectCoordsToBeziersegment:function(t,e,i){var r;return r=s.A.Math.Numerics.fminbr(function(s){var r=[1,e.X(i+s),e.Y(i+s)];return r[1]-=t[1],r[2]-=t[2],r[1]*r[1]+r[2]*r[2]},[0,1]),[[1,e.X(r+i),e.Y(r+i)],r]},projectPointToCurve:function(t,e,i){l.A.exists(i)||(i=t.board);var s=t.X(),r=t.Y(),o=t.position;return l.A.exists(o)||(o="functiongraph"===e.evalVisProp("curvetype")?s:0),this.projectCoordsToCurve(s,r,o,e,i)},projectCoordsToCurve:function(t,e,i,s,n){var a,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N,j,D,k=Number.POSITIVE_INFINITY;if(l.A.exists(n)||(n=s.board),"plot"===s.evalVisProp("curvetype")){if(i=0,p=k,a=0===s.numberPoints?[0,1,1]:[s.Z(0),s.X(0),s.Y(0)],s.numberPoints>1)for(g=[1,t,e],3===s.bezierDegree?d=0:b=[s.Z(0),s.X(0),s.Y(0)],u=0;u<s.numberPoints-1;u++)3===s.bezierDegree?v=this.projectCoordsToBeziersegment(g,s,d):(y=[s.Z(u+1),s.X(u+1),s.Y(u+1)],v=this.projectCoordsToSegment(g,b,y)),_=v[1],A=v[0],0<=_&&_<=1?(f=this.distance(A,g),m=u+_):_<0?(A=b,f=this.distance(b,g),m=u):_>1&&u===s.numberPoints-2&&(A=y,f=this.distance(A,g),m=s.numberPoints-1),f<p&&(p=f,i=m,a=A),3===s.bezierDegree?(d++,u+=2):b=y;c=new o.A(r.A.COORDS_BY_USER,a,n)}else{for(j=s.minX(),D=s.maxX(),T=j,N=D,"functiongraph"===s.evalVisProp("curvetype")&&(O=Math.abs(e-s.Y(t)),isNaN(O)||(T=t-O,N=t+O)),C=function(i){var r,o;return i<j||i>s.maxX_glob?1/0:(r=t-s.X(i))*r+(o=e-s.Y(i))*o},E=C(i),M=(N-T)/50,P=T,u=0;u<50;u++)((x=C(P))<E||E===1/0||isNaN(E))&&(i=P,E=x),P+=M;for(w=M,u=0;u<20&&isNaN(C(i-w));u++,w*=.5);for(isNaN(C(i-w))&&(w=0),S=M,u=0;u<20&&isNaN(C(i+S));u++,S*=.5);isNaN(C(i+S))&&(S=0),i=(i=(i=h.A.fminbr(C,[Math.max(i-w,T),Math.min(i+S,N)]))<j?j:i)>D?D:i,c=new o.A(r.A.COORDS_BY_USER,[s.X(i),s.Y(i)],n)}return[s.updateTransform(c),i]},projectCoordsToPolygon:function(t,e){var i,r,o,n,a,h=e.vertices.length,l=1/0;for(i=0;i<h-1;i++)0<=(o=s.A.Math.Geometry.projectCoordsToSegment(t,e.vertices[i].coords.usrCoords,e.vertices[i+1].coords.usrCoords))[1]&&o[1]<=1?(r=s.A.Math.Geometry.distance(o[0],t,3),n=o[0]):o[1]<0?(r=s.A.Math.Geometry.distance(e.vertices[i].coords.usrCoords,t,3),n=e.vertices[i].coords.usrCoords):(r=s.A.Math.Geometry.distance(e.vertices[i+1].coords.usrCoords,t,3),n=e.vertices[i+1].coords.usrCoords),r<l&&(a=n.slice(0),l=r);return a},projectPointToTurtle:function(t,e,i){var s,n,a,h,c,u,d,p,f,_,g=0,A=0,m=Number.POSITIVE_INFINITY,b=e.objects.length;for(l.A.exists(i)||(i=t.board),c=0;c<b;c++)(d=e.objects[c]).elementClass===r.A.OBJECT_CLASS_CURVE&&(s=(f=this.projectPointToCurve(t,d))[0],_=f[1],(u=this.distance(s.usrCoords,t.coords.usrCoords))<m&&(a=s.usrCoords[1],h=s.usrCoords[2],n=_,m=u,p=d,A=g),g+=d.numberPoints);return s=new o.A(r.A.COORDS_BY_USER,[a,h],i),[p.updateTransform(s),n+A]},projectPointToPoint:function(t,e){return e.coords},projectPointToBoard:function(t,e){var i,s,r,o=e||t.board,a=[[1,1,0,0,3,0,1],[-1,2,1,0,1,2,1],[-1,1,2,2,1,2,3],[1,2,3,0,3,2,3]],h=t.coords||t,l=o.getBoundingBox();for(i=0;i<4;i++)(r=a[i])[0]*h.usrCoords[r[1]]<r[0]*l[r[2]]&&((s=n.A.crossProduct([1,l[r[3]],l[r[4]]],[1,l[r[5]],l[r[6]]]))[3]=0,s=n.A.normalize(s),h=this.projectPointToLine({coords:h},{stdform:s},o));return h},distPointLine:function(t,e){var i,s=e[1],r=e[2],o=e[0];return Math.abs(s)+Math.abs(r)<n.A.eps?Number.POSITIVE_INFINITY:(i=s*t[1]+r*t[2]+o,s*=s,r*=r,Math.abs(i)/Math.sqrt(s+r))},distPointSegment:function(t,e,i){var s,r,o,a,h,l,c=n.A.eps*n.A.eps,u=1e6;return s=(s=t[1]-e[1])===1/0?u:s===-1/0?-u:s,r=(r=t[2]-e[2])===1/0?u:r===-1/0?-u:r,(h=(o=(o=i[1]-e[1])===1/0?u:o===-1/0?-u:o)*o+(a=(a=i[2]-e[2])===1/0?u:a===-1/0?-u:a)*a)>c&&((l=(s*o+r*a)/h)<0?l=0:l>1&&(l=1),s-=l*o,r-=l*a),n.A.hypot(s,r)},intersectionFunction3D:function(t,e,i){var s,o=this;return e.type===r.A.OBJECT_TYPE_PLANE3D?i.type===r.A.OBJECT_TYPE_PLANE3D?s=t.intersectionPlanePlane(e,i):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetPlaneSphere(e,i)):e.type===r.A.OBJECT_TYPE_SPHERE3D&&(i.type===r.A.OBJECT_TYPE_PLANE3D?s=o.meetPlaneSphere(i,e):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetSphereSphere(e,i))),s},meet3Planes:function(t,e,i,s,r,o){var a,h,l,c,u,d=[1,0,0,0];for(a=n.A.crossProduct(r.slice(1),t.slice(1)),h=n.A.crossProduct(t.slice(1),i.slice(1)),l=n.A.crossProduct(i.slice(1),r.slice(1)),c=n.A.innerProduct(t.slice(1),l,3),u=0;u<3;u++)d[u+1]=(e*l[u]+s*a[u]+o*h[u])/c;return d},meetPlanePlane:function(t,e,i,s){var r,o,a,h;return a=t.slice(1),h=e.slice(1),r=n.A.crossProduct(a,h),a=i.slice(1),h=s.slice(1),o=n.A.crossProduct(a,h),(h=n.A.crossProduct(r,o)).unshift(0),h},meetPlaneSphere:function(t,e){var i=function(){return n.A.innerProduct(t.normal,e.center.coords,4)-t.d};return[function(){return n.A.axpy(-i(),t.normal,e.center.coords)},t.normal,function(){var t=e.Radius(),s=i();return Math.sqrt(t*t-s*s)}]},meetSphereSphere:function(t,e){var i=function(){var i=t.center.distance(e.center),s=t.Radius(),r=e.Radius();return(s-r)*(s+r)/(i*i)};return[function(){var s=i();return[1,.5*((1-s)*t.center.coords[1]+(1+s)*e.center.coords[1]),.5*((1-s)*t.center.coords[2]+(1+s)*e.center.coords[2]),.5*((1-s)*t.center.coords[3]+(1+s)*e.center.coords[3])]},function(){return a.A.subtract(e.center.coords,t.center.coords)},function(){var s=t.center.distance(e.center),r=t.Radius(),o=e.Radius(),n=i(),a=.5*(r*r+o*o-.5*s*s*(1+n*n));return Math.sqrt(a)}]},_paramsOutOfRange:function(t,e,i){return t[0]<e[0]||t[0]>e[1]||t.length>1&&(t[1]<i[0]||t[1]>i[1])},projectCoordsToParametric:function(t,e,i,s){var r,o,a,h,c,u=.01*Math.random()+.5,d=2*i;return 1===i?r=.1*((h=[l.A.evaluate(e.range[0]),l.A.evaluate(e.range[1])])[1]-h[0]):2===i&&(h=[l.A.evaluate(e.range_u[0]),l.A.evaluate(e.range_u[1])],c=[l.A.evaluate(e.range_v[0]),l.A.evaluate(e.range_v[1])],r=.1*Math.min(h[1]-h[0],c[1]-c[0])),o=r/5e6,a=function(i,s,r,o){var n=[e.X.apply(e,r),e.Y.apply(e,r),e.Z.apply(e,r)],a=t[0]-n[0],l=t[1]-n[1],u=t[2]-n[2];return s>=2&&(o[0]=r[0]-h[0],o[1]=-r[0]+h[1]),s>=4&&(o[2]=r[1]-c[0],o[3]=-r[1]+c[1]),a*a+l*l+u*u},0===s.length&&(s[0]=u*(h[0]+h[1]),2===i&&(s[1]=u*(c[0]+c[1]))),n.A.Nlp.FindMinimum(a,i,0,s,r,o,0,200),t=[e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)],this._paramsOutOfRange(s,h,c)&&(s[0]=u*(h[0]+h[1]),2===i&&(s[1]=u*(c[0]+c[1])),n.A.Nlp.FindMinimum(a,i,d,s,r,o,0,200)),[1,e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)]},project3DTo3DPlane:function(t,e,i){var s,r;return i=i||[0,0,0],s=n.A.norm(e),r=(n.A.innerProduct(t,e,3)-n.A.innerProduct(i,e,3))/s,n.A.axpy(-r,e,t)},getPlaneBounds:function(t,e,i,s,r){var o,n,a,l,c;return t[2]+e[0]!==0?(a=[[t[0],e[0]],[t[1],e[1]]],l=[s-i[0],s-i[1]],o=(c=h.A.Gauss(a,l))[0],n=c[1],l=[r-i[0],r-i[1]],[o,(c=h.A.Gauss(a,l))[0],n,c[1]]):null},reuleauxPolygon:function(t,e){var i,s=2*Math.PI,r=s/e,o=(e-1)/2,a=0,h=function(h,l){return function(c,u){var d=(c%s+s)%s,p=Math.floor(d/r)%e;return u||(a=t[0].Dist(t[o]),i=n.A.Geometry.rad([t[0].X()+1,t[0].Y()],t[0],t[o%e])),isNaN(p)?p:(d=.5*d+p*r*.5+i,t[p][h]()+a*Math[l](d))}};return[h("X","cos"),h("Y","sin"),0,s]}}),e.A=n.A.Geometry},588:function(t,e,i){var s=i(443),r=i(477),o=i(188);r.A.Statistics={sum:function(t){var e,i=t.length,s=0;for(e=0;e<i;e++)s+=t[e];return s},prod:function(t){var e,i=t.length,s=1;for(e=0;e<i;e++)s*=t[e];return s},mean:function(t){return t.length>0?this.sum(t)/t.length:0},median:function(t){var e,i;return t.length>0?(ArrayBuffer.isView(t)?(e=new Float64Array(t)).sort():(e=t.slice(0)).sort(function(t,e){return t-e}),1&(i=e.length)?e[parseInt(.5*i,10)]:.5*(e[.5*i-1]+e[.5*i])):0},percentile:function(t,e){var i,s,r,n,a,h=[];if(t.length>0){for(ArrayBuffer.isView(t)?(i=new Float64Array(t)).sort():(i=t.slice(0)).sort(function(t,e){return t-e}),s=i.length,n=o.A.isArray(e)?e:[e],r=0;r<n.length;r++)a=s*n[r]*.01,parseInt(a,10)===a?h.push(.5*(i[a-1]+i[a])):h.push(i[parseInt(a,10)]);return o.A.isArray(e)?h:h[0]}return 0},variance:function(t){var e,i,s,r=t.length;if(r>1){for(e=this.mean(t),i=0,s=0;s<r;s++)i+=(t[s]-e)*(t[s]-e);return i/(t.length-1)}return 0},sd:function(t){return Math.sqrt(this.variance(t))},weightedMean:function(t,e){if(t.length!==e.length)throw new Error("JSXGraph error (Math.Statistics.weightedMean): Array dimension mismatch.");return t.length>0?this.mean(this.multiply(t,e)):0},max:function(t){return Math.max.apply(this,t)},min:function(t){return Math.min.apply(this,t)},range:function(t){return[this.min(t),this.max(t)]},abs:function(t){var e,i,s;if(o.A.isArray(t))if(t.map)s=t.map(Math.abs);else for(i=t.length,s=[],e=0;e<i;e++)s[e]=Math.abs(t[e]);else s=ArrayBuffer.isView(t)?t.map(Math.abs):Math.abs(t);return s},add:function(t,e){var i,s,r=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]+e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t+e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(s=Math.min(t.length,e.length),i=0;i<s;i++)r[i]=t[i]+e[i];else r=t+e;return r},div:function(t,e){var i,s,r=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]/e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t/e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(s=Math.min(t.length,e.length),i=0;i<s;i++)r[i]=t[i]/e[i];else r=t/e;return r},divide:function(){s.A.deprecated("Statistics.divide()","Statistics.div()"),r.A.Statistics.div.apply(r.A.Statistics,arguments)},mod:function(t,e,i){var s,n,a=[],h=function(t,e){return t%e};if((i=o.A.def(i,!1))&&(h=r.A.mod),t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(n=t.length,s=0;s<n;s++)a[s]=h(t[s],e);else if(o.A.isNumber(t)&&o.A.isArray(e))for(n=e.length,s=0;s<n;s++)a[s]=h(t,e[s]);else if(o.A.isArray(t)&&o.A.isArray(e))for(n=Math.min(t.length,e.length),s=0;s<n;s++)a[s]=h(t[s],e[s]);else a=h(t,e);return a},multiply:function(t,e){var i,s,r=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]*e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t*e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(s=Math.min(t.length,e.length),i=0;i<s;i++)r[i]=t[i]*e[i];else r=t*e;return r},subtract:function(t,e){var i,s,r=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]-e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t-e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(s=Math.min(t.length,e.length),i=0;i<s;i++)r[i]=t[i]-e[i];else r=t-e;return r},TheilSenRegression:function(t){var e,i,s=[],o=[],n=[];for(e=0;e<t.length;e++){for(o.length=0,i=0;i<t.length;i++)Math.abs(t[i].usrCoords[1]-t[e].usrCoords[1])>r.A.eps&&(o[i]=(t[i].usrCoords[2]-t[e].usrCoords[2])/(t[i].usrCoords[1]-t[e].usrCoords[1]));s[e]=this.median(o),n.push(t[e].usrCoords[2]-s[e]*t[e].usrCoords[1])}return[this.median(n),this.median(s),-1]},generateGaussian:function(t,e){var i,s,r;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+t;do{r=(i=2*Math.random()-1)*i+(s=2*Math.random()-1)*s}while(r>=1||0===r);return r=Math.sqrt(-2*Math.log(r)/r),this.spare=s*r,this.hasSpare=!0,t+e*i*r},randomNormal:function(t,e){return this.generateGaussian(t,e)},randomUniform:function(t,e){return Math.random()*(e-t)+t},randomExponential:function(t){var e;if(t<=0)return NaN;do{e=Math.random()}while(0===e);return-Math.log(e)/t},randomGamma:function(t,e,i){var s,r,o,n,a,h;if(t<=0)return NaN;if(e=e||1,i=i||0,1===t)return e*this.randomExponential(1)+i;if(t<1){a=Math.E/(t+Math.E);do{s=Math.random();do{r=Math.random()}while(0===r);s<a?(o=Math.pow(r,1/t),h=Math.exp(-o)):(o=1-Math.log(r),h=Math.pow(o,t-1)),s=Math.random()}while(s>=h);return e*o+i}do{n=Math.tan(Math.PI*Math.random()),(o=Math.sqrt(2*t-1)*n+t-1)>0&&(r=Math.random())}while(o<=0||r>(1+n*n)*Math.exp((t-1)*Math.log(o/(t-1))-Math.sqrt(2*t-1)*n));return e*o+i},randomBeta:function(t,e){var i;return t<=0||e<=0?NaN:(i=this.randomGamma(t))/(i+this.randomGamma(e))},randomChisquare:function(t){return t<=0?NaN:2*this.randomGamma(.5*t)},randomF:function(t,e){return t<=0||e<=0?NaN:this.randomChisquare(t)*e/(this.randomChisquare(e)*t)},randomT:function(t){var e,i;return t<=0?NaN:(e=this.randomNormal(0,1),i=this.randomChisquare(t),e/Math.sqrt(i/t))},randomBinomial:function(t,e){var i,s,r,o,n;if(e<0||e>1||t<0)return NaN;if(0===e)return 0;if(1===e)return t;if(0===t)return 0;if(1===t)return Math.random()<e?1:0;if(e>.5)return t-this.randomBinomial(t,1-e);if(t<100){if(i=-1,s=0,0===(r=Math.log(1-e)))return 0;do{i+=1,s+=Math.floor(Math.log(Math.random())/r)+1}while(s<t)}else n=t-(o=1+Math.floor(.5*t))+1,i=(i=this.randomBeta(o,n))>=e?this.randomBinomial(o-1,e/i):o+this.randomBinomial(n-1,(e-i)/(1-i));return i},randomGeometric:function(t){var e;return t<0||t>1?NaN:(e=Math.random(),Math.ceil(Math.log(e)/Math.log(1-t)))},randomPoisson:function(t){var e,i,s=Math.exp(-t),r=0,o=1;if(t<=0)return NaN;if(t<10){do{o*=Math.random(),r+=1}while(o>s);e=r-1}else r=Math.floor(7/8*t),e=(i=this.randomGamma(r))<t?r+this.randomPoisson(t-i):this.randomBinomial(r-1,t/i);return e},randomPareto:function(t,e){var i=Math.random();return t<=0||e<=0?NaN:e*Math.pow(1-i,-1/t)},randomHypergeometric:function(t,e,i){var s,r,o,n=t+e-i,a=Math.min(t,e),h=a;if(t<1||e<1||i>t+e)return NaN;for(s=i;h*s>0;)r=Math.random(),h-=Math.floor(r+h/(n+s)),s-=1;return o=a-h,t<=e?o:i-o},histogram:function(t,e){var i,r,o,n,a,h,l,c,u,d=[],p=[],f=0;for(h=e.bins||10,!1===(c=e.range||!1)?(n=Math.min.apply(null,t),a=Math.max.apply(null,t)):(n=c[0],a=c[1]),l=h>0?(a-n)/(h-1):0,i=0;i<h;i++)d.push(0),p.push(n+i*l);for(r=t.length,i=0;i<r;i++)(o=Math.floor((t[i]-n)/l))>=0&&o<h?d[o]+=1:f+=1;if(e.density)for(u=s.A.Math.Statistics.sum(d)+f,i=0;i<h;i++)d[i]/=u*l;if(e.cumulative){if(e.density)for(i=0;i<h;i++)d[i]*=l;for(i=1;i<h;i++)d[i]+=d[i-1]}return[d,p]}},e.A=r.A.Statistics},713:function(t,e,i){var s=i(443),r=i(188),o=i(561),n=i(904);s.A.Expect={each:function(t,e,i){var s,o,n=[];if(r.A.exists(t.length))for(o=t.length,s=0;s<o;s++)n.push(e.call(this,t[s],i));return n},coords:function(t,e){var i=t;return t&&t.elementClass===o.A.OBJECT_CLASS_POINT?i=t.coords:t.usrCoords&&t.scrCoords&&t.usr2screen&&(i=t),e&&(i=new n.A(o.A.COORDS_BY_USER,i.usrCoords,i.board)),i},coordsArray:function(t,e){var i;return(i=r.A.isArray(t)?t:this.coords(t).usrCoords).length<3&&i.unshift(1),e&&(i=[i[0],i[1],i[2]]),i}},e.A=s.A.Expect},733:function(t,e,i){var s=i(443),r=i(477),o=i(188);s.A.Math.DoubleBits=function(){var t,e,i,s,r,o,n,a,h=new Float64Array(1),l=new Uint32Array(h.buffer);void 0!==Float64Array&&(h[0]=1,1072693248===l[1]?(t=function(t){return h[0]=t,[l[0],l[1]]},e=function(t,e){return l[0]=t,l[1]=e,h[0]},i=function(t){return h[0]=t,l[0]},s=function(t){return h[0]=t,l[1]},this.doubleBits=t,this.pack=e,this.lo=i,this.hi=s):1072693248===l[0]&&(r=function(t){return h[0]=t,[l[1],l[0]]},o=function(t,e){return l[1]=t,l[0]=e,h[0]},n=function(t){return h[0]=t,l[1]},a=function(t){return h[0]=t,l[0]},this.doubleBits=r,this.pack=o,this.lo=n,this.hi=a))},s.A.extend(s.A.Math.DoubleBits.prototype,{sign:function(t){return this.hi(t)>>>31},exponent:function(t){return(this.hi(t)<<1>>>21)-1023},fraction:function(t){var e=this.lo(t),i=this.hi(t),s=1048575&i;return 2146435072&i&&(s+=1<<20),[e,s]},denormalized:function(t){return!(2146435072&this.hi(t))}});var n=new s.A.Math.DoubleBits,a=function(t,e){if(void 0!==t&&void 0!==e){if(r.A.IntervalArithmetic.isInterval(t)){if(!r.A.IntervalArithmetic.isSingleton(t))throw new TypeError("JXG.Math.IntervalArithmetic: interval `lo` must be a singleton");this.lo=t.lo}else this.lo=t;if(r.A.IntervalArithmetic.isInterval(e)){if(!r.A.IntervalArithmetic.isSingleton(e))throw new TypeError("JXG.Math.IntervalArithmetic: interval `hi` must be a singleton");this.hi=e.hi}else this.hi=e}else{if(void 0!==t)return Array.isArray(t)?new a(t[0],t[1]):new a(t,t);this.lo=this.hi=0}};s.A.extend(a.prototype,{print:function(){console.log("[",this.lo,this.hi,"]")},set:function(t,e){return this.lo=t,this.hi=e,this},bounded:function(t,e){return this.set(r.A.IntervalArithmetic.prev(t),r.A.IntervalArithmetic.next(e))},boundedSingleton:function(t){return this.bounded(t,t)},assign:function(t,e){if("number"!=typeof t||"number"!=typeof e)throw new TypeError("JXG.Math.Interval#assign: arguments must be numbers");return isNaN(t)||isNaN(e)||t>e?this.setEmpty():this.set(t,e)},setEmpty:function(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},setWhole:function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)},open:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),r.A.IntervalArithmetic.prev(e))},halfOpenLeft:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),e)},halfOpenRight:function(t,e){return this.assign(t,r.A.IntervalArithmetic.prev(e))},toArray:function(){return[this.lo,this.hi]},clone:function(){return(new a).set(this.lo,this.hi)}}),s.A.Math.IntervalArithmetic={Interval:function(t,e){return new a(t,e)},isInterval:function(t){return null!==t&&"object"==typeof t&&"number"==typeof t.lo&&"number"==typeof t.hi},isSingleton:function(t){return t.lo===t.hi},add:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),new a(this.addLo(t.lo,e.lo),this.addHi(t.hi,e.hi))},sub:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),new a(this.subLo(t.lo,e.hi),this.subHi(t.hi,e.lo))},mul:function(t,e){var i,s,r,n,h;return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=t.lo,s=t.hi,r=e.lo,n=e.hi,h=new a,i<0?s>0?r<0?n>0?(h.lo=Math.min(this.mulLo(i,n),this.mulLo(s,r)),h.hi=Math.max(this.mulHi(i,r),this.mulHi(s,n))):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):r<0?n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(i,r)):(h.lo=this.mulLo(s,n),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,r)):(h.lo=0,h.hi=0):s>0?r<0?n>0?(h.lo=this.mulLo(s,r),h.hi=this.mulHi(s,n)):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,n)):n>0?(h.lo=this.mulLo(i,r),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):(h.lo=0,h.hi=0),h)},div:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():this.zeroIn(e)?0!==e.lo?0!==e.hi?this.divZero(t):this.divNegative(t,e.lo):0!==e.hi?this.divPositive(t,e.hi):this.EMPTY.clone():this.divNonZero(t,e)},positive:function(t){return new a(t.lo,t.hi)},negative:function(t){return o.A.isNumber(t)?new a(-t):new a(-t.hi,-t.lo)},isEmpty:function(t){return t.lo>t.hi},isWhole:function(t){return t.lo===-1/0&&t.hi===1/0},zeroIn:function(t){return this.hasValue(t,0)},hasValue:function(t,e){return!this.isEmpty(t)&&(t.lo<=e&&e<=t.hi)},hasInterval:function(t,e){return!!this.isEmpty(t)||!this.isEmpty(e)&&e.lo<=t.lo&&t.hi<=e.hi},intervalsOverlap:function(t,e){return!this.isEmpty(t)&&!this.isEmpty(e)&&(t.lo<=e.lo&&e.lo<=t.hi||e.lo<=t.lo&&t.lo<=e.hi)},divNonZero:function(t,e){var i=t.lo,s=t.hi,r=e.lo,o=e.hi,n=new a;return s<0?o<0?(n.lo=this.divLo(s,r),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,o)):i<0?o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,r)):o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,r)):(n.lo=this.divLo(i,o),n.hi=this.divHi(s,r)),n},divPositive:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(Number.NEGATIVE_INFINITY,this.divHi(t.hi,e)):new a(this.divLo(t.lo,e),Number.POSITIVE_INFINITY)},divNegative:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(this.divLo(t.hi,e),Number.POSITIVE_INFINITY):new a(Number.NEGATIVE_INFINITY,this.divHi(t.lo,e))},divZero:function(t){return 0===t.lo&&0===t.hi?t:this.WHOLE},fmod:function(t,e){var i,s;return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=t.lo<0?e.lo:e.hi,s=(s=t.lo/i)<0?Math.ceil(s):Math.floor(s),this.sub(t,this.mul(e,new a(s))))},multiplicativeInverse:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():this.zeroIn(t)?0!==t.lo?0!==t.hi?this.WHOLE:new a(Number.NEGATIVE_INFINITY,this.divHi(1,t.lo)):0!==t.hi?new a(this.divLo(1,t.hi),Number.POSITIVE_INFINITY):this.EMPTY.clone():new a(this.divLo(1,t.hi),this.divHi(1,t.lo))},pow:function(t,e){var i,s;if(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))return this.EMPTY.clone();if(this.isInterval(e)){if(!this.isSingleton(e))return this.EMPTY.clone();e=e.lo}return 0===e?0===t.lo&&0===t.hi?this.EMPTY.clone():this.ONE.clone():e<0?this.pow(this.multiplicativeInverse(t),-e):e%1==0?t.hi<0?(i=this.powLo(-t.hi,e),s=this.powHi(-t.lo,e),1&~e?new a(i,s):new a(-s,-i)):t.lo<0?1&~e?new a(0,this.powHi(Math.max(-t.lo,t.hi),e)):new a(-this.powLo(-t.lo,e),this.powHi(t.hi,e)):new a(this.powLo(t.lo,e),this.powHi(t.hi,e)):(console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),this.EMPTY.clone())},sqrt:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.nthRoot(t,2)},nthRoot:function(t,e){var i,s,r,n,h;if(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)||e<0)return this.EMPTY.clone();if(this.isInterval(e)){if(!this.isSingleton(e))return this.EMPTY.clone();e=e.lo}return i=1/e,t.hi<0?e%1!=0||1&~e?this.EMPTY.clone():(s=this.powHi(-t.lo,i),r=this.powLo(-t.hi,i),new a(-s,-r)):t.lo<0?(n=this.powHi(t.hi,i),e%1!=0||1&~e?new a(0,n):(h=-this.powHi(-t.lo,i),new a(h,n))):new a(this.powLo(t.lo,i),this.powHi(t.hi,i))},exp:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():new a(this.expLo(t.lo),this.expHi(t.hi))},log:function(t){var e;return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():(e=t.lo<=0?Number.NEGATIVE_INFINITY:this.logLo(t.lo),new a(e,this.logHi(t.hi)))},ln:function(t){return this.log(t)},log10:function(t){return this.isEmpty(t)?this.EMPTY.clone():this.div(this.log(t),this.log(new a(10,10)))},log2:function(t){return this.isEmpty(t)?this.EMPTY.clone():this.div(this.log(t),this.log(new a(2,2)))},hull:function(t,e){var i=this.isEmpty(t),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?t.clone():new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},intersection:function(t,e){var i,s;return this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=Math.max(t.lo,e.lo))<=(s=Math.min(t.hi,e.hi))?new a(i,s):this.EMPTY.clone()},union:function(t,e){if(!this.intervalsOverlap(t,e))throw new Error("Interval#unions do not overlap");return new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},difference:function(t,e){if(this.isEmpty(t)||this.isWhole(e))return this.EMPTY.clone();if(this.intervalsOverlap(t,e)){if(t.lo<e.lo&&e.hi<t.hi)throw new Error("Interval.difference: difference creates multiple intervals");return e.lo<=t.lo&&e.hi===1/0||e.hi>=t.hi&&e.lo===-1/0?this.EMPTY.clone():e.lo<=t.lo?(new a).halfOpenLeft(e.hi,t.hi):(new a).halfOpenRight(t.lo,e.lo)}return t.clone()},width:function(t){return this.isEmpty(t)?0:this.subHi(t.hi,t.lo)},abs:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():t.lo>=0?t.clone():t.hi<=0?this.negative(t):new a(0,Math.max(-t.lo,t.hi))},max:function(t,e){var i=this.isEmpty(t),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?t.clone():new a(Math.max(t.lo,e.lo),Math.max(t.hi,e.hi))},min:function(t,e){var i=this.isEmpty(t),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?t.clone():new a(Math.min(t.lo,e.lo),Math.min(t.hi,e.hi))},onlyInfinity:function(t){return!isFinite(t.lo)&&t.lo===t.hi},_handleNegative:function(t){var e;return t.lo<0&&(t.lo===-1/0?(t.lo=0,t.hi=1/0):(e=Math.ceil(-t.lo/this.piTwiceLow),t.lo+=this.piTwiceLow*e,t.hi+=this.piTwiceLow*e)),t},cos:function(t){var e,i,s,r,o,n,h,l;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=(new a).set(t.lo,t.hi),this._handleNegative(e),i=this.PI_TWICE,s=this.fmod(e,i),this.width(s)>=i.lo?new a(-1,1):s.lo>=this.piHigh?(r=this.cos(this.sub(s,this.PI)),this.negative(r)):(o=s.lo,n=s.hi,h=this.cosLo(n),l=this.cosHi(o),n<=this.piLow?new a(h,l):n<=i.lo?new a(-1,Math.max(h,l)):new a(-1,1)))},sin:function(t){return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():this.cos(this.sub(t,this.PI_HALF))},tan:function(t){var e,i,s;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=(new a).set(t.lo,t.hi),this._handleNegative(e),s=this.PI,(i=this.fmod(e,s)).lo>=this.piHalfLow&&(i=this.sub(i,s)),i.lo<=-this.piHalfLow||i.hi>=this.piHalfLow?this.WHOLE.clone():new a(this.tanLo(i.lo),this.tanHi(i.hi)))},asin:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.lo<=-1?-this.piHalfHigh:this.asinLo(t.lo),i=t.hi>=1?this.piHalfHigh:this.asinHi(t.hi),new a(e,i))},acos:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.hi>=1?0:this.acosLo(t.hi),i=t.lo<=-1?this.piHigh:this.acosHi(t.lo),new a(e,i))},acot:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.acotLo(t.lo),this.acotHi(t.hi))},atan:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.atanLo(t.lo),this.atanHi(t.hi))},sinh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.sinhLo(t.lo),this.sinhHi(t.hi))},cosh:function(t){return this.isEmpty(t)?this.EMPTY.clone():t.hi<0?new a(this.coshLo(t.hi),this.coshHi(t.lo)):t.lo>=0?new a(this.coshLo(t.lo),this.coshHi(t.hi)):new a(1,this.coshHi(-t.lo>t.hi?t.lo:t.hi))},tanh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.tanhLo(t.lo),this.tanhHi(t.hi))},equal:function(t,e){return this.isEmpty(t)?this.isEmpty(e):!this.isEmpty(e)&&t.lo===e.lo&&t.hi===e.hi},notEqual:function(t,e){return this.isEmpty(t)?!this.isEmpty(e):this.isEmpty(e)||t.hi<e.lo||t.lo>e.hi},lt:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<e.lo},gt:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.lo>e.hi},leq:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<=e.lo},geq:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.lo>=e.hi},piLow:3.141592653589793,piHigh:3.1415926535897936,piHalfLow:1.5707963267948966,piHalfHigh:1.5707963267948968,piTwiceLow:6.283185307179586,piTwiceHigh:6.283185307179587,identity:function(t){return t},_prev:function(t){return t===1/0?t:this.nextafter(t,-1/0)},_next:function(t){return t===-1/0?t:this.nextafter(t,1/0)},prev:function(t){return this._prev(t)},next:function(t){return this._next(t)},toInteger:function(t){return t<0?Math.ceil(t):Math.floor(t)},addLo:function(t,e){return this.prev(t+e)},addHi:function(t,e){return this.next(t+e)},subLo:function(t,e){return this.prev(t-e)},subHi:function(t,e){return this.next(t-e)},mulLo:function(t,e){return this.prev(t*e)},mulHi:function(t,e){return this.next(t*e)},divLo:function(t,e){return this.prev(t/e)},divHi:function(t,e){return this.next(t/e)},intLo:function(t){return this.toInteger(this.prev(t))},intHi:function(t){return this.toInteger(this.next(t))},logLo:function(t){return this.prev(Math.log(t))},logHi:function(t){return this.next(Math.log(t))},expLo:function(t){return this.prev(Math.exp(t))},expHi:function(t){return this.next(Math.exp(t))},sinLo:function(t){return this.prev(Math.sin(t))},sinHi:function(t){return this.next(Math.sin(t))},cosLo:function(t){return this.prev(Math.cos(t))},cosHi:function(t){return this.next(Math.cos(t))},tanLo:function(t){return this.prev(Math.tan(t))},tanHi:function(t){return this.next(Math.tan(t))},asinLo:function(t){return this.prev(Math.asin(t))},asinHi:function(t){return this.next(Math.asin(t))},acosLo:function(t){return this.prev(Math.acos(t))},acosHi:function(t){return this.next(Math.acos(t))},acotLo:function(t){return this.prev(r.A.acot(t))},acotHi:function(t){return this.next(r.A.acot(t))},atanLo:function(t){return this.prev(Math.atan(t))},atanHi:function(t){return this.next(Math.atan(t))},sinhLo:function(t){return this.prev(r.A.sinh(t))},sinhHi:function(t){return this.next(r.A.sinh(t))},coshLo:function(t){return this.prev(r.A.cosh(t))},coshHi:function(t){return this.next(r.A.cosh(t))},tanhLo:function(t){return this.prev(r.A.tanh(t))},tanhHi:function(t){return this.next(r.A.tanh(t))},sqrtLo:function(t){return this.prev(Math.sqrt(t))},sqrtHi:function(t){return this.next(Math.sqrt(t))},powLo:function(t,e){var i;if(e%1!=0)return this.prev(Math.pow(t,e));for(i=1&~e?1:t,e>>=1;e>0;)t=this.mulLo(t,t),1&~e||(i=this.mulLo(t,i)),e>>=1;return i},powHi:function(t,e){var i;if(e%1!=0)return this.next(Math.pow(t,e));for(i=1&~e?1:t,e>>=1;e>0;)t=this.mulHi(t,t),1&~e||(i=this.mulHi(t,i)),e>>=1;return i},disable:function(){this.next=this.prev=this.identity},enable:function(){this.prev=function(t){return this._prev(t)},this.next=function(t){return this._next(t)}},SMALLEST_DENORM:Math.pow(2,-1074),UINT_MAX:-1>>>0,nextafter:function(t,e){var i,s;return isNaN(t)||isNaN(e)?NaN:t===e?t:0===t?e<0?-this.SMALLEST_DENORM:this.SMALLEST_DENORM:(s=n.hi(t),i=n.lo(t),e>t==t>0?i===this.UINT_MAX?(s+=1,i=0):i+=1:0===i?(i=this.UINT_MAX,s-=1):i-=1,n.pack(i,s))}},s.A.Math.IntervalArithmetic.PI=new a(r.A.IntervalArithmetic.piLow,r.A.IntervalArithmetic.piHigh),s.A.Math.IntervalArithmetic.PI_HALF=new a(r.A.IntervalArithmetic.piHalfLow,r.A.IntervalArithmetic.piHalfHigh),s.A.Math.IntervalArithmetic.PI_TWICE=new a(r.A.IntervalArithmetic.piTwiceLow,r.A.IntervalArithmetic.piTwiceHigh),s.A.Math.IntervalArithmetic.ZERO=new a(0),s.A.Math.IntervalArithmetic.ONE=new a(1),s.A.Math.IntervalArithmetic.WHOLE=(new a).setWhole(),s.A.Math.IntervalArithmetic.EMPTY=(new a).setEmpty(),e.A=s.A.Math.IntervalArithmetic},873:function(t,e,i){var s=i(443),r=i(188),o=i(477),n={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",venetianred:"ae181e",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},a=[{re:/^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d.]{1,3})\s*\)\s*$/,example:["rgba(123, 234, 45, 0.5)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}];s.A.rgbParser=function(t,e,i){var s,o,h,l,c,u,d,p,f,_,g=t;if(!r.A.exists(t))return[];if(r.A.exists(e)&&r.A.exists(i)&&(g=[t,e,i]),s=g,_=!1,r.A.isArray(s)){for(u=0;u<3;u++)_=_||/\./.test(g[u].toString());for(u=0;u<3;u++)_=_&&g[u]>=0&&g[u]<=1;return _?[Math.ceil(255*g[0]),Math.ceil(255*g[1]),Math.ceil(255*g[2])]:g}for("string"==typeof g&&(s=g),"#"===s.charAt(0)&&(s=s.slice(1,7)),s=s.replace(/ /g,"").toLowerCase(),s=n[s]||s,u=0;u<a.length;u++)h=a[u].re,l=a[u].process,(c=h.exec(s))&&(d=(o=l(c))[0],p=o[1],f=o[2]);return isNaN(d)||isNaN(p)||isNaN(f)?[]:[d=d<0||isNaN(d)?0:d>255?255:d,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f]},s.A.isColor=function(t){var e=(new Option).style;return e.color=t,""!==e.color},s.A.rgb2css=function(t,e,i){var r;return"rgb("+(r=s.A.rgbParser(t,e,i))[0]+", "+r[1]+", "+r[2]+")"},s.A.rgb2hex=function(t,e,i){var r,o,n;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=(r=r[0]).toString(16),o=o.toString(16),n=n.toString(16),1===r.length&&(r="0"+r),1===o.length&&(o="0"+o),1===n.length&&(n="0"+n),"#"+r+o+n},s.A.hex2rgb=function(t){return s.A.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),s.A.rgb2css(t)},s.A.hsv2rgb=function(t,e,i){var s,r,n,a,h,l,c,u,d;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t<o.A.eps))return"#ffffff";s=i,r=i,n=i}else switch(l=t>=360?0:t,c=i*(1-e),u=i*(1-e*(a=(l/=60)-(h=Math.floor(l)))),d=i*(1-e*(1-a)),h){case 0:s=i,r=d,n=c;break;case 1:s=u,r=i,n=c;break;case 2:s=c,r=i,n=d;break;case 3:s=c,r=u,n=i;break;case 4:s=d,r=c,n=i;break;case 5:s=i,r=c,n=u}return["#",s=2===(s=Math.round(255*s).toString(16)).length?s:1===s.length?"0"+s:"00",r=2===(r=Math.round(255*r).toString(16)).length?r:1===r.length?"0"+r:"00",n=2===(n=Math.round(255*n).toString(16)).length?n:1===n.length?"0"+n:"00"].join("")},s.A.rgb2hsv=function(t,e,i){var r,o,n,a,h,l,c,u,d,p,f,_,g;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],a=(r=r[0])/255,h=o/255,l=n/255,_=Math.max(r,o,n),u=(g=Math.min(r,o,n))/255,p=0,(f=c=_/255)>0&&(p=(f-u)/f),d=1/(c-u),p>0&&(_===r?d*=h-l:d=_===o?2+(l-a)*d:4+(a-h)*d),(d*=60)<0&&(d+=360),_===g&&(d=0),[d,p,f]},s.A.rgb2LMS=function(t,e,i){var r,o,n,a,h,l,c,u=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=r[0],r=Math.pow(r,.476190476),o=Math.pow(o,.476190476),n=Math.pow(n,.476190476),(c=[a=r*u[0][0]+o*u[0][1]+n*u[0][2],h=r*u[1][0]+o*u[1][1]+n*u[1][2],l=r*u[2][0]+o*u[2][1]+n*u[2][2]]).l=a,c.m=h,c.s=l,c},s.A.LMS2rgb=function(t,e,i){var s,r,o,n,a=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]],h=function(t){for(var e=127,i=64;i>0;){if(Math.pow(e,.476190476)>t)e-=i;else{if(Math.pow(e+1,.476190476)>t)return e;e+=i}i/=2}return 254===e&&13.994955247<t?255:e};return s=t*a[0][0]+e*a[0][1]+i*a[0][2],r=t*a[1][0]+e*a[1][1]+i*a[1][2],o=t*a[2][0]+e*a[2][1]+i*a[2][2],(n=[s=h(s),r=h(r),o=h(o)]).r=s,n.g=r,n.b=o,n},s.A.rgba2rgbo=function(t){var e;return 9===t.length&&"#"===t.charAt(0)?(e=parseInt(t.slice(7,9).toUpperCase(),16)/255,t=t.slice(0,7)):e=1,[t,e]},s.A.rgbo2rgba=function(t,e){var i;return"none"===t||"transparent"===t?t:(1===(i=Math.round(255*e).toString(16)).length&&(i="0"+i),s.A.rgb2hex(t)+i)},s.A.rgb2bw=function(t){var e,i,r,o="0123456789ABCDEF";return"none"===t?t:(r=s.A.rgbParser(t),e=Math.floor(.3*r[0]+.59*r[1]+.11*r[2]),t="#"+(i=o.charAt(e>>4&15)+o.charAt(15&e))+i+i)},s.A.rgb2cb=function(t,e){var i,r,o,n,a,h,l,c,u,d,p,f="0123456789ABCDEF";if("none"===t)return t;switch(r=(a=s.A.rgb2LMS(t))[0],o=a[1],n=a[2],e=e.toLowerCase()){case"protanopia":h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,u=.05858939668799999,d=-.07934519995360001,p=.013289415272000003,r=n/o<.6903216543277437?-(l*o+c*n)/h:-(d*o+p*n)/u;break;case"tritanopia":h=-.00058973116217,l=.007690316482,c=-.01011703519052,u=.025495080838999994,d=-.0422740347,p=.017005316784,n=o/r<.8349489908460004?-(h*r+l*o)/c:-(u*r+d*o)/p;break;default:h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,u=.05858939668799999,d=-.07934519995360001,p=.013289415272000003,o=n/r<.5763833686400911?-(h*r+c*n)/l:-(u*r+p*n)/d}return i=s.A.LMS2rgb(r,o,n),t="#"+(f.charAt(i[0]>>4&15)+f.charAt(15&i[0])),t+=f.charAt(i[1]>>4&15)+f.charAt(15&i[1]),t+=f.charAt(i[2]>>4&15)+f.charAt(15&i[2])},s.A.shadeColor=function(t,e){var i=s.A.rgbParser(t),r=i[0],o=i[1],n=i[2];return r=(r=(r=parseInt(r+255*e))>0?r:0)<255?r:255,o=(o=(o=parseInt(o+255*e))>0?o:0)<255?o:255,n=(n=(n=parseInt(n+255*e))>0?n:0)<255?n:255,r=Math.round(r),o=Math.round(o),n=Math.round(n),s.A.rgb2hex([r,o,n])},s.A.lightenColor=function(t,e){return s.A.shadeColor(t,e)},s.A.darkenColor=function(t,e){return s.A.shadeColor(t,-1*e)},s.A.autoHighlight=function(t){var e=s.A.rgba2rgbo(t),i=e[0],r=e[1];return"#"===t.charAt(0)?(r*=r<.3?1.8:.4,s.A.rgbo2rgba(i,r)):t},s.A.contrast=function(t,e,i,r){var o,n,a,h,l;return e=e||"#000000",i=i||"#ffffff",r=r||7,o=s.A.rgbParser(t),n=s.A.rgbParser("#000000"),l=(a=.2126*Math.pow(o[0]/255,2.2)+.7152*Math.pow(o[1]/255,2.2)+.0722*Math.pow(o[2]/255,2.2))>(h=.2126*Math.pow(n[0]/255,2.2)+.7152*Math.pow(n[1]/255,2.2)+.0722*Math.pow(n[2]/255,2.2))?Math.floor((a+.05)/(h+.05)):Math.floor((h+.05)/(a+.05)),(l-=1)>r?e:i},s.A.setClassicColors=function(){s.A.Options.elements.strokeColor="blue",s.A.Options.elements.fillColor="red",s.A.Options.hatch.strokeColor="blue",s.A.Options.angle.fillColor="#ff7f00",s.A.Options.angle.highlightFillColor="#ff7f00",s.A.Options.angle.strokeColor="#ff7f00",s.A.Options.angle.label.strokeColor="blue",s.A.Options.arc.strokeColor="blue",s.A.Options.circle.center.fillColor="red",s.A.Options.circle.center.strokeColor="blue",s.A.Options.circumcircle.strokeColor="blue",s.A.Options.circumcircle.center.fillColor="red",s.A.Options.circumcircle.center.strokeColor="blue",s.A.Options.circumcirclearc.strokeColor="blue",s.A.Options.circumcirclesector.strokeColor="blue",s.A.Options.circumcirclesector.fillColor="green",s.A.Options.circumcirclesector.highlightFillColor="green",s.A.Options.conic.strokeColor="blue",s.A.Options.curve.strokeColor="blue",s.A.Options.incircle.strokeColor="blue",s.A.Options.incircle.center.fillColor="red",s.A.Options.incircle.center.strokeColor="blue",s.A.Options.inequality.fillColor="red",s.A.Options.integral.fillColor="red",s.A.Options.integral.curveLeft.color="red",s.A.Options.integral.curveRight.color="red",s.A.Options.line.strokeColor="blue",s.A.Options.point.fillColor="red",s.A.Options.point.strokeColor="red",s.A.Options.polygon.fillColor="green",s.A.Options.polygon.highlightFillColor="green",s.A.Options.polygon.vertices.strokeColor="red",s.A.Options.polygon.vertices.fillColor="red",s.A.Options.regularpolygon.fillColor="green",s.A.Options.regularpolygon.highlightFillColor="green",s.A.Options.regularpolygon.vertices.strokeColor="red",s.A.Options.regularpolygon.vertices.fillColor="red",s.A.Options.riemannsum.fillColor="yellow",s.A.Options.sector.fillColor="green",s.A.Options.sector.highlightFillColor="green",s.A.Options.semicircle.center.fillColor="red",s.A.Options.semicircle.center.strokeColor="blue",s.A.Options.slopetriangle.fillColor="red",s.A.Options.slopetriangle.highlightFillColor="red",s.A.Options.turtle.arrow.strokeColor="blue"},s.A.extend(s.A,{paletteWong:{black:"#000000",orange:"#E69F00",skyblue:"#56B4E9",bluishgreen:"#009E73",yellow:"#F0E442",darkblue:"#0072B2",vermillion:"#D55E00",reddishpurple:"#CC79A7",blue:"#0072B2",red:"#D55E00",green:"#009E73",purple:"#CC79A7",white:"#ffffff"}}),s.A.palette=s.A.paletteWong,e.A=s.A},904:function(t,e,i){var s=i(443),r=i(561),o=i(454),n=i(188),a=i(477);s.A.Coords=function(t,e,i,s){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!n.A.exists(s)||s,this.emitter&&o.A.eventify(this),this.setCoordinates(t,e,!1,!0)},s.A.extend(s.A.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>a.A.eps&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(t){var e=Math.round,i=this.board,s=this.usrCoords,r=i.origin.scrCoords;!0===t?(this.scrCoords[0]=e(s[0]),this.scrCoords[1]=e(s[0]*r[1]+s[1]*i.unitX),this.scrCoords[2]=e(s[0]*r[2]-s[2]*i.unitY)):(this.scrCoords[0]=s[0],this.scrCoords[1]=s[0]*r[1]+s[1]*i.unitX,this.scrCoords[2]=s[0]*r[2]-s[2]*i.unitY)},screen2usr:function(){var t=this.board.origin.scrCoords,e=this.scrCoords,i=this.board;this.usrCoords[0]=1,this.usrCoords[1]=(e[1]-t[1])/i.unitX,this.usrCoords[2]=(t[2]-e[2])/i.unitY},distance:function(t,e){var i,s,o=this.usrCoords,n=this.scrCoords;return t===r.A.COORDS_BY_USER?(i=e.usrCoords,(s=o[0]-i[0])*s>a.A.eps*a.A.eps?Number.POSITIVE_INFINITY:a.A.hypot(o[1]-i[1],o[2]-i[2])):(i=e.scrCoords,a.A.hypot(n[1]-i[1],n[2]-i[2]))},setCoordinates:function(t,e,i,s){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===r.A.COORDS_BY_USER?(2===e.length?(o[0]=1,o[1]=e[0],o[2]=e[1]):(o[0]=e[0],o[1]=e[1],o[2]=e[2],this.normalizeUsrCoords()),this.usr2screen(i)):(2===e.length?(n[1]=e[0],n[2]=e[1]):(n[1]=e[1],n[2]=e[2]),this.screen2usr()),!this.emitter||s||h[1]===n[1]&&h[2]===n[2]||this.triggerEventHandlers(["update"],[a,h]),this},copy:function(t,e){return void 0===e&&(e=0),this[t].slice(e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>a.A.eps},__evt__update:function(t,e){},__evt:function(){}}),e.A=s.A.Coords},925:function(t,e,i){var s=i(443),r=i(561),o=i(144),n=i(86),a=i(133),h=i(188),l=i(477),c=i(102),u=function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()};s.A.Text=function(t,e,i,s){var o;this.constructor(t,i,r.A.OBJECT_TYPE_TEXT,r.A.OBJECT_CLASS_TEXT),this.element=this.board.select(i.anchor),this.coordsConstructor(e,this.evalVisProp("islabel")),this.content="",this.plaintext="",this.plaintextOld=null,this.orgText="",this.needsSizeUpdate=!1,this.hiddenByParent=!1,this.size=[1,1],this.id=this.board.setId(this,"T"),this.board.renderer.drawText(this),this.board.finalizeAdding(this),o=this.visProp.visible,this.visProp.visible=!0,this.setText(s),this.visProp.visible=o,h.A.isString(this.content)&&this.notifyParents(this.content),this.elType="text",this.methodMap=h.A.deepCopy(this.methodMap,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"})},s.A.Text.prototype=new o.A,h.A.copyPrototypeMethods(s.A.Text,c.A,"coordsConstructor"),s.A.extend(s.A.Text.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a,c,u;return h.A.isObject(this.evalVisProp("precision"))?(c=this.board._inputDevice,u=this.evalVisProp("precision."+c)):u=this.board.options.precision.hasPoint,this.transformations.length>0&&(t=(i=l.A.matVecMult(l.A.inverse(this.board.renderer.joinTransforms(this,this.transformations)),[1,t,e]))[1],e=i[2]),s=(i="right"===(n=this.getAnchorX())?this.coords.scrCoords[1]-this.size[0]:"middle"===n?this.coords.scrCoords[1]-.5*this.size[0]:this.coords.scrCoords[1])+this.size[0],r=(o="top"===(a=this.getAnchorY())?this.coords.scrCoords[2]+this.size[1]:"middle"===a?this.coords.scrCoords[2]+.5*this.size[1]:this.coords.scrCoords[2])-this.size[1],"all"===this.evalVisProp("dragarea")?t>=i-u&&t<s+u&&e>=r-u&&e<=o+u:e>=r-u&&e<=o+u&&(t>=i-u&&t<=i+2*u||t>=s-2*u&&t<=s+u)},_createFctUpdateText:function(t){var e,i,s,r,o,n,a=this.evalVisProp("parse"),l=this.evalVisProp("usemathjax"),c=this.evalVisProp("usekatex"),u=!1;if(this.orgText=t,h.A.isFunction(t))this.updateText=function(){r=t().toString(),this.plaintext=!a||l||c?r:this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(r,!1)))};else if(h.A.isNumber(t)&&this.evalVisProp("formatnumber")?this.evalVisProp("tofraction")?this.content=l?"\\("+h.A.toFraction(t,!0)+"\\)":h.A.toFraction(t,c):(s=this.evalVisProp("digits"),this.useLocale()?this.content=this.formatNumberLocale(t,s):this.content=h.A.toFixed(t,s)):h.A.isString(t)&&a?(this.evalVisProp("useasciimathml")?this.content="'`"+t+"`'":l||c?(this.content=this.valueTagToJessieCode(t),h.A.isArray(this.content)||(this.content=this.content.replace(/\\/g,"\\\\"))):this.content=this.poorMansTeX(this.valueTagToJessieCode(t)),u=!0):this.content=t,u){if(h.A.isArray(this.content)){for(n=this,o=0;o<this.content.length;o++)if('"'!==this.content[o][0])for(i in this.content[o]=this.board.jc.snippet(this.content[o],!0,"",!1),this.content[o].deps)this.addParents(this.content[o].deps[i]),this.content[o].deps[i].addChild(this);e=function(){var t,e,i=n.evalVisProp("digits"),s="";for(t=0;t<n.content.length;t++)h.A.isFunction(n.content[t])?(e=n.content[t](),e=n.useLocale()?n.formatNumberLocale(e,i):h.A.toFixed(e,i)):'"'===(e=n.content[t])[0]&&'"'===e[e.length-1]&&(e=e.slice(1,-1)),s+=e;return s}}else for(i in(e=this.board.jc.snippet(this.content,!0,"",!1)).deps)this.addParents(e.deps[i]),e.deps[i].addChild(this);this.updateText=function(){this.plaintext=this.unescapeTicks(e())}}else this.updateText=function(){this.plaintext=this.content}},_setText:function(t){return this._createFctUpdateText(t),this.updateText(),this.fullUpdate(),this.board.infobox&&this.id===this.board.infobox.id||this.updateSize(),this},setTextJessieCode:function(t){var e;return this.visProp.castext=t,e=h.A.isFunction(t)?function(){return h.A.sanitizeHTML(t())}:h.A.isNumber(t)?t:h.A.sanitizeHTML(t),this._setText(e)},setText:function(t){return this._setText(t)},updateSize:function(){var t,e,i,s=this.evalVisProp("display");return a.A.isBrowser&&"no"!==this.board.renderer.type?(i=this.rendNode,"html"===s||"vml"===this.board.renderer.type?h.A.exists(i.offsetWidth)?(e=this,window.setTimeout(function(){e.size=[i.offsetWidth,i.offsetHeight],e.needsUpdate=!0,e.updateRenderer()},0)):this.size=this.crudeSizeEstimate():"internal"===s&&("svg"===this.board.renderer.type?(e=this,window.setTimeout(function(){try{t=i.getBBox(),e.size=[t.width,t.height],e.needsUpdate=!0,e.updateRenderer()}catch(t){}},0)):"canvas"===this.board.renderer.type&&(this.size=this.crudeSizeEstimate())),this):this},crudeSizeEstimate:function(){var t=parseFloat(this.evalVisProp("fontsize"));return[t*this.plaintext.length*.45,.9*t]},utf8_decode:function(t){return t.replace(/&#x(\w+);/g,function(t,e){return String.fromCharCode(parseInt(e,16))})},replaceSub:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("_{");i>=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/_\{/,"<sub>")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"</sub>")),i=t.indexOf("_{");for(i=t.indexOf("_");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/_(.?)/,"<sub>$1</sub>")).indexOf("_");return t},replaceSup:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("^{");i>=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/\^\{/,"<sup>")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"</sup>")),i=t.indexOf("^{");for(i=t.indexOf("^");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/\^(.?)/,"<sup>$1</sup>")).indexOf("^");return t},getSize:function(){return this.size},setCoords:function(t,e){var i,s,o;return h.A.isArray(t)&&t.length>1&&(e=t[1],t=t[0]),this.evalVisProp("islabel")&&h.A.exists(this.element)?(s=(t-(i=this.element.getLabelAnchor()).usrCoords[1])*this.board.unitX,o=-(e-i.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(r.A.COORDS_BY_SCREEN,[s,o])):this.coords.setCoordinates(r.A.COORDS_BY_USER,[t,e]),this.fullUpdate(),this},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateText(),"internal"===this.evalVisProp("display")&&h.A.isString(this.plaintext)&&(this.plaintext=this.utf8_decode(this.plaintext)),this.checkForSizeUpdate(),this.needsSizeUpdate&&this.updateSize(),this):this},checkForSizeUpdate:function(){this.board.infobox&&this.id===this.board.infobox.id?this.needsSizeUpdate=!1:(this.needsSizeUpdate=this.plaintextOld!==this.plaintext,this.needsSizeUpdate&&(this.plaintextOld=this.plaintext))},updateRenderer:function(){return this.evalVisProp("autoposition")&&this.setAutoPosition().updateConstraint(),this.updateRendererGeneric("updateText")},expandShortMath:function(t){return t.replace(/([)0-9.])\s*([(a-zA-Z_])/g,"$1*$2")},generateTerm:function(t,e,i){var s,r,o,a,l='""';if(o=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/"/g,"'")).replace(/'/g,"\\'")).replace(/&amp;arc;/g,"&ang;")).replace(/<arc\s*\/>/g,"&ang;")).replace(/&lt;arc\s*\/&gt;/g,"&ang;")).replace(/&lt;sqrt\s*\/&gt;/g,"&radic;")).replace(/&lt;value&gt;/g,"<value>")).replace(/&lt;\/value&gt;/g,"</value>")).indexOf("<value>"),a=t.indexOf("</value>"),o>=0)for(;o>=0;)l+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,o)))+'"',r=(r=t.slice(o+7,a)).replace(/\s+/g,""),!0===e&&(r=this.expandShortMath(r)),(s=(s=(s=i?r:n.A.geonext2JS(r,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")<0&&h.A.isNumber(h.A.bind(this.board.jc.snippet(s,!0,"",!1),this)())?l+="+("+s+").toFixed("+this.evalVisProp("digits")+")":l+="+("+s+")",o=(t=t.slice(a+8)).indexOf("<value>"),a=t.indexOf("</value>");return l+=' + "'+this.replaceSub(this.replaceSup(t))+'"',l=(l=(l=this.convertGeonextAndSketchometry2CSS(l)).replace(/&amp;/g,"&")).replace(/"/g,"'")},valueTagToJessieCode:function(t){var e,i,s,r,o=[],n='"';if(s=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/&lt;value&gt;/g,"<value>")).replace(/&lt;\/value&gt;/g,"</value>")).indexOf("<value>"),r=t.indexOf("</value>"),s>=0)for(;s>=0;)o.push(n+this.escapeTicks(t.slice(0,s))+n),i=(i=t.slice(s+7,r)).replace(/\s+/g,""),e=(e=i=this.expandShortMath(i)).replace(/\\"/g,"'").replace(/\\'/g,"'"),o.push("("+e+")"),s=(t=t.slice(r+8)).indexOf("<value>"),r=t.indexOf("</value>");for(o.push(n+this.escapeTicks(t)+n),s=0;s<o.length;s++)o[s]=o[s].replace(/&amp;/g,"&");return o},poorMansTeX:function(t){var e,i;if(h.A.isArray(t)){for(i=[],e=0;e<t.length;e++)i.push(this.poorMansTeX(t[e]));return i}return t=t.replace(/<arc\s*\/*>/g,"&ang;").replace(/&lt;arc\s*\/*&gt;/g,"&ang;").replace(/<sqrt\s*\/*>/g,"&radic;").replace(/&lt;sqrt\s*\/*&gt;/g,"&radic;"),this.convertGeonextAndSketchometry2CSS(this.replaceSub(this.replaceSup(t)),!0)},escapeTicks:function(t){return t.replace(/"/g,"%22").replace(/'/g,"%27")},unescapeTicks:function(t){return t.replace(/%22/g,'"').replace(/%27/g,"'")},convertGeonext2CSS:function(t){return h.A.isString(t)&&(t=(t=(t=(t=t.replace(/(<|&lt;)overline(>|&gt;)/g,"<span style=text-decoration:overline;>")).replace(/(<|&lt;)\/overline(>|&gt;)/g,"</span>")).replace(/(<|&lt;)arrow(>|&gt;)/g,"<span style=text-decoration:overline;>")).replace(/(<|&lt;)\/arrow(>|&gt;)/g,"</span>")),t},convertSketchometry2CSS:function(t,e){var i='<span class="sketcho sketcho-inherit sketcho-',s='"></span>';return h.A.isString(t)&&(e&&(i=this.escapeTicks(i),s=this.escapeTicks(s)),t=(t=t.replace(/(<|&lt;)sketchofont(>|&gt;)/g,i)).replace(/(<|&lt;)\/sketchofont(>|&gt;)/g,s)),t},convertGeonextAndSketchometry2CSS:function(t,e){return t=this.convertGeonext2CSS(t),t=this.convertSketchometry2CSS(t,e)},notifyParents:function(t){var e,i=null;t=(t=t.replace(/&lt;value&gt;/g,"<value>")).replace(/&lt;\/value&gt;/g,"</value>");do{null!==(i=(e=/<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/).exec(t))&&(n.A.findDependencies(this,i[1],this.board),t=(t=t.slice(i.index)).replace(e,""))}while(null!==i);return this},getParents:function(){var t;return t=void 0!==this.relativeCoords?[this.relativeCoords.usrCoords[1],this.relativeCoords.usrCoords[2],this.orgText]:[this.Z(),this.X(),this.Y(),this.orgText],0!==this.parents.length&&(t=this.parents),t},bounds:function(){var t=this.coords.usrCoords;return this.evalVisProp("islabel")||0===this.board.unitY||0===this.board.unitX?[0,0,0,0]:[t[1],t[2]+this.size[1]/this.board.unitY,t[1]+this.size[0]/this.board.unitX,t[2]]},getAnchorX:function(){var t=this.evalVisProp("anchorx");if("auto"===t)switch(this.visProp.position){case"top":case"bot":return"middle";case"rt":case"lrt":case"urt":return"left";default:return"right"}return t},getAnchorY:function(){var t=this.evalVisProp("anchory");if("auto"===t)switch(this.visProp.position){case"top":case"ulft":case"urt":return"bottom";case"bot":case"lrt":case"llft":return"top";default:return"middle"}return t},getNumberOfConflicts:function(t,e,i,s,o){o=o||[];var n,a,h,l,c,u,d,p,f=0,_=this.board.options.precision.hasPoint;for(this.board.options.precision.hasPoint=.3*(i+s),n=0;n<this.board.objectsList.length;n++)(a=this.board.objectsList[n]).visPropCalc.visible&&a!==this&&-1===o.indexOf(a.id)&&!0!==a.evalVisProp("ignoreforlabelautoposition")&&(l=a.visProp.hasinnerpoints,a.visProp.hasinnerpoints=!1,a.visProp.islabel||a.elementClass===r.A.OBJECT_CLASS_POINT?(c=(h=a.coords.scrCoords)[1],u=h[2],d=a.size[0],p=a.size[1],a.visProp.islabel?("top"===a.visProp.anchory?u+=p/2:u-=p/2,"left"===a.visProp.anchorx?c+=d/2:c-=d/2):(d=0,p=0),Math.abs(c-t)<(i+d)/2&&Math.abs(u-e)<(s+p)/2&&f++):a.hasPoint(t,e)&&f++,a.visProp.hasinnerpoints=l);return this.board.options.precision.hasPoint=_,f},calculateScore:function(t,e){var i,s,r,o,n,a,l=0,c=[0,0],u=this.getSize()[0],d=this.getSize()[1],p=this.evalVisProp("offset"),f=this.board.getBoundingBox();return this.evalVisProp("islabel")&&h.A.exists(this.element)?(a=this.element.getLabelAnchor().scrCoords,r=Math.cos(e),o=Math.sin(e),i=a[1]+t*r,s=a[2]-t*o,r<0?(c[0]=i-u,i-=u/2):(c[0]=i+u,i+=u/2),o<0?(c[1]=s+d,s+=d/2):(c[1]=s-d,s-=d/2),(c[0]<0||c[0]>(f[2]-f[0])*this.board.unitX||c[1]<0||c[1]>(f[1]-f[3])*this.board.unitY)&&(l-=1),l-=this.getNumberOfConflicts(i,s,u,d,h.A.evaluate(this.visProp.autopositionwhitelist)),l-=t/this.evalVisProp("autopositionmindistance")/10-.1,(n=Math.atan2(p[1],p[0]))<0&&(n+=2*Math.PI),l-=(r>0&&Math.cos(n)>0&&Math.abs(e-n)>Math.PI?Math.abs(e-n-2*Math.PI):Math.abs(e-n))/10):0},setAutoPosition:function(){var t,e,i,s,r,o,n,a,h,l,c,u=-1/0,d=this.evalVisProp("autopositionmindistance"),p=this.evalVisProp("autopositionmaxdistance"),f=this.evalVisProp("offset");if(this===this.board.infobox||!this.element||!this.visPropCalc.visible||!this.evalVisProp("islabel"))return this;if(l=Math.sqrt(f[0]*f[0]+f[1]*f[1]),c=Math.atan2(f[1],f[0]),0===this.calculateScore(l,c))return this;for(t=d,i=(p-d)/3;p-t>-.01;){for(s=0;s<60;s++)if(e=s/60*2*Math.PI,(n=this.calculateScore(t,e))>u&&(o=e,r=t,u=n),0===u){t=p;break}t+=i}return a=Math.cos(o),h=Math.sin(o),this.visProp.anchorx=a<0?"right":"left",this.visProp.anchory=h<0?"top":"bottom",this.visProp.offset=[r*a,r*h],this}}),s.A.createText=function(t,e,i){var r,o=h.A.copyAttributes(i,t.options,"text"),n=e.slice(0,-1),a=e[e.length-1];if(o.anchor=o.parent||o.anchor,!(r=c.A.create(s.A.Text,t,n,o,a)))throw new Error("JSXGraph: Can't create text with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==o.rotate&&r.addRotation(o.rotate),r},s.A.registerElement("text",s.A.createText),s.A.createHTMLSlider=function(t,e,i){var r,o,n=h.A.copyAttributes(i,t.options,"htmlslider");if(2!==e.length||2!==e[0].length||3!==e[1].length)throw new Error("JSXGraph: Can't create htmlslider with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parents are: [[x,y], [min, start, max]]");n.anchor=n.parent||n.anchor,n.fixed=n.fixed||!0,o=[e[0][0],e[0][1],'<form style="display:inline"><input type="range" /><span></span><input type="text" /></form>'],(r=s.A.createText(t,o,n)).type=h.A.OBJECT_TYPE_HTMLSLIDER,r.rendNodeForm=r.rendNode.childNodes[0],r.rendNodeRange=r.rendNodeForm.childNodes[0],r.rendNodeRange.min=e[1][0],r.rendNodeRange.max=e[1][2],r.rendNodeRange.step=n.step,r.rendNodeRange.value=e[1][1],r.rendNodeLabel=r.rendNodeForm.childNodes[1],r.rendNodeLabel.id=r.rendNode.id+"_label",n.withlabel&&(r.rendNodeLabel.innerText=r.name+"="),r.rendNodeOut=r.rendNodeForm.childNodes[2],r.rendNodeOut.value=e[1][1];try{r.rendNodeForm.id=r.rendNode.id+"_form",r.rendNodeRange.id=r.rendNode.id+"_range",r.rendNodeOut.id=r.rendNode.id+"_out"}catch(t){s.A.debug(t)}return r.rendNodeRange.style.width=n.widthrange+"px",r.rendNodeRange.style.verticalAlign="middle",r.rendNodeOut.style.width=n.widthout+"px",r._val=e[1][1],s.A.supportsVML()?a.A.addEvent(r.rendNodeForm,"change",u,r):a.A.addEvent(r.rendNodeForm,"input",u,r),r.Value=function(){return this._val},r},s.A.registerElement("htmlslider",s.A.createHTMLSlider),e.A=s.A.Text}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=function(t,e){for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var __webpack_exports__={};__webpack_require__.d(__webpack_exports__,{default:function(){return src}});var jxg=__webpack_require__(443),env=__webpack_require__(133),constants=__webpack_require__(561),utils_type=__webpack_require__(188);jxg.A.XML={cleanWhitespace:function(t){for(var e=t.firstChild;utils_type.A.exists(e);)3!==e.nodeType||/\S/.test(e.nodeValue)?1===e.nodeType&&this.cleanWhitespace(e):t.removeChild(e),e=e.nextSibling},parse:function(t){var e,i;return i="function"==typeof DOMParser||"object"==typeof DOMParser?DOMParser:function(){this.parseFromString=function(t){var e;return"function"==typeof ActiveXObject&&(e=new ActiveXObject("MSXML.DomDocument")).loadXML(t),e}},e=(new i).parseFromString(t,"text/xml"),this.cleanWhitespace(e),e}};var xml=jxg.A.XML,utils_event=__webpack_require__(454),expect=__webpack_require__(713),math=__webpack_require__(477);math.A.ProbFuncs={MAXNUM:17014118346046923e22,SQRTH:.7071067811865476,SQRT2:1.4142135623730951,MAXLOG:708.3964185322641,P:[2.461969814735305e-10,.5641895648310689,7.463210564422699,48.63719709856814,196.5208329560771,526.4451949954773,934.5285271719576,1027.5518868951572,557.5353353693994],Q:[13.228195115474499,86.70721408859897,354.9377788878199,975.7085017432055,1823.9091668790973,2246.3376081871097,1656.6630919416134,557.5353408177277],R:[.5641895835477551,1.275366707599781,5.019050422511805,6.160210979930536,7.4097426995044895,2.9788666537210022],S:[2.2605286322011726,9.396035249380015,12.048953980809666,17.08144507475659,9.608968090632859,3.369076451000815],T:[9.604973739870516,90.02601972038427,2232.005345946843,7003.325141128051,55592.30130103949],U:[33.56171416475031,521.3579497801527,4594.323829709801,22629.000061389095,49267.39426086359],M:128,MINV:.0078125,expx2:function(t,e){var i,s,r,o;return t=Math.abs(t),e<0&&(t=-t),i=(r=this.MINV*Math.floor(this.M*t+.5))*r,s=2*r*(o=t-r)+o*o,e<0&&(i=-i,s=-s),i+s>this.MAXLOG?1/0:i=Math.exp(i)*Math.exp(s)},polevl:function(t,e,i){var s,r;if(utils_type.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},0);for(r=0,s=0;r<=i;r++)s=s*t+e[r];return s},p1evl:function(t,e,i){var s,r;if(utils_type.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},1);for(r=0,s=1;r<i;r++)s=s*t+e[r];return s},ndtr:function(t){var e,i,s;return e=t*this.SQRTH,(s=Math.abs(e))<1?i=.5+.5*this.erf(e):(i=.5*this.erfce(s),s=this.expx2(t,-1),i*=Math.sqrt(s),e>0&&(i=1-i)),i},_underflow:function(t){return console.log("erfc","UNDERFLOW"),t<0?2:0},erfc:function(t){var e,i,s,r,o;return(s=t<0?-t:t)<1?1-this.erf(t):(o=-t*t)<-this.MAXLOG?this._underflow(t):(o=this.expx2(t,-1),s<8?(e=this.polevl(s,this.P,8),i=this.p1evl(s,this.Q,8)):(e=this.polevl(s,this.R,5),i=this.p1evl(s,this.S,6)),r=o*e/i,t<0&&(r=2-r),0===r?this._underflow(t):r)},erfce:function(t){var e,i;return t<8?(e=this.polevl(t,this.P,8),i=this.p1evl(t,this.Q,8)):(e=this.polevl(t,this.R,5),i=this.p1evl(t,this.S,6)),e/i},erf:function(t){var e;return Math.abs(t)>1?1-this.erfc(t):(e=t*t,t*this.polevl(e,this.T,4)/this.p1evl(e,this.U,5))},s2pi:2.5066282746310007,P0:[-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125],Q0:[1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262117,-1.1833162112133],P1:[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],Q1:[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],P2:[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6.239745391849833e-9],Q2:[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6.790194080099813e-9],ndtri:function(t){var e,i,s,r,o;return t<=0?-1/0:t>=1?1/0:(o=1,(i=t)>.8646647167633873&&(i=1-i,o=0),i>.1353352832366127?(e=(i-=.5)+i*((r=i*i)*this.polevl(r,this.P0,4)/this.p1evl(r,this.Q0,8)),e*=this.s2pi):(s=1/(e=Math.sqrt(-2*Math.log(i))),e=e-Math.log(e)/e-(e<8?s*this.polevl(s,this.P1,8)/this.p1evl(s,this.Q1,8):s*this.polevl(s,this.P2,8)/this.p1evl(s,this.Q2,8)),0!==o&&(e=-e),e))},erfi:function(t){return this.ndtri(.5*(t+1))*this.SQRTH}};var probfuncs=math.A.ProbFuncs,ia=__webpack_require__(733);math.A.Extrapolate={upper:15,infty:1e4,wynnEps:function(t,e,i){var s,r,o,n,a;if(i[e]=t,0===e)a=t;else{for(o=0,s=e;s>0;s--)r=o,o=i[s-1],n=i[s]-o,Math.abs(n)<=1e-15?i[s-1]=1e20:i[s-1]=1*r+1/n;a=i[e%2]}return a},aitken:function(t,e,i){var s,r,o,n,a,h;if(i[e]=t,e<2)s=t;else{for(n=e/2,a=1;a<=n;a++)r=i[(h=e-2*a)+2]-2*i[h+1]+i[h],Math.abs(r)<1e-15?i[h]=1e20:(o=i[h]-i[h+1],i[h]-=o*o/r);s=i[e%2]}return s},brezinski:function(t,e,i){var s,r,o,n,a,h,l,c;if(i[e]=t,e<3)s=t;else{for(h=e/3,c=e,l=1;l<=h;l++)o=i[(c-=3)+1]-i[c],n=i[c+2]-i[c+1],r=(a=i[c+3]-i[c+2])*(n-o)-o*(a-n),Math.abs(r)<1e-15?i[c]=1e20:i[c]=i[c+1]-o*n*(a-n)/r;s=i[e%3]}return s},iteration:function(t,e,i,s,r){var o,n,a,h,l=NaN,c=[],u="finite",d=e;for(r=r||0,o=1;o<=this.upper;o++){if(n=i(t+(d=0===r?e/(o+1):.5*d),!0),a=this[s](n,o-1,c),isNaN(a)){u="NaN";break}if(0!==n&&a/n>this.infty){l=a,u="infinite";break}if(h=a-l,Math.abs(h)<1e-7)break;l=a}return[l,u,1-(o-1)/this.upper]},levin:function(t,e,i,s,r,o){var n,a,h,l;if(l=1/(s+e),r[e]=t/i,o[e]=1/i,e>0&&(r[e-1]=r[e]-r[e-1],o[e-1]=o[e]-o[e-1],e>1))for(h=(s+e-1)*l,n=2;n<=e;n++)a=(s+e-n)*Math.pow(h,n-2)*l,r[e-n]=r[e-n+1]-a*r[e-n],o[e-n]=o[e-n+1]-a*o[e-n],l*=h;return Math.abs(o[0])<1e-15?1e20:r[0]/o[0]},iteration_levin:function(t,e,i,s){var r,o,n,a,h,l,c,u=NaN,d=[],p=[],f="finite",_=e;for(s=s||0,a=i(t+e,!0),r=1;r<=this.upper;r++){if(h=(o=i(t+(_=0===s?e/(r+1):.5*_),!0))-a,c="u"===(Math.abs(h)<1?"u":"t")?(1+r)*h:h,a=o,l=(n=this.levin(o,r-1,c,1,d,p))-u,isNaN(n)){f="NaN";break}if(0!==o&&n/o>this.infty){u=n,f="infinite";break}if(Math.abs(l)<1e-7)break;u=n}return[u,f,1-(r-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}};var extrapolate=math.A.Extrapolate,geometry=__webpack_require__(571);math.A.Quadtree=function(t,e,i){e=e||{capacity:10,pointType:"coords"},this.config={},this.config.capacity=e.capacity||10,this.config.pointType=e.pointType||"coords",this.points=[],this.xlb=t[0],this.xub=t[2],this.ylb=t[3],this.yub=t[1],this.parent=i||null,this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null},utils_type.A.extend(math.A.Quadtree.prototype,{contains:function(t,e){return this.xlb<t&&t<=this.xub&&this.ylb<e&&e<=this.yub},insert:function(t){switch(this.config.pointType){case"coords":if(!this.contains(t.usrCoords[1],t.usrCoords[2]))return!1;break;case"object":if(!this.contains(t.x,t.y))return!1}return this.points.length<this.config.capacity&&null===this.northWest?(this.points.push(t),!0):(null===this.northWest&&this.subdivide(),!!this.northWest.insert(t)||(!!this.northEast.insert(t)||(!!this.southEast.insert(t)||!!this.southWest.insert(t))))},subdivide:function(){var t=this.xlb+.5*(this.xub-this.xlb),e=this.ylb+.5*(this.yub-this.ylb);this.northWest=new math.A.Quadtree([this.xlb,this.yub,t,e],this.config,this),this.northEast=new math.A.Quadtree([t,this.yub,this.xub,e],this.config,this),this.southEast=new math.A.Quadtree([this.xlb,e,t,this.ylb],this.config,this),this.southWest=new math.A.Quadtree([t,e,this.xub,this.ylb],this.config,this)},_query:function(t,e){var i;if(this.contains(t,e)){if(null===this.northWest)return this;if(i=this.northWest._query(t,e))return i;if(i=this.northEast._query(t,e))return i;if(i=this.southEast._query(t,e))return i;if(i=this.southWest._query(t,e))return i}return!1},query:function(t,e){var i,s;return utils_type.A.exists(e)?(i=t,s=e):(i=t.usrCoords[1],s=t.usrCoords[2]),this._query(i,s)},hasPoint:function(t,e,i){var s,r,o;if(this.contains(t,e)){switch(o=this.points.length,this.config.pointType){case"coords":for(r=0;r<o;r++)if(geometry.A.distance([t,e],this.points[r].usrCoords.slice(1),2)<i)return!0;break;case"object":for(r=0;r<o;r++)if(geometry.A.distance([t,e],[this.points[r].x,this.points[r].y],2)<i)return!0}if(null===this.northWest)return!1;if(s=this.northWest.hasPoint(t,e,i))return s;if(s=this.northEast.hasPoint(t,e,i))return s;if(s=this.southEast.hasPoint(t,e,i))return s;if(s=this.southWest.hasPoint(t,e,i))return s}return!1},getAllPoints:function(){var t=[];return this.getAllPointsRecursive(t),t},getAllPointsRecursive(t){Array.prototype.push.apply(t,this.points.slice()),null!==this.northWest&&(this.northWest.getAllPointsRecursive(t),this.northEast.getAllPointsRecursive(t),this.southEast.getAllPointsRecursive(t),this.southWest.getAllPointsRecursive(t))}});var qdt=math.A.Quadtree;math.A.BoxQuadtree=function(t,e,i){var s,r,o,n;t--,this.depth=t,this.capacity=e,this.items=[],this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null,this.bbox=null,this.cx=null,this.cy=null,i&&(s=i[0],r=i[1],o=i[2],n=i[3],this.cx=.5*(s+o),this.cy=.5*(r+n),this.bbox=[s,r,o,n])},utils_type.A.extend(math.A.BoxQuadtree.prototype,{insert:function(t){var e,i,s,r,o,n,a,h,l,c,u,d=[],p=[],f=[],_=[];if(null===this.bbox){for(i=t.length,s=n=1/0,o=r=-1/0,e=0;e<t.length;e++)s=(a=t[e]).xlb<s?a.xlb:s,r=a.yub>r?a.yub:r,o=a.xub>o?a.xub:o,n=a.ylb<n?a.ylb:n;this.cx=.5*(s+o),this.cy=.5*(r+n),this.bbox=[s,r,o,n]}else s=this.bbox[0],r=this.bbox[1],o=this.bbox[2],n=this.bbox[3];if(0===this.depth||this.items.length+t.length<this.capacity)return this.items=this.items.concat(t),this;for(i=t.length,e=0;e<i;e++)h=(a=t[e]).xlb<=this.cx&&a.yub>this.cy,c=a.xlb<=this.cx&&a.ylb<=this.cy,l=a.xub>this.cx&&a.yub>this.cy,u=a.xub>this.cx&&a.ylb<=this.cy,h&&l&&u&&c?this.items.push(a):(h&&d.push(a),c&&f.push(a),l&&p.push(a),u&&_.push(a));return this.subdivide(d,f,p,_,s,r,o,n),this},insertItem:function(t){var e,i,s,r,o,n,a,h,l=[],c=[],u=[],d=[];return null===this.bbox?(e=r=1/0,s=i=-1/0,e=t.xlb<e?t.xlb:e,i=t.yub>i?t.yub:i,s=t.xub>s?t.xub:s,r=t.ylb<r?t.ylb:r,this.cx=.5*(e+s),this.cy=.5*(i+r),this.bbox=[e,i,s,r]):(e=this.bbox[0],i=this.bbox[1],s=this.bbox[2],r=this.bbox[3]),0===this.depth||this.items.length+1<this.capacity?(this.items.push(t),this):(o=t.xlb<=this.cx&&t.yub>this.cy,a=t.xlb<=this.cx&&t.ylb<=this.cy,n=t.xub>this.cx&&t.yub>this.cy,h=t.xub>this.cx&&t.ylb<=this.cy,o&&n&&h&&a?this.items.push(t):(o&&l.push(t),a&&u.push(t),n&&c.push(t),h&&d.push(t)),this.subdivide(l,u,c,d,e,i,s,r),this)},subdivide:function(t,e,i,s,r,o,n,a){return t.length>0&&(null===this.northWest&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,o,this.cx,this.cy])),this.northWest.insert(t)),e.length>0&&(null===this.southWest&&(this.southWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,this.cy,this.cx,a])),this.southWest.insert(e)),i.length>0&&(null===this.northEast&&(this.northEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,o,n,this.cy])),this.northEast.insert(i)),s.length>0&&(null===this.southEast&&(this.southEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,this.cy,n,a])),this.southEast.insert(s)),this},find:function(t){var e,i,s=function(e){return t[2]>=e.xlb&&t[0]<=e.xub&&t[3]<=e.yub&&t[1]>=e.ylb},r=[];for(i=this.items.length,e=0;e<i;e++)s(this.items[e])&&r.push(this.items[e]);return null!==this.northWest&&t[0]<=this.cx&t[1]>=this.cy&&utils_type.A.concat(r,this.northWest.find(t)),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&utils_type.A.concat(r,this.southWest.find(t)),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&utils_type.A.concat(r,this.northEast.find(t)),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&utils_type.A.concat(r,this.southEast.find(t)),r},analyzeTree:function(){var t,e={number_items:this.items.length,depth:1};return null!==this.northWest&&(t=this.northWest.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.southWest&&(t=this.southWest.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.northEast&&(t=this.northEast.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.southEast&&(t=this.southEast.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),e},plot:function(){var t,e=[],i=[];return e.push(this.bbox[0]),i.push(this.bbox[3]),e.push(this.bbox[2]),i.push(this.bbox[3]),e.push(this.bbox[2]),i.push(this.bbox[1]),e.push(this.bbox[0]),i.push(this.bbox[1]),e.push(this.bbox[0]),i.push(this.bbox[3]),e.push(NaN),i.push(NaN),null!==this.northWest&&(t=this.northWest.plot(),utils_type.A.concat(e,t[0]),utils_type.A.concat(i,t[1])),null!==this.northEast&&(t=this.northEast.plot(),utils_type.A.concat(e,t[0]),utils_type.A.concat(i,t[1])),null!==this.southEast&&(t=this.southEast.plot(),utils_type.A.concat(e,t[0]),utils_type.A.concat(i,t[1])),null!==this.southWest&&(t=this.southWest.plot(),utils_type.A.concat(e,t[0]),utils_type.A.concat(i,t[1])),[e,i]}});var bqdt=math.A.BoxQuadtree,numerics=__webpack_require__(171);jxg.A.Math.Nlp={arr:function(t){return new Float64Array(t)},arr2:function(t,e){for(var i=0,s=new Array(t);i<t;)s[i]=this.arr(e),i++;return s},arraycopy:function(t,e,i,s,r){for(var o=0;o<r;)i[o+s]=t[o+e],o++},lastNumberOfEvaluations:0,GetLastNumberOfEvaluations:function(){return this.lastNumberOfEvaluations},Normal:0,MaxIterationsReached:1,DivergingRoundingErrors:2,FindMinimum:function(t,e,i,s,r,o,n,a,h){var l,c,u=i+2,d=this.arr(e+1),p=this;return this.lastNumberOfEvaluations=0,h&&console.log("Experimental feature 'testForRoundingErrors' is activated."),d[0]=0,this.arraycopy(s,0,d,1,e),c=function(e,i,s,r){var o,n,a=p.arr(e);return p.lastNumberOfEvaluations=p.lastNumberOfEvaluations+1,p.arraycopy(s,1,a,0,e),o=p.arr(i),n=t(e,i,a,o),p.arraycopy(o,0,r,1,i),n},l=this.cobylb(c,e,i,u,d,r,o,n,a,h),this.arraycopy(d,1,s,0,e),l},cobylb:function(t,e,i,s,r,o,n,a,h,l){var c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N,j,D,k,R,L,B,I,Y=-1,V=0,X=0,U=e+1,F=i+1,z=o,J=0,G=!1,W=!1,H=0,K=0,$=0,q=this.arr(1+s),Z=this.arr2(1+e,1+U),Q=this.arr2(1+e,1+e),tt=this.arr2(1+s,1+U),et=this.arr2(1+e,1+F),it=this.arr(1+e),st=this.arr(1+e),rt=this.arr(1+e),ot=this.arr(1+e),nt=this.arr(1+e);for(a>=2&&console.log("The initial value of RHO is "+z+" and PARMU is set to zero."),A=0,_=1/z,u=1;u<=e;++u)Z[u][U]=r[u],Z[u][u]=z,Q[u][u]=_;m=U,b=!1;t:for(;;){if(A>=h&&A>0){Y=this.MaxIterationsReached;break t}for(++A,V=t(e,i,r,q),X=0,p=1;p<=i;++p)X=Math.max(X,-q[p]);if(A!==a-1&&3!==a||this.PrintIterationResult(A,V,X,r,e,a),q[F]=V,q[s]=X,y=!0,!b){for(y=!1,u=1;u<=s;++u)tt[u][m]=q[u];if(A<=U){if(m<=e)if(tt[F][U]<=V)r[m]=Z[m][U];else{for(Z[m][U]=r[m],p=1;p<=s;++p)tt[p][m]=tt[p][U],tt[p][U]=q[p];for(p=1;p<=m;++p){for(Z[m][p]=-z,_=0,u=p;u<=m;++u)_-=Q[u][p];Q[m][p]=_}}if(A<=e){r[m=A]+=z;continue t}}b=!0}e:for(;;){i:do{if(!y){for(v=tt[F][U]+J*tt[s][U],C=U,d=1;d<=e;++d)(_=tt[F][d]+J*tt[s][d])<v?(C=d,v=_):_===v&&0===J&&tt[s][d]<tt[s][C]&&(C=d);if(C<=e){for(u=1;u<=s;++u)_=tt[u][U],tt[u][U]=tt[u][C],tt[u][C]=_;for(u=1;u<=e;++u){for(_=Z[u][C],Z[u][C]=0,Z[u][U]+=_,g=0,p=1;p<=e;++p)Z[u][p]-=_,g-=Q[p][u];Q[C][u]=g}}if(P=0,l)for(u=1;u<=e;++u)for(d=1;d<=e;++d)_=this.DOT_PRODUCT_ROW_COL(Q,u,Z,d,1,e)-(u===d?1:0),P=Math.max(P,Math.abs(_));if(P>.1){Y=this.DivergingRoundingErrors;break t}for(p=1;p<=F;++p){for(q[p]=-tt[p][U],d=1;d<=e;++d)nt[d]=tt[p][d]+q[p];for(u=1;u<=e;++u)et[u][p]=(p===F?-1:1)*this.DOT_PRODUCT_ROW_COL(nt,-1,Q,u,1,e)}for(G=!0,H=.25*z,x=2.1*z,d=1;d<=e;++d){for(E=0,O=0,p=1;p<=e;++p)E+=Q[d][p]*Q[d][p],O+=Z[p][d]*Z[p][d];it[d]=1/Math.sqrt(E),st[d]=Math.sqrt(O),(it[d]<H||st[d]>x)&&(G=!1)}if(!b&&!G){for(m=0,_=x,d=1;d<=e;++d)st[d]>_&&(m=d,_=st[d]);if(0===m)for(d=1;d<=e;++d)it[d]<_&&(m=d,_=it[d]);for(_=.5*z*it[m],p=1;p<=e;++p)ot[p]=_*Q[m][p];for(M=0,w=0,c=0,p=1;p<=F;++p)c=this.DOT_PRODUCT_ROW_COL(ot,-1,et,p,1,e),p<F&&(_=tt[p][U],M=Math.max(M,-c-_),w=Math.max(w,c-_));for(S=J*(M-w)>2*c?-1:1,_=0,u=1;u<=e;++u)ot[u]=S*ot[u],Z[u][m]=ot[u],_+=Q[m][u]*ot[u];for(p=1;p<=e;++p)Q[m][p]/=_;for(d=1;d<=e;++d){if(d!==m)for(_=this.DOT_PRODUCT_ROW_COL(Q,d,ot,-1,1,e),p=1;p<=e;++p)Q[d][p]-=_*Q[m][p];r[d]=Z[d][U]+ot[d]}continue t}if(!(W=this.trstlp(e,i,et,q,z,ot))){for(_=0,p=1;p<=e;++p)_+=ot[p]*ot[p];if(_<.25*z*z){b=!0;break i}}for(c=0,T=0,q[F]=0,p=1;p<=F;++p)c=q[p]-this.DOT_PRODUCT_ROW_COL(ot,-1,et,p,1,e),p<F&&(T=Math.max(T,c));if(J<1.5*(N=(K=tt[s][U]-T)>0?c/K:0))for(J=2*N,a>=2&&console.log("Increase in PARMU to "+J),j=tt[F][U]+J*tt[s][U],d=1;d<=e;++d)if((_=tt[F][d]+J*tt[s][d])<j||_===j&&0===J&&tt[s][d]<tt[s][U])continue e;for($=J*K-c,p=1;p<=e;++p)r[p]=Z[p][U]+ot[p];b=!0;continue t}for(y=!1,D=tt[F][U]+J*tt[s][U]-(V+J*X),0===J&&V===tt[F][U]&&($=K,D=tt[s][U]-X),k=D<=0?1:0,m=0,d=1;d<=e;++d)(_=Math.abs(this.DOT_PRODUCT_ROW_COL(Q,d,ot,-1,1,e)))>k&&(m=d,k=_),rt[d]=_*it[d];for(R=1.1*z,f=0,d=1;d<=e;++d)if(rt[d]>=H||rt[d]>=it[d]){if(_=st[d],D>0){for(_=0,p=1;p<=e;++p)_+=Math.pow(ot[p]-Z[p][d],2);_=Math.sqrt(_)}_>R&&(f=d,R=_)}if(f>0&&(m=f),0!==m){for(_=0,u=1;u<=e;++u)Z[u][m]=ot[u],_+=Q[m][u]*ot[u];for(p=1;p<=e;++p)Q[m][p]/=_;for(d=1;d<=e;++d)if(d!==m)for(_=this.DOT_PRODUCT_ROW_COL(Q,d,ot,-1,1,e),p=1;p<=e;++p)Q[d][p]-=_*Q[m][p];for(p=1;p<=s;++p)tt[p][m]=q[p];if(D>0&&D>=.1*$)continue e}}while(0);if(G){if(z<=n){Y=this.Normal;break t}if(L=0,B=0,(z*=.5)<=1.5*n&&(z=n),J>0){for(I=0,p=1;p<=F;++p){for(B=L=tt[p][U],u=1;u<=e;++u)L=Math.min(L,tt[p][u]),B=Math.max(B,tt[p][u]);p<=i&&L<.5*B&&(_=Math.max(B,0)-L,I=I<=0?_:Math.min(I,_))}0===I?J=0:B-L<J*I&&(J=(B-L)/I)}a>=2&&console.log("Reduction in RHO to "+z+"  and PARMU = "+J),2===a&&this.PrintIterationResult(A,tt[F][U],tt[s][U],this.COL(Z,U),e,a)}else b=!1}}switch(Y){case this.Normal:if(a>=1&&console.log("%nNormal return from subroutine COBYLA%n"),W)return a>=1&&this.PrintIterationResult(A,V,X,r,e,a),Y;break;case this.MaxIterationsReached:a>=1&&console.log("%nReturn from subroutine COBYLA because the MAXFUN limit has been reached.%n");break;case this.DivergingRoundingErrors:a>=1&&console.log("%nReturn from subroutine COBYLA because rounding errors are becoming damaging.%n")}for(p=1;p<=e;++p)r[p]=Z[p][U];return V=tt[F][U],X=tt[s][U],a>=1&&this.PrintIterationResult(A,V,X,r,e,a),Y},trstlp:function(t,e,i,s,r,o){var n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N,j,D,k,R,L,B,I,Y=0,V=0,X=0,U=this.arr2(1+t,1+t),F=this.arr(2+e),z=this.arr(2+e),J=this.arr(1+t),G=this.arr(1+t),W=this.arr(2+e),H=this.arr(2+e),K=e,$=0;for(h=1;h<=t;++h)U[h][h]=1,o[h]=0;if(n=0,a=0,e>=1){for(l=1;l<=e;++l)s[l]>a&&(a=s[l],n=l);for(l=1;l<=e;++l)H[l]=l,z[l]=a-s[l]}c=!0;do{t:for(;;){(!c||c&&0===a)&&(n=K=e+1,H[K]=K,z[K]=0),c=!1,u=0,d=0,p=0,f=0;e:do{if(_=K===e?a:-this.DOT_PRODUCT_ROW_COL(o,-1,i,K,1,t),0===d||_<u?(u=_,V=$,d=3):$>V?(V=$,d=3):--d,0===d)break t;if(g=0,n<=$){if(n<$){A=H[n],m=z[n],l=n;do{for(v=H[y=l+1],C=this.DOT_PRODUCT(this.PART(this.COL(U,l),1,t),this.PART(this.COL(i,v),1,t)),Y=math.A.hypot(C,F[y]),P=F[y]/Y,x=C/Y,F[y]=P*F[l],F[l]=Y,h=1;h<=t;++h)Y=P*U[h][y]+x*U[h][l],U[h][y]=P*U[h][l]-x*U[h][y],U[h][l]=Y;H[l]=v,z[l]=z[y],l=y}while(l<$);H[l]=A,z[l]=m}if(--$,K>e)for(Y=1/F[$],l=1;l<=t;++l)J[l]=Y*U[l][$];else for(Y=this.DOT_PRODUCT_ROW_COL(J,-1,U,$+1,1,t),l=1;l<=t;++l)J[l]-=Y*U[l][$+1]}else{for(v=H[n],l=1;l<=t;++l)G[l]=i[l][v];for(E=0,l=t;l>$;){for(C=0,O=0,h=1;h<=t;++h)C+=Y=U[h][l]*G[h],O+=Math.abs(Y);if(M=O+.1*Math.abs(C),w=O+.2*Math.abs(C),(O>=M||M>=w)&&(C=0),0===E)E=C;else for(y=l+1,P=C/(Y=math.A.hypot(C,E)),x=E/Y,E=Y,h=1;h<=t;++h)Y=P*U[h][l]+x*U[h][y],U[h][y]=P*U[h][y]-x*U[h][l],U[h][l]=Y;--l}if(0===E){g=-1,l=$;do{for(S=0,T=0,h=1;h<=t;++h)S+=Y=U[h][l]*G[h],T+=Math.abs(Y);if(M=T+.1*Math.abs(S),w=T+.2*Math.abs(S),T<M&&M<w){if((Y=S/F[l])>0&&H[l]<=e&&(I=z[l]/Y,(g<0||I<g)&&(g=I)),l>=2)for(N=H[l],h=1;h<=t;++h)G[h]-=Y*i[h][N];W[l]=Y}else W[l]=0}while(--l>0);if(g<0)break t;for(l=1;l<=$;++l)z[l]=Math.max(0,z[l]-g*W[l]);if(n<$){A=H[n],m=z[n],l=n;do{for(N=H[y=l+1],C=this.DOT_PRODUCT(this.PART(this.COL(U,l),1,t),this.PART(this.COL(i,N),1,t)),Y=math.A.hypot(C,F[y]),P=F[y]/Y,x=C/Y,F[y]=P*F[l],F[l]=Y,h=1;h<=t;++h)Y=P*U[h][y]+x*U[h][l],U[h][y]=P*U[h][l]-x*U[h][y],U[h][l]=Y;H[l]=N,z[l]=z[y],l=y}while(l<$);H[l]=A,z[l]=m}if(0===(Y=this.DOT_PRODUCT(this.PART(this.COL(U,$),1,t),this.PART(this.COL(i,v),1,t))))break t;F[$]=Y,z[n]=0,z[$]=g}else F[++$]=E,z[n]=z[$],z[$]=0;if(H[n]=H[$],H[$]=v,K>e&&v!==K){for(l=$-1,C=this.DOT_PRODUCT(this.PART(this.COL(U,l),1,t),this.PART(this.COL(i,v),1,t)),Y=math.A.hypot(C,F[$]),P=F[$]/Y,x=C/Y,F[$]=P*F[l],F[l]=Y,h=1;h<=t;++h)Y=P*U[h][$]+x*U[h][l],U[h][$]=P*U[h][l]-x*U[h][$],U[h][l]=Y;H[$]=H[l],H[l]=v,Y=z[l],z[l]=z[$],z[$]=Y}if(K>e)for(Y=1/F[$],l=1;l<=t;++l)J[l]=Y*U[l][$];else for(v=H[$],Y=(this.DOT_PRODUCT_ROW_COL(J,-1,i,v,1,t)-1)/F[$],l=1;l<=t;++l)J[l]-=Y*U[l][$]}for(j=r*r,k=0,D=0,h=1;h<=t;++h)Math.abs(o[h])>=1e-6*r&&(j-=o[h]*o[h]),k+=o[h]*J[h],D+=J[h]*J[h];if(j<=0)break t;if(Y=Math.sqrt(D*j),Math.abs(k)>=1e-6*Y&&(Y=Math.sqrt(D*j+k*k)),p=f=j/(Y+k),K===e){if(w=p+.2*a,p>=(M=p+.1*a)||M>=w)break e;p=Math.min(p,a)}for(l=1;l<=t;++l)G[l]=o[l]+p*J[l];if(K===e)for(X=a,a=0,l=1;l<=$;++l)Y=s[v=H[l]]-this.DOT_PRODUCT_ROW_COL(G,-1,i,v,1,t),a=Math.max(a,Y);l=$;do{for(R=0,L=0,h=1;h<=t;++h)R+=Y=U[h][l]*G[h],L+=Math.abs(Y);if(M=L+.1*Math.abs(R),w=L+.2*Math.abs(R),(L>=M||M>=w)&&(R=0),W[l]=R/F[l],l>=2)for(v=H[l],h=1;h<=t;++h)G[h]-=W[l]*i[h][v]}while(l-- >=2);for(K>e&&(W[$]=Math.max(0,W[$])),l=1;l<=t;++l)G[l]=o[l]+p*J[l];if(K>$)for(l=$+1;l<=K;++l){for(b=a-s[v=H[l]],B=a+Math.abs(s[v]),h=1;h<=t;++h)b+=Y=i[h][v]*G[h],B+=Math.abs(Y);M=B+.1*Math.abs(b),w=B+.2*Math.abs(b),(B>=M||M>=w)&&(b=0),W[l]=b}for(g=1,n=0,l=1;l<=K;++l)W[l]<0&&(Y=z[l]/(z[l]-W[l]))<g&&(g=Y,n=l);for(Y=1-g,l=1;l<=t;++l)o[l]=Y*o[l]+g*G[l];for(l=1;l<=K;++l)z[l]=Math.max(0,Y*z[l]+g*W[l]);K===e&&(a=X+g*(a-X))}while(n>0);if(p===f)return!0}}while(K===e);return!1},PrintIterationResult:function(t,e,i,s,r,o){o>1&&console.log("NFVALS = "+t+"  F = "+e+"  MAXCV = "+i),o>1&&console.log("X = "+this.PART(s,1,r))},ROW:function(t,e){return t[e].slice()},COL:function(t,e){var i,s=t.length,r=[];for(i=0;i<s;++i)r[i]=t[i][e];return r},PART:function(t,e,i){return t.slice(e,i+1)},FORMAT:function(t){return t.join(",")},DOT_PRODUCT:function(t,e){var i,s=0,r=t.length;for(i=0;i<r;++i)s+=t[i]*e[i];return s},DOT_PRODUCT_ROW_COL:function(t,e,i,s,r,o){var n,a=0;if(-1===e)for(n=r;n<=o;++n)a+=t[n]*i[n][s];else if(-1===s)for(n=r;n<=o;++n)a+=t[e][n]*i[n];else for(n=r;n<=o;++n)a+=t[e][n]*i[n][s];return a}};var nlp=jxg.A.Math.Nlp,base_coords=__webpack_require__(904),statistics=__webpack_require__(588);math.A.Plot={checkReal:function(t){var e,i,s=!1,r=t.length;for(e=0;e<r;e++)if(i=t[e].usrCoords,!isNaN(i[1])&&!isNaN(i[2])&&Math.abs(i[0])>math.A.eps){s=!0;break}return s},updateParametricCurveNaive:function(t,e,i,s){var r,o,n=!1,a=(i-e)/s;for(r=0;r<s;r++)o=e+r*a,t.points[r].setCoordinates(constants.A.COORDS_BY_USER,[t.X(o,n),t.Y(o,n)],!1),t.points[r]._t=o,n=!0;return t},isSegmentOutside:function(t,e,i,s,r){return e<0&&s<0||e>r.canvasHeight&&s>r.canvasHeight||t<0&&i<0||t>r.canvasWidth&&i>r.canvasWidth},isDistOK:function(t,e,i,s){return Math.abs(t)<i&&Math.abs(e)<s&&!isNaN(t+e)},isSegmentDefined:function(t,e,i,s){return!(isNaN(t+e)&&isNaN(i+s))},updateParametricCurveOld:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f=!1,_=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),g=[],A=[],m=[],b=[],y=!1,v=0,C=function(t,e,i){var s,r=i[1]-t[1],o=i[2]-t[2],n=e[0]-t[1],a=e[1]-t[2],h=n*n+a*a;return h>=math.A.eps&&(s=(r*n+o*a)/h)>0&&(s<=1?(r-=s*n,o-=s*a):(r-=n,o-=a)),math.A.hypot(r,o)};for(jxg.A.deprecated("Curve.updateParametricCurveOld()"),t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(u=15,d=10,p=10):(u=21,d=.7,p=.7),b[0]=i-e,s=1;s<u;s++)b[s]=.5*b[s-1];s=1,g[0]=1,A[0]=0,r=e,_.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,f),t.Y(r,f)],!1),f=!0,a=_.scrCoords[1],h=_.scrCoords[2],r=i,_.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,f),t.Y(r,f)],!1),o=_.scrCoords[1],n=_.scrCoords[2],m[0]=[o,n],l=1,c=0,t.points=[],t.points[v++]=new base_coords.A(constants.A.COORDS_BY_SCREEN,[a,h],t.board,!1);do{for(y=this.isDistOK(o-a,n-h,d,p)||this.isSegmentOutside(a,h,o,n,t.board);c<u&&(!y||c<6)&&(c<=7||this.isSegmentDefined(a,h,o,n));)g[l]=s,A[l]=c,m[l]=[o,n],l+=1,r=e+(s=2*s-1)*b[++c],_.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,f),t.Y(r,f)],!1,!0),o=_.scrCoords[1],n=_.scrCoords[2],y=this.isDistOK(o-a,n-h,d,p)||this.isSegmentOutside(a,h,o,n,t.board);v>1&&C(t.points[v-2].scrCoords,[o,n],t.points[v-1].scrCoords)<.015&&(v-=1),t.points[v]=new base_coords.A(constants.A.COORDS_BY_SCREEN,[o,n],t.board,!1),t.points[v]._t=r,v+=1,a=o,h=n,o=m[l-=1][0],n=m[l][1],c=A[l]+1,s=2*g[l]}while(l>0&&v<5e5);return t.numberPoints=t.points.length,t},_insertPoint_v2:function(t,e,i){var s=!isNaN(this._lastCrds[1]+this._lastCrds[2]),r=!isNaN(e.scrCoords[1]+e.scrCoords[2]),o=t.board.canvasWidth,n=t.board.canvasHeight,a=500;(!(r=r&&e.scrCoords[1]>-500&&e.scrCoords[2]>-500&&e.scrCoords[1]<o+a&&e.scrCoords[2]<n+a)&&s||r&&(!s||Math.abs(e.scrCoords[1]-this._lastCrds[1])>.7||Math.abs(e.scrCoords[2]-this._lastCrds[2])>.7))&&(e._t=i,t.points.push(e),this._lastCrds=e.copy("scrCoords"))},neighborhood_isNaN_v2:function(t,e){var i,s,r=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);return i=e+math.A.eps,r.setCoordinates(constants.A.COORDS_BY_USER,[t.X(i,!0),t.Y(i,!0)],!1),s=r.usrCoords,!!(isNaN(s[1]+s[2])||(i=e-math.A.eps,r.setCoordinates(constants.A.COORDS_BY_USER,[t.X(i,!0),t.Y(i,!0)],!1),s=r.usrCoords,isNaN(s[1]+s[2])))},_borderCase:function(t,e,i,s,r,o,n,a){var h,l,c,u,d,p,f=null,_=!1;if(a<=1){if(l=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),isNaN(e[1]+e[2])&&!isNaN(s[1]+s[2])&&!this.neighborhood_isNaN_v2(t,r))return!1;if(isNaN(i[1]+i[2])&&!isNaN(s[1]+s[2])&&!this.neighborhood_isNaN_v2(t,o))return!1;if(isNaN(s[1]+s[2])&&(!isNaN(e[1]+e[2])||!isNaN(i[1]+i[2]))&&!this.neighborhood_isNaN_v2(t,n))return!1;u=0;do{if(isNaN(e[1]+e[2])&&!isNaN(s[1]+s[2]))d=r,p=n;else if(isNaN(i[1]+i[2])&&!isNaN(s[1]+s[2]))d=o,p=n;else if(isNaN(s[1]+s[2])&&!isNaN(i[1]+i[2]))d=n,p=o;else{if(!isNaN(s[1]+s[2])||isNaN(e[1]+e[2]))return!1;d=n,p=r}h=.5*(d+p),l.setCoordinates(constants.A.COORDS_BY_USER,[t.X(h,!0),t.Y(h,!0)],!1),c=l.usrCoords,(_=isNaN(c[1]+c[2]))?d=h:p=h,++u}while(_&&u<30);if(u<30&&(f=c.slice(),s=c.slice(),p=h),null!==f)return this._insertPoint_v2(t,new base_coords.A(constants.A.COORDS_BY_USER,f,t.board,!1)),!0}return!1},_plotRecursive_v2:function(t,e,i,s,r,o,n){var a,h,l,c,u,d=0,p=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);if(!(t.numberPoints>65536))return o<this.nanLevel&&this._isUndefined(t,e,i,s,r)||o<this.nanLevel&&this._isOutside(e,i,s,r,t.board)?this:(a=.5*(i+r),p.setCoordinates(constants.A.COORDS_BY_USER,[t.X(a,!0),t.Y(a,!0)],!1),h=p.scrCoords,this._borderCase(t,e,s,h,i,r,a,o)||(l=this._triangleDists(e,s,h),c=o<this.smoothLevel&&l[3]<n,u=o<=this.jumpLevel&&(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))||o<this.jumpLevel&&(l[2]>.99*l[0]||l[1]>.99*l[0]||l[0]===1/0||l[1]===1/0||l[2]===1/0),o<this.smoothLevel+2&&l[0]<.5*(l[1]+l[2])&&(d=0,c=!1),--o,u?this._insertPoint_v2(t,new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],t.board,!1),a):o<=d||c?this._insertPoint_v2(t,p,a):(this._plotRecursive_v2(t,e,i,h,a,o,n),isNaN(p.scrCoords[1]+p.scrCoords[2])||this._insertPoint_v2(t,p,a),this._plotRecursive_v2(t,h,a,s,r,o,n))),this)},updateParametricCurve_v2:function(t,e,i){var s,r,o,n,a,h,l,c,u,d=!1,p=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),f=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);return t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(a=t.evalVisProp("recursiondepthlow")||13,h=2,this.smoothLevel=a-6,this.jumpLevel=3):(a=t.evalVisProp("recursiondepthhigh")||17,h=2,this.smoothLevel=a-9,this.jumpLevel=2),this.nanLevel=a-4,t.points=[],"x"===this.xterm?(l=.3*((c=t.board.getBoundingBox())[2]-c[0]),s=Math.max(e,c[0]-l),r=Math.min(i,c[2]+l)):(s=e,r=i),p.setCoordinates(constants.A.COORDS_BY_USER,[t.X(s,d),t.Y(s,d)],!1),d=!0,f.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,d),t.Y(r,d)],!1),u=this._findStartPoint(t,p.scrCoords,s,f.scrCoords,r),p.setCoordinates(constants.A.COORDS_BY_SCREEN,u[0],!1),s=u[1],u=this._findStartPoint(t,f.scrCoords,r,p.scrCoords,s),f.setCoordinates(constants.A.COORDS_BY_SCREEN,u[0],!1),r=u[1],this._visibleArea=[s,r],o=p.copy("scrCoords"),n=f.copy("scrCoords"),p._t=s,t.points.push(p),this._lastCrds=p.copy("scrCoords"),this._plotRecursive_v2(t,o,s,n,r,a,h),f._t=r,t.points.push(f),t.numberPoints=t.points.length,t},_insertLimesPoint:function(t,e,i,s,r){var o,n,a;Math.abs(this._lastUsrCrds[1])===1/0&&Math.abs(r.left_x)===1/0||Math.abs(this._lastUsrCrds[2])===1/0&&Math.abs(r.left_y)===1/0||((o=new base_coords.A(constants.A.COORDS_BY_USER,[r.left_x,r.left_y],t.board))._t=i,t.points.push(o),isNaN(r.left_x)||isNaN(r.left_y)||isNaN(r.right_x)||isNaN(r.right_y)||!(Math.abs(r.left_x-r.right_x)>math.A.eps||Math.abs(r.left_y-r.right_y)>math.A.eps)||((n=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(n)),(a=new base_coords.A(constants.A.COORDS_BY_USER,[r.right_x,r.right_y],t.board))._t=i,t.points.push(a),this._lastScrCrds=a.copy("scrCoords"),this._lastUsrCrds=a.copy("usrCoords"))},_insertPoint:function(t,e,i,s,r){var o,n=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),a=!isNaN(e[1]+e[2]),h=t.board.canvasWidth,l=t.board.canvasHeight,c=500;utils_type.A.exists(r)?this._insertLimesPoint(t,e,i,s,r):(a=a&&e[1]>-500&&e[2]>-500&&e[1]<h+c&&e[2]<l+c,(n||a)&&(a&&n&&Math.abs(e[1]-this._lastScrCrds[1])<.8&&Math.abs(e[2]-this._lastScrCrds[2])<.8||Math.abs(e[1])===1/0&&Math.abs(this._lastUsrCrds[1])===1/0||Math.abs(e[2])===1/0&&Math.abs(this._lastUsrCrds[2])===1/0||((o=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(o),this._lastScrCrds=o.copy("scrCoords"),this._lastUsrCrds=o.copy("usrCoords"))))},_triangleDists:function(t,e,i){var s;return s=[t[0]*e[0],.5*(t[1]+e[1]),.5*(t[2]+e[2])],[geometry.A.distance(t,e,3),geometry.A.distance(t,i,3),geometry.A.distance(i,e,3),geometry.A.distance(i,s,3)]},_isUndefined:function(t,e,i,s,r){var o,n,a;if(!isNaN(e[1]+e[2])||!isNaN(s[1]+s[2]))return!1;for(a=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),n=0;n<20;++n)if(o=i+Math.random()*(r-i),a.setCoordinates(constants.A.COORDS_BY_USER,[t.X(o,!0),t.Y(o,!0)],!1),!isNaN(a.scrCoords[0]+a.scrCoords[1]+a.scrCoords[2]))return!1;return!0},_isOutside:function(t,e,i,s,r){var o=500,n=r.canvasWidth,a=r.canvasHeight;return!!(t[1]<-500&&i[1]<-500||t[2]<-500&&i[2]<-500||t[1]>n+o&&i[1]>n+o||t[2]>a+o&&i[2]>a+o)},_isOutsidePoint:function(t,e){var i=500,s=e.canvasWidth,r=e.canvasHeight;return!!(t[1]<-500||t[2]<-500||t[1]>s+i||t[2]>r+i)},_findStartPoint:function(t,e,i,s,r){return[e,i]},_getBorderPos:function(t,e,i,s,r,o,n){var a,h,l,c,u,d;if(h=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),c=0,isNaN(i[1]+i[2])&&!isNaN(r[1]+r[2]))d=e,u=s;else if(isNaN(n[1]+n[2])&&!isNaN(r[1]+r[2]))d=o,u=s;else if(isNaN(r[1]+r[2])&&!isNaN(n[1]+n[2]))d=s,u=o;else{if(!isNaN(r[1]+r[2])||isNaN(i[1]+i[2]))return!1;d=s,u=e}do{a=.5*(u+d),h.setCoordinates(constants.A.COORDS_BY_USER,[t.X(a,!0),t.Y(a,!0)],!1),l=h.usrCoords,isNaN(l[1]+l[2])?d=a:u=a,++c}while(c<30&&Math.abs(u-d)>math.A.eps);return a},_getCuspPos:function(t,e,i){var s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(i,!0),t.Y(i,!0)];return numerics.A.fminbr(function(e){var i=[t.X(e,!0),t.Y(e,!0)];return-(math.A.hypot(s[0]-i[0],s[1]-i[1])+math.A.hypot(r[0]-i[0],r[1]-i[1]))},[e,i],t)},_getJumpPos:function(t,e,i){return numerics.A.fminbr(function(e){var i=math.A.eps*math.A.eps,s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(e+i,!0),t.Y(e+i,!0)];return-Math.abs((r[1]-s[1])/(r[0]-s[0]))},[e,i],t)},_getLimits:function(t,e){var i,s,r,o,n,a=2/(t.maxX()-t.minX());return s=(i=extrapolate.limit(e,-a,t.X))[0],"infinite"===i[1]&&(s=Math.sign(s)*(1/0)),o=(i=extrapolate.limit(e,-a,t.Y))[0],"infinite"===i[1]&&(o=Math.sign(o)*(1/0)),r=(i=extrapolate.limit(e,a,t.X))[0],"infinite"===i[1]&&(r=Math.sign(r)*(1/0)),n=(i=extrapolate.limit(e,a,t.Y))[0],"infinite"===i[1]&&(n=Math.sign(n)*(1/0)),{left_x:s,left_y:o,right_x:r,right_y:n,t:e}},_getLimes:function(t,e,i,s,r,o,n,a,h){var l;return"border"===a?l=this._getBorderPos(t,e,i,s,r,o,n):"cusp"===a?l=this._getCuspPos(t,e,o):"jump"===a&&(l=this._getJumpPos(t,e,o)),this._getLimits(t,l)},_plotNonRecursive:function(t,e,i,s,r,o){var n,a,h,l,c,u,d,p,f,_,g,A=null,m=!1,b="",y=[],v=0;for(p=t.board.origin.scrCoords,y[v++]=[e,i,s,r,o,1/0];v>0;){if(e=(g=y[--v])[0],i=g[1],s=g[2],r=g[3],f=g[4],_=g[5],m=!1,b="",A=null,t.points.length>65536)return;if(f<this.nanLevel){if(this._isUndefined(t,e,i,s,r))continue;if(this._isOutside(e,i,s,r,t.board))continue}n=.5*(i+r),u=t.X(n,!0),d=t.Y(n,!0),a=[1,p[1]+u*t.board.unitX,p[2]-d*t.board.unitY],h=this._triangleDists(e,s,a),l=isNaN(e[1]+e[2]),c=isNaN(s[1]+s[2]),l&&!c||!l&&c?b="border":h[0]>.66*_||h[0]<this.cusp_threshold*(h[1]+h[2])||h[1]>5*h[2]||h[2]>5*h[1]?b="cusp":(h[2]>this.jump_threshold*h[0]||h[1]>this.jump_threshold*h[0]||h[0]===1/0||h[1]===1/0||h[2]===1/0)&&(b="jump"),m=""===b&&f<this.smoothLevel&&h[3]<this.smooth_threshold,f<this.testLevel&&!m&&(""===b?m=!0:A=this._getLimes(t,i,e,n,a,r,s,b,f)),null!==A?(a=[1,NaN,NaN],this._insertPoint(t,a,n,f,A)):f<=0||m?this._insertPoint(t,a,n,f,null):(y[v++]=[a,n,s,r,f-1,h[0]],y[v++]=[e,i,a,n,f-1,h[0]])}return this},updateParametricCurve_v3:function(t,e,i){var s,r,o,n,a,h,l,c,u=!1,d=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),p=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);return a=t.board.updateQuality===t.board.BOARD_QUALITY_LOW?t.evalVisProp("recursiondepthlow")||14:t.evalVisProp("recursiondepthhigh")||17,this.smoothLevel=7,this.nanLevel=a-4,this.testLevel=4,this.cusp_threshold=.5,this.jump_threshold=.99,this.smooth_threshold=2,t.points=[],"x"===t.xterm?(h=.3*((l=t.board.getBoundingBox())[2]-l[0]),s=Math.max(e,l[0]-h),r=Math.min(i,l[2]+h)):(s=e,r=i),d.setCoordinates(constants.A.COORDS_BY_USER,[t.X(s,u),t.Y(s,u)],!1),u=!0,p.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,u),t.Y(r,u)],!1),c=this._findStartPoint(t,d.scrCoords,s,p.scrCoords,r),d.setCoordinates(constants.A.COORDS_BY_SCREEN,c[0],!1),s=c[1],c=this._findStartPoint(t,p.scrCoords,r,d.scrCoords,s),p.setCoordinates(constants.A.COORDS_BY_SCREEN,c[0],!1),r=c[1],this._visibleArea=[s,r],o=d.copy("scrCoords"),n=p.copy("scrCoords"),d._t=s,t.points.push(d),this._lastScrCrds=d.copy("scrCoords"),this._lastUsrCrds=d.copy("usrCoords"),this._plotNonRecursive(t,o,s,n,r,a),p._t=r,t.points.push(p),t.numberPoints=t.points.length,t},_criticalInterval:function(t,e,i){var s,r,o,n,a,h,l,c=!1,u=-1/0,d=!1,p=!1,f=0,_=[],g=[],A=[];for(l=statistics.A.abs(t),(n=statistics.A.median(l))<1e-7?(n=1e-7,d=!0):n*=this.criticalThreshold,s=0;s<e;s++)l[s]>n?(A.push({i:s,v:t[s],group:f}),u=s,c||(c=!0)):c&&s>u+4&&(A.length>0&&_.push(A.slice(0)),A=[],c=!1,f++);for(c&&A.length>1&&_.push(A.slice(0)),d&&0===_.length&&(p=!0),r=0;r<_.length;r++)if(g[r]="point",!((o=_[r].length)<64)){for(h=0,a=Math.sign(_[r][0].v),s=1;s<o;s++)Math.sign(_[r][s].v)!==a&&(h++,a=Math.sign(_[r][s].v));6*h>o&&(g[r]="interval")}return{smooth:p,groups:_,types:g}},Component:function(){this.left_isNaN=!1,this.right_isNaN=!1,this.left_t=null,this.right_t=null,this.t_values=[],this.x_values=[],this.y_values=[],this.len=0},findComponents:function(t,e,i,s){var r,o,n,a,h,l,c=[],u=0,d=0,p=0,f=!1,_=!1;for(n=(i-e)/s,c[u]=new this.Component,l=c[u],r=0,o=e;r<=s;r++,o+=n)a=t.X(o,_),h=t.Y(o,_),isNaN(a)||isNaN(h)?++p>1&&f&&(l.right_isNaN=!0,l.right_t=o-n,l.len=d,f=!1,c[++u]=new this.Component,l=c[u],p=0):(f||(f=!0,d=0,p>0&&(l.left_t=o-n,l.left_isNaN=!0)),p=0,l.t_values[d]=o,l.x_values[d]=a,l.y_values[d]=h,d++),0===r&&(_=!0);return f?l.len=d:c.pop(),c},getPointType:function(t,e,i,s,r,o,n){var a=r[0],h=o[0],l=s.length,c={idx:e,t:i,x:a[e],y:h[e],type:"other"};return e<5?(c.type="borderleft",c.idx=0,c.t=s[0],c.x=a[0],c.y=h[0],c):e>n-6?(c.type="borderright",c.idx=l-1,c.t=s[l-1],c.x=a[l-1],c.y=h[l-1],c):c},newtonApprox:function(t,e,i,s,r){var o,n=0;for(o=s;o>0;o--)n=(n+r[o][t])*(e-(o-1)*i)/o;return n+r[0][t]},thiele:function(t,e,i,s,r){var o,n=0;for(o=r;o>1;o--)n=(t-i[s+o])/(e[o][s+1]-e[o-2][s+1]+n);return e[0][s+1]+(t-i[s+1])/(e[1][s+1]+n)},differenceMethodExperiments:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p=t.t_values,f=t.x_values,_=t.y_values,g=[],A=[],m=[],b=[],y=[],v=[],C=[],P=[],x=0,E=[];for(n=p[1]-p[0],y.push([]),v.push([]),C.push([]),P.push([]),r=_.length,i=0;i<r;i++)y[0][i]=f[i],v[0][i]=_[i],C[0][i]=f[i],P[0][i]=_[i];for(y.push([]),v.push([]),C.push([]),P.push([]),a=n,r=_.length-1,i=0;i<r;i++)g[i]=f[i+1]-f[i],A[i]=_[i+1]-_[i],m[i]=g[i],b[i]=A[i],y[1][i]=g[i],v[1][i]=A[i],C[1][i]=a/g[i],P[1][i]=a/A[i];for(r--,o=Math.min(8,_.length-1),s=1;s<o;s++){for(y.push([]),v.push([]),C.push([]),P.push([]),a*=n,i=0;i<r;i++)g[i]=g[i+1]-g[i],A[i]=A[i+1]-A[i],y[s+1][i]=g[i],v[s+1][i]=A[i],C[s+1][i]=a/(C[s][i+1]-C[s][i])+C[s-1][i+1],P[s+1][i]=a/(P[s][i+1]-P[s][i])+P[s-1][i+1];if(!1===(d=this._criticalPoints(A,r,s))){console.log("Polynomial of degree",s),d=[];break}if(d.length>0&&++x>1&&s%2==0)break;r--}for(i=0;i<d.length;i++){for(l=-1/0,c=0;c<d[i].length;c++)(u=Math.abs(d[i][c].v))>l&&(l=u,h=c);h=Math.floor(d[i][h].i+s/2),E.push(this.getPointType(e,h,p,f,_,m,b,r+1))}return[E,y,v,C,P]},getCenterOfCriticalInterval:function(t,e,i){var s,r,o,n,a,h=0,l=0,c=i[1]-i[0],u=[];for(s=-1/0,u=[],r=0;r<t.length;r++)(n=Math.abs(t[r].v))>s?(u=[r],s=n,o=r):s===n&&u.push(r);if(u.length>0&&(a=u.reduce(function(t,e){return t+e},0)/u.length,o=Math.floor(a),a+=t[0].i),s<1/0){for(r=0;r<t.length;r++)h+=Math.abs(t[r].v)*t[r].i,l+=Math.abs(t[r].v);a=h/l}return a+=e/2,[t[o].i+e/2,a,i[Math.floor(a)]+c*(a-Math.floor(a))]},differenceMethod:function(t,e){var i,s,r,o,n,a,h,l,c,u,d=t.t_values,p=t.x_values,f=t.y_values,_=[],g=[],A=0,m=-1,b=-1,y=[],v=[];for(r=f.length,_.push(new Float64Array(p)),g.push(new Float64Array(f)),r--,o=Math.min(12,r),s=0;s<o&&(_.push(new Float64Array(r)),g.push(new Float64Array(r)),_[s+1]=_[s].map(function(t,e,i){return i[e+1]-t}),g[s+1]=g[s].map(function(t,e,i){return i[e+1]-t}),!0===(l=this._criticalInterval(g[s+1],r,s)).smooth&&(b=s,y=[]),h=this._criticalInterval(_[s+1],r,s),-1===m&&!0===h.smooth&&(m=s),!(b>=0));s++){if(l.groups.length>0&&++A>2&&(s+1)%2==0){y=l.groups,u=l.types;break}r--}for(i=0;i<y.length;i++)"interval"!==u[i]&&(a=this.getCenterOfCriticalInterval(y[i],s+1,d),l[0],n=Math.floor(a[1]),c=a[2],v.push(this.getPointType(e,n,c,d,_,g,r+1)));return[v,_,g,m,b]},_insertPoint_v4:function(t,e,i,s){var r,o,n,a=null;t.points.length>0&&(a=t.points[t.points.length-1].scrCoords),r=new base_coords.A(constants.A.COORDS_BY_USER,e,t.board),null!==a&&(o=r.scrCoords[1]-a[1])*o+(n=r.scrCoords[2]-a[2])*n<.8*.8||(r._t=i,t.points.push(r))},getInterval:function(t,e,i){var s,r;return ia.A.disable(),s=ia.A.Interval(e,i),t.board.mathLib=ia.A,t.board.mathLibJXG=ia.A,r=t.Y(s,!0),t.board.mathLib=Math,t.board.mathLibJXG=jxg.A.Math,r},sign:function(t){return t<0?-1:t>0?1:0},handleBorder:function(t,e,i,s,r){var o,n,a,h,l,c,u,d,p,f,_,g,A=i.idx;if(g=e.t_values[1]-e.t_values[0],"borderleft"===i.type?a=(n=o=e.left_isNaN?e.left_t:i.t-g)+g:"borderright"===i.type?n=(a=o=e.right_isNaN?e.right_t:i.t+g)-g:console.log("No bordercase!!!"),0!==(f=this.findComponents(t,n,a,32)).length){for("borderleft"===i.type&&(n=f[0].left_t,a=f[0].t_values[0],g=f[0].t_values[1]-f[0].t_values[0],o=n=null===n?a-g:n,h=this.getInterval(t,n,a),utils_type.A.isObject(h)&&(u=h.lo,d=h.hi,l=t.X(o,!0),c=r[1][A]<0?d:u,this._insertPoint_v4(t,[1,l,c],o))),_=f[0].t_values.length,p=0;p<_;p++)o=f[0].t_values[p],l=f[0].x_values[p],c=f[0].y_values[p],this._insertPoint_v4(t,[1,l,c],o);"borderright"===i.type&&(n=f[0].t_values[_-1],a=f[0].right_t,g=f[0].t_values[1]-f[0].t_values[0],o=a=null===a?n+g:a,h=this.getInterval(t,n,a),utils_type.A.isObject(h)&&(u=h.lo,d=h.hi,l=t.X(o,!0),c=r[1][A]>0?d:u,this._insertPoint_v4(t,[1,l,c],o)))}},_seconditeration_v4:function(t,e,i,s,r){var o,n,a,h,l,c,u,d,p,f,_,g,A;for(n=e.t_values[i.idx-2],a=e.t_values[i.idx+2],l=this.findComponents(t,n,a,64),u=0;u<l.length;u++){for(c=l[u],d=(h=this.differenceMethod(c,t))[0],f=h[1],_=h[2],g=0,p=0;p<=d.length;p++){for(A=p===d.length?c.len:d[p].idx,o=g;o<A;o++)isNaN(c.x_values[o])||isNaN(c.y_values[o])||this._insertPoint_v4(t,[1,c.x_values[o],c.y_values[o]],c.t_values[o]);p<d.length&&(this.handleSingularity(t,c,d[p],f,_),g=d[p].idx+1)}A=c.len,u<l.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],c.right_t)}return this},_recurse_v4:function(t,e,i,s,r,o,n,a){var h,l,c=.5*(e+i),u=t.X(c,!0),d=t.Y(c,!0);0!==a?(h=(u-s)*t.board.unitX,l=(d-r)*t.board.unitY,math.A.hypot(h,l)>2?this._recurse_v4(t,e,c,s,r,u,d,a-1):this._insertPoint_v4(t,[1,u,d],c),h=(u-o)*t.board.unitX,l=(d-n)*t.board.unitY,math.A.hypot(h,l)>2?this._recurse_v4(t,c,i,u,d,o,n,a-1):this._insertPoint_v4(t,[1,u,d],c)):this._insertPoint_v4(t,[1,NaN,NaN],c)},handleSingularity:function(t,e,i,s,r){var o,n,a,h,l,c,u,d,p,f,_,g=i.idx,A=100;o=i.t,console.log("HandleSingularity at t =",o),n=e.t_values[g-5],a=e.t_values[g+5],h=this.getInterval(t,n,a),utils_type.A.isObject(h)?(d=h.lo,p=h.hi):r[0][g-1]<r[0][g+1]?(d=r[0][g-1],p=r[0][g+1]):(d=r[0][g+1],p=r[0][g-1]),u=t.X(o,!0),f=(r[0][g-3]-r[0][g-5])/(e.t_values[g-3]-e.t_values[g-5]),_=(r[0][g+3]-r[0][g+5])/(e.t_values[g+3]-e.t_values[g+5]),console.log(":::",f,_),f<-100?(this._insertPoint_v4(t,[1,u,d],o,!0),_<=A&&this._insertPoint_v4(t,[1,NaN,NaN],o)):f>A?(this._insertPoint_v4(t,[1,u,p],o),_>=-100&&this._insertPoint_v4(t,[1,NaN,NaN],o)):(d===-1/0&&(this._insertPoint_v4(t,[1,u,d],o,!0),this._insertPoint_v4(t,[1,NaN,NaN],o)),p===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],o),this._insertPoint_v4(t,[1,u,p],o,!0)),i.t<e.t_values[g]?(l=g-1,c=g):(l=g,c=g+1),n=e.t_values[l],a=e.t_values[c],this._recurse_v4(t,n,a,s[0][l],r[0][l],s[0][c],r[0][c],10)),_<-100?this._insertPoint_v4(t,[1,u,p],o):_>A&&this._insertPoint_v4(t,[1,u,d],o)},steps:1021,criticalThreshold:1e3,plot_v4:function(t,e,i,s){var r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b=(i-e)/s,y=function(e){return t.Y(e,!0)},v=function(e){return-t.Y(e,!0)},C=.5*b;for(n=this.findComponents(t,e,i,s),a=0;a<n.length;a++){for(h=n[a],l=(d=this.differenceMethod(h,t))[0],p=d[1],f=d[2],0!==l.length&&"borderleft"===l[0].type||l.unshift({idx:0,t:h.t_values[0],x:h.x_values[0],y:h.y_values[0],type:"borderleft"}),"borderright"!==l[l.length-1].type&&(o=h.t_values.length,l.push({idx:o-1,t:h.t_values[o-1],x:h.x_values[o-1],y:h.y_values[o-1],type:"borderright"})),u=0,c=0;c<=l.length;c++){for(o=c===l.length?h.len:l[c].idx-1,r=u;r<o-2;r++)this._insertPoint_v4(t,[1,h.x_values[r],h.y_values[r]],h.t_values[r]),r>=u+3&&r<o-3&&f.length>3&&Math.abs(f[2][r])>.2*Math.abs(f[0][r])&&(_=h.t_values[r],C=.25*b,m=this.getInterval(t,_,_+b),utils_type.A.isObject(m)?f[2][r]>0?this._insertPoint_v4(t,[1,_+C,m.lo],_+C):this._insertPoint_v4(t,[1,_+b-C,m.hi],_+b-C):(g=numerics.A.fminbr(y,[_,_+b]))<(A=numerics.A.fminbr(v,[_,_+b]))?(this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g),this._insertPoint_v4(t,[1,t.X(A,!0),t.Y(A,!0)],A)):(this._insertPoint_v4(t,[1,t.X(A,!0),t.Y(A,!0)],A),this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g)));c<l.length&&(r=l[c].idx,"borderleft"===l[c].type||"borderright"===l[c].type?this.handleBorder(t,h,l[c],p,f):this._seconditeration_v4(t,h,l[c],p,f),u=l[c].idx+1+1)}o=h.len,a<n.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],h.right_t)}},updateParametricCurve_v4:function(t,e,i){var s,r,o,n;"x"===t.xterm?(o=.3*((n=t.board.getBoundingBox())[2]-n[0]),s=Math.max(e,n[0]-o),r=Math.min(i,n[2]+o)):(s=e,r=i),t.points=[],this.plot_v4(t,s,r,this.steps),t.numberPoints=t.points.length},updateParametricCurve:function(t,e,i){return this.updateParametricCurve_v2(t,e,i)}};var plot=math.A.Plot;math.A.ImplicitPlot=function(t,e,i,s,r){var o={resolution_out:5,resolution_in:5,max_steps:1024,alpha_0:.05,tol_u0:math.A.eps,tol_newton:1e-7,tol_cusp:.05,tol_progress:1e-4,qdt_box:.2,kappa_0:.2,delta_0:.05,h_initial:.1,h_critical:.001,h_max:1,loop_dist:.09,loop_dir:.99,loop_detection:!0,unitX:10,unitY:10};this.config=utils_type.A.merge(o,e),this.f=i,this.dfx=null,this.dfy=null,utils_type.A.isFunction(s)?this.dfx=s:this.dfx=function(t,e){var i=math.A.eps*math.A.eps;return.5*(this.f(t+i,e)-this.f(t-i,e))/i},utils_type.A.isFunction(r)?this.dfy=r:this.dfy=function(t,e){var i=math.A.eps*math.A.eps;return.5*(this.f(t,e+i)-this.f(t,e-i))/i},this.bbox=t,this.qdt=new bqdt(20,5,t),this.components=[]},utils_type.A.extend(math.A.ImplicitPlot.prototype,{plot:function(){var t,e,i,s,r,o,n,a=[],h=[],l=[],c=0,u=this,d=function(e){return u.f(t,e)},p=function(e){return-u.f(t,e)},f=function(t){return u.f(t,e)},_=function(t){return-u.f(t,e)};for(i=Math.min(this.bbox[0],this.bbox[2])-math.A.eps,s=Math.max(this.bbox[0],this.bbox[2]),r=Math.min(this.bbox[1],this.bbox[3])+math.A.eps,o=Math.max(this.bbox[1],this.bbox[3]),n=this.config.resolution_out/this.config.unitX,n*=1+math.A.eps,t=i;t<s;t+=n)!1!==(l=this.searchLine(d,p,t,[r,o],"vertical",c,a,h,20))&&(a=l[0],h=l[1],c=l[2]);for(n=this.config.resolution_out/this.config.unitY,n*=1+math.A.eps,e=r;e<o;e+=n)!1!==(l=this.searchLine(f,_,e,[i,s],"horizontal",c,a,h,20))&&(a=l[0],h=l[1],c=l[2]);return[a,h,c]},searchLine:function(t,e,i,s,r,o,n,a,h){var l,c,u,d,p,f,_,g,A,m,b,y,v,C,P=this.config.tol_u0,x=!1,E=s[0],O=s[1];if(p=t(l=numerics.A.fminbr(t,[E,O])),f=t(c=numerics.A.fminbr(e,[E,O])),p<P&&f>-P){if(_=l,l=Math.min(_,c),c=Math.max(_,c),d=t(u=numerics.A.fzero(t,[l,c])),Math.abs(d)>Math.max((f-p)*math.A.eps,.001))return!1;if("vertical"===r?(A=[1,i,u],C=this.config.resolution_in/this.config.unitY):(A=[1,u,i],C=this.config.resolution_in/this.config.unitX),C*=1+math.A.eps,this.curveContainsPoint(A,n,a,2*C,this.config.qdt_box))x;else if((y=this.traceComponent(A,1))[0].length>0){for(o>0&&(n.push(NaN),a.push(NaN)),v=n.length,b=y[0].length,m=1;m<b;m++)this.qdt.insertItem({xlb:Math.min(y[0][m-1],y[0][m]),xub:Math.max(y[0][m-1],y[0][m]),ylb:Math.min(y[1][m-1],y[1][m]),yub:Math.max(y[1][m-1],y[1][m]),idx1:v+m-1,idx2:v+m,comp:o});o++,utils_type.A.concat(n,y[0]),utils_type.A.concat(a,y[1])}return(g=u-.01*C)-E>C&&h>0&&!1!==(y=this.searchLine(t,e,i,[E,g],r,o,n,a,h-1))&&(n=y[0],a=y[1],o=y[2]),O-(g=u+.01*C)>C&&h>0&&!1!==(y=this.searchLine(t,e,i,[g,O],r,o,n,a,h-1))&&(n=y[0],a=y[1],o=y[2]),[n,a,o]}return!1},curveContainsPoint:function(t,e,i,s,r){var o,n,a,h=t[1],l=t[2];for(n=(a=this.qdt.find([h-r,l+r,h+r,l-r])).length,o=0;o<n;o++)if(geometry.A.distPointSegment(t,[1,e[a[o].idx1],i[a[o].idx1]],[1,e[a[o].idx2],i[a[o].idx2]])<s)return!0;return!1},traceComponent:function(t){var e=[],i=[],s=[];return 0===(s=this.tracing(t,1)).length||(e=s[0],i=s[1]),s[2]||0===(s=this.tracing(t,-1)).length||(e=s[0].reverse().concat(e.slice(1)),i=s[1].reverse().concat(i.slice(1))),e.length>0&&e.length<6&&(e.push(e[e.length-1]),i.push(i[i.length-1])),[e,i]},tracing:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C=[],P=[],x=[],E=0,O=0,M=!1,w=!1,S=!1,T=this.config.kappa_0,N=this.config.delta_0,j=this.config.alpha_0,D=this.config.h_initial,k=this.config.max_steps,R=e,L=[],B=[],I=[];if(C=t.slice(1),L.push(C[0]),B.push(C[1]),!1===(r=this.tangent(C)))return[];this.dfx(C[0],C[1]),this.dfy(C[0],C[1]);do{if(!1===(r=this.tangent(C))){C=P.slice(),L.push(C[0]),B.push(C[1]);break}if(1===L.length)n=r.slice();else if(2===L.length)I.push(L.length-1);else if(w&&L.length>2&&!S){if(geometry.A.distPointSegment([1,C[0],C[1]],[1,L[0],B[0]],[1,L[1],B[1]])<this.config.loop_dist*D&&math.A.innerProduct(r,n,2)>this.config.loop_dir){C=t.slice(1),L.push(C[0]),B.push(C[1]),M=!0;break}if(this.config.loop_detection){for(m=L.length-1,b=Math.floor(math.A.log2(m)),y=0;y<=b&&!(geometry.A.distPointSegment([1,C[0],C[1]],[1,L[I[y]-1],B[I[y]-1]],[1,L[I[y]],B[I[y]]])<this.config.loop_dist*D&&(o=this.tangent([L[I[y]],B[I[y]]]),math.A.innerProduct(r,o,2)>this.config.loop_dir));y++);if(y<=b){M=!0;break}for(b=1,v=0,y=0;y<100&&(m+1)%b===0;y++)b*=2,v++;I[v]=m}}P[0]=C[0]+D*R*r[0],P[1]=C[1]+D*R*r[1],O=0;do{p=(h=[this.dfx(P[0],P[1]),this.dfy(P[0],P[1])])[0]*h[0]+h[1]*h[1],l=this.f(P[0],P[1])/p,x[0]=P[0]-h[0]*l,x[1]=P[1]-h[1]*l,0===O?u=Math.abs(l)*Math.sqrt(p):1===O&&(d=Math.abs(l)*Math.sqrt(p)),P[0]=x[0],P[1]=x[1],O++}while(O<20&&Math.abs(this.f(P[0],P[1]))>this.config.tol_newton);if(_=u,f=O>1?d/u:0,o=this.tangent(P),c=math.A.innerProduct(r,o,2),c=Math.max(-1,Math.min(1,c)),g=Math.acos(c),S=!1,geometry.A.distance(C,P,2)<this.config.tol_progress){C=P.slice(),L.push(C[0]),B.push(C[1]);break}if(c<0)if(D>this.config.h_critical);else{if(S=!0,!this.isBifurcation(C,this.config.tol_cusp)){C=P.slice(),L.push(C[0]),B.push(C[1]);break}R*=-1,g=0}if(!S&&(A=Math.max(Math.sqrt(f/T),Math.sqrt(_/N),g/j),isNaN(A)&&(A=1),D/=A=Math.max(Math.min(A,2),.5),D=Math.min(this.config.h_max,D),A>=2)){if(++E>=3*k)break;w=!1}else C=P.slice(),L.push(C[0]),B.push(C[1]),w=!0,E++}while(E<k&&C[0]>=this.bbox[0]&&C[1]<=this.bbox[1]&&C[0]<=this.bbox[2]&&C[1]>=this.bbox[3]);return i=[L[(s=L.length)-2],B[s-2]],C[0]<this.bbox[0]&&(C[0]!==i[0]&&(a=(this.bbox[0]-i[0])/(C[0]-i[0]),C[1]!==i[1]&&(C[1]=i[1]+a*(C[1]-i[1]))),C[0]=this.bbox[0]),C[0]>this.bbox[2]&&(C[0]!==i[0]&&(a=(this.bbox[2]-i[0])/(C[0]-i[0]),C[1]!==i[1]&&(C[1]=i[1]+a*(C[1]-i[1]))),C[0]=this.bbox[2]),C[1]<this.bbox[3]&&(C[1]!==i[1]&&(a=(this.bbox[3]-i[1])/(C[1]-i[1]),C[0]!==i[0]&&(C[0]=i[0]+a*(C[0]-i[0]))),C[1]=this.bbox[3]),C[1]>this.bbox[1]&&(C[1]!==i[1]&&(a=(this.bbox[1]-i[1])/(C[1]-i[1]),C[0]!==i[0]&&(C[0]=i[0]+a*(C[0]-i[0]))),C[1]=this.bbox[1]),L[s-1]=C[0],B[s-1]=C[1],[L,B,M]},isBifurcation:function(t,e){var i,s,r,o,n,a,h,l,c,u,d=math.A.eps*math.A.eps*100;return i=t[0],s=t[1],r=.5*(this.dfx(i+d,s)-this.dfx(i-d,s))/d,o=.5*(this.dfx(i,s+d)-this.dfx(i,s-d))/d,n=.5*(this.dfy(i+d,s)-this.dfy(i-d,s))/d,u=(h=r+(a=.5*(this.dfy(i,s+d)-this.dfy(i,s-d))/d))*h-4*(r*a-o*n),l=.5*(h+Math.sqrt(u)),c=.5*(h-Math.sqrt(u)),Math.abs(l)>e&&Math.abs(c)>e},handleCriticalPoint:function(t,e,i,s){var r,o=Math.atan2(s*e[1],s*e[0]);return r=numerics.A.root(function(e){var s=t[0]+i*Math.cos(e),r=t[1]+i*Math.sin(e);return this.f(s,r)},o),[t[0]+i*Math.cos(r),t[1]+i*Math.sin(r)]},updateA:function(t,e,i){var s,r,o=[i[0]-e[0],i[1]-e[1]],n=this.f(i[0],i[1])-this.f(e[0],e[1]);return r=o[0]*o[0]+o[1]*o[1],s=n-(t[0]*o[0]+t[1]*o[1]),s/=r,t[0]+=s*o[0],t[1]+=s*o[1],t},tangent_A:function(t){var e=[-t[1],t[0]],i=math.A.norm(e,2);return math.A.eps,[e[0]/i,e[1]/i]},tangent:function(t){var e=[-this.dfy(t[0],t[1]),this.dfx(t[0],t[1])],i=math.A.norm(e,2);return!(i<math.A.eps*math.A.eps)&&[e[0]/i,e[1]/i]}});var implicitplot=math.A.ImplicitPlot;math.A.Metapost={MP_ENDPOINT:0,MP_EXPLICIT:1,MP_GIVEN:2,MP_CURL:3,MP_OPEN:4,MP_END_CYCLE:5,UNITY:1,FRACTION_ONE:1,FRACTION_THREE:3,ONE_EIGHTY_DEG:Math.PI,THREE_SIXTY_DEG:2*Math.PI,EPS_SQ:1e-5*1e-5,make_choices:function(t){var e,i,s,r,o,n,a,h,l,c,u,d,p,f,_;a=t[0];do{if(!a)break;n=a.next,a.rtype>this.MP_EXPLICIT&&(a.x-n.x)*(a.x-n.x)+(a.y-n.y)*(a.y-n.y)<this.EPS_SQ&&(a.rtype=this.MP_EXPLICIT,a.ltype===this.MP_OPEN&&(a.ltype=this.MP_CURL,a.set_left_curl(this.UNITY)),n.ltype=this.MP_EXPLICIT,n.rtype===this.MP_OPEN&&(n.rtype=this.MP_CURL,n.set_right_curl(this.UNITY)),a.rx=a.x,n.lx=a.x,a.ry=a.y,n.ly=a.y),a=n}while(a!==t[0]);for(i=t[0];i.ltype===this.MP_OPEN&&i.rtype===this.MP_OPEN;)if((i=i.next)===t[0]){i.ltype=this.MP_END_CYCLE;break}for(a=i;a;){if(n=a.next,a.rtype>=this.MP_GIVEN){for(;n.ltype===this.MP_OPEN&&n.rtype===this.MP_OPEN;)n=n.next;for(s=0,h=a,o=t.length,d=[],p=[],f=[],_=[null];c=h.next,d.push(c.x-h.x),p.push(c.y-h.y),f.push(this.mp_pyth_add(d[s],p[s])),s>0&&(u=p[s-1]/f[s-1],l=d[s-1]/f[s-1],_.push(Math.atan2(p[s]*l-d[s]*u,d[s]*l+p[s]*u))),s++,(h=c)===n&&(o=s),!(s>=o&&h.ltype!==this.MP_END_CYCLE););s===o?_.push(0):_.push(_[1]),n.ltype===this.MP_OPEN&&((r=n.rx-n.x)*r+(e=n.ry-n.y)*e<this.EPS_SQ?(n.ltype=this.MP_CURL,n.set_left_curl(this.UNITY)):(n.ltype=this.MP_GIVEN,n.set_left_given(Math.atan2(e,r)))),a.rtype===this.MP_OPEN&&a.ltype===this.MP_EXPLICIT&&((r=a.x-a.lx)*r+(e=a.y-a.ly)*e<this.EPS_SQ?(a.rtype=this.MP_CURL,a.set_right_curl(this.UNITY)):(a.rtype=this.MP_GIVEN,a.set_right_given(Math.atan2(e,r)))),this.mp_solve_choices(a,n,o,d,p,f,_)}else a.rtype===this.MP_ENDPOINT&&(a.rx=a.x,a.ry=a.y,n.lx=n.x,n.ly=n.y);if((a=n)===i)break}},mp_solve_choices:function(t,e,i,s,r,o,n){var a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N,j;for(u=o.length+1,g=new Array(u),_=new Array(u),l=new Array(u),v=new Array(u),N=0;N<u;N++)v[N]=l[N]=_[N]=g[N]=0;for(p=0,f=t,m=0;;){if(b=f.next,0===p)if(f.rtype===this.MP_GIVEN){if(b.ltype===this.MP_GIVEN)return a=Math.atan2(r[0],s[0]),O=(E=this.mp_n_sin_cos(t.right_given()-a))[0],M=E[1],S=(w=this.mp_n_sin_cos(e.left_given()-a))[0],T=w[1],void this.mp_set_controls(t,e,s[0],r[0],M,O,-T,S);l[0]=f.right_given()-Math.atan2(r[0],s[0]),l[0]=this.reduce_angle(l[0]),g[0]=0,_[0]=0}else if(f.rtype===this.MP_CURL){if(b.ltype===this.MP_CURL)return t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT,A=Math.abs(e.left_tension()),C=Math.abs(t.right_tension()),y=this.UNITY/(3*C),t.rx=t.x+s[0]*y,t.ry=t.y+r[0]*y,y=this.UNITY/(3*A),e.lx=e.x-s[0]*y,void(e.ly=e.y-r[0]*y);x=f.right_curl(),A=Math.abs(b.left_tension()),C=Math.abs(f.right_tension()),g[0]=this.mp_curl_ratio(x,C,A),l[0]=-n[1]*g[0],_[0]=0}else f.rtype===this.MP_OPEN&&(g[0]=0,l[0]=0,_[0]=this.FRACTION_ONE);else if(f.ltype===this.MP_END_CYCLE||f.ltype===this.MP_OPEN){if(a=this.UNITY/(3*Math.abs(m.right_tension())-this.UNITY),P=o[p]*(this.FRACTION_THREE-this.UNITY/Math.abs(m.right_tension())),c=this.UNITY/(3*Math.abs(b.left_tension())-this.UNITY),d=o[p-1]*(this.FRACTION_THREE-this.UNITY/Math.abs(b.left_tension())),P*=x=this.FRACTION_ONE-g[p-1]*a,(A=Math.abs(f.left_tension()))<(C=Math.abs(f.right_tension()))?P*=Math.pow(A/C,2):A>C&&(d*=Math.pow(C/A,2)),y=d/(d+P),g[p]=y*c,h=-n[p+1]*g[p],m.rtype===this.MP_CURL?(_[p]=0,l[p]=h-n[1]*(this.FRACTION_ONE-y)):(y=(this.FRACTION_ONE-y)/x,h-=n[p]*y,y*=a,l[p]=h-l[p-1]*y,_[p]=-_[p-1]*y),f.ltype===this.MP_END_CYCLE){for(a=0,c=this.FRACTION_ONE;0===(p-=1)&&(p=i),a=l[p]-a*g[p],c=_[p]-c*g[p],p!==i;);for(a/=this.FRACTION_ONE-c,v[i]=a,l[0]=a,j=1;j<i;j++)l[j]=l[j]+a*_[j];break}}else{if(f.ltype===this.MP_CURL){x=f.left_curl(),A=Math.abs(f.left_tension()),C=Math.abs(m.right_tension()),y=this.mp_curl_ratio(x,A,C),v[i]=-l[i-1]*y/(this.FRACTION_ONE-y*g[i-1]);break}if(f.ltype===this.MP_GIVEN){v[i]=f.left_given()-Math.atan2(r[i-1],s[i-1]),v[i]=this.reduce_angle(v[i]);break}}m=f,f=b,p+=1}for(p=i-1;p>-1;p--)v[p]=l[p]-v[p+1]*g[p];for(f=t,p=0;b=f.next,O=(E=this.mp_n_sin_cos(v[p]))[0],M=E[1],S=(w=this.mp_n_sin_cos(-n[p+1]-v[p+1]))[0],T=w[1],this.mp_set_controls(f,b,s[p],r[p],M,O,T,S),f=b,++p!==i;);},mp_n_sin_cos:function(t){return[Math.cos(t),Math.sin(t)]},mp_set_controls:function(t,e,i,s,r,o,n,a){var h,l,c,u,d;c=Math.abs(e.left_tension()),h=Math.abs(t.right_tension()),d=this.mp_velocity(r,o,n,a,h),l=this.mp_velocity(n,a,r,o,c),(t.right_tension()<0||e.left_tension()<0)&&(r>=0&&n>=0||r<=0&&n<=0)&&(u=Math.abs(r)*a+Math.abs(n)*o)>0&&(u*=1.00024414062,t.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,d,u)<0&&(d=Math.abs(n)/u),e.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(r),this.FRACTION_ONE,l,u)<0&&(l=Math.abs(r)/u)),t.rx=t.x+(i*o-s*r)*d,t.ry=t.y+(s*o+i*r)*d,e.lx=e.x-(i*a+s*n)*l,e.ly=e.y-(s*a-i*n)*l,t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT},mp_pyth_add:function(t,e){return math.A.hypot(t,e)},mp_curl_ratio:function(t,e,i){var s=1/e,r=1/i;return Math.min(4,((3-s)*s*s*t+r*r*r)/(s*s*s*t+(3-r)*r*r))},mp_ab_vs_cd:function(t,e,i,s){return t*e===i*s?0:t*e>i*s?1:-1},mp_velocity:function(t,e,i,s,r){return Math.min(4,(2+Math.sqrt(2)*(t-i/16)*(i-t/16)*(e-s))/(1.5*r*(2+(Math.sqrt(5)-1)*e+(3-Math.sqrt(5))*s)))},reduce_angle:function(t){return Math.abs(t)>this.ONE_EIGHTY_DEG&&(t>0?t-=this.THREE_SIXTY_DEG:t+=this.THREE_SIXTY_DEG),t},makeknots:function(t,e){var i,s,r=[];for(s=t.length,i=0;i<s;i++)r.push({x:t[i][0],y:t[i][1],ltype:this.MP_OPEN,rtype:this.MP_OPEN,lx:!1,rx:!1,ly:e,ry:e,left_curl:function(){return this.lx||0},right_curl:function(){return this.rx||0},left_tension:function(){return this.ly||1},right_tension:function(){return this.ry||1},set_right_curl:function(t){this.rx=t||0},set_left_curl:function(t){this.lx=t||0}});for(s=r.length,i=0;i<s;i++)r[i].next=r[i+1]||r[i],r[i].set_right_given=r[i].set_right_curl,r[i].set_left_given=r[i].set_left_curl,r[i].right_given=r[i].right_curl,r[i].left_given=r[i].left_curl;return r[s-1].next=r[0],r},curve:function(t,e){var i,s,r,o,n,a,h=!1,l=[],c=[];for(o in n=1,(e=e||{tension:1,direction:{},curl:{},isClosed:!1}).hasOwnProperty("tension")&&(n=utils_type.A.evaluate(e.tension)),s=(i=this.makeknots(t,n)).length,utils_type.A.exists(e.isClosed)&&utils_type.A.evaluate(e.isClosed)&&(h=!0),h||(i[0].ltype=this.MP_ENDPOINT,i[0].rtype=this.MP_CURL,i[s-1].rtype=this.MP_ENDPOINT,i[s-1].ltype=this.MP_CURL),e)if(e.hasOwnProperty(o)){if(r=parseInt(o,10),isNaN(r)||r<0||r>=s)continue;if(a=e[r],utils_type.A.exists(a.type)&&"curl"===a.type)n=utils_type.A.evaluate(a.curl),0===r?(i[r].rtype=this.MP_CURL,i[r].set_right_curl(n)):r===s-1?(i[r].ltype=this.MP_CURL,i[r].set_left_curl(n)):(i[r].ltype=this.MP_CURL,i[r].rtype=this.MP_CURL,i[r].lx=n,i[r].rx=n);utils_type.A.exists(a.direction)&&(n=utils_type.A.evaluate(a.direction),utils_type.A.isArray(n)?(!1!==n[0]&&(i[r].lx=n[0]*Math.PI/180,i[r].ltype=this.MP_GIVEN),!1!==n[1]&&(i[r].rx=n[1]*Math.PI/180,i[r].rtype=this.MP_GIVEN)):(i[r].lx=n*Math.PI/180,i[r].rx=n*Math.PI/180,i[r].ltype=i[r].rtype=this.MP_GIVEN)),utils_type.A.exists(a.tension)&&(n=utils_type.A.evaluate(a.tension),utils_type.A.isArray(n)?(!1!==n[0]&&(i[r].ly=utils_type.A.evaluate(n[0])),!1!==n[1]&&(i[r].ry=utils_type.A.evaluate(n[1]))):(i[r].ly=n,i[r].ry=n))}for(this.make_choices(i),r=0;r<s-1;r++)l.push(i[r].x),l.push(i[r].rx),l.push(i[r+1].lx),c.push(i[r].y),c.push(i[r].ry),c.push(i[r+1].ly);return l.push(i[s-1].x),c.push(i[s-1].y),h&&(l.push(i[s-1].rx),c.push(i[s-1].ry),l.push(i[0].lx),c.push(i[0].ly),l.push(i[0].x),c.push(i[0].y)),[l,c]}};var metapost=math.A.Metapost;math.A.Clip={_isSeparator:function(t){return isNaN(t.coords.usrCoords[1])&&isNaN(t.coords.usrCoords[2])},makeDoublyLinkedList:function(t){var e,i=null,s=[],r=t.length;if(r>0)for(e=0;e<r;e++)this._isSeparator(t[e])?(t[e]._next=t[(e+1)%r],t[e]._prev=t[(r+e-1)%r]):(null===i&&(i=e,s.push(i)),this._isSeparator(t[(e+1)%r])||e===r-1?(t[e]._next=t[i],t[i]._prev=t[e],t[e]._end=!0,i=null):(t[e]._next=t[(e+1)%r],t[i]._prev=t[e]),this._isSeparator(t[(r+e-1)%r])||(t[e]._prev=t[(r+e-1)%r]));return s},Vertex:function(t,e,i,s,r,o){this.pos=e,this.intersection=!0,this.coords=t,this.elementClass=constants.A.OBJECT_CLASS_POINT,this.data={alpha:i,path:s,pathname:r,done:!1,type:o,idx:0},this.neighbour=null,this.entry_exit=!1},_addToList:function(t,e,i){var s=t.length,r=math.A.eps*math.A.eps;s>0&&Math.abs(t[s-1].coords.usrCoords[0]-e.usrCoords[0])<r&&Math.abs(t[s-1].coords.usrCoords[1]-e.usrCoords[1])<r&&Math.abs(t[s-1].coords.usrCoords[2]-e.usrCoords[2])<r||t.push({pos:i,intersection:!1,coords:e,elementClass:constants.A.OBJECT_CLASS_POINT})},sortIntersections:function(t){var e,i,s,r,o,n,a=[],h=t.length;for(e=0;e<h;e++)if(t[e].sort(function(t,e){return t.data.alpha>e.data.alpha?1:-1}),t[e].length>0){for(o=t[e].length-1,n=(r=(s=t[e][0]).data.path[s.pos])._next,e===h-1&&(r._end=!1),0===s.data.alpha&&"T"===s.data.type?(r.intersection=!0,r.data=s.data,r.neighbour=s.neighbour,r.neighbour.neighbour=r,r.entry_exit=!1,t[e][0]=r):(s._prev=r,s._prev._next=s),i=1;i<=o;i++)(s=t[e][i])._prev=t[e][i-1],s._prev._next=s;(s=t[e][o])._next=n,s._next._prev=s,e===h-1&&(s._end=!0),a=a.concat(t[e])}return a},_inbetween:function(t,e,i){var s,r=math.A.eps*math.A.eps,o=i[1]-e[1],n=i[2]-e[2],a=t[1]-e[1],h=t[2]-e[2];return 0===o&&0===n&&0===a&&0===h||(s=Math.abs(a)<r&&Math.abs(o)<r?h/n:a/o,Math.abs(s)<r&&(s=0),s)},_print_array:function(t){var e,i;for(e=0;e<t.length;e++)try{i="",t[e]._end&&(i=" end"),console.log(e,t[e].coords.usrCoords,t[e].data.type,"\t","prev",t[e]._prev.coords.usrCoords,"next",t[e]._next.coords.usrCoords+i)}catch(i){console.log(e,t[e].coords.usrCoords)}},_print_list:function(t){for(var e,i=0;i<100&&(e=t.data?t.data.alpha:"-",console.log("\t",t.coords.usrCoords,"\n\t\tis:",t.intersection,"end:",t._end,e,"\n\t\t-:",t._prev.coords.usrCoords,"\n\t\t+:",t._next.coords.usrCoords,"\n\t\tn:",t.intersection?t.neighbour.coords.usrCoords:"-"),!t._end);)t=t._next,i++},_noOverlap:function(t,e,i,s){var r,o,n,a,h,l=Math.sqrt(math.A.eps),c=!1;for(r=0;r<3;r++)if(o=Math.min(t[r],e[r]),n=Math.max(t[r],e[r]),a=Math.min(i[r],s[r]),h=Math.max(i[r],s[r]),n<a-l||o>h+l){c=!0;break}return c},findIntersections:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g=[],A=100*math.A.eps,m=t.length,b=e.length,y=[],v=[],C=[],P=!1,x=!1,E=!1;for(r=0;r<b;r++)C.push([]);for(s=0;s<m;s++)if(v.push([]),this._isSeparator(t[s])||this._isSeparator(t[(s+1)%m]))P=!0;else{if(P&&s===m-1)break;for(n=t[s].coords.usrCoords,a=t[(s+1)%m].coords.usrCoords,r=0;r<b;r++)if(this._isSeparator(e[r])||this._isSeparator(e[(r+1)%b]))x=!0;else{if(x&&r===b-1)break;if(h=e[r].coords.usrCoords,l=e[(r+1)%b].coords.usrCoords,!this._noOverlap(n,a,h,l)&&(g=geometry.A.meetSegmentSegment(n,a,h,l),c=geometry.A.distance(n,a,3),u=geometry.A.distance(h,l,3),g[1]*c>-A&&g[1]<1-A/c&&g[2]*u>-A&&g[2]<1-A/u||g[1]===1/0&&g[2]===1/0&&math.A.norm(g[0],3)<A)){if(o=new base_coords.A(constants.A.COORDS_BY_USER,g[0],i),p="X",Math.abs(g[1])*c<A||Math.abs(g[2])*u<A)p="T",Math.abs(g[1])*c<A&&(g[1]=0),Math.abs(g[2])*u<A&&(g[2]=0),o=0===g[1]?new base_coords.A(constants.A.COORDS_BY_USER,n,i):new base_coords.A(constants.A.COORDS_BY_USER,h,i);else if(g[1]===1/0&&g[2]===1/0&&math.A.norm(g[0],3)<A){(d=this._inbetween(n,h,l))>=0&&d<1&&(p="T",o=new base_coords.A(constants.A.COORDS_BY_USER,n,i),g[1]=0,g[2]=d,f=new this.Vertex(o,s,g[1],t,"S",p),_=new this.Vertex(o,r,g[2],e,"C",p),f.neighbour=_,_.neighbour=f,v[s].push(f),C[r].push(_)),d=this._inbetween(h,n,a),geometry.A.distance(n,h,3)>A&&d>=0&&d<1&&(p="T",o=new base_coords.A(constants.A.COORDS_BY_USER,h,i),g[1]=d,g[2]=0,f=new this.Vertex(o,s,g[1],t,"S",p),_=new this.Vertex(o,r,g[2],e,"C",p),f.neighbour=_,_.neighbour=f,v[s].push(f),C[r].push(_));continue}E,f=new this.Vertex(o,s,g[1],t,"S",p),_=new this.Vertex(o,r,g[2],e,"C",p),f.neighbour=_,_.neighbour=f,v[s].push(f),C[r].push(_)}}}for(y=this.sortIntersections(v),s=0;s<y.length;s++)y[s].data.idx=s,y[s].neighbour.data.idx=s;return[y,this.sortIntersections(C)]},_getPosition:function(t,e,i,s){var r=geometry.A.det3p(t,e,i),o=geometry.A.det3p(t,i,s);return geometry.A.det3p(e,i,s)>=0?r>=0&&o>=0?"left":"right":r>=0||o>=0?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,s,r,o,n,a,h,l,c,u,d,p,f,_=!1;for(_,l=geometry.A.det3p,a=0,t._tours=0;;){if(t.intersection&&"T"===t.data.type&&(e=t._next.coords.usrCoords,i=t._prev.coords.usrCoords,geometry.A.distance(t.coords.usrCoords,e,3)<math.A.eps&&(e=t._next._next.coords.usrCoords),geometry.A.distance(t.coords.usrCoords,i,3)<math.A.eps&&(i=t._prev._prev.coords.usrCoords),r=(o=t.neighbour)._prev.coords.usrCoords,s=o._next.coords.usrCoords,geometry.A.distance(o.coords.usrCoords,s,3)<math.A.eps&&(s=o._next._next.coords.usrCoords),geometry.A.distance(o.coords.usrCoords,r,3)<math.A.eps&&(r=o._prev._prev.coords.usrCoords),u=l(t.coords.usrCoords,i,r),d=l(t.coords.usrCoords,e,s),p=l(t.coords.usrCoords,i,s),f=l(t.coords.usrCoords,e,r),0===u&&0===d&&0===p&&0===f&&(t.coords.usrCoords[1]*=1+Math.random()*math.A.eps,t.coords.usrCoords[2]*=1+Math.random()*math.A.eps,o.coords.usrCoords[1]=t.coords.usrCoords[1],o.coords.usrCoords[2]=t.coords.usrCoords[2],u=l(t.coords.usrCoords,i,r),d=l(t.coords.usrCoords,e,s),p=l(t.coords.usrCoords,i,s),f=l(t.coords.usrCoords,e,r)),c=!1,0===u?geometry.A.affineRatio(t.coords.usrCoords,i,r)<0&&(c=!0):0===d?geometry.A.affineRatio(t.coords.usrCoords,e,s)<0&&(c=!0):0===p?geometry.A.affineRatio(t.coords.usrCoords,i,s)>0&&(c=!0):0===f&&geometry.A.affineRatio(t.coords.usrCoords,e,r)>0&&(c=!0),c&&(h=r,r=s,s=h,h=u,u=p,p=h,h=d,d=f,f=h),utils_type.A.exists(t.delayedStatus)||(t.delayedStatus=[]),0===u&&0===d?t.delayedStatus=["on","on"]:0===u?(n=this._getPosition(e,r,o.coords.usrCoords,s),t.delayedStatus=["on",n]):0===d?(n=this._getPosition(i,r,o.coords.usrCoords,s),t.delayedStatus=[n,"on"]):0===t.delayedStatus.length&&(this._getPosition(i,r,o.coords.usrCoords,s)!==this._getPosition(e,r,o.coords.usrCoords,s)?t.data.type="X":t.data.type="B")),utils_type.A.exists(t._tours)&&t._tours++,t._tours>3||t._end||a>1e3){a>1e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),utils_type.A.exists(t._tours)&&delete t._tours;break}t.intersection&&a++,t=t._next}},_handleIntersectionChains:function(t){var e,i=0,s="Null",r=!1,o=!1,n=!1;for(n;!0===t.intersection&&("T"===t.data.type&&("on"!==t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(r=!0,e=t,s=t.delayedStatus[0]):r&&"on"===t.delayedStatus[0]&&"on"===t.delayedStatus[1]?t.data.type="B":r&&"on"===t.delayedStatus[0]&&"on"!==t.delayedStatus[1]&&(r=!1,s===t.delayedStatus[1]?(e.data.type="DB",t.data.type="DB"):(e.data.type="DX",t.data.type="DX"))),i++),t._end&&(o=!0),!o||r;){if(i>1e3){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}t=t._next}},_handleFullyDegenerateCase:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A=[t,e];for(o=0;o<2;o++){for(d=(s=A[o]).length,c=0,g=!0;c<d;c++)if(!s[c].intersection){g=!1;break}if(g)for(p=(r=A[(o+1)%2]).length,c=0;c<d;c++){for(a=s[c].coords.usrCoords,h=s[c]._next.coords.usrCoords,n=[.5*(a[0]+h[0]),.5*(a[1]+h[1]),.5*(a[2]+h[2])],u=0,f=!1;u<p;u++)if(Math.abs(geometry.A.det3p(r[u].coords.usrCoords,r[(u+1)%p].coords.usrCoords,n))<math.A.eps){f=!0;break}if(!f){l={pos:c,intersection:!1,coords:new base_coords.A(constants.A.COORDS_BY_USER,n,i),elementClass:constants.A.OBJECT_CLASS_POINT},_=s[c]._next,s[c]._next=l,l._prev=s[c],l._next=_,_._prev=l,s[c]._end&&(s[c]._end=!1,l._end=!0);break}}}},_getStatus:function(t,e){for(;t.intersection&&!t._end;)t=t._next;return[t,0===geometry.A.windingNumber(t.coords.usrCoords,e)?"entry":"exit"]},markEntryExit:function(t,e,i){var s,r,o,n,a,h,l,c=null,u=0;for(h=i.length,a=0;a<h;a++)for(l=i[a],this._classifyDegenerateIntersections(t[l]),this._handleIntersectionChains(t[l]),r=(n=this._getStatus(t[l],e))[0],s=n[1],r._starter=!0,o=0,c=null,u=0;!0===r.intersection&&("X"===r.data.type&&1===u&&(c.entry_exit=s,"exit"===s&&(c.data.type="X"),u=2),"X"!==r.data.type&&"DB"!==r.data.type||(r.entry_exit=s,s="entry"===s?"exit":"entry"),"DX"===r.data.type&&(0===u?(c=r,u=1):1===u?(r.entry_exit=s,c.entry_exit=s,"exit"===s?c.data.type="X":r.data.type="X",s="entry"===s?"exit":"entry",c=null,u=0):2===u&&(r.entry_exit=s,r.data.type="X",s="entry"===s?"exit":"entry",c=null,u=0))),r=r._next,!(utils_type.A.exists(r._starter)||o>1e4);)o++},_stayOnPath:function(t,e){var i=!0;return t.intersection&&"B"!==t.data.type&&(i=e===t.entry_exit),i},_addVertex:function(t,e,i){return isNaN(e.coords.usrCoords[1])||isNaN(e.coords.usrCoords[2])||t.push(e),e.intersection&&e.data.done?(i&&console.log("Add last intersection point",e.coords.usrCoords,"on",e.data.pathname,e.entry_exit,e.data.type),!0):(e.intersection&&(e.data.done=!0,i&&console.log("Add intersection point",e.coords.usrCoords,"on",e.data.pathname,e.entry_exit,e.data.type)),!1)},tracing:function(t,e,i){var s,r,o,n,a=0,h=1e4,l=0,c=[],u=!1,d=!1;for(d;l<e.length&&a<h;)if((o=e[l]).data.done||"X"!==o.data.type)l++;else{d,c.length>0&&c.push([NaN,NaN]),n=o.data.idx,s=t,u=this._addVertex(c,o,d),r=o.entry_exit;do{if(u)break;if("intersection"===i&&"entry"===o.entry_exit||"union"===i&&"exit"===o.entry_exit||"difference"===i&&s===t==("exit"===o.entry_exit)){d;do{if(o=o._next,u=this._addVertex(c,o,d))break}while(this._stayOnPath(o,r));a++}else{d;do{if(o=o._prev,u=this._addVertex(c,o,d))break}while(this._stayOnPath(o,r));a++}if(u)break;if(!o.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",a),[[0],[0]];if((o=o.neighbour).data.done)break;o.data.done=!0,r=o.entry_exit,s=o.data.path}while(o.data.idx!==n&&a<h);a>=h&&console.log("Tracing: stopping an infinite loop!",a),l++}return this._getCoordsArrays(c,!1)},isEmptyCase:function(t,e,i){return"intersection"===i&&(0===t.length||0===e.length)||("union"===i&&0===t.length&&0===e.length||"difference"===i&&0===t.length)},_getCoordsArrays:function(t,e){var i,s=[],r=[],o=t.length;for(i=0;i<o;i++)t[i].coords?(s.push(t[i].coords.usrCoords[1]),r.push(t[i].coords.usrCoords[2])):(s.push(t[i][0]),r.push(t[i][1]));return e&&o>0&&(t[0].coords?(s.push(t[0].coords.usrCoords[1]),r.push(t[0].coords.usrCoords[2])):(s.push(t[0][0]),r.push(t[0][1]))),[s,r]},handleEmptyIntersection:function(t,e,i){var s,r,o=!1,n=[];if(0===t.length)return n="union"===i?e:[],this._getCoordsArrays(n,!0);if(0===e.length)return n="intersection"===i?[]:t,this._getCoordsArrays(n,!0);if(t.length>0)for(s=t[0];s.intersection&&!(s=s._next)._end;);if(e.length>0)for(r=e[0];r.intersection&&!(r=r._next)._end;);return 0===geometry.A.windingNumber(s.coords.usrCoords,e)?0!==geometry.A.windingNumber(r.coords.usrCoords,t)?("union"===i?(utils_type.A.concat(n,t),n.push(t[0])):"difference"===i&&(utils_type.A.concat(n,t),n.push(t[0]),geometry.A.signedPolygon(t)*geometry.A.signedPolygon(e)>0&&n.reverse(),n.push([NaN,NaN])),"difference"!==i&&"intersection"!==i||(utils_type.A.concat(n,e),n.push(e[0]),o=!1)):"difference"===i?(utils_type.A.concat(n,t),o=!0):"union"===i&&(utils_type.A.concat(n,t),n.push(t[0]),n.push([NaN,NaN]),utils_type.A.concat(n,e),n.push(e[0])):"intersection"===i?(utils_type.A.concat(n,t),o=!0):"union"===i&&(utils_type.A.concat(n,e),n.push(e[0])),this._getCoordsArrays(n,o)},_countCrossingIntersections:function(t){var e,i=t.length,s=0;for(e=0;e<i;e++)"X"===t[e].data.type&&s++;return s},_getPath:function(t,e){var i,s,r,o,n,a,h,l=[];if(t.elementClass!==constants.A.OBJECT_CLASS_CURVE||t.type!==constants.A.OBJECT_TYPE_ARC&&t.type!==constants.A.OBJECT_TYPE_SECTOR){if(t.elementClass===constants.A.OBJECT_CLASS_CURVE&&utils_type.A.exists(t.points))for(s=t.numberPoints,i=0;i<s;i++)this._addToList(l,t.points[i],i);else if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(i=0;i<t.vertices.length;i++)this._addToList(l,t.vertices[i].coords,i);else if(t.elementClass===constants.A.OBJECT_CLASS_CIRCLE)for(h=359,r=t.Radius(),o=2*Math.PI/h,i=0;i<=h;i++)this._addToList(l,new base_coords.A(constants.A.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(i*o)*r,t.center.coords.usrCoords[2]+Math.sin(i*o)*r],e),i);else if(utils_type.A.isArray(t))for(s=t.length,i=0;i<s;i++)utils_type.A.exists(t[i].coords)?this._addToList(l,t[i].coords,i):utils_type.A.isArray(t[i])?this._addToList(l,new base_coords.A(constants.A.COORDS_BY_USER,t[i],e),i):utils_type.A.exists(t[i].usrCoords)&&this._addToList(l,t[i],i)}else{for(n=geometry.A.rad(t.radiuspoint,t.center,t.anglepoint),h=Math.floor(180*n/Math.PI),r=t.Radius(),o=n/h,a=Math.atan2(t.radiuspoint.coords.usrCoords[2]-t.center.coords.usrCoords[2],t.radiuspoint.coords.usrCoords[1]-t.center.coords.usrCoords[1]),t.type===constants.A.OBJECT_TYPE_SECTOR&&this._addToList(l,t.center.coords,0),i=0;i<=h;i++)this._addToList(l,new base_coords.A(constants.A.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(i*o+a)*r,t.center.coords.usrCoords[2]+Math.sin(i*o+a)*r],e),i+1);t.type===constants.A.OBJECT_TYPE_SECTOR&&this._addToList(l,t.center.coords,h+2)}return l},greinerHormann:function(t,e,i,s){var r,o,n,a,h=[],l=[];return(r=(h=this._getPath(t,s)).length)>0&&geometry.A.distance(h[0].coords.usrCoords,h[r-1].coords.usrCoords,3)<math.A.eps&&h.pop(),(r=(l=this._getPath(e,s)).length)>0&&geometry.A.distance(l[0].coords.usrCoords,l[r-1].coords.usrCoords,3)<math.A.eps*math.A.eps&&l.pop(),this.isEmptyCase(h,l,i)?[[],[]]:(n=this.makeDoublyLinkedList(h),a=this.makeDoublyLinkedList(l),o=this.findIntersections(h,l,s)[0],this._handleFullyDegenerateCase(h,l,s),this.markEntryExit(h,l,n),this.markEntryExit(l,h,a),0===this._countCrossingIntersections(o)?this.handleEmptyIntersection(h,l,i):this.tracing(h,o,i))},union:function(t,e,i){return this.greinerHormann(t,e,"union",i)},intersection:function(t,e,i){return this.greinerHormann(t,e,"intersection",i)},difference:function(t,e,i){return this.greinerHormann(t,e,"difference",i)}};var clip=math.A.Clip;math.A.Poly={},math.A.Poly.Ring=function(t){this.vars=t},jxg.A.extend(math.A.Poly.Ring.prototype,{}),math.A.Poly.Monomial=function(t,e,i){var s;if(!utils_type.A.exists(t))throw new Error("JSXGraph error: In JXG.Math.Poly.monomial missing parameter 'ring'.");for(utils_type.A.isArray(i)||(i=[]),s=(i=i.slice(0,t.vars.length)).length;s<t.vars.length;s++)i.push(0);this.ring=t,this.coefficient=e||0,this.exponents=utils_type.A.deepCopy(i)},jxg.A.extend(math.A.Poly.Monomial.prototype,{copy:function(){return new math.A.Poly.Monomial(this.ring,this.coefficient,this.exponents)},print:function(){var t,e=[];for(t=0;t<this.ring.vars.length;t++)e.push(this.ring.vars[t]+"^"+this.exponents[t]);return this.coefficient+"*"+e.join("*")}}),math.A.Poly.Polynomial=function(t,e){var i;if(!utils_type.A.exists(t))throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial missing parameter 'ring'.");i=utils_type.A.exists(e)&&utils_type.A.isString(e)?void 0:[],this.ring=t,this.monomials=i},jxg.A.extend(math.A.Poly.Polynomial.prototype,{findSignature:function(t){var e;for(e=0;e<this.monomials.length;e++)if(utils_type.A.cmpArrays(this.monomials[e].exponents,t))return e;return-1},addSubMonomial:function(t,e){var i;(i=this.findSignature(t.exponents))>-1?this.monomials[i].coefficient+=e*t.coefficient:(t.coefficient*=e,this.monomials.push(t))},add:function(t){var e;if(!utils_type.A.exists(t)||t.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.");if(utils_type.A.isArray(t.exponents))this.addSubMonomial(t,1);else for(e=0;e<t.monomials.length;e++)this.addSubMonomial(t.monomials[e],1)},sub:function(t){var e;if(!utils_type.A.exists(t)||t.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.sub either summand is undefined or rings don't match.");if(utils_type.A.isArray(t.exponents))this.addSubMonomial(t,-1);else for(e=0;e<t.monomials.length;e++)this.addSubMonomial(t.monomials[e],-1)},copy:function(){var t,e;for(e=new math.A.Poly.Polynomial(this.ring),t=0;t<this.monomials.length;t++)e.monomials.push(this.monomials[t].copy());return e},print:function(){var t,e=[];for(t=0;t<this.monomials.length;t++)e.push("("+this.monomials[t].print()+")");return e.join("+")}});var poly=math.A.Poly;jxg.A.Complex=function(t,e){this.isComplex=!0,t&&t.isComplex&&(e=t.imaginary,t=t.real),this.real=t||0,this.imaginary=e||0},jxg.A.extend(jxg.A.Complex.prototype,{toString:function(){return this.real+" + "+this.imaginary+"i"},add:function(t){return utils_type.A.isNumber(t)?this.real+=t:(this.real+=t.real,this.imaginary+=t.imaginary),this},sub:function(t){return utils_type.A.isNumber(t)?this.real-=t:(this.real-=t.real,this.imaginary-=t.imaginary),this},mult:function(t){var e,i;return utils_type.A.isNumber(t)?(this.real*=t,this.imaginary*=t):(e=this.real,i=this.imaginary,this.real=e*t.real-i*t.imaginary,this.imaginary=e*t.imaginary+i*t.real),this},div:function(t){var e,i,s;if(utils_type.A.isNumber(t)){if(Math.abs(t)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;this.real/=t,this.imaginary/=t}else{if(Math.abs(t.real)<Math.eps&&Math.abs(t.imaginary)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;e=t.real*t.real+t.imaginary*t.imaginary,s=this.real,i=this.imaginary,this.real=(s*t.real+i*t.imaginary)/e,this.imaginary=(i*t.real-s*t.imaginary)/e}return this},conj:function(){return this.imaginary*=-1,this},abs:function(){var t=this.real,e=this.imaginary;return Math.sqrt(t*t+e*e)},angle:function(){return Math.atan2(this.imaginary,this.real)}}),jxg.A.C={},jxg.A.C.add=function(t,e){var i=new jxg.A.Complex(t);return i.add(e),i},jxg.A.C.sub=function(t,e){var i=new jxg.A.Complex(t);return i.sub(e),i},jxg.A.C.mult=function(t,e){var i=new jxg.A.Complex(t);return i.mult(e),i},jxg.A.C.div=function(t,e){var i=new jxg.A.Complex(t);return i.div(e),i},jxg.A.C.conj=function(t){var e=new jxg.A.Complex(t);return e.conj(),e},jxg.A.C.abs=function(t){return new jxg.A.Complex(t).abs()},jxg.A.C.angle=function(t){return new jxg.A.Complex(t).angle()},jxg.A.C.copy=function(t){return new jxg.A.Complex(t)},jxg.A.Complex.C=jxg.A.C;var complex=jxg.A.Complex,src_options=__webpack_require__(378);jxg.A.AbstractRenderer=function(){this.vOffsetText=0,this.enhancedRendering=!0,this.container=null,this.type="",this.supportsForeignObject=!1,this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5],[0,5]]},jxg.A.extend(jxg.A.AbstractRenderer.prototype,{_updateVisual:function(t,e,i){(i||this.enhancedRendering)&&(e=e||{},this.setObjectTransition(t),t.evalVisProp("draft")?this.setDraft(t):(e.stroke||(t.highlighted?(this.setObjectStrokeColor(t,t.evalVisProp("highlightstrokecolor"),t.evalVisProp("highlightstrokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("highlightstrokewidth"))):(this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("strokewidth")))),e.fill||(t.highlighted?this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")):this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity"))),e.dash||this.setDashStyle(t,t.visProp),e.shadow||this.setShadow(t),e.tabindex||this.setTabindex(t)),t.highlighted?this.setCssClass(t,t.evalVisProp("highlightcssclass")):this.setCssClass(t,t.evalVisProp("cssclass")),t.evalVisProp("aria.enabled")&&this.setARIA(t))},_getHighlighted:function(t){var e=!1;return utils_type.A.exists(t.board)&&utils_type.A.exists(t.board.highlightedObjects)||(e=!0),!e&&utils_type.A.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e,i=src_options.A.normalizePointFace(t.evalVisProp("face"));e="o"===i?"ellipse":"[]"===i?"rect":"path",t.rendNode=this.appendChildPrim(this.createPrim(e,t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,e),this._updateVisual(t,{dash:!0,shadow:!0},!0),this.updatePoint(t)},updatePoint:function(t){var e,i=t.evalVisProp("size"),s=src_options.A.normalizePointFace(t.evalVisProp("face")),r=t.evalVisProp("sizeunit"),o=t.evalVisProp("zoom");isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===r&&(i*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),e=0===(i*=t.board&&o?Math.sqrt(t.board.zoomX*t.board.zoomY):1)?0:i+1,"o"===s?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],e,e):"[]"===s?this.updateRectPrim(t.rendNode,t.coords.scrCoords[1]-i,t.coords.scrCoords[2]-i,2*i,2*i):this.updatePathPrim(t.rendNode,this.updatePathStringPoint(t,i,s),t.board),this._updateVisual(t,{dash:!1,shadow:!1}),this.setShadow(t))},changePointStyle:function(t){var e=this.getElementById(t.id);utils_type.A.exists(e)&&this.remove(e),this.drawPoint(t),utils_type.A.clearVisPropOld(t),t.visPropCalc.visible||this.display(t,!1),t.evalVisProp("draft")&&this.setDraft(t)},drawLine:function(t){t.rendNode=this.appendChildPrim(this.createPrim("line",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"lines"),this.updateLine(t)},updateLine:function(t){this._updateVisual(t),this.updatePathWithArrowHeads(t),this.setLineCap(t)},drawCurve:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"path"),this.updateCurve(t)},updateCurve:function(t){this._updateVisual(t),this.updatePathWithArrowHeads(t),this.setLineCap(t)},updatePathWithArrowHeads:function(t,e){var i,s,r=e?"highlight":"";i=e&&t.evalVisProp("highlightstrokewidth")?Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")):t.evalVisProp("strokewidth"),s=this.getArrowHeadData(t,i,r),this.makeArrows(t,s),t.elementClass===constants.A.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,s):t.elementClass===constants.A.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,s)},getArrowHeadData:function(t,e,i){var s,r,o,n,a=math.A.eps,h=0,l=0,c=0,u=0,d=t.evalVisProp("firstarrow"),p=t.evalVisProp("lastarrow");return(d||p)&&(s=utils_type.A.exists(d.type)?t.eval(d.type):t.elementClass===constants.A.OBJECT_CLASS_LINE?1:7,r=utils_type.A.exists(p.type)?t.eval(p.type):t.elementClass===constants.A.OBJECT_CLASS_LINE?1:7,d&&(n=6,utils_type.A.exists(d.size)&&(n=t.eval(d.size)),""!==i&&utils_type.A.exists(d[i+"size"])&&(n=t.eval(d[i+"size"])),o=e*n,2===s?(o*=.5,a+=e*n):3===s?(o=e*n/3,a+=e):4===s||5===s||6===s?(o=e*n/1.5,a+=e*n):7===s?(o=0,n=10,a+=e):a+=e*n,h+=o,c=n),p&&(n=6,utils_type.A.exists(p.size)&&(n=t.eval(p.size)),""!==i&&utils_type.A.exists(p[i+"size"])&&(n=t.eval(p[i+"size"])),o=e*n,2===r?(o*=.5,a+=e*n):3===r?(o=e*n/3,a+=e):4===r||5===r||6===r?(o=e*n/1.5,a+=e*n):7===r?(o=0,n=10,a+=e):a+=e*n,l+=o,u=n)),t.visPropCalc.typeFirst=s,t.visPropCalc.typeLast=r,{evFirst:d,evLast:p,typeFirst:s,typeLast:r,offFirst:h,offLast:l,sizeFirst:c,sizeLast:u,showFirst:1,showLast:1,minLen:a,strokeWidth:e}},updateLineWithEndings:function(t,e){var i,s,r;return i=new base_coords.A(constants.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),s=new base_coords.A(constants.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),r=t.evalVisProp("margin"),geometry.A.calcStraight(t,i,s,r),this.handleTouchpoints(t,i,s,e),this.getPositionArrowHead(t,i,s,e),this.updateLinePrim(t.rendNode,i.scrCoords[1],i.scrCoords[2],s.scrCoords[1],s.scrCoords[2],t.board),this},updatePath:function(t){return t.evalVisProp("handdrawing")?this.updatePathPrim(t.rendNode,this.updatePathStringBezierPrim(t),t.board):this.updatePathPrim(t.rendNode,this.updatePathStringPrim(t),t.board),this},getPositionArrowHead:function(t,e,i,s){var r,o,n,a,h;return(s.evFirst||s.evLast)&&(o=n=a=h=0,r=e.distance(constants.A.COORDS_BY_SCREEN,i),s.evFirst&&"vml"!==t.board.renderer.type&&(r>=s.minLen?(o=(i.scrCoords[1]-e.scrCoords[1])*s.offFirst/r,n=(i.scrCoords[2]-e.scrCoords[2])*s.offFirst/r):s.showFirst=0),s.evLast&&"vml"!==t.board.renderer.type&&(r>=s.minLen?(a=(i.scrCoords[1]-e.scrCoords[1])*s.offLast/r,h=(i.scrCoords[2]-e.scrCoords[2])*s.offLast/r):s.showLast=0),e.setCoordinates(constants.A.COORDS_BY_SCREEN,[e.scrCoords[1]+o,e.scrCoords[2]+n],!1,!0),i.setCoordinates(constants.A.COORDS_BY_SCREEN,[i.scrCoords[1]-a,i.scrCoords[2]-h],!1,!0)),this},handleTouchpoints:function(t,e,i,s){var r,o,n,a,h,l,c;return(s.evFirst||s.evLast)&&(n=a=h=l=c=0,r=t.point1.evalVisProp("size")+t.point1.evalVisProp("strokewidth"),o=t.point2.evalVisProp("size")+t.point2.evalVisProp("strokewidth"),s.evFirst&&t.evalVisProp("touchfirstpoint")&&t.point1.evalVisProp("visible")&&(n=e.distance(constants.A.COORDS_BY_SCREEN,i),a=(i.scrCoords[1]-e.scrCoords[1])*r/n,h=(i.scrCoords[2]-e.scrCoords[2])*r/n),s.evLast&&t.evalVisProp("touchlastpoint")&&t.point2.evalVisProp("visible")&&(n=e.distance(constants.A.COORDS_BY_SCREEN,i),l=(i.scrCoords[1]-e.scrCoords[1])*o/n,c=(i.scrCoords[2]-e.scrCoords[2])*o/n),e.setCoordinates(constants.A.COORDS_BY_SCREEN,[e.scrCoords[1]+a,e.scrCoords[2]+h],!1,!0),i.setCoordinates(constants.A.COORDS_BY_SCREEN,[i.scrCoords[1]-l,i.scrCoords[2]-c],!1,!0)),this},setArrowSize:function(t,e){return e.evFirst&&this._setArrowWidth(t.rendNodeTriangleStart,e.showFirst*e.strokeWidth,t.rendNode,e.sizeFirst),e.evLast&&this._setArrowWidth(t.rendNodeTriangleEnd,e.showLast*e.strokeWidth,t.rendNode,e.sizeLast),this},setLineCap:function(t){},drawTicks:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"path")},updateTicks:function(t){},drawEllipse:function(t){t.rendNode=this.appendChildPrim(this.createPrim("ellipse",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"ellipse"),this.updateEllipse(t)},updateEllipse:function(t){this._updateVisual(t);var e=t.Radius();Math.abs(t.center.coords.usrCoords[0])>math.A.eps&&!isNaN(e+t.center.coords.scrCoords[1]+t.center.coords.scrCoords[2])&&e*t.board.unitX<2e6&&this.updateEllipsePrim(t.rendNode,t.center.coords.scrCoords[1],t.center.coords.scrCoords[2],e*t.board.unitX,e*t.board.unitY),this.setLineCap(t)},drawPolygon:function(t){t.rendNode=this.appendChildPrim(this.createPrim("polygon",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"polygon"),this.updatePolygon(t)},updatePolygon:function(t){this._updateVisual(t,{stroke:!0,dash:!0}),this.updatePolygonPrim(t.rendNode,t)},displayCopyright:function(t,e){},displayLogo:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var e,i,s,r;"html"===t.evalVisProp("display")&&env.A.isBrowser&&"no"!==this.type?((e=this.container.ownerDocument.createElement("div")).style.position="absolute",e.className=t.evalVisProp("cssclass"),s=t.evalVisProp("layer"),utils_type.A.exists(s)||(s=0),i=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),e.style.zIndex=i+s,this.container.appendChild(e),e.setAttribute("id",this.container.id+"_"+t.id)):e=this.drawInternalText(t),t.rendNode=e,t.htmlStr="",t.visProp.islabel&&utils_type.A.exists(t.visProp.anchor)?(r=t.visProp.anchor.evalVisProp("visible"),t.prepareUpdate().updateVisibility(r)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateText:function(t){var e,i,s,r,o,n,a,h,l,c,u,d=t.plaintext;if(t.visPropCalc.visible)if(this.updateTextStyle(t,!1),"html"===t.evalVisProp("display")&&"no"!==this.type){if(isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(i=t.coords.scrCoords[1],i=Math.abs(i)<1e6?i:1e6,"right"===(o=t.getAnchorX())?(e=t.board.canvasWidth-i,c="right"):"middle"===o?(e=i-.5*t.size[0],c="center"):(e=i,c="left"),t.visPropOld.left!==o+e&&("right"===o?(t.rendNode.style.right=e+"px",t.rendNode.style.left="auto"):(t.rendNode.style.left=e+"px",t.rendNode.style.right="auto"),t.visPropOld.left=o+e),i=t.coords.scrCoords[2]+this.vOffsetText,i=Math.abs(i)<1e6?i:1e6,"bottom"===(n=t.getAnchorY())?(e=t.board.canvasHeight-i,u="bottom"):"middle"===n?(e=i-.5*t.size[1],u="center"):(e=i,u="top"),t.visPropOld.top!==n+e&&("bottom"===n?(t.rendNode.style.top="auto",t.rendNode.style.bottom=e+"px"):(t.rendNode.style.bottom="auto",t.rendNode.style.top=e+"px"),t.visPropOld.top=n+e)),t.htmlStr!==d){try{t.type===utils_type.A.OBJECT_TYPE_BUTTON?t.rendNodeButton.innerHTML=d:t.type===utils_type.A.OBJECT_TYPE_CHECKBOX||t.type===utils_type.A.OBJECT_TYPE_INPUT?t.rendNodeLabel.innerHTML=d:t.rendNode.innerHTML=d}catch(e){s=t.rendNode.parentNode,t.rendNode.parentNode.removeChild(t.rendNode),t.rendNode.innerHTML=d,s.appendChild(t.rendNode)}if(t.htmlStr=d,t.evalVisProp("usemathjax"))try{MathJax.typeset?MathJax.typeset([t.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.rendNode])}catch(t){jxg.A.debug("MathJax (not yet) loaded")}else if(t.evalVisProp("usekatex"))try{(r=0===t.rendNode.innerHTML.indexOf("<span")&&t.rendNode.innerHTML.indexOf("<label")>0&&(t.rendNode.innerHTML.indexOf("<checkbox")>0||t.rendNode.innerHTML.indexOf("<input")>0)?t.rendNodeLabel:0===t.rendNode.innerHTML.indexOf("<button")?t.rendNodeButton:t.rendNode)&&katex.render(d,r,{macros:t.evalVisProp("katexmacros"),throwOnError:!1})}catch(t){jxg.A.debug("KaTeX not loaded (yet)")}else if(t.evalVisProp("useasciimathml"))try{AMprocessNode(t.rendNode,!1)}catch(t){jxg.A.debug("AsciiMathML not loaded (yet)")}}0!==(a=t.evalVisProp("rotate"))&&(a*=Math.PI/180,h=Math.cos(a),l=Math.sin(a),t.rendNode.style.transform="matrix("+[h,-1*l,l,h,0,0].join(",")+")",t.rendNode.style["transform-origin"]=c+" "+u),this.transformRect(t,t.transformations)}else this.updateInternalText(t)},_css2js:function(t){var e,i,s,r,o,n=[],a=utils_type.A.trim(t).replace(/;$/,"").split(";");for(i=a.length,e=0;e<i;++e)""!==utils_type.A.trim(a[e])&&(o=a[e].split(":"),s=utils_type.A.trim(o[0].replace(/-([a-z])/gi,function(t,e){return e.toUpperCase()})),r=utils_type.A.trim(o[1]),n.push({key:s,val:r}));return n},updateTextStyle:function(t,e){var i,s,r,o,n,a,h,l,c,u=env.A.isBrowser?t.visProp.display:"internal",d=["rendNode","rendNodeTag","rendNodeLabel"],p=d.length,f=t.evalVisProp("fontunit"),_=["cssdefaultstyle","cssstyle"],g=_.length;if(e?(r=t.evalVisProp("highlightstrokecolor"),s=t.evalVisProp("highlightstrokeopacity"),o=t.evalVisProp("highlightcssclass")):(r=t.evalVisProp("strokecolor"),s=t.evalVisProp("strokeopacity"),o=t.evalVisProp("cssclass")),"no"!==this.type&&("html"===u||"canvas"!==this.type)){for(l=0;l<g;l++)for(c=t.evalVisProp((e?"highlight":"")+_[l]),n=0;n<p;n++)if(utils_type.A.exists(t[d[n]])&&""!==c&&t.visPropOld[_[l]+"_"+n]!==c){for(h in a=this._css2js(c))a.hasOwnProperty(h)&&(t[d[n]].style[a[h].key]=a[h].val);t.visPropOld[_[l]+"_"+n]=c}if(i=t.evalVisProp("fontsize"),t.visPropOld.fontsize!==i){t.needsSizeUpdate=!0;try{for(n=0;n<p;n++)utils_type.A.exists(t[d[n]])&&(t[d[n]].style.fontSize=i+f)}catch(e){for(n=0;n<p;n++)utils_type.A.exists(t[d[n]])&&(t[d[n]].style.fontSize=i)}t.visPropOld.fontsize=i}}return this.setTabindex(t),this.setObjectTransition(t),"html"===u&&"no"!==this.type?(t.visPropOld.cssclass!==o&&(t.rendNode.className=o,t.visPropOld.cssclass=o,t.needsSizeUpdate=!0),this.setObjectStrokeColor(t,r,s)):this.updateInternalTextStyle(t,r,s),t.evalVisProp("aria.enabled")&&this.setARIA(t),this},updateInternalTextStyle:function(t,e,i){this.setObjectStrokeColor(t,e,i)},drawImage:function(t){},updateImage:function(t){this.updateRectPrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),this.updateImageURL(t),this.transformRect(t,t.transformations),this._updateVisual(t,{stroke:!0,dash:!0},!0)},joinTransforms:function(t,e){var i,s=t.board.origin.scrCoords[1],r=t.board.origin.scrCoords[2],o=t.board.unitX,n=t.board.unitY,a=e.length,h=[[1,0,0],[-s/o,1/o,0],[r/n,0,-1/n]];for(i=0;i<a;i++)h=math.A.matMatMult(e[i].matrix,h);return h=math.A.matMatMult([[1,0,0],[s,o,0],[r,0,-n]],h)},transformRect:function(t,e){},updateImageURL:function(t){},updateImageStyle:function(t,e){t.rendNode.className=t.evalVisProp(e?"highlightcssclass":"cssclass")},drawForeignObject:function(t){},updateForeignObject:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},createPrim:function(t,e){return null},remove:function(t){},makeArrows:function(t,e){},_setArrowWidth:function(t,e,i){},updateEllipsePrim:function(t,e,i,s,r){},updateLinePrim:function(t,e,i,s,r,o){},updatePathPrim:function(t,e,i){},updatePathStringPoint:function(t,e,i){},updatePathStringPrim:function(t){},updatePathStringBezierPrim:function(t){},updatePolygonPrim:function(t,e){},updateRectPrim:function(t,e,i,s,r){},display:function(t,e){t&&(t.visPropOld.visible=e)},hide:function(t){},highlight:function(t,e){var i,s,r;if(this.setObjectTransition(t),!t.visProp.draft){if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")),s=t.evalVisProp("highlightbystrokewidth"),i=0;i<t.borders.length;i++)this.highlight(t.borders[i],!s);else t.elementClass===constants.A.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!0):t.type===constants.A.OBJECT_TYPE_IMAGE?(this.updateImageStyle(t,!0),this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity"))):(this.setObjectStrokeColor(t,t.evalVisProp("highlightstrokecolor"),t.evalVisProp("highlightstrokeopacity")),this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")));!e&&t.evalVisProp("highlightstrokewidth")&&(r=Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")),this.setObjectStrokeWidth(t,r),t.elementClass!==constants.A.OBJECT_CLASS_LINE&&t.elementClass!==constants.A.OBJECT_CLASS_CURVE||this.updatePathWithArrowHeads(t,!0))}return this.setCssClass(t,t.evalVisProp("highlightcssclass")),this},noHighlight:function(t){var e,i;if(this.setObjectTransition(t),!t.evalVisProp("draft")){if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")),e=0;e<t.borders.length;e++)this.noHighlight(t.borders[e]);else t.elementClass===constants.A.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!1):t.type===constants.A.OBJECT_TYPE_IMAGE?(this.updateImageStyle(t,!1),this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity"))):(this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")));i=t.evalVisProp("strokewidth"),this.setObjectStrokeWidth(t,i),t.elementClass!==constants.A.OBJECT_CLASS_LINE&&t.elementClass!==constants.A.OBJECT_CLASS_CURVE||this.updatePathWithArrowHeads(t,!1)}return this.setCssClass(t,t.evalVisProp("cssclass")),this},removeDraft:function(t){this.setObjectTransition(t),t.type===constants.A.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")):(t.type===constants.A.OBJECT_CLASS_POINT&&this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")),this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("strokewidth")))},setARIA:function(t){},setBuffering:function(t,e){},setCssClass:function(t,e){},setDashStyle:function(t){},setDraft:function(t){if(t.evalVisProp("draft")){var e=t.board.options.elements.draft.color,i=t.board.options.elements.draft.opacity;this.setObjectTransition(t),t.type===constants.A.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,e,i):(t.elementClass===constants.A.OBJECT_CLASS_POINT?this.setObjectFillColor(t,e,i):this.setObjectFillColor(t,"none",0),this.setObjectStrokeColor(t,e,i),this.setObjectStrokeWidth(t,t.board.options.elements.draft.strokeWidth))}},setGradient:function(t){},setLayer:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setObjectTransition:function(t,e){},setPropertyPrim:function(t,e,i){},setShadow:function(t){},setTabindex:function(t){},show:function(t){},updateGradient:function(t){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(t,e){var i,s,r=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},o=function(e,o,n,a){var h;n=n||"",(h=i.createElement("span")).innerHTML=e,h.style.paddingLeft="7px",h.style.paddingRight="7px",void 0!==h.classList&&(h.classList.add("JXG_navigation_button"),h.classList.add("JXG_navigation_button_"+a)),h.setAttribute("id",n+"_navigation_"+a),h.setAttribute("aria-hidden","true"),s.appendChild(h),env.A.addEvent(h,"click",function(e){return utils_type.A.bind(o,t)(),!1},t),env.A.addEvent(h,"pointerup",r,t),env.A.addEvent(h,"pointerdown",r,t),env.A.addEvent(h,"pointerleave",r,t),env.A.addEvent(h,"mouseup",r,t),env.A.addEvent(h,"mousedown",r,t),env.A.addEvent(h,"touchend",r,t),env.A.addEvent(h,"touchstart",r,t)};env.A.isBrowser&&"no"!==this.type&&(i=t.containerObj.ownerDocument,(s=i.createElement("div")).setAttribute("id",t.container+"_navigationbar"),s.style.color=e.strokecolor,s.style.backgroundColor=e.fillcolor,s.style.padding=e.padding,s.style.position=e.position,s.style.fontSize=e.fontsize,s.style.cursor=e.cursor,s.style.zIndex=e.zindex,t.containerObj.appendChild(s),s.style.right=e.right,s.style.bottom=e.bottom,void 0!==s.classList&&s.classList.add("JXG_navigation"),t.attr.showfullscreen&&o(t.attr.fullscreen.symbol,function(){t.toFullscreen(t.attr.fullscreen.id)},t.container,"fullscreen"),t.attr.showscreenshot&&o(t.attr.screenshot.symbol,function(){window.setTimeout(function(){t.renderer.screenshot(t,"",!1)},330)},t.container,"screenshot"),t.attr.showreload&&o("↻",function(){t.reload()},t.container,"reload"),t.attr.showcleartraces&&o("⊗",function(){t.clearTraces()},t.container,"cleartraces"),t.attr.shownavigation&&(t.attr.showzoom&&(o("–",t.zoomOut,t.container,"out"),o("o",t.zoom100,t.container,"100"),o("+",t.zoomIn,t.container,"in")),o("←",t.clickLeftArrow,t.container,"left"),o("↓",t.clickUpArrow,t.container,"down"),o("↑",t.clickDownArrow,t.container,"up"),o("→",t.clickRightArrow,t.container,"right")))},getElementById:function(t){var e;return utils_type.A.exists(this.container)?(e=this.container.id+"_"+t,utils_type.A.exists(CSS)&&utils_type.A.exists(CSS.escape)&&(e=CSS.escape(e)),this.container.querySelector("#"+e)):""},removeToInsertLater:function(t){var e=t.parentNode,i=t.nextSibling;if(null!==e)return e.removeChild(t),function(){i?e.insertBefore(t,i):e.appendChild(t)}},resize:function(t,e){},createTouchpoints:function(t){},showTouchpoint:function(t){},hideTouchpoint:function(t){},updateTouchpoint:function(t,e){},dumpToDataURI:function(t){},dumpToCanvas:function(t,e,i,s){},screenshot:function(t){}});var renderer_abstract=jxg.A.AbstractRenderer,UTF8_ACCEPT=0,UTF8D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,0,12,24,36,60,96,84,12,12,12,48,72,12,12,12,12,12,12,12,12,12,12,12,12,12,0,12,12,12,12,12,0,12,0,12,12,12,24,12,12,12,12,12,24,12,24,12,12,12,12,12,12,12,12,12,24,12,12,12,12,12,24,12,12,12,12,12,12,12,24,12,12,12,12,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,12,12,12,12,12];jxg.A.Util=jxg.A.Util||{},jxg.A.Util.UTF8={encode:function(t){var e,i,s="",r=t.length;if(t=t.replace(/\r\n/g,"\n"),"function"==typeof unescape&&"function"==typeof encodeURIComponent)return unescape(encodeURIComponent(t));for(e=0;e<r;e++)(i=t.charCodeAt(e))<128?s+=String.fromCharCode(i):i>127&&i<2048?(s+=String.fromCharCode(i>>6|192),s+=String.fromCharCode(63&i|128)):(s+=String.fromCharCode(i>>12|224),s+=String.fromCharCode(i>>6&63|128),s+=String.fromCharCode(63&i|128));return s},decode:function(t){var e,i,s,r=0,o=0,n=UTF8_ACCEPT,a=[],h=t.length,l=[];for(e=0;e<h;e++)i=t.charCodeAt(e),s=UTF8D[i],o=n!==UTF8_ACCEPT?63&i|o<<6:255>>s&i,(n=UTF8D[256+n+s])===UTF8_ACCEPT&&(o>65535?a.push(55232+(o>>10),56320+(1023&o)):a.push(o),++r%1e4==0&&(l.push(String.fromCharCode.apply(null,a)),a=[]));return l.push(String.fromCharCode.apply(null,a)),l.join("")},asciiCharCodeAt:function(t,e){var i=t.charCodeAt(e);if(i>255)switch(i){case 8364:i=128;break;case 8218:i=130;break;case 402:i=131;break;case 8222:i=132;break;case 8230:i=133;break;case 8224:i=134;break;case 8225:i=135;break;case 710:i=136;break;case 8240:i=137;break;case 352:i=138;break;case 8249:i=139;break;case 338:i=140;break;case 381:i=142;break;case 8216:i=145;break;case 8217:i=146;break;case 8220:i=147;break;case 8221:i=148;break;case 8226:i=149;break;case 8211:i=150;break;case 8212:i=151;break;case 732:i=152;break;case 8482:i=153;break;case 353:i=154;break;case 8250:i=155;break;case 339:i=156;break;case 382:i=158;break;case 376:i=159}return i}};var utils_encoding=jxg.A.Util.UTF8,alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pad="=";jxg.A.Util=jxg.A.Util||{},jxg.A.Util.Base64={_getByte:function(t,e){return 255&t.charCodeAt(e)},_getIndex:function(t,e){return alphabet.indexOf(t.charAt(e))},encode:function(t){var e,i,s,r,o,n=[];for(r=(s=(o=utils_encoding.encode(t)).length)%3,e=0;e<s-r;e+=3)i=this._getByte(o,e)<<16|this._getByte(o,e+1)<<8|this._getByte(o,e+2),n.push(alphabet.charAt(i>>18),alphabet.charAt(i>>12&63),alphabet.charAt(i>>6&63),alphabet.charAt(63&i));switch(r){case 1:i=this._getByte(o,s-1),n.push(alphabet.charAt(i>>2),alphabet.charAt(i<<4&63),pad,pad);break;case 2:i=this._getByte(o,s-2)<<8|this._getByte(o,s-1),n.push(alphabet.charAt(i>>10),alphabet.charAt(i>>4&63),alphabet.charAt(i<<2&63),pad)}return n.join("")},decode:function(t,e){var i,s,r,o,n,a,h=[],l=[];if((r=(i=t.replace(/[^A-Za-z0-9+/=]/g,"")).length)%4!=0)throw new Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(i.charAt(r-1)===pad&&(o=1,i.charAt(r-2)===pad&&(o=2),r-=4),s=0;s<r;s+=4)n=this._getIndex(i,s)<<18|this._getIndex(i,s+1)<<12|this._getIndex(i,s+2)<<6|this._getIndex(i,s+3),l.push(n>>16,n>>8&255,255&n),s%1e4==0&&(h.push(String.fromCharCode.apply(null,l)),l=[]);switch(o){case 1:n=this._getIndex(i,r)<<12|this._getIndex(i,r+1)<<6|this._getIndex(i,r+2),l.push(n>>10,n>>2&255);break;case 2:n=this._getIndex(i,s)<<6|this._getIndex(i,s+1),l.push(n>>4)}return h.push(String.fromCharCode.apply(null,l)),a=h.join(""),e&&(a=utils_encoding.decode(a)),a},decodeAsArray:function(t){var e,i=this.decode(t),s=[],r=i.length;for(e=0;e<r;e++)s[e]=i.charCodeAt(e);return s}};var base64=jxg.A.Util.Base64;jxg.A.FileReader={handleRemoteFile:function(t,e,i,s,r,o){var n=!1;try{n=new XMLHttpRequest,"raw"===i.toLowerCase()?n.overrideMimeType("text/plain; charset="+r):n.overrideMimeType("text/xml; charset="+r)}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){n=!1}}}if(n){n.open("GET",t,s),"raw"===i.toLowerCase()?this.cbp=function(){var t=n;4===t.readyState&&e(t.responseText)}:this.cbp=function(){var t=n,s="";4===t.readyState&&(s=!utils_type.A.exists(t.responseStream)||"PK"!==t.responseText.slice(0,2)&&31!==utils_encoding.asciiCharCodeAt(t.responseText.slice(0,1),0)?t.responseText:base64.decode(jxgBinFileReader(t)),this.parseString(s,e,i,o))},this.cb=utils_type.A.bind(this.cbp,this),n.onreadystatechange=this.cb;try{n.send(null)}catch(e){throw new Error("JSXGraph: A problem occurred while trying to read remote file '"+t+"'.")}}else jxg.A.debug("AJAX not activated!")},handleLocalFile:function(t,e,i,s,r,o){utils_type.A.exists(s)||(s=!0),"raw"===i.toLowerCase()?this.cbp=function(t){e(t.target.result)}:this.cbp=function(t){var s=t.target.result;this.parseString(s,e,i,o)},this.cb=utils_type.A.bind(this.cbp,this);var n=new FileReader;n.onload=this.cb,"raw"===i.toLowerCase()?n.readAsText(t):n.readAsText(t,r)},parseFileContent:function(t,e,i,s,r,o){utils_type.A.isString(t)||void 0===FileReader?this.handleRemoteFile(t,e,i,s,r,o):this.handleLocalFile(t,e,i,s,r,o)},parseString:function(t,e,i,s){var r;if(i=i.toLowerCase(),r=jxg.A.readers[i],utils_type.A.exists(r))new r(e,t).read();else if("jessiecode"!==i)throw new Error("JSXGraph: There is no reader available for '"+i+"'.");utils_type.A.isFunction(s)&&s(e)}},!env.A.isMetroApp()&&env.A.isBrowser&&"object"==typeof navigator&&/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&document&&document.write&&document.write('<script type="text/vbscript">\nFunction Base64Encode(inData)\n  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"\n  Dim cOut, sOut, I\n  For I = 1 To LenB(inData) Step 3\n    Dim nGroup, pOut, sGroup\n    nGroup = &H10000 * AscB(MidB(inData, I, 1)) + _\n      &H100 * MyASC(MidB(inData, I + 1, 1)) + MyASC(MidB(inData, I + 2, 1))\n    nGroup = Oct(nGroup)\n    nGroup = String(8 - Len(nGroup), "0") & nGroup\n    pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _\n      Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _\n      Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _\n      Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)\n    sOut = sOut + pOut\n  Next\n  Select Case LenB(inData) Mod 3\n    Case 1: \'8 bit final\n      sOut = Left(sOut, Len(sOut) - 2) + "=="\n    Case 2: \'16 bit final\n      sOut = Left(sOut, Len(sOut) - 1) + "="\n  End Select\n  Base64Encode = sOut\nEnd Function\n\nFunction MyASC(OneChar)\n  If OneChar = "" Then MyASC = 0 Else MyASC = AscB(OneChar)\nEnd Function\n\nFunction jxgBinFileReader(xhr)\n    Dim byteString\n    Dim b64String\n    Dim i\n    byteString = xhr.responseBody\n    ReDim byteArray(LenB(byteString))\n    For i = 1 To LenB(byteString)\n        byteArray(i-1) = AscB(MidB(byteString, i, 1))\n    Next\n    b64String = Base64Encode(byteString)\n    jxgBinFileReader = b64String\nEnd Function\n<\/script>\n');var reader_file=jxg.A.FileReader,geonext=__webpack_require__(86),jessiecode=__webpack_require__(428),utils_color=__webpack_require__(873);jxg.A.Composition=function(t){var e,i=this,s=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],r=function(t){return function(){var e;for(e in i.elements)i.elements.hasOwnProperty(e)&&utils_type.A.exists(i.elements[e][t])&&i.elements[e][t].apply(i.elements[e],arguments);return i}};for(e=0;e<s.length;e++)this[s[e]]=r(s[e]);for(e in this.elements={},this.objects=this.elements,this.elementsByName={},this.objectsList=[],this.groups={},this.methodMap={setAttribute:"setAttribute",setProperty:"setAttribute",setParents:"setParents",add:"add",remove:"remove",select:"select"},t)t.hasOwnProperty(e)&&this.add(e,t[e]);this.dump=!0,this.subs={}},jxg.A.extend(jxg.A.Composition.prototype,{add:function(t,e){return!(utils_type.A.exists(this[t])||!utils_type.A.exists(e))&&(utils_type.A.exists(e.id)?this.elements[e.id]=e:this.elements[t]=e,utils_type.A.exists(e.name)&&(this.elementsByName[e.name]=e),e.on("attribute:name",this.nameListener,this),this.objectsList.push(e),this[t]=e,this.methodMap[t]=e,!0)},remove:function(t){var e,i=!1;for(e in this.elements)if(this.elements.hasOwnProperty(e)&&this.elements[e].id===this[t].id){i=!0;break}return i&&(delete this.elements[this[t].id],delete this[t]),i},nameListener:function(t,e,i){delete this.elementsByName[t],this.elementsByName[e]=i},select:function(t){return utils_type.A.exists(jxg.A.Board)?jxg.A.Board.prototype.select.call(this,t):new jxg.A.Composition},getParents:function(){return this.parents},getType:function(){return this.elType},getAttributes:function(){var t,e={};for(t in this.subs)this.subs.hasOwnProperty(t)&&(e[t]=this.subs[t].visProp);return this.attr}});var composition=jxg.A.Composition;jxg.A.Board=function(t,e,i,s,r,o,n,a,h,l,c){if(this.BOARD_MODE_NONE=0,this.BOARD_MODE_DRAG=1,this.BOARD_MODE_MOVE_ORIGIN=2,this.BOARD_MODE_ZOOM=17,this.BOARD_QUALITY_LOW=1,this.BOARD_QUALITY_HIGH=2,utils_type.A.exists(c.document)&&!1!==c.document?this.document=c.document:env.A.isBrowser&&(this.document=document),this.container="",this.id="",this.containerObj=null,utils_type.A.isString(t)?(this.container=t,this.containerObj=env.A.isBrowser?this.document.getElementById(this.container):null):env.A.isBrowser&&(this.containerObj=t,this.container=this.containerObj.getAttribute("id"),null===this.container&&(this.container="null"+parseInt(16777216*Math.random()).toString())),env.A.isBrowser&&"no"!==e.type&&null===this.containerObj)throw new Error('\nJSXGraph: HTML container element "'+t+'" not found.');utils_type.A.exists(i)&&""!==i&&env.A.isBrowser&&!utils_type.A.exists(this.document.getElementById(i))?this.id=i:this.id=this.generateId(),this.renderer=e,this.grids=[],this.options=utils_type.A.deepCopy(src_options.A),this.attr=c,"default"!==this.attr.theme&&utils_type.A.exists(jxg.A.themes[this.attr.theme])&&utils_type.A.mergeAttr(this.options,jxg.A.themes[this.attr.theme],!0),this.dimension=2,this.jc=new jessiecode.A,this.jc.use(this),this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,s[0],s[1]],this.zoomX=r,this.zoomY=o,this.unitX=n*this.zoomX,this.unitY=a*this.zoomY,this.keepaspectratio=!1,this.canvasWidth=h,this.canvasHeight=l,utils_event.A.eventify(this),this.hooks=[],this.dependentBoards=[],this.inUpdate=!1,this.objects={},this.objectsList=[],this.groups={},this.animationObjects={},this.highlightedObjects={},this.numObjects=0,this.elementsByName={},this.mode=this.BOARD_MODE_NONE,this.updateQuality=this.BOARD_QUALITY_HIGH,this.isSuspendedRedraw=!1,this.calculateSnapSizes(),this.drag_dx=0,this.drag_dy=0,this.drag_position=[0,0],this.mouse={},this.touches=[],this.xmlString="",this.cPos=[],this.touchMoveLast=0,this.touchMoveLastId=1/0,this.positionAccessLast=0,this.downObjects=[],this.clickObjects={},this.focusObjects=[],(this.attr.showcopyright||this.attr.showlogo)&&this.renderer.displayLogo(constants.A.licenseLogo,parseInt(this.options.text.fontSize,10),this),this.attr.showcopyright&&this.renderer.displayCopyright(constants.A.licenseText,parseInt(this.options.text.fontSize,10)),this.needsFullUpdate=!1,this.reducedUpdate=!1,this.currentCBDef="none",this.geonextCompatibilityMode=!1,this.options.text.useASCIIMathML&&translateASCIIMath?init():this.options.text.useASCIIMathML=!1,this.hasMouseHandlers=!1,this.hasTouchHandlers=!1,this.hasPointerHandlers=!1,this.hasWheelHandlers=!1,this.hasMouseUp=!1,this.hasTouchEnd=!1,this.hasPointerUp=!1,this.resizeHandlers=[],this._drag_offset=[0,0],this._inputDevice="mouse",this._board_touches=[],this.selectingMode=!1,this.isSelecting=!1,this._isScrolling=!1,this._isResizing=!1,this._change3DView=!1,this.selectingBox=[[0,0],[0,0]],this.userLog=[],this.mathLib=Math,this.mathLibJXG=jxg.A.Math,!0===this.attr.registerevents?this.attr.registerevents={fullscreen:!0,keyboard:!0,pointer:!0,resize:!0,wheel:!0}:"object"==typeof this.attr.registerevents&&(utils_type.A.exists(this.attr.registerevents.fullscreen)||(this.attr.registerevents.fullscreen=!0),utils_type.A.exists(this.attr.registerevents.keyboard)||(this.attr.registerevents.keyboard=!0),utils_type.A.exists(this.attr.registerevents.pointer)||(this.attr.registerevents.pointer=!0),utils_type.A.exists(this.attr.registerevents.resize)||(this.attr.registerevents.resize=!0),utils_type.A.exists(this.attr.registerevents.wheel)||(this.attr.registerevents.wheel=!0)),!1!==this.attr.registerevents&&(this.attr.registerevents.fullscreen&&this.addFullscreenEventHandlers(),this.attr.registerevents.keyboard&&this.addKeyboardEventHandlers(),this.attr.registerevents.pointer&&this.addEventHandlers(),this.attr.registerevents.resize&&this.addResizeEventHandlers(),this.attr.registerevents.wheel&&this.addWheelEventHandlers()),this.methodMap={update:"update",fullUpdate:"fullUpdate",on:"on",off:"off",trigger:"trigger",setAttribute:"setAttribute",setBoundingBox:"setBoundingBox",setView:"setBoundingBox",getBoundingBox:"getBoundingBox",BoundingBox:"getBoundingBox",getView:"getBoundingBox",View:"getBoundingBox",migratePoint:"migratePoint",colorblind:"emulateColorblindness",suspendUpdate:"suspendUpdate",unsuspendUpdate:"unsuspendUpdate",clearTraces:"clearTraces",left:"clickLeftArrow",right:"clickRightArrow",up:"clickUpArrow",down:"clickDownArrow",zoomIn:"zoomIn",zoomOut:"zoomOut",zoom100:"zoom100",zoomElements:"zoomElements",remove:"removeObject",removeObject:"removeObject"}},jxg.A.extend(jxg.A.Board.prototype,{generateName:function(t){var e,i,s=this.attr.maxnamelength,r="",o="",n=[],a="";if(t.type===constants.A.OBJECT_TYPE_TICKS)return"";for(e=utils_type.A.isPoint(t)||utils_type.A.isPoint3D(t)?["","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]:t.type===constants.A.OBJECT_TYPE_ANGLE?["","&alpha;","&beta;","&gamma;","&delta;","&epsilon;","&zeta;","&eta;","&theta;","&iota;","&kappa;","&lambda;","&mu;","&nu;","&xi;","&omicron;","&pi;","&rho;","&sigma;","&tau;","&upsilon;","&phi;","&chi;","&psi;","&omega;"]:["","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],utils_type.A.isPoint(t)||utils_type.A.isPoint3D(t)||t.elementClass===constants.A.OBJECT_CLASS_LINE||t.type===constants.A.OBJECT_TYPE_ANGLE||(r=t.type===constants.A.OBJECT_TYPE_POLYGON?"P_{":t.elementClass===constants.A.OBJECT_CLASS_CIRCLE?"k_{":t.elementClass===constants.A.OBJECT_CLASS_TEXT?"t_{":"s_{",o="}"),i=0;i<s;i++)n[i]=0;for(;n[s-1]<e.length;){for(n[0]=1;n[0]<e.length;n[0]++){for(a=r,i=s;i>0;i--)a+=e[n[i-1]];if(!utils_type.A.exists(this.elementsByName[a+o]))return a+o}for(n[0]=e.length,i=1;i<s;i++)n[i-1]===e.length&&(n[i-1]=1,n[i]+=1)}return""},generateId:function(){for(var t=1;utils_type.A.exists(jxg.A.boards["jxgBoard"+t]);)t=Math.round(16777216*Math.random());return"jxgBoard"+t},setId:function(t,e){var i,s=this.numObjects,r=t.id;if(this.numObjects+=1,""===r||!utils_type.A.exists(r))for(r=this.id+e+s;utils_type.A.exists(this.objects[r]);)i=Math.round(65535*Math.random()),r=this.id+e+s+"-"+i;return t.id=r,this.objects[r]=t,t._pos=this.objectsList.length,this.objectsList[this.objectsList.length]=t,r},finalizeAdding:function(t){!1===t.evalVisProp("visible")&&this.renderer.display(t,!1)},finalizeLabel:function(t){t.hasLabel&&!t.label.evalVisProp("islabel")&&!1===t.label.evalVisProp("visible")&&this.renderer.display(t.label,!1)},checkFrameRate:function(t){var e=!1,i=(new Date).getTime();return utils_type.A.exists(t.pointerId)&&this.touchMoveLastId!==t.pointerId&&(e=!0,this.touchMoveLastId=t.pointerId),!e&&(i-this.touchMoveLast)*this.attr.maxframerate>=1e3&&(e=!0),e&&(this.touchMoveLast=i),e},getCoordsTopLeftCorner:function(){var t,e,i,s,r,o=this.document.ownerDocument||this.document,n=o.documentElement||this.document.body.parentNode,a=o.body,h=this.containerObj;if(this.cPos.length>0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||(new Date).getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=(new Date).getTime(),h.getBoundingClientRect){for(i=h.getBoundingClientRect(),s=1,r=h;r&&utils_type.A.exists(r.parentNode);)utils_type.A.exists(r.style)&&utils_type.A.exists(r.style.zoom)&&""!==r.style.zoom&&(s*=parseFloat(r.style.zoom)),r=r.parentNode;return(t=[i.left*s,i.top*s])[0]+=env.A.getProp(h,"border-left-width"),t[1]+=env.A.getProp(h,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=env.A.getProp(h,"padding-left"),t[1]+=env.A.getProp(h,"padding-top")),this.cPos=t.slice(),this.cPos}return t=env.A.getOffset(h),e=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&e.defaultView&&(t[0]+=env.A.getProp(n,"margin-left"),t[1]+=env.A.getProp(n,"margin-top"),t[0]+=env.A.getProp(n,"border-left-width"),t[1]+=env.A.getProp(n,"border-top-width"),t[0]+=env.A.getProp(n,"padding-left"),t[1]+=env.A.getProp(n,"padding-top")),a&&(t[0]+=env.A.getProp(a,"left"),t[1]+=env.A.getProp(a,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=env.A.getProp(h,"border-left-width"),t[1]+=env.A.getProp(h,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=env.A.getProp(h,"padding-left"),t[1]+=env.A.getProp(h,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getPointLoc:function(t,e){var i,s,r,o;return i=this.getBoundingBox(),2===(s=t).length&&s.unshift(void 0),r=[0,0],o=e||0,utils_type.A.isNumber(o)&&(o=[o,o,o,o]),s[1]>i[2]-o[1]&&(r[0]=1),s[1]<i[0]+o[3]&&(r[0]=-1),s[2]>i[1]-o[0]&&(r[1]=1),s[2]<i[3]+o[2]&&(r[1]=-1),r},getLocationOrigin:function(t){return this.getPointLoc([0,0],t)},getMousePosition:function(t,e){var i,s,r=this.getCoordsTopLeftCorner();return i=env.A.getPosition(t,e,this.document),this.updateCSSTransforms(),s=[1,i[0]-r[0],i[1]-r[1]],(s=math.A.matVecMult(this.cssTransMat,s))[1]/=s[0],s[2]/=s[0],[s[1],s[2]]},initMoveOrigin:function(t,e){this.drag_dx=t-this.origin.scrCoords[1],this.drag_dy=e-this.origin.scrCoords[2],this.mode=this.BOARD_MODE_MOVE_ORIGIN,this.updateQuality=this.BOARD_QUALITY_LOW},initMoveObject:function(t,e,i,s){var r,o,n,a=[],h=[],l=this.objectsList.length,c={visProp:{layer:-1e4}};for(this._shiftKey=i.shiftKey,this._ctrlKey=i.ctrlKey,o=0;o<l;o++)n=(r=this.objectsList[o]).hasPoint&&r.hasPoint(t,e),r.visPropCalc.visible&&n&&(r.triggerEventHandlers([s+"down","down"],[i]),this.downObjects.push(r)),n&&r.isDraggable&&r.visPropCalc.visible&&(this.geonextCompatibilityMode&&(utils_type.A.isPoint(r)||r.elementClass===constants.A.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!r.evalVisProp("fixed")&&(r.visProp.layer>c.visProp.layer||r.visProp.layer===c.visProp.layer&&r.lastDragTime.getTime()>=c.lastDragTime.getTime())&&(this.attr.ignorelabels&&utils_type.A.exists(c.label)&&r===c.label||(c=r,a.push(c),utils_type.A.exists(c.coords)?c.elementClass===constants.A.OBJECT_CLASS_POINT||c.relativeCoords?h.push(statistics.A.subtract(c.coords.scrCoords.slice(1),[t,e])):h.push(statistics.A.subtract(c.actualCoords.scrCoords.slice(1),[t,e])):h.push([0,0])));return this.attr.drag.enabled&&a.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(a.length=1,this._drag_offset=h[0]):(a=a.slice(-1),this._drag_offset=h[h.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&utils_type.A.exists(a[0])&&a[0].evalVisProp("dragtotopoflayer")&&1===a.length&&utils_type.A.exists(a[0].rendNode)&&a[0].rendNode.parentNode.appendChild(a[0].rendNode),a.length>=1&&(a[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[i,a[0]])),a},moveObject:function(t,e,i,s,r){var o,n,a,h=new base_coords.A(constants.A.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,e),this);i&&i.obj&&((o=i.obj).coords&&(n=o.coords.scrCoords.slice()),this.addLogEntry("drag",o,h.usrCoords.slice(1)),this.drag_position=[h.scrCoords[1],h.scrCoords[2]],this.drag_position=statistics.A.add(this.drag_position,this._drag_offset),this._shiftKey=s.shiftKey,this._ctrlKey=s.ctrlKey,utils_type.A.exists(o.coords)?o.setPositionDirectly(constants.A.COORDS_BY_SCREEN,this.drag_position,[t,e]):(this.displayInfobox(!1),isNaN(i.targets[0].Xprev+i.targets[0].Yprev)||o.setPositionDirectly(constants.A.COORDS_BY_SCREEN,[h.scrCoords[1],h.scrCoords[2]],[i.targets[0].Xprev,i.targets[0].Yprev]),i.targets[0].Xprev=h.scrCoords[1],i.targets[0].Yprev=h.scrCoords[2]),utils_type.A.exists(o.coords)&&(o.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(o),o.prepareUpdate().update(!0).updateRenderer()),o.coords&&(a=o.coords.scrCoords),o.coords&&n[1]===a[1]&&n[2]===a[2]||(o.triggerEventHandlers([r+"drag","drag"],[s]),this.update(o)),o.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[s,o]),o.lastDragTime=new Date)},twoFingerMove:function(t,e,i){var s;utils_type.A.exists(t)&&utils_type.A.exists(t.obj)&&((s=t.obj).elementClass===constants.A.OBJECT_CLASS_LINE||s.type===constants.A.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(t.targets,s,e):s.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(t.targets,s,e),i&&s.triggerEventHandlers(["touchdrag","drag"],[i]))},getTwoFingerTransform(t,e,i,s){var r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y;return o=(r=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this).usrCoords)[1],n=r[2],a=(r=new base_coords.A(constants.A.COORDS_BY_SCREEN,[e.Xprev,e.Yprev],this).usrCoords)[1],h=r[2],u=(r=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.X,t.Y],this).usrCoords)[1],d=r[2],A=((_=(p=(r=new base_coords.A(constants.A.COORDS_BY_SCREEN,[e.X,e.Y],this).usrCoords)[1])-u)*(l=a-o)+(g=(f=r[2])-d)*(c=h-n))/(b=l*l+c*c),m=(g*l-_*c)/b,i||(A/=y=math.A.hypot(A,m),m/=y),s||(m=0),[1,0,0,.5*(u+p-A*(o+a)+m*(n+h)),A,-m,.5*(d+f-m*(o+a)-A*(n+h)),m,A]},twoFingerTouchObject:function(t,e,i){var s,r,o,n,a,h=!1;if(utils_type.A.exists(t[0])&&utils_type.A.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)){if(r=this.getTwoFingerTransform(t[0],t[1],e.evalVisProp("scalable"),e.evalVisProp("rotatable")),(s=this.create("transform",r,{type:"generic"})).update(),e.elementClass===constants.A.OBJECT_CLASS_LINE)o=[],e.point1.draggable()&&o.push(e.point1),e.point2.draggable()&&o.push(e.point2),s.applyOnce(o);else if(e.type===constants.A.OBJECT_TYPE_POLYGON){for(a=e.vertices.length-1,h=e.evalVisProp("snaptogrid")||e.evalVisProp("snaptopoints"),n=0;n<a&&!h;++n)h=(h=h||e.vertices[n].evalVisProp("snaptogrid")||e.vertices[n].evalVisProp("snaptopoints"))||!e.vertices[n].draggable();if(!h){for(o=[],n=0;n<a;++n)e.vertices[n].draggable()&&o.push(e.vertices[n]);s.applyOnce(o)}}this.update(),e.highlight(!0)}},twoFingerTouchCircle:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p;"pointCircle"!==e.method&&"pointLine"!==e.method&&utils_type.A.exists(t[0])&&utils_type.A.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)&&(i===t[0].num?(s=t[1],r=t[0]):(s=t[0],r=t[1]),a=new base_coords.A(constants.A.COORDS_BY_SCREEN,[s.Xprev,s.Yprev],this).usrCoords,n=new base_coords.A(constants.A.COORDS_BY_SCREEN,[r.Xprev,r.Yprev],this).usrCoords,o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[r.X,r.Y],this).usrCoords,l=geometry.A.rad(n.slice(1),a.slice(1),o.slice(1)),c=this.create("transform",[-a[1],-a[2]],{type:"translate"}),u=this.create("transform",[l],{type:"rotate"}),c.melt(u),e.evalVisProp("scalable")&&(h=geometry.A.distance(a,o)/geometry.A.distance(a,n),d=this.create("transform",[h,h],{type:"scale"}),c.melt(d)),p=this.create("transform",[a[1],a[2]],{type:"translate"}),c.melt(p),e.center.draggable()&&c.applyOnce([e.center]),"twoPoints"===e.method?e.point2.draggable()&&c.applyOnce([e.point2]):"pointRadius"===e.method&&utils_type.A.isNumber(e.updateRadius.origin)&&e.setRadius(e.radius*h),this.update(e.center),e.highlight(!0))},highlightElements:function(t,e,i,s){var r,o,n,a={},h=this.objectsList.length;for(r=0;r<h;r++)n=(o=this.objectsList[r]).id,utils_type.A.exists(o.hasPoint)&&o.visPropCalc.visible&&o.hasPoint(t,e)&&(this.updateInfobox(o),utils_type.A.exists(this.highlightedObjects[n])||(a[n]=o,o.highlight(),this.triggerEventHandlers(["mousehit","hit"],[i,o,s])),o.mouseover?o.triggerEventHandlers(["mousemove","move"],[i]):(o.triggerEventHandlers(["mouseover","over"],[i]),o.mouseover=!0));for(r=0;r<h;r++)n=(o=this.objectsList[r]).id,o.mouseover&&(a[n]||(o.triggerEventHandlers(["mouseout","out"],[i]),o.mouseover=!1))},saveStartPos:function(t,e){var i,s,r=[];if(t.type===constants.A.OBJECT_TYPE_TICKS)r.push([1,NaN,NaN]);else if(t.elementClass===constants.A.OBJECT_CLASS_LINE)r.push(t.point1.coords.usrCoords),r.push(t.point2.coords.usrCoords);else if(t.elementClass===constants.A.OBJECT_CLASS_CIRCLE)r.push(t.center.coords.usrCoords),"twoPoints"===t.method&&r.push(t.point2.coords.usrCoords);else if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(s=t.vertices.length-1,i=0;i<s;i++)r.push(t.vertices[i].coords.usrCoords);else if(t.type===constants.A.OBJECT_TYPE_SECTOR)r.push(t.point1.coords.usrCoords),r.push(t.point2.coords.usrCoords),r.push(t.point3.coords.usrCoords);else if(utils_type.A.isPoint(t)||t.type===constants.A.OBJECT_TYPE_GLIDER)r.push(t.coords.usrCoords);else if(t.elementClass===constants.A.OBJECT_CLASS_CURVE)t.points.length>0&&r.push(t.points[0].usrCoords);else try{r.push(t.coords.usrCoords)}catch(t){jxg.A.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+t)}for(s=r.length,i=0;i<s;i++)e.Zstart.push(r[i][0]),e.Xstart.push(r[i][1]),e.Ystart.push(r[i][2])},mouseOriginMoveStart:function(t){var e,i;return(e=this._isRequiredKeyPressed(t,"pan"))&&(i=this.getMousePosition(t),this.initMoveOrigin(i[0],i[1])),e},mouseOriginMove:function(t){var e,i=this.mode===this.BOARD_MODE_MOVE_ORIGIN;return i&&(e=this.getMousePosition(t),this.moveOrigin(e[0],e[1],!0)),i},touchStartMoveOriginOneFinger:function(t){var e,i,s=t.touches;return(e=this.attr.pan.enabled&&!this.attr.pan.needtwofingers&&1===s.length)&&(i=this.getMousePosition(t,0),this.initMoveOrigin(i[0],i[1])),e},touchOriginMove:function(t){var e,i=this.mode===this.BOARD_MODE_MOVE_ORIGIN;return i&&(e=this.getMousePosition(t,0),this.moveOrigin(e[0],e[1],!0)),i},originMoveEnd:function(){this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE},suppressDefault:function(t){return utils_type.A.exists(t)&&t.preventDefault(),!1},addEventHandlers:function(){env.A.supportsPointerEvents()?this.addPointerEventHandlers():(this.addMouseEventHandlers(),this.addTouchEventHandlers()),null!==this.containerObj&&env.A.addEvent(this.containerObj,"contextmenu",this.suppressDefault,this)},removeEventHandlers:function(){(this.hasPointerHandlers||this.hasMouseHandlers||this.hasTouchHandlers)&&null!==this.containerObj&&env.A.removeEvent(this.containerObj,"contextmenu",this.suppressDefault,this),this.removeMouseEventHandlers(),this.removeTouchEventHandlers(),this.removePointerEventHandlers(),this.removeFullscreenEventHandlers(),this.removeKeyboardEventHandlers(),this.removeResizeEventHandlers()},addResizeEventHandlers:function(){if(this.resizeHandlers=[],env.A.isBrowser){try{this.startResizeObserver(),this.resizeHandlers.push("resizeobserver")}catch(t){env.A.addEvent(window,"resize",this.resizeListener,this),this.startIntersectionObserver(),this.resizeHandlers.push("resize")}env.A.addEvent(window,"scroll",this.scrollListener,this),this.resizeHandlers.push("scroll");try{window.matchMedia("print").addEventListener("change",this.printListenerMatch.bind(this)),window.matchMedia("screen").addEventListener("change",this.printListenerMatch.bind(this)),this.resizeHandlers.push("print")}catch(t){jxg.A.debug("Error adding printListener",t)}}},removeResizeEventHandlers:function(){var t;if(this.resizeHandlers.length>0&&env.A.isBrowser){for(t=0;t<this.resizeHandlers.length;t++)switch(this.resizeHandlers[t]){case"resizeobserver":utils_type.A.exists(this.resizeObserver)&&this.stopResizeObserver();break;case"resize":env.A.removeEvent(window,"resize",this.resizeListener,this),utils_type.A.exists(this.intersectionObserver)&&this.stopIntersectionObserver();break;case"scroll":env.A.removeEvent(window,"scroll",this.scrollListener,this);break;case"print":window.matchMedia("print").removeEventListener("change",this.printListenerMatch.bind(this),!1),window.matchMedia("screen").removeEventListener("change",this.printListenerMatch.bind(this),!1)}this.resizeHandlers=[]}},addPointerEventHandlers:function(){if(!this.hasPointerHandlers&&env.A.isBrowser){var t=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(env.A.addEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),env.A.addEvent(t,"MSPointerMove",this.pointerMoveListener,this)):(env.A.addEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),env.A.addEvent(t,"pointermove",this.pointerMoveListener,this),env.A.addEvent(t,"pointerleave",this.pointerLeaveListener,this),env.A.addEvent(t,"click",this.pointerClickListener,this),env.A.addEvent(t,"dblclick",this.pointerDblClickListener,this)),null!==this.containerObj&&(this.containerObj.style.touchAction="none"),this.hasPointerHandlers=!0}},addMouseEventHandlers:function(){if(!this.hasMouseHandlers&&env.A.isBrowser){var t=this.attr.movetarget||this.containerObj;env.A.addEvent(this.containerObj,"mousedown",this.mouseDownListener,this),env.A.addEvent(t,"mousemove",this.mouseMoveListener,this),env.A.addEvent(t,"click",this.mouseClickListener,this),env.A.addEvent(t,"dblclick",this.mouseDblClickListener,this),this.hasMouseHandlers=!0}},addTouchEventHandlers:function(t){if(!this.hasTouchHandlers&&env.A.isBrowser){var e=this.attr.movetarget||this.containerObj;env.A.addEvent(this.containerObj,"touchstart",this.touchStartListener,this),env.A.addEvent(e,"touchmove",this.touchMoveListener,this),this.hasTouchHandlers=!0}},addWheelEventHandlers:function(){!this.hasWheelHandlers&&env.A.isBrowser&&(env.A.addEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),env.A.addEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this),this.hasWheelHandlers=!0)},addFullscreenEventHandlers:function(){var t,e=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],i=e.length;if(!this.hasFullscreenEventHandlers&&env.A.isBrowser){for(t=0;t<i;t++)env.A.addEvent(this.document,e[t],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!0}},addKeyboardEventHandlers:function(){this.attr.keyboard.enabled&&!this.hasKeyboardHandlers&&env.A.isBrowser&&(env.A.addEvent(this.containerObj,"keydown",this.keyDownListener,this),env.A.addEvent(this.containerObj,"focusin",this.keyFocusInListener,this),env.A.addEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!0)},removeKeyboardEventHandlers:function(){this.hasKeyboardHandlers&&env.A.isBrowser&&(env.A.removeEvent(this.containerObj,"keydown",this.keyDownListener,this),env.A.removeEvent(this.containerObj,"focusin",this.keyFocusInListener,this),env.A.removeEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!1)},removeFullscreenEventHandlers:function(){var t,e=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],i=e.length;if(this.hasFullscreenEventHandlers&&env.A.isBrowser){for(t=0;t<i;t++)env.A.removeEvent(this.document,e[t],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!1}},removePointerEventHandlers:function(){if(this.hasPointerHandlers&&env.A.isBrowser){var t=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(env.A.removeEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),env.A.removeEvent(t,"MSPointerMove",this.pointerMoveListener,this)):(env.A.removeEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),env.A.removeEvent(t,"pointermove",this.pointerMoveListener,this),env.A.removeEvent(t,"pointerleave",this.pointerLeaveListener,this),env.A.removeEvent(t,"click",this.pointerClickListener,this),env.A.removeEvent(t,"dblclick",this.pointerDblClickListener,this)),this.hasWheelHandlers&&(env.A.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),env.A.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasPointerUp&&(window.navigator.msPointerEnabled?env.A.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(env.A.removeEvent(this.document,"pointerup",this.pointerUpListener,this),env.A.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this.hasPointerHandlers=!1}},removeMouseEventHandlers:function(){if(this.hasMouseHandlers&&env.A.isBrowser){var t=this.attr.movetarget||this.containerObj;env.A.removeEvent(this.containerObj,"mousedown",this.mouseDownListener,this),env.A.removeEvent(t,"mousemove",this.mouseMoveListener,this),env.A.removeEvent(t,"click",this.mouseClickListener,this),env.A.removeEvent(t,"dblclick",this.mouseDblClickListener,this),this.hasMouseUp&&(env.A.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.hasWheelHandlers&&(env.A.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),env.A.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasMouseHandlers=!1}},removeTouchEventHandlers:function(){if(this.hasTouchHandlers&&env.A.isBrowser){var t=this.attr.movetarget||this.containerObj;env.A.removeEvent(this.containerObj,"touchstart",this.touchStartListener,this),env.A.removeEvent(t,"touchmove",this.touchMoveListener,this),this.hasTouchEnd&&(env.A.removeEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!1),this.hasTouchHandlers=!1}},clickLeftArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]+.1*this.canvasWidth,this.origin.scrCoords[2]),this},clickRightArrow:function(){return this.moveOrigin(this.origin.scrCoords[1]-.1*this.canvasWidth,this.origin.scrCoords[2]),this},clickUpArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]-.1*this.canvasHeight),this},clickDownArrow:function(){return this.moveOrigin(this.origin.scrCoords[1],this.origin.scrCoords[2]+.1*this.canvasHeight),this},gestureChangeListener:function(t){var e,i,s,r,o,n,a,h,l,c,u,d,p,f=!1,_=this.attr.zoom.factorx,g=this.attr.zoom.factory,A=!1;return this.mode!==this.BOARD_MODE_ZOOM||(t.preventDefault(),n=geometry.A.distance([t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY],2),void 0===t.scale&&(t.scale=n/this.prevDist),!!utils_type.A.exists(this.prevCoords)&&(i=[t.touches[0].clientX-this.prevCoords[0][0],t.touches[0].clientY-this.prevCoords[0][1]],s=[t.touches[1].clientX-this.prevCoords[1][0],t.touches[1].clientY-this.prevCoords[1][1]],i[0]*i[0]+i[1]*i[1]<100&&s[0]*s[0]+s[1]*s[1]<100||(r=geometry.A.rad(i,[0,0],s),"pan"!==this.isPreviousGesture&&Math.abs(r)>.2*Math.PI&&Math.abs(r)<1.8*Math.PI&&(f=!0),"pan"===this.isPreviousGesture||f||(Math.abs(t.scale)<.77||Math.abs(t.scale)>1.3)&&(f=!0),o=t.scale/this.prevScale,this.prevScale=t.scale,this.prevCoords=[[t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY]],e=new base_coords.A(constants.A.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!f?(this.isPreviousGesture="pan",this.moveOrigin(e.scrCoords[1],e.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(o-1)<.5&&(A=!1,l=this.attr.zoom.center,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(c=Math.abs(t.touches[0].clientX-t.touches[1].clientX),u=Math.abs(t.touches[0].clientY-t.touches[1].clientY),a=Math.abs(Math.atan2(u,c)),h=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&a<h?(this.attr.zoom.factorx=o,this.attr.zoom.factory=1,d=0,p=0,A=!0):!this.keepaspectratio&&this.attr.zoom.pinchvertical&&Math.abs(a-.5*Math.PI)<h?(this.attr.zoom.factorx=1,this.attr.zoom.factory=o,d=0,p=0,A=!0):this.attr.zoom.pinch&&(this.attr.zoom.factorx=o,this.attr.zoom.factory=o,d=e.usrCoords[1],p=e.usrCoords[2],A=!0),A&&("board"===l?this.zoomIn():this.zoomIn(d,p),this.attr.zoom.factorx=_,this.attr.zoom.factory=g))),!1))},gestureStartListener:function(t){var e;return t.preventDefault(),this.prevScale=1,this.prevDist=geometry.A.distance([t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY],2),this.prevCoords=[[t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY]],this.isPreviousGesture="none",e=this.getMousePosition(t,0),this.initMoveOrigin(e[0],e[1]),this.mode=this.BOARD_MODE_ZOOM,!1},_isRequiredKeyPressed:function(t,e){var i=this.attr[e];return!!i.enabled&&!(!(i.needshift&&t.shiftKey||!i.needshift&&!t.shiftKey)||!(i.needctrl&&t.ctrlKey||!i.needctrl&&!t.ctrlKey))},_isPointerRegistered:function(t){var e,i=this._board_touches.length;for(e=0;e<i;e++)if(this._board_touches[e].pointerId===t.pointerId)return!0;return!1},_pointerStorePosition:function(t){var e,i;for(e=0,i=!1;e<this._board_touches.length;e++)if(this._board_touches[e].pointerId===t.pointerId){this._board_touches[e].clientX=t.clientX,this._board_touches[e].clientY=t.clientY,i=!0;break}return!i&&this._board_touches.length<2&&this._board_touches.push({pointerId:t.pointerId,clientX:t.clientX,clientY:t.clientY}),this},_pointerRemoveTouches:function(t){var e;for(e=0;e<this._board_touches.length;e++)if(this._board_touches[e].pointerId===t.pointerId){this._board_touches.splice(e,1);break}return this},_pointerClearTouches:function(t){this._board_touches.length>0&&this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this._board_touches=[],this.touches=[]},_getPointerInputDevice:function(t){if(env.A.isBrowser){if("touch"===t.pointerType||window.navigator.msMaxTouchPoints&&window.navigator.msMaxTouchPoints>1)return"touch";if("mouse"===t.pointerType)return"mouse";if("pen"===t.pointerType)return"pen"}return"mouse"},pointerDownListener:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p;if(!e&&this._isPointerRegistered(t))return!1;if(null===utils_type.A.evaluate(this.attr.movetarget)&&utils_type.A.exists(t.target)&&utils_type.A.exists(t.target.releasePointerCapture)&&t.target.releasePointerCapture(t.pointerId),!e&&t.isPrimary,this.hasPointerUp||(window.navigator.msPointerEnabled?env.A.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(env.A.addEvent(this.document,"pointerup",this.pointerUpListener,this),env.A.addEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&utils_type.A.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(h=window.getSelection()).removeAllRanges)try{h.removeAllRanges()}catch(t){}if(this._inputDevice=this._getPointerInputDevice(t),c=this._inputDevice,this.options.precision.hasPoint=this.options.precision[c],n=this.getMousePosition(t),this._testForSelection(t),this.selectingMode)return this._startSelecting(n),void this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[t]);if(this.attr.drag.enabled&&e?(a=[e],this.mode=this.BOARD_MODE_DRAG):a=this.initMoveObject(n[0],n[1],t,c),l={num:t.pointerId,X:n[0],Y:n[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},a.length>0){for(d=a[a.length-1],u=!1,s=0;s<this.touches.length;s++)if(this.touches[s].obj===d){r=s,o=this.touches[s].targets.push(l)-1,u=!0;break}u||(o=0,r=this.touches.push({obj:d,targets:[l]})-1),this.dehighlightAll(),d.highlight(!0),this.saveStartPos(d,this.touches[r].targets[o]),t&&t.preventDefault&&!i&&t.preventDefault()}return this.touches.length>0&&!i&&(t.preventDefault(),t.stopPropagation()),!!env.A.isBrowser&&("touch"!==this._getPointerInputDevice(t)?this.mode===this.BOARD_MODE_NONE&&this.mouseOriginMoveStart(t):(this._pointerStorePosition(t),t.touches=this._board_touches,1===t.touches.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(t)||2!==t.touches.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(t))),p="none",this.mode!==this.BOARD_MODE_NONE||!0!==utils_type.A.evaluate(this.attr.browserpan)&&!0!==utils_type.A.evaluate(this.attr.browserpan.enabled)||!1!==utils_type.A.evaluate(this.attr.pan.enabled)&&!0!==utils_type.A.evaluate(this.attr.pan.needtwofingers)||(p="auto"),this.containerObj.style.touchAction=p,this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[t]),!0)},_handleClicks:function(t,e){var i,s,r=this;if(this.selectingMode)t.stopPropagation();else{if(s=utils_type.A.evaluate(this.attr.clickdelay),utils_type.A.evaluate(this.attr.dblclicksuppressclick))this._preventSingleClick=!1,this._singleClickTimer=setTimeout(function(){if(!r._preventSingleClick)for(i in r.triggerEventHandlers(e,[t]),r.clickObjects)r.clickObjects.hasOwnProperty(i)&&(r.clickObjects[i].triggerEventHandlers(e,[t]),delete r.clickObjects[i])},s);else{for(i in r.triggerEventHandlers(e,[t]),r.clickObjects)r.clickObjects.hasOwnProperty(i)&&r.clickObjects[i].triggerEventHandlers(e,[t]);setTimeout(function(){for(i in r.clickObjects)r.clickObjects.hasOwnProperty(i)&&delete r.clickObjects[i]},s)}t.stopPropagation()}},_handleDblClicks:function(t,e){var i;if(this.selectingMode)t.stopPropagation();else{for(i in this._preventSingleClick=!0,clearTimeout(this._singleClickTimer),this.triggerEventHandlers(e,[t]),this.clickObjects)this.clickObjects.hasOwnProperty(i)&&(this.clickObjects[i].triggerEventHandlers(e,[t]),delete this.clickObjects[i]);t.stopPropagation()}},pointerClickListener:function(t){this._handleClicks(t,["click","pointerclick"])},pointerDblClickListener:function(t){this._handleDblClicks(t,["dblclick","pointerdblclick"])},mouseClickListener:function(t){this._handleClicks(t,["click","mouseclick"])},mouseDblClickListener:function(t){this._handleDblClicks(t,["dblclick","mousedblclick"])},pointerMoveListener:function(t){var e,i,s,r,o,n;if("touch"===this._getPointerInputDevice(t)&&!this._isPointerRegistered(t))return this.BOARD_MODE_NONE;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.updateQuality=this.BOARD_QUALITY_LOW,this._inputDevice=this._getPointerInputDevice(t),n=this._inputDevice,this.options.precision.hasPoint=this.options.precision[n],r=.3333*this.options.precision.hasPoint,s=this.getMousePosition(t),null===utils_type.A.evaluate(this.attr.movetarget)&&s[0]<=r||s[1]<=r||s[0]>=this.canvasWidth-r||s[1]>=this.canvasHeight-r)return this.mode===this.BOARD_MODE_NONE;if(this.selectingMode)this._moveSelecting(s),this.triggerEventHandlers(["touchmoveselecting","moveselecting","pointermoveselecting"],[t,this.mode]);else if(!this.mouseOriginMove(t))if(this.mode===this.BOARD_MODE_DRAG){for(e=0;e<this.touches.length;e++)for(o=this.touches[e].targets,i=0;i<o.length;i++)if(o[i].num===t.pointerId){o[i].X=s[0],o[i].Y=s[1],1===o.length?this.moveObject(s[0],s[1],this.touches[e],t,n):2===o.length&&(this.twoFingerMove(this.touches[e],t.pointerId,t),o[i].Xprev=s[0],o[i].Yprev=s[1]);break}}else"touch"===this._getPointerInputDevice(t)&&(this._pointerStorePosition(t),2===this._board_touches.length&&(t.touches=this._board_touches,this.gestureChangeListener(t))),this.highlightElements(s[0],s[1],t,-1);return this.triggerEventHandlers(["pointermove","MSPointerMove","move"],[t,this.mode]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},pointerUpListener:function(t){var e,i,s,r,o,n=!1;if(this.triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[t]),this.displayInfobox(!1),t)for(e=0;e<this.touches.length;e++)for(o=this.touches[e].targets,i=0;i<o.length;i++)if(o[i].num===t.pointerId){o.splice(i,1),0===o.length&&this.touches.splice(e,1);break}if(this.originMoveEnd(),this.update(),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","pointerstopselecting","stopselecting"],[t]),this.stopSelectionMode();else for(e=this.downObjects.length-1;e>-1;e--){for(s=!1,i=0;i<this.touches.length;i++)this.touches[i].obj.id===this.downObjects[e].id&&(s=!0);s||(this.downObjects[e].triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[t]),utils_type.A.exists(this.downObjects[e].coords)||(this.downObjects[e].snapToGrid(),this.downObjects[e].snapToPoints(),n=!0),r=this.downObjects[e].eventHandlers,(utils_type.A.exists(r.click)&&r.click.length>0||utils_type.A.exists(r.pointerclick)&&r.pointerclick.length>0||utils_type.A.exists(r.dblclick)&&r.dblclick.length>0||utils_type.A.exists(r.pointerdblclick)&&r.pointerdblclick.length>0)&&(this.clickObjects[this.downObjects[e].id]=this.downObjects[e]),this.downObjects.splice(e,1))}return this.hasPointerUp&&(window.navigator.msPointerEnabled?env.A.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(env.A.removeEvent(this.document,"pointerup",this.pointerUpListener,this),env.A.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this._pointerClearTouches(t.pointerId),"touch"!==this._getPointerInputDevice(t)&&this.dehighlightAll(),n&&this.update(),!0},pointerLeaveListener:function(t){return this.displayInfobox(!1),this.dehighlightAll(),!0},touchStartListener:function(t){var e,i,s,r,o,n,a,h,l,c,u=this.options.precision.touch,d=t.touches;for(this.hasTouchEnd||(env.A.addEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!0),this.document.selection&&utils_type.A.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,e=0;e<d.length;e++)d[e].jxg_isused=!1;for(e=0;e<this.touches.length;e++)for(c=this.touches[e].targets,i=0;i<c.length;i++){c[i].num=-1,u=this.options.precision.touch;do{for(s=0;s<d.length;s++)if(Math.abs(Math.pow(d[s].screenX-c[i].X,2)+Math.pow(d[s].screenY-c[i].Y,2))<u*u){c[i].num=s,c[i].X=d[s].screenX,c[i].Y=d[s].screenY,d[s].jxg_isused=!0;break}u*=2}while(-1===c[i].num&&u<this.options.precision.touchMax);-1===c[i].num&&(jxg.A.debug("i couldn't find a targettouches for target no "+i+" on "+this.touches[e].obj.name+" ("+this.touches[e].obj.id+"). Removed the target."),jxg.A.debug("eps = "+u+", touchMax = "+src_options.A.precision.touchMax),c.splice(e,1))}for(e=0;e<d.length;e++)if(!d[e].jxg_isused){if(r=this.getMousePosition(t,e),this.selectingMode)return this._startSelecting(r),this.triggerEventHandlers(["touchstartselecting","startselecting"],[t]),t.preventDefault(),t.stopPropagation(),this.options.precision.hasPoint=this.options.precision.mouse,this.touches.length>0;if(0!==(o=this.initMoveObject(r[0],r[1],t,"touch")).length)if(n=o[o.length-1],l={num:e,X:d[e].screenX,Y:d[e].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},utils_type.A.isPoint(n)||n.elementClass===constants.A.OBJECT_CLASS_TEXT||n.type===constants.A.OBJECT_TYPE_TICKS||n.type===constants.A.OBJECT_TYPE_IMAGE)h=[l],this.saveStartPos(n,h[0]),this.touches.push({obj:n,targets:h}),n.highlight(!0);else if(n.elementClass===constants.A.OBJECT_CLASS_LINE||n.elementClass===constants.A.OBJECT_CLASS_CIRCLE||n.elementClass===constants.A.OBJECT_CLASS_CURVE||n.type===constants.A.OBJECT_TYPE_POLYGON){for(a=!1,i=0;i<this.touches.length;i++)n.id===this.touches[i].obj.id&&(a=!0,1===this.touches[i].targets.length&&(this.saveStartPos(n,l),this.touches[i].targets.push(l)),d[e].jxg_isused=!0);a||(h=[l],this.saveStartPos(n,h[0]),this.touches.push({obj:n,targets:h}),n.highlight(!0))}d[e].jxg_isused=!0}return this.touches.length>0&&(t.preventDefault(),t.stopPropagation()),1===d.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(t)||2!==d.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(t)),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[t]),!1},touchMoveListener:function(t){var e,i,s,r,o=t.touches;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode){for(e=0;e<o.length;e++)if(!o[e].jxg_isused){i=this.getMousePosition(t,e),this._moveSelecting(i),this.triggerEventHandlers(["touchmoves","moveselecting"],[t,this.mode]);break}}else if(!this.touchOriginMove(t))if(this.mode===this.BOARD_MODE_DRAG){for(e=0;e<this.touches.length;e++)if(1===(r=this.touches[e].targets).length){if(o[r[0].num]){if((i=this.getMousePosition(t,r[0].num))[0]<0||i[0]>this.canvasWidth||i[1]<0||i[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],this.moveObject(i[0],i[1],this.touches[e],t,"touch")}}else if(2===r.length&&r[0].num>-1&&r[1].num>-1&&o[r[0].num]&&o[r[1].num]){if(i=this.getMousePosition(t,r[0].num),s=this.getMousePosition(t,r[1].num),i[0]<0||i[0]>this.canvasWidth||i[1]<0||i[1]>this.canvasHeight||s[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],r[1].X=s[0],r[1].Y=s[1],this.twoFingerMove(this.touches[e],r[0].num,t),r[0].Xprev=i[0],r[0].Yprev=i[1],r[1].Xprev=s[0],r[1].Yprev=s[1]}}else 2===o.length&&this.gestureChangeListener(t),i=this.getMousePosition(t,0),this.highlightElements(i[0],i[1],t,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.displayInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[t,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(t){var e,i,s,r,o,n,a=this.options.precision.touch,h=[],l=t&&t.touches,c=!1;if(this.triggerEventHandlers(["touchend","up"],[t]),this.displayInfobox(!1),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[t]),this.stopSelectionMode();else if(l&&l.length>0){for(e=0;e<this.touches.length;e++)h[e]=this.touches[e];for(this.touches.length=0,e=0;e<l.length;e++)l[e].jxg_isused=!1;for(e=0;e<h.length;e++){for(r=!1,o=0,n=h[e].targets,i=0;i<n.length;i++)for(n[i].found=!1,s=0;s<l.length;s++)if(Math.abs(Math.pow(l[s].screenX-n[i].X,2)+Math.pow(l[s].screenY-n[i].Y,2))<a*a){n[i].found=!0,n[i].num=s,n[i].X=l[s].screenX,n[i].Y=l[s].screenY,o+=1;break}if(utils_type.A.isPoint(h[e].obj)?r=n[0]&&n[0].found:h[e].obj.elementClass===constants.A.OBJECT_CLASS_LINE?r=n[0]&&n[0].found||n[1]&&n[1].found:h[e].obj.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&(r=1===o||3===o),r)for(this.touches.push({obj:h[e].obj,targets:[]}),i=0;i<n.length;i++)n[i].found&&this.touches[this.touches.length-1].targets.push({num:n[i].num,X:n[i].screenX,Y:n[i].screenY,Xprev:NaN,Yprev:NaN,Xstart:n[i].Xstart,Ystart:n[i].Ystart,Zstart:n[i].Zstart});else h[e].obj.noHighlight()}}else this.touches.length=0;for(e=this.downObjects.length-1;e>-1;e--){for(r=!1,i=0;i<this.touches.length;i++)this.touches[i].obj.id===this.downObjects[e].id&&(r=!0);r||(this.downObjects[e].triggerEventHandlers(["touchup","up"],[t]),utils_type.A.exists(this.downObjects[e].coords)||(this.downObjects[e].snapToGrid(),this.downObjects[e].snapToPoints(),c=!0),this.downObjects.splice(e,1))}return l&&0!==l.length||(this.hasTouchEnd&&(env.A.removeEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!1),this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.originMoveEnd(),c&&this.update()),!0},mouseDownListener:function(t){var e,i,s;if(this.document.selection&&utils_type.A.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),!this.hasMouseUp)return env.A.addEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!0,this._inputDevice="mouse",this.options.precision.hasPoint=this.options.precision.mouse,e=this.getMousePosition(t),this._testForSelection(t),this.selectingMode?(this._startSelecting(e),void this.triggerEventHandlers(["mousestartselecting","startselecting"],[t])):(0===(i=this.initMoveObject(e[0],e[1],t,"mouse")).length?(this.mode=this.BOARD_MODE_NONE,s=!0):(this.mouse={obj:null,targets:[{X:e[0],Y:e[1],Xprev:NaN,Yprev:NaN}]},this.mouse.obj=i[i.length-1],this.dehighlightAll(),this.mouse.obj.highlight(!0),this.mouse.targets[0].Xstart=[],this.mouse.targets[0].Ystart=[],this.mouse.targets[0].Zstart=[],this.saveStartPos(this.mouse.obj,this.mouse.targets[0]),t&&t.preventDefault?t.preventDefault():window.event&&(window.event.returnValue=!1)),this.mode===this.BOARD_MODE_NONE&&(s=this.mouseOriginMoveStart(t)),this.triggerEventHandlers(["mousedown","down"],[t]),s)},mouseMoveListener:function(t){var e;if(!this.checkFrameRate(t))return!1;e=this.getMousePosition(t),this.updateQuality=this.BOARD_QUALITY_LOW,this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.selectingMode?(this._moveSelecting(e),this.triggerEventHandlers(["mousemoveselecting","moveselecting"],[t,this.mode])):this.mouseOriginMove(t)||(this.mode===this.BOARD_MODE_DRAG?this.moveObject(e[0],e[1],this.mouse,t,"mouse"):this.highlightElements(e[0],e[1],t,-1),this.triggerEventHandlers(["mousemove","move"],[t,this.mode])),this.updateQuality=this.BOARD_QUALITY_HIGH},mouseUpListener:function(t){var e;if(!1===this.selectingMode&&this.triggerEventHandlers(["mouseup","up"],[t]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mouse&&this.mouse.obj&&(utils_type.A.exists(this.mouse.obj.coords)||(this.mouse.obj.snapToGrid(this.mouse.targets[0]),this.mouse.obj.snapToPoints())),this.originMoveEnd(),this.dehighlightAll(),this.update(),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["mousestopselecting","stopselecting"],[t]),this.stopSelectionMode();else for(e=0;e<this.downObjects.length;e++)this.downObjects[e].triggerEventHandlers(["mouseup","up"],[t]);this.downObjects.length=0,this.hasMouseUp&&(env.A.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.mouse=null},mouseWheelListener:function(t){var e,i;return!(this.attr.zoom.enabled&&this.attr.zoom.wheel&&this._isRequiredKeyPressed(t,"zoom"))||(e=(t=t||window.event).detail?-t.detail:t.wheelDelta/40,i="board"===this.attr.zoom.center?[]:new base_coords.A(constants.A.COORDS_BY_SCREEN,this.getMousePosition(t),this).usrCoords,e>0?this.zoomIn(i[1],i[2]):this.zoomOut(i[1],i[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1)},keyDownListener:function(t){var e,i,s,r,o,n,a=t.target.id,h=0,l=0,c=utils_type.A.evaluate(this.attr.keyboard.dx)/this.unitX,u=utils_type.A.evaluate(this.attr.keyboard.dy)/this.unitY,d=!1,p=!0;return!(!this.attr.keyboard.enabled||""===a)&&((!(r=this.containerObj.shadowRoot||document).activeElement||"INPUT"!==(i=r.activeElement).tagName&&"textarea"!==i.tagName)&&(e=a.replace(this.containerObj.id+"_",""),i=this.select(e),utils_type.A.exists(i.coords)&&(n=i.coords.usrCoords.slice(1)),utils_type.A.evaluate(this.attr.keyboard.panshift)&&t.shiftKey||utils_type.A.evaluate(this.attr.keyboard.panctrl)&&t.ctrlKey?(!0===utils_type.A.evaluate(this.attr.zoom.enabled)&&(d=!0),38===t.keyCode?this.clickUpArrow():40===t.keyCode?this.clickDownArrow():37===t.keyCode?this.clickLeftArrow():39===t.keyCode?this.clickRightArrow():d&&171===t.keyCode?this.zoomIn():d&&173===t.keyCode?this.zoomOut():d&&79===t.keyCode?this.zoom100():p=!1):t.shiftKey||t.ctrlKey||(utils_type.A.exists(i.visProp)&&(utils_type.A.exists(i.visProp.snaptogrid)&&i.visProp.snaptogrid&&i.evalVisProp("snapsizex")&&i.evalVisProp("snapsizey")?(c=h=(s=i.getSnapSizes())[0],u=l=s[1]):utils_type.A.exists(i.visProp.attracttogrid)&&i.visProp.attracttogrid&&i.evalVisProp("attractordistance")&&i.evalVisProp("attractorunit")&&(l=h=1.1*i.evalVisProp("attractordistance"),"screen"===i.evalVisProp("attractorunit")&&(h/=this.unitX,l/=this.unitX),c=Math.max(h,c),u=Math.max(l,u))),38===t.keyCode?o=[0,u]:40===t.keyCode?o=[0,-u]:37===t.keyCode?o=[-c,0]:39===t.keyCode?o=[c,0]:p=!1,o&&i.isDraggable&&i.visPropCalc.visible&&(this.geonextCompatibilityMode&&(utils_type.A.isPoint(i)||i.elementClass===constants.A.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!i.evalVisProp("fixed")&&(this.mode=this.BOARD_MODE_DRAG,utils_type.A.exists(i.coords)&&(o[0]+=n[0],o[1]+=n[1]),utils_type.A.exists(i.coords)?(i.setPosition(jxg.A.COORDS_BY_USER,o),this.updateInfobox(i)):(this.displayInfobox(!1),i.setPositionDirectly(constants.A.COORDS_BY_USER,o,[0,0])),this.triggerEventHandlers(["keymove","move"],[t,this.mode]),i.triggerEventHandlers(["keydrag","drag"],[t]),this.mode=this.BOARD_MODE_NONE)),this.update(),p&&utils_type.A.exists(t.preventDefault)&&t.preventDefault(),p))},keyFocusInListener:function(t){var e,i,s=t.target.id;if(!this.attr.keyboard.enabled||""===s)return!1;e=s.replace(this.containerObj.id+"_",""),i=this.select(e),utils_type.A.exists(i.highlight)&&(i.highlight(!0),this.focusObjects=[e],i.triggerEventHandlers(["hit"],[t])),utils_type.A.exists(i.coords)&&this.updateInfobox(i)},keyFocusOutListener:function(t){if(!this.attr.keyboard.enabled)return!1;this.focusObjects=[],this.dehighlightAll(),this.displayInfobox(!1)},updateContainerDims:function(t,e){var i,s,r,o=t,n=e;return void 0===t&&(o=this.containerObj.offsetWidth,n=this.containerObj.offsetHeight),void 0===t&&window&&window.getComputedStyle&&(i=window.getComputedStyle(this.containerObj,null),s=parseFloat(i.getPropertyValue("border-left-width"))+parseFloat(i.getPropertyValue("border-right-width")),isNaN(s)||(o-=s),r=parseFloat(i.getPropertyValue("border-top-width"))+parseFloat(i.getPropertyValue("border-bottom-width")),isNaN(r)||(n-=r)),o<=0||n<=0||isNaN(o)||isNaN(n)?this:(isNaN(this.getBoundingBox()[0])&&this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"keep"),utils_type.A.exists(this._prevDim)&&this._prevDim.w===o&&this._prevDim.h===n||(this.resizeContainer(o,n,!0),this._prevDim={w:o,h:n}),this)},startResizeObserver:function(){var t=this;env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&(this.resizeObserver=new ResizeObserver(function(e){var i;t._isResizing||(t._isResizing=!0,i=e[0].contentRect,window.setTimeout(function(){try{t.updateContainerDims(i.width,i.height)}catch(e){jxg.A.debug(e),t.stopResizeObserver()}finally{t._isResizing=!1}},t.attr.resize.throttle))}),this.resizeObserver.observe(this.containerObj))},stopResizeObserver:function(){env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&utils_type.A.exists(this.resizeObserver)&&this.resizeObserver.unobserve(this.containerObj)},resizeListener:function(){var t=this;env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&(this._isScrolling||this._isResizing||(this._isResizing=!0,window.setTimeout(function(){t.updateContainerDims(),t._isResizing=!1},this.attr.resize.throttle)))},scrollListener:function(t){var e=this;env.A.isBrowser&&(this._isScrolling||(this._isScrolling=!0,window.setTimeout(function(){e._isScrolling=!1},66)))},startIntersectionObserver:function(){var t=this;try{this.intersectionObserver=new IntersectionObserver(function(e){isNaN(t.getBoundingBox()[0])&&t.updateContainerDims()},{root:null,rootMargin:"0px",threshold:.8}),this.intersectionObserver.observe(t.containerObj)}catch(t){jxg.A.debug("JSXGraph: IntersectionObserver not available in this browser.")}},stopIntersectionObserver:function(){utils_type.A.exists(this.intersectionObserver)&&this.intersectionObserver.unobserve(this.containerObj)},printListener:function(t){this.updateContainerDims()},printListenerMatch:function(t){t.matches&&this.printListener()},initInfobox:function(t){var e=utils_type.A.copyAttributes(t,this.options,"infobox");return e.id=this.id+"_infobox",this.infobox=this.create("text",[0,0,"0,0"],e),this.infobox.dump=!1,this.displayInfobox(!1),this},updateInfobox:function(t){var e,i,s,r,o,n,a,h=t.evalVisProp("showinfobox");return!utils_type.A.evaluate(this.attr.showinfobox)&&"inherit"===h||!h||utils_type.A.isPoint(t)&&(s=t.coords.usrCoords[1],r=t.coords.usrCoords[2],n=this.infobox.evalVisProp("distancex"),a=this.infobox.evalVisProp("distancey"),this.infobox.setCoords(s+n/this.unitX,r+a/this.unitY),o=t.evalVisProp("infoboxdigits"),"string"!=typeof t.infoboxText?("auto"===o?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(s),i=this.infobox.formatNumberLocale(r)):(e=utils_type.A.autoDigits(s),i=utils_type.A.autoDigits(r)):utils_type.A.isNumber(o)?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(s,o),i=this.infobox.formatNumberLocale(r,o)):(e=utils_type.A.toFixed(s,o),i=utils_type.A.toFixed(r,o)):(e=s,i=r),this.highlightInfobox(e,i,t)):this.highlightCustomInfobox(t.infoboxText,t),this.displayInfobox(!0)),this},displayInfobox:function(t){return!t&&this.focusObjects.length>0&&this.select(this.focusObjects[0]).elementClass===constants.A.OBJECT_CLASS_POINT||this.infobox.hiddenByParent===t&&(this.infobox.hiddenByParent=!t,this.infobox.prepareUpdate().updateVisibility(t).updateRenderer()),this},showInfobox:function(t){return this.displayInfobox(t)},highlightInfobox:function(t,e,i){return this.highlightCustomInfobox("("+t+", "+e+")",i),this},highlightCustomInfobox:function(t,e){return this.infobox.setText(t),this},dehighlightAll:function(){var t,e,i={},s=!1;for(t in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(t)&&(e=this.highlightedObjects[t],this.focusObjects.indexOf(t)<0?((this.hasMouseHandlers||this.hasPointerHandlers)&&e.noHighlight(),s=!0):i[t]=e);return this.highlightedObjects=i,"canvas"===this.renderer.type&&s&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(t,e){return[t,e]},getUsrCoordsOfMouse:function(t){var e=this.getCoordsTopLeftCorner(),i=env.A.getPosition(t,null,this.document),s=i[0]-e[0],r=i[1]-e[1];return new base_coords.A(constants.A.COORDS_BY_SCREEN,[s,r],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var e,i,s=this.getCoordsTopLeftCorner(),r=env.A.getPosition(t,null,this.document),o=r[0]-s[0],n=r[1]-s[1],a=[],h=this.objectsList.length;for(e=0;e<h;e++)(i=this.objectsList[e]).visPropCalc.visible&&i.hasPoint&&i.hasPoint(o,n)&&(a[a.length]=i);return a},updateCoords:function(){var t,e,i=this.objectsList.length;for(e=0;e<i;e++)t=this.objectsList[e],utils_type.A.exists(t.coords)&&(!0===t.evalVisProp("frozen")?t.is3D?t.element2D.coords.screen2usr():t.coords.screen2usr():t.is3D?t.element2D.coords.usr2screen():(t.coords.usr2screen(),utils_type.A.exists(t.actualCoords)&&t.actualCoords.usr2screen()));return this},moveOrigin:function(t,e,i){var s,r,o,n;return utils_type.A.exists(t)&&utils_type.A.exists(e)&&(s=this.origin.scrCoords[1],r=this.origin.scrCoords[2],this.origin.scrCoords[1]=t,this.origin.scrCoords[2]=e,i&&(this.origin.scrCoords[1]-=this.drag_dx,this.origin.scrCoords[2]-=this.drag_dy),o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[0,0],this).usrCoords,n=new base_coords.A(constants.A.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords,(o[1]<this.maxboundingbox[0]-math.A.eps||o[2]>this.maxboundingbox[1]+math.A.eps||n[1]>this.maxboundingbox[2]+math.A.eps||n[2]<this.maxboundingbox[3]-math.A.eps)&&(this.origin.scrCoords[1]=s,this.origin.scrCoords[2]=r)),this.updateCoords().clearTraces().fullUpdate(),this.triggerEventHandlers(["boundingbox"]),this},addConditions:function(t){var e,i,s,r,o,n,a,h=[],l=t.indexOf("<data>"),c=t.indexOf("</data>"),u=function(t,e,i,s){return function(){var r,o;o=(r=t.select(e.id)).coords.usrCoords[s],2===s?r.setPositionDirectly(constants.A.COORDS_BY_USER,[i(),o]):r.setPositionDirectly(constants.A.COORDS_BY_USER,[o,i()]),r.prepareUpdate().update()}},d=function(t,e,i){return function(){var s,r;s=t.select(e.id),r=i(),s.setAttribute({visible:r})}},p=function(t,e,i,s){return function(){var r,o;r=t.select(e.id),o=i(),"strokewidth"===s?r.visProp.strokewidth=o:(o=utils_color.A.rgba2rgbo(o),r.visProp[s+"color"]=o[0],r.visProp[s+"opacity"]=o[1])}},f=function(t,e,i){return function(){t.select(e.id).position=i()}},_=function(t,e,i){return function(){t.select(e.id).setStyle(i())}};if(!(l<0)){for(;l>=0;){if(i=(e=t.slice(l+6,c)).indexOf("="),s=e.slice(0,i),r=e.slice(i+1),i=s.indexOf("."),o=s.slice(0,i),n=this.elementsByName[utils_type.A.unescapeHTML(o)],a=s.slice(i+1).replace(/\s+/g,"").toLowerCase(),r=utils_type.A.createFunction(r,this,"",!0),utils_type.A.exists(this.elementsByName[o]))switch(a){case"x":h.push(u(this,n,r,2));break;case"y":h.push(u(this,n,r,1));break;case"visible":h.push(d(this,n,r));break;case"position":h.push(f(this,n,r));break;case"stroke":h.push(p(this,n,r,"stroke"));break;case"style":h.push(_(this,n,r));break;case"strokewidth":h.push(p(this,n,r,"strokewidth"));break;case"fill":h.push(p(this,n,r,"fill"));break;case"label":break;default:jxg.A.debug('property "'+a+'" in conditions not yet implemented:'+r)}else jxg.A.debug("debug conditions: |"+o+"| undefined");l=(t=t.slice(c+7)).indexOf("<data>"),c=t.indexOf("</data>")}this.updateConditions=function(){var t;for(t=0;t<h.length;t++)h[t]();return this.prepareUpdate().updateElements(),!0},this.updateConditions()}},updateConditions:function(){return!1},calculateSnapSizes:function(){var t,e,i,s,r=this.getBoundingBox(),o=utils_type.A.evaluate(this.options.grid.majorStep),n=utils_type.A.evaluate(this.options.grid.gridX),a=utils_type.A.evaluate(this.options.grid.gridY);for(utils_type.A.isArray(o)||(o=[o,o]),o.length<2&&(o=[o[0],o[0]]),utils_type.A.exists(n)&&(o[0]=n),utils_type.A.exists(a)&&(o[1]=a),"auto"===o[0]?o[0]=1:o[0]=utils_type.A.parseNumber(o[0],Math.abs(r[1]-r[3]),1/this.unitX),"auto"===o[1]?o[1]=1:o[1]=utils_type.A.parseNumber(o[1],Math.abs(r[0]-r[2]),1/this.unitY),t=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],this),e=new base_coords.A(constants.A.COORDS_BY_USER,[o[0],o[1]],this),i=t.scrCoords[1]-e.scrCoords[1],s=t.scrCoords[2]-e.scrCoords[2],this.options.grid.snapSizeX=o[0];Math.abs(i)>25;)this.options.grid.snapSizeX*=2,i/=2;for(this.options.grid.snapSizeY=o[1];Math.abs(s)>25;)this.options.grid.snapSizeY*=2,s/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),s=utils_type.A.evaluate(this.attr.zoom.factorx),r=utils_type.A.evaluate(this.attr.zoom.factory),o=(i[2]-i[0])*(1-1/s),n=(i[1]-i[3])*(1-1/r),a=.5,h=.5,l=utils_type.A.evaluate(this.attr.zoom.max),c=utils_type.A.evaluate(this.attr.zoom.eps)||utils_type.A.evaluate(this.attr.zoom.min)||.001;return this.zoomX>l&&s>1||this.zoomY>l&&r>1||this.zoomX<c&&s<1||this.zoomY<c&&r<1?this:(utils_type.A.isNumber(t)&&utils_type.A.isNumber(e)&&(a=(t-i[0])/(i[2]-i[0]),h=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+o*a,i[1]-n*h,i[2]-o*(1-a),i[3]+n*(1-h)],this.keepaspectratio,"update"),this.applyZoom())},zoomOut:function(t,e){var i=this.getBoundingBox(),s=utils_type.A.evaluate(this.attr.zoom.factorx),r=utils_type.A.evaluate(this.attr.zoom.factory),o=(i[2]-i[0])*(1-s),n=(i[1]-i[3])*(1-r),a=.5,h=.5,l=utils_type.A.evaluate(this.attr.zoom.eps)||utils_type.A.evaluate(this.attr.zoom.min)||.001;return this.zoomX<l||this.zoomY<l?this:(utils_type.A.isNumber(t)&&utils_type.A.isNumber(e)&&(a=(t-i[0])/(i[2]-i[0]),h=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+o*a,i[1]-n*h,i[2]-o*(1-a),i[3]+n*(1-h)],this.keepaspectratio,"update"),this.applyZoom())},zoom100:function(){var t,e,i;return utils_type.A.exists(this.attr.boundingbox)?this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"reset"):(e=((t=this.getBoundingBox())[2]-t[0])*(1-this.zoomX)*.5,i=(t[1]-t[3])*(1-this.zoomY)*.5,this.setBoundingBox([t[0]+e,t[1]-i,t[2]-e,t[3]+i],this.keepaspectratio,"reset")),this.applyZoom()},zoomAllPoints:function(){var t,e,i,s,r=0,o=0,n=0,a=0,h=this.objectsList.length;for(t=0;t<h;t++)s=this.objectsList[t],utils_type.A.isPoint(s)&&s.visPropCalc.visible&&(s.coords.usrCoords[1]<r?r=s.coords.usrCoords[1]:s.coords.usrCoords[1]>o&&(o=s.coords.usrCoords[1]),s.coords.usrCoords[2]>a?a=s.coords.usrCoords[2]:s.coords.usrCoords[2]<n&&(n=s.coords.usrCoords[2]));return e=50/this.unitX,i=50/this.unitY,this.setBoundingBox([r-e,a+i,o+e,n-i],this.keepaspectratio,"update"),this.applyZoom()},zoomElements:function(t){var e,i,s,r,o,n,a,h=[1/0,-1/0,-1/0,1/0];if(!utils_type.A.isArray(t)||0===t.length)return this;for(e=0;e<t.length;e++)i=this.select(t[e]).bounds(),utils_type.A.isArray(i)&&(i[0]<h[0]&&(h[0]=i[0]),i[1]>h[1]&&(h[1]=i[1]),i[2]>h[2]&&(h[2]=i[2]),i[3]<h[3]&&(h[3]=i[3]));return utils_type.A.isArray(h)&&(s=.5*(h[0]+h[2]),r=.5*(h[1]+h[3]),o=1.5*(h[2]-h[0])*.5,n=1.5*(h[1]-h[3])*.5,a=Math.max(o,n),this.setBoundingBox([s-a,r+a,s+a,r-a],this.keepaspectratio,"update")),this},setZoom:function(t,e){var i=this.attr.zoom.factorx,s=this.attr.zoom.factory;return this.attr.zoom.factorx=t/this.zoomX,this.attr.zoom.factory=e/this.zoomY,this.zoomIn(),this.attr.zoom.factorx=i,this.attr.zoom.factory=s,this},_removeObj:function(t,e){var i,s;if(utils_type.A.isArray(t)){for(s=0;s<t.length;s++)this._removeObj(t[s],e);return this}if(t=this.select(t),!utils_type.A.exists(t)||utils_type.A.isString(t))return this;try{for(i in t.childElements)t.childElements.hasOwnProperty(i)&&t.childElements[i].board._removeObj(t.childElements[i]);for(i in t.objects)t.objects.hasOwnProperty(i)&&t.objects[i].board._removeObj(t.objects[i]);if(e)for(i in this.objects)this.objects.hasOwnProperty(i)&&utils_type.A.exists(this.objects[i].childElements)&&utils_type.A.exists(this.objects[i].childElements.hasOwnProperty(t.id))&&(delete this.objects[i].childElements[t.id],delete this.objects[i].descendants[t.id]);else if(utils_type.A.exists(t.ancestors))for(i in t.ancestors)t.ancestors.hasOwnProperty(i)&&utils_type.A.exists(t.ancestors[i].childElements)&&utils_type.A.exists(t.ancestors[i].childElements.hasOwnProperty(t.id))&&(delete t.ancestors[i].childElements[t.id],delete t.ancestors[i].descendants[t.id]);if(t._pos>-1)for(this.objectsList.splice(t._pos,1),s=t._pos;s<this.objectsList.length;s++)this.objectsList[s]._pos--;else t.type!==constants.A.OBJECT_TYPE_TURTLE&&jxg.A.debug("Board.removeObject: object "+t.id+" not found in list.");delete this.objects[t.id],delete this.elementsByName[t.name],t.visProp&&t.evalVisProp("trace")&&t.clearTrace(),utils_type.A.exists(t.remove)&&t.remove()}catch(e){jxg.A.debug(t.id+": Could not be removed: "+e)}return this},removeObject:function(t,e){var i;if(this.renderer.suspendRedraw(this),utils_type.A.isArray(t))for(i=0;i<t.length;i++)this._removeObj(t[i],e);else this._removeObj(t,e);return this.renderer.unsuspendRedraw(),this.update(),this},removeAncestors:function(t){var e;for(e in t.ancestors)t.ancestors.hasOwnProperty(e)&&this.removeAncestors(t.ancestors[e]);return this.removeObject(t),this},initGeonextBoard:function(){var t,e,i;return t=this.create("point",[0,0],{id:this.id+"g00e0",name:"Ursprung",withLabel:!1,visible:!1,fixed:!0}),e=this.create("point",[1,0],{id:this.id+"gX0e0",name:"Punkt_1_0",withLabel:!1,visible:!1,fixed:!0}),i=this.create("point",[0,1],{id:this.id+"gY0e0",name:"Punkt_0_1",withLabel:!1,visible:!1,fixed:!0}),this.create("line",[t,e],{id:this.id+"gXLe0",name:"X-Achse",withLabel:!1,visible:!1}),this.create("line",[t,i],{id:this.id+"gYLe0",name:"Y-Achse",withLabel:!1,visible:!1}),this},resizeContainer:function(t,e,i,s){var r,o,n,a,h;return o=this.canvasWidth,n=this.canvasHeight,s||(r=this.getBoundingBox()),this.canvasWidth=parseFloat(t),this.canvasHeight=parseFloat(e),i||(this.containerObj.style.width=this.canvasWidth+"px",this.containerObj.style.height=this.canvasHeight+"px"),this.renderer.resize(this.canvasWidth,this.canvasHeight),s?(a=.5*(this.canvasWidth-o),h=.5*(this.canvasHeight-n),this.moveOrigin(this.origin.scrCoords[1]+a,this.origin.scrCoords[2]+h)):this.setBoundingBox(r,this.keepaspectratio,"keep"),this},showDependencies:function(){var t,e,i,s,r;for(t in e="<p>\n",this.objects)if(this.objects.hasOwnProperty(t)){for(i in r=0,this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(i)&&(r+=1);for(i in r>=0&&(e+="<strong>"+this.objects[t].id+":</strong> "),this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(i)&&(e+=this.objects[t].childElements[i].id+"("+this.objects[t].childElements[i].name+"), ");e+="<p>\n"}return e+="</p>\n",(s=window.open()).document.open(),s.document.write(e),s.document.close(),this},showXML:function(){var t=window.open("");return t.document.open(),t.document.write("<pre>"+utils_type.A.escapeHTML(this.xmlString)+"</pre>"),t.document.close(),this},prepareUpdate:function(t){var e,i,s,r=this.objectsList.length;for(e=0;e<r;e++)if(s=this.objectsList[e],this._change3DView||utils_type.A.exists(t)&&"view3d_slider"===t.elType){if(s.needsUpdate=s.visProp.element3d||"view3d"===s.elType||"view3d_slider"===s.elType||this.needsFullUpdate,s.visProp.element3d&&s.visProp.element3d.type===constants.A.OBJECT_TYPE_SPHERE3D)for(i=0;i<s.parents.length;i++)this.objects[s.parents[i]].needsUpdate=!0}else s.needsUpdate=s.needsRegularUpdate||this.needsFullUpdate;for(e in this.groups)this.groups.hasOwnProperty(e)&&((s=this.groups[e]).needsUpdate=s.needsRegularUpdate||this.needsFullUpdate);return this},updateElements:function(t){var e,i;for(t=this.select(t),e=0;e<this.objectsList.length;e++)i=this.objectsList[e],this.needsFullUpdate&&i.elementClass===constants.A.OBJECT_CLASS_TEXT&&i.updateSize(),i.update(!utils_type.A.exists(t)||i.id!==t.id).updateVisibility();for(e in this.groups)this.groups.hasOwnProperty(e)&&this.groups[e].update(t);return this},updateRenderer:function(){var t,e,i,s=this.objectsList.length,r=[];if(this.renderer){if("canvas"===this.renderer.type)this.updateRendererCanvas();else{for(t=0;t<s;t++)this.objectsList[t].visProp.islabel&&this.objectsList[t].visProp.autoposition?r.push(t):this.objectsList[t].updateRenderer();for(e=r.length;0!==e;)i=Math.floor(Math.random()*e),e--,[r[e],r[i]]=[r[i],r[e]];for(t=0;t<r.length;t++)this.objectsList[r[t]].updateRenderer()}return this}},updateRendererCanvas:function(){var t,e,i,s=this.objectsList.length,r=[];for(t=0;t<s;t++)if("view3d"===(e=this.objectsList[t]).elType&&e.evalVisProp("depthorder.enabled")){r=e.evalVisProp("depthorder.layers"),e.updateRenderer();break}for(s=(i=this.objectsList.toSorted(function(t,e){return t.visProp.layer!==e.visProp.layer?t.visProp.layer-e.visProp.layer:-1===r.indexOf(t.visProp.layer)?t._pos-e._pos:t.visProp.element3d||e.visProp.element3d?t.visProp.element3d&&!e.visProp.element3d?-1:e.visProp.element3d&&!t.visProp.element3d?1:t.visProp.element3d.zIndex-e.visProp.element3d.zIndex:t._pos-e._pos})).length,t=0;t<s;t++)i[t].prepareUpdate().updateRenderer();return this},addHook:function(t,e,i){return jxg.A.deprecated("Board.addHook()","Board.on()"),e=utils_type.A.def(e,"update"),i=utils_type.A.def(i,this),this.hooks.push([e,t]),this.on(e,t,i),this.hooks.length-1},addEvent:jxg.A.shortcut(jxg.A.Board.prototype,"on"),removeHook:function(t){return jxg.A.deprecated("Board.removeHook()","Board.off()"),this.hooks[t]&&(this.off(this.hooks[t][0],this.hooks[t][1]),this.hooks[t]=null),this},removeEvent:jxg.A.shortcut(jxg.A.Board.prototype,"off"),updateHooks:function(t){var e=Array.prototype.slice.call(arguments,0);return jxg.A.deprecated("Board.updateHooks()","Board.triggerEventHandlers()"),e[0]=utils_type.A.def(e[0],"update"),this.triggerEventHandlers([e[0]],arguments),this},addChild:function(t){return utils_type.A.exists(t)&&utils_type.A.exists(t.containerObj)&&(this.dependentBoards.push(t),this.update()),this},removeChild:function(t){var e;for(e=this.dependentBoards.length-1;e>=0;e--)this.dependentBoards[e]===t&&this.dependentBoards.splice(e,1);return this},update:function(t){var e,i,s,r,o;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,"all"===this.attr.minimizereflow&&this.containerObj&&"vml"!==this.renderer.type&&(o=this.document.activeElement,r=this.renderer.removeToInsertLater(this.containerObj)),"svg"===this.attr.minimizereflow&&"svg"===this.renderer.type&&(o=this.document.activeElement,r=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate(t).updateElements(t).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw(),this.triggerEventHandlers(["update"],[]),r&&(r(),o.focus()),i=this.dependentBoards.length,e=0;e<i;e++)s=this.dependentBoards[e],utils_type.A.exists(s)&&s!==this&&(s.updateQuality=this.updateQuality,s.prepareUpdate().updateElements().updateConditions(),s.renderer.suspendRedraw(this),s.updateRenderer(),s.renderer.unsuspendRedraw(),s.triggerEventHandlers(["update"],[]));return this.inUpdate=!1,this},fullUpdate:function(){return this.needsFullUpdate=!0,this.update(),this.needsFullUpdate=!1,this},addGrid:function(){return this.create("grid",[]),this},removeGrids:function(){var t;for(t=0;t<this.grids.length;t++)this.removeObject(this.grids[t]);return this.grids.length=0,this.update(),this},create:function(t,e,i){var s,r;for(t=t.toLowerCase(),utils_type.A.exists(e)||(e=[]),utils_type.A.exists(i)||(i={}),r=0;r<e.length;r++)!utils_type.A.isString(e[r])||"text"===t&&2===r||"solidofrevolution3d"===t&&2===r||"text3d"===t&&(2===r||4===r)||!("input"!==t&&"checkbox"!==t&&"button"!==t||2!==r&&3!==r)||"curve"===t||"functiongraph"===t||"implicitcurve"===t||(r>0&&"view3d"===e[0].elType?e[r]=e[0].select(e[r]):e[r]=this.select(e[r]));if(!utils_type.A.isFunction(jxg.A.elements[t]))throw new Error("JSXGraph: create: Unknown element type given: "+t);return s=jxg.A.elements[t](this,e,i),utils_type.A.exists(s)?(s.prepareUpdate&&s.update&&s.updateRenderer&&s.fullUpdate(),s):(jxg.A.debug("JSXGraph: create: failure creating "+t),s)},createElement:function(){return jxg.A.deprecated("Board.createElement()","Board.create()"),this.create.apply(this,arguments)},clearTraces:function(){var t;for(t=0;t<this.objectsList.length;t++)this.objectsList[t].clearTrace();return this.numTraces=0,this},suspendUpdate:function(){return this.inUpdate||(this.isSuspendedUpdate=!0),this},unsuspendUpdate:function(){return this.isSuspendedUpdate&&(this.isSuspendedUpdate=!1,this.fullUpdate()),this},setBoundingBox:function(t,e,i){var s,r,o,n,a,h,l,c,u,d=0,p=0,f=1,_=env.A.getDimensions(this.containerObj,this.document);return utils_type.A.isArray(t)?(t[0]<this.maxboundingbox[0]-math.A.eps||t[1]>this.maxboundingbox[1]+math.A.eps||t[2]>this.maxboundingbox[2]+math.A.eps||t[3]<this.maxboundingbox[3]-math.A.eps||(utils_type.A.exists(i)||(i="reset"),o=this.unitX,n=this.unitY,this.canvasWidth=parseFloat(_.width),this.canvasHeight=parseFloat(_.height),r=this.canvasWidth,s=this.canvasHeight,e?(this.keepaspectratio?(a=o/n,isNaN(a)&&(a=1)):a=1,"keep"===i&&(f=this.zoomX/this.zoomY),c=o*(h=t[2]-t[0]),u=n*(l=t[1]-t[3]),r>=s?c>=u?(this.unitY=s/l,this.unitX=this.unitY*a):(this.unitY=s/Math.abs(h)*math.A.sign(l)/f,this.unitX=this.unitY*a):u>c?(this.unitX=r/h,this.unitY=this.unitX/a):(this.unitX=r/Math.abs(l)*math.A.sign(h)*f,this.unitY=this.unitX/a),d=.5*(r/this.unitX-h),p=.5*(s/this.unitY-l),this.keepaspectratio=!0):(this.unitX=r/(t[2]-t[0]),this.unitY=s/(t[1]-t[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(t[0]-d),this.unitY*(t[1]+p)),"update"===i?(this.zoomX*=this.unitX/o,this.zoomY*=this.unitY/n):"reset"===i&&(this.zoomX=utils_type.A.exists(this.attr.zoomx)?this.attr.zoomx:1,this.zoomY=utils_type.A.exists(this.attr.zoomy)?this.attr.zoomy:1)),this):this},getBoundingBox:function(){var t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[0,0],this).usrCoords,e=new base_coords.A(constants.A.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords;return[t[1],t[2],e[1],e[2]]},_set:function(t,e){t=t.toLocaleLowerCase(),null===e||!utils_type.A.isObject(e)||utils_type.A.exists(e.id)||utils_type.A.exists(e.name)?this.attr[t]=e:utils_type.A.mergeAttr(this.attr[t],e)},setAttribute:function(t){var e,i,s,r,o,n,a={};for(e=0;e<arguments.length;e++)i=arguments[e],utils_type.A.isString(i)?(s=i.split(":"),a[utils_type.A.trim(s[0])]=utils_type.A.trim(s[1])):utils_type.A.isArray(i)?a[i[0]]=i[1]:jxg.A.extend(a,i);for(e in a)if(a.hasOwnProperty(e)&&(r=e.replace(/\s+/g,"").toLowerCase(),o=a[e]),o=(!o.toLowerCase||"false"!==o.toLowerCase())&&o,this.attr[r]!==o)switch(r){case"axis":!1===o&&utils_type.A.exists(this.defaultAxes)&&(this.defaultAxes.x.setAttribute({visible:!1}),this.defaultAxes.y.setAttribute({visible:!1}));break;case"boundingbox":this.setBoundingBox(o,this.keepaspectratio),this._set(r,o);break;case"defaultaxes":utils_type.A.exists(this.defaultAxes.x)&&utils_type.A.exists(o.x)&&this.defaultAxes.x.setAttribute(o.x),utils_type.A.exists(this.defaultAxes.y)&&utils_type.A.exists(o.y)&&this.defaultAxes.y.setAttribute(o.y);break;case"title":this.document.getElementById(this.container+"_ARIAlabel").innerText=o,this._set(r,o);break;case"keepaspectratio":this._set(r,o),this.setBoundingBox(this.getBoundingBox(),o,"keep");break;case"document":case"maxboundingbox":this[r]=o,this._set(r,o);break;case"zoomx":case"zoomy":this[r]=o,this._set(r,o),this.setZoom(this.attr.zoomx,this.attr.zoomy);break;case"registerevents":case"renderer":break;case"fullscreen":case"screenshot":(n=this.containerObj.ownerDocument.getElementById(this.container+"_navigation_"+r))&&utils_type.A.exists(o.symbol)&&(n.innerText=utils_type.A.evaluate(o.symbol)),this._set(r,o);break;case"selection":o.visible=!1,o.withLines=!1,o.vertices={visible:!1},this._set(r,o);break;case"showcopyright":"svg"===this.renderer.type&&((n=this.containerObj.ownerDocument.getElementById(this.renderer.uniqName("licenseText")))?n.style.display=utils_type.A.evaluate(o)?"inline":"none":utils_type.A.evaluate(o)&&this.renderer.displayCopyright(constants.A.licenseText,parseInt(this.options.text.fontSize,10))),this._set(r,o);break;case"showlogo":"svg"===this.renderer.type&&((n=this.containerObj.ownerDocument.getElementById(this.renderer.uniqName("licenseLogo")))?n.style.display=utils_type.A.evaluate(o)?"inline":"none":utils_type.A.evaluate(o)&&this.renderer.displayLogo(constants.A.licenseLogo,parseInt(this.options.text.fontSize,10))),this._set(r,o);break;default:utils_type.A.exists(this.attr[r])&&this._set(r,o)}return this.containerObj.ownerDocument.getElementById(this.container+"_navigationbar").remove(),this.renderer.drawNavigationBar(this,this.attr.navbar),this.triggerEventHandlers(["attribute"],[a,this]),this.fullUpdate(),this},addAnimation:function(t){var e=this;return this.animationObjects[t.id]=t,this.animationIntervalCode||(this.animationIntervalCode=window.setInterval(function(){e.animate()},t.board.attr.animationdelay)),this},stopAllAnimation:function(){var t;for(t in this.animationObjects)this.animationObjects.hasOwnProperty(t)&&utils_type.A.exists(this.animationObjects[t])&&(this.animationObjects[t]=null,delete this.animationObjects[t]);return window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode,this},animate:function(){var t,e,i,s,r,o,n,a,h=0,l=null;for(e in this.animationObjects)if(this.animationObjects.hasOwnProperty(e)&&utils_type.A.exists(this.animationObjects[e])){if(h+=1,(i=this.animationObjects[e]).animationPath&&(s=utils_type.A.isFunction(i.animationPath)?i.animationPath((new Date).getTime()-i.animationStart):i.animationPath.pop(),!utils_type.A.exists(s)||!utils_type.A.isArray(s)&&isNaN(s)?delete i.animationPath:(i.setPositionDirectly(constants.A.COORDS_BY_USER,s),i.fullUpdate(),l=i)),i.animationData){for(r in n=0,i.animationData)i.animationData.hasOwnProperty(r)&&(o=i.animationData[r].pop(),utils_type.A.exists(o)?(n+=1,(t={})[r]=o,i.setAttribute(t)):delete i.animationData[o]);0===n&&delete i.animationData}utils_type.A.exists(i.animationData)||utils_type.A.exists(i.animationPath)||(this.animationObjects[e]=null,delete this.animationObjects[e],utils_type.A.exists(i.animationCallback)&&(a=i.animationCallback,i.animationCallback=null,a()))}return 0===h?(window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode):this.update(l),this},migratePoint:function(t,e,i){var s,r,o,n,a,h,l=!1;for(r in t=this.select(t),e=this.select(e),utils_type.A.exists(t.label)&&(h=t.label.id,l=!0,this.removeObject(t.label)),t.childElements)if(t.childElements.hasOwnProperty(r)){for(o in n=!1,s=t.childElements[r])s.hasOwnProperty(o)&&s[o]===t&&(s[o]=e,n=!0);for(n&&delete t.childElements[r],a=0;a<s.parents.length;a++)s.parents[a]===t.id&&(s.parents[a]=e.id);e.addChild(s)}return i&&(l&&(delete e.childElements[h],delete e.descendants[h]),e.label&&this.removeObject(e.label),delete this.elementsByName[e.name],e.name=t.name,l&&e.createLabel()),this.removeObject(t),utils_type.A.exists(e.name)&&""!==e.name&&(this.elementsByName[e.name]=e),this.fullUpdate(),this},emulateColorblindness:function(t){var e,i;if(utils_type.A.exists(t)||(t="none"),this.currentCBDef===t)return this;for(e in this.objects)this.objects.hasOwnProperty(e)&&(i=this.objects[e],"none"!==t?("none"===this.currentCBDef&&(i.visPropOriginal={strokecolor:i.visProp.strokecolor,fillcolor:i.visProp.fillcolor,highlightstrokecolor:i.visProp.highlightstrokecolor,highlightfillcolor:i.visProp.highlightfillcolor}),i.setAttribute({strokecolor:utils_color.A.rgb2cb(i.eval(i.visPropOriginal.strokecolor),t),fillcolor:utils_color.A.rgb2cb(i.eval(i.visPropOriginal.fillcolor),t),highlightstrokecolor:utils_color.A.rgb2cb(i.eval(i.visPropOriginal.highlightstrokecolor),t),highlightfillcolor:utils_color.A.rgb2cb(i.eval(i.visPropOriginal.highlightfillcolor),t)})):utils_type.A.exists(i.visPropOriginal)&&jxg.A.extend(i.visProp,i.visPropOriginal));return this.currentCBDef=t,this.update(),this},select:function(t,e){var i,s,r,o,n=t;if(null===n)return n;if(utils_type.A.isString(n)&&""!==n)utils_type.A.exists(this.objects[n])?n=this.objects[n]:utils_type.A.exists(this.elementsByName[n])?n=this.elementsByName[n]:utils_type.A.exists(this.groups[n])&&(n=this.groups[n]);else if(!e&&(utils_type.A.isFunction(n)||utils_type.A.isObject(n)&&!utils_type.A.isFunction(n.setAttribute))){for(s={},o=(i=utils_type.A.filterElements(this.objectsList,n)).length,r=0;r<o;r++)s[i[r].id]=i[r];n=new composition(s)}else utils_type.A.isObject(n)&&utils_type.A.exists(n.id)&&!utils_type.A.exists(this.objects[n.id])&&(n=null);return n},hasPoint:function(t,e){var i=t,s=e,r=this.getBoundingBox();return utils_type.A.exists(t)&&utils_type.A.isArray(t.usrCoords)&&(i=t.usrCoords[1],s=t.usrCoords[2]),!!(utils_type.A.isNumber(i)&&utils_type.A.isNumber(s)&&r[0]<i&&i<r[2]&&r[1]>s&&s>r[3])},updateCSSTransforms:function(){var t=this.containerObj,e=t,i=t;if(this.cssTransMat=env.A.getCSSTransformMatrix(e),utils_type.A.exists(e.getRootNode)){for(e=e.parentNode===e.getRootNode()?e.parentNode.host:e.parentNode;e;)this.cssTransMat=math.A.matMatMult(env.A.getCSSTransformMatrix(e),this.cssTransMat),e=e.parentNode===e.getRootNode()?e.parentNode.host:e.parentNode;this.cssTransMat=math.A.inverse(this.cssTransMat)}else{for(e=e.offsetParent;e;){for(this.cssTransMat=math.A.matMatMult(env.A.getCSSTransformMatrix(e),this.cssTransMat),i=i.parentNode;i!==e;)this.cssTransMat=math.A.matMatMult(env.A.getCSSTransformMatrix(e),this.cssTransMat),i=i.parentNode;e=e.offsetParent}this.cssTransMat=math.A.inverse(this.cssTransMat)}return this},startSelectionMode:function(){this.selectingMode=!0,this.selectionPolygon.setAttribute({visible:!0}),this.selectingBox=[[0,0],[0,0]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate()},stopSelectionMode:function(){return this.selectingMode=!1,this.selectionPolygon.setAttribute({visible:!1}),[this.selectionPolygon.vertices[0].coords,this.selectionPolygon.vertices[2].coords]},_startSelecting:function(t){this.isSelecting=!0,this.selectingBox=[[t[0],t[1]],[t[0],t[1]]],this._setSelectionPolygonFromBox()},_moveSelecting:function(t){this.isSelecting&&(this.selectingBox[1]=[t[0],t[1]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate())},_stopSelecting:function(t){var e=this.getMousePosition(t);this.isSelecting=!1,this.selectingBox[1]=[e[0],e[1]],this._setSelectionPolygonFromBox()},_setSelectionPolygonFromBox:function(){var t=this.selectingBox[0],e=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(jxg.A.COORDS_BY_SCREEN,[t[0],t[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(jxg.A.COORDS_BY_SCREEN,[t[0],e[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(jxg.A.COORDS_BY_SCREEN,[e[0],e[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(jxg.A.COORDS_BY_SCREEN,[e[0],t[1]])},_testForSelection:function(t){this._isRequiredKeyPressed(t,"selection")&&(utils_type.A.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(t){var e;return utils_type.A.exists(this.selectionPolygon)||!0===(e=utils_type.A.copyAttributes(t,src_options.A,"board","selection")).enabled&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],e)),this},__evt__attribute:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__pointerdown:function(t){},__evt__touchstart:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__pointerup:function(t){},__evt__touchend:function(t){},__evt__click:function(t){},__evt__dblclick:function(t){},__evt__mouseclick:function(t){},__evt__mousedblclick:function(t){},__evt__pointerclick:function(t){},__evt__pointerdblclick:function(t){},__evt__move:function(t,e){},__evt__mousemove:function(t,e){},__evt__penmove:function(t,e){},__evt__pointermove:function(t,e){},__evt__touchmove:function(t,e){},__evt__keymove:function(t,e){},__evt__hit:function(t,e,i){},__evt__mousehit:function(t,e,i){},__evt__update:function(){},__evt__boundingbox:function(){},__evt__startselecting:function(){},__evt__mousestartselecting:function(){},__evt__pointerstartselecting:function(){},__evt__touchstartselecting:function(){},__evt__stopselecting:function(){},__evt__mousestopselecting:function(){},__evt__pointerstopselecting:function(){},__evt__touchstopselecting:function(){},__evt__moveselecting:function(){},__evt__mousemoveselecting:function(){},__evt__pointermoveselecting:function(){},__evt__touchmoveselecting:function(){},__evt:function(){},toFullscreen:function(t){var e,i,s,r,o=this.document;return t=t||this.container,this._fullscreen_inner_id=t,s=o.getElementById(t),e="fullscreenwrap_"+t,utils_type.A.exists(s._cssFullscreenStore)||(r=this.containerObj.getBoundingClientRect(),s._cssFullscreenStore={w:r.width,h:r.height}),o.getElementById(e)?i=o.getElementById(e):((i=document.createElement("div")).classList.add("JXG_wrap_private"),i.setAttribute("id",e),s.parentNode.insertBefore(i,s),i.appendChild(s)),i.requestFullscreen=i.requestFullscreen||i.webkitRequestFullscreen||i.mozRequestFullScreen||i.msRequestFullscreen,null===(void 0!==o.fullscreenElement?o.fullscreenElement:void 0!==o.webkitFullscreenElement?o.webkitFullscreenElement:o.msFullscreenElement)?i.requestFullscreen&&(i.requestFullscreen(),this.startFullscreenResizeObserver(i)):(this.stopFullscreenResizeObserver(i),utils_type.A.exists(document.exitFullscreen)?document.exitFullscreen():utils_type.A.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(t){var e,i,s,r=this.document;e=this._fullscreen_inner_id,utils_type.A.exists(e)&&(s=void 0!==r.fullscreenElement?r.fullscreenElement:void 0!==r.webkitFullscreenElement?r.webkitFullscreenElement:r.msFullscreenElement,i=r.getElementById(e),s?(i._cssFullscreenStore.id=s.id,i._cssFullscreenStore.isFullscreen=!0,i._cssFullscreenStore.margin=i.style.margin,i._cssFullscreenStore.width=i.style.width,i._cssFullscreenStore.height=i.style.height,i._cssFullscreenStore.transform=i.style.transform,i.style.width=i._cssFullscreenStore.w+"px",i.style.height=i._cssFullscreenStore.h+"px",i.style.margin="",env.A.scaleJSXGraphDiv(s.id,e,r,utils_type.A.evaluate(this.attr.fullscreen.scale)),s=null):utils_type.A.exists(i._cssFullscreenStore)&&(i._cssFullscreenStore.isFullscreen=!1,i.style.margin=i._cssFullscreenStore.margin,i.style.width=i._cssFullscreenStore.width,i.style.height=i._cssFullscreenStore.height,i.style.transform=i._cssFullscreenStore.transform,i._cssFullscreenStore=null,i.parentElement.replaceWith(i)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(t){var e=this;return env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(this.resizeObserver=new ResizeObserver(function(i){var s,r,o=e.document;e._isResizing||(e._isResizing=!0,window.setTimeout(function(){try{s=e._fullscreen_inner_id,null!==(r=void 0!==o.fullscreenElement?o.fullscreenElement:void 0!==o.webkitFullscreenElement?o.webkitFullscreenElement:o.msFullscreenElement)&&env.A.scaleJSXGraphDiv(r.id,s,o,utils_type.A.evaluate(e.attr.fullscreen.scale))}catch(i){e.stopFullscreenResizeObserver(t)}finally{e._isResizing=!1}},e.attr.resize.throttle))}),this.resizeObserver.observe(t),this):this},stopFullscreenResizeObserver:function(t){return env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(utils_type.A.exists(this.resizeObserver)&&this.resizeObserver.unobserve(t),this):this},addLogEntry:function(t,e,i){var s,r,o=this.userLog.length-1;return utils_type.A.exists(e.elementClass)&&(r=e.id),utils_type.A.evaluate(this.attr.logging.enabled)&&(s=(new Date).getTime(),o>=0&&this.userLog[o].type===t&&this.userLog[o].id===r&&s-this.userLog[o].end<500?(this.userLog[o].end=s,this.userLog[o].endpos=i):this.userLog.push({type:t,id:r,start:s,startpos:i,end:s,endpos:i,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(t,e,i,s,r,o,n){var a=this;return new function(){var h,l=0,c=0,u=0,d=i,p=numerics.A.root(function(i){var s=t.X(d),r=t.Y(d),o=e.X(i),n=e.Y(i);return(s-o)*(s-o)+(r-n)*(r-n)},[0,2*Math.PI]),f=0,_=0,g=a.create("transform",[function(){return l}],{type:"rotate"}),A=a.create("transform",[function(){return l},function(){return t.X(d)},function(){return t.Y(d)}],{type:"rotate"}),m=a.create("transform",[function(){return c},function(){return u}],{type:"translate"}),b=function(t,e,i){var s=numerics.A.D(t.X)(e),r=numerics.A.D(t.Y)(e),o=numerics.A.D(t.X)(i),n=numerics.A.D(t.Y)(i),a=numerics.A.D(t.X)(.5*(e+i)),h=numerics.A.D(t.Y)(.5*(e+i)),l=math.A.hypot(s,r),c=math.A.hypot(o,n);return(l+4*math.A.hypot(a,h)+c)*(i-e)/6},y=function(t){return h-b(e,p,t)},v=Math.PI/18,C=9*v,P=null;return this.rolling=function(){var i,o,P,x,E;h=b(t,d,f=d+r*s),_=numerics.A.root(y,p),i=new complex(t.X(f),t.Y(f)),o=new complex(e.X(_),e.Y(_)),P=new complex(numerics.A.D(t.X)(f),numerics.A.D(t.Y)(f)),x=new complex(numerics.A.D(e.X)(_),numerics.A.D(e.Y)(_)),E=complex.C.div(P,x),l=Math.atan2(E.imaginary,E.real),E.div(complex.C.abs(E)),E.mult(o),c=i.real-E.real,u=i.imaginary-E.imaginary,l<-v&&l>-C?(l=-v,A.applyOnce(n)):l>v&&l<C?(l=v,A.applyOnce(n)):(g.applyOnce(n),m.applyOnce(n),d=f,p=_),a.update()},this.start=function(){return o>0&&(P=window.setInterval(this.rolling,o)),this},this.stop=function(){return window.clearInterval(P),this},this}}});var base_board=jxg.A.Board;jxg.A.SVGRenderer=function(t,e){var i;for(this.type="svg",this.isIE=-1!==navigator.appVersion.indexOf("MSIE")||navigator.userAgent.match(/Trident\//),this.svgRoot=null,this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",this.container=t,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.svgRoot=this.container.ownerDocument.createElementNS(this.svgNamespace,"svg"),this.svgRoot.style.overflow="hidden",this.svgRoot.style.display="block",this.resize(e.width,e.height),this.container.appendChild(this.svgRoot),this.defs=this.container.ownerDocument.createElementNS(this.svgNamespace,"defs"),this.svgRoot.appendChild(this.defs),this.createShadowFilter=function(t,e,i,s,r,o){var n,a,h,l,c,u=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter");return u.setAttributeNS(null,"id",t),u.setAttributeNS(null,"width","300%"),u.setAttributeNS(null,"height","300%"),u.setAttributeNS(null,"filterUnits","userSpaceOnUse"),(n=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset")).setAttributeNS(null,"in","SourceGraphic"),n.setAttributeNS(null,"result","offOut"),n.setAttributeNS(null,"dx",o[0]),n.setAttributeNS(null,"dy",o[1]),u.appendChild(n),(a=this.container.ownerDocument.createElementNS(this.svgNamespace,"feColorMatrix")).setAttributeNS(null,"in","offOut"),a.setAttributeNS(null,"result","colorOut"),a.setAttributeNS(null,"type","matrix"),"none"===e||!utils_type.A.isArray(e)||e.length<3?a.setAttributeNS(null,"values","0.1 0 0 0 0  0 0.1 0 0 0  0 0 0.1 0 0  0 0 0 "+i+" 0"):(e[0]/=255,e[1]/=255,e[2]/=255,c=s+" 0 0 0 "+e[0]+"  0 "+s+" 0 0 "+e[1]+"  0 0 "+s+" 0 "+e[2]+"  0 0 0 "+i+" 0",a.setAttributeNS(null,"values",c)),u.appendChild(a),(h=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur")).setAttributeNS(null,"in","colorOut"),h.setAttributeNS(null,"result","blurOut"),h.setAttributeNS(null,"stdDeviation",r),u.appendChild(h),(l=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend")).setAttributeNS(null,"in","SourceGraphic"),l.setAttributeNS(null,"in2","blurOut"),l.setAttributeNS(null,"mode","normal"),u.appendChild(l),u},this.uniqName=function(){return this.container.id+"_"+Array.prototype.slice.call(arguments).join("_")},this.toStr=function(){var t=Array.prototype.slice.call(arguments).join("");return utils_type.A.exists(encodeURIComponent)&&(t=encodeURIComponent(t)),t},this.toURL=function(){return"url(#"+this.toStr.apply(this,arguments)+")"},this.defs.appendChild(this.createShadowFilter(this.uniqName("f1"),"none",1,.1,3,[5,5])),this.layer=[],i=0;i<src_options.A.layer.numlayers;i++)this.layer[i]=this.container.ownerDocument.createElementNS(this.svgNamespace,"g"),this.svgRoot.appendChild(this.layer[i]);try{this.foreignObjLayer=this.container.ownerDocument.createElementNS(this.svgNamespace,"foreignObject"),this.foreignObjLayer.setAttribute("display","none"),this.foreignObjLayer.setAttribute("x",0),this.foreignObjLayer.setAttribute("y",0),this.foreignObjLayer.setAttribute("width","100%"),this.foreignObjLayer.setAttribute("height","100%"),this.foreignObjLayer.setAttribute("id",this.uniqName("foreignObj")),this.svgRoot.appendChild(this.foreignObjLayer),this.supportsForeignObject=!0}catch(t){this.supportsForeignObject=!1}},jxg.A.SVGRenderer.prototype=new renderer_abstract,jxg.A.extend(jxg.A.SVGRenderer.prototype,{_createArrowHead:function(t,e,i){var s,r,o,n,a=t.id+"Triangle";return utils_type.A.exists(e)&&(a+=e),utils_type.A.exists(i)&&(a+=i),(s=this.createPrim("marker",a)).setAttributeNS(null,"fill","context-stroke"),s.setAttributeNS(null,"stroke","context-stroke"),s.setAttributeNS(null,"stroke-width",0),s.setAttributeNS(null,"orient","auto"),s.setAttributeNS(null,"markerUnits","strokeWidth"),r=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),n=5,"Start"===e?(o=0,2===i?r.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 L 5,5 z"):3===i?r.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z"):4===i?(n=3.31,r.setAttributeNS(null,"d","M 0.00,3.31 C 3.53,3.84 7.13,4.50 10.00,6.63 C 9.33,5.52 8.67,4.42 8.00,3.31 C 8.67,2.21 9.33,1.10 10.00,0.00 C 7.13,2.13 3.53,2.79 0.00,3.31")):5===i?(n=3.28,r.setAttributeNS(null,"d","M 0.00,3.28 C 3.39,4.19 6.81,5.07 10.00,6.55 C 9.38,5.56 9.00,4.44 9.00,3.28 C 9.00,2.11 9.38,0.99 10.00,0.00 C 6.81,1.49 3.39,2.37 0.00,3.28")):6===i?(n=2.84,r.setAttributeNS(null,"d","M 0.00,2.84 C 3.39,3.59 6.79,4.35 10.00,5.68 C 9.67,4.73 9.33,3.78 9.00,2.84 C 9.33,1.89 9.67,0.95 10.00,0.00 C 6.79,1.33 3.39,2.09 0.00,2.84")):7===i?(n=5.2,r.setAttributeNS(null,"d","M 0.00,5.20 C 4.04,5.20 7.99,6.92 10.00,10.39 M 10.00,0.00 C 7.99,3.47 4.04,5.20 0.00,5.20")):r.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 z"),t.elementClass===constants.A.OBJECT_CLASS_LINE&&(o=2===i?4.9:3===i?3.3:4===i||5===i||6===i?6.66:7===i?0:10)):(o=10,2===i?r.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 L 5,5 z"):3===i?(o=3.3,r.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z")):4===i?(n=3.31,r.setAttributeNS(null,"d","M 10.00,3.31 C 6.47,3.84 2.87,4.50 0.00,6.63 C 0.67,5.52 1.33,4.42 2.00,3.31 C 1.33,2.21 0.67,1.10 0.00,0.00 C 2.87,2.13 6.47,2.79 10.00,3.31")):5===i?(n=3.28,r.setAttributeNS(null,"d","M 10.00,3.28 C 6.61,4.19 3.19,5.07 0.00,6.55 C 0.62,5.56 1.00,4.44 1.00,3.28 C 1.00,2.11 0.62,0.99 0.00,0.00 C 3.19,1.49 6.61,2.37 10.00,3.28")):6===i?(n=2.84,r.setAttributeNS(null,"d","M 10.00,2.84 C 6.61,3.59 3.21,4.35 0.00,5.68 C 0.33,4.73 0.67,3.78 1.00,2.84 C 0.67,1.89 0.33,0.95 0.00,0.00 C 3.21,1.33 6.61,2.09 10.00,2.84")):7===i?(n=5.2,r.setAttributeNS(null,"d","M 10.00,5.20 C 5.96,5.20 2.01,6.92 0.00,10.39 M 0.00,0.00 C 2.01,3.47 5.96,5.20 10.00,5.20")):r.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 z"),t.elementClass===constants.A.OBJECT_CLASS_LINE&&(o=2===i?5.1:3===i?.02:4===i||5===i||6===i?3.33:7===i?10:.05)),7===i&&(s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"stroke-width",1)),s.setAttributeNS(null,"refY",n),s.setAttributeNS(null,"refX",o),s.appendChild(r),s},_setArrowColor:function(t,e,i,s,r){t&&(utils_type.A.isString(e)&&(7!==r?this._setAttribute(function(){t.setAttributeNS(null,"fill","context-stroke")},s.visPropOld.fillcolor):this._setAttribute(function(){t.setAttributeNS(null,"fill","none"),t.setAttributeNS(null,"stroke","context-stroke")},s.visPropOld.fillcolor)),s.rendNode.parentNode.insertBefore(s.rendNode,s.rendNode))},_setArrowWidth:function(t,e,i,s){var r,o;t&&(o=(r=e)*s,t.setAttributeNS(null,"viewBox","0 0 "+10*r+" "+10*r),t.setAttributeNS(null,"markerHeight",o),t.setAttributeNS(null,"markerWidth",o),t.setAttributeNS(null,"display","inherit"),i.parentNode.insertBefore(i,i))},updateTicks:function(t){var e,i,s,r,o,n,a,h,l="",c=t.ticks.length,u=!0;for(e=0;e<c;e++){for(o=(s=t.ticks[e])[0],n=s[1],a=o.length,h=" M "+o[0]+" "+n[0],utils_type.A.isNumber(o[0])||(u=!1),i=1;u&&i<a;++i)utils_type.A.isNumber(o[i])?h+=" L "+o[i]+" "+n[i]:u=!1;u&&(l+=h)}r=t.rendNode,utils_type.A.exists(r)||(r=this.createPrim("path",t.id),this.appendChildPrim(r,t.evalVisProp("layer")),t.rendNode=r),r.setAttributeNS(null,"stroke",t.evalVisProp("strokecolor")),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"stroke-opacity",t.evalVisProp("strokeopacity")),r.setAttributeNS(null,"stroke-width",t.evalVisProp("strokewidth")),this.updatePathPrim(r,l,t.board)},displayCopyright:function(t,e){var i,s,r=4+1.8*e,o=6+e;(i=this.createPrim("text","licenseText")).setAttributeNS(null,"x",r+"px"),i.setAttributeNS(null,"y",o+"px"),i.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+e+"px; opacity:0.2;"),i.setAttributeNS(null,"aria-hidden","true"),s=this.container.ownerDocument.createTextNode(t),i.appendChild(s),this.appendChildPrim(i,0)},displayLogo:function(t,e){var i,s=1.5*e;(i=this.createPrim("image","licenseLogo")).setAttributeNS(null,"x","5px"),i.setAttributeNS(null,"y","5px"),i.setAttributeNS(null,"width",s+"px"),i.setAttributeNS(null,"height",s+"px"),i.setAttributeNS(null,"preserveAspectRatio","none"),i.setAttributeNS(null,"style","opacity:0.2;"),i.setAttributeNS(null,"aria-hidden","true"),i.setAttributeNS(this.xlinkNamespace,"xlink:href",t),this.appendChildPrim(i,0)},drawInternalText:function(t){var e=this.createPrim("text",t.id);return e.style.whiteSpace="nowrap",t.rendNodeText=this.container.ownerDocument.createTextNode(""),e.appendChild(t.rendNodeText),this.appendChildPrim(e,t.evalVisProp("layer")),e},updateInternalText:function(t){var e,i,s=t.plaintext,r=t.getAnchorX(),o=t.getAnchorY();i=t.evalVisProp("cssclass"),t.rendNode.getAttributeNS(null,"class")!==i&&(t.rendNode.setAttributeNS(null,"class",i),t.needsSizeUpdate=!0),isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(e=t.coords.scrCoords[1],t.visPropOld.left!==r+e&&(t.rendNode.setAttributeNS(null,"x",e+"px"),"left"===r?t.rendNode.setAttributeNS(null,"text-anchor","start"):"right"===r?t.rendNode.setAttributeNS(null,"text-anchor","end"):"middle"===r&&t.rendNode.setAttributeNS(null,"text-anchor","middle"),t.visPropOld.left=r+e),e=t.coords.scrCoords[2],t.visPropOld.top!==o+e&&(t.rendNode.setAttributeNS(null,"y",e+.5*this.vOffsetText+"px"),"bottom"===o?(t.rendNode.setAttributeNS(null,"dy","0"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"top"===o?(t.rendNode.setAttributeNS(null,"dy","1.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"middle"===o&&(t.rendNode.setAttributeNS(null,"dy","0.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")),t.visPropOld.top=o+e)),t.htmlStr!==s&&(t.rendNodeText.data=s,t.htmlStr=s),this.transformRect(t,t.transformations)},updateInternalTextStyle:function(t,e,i,s){this.setObjectFillColor(t,e,i)},drawImage:function(t){var e=this.createPrim("image",t.id);e.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(e,t.evalVisProp("layer")),t.rendNode=e,this.updateImage(t)},transformRect:function(t,e){var i,s,r,o,n,a="";if(e.length>0&&(r=t.rendNode,-1===(i=[(s=this.joinTransforms(t,e))[1][1],s[2][1],s[1][2],s[2][2],s[1][0],s[2][0]].join(",")).indexOf("NaN")))if(a+=" matrix("+i+") ",t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(r.style.transform=a,o=-t.coords.scrCoords[1],n=-t.coords.scrCoords[2],t.evalVisProp("anchorx")){case"right":o+=t.size[0];break;case"middle":o+=.5*t.size[0]}switch(t.evalVisProp("anchory")){case"bottom":n+=t.size[1];break;case"middle":n+=.5*t.size[1]}r.style["transform-origin"]=o+"px "+n+"px"}else r.setAttributeNS(null,"transform",a)},updateImageURL:function(t){var e=t.eval(t.url);return t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",e),t._src=e,!0)},updateImageStyle:function(t,e){var i=t.evalVisProp(e?"highlightcssclass":"cssclass");t.rendNode.setAttributeNS(null,"class",i)},drawForeignObject:function(t){t.rendNode=this.appendChildPrim(this.createPrim("foreignObject",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"foreignObject"),this.updateForeignObject(t)},updateForeignObject:function(t){t._useUserSize?t.rendNode.style.overflow="hidden":t.rendNode.style.overflow="visible",this.updateRectPrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),!0===t.evalVisProp("evaluateOnlyOnce")&&t.renderedOnce||(t.rendNode.innerHTML=t.content,t.renderedOnce=!0),this._updateVisual(t,{stroke:!0,dash:!0},!0)},appendChildPrim:function(t,e){return utils_type.A.exists(e)?e>=src_options.A.layer.numlayers&&(e=src_options.A.layer.numlayers-1):e=0,this.layer[e].appendChild(t),t},createPrim:function(t,e){var i=this.container.ownerDocument.createElementNS(this.svgNamespace,t);return i.setAttributeNS(null,"id",this.uniqName(e)),i.style.position="absolute","path"===t&&(i.setAttributeNS(null,"stroke-linecap","round"),i.setAttributeNS(null,"stroke-linejoin","round"),i.setAttributeNS(null,"fill-rule","evenodd")),i},remove:function(t){utils_type.A.exists(t)&&utils_type.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},setLayer:function(t,e){utils_type.A.exists(e)?e>=src_options.A.layer.numlayers&&(e=src_options.A.layer.numlayers-1):e=0,this.layer[e].appendChild(t.rendNode)},makeArrows:function(t,e){var i,s,r=e.evFirst,o=e.evLast;this.isIE&&t.visPropCalc.visible&&(r||o)?t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode):(i=t.rendNodeTriangleStart,r?(s=this.toStr(this.container.id,"_",t.id,"TriangleStart",e.typeFirst),utils_type.A.exists(i)&&i.id===s||(null===(i=this.container.ownerDocument.getElementById(s))&&(i=this._createArrowHead(t,"Start",e.typeFirst),this.defs.appendChild(i)),t.rendNodeTriangleStart=i,t.rendNode.setAttributeNS(null,"marker-start",this.toURL(s)))):(utils_type.A.exists(i)&&(this.remove(i),t.rendNodeTriangleStart=null),t.rendNode.removeAttributeNS(null,"marker-start")),i=t.rendNodeTriangleEnd,o?(s=this.toStr(this.container.id,"_",t.id,"TriangleEnd",e.typeLast),utils_type.A.exists(i)&&i.id===s||(null===(i=this.container.ownerDocument.getElementById(s))&&(i=this._createArrowHead(t,"End",e.typeLast),this.defs.appendChild(i)),t.rendNodeTriangleEnd=i,t.rendNode.setAttributeNS(null,"marker-end",this.toURL(s)))):(utils_type.A.exists(i)&&(this.remove(i),t.rendNodeTriangleEnd=null),t.rendNode.removeAttributeNS(null,"marker-end")))},updateEllipsePrim:function(t,e,i,s,r){var o;o=2e5,e=Math.abs(e)<o?e:o*e/Math.abs(e),i=Math.abs(i)<o?i:o*i/Math.abs(i),s=Math.abs(s)<o?s:o*s/Math.abs(s),r=Math.abs(r)<o?r:o*r/Math.abs(r),t.setAttributeNS(null,"cx",e),t.setAttributeNS(null,"cy",i),t.setAttributeNS(null,"rx",Math.abs(s)),t.setAttributeNS(null,"ry",Math.abs(r))},updateLinePrim:function(t,e,i,s,r){var o;o=2e5,isNaN(e+i+s+r)||(e=Math.abs(e)<o?e:o*e/Math.abs(e),i=Math.abs(i)<o?i:o*i/Math.abs(i),s=Math.abs(s)<o?s:o*s/Math.abs(s),r=Math.abs(r)<o?r:o*r/Math.abs(r),t.setAttributeNS(null,"x1",e),t.setAttributeNS(null,"y1",i),t.setAttributeNS(null,"x2",s),t.setAttributeNS(null,"y2",r))},updatePathPrim:function(t,e){""===e&&(e="M 0 0"),t.setAttributeNS(null,"d",e)},updatePathStringPoint:function(t,e,i){var s="",r=t.coords.scrCoords,o=e*Math.sqrt(3)*.5,n=.5*e;return"x"===i?s=" M "+(r[1]-e)+" "+(r[2]-e)+" L "+(r[1]+e)+" "+(r[2]+e)+" M "+(r[1]+e)+" "+(r[2]-e)+" L "+(r[1]-e)+" "+(r[2]+e):"+"===i?s=" M "+(r[1]-e)+" "+r[2]+" L "+(r[1]+e)+" "+r[2]+" M "+r[1]+" "+(r[2]-e)+" L "+r[1]+" "+(r[2]+e):"|"===i?s=" M "+r[1]+" "+(r[2]-e)+" L "+r[1]+" "+(r[2]+e):"-"===i?s=" M "+(r[1]-e)+" "+r[2]+" L "+(r[1]+e)+" "+r[2]:"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s=" M "+(r[1]-e)+" "+r[2]+" L "+r[1]+" "+(r[2]+e)+" L "+(r[1]+e)+" "+r[2]+" L "+r[1]+" "+(r[2]-e)+" Z "):"^"===i?s=" M "+r[1]+" "+(r[2]-e)+" L "+(r[1]-o)+" "+(r[2]+n)+" L "+(r[1]+o)+" "+(r[2]+n)+" Z ":"v"===i?s=" M "+r[1]+" "+(r[2]+e)+" L "+(r[1]-o)+" "+(r[2]-n)+" L "+(r[1]+o)+" "+(r[2]-n)+" Z ":">"===i?s=" M "+(r[1]+e)+" "+r[2]+" L "+(r[1]-n)+" "+(r[2]-o)+" L "+(r[1]-n)+" "+(r[2]+o)+" Z ":"<"===i&&(s=" M "+(r[1]-e)+" "+r[2]+" L "+(r[1]+n)+" "+(r[2]-o)+" L "+(r[1]+n)+" "+(r[2]+o)+" Z "),s},updatePathStringPrim:function(t){var e,i,s,r=" M ",o=r,n=5e3,a="";if(t.numberPoints<=0)return"";if(s=Math.min(t.points.length,t.numberPoints),1===t.bezierDegree)for(e=0;e<s;e++)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?o=r:(i[1]=Math.max(Math.min(i[1],n),-5e3),i[2]=Math.max(Math.min(i[2],n),-5e3),a+=o+i[1]+" "+i[2],o=" L ");else if(3===t.bezierDegree)for(e=0;e<s;)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?o=r:(a+=o+i[1]+" "+i[2]," C "===o&&(e+=1,a+=" "+(i=t.points[e].scrCoords)[1]+" "+i[2],e+=1,a+=" "+(i=t.points[e].scrCoords)[1]+" "+i[2]),o=" C "),e+=1;return a},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a,h=" M ",l=h,c=5e3,u="",d=t.evalVisProp("strokewidth"),p="plot"!==t.evalVisProp("curvetype");if(t.numberPoints<=0)return"";for(p&&t.board.options.curve.RDPsmoothing&&(t.points=numerics.A.RamerDouglasPeucker(t.points,.5)),a=Math.min(t.points.length,t.numberPoints),i=1;i<3;i++)for(l=h,e=0;e<a;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?l=h:(r[1]=Math.max(Math.min(r[1],c),-5e3),r[2]=Math.max(Math.min(r[2],c),-5e3),l===h?u+=l+r[1]+" "+r[2]:(s=2*i,u+=[l,o+.333*(r[1]-o)+d*(s*Math.random()-i)," ",n+.333*(r[2]-n)+d*(s*Math.random()-i)," ",o+.666*(r[1]-o)+d*(s*Math.random()-i)," ",n+.666*(r[2]-n)+d*(s*Math.random()-i)," ",r[1]," ",r[2]].join("")),l=" C ",o=r[1],n=r[2]);return u},updatePolygonPrim:function(t,e){var i,s,r="",o=e.vertices.length;for(t.setAttributeNS(null,"stroke","none"),t.setAttributeNS(null,"fill-rule","evenodd"),"polygonalchain"===e.elType&&o++,i=0;i<o-1;i++){if(!e.vertices[i].isReal)return void t.setAttributeNS(null,"points","");r=r+(s=e.vertices[i].coords.scrCoords)[1]+","+s[2],i<o-2&&(r+=" ")}-1===r.indexOf("NaN")&&t.setAttributeNS(null,"points",r)},updateRectPrim:function(t,e,i,s,r){t.setAttributeNS(null,"x",e),t.setAttributeNS(null,"y",i),t.setAttributeNS(null,"width",s),t.setAttributeNS(null,"height",r)},_setAttribute:function(t,e){""===e?t():window.setTimeout(t,1)},display:function(t,e){var i;t&&t.rendNode&&(t.visPropOld.visible=e,i=t.rendNode,e?(i.setAttributeNS(null,"display","inline"),i.style.visibility="inherit"):(i.setAttributeNS(null,"display","none"),i.style.visibility="hidden"))},hide:function(t){jxg.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),this.display(t,!1)},setARIA:function(t){var e,i,s;for(e in t.visProp.aria)t.visProp.aria.hasOwnProperty(e)&&"enabled"!==e&&(i="aria."+e,s=t.evalVisProp("aria."+e),t.visPropOld[i]!==s&&(this.setPropertyPrim(t.rendNode,"aria-"+e,s),t.visPropOld[i]=s))},setBuffering:function(t,e){t.rendNode.setAttribute("buffered-rendering",e)},setCssClass(t,e){t.visPropOld.cssclass!==e&&(this.setPropertyPrim(t.rendNode,"class",e),t.visPropOld.cssclass=e)},setDashStyle:function(t){var e=t.evalVisProp("dash"),i=t.evalVisProp("dashscale")?.5*t.evalVisProp("strokewidth"):1,s=t.rendNode;e>0?s.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map(function(t){return t*i}).join(",")):s.hasAttributeNS(null,"stroke-dasharray")&&s.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,s,r=t.rendNode,o=t.evalVisProp("gradient");"linear"===o||"radial"===o?(e=this.createPrim(o+"Gradient",t.id+"_gradient"),i=this.createPrim("stop",t.id+"_gradient1"),s=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(s),this.defs.appendChild(e),r.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=i,t.gradNode2=s,t.gradNode=e):r.removeAttributeNS(null,"style")},setLineCap:function(t){var e=t.evalVisProp("linecap");void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&utils_type.A.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setObjectFillColor:function(t,e,i,s){var r,o,n,a,h=e,l=i,c=t.evalVisProp("gradient");l=l>0?l:0,t.visPropOld.fillcolor===h&&t.visPropOld.fillopacity===l&&null===c||(utils_type.A.exists(h)&&!1!==h&&(9!==h.length?(o=h,a=l):(n=utils_color.A.rgba2rgbo(h),o=n[0],a=l*n[1]),r=void 0===s?t.rendNode:s,"none"!==o&&""!==o&&!1!==o&&this._setAttribute(function(){r.setAttributeNS(null,"fill",o)},t.visPropOld.fillcolor),t.type===jxg.A.OBJECT_TYPE_IMAGE?this._setAttribute(function(){r.setAttributeNS(null,"opacity",a)},t.visPropOld.fillopacity):("none"===o?(a=0,r.setAttributeNS(null,"pointer-events","visibleStroke")):r.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute(function(){r.setAttributeNS(null,"fill-opacity",a)},t.visPropOld.fillopacity)),"linear"!==c&&"radial"!==c||this.updateGradient(t)),t.visPropOld.fillcolor=h,t.visPropOld.fillopacity=l)},setObjectStrokeColor:function(t,e,i){var s,r,o,n,a=e,h=i;h=h>0?h:0,t.visPropOld.strokecolor===a&&t.visPropOld.strokeopacity===h||(utils_type.A.exists(a)&&!1!==a&&(9!==a.length?(s=a,o=h):(r=utils_color.A.rgba2rgbo(a),s=r[0],o=h*r[1]),n=t.rendNode,t.elementClass===constants.A.OBJECT_CLASS_TEXT?"html"===t.evalVisProp("display")?this._setAttribute(function(){n.style.color=s,n.style.opacity=o},t.visPropOld.strokecolor):this._setAttribute(function(){n.setAttributeNS(null,"fill",s),n.setAttributeNS(null,"fill-opacity",o)},t.visPropOld.strokecolor):this._setAttribute(function(){n.setAttributeNS(null,"stroke",s),n.setAttributeNS(null,"stroke-opacity",o)},t.visPropOld.strokecolor),t.elementClass!==constants.A.OBJECT_CLASS_CURVE&&t.elementClass!==constants.A.OBJECT_CLASS_LINE||(t.evalVisProp("firstarrow")&&this._setArrowColor(t.rendNodeTriangleStart,s,o,t,t.visPropCalc.typeFirst),t.evalVisProp("lastarrow")&&this._setArrowColor(t.rendNodeTriangleEnd,s,o,t,t.visPropCalc.typeLast))),t.visPropOld.strokecolor=a,t.visPropOld.strokeopacity=h)},setObjectStrokeWidth:function(t,e){var i,s=e;isNaN(s)||t.visPropOld.strokewidth===s||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),utils_type.A.exists(s)&&this.setPropertyPrim(i,"stroke-width",s+"px"),t.visPropOld.strokewidth=s)},setObjectTransition:function(t,e){var i,s,r,o=[],n=0,a=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(void 0===e&&(e=t.evalVisProp("transitionduration")),i=t.evalVisProp("transitionproperties"),e!==t.visPropOld.transitionduration||i!==t.visPropOld.transitionproperties){for(utils_type.A.exists(i)&&(n=i.length),r=0;r<n;r++)o.push(i[r]+" "+e+"ms");for(s=o.join(", "),n=a.length,r=0;r<n;++r)t[a[r]]&&(t[a[r]].style.transition=s);t.visPropOld.transitionduration=e,t.visPropOld.transitionproperties=i}},setShadow:function(t){var e,i,s,r,o,n,a,h,l=t.evalVisProp("shadow"),c=!0,u=!1;(e=JSON.stringify(l))!==t.visPropOld.shadow&&("boolean"==typeof l?(c=!0,u=l,i="none",s=3,r=.1,o=[5,5],n=1):t.evalVisProp("shadow.enabled")?(c=!1,u=!0,i=jxg.A.rgbParser(t.evalVisProp("shadow.color")),s=t.evalVisProp("shadow.blur"),r=t.evalVisProp("shadow.blend"),o=t.evalVisProp("shadow.offset"),n=t.evalVisProp("shadow.opacity")):u=!1,utils_type.A.exists(t.rendNode)&&(u?c?t.rendNode.setAttributeNS(null,"filter",this.toURL(this.container.id+"_f1")):((h=this.container.ownerDocument.getElementById(a))&&this.defs.removeChild(h),a=t.rendNode.id+"_f1",this.defs.appendChild(this.createShadowFilter(a,i,n,r,s,o)),t.rendNode.setAttributeNS(null,"filter",this.toURL(a))):t.rendNode.removeAttributeNS(null,"filter")),t.visPropOld.shadow=e)},setTabindex:function(t){var e;t.board.attr.keyboard.enabled&&utils_type.A.exists(t.rendNode)&&(e=t.evalVisProp("tabindex"),t.visPropCalc.visible||(e=null),e!==t.visPropOld.tabindex&&(t.rendNode.setAttribute("tabindex",e),t.visPropOld.tabindex=e))},setPropertyPrim:function(t,e,i){"stroked"!==e&&t.setAttributeNS(null,e,i)},show:function(t){jxg.A.deprecated("Board.renderer.show()","Board.renderer.display()"),this.display(t,!0)},updateGradient:function(t){var e,i,s=t.gradNode1,r=t.gradNode2,o=t.evalVisProp("gradient");utils_type.A.exists(s)&&utils_type.A.exists(r)&&(i=(i=t.evalVisProp("fillopacity"))>0?i:0,e=t.evalVisProp("fillcolor"),s.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),r.setAttributeNS(null,"style","stop-color:"+t.evalVisProp("gradientsecondcolor")+";stop-opacity:"+t.evalVisProp("gradientsecondopacity")),s.setAttributeNS(null,"offset",100*t.evalVisProp("gradientstartoffset")+"%"),r.setAttributeNS(null,"offset",100*t.evalVisProp("gradientendoffset")+"%"),"linear"===o?this.updateGradientAngle(t.gradNode,t.evalVisProp("gradientangle")):"radial"===o&&this.updateGradientCircle(t.gradNode,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr")))},updateGradientAngle:function(t,e){var i=1,s=Math.cos(e),r=Math.sin(e);Math.abs(s)>Math.abs(r)?i/=Math.abs(s):i/=Math.abs(r),s>=0?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",s*i)):(t.setAttributeNS(null,"x1",-s*i),t.setAttributeNS(null,"x2",0)),r>=0?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",r*i)):(t.setAttributeNS(null,"y1",-r*i),t.setAttributeNS(null,"y2",0))},updateGradientCircle:function(t,e,i,s,r,o,n){t.setAttributeNS(null,"cx",100*e+"%"),t.setAttributeNS(null,"cy",100*i+"%"),t.setAttributeNS(null,"r",100*s+"%"),t.setAttributeNS(null,"fx",100*r+"%"),t.setAttributeNS(null,"fy",100*o+"%"),t.setAttributeNS(null,"fr",100*n+"%")},suspendRedraw:function(){this.suspendHandle=this.svgRoot.suspendRedraw(1e4)},unsuspendRedraw:function(){this.svgRoot.unsuspendRedraw(this.suspendHandle)},resize:function(t,e){this.svgRoot.setAttribute("width",parseFloat(t)),this.svgRoot.setAttribute("height",parseFloat(e))},createTouchpoints:function(t){var e,i,s,r;for(this.touchpoints=[],e=0;e<t;e++)i="touchpoint1_"+e,r=this.createPrim("path",i),this.appendChildPrim(r,19),r.setAttributeNS(null,"d","M 0 0"),this.touchpoints.push(r),this.setPropertyPrim(r,"stroked","true"),this.setPropertyPrim(r,"stroke-width","1px"),r.setAttributeNS(null,"stroke","#000000"),r.setAttributeNS(null,"stroke-opacity",1),r.setAttributeNS(null,"display","none"),s="touchpoint2_"+e,r=this.createPrim("ellipse",s),this.appendChildPrim(r,19),this.updateEllipsePrim(r,0,0,0,0),this.touchpoints.push(r),this.setPropertyPrim(r,"stroked","true"),this.setPropertyPrim(r,"stroke-width","1px"),r.setAttributeNS(null,"stroke","#000000"),r.setAttributeNS(null,"fill","#ffffff"),r.setAttributeNS(null,"stroke-opacity",1),r.setAttributeNS(null,"fill-opacity",0),r.setAttributeNS(null,"display","none")},showTouchpoint:function(t){this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(this.touchpoints[2*t].setAttributeNS(null,"display","inline"),this.touchpoints[2*t+1].setAttributeNS(null,"display","inline"))},hideTouchpoint:function(t){this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(this.touchpoints[2*t].setAttributeNS(null,"display","none"),this.touchpoints[2*t+1].setAttributeNS(null,"display","none"))},updateTouchpoint:function(t,e){var i,s;this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(i=e[0],s=e[1],this.touchpoints[2*t].setAttributeNS(null,"d","M "+(i-37)+" "+s+" L "+(i+37)+" "+s+" M "+i+" "+(s-37)+" L "+i+" "+(s+37)),this.updateEllipsePrim(this.touchpoints[2*t+1],e[0],e[1],25,25))},_getValuesOfDOMElements:function(t){var e=[];if(1===t.nodeType)for(t=t.firstChild;t;)void 0!==t.id&&void 0!==t.value&&e.push([t.id,t.value]),utils_type.A.concat(e,this._getValuesOfDOMElements(t)),t=t.nextSibling;return e},_getImgDataURL:function(t){var e,i,s,r,o,n;if((i=(e=t.getElementsByTagName("image")).length)>0)for(s=document.createElement("canvas"),n=0;n<i;n++){e[n].setAttribute("crossorigin","anonymous"),r=s.getContext("2d"),s.width=e[n].getAttribute("width"),s.height=e[n].getAttribute("height");try{r.drawImage(e[n],0,0,s.width,s.height),o=s.toDataURL(),e[n].setAttribute("xlink:href",o)}catch(t){console.log("CORS problem! Image can not be used",t)}}return!0},dumpToDataURI:function(t){var e,i,s,r=this.svgRoot,o=window.btoa||base64.encode,n=[];if(this.container.hasChildNodes()&&utils_type.A.exists(this.foreignObjLayer))for(t||this.foreignObjLayer.setAttribute("display","inline");r.nextSibling;)utils_type.A.concat(n,this._getValuesOfDOMElements(r.nextSibling)),this.foreignObjLayer.appendChild(r.nextSibling);if(this._getImgDataURL(r),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),e=(new XMLSerializer).serializeToString(r),!0!==t)for(s=n.length,i=0;i<s;i++)e=e.replace('id="'+n[i][0]+'"','id="'+n[i][0]+'" value="'+n[i][1]+'"');if(this.isIE&&(e.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g)||[]).length>1&&(e=e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),e=e.replace(/&nbsp;/g," "),utils_type.A.exists(this.foreignObjLayer)&&this.foreignObjLayer.hasChildNodes()){for(;this.foreignObjLayer.firstChild;)this.container.appendChild(this.foreignObjLayer.firstChild);this.foreignObjLayer.setAttribute("display","none")}return"data:image/svg+xml;base64,"+o(unescape(encodeURIComponent(e)))},dumpToCanvas:function(t,e,i,s){var r,o,n,a;return(n=this.container.ownerDocument.getElementById(t)).width=n.width,a=n.getContext("2d"),void 0!==e&&void 0!==i&&(n.style.width=parseFloat(e)+"px",n.style.height=parseFloat(i)+"px",n.setAttribute("width",parseFloat(e)),n.setAttribute("height",parseFloat(i))),o=new Image,r=this.dumpToDataURI(s),o.src=r,"Promise"in window?new Promise(function(t,s){try{o.onload=function(){a.drawImage(o,0,0,e,i),t()}}catch(t){s(t)}}):(o.onload=function(){window.setTimeout(function(){try{a.drawImage(o,0,0,e,i)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_=this.container.ownerDocument,g=this.container.parentNode,A=t.attr.screenshot,m=!1;return"no"===this.type||(l=A.scale*this.container.getBoundingClientRect().width,c=A.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(m=!0,(n=new Image).style.width=l+"px",n.style.height=c+"px"):(m=!1,n=_.getElementById(e)),m&&((s=_.createElement("div")).style.cssText=A.css,s.style.width=l+"px",s.style.height=c+"px",s.style.zIndex=this.container.style.zIndex+120,s.style.position="absolute",s.style.top=this.container.offsetTop+"px",s.style.left=this.container.offsetLeft+"px"),r=_.createElement("canvas"),o=Math.random().toString(36).slice(2,7),r.setAttribute("id",o),r.setAttribute("width",l),r.setAttribute("height",c),r.style.width=l+"px",r.style.height=l+"px",r.style.display="none",g.appendChild(r),m&&(a=_.createElement("span"),h=_.createTextNode("✖"),a.style.cssText=A.cssButton,a.appendChild(h),a.onclick=function(){s.parentNode.removeChild(s)},s.appendChild(n),s.appendChild(a),g.insertBefore(s,this.container.nextSibling)),u=_.getElementById(this.uniqName("navigationbar")),utils_type.A.exists(u)&&(d=u.style.display,u.style.display="none",p=this.removeToInsertLater(u)),f=function(){n.src=r.toDataURL("image/png"),g.removeChild(r)},"Promise"in window?this.dumpToCanvas(o,l,c,i).then(f):(this.dumpToCanvas(o,l,c,i),window.setTimeout(f,200)),utils_type.A.exists(u)&&(u.style.display=d,p())),this}});var svg=jxg.A.SVGRenderer;jxg.A.VMLRenderer=function(t){this.type="vml",this.container=t,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,utils_type.A.exists(jxg.A.vmlStylesheet)||(t.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),jxg.A.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),jxg.A.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{t.ownerDocument.namespaces.jxgvml||t.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(e){return t.ownerDocument.createElement("<jxgvml:"+e+' class="jxgvml">')}}catch(e){this.createNode=function(e){return t.ownerDocument.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},jxg.A.VMLRenderer.prototype=new renderer_abstract,jxg.A.extend(jxg.A.VMLRenderer.prototype,{_setAttr:function(t,e,i,s){try{8===this.container.ownerDocument.documentMode?t[e]=i:t.setAttribute(e,i,s)}catch(t){jxg.A.debug("_setAttr: "+e+" "+i+"<br>\n")}},updateTicks:function(t){var e,i,s,r,o,n=this.resolution,a=[];for(i=t.ticks.length,e=0;e<i;e++)r=(s=t.ticks[e])[0],o=s[1],utils_type.A.isNumber(r[0])&&utils_type.A.isNumber(r[1])&&a.push(" m "+Math.round(n*r[0])+", "+Math.round(n*o[0])+" l "+Math.round(n*r[1])+", "+Math.round(n*o[1])+" ");utils_type.A.exists(t.rendNode)||(t.rendNode=this.createPrim("path",t.id),this.appendChildPrim(t.rendNode,t.evalVisProp("layer"))),this._setAttr(t.rendNode,"stroked","true"),this._setAttr(t.rendNode,"strokecolor",t.evalVisProp("strokecolor"),1),this._setAttr(t.rendNode,"strokeweight",t.evalVisProp("strokewidth")),this._setAttr(t.rendNodeStroke,"opacity",100*t.evalVisProp("strokeopacity")+"%"),this.updatePathPrim(t.rendNode,a,t.board)},displayCopyright:function(t,e){var i,s;(i=this.createNode("textbox")).style.position="absolute",this._setAttr(i,"id",this.container.id+"_licenseText"),i.style.left=20,i.style.top=2,i.style.fontSize=e,i.style.color="#356AA0",i.style.fontFamily="Arial,Helvetica,sans-serif",this._setAttr(i,"opacity","30%"),i.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 30, enabled = true)",s=this.container.ownerDocument.createTextNode(t),i.appendChild(s),this.appendChildPrim(i,0)},drawInternalText:function(t){var e;return(e=this.createNode("textbox")).style.position="absolute",t.rendNodeText=this.container.ownerDocument.createTextNode(""),e.appendChild(t.rendNodeText),this.appendChildPrim(e,9),e.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",e},updateInternalText:function(t){var e,i,s,r,o,n,a=t.plaintext,h=this.joinTransforms(t,t.transformations),l=[0,0],c=t.rendNode,u=[],d=t.getAnchorX(),p=t.getAnchorY();if(!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])){for("right"===d?l[0]=1:"middle"===d&&(l[0]=.5),"bottom"===p?l[1]=1:"middle"===p&&(l[1]=.5),u[0]=math.A.matVecMult(h,[1,t.coords.scrCoords[1]-l[0]*t.size[0],t.coords.scrCoords[2]+(1-l[1])*t.size[1]+this.vOffsetText]),u[0][1]/=u[0][0],u[0][2]/=u[0][0],u[1]=math.A.matVecMult(h,[1,t.coords.scrCoords[1]+(1-l[0])*t.size[0],t.coords.scrCoords[2]+(1-l[1])*t.size[1]+this.vOffsetText]),u[1][1]/=u[1][0],u[1][2]/=u[1][0],u[2]=math.A.matVecMult(h,[1,t.coords.scrCoords[1]+(1-l[0])*t.size[0],t.coords.scrCoords[2]-l[1]*t.size[1]+this.vOffsetText]),u[2][1]/=u[2][0],u[2][2]/=u[2][0],u[3]=math.A.matVecMult(h,[1,t.coords.scrCoords[1]-l[0]*t.size[0],t.coords.scrCoords[2]-l[1]*t.size[1]+this.vOffsetText]),u[3][1]/=u[3][0],u[3][2]/=u[3][0],i=u[0][1],r=u[0][1],s=u[0][2],o=u[0][2],n=1;n<4;n++)i=Math.max(i,u[n][1]),r=Math.min(r,u[n][1]),s=Math.max(s,u[n][2]),o=Math.min(o,u[n][2]);e=1===l[0]?Math.floor(t.board.canvasWidth-i):Math.floor(r),t.visPropOld.left!==d+e&&(1===l[0]?(t.rendNode.style.right=e+"px",t.rendNode.style.left="auto"):(t.rendNode.style.left=e+"px",t.rendNode.style.right="auto"),t.visPropOld.left=d+e),e=1===l[1]?Math.floor(t.board.canvasHeight-s):Math.floor(o),t.visPropOld.top!==p+e&&(1===l[1]?(t.rendNode.style.bottom=e+"px",t.rendNode.style.top="auto"):(t.rendNode.style.top=e+"px",t.rendNode.style.bottom="auto"),t.visPropOld.top=p+e)}t.htmlStr!==a&&(t.rendNodeText.data=a,t.htmlStr=a),c.filters.item(0).M11=h[1][1],c.filters.item(0).M12=h[1][2],c.filters.item(0).M21=h[2][1],c.filters.item(0).M22=h[2][2],c.filters.item(0).enabled=!0},drawImage:function(t){var e;(e=this.container.ownerDocument.createElement("img")).style.position="absolute",this._setAttr(e,"id",this.container.id+"_"+t.id),this.container.appendChild(e),this.appendChildPrim(e,t.evalVisProp("layer")),e.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",t.rendNode=e,this.updateImage(t)},transformRect:function(t,e){var i,s,r,o,n,a,h=t.rendNode,l=[];if(e.length>0){for(i=this.joinTransforms(t,e),l[0]=math.A.matVecMult(i,t.coords.scrCoords),l[0][1]/=l[0][0],l[0][2]/=l[0][0],l[1]=math.A.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]]),l[1][1]/=l[1][0],l[1][2]/=l[1][0],l[2]=math.A.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]-t.size[1]]),l[2][1]/=l[2][0],l[2][2]/=l[2][0],l[3]=math.A.matVecMult(i,[1,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1]]),l[3][1]/=l[3][0],l[3][2]/=l[3][0],s=l[0][1],o=l[0][1],r=l[0][2],n=l[0][2],a=1;a<4;a++)s=Math.max(s,l[a][1]),o=Math.min(o,l[a][1]),r=Math.max(r,l[a][2]),n=Math.min(n,l[a][2]);h.style.left=Math.floor(o)+"px",h.style.top=Math.floor(n)+"px",h.filters.item(0).M11=i[1][1],h.filters.item(0).M12=i[1][2],h.filters.item(0).M21=i[2][1],h.filters.item(0).M22=i[2][2],h.filters.item(0).enabled=!0}},updateImageURL:function(t){var e=t.eval(t.url);this._setAttr(t.rendNode,"src",e)},appendChildPrim:function(t,e){return utils_type.A.exists(e)||(e=0),t.style.zIndex=e,this.container.appendChild(t),t},appendNodesToElement:function(t,e){"shape"!==e&&"path"!==e&&"polygon"!==e||(t.rendNodePath=this.getElementById(t.id+"_path")),t.rendNodeFill=this.getElementById(t.id+"_fill"),t.rendNodeStroke=this.getElementById(t.id+"_stroke"),t.rendNodeShadow=this.getElementById(t.id+"_shadow"),t.rendNode=this.getElementById(t.id)},createPrim:function(t,e){var i,s,r=this.createNode("fill"),o=this.createNode("stroke"),n=this.createNode("shadow");return this._setAttr(r,"id",this.container.id+"_"+e+"_fill"),this._setAttr(o,"id",this.container.id+"_"+e+"_stroke"),this._setAttr(n,"id",this.container.id+"_"+e+"_shadow"),"circle"===t||"ellipse"===t?((i=this.createNode("oval")).appendChild(r),i.appendChild(o),i.appendChild(n)):"polygon"===t||"path"===t||"shape"===t||"line"===t?((i=this.createNode("shape")).appendChild(r),i.appendChild(o),i.appendChild(n),s=this.createNode("path"),this._setAttr(s,"id",this.container.id+"_"+e+"_path"),i.appendChild(s)):((i=this.createNode(t)).appendChild(r),i.appendChild(o),i.appendChild(n)),i.style.position="absolute",i.style.left="0px",i.style.top="0px",this._setAttr(i,"id",this.container.id+"_"+e),i},remove:function(t){utils_type.A.exists(t)&&t.removeNode(!0)},makeArrows:function(t){var e,i=t.evalVisProp("firstarrow"),s=t.evalVisProp("lastarrow");t.visPropOld.firstarrow===i&&t.visPropOld.lastarrow===s||(i?(e=t.rendNodeStroke,this._setAttr(e,"startarrow","block"),this._setAttr(e,"startarrowlength","long")):(e=t.rendNodeStroke,utils_type.A.exists(e)&&this._setAttr(e,"startarrow","none")),s?(e=t.rendNodeStroke,this._setAttr(e,"id",this.container.id+"_"+t.id+"stroke"),this._setAttr(e,"endarrow","block"),this._setAttr(e,"endarrowlength","long")):(e=t.rendNodeStroke,utils_type.A.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=s)},updateEllipsePrim:function(t,e,i,s,r){t.style.left=Math.floor(e-s)+"px",t.style.top=Math.floor(i-r)+"px",t.style.width=Math.floor(2*Math.abs(s))+"px",t.style.height=Math.floor(2*Math.abs(r))+"px"},updateLinePrim:function(t,e,i,s,r,o){var n,a=this.resolution;isNaN(e+i+s+r)||(n=["m ",Math.floor(a*e),", ",Math.floor(a*i)," l ",Math.floor(a*s),", ",Math.floor(a*r)],this.updatePathPrim(t,n,o))},updatePathPrim:function(t,e,i){var s=i.canvasWidth,r=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=s,t.style.height=r,this._setAttr(t,"coordsize",[Math.floor(this.resolution*s),Math.floor(this.resolution*r)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var s=[],r=Math.round,o=t.coords.scrCoords,n=e*Math.sqrt(3)*.5,a=.5*e,h=this.resolution;return"x"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]+e)),", ",r(h*(o[2]+e))," m ",r(h*(o[1]+e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-e)),", ",r(h*(o[2]+e))].join("")):"+"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+e)),", ",r(h*o[2])," m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*o[1]),", ",r(h*(o[2]+e))].join("")):"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]-e))," x e "].join(""))):"^"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]+a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]+a))," x e "].join("")):"v"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]-a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]-a))," x e "].join("")):">"===i?s.push([" m ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*(o[1]-a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]-a)),", ",r(h*(o[2]+n))," l ",r(h*(o[1]+e)),", ",r(h*o[2])].join("")):"<"===i&&s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]+a)),", ",r(h*(o[2]+n))," x e "].join("")),s},updatePathStringPrim:function(t){var e,i,s=[],r=this.resolution,o=Math.round,n=" m ",a=n,h=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(h=Math.min(h,t.points.length),1===t.bezierDegree)for(e=0;e<h;e++)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?a=n:(i[1]>2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),s.push([a,o(r*i[1]),", ",o(r*i[2])].join("")),a=" l ");else if(3===t.bezierDegree)for(e=0;e<h;)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?a=n:(s.push([a,o(r*i[1]),", ",o(r*i[2])].join(""))," c "===a&&(e+=1,i=t.points[e].scrCoords,s.push([" ",o(r*i[1]),", ",o(r*i[2])].join("")),e+=1,i=t.points[e].scrCoords,s.push([" ",o(r*i[1]),", ",o(r*i[2])].join(""))),a=" c "),e+=1;return s.push(" e"),s},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a=[],h=t.evalVisProp("strokewidth"),l=this.resolution,c=Math.round,u=" m ",d=u,p="plot"!==t.evalVisProp("curvetype"),f=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";for(p&&t.board.options.curve.RDPsmoothing&&(t.points=numerics.A.RamerDouglasPeucker(t.points,1)),f=Math.min(f,t.points.length),i=1;i<3;i++)for(d=u,e=0;e<f;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?d=u:(r[1]>2e4?r[1]=2e4:r[1]<-2e4&&(r[1]=-2e4),r[2]>2e4?r[2]=2e4:r[2]<-2e4&&(r[2]=-2e4),d===u?a.push([d,c(l*r[1])," ",c(l*r[2])].join("")):(s=2*i,a.push([d,c(l*(o+.333*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.333*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*(o+.666*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.666*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*r[1])," ",c(l*r[2])].join(""))),d=" c ",o=r[1],n=r[2]);return a.push(" e"),a},updatePolygonPrim:function(t,e){var i,s,r=e.vertices.length,o=this.resolution,n=[];if(this._setAttr(t,"stroked","false"),s=e.vertices[0].coords.scrCoords,!isNaN(s[1]+s[2])){for(n.push(["m ",Math.floor(o*s[1]),",",Math.floor(o*s[2])," l "].join("")),i=1;i<r-1;i++){if(!e.vertices[i].isReal)return void this.updatePathPrim(t,"",e.board);if(s=e.vertices[i].coords.scrCoords,isNaN(s[1]+s[2]))return;n.push(Math.floor(o*s[1])+","+Math.floor(o*s[2])),i<r-2&&n.push(", ")}n.push(" x e"),this.updatePathPrim(t,n,e.board)}},updateRectPrim:function(t,e,i,s,r){t.style.left=Math.floor(e)+"px",t.style.top=Math.floor(i)+"px",s>=0&&(t.style.width=s+"px"),r>=0&&(t.style.height=r+"px")},setPropertyPrim:function(t,e,i){var s,r="";switch(e){case"stroke":r="strokecolor";break;case"stroke-width":r="strokeweight";break;case"stroke-dasharray":r="dashstyle"}""!==r&&(s=i,this._setAttr(t,r,s))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(t){jxg.A.deprecated("Board.renderer.show()","Board.renderer.display()"),t&&t.rendNode&&(t.rendNode.style.visibility="inherit")},hide:function(t){jxg.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),t&&t.rendNode&&(t.rendNode.style.visibility="hidden")},setDashStyle:function(t,e){var i;e.dash>=0&&(i=t.rendNodeStroke,this._setAttr(i,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=t.evalVisProp("gradient");"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",t.evalVisProp("gradientsecondcolor")),this._setAttr(e,"opacity2",t.evalVisProp("gradientsecondopacity")),this._setAttr(e,"angle",t.evalVisProp("gradientangle"))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",t.evalVisProp("gradientsecondcolor")),this._setAttr(e,"opacity2",t.evalVisProp("gradientsecondopacity")),this._setAttr(e,"focusposition",100*t.evalVisProp("gradientpositionx")+"%,"+100*t.evalVisProp("gradientpositiony")+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,i){var s,r,o,n=e,a=i,h=t.rendNode;a=a>0?a:0,t.visPropOld.fillcolor===n&&t.visPropOld.fillopacity===a||(utils_type.A.exists(n)&&!1!==n&&(9!==n.length?(s=n,o=a):(s=(r=utils_color.A.rgba2rgbo(n))[0],o=a*r[1]),"none"===s||!1===s?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",s),utils_type.A.exists(o)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*o+"%")),t.type===constants.A.OBJECT_TYPE_IMAGE&&h.filters.length>1&&(h.filters.item(1).opacity=Math.round(100*o),h.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=n,t.visPropOld.fillopacity=a)},setObjectStrokeColor:function(t,e,i){var s,r,o,n,a=e,h=i,l=t.rendNode;h=h>0?h:0,t.visPropOld.strokecolor===a&&t.visPropOld.strokeopacity===h||(utils_type.A.exists(a)&&!1!==a&&(9!==a.length?(s=a,o=h):(s=(r=e.rgba2rgbo(a))[0],o=h*r[1]),t.elementClass===constants.A.OBJECT_CLASS_TEXT?(l.filters.length>1&&(l.filters.item(1).opacity=Math.round(100*o),l.filters.item(1).enabled=!0),l.style.color=s):(!1!==s&&(this._setAttr(l,"stroked","true"),this._setAttr(l,"strokecolor",s)),n=t.rendNodeStroke,utils_type.A.exists(o)&&t.type!==constants.A.OBJECT_TYPE_IMAGE&&this._setAttr(n,"opacity",100*o+"%"))),t.visPropOld.strokecolor=a,t.visPropOld.strokeopacity=h)},setObjectStrokeWidth:function(t,e){var i,s=utils_type.A.evaluate(e);isNaN(s)||t.visPropOld.strokewidth===s||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),utils_type.A.exists(s)&&(this.setPropertyPrim(i,"stroke-width",s),0===s&&utils_type.A.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=s)},setShadow:function(t){var e=t.rendNodeShadow,i=t.evalVisProp("shadow");e&&t.visPropOld.shadow!==i&&(i?(this._setAttr(e,"On","True"),this._setAttr(e,"Offset","3pt,3pt"),this._setAttr(e,"Opacity","60%"),this._setAttr(e,"Color","#aaaaaa")):this._setAttr(e,"On","False"),t.visPropOld.shadow=i)},suspendRedraw:function(){this.container.style.display="none"},unsuspendRedraw:function(){this.container.style.display=""}});var vml=jxg.A.VMLRenderer,uuidCharsStr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",uuidChars=uuidCharsStr.split("");jxg.A.Util=jxg.A.Util||{},jxg.A.Util.genUUID=function(t){var e,i,s=[],r=0;for(""!==(t=t||"")&&"-"!==t.slice(t.length-1)&&(t+="-"),i=0;i<36;i++)8===i||13===i||18===i||23===i?s[i]="-":14===i?s[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,s[i]=uuidChars[19===i?3&e|8:e]);return t+s.join("")};var uuid=jxg.A.Util;jxg.A.CanvasRenderer=function(t,e){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=uuid.genUUID(),this.canvasNamespace=null,env.A.isBrowser)this.container=t,this.container.style.MozUserSelect="none",this.container.style.userSelect="none",this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.innerHTML=['<canvas id="',this.canvasId,'" width="',e.width,'px" height="',e.height,'px"></canvas>'].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.canvasRoot.style.display="block",this.context=this.canvasRoot.getContext("2d");else if(env.A.isNode())try{this.canvasRoot=jxg.A.createCanvas(500,500),this.context=this.canvasRoot.getContext("2d")}catch(t){throw new Error('JXG.createCanvas not available.\nInstall the npm package `canvas`\nand call:\n    import { createCanvas } from "canvas.js"\n    JXG.createCanvas = createCanvas;\n')}},jxg.A.CanvasRenderer.prototype=new renderer_abstract,jxg.A.extend(jxg.A.CanvasRenderer.prototype,{_drawPolygon:function(t,e,i){var s,r=t.length,o=this.context;if(r>0){if(i&&(o.lineWidth=0),o.beginPath(),o.moveTo(t[0][0],t[0][1]),1===e)for(s=1;s<r;s++)o.lineTo(t[s][0],t[s][1]);else for(s=1;s<r;s+=3)o.bezierCurveTo(t[s][0],t[s][1],t[s+1][0],t[s+1][1],t[s+2][0],t[s+2][1]);i?(o.lineTo(t[0][0],t[0][1]),o.closePath(),o.fill("evenodd")):o.stroke()}},_fill:function(t){var e=this.context;e.save(),this._setColor(t,"fill")&&e.fill("evenodd"),e.restore()},_rotatePoint:function(t,e,i){return[e*Math.cos(t)-i*Math.sin(t),e*Math.sin(t)+i*Math.cos(t)]},_rotateShape:function(t,e){var i,s=[],r=t.length;if(r<=0)return t;for(i=0;i<r;i++)s.push(this._rotatePoint(e,t[i][0],t[i][1]));return s},updateGradientAngle:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f=1,_=Math.cos(-e),g=Math.sin(-e),A=t.getBoundingBox();return Math.abs(_)>Math.abs(g)?f/=Math.abs(_):f/=Math.abs(g),_>=0?(r=0,o=_*f):(r=-_*f,o=0),g>=0?(n=0,a=g*f):(n=-g*f,a=0),i=new base_coords.A(constants.A.COORDS_BY_USER,[A[0],A[1]],t.board),d=(s=new base_coords.A(constants.A.COORDS_BY_USER,[A[2],A[3]],t.board)).scrCoords[1]-i.scrCoords[1],p=s.scrCoords[2]-i.scrCoords[2],h=i.scrCoords[1]+d*r,c=i.scrCoords[2]+p*n,l=i.scrCoords[1]+d*o,u=i.scrCoords[2]+p*a,this.context.createLinearGradient(h,c,l,u)},updateGradientCircle:function(t,e,i,s,r,o,n){var a,h,l,c,u,d,p,f,_,g,A=t.getBoundingBox();return a=new base_coords.A(constants.A.COORDS_BY_USER,[A[0],A[1]],t.board),_=(h=new base_coords.A(constants.A.COORDS_BY_USER,[A[2],A[3]],t.board)).scrCoords[1]-a.scrCoords[1],g=a.scrCoords[2]-h.scrCoords[2],l=a.scrCoords[1]+_*e,c=h.scrCoords[2]+g*i,d=a.scrCoords[1]+_*r,p=h.scrCoords[2]+g*o,u=s*(_+g)*.5,f=n*(_+g)*.5,this.context.createRadialGradient(d,p,f,l,c,u)},updateGradient:function(t){var e,i,s=t.evalVisProp("gradient");return e=t.evalVisProp("fillcolor"),"linear"===s?i=this.updateGradientAngle(t,t.evalVisProp("gradientangle")):"radial"===s&&(i=this.updateGradientCircle(t,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr"))),"none"!==e&&""!==e&&!1!==e&&(i.addColorStop(t.evalVisProp("gradientstartoffset"),e),i.addColorStop(t.evalVisProp("gradientendoffset"),t.evalVisProp("gradientsecondcolor"))),i},_setColor:function(t,e,i){var s,r,o,n,a,h,l,c,u,d=!0;return e=e||"stroke",i=i||e,r=this._getHighlighted(t),"none"!==(n=t.evalVisProp(r+e+"color"))&&""!==n&&!1!==n?(l=(l=t.evalVisProp(r+e+"opacity"))>0?l:0,9!==n.length?(h=n,c=l):(h=(a=utils_color.A.rgba2rgbo(n))[0],c=l*a[1]),this.context.globalAlpha=c,this.context[i+"Style"]=h):d=!1,"stroke"===e||"linear"!==(u=t.evalVisProp("gradient"))&&"radial"!==u?(o=parseFloat(t.evalVisProp(r+"strokewidth")),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),s=t.evalVisProp("linecap"),"stroke"===e&&void 0!==s&&""!==s&&(this.context.lineCap=s),d):(this.context.globalAlpha=c,this.context[i+"Style"]=this.updateGradient(t),d)},_stroke:function(t){var e=this.context,i=t.evalVisProp("dash"),s=t.evalVisProp("dashscale")?.5*t.evalVisProp("strokewidth"):1;e.save(),i>0?e.setLineDash&&e.setLineDash(this.dashArray[i-1].map(function(t){return t*s})):this.context.lineDashArray=[],this._setColor(t,"stroke")&&e.stroke(),e.restore()},_translateShape:function(t,e,i){var s,r=[],o=t.length;if(o<=0)return t;for(s=0;s<o;s++)r.push([t[s][0]+e,t[s][1]+i]);return r},drawPoint:function(t){var e=t.evalVisProp("face"),i=t.evalVisProp("size"),s=t.coords.scrCoords,r=i*Math.sqrt(3)*.5,o=.5*i,n=parseFloat(t.evalVisProp("strokewidth"))/2,a=this.context;if(t.visPropCalc.visible)switch(e){case"cross":case"x":a.beginPath(),a.moveTo(s[1]-i,s[2]-i),a.lineTo(s[1]+i,s[2]+i),a.moveTo(s[1]+i,s[2]-i),a.lineTo(s[1]-i,s[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"circle":case"o":a.beginPath(),a.arc(s[1],s[2],i+1+n,0,2*Math.PI,!1),a.closePath(),this._fill(t),this._stroke(t);break;case"square":case"[]":if(i<=0)break;a.save(),this._setColor(t,"stroke","fill")&&a.fillRect(s[1]-i-n,s[2]-i-n,2*i+3*n,2*i+3*n),a.restore(),a.save(),this._setColor(t,"fill"),a.fillRect(s[1]-i+n,s[2]-i+n,2*i-n,2*i-n),a.restore();break;case"plus":case"+":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1]+i,s[2]),a.moveTo(s[1],s[2]-i),a.lineTo(s[1],s[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"divide":case"|":a.beginPath(),a.moveTo(s[1],s[2]-i),a.lineTo(s[1],s[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"minus":case"-":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1]+i,s[2]),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"diamond2":case"<<>>":i*=1.41;case"diamond":case"<>":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1],s[2]+i),a.lineTo(s[1]+i,s[2]),a.lineTo(s[1],s[2]-i),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"A":case"a":case"^":a.beginPath(),a.moveTo(s[1],s[2]-i),a.lineTo(s[1]-r,s[2]+o),a.lineTo(s[1]+r,s[2]+o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":a.beginPath(),a.moveTo(s[1],s[2]+i),a.lineTo(s[1]-r,s[2]-o),a.lineTo(s[1]+r,s[2]-o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1]+o,s[2]-r),a.lineTo(s[1]+o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleright":case">":a.beginPath(),a.moveTo(s[1]+i,s[2]),a.lineTo(s[1]-o,s[2]-r),a.lineTo(s[1]-o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,i,s,r){var o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E=this.context,O=1,M=1,w=1,S=r.evFirst,T=r.evLast;if("none"!==t.evalVisProp("strokecolor")&&(S||T)){if(t.elementClass===constants.A.OBJECT_CLASS_LINE)o=e.scrCoords[1],n=e.scrCoords[2],a=i.scrCoords[1],h=i.scrCoords[2],P=x=Math.atan2(h-n,a-o);else{if(o=t.points[0].scrCoords[1],n=t.points[0].scrCoords[2],(C=t.points.length-1)<1)return;a=t.points[t.points.length-1].scrCoords[1],h=t.points[t.points.length-1].scrCoords[2],m=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],b=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],y=t.points[C].scrCoords[1]-t.points[C-1].scrCoords[1],v=t.points[C].scrCoords[2]-t.points[C-1].scrCoords[2],S&&(P=Math.atan2(b,m)),T&&(x=Math.atan2(v,y))}if(c=t.evalVisProp(s+"strokewidth"),S)if(l=c*r.sizeFirst,p=O=r.typeFirst,2===O)d=[[l,.5*-l],[0,0],[l,.5*l],[.5*l,0]];else if(3===O)d=[[l/3,.5*-l],[0,.5*-l],[0,.5*l],[l/3,.5*l]];else if(4===O)for(l/=10,M=3,A=(d=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]]).length,g=0;g<A;g++)d[g][0]*=-l,d[g][1]*=l,d[g][0]+=10*l,d[g][1]-=3.31*l;else if(5===O)for(l/=10,M=3,A=(d=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]]).length,g=0;g<A;g++)d[g][0]*=-l,d[g][1]*=l,d[g][0]+=10*l,d[g][1]-=3.28*l;else if(6===O)for(l/=10,M=3,A=(d=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]]).length,g=0;g<A;g++)d[g][0]*=-l,d[g][1]*=l,d[g][0]+=10*l,d[g][1]-=2.84*l;else if(7===O)for(l=c,M=3,A=(d=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]]).length,g=0;g<A;g++)d[g][0]*=-l,d[g][1]*=l,d[g][0]+=10*l,d[g][1]-=5.2*l;else d=[[l,.5*-l],[0,0],[l,.5*l]];if(T)if(l=c*r.sizeLast,f=O=r.typeLast,2===O)u=[[-l,.5*-l],[0,0],[-l,.5*l],[.5*-l,0]];else if(3===O)u=[[-l/3,.5*-l],[0,.5*-l],[0,.5*l],[-l/3,.5*l]];else if(4===O)for(l/=10,w=3,A=(u=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]]).length,g=0;g<A;g++)u[g][0]*=l,u[g][1]*=l,u[g][0]-=10*l,u[g][1]-=3.31*l;else if(5===O)for(l/=10,w=3,A=(u=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]]).length,g=0;g<A;g++)u[g][0]*=l,u[g][1]*=l,u[g][0]-=10*l,u[g][1]-=3.28*l;else if(6===O)for(l/=10,w=3,A=(u=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]]).length,g=0;g<A;g++)u[g][0]*=l,u[g][1]*=l,u[g][0]-=10*l,u[g][1]-=2.84*l;else if(7===O)for(l=c,w=3,A=(u=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]]).length,g=0;g<A;g++)u[g][0]*=l,u[g][1]*=l,u[g][0]-=10*l,u[g][1]-=5.2*l;else u=[[-l,.5*-l],[0,0],[-l,.5*l]];E.save(),this._setColor(t,"stroke","fill")&&(this._setColor(t,"stroke"),S&&(_=7!==p,this._drawPolygon(this._translateShape(this._rotateShape(d,P),o,n),M,_)),T&&(_=7!==f,this._drawPolygon(this._translateShape(this._rotateShape(u,x),a,h),w,_))),E.restore()}},drawLine:function(t){var e,i,s,r,o,n=new base_coords.A(constants.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),a=new base_coords.A(constants.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),h=null;t.visPropCalc.visible&&(s=this._getHighlighted(t),r=t.evalVisProp(s+"strokewidth"),((o=this.getArrowHeadData(t,r,s)).evFirst||o.evLast)&&(h=-4),geometry.A.calcStraight(t,n,a,h),this.handleTouchpoints(t,n,a,o),e=new base_coords.A(constants.A.COORDS_BY_USER,n.usrCoords,t.board),i=new base_coords.A(constants.A.COORDS_BY_USER,a.usrCoords,t.board),this.getPositionArrowHead(t,n,a,o),this.context.beginPath(),this.context.moveTo(n.scrCoords[1],n.scrCoords[2]),this.context.lineTo(a.scrCoords[1],a.scrCoords[2]),this._stroke(t),(o.evFirst||o.evLast)&&this.drawArrows(t,e,i,s,o))},updateLine:function(t){this.drawLine(t)},drawTicks:function(){},updateTicks:function(t){var e,i,s,r,o,n,a=t.ticks.length,h=this.context;for(h.beginPath(),e=0;e<a;e++)for(s=(i=t.ticks[e])[0],r=i[1],o=s.length,h.moveTo(s[0],r[0]),n=1;n<o;++n)h.lineTo(s[n],r[n]);h.lineCap="round",this._stroke(t)},drawCurve:function(t){var e,i,s;t.evalVisProp("handdrawing")?this.updatePathStringBezierPrim(t):this.updatePathStringPrim(t),t.numberPoints>1&&(e=this._getHighlighted(t),i=t.evalVisProp(e+"strokewidth"),((s=this.getArrowHeadData(t,i,e)).evFirst||s.evLast)&&this.drawArrows(t,null,null,e,s))},updateCurve:function(t){this.drawCurve(t)},drawEllipse:function(t){var e=t.center.coords.scrCoords[1],i=t.center.coords.scrCoords[2],s=t.board.unitX,r=t.board.unitY,o=2*t.Radius(),n=2*t.Radius(),a=o*s,h=n*r,l=e-a/2,c=i-h/2,u=a/2*.5522848,d=h/2*.5522848,p=l+a,f=c+h,_=l+a/2,g=c+h/2,A=this.context;o>0&&n>0&&!isNaN(e+i)&&(A.beginPath(),A.moveTo(l,g),A.bezierCurveTo(l,g-d,_-u,c,_,c),A.bezierCurveTo(_+u,c,p,g-d,p,g),A.bezierCurveTo(p,g+d,_+u,f,_,f),A.bezierCurveTo(_-u,f,l,g+d,l,g),A.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context,s=4+1.8*e,r=6+e;i.save(),i.font=e+"px Arial",i.globalAlpha=.2,i.lineWidth=.5,i.fillText(t+".",s,r),i.restore()},displayLogo:function(t,e,i){var s=this.context,r=1.5*e;utils_type.A.exists(i._logo_image)||(i._logo_image=new Image,i._logo_image.src=t),i._logo_image.onload=function(){s.save(),s.globalAlpha=.2,s.drawImage(i._logo_image,5,5,r,r),s.restore()},s.save(),s.globalAlpha=.2,s.drawImage(i._logo_image,5,5,r,r),s.restore()},drawInternalText:function(t){var e=t.evalVisProp("fontsize"),i=t.evalVisProp("fontunit"),s=t.getAnchorX(),r=t.getAnchorY(),o=this.context;return o.save(),this._setColor(t,"stroke","fill")&&!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])&&(o.font=(e>0?e:0)+i+" Arial",this.transformRect(t,t.transformations),"left"===s?o.textAlign="left":"right"===s?o.textAlign="right":"middle"===s&&(o.textAlign="center"),"bottom"===r?o.textBaseline="bottom":"top"===r?o.textBaseline="top":"middle"===r&&(o.textBaseline="middle"),o.fillText(t.plaintext,t.coords.scrCoords[1],t.coords.scrCoords[2])),o.restore(),null},updateInternalText:function(t){this.drawInternalText(t)},setObjectStrokeColor:function(t,e,i){var s,r,o,n,a=e,h=i;h=h>0?h:0,t.visPropOld.strokecolor===a&&t.visPropOld.strokeopacity===h||(utils_type.A.exists(a)&&!1!==a&&(9!==a.length?(s=a,o=h):(s=(r=utils_color.A.rgba2rgbo(a))[0],o=h*r[1]),n=t.rendNode,t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")&&(n.style.color=s,n.style.opacity=o)),t.visPropOld.strokecolor=a,t.visPropOld.strokeopacity=h)},drawImage:function(t){t.rendNode=new Image,t._src="",this.updateImage(t)},updateImage:function(t){var e=this.context,i=t.evalVisProp("fillopacity"),s=utils_type.A.bind(function(){t.imgIsLoaded=!0,t.size[0]<=0||t.size[1]<=0||(e.save(),e.globalAlpha=i,this.transformRect(t,t.transformations),e.drawImage(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),e.restore())},this);this.updateImageURL(t)?t.rendNode.onload=s:t.imgIsLoaded&&s()},transformRect:function(t,e){var i,s,r,o,n,a=e.length,h=this.context;if(a>0)if(i=this.joinTransforms(t,e),t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(s=" matrix("+[i[1][1],i[2][1],i[1][2],i[2][2],i[1][0],i[2][0]].join(",")+") ").indexOf("NaN")){switch((n=t.rendNode).style.transform=s,r=-t.coords.scrCoords[1],o=-t.coords.scrCoords[2],t.evalVisProp("anchorx")){case"right":r+=t.size[0];break;case"middle":r+=.5*t.size[0]}switch(t.evalVisProp("anchory")){case"bottom":o+=t.size[1];break;case"middle":o+=.5*t.size[1]}n.style["transform-origin"]=r+"px "+o+"px"}}else Math.abs(numerics.A.det(i))>=math.A.eps&&h.transform(i[1][1],i[2][1],i[1][2],i[2][2],i[1][0],i[2][0])},updateImageURL:function(t){var e;return e=t.eval(t.url),t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.src=e,t._src=e,!0)},remove:function(t){utils_type.A.exists(t)&&utils_type.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},updatePathStringPrim:function(t){var e,i,s,r,o,n="M",a=n,h=5e3,l=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),l.beginPath(),1===t.bezierDegree)for(e=0;e<o;e++)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?a=n:(i[1]>h?i[1]=h:i[1]<-5e3&&(i[1]=-5e3),i[2]>h?i[2]=h:i[2]<-5e3&&(i[2]=-5e3),a===n?l.moveTo(i[1],i[2]):l.lineTo(i[1],i[2]),a="L");else if(3===t.bezierDegree)for(e=0;e<o;)i=t.points[e].scrCoords,isNaN(i[1])||isNaN(i[2])?a=n:(a===n?l.moveTo(i[1],i[2]):(e+=1,s=t.points[e].scrCoords,e+=1,r=t.points[e].scrCoords,l.bezierCurveTo(i[1],i[2],s[1],s[2],r[1],r[2])),a="C"),e+=1;l.lineCap="round",l.lineJoin="round",this._fill(t),this._stroke(t)}},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a,h="M",l=h,c=5e3,u=t.evalVisProp("strokewidth"),d="plot"!==t.evalVisProp("curvetype"),p=this.context;if(!(t.numberPoints<=0)){for(d&&t.board.options.curve.RDPsmoothing&&(t.points=numerics.A.RamerDouglasPeucker(t.points,.5)),a=Math.min(t.points.length,t.numberPoints),p.beginPath(),i=1;i<3;i++)for(l=h,e=0;e<a;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?l=h:(r[1]>c?r[1]=c:r[1]<-5e3&&(r[1]=-5e3),r[2]>c?r[2]=c:r[2]<-5e3&&(r[2]=-5e3),l===h?p.moveTo(r[1],r[2]):(s=2*i,p.bezierCurveTo(o+.333*(r[1]-o)+u*(s*Math.random()-i),n+.333*(r[2]-n)+u*(s*Math.random()-i),o+.666*(r[1]-o)+u*(s*Math.random()-i),n+.666*(r[2]-n)+u*(s*Math.random()-i),r[1],r[2])),l="C",o=r[1],n=r[2]);p.lineCap="round",p.lineJoin="round",this._fill(t),this._stroke(t)}},updatePolygonPrim:function(t,e){var i,s,r,o=e.vertices.length,n=this.context,a=!0;if(!(o<=0)&&e.visPropCalc.visible){for("polygonalchain"===e.elType&&o++,n.beginPath(),s=0;!e.vertices[s].isReal&&s<o-1;)s++,a=!1;for(i=e.vertices[s].coords.scrCoords,n.moveTo(i[1],i[2]),r=s;r<o-1;r++)e.vertices[r].isReal||(a=!1),i=e.vertices[r].coords.scrCoords,n.lineTo(i[1],i[2]);n.closePath(),a&&this._fill(e)}},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(t){jxg.A.deprecated("Board.renderer.show()","Board.renderer.display()"),utils_type.A.exists(t.rendNode)&&(t.rendNode.style.visibility="inherit")},hide:function(t){jxg.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),utils_type.A.exists(t.rendNode)&&(t.rendNode.style.visibility="hidden")},setGradient:function(t){},setShadow:function(t){t.visPropOld.shadow!==t.visProp.shadow&&(t.visPropOld.shadow=t.visProp.shadow)},highlight:function(t){return t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")?this.updateTextStyle(t,!0):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},noHighlight:function(t){return t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")?this.updateTextStyle(t,!1):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(t){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),t&&(t.attr.showcopyright||t.attr.showlogo)&&this.displayLogo(jxg.A.licenseLogo,12,t),t&&t.attr.showcopyright&&this.displayCopyright(jxg.A.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(t,e){this.container?(this.canvasRoot.style.width=parseFloat(t)+"px",this.canvasRoot.style.height=parseFloat(e)+"px",this.canvasRoot.setAttribute("width",2*parseFloat(t)+"px"),this.canvasRoot.setAttribute("height",2*parseFloat(e)+"px")):(this.canvasRoot.width=2*parseFloat(t),this.canvasRoot.height=2*parseFloat(e)),this.context=this.canvasRoot.getContext("2d"),this.context.scale(2,2)},removeToInsertLater:function(){return function(){}}});var canvas=jxg.A.CanvasRenderer;jxg.A.NoRenderer=function(){this.enhancedRendering=!1,this.type="no"},jxg.A.extend(jxg.A.NoRenderer.prototype,{drawPoint:function(t){},updatePoint:function(t){},changePointStyle:function(t){},drawLine:function(t){},updateLine:function(t){},drawTicks:function(t){},updateTicks:function(t){},drawCurve:function(t){},updateCurve:function(t){},drawEllipse:function(t){},updateEllipse:function(t){},drawPolygon:function(t){},updatePolygon:function(t){},displayCopyright:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){},updateText:function(t){},updateTextStyle:function(t,e){},updateInternalTextStyle:function(t,e,i){},drawImage:function(t){},updateImage:function(t){},updateImageURL:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},remove:function(t){},makeArrows:function(t){},updateEllipsePrim:function(t,e,i,s,r){},updateLinePrim:function(t,e,i,s,r,o){},updatePathPrim:function(t,e,i){},updatePathStringPoint:function(t,e,i){},updatePathStringPrim:function(t){},updatePathStringBezierPrim:function(t){},updatePolygonPrim:function(t,e){},updateRectPrim:function(t,e,i,s,r){},setPropertyPrim:function(t,e,i){},show:function(t){},hide:function(t){},setBuffering:function(t,e){},setDashStyle:function(t){},setDraft:function(t){},removeDraft:function(t){},setGradient:function(t){},updateGradient:function(t){},setObjectTransition:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setShadow:function(t){},highlight:function(t){},noHighlight:function(t){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(t){},getElementById:function(t){return null},resize:function(t,e){},removeToInsertLater:function(){return function(){}}}),jxg.A.NoRenderer.prototype=new renderer_abstract;var no=jxg.A.NoRenderer;jxg.A.JSXGraph={rendererType:(src_options.A.board.renderer="no",env.A.supportsVML()&&(src_options.A.board.renderer="vml",document.onmousemove=function(){var t;return document.body&&(t=document.body.scrollLeft,t+=document.body.scrollTop),t}),env.A.supportsCanvas()&&(src_options.A.board.renderer="canvas"),env.A.supportsSVG()&&(src_options.A.board.renderer="svg"),env.A.isNode()&&env.A.supportsCanvas()&&(src_options.A.board.renderer="canvas"),(env.A.isNode()||"no"===src_options.A.renderer)&&(src_options.A.text.display="internal",src_options.A.infobox.display="internal"),src_options.A.board.renderer),initRenderer:function(t,e,i,s){var r;if(utils_type.A.exists(i)&&!1!==i||"object"!=typeof document||(i=document),"object"==typeof i&&null!==t)for(r=utils_type.A.isString(t)?i.getElementById(t):t;r.firstChild;)r.removeChild(r.firstChild);else r=t;return void 0!==s&&"auto"!==s||(s=this.rendererType),"svg"===s?new svg(r,e):"vml"===s?new vml(r):"canvas"===s?new canvas(r,e):new no},_setAttributes:function(t,e){var i,s,r=utils_type.A.copyAttributes(t,e,"board"),o=["drag","fullscreen","intl","keyboard","logging","pan","resize","screenshot","selection","zoom"],n=o.length;for(i=0;i<n;i++)r[s=o[i]]=utils_type.A.copyAttributes(r,e,"board",s);return r.navbar=utils_type.A.copyAttributes(r.navbar,e,"navbar"),r.movetarget=t.moveTarget||t.movetarget||e.board.moveTarget,r},_fillBoard:function(t,e,i){t.initInfobox(e.infobox),t.maxboundingbox=e.maxboundingbox,t.resizeContainer(i.width,i.height,!0,!0),t._createSelectionPolygon(e),t.renderer.drawNavigationBar(t,e.navbar),jxg.A.boards[t.id]=t},_setARIA:function(t,e){var i,s=e.document;if("object"!=typeof s){if(!env.A.isBrowser)return;s=document}(i=utils_type.A.isString(t)?s.getElementById(t):t).setAttribute("role","region"),i.setAttribute("aria-label",e.title)},_removeARIANodes:function(t){var e,i,s;"object"==typeof(s=t.document||document)&&(i=t.containerObj.getAttribute("aria-labelledby"),(e=s.getElementById(i))&&e.parentNode&&e.parentNode.removeChild(e),i=t.containerObj.getAttribute("aria-describedby"),(e=s.getElementById(i))&&e.parentNode&&e.parentNode.removeChild(e))},initBoard:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A=0,m=0,b={};return"default"!==(e=e||{}).theme&&utils_type.A.exists(jxg.A.themes[e.theme])&&(b=jxg.A.themes[e.theme]),_=utils_type.A.deepCopy(src_options.A,b,!0),u=this._setAttributes(e,_),l=env.A.getDimensions(t,u.document),u.unitx||u.unity?(i=utils_type.A.def(u.originx,150),s=utils_type.A.def(u.originy,150),r=utils_type.A.def(u.unitx,50),o=utils_type.A.def(u.unity,50)):((c=u.boundingbox)[0]<u.maxboundingbox[0]&&(c[0]=u.maxboundingbox[0]),c[1]>u.maxboundingbox[1]&&(c[1]=u.maxboundingbox[1]),c[2]>u.maxboundingbox[2]&&(c[2]=u.maxboundingbox[2]),c[3]<u.maxboundingbox[3]&&(c[3]=u.maxboundingbox[3]),n=parseInt(l.width,10),a=parseInt(l.height,10),utils_type.A.exists(c)&&u.keepaspectratio?(r=n/(c[2]-c[0]),o=a/(c[1]-c[3]),Math.abs(r)<Math.abs(o)?m=.5*(a/(o=Math.abs(r)*o/Math.abs(o))-(c[1]-c[3])):A=.5*(n/(r=Math.abs(o)*r/Math.abs(r))-(c[2]-c[0]))):(r=n/(c[2]-c[0]),o=a/(c[1]-c[3])),i=-r*(c[0]-A),s=o*(c[1]+m)),h=this.initRenderer(t,l,u.document,u.renderer),this._setARIA(t,u),(g=new base_board(t,h,u.id,[i,s],u.zoomx,u.zoomy,r,o,l.width,l.height,u)).keepaspectratio=u.keepaspectratio,this._fillBoard(g,u,l),g.suspendUpdate(),(u=g.attr).axis&&(d="object"==typeof u.axis?u.axis:{},p=utils_type.A.deepCopy(_.board.defaultaxes.x,d),f=utils_type.A.deepCopy(_.board.defaultaxes.y,d),u.defaultaxes.x&&(p=utils_type.A.deepCopy(p,u.defaultaxes.x)),u.defaultaxes.y&&(f=utils_type.A.deepCopy(f,u.defaultaxes.y)),g.defaultAxes={},g.defaultAxes.x=g.create("axis",[[0,0],[1,0]],p),g.defaultAxes.y=g.create("axis",[[0,0],[0,1]],f)),u.grid&&g.create("grid",[],"object"==typeof u.grid?u.grid:{}),g.unsuspendUpdate(),g},loadBoardFromFile:function(t,e,i,s,r){var o,n,a,h,l;return s=s||{},o=this._setAttributes(s),h=env.A.getDimensions(t,o.document),n=this.initRenderer(t,h,o.document,o.renderer),this._setARIA(t,o),a=new base_board(t,n,"",[150,150],1,1,50,50,h.width,h.height,o),this._fillBoard(a,o,h),l=o.encoding||"iso-8859-1",reader_file.parseFileContent(e,a,i,!0,l,r),a},loadBoardFromString:function(t,e,i,s,r){var o,n,a,h;return s=s||{},o=this._setAttributes(s),h=env.A.getDimensions(t,o.document),n=this.initRenderer(t,h,o.document,o.renderer),this._setARIA(t,o),a=new base_board(t,n,"",[150,150],1,1,50,50,h.width,h.height,o),this._fillBoard(a,o,h),reader_file.parseString(e,a,i,!0,r),a},freeBoard:function(t){var e;for(e in"string"==typeof t&&(t=jxg.A.boards[t]),this._removeARIANodes(t),t.removeEventHandlers(),t.suspendUpdate(),t.objects)t.objects.hasOwnProperty(e)&&t.objects[e].remove();for(;t.containerObj.firstChild;)t.containerObj.removeChild(t.containerObj.firstChild);for(e in t.objects)t.objects.hasOwnProperty(e)&&delete t.objects[e];delete t.renderer,t.jc.creator.clearCache(),delete t.jc,delete jxg.A.boards[t.id]},registerElement:function(t,e){jxg.A.deprecated("JXG.JSXGraph.registerElement()","JXG.registerElement()"),jxg.A.registerElement(t,e)}},env.A.isBrowser&&"object"==typeof window&&"object"==typeof document&&env.A.addEvent(window,"load",function(){var t,e,i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m=!1,b=document.getElementsByTagName("script"),y=function(t,e,i){var s=jxg.A.JSXGraph.initBoard(r,{boundingbox:i,keepaspectratio:!0,grid:f,axis:p,showReload:!0});if(e.toLowerCase().indexOf("script")>-1)s.construct(t);else try{s.jc.parse(t)}catch(t){jxg.A.debug(t)}return s},v=function(t,e,i,s){return function(){var r;jxg.A.JSXGraph.freeBoard(t),(r=y(e,i,s)).reload=v(r,e,i,s)}};for(e=0;e<b.length;e++)if(t=b[e].getAttribute("type",!1),utils_type.A.exists(t)&&("text/jessiescript"===t.toLowerCase()||"jessiescript"===t.toLowerCase()||"text/jessiecode"===t.toLowerCase()||"jessiecode"===t.toLowerCase())){if(u=b[e].getAttribute("class",!1)||"",a=b[e].getAttribute("width",!1)||"",h=b[e].getAttribute("height",!1)||"",l=b[e].getAttribute("maxwidth",!1)||"100%",c=b[e].getAttribute("aspectratio",!1)||"1/1",d=b[e].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",r=b[e].getAttribute("container",!1),g=b[e].getAttribute("src",!1),4!==(d=d.split(",")).length)d=[-5,5,5,-5];else for(i=0;i<d.length;i++)d[i]=parseFloat(d[i]);if(p=utils_type.A.str2Bool(b[e].getAttribute("axis",!1)||"false"),f=utils_type.A.str2Bool(b[e].getAttribute("grid",!1)||"false"),utils_type.A.exists(r))s=document.getElementById(r);else{r="jessiescript_autgen_jxg_"+e,(s=document.createElement("div")).setAttribute("id",r),n=""!==a?"width:"+a+";":"",n+=""!==h?"height:"+h+";":"",n+=""!==l?"max-width:"+l+";":"",n+=""!==c?"aspect-ratio:"+c+";":"",s.setAttribute("style",n),s.setAttribute("class","jxgbox "+u);try{document.body.insertBefore(s,b[e])}catch(t){utils_type.A.exists(jQuery)&&"object"==typeof jQuery&&jQuery(s).insertBefore(b[e])}}_="",utils_type.A.exists(g)?(m=!0,(A=new XMLHttpRequest).open("GET",g),A.overrideMimeType("text/plain; charset=x-user-defined"),A.addEventListener("load",function(){if(!(this.status<400))throw new Error("\nJSXGraph: failed to load file",g,":",this.responseText);_=this.responseText+"\n"+_,(o=y(_,t,d)).reload=v(o,_,t,d)}),A.addEventListener("error",function(t){throw new Error("\nJSXGraph: failed to load file",g,":",t)}),A.send()):m=!1,document.getElementById(r)?(_=(_=b[e].innerHTML).replace(/<!\[CDATA\[/g,"").replace(/\]\]>/g,""),b[e].innerHTML=_,m||((o=y(_,t,d)).reload=v(o,_,t,d))):jxg.A.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window);var jsxgraph=jxg.A.JSXGraph,base_element=__webpack_require__(144),coordselement=__webpack_require__(102);jxg.A.Point=function(t,e,i){this.constructor(t,i,constants.A.OBJECT_TYPE_POINT,constants.A.OBJECT_CLASS_POINT),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this.elType="point",this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createGradient(),this.createLabel()},jxg.A.Point.prototype=new base_element.A,utils_type.A.copyPrototypeMethods(jxg.A.Point,coordselement.A,"coordsConstructor"),jxg.A.extend(jxg.A.Point.prototype,{hasPoint:function(t,e){var i,s,r,o=this.coords.scrCoords,n=this.evalVisProp("sizeunit");return utils_type.A.isObject(this.evalVisProp("precision"))?(r=this.board._inputDevice,s=this.evalVisProp("precision."+r)):s=this.board.options.precision.hasPoint,i=parseFloat(this.evalVisProp("size")),"user"===n&&(i*=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY))),(i+=.5*parseFloat(this.evalVisProp("strokewidth")))<s&&(i=s),Math.abs(o[1]-t)<i+2&&Math.abs(o[2]-e)<i+2},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateTransform:function(t){var e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this.transformations[0].update(),e=this===this.baseElement?this.transformations[0].apply(this,"self"):this.transformations[0].apply(this.baseElement),i=1;i<this.transformations.length;i++)this.transformations[i].update(),e=math.A.matVecMult(this.transformations[i].matrix,e);return this.coords.setCoordinates(constants.A.COORDS_BY_USER,e),this},updateRenderer:function(){return this.updateRendererGeneric("updatePoint"),this},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},makeIntersection:function(t,e,i,s){var r;t=this.board.select(t),e=this.board.select(e),r=geometry.A.intersectionFunction(this.board,t,e,i,s,this.visProp.alwaysintersect),this.addConstraint([r]);try{t.addChild(this),e.addChild(this)}catch(i){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof t+"' and '"+typeof e+"'.")}this.type=constants.A.OBJECT_TYPE_INTERSECTION,this.elType="intersection",this.parents=[t.id,e.id,i,s],this.generatePolynomial=function(){var i=t.generatePolynomial(this),s=e.generatePolynomial(this);return 0===i.length||0===s.length?[]:[i[0],s[0]]},this.prepareUpdate().update()},setStyle:function(t){return this.visProp.face=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"][t],this.visProp.size=[2,3,4,1,2,3,4,2,3,4,2,3,4][t],this.board.renderer.changePointStyle(this),this},normalizeFace:function(t){return jxg.A.deprecated("Point.normalizeFace()","JXG.normalizePointFace()"),src_options.A.normalizePointFace(t)},face:function(t){jxg.A.deprecated("Point.face()","Point.setAttribute()"),this.setAttribute({face:t})},size:function(t){jxg.A.deprecated("Point.size()","Point.setAttribute()"),this.setAttribute({size:t})},isOn:function(t,e){var i,s;return e=e||math.A.eps,utils_type.A.isPoint(t)?this.Dist(t)<e:t.elementClass===constants.A.OBJECT_CLASS_LINE?("segment"!==t.elType||this.evalVisProp("alwaysintersect")||(i=jxg.A.Math.Geometry.projectCoordsToSegment(this.coords.usrCoords,t.point1.coords.usrCoords,t.point2.coords.usrCoords))[1]>=0&&i[1]<=1)&&geometry.A.distPointLine(this.coords.usrCoords,t.stdform)<e:t.elementClass===constants.A.OBJECT_CLASS_CIRCLE?t.evalVisProp("hasinnerpoints")?this.Dist(t.center)<t.Radius()+e:Math.abs(this.Dist(t.center)-t.Radius())<e:t.elementClass===constants.A.OBJECT_CLASS_CURVE?(s=geometry.A.projectPointToCurve(this,t,this.board)[0],geometry.A.distance(this.coords.usrCoords,s.usrCoords,3)<e):t.type===constants.A.OBJECT_TYPE_POLYGON?!(!t.evalVisProp("hasinnerpoints")||!t.pnpoly(this.coords.usrCoords[1],this.coords.usrCoords[2],jxg.A.COORDS_BY_USER))||(i=geometry.A.projectCoordsToPolygon(this.coords.usrCoords,t),geometry.A.distance(this.coords.usrCoords,i,3)<e):t.type===constants.A.OBJECT_TYPE_TURTLE&&(s=geometry.A.projectPointToTurtle(this,t,this.board),geometry.A.distance(this.coords.usrCoords,s.usrCoords,3)<e)},cloneToBackground:function(){var t=utils_type.A.getCloneObject(this);return this.board.renderer.drawPoint(t),this.traces[t.id]=t.rendNode,this}}),jxg.A.createPoint=function(t,e,i){var s,r;if(r=utils_type.A.copyAttributes(i,t.options,"point"),!(s=coordselement.A.create(jxg.A.Point,t,e,r)))throw new Error("JSXGraph: Can't create point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return s},jxg.A.createGlider=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"glider");return r=1===e.length?[0,0]:e.slice(0,2),(s=t.create("point",r,o)).makeGlider(e[e.length-1]),s},jxg.A.createIntersectionPoint=function(t,e,i){var s,r,o,n,a,h,l=utils_type.A.copyAttributes(i,t.options,"intersection");e.push(0,0),r=t.select(e[0]),o=t.select(e[1]),a=e[2]||0,h=e[3]||0,s=t.create("point",[0,0,0],l),n=geometry.A.intersectionFunction(t,r,o,a,h,s.visProp.alwaysintersect),s.addConstraint([n]);try{r.addChild(s),o.addChild(s)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.")}return s.type=constants.A.OBJECT_TYPE_INTERSECTION,s.elType="intersection",s.setParents([r.id,o.id]),s.intersectionNumbers=[a,h],s.getParents=function(){return this.parents.concat(this.intersectionNumbers)},s.generatePolynomial=function(){var t=r.generatePolynomial(s),e=o.generatePolynomial(s);return 0===t.length||0===e.length?[]:[t[0],e[0]]},s},jxg.A.createOtherIntersectionPoint=function(t,e,i){var s,r,o,n,a,h,l,c=!0,u=utils_type.A.copyAttributes(i,t.options,"otherintersection");if(3!==e.length)c=!1;else{for(r=t.select(e[0]),o=t.select(e[1]),a=utils_type.A.isArray(e[2])?e[2]:[e[2]],n=0;n<a.length;n++)if(a[n]=t.select(a[n]),!utils_type.A.isPoint(a[n])){c=!1;break}c&&((l=[r,o]).sort(function(t,e){return e.elementClass-t.elementClass}),([constants.A.OBJECT_CLASS_CIRCLE,constants.A.OBJECT_CLASS_CURVE].indexOf(l[0].elementClass)<0||[constants.A.OBJECT_CLASS_CIRCLE,constants.A.OBJECT_CLASS_CURVE,constants.A.OBJECT_CLASS_LINE].indexOf(l[1].elementClass)<0)&&(c=!1))}if(!c)throw new Error("JSXGraph: Can't create 'other intersection point' with parent types '"+typeof e[0]+"',  '"+typeof e[1]+"'and  '"+typeof e[2]+"'.\nPossible parent types: [circle|curve|line,circle|curve|line, point], not two lines");return s=t.create("point",[0,0,0],u),h=geometry.A.otherIntersectionFunction(l,a,s.visProp.alwaysintersect,s.visProp.precision),s.addConstraint([h]),s.type=constants.A.OBJECT_TYPE_INTERSECTION,s.elType="otherintersection",s.setParents([r.id,o.id]),s.addParents(a),r.addChild(s),o.addChild(s),r.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&(s.generatePolynomial=function(){var t=r.generatePolynomial(s),e=o.generatePolynomial(s);return 0===t.length||0===e.length?[]:[t[0],e[0]]}),s},jxg.A.createPolePoint=function(t,e,i){var s,r,o,n,a,h,l;if(e.length>1&&(n=e[0].type===constants.A.OBJECT_TYPE_CONIC||e[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE,a=e[1].type===constants.A.OBJECT_TYPE_CONIC||e[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE,h=e[0].elementClass===constants.A.OBJECT_CLASS_LINE,l=e[1].elementClass===constants.A.OBJECT_CLASS_LINE),2!==e.length||!(n&&l||h&&a))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return l?(r=t.select(e[0]),o=t.select(e[1])):(r=t.select(e[1]),o=t.select(e[0])),(s=t.create("point",[function(){var t=r.quadraticform,e=o.stdform.slice(0,3);return[jxg.A.Math.Numerics.det([e,t[1],t[2]]),jxg.A.Math.Numerics.det([t[0],e,t[2]]),jxg.A.Math.Numerics.det([t[0],t[1],e])]}],i)).elType="polepoint",s.setParents([r.id,o.id]),r.addChild(s),o.addChild(s),s},jxg.A.registerElement("point",jxg.A.createPoint),jxg.A.registerElement("glider",jxg.A.createGlider),jxg.A.registerElement("intersection",jxg.A.createIntersectionPoint),jxg.A.registerElement("otherintersection",jxg.A.createOtherIntersectionPoint),jxg.A.registerElement("polepoint",jxg.A.createPolePoint);var point=jxg.A.Point;jxg.A.Line=function(t,e,i,s){this.constructor(t,s,constants.A.OBJECT_TYPE_LINE,constants.A.OBJECT_CLASS_LINE),this.point1=this.board.select(e),this.point2=this.board.select(i),this.ticks=[],this.defaultTicks=null,this.parentPolygon=null,this.id=this.board.setId(this,"L"),this.board.renderer.drawLine(this),this.board.finalizeAdding(this),this.elType="line",this.point1._is_new?(this.addChild(this.point1),delete this.point1._is_new):this.point1.addChild(this),this.point2._is_new?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this),this.inherits.push(this.point1,this.point2),this.updateStdform(),this.createLabel(),this.methodMap=jxg.A.deepCopy(this.methodMap,{point1:"point1",point2:"point2",getSlope:"Slope",Slope:"Slope",Direction:"Direction",getRise:"getRise",Rise:"getRise",getYIntersect:"getRise",YIntersect:"getRise",getAngle:"getAngle",Angle:"getAngle",L:"L",length:"L",setFixedLength:"setFixedLength",setStraight:"setStraight"})},jxg.A.Line.prototype=new base_element.A,jxg.A.extend(jxg.A.Line.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a,h,l,c,u=[],d=[1,t,e],p=this.evalVisProp("strokewidth");return utils_type.A.isObject(this.evalVisProp("precision"))?(c=this.board._inputDevice,l=this.evalVisProp("precision."+c)):l=this.board.options.precision.hasPoint,l+=.5*p,u[0]=this.stdform[0]-this.stdform[1]*this.board.origin.scrCoords[1]/this.board.unitX+this.stdform[2]*this.board.origin.scrCoords[2]/this.board.unitY,u[1]=this.stdform[1]/this.board.unitX,u[2]=this.stdform[2]/-this.board.unitY,i=geometry.A.distPointLine(d,u),!(isNaN(i)||i>l)&&(!(!this.evalVisProp("straightfirst")||!this.evalVisProp("straightlast"))||(r=this.point1.coords,o=this.point2.coords,s=[0,u[1],u[2]],s=math.A.crossProduct(s,d),(s=math.A.crossProduct(s,u))[1]/=s[0],s[2]/=s[0],s[0]=1,s=new base_coords.A(constants.A.COORDS_BY_SCREEN,s.slice(1),this.board).usrCoords,n=r.distance(constants.A.COORDS_BY_USER,o),r=r.usrCoords.slice(0),o=o.usrCoords.slice(0),n<math.A.eps?a=0:(n===Number.POSITIVE_INFINITY&&(n=1/math.A.eps,Math.abs(o[0])<math.A.eps?(n/=geometry.A.distance([0,0,0],o),o=[1,r[1]+o[1]*n,r[2]+o[2]*n]):(n/=geometry.A.distance([0,0,0],r),r=[1,o[1]+r[1]*n,o[2]+r[2]*n])),n=o[h=1]-r[h],Math.abs(n)<math.A.eps&&(n=o[h=2]-r[h]),a=(s[h]-r[h])/n),!(!this.evalVisProp("straightfirst")&&a<0)&&!(!this.evalVisProp("straightlast")&&a>1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(utils_type.A.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(utils_type.A.isFunction(this.funp1)&&(t=this.funp1(),utils_type.A.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(constants.A.COORDS_BY_USER,t)),utils_type.A.isFunction(this.funp2)&&(t=this.funp2(),utils_type.A.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(constants.A.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,e,i,s,r,o,n,a;return this.hasFixedLength?(t=this.point1.Dist(this.point2),e=this.evalVisProp("nonnegativeonly")?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),i=this.fixedLengthOldCoords[0].distance(constants.A.COORDS_BY_USER,this.point1.coords),s=this.fixedLengthOldCoords[1].distance(constants.A.COORDS_BY_USER,this.point2.coords),(i>math.A.eps||s>math.A.eps||t!==e)&&(r=this.point1.isDraggable&&this.point1.type!==constants.A.OBJECT_TYPE_GLIDER&&!this.point1.evalVisProp("fixed"),o=this.point2.isDraggable&&this.point2.type!==constants.A.OBJECT_TYPE_GLIDER&&!this.point2.evalVisProp("fixed"),t>math.A.eps?i>s&&o||i<=s&&o&&!r?(this.point2.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*e/t,this.point1.Y()+(this.point2.Y()-this.point1.Y())*e/t]),this.point2.fullUpdate()):(i<=s&&r||i>s&&r&&!o)&&(this.point1.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*e/t,this.point2.Y()+(this.point1.Y()-this.point2.Y())*e/t]),this.point1.fullUpdate()):(n=Math.random()-.5,a=Math.random()-.5,t=math.A.hypot(n,a),o?(this.point2.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point1.X()+n*e/t,this.point1.Y()+a*e/t]),this.point2.fullUpdate()):r&&(this.point1.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point2.X()+n*e/t,this.point2.Y()+a*e/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(constants.A.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(constants.A.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=math.A.crossProduct(this.point1.coords.usrCoords,this.point2.coords.usrCoords);this.stdform[0]=t[0],this.stdform[1]=t[1],this.stdform[2]=t[2],this.stdform[3]=0,this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.point1.coords.usrCoords[1]+this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[1]+this.point2.coords.usrCoords[2])&&math.A.innerProduct(this.stdform,this.stdform,3)>=math.A.eps*math.A.eps,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateLine(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(t){var e=this.point1.symbolic.x,i=this.point1.symbolic.y,s=this.point2.symbolic.x,r=this.point2.symbolic.y,o=t.symbolic.x,n=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",s,")+(",n,")*(",s,")-(",e,")*(",n,")+(",e,")*(",r,")-(",o,")*(",r,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=math.A.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=math.A.eps?-this.stdform[1]/this.stdform[2]:1/0},getSlope:function(){return this.Slope()},getAngle:function(){return Math.atan2(-this.stdform[1],this.stdform[2])},Direction:function(){var t=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return 0===e[0]&&0!==t[0]?e.slice(1):0===t[0]&&0!==e[0]?[-t[1],-t[2]]:[e[1]-t[1],e[2]-t[2]]},isVertical:function(){var t=this.Direction();return 0===t[0]&&0!==t[1]},isHorizontal:function(){var t=this.Direction();return 0===t[1]&&0!==t[0]},setStraight:function(t,e){return this.visProp.straightfirst=t,this.visProp.straightlast=e,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new base_coords.A(constants.A.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){utils_type.A.exists(this.label)&&(this.label.relativeCoords=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,e,i,s,r,o,n,a,h=1.5,l=0,c=new base_coords.A(constants.A.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),u=new base_coords.A(constants.A.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),d=this.evalVisProp("straightfirst"),p=this.evalVisProp("straightlast");if((d||p)&&geometry.A.calcStraight(this,c,u,0),c=c.scrCoords,u=u.scrCoords,!utils_type.A.exists(this.label))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(i=this.label.evalVisProp("position"),!utils_type.A.isString(i))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(i.indexOf("right")<0&&i.indexOf("left")<0)switch(i){case"last":t=u[1],e=u[2];break;case"first":t=c[1],e=c[2];break;case"lft":case"llft":case"ulft":c[1]<u[1]+math.A.eps?(t=c[1],e=c[2]):(t=u[1],e=u[2]);break;case"rt":case"lrt":case"urt":c[1]>u[1]+math.A.eps?(t=c[1],e=c[2]):(t=u[1],e=u[2]);break;default:t=.5*(c[1]+u[1]),e=.5*(c[2]+u[2])}else s=utils_type.A.parsePosition(i),r=utils_type.A.parseNumber(s.pos,1,1),o=u[1]-c[1],n=u[2]-c[2],a=math.A.hypot(o,n),s.pos.indexOf("px")>=0||s.pos.indexOf("fr")>=0||s.pos.indexOf("%")>=0?(s.pos.indexOf("px")>=0&&(r/=a),t=c[1]+r*o,e=c[2]+r*n):(t=c[1]+r*this.board.unitX*o/a,e=c[2]+r*this.board.unitY*n/a),"left"===s.side?o*=-1:n*=-1,utils_type.A.exists(this.label)&&(h=.5*this.label.evalVisProp("distance")/a),t+=n*this.label.size[0]*h,e+=o*this.label.size[1]*h;return(d||p)&&(utils_type.A.exists(this.label)&&(l=this.label.evalVisProp("fontsize")),Math.abs(t)<math.A.eps?t=l:this.board.canvasWidth+math.A.eps>t&&t>this.board.canvasWidth-l-math.A.eps&&(t=this.board.canvasWidth-l),math.A.eps+l>e&&e>-math.A.eps?e=l:this.board.canvasHeight+math.A.eps>e&&e>this.board.canvasHeight-l-math.A.eps&&(e=this.board.canvasHeight-l)),new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board)},cloneToBackground:function(){var t,e,i,s=utils_type.A.getCloneObject(this);return s.point1=this.point1,s.point2=this.point2,s.stdform=this.stdform,e=this.getSlope(),t=this.getRise(),s.getSlope=function(){return e},s.getRise=function(){return t},i=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(s),this.board.renderer.enhancedRendering=i,this.traces[s.id]=s.rendNode,this},addTransform:function(t){var e,i=utils_type.A.isArray(t)?t:[t],s=i.length;for(e=0;e<s;e++)this.point1.transformations.push(i[e]),this.point2.transformations.push(i[e]);return this},snapToGrid:function(t){var e,i,s,r,o,n,a,h;return this.evalVisProp("snaptogrid")?this.parents.length<3?(this.point1.handleSnapToGrid(!0,!0),this.point2.handleSnapToGrid(!0,!0)):utils_type.A.exists(t)&&(a=this.evalVisProp("snapsizex"),h=this.evalVisProp("snapsizey"),o=(e=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this.board)).usrCoords[1],n=e.usrCoords[2],a<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(a=(r=this.board.defaultAxes.x.defaultTicks).ticksDelta*(r.evalVisProp("minorticks")+1)),h<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(h=(r=this.board.defaultAxes.y.defaultTicks).ticksDelta*(r.evalVisProp("minorticks")+1)),a>0&&h>0&&(i=geometry.A.projectPointToLine({coords:e},this,this.board),s=statistics.A.subtract([1,Math.round(o/a)*a,Math.round(n/h)*h],i.usrCoords),this.board.create("transform",s.slice(1),{type:"translate"}).applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGrid(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var t=this.evalVisProp("snaptopoints");return this.parents.length<3&&(this.point1.handleSnapToPoints(t),this.point2.handleSnapToPoints(t)),this},X:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[2];return 0!==e[0]?0!==i[0]?e[1]+(i[1]-e[1])*t:e[1]+1e5*s*t:0!==e[0]?i[1]-(e[1]-i[1])*t:i[1]+1e5*s*t},Y:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[1];return 0!==e[0]?0!==i[0]?e[2]+(i[2]-e[2])*t:e[2]-1e5*s*t:0!==e[0]?i[2]-(e[2]-i[2])*t:i[2]-1e5*s*t},Z:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords;return 1===t&&e[0]*i[0]===0?0:1},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(t){return this.hasFixedLength?(this.fixedLength=utils_type.A.createFunction(t,this.board),this.hasFixedLength=!0,this.addParentsFromJCFunctions([this.fixedLength]),this.board.update(),this):this},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var t=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return[Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[1],e[1]),Math.min(t[2],e[2])]},remove:function(){this.removeAllTicks(),base_element.A.prototype.remove.call(this)}}),jxg.A.createLine=function(t,e,i){var s,r,o,n,a,h,l,c=[],u=!1,d=!1;if(2===e.length){if(h=utils_type.A.copyAttributes(i,t.options,"line","point1"),utils_type.A.isArray(e[0])&&e[0].length>1)o=t.create("point",e[0],h);else if(utils_type.A.isString(e[0])||utils_type.A.isPoint(e[0]))o=t.select(e[0]);else if(utils_type.A.isFunction(e[0])&&utils_type.A.isPoint(e[0]()))o=e[0](),d=!0;else if(utils_type.A.isFunction(e[0])&&e[0]().length&&e[0]().length>=2)o=jxg.A.createPoint(t,e[0](),h),d=!0;else{if(!utils_type.A.isObject(e[0])||!utils_type.A.isTransformationOrArray(e[1]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u=!0,o=t.create("point",[e[0].point1,e[1]],h)}if(h=utils_type.A.copyAttributes(i,t.options,"line","point2"),u)n=t.create("point",[e[0].point2,e[1]],h);else if(utils_type.A.isArray(e[1])&&e[1].length>1)n=t.create("point",e[1],h);else if(utils_type.A.isString(e[1])||utils_type.A.isPoint(e[1]))n=t.select(e[1]);else if(utils_type.A.isFunction(e[1])&&utils_type.A.isPoint(e[1]()))n=e[1](),d=!0;else{if(!(utils_type.A.isFunction(e[1])&&e[1]().length&&e[1]().length>=2))throw new Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");n=jxg.A.createPoint(t,e[1](),h),d=!0}h=utils_type.A.copyAttributes(i,t.options,"line"),r=new jxg.A.Line(t,o,n,h),d?(r.constrained=!0,r.funp1=e[0],r.funp2=e[1]):u||(r.isDraggable=!0),r.setParents([o.id,n.id])}else if(3===e.length){for(l=!0,a=0;a<3;a++)if(utils_type.A.isNumber(e[a]))c[a]=utils_type.A.createFunction(e[a]);else{if(!utils_type.A.isFunction(e[a]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");c[a]=e[a],l=!1}h=utils_type.A.copyAttributes(i,t.options,"line","point1"),o=l?t.create("point",[c[2]()*c[2]()+c[1]()*c[1](),c[2]()-c[1]()*c[0]()+c[2](),-c[1]()-c[2]()*c[0]()-c[1]()],h):t.create("point",[function(){return.5*(c[2]()*c[2]()+c[1]()*c[1]())},function(){return.5*(c[2]()-c[1]()*c[0]()+c[2]())},function(){return.5*(-c[1]()-c[2]()*c[0]()-c[1]())}],h),h=utils_type.A.copyAttributes(i,t.options,"line","point2"),n=l?t.create("point",[c[2]()*c[2]()+c[1]()*c[1](),-c[1]()*c[0]()+c[2](),-c[2]()*c[0]()-c[1]()],h):t.create("point",[function(){return c[2]()*c[2]()+c[1]()*c[1]()},function(){return-c[1]()*c[0]()+c[2]()},function(){return-c[2]()*c[0]()-c[1]()}],h),o.prepareUpdate().update(),n.prepareUpdate().update(),h=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,o,n,h)).isDraggable=l,r.setParents([o,n])}else if(1===e.length&&utils_type.A.isFunction(e[0])&&2===e[0]().length&&utils_type.A.isPoint(e[0]()[0])&&utils_type.A.isPoint(e[0]()[1]))s=e[0](),h=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,s[0],s[1],h)).constrained=!0,r.funps=e[0],r.setParents(s);else{if(!(1===e.length&&utils_type.A.isFunction(e[0])&&3===e[0]().length&&utils_type.A.isNumber(e[0]()[0])&&utils_type.A.isNumber(e[0]()[1])&&utils_type.A.isNumber(e[0]()[2])))throw new Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");s=e[0],h=utils_type.A.copyAttributes(i,t.options,"line","point1"),o=t.create("point",[function(){var t=s();return[.5*(t[2]*t[2]+t[1]*t[1]),.5*(t[2]-t[1]*t[0]+t[2]),.5*(-t[1]-t[2]*t[0]-t[1])]}],h),h=utils_type.A.copyAttributes(i,t.options,"line","point2"),n=t.create("point",[function(){var t=s();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],h),h=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,o,n,h)).constrained=!0,r.funps=e[0],r.setParents([o,n])}return r},jxg.A.registerElement("line",jxg.A.createLine),jxg.A.createSegment=function(t,e,i){var s,r;if(i.straightFirst=!1,i.straightLast=!1,r=utils_type.A.copyAttributes(i,t.options,"segment"),s=t.create("line",e.slice(0,2),r),3===e.length){try{s.hasFixedLength=!0,s.fixedLengthOldCoords=[],s.fixedLengthOldCoords[0]=new base_coords.A(constants.A.COORDS_BY_USER,s.point1.coords.usrCoords.slice(1,3),t),s.fixedLengthOldCoords[1]=new base_coords.A(constants.A.COORDS_BY_USER,s.point2.coords.usrCoords.slice(1,3),t),s.setFixedLength(e[2])}catch(t){throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function")}s.getParents=function(){return this.parents.concat(this.fixedLength())}}return s.elType="segment",s},jxg.A.registerElement("segment",jxg.A.createSegment),jxg.A.createArrow=function(t,e,i){var s,r;return i.straightFirst=!1,i.straightLast=!1,r=utils_type.A.copyAttributes(i,t.options,"arrow"),(s=t.create("line",e,r)).type=constants.A.OBJECT_TYPE_VECTOR,s.elType="arrow",s},jxg.A.registerElement("arrow",jxg.A.createArrow),jxg.A.createAxis=function(t,e,i){var s,r,o,n;r=utils_type.A.copyAttributes(i,t.options,"axis");try{s=t.create("line",e,r)}catch(t){throw new Error("JSXGraph: Can't create axis with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}for(o in s.type=constants.A.OBJECT_TYPE_AXIS,s.isDraggable=!1,s.point1.isDraggable=!1,s.point2.isDraggable=!1,s._point1UsrCoordsOrg=s.point1.coords.usrCoords.slice(),s._point2UsrCoordsOrg=s.point2.coords.usrCoords.slice(),s.ancestors)s.ancestors.hasOwnProperty(o)&&(s.ancestors[o].type=constants.A.OBJECT_TYPE_AXISPOINT);return n=utils_type.A.exists(r.ticks.ticksdistance)?r.ticks.ticksdistance:utils_type.A.isArray(r.ticks.ticks)?r.ticks.ticks:1,s.defaultTicks=t.create("ticks",[s,n],r.ticks),s.defaultTicks.dump=!1,s.elType="axis",s.subs={ticks:s.defaultTicks},s.inherits.push(s.defaultTicks),s.update=function(){var t,e,i,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b;if(!this.needsUpdate)return this;if(t=this.board.getBoundingBox(),e=this.evalVisProp("position"),r=this.Direction(),o=this.isHorizontal(),n=this.isVertical(),a=this.evalVisProp("ticksautopos"),h=this.evalVisProp("ticksautoposthreshold"),h=o?utils_type.A.parseNumber(h,Math.abs(t[1]-t[3]),1/this.board.unitX)*this.board.unitX:n?utils_type.A.parseNumber(h,Math.abs(t[1]-t[3]),1/this.board.unitY)*this.board.unitY:utils_type.A.parseNumber(h,1,1),u=(c=this.evalVisProp("anchor")).indexOf("left")>-1,d=c.indexOf("right")>-1,p=this.evalVisProp("anchordist"),p=o?utils_type.A.parseNumber(p,Math.abs(t[1]-t[3]),1/this.board.unitX):n?utils_type.A.parseNumber(p,Math.abs(t[0]-t[2]),1/this.board.unitY):0,g=this.board.getPointLoc(this._point1UsrCoordsOrg,p),f=this.point1.coords.usrCoords.slice(),_=this.point2.coords.usrCoords.slice(),"static"===e||!n&&!o||("fixed"===e?(o&&(r[0]>0&&d||r[0]<0&&u?(f[2]=t[3]+p,_[2]=t[3]+p):r[0]>0&&u||r[0]<0&&d?(f[2]=t[1]-p,_[2]=t[1]-p):(f=this._point1UsrCoordsOrg.slice(),_=this._point2UsrCoordsOrg.slice())),n&&(r[1]>0&&u||r[1]<0&&d?(f[1]=t[0]+p,_[1]=t[0]+p):r[1]>0&&d||r[1]<0&&u?(f[1]=t[2]-p,_[1]=t[2]-p):(f=this._point1UsrCoordsOrg.slice(),_=this._point2UsrCoordsOrg.slice()))):"sticky"===e&&(o&&(g[1]<0&&(r[0]>0&&d||r[0]<0&&u)?(f[2]=t[3]+p,_[2]=t[3]+p):g[1]>0&&(r[0]>0&&u||r[0]<0&&d)?(f[2]=t[1]-p,_[2]=t[1]-p):(f=this._point1UsrCoordsOrg.slice(),_=this._point2UsrCoordsOrg.slice())),n&&(g[0]<0&&(r[1]>0&&u||r[1]<0&&d)?(f[1]=t[0]+p,_[1]=t[0]+p):g[0]>0&&(r[1]>0&&d||r[1]<0&&u)?(f[1]=t[2]-p,_[1]=t[2]-p):(f=this._point1UsrCoordsOrg.slice(),_=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(jxg.A.COORDS_BY_USER,f),this.point2.setPositionDirectly(jxg.A.COORDS_BY_USER,_),utils_type.A.exists(this.defaultTicks)){if(A=this.defaultTicks.visProp.label,a&&(o||n)){if(utils_type.A.exists(A._anchorx_org)||(A._anchorx_org=utils_type.A.def(A.anchorx,this.board.options.text.anchorX)),utils_type.A.exists(A._anchory_org)||(A._anchory_org=utils_type.A.def(A.anchory,this.board.options.text.anchorY)),utils_type.A.exists(A._offset_org)||(A._offset_org=A.offset.slice()),b=A.offset,o){for(l=s.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,m=A.anchory,l<0&&Math.abs(l)>h?"bottom"===A._side&&("top"===A.anchory&&(m="bottom"),b[1]*=-1,A._side="top"):l>0&&Math.abs(l)>h?"top"===A._side&&("bottom"===A.anchory&&(m="top"),b[1]*=-1,A._side="bottom"):(m=A._anchory_org,b=A._offset_org.slice(),"top"===m?A._side="bottom":"bottom"===m?A._side="top":b[1]<0?A._side="bottom":A._side="top"),i=0;i<s.defaultTicks.labels.length;i++)this.defaultTicks.labels[i].visProp.anchory=m;A.anchory=m}else if(n){for((l=s.point1.coords.scrCoords[1]-.5*this.board.canvasWidth)<0&&Math.abs(l)>h?"right"===A._side&&("left"===A.anchorx&&(m="right"),b[0]*=-1,A._side="left"):l>0&&Math.abs(l)>h?"left"===A._side&&("right"===A.anchorx&&(m="left"),b[0]*=-1,A._side="right"):(m=A._anchorx_org,b=A._offset_org.slice(),"left"===m?A._side="right":"right"===m||b[0]<0?A._side="left":A._side="right"),i=0;i<s.defaultTicks.labels.length;i++)this.defaultTicks.labels[i].visProp.anchorx=m;A.anchorx=m}A.offset=b}else delete A._anchorx_org,delete A._anchory_org,delete A._offset_org;this.defaultTicks.needsUpdate=!0}return jxg.A.Line.prototype.update.call(this),this},s},jxg.A.registerElement("axis",jxg.A.createAxis),jxg.A.createTangent=function(t,e,i){var s,r,o,n,a,h,l,c,u,d=[];if(1===e.length)s=e[0],r=s.slideObject;else{if(2!==e.length)throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");if(utils_type.A.isPoint(e[0]))s=e[0],r=e[1];else{if(!utils_type.A.isPoint(e[1]))throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");r=e[0],s=e[1]}}if(h=utils_type.A.copyAttributes(i,t.options,"tangent"),r.elementClass===constants.A.OBJECT_CLASS_LINE)(a=t.create("line",[r.point1,r.point2],h)).glider=s;else if(r.elementClass===constants.A.OBJECT_CLASS_CURVE&&r.type!==constants.A.OBJECT_TYPE_CONIC){if(c=r.getTransformationSource(),u=c[0])for(d.push(r);c[0]&&utils_type.A.exists(c[1]._transformationSource);)d.push(c[1]),c=c[1].getTransformationSource();"plot"!==r.evalVisProp("curvetype")||u?(a=t.create("line",[function(){var e,i,o,n,a,h,l,c,p=r.X,f=r.Y;if(c=s.type===constants.A.OBJECT_TYPE_GLIDER?s.position:"functiongraph"===r.evalVisProp("curvetype")?s.X():geometry.A.projectPointToCurve(s,r,t)[1],l=s.Coords(!0),u){for(p=(a=d[d.length-1]._transformationSource).X,f=a.Y,n=0;n<d.length;n++)d[n].updateTransformMatrix(),h=math.A.inverse(d[n].transformMat),l=math.A.matVecMult(h,l);s.type!==constants.A.OBJECT_TYPE_GLIDER&&(l[1]/=l[0],l[2]/=l[0],l[0]/=l[0],c=geometry.A.projectCoordsToCurve(l[1],l[2],0,a,t)[1])}if(e=numerics.A.D(f)(c),i=numerics.A.D(p)(c),o=[-l[1]*e+l[2]*i,l[0]*e,-l[0]*i],u)for(n=d.length-1;n>=0;n--)h=math.A.transpose(math.A.inverse(d[n].transformMat)),o=math.A.matVecMult(h,o);return o}],h),s.addChild(a),a.glider=s):(l=function(t,e,i){var r,o,n,a,h,l,c,u,d,p,f,_,g=Math.floor(t);if(1===e.bezierDegree)g===e.numberPoints-1&&g--;else{if(3!==e.bezierDegree)return 0;n=(t*((_="sector"===e.elType?(f=e.points.slice(3,e.numberPoints-3)).length:(f=e.points).length)-1)-(g=3*Math.floor(t*(_-1)/3)))/3,g>=_-1&&(g=_-4,n=1)}if(g<0)return 1;switch(1===e.bezierDegree?(r=e.points[g].usrCoords,o=e.points[g+1].usrCoords):(a=f[g].usrCoords,h=f[g+1].usrCoords,l=f[g+2].usrCoords,c=f[g+3].usrCoords,u=(1-n)*(1-n)*(h[1]-a[1])+2*(1-n)*n*(l[1]-h[1])+n*n*(c[1]-l[1]),d=(1-n)*(1-n)*(h[2]-a[2])+2*(1-n)*n*(l[2]-h[2])+n*n*(c[2]-l[2]),u/=p=math.A.hypot(u,d),d/=p,o=[1,(r=s.coords.usrCoords)[1]+u,r[2]+d]),i){case 0:return r[2]*o[1]-r[1]*o[2];case 1:return o[2]-r[2];case 2:return r[1]-o[1];default:return[r[2]*o[1]-r[1]*o[2],o[2]-r[2],r[1]-o[1]]}},a=t.create("line",[function(){var e;return e=s.type===constants.A.OBJECT_TYPE_GLIDER?s.position:geometry.A.projectPointToCurve(s,r,t)[1],l(e,r)}],h),s.addChild(a),a.glider=s)}else r.type===constants.A.OBJECT_TYPE_TURTLE?(a=t.create("line",[function(){var e,i;for(i=s.type===constants.A.OBJECT_TYPE_GLIDER?s.position:geometry.A.projectPointToTurtle(s,r,t)[1],e=Math.floor(i),o=0;o<r.objects.length;o++)if((n=r.objects[o]).type===constants.A.OBJECT_TYPE_CURVE){if(e<n.numberPoints)break;e-=n.numberPoints}return e===n.numberPoints-1&&e--,e<0?[1,0,0]:[n.Y(e)*n.X(e+1)-n.X(e)*n.Y(e+1),n.Y(e+1)-n.Y(e),n.X(e)-n.X(e+1)]}],h),s.addChild(a),a.glider=s):r.elementClass!==constants.A.OBJECT_CLASS_CIRCLE&&r.type!==constants.A.OBJECT_TYPE_CONIC||(a=t.create("line",[function(){return math.A.matVecMult(r.quadraticform,s.coords.usrCoords)}],h),s.addChild(a),a.glider=s);if(!utils_type.A.exists(a))throw new Error("JSXGraph: Couldn't create tangent with the given parents.");return a.elType="tangent",a.type=constants.A.OBJECT_TYPE_TANGENT,a.setParents(e),a},jxg.A.createNormal=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p=[];for(n=0;n<e.length;++n)e[n]=t.select(e[n]);if(1===e.length)s=e[0],r=s.slideObject;else{if(2!==e.length)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");if(utils_type.A.isPointType(t,e[0]))s=utils_type.A.providePoints(t,[e[0]],i,"point")[0],r=e[1];else{if(!utils_type.A.isPointType(t,e[1]))throw new Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");r=e[0],s=utils_type.A.providePoints(t,[e[1]],i,"point")[0]}}if(a=utils_type.A.copyAttributes(i,t.options,"normal"),r.elementClass===constants.A.OBJECT_CLASS_LINE)l=utils_type.A.copyAttributes(i,t.options,"normal","point"),h=t.create("point",[function(){var t=math.A.crossProduct([1,0,0],r.stdform);return[t[0],-t[2],t[1]]}],l),h.isDraggable=!0,(o=t.create("line",[s,h],a)).point=h,o.subs={point:h},o.inherits.push(h);else if(r.elementClass===constants.A.OBJECT_CLASS_CIRCLE)o=t.create("line",[r.midpoint,s],a);else if(r.elementClass===constants.A.OBJECT_CLASS_CURVE){if(u=r.getTransformationSource(),d=u[0])for(p.push(r);u[0]&&utils_type.A.exists(u[1]._transformationSource);)p.push(u[1]),u=u[1].getTransformationSource();"plot"!==r.evalVisProp("curvetype")||d?o=t.create("line",[function(){var e,i,o,n,a,h,l,c,u=r.X,f=r.Y;if(c=s.type===constants.A.OBJECT_TYPE_GLIDER?s.position:"functiongraph"===r.evalVisProp("curvetype")?s.X():geometry.A.projectPointToCurve(s,r,t)[1],l=s.Coords(!0),d){for(u=(a=p[p.length-1]._transformationSource).X,f=a.Y,n=0;n<p.length;n++)p[n].updateTransformMatrix(),h=math.A.inverse(p[n].transformMat),l=math.A.matVecMult(h,l);s.type!==constants.A.OBJECT_TYPE_GLIDER&&(l[1]/=l[0],l[2]/=l[0],l[0]/=l[0],c=geometry.A.projectCoordsToCurve(l[1],l[2],0,a,t)[1])}if(e=numerics.A.D(f)(c),i=numerics.A.D(u)(c),o=[-l[1]*i-l[2]*e,l[0]*i,l[0]*e],d)for(n=p.length-1;n>=0;n--)h=math.A.transpose(math.A.inverse(p[n].transformMat)),o=math.A.matVecMult(h,o);return o}],a):(c=function(t,e,i){var r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y=Math.floor(t);if(1===e.bezierDegree)y===e.numberPoints-1&&y--,a=t;else{if(3!==e.bezierDegree)return 0;a=(t*((b="sector"===e.elType?(m=e.points.slice(3,e.numberPoints-3)).length:(m=e.points).length)-1)-(y=3*Math.floor(t*(b-1)/3)))/3,y>=b-1&&(y=b-4,a=1)}if(y<0)return 1;switch(r=a-y,1===e.bezierDegree?(o=e.points[y].usrCoords,n=e.points[y+1].usrCoords,g=[o[0]+r*(n[0]-o[0]),o[1]+r*(n[1]-o[1]),o[2]+r*(n[2]-o[2])],_=math.A.crossProduct(o,n),A=[(A=math.A.crossProduct([1,0,0],_))[0],-A[2],A[1]],_=math.A.crossProduct(g,A)):(h=m[y].usrCoords,l=m[y+1].usrCoords,c=m[y+2].usrCoords,u=m[y+3].usrCoords,d=(1-a)*(1-a)*(l[1]-h[1])+2*(1-a)*a*(c[1]-l[1])+a*a*(u[1]-c[1]),p=(1-a)*(1-a)*(l[2]-h[2])+2*(1-a)*a*(c[2]-l[2])+a*a*(u[2]-c[2]),d/=f=math.A.hypot(d,p),p/=f,n=[1,(o=s.coords.usrCoords)[1]-p,o[2]+d],_=[o[2]*n[1]-o[1]*n[2],n[2]-o[2],o[1]-n[1]]),i){case 0:return _[0];case 1:return _[1];case 2:return _[2];default:return _}},o=t.create("line",[function(){var e;return e=s.type===constants.A.OBJECT_TYPE_GLIDER?s.position:geometry.A.projectPointToCurve(s,r,t)[1],c(e,r)}],a),s.addChild(o),o.glider=s)}else{if(r.type!==constants.A.OBJECT_TYPE_TURTLE)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");o=t.create("line",[function(){var t,e,i=Math.floor(s.position),o=s.position-i;for(e=0;e<r.objects.length;e++)if((t=r.objects[e]).type===constants.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return i===t.numberPoints-1&&(i-=1,o=1),i<0?1:(t.Y(i)+o*(t.Y(i+1)-t.Y(i)))*(t.Y(i)-t.Y(i+1))-(t.X(i)+o*(t.X(i+1)-t.X(i)))*(t.X(i+1)-t.X(i))},function(){var t,e,i=Math.floor(s.position);for(e=0;e<r.objects.length;e++)if((t=r.objects[e]).type===constants.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return i===t.numberPoints-1&&(i-=1),i<0?0:t.X(i+1)-t.X(i)},function(){var t,e,i=Math.floor(s.position);for(e=0;e<r.objects.length;e++)if((t=r.objects[e]).type===constants.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return i===t.numberPoints-1&&(i-=1),i<0?0:t.Y(i+1)-t.Y(i)}],a)}return o.elType="normal",o.setParents(e),utils_type.A.exists(s._is_new)?(o.addChild(s),delete s._is_new):s.addChild(o),r.addChild(o),o},jxg.A.createRadicalAxis=function(t,e,i){var s,r,o;if(2!==e.length||e[0].elementClass!==constants.A.OBJECT_CLASS_CIRCLE||e[1].elementClass!==constants.A.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create 'radical axis' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [circle,circle]");return r=t.select(e[0]),o=t.select(e[1]),(s=t.create("line",[function(){var t=r.stdform,e=o.stdform;return math.A.matVecMult(math.A.transpose([t.slice(0,3),e.slice(0,3)]),[e[3],-t[3]])}],i)).elType="radicalaxis",s.setParents([r.id,o.id]),r.addChild(s),o.addChild(s),s},jxg.A.createPolarLine=function(t,e,i){var s,r,o,n,a,h,l;if(e.length>1&&(n=e[0].type===constants.A.OBJECT_TYPE_CONIC||e[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE,a=e[1].type===constants.A.OBJECT_TYPE_CONIC||e[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE,h=utils_type.A.isPoint(e[0]),l=utils_type.A.isPoint(e[1])),2!==e.length||!(n&&l||h&&a))throw new Error("JSXGraph: Can't create 'polar line' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [conic|circle,point], [point,conic|circle]");return l?(r=t.select(e[0]),o=t.select(e[1])):(r=t.select(e[1]),o=t.select(e[0])),(s=t.create("tangent",[r,o],i)).elType="polarline",s},jxg.A.createTangentTo=function(t,e,i){var s,r,o,n,a,h,l;if(o=t.select(e[0]),n=utils_type.A.providePoints(t,e[1],i,"point")[0],a=utils_type.A.def(e[2],0),o.type!==constants.A.OBJECT_TYPE_CIRCLE&&o.type!==constants.A.OBJECT_TYPE_CONIC||n.elementClass!==constants.A.OBJECT_CLASS_POINT)throw new Error("JSXGraph: Can't create tangentto with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [circle|conic,point,number]");return r=utils_type.A.copyAttributes(i,t.options,"tangentto"),l=t.create("polar",[o,n],r.polar),h=t.create("intersection",[l,o,a],r.point),(s=t.create("tangent",[o,h],r)).point=h,s.polar=l,s.elType="tangentto",s},jxg.A.registerElement("tangent",jxg.A.createTangent),jxg.A.registerElement("normal",jxg.A.createNormal),jxg.A.registerElement("tangentto",jxg.A.createTangentTo),jxg.A.registerElement("polar",jxg.A.createTangent),jxg.A.registerElement("radicalaxis",jxg.A.createRadicalAxis),jxg.A.registerElement("polarline",jxg.A.createPolarLine);var line=jxg.A.Line;jxg.A.Group=function(t,e,i,s,r){var o,n,a,h;for(this.board=t,this.objects={},o=this.board.numObjects,this.board.numObjects+=1,""!==e&&utils_type.A.exists(e)?this.id=e:this.id=this.board.id+"Group"+o,this.board.groups[this.id]=this,this.type=constants.A.OBJECT_TYPE_POINT,this.elementClass=constants.A.OBJECT_CLASS_POINT,""!==i&&utils_type.A.exists(i)?this.name=i:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=r.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],n=utils_type.A.isArray(s)?s:Array.prototype.slice.call(arguments,3),a=0;a<n.length;a++)!(h=this.board.select(n[a])).evalVisProp("fixed")&&utils_type.A.exists(h.coords)&&this.addPoint(h);this.methodMap={ungroup:"ungroup",add:"addPoint",addPoint:"addPoint",addPoints:"addPoints",addGroup:"addGroup",remove:"removePoint",removePoint:"removePoint",setAttribute:"setAttribute",setProperty:"setAttribute"}},jxg.A.extend(jxg.A.Group.prototype,{ungroup:function(){var t,e,i;for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point,utils_type.A.isArray(e.groups)&&(i=utils_type.A.indexOf(e.groups,this.id))>=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,s;for(i=(s=utils_type.A.isArray(t)?t:arguments).length,e=0;e<i;++e)utils_type.A.isId(this.board,s[e])?this.parents.push(s[e]):utils_type.A.exists(s[e].id)&&this.parents.push(s[e].id);this.parents=utils_type.A.uniqueArray(this.parents)},setParents:function(t){return this.parents=[],this.addParents(t),this},getParents:function(){return utils_type.A.isArray(this.parents)?this.parents:[]},_updateCoordsCache:function(t){var e;""!==t&&utils_type.A.exists(this.objects[t])&&(e=this.objects[t].point,this.coords[e.id]={usrCoords:e.coords.usrCoords.slice(0)})},update:function(){var t,e,i,s,r,o,n,a,h,l,c,u,d=null;if(!this.needsUpdate)return this;if("nothing"===(e=this._update_find_drag_type()).action)return this._updateCoordsCache(e.id),this;if(d=this.objects[e.id].point,"translation"===e.action){if(l=[d.coords.usrCoords[1]-this.coords[e.id].usrCoords[1],d.coords.usrCoords[2]-this.coords[e.id].usrCoords[2]],d.elementClass!==constants.A.OBJECT_CLASS_POINT){for(l.unshift(0),t=0;t<d.transformations.length;t++)l=math.A.matVecMult(d.transformations[t].matrix,l);l.shift()}(c=this.board.create("transform",l,{type:"translate"})).update()}else if("rotation"===e.action||"scaling"===e.action){if(s="rotation"===e.action?"rotationCenter":"scaleCenter",utils_type.A.exists(this[s].coords))u=this[s].coords.usrCoords.slice(1);else if("centroid"===this[s])u=this._update_centroid_center();else if(utils_type.A.isArray(this[s]))u=this[s];else{if(!utils_type.A.isFunction(this[s]))return jxg.A.debug("Group.update: No valid center for this transformation, get out of here."),this;u=this[s]()}if("rotation"===e.action)h=geometry.A.rad(this.coords[e.id].usrCoords.slice(1),u,this.objects[e.id].point),(l=this.board.create("transform",[h,u[0],u[1]],{type:"rotate"})).update();else{if("scaling"!==e.action)return this;if(o=geometry.A.distance(this.coords[e.id].usrCoords.slice(1),u),Math.abs(o)<math.A.eps)return this;o=geometry.A.distance(d.coords.usrCoords.slice(1),u)/o,n=this.scaleDirections[e.id].indexOf("x")>=0?o:1,a=this.scaleDirections[e.id].indexOf("y")>=0?o:1,(l=this.board.create("transform",[1,0,0,u[0]*(1-n),n,0,u[1]*(1-a),0,a],{type:"generic"})).update()}}for(i in this.objects)(d=this.objects[i].point).elementClass!==constants.A.OBJECT_CLASS_POINT&&(utils_type.A.exists(l.board)?l.meltTo(d):e.id!==d.id&&c.meltTo(d));for(i in this._update_apply_transformation(e,l),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(i))for(r in this.objects[i].descendants)this.objects[i].descendants.hasOwnProperty(r)&&(this.objects[i].descendants.needsUpdate=this.objects[i].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(i in this.board.updateElements(e),this.objects)this.objects.hasOwnProperty(i)&&this._updateCoordsCache(i);return this},_update_find_drag_type:function(){var t,e,i,s="nothing",r=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point).coords.distance(constants.A.COORDS_BY_USER,this.coords[t])>math.A.eps&&r.push(e.id);return 0===r.length?{action:s,id:"",changed:r}:(i=r[0],e=this.objects[i].point,r.length>1?s="translation":utils_type.A.isInArray(this.rotationPoints,e)&&utils_type.A.exists(this.rotationCenter)?s="rotation":utils_type.A.isInArray(this.scalePoints,e)&&utils_type.A.exists(this.scaleCenter)?s="scaling":utils_type.A.isInArray(this.translationPoints,e)&&(s="translation"),{action:s,id:i,changed:r})},_update_centroid_center:function(){var t,e,i;for(i in t=[0,0],e=0,this.coords)this.coords.hasOwnProperty(i)&&(t[0]+=this.coords[i].usrCoords[1],t[1]+=this.coords[i].usrCoords[2],++e);return e>0&&(t[0]/=e,t[1]/=e),t},_update_apply_transformation:function(t,e){var i,s;for(i in this.objects)this.objects.hasOwnProperty(i)&&(utils_type.A.exists(this.board.objects[i])?(s=this.objects[i].point).id!==t.id?"translation"===t.action?utils_type.A.isInArray(t.changed,s.id)||s.elementClass===constants.A.OBJECT_CLASS_POINT&&s.coords.setCoordinates(constants.A.COORDS_BY_USER,[this.coords[i].usrCoords[1]+e[0],this.coords[i].usrCoords[2]+e[1]]):"rotation"!==t.action&&"scaling"!==t.action||s.elementClass===constants.A.OBJECT_CLASS_POINT&&e.applyOnce([s]):"rotation"!==t.action&&"scaling"!==t.action||s.coords.setCoordinates(constants.A.COORDS_BY_USER,math.A.matVecMult(e.matrix,this.coords[s.id].usrCoords)):delete this.objects[i])},addPoint:function(t){return this.objects[t.id]={point:this.board.select(t)},this._updateCoordsCache(t.id),this.translationPoints.push(t),t.groups.push(this.id),t.groups=utils_type.A.uniqueArray(t.groups),this},addPoints:function(t){var e;for(e=0;e<t.length;e++)this.addPoint(t[e]);return this},addGroup:function(t){var e;for(e in t.objects)t.objects.hasOwnProperty(e)&&this.addPoint(t.objects[e].point);return this},removePoint:function(t){return delete this.objects[t.id],this},setRotationCenter:function(t){return this.rotationCenter=t,this},setRotationPoints:function(t){return this._setActionPoints("rotation",t)},addRotationPoint:function(t){return this._addActionPoint("rotation",t)},removeRotationPoint:function(t){return this._removeActionPoint("rotation",t)},setTranslationPoints:function(t){return this._setActionPoints("translation",t)},addTranslationPoint:function(t){return this._addActionPoint("translation",t)},removeTranslationPoint:function(t){return this._removeActionPoint("translation",t)},setScaleCenter:function(t){return this.scaleCenter=t,this},setScalePoints:function(t,e){var i,s,r;for(r=(i=utils_type.A.isArray(t)?t:arguments).length,s=0;s<r;++s)this.scaleDirections[this.board.select(i[s]).id]=e||"xy";return this._setActionPoints("scale",t)},addScalePoint:function(t,e){return this._addActionPoint("scale",t),this.scaleDirections[this.board.select(t).id]=e||"xy",this},removeScalePoint:function(t){return this._removeActionPoint("scale",t)},_setActionPoints:function(t,e){var i,s,r;for(r=(i=utils_type.A.isArray(e)?e:arguments).length,this[t+"Points"]=[],s=0;s<r;++s)this._addActionPoint(t,i[s]);return this},_addActionPoint:function(t,e){return this[t+"Points"].push(this.board.select(e)),this},_removeActionPoint:function(t,e){var i=this[t+"Points"].indexOf(this.board.select(e));return i>-1&&this[t+"Points"].splice(i,1),this},setProperty:function(){jxg.A.deprecated("Group.setProperty","Group.setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(){var t;for(t in this.objects)this.objects.hasOwnProperty(t)&&this.objects[t].point.setAttribute.apply(this.objects[t].point,arguments);return this}}),jxg.A.createGroup=function(t,e,i){var s=utils_type.A.copyAttributes(i,t.options,"group"),r=new jxg.A.Group(t,s.id,s.name,e,s);return r.elType="group",r.setParents(e),r},jxg.A.registerElement("group",jxg.A.createGroup);var group=jxg.A.Group;jxg.A.Circle=function(t,e,i,s,r){this.constructor(t,r,constants.A.OBJECT_TYPE_CIRCLE,constants.A.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(i),this.center=this.board.select(i),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],"twoPoints"===e?(this.point2=t.select(s),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=s,this.updateRadius=utils_type.A.createFunction(s,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):"pointLine"===e?(this.line=t.select(s),this.radius=this.line.point1.coords.distance(constants.A.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(s),this.radius=this.circle.Radius()),this.id=this.board.setId(this,"C"),this.board.renderer.drawEllipse(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="circle",this.createLabel(),utils_type.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"pointRadius"===e?this.notifyParents(s):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&(utils_type.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=utils_type.A.deepCopy(this.methodMap,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",Perimeter:"Perimeter",Circumference:"Perimeter",radius:"Radius",Radius:"Radius",Diameter:"Diameter",center:"center",line:"line",point2:"point2"})},jxg.A.Circle.prototype=new base_element.A,jxg.A.extend(jxg.A.Circle.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a=this.center.coords.usrCoords,h=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),l=this.Radius();return utils_type.A.isObject(this.evalVisProp("precision"))?(s=this.board._inputDevice,i=this.evalVisProp("precision."+s)):i=this.board.options.precision.hasPoint,r=a[1]-h.usrCoords[1],o=a[2]-h.usrCoords[2],n=math.A.hypot(r,o),i+=.5*this.evalVisProp("strokewidth"),i/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),this.evalVisProp("hasinnerpoints")?n<l+i:Math.abs(n-l)<i},generatePolynomial:function(t){var e=this.center.symbolic.x,i=this.center.symbolic.y,s=t.symbolic.x,r=t.symbolic.y,o=this.generateRadiusSquared();return""===o?[]:["(("+s+")-("+e+"))^2 + (("+r+")-("+i+"))^2 - ("+o+")"]},generateRadiusSquared:function(){var t,e,i,s,r="";return"twoPoints"===this.method?(t=this.center.symbolic.x,e=this.center.symbolic.y,r="(("+(i=this.point2.symbolic.x)+")-("+t+"))^2 + (("+(s=this.point2.symbolic.y)+")-("+e+"))^2"):"pointRadius"===this.method?utils_type.A.isNumber(this.radius)&&(r=(this.radius*this.radius).toString()):"pointLine"===this.method?(i=this.line.point1.symbolic.x,s=this.line.point1.symbolic.y,r="(("+i+")-("+this.line.point2.symbolic.x+"))^2 + (("+s+")-("+this.line.point2.symbolic.y+"))^2"):"pointCircle"===this.method&&(r=this.circle.Radius()),r},update:function(){var t,e,i,s,r,o;if(this.needsUpdate)for(this.evalVisProp("trace")&&this.cloneToBackground(!0),"pointLine"===this.method?this.radius=this.line.point1.coords.distance(constants.A.COORDS_BY_USER,this.line.point2.coords):"pointCircle"===this.method?this.radius=this.circle.Radius():"pointRadius"===this.method&&(this.radius=this.updateRadius()),this.radius=Math.abs(this.radius),this.updateStdform(),this.updateQuadraticform(),i=this.center.coords.usrCoords[0],t=this.center.coords.usrCoords[1]/i,e=this.center.coords.usrCoords[2]/i,i/=i,s=this.Radius(),r=.551915024494,this.numberPoints=13,this.dataX=[t+s,t+s,t+s*r,t,t-s*r,t-s,t-s,t-s,t-s*r,t,t+s*r,t+s,t+s],this.dataY=[e,e+s*r,e+s,e+s,e+s,e+s*r,e,e-s*r,e-s,e-s,e-s,e-s*r,e],this.bezierDegree=3,o=0;o<this.numberPoints;o++)this.points[o]=new base_coords.A(constants.A.COORDS_BY_USER,[this.dataX[o],this.dataY[o]],this.board);return this},updateQuadraticform:function(){var t=this.center,e=t.X(),i=t.Y(),s=this.Radius();this.quadraticform=[[e*e+i*i-s*s,-e,-i],[-e,1,0],[-i,0,1]]},updateStdform:function(){this.stdform[3]=.5,this.stdform[4]=this.Radius(),this.stdform[1]=-this.center.coords.usrCoords[1],this.stdform[2]=-this.center.coords.usrCoords[2],isFinite(this.stdform[4])||(this.stdform[0]=utils_type.A.exists(this.point2)?-(this.stdform[1]*this.point2.coords.usrCoords[1]+this.stdform[2]*this.point2.coords.usrCoords[2]):0),this.normalize()},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=!isNaN(this.center.coords.usrCoords[1]+this.center.coords.usrCoords[2]+this.Radius())&&this.center.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateEllipse(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},notifyParents:function(t){utils_type.A.isString(t)&&geonext.A.findDependencies(this,t,this.board)},setRadius:function(t){return this.updateRadius=utils_type.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return utils_type.A.exists(t)?(this.setRadius(t),this.Radius()):"twoPoints"===this.method?utils_type.A.cmpArrays(this.point2.coords.usrCoords,[0,0,0])||utils_type.A.cmpArrays(this.center.coords.usrCoords,[0,0,0])?NaN:this.center.Dist(this.point2):"pointLine"===this.method||"pointCircle"===this.method?this.radius:"pointRadius"===this.method?this.evalVisProp("nonnegativeonly")?Math.max(0,this.updateRadius()):Math.abs(this.updateRadius()):NaN},Diameter:function(){return 2*this.Radius()},getRadius:function(){return jxg.A.deprecated("Circle.getRadius()","Circle.Radius()"),this.Radius()},getTextAnchor:function(){return this.center.coords},getLabelAnchor:function(){var t,e,i,s,r,o,n=1.5,a=this.Radius(),h=this.center.coords.usrCoords,l=.7071067811865;if(!utils_type.A.exists(this.label))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(i=this.label.evalVisProp("position"),!utils_type.A.isString(i))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(i.indexOf("right")<0&&i.indexOf("left")<0))return h=this.center.coords.scrCoords,s=utils_type.A.parsePosition(i),r=utils_type.A.parseNumber(s.pos,2*Math.PI,1),s.pos.indexOf("fr")<0&&s.pos.indexOf("%")<0&&(s.pos.indexOf("px")>=0?r=0:r*=Math.PI/180),o=1,"left"===s.side&&(o=-1),utils_type.A.exists(this.label)&&(n=.5*o*this.label.evalVisProp("distance")),t=h[1]+(a*this.board.unitX+this.label.size[0]*n)*Math.cos(r),e=h[2]-(a*this.board.unitY+this.label.size[1]*n)*Math.sin(r),new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board);switch(this.evalVisProp("label.position")){case"lft":t=h[1]-a,e=h[2];break;case"llft":t=h[1]-l*a,e=h[2]-l*a;break;case"rt":t=h[1]+a,e=h[2];break;case"lrt":t=h[1]+l*a,e=h[2]-l*a;break;case"urt":t=h[1]+l*a,e=h[2]+l*a;break;case"top":t=h[1],e=h[2]+a;break;case"bot":t=h[1],e=h[2]-a;break;default:t=h[1]-l*a,e=h[2]+l*a}return new base_coords.A(constants.A.COORDS_BY_USER,[t,e],this.board)},cloneToBackground:function(){var t,e=this.Radius(),i=utils_type.A.getCloneObject(this);return i.center={coords:this.center.coords},i.Radius=function(){return e},i.getRadius=function(){return e},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawEllipse(i),this.board.renderer.enhancedRendering=t,this.traces[i.id]=i.rendNode,this},addTransform:function(t){var e,i=utils_type.A.isArray(t)?t:[t],s=i.length;for(e=0;e<s;e++)this.center.transformations.push(i[e]),"twoPoints"===this.method&&this.point2.transformations.push(i[e]);return this},snapToGrid:function(){var t=this.evalVisProp("snaptogrid");return this.center.handleSnapToGrid(t,!0),"twoPoints"===this.method&&this.point2.handleSnapToGrid(t,!0),this},snapToPoints:function(){var t=this.evalVisProp("snaptopoints");return this.center.handleSnapToPoints(t),"twoPoints"===this.method&&this.point2.handleSnapToPoints(t),this},X:function(t){return this.Radius()*Math.cos(2*t*Math.PI)+this.center.coords.usrCoords[1]},Y:function(t){return this.Radius()*Math.sin(2*t*Math.PI)+this.center.coords.usrCoords[2]},Z:function(t){return 1},minX:function(){return 0},maxX:function(){return 1},Area:function(){var t=this.Radius();return t*t*Math.PI},Perimeter:function(){return 2*this.Radius()*Math.PI},bounds:function(){var t=this.center.coords.usrCoords,e=this.Radius();return[t[1]-e,t[2]+e,t[1]+e,t[2]-e]},getParents:function(){return 1===this.parents.length?this.parents.concat(this.radius):this.parents}}),jxg.A.createCircle=function(t,e,i){var s,r,o,n,a,h=["center","point2"];if(r=[],a=t.select(e[0]),utils_type.A.isObject(a)&&a.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isTransformationOrArray(e[1]))return n=utils_type.A.copyAttributes(i,t.options,"circle"),(s=jxg.A.createEllipse(t,[a.center,a.center,function(){return 2*a.Radius()}],n)).addTransform(e[1]),s;for(o=0;o<e.length;o++)if(utils_type.A.isPointType(t,e[o])){if(e.length<3?r.push(utils_type.A.providePoints(t,[e[o]],i,"circle",[h[o]])[0]):r.push(utils_type.A.providePoints(t,[e[o]],i,"point")[0]),!1===r[r.length-1])throw new Error("JSXGraph: Can't create circle from this type. Please provide a point type.")}else r.push(e[o]);if(n=utils_type.A.copyAttributes(i,t.options,"circle"),2===r.length&&utils_type.A.isPoint(r[0])&&utils_type.A.isPoint(r[1]))s=new jxg.A.Circle(t,"twoPoints",r[0],r[1],n);else if((utils_type.A.isNumber(r[0])||utils_type.A.isFunction(r[0])||utils_type.A.isString(r[0]))&&utils_type.A.isPoint(r[1]))s=new jxg.A.Circle(t,"pointRadius",r[1],r[0],n);else if((utils_type.A.isNumber(r[1])||utils_type.A.isFunction(r[1])||utils_type.A.isString(r[1]))&&utils_type.A.isPoint(r[0]))s=new jxg.A.Circle(t,"pointRadius",r[0],r[1],n);else if(r[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isPoint(r[1]))s=new jxg.A.Circle(t,"pointCircle",r[1],r[0],n);else if(r[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isPoint(r[0]))s=new jxg.A.Circle(t,"pointCircle",r[0],r[1],n);else if(r[0].elementClass===constants.A.OBJECT_CLASS_LINE&&utils_type.A.isPoint(r[1]))s=new jxg.A.Circle(t,"pointLine",r[1],r[0],n);else if(r[1].elementClass===constants.A.OBJECT_CLASS_LINE&&utils_type.A.isPoint(r[0]))s=new jxg.A.Circle(t,"pointLine",r[0],r[1],n);else{if(!(3===e.length&&utils_type.A.isPoint(r[0])&&utils_type.A.isPoint(r[1])&&utils_type.A.isPoint(r[2])))throw new Error("JSXGraph: Can't create circle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point], [circle,transformation]");if(!jxg.A.elements.circumcircle)throw new Error("JSXGraph: Can't create circle with three points. Please include the circumcircle element (element/composition).");s=jxg.A.elements.circumcircle(t,r,n)}for(s.isDraggable=!0,s.setParents(r),s.elType="circle",o=0;o<r.length;o++)utils_type.A.isPoint(r[o])&&s.inherits.push(r[o]);return s},jxg.A.registerElement("circle",jxg.A.createCircle);var circle=jxg.A.Circle;jxg.A.createEllipse=function(t,e,i){var s,r,o,n,a,h,l,c=[],u=utils_type.A.copyAttributes(i,t.options,"conic","foci"),d=utils_type.A.copyAttributes(i,t.options,"conic","center"),p=utils_type.A.copyAttributes(i,t.options,"conic");for(h=0;h<2;h++)if(e[h].length>1)c[h]=t.create("point",e[h],u);else if(utils_type.A.isPoint(e[h]))c[h]=t.select(e[h]);else if(utils_type.A.isFunction(e[h])&&utils_type.A.isPoint(e[h]()))c[h]=e[h]();else{if(!utils_type.A.isString(e[h]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");c[h]=t.select(e[h])}if(utils_type.A.isNumber(e[2]))a=utils_type.A.createFunction(e[2],t);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isNumber(e[2]()))a=e[2];else{if(utils_type.A.isPoint(e[2]))n=t.select(e[2]);else if(e[2].length>1)n=t.create("point",e[2],u);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isPoint(e[2]()))n=e[2]();else{if(!utils_type.A.isString(e[2]))throw new Error("JSXGraph: Can't create Ellipse with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");n=t.select(e[2])}a=function(){return n.Dist(c[0])+n.Dist(c[1])}}for(utils_type.A.exists(e[4])||(e[4]=2*Math.PI),utils_type.A.exists(e[3])||(e[3]=0),o=t.create("point",[function(){return.5*(c[0].X()+c[1].X())},function(){return.5*(c[0].Y()+c[1].Y())}],d),(r=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],p)).majorAxis=a,l=r.hasPoint,s=function(t,e){var i,s,o,n,h,l,u,d,p;e||(s=(i=a())*i,o=c[0].X(),n=c[0].Y(),u=o-(h=c[1].X()),d=n-(l=c[1].Y()),p=(s-o*o-n*n+h*h+l*l)/(2*i),r.quadraticform=[[p*p-h*h-l*l,p*u/i+h,p*d/i+l],[p*u/i+h,u*u/s-1,u*d/s],[p*d/i+l,u*d/s,d*d/s-1]])},r.X=function(t,e){var i=a(),r=c[1].Dist(c[0]),o=.5*(r*r-i*i)/(r*Math.cos(t)-i),n=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return e||s(0,e),c[0].X()+Math.cos(n+t)*o},r.Y=function(t,e){var i=a(),s=c[1].Dist(c[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),o=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return c[0].Y()+Math.sin(o+t)*r},r.midpoint=r.center=o,r.type=constants.A.OBJECT_TYPE_CONIC,r.subs={center:r.center},r.inherits.push(r.center,c[0],c[1]),utils_type.A.isPoint(n)&&r.inherits.push(n),r.hasPoint=function(t,e){var i,s,r,o;return this.evalVisProp("hasinnerpoints")?(i=c[0].coords,s=c[1].coords,r=this.majorAxis(),(o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board)).distance(constants.A.COORDS_BY_USER,i)+o.distance(constants.A.COORDS_BY_USER,s)<=r):l.apply(this,arguments)},o.addChild(r),h=0;h<2;h++)utils_type.A.isPoint(c[h])&&c[h].addChild(r);return utils_type.A.isPoint(n)&&n.addChild(r),r.setParents(e),r},jxg.A.createHyperbola=function(t,e,i){var s,r,o,n,a,h,l=[],c=utils_type.A.copyAttributes(i,t.options,"conic","foci"),u=utils_type.A.copyAttributes(i,t.options,"conic","center"),d=utils_type.A.copyAttributes(i,t.options,"conic");for(h=0;h<2;h++)if(e[h].length>1)l[h]=t.create("point",e[h],c);else if(utils_type.A.isPoint(e[h]))l[h]=t.select(e[h]);else if(utils_type.A.isFunction(e[h])&&utils_type.A.isPoint(e[h]()))l[h]=e[h]();else{if(!utils_type.A.isString(e[h]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");l[h]=t.select(e[h])}if(utils_type.A.isNumber(e[2]))a=utils_type.A.createFunction(e[2],t);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isNumber(e[2]()))a=e[2];else{if(utils_type.A.isPoint(e[2]))n=t.select(e[2]);else if(e[2].length>1)n=t.create("point",e[2],c);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isPoint(e[2]()))n=e[2]();else{if(!utils_type.A.isString(e[2]))throw new Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");n=t.select(e[2])}a=function(){return n.Dist(l[0])-n.Dist(l[1])}}for(utils_type.A.exists(e[4])||(e[4]=1.0001*Math.PI),utils_type.A.exists(e[3])||(e[3]=-1.0001*Math.PI),o=t.create("point",[function(){return.5*(l[0].X()+l[1].X())},function(){return.5*(l[0].Y()+l[1].Y())}],u),(r=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],d)).majorAxis=a,s=function(t,e){var i,s,o,n,h,c,u,d,p;e||(s=(i=a())*i,o=l[0].X(),n=l[0].Y(),u=o-(h=l[1].X()),d=n-(c=l[1].Y()),p=(s-o*o-n*n+h*h+c*c)/(2*i),r.quadraticform=[[p*p-h*h-c*c,p*u/i+h,p*d/i+c],[p*u/i+h,u*u/s-1,u*d/s],[p*d/i+c,u*d/s,d*d/s-1]])},r.X=function(t,e){var i=a(),r=l[1].Dist(l[0]),o=.5*(r*r-i*i)/(r*Math.cos(t)+i),n=Math.atan2(l[1].Y()-l[0].Y(),l[1].X()-l[0].X());return e||s(0,e),l[0].X()+Math.cos(n+t)*o},r.Y=function(t,e){var i=a(),s=l[1].Dist(l[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)+i),o=Math.atan2(l[1].Y()-l[0].Y(),l[1].X()-l[0].X());return l[0].Y()+Math.sin(o+t)*r},r.midpoint=r.center=o,r.subs={center:r.center},r.inherits.push(r.center,l[0],l[1]),utils_type.A.isPoint(n)&&r.inherits.push(n),r.type=constants.A.OBJECT_TYPE_CONIC,o.addChild(r),h=0;h<2;h++)utils_type.A.isPoint(l[h])&&l[h].addChild(r);return utils_type.A.isPoint(n)&&n.addChild(r),r.setParents(e),r},jxg.A.createParabola=function(t,e,i){var s,r,o,n,a=e[0],h=e[1],l=utils_type.A.copyAttributes(i,t.options,"conic","foci"),c=utils_type.A.copyAttributes(i,t.options,"conic","center"),u=utils_type.A.copyAttributes(i,t.options,"conic");if(e[0].length>1)a=t.create("point",e[0],l);else if(utils_type.A.isPoint(e[0]))a=t.select(e[0]);else if(utils_type.A.isFunction(e[0])&&utils_type.A.isPoint(e[0]()))a=e[0]();else{if(!utils_type.A.isString(e[0]))throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");a=t.select(e[0])}return utils_type.A.isArray(h)&&2===h.length&&(n=utils_type.A.copyAttributes(i,t.options,"conic","line"),h=t.create("line",h,n)),utils_type.A.exists(e[3])||(e[3]=2*Math.PI),utils_type.A.exists(e[2])||(e[2]=0),o=t.create("point",[function(){return geometry.A.projectPointToLine(a,h,t).usrCoords}],c),(r=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],u)).midpoint=r.center=o,r.subs={center:r.center},r.inherits.push(r.center),s=function(t,e){var i,s,o,n,l,c;e||(i=h.stdform[1],s=h.stdform[2],o=h.stdform[0],n=i*i+s*s,l=a.X(),c=a.Y(),r.quadraticform=[[o*o-n*(l*l+c*c),o*i+n*l,o*s+n*c],[o*i+n*l,-s*s,i*s],[o*s+n*c,i*s,-i*i]])},r.X=function(t,e){var i,r=h.getAngle(),o=geometry.A.distPointLine(a.coords.usrCoords,h.stdform),n=h.point1.coords.usrCoords,l=h.point2.coords.usrCoords,c=a.coords.usrCoords;return 0===n[0]?n=[1,l[1]+h.stdform[2],l[2]-h.stdform[1]]:0===l[0]&&(l=[1,n[1]+h.stdform[2],n[2]-h.stdform[1]]),i=((l[1]-n[1])*(c[2]-n[2])-(l[2]-n[2])*(c[1]-n[1])>=0?1:-1)*o/(1-Math.sin(t)),e||s(0,e),a.X()+Math.cos(t+r)*i},r.Y=function(t,e){var i,s=h.getAngle(),r=geometry.A.distPointLine(a.coords.usrCoords,h.stdform),o=h.point1.coords.usrCoords,n=h.point2.coords.usrCoords,l=a.coords.usrCoords;return 0===o[0]?o=[1,n[1]+h.stdform[2],n[2]-h.stdform[1]]:0===n[0]&&(n=[1,o[1]+h.stdform[2],o[2]-h.stdform[1]]),i=((n[1]-o[1])*(l[2]-o[2])-(n[2]-o[2])*(l[1]-o[1])>=0?1:-1)*r/(1-Math.sin(t)),a.Y()+Math.sin(t+s)*i},r.type=constants.A.OBJECT_TYPE_CONIC,o.addChild(r),utils_type.A.isPoint(a)&&(a.addChild(r),r.inherits.push(a)),h.addChild(r),r.setParents(e),r},jxg.A.createConic=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A=[[1,0,0],[0,1,0],[0,0,1]],m=[[1,0,0],[0,1,0],[0,0,1]],b=[],y=[],v=utils_type.A.copyAttributes(i,t.options,"conic","point"),C=utils_type.A.copyAttributes(i,t.options,"conic","center"),P=utils_type.A.copyAttributes(i,t.options,"conic");if(5===e.length)g=!0;else{if(6!==e.length)throw new Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");g=!1}if(g)for(f=0;f<5;f++)if(e[f].length>1)b[f]=t.create("point",e[f],v);else if(utils_type.A.isPoint(e[f]))b[f]=t.select(e[f]);else if(utils_type.A.isFunction(e[f])&&utils_type.A.isPoint(e[f]()))b[f]=e[f]();else{if(!utils_type.A.isString(e[f]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[f]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");b[f]=t.select(e[f])}else(_=[[0,0,0],[0,0,0],[0,0,0]])[0][0]=utils_type.A.isFunction(e[2])?function(){return e[2]()}:function(){return e[2]},_[0][1]=utils_type.A.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},_[0][2]=utils_type.A.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},_[1][1]=utils_type.A.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},_[1][2]=utils_type.A.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},_[2][2]=utils_type.A.isFunction(e[1])?function(){return e[1]()}:function(){return e[1]};if(a=function(t){var e,i;for(e=0;e<3;e++)for(i=e;i<3;i++)t[e][i]+=t[i][e];for(e=0;e<3;e++)for(i=0;i<e;i++)t[e][i]=t[i][e];return t},n=function(t,e){var i,s,r=[[0,0,0],[0,0,0],[0,0,0]];for(i=0;i<3;i++)for(s=0;s<3;s++)r[i][s]=t[i]*e[s];return a(r)},o=function(t,e,i){var s,r,o,n,a,h=[[0,0,0],[0,0,0],[0,0,0]];for(a=math.A.matVecMult(e,i),o=math.A.innerProduct(i,a),a=math.A.matVecMult(t,i),n=math.A.innerProduct(i,a),s=0;s<3;s++)for(r=0;r<3;r++)h[s][r]=o*t[s][r]-n*e[s][r];return h},r=t.create("curve",[function(t){return 0},function(t){return 0},0,2*Math.PI],P),s=function(t,e){var i,s,a;if(!e){if(g){for(i=0;i<5;i++)y[i]=b[i].coords.usrCoords;d=n(math.A.crossProduct(y[0],y[1]),math.A.crossProduct(y[2],y[3])),p=n(math.A.crossProduct(y[0],y[2]),math.A.crossProduct(y[1],y[3])),m=o(d,p,y[4])}else for(i=0;i<3;i++)for(s=i;s<3;s++)m[i][s]=_[i][s](),s>i&&(m[s][i]=m[i][s]);r.quadraticform=m,(h=numerics.A.Jacobi(m))[0][0][0]<0&&(h[0][0][0]*=-1,h[0][1][1]*=-1,h[0][2][2]*=-1),A=h[1],u=Math.sqrt(Math.abs(h[0][0][0])),l=Math.sqrt(Math.abs(h[0][1][1])),c=Math.sqrt(Math.abs(h[0][2][2]))}return h[0][1][1]<=0&&h[0][2][2]<=0?a=math.A.matVecMult(A,[1/u,Math.cos(t)/l,Math.sin(t)/c]):h[0][1][1]<=0&&h[0][2][2]>0?a=math.A.matVecMult(A,[Math.cos(t)/u,1/l,Math.sin(t)/c]):h[0][2][2]<0&&(a=math.A.matVecMult(A,[Math.sin(t)/u,Math.cos(t)/l,1/c])),utils_type.A.exists(a)?(a[1]/=a[0],a[2]/=a[0],a[0]=1):a=[1,NaN,NaN],a},r.X=function(t,e){return s(t,e)[1]},r.Y=function(t,e){return s(t,e)[2]},r.midpoint=t.create("point",[function(){var t=r.quadraticform;return[t[1][1]*t[2][2]-t[1][2]*t[1][2],t[1][2]*t[0][2]-t[2][2]*t[0][1],t[0][1]*t[1][2]-t[1][1]*t[0][2]]}],C),r.type=constants.A.OBJECT_TYPE_CONIC,r.center=r.midpoint,r.subs={center:r.center},r.inherits.push(r.center),r.inherits=r.inherits.concat(b),g){for(f=0;f<5;f++)utils_type.A.isPoint(b[f])&&b[f].addChild(r);r.setParents(e)}return r.addChild(r.center),r},jxg.A.registerElement("ellipse",jxg.A.createEllipse),jxg.A.registerElement("hyperbola",jxg.A.createHyperbola),jxg.A.registerElement("parabola",jxg.A.createParabola),jxg.A.registerElement("conic",jxg.A.createConic),jxg.A.Polygon=function(t,e,i){this.constructor(t,i,constants.A.OBJECT_TYPE_POLYGON,constants.A.OBJECT_CLASS_AREA);var s,r,o,n,a,h=utils_type.A.copyAttributes(i,t.options,"polygon","borders");for(this.withLines=i.withlines,this.attr_line=h,this.vertices=[],s=0;s<e.length;s++)this.vertices[s]=this.board.select(e[s]),this.vertices[s]._is_new&&(delete this.vertices[s]._is_new,this.vertices[s]._is_new_pol=!0);if(this.vertices.length>0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(o=this.vertices.length-1,n=0;n<o;n++)s=(n+1)%o,h.id=h.ids&&h.ids[s],h.name=h.names&&h.names[s],h.strokecolor=utils_type.A.isArray(h.colors)&&h.colors[s%h.colors.length]||h.strokecolor,h.visible=utils_type.A.exists(i.borders.visible)?i.borders.visible:i.visible,!1===h.strokecolor&&(h.strokecolor="none"),(r=t.create("segment",[this.vertices[s],this.vertices[s+1]],h)).dump=!1,this.borders[s]=r,r.parentPolygon=this,this.addChild(r);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),s=0;s<this.vertices.length-1;s++)a=this.board.select(this.vertices[s]),utils_type.A.exists(a._is_new_pol)?(this.addChild(a),delete a._is_new_pol):a.addChild(this);this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="polygon",this.createLabel(),this.methodMap=jxg.A.deepCopy(this.methodMap,{borders:"borders",vertices:"vertices",A:"Area",Area:"Area",Perimeter:"Perimeter",L:"Perimeter",boundingBox:"bounds",BoundingBox:"bounds",addPoints:"addPoints",insertPoints:"insertPoints",removePoints:"removePoints",Intersect:"intersect"})},jxg.A.Polygon.prototype=new base_element.A,jxg.A.extend(jxg.A.Polygon.prototype,{pnpoly:function(t,e,i){return geometry.A.pnpoly(t,e,this.vertices,i,this.board)},hasPoint:function(t,e){var i,s;if(this.evalVisProp("hasinnerpoints")&&this.pnpoly(t,e))return!0;for(s=this.borders.length,i=0;i<s;i++)if(this.borders[i].hasPoint(t,e))return!0;return!1},updateRenderer:function(){var t,e;if(!this.needsUpdate)return this;if(this.visPropCalc.visible){for(e=this.vertices.length-("polygonalchain"===this.elType?0:1),this.isReal=!0,t=0;t<e;++t)if(!this.vertices[t].isReal){this.isReal=!1;break}if(!this.isReal)for(t in this.updateVisibility(!1),this.childElements)this.childElements.hasOwnProperty(t)&&this.childElements[t].setDisplayRendNode(!1)}return this.visPropCalc.visible&&this.board.renderer.updatePolygon(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this},getTextAnchor:function(){var t,e,i,s,r;if(0===this.vertices.length)return new base_coords.A(constants.A.COORDS_BY_USER,[1,0,0],this.board);for(i=t=this.vertices[0].X(),s=e=this.vertices[0].Y(),r=0;r<this.vertices.length;r++)this.vertices[r].X()<t&&(t=this.vertices[r].X()),this.vertices[r].X()>i&&(i=this.vertices[r].X()),this.vertices[r].Y()>e&&(e=this.vertices[r].Y()),this.vertices[r].Y()<s&&(s=this.vertices[r].Y());return new base_coords.A(constants.A.COORDS_BY_USER,[.5*(t+i),.5*(e+s)],this.board)},getLabelAnchor:jxg.A.shortcut(jxg.A.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var t,e=utils_type.A.getCloneObject(this);return e.vertices=this.vertices,t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawPolygon(e),this.board.renderer.enhancedRendering=t,this.traces[e.id]=e.rendNode,this},hideElement:function(t){var e;if(jxg.A.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),!t)for(e=0;e<this.borders.length;e++)this.borders[e].hideElement();this.hasLabel&&utils_type.A.exists(this.label)&&(this.label.hiddenByParent=!0,this.label.visPropCalc.visible&&this.label.hideElement())},showElement:function(t){var e;if(jxg.A.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!0),!t)for(e=0;e<this.borders.length;e++)this.borders[e].showElement().updateRenderer();return utils_type.A.exists(this.label)&&this.hasLabel&&this.label.hiddenByParent&&(this.label.hiddenByParent=!1,this.label.visPropCalc.visible||this.label.showElement().updateRenderer()),this},Area:function(){return Math.abs(geometry.A.signedPolygon(this.vertices,!0))},Perimeter:function(){var t,e=this.vertices.length,i=0;for(t=1;t<e;++t)i+=this.vertices[t].Dist(this.vertices[t-1]);return i},L:function(){return this.Perimeter()},boundingBox:function(){var t,e,i=[0,0,0,0],s=this.vertices.length-1;if(0===s)return i;for(i[0]=this.vertices[0].X(),i[2]=i[0],i[1]=this.vertices[0].Y(),i[3]=i[1],t=1;t<s;++t)(e=this.vertices[t].X())<i[0]?i[0]=e:e>i[2]&&(i[2]=e),(e=this.vertices[t].Y())>i[1]?i[1]=e:e<i[3]&&(i[3]=e);return i},bounds:function(){return this.boundingBox()},remove:function(){var t;for(t=0;t<this.borders.length;t++)this.board.removeObject(this.borders[t]);base_element.A.prototype.remove.call(this)},findPoint:function(t){var e;if(!utils_type.A.isPoint(t))return-1;for(e=0;e<this.vertices.length;e++)if(this.vertices[e].id===t.id)return e;return-1},addPoints:function(t){var e,i=Array.prototype.slice.call(arguments);return e="polygonalchain"===this.elType?this.vertices.length-1:this.vertices.length-2,this.insertPoints.apply(this,[e].concat(i))},insertPoints:function(t,e){var i,s,r,o,n;if(0===arguments.length)return this;if(r=this.vertices.length-1,"polygon"===this.elType&&r--,t<-1||t>r)return this;for(s=arguments.length-1,i=1;i<s+1;i++)(n=utils_type.A.providePoints(this.board,[arguments[i]],{},"polygon",["vertices"])[0])._is_new&&(this.addChild(n),delete n._is_new),this.vertices.splice(t+i,0,n);if(this.withLines)for(o=t+1,"polygon"===this.elType?t<0?(this.vertices[this.vertices.length-1]=this.vertices[0],this.borders[this.borders.length-1].point2=this.vertices[this.vertices.length-1]):this.borders[t].point2=this.vertices[o]:t>=0&&(t<this.borders.length?this.borders[t].point2=this.vertices[o]:o=t),i=o;i<o+s;i++)this.borders.splice(i,0,this.board.create("segment",[this.vertices[i],this.vertices[i+1]],this.attr_line));return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},removePoints:function(t){var e,i,s,r,o=[],n=[],a=[],h=[];for("polygon"===this.elType&&(r=this.vertices.pop()),e=0;e<arguments.length;e++)s=arguments[e],utils_type.A.isPoint(s)&&(s=this.findPoint(s)),utils_type.A.isNumber(s)&&s>-1&&s<this.vertices.length&&-1===utils_type.A.indexOf(a,s)&&a.push(s);if(0===a.length)return"polygon"===this.elType&&this.vertices.push(r),this;for(e=0;e<a.length;e++)this.vertices[a[e]].removeChild(this);for(a=a.sort(),o=this.vertices.slice(),n=this.borders.slice(),this.withLines&&h.push([a[a.length-1]]),e=a.length-1;e>-1;e--)o[a[e]]=-1,this.withLines&&a.length>1&&a[e]-1>a[e-1]&&(h[h.length-1][1]=a[e],h.push([a[e-1]]));for(this.withLines&&(h[h.length-1][1]=a[0]),this.vertices=[],e=0;e<o.length;e++)utils_type.A.isPoint(o[e])&&this.vertices.push(o[e]);if("polygon"===this.elType&&this.vertices.length>1&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(e=0;e<h.length;e++){for(i=h[e][1]-1;i<h[e][0]+1;i++)i<0?"polygon"===this.elType&&(this.board.removeObject(this.borders[n.length-1]),n[n.length-1]=-1):i<n.length&&(this.board.removeObject(this.borders[i]),n[i]=-1);0!==h[e][1]&&h[e][0]!==o.length-1&&(n[h[e][0]-1]=this.board.create("segment",[o[h[e][1]-1],o[h[e][0]+1]],this.attr_line))}for(this.borders=[],e=0;e<n.length;e++)-1!==n[e]&&this.borders.push(n[e]);"polygon"===this.elType&&this.vertices.length>2&&(h[0][1]===this.vertices.length-1||0===h[h.length-1][1])&&this.borders.push(this.board.create("segment",[this.vertices[this.vertices.length-2],this.vertices[0]],this.attr_line))}return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},getParents:function(){return this.setParents(this.vertices),this.parents},getAttributes:function(){var t,e=base_element.A.prototype.getAttributes.call(this);if(this.withLines)for(e.lines=e.lines||{},e.lines.ids=[],e.lines.colors=[],t=0;t<this.borders.length;t++)e.lines.ids.push(this.borders[t].id),e.lines.colors.push(this.borders[t].visProp.strokecolor);return e},snapToGrid:function(){var t,e;for(e=!!this.evalVisProp("snaptogrid"),t=0;t<this.vertices.length;t++)this.vertices[t].handleSnapToGrid(e,!0)},setPositionDirectly:function(t,e,i){var s,r,o,n=new base_coords.A(t,e,this.board),a=new base_coords.A(t,i,this.board);for(o=this.vertices.length-1,r=0;r<o;r++)if(!this.vertices[r].draggable())return this;return s=statistics.A.subtract(n.usrCoords,a.usrCoords),this.board.create("transform",s.slice(1),{type:"translate"}).applyOnce(this.vertices.slice(0,-1)),this},sutherlandHodgman:function(t){var e,i,s,r,o,n,a,h=jxg.A.Math.Geometry.sortVertices(this.vertices),l=jxg.A.Math.Geometry.sortVertices(t.vertices),c=h.length-1,u=l.length-1,d=[],p=function(t,e,i){return(e[1]-t[1])*(i[2]-t[2])-(e[2]-t[2])*(i[1]-t[1])>=0};for(s=0;s<u;s++)d.push(l[s]);for(s=0;s<c;s++)for(i=d.slice(0),d=[],o=i[(e=i.length)-1],r=0;r<e;r++)n=i[r],p(h[s],h[s+1],n)?(p(h[s],h[s+1],o)||((a=jxg.A.Math.Geometry.meetSegmentSegment(o,n,h[s],h[s+1]))[0][1]/=a[0][0],a[0][2]/=a[0][0],a[0][0]=1,d.push(a[0])),d.push(n)):p(h[s],h[s+1],o)&&((a=jxg.A.Math.Geometry.meetSegmentSegment(o,n,h[s],h[s+1]))[0][1]/=a[0][0],a[0][2]/=a[0][0],a[0][0]=1,d.push(a[0])),o=n;return d},intersect:function(t){return this.sutherlandHodgman(t)}}),jxg.A.createPolygon=function(t,e,i){var s,r,o,n,a,h,l=[],c=!1;if(utils_type.A.copyAttributes(i,t.options,"polygon"),null===(n=t.select(e[0]))&&(n=e[0]),utils_type.A.isObject(n)&&n.type===constants.A.OBJECT_TYPE_POLYGON&&utils_type.A.isTransformationOrArray(e[1]))for(c=!0,o=n.vertices.length-1,h=utils_type.A.copyAttributes(i,t.options,"polygon","vertices"),r=0;r<o;r++)h.withlabel&&(h.name=""===n.vertices[r].name?"":n.vertices[r].name+"'"),l.push(t.create("point",[n.vertices[r],e[1]],h));else if(!1===(l=utils_type.A.providePoints(t,e,i,"polygon",["vertices"])))throw new Error("JSXGraph: Can't create polygon / polygonalchain with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon and a transformation can be supplied");if(a=utils_type.A.copyAttributes(i,t.options,"polygon"),(s=new jxg.A.Polygon(t,l,a)).isDraggable=!0,c)for(s.prepareUpdate().update().updateVisibility().updateRenderer(),o=n.vertices.length-1,r=0;r<o;r++)l[r].prepareUpdate().update().updateVisibility().updateRenderer();return s},jxg.A.createRegularPolygon=function(t,e,i){var s,r,o,n,a,h,l,c=[];if(o=e[(a=e.length)-1],utils_type.A.isNumber(o)&&(3!==e.length||o<3))throw new Error("JSXGraph: A regular polygon needs two point types and a number > 2 as input.");if(utils_type.A.isNumber(t.select(o))?(a--,h=!1):(o=a,h=!0),!1===(c=utils_type.A.providePoints(t,e.slice(0,a),i,"regularpolygon",["vertices"])))throw new Error("JSXGraph: Can't create regular polygon with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates");for(l=utils_type.A.copyAttributes(i,t.options,"regularpolygon","vertices"),r=2;r<o;r++)n=t.create("transform",[Math.PI*(2-(o-2)/o),c[r-1]],{type:"rotate"}),h?(c[r].addTransform(c[r-2],n),c[r].fullUpdate()):(utils_type.A.isArray(l.ids)&&l.ids.length>=o-2&&(l.id=l.ids[r-2]),c[r]=t.create("point",[c[r-2],n],l),c[r].type=constants.A.OBJECT_TYPE_CAS,c[r].isDraggable=!0,c[r].visProp.fixed=!1);return l=utils_type.A.copyAttributes(i,t.options,"regularpolygon"),(s=t.create("polygon",c,l)).elType="regularpolygon",s},jxg.A.createPolygonalChain=function(t,e,i){var s,r;return s=utils_type.A.copyAttributes(i,t.options,"polygonalchain"),(r=t.create("polygon",e,s)).elType="polygonalchain",r.vertices.pop(),t.removeObject(r.borders[r.borders.length-1]),r.borders.pop(),r},jxg.A.createParallelogram=function(t,e,i){var s,r,o,n,a;if(!1===(o=utils_type.A.providePoints(t,e,i,"polygon",["vertices"]))||o.length<3)throw new Error("JSXGraph: Can't create parallelogram with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates.");return a=utils_type.A.copyAttributes(i,t.options,"parallelogram","parallelpoint"),r=t.create("parallelpoint",o,a),n=utils_type.A.copyAttributes(i,t.options,"parallelogram"),(s=t.create("polygon",[o[0],o[1],r,o[2]],n)).elType="parallelogram",s.parallelPoint=r,s.isDraggable=!0,r.isDraggable=!0,r.visProp.fixed=!1,s},jxg.A.registerElement("polygon",jxg.A.createPolygon),jxg.A.registerElement("regularpolygon",jxg.A.createRegularPolygon),jxg.A.registerElement("polygonalchain",jxg.A.createPolygonalChain),jxg.A.registerElement("parallelogram",jxg.A.createParallelogram);var polygon=jxg.A.Polygon;jxg.A.Curve=function(t,e,i){this.constructor(t,i,constants.A.OBJECT_TYPE_CURVE,constants.A.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=this.evalVisProp("numberpointshigh"),this.bezierDegree=1,this.dataX=null,this.dataY=null,this.ticks=[],this.qdt=null,utils_type.A.exists(e[0])?this.varname=e[0]:this.varname="x",this.xterm=e[1],this.yterm=e[2],this.generateTerm(this.varname,this.xterm,this.yterm,e[3],e[4]),this.updateCurve(),this.id=this.board.setId(this,"G"),this.board.renderer.drawCurve(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="curve",this.createLabel(),utils_type.A.isString(this.xterm)&&this.notifyParents(this.xterm),utils_type.A.isString(this.yterm)&&this.notifyParents(this.yterm),this.methodMap=utils_type.A.deepCopy(this.methodMap,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"})},jxg.A.Curve.prototype=new base_element.A,jxg.A.extend(jxg.A.Curve.prototype,{minX:function(){return"polar"===this.evalVisProp("curvetype")?0:new base_coords.A(constants.A.COORDS_BY_SCREEN,[.1*-this.board.canvasWidth,0],this.board,!1).usrCoords[1]},maxX:function(){return"polar"===this.evalVisProp("curvetype")?2*Math.PI:new base_coords.A(constants.A.COORDS_BY_SCREEN,[1.1*this.board.canvasWidth,0],this.board,!1).usrCoords[1]},X:function(t){return NaN},Y:function(t){return NaN},Z:function(t){return 1},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return this.transformations.length>0&&(e=math.A.matVecMult(this.transformMat,e)),e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},hasPoint:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b=[],y=this.evalVisProp("numberpointslow"),v=(this.maxX()-this.minX())/y,C=1/0,P=!0;if(utils_type.A.isObject(this.evalVisProp("precision"))?(f=this.board._inputDevice,p=this.evalVisProp("precision."+f)):p=this.board.options.precision.hasPoint,t=(h=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=h.usrCoords[2],1===this.bezierDegree&&this.evalVisProp("hasinnerpoints")&&0!==geometry.A.windingNumber([1,t,e],this.points,!0))return!0;if(p+=.5*this.evalVisProp("strokewidth"),p*=p,_=this.board.unitX*this.board.unitX,g=this.board.unitY*this.board.unitY,m=this.minX(),this.maxX(),utils_type.A.exists(this._visibleArea)&&(m=this._visibleArea[0],v=(this._visibleArea[1]-m)/y),"parameter"===(A=this.evalVisProp("curvetype"))||"polar"===A)for(this.transformations.length>0&&(this.updateTransformMatrix(),c=math.A.inverse(this.transformMat),t=(r=math.A.matVecMult(c,[1,t,e]))[1],e=r[2]),o=0,s=m;o<y;o++){if((C=(t-(n=this.X(s,P)))*(t-n)*_+(e-(a=this.Y(s,P)))*(e-a)*g)<=p)return!0;s+=v}else if("plot"===A||"functiongraph"===A){for((!utils_type.A.exists(i)||i<0)&&(i=0),utils_type.A.exists(this.qdt)&&this.evalVisProp("useqdt")&&3!==this.bezierDegree?l=(u=(d=this.qdt.query(new base_coords.A(constants.A.COORDS_BY_USER,[t,e],this.board))).points).length:(u=this.points,l=this.numberPoints-1),o=i;o<l;o++)if(3===this.bezierDegree?b=geometry.A.projectCoordsToBeziersegment([1,t,e],this,o):d?(u[o].prev&&(b=geometry.A.projectCoordsToSegment([1,t,e],u[o].prev.usrCoords,u[o].usrCoords)),u[o].next&&u[o+1]!==u[o].next&&(b=geometry.A.projectCoordsToSegment([1,t,e],u[o].usrCoords,u[o].next.usrCoords))):b=geometry.A.projectCoordsToSegment([1,t,e],u[o].usrCoords,u[o+1].usrCoords),b[1]>=0&&b[1]<=1&&(t-b[0][1])*(t-b[0][1])*_+(e-b[0][2])*(e-b[0][2])*g<=p)return!0;return!1}return C<p},allocatePoints:function(){var t,e;if(e=this.numberPoints,this.points.length<this.numberPoints)for(t=this.points.length;t<e;t++)this.points[t]=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],this.board,!1)},update:function(){return this.needsUpdate&&(this.evalVisProp("trace")&&this.cloneToBackground(!0),this.updateCurve()),this},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=plot.checkReal(this.points),this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateCurve(this),this.hasLabel&&this.visPropCalc.visible&&this.label&&this.label.visPropCalc.visible&&this.isReal&&(this.label.update(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},updateDataArray:function(){},updateCurve:function(){var t,e,i,s,r,o,n=this.visProp.plotversion,a=!1;if(this.updateTransformMatrix(),this.updateDataArray(),i=this.minX(),s=this.maxX(),utils_type.A.exists(this.dataX))for(this.numberPoints=this.dataX.length,e=this.numberPoints,this.allocatePoints(),t=0;t<e;t++)r=t,utils_type.A.exists(this.dataY)?(o=t,this.points[t].setCoordinates(constants.A.COORDS_BY_USER,[this.dataX[t],this.dataY[t]],!1)):(o=this.X(r),this.points[t].setCoordinates(constants.A.COORDS_BY_USER,[this.dataX[t],this.Y(o,a)],!1)),this.points[t]._t=t,a=!0;else if(this.evalVisProp("doadvancedplot")?1===n||this.evalVisProp("doadvancedplotold")?plot.updateParametricCurveOld(this,i,s):2===n?plot.updateParametricCurve_v2(this,i,s):3===n?plot.updateParametricCurve_v3(this,i,s):4===n?plot.updateParametricCurve_v4(this,i,s):plot.updateParametricCurve_v2(this,i,s):(this.board.updateQuality===this.board.BOARD_QUALITY_HIGH?this.numberPoints=this.evalVisProp("numberpointshigh"):this.numberPoints=this.evalVisProp("numberpointslow"),this.allocatePoints(),plot.updateParametricCurveNaive(this,i,s,this.numberPoints)),e=this.numberPoints,this.evalVisProp("useqdt")&&this.board.updateQuality===this.board.BOARD_QUALITY_HIGH)for(this.qdt=new qdt(this.board.getBoundingBox()),t=0;t<this.points.length;t++)this.qdt.insert(this.points[t]),t>0&&(this.points[t].prev=this.points[t-1]),t<e-1&&(this.points[t].next=this.points[t+1]);for("plot"!==this.evalVisProp("curvetype")&&this.evalVisProp("rdpsmoothing")&&(this.points=numerics.A.RamerDouglasPeucker(this.points,.2),this.numberPoints=this.points.length),e=this.numberPoints,t=0;t<e;t++)this.updateTransform(this.points[t]);return this},updateTransformMatrix:function(){var t,e,i=this.transformations.length;for(this.transformMat=[[1,0,0],[0,1,0],[0,0,1]],e=0;e<i;e++)(t=this.transformations[e]).update(),this.transformMat=math.A.matMatMult(t.matrix,this.transformMat);return this},updateTransform:function(t){var e;return this.transformations.length>0&&(e=math.A.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(constants.A.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){var e,i=utils_type.A.isArray(t)?t:[t],s=i.length;for(e=0;e<s;e++)this.transformations.push(i[e]);return this},interpolationFunctionFromArray:function(t){var e="data"+t,i=this;return function(t,s){var r,o,n,a,h=i[e],l=h.length,c=[];if(isNaN(t))return NaN;if(t<0)return utils_type.A.isFunction(h[0])?h[0]():h[0];if(3===i.bezierDegree){if(t>=(l-1)/3)return utils_type.A.isFunction(h[h.length-1])?h[h.length-1]():h[h.length-1];for(r=3*Math.floor(t),a=1-(n=t%1),o=0;o<4;o++)utils_type.A.isFunction(h[r+o])?c[o]=h[r+o]():c[o]=h[r+o];return a*a*(a*c[0]+3*n*c[1])+(3*a*c[2]+n*c[3])*n*n}if((r=t>l-2?l-2:parseInt(Math.floor(t),10))===t)return utils_type.A.isFunction(h[r])?h[r]():h[r];for(o=0;o<2;o++)utils_type.A.isFunction(h[r+o])?c[o]=h[r+o]():c[o]=h[r+o];return c[0]+(c[1]-c[0])*(t-r)}},generateTerm:function(t,e,i,s,r){var o,n,a;utils_type.A.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray.apply(this,["X"]),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=utils_type.A.createFunction(e,this.board,t),utils_type.A.isString(e)?this.visProp.curvetype="functiongraph":(utils_type.A.isFunction(e)||utils_type.A.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),utils_type.A.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):utils_type.A.exists(i)?this.Y=utils_type.A.createFunction(i,this.board,t):(a=math.A.transpose(e),this.dataX=a[0],this.dataY=a[1],this.numberPoints=this.dataX.length,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])),utils_type.A.isFunction(e)&&utils_type.A.isArray(i)&&(o=utils_type.A.createFunction(i[0],this.board,""),n=utils_type.A.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+o()},this.X.deps=o.deps,this.Y=function(t){return e(t)*Math.sin(t)+n()},this.Y.deps=n.deps,this.visProp.curvetype="polar"),utils_type.A.exists(s)?this.minX=utils_type.A.createFunction(s,this.board,""):delete this.minX,utils_type.A.exists(r)?this.maxX=utils_type.A.createFunction(r,this.board,""):delete this.maxX,this.addParentsFromJCFunctions([this.X,this.Y,this.minX,this.maxX])},notifyParents:function(t){var e,i,s,r=!1;for(e in s={xterm:1,yterm:1})if(s.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin)for(i in r=!0,this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this);r||geonext.A.findDependencies(this,t,this.board)},getLabelPosition:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_=1.5;return l=this.minX(),c=this.maxX(),u=numerics.A.findDomain(this.X,[l,c],null,!1),u=numerics.A.findDomain(this.Y,u,null,!1),l=Math.max(u[0],u[0]),c=Math.min(u[1],u[1]),r=utils_type.A.parsePosition(t),h=utils_type.A.parseNumber(r.pos,c-l,1),r.pos.indexOf("fr")<0&&r.pos.indexOf("%")<0&&(h=0),d=l+h,i=this.X(d),s=this.Y(d),isNaN(i+s)&&(d=l+(h/=c-l),i=this.X(l)+h*(this.X(c)-this.X(l)),s=this.Y(l)+h*(this.Y(c)-this.Y(l))),o=new base_coords.A(constants.A.COORDS_BY_USER,[i,s],this.board).scrCoords,d<l+(a=math.A.eps)?(p=(this.X(d+a)-this.X(d))/a,f=(this.Y(d+a)-this.Y(d))/a):d>c-a?(p=(this.X(d)-this.X(d-a))/a,f=(this.Y(d)-this.Y(d-a))/a):(p=.5*(this.X(d+a)-this.X(d-a))/a,f=.5*(this.Y(d+a)-this.Y(d-a))/a),p=isNaN(p)?1:p,f=isNaN(f)?1:f,n=math.A.hypot(p,f),"left"===r.side?f*=-1:p*=-1,utils_type.A.exists(this.label)&&(_=.5*e/n),i=o[1]+f*this.label.size[0]*_,s=o[2]-p*this.label.size[1]*_,new base_coords.A(constants.A.COORDS_BY_SCREEN,[i,s],this.board)},getLabelAnchor:function(){var t,e,i,s,r=.05*this.board.canvasWidth,o=.05*this.board.canvasHeight,n=.95*this.board.canvasWidth,a=.95*this.board.canvasHeight;if(!utils_type.A.exists(this.label))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(i=this.label.evalVisProp("position"),!utils_type.A.isString(i))return new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(i.indexOf("right")<0&&i.indexOf("left")<0))return this.getLabelPosition(i,this.label.evalVisProp("distance"));switch(this.evalVisProp("label.position")){case"ulft":t=r,e=o;break;case"llft":t=r,e=a;break;case"rt":t=n,e=.5*a;break;case"lrt":t=n,e=a;break;case"urt":t=n,e=o;break;case"top":t=.5*n,e=o;break;case"bot":t=.5*n,e=a;break;default:t=r,e=.5*a}return s=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board,!1),geometry.A.projectCoordsToCurve(s.usrCoords[1],s.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,e=utils_type.A.getCloneObject(this);return e.points=this.points.slice(0),e.bezierDegree=this.bezierDegree,e.numberPoints=this.numberPoints,t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(e),this.board.renderer.enhancedRendering=t,this.traces[e.id]=e.rendNode,this},bounds:function(){var t,e,i,s=1/0,r=-1/0,o=1/0,n=-1/0,a=this.points.length;if(3===this.bezierDegree){for(t=0;t<a;t++)this.points[t].X=utils_type.A.bind(function(){return this.usrCoords[1]},this.points[t]),this.points[t].Y=utils_type.A.bind(function(){return this.usrCoords[2]},this.points[t]);return i=(e=numerics.A.bezier(this.points))[3](),s=numerics.A.fminbr(function(t){return e[0](t)},[0,i]),r=numerics.A.fminbr(function(t){return-e[0](t)},[0,i]),o=numerics.A.fminbr(function(t){return e[1](t)},[0,i]),n=numerics.A.fminbr(function(t){return-e[1](t)},[0,i]),s=e[0](s),r=e[0](r),o=e[1](o),[s,n=e[1](n),r,o]}for(t=0;t<a;t++)s>this.points[t].usrCoords[1]&&(s=this.points[t].usrCoords[1]),r<this.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),o>this.points[t].usrCoords[2]&&(o=this.points[t].usrCoords[2]),n<this.points[t].usrCoords[2]&&(n=this.points[t].usrCoords[2]);return[s,n,r,o]},getParents:function(){var t=[this.xterm,this.yterm,this.minX(),this.maxX()];return 0!==this.parents.length&&(t=this.parents),t},moveTo:function(t){var e,i=[];return this.points.length>0&&!this.evalVisProp("fixed")?(e=this.points[0],i=3===t.length?[t[0]-e.usrCoords[0],t[1]-e.usrCoords[1],t[2]-e.usrCoords[2]]:[t[0]-e.usrCoords[1],t[1]-e.usrCoords[2]],this.setPosition(constants.A.COORDS_BY_USER,i),this.board.update(this)):this},getTransformationSource:function(){var t,e;return utils_type.A.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===constants.A.OBJECT_CLASS_CURVE&&(t=!0),[t,e]}}),jxg.A.createCurve=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"curve");return s=t.select(e[0],!0),utils_type.A.isTransformationOrArray(e[1])&&utils_type.A.isObject(s)&&(s.type===constants.A.OBJECT_TYPE_CURVE||s.type===constants.A.OBJECT_TYPE_ANGLE||s.type===constants.A.OBJECT_TYPE_ARC||s.type===constants.A.OBJECT_TYPE_CONIC||s.type===constants.A.OBJECT_TYPE_SECTOR)?(s.type===constants.A.OBJECT_TYPE_SECTOR?o=utils_type.A.copyAttributes(i,t.options,"sector"):s.type===constants.A.OBJECT_TYPE_ARC?o=utils_type.A.copyAttributes(i,t.options,"arc"):s.type===constants.A.OBJECT_TYPE_ANGLE?(utils_type.A.exists(i.withLabel)||(i.withLabel=!1),o=utils_type.A.copyAttributes(i,t.options,"angle")):o=utils_type.A.copyAttributes(i,t.options,"curve"),o=utils_type.A.copyAttributes(o,t.options,"curve"),(r=new jxg.A.Curve(t,["x",[],[]],o)).updateDataArray=function(){var t,e=s.numberPoints;for(this.bezierDegree=s.bezierDegree,this.dataX=[],this.dataY=[],t=0;t<e;t++)this.dataX.push(s.points[t].usrCoords[1]),this.dataY.push(s.points[t].usrCoords[2]);return this},r.addTransform(e[1]),s.addChild(r),r.setParents([s]),r._transformationSource=s,r):(o=utils_type.A.copyAttributes(i,t.options,"curve"),new jxg.A.Curve(t,["x"].concat(e),o))},jxg.A.registerElement("curve",jxg.A.createCurve),jxg.A.createFunctiongraph=function(t,e,i){var s,r=["x","x"].concat(e);return s=utils_type.A.copyAttributes(i,t.options,"functiongraph"),(s=utils_type.A.copyAttributes(s,t.options,"curve")).curvetype="functiongraph",new jxg.A.Curve(t,r,s)},jxg.A.registerElement("functiongraph",jxg.A.createFunctiongraph),jxg.A.registerElement("plot",jxg.A.createFunctiongraph),jxg.A.createSpline=function(t,e,i){var s,r,o;return r=function(){var t,i=[],s=[];return[function(r,o){var n,a,h;if(!o){if(i=[],s=[],2===e.length&&utils_type.A.isArray(e[0])&&utils_type.A.isArray(e[1])&&e[0].length===e[1].length)for(n=0;n<e[0].length;n++)utils_type.A.isFunction(e[0][n])?i.push(e[0][n]()):i.push(e[0][n]),utils_type.A.isFunction(e[1][n])?s.push(e[1][n]()):s.push(e[1][n]);else for(n=0;n<e.length;n++)if(utils_type.A.isPoint(e[n]))i.push(e[n].X()),s.push(e[n].Y());else if(utils_type.A.isArray(e[n])&&2===e[n].length)for(a=0;a<e.length;a++)utils_type.A.isFunction(e[a][0])?i.push(e[a][0]()):i.push(e[a][0]),utils_type.A.isFunction(e[a][1])?s.push(e[a][1]()):s.push(e[a][1]);else utils_type.A.isFunction(e[n])&&2===e[n]().length&&(h=e[n](),i.push(h[0]),s.push(h[1]));t=numerics.A.splineDef(i,s)}return numerics.A.splineEval(r,i,s,t)},function(){return i[0]},function(){return i[i.length-1]}]},(i=utils_type.A.copyAttributes(i,t.options,"curve")).curvetype="functiongraph",o=r(),(s=new jxg.A.Curve(t,["x","x",o[0],o[1],o[2]],i)).setParents(e),s.elType="spline",s},jxg.A.registerElement("spline",jxg.A.createSpline),jxg.A.createCardinalSpline=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p="\nPossible parent types: [points:array, tau:number|function, type:string]";if(!utils_type.A.exists(e[0])||!utils_type.A.isArray(e[0]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 1 'points' has to be array of points or coordinate pairs"+p);if(!utils_type.A.exists(e[1])||!utils_type.A.isNumber(e[1])&&!utils_type.A.isFunction(e[1]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 2 'tau' has to be number between [0,1] or function'"+p);if(a=utils_type.A.exists(e[2])&&utils_type.A.isString(e[2])?e[2]:"uniform",i=utils_type.A.copyAttributes(i,t.options,"curve"),(i=utils_type.A.copyAttributes(i,t.options,"cardinalspline")).curvetype="parameter",h=e[0],l=[],!i.isarrayofcoordinates&&2===h.length&&utils_type.A.isArray(h[0])&&utils_type.A.isArray(h[1])&&h[0].length===h[1].length)for(c=0;c<h[0].length;c++)l[c]=[],utils_type.A.isFunction(h[0][c])?l[c].push(h[0][c]()):l[c].push(h[0][c]),utils_type.A.isFunction(h[1][c])?l[c].push(h[1][c]()):l[c].push(h[1][c]);else for(c=0;c<h.length;c++)utils_type.A.isString(h[c])?l.push(t.select(h[c])):utils_type.A.isPoint(h[c])?l.push(h[c]):utils_type.A.isArray(h[c])&&2===h[c].length?(l[c]=[],utils_type.A.isFunction(h[c][0])?l[c].push(h[c][0]()):l[c].push(h[c][0]),utils_type.A.isFunction(h[c][1])?l[c].push(h[c][1]()):l[c].push(h[c][1])):utils_type.A.isFunction(h[c])&&2===h[c]().length&&l.push(e[c]());if(!0===i.createpoints)o=utils_type.A.providePoints(t,l,i,"cardinalspline",["points"]);else for(o=[],r=function(t){return{X:function(){return l[t][0]},Y:function(){return l[t][1]},Dist:function(t){var e=this.X()-t.X(),i=this.Y()-t.Y();return math.A.hypot(e,i)}}},c=0;c<l.length;c++)utils_type.A.isPoint(l[c])?o.push(l[c]):o.push(r(c));for(n=e[1],d=["x"].concat(numerics.A.CardinalSpline(o,n,a)),s=new jxg.A.Curve(t,d,i),u=o.length,s.setParents(o),c=0;c<u;c++)h=o[c],utils_type.A.isPoint(h)&&(utils_type.A.exists(h._is_new)?(s.addChild(h),delete h._is_new):h.addChild(s));return s.elType="cardinalspline",s},jxg.A.registerElement("cardinalspline",jxg.A.createCardinalSpline),jxg.A.createMetapostSpline=function(t,e,i){var s,r,o,n,a,h,l,c,u="\nPossible parent types: [points:array, controls:object";if(!utils_type.A.exists(e[0])||!utils_type.A.isArray(e[0]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 1 'points' has to be array of points or coordinate pairs"+u);if(!utils_type.A.exists(e[1])||!utils_type.A.isObject(e[1]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 2 'controls' has to be a JavaScript object'"+u);if(i=utils_type.A.copyAttributes(i,t.options,"curve"),(i=utils_type.A.copyAttributes(i,t.options,"metapostspline")).curvetype="parameter",a=e[0],h=[],!i.isarrayofcoordinates&&2===a.length&&utils_type.A.isArray(a[0])&&utils_type.A.isArray(a[1])&&a[0].length===a[1].length)for(l=0;l<a[0].length;l++)h[l]=[],utils_type.A.isFunction(a[0][l])?h[l].push(a[0][l]()):h[l].push(a[0][l]),utils_type.A.isFunction(a[1][l])?h[l].push(a[1][l]()):h[l].push(a[1][l]);else for(l=0;l<a.length;l++)utils_type.A.isString(a[l])?h.push(t.select(a[l])):utils_type.A.isPoint(a[l])?h.push(a[l]):utils_type.A.isArray(a[l])&&2===a[l].length?(h[l]=[],utils_type.A.isFunction(a[l][0])?h[l].push(a[l][0]()):h[l].push(a[l][0]),utils_type.A.isFunction(a[l][1])?h[l].push(a[l][1]()):h[l].push(a[l][1])):utils_type.A.isFunction(a[l])&&2===a[l]().length&&h.push(e[l]());if(!0===i.createpoints)o=utils_type.A.providePoints(t,h,i,"metapostspline",["points"]);else for(o=[],r=function(t){return{X:function(){return h[t][0]},Y:function(){return h[t][1]}}},l=0;l<h.length;l++)utils_type.A.isPoint(h[l])?o.push(h[l]):o.push(r);for(n=e[1],(s=new jxg.A.Curve(t,["t",[],[],0,a.length-1],i)).updateDataArray=function(){var t,e,i=o.length,s=[];for(e=0;e<i;e++)s.push([o[e].X(),o[e].Y()]);t=metapost.curve(s,n),this.dataX=t[0],this.dataY=t[1]},s.bezierDegree=3,c=o.length,s.setParents(o),l=0;l<c;l++)utils_type.A.isPoint(o[l])&&o[l].addChild(s);return s.elType="metapostspline",s},jxg.A.registerElement("metapostspline",jxg.A.createMetapostSpline),jxg.A.createRiemannsum=function(t,e,i){var s,r,o,n,a,h;if((h=utils_type.A.copyAttributes(i,t.options,"riemannsum")).curvetype="plot",o=e[0],s=utils_type.A.createFunction(e[1],t,""),!utils_type.A.exists(s))throw new Error("JSXGraph: JXG.createRiemannsum: argument '2' n has to be number or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");if("string"==typeof e[2]&&(e[2]="'"+e[2]+"'"),r=utils_type.A.createFunction(e[2],t,""),!utils_type.A.exists(r))throw new Error("JSXGraph: JXG.createRiemannsum: argument 3 'type' has to be string or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");return n=[[0],[0]].concat(e.slice(3)),(a=t.create("curve",n,h)).sum=0,a.Value=function(){return this.sum},a.updateDataArray=function(){var t=numerics.A.riemann(o,s(),r(),this.minX(),this.maxX());this.dataX=t[0],this.dataY=t[1],this.sum=t[2]},a.addParentsFromJCFunctions([s,r]),a},jxg.A.registerElement("riemannsum",jxg.A.createRiemannsum),jxg.A.createTracecurve=function(t,e,i){var s,r,o,n;if(2!==e.length)throw new Error("JSXGraph: Can't create trace curve with given parent'\nPossible parent types: [glider, point]");if(r=t.select(e[0]),o=t.select(e[1]),r.type!==constants.A.OBJECT_TYPE_GLIDER||!utils_type.A.isPoint(o))throw new Error("JSXGraph: Can't create trace curve with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider, point]");return(n=utils_type.A.copyAttributes(i,t.options,"tracecurve")).curvetype="plot",(s=t.create("curve",[[0],[0]],n)).updateDataArray=function(){var t,e,i,s,n,a,h,l,c,u=this.visProp.numberpoints,d=r.position,p=r.slideObject,f=p.minX();for(e=(p.maxX()-f)/u,this.dataX=[],this.dataY=[],p.elementClass!==constants.A.OBJECT_CLASS_CURVE&&u++,t=0;t<u;t++){for(s in i=f+t*e,a=p.X(i)/p.Z(i),h=p.Y(i)/p.Z(i),r.setPositionDirectly(constants.A.COORDS_BY_USER,[a,h]),l=!1,this.board.objects)if(this.board.objects.hasOwnProperty(s)&&((n=this.board.objects[s])===r&&(l=!0),l&&n.needsRegularUpdate&&(c=n.visProp.trace,n.visProp.trace=!1,n.needsUpdate=!0,n.update(!0),n.visProp.trace=c,n===o)))break;this.dataX[t]=o.X(),this.dataY[t]=o.Y()}for(s in r.position=d,l=!1,this.board.objects)if(this.board.objects.hasOwnProperty(s)&&((n=this.board.objects[s])===r&&(l=!0),l&&n.needsRegularUpdate&&(c=n.visProp.trace,n.visProp.trace=!1,n.needsUpdate=!0,n.update(!0),n.visProp.trace=c,n===o)))break},s},jxg.A.registerElement("tracecurve",jxg.A.createTracecurve),jxg.A.createStepfunction=function(t,e,i){var s,r;if(2!==e.length)throw new Error("JSXGraph: Can't create step function with given parent'\nPossible parent types: [array, array|function]");return r=utils_type.A.copyAttributes(i,t.options,"stepfunction"),(s=t.create("curve",e,r)).updateDataArray=function(){var t,e=0,i=this.xterm.length;if(this.dataX=[],this.dataY=[],0!==i)for(this.dataX[e]=this.xterm[0],this.dataY[e]=this.yterm[0],++e,t=1;t<i;++t)this.dataX[e]=this.xterm[t],this.dataY[e]=this.dataY[e-1],++e,this.dataX[e]=this.xterm[t],this.dataY[e]=this.yterm[t],++e},s},jxg.A.registerElement("stepfunction",jxg.A.createStepfunction),jxg.A.createDerivative=function(t,e,i){var s,r,o,n,a;if(1!==e.length&&e[0].class!==constants.A.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create derivative curve with given parent'\nPossible parent types: [curve]");return a=utils_type.A.copyAttributes(i,t.options,"curve"),r=e[0],o=numerics.A.D(r.X),n=numerics.A.D(r.Y),(s=t.create("curve",[function(t){return r.X(t)},function(t){return n(t)/o(t)},r.minX(),r.maxX()],a)).setParents(r),s},jxg.A.registerElement("derivative",jxg.A.createDerivative),jxg.A.createCurveIntersection=function(t,e,i){var s;if(2!==e.length)throw new Error("JSXGraph: Can't create curve intersection with given parent'\nPossible parent types: [array, array|function]");return(s=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.intersection(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},jxg.A.createCurveUnion=function(t,e,i){var s;if(2!==e.length)throw new Error("JSXGraph: Can't create curve union with given parent'\nPossible parent types: [array, array|function]");return(s=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.union(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},jxg.A.createCurveDifference=function(t,e,i){var s;if(2!==e.length)throw new Error("JSXGraph: Can't create curve difference with given parent'\nPossible parent types: [array, array|function]");return(s=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.difference(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},jxg.A.registerElement("curvedifference",jxg.A.createCurveDifference),jxg.A.registerElement("curveintersection",jxg.A.createCurveIntersection),jxg.A.registerElement("curveunion",jxg.A.createCurveUnion),jxg.A.createBoxPlot=function(t,e,i){var s,r,o,n=utils_type.A.copyAttributes(i,t.options,"boxplot");if(3!==e.length)throw new Error("JSXGraph: Can't create box plot with given parent'\nPossible parent types: [array, number|function, number|function] containing quantiles, axis, width");if(e[0].length<5)throw new Error("JSXGraph: Can't create box plot with given parent[0]'\nparent[0] has to contain at least 5 quantiles.");for(s=t.create("curve",[[],[]],n),o=e[0].length,s.Q=[],r=0;r<o;r++)s.Q[r]=utils_type.A.createFunction(e[0][r],t);return s.x=utils_type.A.createFunction(e[1],t),s.w=utils_type.A.createFunction(e[2],t),s.updateDataArray=function(){var t,e,i,s,r,o,n,a,h;n=this.evalVisProp("smallwidth"),a=this.evalVisProp("dir"),i=(h=this.x())-.5*this.w(),s=h-.5*this.w()*n,r=h+.5*this.w(),t=[h,s,o=h+.5*this.w()*n,h,h,i,i,r,r,h,NaN,i,r,NaN,h,h,s,o,h],e=[this.Q[0](),this.Q[0](),this.Q[0](),this.Q[0](),this.Q[1](),this.Q[1](),this.Q[3](),this.Q[3](),this.Q[1](),this.Q[1](),NaN,this.Q[2](),this.Q[2](),NaN,this.Q[3](),this.Q[4](),this.Q[4](),this.Q[4](),this.Q[4]()],"vertical"===a?(this.dataX=t,this.dataY=e):(this.dataX=e,this.dataY=t)},s.addParentsFromJCFunctions([s.Q,s.x,s.w]),s},jxg.A.registerElement("boxplot",jxg.A.createBoxPlot),jxg.A.createImplicitCurve=function(t,e,i){var s,r;if([1,3,5].indexOf(e.length)<0)throw new Error("JSXGraph: Can't create curve implicitCurve with given parent'\nPossible parent types: [f], [f, rangex, rangey], [f, dfx, dfy] or [f, dfx, dfy, rangex, rangey]\nwith functions f, dfx, dfy and arrays of length 2 rangex, rangey.");return r=utils_type.A.copyAttributes(i,t.options,"implicitcurve"),(s=t.create("curve",[[],[]],r)).f=utils_type.A.createFunction(e[0],t,"x, y"),5===e.length||utils_type.A.isString(e[1])||utils_type.A.isFunction(e[1])?s.dfx=utils_type.A.createFunction(e[1],t,"x, y"):s.dfx=null,5===e.length||utils_type.A.isString(e[2])||utils_type.A.isFunction(e[2])?s.dfy=utils_type.A.createFunction(e[2],t,"x, y"):s.dfy=null,s.domain=null,5===e.length?s.domain=[e[3],e[4]]:3===e.length&&(s.domain=[e[1],e[2]]),s.updateDataArray=function(){var t,e,i,s,r,o,n;null===this.domain?(n=this.evalVisProp("margin"),(t=this.board.getBoundingBox())[0]-=n,t[1]+=n,t[2]+=n,t[3]-=n):(e=utils_type.A.evaluate(this.domain[0]),i=utils_type.A.evaluate(this.domain[1]),t=[Math.min(e[0],e[1]),Math.max(i[0],i[1]),Math.max(e[0],e[1]),Math.min(i[0],i[1])]),r={resolution_out:Math.max(.01,this.evalVisProp("resolution_outer")),resolution_in:Math.max(.01,this.evalVisProp("resolution_inner")),max_steps:this.evalVisProp("max_steps"),alpha_0:this.evalVisProp("alpha_0"),tol_u0:this.evalVisProp("tol_u0"),tol_newton:this.evalVisProp("tol_newton"),tol_cusp:this.evalVisProp("tol_cusp"),tol_progress:this.evalVisProp("tol_progress"),qdt_box:this.evalVisProp("qdt_box"),kappa_0:this.evalVisProp("kappa_0"),delta_0:this.evalVisProp("delta_0"),h_initial:this.evalVisProp("h_initial"),h_critical:this.evalVisProp("h_critical"),h_max:this.evalVisProp("h_max"),loop_dist:this.evalVisProp("loop_dist"),loop_dir:this.evalVisProp("loop_dir"),loop_detection:this.evalVisProp("loop_detection"),unitX:this.board.unitX,unitY:this.board.unitY},this.dataX=[],this.dataY=[],s=new implicitplot(t,r,this.f,this.dfx,this.dfy),this.qdt=s.qdt,o=s.plot(),this.dataX=o[0],this.dataY=o[1]},s.elType="implicitcurve",s},jxg.A.registerElement("implicitcurve",jxg.A.createImplicitCurve);var curve=jxg.A.Curve;jxg.A.createArc=function(t,e,i){var s,r,o;if(!1===(o=utils_type.A.providePoints(t,e,i,"arc",["center","radiuspoint","anglepoint"]))||o.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return r=utils_type.A.copyAttributes(i,t.options,"arc"),(s=t.create("curve",[[0],[0],0,4],r)).elType="arc",s.setParents(o),s.type=constants.A.OBJECT_TYPE_ARC,s.center=o[0],s.radiuspoint=o[1],s.point2=s.radiuspoint,s.anglepoint=o[2],s.point3=s.anglepoint,utils_type.A.exists(s.center._is_new)?(s.addChild(s.center),delete s.center._is_new):s.center.addChild(s),utils_type.A.exists(s.radiuspoint._is_new)?(s.addChild(s.radiuspoint),delete s.radiuspoint._is_new):s.radiuspoint.addChild(s),utils_type.A.exists(s.anglepoint._is_new)?(s.addChild(s.anglepoint),delete s.anglepoint._is_new):s.anglepoint.addChild(s),s.useDirection=r.usedirection,s.updateDataArray=function(){var t,e,i,s,r,n=1,a=this.radiuspoint,h=this.center,l=this.anglepoint,c=this.evalVisProp("selection");e=geometry.A.rad(a,h,l),("minor"===c&&e>Math.PI||"major"===c&&e<Math.PI)&&(n=-1),this.useDirection&&(i=o[1].coords.usrCoords,s=o[3].coords.usrCoords,r=o[2].coords.usrCoords,(i[1]-r[1])*(i[2]-s[2])-(i[2]-r[2])*(i[1]-s[1])<0?(this.radiuspoint=o[1],this.anglepoint=o[2]):(this.radiuspoint=o[2],this.anglepoint=o[1])),a=a.coords.usrCoords,h=h.coords.usrCoords,l=l.coords.usrCoords,t=geometry.A.bezierArc(a,h,l,!1,n),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},s.Radius=function(){return this.radiuspoint.Dist(this.center)},s.getRadius=function(){return jxg.A.deprecated("Arc.getRadius()","Arc.Radius()"),this.Radius()},s.Value=function(t,e){var i;return e=e||geometry.A.rad(this.radiuspoint,this.center,this.anglepoint),""===(t=(t=t||"length").toLocaleLowerCase())||0===t.indexOf("len")?i=e*this.Radius():0===t.indexOf("rad")?i=e:0===t.indexOf("deg")?i=180*e/Math.PI:0===t.indexOf("sem")?i=e/Math.PI:0===t.indexOf("cir")&&(i=.5*e/Math.PI),i},s.L=function(){return this.Value("length")},s.hasPoint=function(t,e){var i,s,r,o,n,a,h,l=this.Radius();return this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):(utils_type.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,a=this.evalVisProp("precision."+h)):a=this.board.options.precision.hasPoint,a/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),s=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),this.transformations.length>0&&(this.updateTransformMatrix(),o=math.A.inverse(this.transformMat),n=math.A.matVecMult(o,s.usrCoords),s=new base_coords.A(constants.A.COORDS_BY_USER,n,this.board)),i=this.center.coords.distance(constants.A.COORDS_BY_USER,s),(r=Math.abs(i-l)<a)&&(r=geometry.A.coordsOnArc(this,s)),r)},s.hasPointSector=function(t,e){var i=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),s=this.Radius(),r=this.center.coords.distance(constants.A.COORDS_BY_USER,i)<s;return r&&(r=geometry.A.coordsOnArc(this,i)),r},s.getTextAnchor=function(){return this.center.coords},s.getLabelAnchor=function(){var t,e,i,s,r,o=this.label.evalVisProp("position"),n=geometry.A.rad(this.radiuspoint,this.center,this.anglepoint),a=10/this.board.unitX,h=10/this.board.unitY,l=this.point2.coords.usrCoords,c=this.center.coords.usrCoords,u=l[1]-c[1],d=l[2]-c[2],p=this.evalVisProp("selection"),f=this.label?this.label.visProp:this.visProp.label;return!utils_type.A.isString(o)||o.indexOf("right")<0&&o.indexOf("left")<0?(("minor"===p&&n>Math.PI||"major"===p&&n<Math.PI)&&(n=-(2*Math.PI-n)),i=(t=new base_coords.A(constants.A.COORDS_BY_USER,[c[1]+Math.cos(.5*n)*u-Math.sin(.5*n)*d,c[2]+Math.sin(.5*n)*u+Math.cos(.5*n)*d],this.board)).usrCoords[1]-c[1],s=t.usrCoords[2]-c[2],i=i*((r=math.A.hypot(i,s))+a)/r,s=s*(r+h)/r,e=[c[1]+i,c[2]+s],f.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],e)),new base_coords.A(constants.A.COORDS_BY_USER,e,this.board)):this.getLabelPosition(o,this.label.evalVisProp("distance"))},s.updateQuadraticform=circle.prototype.updateQuadraticform,s.updateStdform=circle.prototype.updateStdform,s.methodMap=jxg.A.deepCopy(s.methodMap,{getRadius:"getRadius",radius:"Radius",Radius:"Radius",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint",Value:"Value",L:"L"}),s.prepareUpdate().update(),s},jxg.A.registerElement("arc",jxg.A.createArc),jxg.A.createSemicircle=function(t,e,i){var s,r,o,n;if(!1===(n=utils_type.A.providePoints(t,e,i,"point"))||2!==n.length)throw new Error("JSXGraph: Can't create Semicircle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point]");return o=utils_type.A.copyAttributes(i,t.options,"semicircle","center"),(r=t.create("midpoint",n,o)).dump=!1,o=utils_type.A.copyAttributes(i,t.options,"semicircle"),(s=t.create("arc",[r,n[1],n[0]],o)).elType="semicircle",s.setParents([n[0].id,n[1].id]),s.subs={midpoint:r},s.inherits.push(r),s.midpoint=s.center=r,s},jxg.A.registerElement("semicircle",jxg.A.createSemicircle),jxg.A.createCircumcircleArc=function(t,e,i){var s,r,o,n;if(!1===(n=utils_type.A.providePoints(t,e,i,"point"))||3!==n.length)throw new Error("JSXGraph: create Circumcircle Arc with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");return o=utils_type.A.copyAttributes(i,t.options,"circumcirclearc","center"),(r=t.create("circumcenter",n,o)).dump=!1,(o=utils_type.A.copyAttributes(i,t.options,"circumcirclearc")).usedirection=!0,(s=t.create("arc",[r,n[0],n[2],n[1]],o)).elType="circumcirclearc",s.setParents([n[0].id,n[1].id,n[2].id]),s.subs={center:r},s.inherits.push(r),s.center=r,s},jxg.A.registerElement("circumcirclearc",jxg.A.createCircumcircleArc),jxg.A.createMinorArc=function(t,e,i){return i.selection="minor",jxg.A.createArc(t,e,i)},jxg.A.registerElement("minorarc",jxg.A.createMinorArc),jxg.A.createMajorArc=function(t,e,i){return i.selection="major",jxg.A.createArc(t,e,i)},jxg.A.registerElement("majorarc",jxg.A.createMajorArc),jxg.A.createSector=function(t,e,i){var s,r,o,n,a,h,l=1e-14,c="invalid";if(e[0].elementClass===constants.A.OBJECT_CLASS_LINE&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE&&(utils_type.A.isArray(e[2])||utils_type.A.isNumber(e[2]))&&(utils_type.A.isArray(e[3])||utils_type.A.isNumber(e[3]))&&(utils_type.A.isNumber(e[4])||utils_type.A.isFunction(e[4])||utils_type.A.isString(e[4])))c="2lines";else{if(!1===(h=utils_type.A.providePoints(t,e,i,"sector",["center","radiusPoint","anglePoint"])))throw new Error("JSXGraph: Can't create Sector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");c="3points"}if(r=utils_type.A.copyAttributes(i,t.options,"sector"),(s=t.create("curve",[[0],[0],0,6],r)).type=constants.A.OBJECT_TYPE_SECTOR,s.elType="sector",s.autoRadius=function(){var t=20/s.board.unitX,e=1/0,i=50/s.board.unitX;return utils_type.A.isPoint(s.center)&&(e=.3333*s.center.Dist(s.point2)),Math.max(t,Math.min(e,i))},"2lines"===c)s.Radius=function(){var t=utils_type.A.evaluate(e[4]);return"auto"===t?this.autoRadius():t},s.line1=t.select(e[0]),s.line2=t.select(e[1]),s.line1.addChild(s),s.line2.addChild(s),s.setParents(e),s.point1={visProp:{}},s.point2={visProp:{}},s.point3={visProp:{}},n=geometry.A.meetLineLine(s.line1.stdform,s.line2.stdform,0,t),geometry.A.distance(n.usrCoords,[0,0,0],3)<l&&(s.line1.point1.Dist(s.line2.point1)<l||s.line1.point1.Dist(s.line2.point2)<l?n=s.line1.point1.coords:s.line1.point2.Dist(s.line2.point1)<l||s.line1.point2.Dist(s.line2.point1)<l?n=s.line1.point2.coords:console.log("JSXGraph warning: Can't create Sector from parallel lines with no common defining point.")),utils_type.A.isArray(e[2])?(2===e[2].length&&(e[2]=[1].concat(e[2])),a=geometry.A.projectPointToLine({coords:{usrCoords:e[2]}},s.line1,t),a=statistics.A.subtract(a.usrCoords,n.usrCoords),s.direction1=math.A.innerProduct(a,[0,s.line1.stdform[2],-s.line1.stdform[1]],3)>=0?1:-1):s.direction1=e[2]>=0?1:-1,utils_type.A.isArray(e[3])?(2===e[3].length&&(e[3]=[1].concat(e[3])),a=geometry.A.projectPointToLine({coords:{usrCoords:e[3]}},s.line2,t),a=statistics.A.subtract(a.usrCoords,n.usrCoords),s.direction2=math.A.innerProduct(a,[0,s.line2.stdform[2],-s.line2.stdform[1]],3)>=0?1:-1):s.direction2=e[3]>=0?1:-1,s.methodMap=jxg.A.deepCopy(s.methodMap,{arc:"arc",center:"center",line1:"line1",line2:"line2"}),s.updateDataArray=function(){var t,e,i,r,o,n,a=1e-14,h=[0,0,0];if(e=this.line1,i=this.line2,h=math.A.crossProduct(e.stdform,i.stdform),geometry.A.distance(h,[0,0,0],3)<a&&(e.point1.Dist(i.point1)<a||e.point1.Dist(i.point2)<a?h=e.point1.coords.usrCoords:(e.point2.Dist(i.point1)<a||e.point2.Dist(i.point1)<a)&&(h=e.point2.coords.usrCoords)),Math.abs(h[0])>a&&(h[1]/=h[0],h[2]/=h[0],h[0]/=h[0]),t=this.direction1*this.Radius(),r=statistics.A.add(h,[0,t*e.stdform[2],-t*e.stdform[1]]),t=this.direction2*this.Radius(),o=statistics.A.add(h,[0,t*i.stdform[2],-t*i.stdform[1]]),this.point2.coords=new base_coords.A(constants.A.COORDS_BY_USER,r,s.board),this.point1.coords=new base_coords.A(constants.A.COORDS_BY_USER,h,s.board),this.point3.coords=new base_coords.A(constants.A.COORDS_BY_USER,o,s.board),Math.abs(r[0])<math.A.eps||Math.abs(h[0])<math.A.eps||Math.abs(o[0])<math.A.eps)return this.dataX=[NaN],void(this.dataY=[NaN]);n=geometry.A.bezierArc(r,h,o,!0,1),this.dataX=n[0],this.dataY=n[1],this.bezierDegree=3};else if("3points"===c){for(s.point1=h[0],s.point2=h[1],s.point3=h[2],o=0;o<3;o++)utils_type.A.exists(h[o]._is_new)?(s.addChild(h[o]),delete h[o]._is_new):h[o].addChild(s);s.useDirection=i.usedirection,s.setParents(h),utils_type.A.exists(h[3])&&(s.point4=h[3],s.point4.addChild(s)),s.methodMap=jxg.A.deepCopy(s.methodMap,{arc:"arc",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint"}),s.updateDataArray=function(){var t,e,i,s,r,o=this.point2,n=this.point1,a=this.point3,h=1,l=this.evalVisProp("selection");if(!o.isReal||!n.isReal||!a.isReal)return this.dataX=[NaN],void(this.dataY=[NaN]);r=geometry.A.rad(o,n,a),("minor"===l&&r>Math.PI||"major"===l&&r<Math.PI)&&(h=-1),this.useDirection&&utils_type.A.exists(this.point4)&&(e=this.point2.coords.usrCoords,i=this.point4.coords.usrCoords,s=this.point3.coords.usrCoords,(e[1]-s[1])*(e[2]-i[2])-(e[2]-s[2])*(e[1]-i[1])>=0&&(a=this.point2,o=this.point3)),o=o.coords.usrCoords,n=n.coords.usrCoords,a=a.coords.usrCoords,t=geometry.A.bezierArc(o,n,a,!0,h),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},s.Radius=function(){return this.point2.Dist(this.point1)}}return s.center=s.point1,s.radiuspoint=s.point2,s.anglepoint=s.point3,r=utils_type.A.copyAttributes(i,t.options,"arc"),(r=utils_type.A.copyAttributes(r,t.options,"sector","arc")).withlabel=!1,r.selection=s.visProp.selection,r.name+="_arc","2lines"===c?(s.updateDataArray(),s.arc=t.create("arc",[function(){return s.point1.coords.usrCoords},function(){var t=s.point2.coords.distance(constants.A.COORDS_BY_USER,s.point1.coords);return 0===t?[s.point1.coords.usrCoords[1],s.point1.coords.usrCoords[2]]:[s.point1.coords.usrCoords[1]+s.Radius()*(s.point2.coords.usrCoords[1]-s.point1.coords.usrCoords[1])/t,s.point1.coords.usrCoords[2]+s.Radius()*(s.point2.coords.usrCoords[2]-s.point1.coords.usrCoords[2])/t]},function(){return s.point3.coords.usrCoords}],r)):s.arc=t.create("arc",[s.point1,function(){var t=s.point2.Dist(s.point1);return 0===t?[s.point1.X(),s.point1.Y()]:[s.point1.X()+s.Radius()*(s.point2.X()-s.point1.X())/t,s.point1.Y()+s.Radius()*(s.point2.Y()-s.point1.Y())/t]},s.point3],r),s.addChild(s.arc),s.hasPointCurve=function(t,e){var i,s,r,o,n,a,h=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),l=this.Radius(),c=this.center.coords.distance(constants.A.COORDS_BY_USER,h),u=this.evalVisProp("selection");return utils_type.A.isObject(this.evalVisProp("precision"))?(n=this.board._inputDevice,o=this.evalVisProp("precision."+n)):o=this.board.options.precision.hasPoint,o/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(a=Math.abs(c-l)<o)&&(i=geometry.A.rad(this.point2,this.center,h.usrCoords.slice(1)),s=0,r=geometry.A.rad(this.point2,this.center,this.point3),("minor"===u&&r>Math.PI||"major"===u&&r<Math.PI)&&(s=r,r=2*Math.PI),(i<s||i>r)&&(a=!1)),a},s.hasPointSector=function(t,e){var i,s,r,o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),n=this.Radius(),a=this.point1.coords.distance(constants.A.COORDS_BY_USER,o)<n,h=this.evalVisProp("selection");return a&&(i=geometry.A.rad(this.radiuspoint,this.center,o.usrCoords.slice(1)),s=0,r=geometry.A.rad(this.radiuspoint,this.center,this.anglepoint),("minor"===h&&r>Math.PI||"major"===h&&r<Math.PI)&&(s=r,r=2*Math.PI),(i<s||i>r)&&(a=!1)),a},s.hasPoint=function(t,e){return this.evalVisProp("highlightonsector")||this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):this.hasPointCurve(t,e)},s.getTextAnchor=function(){return this.point1.coords},s.getLabelAnchor=function(){var t,e,i,s,r,o=this.label.evalVisProp("position"),n=geometry.A.rad(this.point2,this.point1,this.point3),a=13/this.board.unitX,h=13/this.board.unitY,l=this.point2.coords.usrCoords,c=this.point1.coords.usrCoords,u=l[1]-c[1],d=l[2]-c[2],p=this.evalVisProp("selection"),f=this.label?this.label.visProp:this.visProp.label;return!utils_type.A.isString(o)||o.indexOf("right")<0&&o.indexOf("left")<0?(("minor"===p&&n>Math.PI||"major"===p&&n<Math.PI)&&(n=-(2*Math.PI-n)),i=(t=new base_coords.A(constants.A.COORDS_BY_USER,[c[1]+Math.cos(.5*n)*u-Math.sin(.5*n)*d,c[2]+Math.sin(.5*n)*u+Math.cos(.5*n)*d],this.board)).usrCoords[1]-c[1],s=t.usrCoords[2]-c[2],i=i*((r=math.A.hypot(i,s))+a)/r,s=s*(r+h)/r,e=[c[1]+i,c[2]+s],f.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],e)),new base_coords.A(constants.A.COORDS_BY_USER,e,this.board)):this.getLabelPosition(o,this.label.evalVisProp("distance"))},s.setRadius=function(t){var e=utils_type.A.evaluate(t);"undefined"!==("auto"===t||"auto"===e?"auto":utils_type.A.isNumber(t)?"number":utils_type.A.isFunction(t)&&!utils_type.A.isString(e)?"function":"undefined")&&(this.visProp.radius=t),s.Radius=function(){var e=utils_type.A.evaluate(t);return"auto"===e?this.autoRadius():e}},s.getRadius=function(){return jxg.A.deprecated("Sector.getRadius()","Sector.Radius()"),this.Radius()},s.Value=function(t){return this.arc.Value(t)},s.L=function(){return this.arc.L()},s.Area=function(){var t=this.Radius();return.5*t*t*this.Value("radians")},s.Perimeter=function(){return this.L()+2*this.Radius()},"3points"===c&&(s.setPositionDirectly=function(t,e,i){var r,o=new base_coords.A(t,e,this.board),n=new base_coords.A(t,i,this.board);return s.point1.draggable()&&s.point2.draggable()&&s.point3.draggable()?(r=statistics.A.subtract(o.usrCoords,n.usrCoords),this.board.create("transform",r.slice(1),{type:"translate"}).applyOnce([s.point1,s.point2,s.point3]),this):this}),s.methodMap=jxg.A.deepCopy(s.methodMap,{radius:"Radius",Radius:"Radius",getRadius:"Radius",setRadius:"setRadius",Value:"Value",L:"L",Area:"Area",Perimeter:"Perimeter"}),s},jxg.A.registerElement("sector",jxg.A.createSector),jxg.A.createCircumcircleSector=function(t,e,i){var s,r,o,n;if(!1===(n=utils_type.A.providePoints(t,e,i,"point")))throw new Error("JSXGraph: Can't create circumcircle sector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");return(r=t.create("circumcenter",n.slice(0,3),o)).dump=!1,o=utils_type.A.copyAttributes(i,t.options,"circumcirclesector"),(s=t.create("sector",[r,n[0],n[2],n[1]],o)).elType="circumcirclesector",s.setParents(n),s.center=r,s.subs={center:r},s},jxg.A.registerElement("circumcirclesector",jxg.A.createCircumcircleSector),jxg.A.createMinorSector=function(t,e,i){return i.selection="minor",jxg.A.createSector(t,e,i)},jxg.A.registerElement("minorsector",jxg.A.createMinorSector),jxg.A.createMajorSector=function(t,e,i){return i.selection="major",jxg.A.createSector(t,e,i)},jxg.A.registerElement("majorsector",jxg.A.createMajorSector),jxg.A.createAngle=function(t,e,i){var s,r,o,n,a,h,l="invalid";if(e[0].elementClass===constants.A.OBJECT_CLASS_LINE&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE&&(utils_type.A.isArray(e[2])||utils_type.A.isNumber(e[2]))&&(utils_type.A.isArray(e[3])||utils_type.A.isNumber(e[3])))l="2lines";else{if(o={name:""},!1===(h=utils_type.A.providePoints(t,e,o,"point")))throw new Error("JSXGraph: Can't create angle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");l="3points"}if(o=utils_type.A.copyAttributes(i,t.options,"angle"),utils_type.A.exists(o.name)||(o.name=t.generateName({type:constants.A.OBJECT_TYPE_ANGLE})),r=utils_type.A.exists(o.radius)?o.radius:0,t.suspendUpdate(),"2lines"===l?(e.push(r),(s=t.create("sector",e,o)).updateDataArraySector=s.updateDataArray,s.setAngle=function(t){},s.free=function(t){}):((s=t.create("sector",[h[1],h[0],h[2]],o)).arc.visProp.priv=!0,s.point=s.point2=s.radiuspoint=h[0],s.pointsquare=s.point3=s.anglepoint=h[2],s.Radius=function(){var t=utils_type.A.evaluate(r);return"auto"===t?s.autoRadius():t},s.updateDataArraySector=function(){var t,e,i=this.point2,s=this.point1,r=this.point3,o=this.Radius(),n=s.Dist(i),a=1,h=this.evalVisProp("selection");e=geometry.A.rad(i,s,r),("minor"===h&&e>Math.PI||"major"===h&&e<Math.PI)&&(a=-1),i=i.coords.usrCoords,s=s.coords.usrCoords,r=r.coords.usrCoords,i=[1,s[1]+(i[1]-s[1])*o/n,s[2]+(i[2]-s[2])*o/n],r=[1,s[1]+(r[1]-s[1])*o/n,s[2]+(r[2]-s[2])*o/n],t=geometry.A.bezierArc(i,s,r,!0,a),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},s.setAngle=function(t){var e,i,s,r=this.anglepoint,o=this.radiuspoint;return r.draggable()&&(e=this.board.create("transform",[t,this.center],{type:"rotate"}),r.addTransform(o,e),e.update(),r.moveTo(math.A.matVecMult(e.matrix,o.coords.usrCoords)),s=utils_type.A.isFunction(t)?function(){return 2*Math.PI-t()}:function(){return 2*Math.PI-t},i=this.board.create("transform",[s,this.center],{type:"rotate"}),r.coords.on("update",function(){i.update(),o.setPositionDirectly(constants.A.COORDS_BY_USER,math.A.matVecMult(i.matrix,r.coords.usrCoords))}),r.setParents(o),this.hasFixedAngle=!0),this},s.free=function(){var t=this.anglepoint;return t.transformations.length>0&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[],t.coords.off("update")),this.hasFixedAngle=!1,this},s.setParents(h)),utils_type.A.exists(s.visProp.text)&&s.label.setText(s.evalVisProp("text")),s.elType="angle",s.type=constants.A.OBJECT_TYPE_ANGLE,s.subs={},s.updateDataArraySquare=function(){var t,e,i,s,r,o,n,a,h=this.Radius();"2lines"===l&&this.updateDataArraySector(),t=this.point2,e=this.point1,i=this.point3,t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,s=geometry.A.distance(t,e,3),r=geometry.A.distance(i,e,3),t=[1,e[1]+(t[1]-e[1])*h/s,e[2]+(t[2]-e[2])*h/s],i=[1,e[1]+(i[1]-e[1])*h/r,e[2]+(i[2]-e[2])*h/r],o=math.A.crossProduct(i,e),n=[-t[1]*o[1]-t[2]*o[2],t[0]*o[1],t[0]*o[2]],o=math.A.crossProduct(t,e),a=[-i[1]*o[1]-i[2]*o[2],i[0]*o[1],i[0]*o[2]],(o=math.A.crossProduct(n,a))[1]/=o[0],o[2]/=o[0],this.dataX=[e[1],t[1],o[1],i[1],e[1]],this.dataY=[e[2],t[2],o[2],i[2],e[2]],this.bezierDegree=1},s.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},s.updateDataArray=function(){var t=this.evalVisProp("type"),e=geometry.A.trueAngle(this.point2,this.point1,this.point3),i=this.evalVisProp("selection");("minor"===i&&e>180||"major"===i&&e<180)&&(e=360-e),Math.abs(e-90)<this.evalVisProp("orthosensitivity")+math.A.eps&&(t=this.evalVisProp("orthotype")),"none"===t?(this.updateDataArrayNone(),this.maxX=function(){return 0}):"square"===t?(this.updateDataArraySquare(),this.maxX=function(){return 4}):"sector"===t?(this.updateDataArraySector(),this.maxX=function(){return 6}):"sectordot"===t&&(this.updateDataArraySector(),this.maxX=function(){return 6},this.dot.visProp.visible||this.dot.setAttribute({visible:!0})),(!this.visProp.visible||"sectordot"!==t&&this.dot.visProp.visible)&&this.dot.setAttribute({visible:!1})},n=utils_type.A.copyAttributes(i,t.options,"angle","dot"),s.dot=t.create("point",[function(){var t,e,i,r,o,n,a,h,l;return utils_type.A.exists(s.dot)&&!s.dot.visProp.visible?[0,0]:(t=s.point2.coords.usrCoords,e=s.point1.coords.usrCoords,i=s.Radius(),r=geometry.A.distance(t,e,3),o=geometry.A.rad(s.point2,s.point1,s.point3),("minor"===(l=s.evalVisProp("selection"))&&o>Math.PI||"major"===l&&o<Math.PI)&&(o=-(2*Math.PI-o)),o*=.5,n=Math.cos(o),a=Math.sin(o),t=[1,e[1]+(t[1]-e[1])*i/r,e[2]+(t[2]-e[2])*i/r],h=[[1,0,0],[e[1]-.5*e[1]*n+.5*e[2]*a,.5*n,.5*-a],[e[2]-.5*e[1]*a-.5*e[2]*n,.5*a,.5*n]],math.A.matVecMult(h,t))}],n),s.dot.dump=!1,s.subs.dot=s.dot,"2lines"===l)for(a=0;a<2;a++)t.select(e[a]).addChild(s.dot);else for(a=0;a<3;a++)t.select(h[a]).addChild(s.dot);return t.unsuspendUpdate(),s.Value=function(t){return""===(t=t||"radians")&&(t="radians"),s.arc.Value(t)},s.getLabelAnchor=function(){var t,e,i,r,o,n,a,h,l,c=12,u=s.evalVisProp("selection"),d=this.label?this.label.visProp:this.visProp.label,p=this.label?this.label.evalVisProp("position"):this.evalVisProp("label.position");return!utils_type.A.isString(p)||p.indexOf("right")<0&&p.indexOf("left")<0?(utils_type.A.exists(this.label)&&utils_type.A.exists(this.label.visProp.fontsize)&&(c=this.label.evalVisProp("fontsize")),c/=this.board.unitX,e=s.point2.coords.usrCoords,i=s.point1.coords.usrCoords,r=s.Radius(),o=geometry.A.distance(e,i,3),n=geometry.A.rad(s.point2,s.point1,s.point3),("minor"===u&&n>Math.PI||"major"===u&&n<Math.PI)&&(n=-(2*Math.PI-n)),n*=.5,a=Math.cos(n),h=Math.sin(n),e=[1,i[1]+(e[1]-i[1])*r/o,i[2]+(e[2]-i[2])*r/o],l=[[1,0,0],[i[1]-.5*i[1]*a+.5*i[2]*h,.5*a,.5*-h],[i[2]-.5*i[1]*h-.5*i[2]*a,.5*h,.5*a]],(t=math.A.matVecMult(l,e))[1]/=t[0],t[2]/=t[0],t[0]/=t[0],o=geometry.A.distance(t,i,3),t=[t[0],i[1]+(t[1]-i[1])*(r+c)/o,i[2]+(t[2]-i[2])*(r+c)/o],d.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],t)),new base_coords.A(constants.A.COORDS_BY_USER,t,this.board)):this.getLabelPosition(p,this.label.evalVisProp("distance"))},s.methodMap=utils_type.A.deepCopy(s.methodMap,{setAngle:"setAngle",Value:"Value",free:"free"}),s},jxg.A.registerElement("angle",jxg.A.createAngle),jxg.A.createNonreflexAngle=function(t,e,i){var s;return i.selection="minor",i=utils_type.A.copyAttributes(i,t.options,"nonreflexangle"),(s=jxg.A.createAngle(t,e,i)).Value=function(t){var e=geometry.A.rad(this.point2,this.point1,this.point3);return""===(t=t||"radians")&&(t="radians"),e=e<Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},s},jxg.A.registerElement("nonreflexangle",jxg.A.createNonreflexAngle),jxg.A.createReflexAngle=function(t,e,i){var s;return i.selection="major",i=utils_type.A.copyAttributes(i,t.options,"reflexangle"),(s=jxg.A.createAngle(t,e,i)).Value=function(t){var e=geometry.A.rad(this.point2,this.point1,this.point3);return""===(t=t||"radians")&&(t="radians"),e=e>=Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},s},jxg.A.registerElement("reflexangle",jxg.A.createReflexAngle),jxg.A.createOrthogonalProjection=function(t,e,i){var s,r,o,n;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)r=utils_type.A.providePoints(t,[e[0]],i,"point")[0],s=e[1];else{if(!utils_type.A.isPointType(t,e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");r=utils_type.A.providePoints(t,[e[1]],i,"point")[0],s=e[0]}return n=utils_type.A.copyAttributes(i,t.options,"orthogonalprojection"),o=t.create("point",[function(){return geometry.A.projectPointToLine(r,s,t)}],n),utils_type.A.exists(r._is_new)?(o.addChild(r),delete r._is_new):r.addChild(o),s.addChild(o),o.elType="orthogonalprojection",o.setParents([r.id,o.id]),o.update(),o.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,n=s.point2.symbolic.y,a=r.symbolic.x,h=r.symbolic.y,l=o.symbolic.x,c=o.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+n+")-("+l+")*("+n+")","("+h+")*("+e+")-("+h+")*("+n+")-("+c+")*("+e+")+("+c+")*("+n+")+("+a+")*("+t+")-("+a+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},o},jxg.A.createPerpendicular=function(t,e,i){var s,r,o,n;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)r=e[1],s=utils_type.A.providePoints(t,[e[0]],i,"point")[0];else{if(!utils_type.A.isPointType(t,e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");r=e[0],s=utils_type.A.providePoints(t,[e[1]],i,"point")[0]}return n=utils_type.A.copyAttributes(i,t.options,"perpendicular"),(o=jxg.A.createLine(t,[function(){return r.stdform[2]*s.X()-r.stdform[1]*s.Y()},function(){return-r.stdform[2]*s.Z()},function(){return r.stdform[1]*s.Z()}],n)).elType="perpendicular",o.setParents([r.id,s.id]),utils_type.A.exists(s._is_new)?(o.addChild(s),delete s._is_new):s.addChild(o),r.addChild(o),o},jxg.A.createPerpendicularPoint=function(t,e,i){var s,r,o;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)r=utils_type.A.providePoints(t,[e[0]],i,"point")[0],s=e[1];else{if(!utils_type.A.isPointType(t,e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");r=utils_type.A.providePoints(t,[e[1]],i,"point")[0],s=e[0]}return o=t.create("point",[function(){return geometry.A.perpendicular(s,r,t)[0]}],i),utils_type.A.exists(r._is_new)?(o.addChild(r),delete r._is_new):r.addChild(o),s.addChild(o),o.elType="perpendicularpoint",o.setParents([r.id,s.id]),o.update(),o.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,n=s.point2.symbolic.y,a=r.symbolic.x,h=r.symbolic.y,l=o.symbolic.x,c=o.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+n+")-("+l+")*("+n+")","("+h+")*("+e+")-("+h+")*("+n+")-("+c+")*("+e+")+("+c+")*("+n+")+("+a+")*("+t+")-("+a+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},o},jxg.A.createPerpendicularSegment=function(t,e,i){var s,r,o,n,a;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)r=e[1],s=utils_type.A.providePoints(t,[e[0]],i,"point")[0];else{if(!utils_type.A.isPointType(t,e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");r=e[0],s=utils_type.A.providePoints(t,[e[1]],i,"point")[0]}return a=utils_type.A.copyAttributes(i,t.options,"perpendicularsegment","point"),(n=jxg.A.createPerpendicularPoint(t,[r,s],a)).dump=!1,utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),a=utils_type.A.copyAttributes(i,t.options,"perpendicularsegment"),(o=jxg.A.createLine(t,[function(){return geometry.A.perpendicular(r,s,t)[1]?[n,s]:[s,n]}],a)).point=n,utils_type.A.exists(s._is_new)?(o.addChild(s),delete s._is_new):s.addChild(o),r.addChild(o),o.elType="perpendicularsegment",o.setParents([s.id,r.id]),o.subs={point:n},o.inherits.push(n),o},jxg.A.createMidpoint=function(t,e,i){var s,r,o,n,a;for(n=0;n<e.length;++n)e[n]=t.select(e[n]);if(2===e.length&&utils_type.A.isPointType(t,e[0])&&utils_type.A.isPointType(t,e[1]))e=utils_type.A.providePoints(t,e,i,"point"),s=e[0],r=e[1];else{if(1!==e.length||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create midpoint.\nPossible parent types: [point,point], [line]");s=e[0].point1,r=e[0].point2}return a=utils_type.A.copyAttributes(i,t.options,"midpoint"),o=t.create("point",[function(){var t=s.coords.usrCoords[1]+r.coords.usrCoords[1];return isNaN(t)||Math.abs(s.coords.usrCoords[0])<math.A.eps||Math.abs(r.coords.usrCoords[0])<math.A.eps?NaN:.5*t},function(){var t=s.coords.usrCoords[2]+r.coords.usrCoords[2];return isNaN(t)||Math.abs(s.coords.usrCoords[0])<math.A.eps||Math.abs(r.coords.usrCoords[0])<math.A.eps?NaN:.5*t}],a),utils_type.A.exists(s._is_new)?(o.addChild(s),delete s._is_new):s.addChild(o),utils_type.A.exists(r._is_new)?(o.addChild(r),delete r._is_new):r.addChild(o),o.elType="midpoint",o.setParents([s.id,r.id]),o.prepareUpdate().update(),o.generatePolynomial=function(){var t=s.symbolic.x,e=s.symbolic.y,i=r.symbolic.x,n=r.symbolic.y,a=o.symbolic.x,h=o.symbolic.y;return["("+e+")*("+a+")-("+e+")*("+i+")+("+h+")*("+i+")-("+t+")*("+h+")+("+t+")*("+n+")-("+a+")*("+n+")","("+t+")^2 - 2*("+t+")*("+a+")+("+e+")^2-2*("+e+")*("+h+")-("+i+")^2+2*("+i+")*("+a+")-("+n+")^2+2*("+n+")*("+h+")"]},o},jxg.A.createParallelPoint=function(t,e,i){var s,r,o,n,a,h;for(a=0;a<e.length;++a)e[a]=t.select(e[a]);if(3===e.length&&utils_type.A.isPointType(t,e[0])&&utils_type.A.isPointType(t,e[1])&&utils_type.A.isPointType(t,e[2]))e=utils_type.A.providePoints(t,e,i,"point"),s=e[0],r=e[1],o=e[2];else if(utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)o=utils_type.A.providePoints(t,[e[0]],i,"point")[0],s=e[1].point1,r=e[1].point2;else{if(!utils_type.A.isPointType(t,e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create parallel point with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [line,point], [point,point,point]");o=utils_type.A.providePoints(t,[e[1]],i,"point")[0],s=e[0].point1,r=e[0].point2}return h=utils_type.A.copyAttributes(i,t.options,"parallelpoint"),n=t.create("point",[function(){return o.coords.usrCoords[1]+r.coords.usrCoords[1]-s.coords.usrCoords[1]},function(){return o.coords.usrCoords[2]+r.coords.usrCoords[2]-s.coords.usrCoords[2]}],h),utils_type.A.exists(s._is_new)?(n.addChild(s),delete s._is_new):s.addChild(n),utils_type.A.exists(r._is_new)?(n.addChild(r),delete r._is_new):r.addChild(n),utils_type.A.exists(o._is_new)?(n.addChild(o),delete o._is_new):o.addChild(n),n.elType="parallelpoint",n.setParents([s.id,r.id,o.id]),n.prepareUpdate().update(),n.generatePolynomial=function(){var t=s.symbolic.x,e=s.symbolic.y,i=r.symbolic.x,a=r.symbolic.y,h=o.symbolic.x,l=o.symbolic.y,c=n.symbolic.x,u=n.symbolic.y;return["("+a+")*("+c+")-("+a+")*("+h+")-("+e+")*("+c+")+("+e+")*("+h+")-("+u+")*("+i+")+("+u+")*("+t+")+("+l+")*("+i+")-("+l+")*("+t+")","("+u+")*("+t+")-("+u+")*("+h+")-("+a+")*("+t+")+("+a+")*("+h+")-("+c+")*("+e+")+("+c+")*("+l+")+("+i+")*("+e+")-("+i+")*("+l+")"]},n},jxg.A.createParallel=function(t,e,i){var s,r,o,n,a,h,l=1;for(a=0;a<e.length;++a)e[a]=t.select(e[a]);return s=null,3===e.length?(s=(e=utils_type.A.providePoints(t,e,i,"point"))[2],l=0):utils_type.A.isPointType(t,e[0])?(s=utils_type.A.providePoints(t,[e[0]],i,"point")[0],n=function(){return e[1].stdform}):utils_type.A.isPointType(t,e[1])&&(s=utils_type.A.providePoints(t,[e[1]],i,"point")[0],n=function(){return e[0].stdform}),utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),h=utils_type.A.copyAttributes(i,t.options,"parallel","point"),(r=1===l?t.create("point",[function(){return math.A.crossProduct([1,0,0],n())}],h):t.create("parallelpoint",e,h)).isDraggable=!0,h=utils_type.A.copyAttributes(i,t.options,"parallel"),(o=t.create("line",[s,r],h)).elType="parallel",o.subs={point:r},o.inherits.push(r),o.setParents([e[0].id,e[1].id]),3===e.length&&o.addParents(e[2].id),o.point=r,o},jxg.A.createArrowParallel=function(t,e,i){var s,r;try{return!1===(r=utils_type.A.copyAttributes(i,t.options,"arrowparallel")).lastArrow&&(r.lastArrow=!0),(s=jxg.A.createParallel(t,e,r).setAttribute({straightFirst:!1,straightLast:!1})).type=constants.A.OBJECT_TYPE_VECTOR,s.elType="arrowparallel",s}catch(t){throw new Error("JSXGraph: Can't create arrowparallel with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point], [point,point,point]")}},jxg.A.createBisector=function(t,e,i){var s,r,o,n;if(e=utils_type.A.providePoints(t,e,i,"point"),utils_type.A.isPoint(e[0])&&utils_type.A.isPoint(e[1])&&utils_type.A.isPoint(e[2])){for((n=utils_type.A.copyAttributes(i,t.options,"bisector","point")).snapToGrid=!1,(s=t.create("point",[function(){return geometry.A.angleBisector(e[0],e[1],e[2],t)}],n)).dump=!1,o=0;o<3;o++)utils_type.A.exists(e[o]._is_new)?(s.addChild(e[o]),delete e[o]._is_new):e[o].addChild(s);return utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),n=utils_type.A.copyAttributes(i,t.options,"bisector"),(r=jxg.A.createLine(t,[e[1],s],n)).point=s,r.elType="bisector",r.setParents(e),r.subs={point:s},r.inherits.push(s),r}throw new Error("JSXGraph: Can't create angle bisector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point]")},jxg.A.createAngularBisectorsOfTwoLines=function(t,e,i){var s,r,o,n,a=t.select(e[0]),h=t.select(e[1]);if(a.elementClass!==constants.A.OBJECT_CLASS_LINE||h.elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create angle bisectors of two lines with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,line]");return utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),o=utils_type.A.copyAttributes(i,t.options,"bisectorlines","line1"),s=t.create("line",[function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[0]/t-h.stdform[0]/e},function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[1]/t-h.stdform[1]/e},function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[2]/t-h.stdform[2]/e}],o),utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),o=utils_type.A.copyAttributes(i,t.options,"bisectorlines","line2"),r=t.create("line",[function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[0]/t+h.stdform[0]/e},function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[1]/t+h.stdform[1]/e},function(){var t=math.A.hypot(a.stdform[1],a.stdform[2]),e=math.A.hypot(h.stdform[1],h.stdform[2]);return a.stdform[2]/t+h.stdform[2]/e}],o),n=new composition({line1:s,line2:r}),s.dump=!1,r.dump=!1,n.elType="bisectorlines",n.setParents([a.id,h.id]),n.subs={line1:s,line2:r},n},jxg.A.createCircumcenter=function(t,e,i){var s,r,o,n,a;if(e=utils_type.A.providePoints(t,e,i,"point"),utils_type.A.isPoint(e[0])&&utils_type.A.isPoint(e[1])&&utils_type.A.isPoint(e[2])){for(o=e[0],n=e[1],a=e[2],s=jxg.A.createPoint(t,[function(){return geometry.A.circumcenter(o,n,a,t)}],i),r=0;r<3;r++)utils_type.A.exists(e[r]._is_new)?(s.addChild(e[r]),delete e[r]._is_new):e[r].addChild(s);return s.elType="circumcenter",s.setParents(e),s.generatePolynomial=function(){var t=o.symbolic.x,e=o.symbolic.y,i=n.symbolic.x,r=n.symbolic.y,h=a.symbolic.x,l=a.symbolic.y,c=s.symbolic.x,u=s.symbolic.y;return[["((",c,")-(",t,"))^2+((",u,")-(",e,"))^2-((",c,")-(",i,"))^2-((",u,")-(",r,"))^2"].join(""),["((",c,")-(",t,"))^2+((",u,")-(",e,"))^2-((",c,")-(",h,"))^2-((",u,")-(",l,"))^2"].join("")]},s}throw new Error("JSXGraph: Can't create circumcircle midpoint with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")},jxg.A.createIncenter=function(t,e,i){var s,r,o,n,a;if(!((e=utils_type.A.providePoints(t,e,i,"point")).length>=3&&utils_type.A.isPoint(e[0])&&utils_type.A.isPoint(e[1])&&utils_type.A.isPoint(e[2])))throw new Error("JSXGraph: Can't create incenter with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");for(r=e[0],o=e[1],n=e[2],s=t.create("point",[function(){var e,i,s;return e=math.A.hypot(o.X()-n.X(),o.Y()-n.Y()),i=math.A.hypot(r.X()-n.X(),r.Y()-n.Y()),s=math.A.hypot(o.X()-r.X(),o.Y()-r.Y()),new base_coords.A(constants.A.COORDS_BY_USER,[(e*r.X()+i*o.X()+s*n.X())/(e+i+s),(e*r.Y()+i*o.Y()+s*n.Y())/(e+i+s)],t)}],i),a=0;a<3;a++)utils_type.A.exists(e[a]._is_new)?(s.addChild(e[a]),delete e[a]._is_new):e[a].addChild(s);return s.elType="incenter",s.setParents(e),s},jxg.A.createCircumcircle=function(t,e,i){var s,r,o,n;if(!1===(e=utils_type.A.providePoints(t,e,i,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");try{for(o=utils_type.A.copyAttributes(i,t.options,"circumcircle","center"),(s=jxg.A.createCircumcenter(t,e,o)).dump=!1,utils_type.A.exists(i.layer)||(i.layer=t.options.layer.circle),o=utils_type.A.copyAttributes(i,t.options,"circumcircle"),(r=jxg.A.createCircle(t,[s,e[0]],o)).elType="circumcircle",r.setParents(e),r.subs={center:s},r.inherits.push(r),n=0;n<3;n++)utils_type.A.exists(e[n]._is_new)?(r.addChild(e[n]),delete e[n]._is_new):e[n].addChild(r)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")}return r},jxg.A.createIncircle=function(t,e,i){var s,r,o,n;if(!1===(e=utils_type.A.providePoints(t,e,i,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");try{for(n=utils_type.A.copyAttributes(i,t.options,"incircle","center"),(r=jxg.A.createIncenter(t,e,n)).dump=!1,utils_type.A.exists(i.layer)||(i.layer=t.options.layer.circle),n=utils_type.A.copyAttributes(i,t.options,"incircle"),(o=jxg.A.createCircle(t,[r,function(){var t=math.A.hypot(e[1].X()-e[2].X(),e[1].Y()-e[2].Y()),i=math.A.hypot(e[0].X()-e[2].X(),e[0].Y()-e[2].Y()),s=math.A.hypot(e[1].X()-e[0].X(),e[1].Y()-e[0].Y()),r=(t+i+s)/2;return Math.sqrt((r-t)*(r-i)*(r-s)/r)}],n)).elType="incircle",o.setParents(e),s=0;s<3;s++)utils_type.A.exists(e[s]._is_new)?(o.addChild(e[s]),delete e[s]._is_new):e[s].addChild(o);o.center=r,o.subs={center:o.center},o.inherits.push(r)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")}return o},jxg.A.createReflection=function(t,e,i){var s,r,o,n,a,h,l,c,u="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(h=0;h<e.length;++h)e[h]=t.select(e[h]);if(l=utils_type.A.copyAttributes(i,t.options,"reflection"),utils_type.A.isPoint(e[0]))r=utils_type.A.providePoints(t,[e[0]],c)[0];else{if(e[0].elementClass!==constants.A.OBJECT_CLASS_CURVE&&e[0].elementClass!==constants.A.OBJECT_CLASS_LINE&&e[0].type!==constants.A.OBJECT_TYPE_POLYGON&&e[0].elementClass!==constants.A.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create reflection element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);r=e[0]}if(e[1].elementClass!==constants.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);if(s=e[1],a=jxg.A.createTransform(t,[s],{type:"reflect"}),utils_type.A.isPoint(r))o=jxg.A.createPoint(t,[r,a],l);else if(r.elementClass===constants.A.OBJECT_CLASS_CURVE)o=jxg.A.createCurve(t,[r,a],l);else if(r.elementClass===constants.A.OBJECT_CLASS_LINE)o=jxg.A.createLine(t,[r,a],l);else if(r.type===constants.A.OBJECT_TYPE_POLYGON)o=jxg.A.createPolygon(t,[r,a],l);else{if(r.elementClass!==constants.A.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);"euclidean"===l.type.toLowerCase()?(c=utils_type.A.copyAttributes(i,t.options,"reflection","center"),(n=jxg.A.createPoint(t,[r.center,a],c)).prepareUpdate().update().updateVisibility(n.evalVisProp("visible")).updateRenderer(),o=jxg.A.createCircle(t,[n,function(){return r.Radius()}],l)):o=jxg.A.createCircle(t,[r,a],l)}return utils_type.A.exists(r._is_new)&&(o.addChild(r),delete r._is_new),s.addChild(o),o.elType="reflection",o.addParents(s),o.prepareUpdate().update(),utils_type.A.isPoint(o)&&(o.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,n=s.point2.symbolic.y,a=r.symbolic.x,h=r.symbolic.y,l=o.symbolic.x,c=o.symbolic.y;return[["((",c,")-(",h,"))*((",e,")-(",n,"))+((",t,")-(",i,"))*((",l,")-(",a,"))"].join(""),["((",l,")-(",t,"))^2+((",c,")-(",e,"))^2-((",a,")-(",t,"))^2-((",h,")-(",e,"))^2"].join("")]}),o},jxg.A.createMirrorElement=function(t,e,i){var s,r,o,n,a,h,l,c,u="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, point]";for(r=0;r<e.length;++r)e[r]=t.select(e[r]);if(l=utils_type.A.copyAttributes(i,t.options,"mirrorelement"),utils_type.A.isPoint(e[0]))s=utils_type.A.providePoints(t,[e[0]],l)[0];else{if(e[0].elementClass!==constants.A.OBJECT_CLASS_CURVE&&e[0].elementClass!==constants.A.OBJECT_CLASS_LINE&&e[0].type!==constants.A.OBJECT_TYPE_POLYGON&&e[0].elementClass!==constants.A.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);s=e[0]}if(!utils_type.A.isPoint(e[1]))throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);if(c=utils_type.A.copyAttributes(i,t.options,"mirrorelement","point"),o=utils_type.A.providePoints(t,[e[1]],c)[0],h=jxg.A.createTransform(t,[Math.PI,o],{type:"rotate"}),utils_type.A.isPoint(s))n=jxg.A.createPoint(t,[s,h],l);else if(s.elementClass===constants.A.OBJECT_CLASS_CURVE)n=jxg.A.createCurve(t,[s,h],l);else if(s.elementClass===constants.A.OBJECT_CLASS_LINE)n=jxg.A.createLine(t,[s,h],l);else if(s.type===constants.A.OBJECT_TYPE_POLYGON)n=jxg.A.createPolygon(t,[s,h],l);else{if(s.elementClass!==constants.A.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+u);"euclidean"===l.type.toLowerCase()?(c=utils_type.A.copyAttributes(i,t.options,"mirrorelement","center"),(a=jxg.A.createPoint(t,[s.center,h],c)).prepareUpdate().update().updateVisibility(a.evalVisProp("visible")).updateRenderer(),n=jxg.A.createCircle(t,[a,function(){return s.Radius()}],l)):n=jxg.A.createCircle(t,[s,h],l)}return utils_type.A.exists(s._is_new)&&(n.addChild(s),delete s._is_new),o.addChild(n),n.elType="mirrorelement",n.addParents(o),n.prepareUpdate().update(),n},jxg.A.createMirrorPoint=function(t,e,i){var s=jxg.A.createMirrorElement(t,e,i);return s.elType="mirrorpoint",s},jxg.A.createIntegral=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m=null;if(utils_type.A.isArray(e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_CURVE)s=e[0],r=e[1];else{if(!utils_type.A.isArray(e[1])||e[0].elementClass!==constants.A.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create integral with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [[number|function,number|function],curve]");s=e[1],r=e[0]}return(o=utils_type.A.copyAttributes(i,t.options,"integral")).withlabel=!1,A=t.create("curve",[[0],[0]],o),t.objectsList.pop(),n=s[0],a=s[1],utils_type.A.isFunction(n)?(l=function(){return r.Y(h())},n=(h=n)()):(h=n,l=r.Y(n)),utils_type.A.isFunction(a)?(u=function(){return r.Y(c())},a=(c=a)()):(c=a,u=r.Y(a)),o=utils_type.A.copyAttributes(i,t.options,"integral","curveleft"),d=t.create("glider",[h,l,r],o),utils_type.A.isFunction(h)&&d.hideElement(),o=utils_type.A.copyAttributes(i,t.options,"integral","baseleft"),p=t.create("point",[function(){return"y"===A.evalVisProp("axis")?0:d.X()},function(){return"y"===A.evalVisProp("axis")?d.Y():0}],o),o=utils_type.A.copyAttributes(i,t.options,"integral","curveright"),f=t.create("glider",[c,u,r],o),utils_type.A.isFunction(c)&&f.hideElement(),o=utils_type.A.copyAttributes(i,t.options,"integral","baseright"),_=t.create("point",[function(){return"y"===A.evalVisProp("axis")?0:f.X()},function(){return"y"===A.evalVisProp("axis")?f.Y():0}],o),A._pos=t.objectsList.length,t.objectsList.push(A),!1!==(o=utils_type.A.copyAttributes(i,t.options,"integral")).withlabel&&"y"!==o.axis&&(o=utils_type.A.copyAttributes(i,t.options,"integral","label"),o=utils_type.A.copyAttributes(o,t.options,"label"),g=function(){var t,e="&int;",i=numerics.A.NewtonCotes([p.X(),_.X()],r.Y),s=m.evalVisProp("digits");return t=m.useLocale()?m.formatNumberLocale(i,s):utils_type.A.toFixed(i,s),(m.evalVisProp("usemathjax")||m.evalVisProp("usekatex"))&&(e="\\int"),e+" = "+t},(m=t.create("text",[function(){var t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[this.evalVisProp("offset.0")+this.board.origin.scrCoords[1],0],this.board,!1),e=this.board.getBoundingBox(),i=.1*(e[2]-e[0]),s=f.X();return s<e[0]?s=e[0]+i:s>e[2]&&(s=e[2]-i),s+t.usrCoords[1]},function(){var t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[0,this.evalVisProp("offset.1")+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),i=.1*(e[1]-e[3]),s=f.Y();return s>e[1]?s=e[1]-i:s<e[3]&&(s=e[3]+i),s+t.usrCoords[2]},""],o)).setText(g),m.dump=!1,d.addChild(m),f.addChild(m)),d.dump=!1,p.dump=!1,f.dump=!1,_.dump=!1,A.elType="integral",A.setParents([r.id,s]),A.subs={curveLeft:d,baseLeft:p,curveRight:f,baseRight:_},A.inherits.push(d,p,f,_),o.withlabel&&(A.subs.label=m,A.inherits.push(m)),A.Value=function(){return numerics.A.I([p.X(),_.X()],r.Y)},A.updateDataArray=function(){var t,e,i,s,o,n,a,h,l;if("y"===this.evalVisProp("axis")){for(d.Y()<f.Y()?(n=d.X(),h=d.Y(),a=f.X(),l=f.Y()):(n=f.X(),h=f.Y(),a=d.X(),l=d.Y()),s=Math.min(n,a),o=Math.max(n,a),t=[0,n],e=[h,h],i=0;i<r.numberPoints;i++)h<=r.points[i].usrCoords[2]&&s<=r.points[i].usrCoords[1]&&r.points[i].usrCoords[2]<=l&&r.points[i].usrCoords[1]<=o&&(t.push(r.points[i].usrCoords[1]),e.push(r.points[i].usrCoords[2]));t.push(a),e.push(l),t.push(0),e.push(l),t.push(0),e.push(h)}else{for(p.X()<_.X()?(s=p.X(),o=_.X()):(s=_.X(),o=p.X()),t=[s,s],e=[0,r.Y(s)],i=0;i<r.numberPoints;i++)s<=r.points[i].usrCoords[1]&&r.points[i].usrCoords[1]<=o&&(t.push(r.points[i].usrCoords[1]),e.push(r.points[i].usrCoords[2]));t.push(o),e.push(r.Y(o)),t.push(o),e.push(0),t.push(s),e.push(0)}this.dataX=t,this.dataY=e},d.addChild(A),f.addChild(A),p.addChild(A),_.addChild(A),A.baseLeft=p,A.baseRight=_,A.curveLeft=d,A.curveRight=f,A.methodMap=jxg.A.deepCopy(A.methodMap,{curveLeft:"curveLeft",baseLeft:"baseLeft",curveRight:"curveRight",baseRight:"baseRight",Value:"Value"}),A.label=m,A},jxg.A.createInequality=function(t,e,i){var s,r,o;if(o=utils_type.A.copyAttributes(i,t.options,"inequality"),e[0].elementClass===constants.A.OBJECT_CLASS_LINE)(r=t.create("curve",[[],[]],o)).hasPoint=function(){return!1},r.updateDataArray=function(){var i,s,r,o=t.getBoundingBox(),n=this.evalVisProp("inverse"),a=n?-1:1,h=1.5*Math.max(o[2]-o[0],o[1]-o[3]),l={coords:{usrCoords:[1,.5*(o[0]+o[2]),n?o[1]:o[3]]}},c=e[0].stdform.slice(1),u=c;r=1.5*Math.max(geometry.A.perpendicular(e[0],l,t)[0].distance(constants.A.COORDS_BY_USER,l.coords),h),r*=a,l={coords:{usrCoords:[1,.5*(o[0]+o[2]),.5*(o[1]+o[3])]}},i=[1,(l=Math.abs(math.A.innerProduct(l.coords.usrCoords,e[0].stdform,3))>=math.A.eps?geometry.A.perpendicular(e[0],l,t)[0].usrCoords:l.coords.usrCoords)[1]+c[1]*h,l[2]-c[0]*h],s=[1,l[1]-u[1]*h,l[2]+u[0]*h],this.dataX=[i[1],i[1]+c[0]*r,s[1]+u[0]*r,s[1],i[1]],this.dataY=[i[2],i[2]+c[1]*r,s[2]+u[1]*r,s[2],i[2]]};else if(e[0].elementClass===constants.A.OBJECT_CLASS_CURVE&&"functiongraph"===e[0].visProp.curvetype)(r=t.create("curve",[[],[]],o)).updateDataArray=function(){var t,i,s,r,o,n,a,h,l,c=this.board.getBoundingBox(),u=[],d=e[0].minX(),p=e[0].maxX(),f=.3*(c[1]-c[3]);if(t=this.evalVisProp("inverse")?1:3,this.dataX=[],this.dataY=[],0!==(r=e[0].points.length))for(c[1]+=f,c[3]-=f,s=-1;s<r-1;){for(o=s+1,i=r;o<r;o++)if(e[0].points[o].isReal()){i=o;break}if(i>=r)break;for(o=i,s=r-1;o<r-1;o++)if(!e[0].points[o+1].isReal()){s=o;break}for(h=e[0].points[i].usrCoords[1],l=e[0].points[s].usrCoords[1],n=c[0]<d?d:c[0],a=c[2]>p?p:c[2],n=0===i?n:Math.max(n,h),a=s===r-1?a:Math.min(a,l),a=s===r-1?p:l,(u=[]).push([1,n=0===i?d:h,c[t]]),u.push([1,n,e[0].points[i].usrCoords[2]]),o=i;o<=s;o++)u.push(e[0].points[o].usrCoords);for(u.push([1,a,e[0].points[s].usrCoords[2]]),u.push([1,a,c[t]]),u.push(u[0]),o=0;o<u.length;o++)this.dataX.push(u[o][1]),this.dataY.push(u[o][2]);s<r-1&&(this.dataX.push(NaN),this.dataY.push(NaN))}},r.hasPoint=function(){return!1};else if(s=utils_type.A.createFunction(e[0]),r.addParentsFromJCFunctions([s]),!utils_type.A.exists(s))throw new Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]");return r.addParents(e[0]),r},jxg.A.registerElement("arrowparallel",jxg.A.createArrowParallel),jxg.A.registerElement("bisector",jxg.A.createBisector),jxg.A.registerElement("bisectorlines",jxg.A.createAngularBisectorsOfTwoLines),jxg.A.registerElement("msector",jxg.A.createMsector),jxg.A.registerElement("circumcircle",jxg.A.createCircumcircle),jxg.A.registerElement("circumcirclemidpoint",jxg.A.createCircumcenter),jxg.A.registerElement("circumcenter",jxg.A.createCircumcenter),jxg.A.registerElement("incenter",jxg.A.createIncenter),jxg.A.registerElement("incircle",jxg.A.createIncircle),jxg.A.registerElement("integral",jxg.A.createIntegral),jxg.A.registerElement("midpoint",jxg.A.createMidpoint),jxg.A.registerElement("mirrorelement",jxg.A.createMirrorElement),jxg.A.registerElement("mirrorpoint",jxg.A.createMirrorPoint),jxg.A.registerElement("orthogonalprojection",jxg.A.createOrthogonalProjection),jxg.A.registerElement("parallel",jxg.A.createParallel),jxg.A.registerElement("parallelpoint",jxg.A.createParallelPoint),jxg.A.registerElement("perpendicular",jxg.A.createPerpendicular),jxg.A.registerElement("perpendicularpoint",jxg.A.createPerpendicularPoint),jxg.A.registerElement("perpendicularsegment",jxg.A.createPerpendicularSegment),jxg.A.registerElement("reflection",jxg.A.createReflection),jxg.A.registerElement("inequality",jxg.A.createInequality),jxg.A.createGrid=function(t,e,i){var s,r,o,n,a,h,l,c,u=math.A.eps,d=5e3,p=[],f=[];if((o=e).length>2||o.length>=1&&"axis"!==o[0].elType||o.length>=2&&"axis"!==o[1].elType)throw new Error("JSXGraph: Can't create 'grid' with parent type '"+e[0].elType+"'. Possible parent types: [axis,axis]");return!utils_type.A.exists(o[0])&&utils_type.A.exists(t.defaultAxes)&&(o[0]=t.defaultAxes.x),!utils_type.A.exists(o[1])&&utils_type.A.exists(t.defaultAxes)&&(o[1]=t.defaultAxes.y),c=function(t,e,i,s,r,o,n){var a,h,l,c,u,d,p;switch(t.toLowerCase()){case".":case"point":return e.visProp.linecap="round",e.visProp.strokewidth=r*e.board.unitX+o*e.board.unitY,[[i,i,NaN],[s,s,NaN]];case"o":case"circle":return e.visProp.linecap="square",e.bezierDegree=3,[[i+r,i+r,i+(h=4*Math.tan(Math.PI/8)/3)*r,i,i-h*r,i-r,i-r,i-r,i-h*r,i,i+h*r,i+r,i+r,NaN],[s,s+h*o,s+o,s+o,s+o,s+h*o,s,s-h*o,s-o,s-o,s-o,s-h*o,s,NaN]];case"regpol":case"regularpolygon":for(e.visProp.linecap="round",c=e.evalVisProp("polygonvertices"),u=[[],[]],a=0;a<=2*Math.PI;a+=2*Math.PI/c)u[0].push(i-r*Math.sin(a)),u[1].push(s-o*Math.cos(a));return u[0].push(NaN),u[1].push(NaN),u;case"[]":case"square":return e.visProp.linecap="square",[[i-r,i+r,i+r,i-r,i-r,NaN],[s+o,s+o,s-o,s-o,s+o,NaN]];case"<>":case"diamond":return e.visProp.linecap="square",[[i,i+r,i,i-r,i,NaN],[s+o,s,s-o,s,s+o,NaN]];case"<<>>":case"diamond2":return e.visProp.linecap="square",[[i,i+(d=r*Math.sqrt(2)),i,i-d,i,NaN],[s+(p=o*Math.sqrt(2)),s,s-p,s,s+p,NaN]];case"x":case"cross":return[[i-r,i+r,NaN,i-r,i+r,NaN],[s+o,s-o,NaN,s-o,s+o,NaN]];case"+":case"plus":return[[i-r,i+r,NaN,i,i,NaN],[s,s,NaN,s-o,s+o,NaN]];case"-":case"minus":return[[i-r,i+r,NaN],[s,s,NaN]];case"|":case"divide":return[[i,i,NaN],[s-o,s+o,NaN]];case"^":case"a":case"A":case"triangleup":return[[i-r,i,i+r,NaN],[s-o,s,s-o,NaN]];case"v":case"triangledown":return[[i-r,i,i+r,NaN],[s+o,s,s+o,NaN]];case"<":case"triangleleft":return[[i+r,i,i+r,NaN],[s+o,s,s-o,NaN]];case">":case"triangleright":return[[i-r,i,i-r,NaN],[s+o,s,s-o,NaN]];case"line":return l=e.evalVisProp("margin"),[[i,i,NaN,n[0]-l/e.board.unitX,n[2]+l/e.board.unitX,NaN],[n[1]+l/e.board.unitY,n[3]-l/e.board.unitY,NaN,s,s,NaN]];default:return[[],[]]}},n=utils_type.A.copyAttributes(i,t.options,"grid"),utils_type.A.mergeAttr(n,n.themes[n.theme],!1),a={},utils_type.A.mergeAttr(a,n,!0,!0),utils_type.A.mergeAttr(a,n.major,!0,!0),(s=t.create("curve",[[null],[null]],a)).elType="grid",s.type=constants.A.OBJECT_TYPE_GRID,h={},utils_type.A.mergeAttr(h,n,!0,!0),utils_type.A.mergeAttr(h,n.minor,!0,!0),h.id===a.id&&(h.id=s.id+"_minor"),h.name===a.name&&(h.name=s.name+"_minor"),(r=t.create("curve",[[null],[null]],h)).elType="grid",r.type=constants.A.OBJECT_TYPE_GRID,s.minorGrid=r,r.majorGrid=s,s.hasPoint=function(){return!1},r.hasPoint=function(){return!1},s.inherits.push(r),s.updateDataArray=function(){var t,e,i,r,n,a,h,_,g=this.board.getBoundingBox(),A=this.evalVisProp("gridx"),m=this.evalVisProp("gridy"),b=this.evalVisProp("face"),y=this.evalVisProp("drawzero"),v=!0===y||utils_type.A.isObject(y)&&!0===this.eval(y.origin),C=!0===y||utils_type.A.isObject(y)&&!0===this.eval(y.x),P=!0===y||utils_type.A.isObject(y)&&!0===this.eval(y.y),x=this.evalVisProp("includeboundaries"),E=this.evalVisProp("forcesquare");if(this.dataX=[],this.dataY=[],l=this.evalVisProp("majorstep"),utils_type.A.isArray(l)||(l=[l,l]),l.length<2&&(l=[l[0],l[0]]),utils_type.A.exists(A)&&(jxg.A.deprecated("gridX","majorStep"),l[0]=A),utils_type.A.exists(m)&&(jxg.A.deprecated("gridY","majorStep"),l[1]=m),"auto"===l[0]?(_=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),l[0]=_,utils_type.A.exists(o[0])&&(l[0]=o[0].ticks[0].getDistanceMajorTicks())):l[0]=utils_type.A.parseNumber(l[0],Math.abs(g[1]-g[3]),1/this.board.unitX),"auto"===l[1]?(_=Math.pow(10,Math.floor(Math.log(50/this.board.unitY)/Math.LN10)),l[1]=_,utils_type.A.exists(o[1])&&(l[1]=o[1].ticks[0].getDistanceMajorTicks())):l[1]=utils_type.A.parseNumber(l[1],Math.abs(g[0]-g[2]),1/this.board.unitY),"min"===E||!0===E?l[0]*this.board.unitX<=l[1]*this.board.unitY?l[1]=l[0]/this.board.unitY*this.board.unitX:l[0]=l[1]/this.board.unitX*this.board.unitY:"max"===E&&(l[0]*this.board.unitX<=l[1]*this.board.unitY?l[0]=l[1]/this.board.unitX*this.board.unitY:l[1]=l[0]/this.board.unitY*this.board.unitX),p=this.evalVisProp("size"),utils_type.A.isArray(p)||(p=[p,p]),p.length<2&&(p=[p[0],p[0]]),utils_type.A.isNumber(p[0],!0)&&(p[0]=p[0]+"px"),utils_type.A.isNumber(p[1],!0)&&(p[1]=p[1]+"px"),p[0]=utils_type.A.parseNumber(p[0],l[0],1/this.board.unitX),p[1]=utils_type.A.parseNumber(p[1],l[1],1/this.board.unitY),f[0]=p[0]/2,f[1]=p[1]/2,t=math.A.roundToStep(g[0],l[0]),e=math.A.roundToStep(g[1],l[1]),h=isFinite(t)&&isFinite(e)&&isFinite(g[2])&&isFinite(g[3])&&Math.abs(g[2])<Math.abs(l[0]*d)&&Math.abs(g[3])<Math.abs(l[1]*d),"line"===b.toLowerCase()){for(n=s.evalVisProp("margin"),r=e;h&&r>=g[3];r-=l[1])!v&&Math.abs(r)<u||!P&&Math.abs(r)<u||!x&&(r<=g[3]+f[1]||r>=g[1]-f[1])||(a=[[g[0]-n/s.board.unitX,g[2]+n/s.board.unitX,NaN],[r,r,NaN]],utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1]));for(i=t;h&&i<=g[2];i+=l[0])!v&&Math.abs(i)<u||!C&&Math.abs(i)<u||!x&&(i<=g[0]+f[0]||i>=g[2]-f[0])||(a=[[i,i,NaN],[g[1]+n/s.board.unitY,g[3]-n/s.board.unitY,NaN]],utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1]))}else for(r=e;h&&r>=g[3];r-=l[1])for(i=t;h&&i<=g[2];i+=l[0])!v&&Math.abs(r)<u&&Math.abs(i)<u||!C&&Math.abs(r)<u&&Math.abs(i)>=u||!P&&Math.abs(i)<u&&Math.abs(r)>=u||!x&&(i<=g[0]+f[0]||i>=g[2]-f[0]||r<=g[3]+f[1]||r>=g[1]-f[1])||(a=c(b,s,i,r,f[0],f[1],g),utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1]))},r.updateDataArray=function(){var t,e,i,s,n,a,h,p,_,g,A,m,b,y,v,C,P,x,E,O=this.board.getBoundingBox(),M=[],w=[],S=this.evalVisProp("minorelements"),T=this.evalVisProp("size"),N=this.evalVisProp("face"),j=this.evalVisProp("drawzero"),D=!0===j||utils_type.A.isObject(j)&&!0===this.eval(j.x),k=!0===j||utils_type.A.isObject(j)&&!0===this.eval(j.y),R=this.majorGrid.evalVisProp("face"),L=this.majorGrid.evalVisProp("drawzero"),B=!0===L||utils_type.A.isObject(L)&&!0===this.eval(L.origin),I=!0===L||utils_type.A.isObject(L)&&!0===this.eval(L.x),Y=!0===L||utils_type.A.isObject(L)&&!0===this.eval(L.y),V=this.evalVisProp("includeboundaries");if(this.dataX=[],this.dataY=[],utils_type.A.isArray(S)||(S=[S,S]),S.length<2&&(S=[S[0],S[0]]),utils_type.A.isNumber(S[0],!0)?S[0]=parseFloat(S[0]):(S[0]=3,utils_type.A.exists(o[0])&&(S[0]=o[0].eval(o[0].getAttribute("ticks").minorticks))),M[0]=l[0]/(S[0]+1),utils_type.A.isNumber(S[1],!0)?S[1]=parseFloat(S[1]):(S[1]=3,utils_type.A.exists(o[1])&&(S[1]=o[1].eval(o[1].getAttribute("ticks").minorticks))),M[1]=l[1]/(S[1]+1),utils_type.A.isArray(T)||(T=[T,T]),T.length<2&&(T=[T[0],T[0]]),utils_type.A.isNumber(T[0],!0)&&(T[0]=T[0]+"px"),utils_type.A.isNumber(T[1],!0)&&(T[1]=T[1]+"px"),T[0]=utils_type.A.parseNumber(T[0],M[0],1/this.board.unitX),T[1]=utils_type.A.parseNumber(T[1],M[1],1/this.board.unitY),w[0]=.5*T[0],w[1]=.5*T[1],t=math.A.roundToStep(O[0],M[0]),e=math.A.roundToStep(O[1],M[1]),h=isFinite(t)&&isFinite(e)&&isFinite(O[2])&&isFinite(O[3])&&Math.abs(O[2])<=Math.abs(M[0]*d)&&Math.abs(O[3])<Math.abs(M[1]*d),"line"!==N.toLowerCase())for(s=e;h&&s>=O[3];s-=M[1])for(i=t;h&&i<=O[2];i+=M[0]){if(p=math.A.roundToStep(Math.abs(i),l[0]),p=Math.abs(p-Math.abs(i)),_=l[0]-p,g=math.A.roundToStep(Math.abs(s),l[1]),g=Math.abs(g-Math.abs(s)),A=l[1]-g,"line"===R){if(p-w[0]-f[0]<u||_-w[0]-f[0]<u||g-w[1]-f[1]<u||A-w[1]-f[1]<u)continue}else if((p-w[0]-f[0]<u||_-w[0]-f[0]<u)&&(g-w[1]-f[1]<u||A-w[1]-f[1]<u)&&(B||f[1]-Math.abs(s)+w[1]<u||f[0]-Math.abs(i)+w[0]<u)&&(I||f[1]-Math.abs(s)+w[1]<u||f[0]+Math.abs(i)-w[0]<u)&&(Y||f[0]-Math.abs(i)+w[0]<u||f[1]+Math.abs(s)-w[1]<u))continue;!k&&Math.abs(i)<u||!D&&Math.abs(s)<u||(m=Math.abs(O[0]%l[0]),b=Math.abs(O[1]%l[1]),y=Math.abs(O[2]%l[0]),v=Math.abs(O[3]%l[1]),C=l[0]-m,P=l[1]-b,x=l[0]-y,E=l[1]-v,!V&&(i-w[0]-O[0]-f[0]+C<u&&C-f[0]<u||i-w[0]-O[0]-f[0]-m<u&&m-f[0]<u||-i-w[0]+O[2]-f[0]+x<u&&x-f[0]<u||-i-w[0]+O[2]-f[0]-y<u&&y-f[0]<u||-s-w[1]+O[1]-f[1]+P<u&&P-f[1]<u||-s-w[1]+O[1]-f[1]-b<u&&b-f[1]<u||s-w[1]-O[3]-f[1]+E<u&&E-f[1]<u||s-w[1]-O[3]-f[1]-v<u&&v-f[1]<u||-s-w[1]+O[1]<u||i-w[0]-O[0]<u||s-w[1]-O[3]<u||-i-w[0]+O[2]<u)||(a=c(N,r,i,s,w[0],w[1],O),utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1])))}else{for(n=r.evalVisProp("margin"),s=e;h&&s>=O[3];s-=M[1]){if(g=math.A.roundToStep(Math.abs(s),l[1]),g=Math.abs(g-Math.abs(s)),A=l[1]-g,"line"===R){if(g-w[1]-f[1]<u||A-w[1]-f[1]<u)continue}else if((g-w[1]-f[1]<u||A-w[1]-f[1]<u)&&(B||f[1]-Math.abs(s)+w[1]<u)&&(I||f[1]-Math.abs(s)+w[1]<u)&&(Y||f[1]+Math.abs(s)-w[1]<u))continue;!D&&Math.abs(s)<u||(m=Math.abs(O[0]%l[0]),b=Math.abs(O[1]%l[1]),y=Math.abs(O[2]%l[0]),v=Math.abs(O[3]%l[1]),C=l[0]-m,P=l[1]-b,x=l[0]-y,E=l[1]-v,!V&&(-s-w[1]+O[1]-f[1]+P<u&&P-f[1]<u||-s-w[1]+O[1]-f[1]-b<u&&b-f[1]<u||s-w[1]-O[3]-f[1]+E<u&&E-f[1]<u||s-w[1]-O[3]-f[1]-v<u&&v-f[1]<u||-s-w[1]+O[1]<u||s-w[1]-O[3]<u)||(a=[[O[0]-n/r.board.unitX,O[2]+n/r.board.unitX,NaN],[s,s,NaN]],utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1])))}for(i=t;h&&i<=O[2];i+=M[0]){if(p=math.A.roundToStep(Math.abs(i),l[0]),p=Math.abs(p-Math.abs(i)),_=l[0]-p,"line"===R){if(p-w[0]-f[0]<u||_-w[0]-f[0]<u)continue}else if((p-w[0]-f[0]<u||_-w[0]-f[0]<u)&&(B||f[0]-Math.abs(i)+w[0]<u)&&(I||f[0]+Math.abs(i)-w[0]<u)&&(Y||f[0]-Math.abs(i)+w[0]<u))continue;!k&&Math.abs(i)<u||(m=Math.abs(O[0]%l[0]),b=Math.abs(O[1]%l[1]),y=Math.abs(O[2]%l[0]),v=Math.abs(O[3]%l[1]),C=l[0]-m,P=l[1]-b,x=l[0]-y,E=l[1]-v,!V&&(i-w[0]-O[0]-f[0]+C<u&&C-f[0]<u||i-w[0]-O[0]-f[0]-m<u&&m-f[0]<u||-i-w[0]+O[2]-f[0]+x<u&&x-f[0]<u||-i-w[0]+O[2]-f[0]-y<u&&y-f[0]<u||i-w[0]-O[0]<u||-i-w[0]+O[2]<u)||(a=[[i,i,NaN],[O[1]+n/r.board.unitY,O[3]-n/r.board.unitY,NaN]],utils_type.A.concat(this.dataX,a[0]),utils_type.A.concat(this.dataY,a[1])))}}},t.grids.push(s),t.grids.push(r),r.dump=!1,s.getParents=r.getParents=function(){return o.slice()},s},jxg.A.registerElement("grid",jxg.A.createGrid);var base_text=__webpack_require__(925);jxg.A.Image=function(t,e,i,s,r){this.constructor(t,i,constants.A.OBJECT_TYPE_IMAGE,constants.A.OBJECT_CLASS_OTHER),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this.W=utils_type.A.createFunction(r[0],this.board,""),this.H=utils_type.A.createFunction(r[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*t.unitX),Math.abs(this.usrSize[1]*t.unitY)],this.url=s,this.elType="image",this.span=[this.coords.usrCoords.slice(0),[this.coords.usrCoords[0],this.W(),0],[this.coords.usrCoords[0],0,this.H()]],this.id=this.board.setId(this,"Im"),this.board.renderer.drawImage(this),this.board.finalizeAdding(this),this.methodMap=jxg.A.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H",setSize:"setSize"})},jxg.A.Image.prototype=new base_element.A,utils_type.A.copyPrototypeMethods(jxg.A.Image,coordselement.A,"coordsConstructor"),jxg.A.extend(jxg.A.Image.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a,h,l,c,u=this.transformations.length;return utils_type.A.isObject(this.evalVisProp("precision"))?(o=this.board._inputDevice,n=this.evalVisProp("precision."+o)):n=this.board.options.precision.hasPoint,0===u?(i=t-this.coords.scrCoords[1],s=this.coords.scrCoords[2]-e,i>=-(r=n)&&i-this.size[0]<=r&&s>=-r&&s-this.size[1]<=r):(h=[(a=(a=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],a[1]-this.span[0][1],a[2]-this.span[0][2]],0<=(l=(c=math.A.innerProduct)(h,this.span[1]))&&l<=c(this.span[1],this.span[1])&&0<=(l=c(h,this.span[2]))&&l<=c(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var t,e,i=this.transformations.length,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t<i;t++)for(e=0;e<3;e++)s[e]=math.A.matVecMult(this.transformations[t].matrix,s[e]);for(e=0;e<3;e++)s[e][1]/=s[e][0],s[e][2]/=s[e][0],s[e][0]/=s[e][0];for(e=1;e<3;e++)s[e][0]-=s[0][0],s[e][1]-=s[0][1],s[e][2]-=s[0][2];this.span=s}return this},addTransform:function(t){var e;if(utils_type.A.isArray(t))for(e=0;e<t.length;e++)this.transformations.push(t[e]);else this.transformations.push(t);return this},getParents:function(){var t=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return 0!==this.parents.length&&(t=this.parents),t},setSize:function(t,e){return this.W=utils_type.A.createFunction(t,this.board,""),this.H=utils_type.A.createFunction(e,this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}),jxg.A.createImage=function(t,e,i){var s,r,o=e[0],n=e[1],a=e[2];if(s=utils_type.A.copyAttributes(i,t.options,"image"),!(r=coordselement.A.create(jxg.A.Image,t,n,s,o,a)))throw new Error("JSXGraph: Can't create image with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==s.rotate&&r.addRotation(s.rotate),r},jxg.A.registerElement("image",jxg.A.createImage);var base_image=jxg.A.Image;jxg.A.createSlider=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E;return b=(E=utils_type.A.copyAttributes(i,t.options,"slider")).withticks,m=E.withlabel,C=E.snapwidth,y=E.snapvalues,v=E.snapvaluedistance,l=t.create("point",e[0],E.point1),c=t.create("point",e[1],E.point2),(d=t.create("segment",[l,c],E.baseline)).updateStdform(),s=l.coords.usrCoords.slice(1),r=c.coords.usrCoords.slice(1),o=e[2][0],n=e[2][1],a=e[2][2],h=a-o,x=-1===(P=utils_type.A.evaluate(C))?n:Math.round((n-o)/P)*P+o,g=s[0]+(r[0]-s[0])*(x-o)/(a-o),A=s[1]+(r[1]-s[1])*(x-o)/(a-o),E.withlabel=!1,(u=t.create("glider",[g,A,d],E)).setAttribute({snapwidth:C,snapvalues:y,snapvaluedistance:v}),p=t.create("segment",[l,u],E.highline),u.Value=function(){var t=this._smax-this._smin,e=this.evalVisProp("snapwidth");return-1===e?this.position*t+this._smin:Math.round(this.position*t/e)*e+this._smin},u.methodMap=utils_type.A.deepCopy(u.methodMap,{Value:"Value",setValue:"setValue",smax:"_smax",smin:"_smin",setMax:"setMax",setMin:"setMin",point1:"point1",point2:"point2",baseline:"baseline",highline:"highline",ticks:"ticks",label:"label"}),u._smax=a,u._smin=o,u.setMax=function(t){return this._smax=t,this},u.setValue=function(t){var e=this._smax-this._smin;return Math.abs(e)>math.A.eps?this.position=(t-this._smin)/e:this.position=0,this.position=Math.max(0,Math.min(1,this.position)),this},u.setMin=function(t){return this._smin=t,this},m&&(_=t.create("text",[function(){return.05*(c.X()-l.X())+c.X()},function(){return.05*(c.Y()-l.Y())+c.Y()},function(){var t,e=u.evalVisProp("digits"),i=u.evalVisProp("suffixlabel"),s=u.evalVisProp("unitlabel"),r=u.evalVisProp("postlabel");return 2===e&&2!==u.evalVisProp("precision")&&(e=u.evalVisProp("precision")),t=null!==i?i:u.name&&""!==u.name?u.name+" = ":"",u.useLocale()?t+=u.formatNumberLocale(u.Value(),e):t+=utils_type.A.toFixed(u.Value(),e),null!==s&&(t+=s),null!==r&&(t+=r),t}],E.label),u.label=_,u.visProp.withlabel=!0,u.hasLabel=!0),u.point1=l,u.point2=c,u.baseline=d,u.highline=p,b&&(utils_type.A.exists(E.generatelabeltext)||(E.ticks.generateLabelText=function(t,e,i){var s=u.point1.Dist(u.point2),r=u._smin,o=u._smax,n=this.getDistanceFromZero(e,t)*(o-r)/s+r;return s<math.A.eps||Math.abs(n)<math.A.eps?"0":this.formatLabelText(n)}),f=t.create("ticks",[u.baseline,u.point1.Dist(l)/2,function(t){var e=u.point1.Dist(u.point2),i=u.point1.coords.distance(constants.A.COORDS_BY_USER,t);return e<math.A.eps?0:i/e*h+o}],E.ticks),u.ticks=f),u.remove=function(){m&&t.removeObject(_),t.removeObject(p),t.removeObject(d),t.removeObject(c),t.removeObject(l),point.prototype.remove.call(u)},l.dump=!1,c.dump=!1,d.dump=!1,p.dump=!1,m&&(_.dump=!1),u.elType="slider",u.parents=e,u.subs={point1:l,point2:c,baseLine:d,highLine:p},u.inherits.push(l,c,d,p),d.inherits=[],p.inherits=[],b&&(f.dump=!1,u.subs.ticks=f,u.inherits.push(f)),u.getParents=function(){return[this.point1.coords.usrCoords.slice(1),this.point2.coords.usrCoords.slice(1),[this._smin,this.position*(this._smax-this._smin)+this._smin,this._smax]]},u.baseline.on("up",function(t){var e,i;u.evalVisProp("moveonup")&&!u.evalVisProp("fixed")&&(e=d.board.getMousePosition(t,0),i=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,this.board),u.moveTo([i.usrCoords[1],i.usrCoords[2]]),u.triggerEventHandlers(["drag"],[t]))}),u.prepareUpdate().update(),t.isSuspendedUpdate||(u.updateVisibility().updateRenderer(),u.baseline.updateVisibility().updateRenderer(),u.highline.updateVisibility().updateRenderer(),b&&u.ticks.updateVisibility().updateRenderer()),u},jxg.A.registerElement("slider",jxg.A.createSlider),jxg.A.PrefixParser={parse:function(t,e){var i,s,r,o,n,a;if(utils_type.A.isNumber(t)||utils_type.A.isString(t))return t;if(!utils_type.A.isArray(t)||t.length<2)throw new Error("prefixParser.parse: term is not an array, number or string");if(i=t[0],r=t.length,"execute"===e)if(utils_type.A.isInArray(["+","-","*","/"],i))for(o=this.parse(t[1],e),s=2;s<r;s++)switch(a=this.parse(t[s],e),i){case"+":o+=a;break;case"-":o-=a;break;case"*":o*=a;break;case"/":o/=a}else if("exec"===i){for(n=t[1],a=[],s=2;s<r;s++)a.push(this.parse(t[s],e));if(utils_type.A.exists(Math[n]))o=Math[n].apply(this,a);else{if(!utils_type.A.exists(math.A[n]))throw new Error("PrefixParser.parse: "+n+" is not allowed");o=math.A[n].apply(this,a)}}else{if("V"===(n=t[0])&&(n="Value"),"Coords"===n&&(t[2]="true"),!utils_type.A.exists(t[1][n]))throw new Error("PrefixParser.parse: "+n+" is not a method of "+t[1]);for(a=[],s=2;s<r;s++)a.push(this.parse(t[s],e));o=t[1][n].apply(t[1],a)}return o},dimension:function(t){var e,i,s,r,o,n,a,h;if(utils_type.A.isNumber(t))return 0;if(!utils_type.A.isArray(t)||t.length<2)throw new Error("PrefixParser.dimension: term is not an array");if(e=t[0],s=t.length,utils_type.A.isInArray(["+","-","*","/"],e))for(r=this.dimension(t[1]),i=2;i<s;i++)switch(a=this.dimension(t[i]),e){case"+":case"-":a!==r&&(r=NaN);break;case"*":r+=a;break;case"/":r-=a}else if("exec"===e)t[2].type===utils_type.A.OBJECT_TYPE_MEASUREMENT?(r=t[2].Dimension(),utils_type.A.exists(t[2].visProp.dim)&&null!==(n=t[2].evalVisProp("dim"))&&(r=n)):r=0;else switch(o=t[0]){case"L":case"Length":case"Perimeter":case"Radius":case"R":r=1;break;case"Area":case"A":r=2;break;default:t[1].type===utils_type.A.OBJECT_TYPE_MEASUREMENT?(r=t[1].Dimension(),utils_type.A.exists(t[1].visProp.dim)&&null!==(n=t[1].evalVisProp("dim"))&&(r=n)):(r=0,"Value"!==o&&"V"!==o||[constants.A.OBJECT_TYPE_ARC,constants.A.OBJECT_TYPE_SECTOR,constants.A.OBJECT_TYPE_ANGLE].indexOf(t[1].type)>=0&&(h="",3===t.length&&utils_type.A.isString(t[2])&&(h=t[2].toLowerCase()),r=""===h?t[1].type===constants.A.OBJECT_TYPE_ANGLE?0:1:0===h.indexOf("len")?1:0))}return r},toPrefix:function(t){var e,i,s,r;if(utils_type.A.isNumber(t))return t;if(!utils_type.A.isArray(t)||t.length<2)throw new Error("PrefixParser.toPrefix: term is not an array");for(e=t[0],s=t.length,r=[e],i=1;i<s;i++)utils_type.A.isInArray(["+","-","*","/"],e)?r.push(this.toPrefix(t[i])):"V"===e&&t[i].type===utils_type.A.OBJECT_TYPE_MEASUREMENT?r=t[i].toPrefix():"exec"===e?1===i?r.push(t[i]):r.push(this.toPrefix(t[i])):r=[e,t[i].id];return r},getParents:function(t){var e,i,s,r;if(utils_type.A.isNumber(t))return[];if(!utils_type.A.isArray(t)||t.length<2)throw new Error("PrefixParser.getParents: term is not an array");for(e=t[0],s=t.length,r=[],i=1;i<s;i++)utils_type.A.isInArray(["+","-","*","/"],e)?utils_type.A.concat(r,this.getParents(t[i])):"V"===e&&t[i].type===utils_type.A.OBJECT_TYPE_MEASUREMENT?utils_type.A.concat(r,t[i].getParents()):"exec"===e?i>1&&utils_type.A.concat(r,this.getParents(t[i])):r.push(t[i]);return r}};var prefix=jxg.A.PrefixParser;jxg.A.createTapemeasure=function(t,e,i){var s,r,o,n,a,h,l,c,u,d;return s=e[0],r=e[1],o=utils_type.A.copyAttributes(i,t.options,"tapemeasure","point1"),l=t.create("point",s,o),o=utils_type.A.copyAttributes(i,t.options,"tapemeasure","point2"),c=t.create("point",r,o),l.setAttribute({ignoredSnapToPoints:[c.id]}),c.setAttribute({ignoredSnapToPoints:[l.id]}),o=utils_type.A.copyAttributes(i,t.options,"tapemeasure"),n=o.withticks,a=o.withlabel,2===o.digits&&2!==o.precision&&o.precision,a&&(o.withlabel=!0),h=t.create("segment",[l,c],o),a&&(u=i.name&&""!==i.name?i.name+" = ":"",h.label.setText(function(){var t=h.label.evalVisProp("digits");return h.label.useLocale()?u+h.label.formatNumberLocale(l.Dist(c),t):u+utils_type.A.toFixed(l.Dist(c),t)})),n&&(o=utils_type.A.copyAttributes(i,t.options,"tapemeasure","ticks"),d=t.create("ticks",[h,.1],o),h.inherits.push(d)),h.remove=function(){n&&h.removeTicks(d),t.removeObject(c),t.removeObject(l),base_element.A.prototype.remove.call(this)},h.Value=function(){return l.Dist(c)},l.dump=!1,c.dump=!1,h.elType="tapemeasure",h.getParents=function(){return[[l.X(),l.Y()],[c.X(),c.Y()]]},h.subs={point1:l,point2:c},n&&(d.dump=!1),h.methodMap=jxg.A.deepCopy(h.methodMap,{Value:"Value"}),h.prepareUpdate().update(),t.isSuspendedUpdate||(h.updateVisibility().updateRenderer(),h.point1.updateVisibility().updateRenderer(),h.point2.updateVisibility().updateRenderer()),h},jxg.A.registerElement("tapemeasure",jxg.A.createTapemeasure),jxg.A.createMeasurement=function(t,e,i){var s,r,o,n,a,h;for(r=utils_type.A.copyAttributes(i,t.options,"measurement"),o=e[0],n=e[1],a=e[2],(s=t.create("text",[o,n,""],r)).type=utils_type.A.OBJECT_TYPE_MEASUREMENT,s.elType="measurement",s.Value=function(){return prefix.parse(a,"execute")},s.Dimension=function(){var t=s.evalVisProp("dim");return null!==t?t:prefix.dimension(a)},s.Unit=function(t){var e,i="",r=s.evalVisProp("units"),o=t,n={};if(utils_type.A.exists(o)||(o=s.Dimension()),utils_type.A.isArray(t)){for(e=0;e<t.length;e++)n["dim"+t[e]]=s.Unit(t[e]);return n}return utils_type.A.isObject(r)&&utils_type.A.exists(r[o])&&!1!==r[o]?i=s.eval(r[o]):utils_type.A.isObject(r)&&utils_type.A.exists(r["dim"+o])&&!1!==r["dim"+o]?i=s.eval(r["dim"+o]):(i=s.evalVisProp("baseunit"),0===o?i="":o>1&&""!==i&&(i=i+"^{"+o+"}")),i},s.getTerm=function(){return a},s.getMethod=function(){var t=a[0];return"V"===t&&(t="Value"),t},s.toPrefix=function(){return prefix.toPrefix(a)},s.getParents=function(){return prefix.getParents(a)},s.addParents(s.getParents()),h=0;h<s.parents.length;h++)t.select(s.parents[h]).addChild(s);return s.setText(function(){var t,e="",i="",r=s.Dimension(),o=s.evalVisProp("digits"),n=s.Unit(),a=s.Value();if(s.evalVisProp("showprefix")&&(e=s.evalVisProp("prefix")),s.evalVisProp("showsuffix")&&(i=s.evalVisProp("suffix")),utils_type.A.isNumber(a))"none"===o||(a="auto"===o?s.useLocale()?s.formatNumberLocale(a):utils_type.A.autoDigits(a):s.useLocale()?s.formatNumberLocale(a,o):utils_type.A.toFixed(a,o));else if(utils_type.A.isArray(a))for(t=0;t<a.length;t++)utils_type.A.isNumber(a[t])&&("none"===o||("auto"===o?s.useLocale()?a[t]=s.formatNumberLocale(a[t]):a[t]=utils_type.A.autoDigits(a[t]):s.useLocale()?a[t]=s.formatNumberLocale(a[t],o):a[t]=utils_type.A.toFixed(a[t],o)));return"coords"===r&&utils_type.A.isArray(a)&&(2===a.length&&a.unshift(void 0),a=s.visProp.formatcoords(s,a[1],a[2],a[0])),"direction"===r&&utils_type.A.isArray(a)&&(a=s.visProp.formatdirection(s,a[0],a[1])),utils_type.A.isString(r)?e+a+i:isNaN(r)?e+"NaN"+i:e+a+n+i}),s.methodMap=utils_type.A.deepCopy(s.methodMap,{Value:"Value",Dimension:"Dimension",Unit:"Unit",getTerm:"getTerm",Term:"getTerm",getMethod:"getMethod",Method:"getMethod",getParents:"getParents",Parents:"getParents"}),s},jxg.A.registerElement("measurement",jxg.A.createMeasurement),jxg.A.DataSource=function(){return this.data=[],this.columnHeaders=[],this.rowHeaders=[],this},jxg.A.extend(jxg.A.DataSource.prototype,{loadFromArray:function(t,e,i){var s,r,o;if(utils_type.A.isArray(e)&&(this.columnHeaders=e,e=!1),utils_type.A.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),utils_type.A.exists(t)){for(this.data=[],s=0;s<t.length;s++)for(this.data[s]=[],r=0;r<t[s].length;r++)o=t[s][r],parseFloat(o).toString()===o?this.data[s][r]=parseFloat(o):this.data[s][r]="-"!==o?o:NaN;if(e&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),i)for(this.rowHeaders=[],s=0;s<this.data.length;s++)this.rowHeaders.push(this.data[s][0]),this.data[s]=this.data[s].slice(1)}return this},loadFromTable:function(t,e,i){var s,r,o,n,a;if(utils_type.A.isArray(e)&&(this.columnHeaders=e,e=!1),utils_type.A.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),t=document.getElementById(t),utils_type.A.exists(t)){for(s=t.getElementsByTagName("tr"),this.data=[],r=0;r<s.length;r++)for(n=s[r].getElementsByTagName("td"),this.data[r]=[],o=0;o<n.length;o++)a=n[o].innerText,parseFloat(a).toString()===a?this.data[r][o]=parseFloat(a):this.data[r][o]="-"!==a?a:NaN;if(e&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),i)for(this.rowHeaders=[],r=0;r<this.data.length;r++)this.rowHeaders.push(this.data[r][0]),this.data[r]=this.data[r].slice(1)}return this},addColumn:function(t,e,i){throw new Error("not implemented")},addRow:function(t,e,i){throw new Error("not implemented")},getColumn:function(t){var e,i=[];if(utils_type.A.isString(t))for(e=0;e<this.columnHeaders.length;e++)if(t===this.columnHeaders[e]){t=e;break}for(e=0;e<this.data.length;e++)this.data[e].length>t&&(i[e]=parseFloat(this.data[e][t]));return i},getRow:function(t){var e,i;if(utils_type.A.isString(t))for(i=0;i<this.rowHeaders.length;i++)if(t===this.rowHeaders[i]){t=i;break}for(e=[],i=0;i<this.data[t].length;i++)e[i]=this.data[t][i];return e}});var datasource=jxg.A.DataSource;jxg.A.Chart=function(t,e,i){var s,r,o,n,a,h;if(this.constructor(t,i),!utils_type.A.isArray(e)||0===e.length)throw new Error("JSXGraph: Can't create a chart without data");if(this.elements=[],utils_type.A.isNumber(e[0]))for(r=e,s=[],o=0;o<r.length;o++)s[o]=o+1;else if(1===e.length&&utils_type.A.isArray(e[0]))for(r=e[0],s=[],h=utils_type.A.evaluate(r).length,o=0;o<h;o++)s[o]=o+1;else 2===e.length&&(h=Math.min(e[0].length,e[1].length),s=e[0].slice(0,h),r=e[1].slice(0,h));if(utils_type.A.isArray(r)&&0===r.length)throw new Error("JSXGraph: Can't create charts without data.");for(a=i.chartstyle.replace(/ /g,"").split(","),o=0;o<a.length;o++){switch(a[o]){case"bar":n=this.drawBar(t,s,r,i);break;case"line":n=this.drawLine(t,s,r,i);break;case"fit":n=this.drawFit(t,s,r,i);break;case"spline":n=this.drawSpline(t,s,r,i);break;case"pie":n=this.drawPie(t,r,i);break;case"point":n=this.drawPoints(t,s,r,i);break;case"radar":n=this.drawRadar(t,e,i)}this.elements.push(n)}return this.id=this.board.setId(this,"Chart"),this.elements},jxg.A.Chart.prototype=new base_element.A,jxg.A.extend(jxg.A.Chart.prototype,{drawLine:function(t,e,i,s){return s.fillcolor="none",s.highlightfillcolor="none",t.create("curve",[e,i],s)},drawSpline:function(t,e,i,s){return s.fillColor="none",s.highlightfillcolor="none",t.create("spline",[e,i],s)},drawFit:function(t,e,i,s){var r=s.degree;return r=Math.max(parseInt(r,10),1)||1,s.fillcolor="none",s.highlightfillcolor="none",t.create("functiongraph",[numerics.A.regressionPolynomial(r,e,i)],s)},drawBar:function(t,e,i,s){var r,o,n,a,h,l,c,u,d,p,f=[],_=[],g=function(t,i){return function(){return e[t]()-i*n}},A={fixed:!0,withLabel:!1,visible:!1,name:""};if((d=utils_type.A.copyAttributes(s,t.options,"chart"))&&d.width)n=d.width;else{if(e.length<=1)n=1;else for(n=e[1]-e[0],r=1;r<e.length-1;r++)n=e[r+1]-e[r]<n?e[r+1]-e[r]:n;n*=.8}for(p=utils_type.A.copyAttributes(s,t.options,"chart","label"),r=0;r<e.length;r++)utils_type.A.isFunction(e[r])?(a=g(r,-.5),h=g(r,0),l=g(r,.5)):(a=e[r]-.5*n,h=e[r],l=e[r]+.5*n),c=utils_type.A.isFunction(i[r])?i[r]():i[r],c=i[r],"horizontal"===d.dir?(_[0]=t.create("point",[0,a],A),_[1]=t.create("point",[c,a],A),_[2]=t.create("point",[c,l],A),_[3]=t.create("point",[0,l],A),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[r])&&(p.anchorX=function(t){return t.X()>=0?"left":"right"},p.anchorY="middle",o=t.create("text",[c,h,d.labels[r]],p))):(_[0]=t.create("point",[a,0],A),_[1]=t.create("point",[a,c],A),_[2]=t.create("point",[l,c],A),_[3]=t.create("point",[l,0],A),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[r])&&(p.anchorX="middle",p.anchorY=function(t){return t.Y()>=0?"bottom":"top"},o=t.create("text",[h,c,d.labels[r]],p))),utils_type.A.isArray(d.colors)&&(u=d.colors,d.fillcolor=u[r%u.length]),f[r]=t.create("polygon",_,d),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[r])&&(f[r].text=o,f[r].addChild(o));return f},drawPoints:function(t,e,i,s){var r,o=[],n=s.infoboxarray;for(s.fixed=!0,s.name="",r=0;r<e.length;r++)s.infoboxtext=!!n&&n[r%n.length],o[r]=t.create("point",[e[r],i[r]],s);return o},drawPie:function(t,e,i){var s,r,o=[],n=[],a=i.colors,h=i.highlightcolors,l=i.labels,c=i.radius||4,u=c,d=i.center||[0,0],p=d[0],f=d[1],_=function(t,i,s){return function(){var r,o,n,a=0;for(o=0;o<=t;o++)a+=parseFloat(utils_type.A.evaluate(e[o]));for(r=a,o=t+1;o<e.length;o++)r+=parseFloat(utils_type.A.evaluate(e[o]));return n=0!==r?2*Math.PI*a/r:0,u()*Math[i](n)+s}},g=function(t,e){var i=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],s=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];utils_type.A.exists(this.label)&&(this.label.rendNode.style.fontSize=e*this.label.evalVisProp("fontsize")+"px",this.label.fullUpdate()),this.point2.coords=new base_coords.A(constants.A.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+i*t,this.point1.coords.usrCoords[2]+s*t],this.board),this.fullUpdate()},A=function(){this.highlighted||(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this),g.call(this,1.1,2))},m=function(){this.highlighted&&(this.highlighted=!1,this.board.renderer.noHighlight(this),g.call(this,.9090909,1))},b={fixed:!0,withLabel:!1,visible:!1,name:""};if(!utils_type.A.isArray(l))for(l=[],s=0;s<e.length;s++)l[s]="";for(utils_type.A.isFunction(c)||(u=function(){return c}),i.highlightonsector=i.highlightonsector||!1,i.straightfirst=!1,i.straightlast=!1,r=t.create("point",[p,f],b),o[0]=t.create("point",[function(){return u()+p},function(){return f}],b),s=0;s<e.length;s++)o[s+1]=t.create("point",[_(s,"cos",p),_(s,"sin",f)],b),i.name=l[s],i.withlabel=""!==i.name,i.fillcolor=a&&a[s%a.length],i.labelcolor=a&&a[s%a.length],i.highlightfillcolor=h&&h[s%h.length],n[s]=t.create("sector",[r,o[s],o[s+1]],i),i.highlightonsector&&(n[s].hasPoint=n[s].hasPointSector),i.highlightbysize&&(n[s].highlight=A,n[s].noHighlight=m);return{sectors:n,points:o,midpoint:r}},drawRadar:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v,C,P,x,E,O,M,w,S,T,N,j,D,k,R,L,B,I,Y,V,X,U,F,z,J=e.length,G=function(){var t,e,i,s,r=this.evalVisProp("label.offset).slice(0");return t=this.point1.X(),e=this.point2.X(),i=this.point1.Y(),s=this.point2.Y(),e<t&&(r[0]=-r[0]),s<i&&(r[1]=-r[1]),this.setLabelRelativeCoords(r),new base_coords.A(constants.A.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},W=function(e,i){var s,r,o;return s=t.create("transform",[-(A[i]-_[i]),0],{type:"translate"}),r=t.create("transform",[v/(m[i]+g[i]-(A[i]-_[i])),1],{type:"scale"}),s.melt(r),o=t.create("transform",[e],{type:"rotate"}),s.melt(o),s};if(J<=0)throw new Error("JSXGraph radar chart: no data");if(o=i.paramarray,!utils_type.A.exists(o))throw new Error("JSXGraph radar chart: need paramArray attribute");if((n=o.length)<=1)throw new Error("JSXGraph radar chart: need more than one param in paramArray");for(s=0;s<J;s++)if(n!==e[s].length)throw new Error("JSXGraph radar chart: use data length equal to number of params ("+e[s].length+" != "+n+")");for(a=[],h=[],r=0;r<n;r++)a[r]=e[0][r],h[r]=a[r];for(s=1;s<J;s++)for(r=0;r<n;r++)e[s][r]>a[r]&&(a[r]=e[s][r]),e[s][r]<h[r]&&(h[r]=e[s][r]);for(l=[],c=[],s=0;s<J;s++)l[s]="",c[s]=[];for(u=[],d=[],p=i.startshiftratio||0,f=i.endshiftratio||0,s=0;s<n;s++)u[s]=(a[s]-h[s])*p,d[s]=(a[s]-h[s])*f;if(_=i.startshiftarray||u,g=i.endshiftarray||d,A=i.startarray||h,utils_type.A.exists(i.start))for(s=0;s<n;s++)A[s]=i.start;if(m=i.endarray||a,utils_type.A.exists(i.end))for(s=0;s<n;s++)m[s]=i.end;if(_.length!==n)throw new Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(g.length!==n)throw new Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(A.length!==n)throw new Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(m.length!==n)throw new Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(b=i.labelarray||l,y=i.colors,v=i.radius||10,F=i.strokewidth||1,utils_type.A.exists(i.highlightonsector)||(i.highlightonsector=!1),C={name:i.name,id:i.id,strokewidth:F,polystrokewidth:i.polystrokewidth||F,strokecolor:i.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:i.fillColor||"#FFFF88",fillopacity:i.fillOpacity||.4,highlightfillcolor:i.highlightFillColor||"#FF7400",highlightstrokecolor:i.highlightStrokeColor||"black",gradient:i.gradient||"none"},x=(P=i.center||[0,0])[0],E=P[1],O=t.create("point",[x,E],{name:"",fixed:!0,withlabel:!1,visible:!1}),Math.PI/2-Math.PI/n,w=M=i.startangle||0,S=[],T=[],s=0;s<n;s++)for(w+=2*Math.PI/n,j=v*Math.cos(w)+x,D=v*Math.sin(w)+E,S[s]=t.create("point",[j,D],{name:"",fixed:!0,withlabel:!1,visible:!1}),T[s]=t.create("line",[O,S[s]],{name:o[s],strokeColor:C.strokecolor,strokeWidth:C.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:C.highlightstrokecolor}),T[s].getLabelAnchor=G,N=W(w,s),r=0;r<e.length;r++)z=e[r][s],c[r][s]=t.create("point",[z,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),c[r][s].addTransform(c[r][s],N);for(k=[],s=0;s<J;s++)for(C.labelcolor=y&&y[s%y.length],C.strokecolor=y&&y[s%y.length],C.fillcolor=y&&y[s%y.length],k[s]=t.create("polygon",c[s],{withLines:!0,withLabel:!1,fillColor:C.fillcolor,fillOpacity:C.fillopacity,highlightFillColor:C.highlightfillcolor}),r=0;r<n;r++)k[s].borders[r].setAttribute("strokecolor:"+y[s%y.length]),k[s].borders[r].setAttribute("strokewidth:"+C.polystrokewidth);switch(i.legendposition||"none"){case"right":L=i.legendleftoffset||2,B=i.legendtopoffset||1,this.legend=t.create("legend",[x+v+L,E+v-B],{labels:b,colors:y});break;case"none":break;default:jxg.A.debug("Unknown legend position")}if(R=[],i.showcircles){for(I=[],s=0;s<6;s++)I[s]=20*s;if(I[0]="0",(V=(Y=i.circlelabelarray||I).length)<2)throw new Error("JSXGraph radar chart: too less circles in circleLabelArray");for(X=[],N=W(M+Math.PI/n,0),C.fillcolor="none",C.highlightfillcolor="none",C.strokecolor=i.strokecolor||"black",C.strokewidth=i.circlestrokewidth||.5,C.layer=0,U=(m[0]-A[0])/(V-1),s=0;s<V;s++)X[s]=t.create("point",[A[0]+s*U,0],{name:Y[s],size:0,fixed:!0,withLabel:!0,visible:!0}),X[s].addTransform(X[s],N),R[s]=t.create("circle",[O,X[s]],C)}return this.rendNode=k[0].rendNode,{circles:R,lines:T,points:c,midpoint:O,polygons:k}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){return this}}),jxg.A.createChart=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b=[],y=env.A.isBrowser?t.document.getElementById(e[0]):null;if(1===e.length&&utils_type.A.isString(e[0])){if(utils_type.A.exists(y)){if(u=utils_type.A.copyAttributes(i,t.options,"chart"),s=(y=(new datasource).loadFromTable(e[0],u.withheaders,u.withheaders)).data,a=y.columnHeaders,r=y.rowHeaders,d=u.width,p=u.name,f=u.strokecolor,_=u.fillcolor,g=u.highlightstrokecolor,A=u.highlightfillcolor,t.suspendUpdate(),m=s.length,c=[],u.rows&&utils_type.A.isArray(u.rows)){for(o=0;o<m;o++)for(n=0;n<u.rows.length;n++)if(u.rows[n]===o||u.withheaders&&u.rows[n]===r[o]){c.push(s[o]);break}}else c=s;for(m=c.length,o=0;o<m;o++){if(l=[],u.chartstyle&&-1!==u.chartstyle.indexOf("bar")){for(h=d||.8,l.push(1-h/2+(o+.5)*h/m),n=1;n<c[o].length;n++)l.push(l[n-1]+1);u.width=h/m}p&&p.length===m?u.name=p[o]:u.withheaders&&(u.name=a[o]),f&&f.length===m?u.strokecolor=f[o]:u.strokecolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,.6),_&&_.length===m?u.fillcolor=_[o]:u.fillcolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,1),g&&g.length===m?u.highlightstrokecolor=g[o]:u.highlightstrokecolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,1),A&&A.length===m?u.highlightfillcolor=A[o]:u.highlightfillcolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,.6),u.chartstyle&&-1!==u.chartstyle.indexOf("bar")?b.push(new jxg.A.Chart(t,[l,c[o]],u)):b.push(new jxg.A.Chart(t,[c[o]],u))}t.unsuspendUpdate()}return b}return u=utils_type.A.copyAttributes(i,t.options,"chart"),new jxg.A.Chart(t,e,u)},jxg.A.registerElement("chart",jxg.A.createChart),jxg.A.Legend=function(t,e,i){var s;if(this.constructor(),s=utils_type.A.copyAttributes(i,t.options,"legend"),this.board=t,this.coords=new base_coords.A(constants.A.COORDS_BY_USER,e,this.board),this.myAtts={},this.label_array=s.labelarray||s.labels,this.color_array=s.colorarray||s.colors,this.opacy_array=s.strokeopacity||[1],this.lines=[],this.myAtts.strokewidth=s.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.myAtts.fixed=!0,this.myAtts.frozen=s.frozen||!1,this.style=s.legendstyle||s.style,"vertical"!==this.style)throw new Error("JSXGraph: Unknown legend style: "+this.style);this.drawVerticalLegend(t,s),this.id=this.board.setId(this,"Leg")},jxg.A.Legend.prototype=new base_element.A,jxg.A.Legend.prototype.drawVerticalLegend=function(t,e){var i,s=e.linelength||1,r=(e.rowheight||20)/this.board.unitY,o=function(){return this.setLabelRelativeCoords(this.visProp.label.offset),new base_coords.A(constants.A.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)};for(i=0;i<this.label_array.length;i++)this.myAtts.name=this.label_array[i],this.myAtts.strokecolor=this.color_array[i%this.color_array.length],this.myAtts.highlightstrokecolor=this.color_array[i%this.color_array.length],this.myAtts.strokeopacity=this.opacy_array[i%this.opacy_array.length],this.myAtts.highlightstrokeopacity=this.opacy_array[i%this.opacy_array.length],this.myAtts.label={offset:[10,0],strokeColor:this.color_array[i%this.color_array.length],strokeWidth:this.myAtts.strokewidth},this.lines[i]=t.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-i*r],[this.coords.usrCoords[1]+s,this.coords.usrCoords[2]-i*r]],this.myAtts),this.myAtts.frozen&&this.lines[i].setAttribute({point1:{frozen:!0},point2:{frozen:!0}}),this.lines[i].getLabelAnchor=o,this.lines[i].prepareUpdate().update().updateVisibility(this.lines[i].evalVisProp("visible")).updateRenderer(),this.addChild(this.lines[i])},jxg.A.createLegend=function(t,e,i){var s=[0,0];if(!utils_type.A.exists(e)||2!==e.length)throw new Error("JSXGraph: Legend element needs two numbers as parameters");return s=e,new jxg.A.Legend(t,s,i)},jxg.A.registerElement("legend",jxg.A.createLegend);var chart={Chart:jxg.A.Chart,Legend:jxg.A.Legend};jxg.A.Transformation=function(t,e,i,s){this.elementClass=constants.A.OBJECT_CLASS_OTHER,this.type=constants.A.OBJECT_TYPE_TRANSFORMATION,s?(this.is3D=!0,this.matrix=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]):(this.is3D=!1,this.matrix=[[1,0,0],[0,1,0],[0,0,1]]),this.board=t,this.isNumericMatrix=!1,this.is3D?this.setMatrix3D(i[0],e,i.slice(1)):this.setMatrix(t,e,i),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bindTo",melt:"melt",meltTo:"meltTo"}},jxg.A.Transformation.prototype={},jxg.A.extend(jxg.A.Transformation.prototype,{update:function(){return this},setMatrix:function(t,e,i){var s;for(this.isNumericMatrix=!0,s=0;s<i.length;s++)if("number"!=typeof i[s]){this.isNumericMatrix=!1;break}if("translate"===e){if(2!==i.length)throw new Error("JSXGraph: translate transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1)}}else if("scale"===e){if(2!==i.length)throw new Error("JSXGraph: scale transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[2][2]=this.evalParam(1)}}else if("reflect"===e)i.length<4&&(i[0]=t.select(i[0])),2===i.length&&(i[1]=t.select(i[1])),4===i.length&&(this.evalParam=utils_type.A.createEvalFunction(t,i,4)),this.update=function(){var t,e,s,r,o,n,a,h;1===i.length?a=i[0].stdform:2===i.length?a=math.A.crossProduct(i[1].coords.usrCoords,i[0].coords.usrCoords):4===i.length&&(a=math.A.crossProduct([1,this.evalParam(2),this.evalParam(3)],[1,this.evalParam(0),this.evalParam(1)])),t=a[1],e=a[2],n=(h=[-(s=a[0])*t,-s*e,t*t+e*e])[2],r=h[0]/h[2],o=h[1]/h[2],t=-a[2],e=a[1],this.matrix[1][1]=(t*t-e*e)/n,this.matrix[1][2]=2*t*e/n,this.matrix[2][1]=this.matrix[1][2],this.matrix[2][2]=-this.matrix[1][1],this.matrix[1][0]=r*(1-this.matrix[1][1])-o*this.matrix[1][2],this.matrix[2][0]=o*(1-this.matrix[2][2])-r*this.matrix[2][1]};else if("rotate"===e)3===i.length?this.evalParam=utils_type.A.createEvalFunction(t,i,3):i.length>0&&i.length<=2&&(this.evalParam=utils_type.A.createEvalFunction(t,i,1),2!==i.length||utils_type.A.isArray(i[1])||(i[1]=t.select(i[1]))),this.update=function(){var t,e,s=this.evalParam(0),r=Math.cos(s),o=Math.sin(s);this.matrix[1][1]=r,this.matrix[1][2]=-o,this.matrix[2][1]=o,this.matrix[2][2]=r,i.length>1&&(3===i.length?(t=this.evalParam(1),e=this.evalParam(2)):utils_type.A.isArray(i[1])?(t=i[1][0],e=i[1][1]):(t=i[1].X(),e=i[1].Y()),this.matrix[1][0]=t*(1-r)+e*o,this.matrix[2][0]=e*(1-r)-t*o)};else if("shear"===e){if(2!==i.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("generic"===e){if(9!==i.length)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,i,9),this.update=function(){this.matrix[0][0]=this.evalParam(0),this.matrix[0][1]=this.evalParam(1),this.matrix[0][2]=this.evalParam(2),this.matrix[1][0]=this.evalParam(3),this.matrix[1][1]=this.evalParam(4),this.matrix[1][2]=this.evalParam(5),this.matrix[2][0]=this.evalParam(6),this.matrix[2][1]=this.evalParam(7),this.matrix[2][2]=this.evalParam(8)}}else if("matrix"===e){if(1!==i.length)throw new Error("JSXGraph: transformation of type 'matrix' needs 1 parameter.");this.evalParam=i[0].slice(),this.update=function(){var t,e;for(t=0;t<3;t++)for(e=0;e<3;e++)this.matrix[t][e]=utils_type.A.evaluate(this.evalParam[t][e])}}},setMatrix3D:function(t,e,i){var s,r=t.board;for(this.isNumericMatrix=!0,s=0;s<i.length;s++)if("number"!=typeof i[s]){this.isNumericMatrix=!1;break}if("translate"===e){if(3!==i.length)throw new Error("JSXGraph: 3D translate transformation needs 3 parameters.");this.evalParam=utils_type.A.createEvalFunction(r,i,3),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1),this.matrix[3][0]=this.evalParam(2)}}else if("scale"===e){if(3!==i.length&&4!==i.length)throw new Error("JSXGraph: 3D scale transformation needs either 3 or 4 parameters.");this.evalParam=utils_type.A.createEvalFunction(r,i,3),this.update=function(){var t=this.evalParam(0),e=this.evalParam(1),i=this.evalParam(2);this.matrix[1][1]=t,this.matrix[2][2]=e,this.matrix[3][3]=i}}else if("rotateX"===e)i.splice(1,0,[1,0,0]),this.setMatrix3D(t,"rotate",i);else if("rotateY"===e)i.splice(1,0,[0,1,0]),this.setMatrix3D(t,"rotate",i);else if("rotateZ"===e)i.splice(1,0,[0,0,1]),this.setMatrix3D(t,"rotate",i);else if("rotate"===e){if(i.length<2)throw new Error("JSXGraph: 3D rotate transformation needs 2 or 3 parameters.");3!==i.length||utils_type.A.isFunction(i[2])||utils_type.A.isArray(i[2])?this.evalParam=utils_type.A.createEvalFunction(r,i,i.length):(this.evalParam=utils_type.A.createEvalFunction(r,i,2),i[2]=t.select(i[2])),this.update=function(){var t,e,s,r=this.evalParam(0),o=this.evalParam(1),n=[1,0,0,0],a=Math.cos(r),h=Math.sin(r),l=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],c=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],u=math.A.norm(o);3===o.length?(t=o[0]/u,e=o[1]/u,s=o[2]/u):(t=o[1]/u,e=o[2]/u,s=o[3]/u),3===i.length&&(3===(n=3===i.length&&utils_type.A.exists(i[2].is3D)?i[2].coords.slice():this.evalParam(2)).length&&n.unshift(1),l[1][0]=-n[1],l[2][0]=-n[2],l[3][0]=-n[3],c[1][0]=n[1],c[2][0]=n[2],c[3][0]=n[3]),this.matrix=[[1,0,0,0],[0,t*t*(1-a)+a,t*e*(1-a)-s*h,t*s*(1-a)+e*h],[0,e*t*(1-a)+s*h,e*e*(1-a)+a,e*s*(1-a)-t*h],[0,s*t*(1-a)-e*h,s*e*(1-a)+t*h,s*s*(1-a)+a]],this.matrix=math.A.matMatMult(this.matrix,l),this.matrix=math.A.matMatMult(c,this.matrix)}}},apply:function(t,e){var i;return this.update(),i=this.is3D?t.coords:utils_type.A.exists(e)?t.initialCoords.usrCoords:t.coords.usrCoords,math.A.matVecMult(this.matrix,i)},applyOnce:function(t){var e,i,s;for(utils_type.A.isArray(t)||(t=[t]),i=t.length,s=0;s<i;s++)this.update(),this.is3D?t[s].coords=math.A.matVecMult(this.matrix,t[s].coords):(e=math.A.matVecMult(this.matrix,t[s].coords.usrCoords),t[s].coords.setCoordinates(constants.A.COORDS_BY_USER,e))},bindTo:function(t){var e,i;if(utils_type.A.isArray(t))for(i=t.length,e=0;e<i;e++)t[e].transformations.push(this);else t.transformations.push(this)},meltTo:function(t){var e,i,s;if(utils_type.A.isArray(t))for(e=0;e<t.length;e++)this.meltTo(t[e]);else(i=t.transformations).length>0&&i[i.length-1].isNumericMatrix&&this.isNumericMatrix?i[i.length-1].melt(this):(s=this.clone(),i.push(s))},clone:function(){var t=null;return this.isNumericMatrix&&((t=new jxg.A.Transformation(this.board,"none",[])).matrix=this.matrix.slice()),t},setProperty:function(t){jxg.A.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){var e;return this.update(),t.update(),e=math.A.matMatMult(t.matrix,this.matrix),this.update=function(){this.matrix=e},this},getParents:function(){var t=[[].concat.apply([],this.matrix)];return 0!==this.parents.length&&(t=this.parents),t}}),jxg.A.createTransform=function(t,e,i){return new jxg.A.Transformation(t,i.type,e)},jxg.A.registerElement("transform",jxg.A.createTransform),jxg.A.createTransform3D=function(t,e,i){return new jxg.A.Transformation(t,i.type,e,!0)},jxg.A.registerElement("transform3d",jxg.A.createTransform3D);var transformation=jxg.A.Transformation;jxg.A.Turtle=function(t,e,i){var s,r,o;return this.constructor(t,i,constants.A.OBJECT_TYPE_TURTLE,constants.A.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=t,this.visProp.curveType="plot",this._attributes=utils_type.A.copyAttributes(this.visProp,t.options,"turtle"),delete this._attributes.id,s=0,r=0,o=90,0!==e.length&&(3===e.length?(s=e[0],r=e[1],o=e[2]):2===e.length?utils_type.A.isArray(e[0])?(s=e[0][0],r=e[0][1],o=e[1]):(s=e[0],r=e[1]):(s=e[0][0],r=e[0][1])),this.init(s,r,o),this.methodMap=utils_type.A.deepCopy(this.methodMap,{forward:"forward",fd:"forward",back:"back",bk:"back",right:"right",rt:"right",left:"left",lt:"left",penUp:"penUp",pu:"penUp",up:"penUp",penDown:"penDown",pd:"penDown",down:"penDown",clearScreen:"clearScreen",cs:"clearScreen",clean:"clean",setPos:"setPos",home:"home",hideTurtle:"hideTurtle",ht:"hideTurtle",hide:"hideTurtle",showTurtle:"showTurtle",st:"showTurtle",show:"showTurtle",penSize:"setPenSize",setPenSize:"setPenSize",penColor:"setPenColor",setPenColor:"setPenColor",highlightPenColor:"setHighlightPenColor",setHighlightPenColor:"setHighlightPenColor",getPenColor:"getPenColor",Color:"getPenColor",getHighlightPenColor:"getHighlightPenColor",HighlightColor:"getHighlightPenColor",getPenSize:"getPenSize",Size:"getPenSize",pushTurtle:"pushTurtle",push:"pushTurtle",popTurtle:"popTurtle",pop:"popTurtle",lookTo:"lookTo",pos:"pos",Pos:"pos",moveTo:"moveTo",X:"X",Y:"Y"}),this},jxg.A.Turtle.prototype=new base_element.A,jxg.A.extend(jxg.A.Turtle.prototype,{init:function(t,e,i){var s={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/math.A.hypot(this.board.unitX,this.board.unitY),this.pos=[t,e],this.isPenDown=!0,this.dir=90,this.stack=[],this.objects=[],this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.turtle=this.board.create("point",this.pos,s),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],s),this.objects.push(this.turtle2),this.visProp.arrow.lastArrow=!0,this.visProp.arrow.straightFirst=!1,this.visProp.arrow.straightLast=!1,this.arrow=this.board.create("line",[this.turtle,this.turtle2],this.visProp.arrow),this.objects.push(this.arrow),this.subs={arrow:this.arrow},this.inherits.push(this.arrow),this.right(90-i),this.board.update()},forward:function(t){if(0===t)return this;var e,i=t*Math.cos(this.dir*Math.PI/180),s=t*Math.sin(this.dir*Math.PI/180);return this.turtleIsHidden||((e=this.board.create("transform",[i,s],{type:"translate"})).applyOnce(this.turtle),e.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]+=i,this.pos[1]+=s,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(t){return this.forward(-t)},right:function(t){(this.dir-=t,this.dir%=360,this.turtleIsHidden)||this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2);return this.board.update(),this},left:function(t){return this.right(-t)},penUp:function(){return this.isPenDown=!1,this},penDown:function(){return this.isPenDown=!0,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this},clean:function(){var t,e;for(t=0;t<this.objects.length;t++)(e=this.objects[t]).type===constants.A.OBJECT_TYPE_CURVE&&(this.board.removeObject(e),this.objects.splice(t,1));return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},clearScreen:function(){return this.board.removeObject(this.objects),this.objects=[],this.init(0,0,90),this},setPos:function(t,e){return utils_type.A.isArray(t)?this.pos=t:this.pos=[t,e],this.turtleIsHidden||(this.turtle.setPositionDirectly(constants.A.COORDS_BY_USER,[t,e]),this.turtle2.setPositionDirectly(constants.A.COORDS_BY_USER,[t,e+this.arrowLen]),this.board.create("transform",[-(this.dir-90)*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2)),this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},setPenSize:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeWidth",t)),this.objects.push(this.curve),this},setPenColor:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeColor",t)),this.objects.push(this.curve),this},getPenAttribute:function(t){var e,i=this.objects.length;return e=4===i?0:i-1,this.objects[e].evalVisProp(t)},getPenSize:function(){return this.getPenAttribute("strokewidth")},getPenColor:function(){return this.getPenAttribute("strokecolor")},getHighlightPenColor:function(){return this.getPenAttribute("highlightstrokecolor")},setHighlightPenColor:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("highlightStrokeColor",t)),this.objects.push(this.curve),this},setAttribute:function(t){var e,i,s,r=this.objects.length;for(e=0;e<r;e++)(i=this.objects[e]).type===constants.A.OBJECT_TYPE_CURVE&&i.setAttribute(t);return s=this.visProp.id,this.visProp=utils_type.A.deepCopy(this.curve.visProp),this.visProp.id=s,this._attributes=utils_type.A.deepCopy(this.visProp),delete this._attributes.id,this},copyAttr:function(t,e){return this._attributes[t.toLowerCase()]=e,this._attributes},showTurtle:function(){return this.turtleIsHidden=!1,this.arrow.setAttribute({visible:!0}),this.visProp.arrow.visible=!1,this.setPos(this.pos[0],this.pos[1]),this.board.update(),this},hideTurtle:function(){return this.turtleIsHidden=!0,this.arrow.setAttribute({visible:!1}),this.visProp.arrow.visible=!1,this.board.update(),this},home:function(){return this.pos=[0,0],this.setPos(this.pos[0],this.pos[1]),this},pushTurtle:function(){return this.stack.push([this.pos[0],this.pos[1],this.dir]),this},popTurtle:function(){var t=this.stack.pop();return this.pos[0]=t[0],this.pos[1]=t[1],this.dir=t[2],this.setPos(this.pos[0],this.pos[1]),this},lookTo:function(t){var e,i,s,r,o;return utils_type.A.isArray(t)?(e=this.pos[0],i=this.pos[1],s=t[0],r=t[1],o=Math.atan2(r-i,s-e),this.right(this.dir-180*o/Math.PI)):utils_type.A.isNumber(t)&&this.right(this.dir-t),this},moveTo:function(t){var e,i,s;return utils_type.A.isArray(t)&&(e=t[0]-this.pos[0],i=t[1]-this.pos[1],this.turtleIsHidden||((s=this.board.create("transform",[e,i],{type:"translate"})).applyOnce(this.turtle),s.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]=t[0],this.pos[1]=t[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()),this},fd:function(t){return this.forward(t)},bk:function(t){return this.back(t)},lt:function(t){return this.left(t)},rt:function(t){return this.right(t)},pu:function(){return this.penUp()},pd:function(){return this.penDown()},ht:function(){return this.hideTurtle()},st:function(){return this.showTurtle()},cs:function(){return this.clearScreen()},push:function(){return this.pushTurtle()},pop:function(){return this.popTurtle()},evalAt:function(t,e){var i,s,r,o,n=this.objects.length;for(i=0,s=0;i<n;i++)if((r=this.objects[i]).elementClass===constants.A.OBJECT_CLASS_CURVE){if(s<=t&&t<s+r.numberPoints)return o=t-s,r[e](o);s+=r.numberPoints}return this[e]()},X:function(t){return utils_type.A.exists(t)?this.evalAt(t,"X"):this.pos[0]},Y:function(t){return utils_type.A.exists(t)?this.evalAt(t,"Y"):this.pos[1]},Z:function(t){return 1},minX:function(){return 0},maxX:function(){var t,e=this.objects.length,i=0;for(t=0;t<e;t++)this.objects[t].elementClass===constants.A.OBJECT_CLASS_CURVE&&(i+=this.objects[t].numberPoints);return i},hasPoint:function(t,e){var i,s;for(i=0;i<this.objects.length;i++)if((s=this.objects[i]).type===constants.A.OBJECT_TYPE_CURVE&&s.hasPoint(t,e))return!0;return!1}}),jxg.A.createTurtle=function(t,e,i){var s;return e=e||[],s=utils_type.A.copyAttributes(i,t.options,"turtle"),new jxg.A.Turtle(t,e,s)},jxg.A.registerElement("turtle",jxg.A.createTurtle);var turtle=jxg.A.Turtle;jxg.A.Ticks=function(t,e,i){if(this.constructor(t.board,i,constants.A.OBJECT_TYPE_TICKS,constants.A.OBJECT_CLASS_OTHER),this.line=t,this.board=this.line.board,this.fixedTicks=null,this.equidistant=!1,this.labelsData=[],utils_type.A.isFunction(e))throw this.ticksFunction=e,new Error("Function arguments are no longer supported.");utils_type.A.isArray(e)?this.fixedTicks=e:this.equidistant=!0,this.ticks=[],this.labels=[],this.labelCounter=0,this.id=this.line.addTicks(this),this.elType="ticks",this.inherits.push(this.labels),this.board.setId(this,"Ti")},jxg.A.Ticks.prototype=new base_element.A,jxg.A.extend(jxg.A.Ticks.prototype,{hasPoint:function(t,e){var i,s,r,o,n=this.ticks&&this.ticks.length||0;if(!this.line.evalVisProp("scalable")||this.line.elementClass===constants.A.OBJECT_CLASS_CURVE)return!1;if(utils_type.A.isObject(this.evalVisProp("precision"))?(o=this.board._inputDevice,r=this.evalVisProp("precision."+o)):r=this.board.options.precision.hasPoint,r+=.5*this.evalVisProp("strokewidth"),0!==this.line.stdform[1]&&0!==this.line.stdform[2]&&this.line.type!==constants.A.OBJECT_TYPE_AXIS)return!1;for(i=0;i<n;i++)if((s=this.ticks[i])[2]&&!(0===this.line.stdform[1]&&Math.abs(s[0][0]-this.line.point1.coords.scrCoords[1])<math.A.eps||0===this.line.stdform[2]&&Math.abs(s[1][0]-this.line.point1.coords.scrCoords[2])<math.A.eps)&&(Math.abs(s[0][0]-s[0][1])>=1||Math.abs(s[1][0]-s[1][1])>=1))if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*r&&s[0][0]-r<t&&t<s[0][1]+r)return!0}else if(0===this.line.stdform[2]&&Math.abs(t-this.line.point1.coords.scrCoords[1])<2*r&&s[1][0]-r<e&&e<s[1][1]+r)return!0;return!1},setPositionDirectly:function(t,e,i){var s,r,o=new base_coords.A(t,e,this.board),n=new base_coords.A(t,i,this.board),a=this.board.getBoundingBox();return this.line.type===constants.A.OBJECT_TYPE_AXIS&&this.line.evalVisProp("scalable")?(Math.abs(this.line.stdform[1])<math.A.eps&&Math.abs(o.usrCoords[1]*n.usrCoords[1])>math.A.eps?(s=n.usrCoords[1]/o.usrCoords[1],a[0]*=s,a[2]*=s,this.board.setBoundingBox(a,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])<math.A.eps&&Math.abs(o.usrCoords[2]*n.usrCoords[2])>math.A.eps&&(r=n.usrCoords[2]/o.usrCoords[2],a[3]*=r,a[1]*=r,this.board.setBoundingBox(a,this.board.keepaspectratio,"update")),this):this},calculateTicksCoordinates:function(){var t,e,i,s;if(!(this.line.elementClass===constants.A.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)<math.A.eps&&Math.abs(this.dy)<math.A.eps)))return t=this.getZeroCoordinates(),e=this.line.elementClass===constants.A.OBJECT_CLASS_LINE?this.getLowerAndUpperBounds(t,"ticksdistance"):{lower:this.line.minX(),upper:this.line.maxX(),a1:0,a2:0,m1:0,m2:0},"polar"===this.evalVisProp("type")&&(s=this.board.getBoundingBox(),i=Math.max(math.A.hypot(s[0],s[1]),math.A.hypot(s[2],s[3])),e.upper=i),this.ticks=[],this.labelsData=[],this.equidistant?this.generateEquidistantTicks(t,e):this.generateFixedTicks(t,e),this},setTicksSizeVariables:function(t){var e,i,s,r,o=.5*this.evalVisProp("majorheight"),n=.5*this.evalVisProp("minorheight");utils_type.A.exists(t)?(i=this.line.minX(),s=this.line.maxX(),(r=this.line.points.length)<2?(this.dxMaj=0,this.dyMaj=0):math.A.relDif(t,i)<math.A.eps?(this.dxMaj=this.line.points[0].usrCoords[2]-this.line.points[1].usrCoords[2],this.dyMaj=this.line.points[1].usrCoords[1]-this.line.points[0].usrCoords[1]):math.A.relDif(t,s)<math.A.eps?(this.dxMaj=this.line.points[r-2].usrCoords[2]-this.line.points[r-1].usrCoords[2],this.dyMaj=this.line.points[r-1].usrCoords[1]-this.line.points[r-2].usrCoords[1]):(this.dxMaj=-numerics.A.D(this.line.Y)(t),this.dyMaj=numerics.A.D(this.line.X)(t))):(this.dxMaj=this.line.stdform[1],this.dyMaj=this.line.stdform[2]),this.dxMin=this.dxMaj,this.dyMin=this.dyMaj,this.dx=this.dxMaj,this.dy=this.dyMaj,e=math.A.hypot(this.dxMaj*this.board.unitX,this.dyMaj*this.board.unitY),this.dxMaj*=o/e*this.board.unitX,this.dyMaj*=o/e*this.board.unitY,this.dxMin*=n/e*this.board.unitX,this.dyMin*=n/e*this.board.unitY,this.minStyle=this.evalVisProp("minorheight")<0?"infinite":"finite",this.majStyle=this.evalVisProp("majorheight")<0?"infinite":"finite"},getZeroCoordinates:function(){var t,e,i,s,r,o,n,a,h=this.evalVisProp("anchor");return this.line.elementClass===constants.A.OBJECT_CLASS_LINE?this.line.type===constants.A.OBJECT_TYPE_AXIS?geometry.A.projectPointToLine({coords:{usrCoords:[1,0,0]}},this.line,this.board):(i=this.line.point1.coords.usrCoords[0],t=this.line.point1.coords.usrCoords[1],e=this.line.point1.coords.usrCoords[2],o=this.line.point2.coords.usrCoords[0],s=this.line.point2.coords.usrCoords[1],r=this.line.point2.coords.usrCoords[2],"right"===h?this.line.point2.coords:"middle"===h?new base_coords.A(constants.A.COORDS_BY_USER,[.5*(i+o),.5*(t+s),.5*(e+r)],this.board):utils_type.A.isNumber(h)?new base_coords.A(constants.A.COORDS_BY_USER,[i+(o-i)*h,t+(s-t)*h,e+(r-e)*h],this.board):this.line.point1.coords):(n=this.line.minX(),a=this.line.maxX(),"right"===h?a:"middle"===h?.5*(n+a):utils_type.A.isNumber(h)?n*(1-h)+a*h:n)},getLowerAndUpperBounds:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A=10*math.A.eps,m=this.line.evalVisProp("straightfirst"),b=this.line.evalVisProp("straightlast"),y=this.evalVisProp("includeboundaries");return this.line.elementClass===constants.A.OBJECT_CLASS_CURVE?{lower:this.line.minX(),upper:this.line.maxX()}:(n=new base_coords.A(constants.A.COORDS_BY_USER,this.line.point1.coords.usrCoords,this.board),a=new base_coords.A(constants.A.COORDS_BY_USER,this.line.point2.coords.usrCoords,this.board),h=Math.abs(n.usrCoords[0])>=math.A.eps&&n.scrCoords[1]>=0&&n.scrCoords[1]<=this.board.canvasWidth&&n.scrCoords[2]>=0&&n.scrCoords[2]<=this.board.canvasHeight,l=Math.abs(a.usrCoords[0])>=math.A.eps&&a.scrCoords[1]>=0&&a.scrCoords[1]<=this.board.canvasWidth&&a.scrCoords[2]>=0&&a.scrCoords[2]<=this.board.canvasHeight,utils_type.A.exists(e)&&"ticksdistance"===e?(geometry.A.calcStraight(this.line,n,a,0),_=this.getDistanceFromZero(t,n),g=this.getDistanceFromZero(t,a),geometry.A.calcStraight(this.line,n,a,this.line.evalVisProp("margin")),_=this.getDistanceFromZero(t,n)-_,g=this.getDistanceFromZero(t,a).m2):geometry.A.calcLineDelimitingPoints(this.line,n,a),r=this.line.evalVisProp("firstarrow"),o=this.line.evalVisProp("lastarrow"),p=this.getDistanceFromZero(t,n),f=this.getDistanceFromZero(t,a),(r||o)&&(d=this.board.renderer.getArrowHeadData(this.line,this.line.evalVisProp("strokewidth"),""),this.board.renderer.getPositionArrowHead(this.line,n,a,d)),(c=this.getDistanceFromZero(t,n))<(u=this.getDistanceFromZero(t,a))?(i=c,s=u,m||!h||y||(i+=A),b||!l||y||(s-=A)):u<c?(i=u,s=c,b||!l||y||(i+=A),m||!h||y||(s-=A)):(i=0,s=0),{lower:i,upper:s,a1:p=c-p,a2:f=c-f,m1:_,m2:g})},getDistanceFromZero:function(t,e){var i,s,r,o,n;return i=this.line.point1.coords,s=this.line.point2.coords,n=t.distance(constants.A.COORDS_BY_USER,e),r=[s.usrCoords[0]-i.usrCoords[0],s.usrCoords[1]-i.usrCoords[1],s.usrCoords[2]-i.usrCoords[2]],o=[e.usrCoords[0]-t.usrCoords[0],e.usrCoords[1]-t.usrCoords[1],e.usrCoords[2]-t.usrCoords[2]],math.A.innerProduct(r,o,3)<0&&(n*=-1),n},generateEquidistantTicks:function(t,e){var i,s,r,o=math.A.eps,n=this.evalVisProp("minorticks");if(r=this.getDistanceMajorTicks(),this.line.elementClass===constants.A.OBJECT_CLASS_LINE&&(s=this.getXandYdeltas()),r*=this.evalVisProp("scale"),r/=n+1,this.ticksDelta=r,!(r<math.A.eps))if(Math.abs(e.upper-e.lower)>2048*r)jxg.A.warn("JSXGraph ticks: too many ticks (>2048). Please increase ticksDistance.");else{for(i=0,this.evalVisProp("drawzero")||(i=r),i<e.lower&&(i=Math.floor((e.lower-o)/r)*r);i<=e.upper+o&&(i>=e.lower-o&&this.processTickPosition(t,i,r,s),i+=r,!(e.upper-i>1e4*r)););for((i=-r)>e.upper&&(i=Math.ceil((e.upper+o)/-r)*-r);i>=e.lower-o&&(i<=e.upper+o&&this.processTickPosition(t,i,r,s),!((i-=r)-e.lower>1e4*r)););}},getDistanceMajorTicks:function(){var t,e,i,s,r,o,n,a;return this.evalVisProp("insertticks")?(o=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/6/(r=this.evalVisProp("scale")),n=this.evalVisProp("minticksdistance")/r,a=this.evalVisProp("minorticks"),(s=this.getXandYdeltas()).x*=this.board.unitX,s.y*=this.board.unitY,n/=math.A.hypot(s.x,s.y),n*=a+1,2*(t=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)))>=n?t*=2:5*t>=n&&(t*=5),5*(e=Math.pow(10,Math.floor(Math.log(o)/Math.LN10)))<o?e*=5:2*e<o&&(e*=2),t=Math.max(t,e)):this.evalVisProp("ticksdistance")},processTickPosition:function(t,e,i,s){var r,o,n,a,h,l,c=this.evalVisProp("ticksperlabel"),u=null;this.line.elementClass===constants.A.OBJECT_CLASS_LINE?(r=t.usrCoords[1]+e*s.x,o=t.usrCoords[2]+e*s.y):(r=this.line.X(t+e),o=this.line.Y(t+e)),n=new base_coords.A(constants.A.COORDS_BY_USER,[r,o],this.board),this.line.elementClass===constants.A.OBJECT_CLASS_CURVE&&(u=t+e,this.setTicksSizeVariables(u)),h=this.evalVisProp("minorticks"),n.major=Math.round(e/i)%(h+1)===0,c||(c=h+1),l=Math.round(e/i)%c===0,3===(a=this.createTickPath(n,n.major)).length&&(this.ticks.push(a),l&&this.evalVisProp("drawlabels")?this.labelsData.push(this.generateLabelData(this.generateLabelText(n,t,u),n,this.ticks.length)):this.labelsData.push(null))},generateFixedTicks:function(t,e){var i,s,r,o,n,a,h,l,c=math.A.eps,u=utils_type.A.isArray(this.visProp.labels),d=this.evalVisProp("drawlabels");for(this.line.elementClass===constants.A.OBJECT_CLASS_LINE&&(l=this.getXandYdeltas()),r=0;r<this.fixedTicks.length;r++)this.line.elementClass===constants.A.OBJECT_CLASS_LINE?(h=this.fixedTicks[r],n=t.usrCoords[1]+h*l.x,a=t.usrCoords[2]+h*l.y):(h=t+this.fixedTicks[r],n=this.line.X(h),a=this.line.Y(h)),i=new base_coords.A(constants.A.COORDS_BY_USER,[n,a],this.board),this.line.elementClass===constants.A.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(h),3===(o=this.createTickPath(i,!0)).length&&h>=e.lower-c&&h<=e.upper+c&&(this.ticks.push(o),d&&(u||utils_type.A.exists(this.visProp.labels[r]))?(s=u?this.evalVisProp("labels."+r):h,this.labelsData.push(this.generateLabelData(this.generateLabelText(i,t,s),i,r))):this.labelsData.push(null))},getXandYdeltas:function(){var t,e,i=this.line.point1.Dist(this.line.point2);return t=this.line.point1.coords.usrCoords,{x:((e=this.line.point2.coords.usrCoords)[1]-t[1])/i,y:(e[2]-t[2])/i}},_isInsideCanvas:function(t,e,i){var s=this.board.canvasWidth,r=this.board.canvasHeight;return void 0===i&&(i=0),t[0]>=i&&t[0]<=s-i&&e[0]>=i&&e[0]<=r-i||t[1]>=i&&t[1]<=s-i&&e[1]>=i&&e[1]<=r-i},createTickPath:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b=[-2e6,-2e6],y=[-2e6,-2e6];if(i=t.scrCoords,e?(o=this.dxMaj,n=this.dyMaj,c=this.majStyle,g=this.evalVisProp("majortickendings.0")>0,A=this.evalVisProp("majortickendings.1")>0):(o=this.dxMin,n=this.dyMin,c=this.minStyle,g=this.evalVisProp("tickendings.0")>0,A=this.evalVisProp("tickendings.1")>0),s=[-n*i[1]-o*i[2],n,o],e&&"polar"===this.evalVisProp("type")){if(p=this.board.getBoundingBox(),_=(f=2*Math.PI)/180,i=t.usrCoords,(d=math.A.hypot(i[1],i[2]))<Math.max(math.A.hypot(p[0],p[1]),math.A.hypot(p[2],p[3]))){for(b=[],y=[],u=0;u<=f;u+=_)b.push(this.board.origin.scrCoords[1]+d*Math.cos(u)*this.board.unitX),y.push(this.board.origin.scrCoords[2]+d*Math.sin(u)*this.board.unitY);return[b,y,e]}}else{if("infinite"===c){if(this.evalVisProp("ignoreinfinitetickendings")&&(g=A=!0),r=geometry.A.meetLineBoard(s,this.board),g&&A)b[0]=r[0].scrCoords[1],b[1]=r[1].scrCoords[1],y[0]=r[0].scrCoords[2],y[1]=r[1].scrCoords[2];else if((m=[math.A.innerProduct(r[0].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0],math.A.innerProduct(r[1].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0]])[0]<m[1]&&(r.reverse(),m.reverse()),g){if(m[0]<0)return[];m[1]<0?(b[0]=r[0].scrCoords[1],y[0]=r[0].scrCoords[2],b[1]=i[1],y[1]=i[2]):(b[0]=r[0].scrCoords[1],y[0]=r[0].scrCoords[2],b[1]=r[1].scrCoords[1],y[1]=r[1].scrCoords[2])}else if(A){if(m[1]>0)return[];m[0]>0?(b[0]=i[1],y[0]=i[2],b[1]=r[1].scrCoords[1],y[1]=r[1].scrCoords[2]):(b[0]=r[0].scrCoords[1],y[0]=r[0].scrCoords[2],b[1]=r[1].scrCoords[1],y[1]=r[1].scrCoords[2])}}else l=">"===this.evalVisProp("face")?Math.PI/4:"<"===this.evalVisProp("face")?-Math.PI/4:0,a=Math.cos(l)*o-Math.sin(l)*n,h=Math.sin(l)*o+Math.cos(l)*n,b[0]=i[1]+a*g,y[0]=i[2]-h*g,b[1]=i[1],y[1]=i[2],l=-l,a=Math.cos(l)*o-Math.sin(l)*n,h=Math.sin(l)*o+Math.cos(l)*n,b[2]=i[1]-a*A,y[2]=i[2]+h*A;if(this._isInsideCanvas(b,y))return[b,y,e]}return[]},formatLabelText:function(t){var e,i,s=this.evalVisProp("label.usemathjax"),r=this.evalVisProp("label.usekatex"),o=this.evalVisProp("scalesymbol");return utils_type.A.isNumber(t)?(this.evalVisProp("label.tofraction")?e=s?"\\("+utils_type.A.toFraction(t,!0)+"\\)":utils_type.A.toFraction(t,r):(i=this.evalVisProp("digits"),this.useLocale()?e=this.formatNumberLocale(t,i):((e=(Math.round(1e11*t)/1e11).toString()).length>this.evalVisProp("maxlabellength")||-1!==e.indexOf("e"))&&(3!==this.evalVisProp("precision")&&3===i&&(i=this.evalVisProp("precision")),e=t.toExponential(i).toString())),this.evalVisProp("beautifulscientificticklabels")&&(e=this.beautifyScientificNotationLabel(e)),e.indexOf(".")>-1&&-1===e.indexOf("e")&&(e=(e=e.replace(/0+$/,"")).replace(/\.$/,""))):e=t.toString(),o.length>0&&("1"===e?e=o:"-1"===e?e="-"+o:"0"!==e&&(e+=o)),this.evalVisProp("useunicodeminus")&&(e=e.replace(/-/g,"−")),e},beautifyScientificNotationLabel:function(t){return-1===t.indexOf("e")?t:(parseFloat(t.substring(0,t.indexOf("e")))+t.substring(t.indexOf("e"))).replace(/e(.*)$/g,function(t,e){var i="•10";return i+=e.replace(/-/g,"⁻").replace(/\+/g,"").replace(/0/g,"⁰").replace(/1/g,"¹").replace(/2/g,"²").replace(/3/g,"³").replace(/4/g,"⁴").replace(/5/g,"⁵").replace(/6/g,"⁶").replace(/7/g,"⁷").replace(/8/g,"⁸").replace(/9/g,"⁹")})},generateLabelText:function(t,e,i){var s;if(!utils_type.A.exists(i)){if(s=this.getDistanceFromZero(e,t),Math.abs(s)<math.A.eps)return"0";i=s/this.evalVisProp("scale")}return this.formatLabelText(i)},generateLabelData:function(t,e,i){var s,r,o,n;return n=this.evalVisProp("label.fontsize"),s=[e.scrCoords[1],e.scrCoords[1]],r=[e.scrCoords[2],e.scrCoords[2]],o=void 0===n?12:n,o*=.5,this._isInsideCanvas(s,r,o)?(s=this.evalVisProp("label.offset")[0],r=this.evalVisProp("label.offset")[1],{x:e.usrCoords[1]+s/this.board.unitX,y:e.usrCoords[2]+r/this.board.unitY,t:t,i:i}):null},update:function(){return this.needsUpdate&&0!==this.board.canvasWidth&&0!==this.board.canvasHeight&&this.calculateTicksCoordinates(),this},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&this.board.renderer.updateTicks(this),this.updateRendererLabels(),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},updateRendererLabels:function(){var t,e,i,s,r,o,n,a;for(i=this.labelsData.length,s=this.labels.length,t=0,e=0;t<i;t++)null!==this.labelsData[t]&&(n=this.labelsData[t],e<s?((o=this.labels[e]).setText(n.t),o.setCoords(n.x,n.y),e++):(this.labelCounter+=1,(r=utils_type.A.deepCopy(this.visProp.label)).isLabel=!0,r.priv=this.visProp.priv,r.id=this.id+n.i+"Label"+this.labelCounter,o=jxg.A.createText(this.board,[n.x,n.y,n.t],r),this.addChild(o),o.setParents(this),o.isDraggable=!1,o.dump=!1,this.labels.push(o)),"inherit"===(a=this.evalVisProp("label.visible"))&&(a=this.visPropCalc.visible),o.prepareUpdate().updateVisibility(a).updateRenderer(),o.distanceX=this.evalVisProp("label.offset")[0],o.distanceY=this.evalVisProp("label.offset")[1]);for(e=i=e;e<s;e++)this.board.renderer.display(this.labels[e],!1),this.labels[e].visProp.visible=this.labels[e].visPropCalc.visible=!1;return this},hideElement:function(){var t;for(jxg.A.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),t=0;t<this.labels.length;t++)utils_type.A.exists(this.labels[t])&&this.labels[t].hideElement();return this},showElement:function(){var t;for(jxg.A.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!1),t=0;t<this.labels.length;t++)utils_type.A.exists(this.labels[t])&&this.labels[t].showElement();return this}}),jxg.A.createTicks=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"ticks");if(r=e.length<2?o.ticksdistance:e[1],e[0].elementClass!==constants.A.OBJECT_CLASS_LINE&&e[0].elementClass!==constants.A.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create Ticks with parent types '"+typeof e[0]+"'.");return s=new jxg.A.Ticks(e[0],r,o),utils_type.A.isFunction(o.generatelabelvalue)&&(s.generateLabelText=o.generatelabelvalue),utils_type.A.isFunction(o.generatelabeltext)&&(s.generateLabelText=o.generatelabeltext),s.setParents(e[0]),s.isDraggable=!0,s.fullUpdate(e[0].visPropCalc.visible),s},jxg.A.createHatchmark=function(t,e,i){var s,r,o,n,a,h=[],l=utils_type.A.copyAttributes(i,t.options,"hatch");if(e[0].elementClass!==constants.A.OBJECT_CLASS_LINE&&e[0].elementClass!==constants.A.OBJECT_CLASS_CURVE||"number"!=typeof e[1])throw new Error("JSXGraph: Can't create Hatch mark with parent types '"+typeof e[0]+"' and '"+typeof e[1]+" and ''"+typeof e[2]+"'.");for(o=.5*-(((s=e[1])-1)*(n=l.ticksdistance)),r=0;r<s;r++)h[r]=o+r*n;return(a=t.create("ticks",[e[0],h],l)).elType="hatch",e[0].inherits.push(a),a},jxg.A.registerElement("ticks",jxg.A.createTicks),jxg.A.registerElement("hash",jxg.A.createHatchmark),jxg.A.registerElement("hatch",jxg.A.createHatchmark);var ticks=jxg.A.Ticks,bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],NAMEMAX=256;jxg.A.Util=jxg.A.Util||{},jxg.A.Util.Unzip=function(t){var e,i,s,r,o=[],n=0,a=[],h=new Array(32768),l=0,c=!1,u=t.length,d=0,p=1,f=new Array(288),_=new Array(32),g=0,A=null,m=0,b=new Array(17),y=[];function v(){return d<u?t[d++]:-1}function C(){p=1}function P(){var t;try{t=1&p,0===(p>>=1)&&(t=1&(p=v()),p=p>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function x(t){var e=0,i=t;try{for(;i--;)e=e<<1|P();t&&(e=bitReverse[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function E(){l=0}function O(t){h[l++]=t,o.push(String.fromCharCode(t)),32768===l&&(l=0)}function M(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function w(){for(;;){if(b[m]>=r)return-1;if(s[b[m]]===m)return b[m]++;b[m]++}}function S(){var t,e=A[g];if(17===m)return-1;if(g++,m++,(t=w())>=0)e.b0=t;else if(e.b0=32768,S())return-1;if((t=w())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=A[g],e.jumppos=g,S())return-1;return m--,0}function T(t,e,i,o){var n;for(A=t,g=0,s=i,r=e,n=0;n<17;n++)b[n]=0;return m=0,S()?-1:0}function N(t){for(var e,i,s=0,r=t[s];;)if(P()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i<e;i++)if(t[i]===r){s=i;break}}else{if(!(32768&r.b0))return r.b0;r=t[++s]}}function j(){var t,e,i,s,r,o,n,a,c,u,d,p,g,A,m;do{if(t=P(),0===(e=x(2)))for(C(),c=v(),c|=v()<<8,d=v(),65535&(c^~(d|=v()<<8))&&jxg.A.debug("BlockLen checksum mismatch\n");c--;)O(v());else if(1===e)for(;;)if((s=bitReverse[x(7)]>>1)>23?(s=s<<1|P())>199?s=(s-=128)<<1|P():(s-=48)>143&&(s+=136):s+=256,s<256)O(s);else{if(256===s)break;for(a=x(cplext[s-=257])+cplens[s],s=bitReverse[x(5)]>>3,cpdext[s]>8?(u=x(8),u|=x(cpdext[s]-8)<<8):u=x(cpdext[s]),u+=cpdist[s],s=0;s<a;s++)O(h[l-u&32767])}else if(2===e){for(o=new Array(320),g=257+x(5),A=1+x(5),m=4+x(4),s=0;s<19;s++)o[s]=0;for(s=0;s<m;s++)o[border[s]]=x(3);for(a=_.length,i=0;i<a;i++)_[i]=new M;if(T(_,19,o))return E(),1;for(p=g+A,i=0;i<p;)if((s=N(_))<16)o[i++]=s;else if(16===s){if(i+(s=3+x(2))>p)return E(),1;for(r=i?o[i-1]:0;s--;)o[i++]=r}else{if(i+(s=17===s?3+x(3):11+x(7))>p)return E(),1;for(;s--;)o[i++]=0}for(a=f.length,i=0;i<a;i++)f[i]=new M;if(T(f,g,o))return E(),1;for(a=f.length,i=0;i<a;i++)_[i]=new M;for(n=[],i=g;i<o.length;i++)n[i-g]=o[i];if(T(_,A,n))return E(),1;for(;;)if((s=N(f))>=256){if(0===(s-=256))break;for(a=x(cplext[s-=1])+cplens[s],s=N(_),cpdext[s]>8?(u=x(8),u|=x(cpdext[s]-8)<<8):u=x(cpdext[s]),u+=cpdist[s];a--;)O(h[l-u&32767])}else O(s)}}while(!t);return E(),C(),0}function D(){var t,s,r,h,l,u=[];try{if(o=[],c=!1,u[0]=v(),u[1]=v(),120===u[0]&&218===u[1]&&(j(),a[n]=[o.join(""),"geonext.gxt"],n++),31===u[0]&&139===u[1]&&(k(),a[n]=[o.join(""),"file"],n++),80===u[0]&&75===u[1]){if(c=!0,u[2]=v(),u[3]=v(),3===u[2]&&4===u[3]){for(u[0]=v(),u[1]=v(),e=v(),e|=v()<<8,l=v(),l|=v()<<8,v(),v(),v(),v(),v(),v()<<8,v()<<16,v()<<24,v(),v()<<8,v()<<16,v()<<24,v(),v()<<8,v()<<16,v()<<24,h=v(),h|=v()<<8,r=v(),r|=v()<<8,t=0,y=[];h--;)"/"===(s=v())|":"===s?t=0:t<NAMEMAX-1&&(y[t++]=String.fromCharCode(s));for(i||(i=y),t=0;t<r;)s=v(),t++;if(8===l&&(j(),a[n]=new Array(2),a[n][0]=o.join(""),a[n][1]=y.join(""),n++),k())return!1}return!0}}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return!1}function k(){var t,i,s=[];if(8&e&&(s[0]=v(),s[1]=v(),s[2]=v(),s[3]=v(),80===s[0]&&75===s[1]&&7===s[2]&&8===s[3]?(v(),v()<<8,v()<<16,v()<<24):s[0]|s[1]<<8|s[2]<<16|s[3]<<24,v(),v()<<8,v()<<16,v()<<24,v(),v()<<8,v()<<16,v()<<24),c&&D())return!1;if(s[0]=v(),8!==s[0])return!0;if(e=v(),v(),v(),v(),v(),v(),v(),4&e)for(s[0]=v(),s[2]=v(),m=s[0]+256*s[1],t=0;t<m;t++)v();if(8&e)for(t=0,y=[],i=v();i;)"7"!==i&&":"!==i||(t=0),t<NAMEMAX-1&&(y[t++]=i),i=v();if(16&e)for(i=v();i;)i=v();return 2&e&&(v(),v()),j(),v(),v()<<8,v()<<16,v()<<24,v(),v()<<8,v()<<16,v()<<24,c&&D(),!1}b[0]=0,jxg.A.Util.Unzip.prototype.unzipFile=function(t){var e;for(this.unzip(),e=0;e<a.length;e++)if(a[e][1]===t)return a[e][0];return""},jxg.A.Util.Unzip.prototype.unzip=function(){return D(),a}};var zip=jxg.A.Util;jxg.A.CA=function(t,e,i){this.node=t,this.createNode=e,this.parser=i},jxg.A.extend(jxg.A.CA.prototype,{findMapNode:function(t,e){var i,s,r;if("op_assign"===e.value&&e.children[0].value===t)return e.children[1];if(e.children)for(s=e.children.length,i=0;i<s;++i)if(null!==(r=this.findMapNode(t,e.children[i])))return r;return null},setMath:function(t){var e,i;if(("node_op"!=t.type||"op_add"!=t.value&&"op_sub"!=t.value&&"op_mul"!=t.value&&"op_div"!=t.value&&"op_neg"!=t.value&&"op_execfun"!=t.value&&"op_exp"!=t.value)&&"node_var"!=t.type&&"node_const"!=t.type||(t.isMath=!0),t.children)for(i=t.children.length,e=0;e<i;++e)this.setMath(t.children[e])},deriveElementary:function(t,e){var i,s=t.children[0].value,r=t.children[1];switch(s){case"abs":i=this.createNode("node_op","op_div",r[0],this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0]))]));break;case"sqrt":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_mul",this.createNode("node_const",2),this.createNode(t.type,t.value,utils_type.A.deepCopy(t.children[0]),utils_type.A.deepCopy(t.children[1]))));break;case"sin":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),utils_type.A.deepCopy(r));break;case"cos":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),utils_type.A.deepCopy(r)));break;case"tan":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),utils_type.A.deepCopy(r)),this.createNode("node_const",2)));break;case"cot":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),utils_type.A.deepCopy(r)),this.createNode("node_const",2))));break;case"exp":i=this.createNode(t.type,t.value,utils_type.A.deepCopy(t.children[0]),utils_type.A.deepCopy(t.children[1]));break;case"pow":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_execfun",utils_type.A.deepCopy(t.children[0]),utils_type.A.deepCopy(t.children[1])),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(t.children[1][0],e),this.createNode("node_op","op_div",utils_type.A.deepCopy(t.children[1][1]),utils_type.A.deepCopy(t.children[1][0]))),this.createNode("node_op","op_mul",this.derivative(t.children[1][1],e),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[utils_type.A.deepCopy(t.children[1][0])]))));break;case"log":case"ln":i=this.createNode("node_op","op_div",this.createNode("node_const",1),utils_type.A.deepCopy(r[0]));break;case"log2":case"lb":case"ld":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),utils_type.A.deepCopy(r[0])),this.createNode("node_const",1.4426950408889634));break;case"log10":case"lg":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),utils_type.A.deepCopy(r[0])),this.createNode("node_const",.43429448190325176));break;case"asin":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0])))]));break;case"acos":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0])))])));break;case"atan":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0]))));break;case"acot":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0])))));break;case"sinh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cosh"),[utils_type.A.deepCopy(r[0])]);break;case"cosh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","sinh"),[utils_type.A.deepCopy(r[0])]);break;case"tanh":i=this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","tanh"),[utils_type.A.deepCopy(r[0])]),this.createNode("node_const",2)));break;case"asinh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_add",this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0])),this.createNode("node_const",1))]));break;case"acosh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0])),this.createNode("node_const",1))]));break;case"atanh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",utils_type.A.deepCopy(r[0]),utils_type.A.deepCopy(r[0]))));break;default:throw i=this.createNode("node_const",0),console.log('Derivative of "'+s+'" not yet implemented'),new Error("Error("+this.line+"): ")}return i},derivative:function(t,e){var i;switch(t.type){case"node_op":switch(t.value){case"op_execfun":i="pow"==t.children[0].value?this.deriveElementary(t,e):0===t.children[1].length?this.createNode("node_const",0):this.createNode("node_op","op_mul",this.deriveElementary(t,e),this.derivative(t.children[1][0],e));break;case"op_div":i=this.createNode("node_op","op_div",this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",this.derivative(t.children[0],e),utils_type.A.deepCopy(t.children[1])),this.createNode("node_op","op_mul",utils_type.A.deepCopy(t.children[0]),this.derivative(t.children[1],e))),this.createNode("node_op","op_mul",utils_type.A.deepCopy(t.children[1]),utils_type.A.deepCopy(t.children[1])));break;case"op_mul":i=this.createNode("node_op","op_add",this.createNode("node_op","op_mul",utils_type.A.deepCopy(t.children[0]),this.derivative(t.children[1],e)),this.createNode("node_op","op_mul",this.derivative(t.children[0],e),utils_type.A.deepCopy(t.children[1])));break;case"op_neg":i=this.createNode("node_op","op_neg",this.derivative(t.children[0],e));break;case"op_add":case"op_sub":i=this.createNode("node_op",t.value,this.derivative(t.children[0],e),this.derivative(t.children[1],e));break;case"op_exp":i=this.createNode("node_op","op_mul",utils_type.A.deepCopy(t),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(t.children[0],e),this.createNode("node_op","op_div",utils_type.A.deepCopy(t.children[1]),utils_type.A.deepCopy(t.children[0]))),this.createNode("node_op","op_mul",this.derivative(t.children[1],e),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[utils_type.A.deepCopy(t.children[0])]))))}break;case"node_var":i=t.value===e?this.createNode("node_const",1):this.createNode("node_const",0);break;case"node_const":i=this.createNode("node_const",0)}return i},expandDerivatives:function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f;if(!t)return 0;for(this.line=t.line,this.col=t.col,s=t.children.length,r=0;r<s;++r)if(t.children[r]&&t.children[r].type)t.children[r]=this.expandDerivatives(t.children[r],t,i);else if(utils_type.A.isArray(t.children[r]))for(o=0;o<t.children[r].length;++o)t.children[r][o]&&t.children[r][o].type&&(t.children[r][o]=this.expandDerivatives(t.children[r][o],t,i));if("node_op"===t.type)if("op_execfun"===t.value)if(t.children[0]&&"D"===t.children[0].value){if(f=!1,"node_var"==t.children[1][0].type&&(c=t.children[1][0].value,null!==(n=this.findMapNode(c,i))&&(f=!0)),f?(d=n.children[0],u=t.children[1].length>=2?t.children[1][1].value:n.children[0][0],a=n.children[1]):(a=t.children[1][0],d=["x"],u=t.children[1].length>=2?t.children[1][1].value:"x"),l=a,(p=t.children[1].length>=3?t.children[1][2].value:1)>=1)for(;p>=1;)l=this.derivative(l,u),l=this.removeTrivialNodes(l),p--;h="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",d,l):l,this.setMath(h),t.type=h.type,t.value=h.value,h.children.length>0&&(t.children[0]=h.children[0]),h.children.length>1&&(t.children[1]=h.children[1])}return t},removeTrivialNodes:function(t){var e,i,s,r,o;if(utils_type.A.isArray(t))for(i=t.length,e=0;e<i;++e)t[e]=this.removeTrivialNodes(t[e]);if("node_op"!=t.type||!t.children)return t;for(i=t.children.length,e=0;e<i;++e){this.mayNotBeSimplified=!1;do{t.children[e]=this.removeTrivialNodes(t.children[e])}while(this.mayNotBeSimplified)}switch(t.value){case"op_map":if(s=t.children[0],"node_var"==(r=t.children[1]).type)for(e=0;e<s.length;++e)if(s[e]==r.value){r.isMath=!0;break}break;case"op_add":if(s=t.children[0],r=t.children[1],"node_const"==s.type&&0===s.value)return r;if("node_const"==r.type&&0===r.value)return s;if("node_const"==s.type&&"node_const"==r.type)return s.value+=r.value,s;break;case"op_mul":if(s=t.children[0],r=t.children[1],"node_const"==s.type&&1==s.value)return r;if("node_const"==r.type&&1==r.value)return s;if("node_const"==s.type&&0===s.value)return s;if("node_const"==r.type&&0===r.value)return r;if("node_const"==r.type&&0===r.value)return r;if("node_op"==s.type&&"op_neg"==s.value&&"node_op"==r.type&&"op_neg"==r.value)return t.children=[s.children[0],r.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==s.value&&"op_neg"!=r.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",s.children[0],r)],this.mayNotBeSimplified=!0,t;if("op_neg"!=s.value&&"op_neg"==r.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",s,r.children[0])],this.mayNotBeSimplified=!0,t;if("op_div"==s.value&&"node_const"==s.children[0].type&&1==s.children[0].value)return t.type="node_op",t.value="op_div",t.children=[r,s.children[1]],this.mayNotBeSimplified=!0,t;if("op_div"==r.value&&"node_const"==r.children[0].type&&1==r.children[0].value)return t.type="node_op",t.value="op_div",t.children=[s,r.children[1]],this.mayNotBeSimplified=!0,t;if("node_const"!=s.type&&"node_const"==r.type)return t.children=[r,s],this.mayNotBeSimplified=!0,t;if("node_const"!=s.type&&"node_op"==r.type&&"op_neg"==r.value&&"node_const"==r.children[0].type)return t.children=[r,s],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_execfun"!=s.value&&("node_var"==r.type||"node_op"==r.type&&"op_execfun"==r.value))return t.children=[r,s],this.mayNotBeSimplified=!0,t;if("node_op"!=s.type&&"node_op"==r.type&&"op_neg"==r.value&&"node_var"==r.children[0].type)return t.children=[r,s],this.mayNotBeSimplified=!0,t;if("node_const"!=s.type&&"node_op"==r.type&&("op_mul"==r.value||"op_div"==r.value)&&"node_const"==r.children[0].type)return o=r.children[0],r.children[0]=s,t.children=[o,r],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_op"==s.type&&"op_mul"==s.value&&"node_const"==s.children[0].type)return t.children=[s.children[0],this.createNode("node_op","op_mul",s.children[1],r)],this.mayNotBeSimplified=!0,t;if("node_const"==s.type&&"node_const"==r.type)return s.value*=r.value,s;if("node_const"==s.type&&"node_op"==r.type&&("op_mul"==r.value||"op_div"==r.value)&&"node_const"==r.children[0].type)return r.children[0].value*=s.value,r;if(s.hash=this.parser.compile(s),r.hash=this.parser.compile(r),s.hash===r.hash)return t.value="op_exp",t.children[1]=this.createNode("node_const",2),t;if("node_const"==s.type&&"node_op"==r.type&&("op_mul"==r.value||"op_div"==r.value)&&"node_const"==r.children[0].type)return r.children[0].value*=s.value,r;if("node_op"==r.type&&"op_exp"==r.value&&(s.hash||(s.hash=this.parser.compile(s)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),s.hash===r.children[0].hash))return r.children[1]=this.createNode("node_op","op_add",r.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,r;if("node_op"==s.type&&"op_exp"==s.value&&"node_op"==r.type&&"op_exp"==r.value&&(s.children[0].hash=this.parser.compile(s.children[0]),r.children[0].hash=this.parser.compile(r.children[0]),s.children[0].hash===r.children[0].hash))return s.children[1]=this.createNode("node_op","op_add",s.children[1],r.children[1]),this.mayNotBeSimplified=!0,s;break;case"op_sub":if(s=t.children[0],r=t.children[1],"node_const"==s.type&&0===s.value)return t.value="op_neg",t.children[0]=r,t;if("node_const"==r.type&&0===r.value)return s;if("node_const"==s.type&&"node_const"==r.type&&s.value==r.value)return this.createNode("node_const",0);if("node_var"==s.type&&"node_var"==r.type&&s.value==r.value)return this.createNode("node_const",0);if("node_const"==s.type&&"node_const"==r.type)return s.value-=r.value,s;if("node_op"==s.type&&"op_mul"==s.value&&"node_op"==r.type&&"op_mul"==r.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.children[1].hash=this.parser.compile(r.children[1]),s.children[1].hash===r.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",s.children[0],r.children[0]),s.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_mul"==s.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.hash=this.parser.compile(r),s.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",s.children[0],this.createNode("node_const",1)),r],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.hash=this.parser.compile(s),r.children[1].hash===s.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",this.createNode("node_const",1),r.children[0]),s],this.mayNotBeSimplified=!0,t;break;case"op_neg":if("node_const"==(s=t.children[0]).type&&0===s.value)return s;if("node_op"==s.type&&"op_neg"==s.value)return s.children[0];break;case"op_div":if(s=t.children[0],r=t.children[1],"node_const"==s.type&&"node_const"==r.type&&s.value==r.value&&0!==s.value)return s.value=1,s;if("node_const"==s.type&&0===s.value&&"node_const"==r.type&&0!==r.value)return s.value=0,s;if("node_const"==s.type&&0===s.value&&("node_op"==r.type||"node_var"==r.type))return t.type="node_const",t.value=0,t;if("node_var"==s.type&&"node_var"==r.type&&s.value==r.value)return this.createNode("node_const",1);if("node_const"==s.type&&0!==s.value&&"node_const"==r.type&&0===r.value)return s.value>0?s.value=1/0:s.value=-1/0,s;if("node_op"==s.type&&"op_neg"==s.value&&"node_op"==r.type&&"op_neg"==r.value)return t.children=[s.children[0],r.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==s.value&&"op_neg"!=r.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",s.children[0],r)],this.mayNotBeSimplified=!0,t;if("op_neg"!=s.value&&"op_neg"==r.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",s,r.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_exp"==s.value&&(r.hash||(r.hash=this.parser.compile(r)),s.children[0].hash||(s.children[0].hash=this.parser.compile(s.children[0])),r.hash===s.children[0].hash))return s.children[1]=this.createNode("node_op","op_sub",s.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,s;if("node_const"!=r.type&&"node_op"==s.type&&"op_mul"==s.value&&"node_const"==s.children[0].type)return t.value="op_mul",t.children=[s.children[0],this.createNode("node_op","op_div",s.children[1],r)],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_exp"==s.value&&"node_op"==r.type&&"op_exp"==r.value&&(s.children[0].hash=this.parser.compile(s.children[0]),r.children[0].hash=this.parser.compile(r.children[0]),s.children[0].hash===r.children[0].hash))return s.children[1]=this.createNode("node_op","op_sub",s.children[1],r.children[1]),this.mayNotBeSimplified=!0,s;break;case"op_exp":if(s=t.children[0],"node_const"==(r=t.children[1]).type&&0===r.value)return r.value=1,r;if("node_const"==r.type&&1==r.value)return s;if("node_const"==s.type&&1==s.value)return s;if("node_const"==s.type&&0===s.value&&"node_const"==r.type&&0!==r.value)return s;if("node_op"==s.type&&"op_exp"==s.value)return t.children=[s.children[0],this.createNode("node_op","op_mul",s.children[1],r)],t}switch(t.value){case"op_add":if(s=t.children[0],r=t.children[1],"node_const"==s.type&&"node_const"==r.type&&s.value==r.value)return s.value+=r.value,s;if("node_var"==s.type&&"node_var"==r.type&&s.value==r.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==s.type&&"op_neg"==s.value)return t.value="op_sub",t.children[0]=r,t.children[1]=s.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_mul"==s.value&&"node_op"==r.type&&"op_mul"==r.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.children[1].hash=this.parser.compile(r.children[1]),s.children[1].hash===r.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",s.children[0],r.children[0]),s.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==s.type&&"op_mul"==s.value&&(s.children[1].hash=this.parser.compile(s.children[1]),r.hash=this.parser.compile(r),s.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",s.children[0],this.createNode("node_const",1)),r],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),s.hash=this.parser.compile(s),r.children[1].hash===s.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),r.children[0]),s],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(s=t.children[0],"node_op"==(r=t.children[1]).type&&"op_neg"==r.value)return t.value="op_add",t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;break;case"op_execfun":return this.simplifyElementary(t)}return t},simplifyElementary:function(t){var e=t.children[0].value,i=t.children[1];if(0==i.length)return t;switch(e){case"sin":case"tan":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=0,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_const",t.value=0,t;if("node_op"==i[0].type&&"op_mul"==i[0].value&&"node_const"==i[0].children[0].type&&i[0].children[0].value%1==0&&"node_var"==i[0].children[1].type&&"PI"==i[0].children[1].value)return t.type="node_const",t.value=0,t;break;case"cos":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)],t;break;case"exp":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;break;case"pow":if("node_const"==i[1].type&&0===i[1].value)return t.type="node_const",t.value=1,t}return t}});var ca=jxg.A.CA;jxg.A.Dump={addMarkers:function(t,e,i){var s,r,o;for(s in utils_type.A.isArray(e)||(e=[e]),utils_type.A.isArray(i)||(i=[i]),r=Math.min(e.length,i.length),e.length=r,i.length=r,t.objects)if(t.objects.hasOwnProperty(s))for(o=0;o<r;o++)t.objects[s][e[o]]=i[o]},deleteMarkers:function(t,e){var i,s,r;for(i in utils_type.A.isArray(e)||(e=[e]),s=e.length,e.length=s,t.objects)if(t.objects.hasOwnProperty(i))for(r=0;r<s;r++)delete t.objects[i][e[r]]},str:function(t){return"string"==typeof t&&"function"!==t.slice(0,7)&&(t='"'+t+'"'),t},minimizeObject:function(t,e){var i,s,r,o={},n=utils_type.A.deepCopy(t),a=[];for(r=1;r<arguments.length;r++)a.push(arguments[r]);for(o=utils_type.A.deepCopy(o,jxg.A.Options.elements,!0),r=a.length;r>0;r--)o=utils_type.A.deepCopy(o,a[r-1],!0);for(i in o)o.hasOwnProperty(i)&&(s=i.toLowerCase(),null!==o[i]&&"object"!=typeof o[i]&&o[i]===n[s]&&delete n[s]);return n},prepareAttributes:function(t,e){var i,s;for(s in i=this.minimizeObject(e.getAttributes(),jxg.A.Options[e.elType]),e.subs)e.subs.hasOwnProperty(s)&&(i[s]=this.minimizeObject(e.subs[s].getAttributes(),jxg.A.Options[e.elType][s],jxg.A.Options[e.subs[s].elType]),i[s].id=e.subs[s].id,i[s].name=e.subs[s].name);return i.id=e.id,i.name=e.name,i},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),e.keepaspectratio]}),t},dump:function(t){var e,i,s,r,o=[],n=[],a=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),e=0;e<a;e++)if(s={},!(i=t.objectsList[e]).dumped&&i.dump){for(s.type=i.getType(),s.parents=i.getParents().slice(),"point"===s.type&&1===s.parents[0]&&(s.parents=s.parents.slice(1)),r=0;r<s.parents.length;r++)utils_type.A.isString(s.parents[r])&&"'"!==s.parents[r][0]&&'"'!==s.parents[r][0]?s.parents[r]='"'+s.parents[r]+'"':utils_type.A.isArray(s.parents[r])&&(s.parents[r]="["+s.parents[r].toString()+"]");s.attributes=this.prepareAttributes(t,i),"glider"===s.type&&i.onPolygon&&o.push({obj:i.id,prop:"onPolygon",val:!0}),n.push(s)}return this.deleteMarkers(t,"dumped"),{elements:n,props:o,methods:[]}},arrayToParamStr:function(t,e){var i,s=[];for(i=0;i<t.length;i++)s.push(e.call(this,t[i]));return s.join(", ")},toJCAN:function(t){var e,i,s;switch(typeof t){case"object":if(t){if(i=[],utils_type.A.isArray(t)){for(e=0;e<t.length;e++)i.push(this.toJCAN(t[e]));return"["+i.join(",")+"]"}for(s in t)t.hasOwnProperty(s)&&i.push(s+": "+this.toJCAN(t[s]));return"<<"+i.join(", ")+">> "}return"null";case"string":return"'"+t.replace(/\\/g,"\\\\").replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return t.toString();case"null":return"null"}},toJessie:function(t){var e,i,s,r=this.dump(t),o=[];for(r.methods=this.setBoundingBox(r.methods,t,"$board"),i=r.elements,e=0;e<i.length;e++)i[e].attributes.name.length>0&&o.push("// "+i[e].attributes.name),o.push("s"+e+" = "+i[e].type+"("+i[e].parents.join(", ")+") "+this.toJCAN(i[e].attributes).replace(/\n/,"\\n")+";"),"axis"===i[e].type&&(s=i[e].attributes.id,null===t.objects[s].defaultTicks&&o.push("s"+e+".removeAllTicks();")),o.push("");for(e=0;e<r.methods.length;e++)o.push(r.methods[e].obj+"."+r.methods[e].method+"("+this.arrayToParamStr(r.methods[e].params,this.toJCAN)+");"),o.push("");for(e=0;e<r.props.length;e++)o.push(r.props[e].obj+"."+r.props[e].prop+" = "+this.toJCAN(r.props[e].val)+";"),o.push("");return o.join("\n")},toJavaScript:function(t){var e,i,s,r=this.dump(t),o=[];for(r.methods=this.setBoundingBox(r.methods,t,"board"),i=r.elements,e=0;e<i.length;e++)o.push('board.create("'+i[e].type+'", ['+i[e].parents.join(", ")+"], "+utils_type.A.toJSON(i[e].attributes)+");"),"axis"===i[e].type&&(s=i[e].attributes.id,null===t.objects[s].defaultTicks&&o.push('board.objects["'+s+'"].removeTicks(board.objects["'+s+'"].defaultTicks);'));for(e=0;e<r.methods.length;e++)o.push(r.methods[e].obj+"."+r.methods[e].method+"("+this.arrayToParamStr(r.methods[e].params,utils_type.A.toJSON)+");"),o.push("");for(e=0;e<r.props.length;e++)o.push(r.props[e].obj+"."+r.props[e].prop+" = "+utils_type.A.toJSON(r.props[e].val)+";"),o.push("");return o.join("\n")}};var dump=jxg.A.Dump;jxg.A.createComb=function(t,e,i){var s,r,o,n,a;if(2!==e.length)throw a=e.map(function(t){return"'"+typeof t+"'"}),new Error("JSXGraph: Can't create comb with parent types "+a.join(", ")+".\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");if(utils_type.A.isArray(e[0])&&e[0].length>1)n=utils_type.A.copyAttributes(i,t.options,"comb","point1"),s=t.create("point",e[0],n);else if(utils_type.A.isString(e[0])||utils_type.A.isPoint(e[0]))s=t.select(e[0]);else if(utils_type.A.isFunction(e[0])&&utils_type.A.isPoint(e[0]()))s=e[0]();else{if(!(utils_type.A.isFunction(e[0])&&e[0]().length&&e[0]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");n=utils_type.A.copyAttributes(i,t.options,"comb","point1"),s=jxg.A.createPoint(t,e[0](),n)}if(utils_type.A.isArray(e[1])&&e[1].length>1)n=utils_type.A.copyAttributes(i,t.options,"comb","point2"),r=t.create("point",e[1],n);else if(utils_type.A.isString(e[1])||utils_type.A.isPoint(e[1]))r=t.select(e[1]);else if(utils_type.A.isFunction(e[1])&&utils_type.A.isPoint(e[1]()))r=e[1]();else{if(!(utils_type.A.isFunction(e[1])&&e[1]().length&&e[1]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");n=utils_type.A.copyAttributes(i,t.options,"comb","point2"),r=jxg.A.createPoint(t,e[1](),n)}return n=utils_type.A.copyAttributes(i,t.options,"comb"),(o=t.create("curve",[[0],[0]],n)).updateDataArray=function(){var t,e,i,n,a,h,l,c,u,d,p=0,f=s.Dist(r),_=s,g=r;for(c=o.evalVisProp("frequency"),u=-o.evalVisProp("angle"),d=o.evalVisProp("width"),o.evalVisProp("reverse")&&(_=r,g=s,u=-u),t=Math.cos(u),e=Math.sin(u),i=(g.X()-_.X())/f,n=(g.Y()-_.Y())/f,t*=d/Math.abs(e),e*=d/Math.abs(e),this.dataX=[],this.dataY=[];p<f;)a=_.X()+i*p,h=_.Y()+n*p,e*=l=Math.min(t,f-p)/Math.abs(t),t*=l,this.dataX.push(a),this.dataY.push(h),this.dataX.push(a+i*t+n*e),this.dataY.push(h-i*e+n*t),this.dataX.push(NaN),this.dataY.push(NaN),p+=c},o},jxg.A.registerElement("comb",jxg.A.createComb);var priv={removeSlopeTriangle:function(){polygon.prototype.remove.call(this),this.board.removeObject(this.toppoint),this.board.removeObject(this.glider),this.board.removeObject(this.baseline),this.board.removeObject(this.basepoint),this.board.removeObject(this.label),this._isPrivateTangent&&this.board.removeObject(this.tangent)},Value:function(){return this.tangent.getSlope()},Direction:function(){return this.tangent.Direction()}};jxg.A.createSlopeTriangle=function(t,e,i){var s,r,o,n,a,h,l,c,u,d=!1;if(1===e.length&&e[0].type===constants.A.OBJECT_TYPE_TANGENT)r=e[0],o=r.glider;else if(1===e.length&&e[0].type===constants.A.OBJECT_TYPE_GLIDER)o=e[0],u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","tangent"),r=t.create("tangent",[o],u),d=!0;else{if(2!==e.length||e[0].elementClass!==constants.A.OBJECT_CLASS_LINE||!utils_type.A.isPoint(e[1]))throw new Error("JSXGraph: Can't create slope triangle with parent types '"+typeof e[0]+"'.");r=e[0],o=e[1]}return u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","basepoint"),l=t.create("point",[function(){return[o.X()+1,o.Y()]}],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","baseline"),h=t.create("line",[o,l],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","glider"),n=t.create("glider",[o.X()+1,o.Y(),h],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","toppoint"),a=t.create("point",[function(){return[n.X(),n.Y()+(n.X()-o.X())*r.getSlope()]}],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle"),(s=t.create("polygon",[o,n,a],u)).Value=priv.Value,s.Direction=priv.Direction,s.tangent=r,s._isPrivateTangent=d,s.borders[2].setArrow(!1,!1),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","label"),(u=utils_type.A.copyAttributes(u,t.options,"label")).isLabel=!0,u.anchor=s.borders[1],u.priv=s.borders[1].visProp.priv,u.id=s.borders[1].id+"Label",(c=t.create("text",[0,0,function(){return""}],u)).needsUpdate=!0,c.dump=!1,s.borders[1].label=c,s.borders[1].hasLabel=!0,s.borders[1].visProp.withlabel=!0,c._setText(function(){var t=c.evalVisProp("digits");return c.useLocale()?c.formatNumberLocale(s.Value(),t):utils_type.A.toFixed(s.Value(),t)}),c.fullUpdate(),s.glider=n,s.basepoint=l,s.baseline=h,s.toppoint=a,s.label=c,s.subs={glider:n,basePoint:l,baseLine:h,topPoint:a,label:c},s.inherits.push(n,l,h,a,c),s.methodMap=jxg.A.deepCopy(s.methodMap,{tangent:"tangent",glider:"glider",basepoint:"basepoint",baseline:"baseline",toppoint:"toppoint",label:"label",Value:"Value",V:"Value",Direction:"Direction"}),s.remove=priv.removeSlopeTriangle,s},jxg.A.registerElement("slopetriangle",jxg.A.createSlopeTriangle);var checkbox_priv={CheckboxChangeEventHandler:function(){this._value=this.rendNodeCheckbox.checked,this.board.update()}};jxg.A.createCheckbox=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"checkbox");return r=[e[0],e[1],'<span style="display:inline"><input type="checkbox" /><label for=""></label></span>'],(s=t.create("text",r,o)).type=utils_type.A.OBJECT_TYPE_CHECKBOX,s.rendNodeCheckbox=s.rendNode.childNodes[0].childNodes[0],s.rendNodeLabel=s.rendNode.childNodes[0].childNodes[1],s.rendNodeTag=s.rendNodeCheckbox,s.rendNodeTag.disabled=!!o.disabled,s.rendNodeCheckbox.id=s.rendNode.id+"_checkbox",s.rendNodeLabel.id=s.rendNode.id+"_label",s.rendNodeLabel.setAttribute("for",s.rendNodeCheckbox.id),s.setText(e[2]),s.visPropOld.fontsize="0px",t.renderer.updateTextStyle(s,!1),s.rendNodeCheckbox.checked=o.checked,s._value=o.checked,s.Value=function(){return this._value},s.update=function(){return this.needsUpdate&&(jxg.A.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},env.A.addEvent(s.rendNodeCheckbox,"change",checkbox_priv.CheckboxChangeEventHandler,s),s},jxg.A.registerElement("checkbox",jxg.A.createCheckbox);var input_priv={InputInputEventHandler:function(t){this._value=this.rendNodeInput.value,this.board.update()}};jxg.A.createInput=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"input");return r=[e[0],e[1],'<span style="display:inline; white-space:nowrap; padding:0px;"><label></label><input type="text" maxlength="'+o.maxlength+'" style="width:100%" /></span>'],(s=t.create("text",r,o)).type=utils_type.A.OBJECT_TYPE_INPUT,s.rendNodeLabel=s.rendNode.childNodes[0].childNodes[0],s.rendNodeInput=s.rendNode.childNodes[0].childNodes[1],s.rendNodeInput.value=e[2],s.rendNodeTag=s.rendNodeInput,s.rendNodeTag.disabled=!!o.disabled,s.rendNodeLabel.id=s.rendNode.id+"_label",s.rendNodeInput.id=s.rendNode.id+"_input",s.rendNodeInput.setAttribute("aria-labelledby",s.rendNodeLabel.id),s.setText(e[3]),s._value=e[2],s.rendNodeInput.addEventListener("keydown",t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||t.stopPropagation()}),s.update=function(){return this.needsUpdate&&(jxg.A.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},s.Value=function(){return this._value},s.set=function(t){return this._value=t,this.rendNodeInput.value=t,this},env.A.addEvent(s.rendNodeInput,"input",input_priv.InputInputEventHandler,s),env.A.addEvent(s.rendNodeInput,"mousedown",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),env.A.addEvent(s.rendNodeInput,"touchstart",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),env.A.addEvent(s.rendNodeInput,"pointerdown",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),s.visPropOld.fontsize="0px",t.renderer.updateTextStyle(s,!1),s},jxg.A.registerElement("input",jxg.A.createInput);var button_priv={ButtonClickEventHandler:function(){this._handler&&this._handler(),this.board.update()}};jxg.A.createButton=function(t,e,i){var s,r,o=utils_type.A.copyAttributes(i,t.options,"button");return r=[e[0],e[1],'<button type="button" style="width:100%; height:100%;" tabindex="0"></button>'],(s=t.create("text",r,o)).type=utils_type.A.OBJECT_TYPE_BUTTON,s.rendNodeButton=s.rendNode.childNodes[0],s.rendNodeButton.id=s.rendNode.id+"_button",s.rendNodeTag=s.rendNodeButton,s.rendNodeTag.disabled=!!o.disabled,s.setText(e[2]),s.visPropOld.fontsize="0px",t.renderer.updateTextStyle(s,!1),e[3]&&(utils_type.A.isString(e[3])?(s._jc=new jxg.A.JessieCode,s._jc.use(t),s._handler=function(){s._jc.parse(e[3])}):s._handler=e[3]),env.A.addEvent(s.rendNodeButton,"click",button_priv.ButtonClickEventHandler,s),env.A.addEvent(s.rendNodeButton,"mousedown",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),env.A.addEvent(s.rendNodeButton,"touchstart",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),env.A.addEvent(s.rendNodeButton,"pointerdown",function(t){utils_type.A.exists(t.stopPropagation)&&t.stopPropagation()},s),s},jxg.A.registerElement("button",jxg.A.createButton),jxg.A.createVectorField=function(t,e,i){var s,r;if(!(e.length>=3&&(utils_type.A.isArray(e[0])||utils_type.A.isFunction(e[0])||utils_type.A.isString(e[0]))&&utils_type.A.isArray(e[1])&&3===e[1].length&&utils_type.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create vector field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return r=utils_type.A.copyAttributes(i,t.options,"vectorfield"),(s=t.create("curve",[[],[]],r)).elType="vectorfield",s.setF=function(t,e){var i,r;return utils_type.A.isArray(t)?(i=utils_type.A.createFunction(t[0],this.board,e),r=utils_type.A.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),r(t,e)]}):this.F=utils_type.A.createFunction(t,s.board,e),this},s.setF(e[0],"x, y"),s.xData=e[1],s.yData=e[2],s.updateDataArray=function(){var e,i,s,r,o,n,a,h,l,c,u,d,p=this.evalVisProp("scale"),f=utils_type.A.evaluate(this.xData[0]),_=utils_type.A.evaluate(this.xData[1]),g=(utils_type.A.evaluate(this.xData[2])-f)/_,A=utils_type.A.evaluate(this.yData[0]),m=utils_type.A.evaluate(this.yData[1]),b=(utils_type.A.evaluate(this.yData[2])-A)/m,y=this.evalVisProp("arrowhead.enabled");for(y&&(c=(l=this.evalVisProp("arrowhead.size"))/t.unitX,u=l/t.unitY,d=this.evalVisProp("arrowhead.angle")),this.dataX=[],this.dataY=[],s=0,e=f;s<=_;e+=g,s++)for(r=0,i=A;r<=m;i+=b,r++)(o=this.F(e,i))[0]*=p,o[1]*=p,utils_type.A.concat(this.dataX,[e,e+o[0],NaN]),utils_type.A.concat(this.dataY,[i,i+o[1],NaN]),y&&Math.abs(o[0])+Math.abs(o[1])>0&&(a=(n=Math.atan2(o[1],o[0]))+d,h=n-d,utils_type.A.concat(this.dataX,[e+o[0]-Math.cos(a)*c,e+o[0],e+o[0]-Math.cos(h)*c,NaN]),utils_type.A.concat(this.dataY,[i+o[1]-Math.sin(a)*u,i+o[1],i+o[1]-Math.sin(h)*u,NaN]))},s.methodMap=utils_type.A.deepCopy(s.methodMap,{setF:"setF"}),s},jxg.A.registerElement("vectorfield",jxg.A.createVectorField),jxg.A.createSlopeField=function(t,e,i){var s,r,o;if(!(e.length>=3&&(utils_type.A.isFunction(e[0])||utils_type.A.isString(e[0]))&&utils_type.A.isArray(e[1])&&3===e[1].length&&utils_type.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create slope field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return r=utils_type.A.createFunction(e[0],t,"x, y"),e[0]=function(t,e){var i=r(t,e),s=Math.sqrt(1+i*i);return[1/s,i/s]},o=utils_type.A.copyAttributes(i,t.options,"slopefield"),(s=t.create("vectorfield",e,o)).elType="slopefield",s.setF=function(t,e){var i=utils_type.A.createFunction(t,s.board,e);this.F=function(t,e){var s=i(t,e),r=Math.sqrt(1+s*s);return[1/r,s/r]}},s.methodMap=utils_type.A.deepCopy(s.methodMap,{setF:"setF"}),s},jxg.A.registerElement("slopefield",jxg.A.createSlopeField),jxg.A.createSmartLabel=function(t,e,i){var s,r,o,n,a,h;if(0===e.length||[constants.A.OBJECT_CLASS_POINT,constants.A.OBJECT_CLASS_LINE,constants.A.OBJECT_CLASS_CIRCLE].indexOf(e[0].elementClass)<0&&[constants.A.OBJECT_TYPE_POLYGON,constants.A.OBJECT_TYPE_ANGLE].indexOf(e[0].type)<0)throw new Error("JSXGraph: Can't create smartlabel with parent types '"+typeof e[0]+"', '"+typeof e[1]+"'.");return o=e[0],n=e[1]||"",o.elementClass===constants.A.OBJECT_CLASS_POINT?r=utils_type.A.copyAttributes(i,t.options,"smartlabelpoint"):o.elementClass===constants.A.OBJECT_CLASS_LINE?((r=utils_type.A.copyAttributes(i,t.options,"smartlabelline")).rotate=function(){return 180*Math.atan(o.getSlope())/Math.PI},r.visible=function(){return!(o.L()<1.5)}):o.elementClass===constants.A.OBJECT_CLASS_CIRCLE?(r=utils_type.A.copyAttributes(i,t.options,"smartlabelcircle")).visible=function(){return!(o.Radius()<1.5)}:o.type===constants.A.OBJECT_TYPE_POLYGON?r=utils_type.A.copyAttributes(i,t.options,"smartlabelpolygon"):o.type===constants.A.OBJECT_TYPE_ANGLE&&((r=utils_type.A.copyAttributes(i,t.options,"smartlabelangle")).rotate=function(){var t=o.center.coords.usrCoords,e=o.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?i+180:i},r.anchorX=function(){var t=o.center.coords.usrCoords,e=o.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?"right":"left"}),a=function(t,e,i,s){var r;switch(s){case"length":r=function(){return e.L()};break;case"slope":r=function(){return e.Slope()};break;case"area":r=function(){return e.Area()};break;case"radius":r=function(){return e.Radius()};break;case"perimeter":r=function(){return e.Perimeter()};break;case"rad":r=function(){return e.Value()};break;case"deg":r=function(){return 180*e.Value()/Math.PI};break;default:r=function(){return 0}}return function(){var e,i="",s=utils_type.A.evaluate(n),o=t.evalVisProp("digits"),a=t.evalVisProp("unit"),h=t.evalVisProp("prefix"),l=t.evalVisProp("suffix"),c=t.evalVisProp("usemathjax")||t.evalVisProp("usekatex");return""===s?(e=t.useLocale()?t.formatNumberLocale(r(),o):utils_type.A.toFixed(r(),o),i=c?["\\(",h,e,"\\,",a,l,"\\)"].join(""):[h,e,a,l].join("")):i=s,i}},o.elementClass===constants.A.OBJECT_CLASS_POINT?(s=t.create("text",[function(){return o.X()},function(){return o.Y()},""],r),h=function(){var t,e,i="",r=utils_type.A.evaluate(n),a=s.evalVisProp("digits"),h=s.evalVisProp("unit"),l=s.evalVisProp("prefix"),c=s.evalVisProp("suffix"),u=s.evalVisProp("dir"),d=s.evalVisProp("usemathjax")||s.evalVisProp("usekatex");return s.useLocale()?(t=s.formatNumberLocale(o.X(),a),e=s.formatNumberLocale(o.Y(),a)):(t=utils_type.A.toFixed(o.X(),a),e=utils_type.A.toFixed(o.Y(),a)),""===r?"row"===u?i=d?["\\(",l,t,"\\,",h," / ",e,"\\,",h,c,"\\)"].join(""):[l,t," ",h," / ",e," ",h,c].join(""):0===u.indexOf("col")&&(i=d?["\\(",l,"\\left(\\array{",t,"\\,",h,"\\\\ ",e,"\\,",h,"}\\right)",c,"\\)"].join(""):[l,t," ",h,"<br />",e," ",h,c].join("")):i=r,i}):o.elementClass===constants.A.OBJECT_CLASS_LINE?"length"===r.measure?h=a(s=t.create("text",[function(){return.5*(o.point1.X()+o.point2.X())},function(){return.5*(o.point1.Y()+o.point2.Y())},""],r),o,0,"length"):"slope"===r.measure&&(h=a(s=t.create("text",[function(){return.25*o.point1.X()+.75*o.point2.X()},function(){return.25*o.point1.Y()+.75*o.point2.Y()},""],r),o,0,"slope")):o.elementClass===constants.A.OBJECT_CLASS_CIRCLE?"radius"===r.measure?h=a(s=t.create("text",[function(){return o.center.X()+.5*o.Radius()},function(){return o.center.Y()},""],r),o,0,"radius"):"area"===r.measure?h=a(s=t.create("text",[function(){return o.center.X()},function(){return o.center.Y()+.5*o.Radius()},""],r),o,0,"area"):"circumference"!==r.measure&&"perimeter"!==r.measure||(h=a(s=t.create("text",[function(){return o.getLabelAnchor()},""],r),o,0,"perimeter")):o.type===constants.A.OBJECT_TYPE_POLYGON?"area"===r.measure?h=a(s=t.create("text",[function(){return o.getTextAnchor()},""],r),o,0,"area"):"perimeter"===r.measure&&(h=a(s=t.create("text",[function(){var t=o.borders.length-1;return t>=0?[.5*(o.borders[t].point1.X()+o.borders[t].point2.X()),.5*(o.borders[t].point1.Y()+o.borders[t].point2.Y())]:o.getTextAnchor()},""],r),o,0,"perimeter")):o.type===constants.A.OBJECT_TYPE_ANGLE&&(h=a(s=t.create("text",[function(){return o.getLabelAnchor()},""],r),o,0,r.measure)),utils_type.A.exists(s)&&(s.setText(h),o.addChild(s),s.setParents([o])),s},jxg.A.registerElement("smartlabel",jxg.A.createSmartLabel),jxg.A.ForeignObject=function(t,e,i,s,r){this.constructor(t,i,constants.A.OBJECT_TYPE_FOREIGNOBJECT,constants.A.OBJECT_CLASS_OTHER),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this._useUserSize=!1,this.size=[1,1],utils_type.A.exists(r)&&r.length>0&&(this._useUserSize=!0,this.W=utils_type.A.createFunction(r[0],this.board,""),this.H=utils_type.A.createFunction(r[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=s,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this),this.methodMap=jxg.A.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"})},jxg.A.ForeignObject.prototype=new base_element.A,utils_type.A.copyPrototypeMethods(jxg.A.ForeignObject,coordselement.A,"coordsConstructor"),jxg.A.extend(jxg.A.ForeignObject.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a,h,l,c,u=this.transformations.length;return utils_type.A.isObject(this.evalVisProp("precision"))?(o=this.board._inputDevice,n=this.evalVisProp("precision."+o)):n=this.board.options.precision.hasPoint,0===u?(i=t-this.coords.scrCoords[1],s=this.coords.scrCoords[2]-e,i>=-(r=n)&&i-this.size[0]<=r&&s>=-r&&s-this.size[1]<=r):(h=[(a=(a=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],a[1]-this.span[0][1],a[2]-this.span[0][2]],0<=(l=(c=math.A.innerProduct)(h,this.span[1]))&&l<=c(this.span[1],this.span[1])&&0<=(l=c(h,this.span[2]))&&l<=c(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateForeignObject")},updateSize:function(){var t=[0,0];return this._useUserSize?(this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)]):this.rendNode.hasChildNodes()&&(t=this.rendNode.childNodes[0].getBoundingClientRect(),this.size=[t.width,t.height]),this},updateSpan:function(){var t,e,i=this.transformations.length,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t<i;t++)for(e=0;e<3;e++)s[e]=math.A.matVecMult(this.transformations[t].matrix,s[e]);for(e=0;e<3;e++)s[e][1]/=s[e][0],s[e][2]/=s[e][0],s[e][0]/=s[e][0];for(e=1;e<3;e++)s[e][0]-=s[0][0],s[e][1]-=s[0][1],s[e][2]-=s[0][2];this.span=s}return this},addTransform:function(t){var e;if(utils_type.A.isArray(t))for(e=0;e<t.length;e++)this.transformations.push(t[e]);else this.transformations.push(t);return this},getParents:function(){var t=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return 0!==this.parents.length&&(t=this.parents),t},setSize:function(t,e){return this.W=utils_type.A.createFunction(t,this.board,""),this.H=utils_type.A.createFunction(e,this.board,""),this._useUserSize=!0,this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}),jxg.A.createForeignObject=function(t,e,i){var s,r,o=e[0],n=e[1],a=[];if(e.length>=2&&(a=e[2]),s=utils_type.A.copyAttributes(i,t.options,"foreignobject"),!(r=coordselement.A.create(jxg.A.ForeignObject,t,n,s,o,a)))throw new Error("JSXGraph: Can't create foreignObject with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]");return r},jxg.A.registerElement("foreignobject",jxg.A.createForeignObject),jxg.A.registerElement("fo",jxg.A.createForeignObject);var foreignobject=jxg.A.ForeignObject;jxg.A.extend(src_options.A,{axes3d:{axesPosition:"center",xAxis:{visible:!0,point2:{name:"x"},strokeColor:jxg.A.palette.red},yAxis:{visible:!0,point2:{name:"y"},strokeColor:jxg.A.palette.green},zAxis:{visible:!0,point2:{name:"z"},strokeColor:jxg.A.palette.blue},xAxisBorder:{name:"x",visible:"ìnherit",withLabel:!1,label:{position:"50% left",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},yAxisBorder:{name:"y",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[0,-30],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle"}}},zAxisBorder:{name:"z",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},xPlaneRear:{visible:!0,layer:0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",mesh3d:{layer:1}},yPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},yPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1}},axis3d:{highlight:!1,fixed:!0,strokeColor:"black",strokeWidth:1,tabindex:null,point1:{visible:!1,name:"",withLabel:!1},point2:{visible:!1,name:"",withLabel:!1,label:{visible:!0}}},circle3d:{layer:12,point:{visible:!1,name:""},needsRegularUpdate:!0},curve3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,numberPointsHigh:200,needsRegularUpdate:!0},face3d:{transitionProperties:[],layer:12,highlight:!1,tabindex:null,strokeWidth:1,fillColor:jxg.A.palette.yellow,fillOpacity:.4,needsRegularUpdate:!0,shader:{enabled:!1,type:"angle",hue:60,saturation:90,minLightness:30,maxLightness:90}},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{layer:12,strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,needsRegularUpdate:!0,point:{visible:!1,name:""},point1:{visible:!1,name:""},point2:{visible:!1,name:""},straightFirst:!1,straightLast:!1},mesh3d:{layer:12,strokeWidth:1,strokeColor:"#9a9a9a",strokeOpacity:.6,highlight:!1,tabindex:null,needsRegularUpdate:!0,stepWidthU:1,stepWidthV:1},plane3d:{layer:12,strokeWidth:0,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,needsRegularUpdate:!0,visible:!0,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#a7a7a7",fillOpacity:.6,mesh3d:{visible:"inherit"},threePoints:!1,point:{visible:!1,name:"",fixed:!0},point1:{visible:!1,name:""},point2:{visible:!1,name:""},point3:{visible:!1,name:""}},point3d:{layer:13,infoboxDigits:"auto",strokeWidth:0,gradient:"radial",gradientSecondColor:"#555555",fillColor:"yellow",highlightStrokeColor:"#555555",gradientFX:.7,gradientFY:.3,needsRegularUpdate:!0},polygon3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,fillColor:"none",needsRegularUpdate:!0},polyhedron3d:{fillColorArray:["white","black"],needsRegularUpdate:!0},sphere3d:{layer:12,highlight:!1,strokeWidth:1,strokeColor:"#00ff80",fillColor:"white",gradient:"radial",gradientSecondColor:"#00ff80",gradientFX:.7,gradientFY:.3,fillOpacity:.4,needsRegularUpdate:!0},surface3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,stepsU:30,stepsV:30,needsRegularUpdate:!0},text3d:{withLabel:!1,needsRegularUpdate:!0},ticks3d:{visible:!0,ticksDistance:1,majorHeight:10,minorTicks:0,tickEndings:[0,1],drawLabels:!0,needsRegularUpdate:!0,label:{visible:!0,withLabel:!1}},vectorfield3d:{scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI},needsRegularUpdate:!0},view3d:{needsRegularUpdate:!0,depthOrder:{enabled:!1,layers:[12,13]},projection:"parallel",verticalDrag:{enabled:!0,key:"shift"},az:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{pos:"auto",frozen:!1},point2:{pos:"auto",frozen:!1},min:0,max:2*Math.PI,start:1}},el:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:0,max:2*Math.PI,start:.3}},bank:{pointer:{enabled:!0,speed:.08,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:-Math.PI,max:Math.PI,start:0}},trackball:{enabled:!1,outside:!0,button:-1,key:"none"},r:"auto",fov:.4*Math.PI,values:[[0,1.57],[.78,.62],[0,0],[5.49,.62],[4.71,0],[3.93,.62],[3.14,0],[2.36,.62],[1.57,1.57]],infobox:{strokeColor:"#000000",fontSize:16,useKatex:!1,useMathjax:!1,intl:{enabled:!0,options:{minimumFractionDigits:2,maximumFractionDigits:3}}},_currentView:-1}});var options3d=jxg.A.Options;jxg.A.View3D=function(t,e,i){this.constructor(t,i,constants.A.OBJECT_TYPE_VIEW3D,constants.A.OBJECT_CLASS_3D),this.objects={},this.depthOrdered={},this.elementsByName={},this.defaultAxes=null,this.angles={az:null,el:null,bank:null},this.matrix3DRot=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3DRotShift=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3D=[[1,0,0,0],[0,1,0,0],[0,0,1,0]],this.boxToCam=[],this.llftCorner=e[0],this.size=e[1],this.bbox3D=e[2],this.r=-1,this.focalDist=-1,this.projectionType="parallel",this.trackballEnabled=!1,this.timeoutAzimuth=null,this.zIndexMin=1/0,this.zIndexMax=-1/0,this.id=this.board.setId(this,"V"),this.board.finalizeAdding(this),this.elType="view3d",this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.View3D.prototype=new base_element.A,jxg.A.extend(jxg.A.View3D.prototype,{create:function(t,e,i){var s=[];return t.indexOf("3d")>0&&s.push(this),this.board.create(t,s.concat(e),i)},select:function(t,e){var i,s,r,o,n=t;if(null===n)return n;if(utils_type.A.isString(n)&&""!==n)utils_type.A.exists(this.objects[n])?n=this.objects[n]:utils_type.A.exists(this.elementsByName[n])&&(n=this.elementsByName[n]);else if(!e&&(utils_type.A.isFunction(n)||utils_type.A.isObject(n)&&!utils_type.A.isFunction(n.setAttribute))){for(s={},o=(i=utils_type.A.filterElements(this.objectsList,n)).length,r=0;r<o;r++)s[i[r].id]=i[r];n=new composition(s)}else utils_type.A.isObject(n)&&utils_type.A.exists(n.id)&&!utils_type.A.exists(this.objects[n.id])&&(n=null);return n},setAnglesFromRotation:function(){var t,e,i,s,r,o,n,a=this.matrix3DRot;(t=Math.sqrt(a[1][3]*a[1][3]+a[2][3]*a[2][3]))>math.A.eps?(e=a[2][3]/t,i=a[1][3]/t):(e=Math.cos(this.angles.bank),i=Math.sin(this.angles.bank)),a=math.A.matMatMult([[1,0,0,0],[0,e,-i,0],[0,i,e,0],[0,0,0,1]],a),this.angles.bank=Math.atan2(i,e),s=a[2][3],r=a[3][3],a=math.A.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,s,r],[0,0,-r,s]],a),this.angles.el=Math.atan2(r,s),o=-a[1][1],n=a[3][1],this.angles.az=Math.atan2(n,o),this.angles.az<0&&(this.angles.az+=2*Math.PI),this.setSlidersFromAngles()},anglesHaveMoved:function(){return this._hasMoveAz||this._hasMoveEl||Math.abs(this.angles.az-this.az_slide.Value())>math.A.eps||Math.abs(this.angles.el-this.el_slide.Value())>math.A.eps||Math.abs(this.angles.bank-this.bank_slide.Value())>math.A.eps},getAnglesFromSliders:function(){this.angles.az=this.az_slide.Value(),this.angles.el=this.el_slide.Value(),this.angles.bank=this.bank_slide.Value()},setSlidersFromAngles:function(){this.az_slide.setValue(this.angles.az),this.el_slide.setValue(this.angles.el),this.bank_slide.setValue(this.angles.bank)},getRotationFromAngles:function(){var t,e,i,s,r,o,n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return t=this.angles.az,e=this.angles.el,i=this.angles.bank,s=-Math.sin(e),n[1][1]=-Math.cos(t),n[1][2]=Math.sin(t),n[1][3]=0,n[2][1]=s*Math.sin(t),n[2][2]=s*Math.cos(t),n[2][3]=Math.cos(e),n[3][1]=Math.cos(e)*Math.sin(t),n[3][2]=Math.cos(e)*Math.cos(t),n[3][3]=Math.sin(e),r=Math.cos(i),o=Math.sin(i),n=math.A.matMatMult([[1,0,0,0],[0,r,o,0],[0,-o,r,0],[0,0,0,1]],n)},_projectToSphere:function(t,e,i){var s,r=math.A.hypot(e,i);return r<.7071067811865475*t?Math.sqrt(t*t-r*r):(s=t/1.414213562373095)*s/r},updateProjectionTrackball:function(t){var e,i,s,r,o,n,a,h,l,c,u,d,p=100,f=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return utils_type.A.exists(this._trackball)?((e=this._trackball.dx)*e+(i=this._trackball.dy)*i>math.A.eps&&(p=.25*(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY),r=[o=this._trackball.x,n=this._trackball.y,this._projectToSphere(p,o,n)],s=[o-=e,n-=i,this._projectToSphere(p,o,n)],d=math.A.crossProduct(s,r),l=math.A.hypot(d[0],d[1],d[2]),d[0]/=l,d[1]/=l,d[2]/=l,h=(h=(h=geometry.A.distance(r,s,3)/(2*p))>1?1:h)<-1?-1:h,a=2*Math.asin(h),h=1-(c=Math.cos(a)),u=Math.sin(a),f[1][1]=c+d[0]*d[0]*h,f[2][1]=d[1]*d[0]*h+d[2]*u,f[3][1]=d[2]*d[0]*h-d[1]*u,f[1][2]=d[0]*d[1]*h-d[2]*u,f[2][2]=c+d[1]*d[1]*h,f[3][2]=d[2]*d[1]*h+d[0]*u,f[1][3]=d[0]*d[2]*h+d[1]*u,f[2][3]=d[1]*d[2]*h-d[0]*u,f[3][3]=c+d[2]*d[2]*h),f=math.A.matMatMult(f,this.matrix3DRot)):this.matrix3DRot},updateAngleSliderBounds:function(){var t,e,i,s,r,o,n,a,h,l,c;this.trackballEnabled=this.evalVisProp("trackball.enabled"),this.trackballEnabled?(this.az_slide.setMin(0),this.az_slide.setMax(2*Math.PI),this.el_slide.setMin(-.5*Math.PI),this.el_slide.setMax(.5*Math.PI),this.bank_slide.setMin(-Math.PI),this.bank_slide.setMax(Math.PI)):(this.az_slide.setMin(this.visProp.az.slider.min),this.az_slide.setMax(this.visProp.az.slider.max),this.el_slide.setMin(this.visProp.el.slider.min),this.el_slide.setMax(this.visProp.el.slider.max),this.bank_slide.setMin(this.visProp.bank.slider.min),this.bank_slide.setMax(this.visProp.bank.slider.max)),t=this.az_slide._smax,e=this.az_slide._smin,i=this.el_slide._smax,s=this.el_slide._smin,l=this.bank_slide._smax,c=this.bank_slide._smin,this.trackballEnabled?(r=math.A.mod(this.angles.el,2*Math.PI),.5*Math.PI<r&&r<1.5*Math.PI&&(this.angles.el=Math.PI-r,this.angles.az=math.A.wrap(this.angles.az+Math.PI,e,t),this.angles.bank=math.A.wrap(this.angles.bank+Math.PI,c,l)),this.angles.az=math.A.wrap(this.angles.az,e,t),this.angles.el=math.A.wrap(this.angles.el,s,i),this.angles.bank=math.A.wrap(this.angles.bank,c,l)):(h=function(t){return t<s?s-t:i<t?t-i:0},o=.5*(s+i),n=math.A.wrap(this.angles.el,o-Math.PI,o+Math.PI),a=math.A.wrap(Math.PI-this.angles.el,o-Math.PI,o+Math.PI),h(n)<=h(a)?this.angles.el=math.A.clamp(n,s,i):(this.angles.el=math.A.clamp(a,s,i),this.angles.az=math.A.wrap(this.angles.az+Math.PI,e,t),this.angles.bank=math.A.wrap(this.angles.bank+Math.PI,c,l)),this.angles.az=math.A.wrapAndClamp(this.angles.az,e,t,2*Math.PI),this.angles.bank=math.A.wrapAndClamp(this.angles.bank,c,l,2*Math.PI),this.matrix3DRot=this.getRotationFromAngles()),this.setSlidersFromAngles()},_updateCentralProjection:function(){var t,e;return"auto"===(t=this.evalVisProp("r"))&&(t=1.01*math.A.hypot(this.bbox3D[0][0]-this.bbox3D[0][1],this.bbox3D[1][0]-this.bbox3D[1][1],this.bbox3D[2][0]-this.bbox3D[2][1])),this.boxToCam=this.matrix3DRot.map(function(t){return t.slice()}),this.boxToCam[3][0]=-t,this.focalDist=1/Math.tan(.5*this.evalVisProp("fov")),e=[[0,0,0,-1],[0,this.focalDist,0,0],[0,0,this.focalDist,0],[320/-12,0,0,28/-12]],math.A.matMatMult(e,this.boxToCam)},update:function(){var t,e,i,s,r,o=this.r,n=[[1,0,0,0],[0,-o,0,0],[0,0,-o,0],[0,0,0,1]];if(!(utils_type.A.exists(this.el_slide)&&utils_type.A.exists(this.az_slide)&&utils_type.A.exists(this.bank_slide)&&this.needsUpdate))return this.needsUpdate=!1,this;if(t=[[1,0,0],[0,1,0],[0,0,1]],this.projectionType=this.evalVisProp("projection").toLowerCase(),this.trackballEnabled!==this.evalVisProp("trackball.enabled")&&this.updateAngleSliderBounds(),this._hasMoveTrackball?(this.matrix3DRot=this.updateProjectionTrackball(),this.setAnglesFromRotation()):this.anglesHaveMoved()&&(this.getAnglesFromSliders(),this.matrix3DRot=this.getRotationFromAngles()),this.shift=[[1,0,0,0],[-.5*(this.bbox3D[0][0]+this.bbox3D[0][1]),1,0,0],[-.5*(this.bbox3D[1][0]+this.bbox3D[1][1]),0,1,0],[-.5*(this.bbox3D[2][0]+this.bbox3D[2][1]),0,0,1]],"central"===this.projectionType)i=.8,t[1][1]=this.size[0]/i,t[2][2]=this.size[1]/i,t[1][0]=this.llftCorner[0]+.5*t[1][1]*i,t[2][0]=this.llftCorner[1]+.5*t[2][2]*i,this.viewPortTransform=t,e=this._updateCentralProjection(),this.matrix3D=math.A.matMatMult(e,this.shift);else s=this.bbox3D[0][1]-this.bbox3D[0][0],r=this.bbox3D[1][1]-this.bbox3D[1][0],t[1][1]=this.size[0]/s,t[2][2]=this.size[1]/r,t[1][0]=this.llftCorner[0]+.5*t[1][1]*s,t[2][0]=this.llftCorner[1]+.5*t[2][2]*r,this.matrix3D=math.A.matMatMult(t,math.A.matMatMult(math.A.matMatMult(this.matrix3DRot,n),this.shift).slice(0,3));return this.matrix3DRotShift=math.A.matMatMult(this.matrix3DRot,this.shift),this},compareDepth:function(t,e){return t.zIndex-e.zIndex},updateZIndices:function(){var t,e;for(t in this.objects)this.objects.hasOwnProperty(t)&&((e=this.objects[t]).type===constants.A.OBJECT_TYPE_LINE3D||e.type===constants.A.OBJECT_TYPE_POLYGON3D)&&utils_type.A.exists(e.element2D)&&e.element2D.evalVisProp("visible")&&e.updateZIndex()},updateShaders:function(){var t,e,i;for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t],utils_type.A.exists(e.shader)&&((i=e.shader())<this.zIndexMin?this.zIndexMin=i:i>this.zIndexMax&&(this.zIndexMax=i)))},updateDepthOrdering:function(){var t,e,i,s,r,o,n;for(o=this.evalVisProp("depthorder.layers"),i=0;i<o.length;i++)this.depthOrdered[o[i]]=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&((e=this.objects[t]).type===constants.A.OBJECT_TYPE_FACE3D||e.type===constants.A.OBJECT_TYPE_LINE3D||e.type===constants.A.OBJECT_TYPE_POINT3D||e.type===constants.A.OBJECT_TYPE_POLYGON3D)&&utils_type.A.exists(e.element2D)&&e.element2D.evalVisProp("visible")&&(n=e.element2D.evalVisProp("layer"),o.indexOf(n)>=0&&this.depthOrdered[n].push(e));if(this.board.renderer&&"svg"===this.board.renderer.type)for(i=0;i<o.length;i++)for(n=o[i],this.depthOrdered[n].sort(this.compareDepth.bind(this)),r=this.depthOrdered[n],s=0;s<r.length;s++)this.board.renderer.setLayer(r[s].element2D,n);return this},updateRenderer:function(){return this.needsUpdate?(this.depthOrdered={},void 0!==this.shift&&this.evalVisProp("depthorder.enabled")&&(this.updateZIndices(),this.updateShaders(),this.board.renderer&&"svg"===this.board.renderer.type&&this.updateDepthOrdering()),this.needsUpdate=!1,this):this},removeObject:function(t,e){var i,s;if(utils_type.A.isArray(t)){for(i=0;i<t.length;i++)this.removeObject(t[i]);return this}if(t=this.select(t),!utils_type.A.exists(t)||utils_type.A.isString(t))return this;try{for(s in t.childElements)t.childElements.hasOwnProperty(s)&&this.removeObject(t.childElements[s]);delete this.objects[t.id]}catch(e){jxg.A.debug("View3D "+t.id+": Could not be removed: "+e)}return this.board.removeObject(t,e),this},worldToFocal:function(t,e=!0){var i,s=math.A.matVecMult(this.boxToCam,math.A.matVecMult(this.shift,t));if(s[3]-=s[0]*this.focalDist,e)return s;for(i=1;i<4;i++)s[i]/=s[0];return s.slice(1,4)},project3DTo2D:function(t,e,i){var s,r;return 3===arguments.length?s=[1,t,e,i]:3===t.length?(s=t.slice()).unshift(1):s=t,r=math.A.matVecMult(this.matrix3D,s),"central"===this.projectionType?(r[1]/=r[0],r[2]/=r[0],r[3]/=r[0],r[0]/=r[0],math.A.matVecMult(this.viewPortTransform,r.slice(0,3))):r},_getW0:function(t,e,i){var s,r=math.A.inverse(t),o=r[0][0]+e[1]*r[0][1]+e[2]*r[0][2],n=r[3][0]+e[1]*r[3][1]+e[2]*r[3][2];return s=i*r[0][3]-r[3][3],[1/((n*r[0][3]-o*r[3][3])/s),(n-o*i)/s]},project2DTo3DPlane:function(t,e,i){var s,r,o,n,a,h,l,c,u=i.slice(1)||[0,0,0],d=e.slice(1);if(n=math.A.norm(d,3),o=math.A.innerProduct(u,d,3)/n,"parallel"===this.projectionType){(s=this.matrix3D.slice(0,3)).push([0,d[0],d[1],d[2]]),(r=t.coords.usrCoords.slice()).push(o);try{1===s[2][3]&&(s[2][1]=s[2][2]=.001*math.A.eps),a=math.A.Numerics.Gauss(s,r)}catch(t){a=[0,NaN,NaN,NaN]}}else{s=this.matrix3D,r=t.coords.usrCoords.slice(),h=math.A.Numerics.Gauss(this.viewPortTransform,r),l=(c=this._getW0(s,h,o))[0],r=[h[0]*l,h[1]*l,h[2]*l,c[1]*l];try{1===s[2][3]&&(s[2][1]=s[2][2]=.001*math.A.eps),(a=math.A.Numerics.Gauss(s,r))[1]/=a[0],a[2]/=a[0],a[3]/=a[0],a[0]/=a[0]}catch(t){a=[0,NaN,NaN,NaN]}}return a},projectScreenToSegment:function(t,e,i){var s,r,o,n,a,h,l,c=this.project3DTo2D(e).slice(1,3),u=this.project3DTo2D(i).slice(1,3),d=[u[0]-c[0],u[1]-c[1]],p=math.A.innerProduct(d,d),f=[t[0]-c[0],t[1]-c[1]],_=math.A.innerProduct(f,d)/p;return"central"===this.projectionType?(s=[.5*(e[0]+i[0]),.5*(e[1]+i[1]),.5*(e[2]+i[2])],o=[(r=this.project3DTo2D(s).slice(1,3))[0]-c[0],r[1]-c[1]],a=(1-(n=math.A.innerProduct(o,d)/p))*_/((1-2*n)*_+n)):a=_,[1,(l=1-(h=Math.min(Math.max(a,0),1)))*e[0]+h*i[0],l*e[1]+h*i[1],l*e[2]+h*i[2]]},project2DTo3DVertical:function(t,e){var i=t.coords.usrCoords.slice(1,3),s=[e[1],e[2],this.bbox3D[2][0]],r=[e[1],e[2],this.bbox3D[2][1]];return this.projectScreenToSegment(i,s,r)},project3DToCube:function(t){var e=this.bbox3D,i=!1;return t[1]<e[0][0]&&(t[1]=e[0][0],i=!0),t[1]>e[0][1]&&(t[1]=e[0][1],i=!0),t[2]<e[1][0]&&(t[2]=e[1][0],i=!0),t[2]>e[1][1]&&(t[2]=e[1][1],i=!0),t[3]<=e[2][0]&&(t[3]=e[2][0],i=!0),t[3]>=e[2][1]&&(t[3]=e[2][1],i=!0),[t,i]},intersectionLineCube:function(t,e,i){var s,r,o,n,a;for(a=3===e.length?e:e.slice(1),s=i,r=0;r<3;r++)0!==a[r]&&(o=(this.bbox3D[r][0]-t[r+1])/a[r],n=(this.bbox3D[r][1]-t[r+1])/a[r],s=i<0?Math.max(s,Math.min(o,n)):Math.min(s,Math.max(o,n)));return s},isInCube:function(t,e){var i;if(4===t.length){if(0===t[0])return!1;i=t.slice(1)}return i[0]>this.bbox3D[0][0]-math.A.eps&&i[0]<this.bbox3D[0][1]+math.A.eps&&i[1]>this.bbox3D[1][0]-math.A.eps&&i[1]<this.bbox3D[1][1]+math.A.eps&&i[2]>this.bbox3D[2][0]-math.A.eps&&i[2]<this.bbox3D[2][1]+math.A.eps},intersectionPlanePlane:function(t,e,i){var s,r,o,n,a,h=[!1,!1];return i=i||e.d,(n=math.A.crossProduct(t.normal.slice(1),e.normal.slice(1))).unshift(0),s=math.A.Geometry.meet3Planes(t.normal,t.d,e.normal,i,n,0),a=math.A.Geometry.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),o=this.intersectionLineCube(s,a,1/0),r=math.A.axpy(o,a,s),this.isInCube(r)&&(h[0]=r),o=this.intersectionLineCube(s,a,-1/0),r=math.A.axpy(o,a,s),this.isInCube(r)&&(h[1]=r),h},intersectionPlaneFace:function(t,e){var i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m=[],b=[],y=[];for((A=math.A.crossProduct(t.normal.slice(1),e.normal.slice(1))).unshift(0),r=geometry.A.meet3Planes(t.normal,t.d,e.normal,e.d,A,0),_=geometry.A.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),l=e.polyhedron.faces[e.faceNumber],o=e.polyhedron.coords,c=l.length,i=1;i<=c;i++)n=o[l[i-1]],g=[0,(a=o[l[i%c]])[1]-n[1],a[2]-n[2],a[3]-n[3]],u=Math.random(),d=Math.random(),p=Math.random(),f=Math.random(),b=[[u*_[1]+d*_[3],u*-g[1]+d*-g[3]],[p*_[2]+f*_[3],p*-g[2]+f*-g[3]]],y=[u*(n[1]-r[1])+d*(n[3]-r[3]),p*(n[2]-r[2])+f*(n[3]-r[3])],(s=numerics.A.Gauss(b,y)[1])>-math.A.eps&&s<1+math.A.eps&&(h=[1,n[1]+s*g[1],n[2]+s*g[2],n[3]+s*g[3]],m.push(h));return m},intersectionPlanePolyhedron:function(t,e){var i,s,r,o,n,a,h=1e-12,l=[],c=[],u=[],d=[];for(i=0;i<e.numberFaces;i++)if(!(e.def.faces[i].length<3||(r=this.intersectionPlaneFace(t,e.faces[i])).length<2||4!==r[0].length||4!==r[1].length)){for(s=0;s<l.length&&!(geometry.A.distance(r[0],l[s][0],4)<h&&geometry.A.distance(r[1],l[s][1],4)<h||geometry.A.distance(r[0],l[s][1],4)<h&&geometry.A.distance(r[1],l[s][0],4)<h);s++);s===l.length&&l.push(r.slice())}if(0===l.length)return{X:c,Y:u,Z:d};n=0,i=0;do{for(4===(o=l[n][i]).length&&(c.push(o[1]),u.push(o[2]),d.push(o[3])),i=(i+1)%2,o=l[n][i],a=n,s=0;s<l.length;s++){if(s!==n&&geometry.A.distance(o,l[s][0])<h){n=s,i=0;break}if(s!==n&&geometry.A.distance(o,l[s][1])<h){n=s,i=1;break}}if(n===a){console.log("Error face3d intersection update: did not find next",n,i);break}}while(0!==n);return c.push(c[0]),u.push(u[0]),d.push(d[0]),{X:c,Y:u,Z:d}},getMesh:function(t,e,i){var s,r,o,n,a,h,l,c=[0,0,0],u=utils_type.A.evaluate(e[2]),d=utils_type.A.evaluate(i[2]),p=[],f=[];for(h=(utils_type.A.evaluate(e[1])-utils_type.A.evaluate(e[0]))/u,l=(utils_type.A.evaluate(i[1])-utils_type.A.evaluate(i[0]))/d,s=0;s<=u;s++){for(o=e[0]+h*s,r=0;r<=d;r++)n=i[0]+l*r,c=utils_type.A.isFunction(t)?t(o,n):[t[0](o,n),t[1](o,n),t[2](o,n)],a=this.project3DTo2D(c),p.push(a[1]),f.push(a[2]);p.push(NaN),f.push(NaN)}for(r=0;r<=d;r++){for(n=i[0]+l*r,s=0;s<=u;s++)o=e[0]+h*s,c=utils_type.A.isFunction(t)?t(o,n):[t[0](o,n),t[1](o,n),t[2](o,n)],a=this.project3DTo2D(c),p.push(a[1]),f.push(a[2]);p.push(NaN),f.push(NaN)}return[p,f]},animateAzimuth:function(){var t=this.az_slide._smin,e=this.az_slide._smax-t,i=this.az_slide.Value()+.1;this.az_slide.position=(i-t)/e,this.az_slide.position>1&&(this.az_slide.position=0),this.board._change3DView=!0,this.board.update(),this.board._change3DView=!1,this.timeoutAzimuth=setTimeout(function(){this.animateAzimuth()}.bind(this),200)},stopAzimuth:function(){clearTimeout(this.timeoutAzimuth),this.timeoutAzimuth=null},isVerticalDrag:function(){var t=this.board;return!!this.evalVisProp("verticaldrag.enabled")&&t["_"+this.evalVisProp("verticaldrag.key")+"Key"]},setView:function(t,e,i){return i=i||this.r,this.az_slide.setValue(t),this.el_slide.setValue(e),this.r=i,this.board.update(),this},nextView:function(){var t=this.evalVisProp("values"),e=this.visProp._currentview;return e=(e+1)%t.length,this.setCurrentView(e),this},previousView:function(){var t=this.evalVisProp("values"),e=this.visProp._currentview;return e=(e+t.length-1)%t.length,this.setCurrentView(e),this},setCurrentView:function(t){var e=this.evalVisProp("values");return(t<0||t>=e.length)&&(t=(t%e.length+e.length)%e.length),this.setView(e[t][0],e[t][1],e[t][2]),this.visProp._currentview=t,this},_azEventHandler:function(t){var e=this.az_slide._smax,i=this.az_slide._smin,s=(e-i)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),r=t.movementX,o=this.az_slide.Value(),n=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("az.keyboard.enabled")&&("ArrowRight"===t.key?o+=this.evalVisProp("az.keyboard.step")*Math.PI/180:"ArrowLeft"===t.key&&(o-=this.evalVisProp("az.keyboard.step")*Math.PI/180)),this.evalVisProp("az.pointer.enabled")&&0!==r&&null==t.key&&(o+=r*s),this.evalVisProp("az.continuous")?o=math.A.wrap(o,i,e):o>0?o=Math.min(e,o):o<0&&(o=Math.max(i,o)),this.setView(o,n)),this},_elEventHandler:function(t){var e=this.el_slide._smax,i=this.el_slide._smin,s=(e-i)/this.board.canvasHeight*this.evalVisProp("el.pointer.speed"),r=t.movementY,o=this.az_slide.Value(),n=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("el.keyboard.enabled")&&("ArrowUp"===t.key?n-=this.evalVisProp("el.keyboard.step")*Math.PI/180:"ArrowDown"===t.key&&(n+=this.evalVisProp("el.keyboard.step")*Math.PI/180)),this.evalVisProp("el.pointer.enabled")&&0!==r&&null==t.key&&(n+=r*s),this.evalVisProp("el.continuous")&&!this.trackballEnabled?n=math.A.wrap(n,i,e):n>0?n=Math.min(e,n):n<0&&(n=Math.max(i,n)),this.setView(o,n)),this},_bankEventHandler:function(t){var e,i=this.bank_slide._smax,s=this.bank_slide._smin,r=t.deltaY,o=this.bank_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("bank.keyboard.enabled")&&(e=this.evalVisProp("bank.keyboard.step")*Math.PI/180,"."===t.key||"<"===t.key?o-=e:","!==t.key&&">"!==t.key||(o+=e)),this.evalVisProp("bank.pointer.enabled")&&0!==r&&null==t.key&&(o+=r*((i-s)/this.board.canvasHeight*this.evalVisProp("bank.pointer.speed")),t.preventDefault()),o=this.evalVisProp("bank.continuous")?math.A.wrap(o,s,i):math.A.clamp(o,s,i),this.bank_slide.setValue(o),this.board.update()),this},_trackballHandler:function(t){var e,i,s,r=this.board.getMousePosition(t);return s=new base_coords.A(constants.A.COORDS_BY_USER,[this.llftCorner[0]+.5*this.size[0],this.llftCorner[1]+.5*this.size[1]],this.board),e=r[0]-s.scrCoords[1],i=r[1]-s.scrCoords[2],this._trackball={dx:t.movementX,dy:-t.movementY,x:e,y:-i},this.board.update(),this},pointerDownHandler:function(t){var e,i,s;this._hasMoveAz=!1,this._hasMoveEl=!1,this._hasMoveBank=!1,this._hasMoveTrackball=!1,this.board.mode===this.board.BOARD_MODE_NONE&&(this.board._change3DView=!0,this.evalVisProp("trackball.enabled")?(e=this.evalVisProp("trackball.button"),i=this.evalVisProp("trackball.key"),-1!==e&&e!==t.button||!("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)||(s=this.evalVisProp("trackball.outside")?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(this.evalVisProp("az.pointer.enabled")&&(e=this.evalVisProp("az.pointer.button"),i=this.evalVisProp("az.pointer.key"),-1!==e&&e!==t.button||!("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)||(s=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),this.evalVisProp("el.pointer.enabled")&&(e=this.evalVisProp("el.pointer.button"),i=this.evalVisProp("el.pointer.key"),-1!==e&&e!==t.button||!("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)||(s=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0)),this.evalVisProp("bank.pointer.enabled")&&(e=this.evalVisProp("bank.pointer.button"),i=this.evalVisProp("bank.pointer.key"),-1!==e&&e!==t.button||!("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)||(s=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,env.A.addEvent(s,"wheel",this._bankEventHandler,this,{passive:!1}),this._hasMoveBank=!0))),env.A.addEvent(document,"pointerup",this.pointerUpHandler,this))},pointerUpHandler:function(t){var e;this._hasMoveAz&&(e=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(e=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(e=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,env.A.removeEvent(e,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(e=this.evalVisProp("trackball.outside")?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),env.A.removeEvent(document,"pointerup",this.pointerUpHandler,this),this.board._change3DView=!1}}),jxg.A.createView3D=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_=e[0],g=e[1];return r=utils_type.A.copyAttributes(i,t.options,"view3d"),(s=new jxg.A.View3D(t,e,r)).defaultAxes=s.create("axes3d",[],r),h=_[0],l=_[1],c=g[0],u=g[1],(o=utils_type.A.copyAttributes(r,t.options,"view3d","az","slider")).name="az",(n=utils_type.A.copyAttributes(r,t.options,"view3d","el","slider")).name="el",(a=utils_type.A.copyAttributes(r,t.options,"view3d","bank","slider")).name="bank",f=utils_type.A.evaluate(o.point1.pos),d=utils_type.A.isArray(f)?f:[h-1,l-2],f=utils_type.A.evaluate(o.point2.pos),p=utils_type.A.isArray(f)?f:[h+c+1,l-2],s.az_slide=t.create("slider",[d,p,[utils_type.A.evaluate(o.min),utils_type.A.evaluate(o.start),utils_type.A.evaluate(o.max)]],o),s.inherits.push(s.az_slide),s.az_slide.elType="view3d_slider",f=utils_type.A.evaluate(n.point1.pos),d=utils_type.A.isArray(f)?f:[h-1,l],f=utils_type.A.evaluate(n.point2.pos),p=utils_type.A.isArray(f)?f:[h-1,l+u],s.el_slide=t.create("slider",[d,p,[utils_type.A.evaluate(n.min),utils_type.A.evaluate(n.start),utils_type.A.evaluate(n.max)]],n),s.inherits.push(s.el_slide),s.el_slide.elType="view3d_slider",f=utils_type.A.evaluate(a.point1.pos),d=utils_type.A.isArray(f)?f:[h-1,l+u+2],f=utils_type.A.evaluate(a.point2.pos),p=utils_type.A.isArray(f)?f:[h+c+1,l+u+2],s.bank_slide=t.create("slider",[d,p,[utils_type.A.evaluate(a.min),utils_type.A.evaluate(a.start),utils_type.A.evaluate(a.max)]],a),s.inherits.push(s.bank_slide),s.bank_slide.elType="view3d_slider",s.board.infobox.visProp=utils_type.A.merge(s.board.infobox.visProp,r.infobox),s.board.highlightInfobox=function(t,e,i){var r,o,n,a,h,l,c="",u=i.board,d=null;for(this.mode===this.BOARD_MODE_DRAG&&(c=s.isVerticalDrag()?'<span style="color:black; font-size:200%">⇅ &nbsp;</span>':'<span style="color:black; font-size:200%">⇄ &nbsp;</span>'),o=0;o<i.parents.length&&!(d=u.objects[i.parents[o]]).is3D;o++);if(d&&utils_type.A.exists(d.element2D)){if(a=[1,0,0,d.coords[3]],s._w0=math.A.innerProduct(s.matrix3D[0],a,4),n=s.project2DTo3DPlane(d.element2D,[1,0,0,1],a),!s.isInCube(n))return void s.board.highlightCustomInfobox("",d);r=d.evalVisProp("infoboxdigits"),l=s.board.infobox,h="auto"===r?l.useLocale()?[c,"(",l.formatNumberLocale(d.X())," | ",l.formatNumberLocale(d.Y())," | ",l.formatNumberLocale(d.Z()),")"]:[c,"(",utils_type.A.autoDigits(d.X())," | ",utils_type.A.autoDigits(d.Y())," | ",utils_type.A.autoDigits(d.Z()),")"]:l.useLocale()?[c,"(",l.formatNumberLocale(d.X(),r)," | ",l.formatNumberLocale(d.Y(),r)," | ",l.formatNumberLocale(d.Z(),r),")"]:[c,"(",utils_type.A.toFixed(d.X(),r)," | ",utils_type.A.toFixed(d.Y(),r)," | ",utils_type.A.toFixed(d.Z(),r),")"],s.board.highlightCustomInfobox(h.join(""),d)}else s.board.highlightCustomInfobox("("+t+", "+e+")",i)},s.BOARD_MODE_NONE=0,env.A.addEvent(t.containerObj,"keydown",function(t){var e,i=!1;!s.evalVisProp("el.keyboard.enabled")||"ArrowUp"!==t.key&&"ArrowDown"!==t.key||("none"===(e=s.evalVisProp("el.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(s._elEventHandler(t),i=!0),!s.evalVisProp("az.keyboard.enabled")||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||("none"===(e=s.evalVisProp("az.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(s._azEventHandler(t),i=!0),!s.evalVisProp("bank.keyboard.enabled")||","!==t.key&&"<"!==t.key&&"."!==t.key&&">"!==t.key||("none"===(e=s.evalVisProp("bank.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(s._bankEventHandler(t),i=!0),"PageUp"===t.key?(s.nextView(),i=!0):"PageDown"===t.key&&(s.previousView(),i=!0),i&&t.preventDefault(),this.board._change3DView=!1},s),env.A.addEvent(t.containerObj,"pointerdown",s.pointerDownHandler,s),s.getAnglesFromSliders(),s.matrix3DRot=s.getRotationFromAngles(),s.updateAngleSliderBounds(),s.board.update(),s},jxg.A.registerElement("view3d",jxg.A.createView3D);var view3d=jxg.A.View3D;jxg.A.GeometryElement3D=function(t,e){this.elType=e,this.view=t,this.id=this.view.board.setId(this,e),this.element2D=null,this.is3D=!0,this.zIndex=0,this.view.objects[this.id]=this,""!==this.name&&(this.view.elementsByName[this.name]=this)},jxg.A.extend(jxg.A.GeometryElement3D.prototype,{setAttr2D:function(t){var e=t;return e.name=this.name,e.element3d=this,e.id=null,e},setAttribute:function(t){var e,i,s,r,o,n={};for(e=0;e<arguments.length;e++)r=arguments[e],utils_type.A.isString(r)?(o=r.split(":"),n[utils_type.A.trim(o[0])]=utils_type.A.trim(o[1])):utils_type.A.isArray(r)?n[r[0]]=r[1]:jxg.A.extend(n,r);for(e in n)if(n.hasOwnProperty(e))switch(i=e.replace(/\s+/g,"").toLowerCase(),s=n[e],i){case"numberpointshigh":case"stepsu":case"stepsv":utils_type.A.exists(this.visProp[i])&&(!jxg.A.Validator[i]||jxg.A.Validator[i]&&jxg.A.Validator[i](s)||jxg.A.Validator[i]&&utils_type.A.isFunction(s)&&jxg.A.Validator[i](s()))&&(s=(!s.toLowerCase||"false"!==s.toLowerCase())&&s,this._set(i,s));break;default:utils_type.A.exists(this.element2D)&&this.element2D.setAttribute(n)}},getAttribute:function(t){var e;switch(t=t.toLowerCase()){case"numberpointshigh":case"stepsu":case"stepsv":e=this.visProp[t];break;default:utils_type.A.exists(this.element2D)&&(e=this.element2D.getAttribute(t))}return e},getAttributes:function(){var t,e,i={},s=["numberpointshigh","stepsu","stepsv"],r=s.length;for(utils_type.A.exists(this.element2D)&&(i=utils_type.A.merge(this.element2D.getAttributes())),t=0;t<r;t++)e=s[t],utils_type.A.exists(this.visProp[e])&&(i[e]=this.visProp[e]);return i},addTransformGeneric:function(t,e){var i,s=utils_type.A.isArray(e)?e:[e],r=s.length;for(0===this.transformations.length&&(this.baseElement=t),i=0;i<r;i++)this.transformations.push(s[i]);return this},setPosition2D:function(t){},projectCoords:function(t,e){},remove:function(){}});var element3d=jxg.A.GeometryElement3D;jxg.A.createAxes3D=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m,b,y,v=e[0],C=["x","y","z"],P="Axis",x=["Rear","Front"],E=[0,0,0],O=[0,0,0],M={};if(utils_type.A.exists(v.bbox3D))for(s=0;s<C.length;s++)E[s]=v.bbox3D[s][0],O[s]=v.bbox3D[s][1];else for(s=0;s<C.length;s++)E[s]=e[1][s],O[s]=e[2][1];for(l=(h=utils_type.A.copyAttributes(i,t.options,"axes3d")).axesposition,s=0;s<C.length;s++)m=(c=C[s])+P,"center"===l?(d=[0,0,0],(p=[0,0,0])[s]=O[s],M[m]=v.create("axis3d",[d,p],h[m.toLowerCase()]),M[m].view=v):"border"===l&&(m+="Border",d=E.slice(),p=O.slice(),"z"===c?(d[1]=O[1],p[0]=E[0]):"x"===c?(d=[E[0],O[1],E[2]],p=[O[0],O[1],E[2]]):(d=[O[0],E[1],E[2]],p=[O[0],O[1],E[2]]),p[s]=O[s],M[m]=v.create("axis3d",[d,p],h[m.toLowerCase()]),M[m].view=v,(y=h[m.toLowerCase()].ticks3d).element3d=!0,u=O[s]-E[s],M[m+"Ticks"]="x"===c?v.create("ticks3d",[d,[1,0,0],u,[0,1,0]],y):"y"===c?v.create("ticks3d",[d,[0,1,0],u,[1,0,0]],y):v.create("ticks3d",[d,[0,0,1],u,[0,1,0]],y),M[m+"Ticks"].view=v);for("center"===l?(M.O=v.create("intersection",[M[C[0]+P],M[C[1]+P]],{name:"",visible:!1,withLabel:!1}),M.O.view=v):M.O=null,s=0;s<C.length;s++)for(n=(s+1)%3,a=(s+2)%3,c=C[s],r=0;r<x.length;r++)m=c+"Plane"+x[r],(d=[0,0,0])[s]=0===r?E[s]:O[s],_=[0,0,0],(f=[0,0,0])[n]=1,_[a]=1,g=[E[n],O[n]],A=[E[a],O[a]],h=utils_type.A.copyAttributes(i,t.options,"axes3d",m),M[m]=v.create("plane3d",[d,f,_,g,A],h),M[m].elType="axisplane3d";for(s=0;s<C.length;s++)for(c=C[s],r=0;r<x.length;r++)for(o=1;o<=2;o++)m=c+"Plane"+x[r]+C[n=(s+o)%3].toUpperCase()+"Axis",b=c+"Plane"+x[r],(d=[0,0,0])[s]=(p=[0,0,0])[s]=0===r?E[s]:O[s],d[n]=E[n],p[n]=O[n],h=utils_type.A.copyAttributes(i,t.options,"axes3d",m),M[m]=v.create("axis3d",[d,p],h),M[m].view=v,M[b].addChild(M[m]),M[b].element2D.inherits.push(M[m]);return M},jxg.A.registerElement("axes3d",jxg.A.createAxes3D),jxg.A.createAxis3D=function(t,e,i){var s,r,o,n,a,h,l=e[0],c=e[1],u=e[2];return(s=utils_type.A.copyAttributes(i.point1,t.options,"axis3d","point1")).element3d=!0,r=l.create("point",[(n=c[0],a=c[1],h=c[2],function(){return l.project3DTo2D(n,a,h)[1]}),function(t,e,i){return function(){return l.project3DTo2D(t,e,i)[2]}}(c[0],c[1],c[2])],s),(s=utils_type.A.copyAttributes(i.point2,t.options,"axis3d","point2")).element3d=!0,o=l.create("point",[function(t,e,i){return function(){return l.project3DTo2D(t,e,i)[1]}}(u[0],u[1],u[2]),function(t,e,i){return function(){return l.project3DTo2D(t,e,i)[2]}}(u[0],u[1],u[2])],s),(s=utils_type.A.copyAttributes(i,t.options,"axis3d")).element3d=!0,l.create("arrow",[r,o],s)},jxg.A.registerElement("axis3d",jxg.A.createAxis3D),jxg.A.createMesh3D=function(t,e,i){var s,r,o=e[0];return(s=utils_type.A.copyAttributes(i,t.options,"mesh3d")).element3d=!0,(r=o.create("curve",[[],[]],s)).point=e[1],r.direction1=e[2],r.direction2=e[3],r.range1=e[4],r.range2=e[5],r.updateDataArray=function(){var t,e,i,s,r=utils_type.A.evaluate(this.range1),n=utils_type.A.evaluate(this.range2),a=r[0],h=r[1],l=n[0],c=n[1],u=[0,0,0],d=[0,0,0],p=this.evalVisProp("stepwidthu"),f=this.evalVisProp("stepwidthv"),_=[0,0,0];if(this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))_=this.point();else if(utils_type.A.isPoint3D(this.point))_=this.point.coords;else for(s=0;s<this.point.length;s++)_[s]=utils_type.A.evaluate(this.point[s]);if(utils_type.A.isFunction(this.direction1))u=utils_type.A.evaluate(this.direction1);else for(s=0;s<this.direction1.length;s++)u[s]=utils_type.A.evaluate(this.direction1[s]);if(utils_type.A.isFunction(this.direction2))d=utils_type.A.evaluate(this.direction2);else for(s=0;s<this.direction2.length;s++)d[s]=utils_type.A.evaluate(this.direction2[s]);for(4===_.length&&(_=_.slice(1)),4===u.length&&(u=u.slice(1)),4===d.length&&(d=d.slice(1)),t=jxg.A.Math.norm(u,3),e=jxg.A.Math.norm(d,3),s=0;s<3;s++)u[s]/=t,d[s]/=e;i=o.getMesh([function(t,e){return _[0]+t*u[0]+e*d[0]},function(t,e){return _[1]+t*u[1]+e*d[1]},function(t,e){return _[2]+t*u[2]+e*d[2]}],[Math.ceil(a),Math.floor(h),(Math.ceil(h)-Math.floor(a))/p],[Math.ceil(l),Math.floor(c),(Math.ceil(c)-Math.floor(l))/f]),this.dataX=i[0],this.dataY=i[1]},r},jxg.A.registerElement("mesh3d",jxg.A.createMesh3D),jxg.A.Circle3D=function(t,e,i,s,r){var o,n;this.constructor(t.board,r,constants.A.OBJECT_TYPE_CIRCLE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"circle3d"),this.center=this.board.select(e),this.normalFunc=i,this.normal=[0,0,0,0],this.curve,this.frame1,this.frame2,utils_type.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),this.updateRadius=utils_type.A.createFunction(s,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.updateNormal(),this.frame1=math.A.crossProduct(this.normal.slice(1),[1,0,0]),this.frame1.unshift(0),(o=math.A.crossProduct(this.normal.slice(1),[-.5,.8660254037844386,0])).unshift(0),math.A.norm(o)>math.A.norm(this.frame1)&&(this.frame1=o),this.frame2=math.A.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),n=this,this.curve=t.create("curve3d",[function(t){var e=n.Radius(),i=Math.sin(t),s=Math.cos(t);return[n.center.coords[1]+e*(s*n.frame1[1]+i*n.frame2[1]),n.center.coords[2]+e*(s*n.frame1[2]+i*n.frame2[2]),n.center.coords[3]+e*(s*n.frame1[3]+i*n.frame2[3])]},[0,2*Math.PI]],r)},jxg.A.Circle3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Circle3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Circle3D.prototype,{update:function(){return this.needsUpdate&&(this.updateNormal().updateFrame(),this.curve.visProp.visible=!isNaN(this.Radius())),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(t){return this.updateRadius=utils_type.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return utils_type.A.exists(t)?(this.setRadius(t),this.Radius()):Math.abs(this.updateRadius())},normalizeFrame:function(){var t,e=math.A.norm(this.frame1),i=math.A.norm(this.frame2);for(t=0;t<4;t++)this.frame1[t]/=e,this.frame2[t]/=i;return this},updateNormal:function(){var t,e;if(this.normal=utils_type.A.evaluate(this.normalFunc),e=math.A.norm(this.normal),Math.abs(e)>1e-12)for(t=0;t<4;t++)this.normal[t]/=e;return this},updateFrame:function(){return this.frame1=math.A.crossProduct(this.frame2.slice(1),this.normal.slice(1)),this.frame1.unshift(0),this.frame2=math.A.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),this},projectCoords:function(t,e){return this.curve.projectCoords(t,e)}}),jxg.A.createCircle3D=function(t,e,i){var s,r=e[0],o=utils_type.A.copyAttributes(i,t.options,"circle3d"),n=utils_type.A.providePoints3D(r,[e[1]],i,"circle3d",["point"])[0],a=e[2],h=e[3];return(s=new jxg.A.Circle3D(r,n,a,h,o)).curve.addParents([s]),s.addChild(s.curve),s.update(),s},jxg.A.registerElement("circle3d",jxg.A.createCircle3D),jxg.A.createIntersectionCircle3D=function(t,e,i){var s,r,o,n=e[0],a=e[1],h=e[2],l=utils_type.A.copyAttributes(i,t.options,"intersectioncircle3d");o=geometry.A.intersectionFunction3D(n,a,h),r=n.create("point3d",o[0],{visible:!1}),s=n.create("circle3d",[r,o[1],o[2]],l);try{a.addChild(s),h.addChild(s)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return s.type=constants.A.OBJECT_TYPE_INTERSECTION_CIRCLE3D,s.elType="intersectioncircle3d",s.setParents([a.id,h.id]),s},jxg.A.registerElement("intersectioncircle3d",jxg.A.createIntersectionCircle3D),jxg.A.Point3D=function(t,e,i,s){this.constructor(t.board,s,constants.A.OBJECT_TYPE_POINT3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"point3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.initialCoords=[0,0,0,0],this.F=e,this.slide=i,this.position=[],this.movePath=[],this.moveCallback=null,this.moveInterval=null,this._c2d=null,this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Point3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Point3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Point3D.prototype,{X:function(){return this.coords[1]},Y:function(){return this.coords[2]},Z:function(){return this.coords[3]},W:function(){return this.coords[0]},updateCoords:function(){var t,e=0;if(utils_type.A.isFunction(this.F))this.coords=utils_type.A.evaluate(this.F),3===this.coords.length&&this.coords.unshift(1);else for(3===this.F.length&&(this.coords[0]=1,e=1),t=0;t<this.F.length;t++)utils_type.A.isFunction(this.F[t])&&(this.coords[e+t]=utils_type.A.evaluate(this.F[t]));return this},initCoords:function(){var t,e=0;if(utils_type.A.isFunction(this.F))this.coords=utils_type.A.evaluate(this.F),3===this.coords.length&&this.coords.unshift(1);else for(3===this.F.length&&(this.coords[0]=1,e=1),t=0;t<this.F.length;t++)this.coords[e+t]=utils_type.A.evaluate(this.F[t]);return this.initialCoords=this.coords.slice(),this},normalizeCoords:function(){return Math.abs(this.coords[0])>1e-14&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(t,e){var i=this.coords;return 3===t.length?(i[0]=1,i[1]=t[0],i[2]=t[1],i[3]=t[2]):(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[2],this.normalizeCoords()),this},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this===this.baseElement?this.initialCoords:this.baseElement.coords,e=0;e<this.transformations.length;e++)this.transformations[e].update(),t=math.A.matVecMult(this.transformations[e].matrix,t);return this.coords=t,this},update:function(t){var e,i,s;return this.element2D.draggable()&&0!==geometry.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(i=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],i)),0!==e[0]&&(s=this.view.project3DToCube(e),this.coords=s[0],s[1]&&this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords().updateTransform(),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position)),e=this.coords,this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=math.A.innerProduct(this.view.matrix3DRotShift[3],e)),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>1e-12},distance:function(t){var e=this.coords,i=t.coords;return e[0]*e[0]>1e-12&&i[0]*i[0]>1e-12?math.A.hypot(i[1]-e[1],i[2]-e[2],i[3]-e[3]):Number.POSITIVE_INFINITY},moveTo:function(t,e,i){i=i||{};var s,r,o=Math.ceil(e/this.board.attr.animationdelay),n=t[0],a=t[1],h=t[2],l=this.coords[1]-n,c=this.coords[2]-a,u=this.coords[3]-h,d=()=>{};if(i.callback&&(d=i.callback),r=function(t){var e=t/o;if(i.effect){if("<>"===i.effect)return Math.pow(Math.sin(e*Math.PI/2),2);if("<"===i.effect)return e*e*e;if(">"===i.effect)return 1-Math.pow(1-e,3);if("=="===i.effect)return t/o;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return t/o},!utils_type.A.exists(e)||0===e)return this.setPosition([n,a,h],!0),this.board.update(this);if(!utils_type.A.exists(i.callback)&&Math.abs(l)<math.A.eps&&Math.abs(c)<math.A.eps&&Math.abs(u)<math.A.eps)return this;for(this.animationPath=[],s=o;s>=0;s--)this.animationPath[o-s]=[n+l*r(s),a+c*r(s),h+u*r(s)];return this.moveAlong(this.animationPath,e,{callback:d})},moveAlong:function(t,e,i){let s=e/t.length;if(utils_type.A.isObject(i)&&"callback"in i&&(this.moveCallback=i.callback),!(this.movePath.length>0))return this.movePath=t,new Promise((t,e)=>{this.moveInterval=setInterval(()=>{if(this.movePath.length>0){let t=this.movePath.shift();this.setPosition(t,!0),this.board.update(this)}0===this.movePath.length&&(clearInterval(this.moveInterval),t(),utils_type.A.isFunction(this.moveCallback)&&this.moveCallback())},s)});this.movePath=t},__evt__update3D:function(t){}}),jxg.A.createPoint3D=function(t,e,i){var s,r,o,n,a,h=e[0],l=null,c=null;if(o=e.length>2&&utils_type.A.exists(e[e.length-1].is3D)&&!utils_type.A.isTransformationOrArray(e[e.length-1])?e.pop():null,2===e.length)r=e[1];else if(3===e.length&&utils_type.A.isPoint3D(e[1])&&utils_type.A.isTransformationOrArray(e[2]))r=[0,0,0],l=e[1],c=e[2];else if(4===e.length)r=e.slice(1);else{if(5!==e.length)throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [[x,y,z]], [x,y,z], or [[x,y,z], slide], () => [x, y, z], or [point, transformation(s)]");r=e.slice(1)}return s=utils_type.A.copyAttributes(i,t.options,"point3d"),(a=new jxg.A.Point3D(h,r,o,s)).initCoords(),null!==l&&null!==c&&a.addTransform(l,c),n=h.project3DTo2D(a.coords),s=a.setAttr2D(s),a.element2D=h.create("point",n,s),a.element2D.view=h,a.addChild(a.element2D),a.inherits.push(a.element2D),a.element2D.setParents(a),a.slide&&(a.slide.addChild(a),a.setParents(a.slide)),l&&a.setParents(l),a._c2d=a.element2D.coords.usrCoords.slice(),a},jxg.A.registerElement("point3d",jxg.A.createPoint3D),jxg.A.Curve3D=function(t,e,i,s,r,o,n){this.constructor(t.board,n,constants.A.OBJECT_TYPE_CURVE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"curve3d"),this.board.finalizeAdding(this),this._F=e,this._X=i,this._Y=s,this._Z=r,this.points=[],this.numberPoints=0,this.dataX=null,this.dataY=null,this.dataZ=null,null!==this._F?(this._X=function(t){return this._F(t)[0]},this._Y=function(t){return this._F(t)[1]},this._Z=function(t){return this._F(t)[2]}):utils_type.A.isFunction(this._X)?this._F=function(t){return[this._X(t),this._Y(t),this._Z(t)]}:this._F=null,this.range=o,this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Curve3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Curve3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Curve3D.prototype,{updateCoords:function(){var t,e,i,s,r,o,n=this.evalVisProp("numberpointshigh"),a=[1,0,0,0];if(this.points=[],utils_type.A.exists(this.dataX))for(n=this.dataX.length,r=0;r<n;r++)this.points.push([1,this.dataX[r],this.dataY[r],this.dataZ[r]]);else if(utils_type.A.isArray(this._X))for(n=this._X.length,r=0;r<n;r++)this.points.push([1,this._X[r],this._Y[r],this._Z[r]]);else for(t=utils_type.A.evaluate(this.range),e=utils_type.A.evaluate(t[0]),s=((i=utils_type.A.evaluate(t[1]))-e)/(n-1),o=0,r=e;o<n&&r<=i;o++,r+=s)(a=this.F(r)).unshift(1),this.points.push(a);return this.numberPoints=this.points.length,this},evalF:function(t){var e,i,s=[0,0,0,0];if(0===this.transformations.length||!utils_type.A.exists(this.baseElement))return s=utils_type.A.exists(this._F)?this._F(t):[this._X[t],this._Y[t],this._Z[t]];for(e=this.transformations,i=0;i<e.length;i++)e[i].update();for(3===s.length&&s.unshift(1),(s=this===this.baseElement?utils_type.A.exists(this._F)?this._F(t):[this._X[t],this._Y[t],this._Z[t]]:this.baseElement.evalF(t)).unshift(1),s=math.A.matVecMult(e[0].matrix,s),i=1;i<e.length;i++)s=math.A.matVecMult(e[i].matrix,s);return s.slice(1)},F:function(t){return this.evalF(t)},X:function(t){return this.evalF(t)[0]},Y:function(t){return this.evalF(t)[1]},Z:function(t){return this.evalF(t)[2]},updateDataArray2D:function(){var t,e,i=[],s=[],r=this.points.length;for(t=0;t<r;t++)e=this.view.project3DTo2D(this.points[t]),i.push(e[1]),s.push(e[2]);return{X:i,Y:s}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,s,r;if(0===this.transformations.length||null===this.baseElement||utils_type.A.exists(this._F))return this;for(t=this.transformations,i=0;i<t.length;i++)t[i].update();for(r=this.baseElement.numberPoints,i=0;i<r;i++){for(e=this===this.baseElement?this.points[i]:this.baseElement.points[i],s=0;s<t.length;s++)e=math.A.matVecMult(t[s].matrix,e);this.points[i]=e}return this.numberPoints=r,this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords().updateTransform()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return geometry.A.projectCoordsToParametric(t,this,1,e)}}),jxg.A.createCurve3D=function(t,e,i){var s,r,o,n,a,h,l,c,u=e[0],d=null,p=null;return 3===e.length?utils_type.A.isTransformationOrArray(e[2])&&e[1].type===constants.A.OBJECT_TYPE_CURVE3D?(d=e[1],p=e[2],s=null,r=[],o=[],n=[]):(s=e[1],a=e[2],r=null,o=null,n=null):2===e.length&&utils_type.A.isArray(e[1])?(r=(c=math.A.transpose(e[1]))[0],o=c[1],n=c[2],s=null):(r=e[1],o=e[2],n=e[3],a=e[4],s=null),h=utils_type.A.copyAttributes(i,t.options,"curve3d"),h=(l=new jxg.A.Curve3D(u,s,r,o,n,a,h)).setAttr2D(h),l.element2D=u.create("curve",[[],[]],h),l.element2D.view=u,null!==d&&(l.addTransform(d,p),l.addParents(d)),l.element2D.updateDataArray=function(){var t=l.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},l.addChild(l.element2D),l.inherits.push(l.element2D),l.element2D.setParents(l),l.element2D.prepareUpdate().update(),t.isSuspendedUpdate||l.element2D.updateVisibility().updateRenderer(),l},jxg.A.registerElement("curve3d",jxg.A.createCurve3D),jxg.A.createVectorfield3D=function(t,e,i){var s,r,o=e[0];if(!(e.length>=5&&(utils_type.A.isArray(e[1])||utils_type.A.isFunction(e[1])||utils_type.A.isString(e[1]))&&utils_type.A.isArray(e[2])&&3===e[1].length&&utils_type.A.isArray(e[3])&&3===e[2].length&&utils_type.A.isArray(e[4])&&3===e[3].length))throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof e[1]+"', '"+typeof e[2]+"', '"+typeof e[3]+"'.'"+typeof e[4]+"', ");return r=utils_type.A.copyAttributes(i,t.options,"vectorfield3d"),(s=o.create("curve3d",[[],[],[]],r)).setF=function(t,e){var i,r,o;return utils_type.A.isArray(t)?(i=utils_type.A.createFunction(t[0],this.board,e),r=utils_type.A.createFunction(t[1],this.board,e),o=utils_type.A.createFunction(t[2],this.board,e),this.F=function(t,e,s){return[i(t,e,s),r(t,e,s),o(t,e,s)]}):this.F=utils_type.A.createFunction(t,s.board,e),this},s.setF(e[1],"x, y, z"),s.xData=e[2],s.yData=e[3],s.zData=e[4],s.updateDataArray=function(){var e,i,s,r,o,n,a,h,l,c,u,d,p,f,_,g,A,m=this.evalVisProp("scale"),b=[utils_type.A.evaluate(this.xData[0]),utils_type.A.evaluate(this.yData[0]),utils_type.A.evaluate(this.zData[0])],y=[utils_type.A.evaluate(this.xData[1]),utils_type.A.evaluate(this.yData[1]),utils_type.A.evaluate(this.zData[1])],v=[utils_type.A.evaluate(this.xData[2]),utils_type.A.evaluate(this.yData[2]),utils_type.A.evaluate(this.zData[2])],C=[(v[0]-b[0])/y[0],(v[1]-b[1])/y[1],(v[2]-b[2])/y[2]],P=this.evalVisProp("arrowhead.enabled");for(P&&(p=this.evalVisProp("arrowhead.size"),A=this.evalVisProp("arrowhead.angle"),f=p/t.unitX,_=p/t.unitY,g=p/Math.sqrt(t.unitX*t.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],i=0,n=b[0];i<=y[0];n+=C[0],i++)for(s=0,a=b[1];s<=y[1];a+=C[1],s++)for(e=0,h=b[2];e<=y[2];h+=C[2],e++)r=this.F(n,a,h),(o=math.A.norm(r))<Number.EPSILON||(r[0]*=m,r[1]*=m,r[2]*=m,utils_type.A.concat(this.dataX,[n,n+r[0],NaN]),utils_type.A.concat(this.dataY,[a,a+r[1],NaN]),utils_type.A.concat(this.dataZ,[h,h+r[2],NaN]),P&&(o*=m,l=Math.atan2(r[1],r[0]),c=(d=Math.asin(r[2]/o))-A,u=d+A,utils_type.A.concat(this.dataX,[n+r[0]-f*Math.cos(l)*Math.cos(c),n+r[0],n+r[0]-f*Math.cos(l)*Math.cos(u),NaN]),utils_type.A.concat(this.dataY,[a+r[1]-_*Math.sin(l)*Math.cos(c),a+r[1],a+r[1]-_*Math.sin(l)*Math.cos(u),NaN]),utils_type.A.concat(this.dataZ,[h+r[2]-g*Math.sin(u),h+r[2],h+r[2]-g*Math.sin(c),NaN])))},s.methodMap=utils_type.A.deepCopy(s.methodMap,{setF:"setF"}),s},jxg.A.registerElement("vectorfield3D",jxg.A.createVectorfield3D),jxg.A.Line3D=function(t,e,i,s,r){this.constructor(t.board,r,constants.A.OBJECT_TYPE_LINE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"line3d"),this.point=e,this.direction=i,this.vec=[0,0,0,0],this.range=s||[-1/0,1/0],this.point1=null,this.point2=null,this.board.finalizeAdding(this),this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Line3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Line3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Line3D.prototype,{updateCoords:function(){var t,e=0;if(utils_type.A.exists(this.direction.view)&&this.direction.type===constants.A.OBJECT_TYPE_LINE3D)this.vec=this.direction.vec.slice();else if(utils_type.A.isFunction(this.direction))this.vec=utils_type.A.evaluate(this.direction),3===this.vec.length&&this.vec.unshift(0);else for(3===this.direction.length&&(this.vec[0]=0,e=1),t=0;t<this.direction.length;t++)this.vec[e+t]=utils_type.A.evaluate(this.direction[t]);return this},getPointCoords:function(t){var e,i,s;return e=this.point.coords,i=this.vec,s=utils_type.A.evaluate(t),t=this.view.intersectionLineCube(e,i,s),Math.abs(t)===1/0&&(t=0),[e[0]+i[0]*t,e[1]+i[1]*t,e[2]+i[2]*t,e[3]+i[3]*t]},addTransform:function(t,e){return this.point.addTransform(t.point,e),this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this===this.baseElement?this.vec:this.baseElement.vec,e=0;e<this.transformations.length;e++)this.transformations[e].update(),t=math.A.matVecMult(this.transformations[e].matrix,t);return this.vec=t,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},setPosition2D:function(t){var e,i;for(e=0;e<this.parents.length;e++)"point3d"===(i=this.view.select(this.parents[e])).elType&&i.element2D.draggable()&&t.applyOnce(i.element2D);this.endpoints[0].update(),this.endpoints[1].update()},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){var i,s=this.getPointCoords(0),r=this.getPointCoords(1),o=[r[0]-s[0],r[1]-s[1],r[2]-s[2]],n=[t[0]-s[0],t[1]-s[1],t[2]-s[2]],a=math.A.innerProduct(n,o)/math.A.innerProduct(o,o),h=Math.min(Math.max(a,utils_type.A.evaluate(this.range[0])),utils_type.A.evaluate(this.range[1]));return i=this.getPointCoords(h).slice(),e[0]=h,i},updateZIndex:function(){var t=this.endpoints[0],e=this.endpoints[1],i=[1,t.X()+e.X(),t.Y()+e.Y(),t.Z()+e.Z()];return i[1]*=.5,i[2]*=.5,i[3]*=.5,this.zIndex=math.A.innerProduct(this.view.matrix3DRotShift[3],i),this}}),jxg.A.createLine3D=function(t,e,i){var s,r,o,n,a,h,l,c,u,d=e[0],p=null,f=null;if(s=utils_type.A.copyAttributes(i,t.options,"line3d"),e[1].type===constants.A.OBJECT_TYPE_LINE3D&&utils_type.A.isTransformationOrArray(e[2])&&(p=e[1],f=e[2],r=utils_type.A.providePoints3D(d,[[0,0,0,0],[0,0,0,0]],i,"line3d",["point1","point2"])),null===p&&(utils_type.A.isPoint3D(e[2])||3===e.length&&(utils_type.A.isArray(e[2])||utils_type.A.isFunction(e[2]))))h=utils_type.A.providePoints3D(d,[e[1]],i,"line3d",["point1"])[0],l=utils_type.A.providePoints3D(d,[e[2]],i,"line3d",["point2"])[0],n=function(){return[0,l.X()-h.X(),l.Y()-h.Y(),l.Z()-h.Z()]},a=[0,1],(u=new jxg.A.Line3D(d,h,n,a,s)).prepareUpdate().update(),(c=utils_type.A.providePoints3D(d,[[1,0,0,0],[1,0,0,0]],{visible:!0},"line3d",["point1","point2"]))[0].F=function(){var t=0;return u.evalVisProp("straightfirst")&&(t=-1/0),u.getPointCoords(t)},c[1].F=function(){var t=1;return u.evalVisProp("straightlast")&&(t=1/0),u.getPointCoords(t)},c[0].prepareUpdate().update(),c[1].prepareUpdate().update(),(s=u.setAttr2D(s)).straightfirst=!1,s.straightlast=!1,u.element2D=d.create("segment",[c[0].element2D,c[1].element2D],s),u.element2D.view=d,u.endpoints=c,u.addChild(c[0]),u.addChild(c[1]),u.addParents([h,l]);else{if(null!==p)o=utils_type.A.providePoints3D(d,[[0,0,0]],i,"line3d",["point"])[0],n=[0,0,0,1e-4],a=e[3]||[-1/0,1/0];else{if(!(utils_type.A.exists(e[2].view)&&e[2].type===constants.A.OBJECT_TYPE_LINE3D||utils_type.A.isFunction(e[2])||3===e[2].length||4===e[2].length))throw new Error("JSXGraph: Can't create line3d with parents of type '"+typeof e[1]+", "+typeof e[2]+", "+typeof e[3]+"'.");o=utils_type.A.providePoints3D(d,[e[1]],i,"line3d",["point"])[0],n=e[2],a=e[3]}r=utils_type.A.providePoints3D(d,[[1,0,0,0],[1,0,0,0]],i,"line3d",["point1","point2"]),(u=new jxg.A.Line3D(d,o,n,a,s)).prepareUpdate().update(),r[0].F=function(){return u.getPointCoords(utils_type.A.evaluate(u.range[0]))},r[0].prepareUpdate().update(),h=r[0],r[1].F=function(){return u.getPointCoords(utils_type.A.evaluate(u.range[1]))},r[1].prepareUpdate().update(),l=r[1],(s=u.setAttr2D(s)).straightfirst=!1,s.straightlast=!1,u.element2D=d.create("segment",[h.element2D,l.element2D],s),u.element2D.view=d,u.endpoints=r,u.addParents(o),null!==p&&null!==f&&(u.addTransform(p,f),u.addParents(p))}return u.addChild(u.element2D),u.inherits.push(u.element2D),u.element2D.addParents(u),u.point1=h,u.point2=l,u.point1._is_new?(u.addChild(u.point1),delete u.point1._is_new):u.point1.addChild(u),u.point2._is_new?(u.addChild(u.point2),delete u.point2._is_new):u.point2.addChild(u),utils_type.A.exists(o)&&(o._is_new?(u.addChild(o),delete o._is_new):o.addChild(u)),u.update(),u.element2D.prepareUpdate().update().updateRenderer(),u},jxg.A.registerElement("line3d",jxg.A.createLine3D),jxg.A.Plane3D=function(t,e,i,s,r,o,n){this.constructor(t.board,n,constants.A.OBJECT_TYPE_PLANE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"plane3d"),this.board.finalizeAdding(this),this.point=e,this.direction1=i,this.direction2=r,this.range_u=s||[-1/0,1/0],this.range_v=o||[-1/0,1/0],this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],this.mesh3d=null,this.normal=[0,0,0,0],this.d=0,this.updateCoords(),this.updateNormal(),this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Plane3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Plane3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Plane3D.prototype,{F:function(t,e){var i,s,r,o,n;for(s=this.vec1.slice(),r=this.vec2.slice(),o=math.A.norm(s,3),n=math.A.norm(r,3),i=0;i<3;i++)s[i]/=o,r[i]/=n;return[this.point.X()+t*s[0]+e*r[0],this.point.Y()+t*s[1]+e*r[1],this.point.Z()+t*s[2]+e*r[2]]},X:function(t,e){return this.F(t,e)[0]},Y:function(t,e){return this.F(t,e)[1]},Z:function(t,e){return this.F(t,e)[2]},updateCoords:function(){var t,e;if(utils_type.A.exists(this.direction1.view)&&this.direction1.type===constants.A.OBJECT_TYPE_LINE3D)this.vec1=this.direction1.vec.slice();else if(utils_type.A.isFunction(this.direction1))this.vec1=utils_type.A.evaluate(this.direction1),3===this.vec1.length&&this.vec1.unshift(0);else for(e=0,3===this.direction1.length&&(this.vec1[0]=0,e=1),t=0;t<this.direction1.length;t++)this.vec1[e+t]=utils_type.A.evaluate(this.direction1[t]);if(utils_type.A.exists(this.direction2.view)&&this.direction2.type===constants.A.OBJECT_TYPE_LINE3D)this.vec2=this.direction2.vec.slice();else if(utils_type.A.isFunction(this.direction2))this.vec2=utils_type.A.evaluate(this.direction2),3===this.vec2.length&&this.vec2.unshift(0);else for(e=0,3===this.direction2.length&&(this.vec2[0]=0,e=1),t=0;t<this.direction2.length;t++)this.vec2[e+t]=utils_type.A.evaluate(this.direction2[t]);return this},updateNormal:function(){var t,e;if(this.needsUpdate,this.normal=math.A.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),e=math.A.norm(this.normal),Math.abs(e)>math.A.eps*math.A.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.normal.unshift(0),this.d=math.A.innerProduct(this.point.coords,this.normal,4),this},updateDataArray:function(){var t,e,i,s,r,o,n,a,h,l,c,u,d,p,f=["xPlaneRear","yPlaneRear","zPlaneRear"],_=[],g=[0,0,0],A=[0,0,0],m=[0,0,0],b=[0,0,0],y=1e-12,v=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&v.defaultAxes&&utils_type.A.evaluate(this.range_u[0])===-1/0&&utils_type.A.evaluate(this.range_u[1])===1/0&&utils_type.A.evaluate(this.range_v[0])===-1/0&&utils_type.A.evaluate(this.range_v[1])===1/0){for(l=0;l<f.length;l++){if(!1!==(b=v.intersectionPlanePlane(this,v.defaultAxes[f[l]]))[0]&&!1!==b[1]){for(h=0;h<_.length&&!(geometry.A.distance(b[0],_[h][0],4)<y&&geometry.A.distance(b[1],_[h][1],4)<y||geometry.A.distance(b[0],_[h][1],4)<y&&geometry.A.distance(b[1],_[h][0],4)<y);h++);h===_.length&&_.push(b.slice())}if((b=[1,0,0,0])[l+1]=v.bbox3D[l][1],a=math.A.innerProduct(b,v.defaultAxes[f[l]].normal,4),!1!==(b=v.intersectionPlanePlane(this,v.defaultAxes[f[l]],a))[0]&&!1!==b[1]){for(h=0;h<_.length&&!(geometry.A.distance(b[0],_[h][0],4)<y&&geometry.A.distance(b[1],_[h][1],4)<y||geometry.A.distance(b[0],_[h][1],4)<y&&geometry.A.distance(b[1],_[h][0],4)<y);h++);h===_.length&&_.push(b.slice())}}if(0===_.length)return{X:this.dataX,Y:this.dataY};d=0,h=0;do{for(4===(b=_[d][h]).length&&(r=v.project3DTo2D(b),this.dataX.push(r[1]),this.dataY.push(r[2])),h=(h+1)%2,b=_[d][h],p=d,l=0;l<_.length;l++){if(l!==d&&geometry.A.distance(b,_[l][0])<y){d=l,h=0;break}if(l!==d&&geometry.A.distance(b,_[l][1])<y){d=l,h=1;break}}if(d===p){console.log("Error plane3d update: did not find next",d);break}}while(0!==d);r=v.project3DTo2D(_[0][0]),this.dataX.push(r[1]),this.dataY.push(r[2])}else{for(t=utils_type.A.evaluate(this.range_u[0]),e=utils_type.A.evaluate(this.range_u[1]),i=utils_type.A.evaluate(this.range_v[0]),s=utils_type.A.evaluate(this.range_v[1]),m=this.point.coords,g=this.vec1.slice(),A=this.vec2.slice(),o=math.A.norm(g,4),n=math.A.norm(A,4),h=1;h<4;h++)g[h]/=o,A[h]/=n;for(l=0;l<4;l++){switch(l){case 0:c=t,u=i;break;case 1:c=e,u=i;break;case 2:c=e,u=s;break;case 3:c=t,u=s}for(h=0;h<4;h++)b[h]=m[h]+c*g[h]+u*A[h];r=v.project3DTo2D(b),this.dataX.push(r[1]),this.dataY.push(r[2])}this.dataX.push(this.dataX[0]),this.dataY.push(this.dataY[0])}return{X:this.dataX,Y:this.dataY}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this.point.addTransform(t.point,e),this},updateTransform:function(){var t,e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this===this.baseElement?(t=this.vec1,e=this.vec2):(t=this.baseElement.vec1,e=this.baseElement.vec2),i=0;i<this.transformations.length;i++)this.transformations[i].update(),t=math.A.matVecMult(this.transformations[i].matrix,t),e=math.A.matVecMult(this.transformations[i].matrix,e);return this.vec1=t,this.vec2=e,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return geometry.A.projectCoordsToParametric(t,this,2,e)}}),jxg.A.createPlane3D=function(t,e,i){var s,r,o,n,a,h,l,c,u,d,p=e[0],f=null,_=null;if((s=utils_type.A.copyAttributes(i,t.options,"plane3d")).threepoints||utils_type.A.isPoint3D(e[2])||utils_type.A.isPoint3D(e[3]))r=utils_type.A.providePoints3D(p,[e[1]],i,"plane3d",["point1"])[0],o=utils_type.A.providePoints3D(p,[e[2]],i,"plane3d",["point2"])[0],n=utils_type.A.providePoints3D(p,[e[3]],i,"plane3d",["point3"])[0],a=function(){return[o.X()-r.X(),o.Y()-r.Y(),o.Z()-r.Z()]},h=function(){return[n.X()-r.X(),n.Y()-r.Y(),n.Z()-r.Z()]},l=e[4]||[-1/0,1/0],c=e[5]||[-1/0,1/0];else{if(e[1].type===constants.A.OBJECT_TYPE_PLANE3D&&utils_type.A.isTransformationOrArray(e[2])?(f=e[1],_=e[2],r=utils_type.A.providePoints3D(p,[[0,0,0,0]],i,"plane3d",["point"])[0],a=[0,1e-4,0,0],h=[0,0,1e-4,0],l=e[3]||[-1/0,1/0],c=e[4]||[-1/0,1/0]):(r=utils_type.A.providePoints3D(p,[e[1]],i,"plane3d",["point"])[0],a=e[2],h=e[3],l=e[4]||[-1/0,1/0],c=e[5]||[-1/0,1/0]),!1===r)throw new Error("JSXGraph: Can't create plane3d with first parent of type '"+typeof e[1]+"'.\nPossible first parent types are: point3d, array of length 3, function returning an array of length 3.");if(null!==f&&e<3||null===f&&e.length<4)throw new Error("JSXGraph: Can't create plane3d with parents of type '"+typeof e[1]+", "+typeof e[2]+", "+typeof e[3]+", "+typeof e[4]+", "+typeof e[5]+"'.")}return u=new jxg.A.Plane3D(p,r,a,l,h,c,s),r.addChild(u),s=u.setAttr2D(s),u.element2D=p.create("curve",[[],[]],s),u.element2D.view=p,null!==f&&null!==_&&(u.addTransform(f,_),u.addParents(f)),u.element2D.updateDataArray=function(){var t=u.updateDataArray();this.dataX=t.X,this.dataY=t.Y},u.addChild(u.element2D),u.inherits.push(u.element2D),u.element2D.setParents(u),Math.abs(u.range_u[0])!==1/0&&Math.abs(u.range_u[1])!==1/0&&Math.abs(u.range_v[0])!==1/0&&Math.abs(u.range_v[1])!==1/0&&(s=utils_type.A.copyAttributes(s.mesh3d,t.options,"mesh3d"),d=p.create("mesh3d",[function(){return r.coords},function(){return u.vec1},function(){return u.vec2},u.range_u,u.range_v],s),u.mesh3d=d,u.addChild(d),u.inherits.push(d),u.element2D.inherits.push(d),d.setParents(u),u.mesh3d.view=p),u.element2D.prepareUpdate().update(),t.isSuspendedUpdate||u.element2D.updateVisibility().updateRenderer(),u},jxg.A.registerElement("plane3d",jxg.A.createPlane3D),jxg.A.createIntersectionLine3D=function(t,e,i){var s,r,o,n=e[0],a=e[1],h=e[2],l=utils_type.A.copyAttributes(i,t.options,"intersectionline3d"),c=[];for(o=geometry.A.intersectionFunction3D(n,a,h),r=0;r<2;r++)c[r]=n.create("point3d",o[r],l["point"+(r+1)]);s=n.create("line3d",c,l);try{a.addChild(s),h.addChild(s)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return s.type=constants.A.OBJECT_TYPE_INTERSECTION_LINE3D,s.elType="intersectionline3d",s.setParents([a.id,h.id]),s},jxg.A.registerElement("intersectionline3d",jxg.A.createIntersectionLine3D),jxg.A.Text3D=function(t,e,i,s,r){this.constructor(t.board,r,constants.A.OBJECT_TYPE_TEXT3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"text3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.F=e,this.slide=s,this.X=function(){return this.coords[1]},this.Y=function(){return this.coords[2]},this.Z=function(){return this.coords[3]},this.position=[],this._c2d=null,this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Text3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Text3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Text3D.prototype,{updateCoords:function(){var t;if(utils_type.A.isFunction(this.F))this.coords=utils_type.A.evaluate(this.F),this.coords.unshift(1);else for(this.coords[0]=1,t=0;t<3;t++)utils_type.A.isFunction(this.F[t])&&(this.coords[t+1]=utils_type.A.evaluate(this.F[t]));return this},initCoords:function(){var t;if(utils_type.A.isFunction(this.F))this.coords=utils_type.A.evaluate(this.F),this.coords.unshift(1);else for(this.coords[0]=1,t=0;t<3;t++)this.coords[t+1]=utils_type.A.evaluate(this.F[t]);return this},normalizeCoords:function(){return Math.abs(this.coords[0])>math.A.eps&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(t,e){var i=this.coords;return 3===t.length?(i[0]=1,i[1]=t[0],i[2]=t[1],i[3]=t[2]):(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[2],this.normalizeCoords()),this},update:function(t){var e,i,s;return this.element2D.draggable()&&0!==geometry.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(i=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],i)),0!==e[0]&&(s=this.view.project3DToCube(e),this.coords=s[0],s[1]&&this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords(),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position)),e=this.coords,this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=math.A.innerProduct(this.view.matrix3DRotShift[3],e),this.element2D.prepareUpdate().update()),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>math.A.eps},__evt__update3D:function(t){}}),jxg.A.createText3D=function(t,e,i){var s,r,o,n,a,h,l=e[0];if(o=e.length>2&&utils_type.A.exists(e[e.length-1].is3D)?e.pop():null,3===e.length)r=e[1],n=e[2];else{if(5!==e.length)throw new Error("JSXGraph: Can't create text3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [[x,y,z], text], [x,y,z, text]");r=e.slice(1,4),n=e[4]}return s=utils_type.A.copyAttributes(i,t.options,"text3d"),(h=new jxg.A.Text3D(l,r,n,o,s)).initCoords(),a=l.project3DTo2D(h.coords),s=h.setAttr2D(s),h.element2D=l.create("text",[a[1],a[2],n],s),h.element2D.view=l,h.addChild(h.element2D),h.inherits.push(h.element2D),h.element2D.setParents(h),h.slide&&(h.slide.addChild(h),h.setParents(h.slide)),h._c2d=h.element2D.coords.usrCoords.slice(),h},jxg.A.registerElement("text3d",jxg.A.createText3D),jxg.A.createTicks3D=function(t,e,i){var s,r,o=e[0],n=e[1],a=e[2],h=e[3],l=e[4];return r=utils_type.A.copyAttributes(i,t.options,"ticks3d"),(s=o.create("curve",[[],[]],r)).point=n,s.direction1=a,s.len=h,s.direction2=l,s.drawLabels=function(e){var i,s,r,n,a,h,l,c=this.len,u=this.evalVisProp("ticksdistance"),d=this.evalVisProp("tickendings"),p=this.evalVisProp("majorheight"),f=[0,0,0],_=[0,0,0],g=[0,0,0],A=[];if(i=(p/=Math.sqrt(t.unitX*t.unitY))*d[1]*2,this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))g=this.point().slice(1);else for(n=0;n<3;n++)g[n]=utils_type.A.evaluate(this.point[n]);for(n=0;n<3;n++)f[n]=utils_type.A.evaluate(this.direction1[n]),_[n]=utils_type.A.evaluate(this.direction2[n]);for(s=jxg.A.Math.norm(f,3),r=jxg.A.Math.norm(_,3),n=0;n<3;n++)f[n]/=s,_[n]/=r;if(!(Math.abs(u)<math.A.eps)){for(a=0;a<=c;a+=u){for(l=[g[0]+a*f[0]+i*_[0],g[1]+a*f[1]+i*_[1],g[2]+a*f[2]+i*_[2]],n=0;n<3;n++)0!==f[n]&&(h=g[n]+a*f[n]);A.push(o.create("text3d",[l,h],e))}return A}},s.evalVisProp("drawlabels")&&(s.labels=s.drawLabels(r.label)),s.updateDataArray=function(){var e,i,s,r,n,a,h,l,c=this.len,u=this.evalVisProp("ticksdistance"),d=this.evalVisProp("tickendings"),p=this.evalVisProp("majorheight"),f=[0,0,0],_=[0,0,0],g=[0,0,0];if(e=(p/=Math.sqrt(t.unitX*t.unitY))*-d[0],i=p*d[1],this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))g=this.point().slice(1);else for(n=0;n<3;n++)g[n]=utils_type.A.evaluate(this.point[n]);for(n=0;n<3;n++)f[n]=utils_type.A.evaluate(this.direction1[n]),_[n]=utils_type.A.evaluate(this.direction2[n]);for(s=jxg.A.Math.norm(f,3),r=jxg.A.Math.norm(_,3),n=0;n<3;n++)f[n]/=s,_[n]/=r;if(!(Math.abs(u)<math.A.eps))for(a=0;a<=c;a+=u)l=[g[0]+a*f[0]+e*_[0],g[1]+a*f[1]+e*_[1],g[2]+a*f[2]+e*_[2]],h=o.project3DTo2D(l),this.dataX.push(h[1]),this.dataY.push(h[2]),l=[g[0]+a*f[0]+i*_[0],g[1]+a*f[1]+i*_[1],g[2]+a*f[2]+i*_[2]],h=o.project3DTo2D(l),this.dataX.push(h[1]),this.dataY.push(h[2]),this.dataX.push(NaN),this.dataY.push(NaN)},s},jxg.A.registerElement("ticks3d",jxg.A.createTicks3D),jxg.A.Polygon3D=function(t,e,i){var s;for(this.constructor(t.board,i,constants.A.OBJECT_TYPE_POLYGON3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"polygon3d"),this.board.finalizeAdding(this),this.vertices=[],s=0;s<e.length;s++)this.vertices[s]=this.board.select(e[s]),this.vertices[s]._is_new&&(delete this.vertices[s]._is_new,this.vertices[s]._is_new_pol=!0)},jxg.A.Polygon3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Polygon3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Polygon3D.prototype,{update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this},updateZIndex:function(){var t,e=this.vertices.length,i=[1,0,0,0];if(e<=0)return[NaN,NaN,NaN,NaN];for(t=0;t<e;t++)i[1]+=this.vertices[t].coords[1],i[2]+=this.vertices[t].coords[2],i[3]+=this.vertices[t].coords[3];return i[1]/=e,i[2]/=e,i[3]/=e,this.zIndex=math.A.innerProduct(this.view.matrix3DRotShift[3],i),this}}),jxg.A.createPolygon3D=function(t,e,i){var s,r,o,n,a,h,l=e[0],c=[],u=[],d=!1;if(a=utils_type.A.copyAttributes(i,t.options,"polygon3d"),null===(n=t.select(e[1]))&&(n=e[1]),utils_type.A.isObject(n)&&n.type===constants.A.OBJECT_TYPE_POLYGON3D&&utils_type.A.isTransformationOrArray(e[2]))for(d=!0,o=n.vertices.length-1,h=utils_type.A.copyAttributes(i,t.options,"polygon3d","vertices"),r=0;r<o;r++)h.withlabel&&(h.name=""===n.vertices[r].name?"":n.vertices[r].name+"'"),c.push(t.create("point3d",[n.vertices[r],e[2]],h));else if(utils_type.A.isArray(e[1])&&e[1].every(t=>utils_type.A.isPoint3D(t)))c=e[1];else if(!1===(c=utils_type.A.providePoints3D(l,e.slice(1),i,"polygon3d",["vertices"])))throw new Error("JSXGraph: Can't create polygon3d with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon3d and a transformation can be supplied");for((s=new jxg.A.Polygon3D(l,c,a)).isDraggable=!0,a=s.setAttr2D(a),r=0;r<c.length;r++)u.push(c[r].element2D);if(s.element2D=t.create("polygon",u,a),s.element2D.view=l,s.addChild(s.element2D),s.inherits.push(s.element2D),s.element2D.setParents(s),d)for(s.prepareUpdate().update().updateVisibility().updateRenderer(),o=n.vertices.length-1,r=0;r<o;r++)c[r].prepareUpdate().update().updateVisibility().updateRenderer();return s},jxg.A.registerElement("polygon3d",jxg.A.createPolygon3D),jxg.A.Face3D=function(t,e,i,s){this.constructor(t.board,s,constants.A.OBJECT_TYPE_FACE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"face3d"),this.board.finalizeAdding(this),this.polyhedron=e,this.faceNumber=i,this.normal=[0,0,0,0],this.d=0,this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],0===this.faceNumber&&this.updateCoords(),this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Face3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Face3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Face3D.prototype,{updateCoords:function(){var t,e,i,s,r=this.polyhedron;for(t in r.vertices){if(s=r.vertices[t],utils_type.A.isFunction(s))r.coords[t]=utils_type.A.evaluate(s);else if(utils_type.A.isArray(s))for(r.coords[t]=[],i=s.length,e=0;e<i;e++)r.coords[t][e]=utils_type.A.evaluate(s[e]);else{if(s=r.view.select(s),!utils_type.A.isPoint3D(s))throw new Error("Polyhedron3D.updateCoords: unknown vertices type!");r.coords[t]=s.coords}3===r.coords[t].length&&r.coords[t].unshift(1)}return this},updateDataArray2D:function(){var t,e,i,s,r=[],o=[],n=this.polyhedron,a=n.faces[this.faceNumber];if(0===this.faceNumber)for(t in n.vertices)n.coords2D[t]=[];for(e=a.length,this.zIndex=0,t=0;t<e;t++)0===(s=n.coords2D[a[t]]).length&&(i=n.coords[a[t]],s=this.view.project3DTo2D(i),n.coords2D[a[t]]=s,n.zIndex[a[t]]=math.A.innerProduct(this.view.matrix3DRotShift[3],i)),r.push(s[1]),o.push(s[2]),this.zIndex+=n.zIndex[a[t]];return e>0&&(this.zIndex/=e),2!==e&&(r.push(r[0]),o.push(o[0])),{X:r,Y:o}},addTransform:function(t,e){return 0===this.faceNumber&&this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,s,r;if(0!==this.faceNumber)return this;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this.transformations,i=0;i<t.length;i++)t[i].update();for(i in(r=this===this.baseElement?this.polyhedron:this.baseElement.polyhedron).coords)if(r.coords.hasOwnProperty(i)){for(e=r.coords[i],s=0;s<t.length;s++)e=math.A.matVecMult(t[s].matrix,e);this.polyhedron.coords[i]=e}return this},update:function(){var t,e,i,s,r,o;if(this.needsUpdate&&!this.view.board._change3DView){if(e=this.polyhedron,0===this.faceNumber&&this.updateCoords().updateTransform(),(o=e.faces[this.faceNumber]).length<3)return this;if(s=e.coords[o[0]],r=e.coords[o[1]],this.vec1=[r[0]-s[0],r[1]-s[1],r[2]-s[2],r[3]-s[3]],r=e.coords[o[2]],this.vec2=[r[0]-s[0],r[1]-s[1],r[2]-s[2],r[3]-s[3]],this.normal=math.A.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),i=math.A.norm(this.normal),this.normal.unshift(0),Math.abs(i)>1e-12)for(t=1;t<4;t++)this.normal[t]/=i;this.d=math.A.innerProduct(s,this.normal,4)}return this},updateRenderer:function(){return this.needsUpdate&&(this.needsUpdate=!1,this.shader()),this},shader:function(){var t,e,i,s,r,o,n,a,h;if(this.evalVisProp("shader.enabled"))return t=this.evalVisProp("shader.hue"),e=this.evalVisProp("shader.saturation"),a=this.evalVisProp("shader.minlightness"),h=this.evalVisProp("shader.maxlightness"),"angle"===this.evalVisProp("shader.type").toLowerCase()?(s=math.A.innerProduct(this.view.matrix3DRotShift[3],this.normal),i=a+(h-a)*(s=Math.abs(s))):(n=this.view.zIndexMax,o=this.view.zIndexMin,i=a+(h-a)*((this.zIndex-o)/(n-o))),r="hsl("+t+","+e+"%,"+i+"%)",this.element2D.visProp.fillcolor=r,this.zIndex}}),jxg.A.createFace3D=function(t,e,i){var s,r,o=e[0],n=e[1],a=e[2];return s=utils_type.A.copyAttributes(i,t.options,"face3d"),s=(r=new jxg.A.Face3D(o,n,a,s)).setAttr2D(s),r.element2D=o.create("curve",[[],[]],s),r.element2D.view=o,r.element2D.updateDataArray=function(){var t=r.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},r.addChild(r.element2D),r.inherits.push(r.element2D),r.element2D.setParents(r),r.element2D.prepareUpdate().update(),t.isSuspendedUpdate||r.element2D.updateVisibility().updateRenderer(),r},jxg.A.registerElement("face3d",jxg.A.createFace3D),jxg.A.Polyhedron3D=function(t,e,i,s){var r,o,n,a=this;for(this.constructor(t.board,s,constants.A.OBJECT_TYPE_POLYHEDRON3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"polyhedron3d"),this.board.finalizeAdding(this),this.elType="polyhedron3d",this.faces=i,this.numberFaces=i.length,this.def=e,o=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],n=function(t){return function(){var e;for(e in a.faces)a.faces.hasOwnProperty(e)&&utils_type.A.exists(a.faces[e][t])&&a.faces[e][t].apply(a.faces[e],arguments);return a}},r=0;r<o.length;r++)this[o[r]]=n(o[r]);this.methodMap=utils_type.A.deepCopy(this.methodMap,{setAttribute:"setAttribute",setParents:"setParents",addTransform:"addTransform"})},jxg.A.Polyhedron3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Polyhedron3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Polyhedron3D.prototype,{addTransform:function(t,e){if(!(this.faces.length>0&&t.faces.length>0))throw new Error("Adding transformation failed. At least one of the two polyhedra has no faces.");return this.faces[0].addTransform(t.faces[0],e),this},toSTL:function(t){var e,i,s,r,o,n,a="solid ";for(void 0===t&&(t=this.name),a+=t+"\n",e=0;e<this.def.faces.length;e++){for(a+=" facet normal 0 0 0\n  outer loop\n",n=(r=this.def.faces[e]).length,s=this.def.coords,i=0;i<n;i++)a+="   vertex "+(o=s[r[i]])[1]+" "+o[2]+" "+o[3]+"\n";a+="  endloop\n endfacet\n"}return a+="endsolid "+t+"\n"}}),jxg.A.createPolyhedron3D=function(t,e,i){var s,r,o,n,a,h,l,c=e[0],u=[],d=null,p=null,f={view:c,vertices:{},coords:{},coords2D:{},zIndex:{},faces:[]};if(utils_type.A.exists(e[1].type)&&e[1].type===constants.A.OBJECT_TYPE_POLYHEDRON3D)d=e[1],p=e[2],f.vertices=d.def.vertices,f.faces=d.def.faces;else{if(utils_type.A.isArray(e[1]))for(r=e[1].length,s=0;s<r;s++)f.vertices[s]=e[1][s];else if(utils_type.A.isObject(e[1]))for(s in e[1])e[1].hasOwnProperty(s)&&(f.vertices[s]=e[1][s]);f.faces=e[2]}for(l=utils_type.A.copyAttributes(i,t.options,"polyhedron3d"),console.time("polyhedron"),c.board.suspendUpdate(),r=f.faces.length,s=0;s<r;s++)h=utils_type.A.copyAttributes(i,t.options,"face3d"),l.fillcolorarray.length>0&&(h.fillcolor=l.fillcolorarray[s%l.fillcolorarray.length]),n=f.faces[s],utils_type.A.isArray(n)&&2===n.length&&utils_type.A.isObject(n[1])&&utils_type.A.isArray(n[0])&&(utils_type.A.mergeAttr(h,n[1]),f.faces[s]=n[0]),o=c.create("face3d",[f,s],h),u.push(o);for((a=new jxg.A.Polyhedron3D(c,f,u,l)).setParents(a),s=0;s<r;s++)a.inherits.push(a.faces[s]),a.addChild(a.faces[s]);return null!==d&&(a.addTransform(d,p),a.addParents(d)),c.board.unsuspendUpdate(),console.timeEnd("polyhedron"),a},jxg.A.registerElement("polyhedron3d",jxg.A.createPolyhedron3D),jxg.A.Sphere3D=function(t,e,i,s,r){this.constructor(t.board,r,constants.A.OBJECT_TYPE_SPHERE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"sphere3d"),this.board.finalizeAdding(this),this.method=e,this.center=this.board.select(i),this.point2=null,this.points=[],this.element2D=null,this.aux2D=[],this.projectionType=t.projectionType,"twoPoints"===e?(this.point2=this.board.select(s),this.radius=this.Radius()):"pointRadius"===e&&(this.updateRadius=utils_type.A.createFunction(s,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])),utils_type.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"twoPoints"===e&&(utils_type.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=utils_type.A.deepCopy(this.methodMap,{center:"center",point2:"point2",Radius:"Radius"})},jxg.A.Sphere3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Sphere3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Sphere3D.prototype,{X:function(t,e){return this.Radius()*Math.sin(t)*Math.cos(e)},Y:function(t,e){return this.Radius()*Math.sin(t)*Math.sin(e)},Z:function(t,e){return this.Radius()*Math.cos(t)},range_u:[0,2*Math.PI],range_v:[0,Math.PI],update:function(){return this.projectionType!==this.view.projectionType&&this.rebuildProjection(),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(t){return this.updateRadius=utils_type.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return utils_type.A.exists(t)?(this.setRadius(t),this.Radius()):"twoPoints"===this.method?this.center.testIfFinite()&&this.point2.testIfFinite()?this.center.distance(this.point2):NaN:"pointRadius"===this.method?Math.abs(this.updateRadius()):NaN},focusFn:function(t){var e=this;return function(){var i=e.view.boxToCam[3],s=e.Radius();return e.view.project3DTo2D([e.center.X()+t*s*i[1],e.center.Y()+t*s*i[2],e.center.Z()+t*s*i[3]]).slice(1,3)}},innerVertexFn:function(){var t=this;return function(){var e,i=t.view,s=i.worldToFocal(t.center.coords,!1),r=math.A.hypot(s[0],s[1]),o=i.boxToCam,n=t.Radius(),a=Math.atan(-r/s[2])+Math.acos(n/math.A.norm(s)),h=Math.cos(a),l=Math.sin(a);return e=r>1e-8?[-(s[0]*o[1][1]+s[1]*o[2][1])/r,-(s[0]*o[1][2]+s[1]*o[2][2])/r,-(s[0]*o[1][3]+s[1]*o[2][3])/r]:[o[1][1],o[1][2],o[1][3]],i.project3DTo2D([t.center.X()+n*(l*e[0]+h*o[3][1]),t.center.Y()+n*(l*e[1]+h*o[3][2]),t.center.Z()+n*(l*e[2]+h*o[3][3])])}},buildCentralProjection:function(t){var e=this.view,i={visible:!1,withLabel:!1},s=e.create("point",this.focusFn(-1),i),r=e.create("point",this.focusFn(1),i),o=e.create("point",this.innerVertexFn(e),i);this.aux2D=[s,r,o],this.element2D=e.create("ellipse",this.aux2D,void 0===t?this.visProp:t)},buildParallelProjection:function(t){var e=this;this.aux2D=[],this.element2D=this.view.create("circle",[e.center.element2D,function(){var t=e.view.bbox3D[0][1]-e.view.bbox3D[0][0];return e.Radius()*e.view.size[0]/t}],void 0===t?this.visProp:t)},rebuildProjection:function(t){var e;if(this.element2D)for(e in this.view.board.removeObject(this.element2D),this.aux2D)this.aux2D.hasOwnProperty(e)&&this.view.board.removeObject(this.aux2D[e]);this.projectionType=this.view.projectionType,"central"===this.projectionType?this.buildCentralProjection(t):this.buildParallelProjection(t),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view},projectCoords:function(t,e){var i=this.Radius(),s=[1].concat(t),r=this.center.coords,o=geometry.A.distance(r,s,4),n=statistics.A.subtract(s,r);return 0===o?(e[0]=0,e[1]=0,[1,i,0,0]):0===i?(e[0]=0,e[1]=0,this.center.coords):(o=i/o,n[0]=1,n[1]*=o,n[2]*=o,n[3]*=o,e[1]=Math.atan2(n[2],n[1]),e[1]+=e[1]<0?Math.PI:0,0!==e[1]?e[0]=Math.atan2(n[2],n[3]*Math.sin(e[1])):e[0]=Math.atan2(n[1],n[3]*Math.cos(e[1])),e[0]+=e[0]<0?2*Math.PI:0,n)}}),jxg.A.createSphere3D=function(t,e,i){var s,r,o,n,a,h,l=e[0];for(s=utils_type.A.copyAttributes(i,t.options,"sphere3d"),r=[],h=1;h<e.length;h++)if(utils_type.A.isPointType3D(t,e[h])){if(o=0===r.length?"center":"point",!1===(n=utils_type.A.providePoints3D(l,[e[h]],i,"sphere3d",[o])[0]))throw new Error("JSXGraph: Can't create sphere3d from this type. Please provide a point type.");r.push(n)}else r.push(e[h]);if(utils_type.A.isPoint3D(r[0])&&utils_type.A.isPoint3D(r[1]))a=new jxg.A.Sphere3D(l,"twoPoints",r[0],r[1],s);else{if(!utils_type.A.isPoint3D(r[0])||!(utils_type.A.isNumber(r[1])||utils_type.A.isFunction(r[1])||utils_type.A.isString(r[1])))throw new Error("JSXGraph: Can't create sphere3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point], [point,number], [point,function]");a=new jxg.A.Sphere3D(l,"pointRadius",r[0],r[1],s)}return s=a.setAttr2D(s),a.rebuildProjection(s),a.element2D.prepareUpdate().update(),t.isSuspendedUpdate||a.element2D.updateVisibility().updateRenderer(),a},jxg.A.registerElement("sphere3d",jxg.A.createSphere3D),jxg.A.Surface3D=function(t,e,i,s,r,o,n,a){this.constructor(t.board,a,constants.A.OBJECT_TYPE_SURFACE3D,constants.A.OBJECT_CLASS_3D),this.constructor3D(t,"surface3d"),this.board.finalizeAdding(this),this._F=e,this._X=i,this._Y=s,this._Z=r,null!==this._F?(this._X=function(t,e){return this._F(t,e)[0]},this._Y=function(t,e){return this._F(t,e)[1]},this._Z=function(t,e){return this._F(t,e)[2]}):null!==this._X&&(this._F=function(t,e){return[this._X(t,e),this._Y(t,e),this._Z(t,e)]}),this.range_u=o,this.range_v=n,this.dataX=null,this.dataY=null,this.dataZ=null,this.points=[],this.methodMap=utils_type.A.deepCopy(this.methodMap,{})},jxg.A.Surface3D.prototype=new jxg.A.GeometryElement,utils_type.A.copyPrototypeMethods(jxg.A.Surface3D,jxg.A.GeometryElement3D,"constructor3D"),jxg.A.extend(jxg.A.Surface3D.prototype,{updateWireframe:function(){var t,e,i,s,r,o,n,a,h,l,c,u,d=[1,0,0,0];for(this.points=[],t=this.evalVisProp("stepsu"),e=this.evalVisProp("stepsv"),r=utils_type.A.evaluate(this.range_u),o=utils_type.A.evaluate(this.range_v),n=utils_type.A.evaluate(r[0]),a=utils_type.A.evaluate(o[0]),h=(utils_type.A.evaluate(r[1])-n)/t,l=(utils_type.A.evaluate(o[1])-a)/e,i=0,c=n;i<=t;i++,c+=h)for(this.points.push([]),s=0,u=a;s<=e;s++,u+=l)(d=this.F(c,u)).unshift(1),this.points[i].push(d);return this},updateCoords:function(){return null!==this._F?this.updateWireframe():this.updateTransform(),this},evalF:function(t,e){var i,s,r=[0,0,0,0];if(0===this.transformations.length||!utils_type.A.exists(this.baseElement))return r=this._F(t,e);for(i=this.transformations,s=0;s<i.length;s++)i[s].update();for((r=this===this.baseElement?this._F(t,e):this.baseElement.evalF(t,e)).unshift(1),r=math.A.matVecMult(i[0].matrix,r),s=1;s<i.length;s++)r=math.A.matVecMult(i[s].matrix,r);return r.slice(1)},F:function(t,e){return this.evalF(t,e)},X:function(t,e){return this.evalF(t,e)[0]},Y:function(t,e){return this.evalF(t,e)[1]},Z:function(t,e){return this.evalF(t,e)[2]},updateDataArray2D:function(){var t,e,i,s,r,o=[],n=[];if(0!==(i=this.points.length)){for(s=this.points[0].length,t=0;t<i;t++){for(e=0;e<s;e++)r=this.view.project3DTo2D(this.points[t][e]),o.push(r[1]),n.push(r[2]);o.push(NaN),n.push(NaN)}for(e=0;e<s;e++){for(t=0;t<i;t++)r=this.view.project3DTo2D(this.points[t][e]),o.push(r[1]),n.push(r[2]);o.push(NaN),n.push(NaN)}}return{X:o,Y:n}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,s,r,o,n;if(0===this.transformations.length||null===this.baseElement||utils_type.A.exists(this._F))return this;for(t=this.transformations,i=0;i<t.length;i++)t[i].update();if(this!==this.baseElement&&(this.points=[]),(o=this.baseElement.points.length)>0)for(n=this.baseElement.points[0].length,i=0;i<o;i++)for(this!==this.baseElement&&this.points.push([]),s=0;s<n;s++){for(e=this===this.baseElement?this.points[i][s]:this.baseElement.points[i][s],r=0;r<t.length;r++)e=math.A.matVecMult(t[r].matrix,e);this===this.baseElement?this.points[i][s]=e:this.points[i].push(e)}return this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return geometry.A.projectCoordsToParametric(t,this,2,e)}}),jxg.A.createParametricSurface3D=function(t,e,i){var s,r,o,n,a,h,l,c,u=e[0],d=null,p=null;return 3===e.length?(d=e[1],p=e[2],s=null,r=null,o=null,n=null):4===e.length?(s=e[1],a=e[2],h=e[3],r=null,o=null,n=null):(r=e[1],o=e[2],n=e[3],a=e[4],h=e[5],s=null),l=utils_type.A.copyAttributes(i,t.options,"surface3d"),l=(c=new jxg.A.Surface3D(u,s,r,o,n,a,h,l)).setAttr2D(l),c.element2D=u.create("curve",[[],[]],l),c.element2D.view=u,null!==d&&(c.addTransform(d,p),c.addParents(d)),c.element2D.updateDataArray=function(){var t=c.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},c.addChild(c.element2D),c.inherits.push(c.element2D),c.element2D.setParents(c),c.element2D.prepareUpdate().update(),t.isSuspendedUpdate||c.element2D.updateVisibility().updateRenderer(),c},jxg.A.registerElement("parametricsurface3d",jxg.A.createParametricSurface3D),jxg.A.createFunctiongraph3D=function(t,e,i){var s,r=e[0],o=utils_type.A.createFunction(e[1],t,"x, y"),n=e[2],a=e[3];return(s=r.create("parametricsurface3d",[function(t,e){return t},function(t,e){return e},o,n,a],i)).elType="functiongraph3d",s},jxg.A.registerElement("functiongraph3d",jxg.A.createFunctiongraph3D),jxg.A.Parse3D={STL:function(t){var e,i,s,r,o,n,a,h,l,c=[],u=[],d=[];for(r=(n=t.split("\n")).length,e=0;e<r;e++)if(0===(o=n[e].trim()).indexOf("solid"))h=-1,u=[],d=[];else if(0===o.indexOf("endsolid"))c.push([u.slice(),d.slice()]);else if(0===o.indexOf("facet"))h++,d.push([]);else{if(0===o.indexOf("outer loop")||0===o.indexOf("endloop"))continue;if(0===o.indexOf("vertex")){for(a=o.split(" ").slice(1).map(t=>parseFloat(t)),l=!1,i=0;i<u.length;i++)if(jxg.A.Math.Geometry.distance(u[i],a,3)<jxg.A.Math.eps){l=!0,s=i;break}!1===l&&(s=u.length,u.push(a)),d[h].push(s)}}return c}};var _3dmodels=jxg.A.Parse3D;let size=.75,color="#000";jxg.A.themes.mono_thin={board:{showInfobox:!1,showCopyright:!0,defaultAxes:{x:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[1,0]}},y:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[0,1]}}}},navbar:{strokeColor:"#bbb",fillColor:"none"},elements:{strokeColor:color,highlightStrokeColor:color,fillColor:"none",highlightFillColor:"none",strokeOpacity:.6,highlightStrokeOpacity:1},angle:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3,label:{strokeColor:color}},arc:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},axis:{},boxplot:{strokeWidth:size,strokeColor:color,fillColor:color,fillOpacity:.2,highlightStrokeWidth:size,highlightStrokeColor:color,highlightFillColor:color,highlightFillOpacity:.1},circle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},circumcircle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},circumcirclearc:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},circumcirclesector:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},comb:{strokeColor:color,strokeWidth:size},conic:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightStrokeColor:color,fillColor:"none",highlightFillColor:"none"},curve:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size},grid:{strokeWidth:size},hatch:{strokeColor:color,strokeWidth:size},incircle:{strokeWidth:size,highlightStrokeWidth:1.5*size,strokeColor:color,highlightFillColor:"none",highlightStrokeColor:color,center:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},inequality:{fillColor:"#aaaaaa55",fillOpacity:.2},integral:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaa33",fillOpacity:.3,highlightFillOpacity:.3,curveLeft:{color:color},baseLeft:{color:color},curveRight:{color:color},baseRight:{color:color}},label:{strokeColor:color},line:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size,point1:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},normal:{strokeColor:color},parallel:{strokeColor:color},perpendicular:{strokeColor:color},perpendicularsegment:{strokeColor:color},point:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},polygon:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaaa33",fillOpacity:.3,highlightFillOpacity:.3,vertices:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},borders:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size}},sector:{strokeColor:color,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},semicircle:{center:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color}},slider:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color,baseline:{strokeWidth:size,strokeColor:color,highlightStrokeColor:color},label:{strokeColor:color},highline:{strokeWidth:3*size,name:"",strokeColor:color,highlightStrokeColor:color},ticks:{strokeColor:color}},slopefield:{strokeWidth:.75*size,highlightStrokeWidth:size,highlightStrokeColor:color,highlightStrokeOpacity:.8},tapemeasure:{strokeColor:color,strokeWidth:size,highlightStrokeColor:color,highlightStrokeWidth:size,point1:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},point2:{size:size,fillColor:color,strokeColor:color,highlightStrokeWidth:4*size,highlightFillColor:color,highlightStrokeColor:color},ticks:{strokeWidth:size}},text:{strokeColor:color},tracecurve:{strokeColor:color},turtle:{strokeWidth:size,strokeColor:color,arrow:{strokeWidth:2*size,strokeColor:"#aaaaaa55"}},vectorfield:{strokeWidth:.75*size,highlightStrokeWidth:size,highlightStrokeColor:color,highlightStrokeOpacity:.8}};var mono_thin=null;const COORDS_BY_SCREEN=jxg.A.COORDS_BY_SCREEN,COORDS_BY_USER=jxg.A.COORDS_BY_USER,Dump=jxg.A.Dump,Expect=jxg.A.Expect,JSXGraph=jxg.A.JSXGraph,Mat=jxg.A.Math,Options=jxg.A.Options,boards=jxg.A.boards,src_elements=jxg.A.elements,palette=jxg.A.palette,paletteWong=jxg.A.paletteWong,Board=jxg.A.Board,Chart=jxg.A.Chart,Circle=jxg.A.Circle,Complex=jxg.A.Complex,Composition=jxg.A.Composition,Coords=jxg.A.Coords,CoordsElement=jxg.A.CoordsElement,Curve=jxg.A.Curve,GeometryElement=jxg.A.GeometryElement,Group=jxg.A.Group,src_Image=jxg.A.Image,JessieCode=jxg.A.JessieCode,Prefix=jxg.A.PrefixParser,Line=jxg.A.Line,Point=jxg.A.Point,Polygon=jxg.A.Polygon,Text=jxg.A.Text,Ticks=jxg.A.Ticks,Transformation=jxg.A.Transformation,Turtle=jxg.A.Turtle,View3D=jxg.A.View3D,LMS2rgb=jxg.A.LMS2rgb,addEvent=jxg.A.addEvent,autoDigits=jxg.A.autoDigits,autoHighlight=jxg.A.autoHighlight,bind=jxg.A.bind,capitalize=jxg.A.capitalize,clearVisPropOld=jxg.A.clearVisPropOld,clone=jxg.A.clone,cloneAndCopy=jxg.A.cloneAndCopy,cmpArrays=jxg.A.cmpArrays,coordsArrayToMatrix=jxg.A.coordsArrayToMatrix,copyAttributes=jxg.A.copyAttributes,createEvalFunction=jxg.A.createEvalFunction,createFunction=jxg.A.createFunction,createHTMLSlider=jxg.A.createHTMLSlider,darkenColor=jxg.A.darkenColor,debug=jxg.A.debug,debugInt=jxg.A.debugInt,debugLine=jxg.A.debugLine,debugWST=jxg.A.debugWST,deepCopy=jxg.A.deepCopy,def=jxg.A.def,deprecated=jxg.A.deprecated,eliminateDuplicates=jxg.A.eliminateDuplicates,escapeHTML=jxg.A.escapeHTML,evalSlider=jxg.A.evalSlider,evaluate=jxg.A.evaluate,filterElements=jxg.A.filterElements,getBoardByContainerId=jxg.A.getBoardByContainerId,getCSSTransformMatrix=jxg.A.getCSSTransformMatrix,getCSSTransform=jxg.A.getCSSTransform,getDimensions=jxg.A.getDimensions,getOffset=jxg.A.getOffset,getPosition=jxg.A.getPosition,getProp=jxg.A.getProp,hex2rgb=jxg.A.hex2rgb,hsv2rgb=jxg.A.hsv2rgb,isAndroid=jxg.A.isAndroid,isApple=jxg.A.isApple,isArray=jxg.A.isArray,isDesktop=jxg.A.isDesktop,isInArray=jxg.A.isInArray,isInObject=jxg.A.isInObject,isMetroApp=jxg.A.isMetroApp,isMobile=jxg.A.isMobile,isMozilla=jxg.A.isMozilla,isBoard=jxg.A.isBoard,isName=jxg.A.isName,isNode=jxg.A.isNode,isNumber=jxg.A.isNumber,isObject=jxg.A.isObject,isPoint=jxg.A.isPoint,isPoint3D=jxg.A.isPoint3D,isPointType=jxg.A.isPointType,isPointType3D=jxg.A.isPointType3D,isString=jxg.A.isString,isTouchDevice=jxg.A.isTouchDevice,isTransformationOrArray=jxg.A.isTransformationOrArray,isWebWorker=jxg.A.isWebWorker,isWebkitAndroid=jxg.A.isWebkitAndroid,isWebkitApple=jxg.A.isWebkitApple,keys=jxg.A.keys,lightenColor=jxg.A.lightenColor,merge=jxg.A.merge,normalizePointFace=jxg.A.normalizePointFace,providePoints=jxg.A.providePoints,registerElement=jxg.A.registerElement,registerReader=jxg.A.registerReader,removeAllEvents=jxg.A.removeAllEvents,removeElementFromArray=jxg.A.removeElementFromArray,removeEvent=jxg.A.removeEvent,rgb2LMS=jxg.A.rgb2LMS,rgb2bw=jxg.A.rgb2bw,rgb2cb=jxg.A.rgb2cb,rgb2css=jxg.A.rgb2css,rgb2hex=jxg.A.rgb2hex,rgb2hsv=jxg.A.rgb2hsv,rgbParser=jxg.A.rgbParser,rgb2rgbo=jxg.A.rgba2rgbo,rgb2rgba=jxg.A.rgbo2rgba,sanitizeHTML=jxg.A.sanitizeHTML,shortcut=jxg.A.shortcut,strBool=jxg.A.str2Bool,supportsCanvas=jxg.A.supportsCanvas,supportsPointerEvents=jxg.A.supportsPointerEvents,supportsSVG=jxg.A.supportsSVG,supportsVML=jxg.A.supportsVML,swap=jxg.A.swap,timeChunk=jxg.A.timedChunk,toFixed=jxg.A.toFixed,toFullscreen=jxg.A.toFullscreen,toJSON=jxg.A.toJSON,trim=jxg.A.trim,trimNumber=jxg.A.trimNumber,truncate=jxg.A.truncate,unescapeHTML=jxg.A.unescapeHTML,uniqueArray=jxg.A.uniqueArray,useBlackWhiteOptions=jxg.A.useBlackWhiteOptions,useStandardOptions=jxg.A.useStandardOptions,warn=jxg.A.warn;env.A.isBrowser?window.JXG=jxg.A:env.A.isWebWorker()&&(self.JXG=jxg.A);var src=jxg.A;return __webpack_exports__=__webpack_exports__.default,__webpack_exports__}()});