diff --git a/corsscripts/jsxgraph.min.css b/corsscripts/jsxgraph.min.css index 90f05334f1fc07840e4a25de4136089d690d85e4..fb8edd9ba10ed976f2c0387d4a184e6bbef97855 100644 --- a/corsscripts/jsxgraph.min.css +++ b/corsscripts/jsxgraph.min.css @@ -1,8 +1 @@ -/** - * Minified by jsDelivr using clean-css v5.3.2. - * Original file: /npm/jsxgraph@1.8.0/distrib/jsxgraph.css - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -.jxgbox{position:relative;overflow:hidden;background-color:#fff;border-style:solid;border-width:1px;border-color:#356aa0;border-radius:10px;-webkit-border-radius:10px;margin:0;-ms-touch-action:none}.jxgbox svg text{cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.JXGtext{font-family:Courier,monospace;background-color:transparent;padding:0;margin:0}.JXGinfobox{border-style:none;border-width:0;border-color:#000}.jxgbox :focus{outline-width:.5px;outline-style:dotted}.JXG_navigation{position:absolute;right:5px;bottom:5px;z-index:100;background-color:transparent;padding:2px;font-size:14px;cursor:pointer}.JXG_navigation_button{color:#666}.JXG_navigation_button:hover{border-radius:2px;background:rgba(184,184,184,.5)}.JXG_navigation_button svg{top:.2em;position:relative;padding:0}.JXG_wrap_private:-moz-full-screen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:-webkit-full-screen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:fullscreen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:-ms-fullscreen{background-color:#ccc;padding:0;width:100%;height:100%}.smart-label-solid{padding:1px 7px 1px 7px;margin:0;color:#fff;border-radius:150px;text-align:center;vertical-align:middle}.smart-label-outline{padding:1px 7px 1px 7px;margin:0;border:solid 2px #000;background-color:#fff;color:#000;border-radius:15px;text-align:center;vertical-align:middle}.smart-label-pure{padding:20px 7px 1px 7px;margin:0;border:none;background-color:transparent;color:#000;border-radius:15px;text-align:center;vertical-align:middle}.smart-label-line,.smart-label-point{background-color:#0072b2;border-color:#0072b2}.smart-label-point{margin-top:12px}.smart-label-angle{background-color:#e69f00;border-color:#e69f00;padding:1px 7px 1px 7px}.smart-label-circle,.smart-label-polygon{background-color:#f0e442;color:#000;border-color:#f0e442;padding:1px 7px 1px 7px} -/*# sourceMappingURL=/sm/3d24edaf681ab6c04b17b9893d6c33777ba27894d29051d482fdfd0f7c0d071b.map */ \ No newline at end of file +.jxgbox{position:relative;overflow:hidden;background-color:#fff;border-style:solid;border-width:1px;border-color:#356aa0;border-radius:10px;-webkit-border-radius:10px;margin:0;-ms-touch-action:none}.jxgbox svg text{cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.JXGtext{font-family:Courier,monospace;background-color:transparent;padding:0;margin:0}.JXGinfobox{border-style:none;border-width:0;border-color:#000}.jxgbox :focus{outline-width:.5px;outline-style:dotted}.JXG_navigation{position:absolute;right:5px;bottom:5px;z-index:100;background-color:transparent;padding:2px;font-size:14px;cursor:pointer}.JXG_navigation_button{color:#666}.JXG_navigation_button:hover{border-radius:2px;background:rgba(184,184,184,.5)}.JXG_navigation_button svg{top:.2em;position:relative;padding:0}.JXG_wrap_private:-moz-full-screen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:-webkit-full-screen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:fullscreen{background-color:#ccc;padding:0;width:100%;height:100%}.JXG_wrap_private:-ms-fullscreen{background-color:#ccc;padding:0;width:100%;height:100%}.smart-label-solid{padding:1px 7px 1px 7px;margin:0;color:#fff;border-radius:150px;text-align:center;vertical-align:middle}.smart-label-outline{padding:1px 7px 1px 7px;margin:0;border:solid 2px #000;background-color:#fff;color:#000;border-radius:15px;text-align:center;vertical-align:middle}.smart-label-pure{padding:20px 7px 1px 7px;margin:0;border:none;background-color:transparent;color:#000;border-radius:15px;text-align:center;vertical-align:middle}.smart-label-line,.smart-label-point{background-color:#0072b2;border-color:#0072b2}.smart-label-point{margin-top:12px}.smart-label-angle{background-color:#e69f00;border-color:#e69f00;padding:1px 7px 1px 7px}.smart-label-circle,.smart-label-polygon{background-color:#f0e442;color:#000;border-color:#f0e442;padding:1px 7px 1px 7px} \ No newline at end of file diff --git a/corsscripts/jsxgraphcore.min.js b/corsscripts/jsxgraphcore.min.js index ce5c6b4c9ebdba1ac1c75bdb824cd57df96ba4e4..3ce88f23752695abca75131b680622055ec0d9cb 100644 --- a/corsscripts/jsxgraphcore.min.js +++ b/corsscripts/jsxgraphcore.min.js @@ -1,61 +1 @@ -/** - * Skipped minification because the original files appears to be already minified. - * Original file: /npm/jsxgraph@1.8.0/distrib/jsxgraphcore.js - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -/* - JSXGraph 1.8.0 - - Copyright 2008-2023 - 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__={351:function(t,e,i){var s,r=i(765),o="1.8.0";s={version:o,licenseText:"JSXGraph v1.8.0 Copyright (C) see https://jsxgraph.org",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_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.Z.extendConstants(r.Z,s),e.Z=s},705:function(t,e,i){var s=i(765),r=i(351),o=i(88),n=i(109),a=i(275);s.Z.Coords=function(t,e,i,s){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!n.Z.exists(s)||s,this.emitter&&o.Z.eventify(this),this.setCoordinates(t,e,!1,!0)},s.Z.extend(s.Z.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>a.Z.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.Z.COORDS_BY_USER?(i=e.usrCoords,(s=o[0]-i[0])*s>a.Z.eps*a.Z.eps?Number.POSITIVE_INFINITY:a.Z.hypot(o[1]-i[1],o[2]-i[2])):(i=e.scrCoords,a.Z.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.Z.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.Z.eps},__evt__update:function(t,e){},__evt:function(){}}),e.Z=s.Z.Coords},218:function(t,e,i){var s=i(765),r=i(275),o=i(922),n=i(336),a=i(309),h=i(705),l=i(351),c=i(109);s.Z.CoordsElement=function(t,e){var i;for(c.Z.exists(t)||(t=[1,0,0]),i=0;i<t.length;++i)t[i]=parseFloat(t[i]);this.coords=new h.Z(l.Z.COORDS_BY_USER,t,this.board),this.initialCoords=new h.Z(l.Z.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.Z.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.Z.exists(this.element)&&this.addAnchor(t,e),this.isDraggable=!0},s.Z.extend(s.Z.CoordsElement.prototype,{updateConstraint:function(){return this},updateCoords:function(t){return this.needsUpdate?(c.Z.exists(t)||(t=!1),c.Z.evaluate(this.visProp.frozen)||this.updateConstraint(),this.type===l.Z.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,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O=2*Math.PI,x=!1,w=this.slideObject,S=[];if(this.needsUpdateFromParent=!1,w.elementClass===l.Z.OBJECT_CLASS_CIRCLE)c.Z.evaluate(this.visProp.isgeonext)&&(O=1),b=o.Z.projectPointToCircle(this,w,this.board),v=o.Z.rad([w.center.X()+1,w.center.Y()],w.center,this)/O;else if(w.elementClass===l.Z.OBJECT_CLASS_LINE){if(this.onPolygon){if(s=w.point1.coords.usrCoords,e=(n=w.point2.coords.usrCoords)[t=1]-s[t],Math.abs(e)<r.Z.eps&&(e=n[t=2]-s[t]),d=(o.Z.projectPointToLine(this,w,this.board).usrCoords[t]-s[t])/e,a=w.parentPolygon,d<0){for(t=0;t<a.borders.length;t++)if(w===a.borders[t]){w=a.borders[(t-1+a.borders.length)%a.borders.length];break}}else if(d>1)for(t=0;t<a.borders.length;t++)if(w===a.borders[t]){w=a.borders[(t+1+a.borders.length)%a.borders.length];break}w.id!==this.slideObject.id&&(this.slideObject=w)}s=w.point1.coords,n=w.point2.coords,(e=s.distance(l.Z.COORDS_BY_USER,n))<r.Z.eps?(b=s,x=!0,v=0):(b=o.Z.projectPointToLine(this,w,this.board),s=s.usrCoords.slice(0),n=n.usrCoords.slice(0),Math.abs(n[0])<r.Z.eps?(e=n[t=1],Math.abs(e)<r.Z.eps&&(e=n[t=2]),v=((e=(b.usrCoords[t]-s[t])/e)>=0?1:-1)*(e=Math.abs(e))/(e+1)):Math.abs(s[0])<r.Z.eps?(e=s[t=1],Math.abs(e)<r.Z.eps&&(e=s[t=2]),v=(e=(b.usrCoords[t]-n[t])/e)<0?(1-2*e)/(1-e):1/(e+1)):(e=n[t=1]-s[t],Math.abs(e)<r.Z.eps&&(e=n[t=2]-s[t]),v=(b.usrCoords[t]-s[t])/e)),null!==(C=this.findClosestSnapValue(v))?(v=(c.Z.evaluate(this.visProp.snapvalues)[C]-this._smin)/(this._smax-this._smin),this.update(!0)):(Z=c.Z.evaluate(this.visProp.snapwidth),c.Z.evaluate(Z)>0&&Math.abs(this._smax-this._smin)>=r.Z.eps&&(i=(v=Math.max(Math.min(v,1),0))*(this._smax-this._smin)+this._smin,v=((i=Math.round(i/Z)*Z)-this._smin)/(this._smax-this._smin),this.update(!0))),s=w.point1.coords,!c.Z.evaluate(w.visProp.straightfirst)&&Math.abs(s.usrCoords[0])>r.Z.eps&&v<0&&(b=s,x=!0,v=0),n=w.point2.coords,!c.Z.evaluate(w.visProp.straightlast)&&Math.abs(n.usrCoords[0])>r.Z.eps&&v>1&&(b=n,x=!0,v=1)}else if(w.type===l.Z.OBJECT_TYPE_TURTLE)this.updateConstraint(),b=(y=o.Z.projectPointToTurtle(this,w,this.board))[0],v=y[1];else if(w.elementClass===l.Z.OBJECT_CLASS_CURVE)if(w.type===l.Z.OBJECT_TYPE_ARC||w.type===l.Z.OBJECT_TYPE_SECTOR)b=o.Z.projectPointToCircle(this,w,this.board),u=o.Z.rad(w.radiuspoint,w.center,this),p=0,f=o.Z.rad(w.radiuspoint,w.center,w.anglepoint),v=u,("minor"===(Z=c.Z.evaluate(w.visProp.selection))&&f>Math.PI||"major"===Z&&f<Math.PI)&&(p=f,f=2*Math.PI),(u<p||u>f)&&(v=f,(u<p&&u>.5*p||u>f&&u>.5*f+Math.PI)&&(v=p),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),O=f-p,this.visProp.isgeonext&&(O=1),Math.abs(O)>r.Z.eps&&(v/=O);else if(this.updateConstraint(),w.transformations.length>0){for(E=!1,(y=w.getTransformationSource())[0]&&(E=y[0],S.push(w),S.push(y[1]));y[0]&&c.Z.exists(y[1]._transformationSource);)y=y[1].getTransformationSource(),S.push(y[1]);if(P=this.coords.usrCoords,E){for(t=0;t<S.length;t++)S[t].updateTransformMatrix(),m=r.Z.inverse(S[t].transformMat),P=r.Z.matVecMult(m,P);for(_=new h.Z(l.Z.COORDS_BY_USER,P,this.board).usrCoords,P=(g=o.Z.projectCoordsToCurve(_[1],_[2],this.position||0,S[S.length-1],this.board))[0].usrCoords,t=S.length-2;t>=0;t--)P=r.Z.matVecMult(S[t].transformMat,P);g[0]=new h.Z(l.Z.COORDS_BY_USER,P,this.board)}else w.updateTransformMatrix(),m=r.Z.inverse(w.transformMat),P=r.Z.matVecMult(m,P),_=new h.Z(l.Z.COORDS_BY_USER,P,this.board).usrCoords,g=o.Z.projectCoordsToCurve(_[1],_[2],this.position||0,w,this.board);b=g[0],v=g[1]}else b=(y=o.Z.projectPointToCurve(this,w,this.board))[0],v=y[1];else c.Z.isPoint(w)&&(b=o.Z.projectPointToPoint(this,w,this.board),v=this.position);this.coords.setCoordinates(l.Z.COORDS_BY_USER,b.usrCoords,x),this.position=v},findClosestSnapValue:function(t){var e,i,s,o,n=null;if(s=c.Z.evaluate(this.visProp.snapvalues),o=c.Z.evaluate(this.visProp.snapvaluedistance),c.Z.isArray(s)&&Math.abs(this._smax-this._smin)>=r.Z.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,d,u,p,f,_,g,m=this.slideObject,b=[],v=2*Math.PI;if(this.needsUpdateFromParent){if(m.elementClass===l.Z.OBJECT_CLASS_CIRCLE)i=m.Radius(),c.Z.evaluate(this.visProp.isgeonext)&&(v=1),n=[m.center.X()+i*Math.cos(this.position*v),m.center.Y()+i*Math.sin(this.position*v)];else if(m.elementClass===l.Z.OBJECT_CLASS_LINE)t=m.point1.coords.usrCoords,e=m.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.Z.eps?(s=Math.min(Math.abs(this.position),1-r.Z.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.Z.eps?(s=Math.max(this.position,r.Z.eps),s=(s=Math.min(s,2-r.Z.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(m.type===l.Z.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(l.Z.COORDS_BY_USER,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),this.updateConstraint(),n=o.Z.projectPointToTurtle(this,m,this.board)[0].usrCoords;else if(m.elementClass===l.Z.OBJECT_CLASS_CURVE){for(u=!1,(a=m.getTransformationSource())[0]&&(u=a[0],b.push(m),b.push(a[1]));a[0]&&c.Z.exists(a[1]._transformationSource);)a=a[1].getTransformationSource(),b.push(a[1]);if(u?this.coords.setCoordinates(l.Z.COORDS_BY_USER,[b[b.length-1].Z(this.position),b[b.length-1].X(this.position),b[b.length-1].Y(this.position)]):this.coords.setCoordinates(l.Z.COORDS_BY_USER,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),m.type===l.Z.OBJECT_TYPE_ARC||m.type===l.Z.OBJECT_TYPE_SECTOR)p=o.Z.rad([m.center.X()+1,m.center.Y()],m.center,m.radiuspoint),f=0,g=o.Z.rad(m.radiuspoint,m.center,m.anglepoint),("minor"===m.visProp.selection&&g>Math.PI||"major"===m.visProp.selection&&g<Math.PI)&&(f=g,g=2*Math.PI),v=g-f,c.Z.evaluate(this.visProp.isgeonext)&&(v=1),((_=this.position*v)<f||_>g)&&(((_=g)<f&&_>.5*f||_>g&&_>.5*g+Math.PI)&&(_=f),this.position=_,Math.abs(v)>r.Z.eps&&(this.position/=v)),i=m.Radius(),n=[m.center.X()+i*Math.cos(this.position*v+p),m.center.Y()+i*Math.sin(this.position*v+p)];else if(this.updateConstraint(),u)for(n=o.Z.projectPointToCurve(this,b[b.length-1],this.board)[0].usrCoords,d=b.length-2;d>=0;d--)n=new h.Z(l.Z.COORDS_BY_USER,r.Z.matVecMult(b[d].transformMat,n),this.board).usrCoords;else n=o.Z.projectPointToCurve(this,m,this.board)[0].usrCoords}else c.Z.isPoint(m)&&(n=o.Z.projectPointToPoint(this,m,this.board).usrCoords);this.coords.setCoordinates(l.Z.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.Z.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.Z.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,s,r,n,a,h,d,u=0,p=1/0,f=null,_=c.Z.evaluate(this.visProp.ignoredsnaptopoints),g=!1;if(r=this.board.objectsList.length,_&&(h=_.length),c.Z.evaluate(this.visProp.snaptopoints)||t){for(n=c.Z.evaluate(this.visProp.attractorunit),a=c.Z.evaluate(this.visProp.attractordistance),e=0;e<r;e++){if(i=this.board.objectsList[e],_){for(g=!1,d=0;d<h;d++)if(i===this.board.select(_[d])){g=!0;break}if(g)continue}c.Z.isPoint(i)&&i!==this&&i.visPropCalc.visible&&(s=o.Z.projectPointToPoint(this,i,this.board),(u="screen"===n?s.distance(l.Z.COORDS_BY_SCREEN,this.coords):s.distance(l.Z.COORDS_BY_USER,this.coords))<a&&u<p&&(p=u,f=s))}null!==f&&this.coords.setCoordinates(l.Z.COORDS_BY_USER,f.usrCoords)}return this},snapToPoints:function(t){return this.handleSnapToPoints(t)},handleAttractors:function(){var t,e,i,s,r=0,n=c.Z.evaluate(this.visProp.attractorunit),a=c.Z.evaluate(this.visProp.attractordistance),d=c.Z.evaluate(this.visProp.snatchdistance),u=c.Z.evaluate(this.visProp.attractors),p=u.length;if(0!==a){for(t=0;t<p;t++)if(e=this.board.select(u[t]),c.Z.exists(e)&&e!==this){if(c.Z.isPoint(e)?i=o.Z.projectPointToPoint(this,e,this.board):e.elementClass===l.Z.OBJECT_CLASS_LINE?(s=o.Z.projectCoordsToSegment(this.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),i=!c.Z.evaluate(e.visProp.straightfirst)&&s[1]<0?e.point1.coords:!c.Z.evaluate(e.visProp.straightlast)&&s[1]>1?e.point2.coords:new h.Z(l.Z.COORDS_BY_USER,s[0],this.board)):e.elementClass===l.Z.OBJECT_CLASS_CIRCLE?i=o.Z.projectPointToCircle(this,e,this.board):e.elementClass===l.Z.OBJECT_CLASS_CURVE?i=o.Z.projectPointToCurve(this,e,this.board)[0]:e.type===l.Z.OBJECT_TYPE_TURTLE?i=o.Z.projectPointToTurtle(this,e,this.board)[0]:e.type===l.Z.OBJECT_TYPE_POLYGON&&(i=new h.Z(l.Z.COORDS_BY_USER,o.Z.projectCoordsToPolygon(this.coords.usrCoords,e),this.board)),(r="screen"===n?i.distance(l.Z.COORDS_BY_SCREEN,this.coords):i.distance(l.Z.COORDS_BY_USER,this.coords))<a){this.type===l.Z.OBJECT_TYPE_GLIDER&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)||this.makeGlider(e);break}r>=d&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,s,o,n,d=this.coords;if(this.relativeCoords)return s=new h.Z(t,e,this.board),c.Z.evaluate(this.visProp.islabel)?(o=a.Z.subtract(s.scrCoords,d.scrCoords),this.relativeCoords.scrCoords[1]+=o[1],this.relativeCoords.scrCoords[2]+=o[2]):(o=a.Z.subtract(s.usrCoords,d.usrCoords),this.relativeCoords.usrCoords[1]+=o[1],this.relativeCoords.usrCoords[2]+=o[2]),this;for(this.coords.setCoordinates(t,e),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),i=this.transformations.length-1;i>=0;i--)t===l.Z.COORDS_BY_SCREEN?n=new h.Z(t,e,this.board).usrCoords:(2===e.length&&(e=[1].concat(e)),n=e),this.initialCoords.setCoordinates(l.Z.COORDS_BY_USER,r.Z.matVecMult(r.Z.inverse(this.transformations[i].matrix),n));return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===l.Z.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(t,e){var i;return e=new h.Z(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.Z.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.Z.OBJECT_TYPE_POLYGON){for(e=Number.MAX_VALUE,i=0;i<o.borders.length;i++)(r=s.Z.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.Z.exists(o))throw new Error("JSXGraph: slide object undefined.");if(o.type===l.Z.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.Z.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.Z.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===l.Z.OBJECT_CLASS_TEXT?this.elType="text":this.type===l.Z.OBJECT_TYPE_IMAGE?this.elType="image":this.type===l.Z.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.Z.OBJECT_TYPE_GLIDER){if(this.transformations.length=0,delete this.updateConstraint,this.isConstrained=!1,this.isDraggable)return;this.isDraggable=!0,this.elementClass===l.Z.OBJECT_CLASS_POINT&&(this.type=l.Z.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.Z.OBJECT_CLASS_POINT?(this.type=l.Z.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===l.Z.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===l.Z.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.Z.OBJECT_CLASS_POINT&&(this.type=l.Z.OBJECT_TYPE_CAS),this.isDraggable=!1,e=0;e<t.length;e++)i=t[e],c.Z.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.Z.isFunction(i)?s[e]=i:c.Z.isNumber(i)?s[e]=o(i):c.Z.isObject(i)&&c.Z.isFunction(i.Value)&&(s[e]=n(i)),s[e].origin=i;return 1===t.length?this.updateConstraint=function(){var t=s[0]();return c.Z.isArray(t)?this.coords.setCoordinates(l.Z.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.Z.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.Z.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.Z(l.Z.COORDS_BY_SCREEN,t.slice(0,2),this.board):new h.Z(l.Z.COORDS_BY_USER,t,this.board),this.element.addChild(this),e&&this.addParents(this.element),this.XEval=function(){var t,e,i;return c.Z.evaluate(this.visProp.islabel)?(i=c.Z.evaluate(this.visProp.offset),t=parseFloat(i[0]),e=this.element.getLabelAnchor(),new h.Z(l.Z.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 c.Z.evaluate(this.visProp.islabel)?(i=c.Z.evaluate(this.visProp.offset),t=-parseFloat(i[1]),e=this.element.getLabelAnchor(),new h.Z(l.Z.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.Z.createFunction(1,this.board,""),this.updateConstraint=function(){this.coords.setCoordinates(l.Z.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()])},this.isConstrained=!0,this.updateConstraint()},updateTransform:function(t){var e;if(0===this.transformations.length)return this;for(e=0;e<this.transformations.length;e++)this.transformations[e].update();return this},addTransform:function(t,e){var i,s=c.Z.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){var s=c.Z.evaluate(t),r=c.Z.evaluate(e),o=this;return i=c.Z.evaluate(i)||250,this.type!==l.Z.OBJECT_TYPE_GLIDER||c.Z.exists(this.intervalCode)||(this.intervalCode=window.setInterval((function(){o._anim(s,r)}),i),c.Z.exists(this.intervalCount)||(this.intervalCount=0)),this},stopAnimation:function(){return c.Z.exists(this.intervalCode)&&(window.clearInterval(this.intervalCode),delete this.intervalCode),this},moveAlong:function(t,e,i){i=i||{};var s,r,o,a,h,d=[],u=[],p=e/this.board.attr.animationdelay,f=function(e,i){return function(){return t[e][i]}};if(c.Z.isArray(t)){for(o=t.length,s=0;s<o;s++)c.Z.isPoint(t[s])?u[s]=t[s]:u[s]={elementClass:l.Z.OBJECT_CLASS_POINT,X:f(s,0),Y:f(s,1)};if(0===(e=e||0))return this.setPosition(l.Z.COORDS_BY_USER,[u[u.length-1].X(),u[u.length-1].Y()]),this.board.update(this);if(!c.Z.exists(i.interpolate)||i.interpolate)for(r=n.Z.Neville(u),s=0;s<p;s++)d[s]=[],d[s][0]=r[0]((p-s)/p*r[3]()),d[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)),d[s]=[],d[s][0]=(1-h)*u[a].X()+h*u[a+1].X(),d[s][1]=(1-h)*u[a].Y()+h*u[a+1].Y();d.push([u[o].X(),u[o].Y()]),d.reverse()}this.animationPath=d}else c.Z.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.Z(l.Z.COORDS_BY_USER,t,this.board);var s,o=this.board.attr.animationdelay,n=Math.ceil(e/o),a=[],d=this.coords.usrCoords[1],u=this.coords.usrCoords[2],p=t.usrCoords[1]-d,f=t.usrCoords[2]-u,_=function(t){return i.effect&&"<>"===i.effect?Math.pow(Math.sin(t/n*Math.PI/2),2):t/n};if(!c.Z.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>r.Z.eps)return this.setPosition(l.Z.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.Z.exists(i.callback)&&Math.abs(p)<r.Z.eps&&Math.abs(f)<r.Z.eps)return this;for(s=n;s>=0;s--)a[n-s]=[t.usrCoords[0],d+p*_(s),u+f*_(s)];return this.animationPath=a,this.animationCallback=i.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new h.Z(l.Z.COORDS_BY_USER,t,this.board);var s,r,o,n=this.board.attr.animationdelay,a=[],d=this.coords.usrCoords[1],u=this.coords.usrCoords[2],p=t.usrCoords[1]-d,f=t.usrCoords[2]-u,_=function(t){var e=t<o/2?2*t/o:2*(o-t)/o;return i.effect&&"<>"===i.effect?Math.pow(Math.sin(e*Math.PI/2),2):e};for(c.Z.isNumber(i)?i={repeat:i}:(i=i||{},c.Z.exists(i.repeat)||(i.repeat=1)),o=Math.ceil(e/(n*i.repeat)),r=0;r<i.repeat;r++)for(s=o;s>=0;s--)a[r*(o+1)+o-s]=[t.usrCoords[0],d+p*_(s),u+f*_(s)];return this.animationPath=a,this.animationCallback=i.callback,this.board.addAnimation(this),this},_anim:function(t,e){var i,s,r,n,a,h,c,d,u;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0),this.slideObject.elementClass===l.Z.OBJECT_CLASS_LINE?(c=this.slideObject.point1.coords.scrCoords,d=this.slideObject.point2.coords.scrCoords,i=Math.round((d[1]-c[1])*this.intervalCount/e),s=Math.round((d[2]-c[2])*this.intervalCount/e),t>0?n=this.slideObject.point1:(n=this.slideObject.point2,i*=-1,s*=-1),this.coords.setCoordinates(l.Z.COORDS_BY_SCREEN,[n.coords.scrCoords[1]+i,n.coords.scrCoords[2]+s])):this.slideObject.elementClass===l.Z.OBJECT_CLASS_CURVE?(a=t>0?Math.round(this.intervalCount/e*this.board.canvasWidth):Math.round((e-this.intervalCount)/e*this.board.canvasWidth),this.coords.setCoordinates(l.Z.COORDS_BY_SCREEN,[a,0]),u=o.Z.projectPointToCurve(this,this.slideObject,this.board),this.coords=u[0],this.position=u[1]):this.slideObject.elementClass===l.Z.OBJECT_CLASS_CIRCLE&&(r=2*Math.PI,r*=t<0?this.intervalCount/e:(e-this.intervalCount)/e,h=this.slideObject.Radius(),this.coords.setCoordinates(l.Z.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+h*Math.cos(r),this.slideObject.center.coords.usrCoords[2]+h*Math.sin(r)])),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.Z.OBJECT_TYPE_GLIDER&&(t=[this.X(),this.Y(),this.slideObject.id]),t}}),s.Z.CoordsElement.create=function(t,e,i,s,r,o){var n,a,h=!1;for(a=0;a<i.length;a++)(c.Z.isFunction(i[a])||c.Z.isString(i[a]))&&(h=!0);if(h)(n=new t(e,[0,0],s,r,o)).addConstraint(i);else if(c.Z.isNumber(i[0])&&c.Z.isNumber(i[1]))n=new t(e,i,s,r,o),c.Z.exists(s.slideobject)?n.makeGlider(s.slideobject):n.baseElement=n,n.isDraggable=!0;else{if(!c.Z.isObject(i[0])||!c.Z.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.Z=s.Z.CoordsElement},958:function(t,e,i){var s=i(765),r=i(351),o=i(705),n=i(275),a=i(309),h=i(766),l=i(88),c=i(327),d=i(109);s.Z.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.Z.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,arguments.length>0){for(n in this.board=t,this.type=i,this._org_type=i,this.elementClass=s||r.Z.OBJECT_CLASS_OTHER,this.id=e.id,o=e.name,d.Z.exists(o)||(o=this.board.generateName(this)),""!==o&&(this.board.elementsByName[o]=this),this.name=o,this.needsRegularUpdate=e.needsregularupdate,d.Z.clearVisPropOld(this),a=this.resolveShortcuts(e))a.hasOwnProperty(n)&&this._set(n,a[n]);this.visProp.draft=a.draft&&a.draft.draft}},s.Z.extend(s.Z.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=d.Z.isArray(t)?t:arguments).length,e=0;e<i;++e)d.Z.exists(s[e])&&(d.Z.isId(this.board,s[e])?this.parents.push(s[e]):d.Z.exists(s[e].id)&&this.parents.push(s[e].id));this.parents=d.Z.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&&!d.Z.evaluate(this.visProp.fixed)&&this.type!==r.Z.OBJECT_TYPE_GLIDER},setPosition:function(t,e){var i,s,o,n,a=[];if(!d.Z.exists(this.parents))return this;for(o=this.parents.length,s=0;s<o;++s)if(i=this.board.select(this.parents[s]),d.Z.isPoint(i)){if(!i.draggable())return this;a.push(i)}for(3===e.length&&(e=e.slice(1)),n=this.board.create("transform",e,{type:"translate"}),(o=a.length)>0?n.applyOnce(a):this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n),s=0;s<o;++s)a[s].type===r.Z.OBJECT_TYPE_GLIDER&&a[s].updateGlider();return this},setPositionDirectly:function(t,e,i){var s=new o.Z(t,e,this.board,!1),n=new o.Z(t,i,this.board,!1),h=a.Z.subtract(s.usrCoords,n.usrCoords);return this.setPosition(r.Z.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,d;for(s=c.Z.rgb2hsv(t),n=((r=c.Z.rgb2hsv(e))[0]-s[0])/a,l=(r[1]-s[1])/a,d=(r[2]-s[2])/a,h.animationData[i]=[],o=0;o<a;o++)h.animationData[i][a-o-1]=c.Z.hsv2rgb(s[0]+(o+1)*n,s[1]+(o+1)*l,s[2]+(o+1)*d)},u=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(!d.Z.isPoint(this))break;u(this.visProp[r],t[s],r,!0);break;case"strokeopacity":case"strokewidth":case"fillopacity":u(this.visProp[r],t[s],r,!1)}return this.animationCallback=i.callback,this.board.addAnimation(this),this},update:function(){return d.Z.evaluate(this.visProp.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],d.Z.isArray(o))for(r=o.length,e=0;e<r;e++)d.Z.exists(o[e])&&d.Z.exists(o[e].rendNode)&&"inherit"===d.Z.evaluate(o[e].visProp.visible)&&o[e].setDisplayRendNode(t);else d.Z.exists(o)&&d.Z.exists(o.rendNode)&&"inherit"===d.Z.evaluate(o.visProp.visible)&&o.setDisplayRendNode(t);return this.hasLabel&&d.Z.exists(this.label)&&d.Z.exists(this.label.rendNode)&&"inherit"===d.Z.evaluate(this.label.visProp.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){for(void 0!==t?this.visPropCalc.visible=t:(n=d.Z.evaluate(this.visProp.visible),d.Z.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],d.Z.isArray(o))for(r=o.length,e=0;e<r;e++)d.Z.exists(o[e])&&"inherit"===d.Z.evaluate(o[e].visProp.visible)&&o[e].prepareUpdate().updateVisibility(this.visPropCalc.visible);else d.Z.exists(o)&&"inherit"===d.Z.evaluate(o.visProp.visible)&&o.prepareUpdate().updateVisibility(this.visPropCalc.visible);d.Z.exists(this.label)&&d.Z.exists(this.label.visProp)&&d.Z.evaluate(this.label.visProp.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&&d.Z.isString(e)&&9===e.length&&"#"===e.charAt(0))e=c.Z.rgba2rgbo(e),this.visProp[t]=e[0],this.visProp[t.replace("color","opacity")]=e[1];else if(null===e||!d.Z.isObject(e)||d.Z.exists(e.id)||d.Z.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.Z.shortcuts)if(h.Z.shortcuts.hasOwnProperty(e)){if(d.Z.exists(t[e]))for(i=0;i<h.Z.shortcuts[e].length;i++)d.Z.exists(t[h.Z.shortcuts[e][i]])||(t[h.Z.shortcuts[e][i]]=t[e]);for(s=0;s<r.length;s++)d.Z.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 d.Z.exists(this.label)&&(t=t.replace(/</g,"<").replace(/>/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(/</g,"<").replace(/>/g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){s.Z.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(t){var e,i,o,n,a,h,l,u,p,f={};for(e=0;e<arguments.length;e++)h=arguments[e],d.Z.isString(h)?(u=h.split(":"),f[d.Z.trim(u[0])]=d.Z.trim(u[1])):d.Z.isArray(h)?f[h[0]]=h[1]:s.Z.extend(f,h);for(e in f=this.resolveShortcuts(f))if(f.hasOwnProperty(e)){if(n=e.replace(/\s+/g,"").toLowerCase(),a=f[e],d.Z.isObject(a)&&d.Z.exists(this.visProp[n])){if(this.visProp[n]=d.Z.merge(this.visProp[n],a),this.type===r.Z.OBJECT_TYPE_TICKS&&d.Z.exists(this.labels))for(o=this.labels.length,i=0;i<o;i++)this.labels[i].setAttribute(a);else if(d.Z.exists(this[n]))if(d.Z.isArray(this[n]))for(i=0;i<this[n].length;i++)this[n][i].setAttribute(a);else this[n].setAttribute(a);continue}switch(p=this.visProp[n],n){case"checked":d.Z.exists(this.rendNodeTag)&&(this.rendNodeCheckbox.checked=!!a);break;case"disabled":d.Z.exists(this.rendNodeTag)&&(this.rendNodeTag.disabled=!!a);break;case"face":d.Z.isPoint(this)&&(this.visProp.face=a,this.board.renderer.changePointStyle(this));break;case"generatelabelvalue":this.type===r.Z.OBJECT_TYPE_TICKS&&d.Z.isFunction(a)&&(this.generateLabelValue=a);break;case"gradient":this.visProp.gradient=a,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":a=c.Z.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":d.Z.isString(a)?this.infoboxText=a:this.infoboxText=!1;break;case"labelcolor":l=(a=c.Z.rgba2rgbo(a))[1],a=a[0],0===l&&d.Z.exists(this.label)&&this.hasLabel&&this.label.hideElement(),d.Z.exists(this.label)&&this.hasLabel&&(this.label.visProp.strokecolor=a,this.board.renderer.setObjectStrokeColor(this.label,a,l)),this.elementClass===r.Z.OBJECT_CLASS_TEXT&&(this.visProp.strokecolor=a,this.visProp.strokeopacity=l,this.board.renderer.setObjectStrokeColor(this,a,l));break;case"layer":this.board.renderer.setLayer(this,d.Z.evaluate(a)),this._set(n,a);break;case"maxlength":d.Z.exists(this.rendNodeTag)&&(this.rendNodeTag.maxlength=!!a);break;case"name":p=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.Z.OBJECT_TYPE_GLIDER&&(this.onPolygon=!!a);break;case"radius":this.type!==r.Z.OBJECT_TYPE_ANGLE&&this.type!==r.Z.OBJECT_TYPE_SECTOR||this.setRadius(a);break;case"rotate":(this.elementClass===r.Z.OBJECT_CLASS_TEXT&&"internal"===d.Z.evaluate(this.visProp.display)||this.type===r.Z.OBJECT_TYPE_IMAGE)&&this.addRotation(a);break;case"tabindex":d.Z.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(d.Z.evaluate(this.visProp.visible)),d.Z.evaluate(this.visProp.visible)&&d.Z.exists(this.updateSize)&&this.updateSize();break;case"withlabel":this.visProp.withlabel=a,d.Z.evaluate(a)?(this.label||this.createLabel(),this.label.setAttribute({visible:"inherit"})):this.label&&this.hasLabel&&this.label.setAttribute({visible:!1}),this.hasLabel=a;break;default:d.Z.exists(this.visProp[n])&&(!s.Z.Validator[n]||s.Z.Validator[n]&&s.Z.Validator[n](a)||s.Z.Validator[n]&&d.Z.isFunction(a)&&s.Z.Validator[n](a()))&&(a=(!a.toLowerCase||"false"!==a.toLowerCase())&&a,this._set(n,a))}this.triggerEventHandlers(["attribute:"+n],[p,a,this])}return this.triggerEventHandlers(["attribute"],[f,this]),d.Z.evaluate(this.visProp.needsregularupdate)?this.board.update(this):this.board.fullUpdate(),this.elementClass===r.Z.OBJECT_CLASS_TEXT&&this.updateSize(),this},getProperty:function(){s.Z.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},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.Z(r.Z.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new o.Z(r.Z.COORDS_BY_USER,[0,0],this.board)},setArrow:function(t,e){return this.visProp.firstarrow=t,this.visProp.lastarrow=e,e&&(this.type=r.Z.OBJECT_TYPE_VECTOR,this.elType="arrow"),this.prepareUpdate().update().updateVisibility().updateRenderer(),this},createGradient:function(){var t=d.Z.evaluate(this.visProp.gradient);"linear"!==t&&"radial"!==t||this.board.renderer.setGradient(this)},createLabel:function(){var t,e=this;return s.Z.elements.text?((t=d.Z.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.Z.elements.text(this.board,[0,0,function(){return d.Z.isFunction(e.name)?e.name():e.name}],t),this.label.needsUpdate=!0,this.label.dump=!1,this.label.fullUpdate(),this.hasLabel=!0)):s.Z.debug("JSXGraph: Can't create label: text element is not available. Make sure you include base/text"),this},highlight:function(t){return t=d.Z.def(t,!1),!d.Z.evaluate(this.visProp.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.Z.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)&&d.Z.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.Z.OBJECT_CLASS_TEXT&&this.type!==r.Z.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 d.Z.evaluate(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.Z.deprecated("highlightStrokeColor()","setAttribute()"),this.setAttribute({highlightStrokeColor:t}),this},strokeColor:function(t){return s.Z.deprecated("strokeColor()","setAttribute()"),this.setAttribute({strokeColor:t}),this},strokeWidth:function(t){return s.Z.deprecated("strokeWidth()","setAttribute()"),this.setAttribute({strokeWidth:t}),this},fillColor:function(t){return s.Z.deprecated("fillColor()","setAttribute()"),this.setAttribute({fillColor:t}),this},highlightFillColor:function(t){return s.Z.deprecated("highlightFillColor()","setAttribute()"),this.setAttribute({highlightFillColor:t}),this},labelColor:function(t){return s.Z.deprecated("labelColor()","setAttribute()"),this.setAttribute({labelColor:t}),this},dash:function(t){return s.Z.deprecated("dash()","setAttribute()"),this.setAttribute({dash:t}),this},visible:function(t){return s.Z.deprecated("visible()","setAttribute()"),this.setAttribute({visible:t}),this},shadow:function(t){return s.Z.deprecated("shadow()","setAttribute()"),this.setAttribute({shadow:t}),this},getType:function(){return this.elType},getParents:function(){return d.Z.isArray(this.parents)?this.parents:[]},snapToGrid:function(){return this},snapToPoints:function(){return this},getAttributes:function(){var t,e=d.Z.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&&d.Z.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(d.Z.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(d.Z.exists(this.defaultTicks)&&this.defaultTicks===t&&(this.defaultTicks=null),d.Z.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++)d.Z.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=d.Z.evaluate(this.visProp.snapsizex),e=d.Z.evaluate(this.visProp.snapsizey),t<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(t=(i=this.board.defaultAxes.x.defaultTicks).ticksDelta*(d.Z.evaluate(i.visProp.minorticks)+1)),e<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(e=(i=this.board.defaultAxes.y.defaultTicks).ticksDelta*(d.Z.evaluate(i.visProp.minorticks)+1)),[t,e]},handleSnapToGrid:function(t,e){var i,o,n,a,h,l,c,u,p,f,_,g=d.Z.evaluate(this.visProp.attracttogrid),m=d.Z.evaluate(this.visProp.attractorunit),b=d.Z.evaluate(this.visProp.attractordistance);return!d.Z.exists(this.coords)||d.Z.evaluate(this.visProp.fixed)||(d.Z.evaluate(this.visProp.snaptogrid)||g||!0===t)&&(i=this.coords.usrCoords[1],o=this.coords.usrCoords[2],f=(p=this.getSnapSizes())[0],_=p[1],f>0&&_>0&&(u=this.board.getBoundingBox(),n=Math.round(i/f)*f,a=Math.round(o/_)*_,h=new s.Z.Coords(r.Z.COORDS_BY_USER,[n,a],this.board),(!g||h.distance("screen"===m?r.Z.COORDS_BY_SCREEN:r.Z.COORDS_BY_USER,this.coords)<b)&&(i=n,o=a,e||(l=Math.min(u[0],u[2]),c=Math.max(u[0],u[2]),i<l&&i>l-f?i+=f:i>c&&i<c+f&&(i-=f),l=Math.min(u[1],u[3]),c=Math.max(u[1],u[3]),o<l&&o>l-_?o+=_:o>c&&o<c+_&&(o-=_)),this.coords.setCoordinates(r.Z.COORDS_BY_USER,[i,o])))),this},getBoundingBox:function(){var t,e,i,s,o,n=[1/0,1/0,-1/0,-1/0];if(this.type===r.Z.OBJECT_TYPE_POLYGON){if((e=this.vertices.length-1)<=0)return n;for(t=0;t<e;t++)i=this.vertices[t].X(),n[0]=i<n[0]?i:n[0],n[2]=i>n[2]?i:n[2],i=this.vertices[t].Y(),n[1]=i<n[1]?i:n[1],n[3]=i>n[3]?i:n[3]}else if(this.elementClass===r.Z.OBJECT_CLASS_CIRCLE)s=this.center.X(),o=this.center.Y(),n=[s-this.radius,o+this.radius,s+this.radius,o-this.radius];else if(this.elementClass===r.Z.OBJECT_CLASS_CURVE){if(0===(e=this.vertices.length))return n;for(t=0;t<e;t++)i=this.points[t].coords.usrCoords[1],n[0]=i<n[0]?i:n[0],n[2]=i>n[2]?i:n[2],i=this.points[t].coords.usrCoords[1],n[1]=i<n[1]?i:n[1],n[3]=i>n[3]?i:n[3]}return n},addEvent:s.Z.shortcut(s.Z.GeometryElement.prototype,"on"),removeEvent:s.Z.shortcut(s.Z.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(d.Z.exists(Intl)&&this.useLocale()){for(r in i=d.Z.evaluate(this.visProp.intl.locale)||d.Z.evaluate(this.board.attr.intl.locale),s=d.Z.evaluate(this.visProp.intl.options)||{})s.hasOwnProperty(r)&&(n.hasOwnProperty(r)?o[n[r]]=d.Z.evaluate(s[r]):o[r]=d.Z.evaluate(s[r]));return r="maximumfractiondigits",d.Z.exists(s[r])||(o[n[r]]=e),Intl.NumberFormat(i,o).format(t)}return t},useLocale:function(){var t;return!(!d.Z.exists(this.visProp.intl)||!d.Z.exists(this.visProp.intl.enabled))&&(!0===(t=d.Z.evaluate(this.visProp.intl.enabled))||"inherit"===t&&!0===d.Z.evaluate(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.Z=s.Z.GeometryElement},573:function(t,e,i){var s=i(765),r=i(351),o=i(958),n=i(632),a=i(503),h=i(109),l=i(275),c=i(218),d=function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()};s.Z.Text=function(t,e,i,s){var o;this.constructor(t,i,r.Z.OBJECT_TYPE_TEXT,r.Z.OBJECT_CLASS_TEXT),this.element=this.board.select(i.anchor),this.coordsConstructor(e,h.Z.evaluate(this.visProp.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.Z.isString(this.content)&&this.notifyParents(this.content),this.elType="text",this.methodMap=h.Z.deepCopy(this.methodMap,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"})},s.Z.Text.prototype=new o.Z,h.Z.copyPrototypeMethods(s.Z.Text,c.Z,"coordsConstructor"),s.Z.extend(s.Z.Text.prototype,{hasPoint:function(t,e){var i,s,r,o,n,a,c,d;return h.Z.isObject(h.Z.evaluate(this.visProp.precision))?(c=this.board._inputDevice,d=h.Z.evaluate(this.visProp.precision[c])):d=this.board.options.precision.hasPoint,this.transformations.length>0&&(t=(i=l.Z.matVecMult(l.Z.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"===h.Z.evaluate(this.visProp.dragarea)?t>=i-d&&t<s+d&&e>=r-d&&e<=o+d:e>=r-d&&e<=o+d&&(t>=i-d&&t<=i+2*d||t>=s-2*d&&t<=s+d)},_createFctUpdateText:function(t){var e,i,s,r,o,n,a=h.Z.evaluate(this.visProp.parse),l=h.Z.evaluate(this.visProp.usemathjax),c=h.Z.evaluate(this.visProp.usekatex),d=!1;if(this.orgText=t,h.Z.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.Z.isNumber(t)&&h.Z.evaluate(this.visProp.formatnumber)?h.Z.evaluate(this.visProp.tofraction)?this.content=l?"\\("+h.Z.toFraction(t,!0)+"\\)":h.Z.toFraction(t,c):(s=h.Z.evaluate(this.visProp.digits),this.useLocale()?this.content=this.formatNumberLocale(t,s):this.content=h.Z.toFixed(t,s)):h.Z.isString(t)&&a?(h.Z.evaluate(this.visProp.useasciimathml)?this.content="'`"+t+"`'":l||c?(this.content=this.valueTagToJessieCode(t),h.Z.isArray(this.content)||(this.content=this.content.replace(/\\/g,"\\\\"))):this.content=this.poorMansTeX(this.valueTagToJessieCode(t)),d=!0):this.content=t,d){if(h.Z.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=h.Z.evaluate(n.visProp.digits),s="";for(t=0;t<n.content.length;t++)h.Z.isFunction(n.content[t])?(e=n.content[t](),e=n.useLocale()?n.formatNumberLocale(e,i):h.Z.toFixed(e,i)):'"'===(e=n.content[t]).at(0)&&'"'===e.at(-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.Z.isFunction(t)?function(){return h.Z.sanitizeHTML(t())}:h.Z.isNumber(t)?t:h.Z.sanitizeHTML(t),this._setText(e)},setText:function(t){return this._setText(t)},updateSize:function(){var t,e,i,s=h.Z.evaluate(this.visProp.display);return a.Z.isBrowser&&"no"!==this.board.renderer.type?(i=this.rendNode,"html"===s||"vml"===this.board.renderer.type?h.Z.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(h.Z.evaluate(this.visProp.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.Z.isArray(t)&&t.length>1&&(e=t[1],t=t[0]),h.Z.evaluate(this.visProp.islabel)&&h.Z.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.Z.COORDS_BY_SCREEN,[s,o])):this.coords.setCoordinates(r.Z.COORDS_BY_USER,[t,e]),this.fullUpdate(),this},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateText(),"internal"===h.Z.evaluate(this.visProp.display)&&h.Z.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 h.Z.evaluate(this.visProp.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(/&arc;/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<sqrt\s*\/>/g,"√")).replace(/<value>/g,"<value>")).replace(/<\/value>/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.Z.geonext2JS(r,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")<0&&h.Z.isNumber(h.Z.bind(this.board.jc.snippet(s,!0,"",!1),this)())?l+="+("+s+").toFixed("+h.Z.evaluate(this.visProp.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(/&/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(/<value>/g,"<value>")).replace(/<\/value>/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(/&/g,"&");return o},poorMansTeX:function(t){var e,i;if(h.Z.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,"∠").replace(/<arc\s*\/*>/g,"∠").replace(/<sqrt\s*\/*>/g,"√").replace(/<sqrt\s*\/*>/g,"√"),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.Z.isString(t)&&(t=(t=(t=(t=t.replace(/(<|<)overline(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/overline(>|>)/g,"</span>")).replace(/(<|<)arrow(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/arrow(>|>)/g,"</span>")),t},convertSketchometry2CSS:function(t,e){var i='<span class="sketcho sketcho-inherit sketcho-',s='"></span>';return h.Z.isString(t)&&(e&&(i=this.escapeTicks(i),s=this.escapeTicks(s)),t=(t=t.replace(/(<|<)sketchofont(>|>)/g,i)).replace(/(<|<)\/sketchofont(>|>)/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(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>");do{null!==(i=(e=/<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/).exec(t))&&(n.Z.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 h.Z.evaluate(this.visProp.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=h.Z.evaluate(this.visProp.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=h.Z.evaluate(this.visProp.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){var r,o,n,a,h=0;for(a=this.board.options.precision.hasPoint,this.board.options.precision.hasPoint=.25*(i+s),r=0,n=this.board.objectsList.length;r<n;r++)(o=this.board.objectsList[r]).visPropCalc.visible&&"axis"!==o.elType&&"ticks"!==o.elType&&o!==this.board.infobox&&o!==this&&o.hasPoint(t,e)&&h++;return this.board.options.precision.hasPoint=a,h},setAutoPosition:function(){var t,e,i,s,r,o,n,a,l,c,d,u,p,f,_,g,m,b=this.size[0],v=this.size[1],Z={conflicts:1/0,angle:0,r:0},C=2*Math.PI/12;if(this===this.board.infobox||!this.visPropCalc.visible||!h.Z.evaluate(this.visProp.islabel)||!this.element)return this;if(d=h.Z.evaluate(this.visProp.offset),i=(r=this.element.getLabelAnchor()).scrCoords[1],s=r.scrCoords[2],f=d[0],_=d[1],0===(c=this.getNumberOfConflicts(i+f,s-_,b,v)))return this;for(u=h.Z.evaluate(this.visProp.autopositionmindistance),a=h.Z.evaluate(this.visProp.autopositionmaxdistance),l=.2*u,o=Math.atan2(_,f),Z.conflicts=c,Z.angle=o,Z.r=u;Z.conflicts>0&&u<=a;){for(p=1,n=o+C;p<12&&Z.conflicts>0&&(t=i+u*(g=Math.cos(n)),e=s-u*(m=Math.sin(n)),(c=this.getNumberOfConflicts(t,e,b,v))<Z.conflicts&&(Z.conflicts=c,Z.angle=n,Z.r=u),0!==Z.conflicts);p++)n+=C;u+=l}return u=Z.r,g=Math.cos(Z.angle),m=Math.sin(Z.angle),this.visProp.offset=[u*g,u*m],this.visProp.anchorx=g<-.2?"right":g>.2?"left":"middle",this}}),s.Z.createText=function(t,e,i){var r,o=h.Z.copyAttributes(i,t.options,"text"),n=e.slice(0,-1),a=e[e.length-1];if(o.anchor=o.parent||o.anchor,!(r=c.Z.create(s.Z.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.Z.registerElement("text",s.Z.createText),s.Z.createHTMLSlider=function(t,e,i){var r,o,n=h.Z.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.Z.createText(t,o,n)).type=h.Z.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.innerHTML=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.Z.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.Z.supportsVML()?a.Z.addEvent(r.rendNodeForm,"change",d,r):a.Z.addEvent(r.rendNodeForm,"input",d,r),r.Value=function(){return this._val},r},s.Z.registerElement("htmlslider",s.Z.createHTMLSlider),e.Z=s.Z.Text},765: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").innerHTML+="WARNING: "+t+"<br />")},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").innerHTML+=i+"<br/>")},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.Z=i},922:function(t,e,i){var s=i(765),r=i(351),o=i(705),n=i(275),a=i(336),h=i(109),l=i(421);n.Z.Geometry={},s.Z.extend(n.Z.Geometry,{angle:function(t,e,i){var r,o,n,a,h=[],l=[],c=[];return s.Z.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,l,c,d,u=t.coords.usrCoords,p=e.coords.usrCoords,f=i.coords.usrCoords;return h.Z.exists(s)||(s=t.board),0===p[0]?new o.Z(r.Z.COORDS_BY_USER,[1,.5*(u[1]+f[1]),.5*(u[2]+f[2])],s):(c=u[1]-p[1],d=u[2]-p[2],n=Math.atan2(d,c),c=f[1]-p[1],d=f[2]-p[2],l=.5*(n+(a=Math.atan2(d,c))),n>a&&(l+=Math.PI),c=Math.cos(l)+p[1],d=Math.sin(l)+p[2],new o.Z(r.Z.COORDS_BY_USER,[1,c,d],s))},reflection:function(t,e,i){var s,n,a,l,c,d,u=e.coords.usrCoords,p=t.point1.coords.usrCoords,f=t.point2.coords.usrCoords;return h.Z.exists(i)||(i=e.board),l=f[1]-p[1],c=f[2]-p[2],s=u[1]-p[1],d=(l*(u[2]-p[2])-c*s)/(l*l+c*c),n=u[1]+2*d*c,a=u[2]-2*d*l,new o.Z(r.Z.COORDS_BY_USER,[n,a],i)},rotation:function(t,e,i,s){var n,a,l,c,d,u,p=e.coords.usrCoords,f=t.coords.usrCoords;return h.Z.exists(s)||(s=e.board),n=p[1]-f[1],a=p[2]-f[2],d=n*(l=Math.cos(i))-a*(c=Math.sin(i))+f[1],u=n*c+a*l+f[2],new o.Z(r.Z.COORDS_BY_USER,[d,u],s)},perpendicular:function(t,e,i){var s,a,l,c,d,u=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=e.coords.usrCoords;return h.Z.exists(i)||(i=e.board),e===t.point1?(s=u[1]+p[2]-u[2],a=u[2]-p[1]+u[1],d=u[0]*p[0],Math.abs(d)<n.Z.eps&&(s=p[2],a=-p[1]),c=[d,s,a],l=!0):e===t.point2?(s=p[1]+u[2]-p[2],a=p[2]-u[1]+p[1],d=u[0]*p[0],Math.abs(d)<n.Z.eps&&(s=u[2],a=-u[1]),c=[d,s,a],l=!1):Math.abs(n.Z.innerProduct(f,t.stdform,3))<n.Z.eps?(s=f[1]+p[2]-f[2],a=f[2]-p[1]+f[1],d=p[0],Math.abs(d)<n.Z.eps&&(s=p[2],a=-p[1]),l=!0,Math.abs(d)>n.Z.eps&&Math.abs(s-f[1])<n.Z.eps&&Math.abs(a-f[2])<n.Z.eps&&(s=f[1]+u[2]-f[2],a=f[2]-u[1]+f[1],l=!1),c=[d,s,a]):(c=[0,t.stdform[1],t.stdform[2]],c=n.Z.crossProduct(c,f),c=n.Z.crossProduct(c,t.stdform),l=!0),[new o.Z(r.Z.COORDS_BY_USER,c,i),l]},circumcenterMidpoint:function(){s.Z.deprecated("Geometry.circumcenterMidpoint()","Geometry.circumcenter()"),this.circumcenter.apply(this,arguments)},circumcenter:function(t,e,i,s){var a,l,c,d,u=t.coords.usrCoords,p=e.coords.usrCoords,f=i.coords.usrCoords;return h.Z.exists(s)||(s=t.board),a=[p[0]-u[0],-p[2]+u[2],p[1]-u[1]],l=[.5*(u[0]+p[0]),.5*(u[1]+p[1]),.5*(u[2]+p[2])],c=n.Z.crossProduct(a,l),a=[f[0]-p[0],-f[2]+p[2],f[1]-p[1]],l=[.5*(p[0]+f[0]),.5*(p[1]+f[1]),.5*(p[2]+f[2])],d=n.Z.crossProduct(a,l),new o.Z(r.Z.COORDS_BY_USER,n.Z.crossProduct(c,d),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.Z.eps&&(Math.abs(t[0])<n.Z.eps||Math.abs(e[0])<n.Z.eps)?1/0:s},affineRatio:function(t,e,i){var s;return h.Z.exists(t.usrCoords)&&(t=t.usrCoords),h.Z.exists(e.usrCoords)&&(e=e.usrCoords),h.Z.exists(i.usrCoords)&&(i=i.usrCoords),s=e[1]-t[1],Math.abs(s)>n.Z.eps?(i[1]-t[1])/s:(i[2]-t[2])/(e[2]-t[2])},sortVertices:function(t){for(var e,i=l.Z.each(t,l.Z.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=l.Z.coordsArray(t),r=l.Z.coordsArray(e),o=l.Z.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=l.Z.each(t,l.Z.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=1,s=l.Z.each(t,l.Z.coordsArray),r=s.length;for(r=(s=this.sortVertices(s)).length,e=2;e<r;e++){for(;this.signedTriangle(s[i-1],s[i],s[e])<=0;){if(i>1)i-=1;else if(e===r-1)break;e+=1}i+=1,s=h.Z.swap(s,i,e)}return s.slice(0,i)},calcStraight:function(t,e,i,s){var o,a,l,c,d,u,p,f,_,g;if(h.Z.exists(s)||(s=10),u=h.Z.evaluate(t.visProp.straightfirst),p=h.Z.evaluate(t.visProp.straightlast),Math.abs(e.scrCoords[0])<n.Z.eps&&(u=!0),Math.abs(i.scrCoords[0])<n.Z.eps&&(p=!0),(u||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=!u&&Math.abs(e.usrCoords[0])>=n.Z.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.Z.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,c=(l=this.meetLineBoard(f,t.board,s))[0],d=l[1],!o&&!a){if(!u&&p&&!this.isSameDirection(e,i,c)&&!this.isSameDirection(e,i,d))return;if(u&&!p&&!this.isSameDirection(i,e,c)&&!this.isSameDirection(i,e,d))return}o?a||(g=this.isSameDir(e,i,c,d)?d:c):a?_=this.isSameDir(e,i,c,d)?c:d:this.isSameDir(e,i,c,d)?(_=c,g=d):(g=c,_=d),_&&e.setCoordinates(r.Z.COORDS_BY_USER,_.usrCoords),g&&i.setCoordinates(r.Z.COORDS_BY_USER,g.usrCoords)}},calcLineDelimitingPoints:function(t,e,i){var s,o,a,l,c,d,u,p,f,_,g;if(c=h.Z.evaluate(t.visProp.straightfirst),d=h.Z.evaluate(t.visProp.straightlast),Math.abs(e.scrCoords[0])<n.Z.eps&&(c=!0),Math.abs(i.scrCoords[0])<n.Z.eps&&(d=!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(_=!c,g=!d,o=t.board.getBoundingBox(),t.getSlope()>=0?(a=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[1]]}},t,t.board),l=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),l=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[3]]}},t,t.board)),!_&&!g){if(!c&&!d){if(s=e.distance(r.Z.COORDS_BY_USER,i),Math.abs(e.distance(r.Z.COORDS_BY_USER,a)+a.distance(r.Z.COORDS_BY_USER,i)-s)>n.Z.eps)return;if(Math.abs(e.distance(r.Z.COORDS_BY_USER,l)+l.distance(r.Z.COORDS_BY_USER,i)-s)>n.Z.eps)return}if(!c&&d&&!this.isSameDirection(e,i,a)&&!this.isSameDirection(e,i,l))return;if(c&&!d&&!this.isSameDirection(i,e,a)&&!this.isSameDirection(i,e,l))return}_?g||(f=this.isSameDir(e,i,a,l)?l:a):g?p=this.isSameDir(e,i,a,l)?a:l:this.isSameDir(e,i,a,l)?(p=a,f=l):(f=a,p=l),p&&e.setCoordinates(r.Z.COORDS_BY_USER,p.usrCoords),f&&i.setCoordinates(r.Z.COORDS_BY_USER,f.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.Z.eps&&(r=e.usrCoords[1],o=e.usrCoords[2]),Math.abs(t.usrCoords[0])<n.Z.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.Z.eps&&(s=0),Math.abs(r)<n.Z.eps&&(r=0),Math.abs(o)<n.Z.eps&&(o=0),Math.abs(a)<n.Z.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){return(t[1]-i[1])*(e[2]-i[2])-(e[1]-i[1])*(t[2]-i[2])},windingNumber:function(t,e,i){var s,r,o,a,l,c,d=0,u=e.length,p=t[1],f=t[2],_=0;if(0===u)return 0;if((i=i||!1)&&(_=1),isNaN(p)||isNaN(f))return 1;if(h.Z.exists(e[0].coords)?(s=e[0].coords,r=e[u-1].coords):(s=e[0],r=e[u-1]),s.usrCoords[1]===p&&s.usrCoords[2]===f)return 1;for(c=0;c<u-_;c++)if(h.Z.exists(e[c].coords)?(r=e[c].coords.usrCoords,o=e[(c+1)%u].coords.usrCoords):(r=e[c].usrCoords,o=e[(c+1)%u].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(l=2*(o[2]>r[2]?1:0)-1,r[1]>=p)if(o[1]>p)d+=l;else{if(0===(a=this.det3p(r,o,t)))return 0;a>0+n.Z.eps==o[2]>r[2]&&(d+=l)}else o[1]>p&&(a=this.det3p(r,o,t))>0+n.Z.eps==o[2]>r[2]&&(d+=l)}return d},pnpoly:function(t,e,i,s){var n,a,l,c,d,u,p,f,_=i,g=!1;for(s===r.Z.COORDS_BY_USER?(u=(f=new o.Z(r.Z.COORDS_BY_USER,[t,e],this.board)).scrCoords[1],p=f.scrCoords[2]):(u=t,p=e),n=0,a=(d=i.length)-2;n<d-1;a=n++)l=h.Z.exists(_[n].coords)?_[n].coords:_[n],c=h.Z.exists(_[a].coords)?_[a].coords:_[a],l.scrCoords[2]>p!=c.scrCoords[2]>p&&u<(c.scrCoords[1]-l.scrCoords[1])*(p-l.scrCoords[2])/(c.scrCoords[2]-l.scrCoords[2])+l.scrCoords[1]&&(g=!g);return g},intersectionFunction:function(t,e,i,a,l,c){var d,u,p=this;return d=e.elementClass===r.Z.OBJECT_CLASS_CURVE&&(e.type===r.Z.OBJECT_TYPE_ARC||e.type===r.Z.OBJECT_TYPE_SECTOR),u=i.elementClass===r.Z.OBJECT_CLASS_CURVE&&(i.type===r.Z.OBJECT_TYPE_ARC||i.type===r.Z.OBJECT_TYPE_SECTOR),e.elementClass!==r.Z.OBJECT_CLASS_CURVE&&i.elementClass!==r.Z.OBJECT_CLASS_CURVE||e.elementClass!==r.Z.OBJECT_CLASS_CURVE&&e.elementClass!==r.Z.OBJECT_CLASS_CIRCLE||i.elementClass!==r.Z.OBJECT_CLASS_CURVE&&i.elementClass!==r.Z.OBJECT_CLASS_CIRCLE?e.elementClass===r.Z.OBJECT_CLASS_CURVE&&!d&&i.elementClass===r.Z.OBJECT_CLASS_LINE||i.elementClass===r.Z.OBJECT_CLASS_CURVE&&!u&&e.elementClass===r.Z.OBJECT_CLASS_LINE?function(){return p.meetCurveLine(e,i,a,e.board,h.Z.evaluate(c))}:e.type===r.Z.OBJECT_TYPE_POLYGON||i.type===r.Z.OBJECT_TYPE_POLYGON?e.elementClass===r.Z.OBJECT_CLASS_LINE?function(){var t,s=h.Z.evaluate(e.visProp.straightfirst),r=h.Z.evaluate(e.visProp.straightlast),o=h.Z.evaluate(i.visProp.straightfirst),n=h.Z.evaluate(i.visProp.straightlast);return t=!(h.Z.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(i,e,a,e.board,t)}:i.elementClass===r.Z.OBJECT_CLASS_LINE?function(){var t,s=h.Z.evaluate(e.visProp.straightfirst),r=h.Z.evaluate(e.visProp.straightlast),o=h.Z.evaluate(i.visProp.straightfirst),n=h.Z.evaluate(i.visProp.straightlast);return t=!(h.Z.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.Z.OBJECT_CLASS_LINE&&i.elementClass===r.Z.OBJECT_CLASS_LINE?function(){var t,s,n=h.Z.evaluate(e.visProp.straightfirst),l=h.Z.evaluate(e.visProp.straightlast),d=h.Z.evaluate(i.visProp.straightfirst),u=h.Z.evaluate(i.visProp.straightlast);return h.Z.evaluate(c)||n&&l&&d&&u?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||!l&&t[1]>1||!d&&t[2]<0||!u&&t[2]>1?[0,NaN,NaN]:t[0],new o.Z(r.Z.COORDS_BY_USER,s,e.board))}:function(){var t,l,f,_=p.meet(e.stdform,i.stdform,a,e.board),g=!0;return h.Z.evaluate(c)?_:(e.elementClass!==r.Z.OBJECT_CLASS_LINE||(t=h.Z.evaluate(e.visProp.straightfirst),l=h.Z.evaluate(e.visProp.straightlast),t&&l||(f=p.affineRatio(e.point1.coords,e.point2.coords,_),!(!l&&f>1+n.Z.eps||!t&&f<0-n.Z.eps))))&&(i.elementClass!==r.Z.OBJECT_CLASS_LINE||(t=h.Z.evaluate(i.visProp.straightfirst),l=h.Z.evaluate(i.visProp.straightlast),t&&l||(f=p.affineRatio(i.point1.coords,i.point2.coords,_),!(!l&&f>1+n.Z.eps||!t&&f<0-n.Z.eps))))?d&&((g=p.coordsOnArc(e,_))&&u&&(g=p.coordsOnArc(i,_)),!g)?new o.Z(s.Z.COORDS_BY_USER,[0,NaN,NaN],e.board):_:new o.Z(s.Z.COORDS_BY_USER,[0,NaN,NaN],e.board)}:function(){return p.meetCurveCurve(e,i,a,l,e.board)}},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=h.Z.evaluate(t.visProp.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.Z.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,l,c,d=[];for(h.Z.exists(i)||(i=0),d[0]=n.Z.crossProduct(t,[i,0,1]),d[1]=n.Z.crossProduct(t,[i,1,0]),d[2]=n.Z.crossProduct(t,[-i-e.canvasHeight,0,1]),d[3]=n.Z.crossProduct(t,[-i-e.canvasWidth,1,0]),l=0;l<4;l++)if(Math.abs(d[l][0])>n.Z.eps){for(c=2;c>0;c--)d[l][c]/=d[l][0];d[l][0]=1}return Math.abs(d[1][0])<n.Z.eps?(s=d[0],a=d[2]):Math.abs(d[0][0])<n.Z.eps?(s=d[1],a=d[3]):d[1][2]<0?(s=d[0],a=d[3][2]>e.canvasHeight?d[2]:d[3]):d[1][2]>e.canvasHeight?(s=d[2],a=d[3][2]<0?d[0]:d[3]):(s=d[1],a=d[3][2]<0?d[0]:d[3][2]>e.canvasHeight?d[2]:d[3]),[new o.Z(r.Z.COORDS_BY_SCREEN,s.slice(1),e),new o.Z(r.Z.COORDS_BY_SCREEN,a.slice(1),e)]},meetLineLine:function(t,e,i,s){var a=isNaN(t[5]+e[5])?[0,0,0]:n.Z.crossProduct(t,e);return Math.abs(a[0])<1e-14&&(a[0]=0),new o.Z(r.Z.COORDS_BY_USER,a,s)},meetLineCircle:function(t,e,i,s){var a,l,c,d,u,p,f,_,g;return e[4]<n.Z.eps?Math.abs(n.Z.innerProduct([1,e[6],e[7]],t,3))<n.Z.eps?new o.Z(r.Z.COORDS_BY_USER,e.slice(6,8),s):new o.Z(r.Z.COORDS_BY_USER,[NaN,NaN],s):(c=e[0],l=e.slice(1,3),a=e[3],d=t[0],u=t.slice(1,3),p=a,(_=(f=l[0]*u[1]-l[1]*u[0])*f-4*p*(a*d*d-(l[0]*u[0]+l[1]*u[1])*d+c))>-n.Z.eps*n.Z.eps?(g=[(-f+(_=Math.sqrt(Math.abs(_))))/(2*p),(-f-_)/(2*p)],0===h.Z.evaluate(i)?new o.Z(r.Z.COORDS_BY_USER,[-g[0]*-u[1]-d*u[0],-g[0]*u[0]-d*u[1]],s):new o.Z(r.Z.COORDS_BY_USER,[-g[1]*-u[1]-d*u[0],-g[1]*u[0]-d*u[1]],s)):new o.Z(r.Z.COORDS_BY_USER,[0,0,0],s))},meetCircleCircle:function(t,e,i,s){var a;return t[4]<n.Z.eps?Math.abs(this.distance(t.slice(6,2),e.slice(6,8))-e[4])<n.Z.eps?new o.Z(r.Z.COORDS_BY_USER,t.slice(6,8),s):new o.Z(r.Z.COORDS_BY_USER,[0,0,0],s):e[4]<n.Z.eps?Math.abs(this.distance(e.slice(6,2),t.slice(6,8))-t[4])<n.Z.eps?new o.Z(r.Z.COORDS_BY_USER,e.slice(6,8),s):new o.Z(r.Z.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.Z.normalize(a),this.meetLineCircle(a,t,i,s))},meetCurveCurve:function(t,e,i,s,n,l){var c;return c=h.Z.exists(l)&&"newton"===l?a.Z.generalizedNewton(t,e,h.Z.evaluate(i),s):3===t.bezierDegree||3===e.bezierDegree?this.meetBezierCurveRedBlueSegments(t,e,i):this.meetCurveRedBlueSegments(t,e,i),new o.Z(r.Z.COORDS_BY_USER,c,n)},meetCurveLine:function(t,e,i,s,o){var n,a;return h.Z.exists(s)||(s=t.board),t.elementClass===r.Z.OBJECT_CLASS_CURVE?(n=t,a=e):(n=e,a=t),this.meetCurveLineDiscrete(n,a,i,s,!o)},meetCurveLineContinuous:function(t,e,i,s,h){var l,c,d,u,p,f,_,g,m,b,v,Z,C,y=n.Z.eps,P=n.Z.eps;for(u=this.meetCurveLineDiscrete(t,e,i,s,h),p=u.usrCoords[1],f=u.usrCoords[2],c=function(e){var i,s;return e>t.maxX()||e<t.minX()?1/0:(i=p-t.X(e))*i+(s=f-t.Y(e))*s},d=function(i){var s=e.stdform[0]+e.stdform[1]*t.X(i)+e.stdform[2]*t.Y(i);return s*s},50,g=(t.maxX()-t.minX())/50,m=t.minX(),Z=1e-4,v=NaN,b=0;b<50&&(l=a.Z.root(c,[Math.max(m,t.minX()),Math.min(m+g,t.maxX())]),!((C=Math.abs(c(l)))<=Z&&(v=l,(Z=C)<y)));b++)m+=g;return l=v,C=d(l=a.Z.root(d,[Math.max(l-g,t.minX()),Math.min(l+g,t.maxX())])),_=isNaN(C)||Math.abs(C)>P?0:1,new o.Z(r.Z.COORDS_BY_USER,[_,t.X(l),t.Y(l)],s)},meetCurveLineDiscrete:function(t,e,i,s,a){var l,c,d,u,p,f,_,g=h.Z.evaluate(i),m=e.point1.coords.usrCoords,b=e.point2.coords.usrCoords,v=0,Z=t.numberPoints,C=h.Z.evaluate(e.visProp.straightfirst),y=h.Z.evaluate(e.visProp.straightlast);for(f=new o.Z(r.Z.COORDS_BY_USER,[0,NaN,NaN],s),0===m[0]?m=[1,b[1]+e.stdform[2],b[2]-e.stdform[1]]:0===b[0]&&(b=[1,m[1]+e.stdform[2],m[2]-e.stdform[1]]),u=t.points[0].usrCoords,l=1;l<Z;l+=t.bezierDegree)if(d=u.slice(0),u=t.points[l].usrCoords,this.distance(d,u)>n.Z.eps)for(_=3===t.bezierDegree?this.meetBeziersegmentBeziersegment([t.points[l-1].usrCoords.slice(1),t.points[l].usrCoords.slice(1),t.points[l+1].usrCoords.slice(1),t.points[l+2].usrCoords.slice(1)],[m.slice(1),b.slice(1)],a):[this.meetSegmentSegment(d,u,m,b)],c=0;c<_.length;c++)if(0<=(p=_[c])[1]&&p[1]<=1){if(v===g)return a&&(!C&&p[2]<0||!y&&p[2]>1)?f:f=new o.Z(r.Z.COORDS_BY_USER,p[0],s);v+=1}return f},meetCurveRedBlueSegments:function(t,e,i){var s,r,o,n,a,l,c,d,u,p=h.Z.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,d=Math.min(o[1],n[1]),u=Math.max(o[1],n[1]),l=e.points[0].usrCoords,r=1;r<_;r++)if(a=l,l=e.points[r].usrCoords,Math.min(a[1],l[1])<u&&Math.max(a[1],l[1])>d&&(c=this.meetSegmentSegment(o,n,a,l))[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.Z.crossProduct(t,e),l=n.Z.crossProduct(i,s),c=n.Z.crossProduct(h,l);return Math.abs(c[0])<n.Z.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.Z.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.Z.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 l,c,d,u,p=h.Z.evaluate(i);return(d=(l=s.Z.Math.Clip._getPath(t,a)).length)>0&&this.distance(l[0].coords.usrCoords,l[d-1].coords.usrCoords,3)<n.Z.eps&&l.pop(),(d=(c=s.Z.Math.Clip._getPath(e,a)).length)>0&&this.distance(c[0].coords.usrCoords,c[d-1].coords.usrCoords,3)<n.Z.eps*n.Z.eps&&c.pop(),i<0||s.Z.Math.Clip.isEmptyCase(l,c,"intersection")?new o.Z(r.Z.COORDS_BY_USER,[0,0,0],a):(s.Z.Math.Clip.makeDoublyLinkedList(l),s.Z.Math.Clip.makeDoublyLinkedList(c),p<(u=s.Z.Math.Clip.findIntersections(l,c,a)[0]).length?u[p].coords:new o.Z(r.Z.COORDS_BY_USER,[0,0,0],a))},meetPolygonLine:function(t,e,i,s,n){var a,l,c,d=h.Z.evaluate(i),u=[0,0,0],p=t.borders.length,f=[];for(a=0;a<p;a++)c=t.borders[a],l=this.meetSegmentSegment(c.point1.coords.usrCoords,c.point2.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),(!n||l[2]>=0&&l[2]<1)&&l[1]>=0&&l[1]<1&&f.push(l[0]);return d>=0&&d<f.length&&(u=f[d]),new o.Z(r.Z.COORDS_BY_USER,u,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=h.Z.exists(s),n=0,a=e.length,l=t.length;for(l>0&&a>0&&(1===t[l-1][1]&&0===e[0][1]||o&&1===t[l-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,d,u,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]),d=[1].concat(e[0]),u=[1].concat(e[3]),(c=this.meetSegmentSegment(p,f,d,u))[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,d,u,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):(u=[1].concat(t[0]),p=[1].concat(t[3]),c=[1].concat(e[0]),d=[1].concat(e[1]),(l=this.meetSegmentSegment(u,p,c,d))[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,l,c,d,u,p,f,_,g,m,b,v=h.Z.evaluate(i),Z=0,C=0,y=[];if(e.numberPoints<e.bezierDegree+1||t.numberPoints<t.bezierDegree+1)return[0,NaN,NaN];for(1===t.bezierDegree&&3===e.bezierDegree&&(d=t,t=e,e=d),m=e.numberPoints-e.bezierDegree,b=t.numberPoints-t.bezierDegree,t.type===r.Z.OBJECT_TYPE_SECTOR&&(Z=3,b-=3),e.type===r.Z.OBJECT_TYPE_SECTOR&&(C=3,m-=3),o=Z;o<b;o+=t.bezierDegree)for(u=[(s=t.points)[o].usrCoords.slice(1),s[o+1].usrCoords.slice(1)],3===t.bezierDegree&&(u[2]=s[o+2].usrCoords.slice(1),u[3]=s[o+3].usrCoords.slice(1)),f=this._bezierBbox(u),a=C;a<m;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(u,p)).length)continue;for(l=0;l<g.length;l++)(c=g[l])[1]<-n.Z.eps||c[1]>1+n.Z.eps||c[2]<-n.Z.eps||c[2]>1+n.Z.eps||y.push(c);if(y.length>v)return y[v][0]}return y.length>v?y[v][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,l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P=.5*Math.PI,E=e[1],O=e[2],x=e[0],w=[],S=[];for(c=this.distance(e,t),E/=x,O/=x,d=this.rad(t.slice(1),e.slice(1),i.slice(1)),-1===r&&(d=2*Math.PI-d),(o=t)[1]/=o[0],o[2]/=o[0],o[0]/=o[0],l=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.Z.eps;)d>P?(u=P,d-=P):(u=d,d=0),y=[[1,0,0],[E*(1-(p=Math.cos(r*u)))+O*(f=Math.sin(r*u)),p,-f],[O*(1-p)-E*f,f,p]],l=[(Z=n.Z.matVecMult(y,o))[0]/Z[0],Z[1]/Z[0],Z[2]/Z[0]],_=o[1]-E,g=o[2]-O,m=l[1]-E,b=l[2]-O,C=n.Z.hypot(_+m,g+b),v=Math.abs(b-g)>n.Z.eps?(_+m)*(c/C-.5)/(b-g)*8/3:(g+b)*(c/C-.5)/(_-m)*8/3,a=[1,o[1]-v*g,o[2]+v*_],h=[1,l[1]+v*b,l[2]-v*m],w=w.concat([a[1],h[1],l[1]]),S=S.concat([a[2],h[2],l[2]]),o=l.slice(0);return s&&(w=w.concat([l[1]+.333*(E-l[1]),l[1]+.666*(E-l[1]),E]),S=S.concat([l[2]+.333*(O-l[2]),l[2]+.666*(O-l[2]),O])),[w,S]},projectPointToCircle:function(t,e,i){var s,a,l,c,d,u=e.center.coords.usrCoords;return h.Z.exists(i)||(i=t.board),h.Z.isPoint(t)?(s=t.coords.distance(r.Z.COORDS_BY_USER,e.center.coords),a=t.coords.usrCoords):(s=t.distance(r.Z.COORDS_BY_USER,e.center.coords),a=t.usrCoords),Math.abs(s)<n.Z.eps&&(s=n.Z.eps),d=e.Radius()/s,l=u[1]+d*(a[1]-u[1]),c=u[2]+d*(a[2]-u[2]),new o.Z(r.Z.COORDS_BY_USER,[l,c],i)},projectPointToLine:function(t,e,i){var s,a=[0,e.stdform[1],e.stdform[2]];return h.Z.exists(i)||(i=h.Z.exists(t.coords)?t.board:e.board),s=h.Z.exists(t.coords)?t.coords.usrCoords:t.usrCoords,a=n.Z.crossProduct(a,s),new o.Z(r.Z.COORDS_BY_USER,n.Z.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.Z.eps&&Math.abs(r[1])<n.Z.eps?[e,0]:(s=n.Z.innerProduct(o,r),[[1,(s/=n.Z.innerProduct(r,r))*r[0]+e[1],s*r[1]+e[2]],s])},projectCoordsToBeziersegment:function(t,e,i){var r;return r=s.Z.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){h.Z.exists(i)||(i=t.board);var s=t.X(),r=t.Y(),o=t.position||0;return this.projectCoordsToCurve(s,r,o,e,i)},projectCoordsToCurve:function(t,e,i,s,n){var l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N=Number.POSITIVE_INFINITY;if(h.Z.exists(n)||(n=s.board),"plot"===h.Z.evaluate(s.visProp.curvetype)){if(i=0,p=N,l=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?u=0:v=[s.Z(0),s.X(0),s.Y(0)],d=0;d<s.numberPoints-1;d++)3===s.bezierDegree?C=this.projectCoordsToBeziersegment(g,s,u):(Z=[s.Z(d+1),s.X(d+1),s.Y(d+1)],C=this.projectCoordsToSegment(g,v,Z)),_=C[1],m=C[0],0<=_&&_<=1?(f=this.distance(m,g),b=d+_):_<0?(m=v,f=this.distance(v,g),b=d):_>1&&d===s.numberPoints-2&&(m=Z,f=this.distance(m,g),b=s.numberPoints-1),f<p&&(p=f,i=b,l=m),3===s.bezierDegree?(u++,d+=2):v=Z;c=new o.Z(r.Z.COORDS_BY_USER,l,n)}else{for(y=function(i){var r,o;return i<s.minX()||i>s.maxX()?1/0:(r=t-s.X(i))*r+(o=e-s.Y(i))*o},O=y(i),50,M=s.minX(),x=((T=s.maxX())-M)/50,P=M,d=0;d<50;d++)((E=y(P))<O||O===1/0||isNaN(O))&&(i=P,O=E),P+=x;for(w=x,d=0;d<20&&isNaN(y(i-w));d++,w*=.5);for(isNaN(y(i-w))&&(w=0),S=x,d=0;d<20&&isNaN(y(i+S));d++,S*=.5);isNaN(y(i+S))&&(S=0),i=(i=(i=a.Z.fminbr(y,[Math.max(i-w,M),Math.min(i+S,T)]))<M?M:i)>T?T:i,c=new o.Z(r.Z.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.Z.Math.Geometry.projectCoordsToSegment(t,e.vertices[i].coords.usrCoords,e.vertices[i+1].coords.usrCoords))[1]&&o[1]<=1?(r=s.Z.Math.Geometry.distance(o[0],t,3),n=o[0]):o[1]<0?(r=s.Z.Math.Geometry.distance(e.vertices[i].coords.usrCoords,t,3),n=e.vertices[i].coords.usrCoords):(r=s.Z.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,l,c,d,u,p,f,_,g=0,m=0,b=Number.POSITIVE_INFINITY,v=e.objects.length;for(h.Z.exists(i)||(i=t.board),c=0;c<v;c++)(u=e.objects[c]).elementClass===r.Z.OBJECT_CLASS_CURVE&&(s=(f=this.projectPointToCurve(t,u))[0],_=f[1],(d=this.distance(s.usrCoords,t.coords.usrCoords))<b&&(a=s.usrCoords[1],l=s.usrCoords[2],n=_,b=d,p=u,m=g),g+=u.numberPoints);return s=new o.Z(r.Z.COORDS_BY_USER,[a,l],i),[p.updateTransform(s),n+m]},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.Z.crossProduct([1,l[r[3]],l[r[4]]],[1,l[r[5]],l[r[6]]]))[3]=0,s=n.Z.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.Z.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.Z.eps*n.Z.eps,d=1e6;return s=(s=t[1]-e[1])===1/0?d:s===-1/0?-d:s,r=(r=t[2]-e[2])===1/0?d:r===-1/0?-d:r,(h=(o=(o=i[1]-e[1])===1/0?d:o===-1/0?-d:o)*o+(a=(a=i[2]-e[2])===1/0?d:a===-1/0?-d:a)*a)>c&&((l=(s*o+r*a)/h)<0?l=0:l>1&&(l=1),s-=l*o,r-=l*a),n.Z.hypot(s,r)},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,d){var u=(c%s+s)%s,p=Math.floor(u/r)%e;return d||(a=t[0].Dist(t[o]),i=n.Z.Geometry.rad([t[0].X()+1,t[0].Y()],t[0],t[o%e])),isNaN(p)?p:(u=.5*u+p*r*.5+i,t[p][h]()+a*Math[l](u))}};return[h("X","cos"),h("Y","sin"),0,s]},meet3Planes:function(t,e,i,s,r,o){var a,h,l,c,d,u=[0,0,0];for(a=n.Z.crossProduct(r,t),h=n.Z.crossProduct(t,i),l=n.Z.crossProduct(i,r),c=n.Z.innerProduct(t,l,3),d=0;d<3;d++)u[d]=(e*l[d]+s*a[d]+o*h[d])/c;return u},meetPlanePlane:function(t,e,i,s){var r,o,a,l=[0,0,0],c=[0,0,0];for(r=0;r<3;r++)l[r]=h.Z.evaluate(t[r]),c[r]=h.Z.evaluate(e[r]);for(o=n.Z.crossProduct(l,c),r=0;r<3;r++)l[r]=h.Z.evaluate(i[r]),c[r]=h.Z.evaluate(s[r]);return a=n.Z.crossProduct(l,c),n.Z.crossProduct(o,a)},project3DTo3DPlane:function(t,e,i){var s,r;return i=i||[0,0,0],s=n.Z.norm(e),r=(n.Z.innerProduct(t,e,3)-n.Z.innerProduct(i,e,3))/s,n.Z.axpy(-r,e,t)},getPlaneBounds:function(t,e,i,s,r){var o,n,h,l,c;return t[2]+e[0]!==0?(h=[[t[0],e[0]],[t[1],e[1]]],l=[s-i[0],s-i[1]],o=(c=a.Z.Gauss(h,l))[0],n=c[1],l=[r-i[0],r-i[1]],[o,(c=a.Z.Gauss(h,l))[0],n,c[1]]):null}}),e.Z=n.Z.Geometry},785:function(t,e,i){var s=i(765),r=i(275),o=i(109);s.Z.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,!0,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.Z.extend(s.Z.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.Z.Math.DoubleBits,a=function(t,e){if(void 0!==t&&void 0!==e){if(r.Z.IntervalArithmetic.isInterval(t)){if(!r.Z.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.Z.IntervalArithmetic.isInterval(e)){if(!r.Z.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.Z.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.Z.IntervalArithmetic.prev(t),r.Z.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.Z.IntervalArithmetic.next(t),r.Z.IntervalArithmetic.prev(e))},halfOpenLeft:function(t,e){return this.assign(r.Z.IntervalArithmetic.next(t),e)},halfOpenRight:function(t,e){return this.assign(t,r.Z.IntervalArithmetic.prev(e))},toArray:function(){return[this.lo,this.hi]},clone:function(){return(new a).set(this.lo,this.hi)}}),s.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.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.Z.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==(1&e)?new a(-s,-i):new a(i,s)):t.lo<0?1==(1&e)?new a(-this.powLo(-t.lo,e),this.powHi(t.hi,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)):(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.Z.isNumber(t)&&(t=this.Interval(t)),this.nthRoot(t,2)},nthRoot:function(t,e){var i,s,r,n,h;if(o.Z.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==(1&e)?(s=this.powHi(-t.lo,i),r=this.powLo(-t.hi,i),new a(-s,-r)):this.EMPTY.clone():t.lo<0?(n=this.powHi(t.hi,i),e%1==0&&1==(1&e)?(h=-this.powHi(-t.lo,i),new a(h,n)):new a(0,n)):new a(this.powLo(t.lo,i),this.powHi(t.hi,i))},exp:function(t){return o.Z.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.Z.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.Z.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.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<e.lo},gt:function(t,e){return o.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.lo>e.hi},leq:function(t,e){return o.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<=e.lo},geq:function(t,e){return o.Z.isNumber(t)&&(t=this.Interval(t)),o.Z.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.Z.acot(t))},acotHi:function(t){return this.next(r.Z.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.Z.sinh(t))},sinhHi:function(t){return this.next(r.Z.sinh(t))},coshLo:function(t){return this.prev(r.Z.cosh(t))},coshHi:function(t){return this.next(r.Z.cosh(t))},tanhLo:function(t){return this.prev(r.Z.tanh(t))},tanhHi:function(t){return this.next(r.Z.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==(1&e)?t:1,e>>=1;e>0;)t=this.mulLo(t,t),1==(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==(1&e)?t:1,e>>=1;e>0;)t=this.mulHi(t,t),1==(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.Z.Math.IntervalArithmetic.PI=new a(r.Z.IntervalArithmetic.piLow,r.Z.IntervalArithmetic.piHigh),s.Z.Math.IntervalArithmetic.PI_HALF=new a(r.Z.IntervalArithmetic.piHalfLow,r.Z.IntervalArithmetic.piHalfHigh),s.Z.Math.IntervalArithmetic.PI_TWICE=new a(r.Z.IntervalArithmetic.piTwiceLow,r.Z.IntervalArithmetic.piTwiceHigh),s.Z.Math.IntervalArithmetic.ZERO=new a(0),s.Z.Math.IntervalArithmetic.ONE=new a(1),s.Z.Math.IntervalArithmetic.WHOLE=(new a).setWhole(),s.Z.Math.IntervalArithmetic.EMPTY=(new a).setEmpty(),e.Z=s.Z.Math.IntervalArithmetic},275:function(t,e,i){var s,r=i(765),o=i(109),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.Z.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},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(s=0,r=0;r<n;r++)s+=t[i][r]*e[r];a[i]=s}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},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,r,o,n,a,h=t.length,l=[],c=[],d=[];for(e=0;e<h;e++){for(l[e]=[],i=0;i<h;i++)l[e][i]=t[e][i];c[e]=e}for(i=0;i<h;i++){for(o=Math.abs(l[i][i]),n=i,e=i+1;e<h;e++)Math.abs(l[e][i])>o&&(o=Math.abs(l[e][i]),n=e);if(o<=this.eps)return[];if(n>i){for(s=0;s<h;s++)a=l[i][s],l[i][s]=l[n][s],l[n][s]=a;a=c[i],c[i]=c[n],c[n]=a}for(r=1/l[i][i],e=0;e<h;e++)l[e][i]*=r;for(l[i][i]=r,s=0;s<h;s++)if(s!==i){for(e=0;e<h;e++)e!==i&&(l[e][s]-=l[e][i]*l[i][s]);l[i][s]=-r*l[i][s]}}for(e=0;e<h;e++){for(s=0;s<h;s++)d[c[s]]=l[e][s];for(s=0;s<h;s++)l[e][s]=d[s]}return l},innerProduct:function(t,e,i){var r,n=0;for(i!==s&&o.Z.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.Z.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.Z.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.Z.isNumber(t)||!o.Z.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.Z.isNumber(t)&&o.Z.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.Z.exists(e)&&!o.Z.exists(i)&&!o.Z.exists(s))return h;if(r.Z.exists(s)&&(h=Math.min(h,s)),r.Z.exists(i)&&(h=Math.max(h,i)),a=i||0,r.Z.exists(e)){if(n=(h-a)/e,Number.isInteger(n))return h;h=a+(n=Math.round(n))*e}return r.Z.exists(s)&&(h=Math.min(h,s)),r.Z.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},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,d,u=0;for(e=o.Z.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,d=0,l=c=1;t-Math.floor(t)>e&&u<20;)t=1/(t-r),n=h+(r=Math.floor(t))*a,l=d+r*c,h=a,d=c,a=n,c=l,u++;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.Z=r.Z.Math},336:function(t,e,i){var s=i(765),r=i(109),o=i(503),n=i(275),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.Z.Numerics={Gauss:function(t,e){var i,s,o,a,h,l=n.Z.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.Z.swap(a,i,s),r.Z.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,d=n.Z.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)<d){for(r=e+1;r<h&&!(Math.abs(l[r][e])>=d);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,d=n.Z.eps*n.Z.eps,u=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],u+=Math.abs(_[e][i]);f[e][e]=1}if(1===p)return[_,f];if(u<=0)return[_,f];u/=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>=d){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)/u>d&&g<2e3);return[_,f]},NewtonCotes:function(t,e,i){var s,o,n,a=0,h=i&&r.Z.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",d=(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+=d);a*=d;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*d);for(s=t[0]-d,o=0;o<n;o++)a+=4*e(s+=2*d);a*=d/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*d);for(s=t[0]-3*d,o=0;o<n;o++)a+=32*(e(s+=4*d)+e(s+2*d));for(s=t[0]-2*d,o=0;o<n;o++)a+=12*e(s+=4*d);a*=2*d/45}return a},Romberg:function(t,e,i){var s,o,n,a,h,l,c,d,u=[],p=0,f=1/0,_=i&&r.Z.isNumber(i.max_iterations)?i.max_iterations:20,g=i&&r.Z.isNumber(i.eps)?i.eps:i.eps||1e-7;for(s=t[0],n=(o=t[1])-s,h=1,u[0]=.5*n*(e(s)+e(o)),l=0;l<_;++l){for(a=0,n*=.5,h*=2,d=1,c=1;c<h;c+=2)a+=e(s+c*n);for(u[l+1]=.5*u[l]+a*n,p=u[l+1],c=l-1;c>=0;--c)d*=4,u[c]=u[c+1]+(u[c+1]-u[c])/(d-1),p=u[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,d,u=0,p=[],f=[],_=i&&r.Z.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[_],d=f[_],l=.5*(o-s),h=.5*(o+s),!0&_)for(u=d[0]*e(h),n=1;n<a;++n)u+=d[n]*(e(h+l*c[n])+e(h-l*c[n]));else for(u=0,n=0;n<a;++n)u+=d[n]*(e(h+l*c[n])+e(h-l*c[n]));return l*u},_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,d,u,p,f,_,g,m,b=t[0],v=t[1],Z=.5*(b+v),C=.5*(v-b),y=Math.abs(C),P=e(Z),E=0,O=P*o[i-1],x=Math.abs(O),w=0,S=[],M=[];for(i%2==0&&(E=P*r[i/2-1]),a=Math.floor((i-1)/2),d=0;d<a;d++)g=(f=e(Z-(p=C*s[u=2*d+1])))+(_=e(Z+p)),S[u]=f,M[u]=_,E+=r[d]*g,O+=o[u]*g,x+=o[u]*(Math.abs(f)+Math.abs(_));for(a=Math.floor(i/2),d=0;d<a;d++)f=e(Z-(p=C*s[m=2*d])),_=e(Z+p),S[m]=f,M[m]=_,O+=o[m]*(f+_),x+=o[m]*(Math.abs(f)+Math.abs(_));for(l=.5*O,w=o[i-1]*Math.abs(P-l),d=0;d<i-1;d++)w+=o[d]*(Math.abs(S[d]-l)+Math.abs(M[d]-l));return c=(O-E)*C,x*=y,w*=y,h=O*=C,n.abserr=this._rescale_error(c,x,w),n.resabs=x,n.resasc=w,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,d,u,p,f,_,g,m,b,v,Z,C,y,P,E=this._workspace(t,1e3),O=i&&r.Z.isNumber(i.limit)?i.limit:15,x=i&&r.Z.isNumber(i.epsrel)?i.epsrel:1e-7,w=i&&r.Z.isNumber(i.epsabs)?i.epsabs:1e-7,S=i&&r.Z.isFunction(i.q)?i.q:this.GaussKronrod15,M={},T=0,N=0,A=0,D=0,k=0,L=0,R=0,B=0,I=0,Y=0;if(O>E.limit&&s.Z.warn("iteration limit exceeds available workspace"),w<=0&&(x<50*n.Z.eps||x<5e-29)&&s.Z.warn("tolerance cannot be acheived with given epsabs and epsrel"),h=S.apply(this,[t,e,M]),l=M.abserr,c=M.resabs,d=M.resasc,E.set_initial_result(h,l),u=Math.max(w,x*Math.abs(h)),l<=11102230246251565e-30*c&&l>u)return h,s.Z.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(l<=u&&l!==d||0===l)return h;if(1===O)return h,s.Z.warn("a maximum of one iteration was insufficient"),-1/0;o=h,a=l,T=1;do{k=0,L=0,R=0,B=0,I=0,Y=0,m=(y=E.retrieve()).a,b=y.b,v=y.r,Z=y.e,p=m,_=f=.5*(m+b),g=b,k=S.apply(this,[[p,f],e,M]),B=M.abserr,C=M.resasc,L=S.apply(this,[[_,g],e,M]),a+=(Y=B+(I=M.abserr))-Z,o+=(R=k+L)-v,C!==B&&M.resasc!==I&&(P=v-R,Math.abs(P)<=1e-5*Math.abs(R)&&Y>=.99*Z&&N++,T>=10&&Y>Z&&A++),a>(u=Math.max(w,x*Math.abs(o)))&&((N>=6||A>=20)&&(D=2),E.subinterval_too_small(p,_,g)&&(D=3)),E.update(p,f,k,B,_,g,L,I),m=(y=E.retrieve()).a_i,b=y.b_i,v=y.r_i,Z=y.e_i,T++}while(T<O&&!D&&a>u);return E.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.Z.eps,h=t.apply(i,[e]);for(r.Z.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,d,u,p,f,_,g,m,b,v=0;for(this.generalizedNewton.t1memo?(r=this.generalizedNewton.t1memo,o=this.generalizedNewton.t2memo):(r=i,o=s),f=(u=t.X(r)-e.X(o))*u+(p=t.Y(r)-e.Y(o))*p,_=this.D(t.X,t),g=this.D(e.X,e),m=this.D(t.Y,t),b=this.D(e.Y,e);f>n.Z.eps&&v<10;)a=_(r),h=-g(o),l=m(r),r-=((c=-b(o))*u-h*p)/(d=a*c-h*l),o-=(a*p-l*u)/d,f=(u=t.X(r)-e.X(o))*u+(p=t.Y(r)-e.Y(o))*p,v+=1;return this.generalizedNewton.t1memo=r,this.generalizedNewton.t2memo=o,Math.abs(r)<Math.abs(o)?[t.X(r),t.Y(r)]:[e.X(o),e.Y(o)]},Neville:function(t){var e=[],i=function(i){return function(s,r){var o,a,h,l=n.Z.binomial,c=t.length,d=c-1,u=0,p=0;if(!r)for(h=1,o=0;o<c;o++)e[o]=l(d,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,u+=t[o][i]()*h,p+=h}return u/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=[],d=[];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(d[o-3]=a[o-3]/n[o-3],s=o-4;s>=0;s--)d[s]=(a[s]-l[s+1]*d[s+1])/n[s];for(s=o-3;s>=0;s--)d[s+1]=d[s];return d[0]=0,d[o-1]=0,d},splineEval:function(t,e,i,s){var o,n,a,h,l,c,d,u=Math.min(e.length,i.length),p=1,f=!1,_=[];for(r.Z.isArray(t)?(p=t.length,f=!0):t=[t],o=0;o<p;o++){if(t[o]<e[0]||e[o]>e[u-1])return NaN;for(n=1;n<u&&!(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])),d=t[o]-e[n],_.push(a+(h+(l+c*d)*d)*d)}return f?_:_[0]},generatePolynomialTerm:function(t,e,i,s){var r,o=[];for(r=e;r>=0;r--)o=o.concat(["(",t[r].toPrecision(s),")"]),r>1?o=o.concat(["*",i,"<sup>",r,"<","/sup> + "]):1===r&&(o=o.concat(["*",i," + "]));return o.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,d,u,p=t.length,f=!0;for(i=i||"x",void 0===r&&(r=" * "),l=p-1,h=a.lagrangePolynomialCoefficients(t)(),c="",d=0;d<h.length;d++)u=h[d],Math.abs(u)<n.Z.eps||(s.Z.exists(e)&&(u=o.Z._round10(u,-e)),f?(c+=u>0?u:"-"+-u,f=!1):c+=u>0?" + "+u:" - "+-u,l-d>1?c+=r+i+"^"+(l-d):l-d==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.Z.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.Z.isFunction(e)?e:function(){return e},void 0===i&&(i="uniform"),o=function(e){return function(r,o){var d,u,p,f,_,g,m,b,v,Z;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.Z.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.Z.hypot(e,i)}},Z=(s=[p].concat(t,[f])).length,l[e]=[],d=0;d<Z-3;d++)"centripetal"===i?(m=s[d].Dist(s[d+1]),b=s[d+2].Dist(s[d+1]),v=s[d+3].Dist(s[d+2]),m=Math.sqrt(m),b=Math.sqrt(b),v=Math.sqrt(v),b<n.Z.eps&&(b=1),m<n.Z.eps&&(m=b),v<n.Z.eps&&(v=b),_=(s[d+1][e]()-s[d][e]())/m-(s[d+2][e]()-s[d][e]())/(b+m)+(s[d+2][e]()-s[d+1][e]())/b,g=(s[d+2][e]()-s[d+1][e]())/b-(s[d+3][e]()-s[d+1][e]())/(v+b)+(s[d+3][e]()-s[d+2][e]())/v,_*=b,g*=b,l[e][d]=c._initCubicPoly(s[d+1][e](),s[d+2][e](),a*_,a*g)):l[e][d]=c._initCubicPoly(s[d+1][e](),s[d+2][e](),a*(s[d+2][e]()-s[d][e]()),a*(s[d+3][e]()-s[d+1][e]()));return isNaN(r)?NaN:(Z=t.length,r<=0?t[0][e]():r>=Z?t[Z-1][e]():(d=Math.floor(r))===r?t[d][e]():(r-=d,void 0===(u=l[e][d])?NaN:((u[3]*r+u[2])*r+u[1])*r+u[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,d="";if(r.Z.isPoint(t)&&r.Z.isFunction(t.Value))o=function(){return t.Value()};else if(r.Z.isFunction(t))o=t;else{if(!r.Z.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.Z.isArray(e)&&r.Z.isArray(i))l=0;else if(2===arguments.length&&r.Z.isArray(e)&&e.length>0&&r.Z.isPoint(e[0]))l=1;else{if(!(2===arguments.length&&r.Z.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 u,p,f,_,g,m,b,v,Z,C=e.length;if(Z=Math.floor(o()),!c){if(1===l)for(a=[],h=[],u=0;u<C;u++)a[u]=e[u].X(),h[u]=e[u].Y();if(2===l)for(a=[],h=[],u=0;u<C;u++)a[u]=e[u].usrCoords[1],h[u]=e[u].usrCoords[2];if(0===l)for(a=[],h=[],u=0;u<C;u++)r.Z.isFunction(e[u])?a.push(e[u]()):a.push(e[u]),r.Z.isFunction(i[u])?h.push(i[u]()):h.push(i[u]);for(f=[],p=0;p<C;p++)f.push([1]);for(u=1;u<=Z;u++)for(p=0;p<C;p++)f[p][u]=f[p][u-1]*a[p];g=h,_=n.Z.transpose(f),m=n.Z.matMatMult(_,f),b=n.Z.matVecMult(_,g),s=n.Z.Numerics.Gauss(m,b),d=n.Z.Numerics.generatePolynomialTerm(s,Z,"x",3)}for(v=s[Z],u=Z-1;u>=0;u--)v=v*t+s[u];return v}).getTerm=function(){return d},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,d=c-1,u=e;if(d<=0)return NaN;if(d+2<=u&&(u=d+1),r<=0)return t[0][s]();if(r>=d-u+2)return t[d][s]();for(h=Math.floor(r)+u-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}(d,u),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,u,h),n=0,a=h-u+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.Z.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,d,u,p,f,_,g,m,b,v,Z=[],C=[],y=s,P=0;if(r.Z.isArray(t)?(v=t[0],b=t[1]):b=t,(e=Math.floor(e))<=0)return[Z,C,P];for(a=(o-s)/e,n=0;n<e;n++){if("simpson"===i){for(P+=this._riemannValue(y,b,i,a)*a,g=.5*a,u=b(y),p=b(y+g),l=((f=b(y+2*g))+u-2*p)/(g*g)*.5,c=(f-u)/(2*g),d=p,h=0;h<30;h++)_=h*a/30-g,Z.push(y+_+g),C.push(l*_*_+c*_+d);y+=a,m=f}else m=this._riemannValue(y,b,i,a),Z.push(y),C.push(m),y+=a,"trapezoidal"===i?(P+=.5*(m+(f=b(y)))*a,m=f):P+=m*a,Z.push(y),C.push(m);Z.push(y),C.push(m)}for(n=0;n<e;n++){if("simpson"===i&&v){for(P-=this._riemannValue(y,v,i,-a)*a,g=.5*a,u=v(y),p=v(y-g),l=((f=v(y-2*g))+u-2*p)/(g*g)*.5,c=(f-u)/(2*g),d=p,h=0;h<30;h++)_=h*a/30-g,Z.push(y-_-g),C.push(l*_*_+c*_+d);y-=a,m=f}else m=v?this._riemannValue(y,v,i,-a):0,Z.push(y),C.push(m),y-=a,v&&("trapezoidal"===i?(P-=.5*(m+(f=v(y)))*a,m=f):P-=m*a);Z.push(y),C.push(m),Z.push(y),C.push(b(y))}return[Z,C,P]},riemannsum:function(t,e,i,r,o){return s.Z.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,d,u,p=[],f=[],_=(i[1]-i[0])/s,g=i[0],m=e.length,b=[],v=0;for(r.Z.isString(t)&&(t=a[t]||a.euler),u=t.s,p=e.slice(),h=0;h<=s;h++){for(b[v]=p.slice(),v++,c=[],l=0;l<u;l++){for(n=0;n<m;n++)f[n]=0;for(d=0;d<l;d++)for(n=0;n<m;n++)f[n]+=t.A[l][d]*_*c[d][n];for(n=0;n<m;n++)f[n]+=p[n];c.push(o(g+t.c[l]*_,f))}for(n=0;n<m;n++)f[n]=0;for(d=0;d<u;d++)for(n=0;n<m;n++)f[n]+=t.b[d]*c[d][n];for(n=0;n<m;n++)p[n]=p[n]+_*f[n];g+=_}return b},maxIterationsRoot:80,maxIterationsMinimize:500,findBracket:function(t,e,i){var s,o,n,a,h,l,c,d,u,p;if(r.Z.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,u=0;u<p&&(h=a[u],!(n*(l=t.call(i,h))<=0));u++);return h<s&&(c=s,s=h,h=c,d=n,n=l,l=d),[s,n,h,l]},fzero:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,_,g,m,b,v,Z=n.Z.eps,C=this.maxIterationsRoot,y=0;if(r.Z.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],h=t.call(i,s),o=e[1],l=t.call(i,o)}else s=(d=this.findBracket(t,e,i))[0],h=d[1],o=d[2],l=d[3];if(Math.abs(h)<=Z)return s;if(Math.abs(l)<=Z)return o;if(h*l>0)return r.Z.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);for(a=s,c=h;y<C;){if(u=o-s,Math.abs(c)<Math.abs(l)&&(s=o,o=a,a=s,h=l,l=c,c=h),g=2*Z*Math.abs(o)+.5*Z,v=.5*(a-o),Math.abs(v)<=g||Math.abs(l)<=Z)return o;Math.abs(u)>=g&&Math.abs(h)>Math.abs(l)&&(_=a-o,s===a?(m=_*(p=l/h),b=1-p):(m=(f=l/h)*(_*(b=h/c)*(b-(p=l/c))-(o-s)*(p-1)),b=(b-1)*(p-1)*(f-1)),m>0?b=-b:m=-m,m<.75*_*b-.5*Math.abs(g*b)&&m<Math.abs(u*b*.5)&&(v=m/b)),Math.abs(v)<g&&(v=v>0?g:-g),s=o,h=l,o+=v,((l=t.call(i,o))>0&&c>0||l<0&&c<0)&&(a=s,c=h),y++}return o},chandrupatla:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O=0,x=this.maxIterationsRoot,w=1+.001*Math.random(),S=.5*w,M=n.Z.eps;if(r.Z.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.Z.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);c=s,d=o,f=a,_=h;do{if(p=c+S*(d-c),m=t.call(i,p),Math.sign(m)===Math.sign(f)?(u=c,c=p,g=f,f=m):(u=d,d=c,g=_,_=f),b=c=p,v=f=m,Math.abs(_)<Math.abs(f)&&(b=d,v=_),(Z=(2*M*Math.abs(b)+5e-6)/Math.abs(d-c))>.5||0===v)break;C=(c-d)/(u-d),y=(f-_)/(g-_),P=1-Math.sqrt(1-C),E=Math.sqrt(C),(S=P<y&&y<E?f/(_-f)*(g/(_-g))+f/(g-f)*(_/(g-_))*((u-c)/(d-c)):.5*w)<Z&&(S=Z),S>1-Z&&(S=1-Z),O++}while(O<=x);return b},fminbr:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C=.5*(3-Math.sqrt(5)),y=n.Z.eps,P=n.Z.eps,E=this.maxIterationsMinimize,O=0;if(!r.Z.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=e[0])+C*((o=e[1])-s),l=h,c=d=t.call(i,h),u=d;O<E;){if(p=o-s,f=.5*(s+o),_=P*Math.abs(a)+y/3,Math.abs(a-f)+.5*p<=2*_)return a;g=C*(a<f?o-a:s-a),Math.abs(a-l)>=_&&(m=(a-h)*(b=(a-h)*(c-u))-(a-l)*(v=(a-l)*(c-d)),(b=2*(b-v))>0?m=-m:b=-b,Math.abs(m)<Math.abs(g*b)&&m>b*(s-a+2*_)&&m<b*(o-a-2*_)&&(g=m/b)),Math.abs(g)<_&&(g=g>0?_:-_),v=a+g,(Z=t.call(i,v))<=c?(v<a?o=a:s=a,h=l,l=a,a=v,d=u,u=c,c=Z):(v<a?s=v:o=v,Z<=u||l===a?(h=l,l=v,d=u,u=Z):(Z<=d||h===a||h===l)&&(h=v,d=Z)),O+=1}return a},glomin:function(t,e){var i,s,r,o,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N=1e7,A=n.Z.eps,D=n.Z.eps*n.Z.eps,k=n.Z.eps*n.Z.eps*n.Z.eps;if(w=e[0],S=e[1],M=t(w)<t(S)?w:S,T=i=S,s=w,P=v=t(S),v<(b=C=t(w))?b=v:T=w,S<=w)return b;for(d=.5*(1+16*k)*N,c=3,o=s-(m=M<=w||S<=M?.5*(w+S):M),l=9/11,(Z=t(m))<b&&(T=m,b=Z);;){if(h=m-i,x=S-s,u=_=(a=s-i)*a*(E=C-Z)-o*o*(O=C-v),p=f=2*(o*O-a*E),c<1e6||C<=b)for(;p*(_*(P-C)+x*p*(C-b+A))<x*d*_*(x*p-_)&&(y=t(r=s+_/p))<b&&(T=r,b=y),p=1,!(x<=(_=1e-5*(S-w)*(c=1611*c%1048576))););else for(p=1,_=1e-5*(S-w)*(c=1611*c%1048576);_<x;)p*(_*(P-C)+x*p*(C-b+A))<x*d*_*(x*p-_)&&(y=t(r=s+_/p))<b&&(T=r,b=y),p=1,_=1e-5*(S-w)*(c=1611*c%1048576);for(u=(l=.5*(1+l))*(u+2*(_=d*o*a*h)*(g=Math.sqrt((C-b+A)/d))),_=(_=-.5*(o+(E+2.01*D)/(o*d)))<g||o<0?s+g:s+_,r=0<u*(p+=.5*f)?s+u/p:_;(S<=(r=Math.max(r,_))?(r=S,y=P):y=t(r),y<b&&(T=r,b=y),o=r-s,!(r<=_))&&(u=2*(C-y)/(N*o),!((1+9*k)*o<=Math.abs(u)))&&!(.5*d*(o*o+u*u)<=C-b+(y-b)+2*A);)r=.5*(s+r),l*=.9;if(S<=r)break;i=m,m=s,s=r,v=Z,Z=C,C=y}return[T,b]},polzeros:function(t,e,i,r,o){var n,a,h,l=[],c=[],d=[],u=function(t,e,i){var r,o,n=t.length-1;if(i=i||!1)for(o=s.Z.C.mult(n,t[n]),r=n-1;r>0;r--)o.mult(e),o.add(s.Z.C.mult(t[r],r));else for(o=s.Z.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.Z.C.mult(n,t[0]),r=n-1;r>0;r--)o.mult(e),o.add(s.Z.C.mult(t[n-r],r));else for(o=s.Z.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.Z.isNumber(e)&&e>=0&&e<a-1&&(a=e+1),n=0;n<a;n++)l.push(new s.Z.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.Z.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++)d.push(new s.Z.Complex(o[n]));else d=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.Z.C.mult(-1,t[n-1])).div(s.Z.C.mult(n,t[n])),o=s.Z.C.div(u(t,r),t[n]),0===(i=Math.pow(s.Z.C.abs(o),1/n))&&(i=1),e=0;e<n;e++)t=new s.Z.Complex(i*Math.cos(a*e+h),i*Math.sin(a*e+h)),l[e]=s.Z.C.add(r,t);return l}(l);return function(t,e,i,r){var o,n,a,h,l,c,d,_,g,m=[],b=[],v=0,Z=r.length;for(n=0;n<Z;n++)m.push(!1);for(n=0;n<t.length;n++)b.push(s.Z.C.abs(t[n])*(4*n+1));for(o=0;o<i&&v<Z;o++)for(n=0;n<Z;n++)if(!m[n])if(c=u(t,r[n]),l=s.Z.C.abs(r[n]),s.Z.C.abs(c)<e*f(b,l)){if(m[n]=!0,++v===Z)break}else{for(l>1?(h=s.Z.C.div(1,r[n]),(g=p(t,h,!0)).div(p(t,h)),g.mult(h),c=s.Z.C.sub(Z,g),c=s.Z.C.div(r[n],c)):c.div(u(t,r[n],!0)),d=new s.Z.Complex(0),a=0;a<Z;a++)a!==n&&(_=s.Z.C.sub(r[n],r[a]),_=s.Z.C.div(1,_),d.add(_));d.mult(c),d=s.Z.C.sub(1,d),c.div(d),r[n].sub(c)}return o}(l,i,r,d),(d=c.concat(d)).sort((function(t,e){return t.real<e.real?-1:t.real>e.real?1:0})),d},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,d,u,p,f,_=n.Z.eps*n.Z.eps,g=1e4,m=0,b=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=(d=(d=(d=a[1]-o[1])==1/0?g:d)===-1/0?-g:d)*d+(u=(u=(u=a[2]-o[2])==1/0?g:u)===-1/0?-g:u)*u)>_?((f=(l*d+c*u)/p)<0?f=0:f>1&&(f=1),s=(l-=f*d)*l+(c-=f*u)*c):(f=0,s=l*l+c*c),s>m&&(m=s,b=r)}return[Math.sqrt(m),b]}(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.Z.deprecated("Numerics.RamerDouglasPeuker()","Numerics.RamerDouglasPeucker()"),this.RamerDouglasPeucker(t,e)},Visvalingam:function(t,e){var i,r,o,n,a,h,l,c,d,u=[],p=[],f=[];if((r=t.length)<=2)return t;for(u[0]={used:!0,lft:null,node:null},a=0,i=1;i<r-1;i++)o=Math.abs(s.Z.Math.Numerics.det([t[i-1].usrCoords,t[i].usrCoords,t[i+1].usrCoords])),isNaN(o)||(d={v:o,idx:i},p.push(d),u[i]={used:!0,lft:a,node:d},u[a].rt=i,a=i);for(u[r-1]={used:!0,rt:null,lft:a,node:null},u[a].rt=r-1,n=-1/0;p.length>e;)p.sort((function(t,e){return e.v-t.v})),u[i=p.pop().idx].used=!1,n=u[i].node.v,a=u[i].lft,h=u[i].rt,u[a].rt=h,u[h].lft=a,null!==(l=u[a].lft)&&(o=Math.abs(s.Z.Math.Numerics.det([t[l].usrCoords,t[a].usrCoords,t[h].usrCoords])),u[a].node.v=o>=n?o:n),null!==(c=u[h].rt)&&(o=Math.abs(s.Z.Math.Numerics.det([t[a].usrCoords,t[h].usrCoords,t[c].usrCoords])),u[h].node.v=o>=n?o:n);f=[t[i=0]];do{i=u[i].rt,f.push(t[i])}while(null!==u[i].rt);return f}},e.Z=n.Z.Numerics},309:function(t,e,i){var s=i(765),r=i(275),o=i(109);r.Z.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.Z.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.Z.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.Z.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.Z.evalSlider(t),e=o.Z.evalSlider(e),o.Z.isArray(t)&&o.Z.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]+e;else if(o.Z.isNumber(t)&&o.Z.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t+e[i];else if(o.Z.isArray(t)&&o.Z.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.Z.evalSlider(t),e=o.Z.evalSlider(e),o.Z.isArray(t)&&o.Z.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]/e;else if(o.Z.isNumber(t)&&o.Z.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t/e[i];else if(o.Z.isArray(t)&&o.Z.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.Z.deprecated("Statistics.divide()","Statistics.div()"),r.Z.Statistics.div.apply(r.Z.Statistics,arguments)},mod:function(t,e,i){var s,n,a=[],h=function(t,e){return t%e};if((i=o.Z.def(i,!1))&&(h=r.Z.mod),t=o.Z.evalSlider(t),e=o.Z.evalSlider(e),o.Z.isArray(t)&&o.Z.isNumber(e))for(n=t.length,s=0;s<n;s++)a[s]=h(t[s],e);else if(o.Z.isNumber(t)&&o.Z.isArray(e))for(n=e.length,s=0;s<n;s++)a[s]=h(t,e[s]);else if(o.Z.isArray(t)&&o.Z.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.Z.evalSlider(t),e=o.Z.evalSlider(e),o.Z.isArray(t)&&o.Z.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]*e;else if(o.Z.isNumber(t)&&o.Z.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t*e[i];else if(o.Z.isArray(t)&&o.Z.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.Z.evalSlider(t),e=o.Z.evalSlider(e),o.Z.isArray(t)&&o.Z.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]-e;else if(o.Z.isNumber(t)&&o.Z.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t-e[i];else if(o.Z.isArray(t)&&o.Z.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.Z.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}},e.Z=r.Z.Statistics},766:function(t,e,i){var s=i(765),r=i(351),o=i(275),n=i(327),a=i(109);s.Z.Options={jc:{enabled:!0,compile:!0},board:{animationDelay:35,axis:!1,boundingBox:[-5,5,5,-5],browserPan:!1,defaultAxes:{x:{name:"x",fixed:!0,ticks:{label:{visible:"inherit",anchorX:"middle",anchorY:"top",fontSize:12,offset:[0,-3]},tickEndings:[0,1],majorTickEndings:[1,1],drawZero:!1,needsRegularUpdate:!1,visible:"inherit"}},y:{name:"y",fixed:!0,ticks:{label:{visible:"inherit",anchorX:"right",anchorY:"middle",fontSize:12,offset:[-6,0]},tickEndings:[1,0],majorTickEndings:[1,1],drawZero:!1,needsRegularUpdate:!1,visible:"inherit"}}},description:"",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,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",viewport:[0,0,0,0],zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,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:{dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,fillColor:n.Z.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,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.Z.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:0,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,viewport:"inherit",withLabel:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{},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},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:n.Z.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.Z.palette.orange,highlightFillColor:n.Z.palette.orange,strokeColor:n.Z.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.Z.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.Z.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]}},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.Z.palette.blue,fillColor:n.Z.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:n.Z.palette.blue,highlightFillColor:n.Z.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.Z.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.Z.palette.red,strokeColor:n.Z.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:n.Z.palette.red,strokeColor:n.Z.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.Z.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.Z.palette.red,strokeColor:n.Z.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:n.Z.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:n.Z.palette.yellow,highlightFillColor:n.Z.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:n.Z.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.Z.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.Z.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:[]},functiongraph:{},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,gridX:null,gridY:null,majorStep:"auto",minorElements:0,forceSquare:!1,includeBoundaries:!1,major:{size:5,face:"line",margin:0,drawZero:!1,polygonVertices:6,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.5,highlight:!1},minor:{visible:"inherit",size:3,face:"point",margin:0,drawZero:!1,polygonVertices:6,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.25,highlight:!1},snapToGrid:!1,theme:0,themes:[{},{forceSquare:"min"},{minor:{size:3,strokeColor:"#101010"},minorElements:"auto"},{minor:{face:"line"},minorElements:"auto"},{minor:{face:"+",size:"95%"},minorElements:"auto"},{major:{face:"+",size:10,strokeOpacity:1},minor:{size:3},minorElements:"auto"},{major:{face:"circle",size:5},minor:{size:3},minorElements:"auto"},{major:{drawZero:!0},minor:{size:3,drawZero:!0},minorElements:4}]},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.Z.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},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.Z.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.Z.palette.red,strokeColor:n.Z.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:n.Z.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]},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:n.Z.palette.red,fillOpacity:.3,highlightFillColor:n.Z.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:n.Z.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:n.Z.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,position:"urt",offset:[10,10],autoPosition:!1,autoPositionMinDistance:12,autoPositionMaxDistance:28},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],rowHeight:20,strokeWidth:5},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:n.Z.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:n.Z.palette.red,strokeColor:n.Z.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:n.Z.palette.red,strokeColor:n.Z.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:{},dim:null,showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatPrefix:function(t){return t},formatSuffix:function(t){return t},formatCoords:function(t,e,i){return"("+t+", "+e+")"},formatDirection:function(t,e){return"("+t+", "+e+")"}},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:{},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.Z.palette.red,strokeColor:n.Z.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.Z.palette.yellow,highlightFillColor:n.Z.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.Z.palette.red,fillColor:n.Z.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.Z.palette.yellow,highlightFillColor:n.Z.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.Z.palette.red,fillColor:n.Z.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:n.Z.palette.yellow},sector:{fillColor:n.Z.palette.yellow,highlightFillColor:n.Z.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,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.Z.palette.red,strokeColor:n.Z.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:n.Z.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,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,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.Z.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:.125*Math.PI}},slopetriangle:{fillColor:n.Z.palette.red,fillOpacity:.4,highlightFillColor:n.Z.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:{},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,rotate:0,precision:2,digits:2,point1:{visible:"inherit",strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:"inherit",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:!0,digits:2,intl:{enabled:"inherit",options:{}},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.Z.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.Z.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.Z.Validator=function(){var t,e=function(t){return a.Z.isString(t)},i=function(t){return Math.abs(t-Math.round(t))<o.Z.eps},r=function(t){return i(t)&&t>0},n=function(t){return t>0},h=function(t){return t>=0},l={},c={attractorDistance:h,color:e,display:function(t){return"html"===t||"internal"===t},doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:function(t){return a.Z.exists(s.Z.normalizePointFace(t))},factor:a.Z.isNumber,fillColor:e,fillOpacity:a.Z.isNumber,firstArrow:!1,fontSize:i,dash:i,gridX:a.Z.isNumber,gridY:a.Z.isNumber,hasGrid:!1,highlightFillColor:e,highlightFillOpacity:a.Z.isNumber,highlightStrokeColor:e,highlightStrokeOpacity:a.Z.isNumber,insertTicks:!1,lastArrow:!1,layer:function(t){return i(t)&&t>=0},majorHeight:i,minorHeight:i,minorTicks:h,minTicksDistance:r,numberPointsHigh:r,numberPointsLow:r,opacity:a.Z.isNumber,radius:a.Z.isNumber,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:h,snapSizeX:n,snapSizeY:n,snapWidth:a.Z.isNumber,snapToGrid:!1,snatchDistance:h,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:e,strokeOpacity:a.Z.isNumber,strokeWidth:h,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 c)c.hasOwnProperty(t)&&(l[t.toLowerCase()]=c[t]);return l}(),s.Z.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.Z.useStandardOptions=function(t){var e,i,o,n,a=s.Z.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.Z.OBJECT_CLASS_POINT)n(o,a.point);else if(o.elementClass===r.Z.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.Z.OBJECT_CLASS_CIRCLE?n(o,a.circle):o.type===r.Z.OBJECT_TYPE_ANGLE?n(o,a.angle):o.type===r.Z.OBJECT_TYPE_ARC?n(o,a.arc):o.type===r.Z.OBJECT_TYPE_POLYGON?n(o,a.polygon):o.type===r.Z.OBJECT_TYPE_CONIC?n(o,a.conic):o.type===r.Z.OBJECT_TYPE_CURVE?n(o,a.curve):o.type===r.Z.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.Z.useBlackWhiteOptions=function(t){var e=s.Z.Options;e.point.fillColor=n.Z.rgb2bw(e.point.fillColor),e.point.highlightFillColor=n.Z.rgb2bw(e.point.highlightFillColor),e.point.strokeColor=n.Z.rgb2bw(e.point.strokeColor),e.point.highlightStrokeColor=n.Z.rgb2bw(e.point.highlightStrokeColor),e.line.fillColor=n.Z.rgb2bw(e.line.fillColor),e.line.highlightFillColor=n.Z.rgb2bw(e.line.highlightFillColor),e.line.strokeColor=n.Z.rgb2bw(e.line.strokeColor),e.line.highlightStrokeColor=n.Z.rgb2bw(e.line.highlightStrokeColor),e.circle.fillColor=n.Z.rgb2bw(e.circle.fillColor),e.circle.highlightFillColor=n.Z.rgb2bw(e.circle.highlightFillColor),e.circle.strokeColor=n.Z.rgb2bw(e.circle.strokeColor),e.circle.highlightStrokeColor=n.Z.rgb2bw(e.circle.highlightStrokeColor),e.arc.fillColor=n.Z.rgb2bw(e.arc.fillColor),e.arc.highlightFillColor=n.Z.rgb2bw(e.arc.highlightFillColor),e.arc.strokeColor=n.Z.rgb2bw(e.arc.strokeColor),e.arc.highlightStrokeColor=n.Z.rgb2bw(e.arc.highlightStrokeColor),e.polygon.fillColor=n.Z.rgb2bw(e.polygon.fillColor),e.polygon.highlightFillColor=n.Z.rgb2bw(e.polygon.highlightFillColor),e.sector.fillColor=n.Z.rgb2bw(e.sector.fillColor),e.sector.highlightFillColor=n.Z.rgb2bw(e.sector.highlightFillColor),e.curve.strokeColor=n.Z.rgb2bw(e.curve.strokeColor),e.grid.gridColor=n.Z.rgb2bw(e.grid.gridColor),s.Z.useStandardOptions(t)},s.Z.Options.normalizePointFace=s.Z.normalizePointFace,e.Z=s.Z.Options},632:function(t,e,i){var s=i(765),r=i(351),o=i(109);s.Z.GeonextParser={replacePow:function(t){var e,i,s,r,o,n,a,h,l,c,d,u;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),d=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(d.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i<d.length&&e>0;)")"===(s=d.charAt(i))?e-=1:"("===s&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=(n=d.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1")}else n="[\\w\\.]+";u=new RegExp("("+o+")\\^("+n+")"),c=(t=t.replace(u,"pow($1,$2)")).indexOf("^")}return t},replaceIf:function(t){var e,i,s,r,o,n,a,h,l,c="",d=null,u=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"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),c+=e+"(("+(d=this.replaceIf(d))+")?("+(u=this.replaceIf(u))+"):("+(p=this.replaceIf(p))+"))",d=null,u=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(/</g,"<")).replace(/>/g,">")).replace(/&/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.Z.exists(i)||(i=t.board),s=i.elementsByName)s.hasOwnProperty(n)&&n!==t.name&&(s[n].elementClass===r.Z.OBJECT_CLASS_TEXT&&o.Z.evaluate(s[n].visProp.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(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&"),i=(i=(i=(i=this.replaceNameById(i,e,!0)).replace(/True/g,"true")).replace(/False/g,"false")).replace(/fasle/g,"false")}},e.Z=s.Z.GeonextParser},254:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){var _jxg__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(765),_base_constants__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(351),_base_text__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(573),_math_math__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(275),_math_ia__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(785),_math_geometry__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(922),_math_statistics__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(309),_utils_type__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(109),_utils_env__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(503);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__WEBPACK_IMPORTED_MODULE_3__.Z,"math/geometry":_math_geometry__WEBPACK_IMPORTED_MODULE_5__.Z,"math/statistics":_math_statistics__WEBPACK_IMPORTED_MODULE_6__.Z,"math/numerics":_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.Numerics}},r,_ccache;_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.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__WEBPACK_IMPORTED_MODULE_0__.Z.CA&&(this.CA=new _jxg__WEBPACK_IMPORTED_MODULE_0__.Z.CA(this.node,this.createNode,this)),this.code="","string"==typeof t&&this.parse(t,e)},_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.extend(_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(e.locals[t]))return e;e=e.previous}return null},isParameter:function(t){for(var e=this.scope;null!==e;){if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.indexOf(e.args,t)>-1)return e;e=e.previous}return null},isCreator:function(t){return!!_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(e.locals[t]))return e.locals[t];e=e.previous}},getvarJS:function(t,e,i){var s,r="";return e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.def(e,!1),i=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(r)||r.match(/board\.select/)?r:(t=r.split(".").pop(),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this.board.mathLib)&&null!==(s=new RegExp("^Math."+t)).exec(r)?r.replace(s,"$jc$.board.mathLib."+t):_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.deepCopy(i,arguments[e],!0);return i},setProp:function(t,e,i){var s,r,o={};t.elementClass!==_base_constants__WEBPACK_IMPORTED_MODULE_1__.Z.OBJECT_CLASS_POINT||"X"!==e&&"Y"!==e?t.elementClass!==_base_constants__WEBPACK_IMPORTED_MODULE_1__.Z.OBJECT_CLASS_TEXT||"X"!==e&&"Y"!==e?t.type&&t.elementClass&&t.visProp?_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_1__.Z.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=[];s||(this.code+=t+"\n"),_base_text__WEBPACK_IMPORTED_MODULE_2__.Z&&(o=_base_text__WEBPACK_IMPORTED_MODULE_2__.Z.prototype.setText,_base_text__WEBPACK_IMPORTED_MODULE_2__.Z.prototype.setText=_base_text__WEBPACK_IMPORTED_MODULE_2__.Z.prototype.setTextJessieCode);try{for(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(i)||(i=!1),r=0;r<h.length;r++)i&&(h[r]=_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.GeonextParser.geonext2JS(h[r],this.board)),l.push(h[r]);switch(t=l.join("\n"),n=parser.parse(t),this.CA&&(n=this.CA.expandDerivatives(n,null,n),n=this.CA.removeTrivialNodes(n)),e){case"parse":a=this.execute(n);break;case"manipulate":a=this.compile(n);break;case"getAst":a=n;break;default:a=!1}}catch(t){throw t}finally{_base_text__WEBPACK_IMPORTED_MODULE_2__.Z&&(_base_text__WEBPACK_IMPORTED_MODULE_2__.Z.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)},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__WEBPACK_IMPORTED_MODULE_7__.Z.def(e,!0),i=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.def(i,""),s=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.def(s,!1),this.forceValueCall=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(i)&&""!==i.name&&(t.type="node_var",t.value=i.name,t.children.length=0,delete t.replaced)),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this.getvar(s,!0))&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this.board.elementsByName[s])&&(r&&"slider"!==this.board.elementsByName[s].elType&&(r=!1),t=this.createReplacementNode(t,r))),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(Math[t.children[0].value])||_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(_math_math__WEBPACK_IMPORTED_MODULE_3__.Z[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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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.type&&o.elementClass&&o.id&&o.type===_base_constants__WEBPACK_IMPORTED_MODULE_1__.Z.OBJECT_TYPE_SLIDER&&(i[o.id]=o),"node_op"===t.type&&"op_execfun"===t.value&&t.children.length>1&&"$"===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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.children[s-1])&&this.collectDependencies(t.children[s-1],e,i)},resolveProperty:function(t,e,i){return i=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.def(i,!1),t&&t.methodMap&&(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.subs)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.subs[e])?t=t.subs:_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.methodMap[e])?e=t.methodMap[e]:(t=t.visProp,e=e.toLowerCase())),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isFunction(t)&&this._error("Accessing function properties is not allowed."),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)||this._error(t+" is not an object"),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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,d=[];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__WEBPACK_IMPORTED_MODULE_7__.Z.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)<_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.eps?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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.children[2]))if(t.children[3])for(a=t.children[2],l={},s=0;s<a.length;s++)l=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(h)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(h.sc)?h.sc:this,!h.creator&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(h.scope)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(h.scope.argtypes)&&"function"===h.scope.argtypes[s]?(n[s]._isFunctionName=!0,d[s]=this.execute(n[s]),delete n[s]._isFunctionName):d[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(d,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,d);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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_3__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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_assign":e?(i=this.getLHSCompiler(t.children[0],e),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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.needsBrackets&&(o="{\n"+o+" }\n"),t.needsAngleBrackets&&(o=e?"{\n"+o+" }\n":"<< "+o+" >>\n"),o},getName:function(t,e){var i="";return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.getName)?(i=t.getName(),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.Area)||this._error("Error: Can't calculate area."),t.Area()},perimeter:function(t){return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.Perimeter)||this._error("Error: Can't calculate perimeter."),t.Perimeter()},dist:function(t,e){return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.Dist)||this._error("Error: Can't calculate distance."),t.Dist(e)},radius:function(t){return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.Radius)||this._error("Error: Can't calculate radius."),t.Radius()},slope:function(t){return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(t.Slope)||this._error("Error: Can't calculate slope."),t.Slope()},add:function(t,e){var i,s,r;if(t=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e))r=_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.add(t,e);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(e)?r=t+e:_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isString(t)||_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e))r=_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.sub(t,e);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t))s=_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.negative(t);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t))for(i=t.length,s=[],e=0;e<i;e++)s[e]=-t[e];else _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(e)&&(i=t,e=t=e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e))r=_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.mul(t,e);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(e))s=Math.min(t.length,e.length),r=_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.innerProduct(t,e,s);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(e))for(s=e.length,r=[],i=0;i<s;i++)r[i]=t*e[i];else _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e))r=_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.div(t,e);else if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(e))for(s=t.length,r=[],i=0;i<s;i++)r[i]=t[i]/e;else _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e))return _math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.fmod(t,e);if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isArray(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(e))for(s=t.length,r=[],i=0;i<s;i++)r[i]=_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.mod(t[i],e,!0);else _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(t)&&_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.isNumber(e)?r=_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(t),e=_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.evalSlider(e),_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e)?_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.pow(t,e):_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.pow(t,e)},lt:function(t,e){return _math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e)?_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.lt(t,e):t<e},leq:function(t,e){return _math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e)?_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.leq(t,e):t<=e},gt:function(t,e){return _math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e)?_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.gt(t,e):t>e},geq:function(t,e){return _math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(t)||_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.isInterval(e)?_math_ia__WEBPACK_IMPORTED_MODULE_4__.Z.geq(t,e):t>=e},randint:function(t,e,i){return _utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_0__.Z.exists(t.type)&&_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.exists(t.elementClass)&&this.board.removeObject(t)},eval:function(t){return _jxg__WEBPACK_IMPORTED_MODULE_0__.Z.evaluate(t)},use:function(t){var e,i,s=!1;if("string"==typeof t){for(e in _jxg__WEBPACK_IMPORTED_MODULE_0__.Z.boards)if(_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.boards.hasOwnProperty(e)&&_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.boards[e].container===t){i=_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.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__WEBPACK_IMPORTED_MODULE_7__.Z.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__WEBPACK_IMPORTED_MODULE_3__.Z.acosh,acot:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.acot,asinh:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.asinh,binomial:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.binomial,cbrt:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.cbrt,cosh:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.cosh,cot:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.cot,deg:_math_geometry__WEBPACK_IMPORTED_MODULE_5__.Z.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__WEBPACK_IMPORTED_MODULE_3__.Z.erf,erfc:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.erfc,erfi:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.erfi,factorial:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.factorial,gcd:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.gcd,lb:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log2,lcm:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.lcm,ld:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log2,lg:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log10,ln:Math.log,log:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log,log10:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log10,log2:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.log2,ndtr:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.ndtr,ndtri:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.ndtri,nthroot:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.nthroot,pow:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.pow,rad:_math_geometry__WEBPACK_IMPORTED_MODULE_5__.Z.rad,ratpow:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.ratpow,trunc:_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.trunc,sinh:_math_math__WEBPACK_IMPORTED_MODULE_3__.Z.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__WEBPACK_IMPORTED_MODULE_5__.Z,e.deg.sc=_math_geometry__WEBPACK_IMPORTED_MODULE_5__.Z,e.factorial.sc=_math_math__WEBPACK_IMPORTED_MODULE_3__.Z,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__WEBPACK_IMPORTED_MODULE_0__.Z.merge(e,t._addedBuiltIn)},_addedBuiltIn:{},addBuiltIn:function(t,e){if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this.builtIn)){if(_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this.builtIn[t]))return;this.builtIn[t]=e,this.builtIn[t].src="$jc$."+t}_utils_type__WEBPACK_IMPORTED_MODULE_7__.Z.exists(this._addedBuiltIn[t])||(this._addedBuiltIn[t]=e,this._addedBuiltIn[t].src="$jc$."+t,_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.JessieCode.prototype[t]=e)},getPossibleOperands:function(){var t,e,i,s,r,o,n,a,h,l,c,d,u,p,f=["E"],_=this.builtIn||this.defineBuiltIn(),g=Math;for(u=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__WEBPACK_IMPORTED_MODULE_0__.Z.isFunction(i)?{name:t,type:"function",numParams:i.length,origin:e}:_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.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(u),e=Object.getOwnPropertyNames(g).sort(u),i=[],s=0,r=0;s<t.length||r<e.length;)t[s]===e[r]?(o=p(e[r],"Math"),_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.exists(o)&&i.push(o),s++,r++):!_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.exists(e[r])||t[s].toLowerCase().localeCompare(e[r].toLowerCase())<0?(o=p(t[s],"jc"),_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.exists(o)&&i.push(o),s++):(o=p(e[r],"Math"),_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.exists(o)&&i.push(o),r++);for(h=[],l=[],c=[],d={},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)}d[a.name]=a}return{all:d,list:i,functions:h,functions_jessiecode:l,constants:c}},_debug:function(t){"object"==typeof console?console.log(t):_utils_env__WEBPACK_IMPORTED_MODULE_8__.Z.isBrowser&&document&&null!==document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=t+"<br />")},_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("Warning("+this.line+"): "+t):_utils_env__WEBPACK_IMPORTED_MODULE_8__.Z.isBrowser&&document&&null!==document.getElementById(this.warnLog)&&(document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+t+"<br />")},_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],d=[1,19],u=[1,12],p=[1,59],f=[1,60],_=[1,58],g=[1,46],m=[1,48],b=[1,49],v=[1,50],Z=[1,51],C=[1,52],y=[1,53],P=[1,54],E=[1,45],O=[1,38],x=[1,39],w=[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],S=[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],M=[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],A=[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],L=[1,82],R=[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],j=[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],V=[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],K=[1,106],q=[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.$=o[a-1],this.$.needsBrackets=!0;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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{1:[2,1]},t(w,[2,13]),t(S,[2,15]),t(S,[2,16]),t(S,[2,17]),t(S,[2,18]),t(S,[2,19]),t(S,[2,20]),t(S,[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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{16:[1,70]},t(S,[2,11]),t(M,[2,23]),t(M,[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(A,[2,54],{88:77,8:D,64:[1,75],65:[1,76]}),t(A,[2,55],{88:79,8:D,64:[1,81],65:[1,80]}),t(k,[2,28],{39:L}),t(M,[2,56]),t(M,[2,57]),t(M,[2,58]),t(R,[2,30],{41:B,42:I,43:Y}),t(M,[2,61]),t(M,[2,62]),t(M,[2,63]),t(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{8:[1,87]},{8:[1,88]},t(j,[2,32],{45:X,46:U,47:F,48:z}),t(M,[2,66]),t(M,[2,67]),t(M,[2,68]),t(M,[2,69]),{20:J,72:98,73:99,77:Z,78:C,79:y,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,81:101,82:E,91:O,93:x},t(G,[2,36],{50:W,51:H}),t(M,[2,70]),t(M,[2,71]),t(M,[2,72]),t(M,[2,73]),t(M,[2,74]),t(M,[2,75]),t(M,[2,76]),t(V,[2,41],{53:$,54:K,55:q}),t(M,[2,44]),t(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{14:[1,116]},t(S,[2,7]),t(S,[2,8]),t(S,[2,9]),{16:[1,117]},t(S,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(M,[2,87],{89:124,90:125,68:127,20:Q,82:E}),{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,81:129,82:E,91:O,93:x},t(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(M,[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(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(M,[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(M,[2,52]),t(M,[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(S,[2,10]),t(M,[2,25]),t(M,[2,49]),{35:[1,160]},t(k,[2,29],{39:L}),t(M,[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(M,[2,94]),t(M,[2,96]),t(M,[2,97]),t(rt,[2,92]),{10:[1,163],86:it},{66:[1,164]},t(M,[2,91]),t(R,[2,31],{41:B,42:I,43:Y}),t(j,[2,33],{45:X,46:U,47:F,48:z}),t(j,[2,34],{45:X,46:U,47:F,48:z}),t(j,[2,35],{45:X,46:U,47:F,48:z}),t(M,[2,65]),{25:165,26:u},{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(M,[2,80]),{20:J,72:98,73:99,77:Z,78:C,79:y,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(V,[2,42],{53:$,54:K,55:q}),t(V,[2,43],{53:$,54:K,55:q}),t(M,[2,45]),t(M,[2,46]),t(M,[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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(M,[2,60]),{20:Q,68:127,82:E,90:178},t(rt,[2,93]),t(M,[2,90]),t(M,[2,100]),{25:179,26:u},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{94:[1,182]},t(et,[2,82]),t(et,[2,83]),t(st,[2,99]),t(w,[2,2],{12:[1,183]}),t(S,[2,4]),{16:[1,184]},{10:[1,185]},t(M,[2,27]),t(M,[2,95]),t(M,[2,101]),t(nt,[2,105]),t(M,[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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},{16:[1,189]},t(M,[2,103]),t(S,[2,3]),{10:[1,190]},t(S,[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:d,24:11,25:5,26:u,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:m,75:b,76:v,77:Z,78:C,79:y,80:P,82:E,91:O,93:x},t(S,[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),d=Object.create(this.lexer),u={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(u.yy[p]=this.yy[p]);d.setInput(t,u.yy),u.yy.lexer=d,u.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var f=d.yylloc;r.push(f);var _=d.options&&d.options.ranges;"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,m,b,v,Z,C,y,P,E,O=function(){var t;return"number"!=typeof(t=d.lex()||1)&&(t=e.symbols_[t]||t),t},x={};;){if(b=i[i.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==g&&(g=O()),v=o[b]&&o[b][g]),void 0===v||!v.length||!v[0]){var w="";for(C in E=[],o[b])this.terminals_[C]&&C>2&&E.push("'"+this.terminals_[C]+"'");w=d.showPosition?"Parse error on line "+(a+1)+":\n"+d.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(w,{text:d.match,token:this.terminals_[g]||g,line:d.yylineno,loc:f,expected:E})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(v[0]){case 1:i.push(g),s.push(d.yytext),r.push(d.yylloc),i.push(v[1]),g=null,m?(g=m,m=null):(h=d.yyleng,n=d.yytext,a=d.yylineno,f=d.yylloc,l>0&&l--);break;case 2:if(y=this.productions_[v[1]][1],x.$=s[s.length-y],x._$={first_line:r[r.length-(y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(y||1)].first_column,last_column:r[r.length-1].last_column},_&&(x._$.range=[r[r.length-(y||1)].range[0],r[r.length-1].range[1]]),void 0!==(Z=this.performAction.apply(x,[n,h,a,u.yy,v[1],s,r].concat(c))))return Z;y&&(i=i.slice(0,-1*y*2),s=s.slice(0,-1*y),r=r.slice(0,-1*y)),i.push(this.productions_[v[1]][0]),s.push(x.$),r.push(x._$),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 5:case 6:break;case 1:case 2:return 78;case 3:case 4:return 77;case 7:return 7;case 8:return 12;case 9:return 14;case 10:return 17;case 11:return 15;case 12:return 91;case 13:return 93;case 14:return 19;case 15:return 23;case 16:return 21;case 17:return 75;case 18:return 76;case 19:return 74;case 20:return 80;case 21:case 22:return 94;case 23:return 82;case 24:return 83;case 25:return 26;case 26:return 27;case 27:return 16;case 28:return"#";case 29:return 34;case 30:return 35;case 31:return 79;case 32:return 64;case 33:return 65;case 34:return 66;case 35:return 8;case 36:return 10;case 37:return 58;case 38:case 39:return 57;case 40:return 53;case 41:return 54;case 42:return 55;case 43:return 50;case 44:return 51;case 45:return 47;case 46:return 45;case 47:return 48;case 48:return 46;case 49:return 41;case 50:return 43;case 51:return 42;case 52:return 39;case 53:return 37;case 54:return 32;case 55:return 86;case 56:return 5;case 57:return 20;case 58:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[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],inclusive:!0}}};return t}();function dt(){this.yy={}}return at.lexer=ct,dt.prototype=at,at.Parser=dt,new dt}();parser.yy.parseError=parser.parseError,__webpack_exports__.Z=_jxg__WEBPACK_IMPORTED_MODULE_0__.Z.JessieCode},327:function(t,e,i){var s=i(765),r=i(109),o=i(275),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",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.Z.rgbParser=function(t,e,i){var s,o,h,l,c,d,u,p,f,_,g=t;if(!r.Z.exists(t))return[];if(r.Z.exists(e)&&r.Z.exists(i)&&(g=[t,e,i]),s=g,_=!1,r.Z.isArray(s)){for(d=0;d<3;d++)_=_||/\./.test(g[d].toString());for(d=0;d<3;d++)_=_&&g[d]>=0&&g[d]<=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,d=0;d<a.length;d++)h=a[d].re,l=a[d].process,(c=h.exec(s))&&(u=(o=l(c))[0],p=o[1],f=o[2]);return isNaN(u)||isNaN(p)||isNaN(f)?[]:[u=u<0||isNaN(u)?0:u>255?255:u,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f]},s.Z.isColor=function(t){var e=(new Option).style;return e.color=t,""!==e.color},s.Z.rgb2css=function(t,e,i){var r;return"rgb("+(r=s.Z.rgbParser(t,e,i))[0]+", "+r[1]+", "+r[2]+")"},s.Z.rgb2hex=function(t,e,i){var r,o,n;return o=(r=s.Z.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.Z.hex2rgb=function(t){return s.Z.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),s.Z.rgb2css(t)},s.Z.hsv2rgb=function(t,e,i){var s,r,n,a,h,l,c,d,u;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t<o.Z.eps))return"#ffffff";s=i,r=i,n=i}else switch(l=t>=360?0:t,c=i*(1-e),d=i*(1-e*(a=(l/=60)-(h=Math.floor(l)))),u=i*(1-e*(1-a)),h){case 0:s=i,r=u,n=c;break;case 1:s=d,r=i,n=c;break;case 2:s=c,r=i,n=u;break;case 3:s=c,r=d,n=i;break;case 4:s=u,r=c,n=i;break;case 5:s=i,r=c,n=d}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.Z.rgb2hsv=function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,_,g;return o=(r=s.Z.rgbParser(t,e,i))[1],n=r[2],a=(r=r[0])/255,h=o/255,l=n/255,_=Math.max(r,o,n),d=(g=Math.min(r,o,n))/255,p=0,(f=c=_/255)>0&&(p=(f-d)/f),u=1/(c-d),p>0&&(_===r?u*=h-l:u=_===o?2+(l-a)*u:4+(a-h)*u),(u*=60)<0&&(u+=360),_===g&&(u=0),[u,p,f]},s.Z.rgb2LMS=function(t,e,i){var r,o,n,a,h,l,c,d=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return o=(r=s.Z.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*d[0][0]+o*d[0][1]+n*d[0][2],h=r*d[1][0]+o*d[1][1]+n*d[1][2],l=r*d[2][0]+o*d[2][1]+n*d[2][2]]).l=a,c.m=h,c.s=l,c},s.Z.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.Z.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.Z.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.Z.rgb2hex(t)+i)},s.Z.rgb2bw=function(t){var e,i,r,o="0123456789ABCDEF";return"none"===t?t:(r=s.Z.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.Z.rgb2cb=function(t,e){var i,r,o,n,a,h,l,c,d,u,p,f="0123456789ABCDEF";if("none"===t)return t;switch(r=(a=s.Z.rgb2LMS(t))[0],o=a[1],n=a[2],e=e.toLowerCase()){case"protanopia":h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,r=n/o<.6903216543277437?-(l*o+c*n)/h:-(u*o+p*n)/d;break;case"tritanopia":h=-.00058973116217,l=.007690316482,c=-.01011703519052,d=.025495080838999994,u=-.0422740347,p=.017005316784,n=o/r<.8349489908460004?-(h*r+l*o)/c:-(d*r+u*o)/p;break;default:h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,o=n/r<.5763833686400911?-(h*r+c*n)/l:-(d*r+p*n)/u}return i=s.Z.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.Z.shadeColor=function(t,e){var i=s.Z.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.Z.rgb2hex([r,o,n])},s.Z.lightenColor=function(t,e){return s.Z.shadeColor(t,e)},s.Z.darkenColor=function(t,e){return s.Z.shadeColor(t,-1*e)},s.Z.autoHighlight=function(t){var e=s.Z.rgba2rgbo(t),i=e[0],r=e[1];return"#"===t.charAt(0)?(r*=r<.3?1.8:.4,s.Z.rgbo2rgba(i,r)):t},s.Z.contrast=function(t,e,i,r){var o,n,a,h,l;return e=e||"#000000",i=i||"#ffffff",r=r||7,o=s.Z.rgbParser(t),n=s.Z.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.Z.setClassicColors=function(){s.Z.Options.elements.strokeColor="blue",s.Z.Options.elements.fillColor="red",s.Z.Options.hatch.strokeColor="blue",s.Z.Options.angle.fillColor="#ff7f00",s.Z.Options.angle.highlightFillColor="#ff7f00",s.Z.Options.angle.strokeColor="#ff7f00",s.Z.Options.angle.label.strokeColor="blue",s.Z.Options.arc.strokeColor="blue",s.Z.Options.circle.center.fillColor="red",s.Z.Options.circle.center.strokeColor="blue",s.Z.Options.circumcircle.strokeColor="blue",s.Z.Options.circumcircle.center.fillColor="red",s.Z.Options.circumcircle.center.strokeColor="blue",s.Z.Options.circumcirclearc.strokeColor="blue",s.Z.Options.circumcirclesector.strokeColor="blue",s.Z.Options.circumcirclesector.fillColor="green",s.Z.Options.circumcirclesector.highlightFillColor="green",s.Z.Options.conic.strokeColor="blue",s.Z.Options.curve.strokeColor="blue",s.Z.Options.incircle.strokeColor="blue",s.Z.Options.incircle.center.fillColor="red",s.Z.Options.incircle.center.strokeColor="blue",s.Z.Options.inequality.fillColor="red",s.Z.Options.integral.fillColor="red",s.Z.Options.integral.curveLeft.color="red",s.Z.Options.integral.curveRight.color="red",s.Z.Options.line.strokeColor="blue",s.Z.Options.point.fillColor="red",s.Z.Options.point.strokeColor="red",s.Z.Options.polygon.fillColor="green",s.Z.Options.polygon.highlightFillColor="green",s.Z.Options.polygon.vertices.strokeColor="red",s.Z.Options.polygon.vertices.fillColor="red",s.Z.Options.regularpolygon.fillColor="green",s.Z.Options.regularpolygon.highlightFillColor="green",s.Z.Options.regularpolygon.vertices.strokeColor="red",s.Z.Options.regularpolygon.vertices.fillColor="red",s.Z.Options.riemannsum.fillColor="yellow",s.Z.Options.sector.fillColor="green",s.Z.Options.sector.highlightFillColor="green",s.Z.Options.semicircle.center.fillColor="red",s.Z.Options.semicircle.center.strokeColor="blue",s.Z.Options.slopetriangle.fillColor="red",s.Z.Options.slopetriangle.highlightFillColor="red",s.Z.Options.turtle.arrow.strokeColor="blue"},s.Z.extend(s.Z,{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.Z.palette=s.Z.paletteWong,e.Z=s.Z},503:function(t,e,i){var s=i(765),r=i(109);s.Z.extendConstants(s.Z,{touchProperty:"touches"}),s.Z.extend(s.Z,{isTouchEvent:function(t){return s.Z.exists(t[s.Z.touchProperty])},isPointerEvent:function(t){return s.Z.exists(t.pointerId)},isMouseEvent:function(t){return!s.Z.isTouchEvent(t)&&!s.Z.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return s.Z.isTouchEvent(t)&&(e=t[s.Z.touchProperty].length),e},isFirstTouch:function(t){var e=s.Z.getNumberOfTouchPoints(t);return s.Z.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:"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.Z.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return r.Z.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.Z.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return r.Z.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("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,d,u=/\d+(\.\d*)?px/;if(!this.isBrowser||null===t)return{width:500,height:500};if(e=e||document,i=r.Z.isString(t)?e.getElementById(t):t,!r.Z.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}:(d=window.getComputedStyle?window.getComputedStyle(i):i.style,{width:u.test(d.width)?parseFloat(d.width):0,height:u.test(d.height)?parseFloat(d.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.Z.exists(s.BOARD_MODE_NONE)&&(s["x_internal"+e]=s["x_internal"+e]||[],s["x_internal"+e].push(n)),r.Z.exists(t)&&r.Z.exists(t.addEventListener)&&(o=o||!1,t.addEventListener(e,n,o)),r.Z.exists(t)&&r.Z.exists(t.attachEvent)&&t.attachEvent("on"+e,n)},removeEvent:function(t,e,i,o){var n;if(r.Z.exists(o))if(r.Z.exists(o["x_internal"+e]))if(r.Z.isArray(o["x_internal"+e]))if(-1!==(n=r.Z.indexOf(o["x_internal"+e],i,"origin"))){try{r.Z.exists(t)&&r.Z.exists(t.removeEventListener)&&t.removeEventListener(e,o["x_internal"+e][n],!1),r.Z.exists(t)&&r.Z.exists(t.detachEvent)&&t.detachEvent("on"+e,o["x_internal"+e][n])}catch(t){s.Z.debug("event not registered in browser: ("+e+" -- "+i+")")}o["x_internal"+e].splice(n,1)}else s.Z.debug("removeEvent: no such event function in internal list: "+i);else s.Z.debug("owner[x_internal + "+e+"] is not an array");else s.Z.debug("no such type: "+e);else s.Z.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.Z.removeEvent(t,e,i["x_internal"+e][r].origin,i);i["x_internal"+e].length>0&&s.Z.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var o,n,a,h=0,l=0;if(t||(t=window.event),i=i||document,a=t[s.Z.touchProperty],r.Z.exists(a)&&0===a.length&&(a=t.changedTouches),r.Z.exists(e)&&r.Z.exists(a))if(-1===e){for(n=a.length,o=0;o<n;o++)if(a[o]){t=a[o];break}}else t=a[e];return t.clientX&&(h=t.clientX,l=t.clientY),[h,l]},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.Z.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.Z.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.Z.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,d=["transform","webkitTransform","MozTransform","msTransform","oTransform"],u=[[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=d.length,e=0,s="";e<a;e++)if(r.Z.exists(t.style[d[e]])){s=t.style[d[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")?u=[[1,0,0],[0,o[0],o[1]],[0,o[2],o[3]]]:0===s.indexOf("scaleX")?u[1][1]=o[0]:0===s.indexOf("scaleY")?u[2][2]=o[0]:0===s.indexOf("scale")&&(u[1][1]=o[0],u[2][2]=o[1])}return r.Z.exists(t.style.zoom)&&""!==(s=t.style.zoom)&&(u[1][1]*=parseFloat(s),u[2][2]*=parseFloat(s)),u},timedChunk:function(t,e,i,s){var r=t.concat(),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,d,u,p,f,_,g,m=r;for(n=(a=i.getElementById(t).getBoundingClientRect()).height,o=a.width,c=(u=i.getElementById(e))._cssFullscreenStore.w,_=(d=u._cssFullscreenStore.h)/c,c>o*m&&(d=(c=o*m)*_),d>n*m&&(c=(d=n*m)/_),h=c,p=_<n/o?o*m/c:n*m/d,f=.5*(n-(l=d)),g=0;g<4;g++)try{u.style.width=h+"px !important",u.style.height=l+"px !important",u.style.margin="0 auto",u.style.transform=u._cssFullscreenStore.transform+" matrix("+p+",0,0,"+p+",0,"+f+")";break}catch(t){s.Z.debug("JXG.scaleJSXGraphDiv:\n"+t)}4===g&&s.Z.debug("JXG.scaleJSXGraphDiv: Could not set any CSS property.")}}),e.Z=s.Z},88:function(t,e,i){var s=i(765),r=i(109);s.Z.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.Z.isArray(this.eventHandlers[t])||(this.eventHandlers[t]=[]),i=r.Z.def(i,this),this.eventHandlers[t].push({handler:e,context:i}),this},off:function(t,e){var i;return t&&r.Z.isArray(this.eventHandlers[t])?(e?((i=r.Z.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.Z=s.Z.EventEmitter},421:function(t,e,i){var s=i(765),r=i(109),o=i(351),n=i(705);s.Z.Expect={each:function(t,e,i){var s,o,n=[];if(r.Z.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.Z.OBJECT_CLASS_POINT?i=t.coords:t.usrCoords&&t.scrCoords&&t.usr2screen&&(i=t),e&&(i=new n.Z(o.Z.COORDS_BY_USER,i.usrCoords,i.board)),i},coordsArray:function(t,e){var i;return(i=r.Z.isArray(t)?t:this.coords(t).usrCoords).length<3&&i.unshift(1),e&&(i=[i[0],i[1],i[2]]),i}},e.Z=s.Z.Expect},109:function(t,e,i){var s=i(765),r=i(351),o=i(275);s.Z.extend(s.Z,{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.Z.OBJECT_CLASS_POINT},isPoint3D:function(t){return!(null===t||"object"!=typeof t||!this.exists(t.elType))&&"point3d"===t.elType},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)))},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.Z.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 r,o,n,a=[],h={};for(o=0;o<i;o++)for(n in a[o]=s.Z.createFunction(e[o],t),a[o].deps)h[n]=a[o].deps;return(r=function(t){return a[t]()}).deps=h,r},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.isNumber(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,d=[];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?(d.push(t.create("point",e[o],h)),d[d.length-1]._is_new=!0):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(d.push(t.create("point",[e[o]],h)),d[d.length-1]._is_new=!0)):d.push(t.select(e[o])),!this.isPoint(d[o]))return!1;return d},providePoints3D:function(t,e,i,s,r){var o,n,a,h,l,c=0,d=[];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>1?(d.push(t.create("point3d",e[o],h)),d[d.length-1]._is_new=!0):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(d.push(t.create("point3d",[e[o]],h)),d[d.length-1]._is_new=!0)):d.push(t.select(e[o])),!this.isPoint3D(d[o]))return!1;return d},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.Z.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},isInArray:function(t,e){return s.Z.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.Z.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,s){var r;return this.isString(t)&&t.indexOf("%")>-1?(r=t.replace(/\s+%\s+/,""),parseFloat(r)*e*.01):this.isString(t)&&t.indexOf("fr")>-1?(r=t.replace(/\s+fr\s+/,""),parseFloat(r)*e):this.isString(t)&&t.indexOf("px")>-1?(r=t.replace(/\s+px\s+/,""),r=parseFloat(r),this.isFunction(i)?i(r):this.isNumber(i)?r*i:r):parseFloat(t)},parsePosition:function(t){var e,i,s="",r="";if(""!==(t=t.trim()))for(e=t.split(/[ ,]+/),i=0;i<e.length;i++)e[i]in["left","right"]?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){var s,r,o;for(s in i=i||!0,e)e.hasOwnProperty(s)&&(r=i?s.toLowerCase():s,o=e[s],!this.isObject(o)||null===o||this.isDocumentOrFragment(o)||this.exists(o.board)||"string"==typeof o.valueOf()?t[r]=o:(void 0!==t[r]&&null!==t[r]&&this.isObject(t[r])||(t[r]={}),this.mergeAttr(t[r],o,i)))},copyAttributes:function(t,e,i){var r,o,n,a,h;for(r=(n=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.Z.deepCopy(e.elements,null,!0):{},n<4&&this.exists(i)&&this.exists(e.layer[i])&&(r.layer=e.layer[i]),a=e,h=!0,o=2;o<n;o++){if(!this.exists(a[arguments[o]])){h=!1;break}a=a[arguments[o]]}for(h&&(r=s.Z.deepCopy(r,a,!0)),a="object"==typeof t?t:{},h=!0,o=3;o<n;o++){if(!this.exists(a[arguments[o]])){h=!1;break}a=a[arguments[o]]}if(h&&this.mergeAttr(r,a,!0),"board"===arguments[2])return r;for(a=e,h=!0,o=2;o<n;o++){if(!this.exists(a[arguments[o]])){h=!1;break}a=a[arguments[o]]}return h&&this.exists(a.label)&&(r.label=s.Z.deepCopy(a.label,r.label)),r.label=s.Z.deepCopy(e.label,r.label),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])},toJSON:function(t,e){var i,r,o,n;if(e=s.Z.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.Z.toJSON(t[o],e));return"["+i.join(",")+"]"}for(r in t)if(t.hasOwnProperty(r)){try{n=s.Z.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,"&").replace(/</g,"<").replace(/>/g,">")},unescapeHTML:function(t){return t.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/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("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.Z.decToFraction(t,i),r="";return 0===s[1]&&0===s[2]?r+="0":(s[0]<0&&(r+="-"),0!==s[1]&&(r+=s[1]+" "),0!==s[2]&&(r+=!0===e?"\\frac{"+s[2]+"}{"+s[3]+"}":s[2]+"/"+s[3])),r},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,"<").replace(/>/g,">")),t)},evalSlider:function(t){return t&&t.type===r.Z.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.Z=s.Z}},__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__={};return function(){__webpack_require__.d(__webpack_exports__,{default:function(){return lt}});var t=__webpack_require__(765),e=__webpack_require__(503),i=__webpack_require__(351),s=__webpack_require__(109);t.Z.XML={cleanWhitespace:function(t){for(var e=t.firstChild;s.Z.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}};t.Z.XML;var r=__webpack_require__(88),o=(__webpack_require__(421),__webpack_require__(275));o.Z.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 r,o;if(s.Z.exists(e.reduce))return e.reduce((function(e,i){return e*t+i}),0);for(o=0,r=0;o<=i;o++)r=r*t+e[o];return r},p1evl:function(t,e,i){var r,o;if(s.Z.exists(e.reduce))return e.reduce((function(e,i){return e*t+i}),1);for(o=0,r=1;o<i;o++)r=r*t+e[o];return r},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}};o.Z.ProbFuncs;var n=__webpack_require__(785);o.Z.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:(1,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=[],d="finite",u=e;for(r=r||0,o=1;o<=this.upper;o++){if(n=i(t+(u=0===r?e/(o+1):.5*u),!0),a=this[s](n,o-1,c),isNaN(a)){d="NaN";break}if(0!==n&&a/n>this.infty){l=a,d="infinite";break}if(h=a-l,Math.abs(h)<1e-7)break;l=a}return[l,d,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,d=NaN,u=[],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,u,p))-d,isNaN(n)){f="NaN";break}if(0!==o&&n/o>this.infty){d=n,f="infinite";break}if(Math.abs(l)<1e-7)break;d=n}return[d,f,1-(r-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}};var a=o.Z.Extrapolate,h=__webpack_require__(922);o.Z.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},s.Z.extend(o.Z.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 o.Z.Quadtree([this.xlb,this.yub,t,e],this.config,this),this.northEast=new o.Z.Quadtree([t,this.yub,this.xub,e],this.config,this),this.southEast=new o.Z.Quadtree([this.xlb,e,t,this.ylb],this.config,this),this.southWest=new o.Z.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,r;return s.Z.exists(e)?(i=t,r=e):(i=t.usrCoords[1],r=t.usrCoords[2]),this._query(i,r)},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(h.Z.distance([t,e],this.points[r].usrCoords.slice(1),2)<i)return!0;break;case"object":for(r=0;r<o;r++)if(h.Z.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 l=o.Z.Quadtree;o.Z.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])},s.Z.extend(o.Z.BoxQuadtree.prototype,{insert:function(t){var e,i,s,r,o,n,a,h,l,c,d,u=[],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,d=a.xub>this.cx&&a.ylb<=this.cy,h&&l&&d&&c?this.items.push(a):(h&&u.push(a),c&&f.push(a),l&&p.push(a),d&&_.push(a));return this.subdivide(u,f,p,_,s,r,o,n),this},insertItem:function(t){var e,i,s,r,o,n,a,h,l=[],c=[],d=[],u=[];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&&d.push(t),n&&c.push(t),h&&u.push(t)),this.subdivide(l,d,c,u,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,r=[];for(i=this.items.length,e=0;e<i;e++)s=this.items[e],t[2]>=s.xlb&&t[0]<=s.xub&&t[3]<=s.yub&&t[1]>=s.ylb&&r.push(this.items[e]);return null!==this.northWest&&t[0]<=this.cx&t[1]>=this.cy&&(r=r.concat(this.northWest.find(t))),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&(r=r.concat(this.southWest.find(t))),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&(r=r.concat(this.northEast.find(t))),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&(r=r.concat(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(),e=e.concat(t[0]),i=i.concat(t[1])),null!==this.northEast&&(t=this.northEast.plot(),e=e.concat(t[0]),i=i.concat(t[1])),null!==this.southEast&&(t=this.southEast.plot(),e=e.concat(t[0]),i=i.concat(t[1])),null!==this.southWest&&(t=this.southWest.plot(),e=e.concat(t[0]),i=i.concat(t[1])),[e,i]}});var c=o.Z.BoxQuadtree,d=__webpack_require__(336);t.Z.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,d=i+2,u=this.arr(e+1),p=this;return this.lastNumberOfEvaluations=0,h&&console.log("Experimental feature 'testForRoundingErrors' is activated."),u[0]=0,this.arraycopy(s,0,u,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,d,u,r,o,n,a,h),this.arraycopy(u,1,s,0,e),l},cobylb:function(t,e,i,s,r,o,n,a,h,l){var c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N,A,D,k,L,R,B,I,Y=-1,j=0,X=0,U=e+1,F=i+1,z=o,J=0,G=!1,W=!1,H=0,V=0,$=0,K=this.arr(1+s),q=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."),m=0,_=1/z,d=1;d<=e;++d)q[d][U]=r[d],q[d][d]=z,Q[d][d]=_;b=U,v=!1;t:for(;;){if(m>=h&&m>0){Y=this.MaxIterationsReached;break t}for(++m,j=t(e,i,r,K),X=0,p=1;p<=i;++p)X=Math.max(X,-K[p]);if(m!==a-1&&3!==a||this.PrintIterationResult(m,j,X,r,e,a),K[F]=j,K[s]=X,Z=!0,!v){for(Z=!1,d=1;d<=s;++d)tt[d][b]=K[d];if(m<=U){if(b<=e)if(tt[F][U]<=j)r[b]=q[b][U];else{for(q[b][U]=r[b],p=1;p<=s;++p)tt[p][b]=tt[p][U],tt[p][U]=K[p];for(p=1;p<=b;++p){for(q[b][p]=-z,_=0,d=p;d<=b;++d)_-=Q[d][p];Q[b][p]=_}}if(m<=e){r[b=m]+=z;continue t}}v=!0}e:for(;;){i:do{if(!Z){for(C=tt[F][U]+J*tt[s][U],y=U,u=1;u<=e;++u)(_=tt[F][u]+J*tt[s][u])<C?(y=u,C=_):_===C&&0===J&&tt[s][u]<tt[s][y]&&(y=u);if(y<=e){for(d=1;d<=s;++d)_=tt[d][U],tt[d][U]=tt[d][y],tt[d][y]=_;for(d=1;d<=e;++d){for(_=q[d][y],q[d][y]=0,q[d][U]+=_,g=0,p=1;p<=e;++p)q[d][p]-=_,g-=Q[p][d];Q[y][d]=g}}if(P=0,l)for(d=1;d<=e;++d)for(u=1;u<=e;++u)_=this.DOT_PRODUCT_ROW_COL(Q,d,q,u,1,e)-(d===u?1:0),P=Math.max(P,Math.abs(_));if(P>.1){Y=this.DivergingRoundingErrors;break t}for(p=1;p<=F;++p){for(K[p]=-tt[p][U],u=1;u<=e;++u)nt[u]=tt[p][u]+K[p];for(d=1;d<=e;++d)et[d][p]=(p===F?-1:1)*this.DOT_PRODUCT_ROW_COL(nt,-1,Q,d,1,e)}for(G=!0,H=.25*z,E=2.1*z,u=1;u<=e;++u){for(O=0,x=0,p=1;p<=e;++p)O+=Q[u][p]*Q[u][p],x+=q[p][u]*q[p][u];it[u]=1/Math.sqrt(O),st[u]=Math.sqrt(x),(it[u]<H||st[u]>E)&&(G=!1)}if(!v&&!G){for(b=0,_=E,u=1;u<=e;++u)st[u]>_&&(b=u,_=st[u]);if(0===b)for(u=1;u<=e;++u)it[u]<_&&(b=u,_=it[u]);for(_=.5*z*it[b],p=1;p<=e;++p)ot[p]=_*Q[b][p];for(w=0,S=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],w=Math.max(w,-c-_),S=Math.max(S,c-_));for(M=J*(w-S)>2*c?-1:1,_=0,d=1;d<=e;++d)ot[d]=M*ot[d],q[d][b]=ot[d],_+=Q[b][d]*ot[d];for(p=1;p<=e;++p)Q[b][p]/=_;for(u=1;u<=e;++u){if(u!==b)for(_=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=_*Q[b][p];r[u]=q[u][U]+ot[u]}continue t}if(!(W=this.trstlp(e,i,et,K,z,ot))){for(_=0,p=1;p<=e;++p)_+=ot[p]*ot[p];if(_<.25*z*z){v=!0;break i}}for(c=0,T=0,K[F]=0,p=1;p<=F;++p)c=K[p]-this.DOT_PRODUCT_ROW_COL(ot,-1,et,p,1,e),p<F&&(T=Math.max(T,c));if(J<1.5*(N=(V=tt[s][U]-T)>0?c/V:0))for(J=2*N,a>=2&&console.log("Increase in PARMU to "+J),A=tt[F][U]+J*tt[s][U],u=1;u<=e;++u)if((_=tt[F][u]+J*tt[s][u])<A||_===A&&0===J&&tt[s][u]<tt[s][U])continue e;for($=J*V-c,p=1;p<=e;++p)r[p]=q[p][U]+ot[p];v=!0;continue t}for(Z=!1,D=tt[F][U]+J*tt[s][U]-(j+J*X),0===J&&j===tt[F][U]&&($=V,D=tt[s][U]-X),k=D<=0?1:0,b=0,u=1;u<=e;++u)(_=Math.abs(this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e)))>k&&(b=u,k=_),rt[u]=_*it[u];for(L=1.1*z,f=0,u=1;u<=e;++u)if(rt[u]>=H||rt[u]>=it[u]){if(_=st[u],D>0){for(_=0,p=1;p<=e;++p)_+=Math.pow(ot[p]-q[p][u],2);_=Math.sqrt(_)}_>L&&(f=u,L=_)}if(f>0&&(b=f),0!==b){for(_=0,d=1;d<=e;++d)q[d][b]=ot[d],_+=Q[b][d]*ot[d];for(p=1;p<=e;++p)Q[b][p]/=_;for(u=1;u<=e;++u)if(u!==b)for(_=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=_*Q[b][p];for(p=1;p<=s;++p)tt[p][b]=K[p];if(D>0&&D>=.1*$)continue e}}while(0);if(G){if(z<=n){Y=this.Normal;break t}if(R=0,B=0,(z*=.5)<=1.5*n&&(z=n),J>0){for(I=0,p=1;p<=F;++p){for(B=R=tt[p][U],d=1;d<=e;++d)R=Math.min(R,tt[p][d]),B=Math.max(B,tt[p][d]);p<=i&&R<.5*B&&(_=Math.max(B,0)-R,I=I<=0?_:Math.min(I,_))}0===I?J=0:B-R<J*I&&(J=(B-R)/I)}a>=2&&console.log("Reduction in RHO to "+z+" and PARMU = "+J),2===a&&this.PrintIterationResult(m,tt[F][U],tt[s][U],this.COL(q,U),e,a)}else v=!1}}switch(Y){case this.Normal:if(a>=1&&console.log("%nNormal return from subroutine COBYLA%n"),W)return a>=1&&this.PrintIterationResult(m,j,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]=q[p][U];return j=tt[F][U],X=tt[s][U],a>=1&&this.PrintIterationResult(m,j,X,r,e,a),Y},trstlp:function(t,e,i,s,r,n){var a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N,A,D,k,L,R,B,I,Y,j=0,X=0,U=0,F=this.arr2(1+t,1+t),z=this.arr(2+e),J=this.arr(2+e),G=this.arr(1+t),W=this.arr(1+t),H=this.arr(2+e),V=this.arr(2+e),$=e,K=0;for(l=1;l<=t;++l)F[l][l]=1,n[l]=0;if(a=0,h=0,e>=1){for(c=1;c<=e;++c)s[c]>h&&(h=s[c],a=c);for(c=1;c<=e;++c)V[c]=c,J[c]=h-s[c]}d=!0;do{t:for(;;){(!d||d&&0===h)&&(a=$=e+1,V[$]=$,J[$]=0),d=!1,u=0,p=0,f=0,_=0;e:do{if(g=$===e?h:-this.DOT_PRODUCT_ROW_COL(n,-1,i,$,1,t),0===p||g<u?(u=g,X=K,p=3):K>X?(X=K,p=3):--p,0===p)break t;if(m=0,a<=K){if(a<K){b=V[a],v=J[a],c=a;do{for(y=V[C=c+1],P=this.DOT_PRODUCT(this.PART(this.COL(F,c),1,t),this.PART(this.COL(i,y),1,t)),j=o.Z.hypot(P,z[C]),E=z[C]/j,O=P/j,z[C]=E*z[c],z[c]=j,l=1;l<=t;++l)j=E*F[l][C]+O*F[l][c],F[l][C]=E*F[l][c]-O*F[l][C],F[l][c]=j;V[c]=y,J[c]=J[C],c=C}while(c<K);V[c]=b,J[c]=v}if(--K,$>e)for(j=1/z[K],c=1;c<=t;++c)G[c]=j*F[c][K];else for(j=this.DOT_PRODUCT_ROW_COL(G,-1,F,K+1,1,t),c=1;c<=t;++c)G[c]-=j*F[c][K+1]}else{for(y=V[a],c=1;c<=t;++c)W[c]=i[c][y];for(x=0,c=t;c>K;){for(P=0,w=0,l=1;l<=t;++l)P+=j=F[l][c]*W[l],w+=Math.abs(j);if(S=w+.1*Math.abs(P),M=w+.2*Math.abs(P),(w>=S||S>=M)&&(P=0),0===x)x=P;else for(C=c+1,E=P/(j=o.Z.hypot(P,x)),O=x/j,x=j,l=1;l<=t;++l)j=E*F[l][c]+O*F[l][C],F[l][C]=E*F[l][C]-O*F[l][c],F[l][c]=j;--c}if(0===x){m=-1,c=K;do{for(T=0,N=0,l=1;l<=t;++l)T+=j=F[l][c]*W[l],N+=Math.abs(j);if(S=N+.1*Math.abs(T),M=N+.2*Math.abs(T),N<S&&S<M){if((j=T/z[c])>0&&V[c]<=e&&(Y=J[c]/j,(m<0||Y<m)&&(m=Y)),c>=2)for(A=V[c],l=1;l<=t;++l)W[l]-=j*i[l][A];H[c]=j}else H[c]=0}while(--c>0);if(m<0)break t;for(c=1;c<=K;++c)J[c]=Math.max(0,J[c]-m*H[c]);if(a<K){b=V[a],v=J[a],c=a;do{for(A=V[C=c+1],P=this.DOT_PRODUCT(this.PART(this.COL(F,c),1,t),this.PART(this.COL(i,A),1,t)),j=o.Z.hypot(P,z[C]),E=z[C]/j,O=P/j,z[C]=E*z[c],z[c]=j,l=1;l<=t;++l)j=E*F[l][C]+O*F[l][c],F[l][C]=E*F[l][c]-O*F[l][C],F[l][c]=j;V[c]=A,J[c]=J[C],c=C}while(c<K);V[c]=b,J[c]=v}if(0===(j=this.DOT_PRODUCT(this.PART(this.COL(F,K),1,t),this.PART(this.COL(i,y),1,t))))break t;z[K]=j,J[a]=0,J[K]=m}else z[++K]=x,J[a]=J[K],J[K]=0;if(V[a]=V[K],V[K]=y,$>e&&y!==$){for(c=K-1,P=this.DOT_PRODUCT(this.PART(this.COL(F,c),1,t),this.PART(this.COL(i,y),1,t)),j=o.Z.hypot(P,z[K]),E=z[K]/j,O=P/j,z[K]=E*z[c],z[c]=j,l=1;l<=t;++l)j=E*F[l][K]+O*F[l][c],F[l][K]=E*F[l][c]-O*F[l][K],F[l][c]=j;V[K]=V[c],V[c]=y,j=J[c],J[c]=J[K],J[K]=j}if($>e)for(j=1/z[K],c=1;c<=t;++c)G[c]=j*F[c][K];else for(y=V[K],j=(this.DOT_PRODUCT_ROW_COL(G,-1,i,y,1,t)-1)/z[K],c=1;c<=t;++c)G[c]-=j*F[c][K]}for(D=r*r,L=0,k=0,l=1;l<=t;++l)Math.abs(n[l])>=1e-6*r&&(D-=n[l]*n[l]),L+=n[l]*G[l],k+=G[l]*G[l];if(D<=0)break t;if(j=Math.sqrt(k*D),Math.abs(L)>=1e-6*j&&(j=Math.sqrt(k*D+L*L)),f=_=D/(j+L),$===e){if(M=f+.2*h,f>=(S=f+.1*h)||S>=M)break e;f=Math.min(f,h)}for(c=1;c<=t;++c)W[c]=n[c]+f*G[c];if($===e)for(U=h,h=0,c=1;c<=K;++c)j=s[y=V[c]]-this.DOT_PRODUCT_ROW_COL(W,-1,i,y,1,t),h=Math.max(h,j);c=K;do{for(R=0,B=0,l=1;l<=t;++l)R+=j=F[l][c]*W[l],B+=Math.abs(j);if(S=B+.1*Math.abs(R),M=B+.2*Math.abs(R),(B>=S||S>=M)&&(R=0),H[c]=R/z[c],c>=2)for(y=V[c],l=1;l<=t;++l)W[l]-=H[c]*i[l][y]}while(c-- >=2);for($>e&&(H[K]=Math.max(0,H[K])),c=1;c<=t;++c)W[c]=n[c]+f*G[c];if($>K)for(c=K+1;c<=$;++c){for(Z=h-s[y=V[c]],I=h+Math.abs(s[y]),l=1;l<=t;++l)Z+=j=i[l][y]*W[l],I+=Math.abs(j);S=I+.1*Math.abs(Z),M=I+.2*Math.abs(Z),(I>=S||S>=M)&&(Z=0),H[c]=Z}for(m=1,a=0,c=1;c<=$;++c)H[c]<0&&(j=J[c]/(J[c]-H[c]))<m&&(m=j,a=c);for(j=1-m,c=1;c<=t;++c)n[c]=j*n[c]+m*W[c];for(c=1;c<=$;++c)J[c]=Math.max(0,j*J[c]+m*H[c]);$===e&&(h=U+m*(h-U))}while(a>0);if(f===_)return!0}}while($===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}};t.Z.Math.Nlp;var u=__webpack_require__(705),p=__webpack_require__(309);o.Z.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])>o.Z.eps){s=!0;break}return s},updateParametricCurveNaive:function(t,e,s,r){var o,n,a=!1,h=(s-e)/r;for(o=0;o<r;o++)n=e+o*h,t.points[o].setCoordinates(i.Z.COORDS_BY_USER,[t.X(n,a),t.Y(n,a)],!1),t.points[o]._t=n,a=!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(e,s,r){var n,a,h,l,c,d,p,f,_,g,m,b=!1,v=new u.Z(i.Z.COORDS_BY_USER,[0,0],e.board,!1),Z=[],C=[],y=[],P=[],E=!1,O=0,x=function(t,e,i){var s,r=i[1]-t[1],n=i[2]-t[2],a=e[0]-t[1],h=e[1]-t[2],l=a*a+h*h;return l>=o.Z.eps&&(s=(r*a+n*h)/l)>0&&(s<=1?(r-=s*a,n-=s*h):(r-=a,n-=h)),o.Z.hypot(r,n)};for(t.Z.deprecated("Curve.updateParametricCurveOld()"),e.board.updateQuality===e.board.BOARD_QUALITY_LOW?(_=15,g=10,m=10):(_=21,g=.7,m=.7),P[0]=r-s,n=1;n<_;n++)P[n]=.5*P[n-1];n=1,Z[0]=1,C[0]=0,a=s,v.setCoordinates(i.Z.COORDS_BY_USER,[e.X(a,b),e.Y(a,b)],!1),b=!0,c=v.scrCoords[1],d=v.scrCoords[2],a=r,v.setCoordinates(i.Z.COORDS_BY_USER,[e.X(a,b),e.Y(a,b)],!1),h=v.scrCoords[1],l=v.scrCoords[2],y[0]=[h,l],p=1,f=0,e.points=[],e.points[O++]=new u.Z(i.Z.COORDS_BY_SCREEN,[c,d],e.board,!1);do{for(E=this.isDistOK(h-c,l-d,g,m)||this.isSegmentOutside(c,d,h,l,e.board);f<_&&(!E||f<6)&&(f<=7||this.isSegmentDefined(c,d,h,l));)Z[p]=n,C[p]=f,y[p]=[h,l],p+=1,a=s+(n=2*n-1)*P[++f],v.setCoordinates(i.Z.COORDS_BY_USER,[e.X(a,b),e.Y(a,b)],!1,!0),h=v.scrCoords[1],l=v.scrCoords[2],E=this.isDistOK(h-c,l-d,g,m)||this.isSegmentOutside(c,d,h,l,e.board);O>1&&x(e.points[O-2].scrCoords,[h,l],e.points[O-1].scrCoords)<.015&&(O-=1),e.points[O]=new u.Z(i.Z.COORDS_BY_SCREEN,[h,l],e.board,!1),e.points[O]._t=a,O+=1,c=h,d=l,h=y[p-=1][0],l=y[p][1],f=C[p]+1,n=2*Z[p]}while(p>0&&O<5e5);return e.numberPoints=e.points.length,e},_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 s,r,n=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1);return s=e+o.Z.eps,n.setCoordinates(i.Z.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,!!(isNaN(r[1]+r[2])||(s=e-o.Z.eps,n.setCoordinates(i.Z.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,isNaN(r[1]+r[2])))},_borderCase:function(t,e,s,r,o,n,a,h){var l,c,d,p,f,_,g=null,m=!1;if(h<=1){if(c=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1),isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,o))return!1;if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,n))return!1;if(isNaN(r[1]+r[2])&&(!isNaN(e[1]+e[2])||!isNaN(s[1]+s[2]))&&!this.neighborhood_isNaN_v2(t,a))return!1;p=0;do{if(isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2]))f=o,_=a;else if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2]))f=n,_=a;else if(isNaN(r[1]+r[2])&&!isNaN(s[1]+s[2]))f=a,_=n;else{if(!isNaN(r[1]+r[2])||isNaN(e[1]+e[2]))return!1;f=a,_=o}l=.5*(f+_),c.setCoordinates(i.Z.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,(m=isNaN(d[1]+d[2]))?f=l:_=l,++p}while(m&&p<30);if(p<30&&(g=d.slice(),r=d.slice(),_=l),null!==g)return this._insertPoint_v2(t,new u.Z(i.Z.COORDS_BY_USER,g,t.board,!1)),!0}return!1},_plotRecursive_v2:function(t,e,s,r,o,n,a){var h,l,c,d,p,f=0,_=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1);if(!(t.numberPoints>65536))return n<this.nanLevel&&this._isUndefined(t,e,s,r,o)||n<this.nanLevel&&this._isOutside(e,s,r,o,t.board)?this:(h=.5*(s+o),_.setCoordinates(i.Z.COORDS_BY_USER,[t.X(h,!0),t.Y(h,!0)],!1),l=_.scrCoords,this._borderCase(t,e,r,l,s,o,h,n)||(c=this._triangleDists(e,r,l),d=n<this.smoothLevel&&c[3]<a,p=n<=this.jumpLevel&&(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))||n<this.jumpLevel&&(c[2]>.99*c[0]||c[1]>.99*c[0]||c[0]===1/0||c[1]===1/0||c[2]===1/0),n<this.smoothLevel+2&&c[0]<.5*(c[1]+c[2])&&(f=0,d=!1),--n,p?this._insertPoint_v2(t,new u.Z(i.Z.COORDS_BY_SCREEN,[NaN,NaN],t.board,!1),h):n<=f||d?this._insertPoint_v2(t,_,h):(this._plotRecursive_v2(t,e,s,l,h,n,a),isNaN(_.scrCoords[1]+_.scrCoords[2])||this._insertPoint_v2(t,_,h),this._plotRecursive_v2(t,l,h,r,o,n,a))),this)},updateParametricCurve_v2:function(t,e,r){var o,n,a,h,l,c,d,p,f,_=!1,g=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1),m=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1);return t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(l=s.Z.evaluate(t.visProp.recursiondepthlow)||13,c=2,this.smoothLevel=l-6,this.jumpLevel=3):(l=s.Z.evaluate(t.visProp.recursiondepthhigh)||17,c=2,this.smoothLevel=l-9,this.jumpLevel=2),this.nanLevel=l-4,t.points=[],"x"===this.xterm?(d=.3*((p=t.board.getBoundingBox())[2]-p[0]),o=Math.max(e,p[0]-d),n=Math.min(r,p[2]+d)):(o=e,n=r),g.setCoordinates(i.Z.COORDS_BY_USER,[t.X(o,_),t.Y(o,_)],!1),_=!0,m.setCoordinates(i.Z.COORDS_BY_USER,[t.X(n,_),t.Y(n,_)],!1),f=this._findStartPoint(t,g.scrCoords,o,m.scrCoords,n),g.setCoordinates(i.Z.COORDS_BY_SCREEN,f[0],!1),o=f[1],f=this._findStartPoint(t,m.scrCoords,n,g.scrCoords,o),m.setCoordinates(i.Z.COORDS_BY_SCREEN,f[0],!1),n=f[1],this._visibleArea=[o,n],a=g.copy("scrCoords"),h=m.copy("scrCoords"),g._t=o,t.points.push(g),this._lastCrds=g.copy("scrCoords"),this._plotRecursive_v2(t,a,o,h,n,l,c),m._t=n,t.points.push(m),t.numberPoints=t.points.length,t},_insertLimesPoint:function(t,e,s,r,n){var a,h,l;Math.abs(this._lastUsrCrds[1])===1/0&&Math.abs(n.left_x)===1/0||Math.abs(this._lastUsrCrds[2])===1/0&&Math.abs(n.left_y)===1/0||((a=new u.Z(i.Z.COORDS_BY_USER,[n.left_x,n.left_y],t.board))._t=s,t.points.push(a),isNaN(n.left_x)||isNaN(n.left_y)||isNaN(n.right_x)||isNaN(n.right_y)||!(Math.abs(n.left_x-n.right_x)>o.Z.eps||Math.abs(n.left_y-n.right_y)>o.Z.eps)||((h=new u.Z(i.Z.COORDS_BY_SCREEN,e,t.board))._t=s,t.points.push(h)),(l=new u.Z(i.Z.COORDS_BY_USER,[n.right_x,n.right_y],t.board))._t=s,t.points.push(l),this._lastScrCrds=l.copy("scrCoords"),this._lastUsrCrds=l.copy("usrCoords"))},_insertPoint:function(t,e,r,o,n){var a,h=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),l=!isNaN(e[1]+e[2]),c=t.board.canvasWidth,d=t.board.canvasHeight,p=500;s.Z.exists(n)?this._insertLimesPoint(t,e,r,o,n):(l=l&&e[1]>-500&&e[2]>-500&&e[1]<c+p&&e[2]<d+p,(h||l)&&(l&&h&&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||((a=new u.Z(i.Z.COORDS_BY_SCREEN,e,t.board))._t=r,t.points.push(a),this._lastScrCrds=a.copy("scrCoords"),this._lastUsrCrds=a.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])],[h.Z.distance(t,e,3),h.Z.distance(t,i,3),h.Z.distance(i,e,3),h.Z.distance(i,s,3)]},_isUndefined:function(t,e,s,r,o){var n,a,h;if(!isNaN(e[1]+e[2])||!isNaN(r[1]+r[2]))return!1;for(h=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1),a=0;a<20;++a)if(n=s+Math.random()*(o-s),h.setCoordinates(i.Z.COORDS_BY_USER,[t.X(n,!0),t.Y(n,!0)],!1),!isNaN(h.scrCoords[0]+h.scrCoords[1]+h.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,s,r,n,a,h){var l,c,d,p,f,_;if(c=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1),p=0,isNaN(s[1]+s[2])&&!isNaN(n[1]+n[2]))_=e,f=r;else if(isNaN(h[1]+h[2])&&!isNaN(n[1]+n[2]))_=a,f=r;else if(isNaN(n[1]+n[2])&&!isNaN(h[1]+h[2]))_=r,f=a;else{if(!isNaN(n[1]+n[2])||isNaN(s[1]+s[2]))return!1;_=r,f=e}do{l=.5*(f+_),c.setCoordinates(i.Z.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,isNaN(d[1]+d[2])?_=l:f=l,++p}while(p<30&&Math.abs(f-_)>o.Z.eps);return l},_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 d.Z.fminbr((function(e){var i=[t.X(e,!0),t.Y(e,!0)];return-(o.Z.hypot(s[0]-i[0],s[1]-i[1])+o.Z.hypot(r[0]-i[0],r[1]-i[1]))}),[e,i],t)},_getJumpPos:function(t,e,i){return d.Z.fminbr((function(e){var i=o.Z.eps*o.Z.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,h=2/(t.maxX()-t.minX());return s=(i=a.limit(e,-h,t.X))[0],"infinite"===i[1]&&(s=Math.sign(s)*(1/0)),o=(i=a.limit(e,-h,t.Y))[0],"infinite"===i[1]&&(o=Math.sign(o)*(1/0)),r=(i=a.limit(e,h,t.X))[0],"infinite"===i[1]&&(r=Math.sign(r)*(1/0)),n=(i=a.limit(e,h,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,d,u,p,f,_,g,m=null,b=!1,v="",Z=[],C=0;for(p=t.board.origin.scrCoords,Z[C++]=[e,i,s,r,o,1/0];C>0;){if(e=(g=Z[--C])[0],i=g[1],s=g[2],r=g[3],f=g[4],_=g[5],b=!1,v="",m=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),d=t.X(n,!0),u=t.Y(n,!0),a=[1,p[1]+d*t.board.unitX,p[2]-u*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?v="border":h[0]>.66*_||h[0]<this.cusp_threshold*(h[1]+h[2])||h[1]>5*h[2]||h[2]>5*h[1]?v="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)&&(v="jump"),b=""===v&&f<this.smoothLevel&&h[3]<this.smooth_threshold,f<this.testLevel&&!b&&(""===v?b=!0:m=this._getLimes(t,i,e,n,a,r,s,v,f)),null!==m?(a=[1,NaN,NaN],this._insertPoint(t,a,n,f,m)):f<=0||b?this._insertPoint(t,a,n,f,null):(Z[C++]=[a,n,s,r,f-1,h[0]],Z[C++]=[e,i,a,n,f-1,h[0]])}return this},updateParametricCurve_v3:function(t,e,r){var o,n,a,h,l,c,d,p,f=!1,_=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1),g=new u.Z(i.Z.COORDS_BY_USER,[0,0],t.board,!1);return l=t.board.updateQuality===t.board.BOARD_QUALITY_LOW?s.Z.evaluate(t.visProp.recursiondepthlow)||14:s.Z.evaluate(t.visProp.recursiondepthhigh)||17,this.smoothLevel=7,this.nanLevel=l-4,this.testLevel=4,this.cusp_threshold=.5,this.jump_threshold=.99,this.smooth_threshold=2,t.points=[],"x"===t.xterm?(c=.3*((d=t.board.getBoundingBox())[2]-d[0]),o=Math.max(e,d[0]-c),n=Math.min(r,d[2]+c)):(o=e,n=r),_.setCoordinates(i.Z.COORDS_BY_USER,[t.X(o,f),t.Y(o,f)],!1),f=!0,g.setCoordinates(i.Z.COORDS_BY_USER,[t.X(n,f),t.Y(n,f)],!1),p=this._findStartPoint(t,_.scrCoords,o,g.scrCoords,n),_.setCoordinates(i.Z.COORDS_BY_SCREEN,p[0],!1),o=p[1],p=this._findStartPoint(t,g.scrCoords,n,_.scrCoords,o),g.setCoordinates(i.Z.COORDS_BY_SCREEN,p[0],!1),n=p[1],this._visibleArea=[o,n],a=_.copy("scrCoords"),h=g.copy("scrCoords"),_._t=o,t.points.push(_),this._lastScrCrds=_.copy("scrCoords"),this._lastUsrCrds=_.copy("usrCoords"),this._plotNonRecursive(t,a,o,h,n,l),g._t=n,t.points.push(g),t.numberPoints=t.points.length,t},_criticalInterval:function(t,e,i){var s,r,o,n,a,h,l,c=!1,d=-1/0,u=!1,f=!1,_=0,g=[],m=[],b=[];for(l=p.Z.abs(t),(n=p.Z.median(l))<1e-7?(n=1e-7,u=!0):n*=this.criticalThreshold,s=0;s<e;s++)l[s]>n?(b.push({i:s,v:t[s],group:_}),d=s,c||(c=!0)):c&&s>d+4&&(b.length>0&&g.push(b.slice(0)),b=[],c=!1,_++);for(c&&b.length>1&&g.push(b.slice(0)),u&&0===g.length&&(f=!0),r=0;r<g.length;r++)if(m[r]="point",!((o=g[r].length)<64)){for(h=0,a=Math.sign(g[r][0].v),s=1;s<o;s++)Math.sign(g[r][s].v)!==a&&(h++,a=Math.sign(g[r][s].v));6*h>o&&(m[r]="interval")}return{smooth:f,groups:g,types:m}},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=[],d=0,u=0,p=0,f=!1,_=!1;for(n=(i-e)/s,c[d]=new this.Component,l=c[d],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=u,f=!1,c[++d]=new this.Component,l=c[d],p=0):(f||(f=!0,u=0,p>0&&(l.left_t=o-n,l.left_isNaN=!0)),p=0,l.t_values[u]=o,l.x_values[u]=a,l.y_values[u]=h,u++),0===r&&(_=!0);return f?l.len=u: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,d,u,p=t.t_values,f=t.x_values,_=t.y_values,g=[],m=[],b=[],v=[],Z=[],C=[],y=[],P=[],E=0,O=[];for(n=p[1]-p[0],Z.push([]),C.push([]),y.push([]),P.push([]),r=_.length,i=0;i<r;i++)Z[0][i]=f[i],C[0][i]=_[i],y[0][i]=f[i],P[0][i]=_[i];for(Z.push([]),C.push([]),y.push([]),P.push([]),a=n,r=_.length-1,i=0;i<r;i++)g[i]=f[i+1]-f[i],m[i]=_[i+1]-_[i],b[i]=g[i],v[i]=m[i],Z[1][i]=g[i],C[1][i]=m[i],y[1][i]=a/g[i],P[1][i]=a/m[i];for(r--,o=Math.min(8,_.length-1),s=1;s<o;s++){for(Z.push([]),C.push([]),y.push([]),P.push([]),a*=n,i=0;i<r;i++)g[i]=g[i+1]-g[i],m[i]=m[i+1]-m[i],Z[s+1][i]=g[i],C[s+1][i]=m[i],y[s+1][i]=a/(y[s][i+1]-y[s][i])+y[s-1][i+1],P[s+1][i]=a/(P[s][i+1]-P[s][i])+P[s-1][i+1];if(!1===(u=this._criticalPoints(m,r,s))){console.log("Polynomial of degree",s),u=[];break}if(u.length>0&&++E>1&&s%2==0)break;r--}for(i=0;i<u.length;i++){for(l=-1/0,c=0;c<u[i].length;c++)(d=Math.abs(u[i][c].v))>l&&(l=d,h=c);h=Math.floor(u[i][h].i+s/2),O.push(this.getPointType(e,h,p,f,_,b,v,r+1))}return[O,Z,C,y,P]},getCenterOfCriticalInterval:function(t,e,i){var s,r,o,n,a,h=0,l=0,c=i[1]-i[0],d=[];for(s=-1/0,d=[],r=0;r<t.length;r++)(n=Math.abs(t[r].v))>s?(d=[r],s=n,o=r):s===n&&d.push(r);if(d.length>0&&(a=d.reduce((function(t,e){return t+e}),0)/d.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,d,u=t.t_values,p=t.x_values,f=t.y_values,_=[],g=[],m=0,b=-1,v=-1,Z=[],C=[];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&&(v=s,Z=[]),h=this._criticalInterval(_[s+1],r,s),-1===b&&!0===h.smooth&&(b=s),!(v>=0));s++){if(l.groups.length>0&&++m>2&&(s+1)%2==0){Z=l.groups,d=l.types;break}r--}for(i=0;i<Z.length;i++)"interval"!==d[i]&&(a=this.getCenterOfCriticalInterval(Z[i],s+1,u),l[0],n=Math.floor(a[1]),c=a[2],C.push(this.getPointType(e,n,c,u,_,g,r+1)));return[C,_,g,b,v]},_insertPoint_v4:function(t,e,s,r){var o,n,a,h=null;t.points.length>0&&(h=t.points[t.points.length-1].scrCoords),o=new u.Z(i.Z.COORDS_BY_USER,e,t.board),null!==h&&(n=o.scrCoords[1]-h[1])*n+(a=o.scrCoords[2]-h[2])*a<.8*.8||(o._t=s,t.points.push(o))},getInterval:function(e,i,s){var r,o;return n.Z.disable(),r=n.Z.Interval(i,s),e.board.mathLib=n.Z,e.board.mathLibJXG=n.Z,e.X(r,!0),o=e.Y(r,!0),e.board.mathLib=Math,e.board.mathLibJXG=t.Z.Math,o},sign:function(t){return t<0?-1:t>0?1:0},handleBorder:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,_,g,m,b=i.idx;if(m=e.t_values[1]-e.t_values[0],"borderleft"===i.type?h=(a=n=e.left_isNaN?e.left_t:i.t-m)+m:"borderright"===i.type?a=(h=n=e.right_isNaN?e.right_t:i.t+m)-m:console.log("No bordercase!!!"),0!==(_=this.findComponents(t,a,h,32)).length){for("borderleft"===i.type&&(a=_[0].left_t,h=_[0].t_values[0],m=_[0].t_values[1]-_[0].t_values[0],n=a=null===a?h-m:a,l=this.getInterval(t,a,h),s.Z.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][b]<0?p:u,this._insertPoint_v4(t,[1,c,d],n))),g=_[0].t_values.length,f=0;f<g;f++)n=_[0].t_values[f],c=_[0].x_values[f],d=_[0].y_values[f],this._insertPoint_v4(t,[1,c,d],n);"borderright"===i.type&&(a=_[0].t_values[g-1],h=_[0].right_t,m=_[0].t_values[1]-_[0].t_values[0],n=h=null===h?a+m:h,l=this.getInterval(t,a,h),s.Z.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][b]>0?p:u,this._insertPoint_v4(t,[1,c,d],n)))}},_seconditeration_v4:function(t,e,i,s,r){var o,n,a,h,l,c,d,u,p,f,_,g,m;for(n=e.t_values[i.idx-2],a=e.t_values[i.idx+2],l=this.findComponents(t,n,a,64),d=0;d<l.length;d++){for(c=l[d],u=(h=this.differenceMethod(c,t))[0],f=h[1],_=h[2],g=0,p=0;p<=u.length;p++){for(m=p===u.length?c.len:u[p].idx,o=g;o<m;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<u.length&&(this.handleSingularity(t,c,u[p],f,_),g=u[p].idx+1)}m=c.len,d<l.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],c.right_t)}return this},_recurse_v4:function(t,e,i,s,r,n,a,h){var l,c,d=.5*(e+i),u=t.X(d,!0),p=t.Y(d,!0);0!==h?(l=(u-s)*t.board.unitX,c=(p-r)*t.board.unitY,o.Z.hypot(l,c)>2?this._recurse_v4(t,e,d,s,r,u,p,h-1):this._insertPoint_v4(t,[1,u,p],d),l=(u-n)*t.board.unitX,c=(p-a)*t.board.unitY,o.Z.hypot(l,c)>2?this._recurse_v4(t,d,i,u,p,n,a,h-1):this._insertPoint_v4(t,[1,u,p],d)):this._insertPoint_v4(t,[1,NaN,NaN],d)},handleSingularity:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,_,g,m=i.idx,b=100;n=i.t,console.log("HandleSingularity at t =",n),a=e.t_values[m-5],h=e.t_values[m+5],l=this.getInterval(t,a,h),s.Z.isObject(l)?(p=l.lo,f=l.hi):o[0][m-1]<o[0][m+1]?(p=o[0][m-1],f=o[0][m+1]):(p=o[0][m+1],f=o[0][m-1]),u=t.X(n,!0),_=(o[0][m-3]-o[0][m-5])/(e.t_values[m-3]-e.t_values[m-5]),g=(o[0][m+3]-o[0][m+5])/(e.t_values[m+3]-e.t_values[m+5]),console.log(":::",_,g),_<-100?(this._insertPoint_v4(t,[1,u,p],n,!0),g<=b&&this._insertPoint_v4(t,[1,NaN,NaN],n)):_>b?(this._insertPoint_v4(t,[1,u,f],n),g>=-100&&this._insertPoint_v4(t,[1,NaN,NaN],n)):(p===-1/0&&(this._insertPoint_v4(t,[1,u,p],n,!0),this._insertPoint_v4(t,[1,NaN,NaN],n)),f===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],n),this._insertPoint_v4(t,[1,u,f],n,!0)),i.t<e.t_values[m]?(c=m-1,d=m):(c=m,d=m+1),a=e.t_values[c],h=e.t_values[d],this._recurse_v4(t,a,h,r[0][c],o[0][c],r[0][d],o[0][d],10)),g<-100?this._insertPoint_v4(t,[1,u,f],n):g>b&&this._insertPoint_v4(t,[1,u,p],n)},steps:1021,criticalThreshold:1e3,plot_v4:function(t,e,i,r){var o,n,a,h,l,c,u,p,f,_,g,m,b,v,Z,C=(i-e)/r,y=function(e){return t.Y(e,!0)},P=function(e){return-t.Y(e,!0)},E=.5*C;for(a=this.findComponents(t,e,i,r),h=0;h<a.length;h++){for(l=a[h],c=(f=this.differenceMethod(l,t))[0],_=f[1],g=f[2],f[3],f[4],0!==c.length&&"borderleft"===c[0].type||c.unshift({idx:0,t:l.t_values[0],x:l.x_values[0],y:l.y_values[0],type:"borderleft"}),"borderright"!==c[c.length-1].type&&(n=l.t_values.length,c.push({idx:n-1,t:l.t_values[n-1],x:l.x_values[n-1],y:l.y_values[n-1],type:"borderright"})),p=0,u=0;u<=c.length;u++){for(n=u===c.length?l.len:c[u].idx-1,0,0,o=p;o<n-2;o++)this._insertPoint_v4(t,[1,l.x_values[o],l.y_values[o]],l.t_values[o]),Math.max(0,o-2),o>=p+3&&o<n-3&&g.length>3&&Math.abs(g[2][o])>.2*Math.abs(g[0][o])?(m=l.t_values[o],E=.25*C,Z=this.getInterval(t,m,m+C),s.Z.isObject(Z)?g[2][o]>0?this._insertPoint_v4(t,[1,m+E,Z.lo],m+E):this._insertPoint_v4(t,[1,m+C-E,Z.hi],m+C-E):(b=d.Z.fminbr(y,[m,m+C]))<(v=d.Z.fminbr(P,[m,m+C]))?(this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b),this._insertPoint_v4(t,[1,t.X(v,!0),t.Y(v,!0)],v)):(this._insertPoint_v4(t,[1,t.X(v,!0),t.Y(v,!0)],v),this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b))):0;u<c.length&&(o=c[u].idx,"borderleft"===c[u].type||"borderright"===c[u].type?this.handleBorder(t,l,c[u],_,g):this._seconditeration_v4(t,l,c[u],_,g),p=c[u].idx+1+1)}n=l.len,h<a.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],l.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 f=o.Z.Plot;o.Z.ImplicitPlot=function(t,e,i,r,n){var a={resolution_out:5,resolution_in:5,max_steps:1024,alpha_0:.05,tol_u0:o.Z.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=s.Z.merge(a,e),this.f=i,this.dfx=null,this.dfy=null,s.Z.isFunction(r)?this.dfx=r:this.dfx=function(t,e){var i=o.Z.eps*o.Z.eps;return.5*(this.f(t+i,e)-this.f(t-i,e))/i},s.Z.isFunction(n)?this.dfy=n:this.dfy=function(t,e){var i=o.Z.eps*o.Z.eps;return.5*(this.f(t,e+i)-this.f(t,e-i))/i},this.bbox=t,this.qdt=new c(20,5,t),this.components=[]},s.Z.extend(o.Z.ImplicitPlot.prototype,{plot:function(){var t,e,i,s,r,n,a,h=[],l=[],c=[],d=0,u=this,p=function(e){return u.f(t,e)},f=function(e){return-u.f(t,e)},_=function(t){return u.f(t,e)},g=function(t){return-u.f(t,e)};for(i=Math.min(this.bbox[0],this.bbox[2])-o.Z.eps,s=Math.max(this.bbox[0],this.bbox[2]),r=Math.min(this.bbox[1],this.bbox[3])+o.Z.eps,n=Math.max(this.bbox[1],this.bbox[3]),a=this.config.resolution_out/this.config.unitX,a*=1+o.Z.eps,t=i;t<s;t+=a)!1!==(c=this.searchLine(p,f,t,[r,n],"vertical",d,h,l))&&(h=c[0],l=c[1],d=c[2]);for(a=this.config.resolution_out/this.config.unitY,a*=1+o.Z.eps,e=r;e<n;e+=a)!1!==(c=this.searchLine(_,g,e,[i,s],"horizontal",d,h,l))&&(h=c[0],l=c[1],d=c[2]);return[h,l,d]},searchLine:function(t,e,i,s,r,n,a,h){var l,c,u,p,f,_,g,m,b,v,Z,C,y,P,E=this.config.tol_u0,O=s[0],x=s[1];if(f=t(l=d.Z.fminbr(t,[O,x])),_=t(c=d.Z.fminbr(e,[O,x])),f<E&&_>-E){if(g=l,l=Math.min(g,c),c=Math.max(g,c),p=t(u=d.Z.fzero(t,[l,c])),Math.abs(p)>Math.max((_-f)*o.Z.eps,.001))return!1;if("vertical"===r?(b=[1,i,u],P=this.config.resolution_in/this.config.unitY):(b=[1,u,i],P=this.config.resolution_in/this.config.unitX),P*=1+o.Z.eps,this.curveContainsPoint(b,a,h,2*P,this.config.qdt_box))false;else if((C=this.traceComponent(b,1)).length>0){for(n>0&&(a.push(NaN),h.push(NaN)),y=a.length,Z=C[0].length,v=1;v<Z;v++)this.qdt.insertItem({xlb:Math.min(C[0][v-1],C[0][v]),xub:Math.max(C[0][v-1],C[0][v]),ylb:Math.min(C[1][v-1],C[1][v]),yub:Math.max(C[1][v-1],C[1][v]),idx1:y+v-1,idx2:y+v,comp:n});n++,a=a.concat(C[0]),h=h.concat(C[1])}return(m=u-.01*P)-O>P&&!1!==(C=this.searchLine(t,e,i,[O,m],r,n,a,h))&&(a=C[0],h=C[1],n=C[2]),x-(m=u+.01*P)>P&&!1!==(C=this.searchLine(t,e,i,[m,x],r,n,a,h))&&(a=C[0],h=C[1],n=C[2]),[a,h,n]}return!1},curveContainsPoint:function(t,e,i,s,r){var o,n,a,l=t[1],c=t[2];for(n=(a=this.qdt.find([l-r,c+r,l+r,c-r])).length,o=0;o<n;o++)if(h.Z.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<6&&(e.push(e[e.length-1]),i.push(i[i.length-1])),[e,i]},tracing:function(t,e){var i,s,r,n,a,l,c,d,u,p,f,_,g,m,b,v,Z,C=[],y=[],P=[],E=0,O=0,x=!1,w=!1,S=!1,M=this.config.kappa_0,T=this.config.delta_0,N=this.config.alpha_0,A=this.config.h_initial,D=this.config.max_steps,k=e,L=[],R=[],B=[];if(C=t.slice(1),L.push(C[0]),R.push(C[1]),!1===(i=this.tangent(C)))return[];this.dfx(C[0],C[1]),this.dfy(C[0],C[1]);do{if(!1===(i=this.tangent(C))){C=y.slice(),L.push(C[0]),R.push(C[1]);break}if(1===L.length)r=i.slice();else if(2===L.length)B.push(L.length-1);else if(w&&L.length>2&&!S){if(h.Z.distPointSegment([1,C[0],C[1]],[1,L[0],R[0]],[1,L[1],R[1]])<this.config.loop_dist*A&&o.Z.innerProduct(i,r,2)>this.config.loop_dir){C=t.slice(1),L.push(C[0]),R.push(C[1]),x=!0;break}if(this.config.loop_detection){for(m=L.length-1,b=Math.floor(o.Z.log2(m)),v=0;v<=b&&!(h.Z.distPointSegment([1,C[0],C[1]],[1,L[B[v]-1],R[B[v]-1]],[1,L[B[v]],R[B[v]]])<this.config.loop_dist*A&&(s=this.tangent([L[B[v]],R[B[v]]]),o.Z.innerProduct(i,s,2)>this.config.loop_dir));v++);if(v<=b){x=!0;break}for(b=1,Z=0,v=0;v<100&&(m+1)%b==0;v++)b*=2,Z++;B[Z]=m}}y[0]=C[0]+A*k*i[0],y[1]=C[1]+A*k*i[1],O=0;do{u=(n=[this.dfx(y[0],y[1]),this.dfy(y[0],y[1])])[0]*n[0]+n[1]*n[1],a=this.f(y[0],y[1])/u,P[0]=y[0]-n[0]*a,P[1]=y[1]-n[1]*a,0===O?c=Math.abs(a)*Math.sqrt(u):1===O&&(d=Math.abs(a)*Math.sqrt(u)),y[0]=P[0],y[1]=P[1],O++}while(O<20&&Math.abs(this.f(y[0],y[1]))>this.config.tol_newton);if(f=c,p=O>1?d/c:0,s=this.tangent(y),l=o.Z.innerProduct(i,s,2),l=Math.max(-1,Math.min(1,l)),_=Math.acos(l),S=!1,h.Z.distance(C,y,2)<this.config.tol_progress){C=y.slice(),L.push(C[0]),R.push(C[1]);break}if(l<0)if(A>this.config.h_critical);else{if(S=!0,!this.isBifurcation(C,this.config.tol_cusp)){C=y.slice(),L.push(C[0]),R.push(C[1]);break}k*=-1,_=0}if(!S&&(g=Math.max(Math.sqrt(p/M),Math.sqrt(f/T),_/N),isNaN(g)&&(g=1),A/=g=Math.max(Math.min(g,2),.5),A=Math.min(this.config.h_max,A),g>=2)){if(++E>=3*D)break;w=!1}else C=y.slice(),L.push(C[0]),R.push(C[1]),w=!0,E++}while(E<D&&C[0]>=this.bbox[0]&&C[1]<=this.bbox[1]&&C[0]<=this.bbox[2]&&C[1]>=this.bbox[3]);return[L,R,x]},isBifurcation:function(t,e){var i,s,r,n,a,h,l,c,d,u,p=o.Z.eps*o.Z.eps*100;return i=t[0],s=t[1],r=.5*(this.dfx(i+p,s)-this.dfx(i-p,s))/p,n=.5*(this.dfx(i,s+p)-this.dfx(i,s-p))/p,a=.5*(this.dfy(i+p,s)-this.dfy(i-p,s))/p,u=(l=r+(h=.5*(this.dfy(i,s+p)-this.dfy(i,s-p))/p))*l-4*(r*h-n*a),c=.5*(l+Math.sqrt(u)),d=.5*(l-Math.sqrt(u)),Math.abs(c)>e&&Math.abs(d)>e},handleCriticalPoint:function(t,e,i,s){var r,o=Math.atan2(s*e[1],s*e[0]);return r=d.Z.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=o.Z.norm(e,2);return o.Z.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=o.Z.norm(e,2);return!(i<o.Z.eps*o.Z.eps)&&[e[0]/i,e[1]/i]}});var _=o.Z.ImplicitPlot;o.Z.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,d,u,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,u=[],p=[],f=[],_=[null];c=h.next,u.push(c.x-h.x),p.push(c.y-h.y),f.push(this.mp_pyth_add(u[s],p[s])),s>0&&(d=p[s-1]/f[s-1],l=u[s-1]/f[s-1],_.push(Math.atan2(p[s]*l-u[s]*d,u[s]*l+p[s]*d))),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,u,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,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N,A;for(d=o.length+1,g=new Array(d),_=new Array(d),l=new Array(d),C=new Array(d),N=0;N<d;N++)C[N]=l[N]=_[N]=g[N]=0;for(p=0,f=t,b=0;;){if(v=f.next,0===p)if(f.rtype===this.MP_GIVEN){if(v.ltype===this.MP_GIVEN)return a=Math.atan2(r[0],s[0]),x=(O=this.mp_n_sin_cos(t.right_given()-a))[0],w=O[1],M=(S=this.mp_n_sin_cos(e.left_given()-a))[0],T=S[1],void this.mp_set_controls(t,e,s[0],r[0],w,x,-T,M);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(v.ltype===this.MP_CURL)return t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT,m=Math.abs(e.left_tension()),y=Math.abs(t.right_tension()),Z=this.UNITY/(3*y),t.rx=t.x+s[0]*Z,t.ry=t.y+r[0]*Z,Z=this.UNITY/(3*m),e.lx=e.x-s[0]*Z,void(e.ly=e.y-r[0]*Z);E=f.right_curl(),m=Math.abs(v.left_tension()),y=Math.abs(f.right_tension()),g[0]=this.mp_curl_ratio(E,y,m),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(b.right_tension())-this.UNITY),P=o[p]*(this.FRACTION_THREE-this.UNITY/Math.abs(b.right_tension())),c=this.UNITY/(3*Math.abs(v.left_tension())-this.UNITY),u=o[p-1]*(this.FRACTION_THREE-this.UNITY/Math.abs(v.left_tension())),P*=E=this.FRACTION_ONE-g[p-1]*a,(m=Math.abs(f.left_tension()))<(y=Math.abs(f.right_tension()))?P*=Math.pow(m/y,2):m>y&&(u*=Math.pow(y/m,2)),Z=u/(u+P),g[p]=Z*c,h=-n[p+1]*g[p],b.rtype===this.MP_CURL?(_[p]=0,l[p]=h-n[1]*(this.FRACTION_ONE-Z)):(Z=(this.FRACTION_ONE-Z)/E,h-=n[p]*Z,Z*=a,l[p]=h-l[p-1]*Z,_[p]=-_[p-1]*Z),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,C[i]=a,l[0]=a,A=1;A<i;A++)l[A]=l[A]+a*_[A];break}}else{if(f.ltype===this.MP_CURL){E=f.left_curl(),m=Math.abs(f.left_tension()),y=Math.abs(b.right_tension()),Z=this.mp_curl_ratio(E,m,y),C[i]=-l[i-1]*Z/(this.FRACTION_ONE-Z*g[i-1]);break}if(f.ltype===this.MP_GIVEN){C[i]=f.left_given()-Math.atan2(r[i-1],s[i-1]),C[i]=this.reduce_angle(C[i]);break}}b=f,f=v,p+=1}for(p=i-1;p>-1;p--)C[p]=l[p]-C[p+1]*g[p];for(f=t,p=0;v=f.next,x=(O=this.mp_n_sin_cos(C[p]))[0],w=O[1],M=(S=this.mp_n_sin_cos(-n[p+1]-C[p+1]))[0],T=S[1],this.mp_set_controls(f,v,s[p],r[p],w,x,T,M),f=v,++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,d,u;c=Math.abs(e.left_tension()),h=Math.abs(t.right_tension()),u=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)&&(d=Math.abs(r)*a+Math.abs(n)*o)>0&&(d*=1.00024414062,t.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,u,d)<0&&(u=Math.abs(n)/d),e.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(r),this.FRACTION_ONE,l,d)<0&&(l=Math.abs(r)/d)),t.rx=t.x+(i*o-s*r)*u,t.ry=t.y+(s*o+i*r)*u,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 o.Z.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,r,o,n,a,h,l=!1,c=[],d=[];for(n in a=1,(e=e||{tension:1,direction:{},curl:{},isClosed:!1}).hasOwnProperty("tension")&&(a=s.Z.evaluate(e.tension)),r=(i=this.makeknots(t,a)).length,s.Z.exists(e.isClosed)&&s.Z.evaluate(e.isClosed)&&(l=!0),l||(i[0].ltype=this.MP_ENDPOINT,i[0].rtype=this.MP_CURL,i[r-1].rtype=this.MP_ENDPOINT,i[r-1].ltype=this.MP_CURL),e)if(e.hasOwnProperty(n)){if(o=parseInt(n,10),isNaN(o)||o<0||o>=r)continue;if(h=e[o],s.Z.exists(h.type)&&"curl"===h.type)a=s.Z.evaluate(h.curl),0===o?(i[o].rtype=this.MP_CURL,i[o].set_right_curl(a)):o===r-1?(i[o].ltype=this.MP_CURL,i[o].set_left_curl(a)):(i[o].ltype=this.MP_CURL,i[o].rtype=this.MP_CURL,i[o].lx=a,i[o].rx=a);s.Z.exists(h.direction)&&(a=s.Z.evaluate(h.direction),s.Z.isArray(a)?(!1!==a[0]&&(i[o].lx=a[0]*Math.PI/180,i[o].ltype=this.MP_GIVEN),!1!==a[1]&&(i[o].rx=a[1]*Math.PI/180,i[o].rtype=this.MP_GIVEN)):(i[o].lx=a*Math.PI/180,i[o].rx=a*Math.PI/180,i[o].ltype=i[o].rtype=this.MP_GIVEN)),s.Z.exists(h.tension)&&(a=s.Z.evaluate(h.tension),s.Z.isArray(a)?(!1!==a[0]&&(i[o].ly=s.Z.evaluate(a[0])),!1!==a[1]&&(i[o].ry=s.Z.evaluate(a[1]))):(i[o].ly=a,i[o].ry=a))}for(this.make_choices(i),o=0;o<r-1;o++)c.push(i[o].x),c.push(i[o].rx),c.push(i[o+1].lx),d.push(i[o].y),d.push(i[o].ry),d.push(i[o+1].ly);return c.push(i[r-1].x),d.push(i[r-1].y),l&&(c.push(i[r-1].rx),d.push(i[r-1].ry),c.push(i[0].lx),d.push(i[0].ly),c.push(i[0].x),d.push(i[0].y)),[c,d]}};var g=o.Z.Metapost,m=[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],b=[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],v=[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],Z=[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],C=[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],y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];t.Z.Util=t.Z.Util||{},t.Z.Util.Unzip=function(e){var i,s,r,o,n=[],a=0,h=[],l=new Array(32768),c=0,d=!1,u=e.length,p=0,f=1,_=new Array(288),g=new Array(32),P=0,E=null,O=0,x=new Array(17),w=[];function S(){return p<u?e[p++]:-1}function M(){f=1}function T(){var t;try{t=1&f,0===(f>>=1)&&(t=1&(f=S()),f=f>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function N(t){var e=0,i=t;try{for(;i--;)e=e<<1|T();t&&(e=m[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function A(){c=0}function D(t){l[c++]=t,n.push(String.fromCharCode(t)),32768===c&&(c=0)}function k(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function L(){for(;;){if(x[O]>=o)return-1;if(r[x[O]]===O)return x[O]++;x[O]++}}function R(){var t,e=E[P];if(17===O)return-1;if(P++,O++,(t=L())>=0)e.b0=t;else if(e.b0=32768,R())return-1;if((t=L())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=E[P],e.jumppos=P,R())return-1;return O--,0}function B(t,e,i,s){var n;for(E=t,P=0,r=i,o=e,n=0;n<17;n++)x[n]=0;return O=0,R()?-1:0}function I(t){for(var e,i,s=0,r=t[s];;)if(T()){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 Y(){var e,i,s,r,o,n,a,h,d,u,p,f,P,E,O;do{if(e=T(),0===(i=N(2)))for(M(),d=S(),d|=S()<<8,p=S(),65535&(d^~(p|=S()<<8))&&t.Z.debug("BlockLen checksum mismatch\n");d--;)D(S());else if(1===i)for(;;)if((r=m[N(7)]>>1)>23?(r=r<<1|T())>199?r=(r-=128)<<1|T():(r-=48)>143&&(r+=136):r+=256,r<256)D(r);else{if(256===r)break;for(h=N(v[r-=257])+b[r],r=m[N(5)]>>3,C[r]>8?(u=N(8),u|=N(C[r]-8)<<8):u=N(C[r]),u+=Z[r],r=0;r<h;r++)D(l[c-u&32767])}else if(2===i){for(n=new Array(320),P=257+N(5),E=1+N(5),O=4+N(4),r=0;r<19;r++)n[r]=0;for(r=0;r<O;r++)n[y[r]]=N(3);for(h=g.length,s=0;s<h;s++)g[s]=new k;if(B(g,19,n))return A(),1;for(f=P+E,s=0;s<f;)if((r=I(g))<16)n[s++]=r;else if(16===r){if(s+(r=3+N(2))>f)return A(),1;for(o=s?n[s-1]:0;r--;)n[s++]=o}else{if(s+(r=17===r?3+N(3):11+N(7))>f)return A(),1;for(;r--;)n[s++]=0}for(h=_.length,s=0;s<h;s++)_[s]=new k;if(B(_,P,n))return A(),1;for(h=_.length,s=0;s<h;s++)g[s]=new k;for(a=[],s=P;s<n.length;s++)a[s-P]=n[s];if(B(g,E,a))return A(),1;for(;;)if((r=I(_))>=256){if(0===(r-=256))break;for(h=N(v[r-=1])+b[r],r=I(g),C[r]>8?(u=N(8),u|=N(C[r]-8)<<8):u=N(C[r]),u+=Z[r];h--;)D(l[c-u&32767])}else D(r)}}while(!e);return A(),M(),0}function j(){var t,e,r,o,l,c=[];try{if(n=[],d=!1,c[0]=S(),c[1]=S(),120===c[0]&&218===c[1]&&(Y(),h[a]=[n.join(""),"geonext.gxt"],a++),31===c[0]&&139===c[1]&&(X(),h[a]=[n.join(""),"file"],a++),80===c[0]&&75===c[1]){if(d=!0,c[2]=S(),c[3]=S(),3===c[2]&&4===c[3]){for(c[0]=S(),c[1]=S(),i=S(),i|=S()<<8,l=S(),l|=S()<<8,S(),S(),S(),S(),S(),S()<<8,S()<<16,S()<<24,S(),S()<<8,S()<<16,S()<<24,S(),S()<<8,S()<<16,S()<<24,o=S(),o|=S()<<8,r=S(),r|=S()<<8,t=0,w=[];o--;)"/"===(e=S())|":"===e?t=0:t<255&&(w[t++]=String.fromCharCode(e));for(s||(s=w),t=0;t<r;)e=S(),t++;if(8===l&&(Y(),h[a]=new Array(2),h[a][0]=n.join(""),h[a][1]=w.join(""),a++),X())return!1}return!0}}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return!1}function X(){var t,e,s=[];if(8&i&&(s[0]=S(),s[1]=S(),s[2]=S(),s[3]=S(),80===s[0]&&75===s[1]&&7===s[2]&&8===s[3]?(S(),S()<<8,S()<<16,S()<<24):s[0]|s[1]<<8|s[2]<<16|s[3]<<24,S(),S()<<8,S()<<16,S()<<24,S(),S()<<8,S()<<16,S()<<24),d&&j())return!1;if(s[0]=S(),8!==s[0])return!0;if(i=S(),S(),S(),S(),S(),S(),S(),4&i)for(s[0]=S(),s[2]=S(),O=s[0]+256*s[1],t=0;t<O;t++)S();if(8&i)for(t=0,w=[],e=S();e;)"7"!==e&&":"!==e||(t=0),t<255&&(w[t++]=e),e=S();if(16&i)for(e=S();e;)e=S();return 2&i&&(S(),S()),Y(),S(),S()<<8,S()<<16,S()<<24,S(),S()<<8,S()<<16,S()<<24,d&&j(),!1}x[0]=0,t.Z.Util.Unzip.prototype.unzipFile=function(t){var e;for(this.unzip(),e=0;e<h.length;e++)if(h[e][1]===t)return h[e][0];return""},t.Z.Util.Unzip.prototype.unzip=function(){return j(),h}};var P=t.Z.Util,E=[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];t.Z.Util=t.Z.Util||{},t.Z.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=0,a=[],h=t.length,l=[];for(e=0;e<h;e++)i=t.charCodeAt(e),s=E[i],o=0!==n?63&i|o<<6:255>>s&i,0===(n=E[256+n+s])&&(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 O=t.Z.Util.UTF8,x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w="=";t.Z.Util=t.Z.Util||{},t.Z.Util.Base64={_getByte:function(t,e){return 255&t.charCodeAt(e)},_getIndex:function(t,e){return x.indexOf(t.charAt(e))},encode:function(t){var e,i,s,r,o,n=[];for(r=(s=(o=O.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(x.charAt(i>>18),x.charAt(i>>12&63),x.charAt(i>>6&63),x.charAt(63&i));switch(r){case 1:i=this._getByte(o,s-1),n.push(x.charAt(i>>2),x.charAt(i<<4&63),w,w);break;case 2:i=this._getByte(o,s-2)<<8|this._getByte(o,s-1),n.push(x.charAt(i>>10),x.charAt(i>>4&63),x.charAt(i<<2&63),w)}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)===w&&(o=1,i.charAt(r-2)===w&&(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=O.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 S=t.Z.Util.Base64;t.Z.Server={modules:{},runningCalls:{},handleError:function(e){t.Z.debug("error occured, server says: "+e.message)},callServer:function(e,i,r,o){var n,a,h,l,c,d;o=o||!1,c=s.Z.toJSON(r);do{l=e+Math.floor(4096*Math.random())}while(s.Z.exists(this.runningCalls[l]));return this.runningCalls[l]={action:e},s.Z.exists(r.module)&&(this.runningCalls[l].module=r.module),n=t.Z.serverBase+"JXGServer.py",a="action="+escape(e)+"&id="+l+"&dataJSON="+escape(S.encode(c)),this.cbp=function(t){var e,r,o,n,a,h,l,c;if(e=new P.Unzip(S.decodeAsArray(t)).unzip(),s.Z.isArray(e)&&e.length>0&&(e=e[0][0]),s.Z.exists(e))if("error"===(r=window.JSON&&window.JSON.parse?window.JSON.parse(e):new Function("return "+e)()).type)this.handleError(r);else if("response"===r.type){for(h=r.id,l=0;l<r.fields.length;l++)n=(o=r.fields[l]).namespace+("object"==typeof new Function("return "+o.namespace)()?".":".prototype.")+o.name+" = "+o.value,new Function(n)();for(l=0;l<r.handler.length;l++){for(o=r.handler[l],a=[],c=0;c<o.parameters.length;c++)a[c]='"'+o.parameters[c]+'": '+o.parameters[c];n="if(typeof JXG.Server.modules."+this.runningCalls[h].module+' == "undefined")JXG.Server.modules.'+this.runningCalls[h].module+" = {};",n+="JXG.Server.modules."+this.runningCalls[h].module+"."+o.name+"_cb = "+o.callback+";",n+="JXG.Server.modules."+this.runningCalls[h].module+"."+o.name+" = function ("+o.parameters.join(",")+', __JXGSERVER_CB__, __JXGSERVER_SYNC) {if(typeof __JXGSERVER_CB__ == "undefined") __JXGSERVER_CB__ = JXG.Server.modules.'+this.runningCalls[h].module+"."+o.name+"_cb;var __JXGSERVER_PAR__ = {"+a.join(",")+', "module": "'+this.runningCalls[h].module+'", "handler": "'+o.name+'" };JXG.Server.callServer("exec", __JXGSERVER_CB__, __JXGSERVER_PAR__, __JXGSERVER_SYNC);};',new Function(n)()}delete this.runningCalls[h],i(r.data)}},this.cb=t.Z.bind(this.cbp,this),window.XMLHttpRequest?(h=new XMLHttpRequest).overrideMimeType("text/plain; charset=iso-8859-1"):h=new ActiveXObject("Microsoft.XMLHTTP"),!(!h||(h.open("POST",n,!o),h.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o||(h.onreadystatechange=(d=this.cb,function(){return 4===h.readyState&&200===h.status&&(d(h.responseText),!0)})),h.send(a),!o))&&(this.cb(h.responseText),!0)},loadModule_cb:function(e){var i;for(i=0;i<e.length;i++)t.Z.debug(e[i].name+": "+e[i].value)},loadModule:function(e){return t.Z.Server.callServer("load",t.Z.Server.loadModule_cb,{module:e},!0)}},t.Z.Server.load=t.Z.Server.loadModule;var M,T=t.Z.Server;o.Z.Symbolic={generateSymbolicCoordinatesPartial:function(t,e,i,r){var o,n,a,h=e.ancestors,l=0,c=function(t){return"underscore"===r?i+"_{"+t+"}":"brace"===r?i+"["+t+"]":i+t};for(n in t.listOfFreePoints=[],t.listOfDependantPoints=[],h)if(h.hasOwnProperty(n)&&(o=0,s.Z.isPoint(h[n]))){for(a in h[n].ancestors)h[n].ancestors.hasOwnProperty(a)&&o++;0===o?(h[n].symbolic.x=h[n].coords.usrCoords[1],h[n].symbolic.y=h[n].coords.usrCoords[2],t.listOfFreePoints.push(h[n])):(l+=1,h[n].symbolic.x=c(l),l+=1,h[n].symbolic.y=c(l),t.listOfDependantPoints.push(h[n]))}return s.Z.isPoint(e)&&(e.symbolic.x="x",e.symbolic.y="y"),l},clearSymbolicCoordinates:function(t){var e=function(t){var e,i=t&&t.length||0;for(e=0;e<i;e++)s.Z.isPoint(t[e])&&(t[e].symbolic.x="",t[e].symbolic.y="")};e(t.listOfFreePoints),e(t.listOfDependantPoints),delete t.listOfFreePoints,delete t.listOfDependantPoints},generatePolynomials:function(t,e,i){var r,o,n,a,h=e.ancestors,l=[],c=[];for(r in i&&this.generateSymbolicCoordinatesPartial(t,e,"u","brace"),h[e.id]=e,h)if(h.hasOwnProperty(r)&&(a=0,l=[],s.Z.isPoint(h[r]))){for(o in h[r].ancestors)h[r].ancestors.hasOwnProperty(o)&&a++;if(a>0)for(l=h[r].generatePolynomial(),n=0;n<l.length;n++)c.push(l[n])}return i&&this.clearSymbolicCoordinates(t),c},geometricLocusByGroebnerBase:function(t,e){var r,n,a,l,c,d,p,f,_,g,m,b,v=t.options.locus,Z={},C=this.generateSymbolicCoordinatesPartial(t,e,"u","brace"),y=new u.Z(i.Z.COORDS_BY_USR,[0,0],t),P=new u.Z(i.Z.COORDS_BY_USR,[t.canvasWidth,t.canvasHeight],t),E=1,O=0,x=0,w=0;if(T.modules.geoloci===M&&T.loadModule("geoloci"),T.modules.geoloci===M)throw new Error("JSXGraph: Unable to load JXG.Server module 'geoloci.py'.");if(d=y.usrCoords[1],p=P.usrCoords[1],f=P.usrCoords[2],_=y.usrCoords[2],v.translateToOrigin&&t.listOfFreePoints.length>0){for(O=(a=v.toOrigin!==M&&null!==v.toOrigin&&s.Z.isInArray(t.listOfFreePoints,v.toOrigin.id)?v.toOrigin:t.listOfFreePoints[0]).symbolic.x,x=a.symbolic.y,c=0;c<t.listOfFreePoints.length;c++)t.listOfFreePoints[c].symbolic.x-=O,t.listOfFreePoints[c].symbolic.y-=x;if(d-=O,p-=O,f-=x,_-=x,v.translateTo10&&t.listOfFreePoints.length>1){for(l=v.to10!==M&&null!==v.to10&&v.to10.id!==v.toOrigin.id&&s.Z.isInArray(t.listOfFreePoints,v.to10.id)?v.to10:t.listOfFreePoints[0].id===a.id?t.listOfFreePoints[1]:t.listOfFreePoints[0],w=h.Z.rad([1,0],[0,0],[l.symbolic.x,l.symbolic.y]),g=Math.cos(-w),m=Math.sin(-w),c=0;c<t.listOfFreePoints.length;c++)b=t.listOfFreePoints[c].symbolic.x,t.listOfFreePoints[c].symbolic.x=g*t.listOfFreePoints[c].symbolic.x-m*t.listOfFreePoints[c].symbolic.y,t.listOfFreePoints[c].symbolic.y=m*b+g*t.listOfFreePoints[c].symbolic.y;if(l.symbolic.y=0,b=d,d=g*d-m*f,f=m*b+g*f,b=p,p=g*p-m*_,_=m*b+g*_,v.stretch&&Math.abs(l.symbolic.x)>o.Z.eps){for(E=l.symbolic.x,c=0;c<t.listOfFreePoints.length;c++)t.listOfFreePoints[c].symbolic.x/=E,t.listOfFreePoints[c].symbolic.y/=E;for(c=0;c<t.objectsList.length;c++)t.objectsList[c].elementClass===i.Z.OBJECT_CLASS_CIRCLE&&"pointRadius"===t.objectsList[c].method&&(Z[c]=t.objectsList[c].radius,t.objectsList[c].radius/=E);d/=E,p/=E,f/=E,_/=E,l.symbolic.x=1}}for(c=0;c<t.listOfFreePoints.length;c++)b=t.listOfFreePoints[c].symbolic.x,Math.abs(b)<o.Z.eps&&(t.listOfFreePoints[c].symbolic.x=0),Math.abs(b-Math.round(b))<o.Z.eps&&(t.listOfFreePoints[c].symbolic.x=Math.round(b)),b=t.listOfFreePoints[c].symbolic.y,Math.abs(b)<o.Z.eps&&(t.listOfFreePoints[c].symbolic.y=0),Math.abs(b-Math.round(b))<o.Z.eps&&(t.listOfFreePoints[c].symbolic.y=Math.round(b))}for(c in r=this.generatePolynomials(t,e).join(","),this.cbp=function(t){n=t},this.cb=s.Z.bind(this.cbp,this),T.modules.geoloci.lociCoCoA(d,p,f,_,C,r,E,w,O,x,this.cb,!0),this.clearSymbolicCoordinates(t),Z)Z.hasOwnProperty(c)&&(t.objects[c].radius=Z[c]);return n}};var N=o.Z.Symbolic;o.Z.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,s,r,o,n){this.pos=e,this.intersection=!0,this.coords=t,this.elementClass=i.Z.OBJECT_CLASS_POINT,this.data={alpha:s,path:r,pathname:o,done:!1,type:n,idx:0},this.neighbour=null,this.entry_exit=!1},_addToList:function(t,e,s){var r=t.length,n=o.Z.eps*o.Z.eps;r>0&&Math.abs(t[r-1].coords.usrCoords[0]-e.usrCoords[0])<n&&Math.abs(t[r-1].coords.usrCoords[1]-e.usrCoords[1])<n&&Math.abs(t[r-1].coords.usrCoords[2]-e.usrCoords[2])<n||t.push({pos:s,intersection:!1,coords:e,elementClass:i.Z.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=o.Z.eps*o.Z.eps,n=i[1]-e[1],a=i[2]-e[2],h=t[1]-e[1],l=t[2]-e[2];return 0===n&&0===a&&0===h&&0===l||(s=Math.abs(h)<r&&Math.abs(n)<r?l/a:h/n,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,n,a,h,l,c=Math.sqrt(o.Z.eps),d=!1;for(r=0;r<3;r++)if(n=Math.min(t[r],e[r]),a=Math.max(t[r],e[r]),h=Math.min(i[r],s[r]),l=Math.max(i[r],s[r]),a<h-c||n>l+c){d=!0;break}return d},findIntersections:function(t,e,s){var r,n,a,l,c,d,p,f,_,g,m,b,v,Z=[],C=100*o.Z.eps,y=t.length,P=e.length,E=[],O=[],x=[],w=!1,S=!1,M=!1;for(n=0;n<P;n++)x.push([]);for(r=0;r<y;r++)if(O.push([]),this._isSeparator(t[r])||this._isSeparator(t[(r+1)%y]))w=!0;else{if(w&&r===y-1)break;for(l=t[r].coords.usrCoords,c=t[(r+1)%y].coords.usrCoords,n=0;n<P;n++)if(this._isSeparator(e[n])||this._isSeparator(e[(n+1)%P]))S=!0;else{if(S&&n===P-1)break;if(d=e[n].coords.usrCoords,p=e[(n+1)%P].coords.usrCoords,!this._noOverlap(l,c,d,p)&&(Z=h.Z.meetSegmentSegment(l,c,d,p),f=h.Z.distance(l,c,3),_=h.Z.distance(d,p,3),Z[1]*f>-C&&Z[1]<1-C/f&&Z[2]*_>-C&&Z[2]<1-C/_||Z[1]===1/0&&Z[2]===1/0&&o.Z.norm(Z[0],3)<C)){if(a=new u.Z(i.Z.COORDS_BY_USER,Z[0],s),m="X",Math.abs(Z[1])*f<C||Math.abs(Z[2])*_<C)m="T",Math.abs(Z[1])*f<C&&(Z[1]=0),Math.abs(Z[2])*_<C&&(Z[2]=0),a=0===Z[1]?new u.Z(i.Z.COORDS_BY_USER,l,s):new u.Z(i.Z.COORDS_BY_USER,d,s);else if(Z[1]===1/0&&Z[2]===1/0&&o.Z.norm(Z[0],3)<C){(g=this._inbetween(l,d,p))>=0&&g<1&&(m="T",a=new u.Z(i.Z.COORDS_BY_USER,l,s),Z[1]=0,Z[2]=g,b=new this.Vertex(a,r,Z[1],t,"S",m),v=new this.Vertex(a,n,Z[2],e,"C",m),b.neighbour=v,v.neighbour=b,O[r].push(b),x[n].push(v)),g=this._inbetween(d,l,c),h.Z.distance(l,d,3)>C&&g>=0&&g<1&&(m="T",a=new u.Z(i.Z.COORDS_BY_USER,d,s),Z[1]=g,Z[2]=0,b=new this.Vertex(a,r,Z[1],t,"S",m),v=new this.Vertex(a,n,Z[2],e,"C",m),b.neighbour=v,v.neighbour=b,O[r].push(b),x[n].push(v));continue}M,b=new this.Vertex(a,r,Z[1],t,"S",m),v=new this.Vertex(a,n,Z[2],e,"C",m),b.neighbour=v,v.neighbour=b,O[r].push(b),x[n].push(v)}}}for(E=this.sortIntersections(O),r=0;r<E.length;r++)E[r].data.idx=r,E[r].neighbour.data.idx=r;return[E,this.sortIntersections(x)]},_getPosition:function(t,e,i,s){var r=h.Z.det3p(t,e,i),o=h.Z.det3p(t,i,s);return h.Z.det3p(e,i,s)>=0?r>=0&&o>=0?"left":"right":r>=0||o>=0?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,r,n,a,l,c,d,u,p,f,_,g,m,b=!1;for(b,u=h.Z.det3p,c=0,t._tours=0;;){if(t.intersection&&"T"===t.data.type&&(e=t._next.coords.usrCoords,i=t._prev.coords.usrCoords,h.Z.distance(t.coords.usrCoords,e,3)<o.Z.eps&&(e=t._next._next.coords.usrCoords),h.Z.distance(t.coords.usrCoords,i,3)<o.Z.eps&&(i=t._prev._prev.coords.usrCoords),n=(a=t.neighbour)._prev.coords.usrCoords,r=a._next.coords.usrCoords,h.Z.distance(a.coords.usrCoords,r,3)<o.Z.eps&&(r=a._next._next.coords.usrCoords),h.Z.distance(a.coords.usrCoords,n,3)<o.Z.eps&&(n=a._prev._prev.coords.usrCoords),f=u(t.coords.usrCoords,i,n),_=u(t.coords.usrCoords,e,r),g=u(t.coords.usrCoords,i,r),m=u(t.coords.usrCoords,e,n),0===f&&0===_&&0===g&&0===m&&(t.coords.usrCoords[1]*=1+Math.random()*o.Z.eps,t.coords.usrCoords[2]*=1+Math.random()*o.Z.eps,a.coords.usrCoords[1]=t.coords.usrCoords[1],a.coords.usrCoords[2]=t.coords.usrCoords[2],f=u(t.coords.usrCoords,i,n),_=u(t.coords.usrCoords,e,r),g=u(t.coords.usrCoords,i,r),m=u(t.coords.usrCoords,e,n)),p=!1,0===f?h.Z.affineRatio(t.coords.usrCoords,i,n)<0&&(p=!0):0===_?h.Z.affineRatio(t.coords.usrCoords,e,r)<0&&(p=!0):0===g?h.Z.affineRatio(t.coords.usrCoords,i,r)>0&&(p=!0):0===m&&h.Z.affineRatio(t.coords.usrCoords,e,n)>0&&(p=!0),p&&(d=n,n=r,r=d,d=f,f=g,g=d,d=_,_=m,m=d),s.Z.exists(t.delayedStatus)||(t.delayedStatus=[]),0===f&&0===_?t.delayedStatus=["on","on"]:0===f?(l=this._getPosition(e,n,a.coords.usrCoords,r),t.delayedStatus=["on",l]):0===_?(l=this._getPosition(i,n,a.coords.usrCoords,r),t.delayedStatus=[l,"on"]):0===t.delayedStatus.length&&(this._getPosition(i,n,a.coords.usrCoords,r)!==this._getPosition(e,n,a.coords.usrCoords,r)?t.data.type="X":t.data.type="B")),s.Z.exists(t._tours)&&t._tours++,t._tours>3||t._end||c>1e3){c>1e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),s.Z.exists(t._tours)&&delete t._tours;break}t.intersection&&c++,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,s){var r,n,a,l,c,d,p,f,_,g,m,b,v,Z,C=[t,e];for(a=0;a<2;a++){for(g=(r=C[a]).length,f=0,Z=!0;f<g;f++)if(!r[f].intersection){Z=!1;break}if(Z)for(m=(n=C[(a+1)%2]).length,f=0;f<g;f++){for(c=r[f].coords.usrCoords,d=r[f]._next.coords.usrCoords,l=[.5*(c[0]+d[0]),.5*(c[1]+d[1]),.5*(c[2]+d[2])],_=0,b=!1;_<m;_++)if(Math.abs(h.Z.det3p(n[_].coords.usrCoords,n[(_+1)%m].coords.usrCoords,l))<o.Z.eps){b=!0;break}if(!b){p={pos:f,intersection:!1,coords:new u.Z(i.Z.COORDS_BY_USER,l,s),elementClass:i.Z.OBJECT_CLASS_POINT},v=r[f]._next,r[f]._next=p,p._prev=r[f],p._next=v,v._prev=p,r[f]._end&&(r[f]._end=!1,p._end=!0);break}}}},_getStatus:function(t,e){for(;t.intersection&&!t._end;)t=t._next;return[t,0===h.Z.windingNumber(t.coords.usrCoords,e)?"entry":"exit"]},markEntryExit:function(t,e,i){var r,o,n,a,h,l,c,d=null,u=0;for(l=i.length,h=0;h<l;h++)for(c=i[h],this._classifyDegenerateIntersections(t[c]),this._handleIntersectionChains(t[c]),o=(a=this._getStatus(t[c],e))[0],r=a[1],o._starter=!0,n=0,d=null,u=0;!0===o.intersection&&("X"===o.data.type&&1===u&&(d.entry_exit=r,"exit"===r&&(d.data.type="X"),u=2),"X"!==o.data.type&&"DB"!==o.data.type||(o.entry_exit=r,r="entry"===r?"exit":"entry"),"DX"===o.data.type&&(0===u?(d=o,u=1):1===u?(o.entry_exit=r,d.entry_exit=r,"exit"===r?d.data.type="X":o.data.type="X",r="entry"===r?"exit":"entry",d=null,u=0):2===u&&(o.entry_exit=r,o.data.type="X",r="entry"===r?"exit":"entry",d=null,u=0))),o=o._next,!(s.Z.exists(o._starter)||n>1e4);)n++},_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=[],d=!1,u=!1;for(u;l<e.length&&a<h;)if((o=e[l]).data.done||"X"!==o.data.type)l++;else{u,c.length>0&&c.push([NaN,NaN]),n=o.data.idx,s=t,d=this._addVertex(c,o,u),r=o.entry_exit;do{if(d)break;if("intersection"===i&&"entry"===o.entry_exit||"union"===i&&"exit"===o.entry_exit||"difference"===i&&s===t==("exit"===o.entry_exit)){u;do{if(o=o._next,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}else{u;do{if(o=o._prev,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}if(d)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===h.Z.windingNumber(s.coords.usrCoords,e)?0!==h.Z.windingNumber(r.coords.usrCoords,t)?("union"===i?(n=n.concat(t)).push(t[0]):"difference"===i&&((n=n.concat(t)).push(t[0]),h.Z.signedPolygon(t)*h.Z.signedPolygon(e)>0&&n.reverse(),n.push([NaN,NaN])),"difference"!==i&&"intersection"!==i||((n=n.concat(e)).push(e[0]),o=!1)):"difference"===i?(n=n.concat(t),o=!0):"union"===i&&((n=n.concat(t)).push(t[0]),n.push([NaN,NaN]),(n=n.concat(e)).push(e[0])):"intersection"===i?(n=n.concat(t),o=!0):"union"===i&&(n=n.concat(e)).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 r,o,n,a,l,c,d,p=[];if(t.elementClass!==i.Z.OBJECT_CLASS_CURVE||t.type!==i.Z.OBJECT_TYPE_ARC&&t.type!==i.Z.OBJECT_TYPE_SECTOR){if(t.elementClass===i.Z.OBJECT_CLASS_CURVE&&s.Z.exists(t.points))for(o=t.numberPoints,r=0;r<o;r++)this._addToList(p,t.points[r],r);else if(t.type===i.Z.OBJECT_TYPE_POLYGON)for(r=0;r<t.vertices.length;r++)this._addToList(p,t.vertices[r].coords,r);else if(t.elementClass===i.Z.OBJECT_CLASS_CIRCLE)for(d=359,n=t.Radius(),a=2*Math.PI/d,r=0;r<=d;r++)this._addToList(p,new u.Z(i.Z.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(r*a)*n,t.center.coords.usrCoords[2]+Math.sin(r*a)*n],e),r);else if(s.Z.isArray(t))for(o=t.length,r=0;r<o;r++)s.Z.exists(t[r].coords)?this._addToList(p,t[r].coords,r):s.Z.isArray(t[r])?this._addToList(p,new u.Z(i.Z.COORDS_BY_USER,t[r],e),r):s.Z.exists(t[r].usrCoords)&&this._addToList(p,t[r],r)}else{for(l=h.Z.rad(t.radiuspoint,t.center,t.anglepoint),d=Math.floor(180*l/Math.PI),n=t.Radius(),a=l/d,c=Math.atan2(t.radiuspoint.coords.usrCoords[2]-t.center.coords.usrCoords[2],t.radiuspoint.coords.usrCoords[1]-t.center.coords.usrCoords[1]),t.type===i.Z.OBJECT_TYPE_SECTOR&&this._addToList(p,t.center.coords,0),r=0;r<=d;r++)this._addToList(p,new u.Z(i.Z.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(r*a+c)*n,t.center.coords.usrCoords[2]+Math.sin(r*a+c)*n],e),r+1);t.type===i.Z.OBJECT_TYPE_SECTOR&&this._addToList(p,t.center.coords,d+2)}return p},greinerHormann:function(t,e,i,s){var r,n,a,l,c=[],d=[];return(r=(c=this._getPath(t,s)).length)>0&&h.Z.distance(c[0].coords.usrCoords,c[r-1].coords.usrCoords,3)<o.Z.eps&&c.pop(),(r=(d=this._getPath(e,s)).length)>0&&h.Z.distance(d[0].coords.usrCoords,d[r-1].coords.usrCoords,3)<o.Z.eps*o.Z.eps&&d.pop(),this.isEmptyCase(c,d,i)?[[],[]]:(a=this.makeDoublyLinkedList(c),l=this.makeDoublyLinkedList(d),n=this.findIntersections(c,d,s)[0],this._handleFullyDegenerateCase(c,d,s),this.markEntryExit(c,d,a),this.markEntryExit(d,c,l),0===this._countCrossingIntersections(n)?this.handleEmptyIntersection(c,d,i):this.tracing(c,n,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 A=o.Z.Clip;o.Z.Poly={},o.Z.Poly.Ring=function(t){this.vars=t},t.Z.extend(o.Z.Poly.Ring.prototype,{}),o.Z.Poly.Monomial=function(t,e,i){var r;if(!s.Z.exists(t))throw new Error("JSXGraph error: In JXG.Math.Poly.monomial missing parameter 'ring'.");for(s.Z.isArray(i)||(i=[]),r=(i=i.slice(0,t.vars.length)).length;r<t.vars.length;r++)i.push(0);this.ring=t,this.coefficient=e||0,this.exponents=s.Z.deepCopy(i)},t.Z.extend(o.Z.Poly.Monomial.prototype,{copy:function(){return new o.Z.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("*")}}),o.Z.Poly.Polynomial=function(t,e){var i;if(!s.Z.exists(t))throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial missing parameter 'ring'.");i=s.Z.exists(e)&&s.Z.isString(e)?void 0:[],this.ring=t,this.monomials=i},t.Z.extend(o.Z.Poly.Polynomial.prototype,{findSignature:function(t){var e;for(e=0;e<this.monomials.length;e++)if(s.Z.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(!s.Z.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(s.Z.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(!s.Z.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(s.Z.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 o.Z.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("+")}});o.Z.Poly;t.Z.Complex=function(t,e){this.isComplex=!0,t&&t.isComplex&&(e=t.imaginary,t=t.real),this.real=t||0,this.imaginary=e||0,this.absval=0,this.angle=0},t.Z.extend(t.Z.Complex.prototype,{toString:function(){return this.real+" + "+this.imaginary+"i"},add:function(t){return s.Z.isNumber(t)?this.real+=t:(this.real+=t.real,this.imaginary+=t.imaginary),this},sub:function(t){return s.Z.isNumber(t)?this.real-=t:(this.real-=t.real,this.imaginary-=t.imaginary),this},mult:function(t){var e,i;return s.Z.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,r;if(s.Z.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,r=this.real,i=this.imaginary,this.real=(r*t.real+i*t.imaginary)/e,this.imaginary=(i*t.real-r*t.imaginary)/e}return this},conj:function(){return this.imaginary*=-1,this}}),t.Z.C={},t.Z.C.add=function(e,i){var s=new t.Z.Complex(e);return s.add(i),s},t.Z.C.sub=function(e,i){var s=new t.Z.Complex(e);return s.sub(i),s},t.Z.C.mult=function(e,i){var s=new t.Z.Complex(e);return s.mult(i),s},t.Z.C.div=function(e,i){var s=new t.Z.Complex(e);return s.div(i),s},t.Z.C.conj=function(e){var i=new t.Z.Complex(e);return i.conj(),i},t.Z.C.abs=function(e){var i=new t.Z.Complex(e);return i.conj(),i.mult(e),Math.sqrt(i.real)},t.Z.C.copy=function(e){return new t.Z.Complex(e)},t.Z.Complex.C=t.Z.C;var D=t.Z.Complex,k=__webpack_require__(766);t.Z.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]]},t.Z.extend(t.Z.AbstractRenderer.prototype,{_updateVisual:function(t,e,i){(i||this.enhancedRendering)&&(e=e||{},this.setObjectViewport(t),this.setObjectTransition(t),s.Z.evaluate(t.visProp.draft)?this.setDraft(t):(e.stroke||(t.highlighted?(this.setObjectStrokeColor(t,t.visProp.highlightstrokecolor,t.visProp.highlightstrokeopacity),this.setObjectStrokeWidth(t,t.visProp.highlightstrokewidth)):(this.setObjectStrokeColor(t,t.visProp.strokecolor,t.visProp.strokeopacity),this.setObjectStrokeWidth(t,t.visProp.strokewidth))),e.fill||(t.highlighted?this.setObjectFillColor(t,t.visProp.highlightfillcolor,t.visProp.highlightfillopacity):this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity)),e.dash||this.setDashStyle(t,t.visProp),e.shadow||this.setShadow(t),e.tabindex||this.setTabindex(t)))},_getHighlighted:function(t){var e=!1;return s.Z.exists(t.board)&&s.Z.exists(t.board.highlightedObjects)||(e=!0),!e&&s.Z.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e,i=k.Z.normalizePointFace(s.Z.evaluate(t.visProp.face));e="o"===i?"ellipse":"[]"===i?"rect":"path",t.rendNode=this.appendChildPrim(this.createPrim(e,t.id),s.Z.evaluate(t.visProp.layer)),this.appendNodesToElement(t,e),this._updateVisual(t,{dash:!0,shadow:!0},!0),this.updatePoint(t)},updatePoint:function(t){var e,i=s.Z.evaluate(t.visProp.size),r=k.Z.normalizePointFace(s.Z.evaluate(t.visProp.face)),o=s.Z.evaluate(t.visProp.sizeunit),n=s.Z.evaluate(t.visProp.zoom);isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===o&&(i*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),e=0===(i*=t.board&&n?Math.sqrt(t.board.zoomX*t.board.zoomY):1)?0:i+1,"o"===r?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],e,e):"[]"===r?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,r),t.board),this._updateVisual(t,{dash:!1,shadow:!1}),this.setShadow(t))},changePointStyle:function(t){var e=this.getElementById(t.id);s.Z.exists(e)&&this.remove(e),this.drawPoint(t),s.Z.clearVisPropOld(t),t.visPropCalc.visible||this.display(t,!1),s.Z.evaluate(t.visProp.draft)&&this.setDraft(t)},drawLine:function(t){t.rendNode=this.appendChildPrim(this.createPrim("line",t.id),s.Z.evaluate(t.visProp.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),s.Z.evaluate(t.visProp.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 r,o,n=t.visProp,a=e?"highlight":"";r=e&&n.highlightstrokewidth?Math.max(s.Z.evaluate(n.highlightstrokewidth),s.Z.evaluate(n.strokewidth)):s.Z.evaluate(n.strokewidth),o=this.getArrowHeadData(t,r,a),this.makeArrows(t,o),t.elementClass===i.Z.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,o):t.elementClass===i.Z.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,o)},getArrowHeadData:function(t,e,r){var n,a,h,l,c=o.Z.eps,d=0,u=0,p=0,f=0,_=s.Z.evaluate(t.visProp.firstarrow),g=s.Z.evaluate(t.visProp.lastarrow);return(_||g)&&(n=s.Z.exists(_.type)?s.Z.evaluate(_.type):t.elementClass===i.Z.OBJECT_CLASS_LINE?1:7,a=s.Z.exists(g.type)?s.Z.evaluate(g.type):t.elementClass===i.Z.OBJECT_CLASS_LINE?1:7,_&&(l=6,s.Z.exists(_.size)&&(l=s.Z.evaluate(_.size)),""!==r&&s.Z.exists(_[r+"size"])&&(l=s.Z.evaluate(_[r+"size"])),h=e*l,2===n?(h*=.5,c+=e*l):3===n?(h=e*l/3,c+=e):4===n||5===n||6===n?(h=e*l/1.5,c+=e*l):7===n?(h=0,l=10,c+=e):c+=e*l,d+=h,p=l),g&&(l=6,s.Z.exists(g.size)&&(l=s.Z.evaluate(g.size)),""!==r&&s.Z.exists(g[r+"size"])&&(l=s.Z.evaluate(g[r+"size"])),h=e*l,2===a?(h*=.5,c+=e*l):3===a?(h=e*l/3,c+=e):4===a||5===a||6===a?(h=e*l/1.5,c+=e*l):7===a?(h=0,l=10,c+=e):c+=e*l,u+=h,f=l)),t.visPropCalc.typeFirst=n,t.visPropCalc.typeLast=a,{evFirst:_,evLast:g,typeFirst:n,typeLast:a,offFirst:d,offLast:u,sizeFirst:p,sizeLast:f,showFirst:1,showLast:1,minLen:c,strokeWidth:e}},updateLineWithEndings:function(t,e){var r,o,n;return r=new u.Z(i.Z.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),o=new u.Z(i.Z.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),n=s.Z.evaluate(t.visProp.margin),h.Z.calcStraight(t,r,o,n),this.handleTouchpoints(t,r,o,e),this.getPositionArrowHead(t,r,o,e),this.updateLinePrim(t.rendNode,r.scrCoords[1],r.scrCoords[2],o.scrCoords[1],o.scrCoords[2],t.board),this},updatePath:function(t){return s.Z.evaluate(t.visProp.handdrawing)?this.updatePathPrim(t.rendNode,this.updatePathStringBezierPrim(t),t.board):this.updatePathPrim(t.rendNode,this.updatePathStringPrim(t),t.board),this},getPositionArrowHead:function(t,e,s,r){var o,n,a,h,l;return(r.evFirst||r.evLast)&&(n=a=h=l=0,o=e.distance(i.Z.COORDS_BY_SCREEN,s),r.evFirst&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(n=(s.scrCoords[1]-e.scrCoords[1])*r.offFirst/o,a=(s.scrCoords[2]-e.scrCoords[2])*r.offFirst/o):r.showFirst=0),r.evLast&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(h=(s.scrCoords[1]-e.scrCoords[1])*r.offLast/o,l=(s.scrCoords[2]-e.scrCoords[2])*r.offLast/o):r.showLast=0),e.setCoordinates(i.Z.COORDS_BY_SCREEN,[e.scrCoords[1]+n,e.scrCoords[2]+a],!1,!0),s.setCoordinates(i.Z.COORDS_BY_SCREEN,[s.scrCoords[1]-h,s.scrCoords[2]-l],!1,!0)),this},handleTouchpoints:function(t,e,r,o){var n,a,h,l,c,d,u;return(o.evFirst||o.evLast)&&(h=l=c=d=u=0,n=s.Z.evaluate(t.point1.visProp.size)+s.Z.evaluate(t.point1.visProp.strokewidth),a=s.Z.evaluate(t.point2.visProp.size)+s.Z.evaluate(t.point2.visProp.strokewidth),o.evFirst&&s.Z.evaluate(t.visProp.touchfirstpoint)&&s.Z.evaluate(t.point1.visProp.visible)&&(h=e.distance(i.Z.COORDS_BY_SCREEN,r),l=(r.scrCoords[1]-e.scrCoords[1])*n/h,c=(r.scrCoords[2]-e.scrCoords[2])*n/h),o.evLast&&s.Z.evaluate(t.visProp.touchlastpoint)&&s.Z.evaluate(t.point2.visProp.visible)&&(h=e.distance(i.Z.COORDS_BY_SCREEN,r),d=(r.scrCoords[1]-e.scrCoords[1])*a/h,u=(r.scrCoords[2]-e.scrCoords[2])*a/h),e.setCoordinates(i.Z.COORDS_BY_SCREEN,[e.scrCoords[1]+l,e.scrCoords[2]+c],!1,!0),r.setCoordinates(i.Z.COORDS_BY_SCREEN,[r.scrCoords[1]-d,r.scrCoords[2]-u],!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),s.Z.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"path")},updateTicks:function(t){},drawEllipse:function(t){t.rendNode=this.appendChildPrim(this.createPrim("ellipse",t.id),s.Z.evaluate(t.visProp.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])>o.Z.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),s.Z.evaluate(t.visProp.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){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var i,r,o,n;"html"===s.Z.evaluate(t.visProp.display)&&e.Z.isBrowser&&"no"!==this.type?((i=this.container.ownerDocument.createElement("div")).style.position="absolute",i.className=s.Z.evaluate(t.visProp.cssclass),o=s.Z.evaluate(t.visProp.layer),s.Z.exists(o)||(o=0),r=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),i.style.zIndex=r+o,this.container.appendChild(i),i.setAttribute("id",this.container.id+"_"+t.id)):i=this.drawInternalText(t),t.rendNode=i,t.htmlStr="",t.visProp.islabel&&s.Z.exists(t.visProp.anchor)?(n=s.Z.evaluate(t.visProp.anchor.visProp.visible),t.prepareUpdate().updateVisibility(n)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateText:function(e){var i,r,o,n,a,h,l,c,d,u,p,f=e.plaintext;if(e.visPropCalc.visible)if(this.updateTextStyle(e,!1),"html"===s.Z.evaluate(e.visProp.display)&&"no"!==this.type){if(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(r=e.coords.scrCoords[1],r=Math.abs(r)<1e6?r:1e6,"right"===(a=e.getAnchorX())?(i=e.board.canvasWidth-r,u="right"):"middle"===a?(i=r-.5*e.size[0],u="center"):(i=r,u="left"),e.visPropOld.left!==a+i&&("right"===a?(e.rendNode.style.right=i+"px",e.rendNode.style.left="auto"):(e.rendNode.style.left=i+"px",e.rendNode.style.right="auto"),e.visPropOld.left=a+i),r=e.coords.scrCoords[2]+this.vOffsetText,r=Math.abs(r)<1e6?r:1e6,"bottom"===(h=e.getAnchorY())?(i=e.board.canvasHeight-r,p="bottom"):"middle"===h?(i=r-.5*e.size[1],p="center"):(i=r,p="top"),e.visPropOld.top!==h+i&&("bottom"===h?(e.rendNode.style.top="auto",e.rendNode.style.bottom=i+"px"):(e.rendNode.style.bottom="auto",e.rendNode.style.top=i+"px"),e.visPropOld.top=h+i)),e.htmlStr!==f){try{e.type===s.Z.OBJECT_TYPE_BUTTON?e.rendNodeButton.innerHTML=f:e.type===s.Z.OBJECT_TYPE_CHECKBOX||e.type===s.Z.OBJECT_TYPE_INPUT?e.rendNodeLabel.innerHTML=f:e.rendNode.innerHTML=f}catch(t){o=e.rendNode.parentNode,e.rendNode.parentNode.removeChild(e.rendNode),e.rendNode.innerHTML=f,o.appendChild(e.rendNode)}if(e.htmlStr=f,s.Z.evaluate(e.visProp.usemathjax))try{MathJax.typeset?MathJax.typeset([e.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.rendNode])}catch(e){t.Z.debug("MathJax (not yet) loaded")}else if(s.Z.evaluate(e.visProp.usekatex))try{(n=0===e.rendNode.innerHTML.indexOf("<span")&&e.rendNode.innerHTML.indexOf("<label")>0&&(e.rendNode.innerHTML.indexOf("<checkbox")>0||e.rendNode.innerHTML.indexOf("<input")>0)?e.rendNodeLabel:0===e.rendNode.innerHTML.indexOf("<button")?e.rendNodeButton:e.rendNode)&&katex.render(f,n,{macros:s.Z.evaluate(e.visProp.katexmacros),throwOnError:!1})}catch(e){t.Z.debug("KaTeX not loaded (yet)")}else if(s.Z.evaluate(e.visProp.useasciimathml))try{AMprocessNode(e.rendNode,!1)}catch(e){t.Z.debug("AsciiMathML not loaded (yet)")}}0!==(l=s.Z.evaluate(e.visProp.rotate))&&(l*=Math.PI/180,c=Math.cos(l),d=Math.sin(l),e.rendNode.style.transform="matrix("+[c,-1*d,d,c,0,0].join(",")+")",e.rendNode.style["transform-origin"]=u+" "+p),this.transformImage(e,e.transformations)}else this.updateInternalText(e)},_css2js:function(t){var e,i,r,o,n,a=[],h=s.Z.trim(t).replace(/;$/,"").split(";");for(i=h.length,e=0;e<i;++e)""!==s.Z.trim(h[e])&&(n=h[e].split(":"),r=s.Z.trim(n[0].replace(/-([a-z])/gi,(function(t,e){return e.toUpperCase()}))),o=s.Z.trim(n[1]),a.push({key:r,val:o}));return a},updateTextStyle:function(t,i){var r,o,n,a,h,l,c,d,u,p=t.visProp,f=e.Z.isBrowser?p.display:"internal",_=["rendNode","rendNodeTag","rendNodeLabel"],g=_.length,m=s.Z.evaluate(p.fontunit),b=["cssdefaultstyle","cssstyle"],v=b.length;if(i?(n=p.highlightstrokecolor,o=p.highlightstrokeopacity,a=p.highlightcssclass):(n=p.strokecolor,o=p.strokeopacity,a=p.cssclass),"no"!==this.type&&("html"===f||"canvas"!==this.type)){for(d=0;d<v;d++)if(""!==(u=s.Z.evaluate(p[(i?"highlight":"")+b[d]]))&&t.visPropOld[b[d]]!==u){for(l=this._css2js(u),h=0;h<g;h++)if(s.Z.exists(t[_[h]]))for(c in l)l.hasOwnProperty(c)&&(t[_[h]].style[l[c].key]=l[c].val);t.visPropOld[b[d]]=u}if(r=s.Z.evaluate(p.fontsize),t.visPropOld.fontsize!==r){t.needsSizeUpdate=!0;try{for(h=0;h<g;h++)s.Z.exists(t[_[h]])&&(t[_[h]].style.fontSize=r+m)}catch(e){for(h=0;h<g;h++)s.Z.exists(t[_[h]])&&(t[_[h]].style.fontSize=r)}t.visPropOld.fontsize=r}}return this.setTabindex(t),this.setObjectTransition(t),"html"===f&&"no"!==this.type?(this.setObjectViewport(t,!0),t.visPropOld.cssclass!==a&&(t.rendNode.className=a,t.visPropOld.cssclass=a,t.needsSizeUpdate=!0),this.setObjectStrokeColor(t,n,o)):this.updateInternalTextStyle(t,n,o),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.transformImage(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],n=t.board.unitX,a=t.board.unitY,h=e.length,l=[[1,0,0],[-s/n,1/n,0],[r/a,0,-1/a]];for(i=0;i<h;i++)l=o.Z.matMatMult(e[i].matrix,l);return l=o.Z.matMatMult([[1,0,0],[s,n,0],[r,0,-a]],l)},transformImage:function(t,e){},updateImageURL:function(t){},updateImageStyle:function(t,e){t.rendNode.className=s.Z.evaluate(e?t.visProp.highlightcssclass:t.visProp.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){},setPropertyPrim:function(t,e,i){},setTabindex:function(t){var e;t.board.attr.keyboard.enabled&&s.Z.exists(t.rendNode)&&(e=s.Z.evaluate(t.visProp.tabindex),t.visPropCalc.visible&&!s.Z.evaluate(t.visProp.fixed)||(e=null),e!==t.visPropOld.tabindex&&(t.rendNode.setAttribute("tabindex",e),t.visPropOld.tabindex=e))},display:function(t,e){t&&(t.visPropOld.visible=e)},show:function(t){},hide:function(t){},setBuffering:function(t,e){},setDashStyle:function(t){},setDraft:function(t){if(s.Z.evaluate(t.visProp.draft)){var e=t.board.options.elements.draft.color,r=t.board.options.elements.draft.opacity;this.setObjectViewport(t),this.setObjectTransition(t),t.type===i.Z.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,e,r):(t.elementClass===i.Z.OBJECT_CLASS_POINT?this.setObjectFillColor(t,e,r):this.setObjectFillColor(t,"none",0),this.setObjectStrokeColor(t,e,r),this.setObjectStrokeWidth(t,t.board.options.elements.draft.strokeWidth))}},removeDraft:function(t){this.setObjectViewport(t),this.setObjectTransition(t),t.type===i.Z.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity):(t.type===i.Z.OBJECT_CLASS_POINT&&this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity),this.setObjectStrokeColor(t,t.visProp.strokecolor,t.visProp.strokeopacity),this.setObjectStrokeWidth(t,t.visProp.strokewidth))},setGradient:function(t){},updateGradient:function(t){},setObjectTransition:function(t,e){},setObjectViewport:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setShadow:function(t){},highlight:function(t,e){var r,o,n,a=t.visProp;if(this.setObjectViewport(t),this.setObjectTransition(t),!a.draft){if(t.type===i.Z.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,a.highlightfillcolor,a.highlightfillopacity),o=s.Z.evaluate(a.highlightbystrokewidth),r=0;r<t.borders.length;r++)this.highlight(t.borders[r],!o);else t.elementClass===i.Z.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!0):t.type===i.Z.OBJECT_TYPE_IMAGE?(this.updateImageStyle(t,!0),this.setObjectFillColor(t,a.highlightfillcolor,a.highlightfillopacity)):(this.setObjectStrokeColor(t,a.highlightstrokecolor,a.highlightstrokeopacity),this.setObjectFillColor(t,a.highlightfillcolor,a.highlightfillopacity));a.highlightstrokewidth&&!e&&(n=Math.max(s.Z.evaluate(a.highlightstrokewidth),s.Z.evaluate(a.strokewidth)),this.setObjectStrokeWidth(t,n),t.elementClass!==i.Z.OBJECT_CLASS_LINE&&t.elementClass!==i.Z.OBJECT_CLASS_CURVE||this.updatePathWithArrowHeads(t,!0))}return this},noHighlight:function(t){var e,r,o=t.visProp;if(this.setObjectViewport(t),this.setObjectTransition(t),!s.Z.evaluate(t.visProp.draft)){if(t.type===i.Z.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,o.fillcolor,o.fillopacity),e=0;e<t.borders.length;e++)this.noHighlight(t.borders[e]);else t.elementClass===i.Z.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!1):t.type===i.Z.OBJECT_TYPE_IMAGE?(this.updateImageStyle(t,!1),this.setObjectFillColor(t,o.fillcolor,o.fillopacity)):(this.setObjectStrokeColor(t,o.strokecolor,o.strokeopacity),this.setObjectFillColor(t,o.fillcolor,o.fillopacity));r=s.Z.evaluate(o.strokewidth),this.setObjectStrokeWidth(t,r),t.elementClass!==i.Z.OBJECT_CLASS_LINE&&t.elementClass!==i.Z.OBJECT_CLASS_CURVE||this.updatePathWithArrowHeads(t,!1)}return this},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(t,i){var r,o,n=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},a=function(i,a,h,l){var c;h=h||"",(c=r.createElement("span")).innerHTML=i,c.style.paddingLeft="7px",c.style.paddingRight="7px",void 0!==c.classList&&(c.classList.add("JXG_navigation_button"),c.classList.add("JXG_navigation_button_"+l)),c.setAttribute("id",h+"_navigation_"+l),o.appendChild(c),e.Z.addEvent(c,"click",(function(e){return s.Z.bind(a,t)(),!1}),t),e.Z.addEvent(c,"pointerup",n,t),e.Z.addEvent(c,"pointerdown",n,t),e.Z.addEvent(c,"pointerleave",n,t),e.Z.addEvent(c,"mouseup",n,t),e.Z.addEvent(c,"mousedown",n,t),e.Z.addEvent(c,"touchend",n,t),e.Z.addEvent(c,"touchstart",n,t)};e.Z.isBrowser&&"no"!==this.type&&(r=t.containerObj.ownerDocument,(o=r.createElement("div")).setAttribute("id",t.container+"_navigationbar"),o.style.color=i.strokecolor,o.style.backgroundColor=i.fillcolor,o.style.padding=i.padding,o.style.position=i.position,o.style.fontSize=i.fontsize,o.style.cursor=i.cursor,o.style.zIndex=i.zindex,t.containerObj.appendChild(o),o.style.right=i.right,o.style.bottom=i.bottom,void 0!==o.classList&&o.classList.add("JXG_navigation"),t.attr.showfullscreen&&a(t.attr.fullscreen.symbol,(function(){t.toFullscreen(t.attr.fullscreen.id)}),t.container,"fullscreen"),t.attr.showscreenshot&&a(t.attr.screenshot.symbol,(function(){window.setTimeout((function(){t.renderer.screenshot(t,"",!1)}),330)}),t.container,"screenshot"),t.attr.showreload&&a("↻",(function(){t.reload()}),t.container,"reload"),t.attr.showcleartraces&&a("⊗",(function(){t.clearTraces()}),t.container,"cleartraces"),t.attr.shownavigation&&(t.attr.showzoom&&(a("–",t.zoomOut,t.container,"out"),a("o",t.zoom100,t.container,"100"),a("+",t.zoomIn,t.container,"in")),a("←",t.clickLeftArrow,t.container,"left"),a("↓",t.clickUpArrow,t.container,"down"),a("↑",t.clickDownArrow,t.container,"up"),a("→",t.clickRightArrow,t.container,"right")))},getElementById:function(t){var e;return s.Z.exists(this.container)?(e=this.container.id+"_"+t,s.Z.exists(CSS)&&s.Z.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){},setLayer:function(t,e){}});var L=t.Z.AbstractRenderer;t.Z.FileReader={handleRemoteFile:function(e,i,r,o,n,a){var h=!1;try{h=new XMLHttpRequest,"raw"===r.toLowerCase()?h.overrideMimeType("text/plain; charset="+n):h.overrideMimeType("text/xml; charset="+n)}catch(t){try{h=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{h=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){h=!1}}}if(h){h.open("GET",e,o),"raw"===r.toLowerCase()?this.cbp=function(){var t=h;4===t.readyState&&i(t.responseText)}:this.cbp=function(){var t=h,e="";4===t.readyState&&(e=!s.Z.exists(t.responseStream)||"PK"!==t.responseText.slice(0,2)&&31!==O.asciiCharCodeAt(t.responseText.slice(0,1),0)?t.responseText:S.decode(jxgBinFileReader(t)),this.parseString(e,i,r,a))},this.cb=s.Z.bind(this.cbp,this),h.onreadystatechange=this.cb;try{h.send(null)}catch(t){throw new Error("JSXGraph: A problem occurred while trying to read remote file '"+e+"'.")}}else t.Z.debug("AJAX not activated!")},handleLocalFile:function(t,e,i,r,o,n){s.Z.exists(r)||(r=!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,n)},this.cb=s.Z.bind(this.cbp,this);var a=new FileReader;a.onload=this.cb,"raw"===i.toLowerCase()?a.readAsText(t):a.readAsText(t,o)},parseFileContent:function(t,e,i,r,o,n){s.Z.isString(t)||void 0===FileReader?this.handleRemoteFile(t,e,i,r,o,n):this.handleLocalFile(t,e,i,r,o,n)},parseString:function(e,i,r,o){var n;if(r=r.toLowerCase(),n=t.Z.readers[r],s.Z.exists(n))new n(i,e).read();else if("jessiecode"!==r)throw new Error("JSXGraph: There is no reader available for '"+r+"'.");s.Z.isFunction(o)&&o(i)}},!e.Z.isMetroApp()&&e.Z.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 R=t.Z.FileReader,B=__webpack_require__(632),I=__webpack_require__(254),Y=__webpack_require__(327);t.Z.Composition=function(t){var e,i=this,r=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],o=function(t){return function(){var e;for(e in i.elements)i.elements.hasOwnProperty(e)&&s.Z.exists(i.elements[e][t])&&i.elements[e][t].apply(i.elements[e],arguments);return i}};for(e=0;e<r.length;e++)this[r[e]]=o(r[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={}},t.Z.extend(t.Z.Composition.prototype,{add:function(t,e){return!(s.Z.exists(this[t])||!s.Z.exists(e))&&(s.Z.exists(e.id)?this.elements[e.id]=e:this.elements[t]=e,s.Z.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(e){return s.Z.exists(t.Z.Board)?t.Z.Board.prototype.select.call(this,e):new t.Z.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 j=t.Z.Composition;t.Z.Board=function(o,n,a,h,l,c,d,u,p,f,_){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,s.Z.exists(_.document)&&!1!==_.document?this.document=_.document:e.Z.isBrowser&&(this.document=document),this.container="",this.containerObj=null,s.Z.isString(o)?(this.container=o,this.containerObj=e.Z.isBrowser?this.document.getElementById(this.container):null):e.Z.isBrowser&&(this.containerObj=o,this.container=this.containerObj.getAttribute("id"),null===this.container&&(this.container="null"+parseInt(1e8*Math.random()).toString())),e.Z.isBrowser&&"no"!==n.type&&null===this.containerObj)throw new Error('\nJSXGraph: HTML container element "'+o+'" not found.');this.renderer=n,this.grids=[],this.options=s.Z.deepCopy(k.Z),this.attr=_,"default"!==this.attr.theme&&s.Z.exists(t.Z.themes[this.attr.theme])&&s.Z.mergeAttr(this.options,t.Z.themes[this.attr.theme],!0),this.dimension=2,this.jc=new I.Z,this.jc.use(this),this.origin={},this.origin.usrCoords=[1,0,0],this.origin.scrCoords=[1,h[0],h[1]],this.zoomX=l,this.zoomY=c,this.unitX=d*this.zoomX,this.unitY=u*this.zoomY,this.keepaspectratio=!1,this.canvasWidth=p,this.canvasHeight=f,s.Z.exists(a)&&""!==a&&e.Z.isBrowser&&!s.Z.exists(this.document.getElementById(a))?this.id=a:this.id=this.generateId(),r.Z.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.focusObjects=[],this.attr.showcopyright&&this.renderer.displayCopyright(i.Z.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._drag_offset=[0,0],this._inputDevice="mouse",this._board_touches=[],this.selectingMode=!1,this.isSelecting=!1,this._isScrolling=!1,this._isResizing=!1,this.selectingBox=[[0,0],[0,0]],this.userLog=[],this.mathLib=Math,this.mathLibJXG=t.Z.Math,!0===this.attr.registerevents?this.attr.registerevents={fullscreen:!0,keyboard:!0,pointer:!0,resize:!0,wheel:!0}:"object"==typeof this.attr.registerevents&&(s.Z.exists(this.attr.registerevents.fullscreen)||(this.attr.registerevents.fullscreen=!0),s.Z.exists(this.attr.registerevents.keyboard)||(this.attr.registerevents.keyboard=!0),s.Z.exists(this.attr.registerevents.pointer)||(this.attr.registerevents.pointer=!0),s.Z.exists(this.attr.registerevents.resize)||(this.attr.registerevents.resize=!0),s.Z.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"}},t.Z.extend(t.Z.Board.prototype,{generateName:function(t){var e,r,o=this.attr.maxnamelength,n="",a="",h=[],l="";if(t.type===i.Z.OBJECT_TYPE_TICKS)return"";for(e=s.Z.isPoint(t)||s.Z.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===i.Z.OBJECT_TYPE_ANGLE?["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]:["","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"],s.Z.isPoint(t)||t.elementClass===i.Z.OBJECT_CLASS_LINE||t.type===i.Z.OBJECT_TYPE_ANGLE||(n=t.type===i.Z.OBJECT_TYPE_POLYGON?"P_{":t.elementClass===i.Z.OBJECT_CLASS_CIRCLE?"k_{":t.elementClass===i.Z.OBJECT_CLASS_TEXT?"t_{":"s_{",a="}"),r=0;r<o;r++)h[r]=0;for(;h[o-1]<e.length;){for(h[0]=1;h[0]<e.length;h[0]++){for(l=n,r=o;r>0;r--)l+=e[h[r-1]];if(!s.Z.exists(this.elementsByName[l+a]))return l+a}for(h[0]=e.length,r=1;r<o;r++)h[r-1]===e.length&&(h[r-1]=1,h[r]+=1)}return""},generateId:function(){for(var e=1;s.Z.exists(t.Z.boards["jxgBoard"+e]);)e=Math.round(65535*Math.random());return"jxgBoard"+e},setId:function(t,e){var i,r=this.numObjects,o=t.id;if(this.numObjects+=1,""===o||!s.Z.exists(o))for(o=this.id+e+r;s.Z.exists(this.objects[o]);)i=Math.round(65535*Math.random()),o=this.id+e+r+"-"+i;return t.id=o,this.objects[o]=t,t._pos=this.objectsList.length,this.objectsList[this.objectsList.length]=t,o},finalizeAdding:function(t){!1===s.Z.evaluate(t.visProp.visible)&&this.renderer.display(t,!1)},finalizeLabel:function(t){t.hasLabel&&!s.Z.evaluate(t.label.visProp.islabel)&&!1===s.Z.evaluate(t.label.visProp.visible)&&this.renderer.display(t.label,!1)},checkFrameRate:function(t){var e=!1,i=(new Date).getTime();return s.Z.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,i,r,o,n,a=this.document.ownerDocument||this.document,h=a.documentElement||this.document.body.parentNode,l=a.body,c=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(),c.getBoundingClientRect){for(r=c.getBoundingClientRect(),o=1,n=c;n&&s.Z.exists(n.parentNode);)s.Z.exists(n.style)&&s.Z.exists(n.style.zoom)&&""!==n.style.zoom&&(o*=parseFloat(n.style.zoom)),n=n.parentNode;return(t=[r.left*o,r.top*o])[0]+=e.Z.getProp(c,"border-left-width"),t[1]+=e.Z.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.Z.getProp(c,"padding-left"),t[1]+=e.Z.getProp(c,"padding-top")),this.cPos=t.slice(),this.cPos}return t=e.Z.getOffset(c),i=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&i.defaultView&&(t[0]+=e.Z.getProp(h,"margin-left"),t[1]+=e.Z.getProp(h,"margin-top"),t[0]+=e.Z.getProp(h,"border-left-width"),t[1]+=e.Z.getProp(h,"border-top-width"),t[0]+=e.Z.getProp(h,"padding-left"),t[1]+=e.Z.getProp(h,"padding-top")),l&&(t[0]+=e.Z.getProp(l,"left"),t[1]+=e.Z.getProp(l,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=e.Z.getProp(c,"border-left-width"),t[1]+=e.Z.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.Z.getProp(c,"padding-left"),t[1]+=e.Z.getProp(c,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getPointLoc:function(t,e){var i,r,o,n;return i=this.getBoundingBox(),2===(r=t).length&&r.unshift(void 0),o=[0,0],n=e||0,s.Z.isNumber(n)&&(n=[n,n,n,n]),r[1]>i[2]-n[1]&&(o[0]=1),r[1]<i[0]+n[3]&&(o[0]=-1),r[2]>i[1]-n[0]&&(o[1]=1),r[2]<i[3]+n[2]&&(o[1]=-1),o},getLocationOrigin:function(t){return this.getPointLoc([0,0],t)},getMousePosition:function(t,i){var s,r,n=this.getCoordsTopLeftCorner();return s=e.Z.getPosition(t,i,this.document),this.updateCSSTransforms(),r=[1,s[0]-n[0],s[1]-n[1]],(r=o.Z.matVecMult(this.cssTransMat,r))[1]/=r[0],r[2]/=r[0],[r[1],r[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,r,o){var n,a,h,l=[],c=[],d=this.objectsList.length,u={visProp:{layer:-1e4}};for(this._shiftKey=r.shiftKey,this._ctrlKey=r.ctrlKey,a=0;a<d;a++)h=(n=this.objectsList[a]).hasPoint&&n.hasPoint(t,e),n.visPropCalc.visible&&h&&(n.triggerEventHandlers([o+"down","down"],[r]),this.downObjects.push(n)),h&&n.isDraggable&&n.visPropCalc.visible&&(this.geonextCompatibilityMode&&(s.Z.isPoint(n)||n.elementClass===i.Z.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!s.Z.evaluate(n.visProp.fixed)&&(n.visProp.layer>u.visProp.layer||n.visProp.layer===u.visProp.layer&&n.lastDragTime.getTime()>=u.lastDragTime.getTime())&&(this.attr.ignorelabels&&s.Z.exists(u.label)&&n===u.label||(u=n,l.push(u),s.Z.exists(u.coords)?c.push(p.Z.subtract(u.coords.scrCoords.slice(1),[t,e])):c.push([0,0])));return this.attr.drag.enabled&&l.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(l.length=1,this._drag_offset=c[0]):(l=l.slice(-1),this._drag_offset=c[c.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&s.Z.exists(l[0])&&s.Z.evaluate(l[0].visProp.dragtotopoflayer)&&1===l.length&&s.Z.exists(l[0].rendNode)&&l[0].rendNode.parentNode.appendChild(l[0].rendNode),l.length>=1&&(l[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[r,l[0]])),l},moveObject:function(t,e,r,o,n){var a,h,l,c=new u.Z(i.Z.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,e),this);r&&r.obj&&((a=r.obj).coords&&(h=a.coords.scrCoords.slice()),this.addLogEntry("drag",a,c.usrCoords.slice(1)),this.drag_position=[c.scrCoords[1],c.scrCoords[2]],this.drag_position=p.Z.add(this.drag_position,this._drag_offset),this._shiftKey=o.shiftKey,this._ctrlKey=o.ctrlKey,s.Z.exists(a.coords)?a.setPositionDirectly(i.Z.COORDS_BY_SCREEN,this.drag_position):(this.displayInfobox(!1),isNaN(r.targets[0].Xprev+r.targets[0].Yprev)||a.setPositionDirectly(i.Z.COORDS_BY_SCREEN,[c.scrCoords[1],c.scrCoords[2]],[r.targets[0].Xprev,r.targets[0].Yprev]),r.targets[0].Xprev=c.scrCoords[1],r.targets[0].Yprev=c.scrCoords[2]),s.Z.exists(a.coords)&&(a.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(a),a.prepareUpdate().update(!0).updateRenderer()),a.coords&&(l=a.coords.scrCoords),a.coords&&h[1]===l[1]&&h[2]===l[2]||(a.triggerEventHandlers([n+"drag","drag"],[o]),this.update()),a.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[o,a]),a.lastDragTime=new Date)},twoFingerMove:function(t,e,r){var o;s.Z.exists(t)&&s.Z.exists(t.obj)&&((o=t.obj).elementClass===i.Z.OBJECT_CLASS_LINE||o.type===i.Z.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(t.targets,o,e):o.elementClass===i.Z.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(t.targets,o,e),r&&o.triggerEventHandlers(["touchdrag","drag"],[r]))},getTwoFingerTransform(t,e,s,r){var n,a,h,l,c,d,p,f,_,g,m,b,v,Z,C,y,P;return a=(n=new u.Z(i.Z.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this).usrCoords)[1],h=n[2],l=(n=new u.Z(i.Z.COORDS_BY_SCREEN,[e.Xprev,e.Yprev],this).usrCoords)[1],c=n[2],f=(n=new u.Z(i.Z.COORDS_BY_SCREEN,[t.X,t.Y],this).usrCoords)[1],_=n[2],Z=((b=(g=(n=new u.Z(i.Z.COORDS_BY_SCREEN,[e.X,e.Y],this).usrCoords)[1])-f)*(d=l-a)+(v=(m=n[2])-_)*(p=c-h))/(y=d*d+p*p),C=(v*d-b*p)/y,s||(Z/=P=o.Z.hypot(Z,C),C/=P),r||(C=0),[1,0,0,.5*(f+g-Z*(a+l)+C*(h+c)),Z,-C,.5*(_+m-C*(a+l)-Z*(h+c)),C,Z]},twoFingerTouchObject:function(t,e,r){var o,n,a,h,l,c,d=!1;if(s.Z.exists(t[0])&&s.Z.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)){if(n=this.getTwoFingerTransform(t[0],t[1],s.Z.evaluate(e.visProp.scalable),s.Z.evaluate(e.visProp.rotatable)),(o=this.create("transform",n,{type:"generic"})).update(),e.elementClass===i.Z.OBJECT_CLASS_LINE)a=[],e.point1.draggable()&&a.push(e.point1),e.point2.draggable()&&a.push(e.point2),o.applyOnce(a);else if(e.type===i.Z.OBJECT_TYPE_POLYGON){for(l=e.vertices.length-1,c=e.visProp,d=s.Z.evaluate(c.snaptogrid)||s.Z.evaluate(c.snaptopoints),h=0;h<l&&!d;++h)c=e.vertices[h].visProp,d=(d=d||s.Z.evaluate(c.snaptogrid)||s.Z.evaluate(c.snaptopoints))||!e.vertices[h].draggable();if(!d){for(a=[],h=0;h<l;++h)e.vertices[h].draggable()&&a.push(e.vertices[h]);o.applyOnce(a)}}this.update(),e.highlight(!0)}},twoFingerTouchCircle:function(t,e,r){var o,n,a,l,c,d,p,f,_,g,m;"pointCircle"!==e.method&&"pointLine"!==e.method&&s.Z.exists(t[0])&&s.Z.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)&&(r===t[0].num?(o=t[1],n=t[0]):(o=t[0],n=t[1]),c=new u.Z(i.Z.COORDS_BY_SCREEN,[o.Xprev,o.Yprev],this).usrCoords,l=new u.Z(i.Z.COORDS_BY_SCREEN,[n.Xprev,n.Yprev],this).usrCoords,a=new u.Z(i.Z.COORDS_BY_SCREEN,[n.X,n.Y],this).usrCoords,p=h.Z.rad(l.slice(1),c.slice(1),a.slice(1)),f=this.create("transform",[-c[1],-c[2]],{type:"translate"}),_=this.create("transform",[p],{type:"rotate"}),f.melt(_),s.Z.evaluate(e.visProp.scalable)&&(d=h.Z.distance(c,a)/h.Z.distance(c,l),g=this.create("transform",[d,d],{type:"scale"}),f.melt(g)),m=this.create("transform",[c[1],c[2]],{type:"translate"}),f.melt(m),e.center.draggable()&&f.applyOnce([e.center]),"twoPoints"===e.method?e.point2.draggable()&&f.applyOnce([e.point2]):"pointRadius"===e.method&&s.Z.isNumber(e.updateRadius.origin)&&e.setRadius(e.radius*d),this.update(e.center),e.highlight(!0))},highlightElements:function(t,e,i,r){var o,n,a,h={},l=this.objectsList.length;for(o=0;o<l;o++)a=(n=this.objectsList[o]).id,s.Z.exists(n.hasPoint)&&n.visPropCalc.visible&&n.hasPoint(t,e)&&(this.updateInfobox(n),s.Z.exists(this.highlightedObjects[a])||(h[a]=n,n.highlight(),this.triggerEventHandlers(["mousehit","hit"],[i,n,r])),n.mouseover?n.triggerEventHandlers(["mousemove","move"],[i]):(n.triggerEventHandlers(["mouseover","over"],[i]),n.mouseover=!0));for(o=0;o<l;o++)a=(n=this.objectsList[o]).id,n.mouseover&&(h[a]||(n.triggerEventHandlers(["mouseout","out"],[i]),n.mouseover=!1))},saveStartPos:function(e,r){var o,n,a=[];if(e.type===i.Z.OBJECT_TYPE_TICKS)a.push([1,NaN,NaN]);else if(e.elementClass===i.Z.OBJECT_CLASS_LINE)a.push(e.point1.coords.usrCoords),a.push(e.point2.coords.usrCoords);else if(e.elementClass===i.Z.OBJECT_CLASS_CIRCLE)a.push(e.center.coords.usrCoords),"twoPoints"===e.method&&a.push(e.point2.coords.usrCoords);else if(e.type===i.Z.OBJECT_TYPE_POLYGON)for(n=e.vertices.length-1,o=0;o<n;o++)a.push(e.vertices[o].coords.usrCoords);else if(e.type===i.Z.OBJECT_TYPE_SECTOR)a.push(e.point1.coords.usrCoords),a.push(e.point2.coords.usrCoords),a.push(e.point3.coords.usrCoords);else if(s.Z.isPoint(e)||e.type===i.Z.OBJECT_TYPE_GLIDER)a.push(e.coords.usrCoords);else if(e.elementClass===i.Z.OBJECT_CLASS_CURVE)e.points.length>0&&a.push(e.points[0].usrCoords);else try{a.push(e.coords.usrCoords)}catch(e){t.Z.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+e)}for(n=a.length,o=0;o<n;o++)r.Zstart.push(a[o][0]),r.Xstart.push(a[o][1]),r.Ystart.push(a[o][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(e){var i,s,r=e[t.Z.touchProperty];return(i=this.attr.pan.enabled&&!this.attr.pan.needtwofingers&&1===r.length)&&(s=this.getMousePosition(e,0),this.initMoveOrigin(s[0],s[1])),i},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},addEventHandlers:function(){e.Z.supportsPointerEvents()?this.addPointerEventHandlers():(this.addMouseEventHandlers(),this.addTouchEventHandlers()),null!==this.containerObj&&(this.containerObj.oncontextmenu=function(t){return s.Z.exists(t)&&t.preventDefault(),!1})},addResizeEventHandlers:function(){if(e.Z.isBrowser){try{this.startResizeObserver()}catch(t){e.Z.addEvent(window,"resize",this.resizeListener,this),this.startIntersectionObserver()}e.Z.addEvent(window,"scroll",this.scrollListener,this)}},removeEventHandlers:function(){this.removeMouseEventHandlers(),this.removeTouchEventHandlers(),this.removePointerEventHandlers(),this.removeFullscreenEventHandlers(),this.removeKeyboardEventHandlers(),e.Z.isBrowser&&(s.Z.exists(this.resizeObserver)?this.stopResizeObserver():(e.Z.removeEvent(window,"resize",this.resizeListener,this),this.stopIntersectionObserver()),e.Z.removeEvent(window,"scroll",this.scrollListener,this))},addPointerEventHandlers:function(){if(!this.hasPointerHandlers&&e.Z.isBrowser){var t=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(e.Z.addEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),e.Z.addEvent(t,"MSPointerMove",this.pointerMoveListener,this)):(e.Z.addEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),e.Z.addEvent(t,"pointermove",this.pointerMoveListener,this),e.Z.addEvent(t,"pointerleave",this.pointerLeaveListener,this),e.Z.addEvent(t,"click",this.pointerClickListener,this),e.Z.addEvent(t,"dblclick",this.pointerDblClickListener,this)),null!==this.containerObj&&(this.containerObj.style.touchAction="none"),this.hasPointerHandlers=!0}},addMouseEventHandlers:function(){if(!this.hasMouseHandlers&&e.Z.isBrowser){var t=this.attr.movetarget||this.containerObj;e.Z.addEvent(this.containerObj,"mousedown",this.mouseDownListener,this),e.Z.addEvent(t,"mousemove",this.mouseMoveListener,this),e.Z.addEvent(t,"click",this.mouseClickListener,this),e.Z.addEvent(t,"dblclick",this.mouseDblClickListener,this),this.hasMouseHandlers=!0}},addTouchEventHandlers:function(t){if(!this.hasTouchHandlers&&e.Z.isBrowser){var i=this.attr.movetarget||this.containerObj;e.Z.addEvent(this.containerObj,"touchstart",this.touchStartListener,this),e.Z.addEvent(i,"touchmove",this.touchMoveListener,this),this.hasTouchHandlers=!0}},addWheelEventHandlers:function(){!this.hasWheelHandlers&&e.Z.isBrowser&&(e.Z.addEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),e.Z.addEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this),this.hasWheelHandlers=!0)},addFullscreenEventHandlers:function(){var t,i=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],s=i.length;if(!this.hasFullscreenEventHandlers&&e.Z.isBrowser){for(t=0;t<s;t++)e.Z.addEvent(this.document,i[t],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!0}},addKeyboardEventHandlers:function(){this.attr.keyboard.enabled&&!this.hasKeyboardHandlers&&e.Z.isBrowser&&(e.Z.addEvent(this.containerObj,"keydown",this.keyDownListener,this),e.Z.addEvent(this.containerObj,"focusin",this.keyFocusInListener,this),e.Z.addEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!0)},removeKeyboardEventHandlers:function(){this.hasKeyboardHandlers&&e.Z.isBrowser&&(e.Z.removeEvent(this.containerObj,"keydown",this.keyDownListener,this),e.Z.removeEvent(this.containerObj,"focusin",this.keyFocusInListener,this),e.Z.removeEvent(this.containerObj,"focusout",this.keyFocusOutListener,this),this.hasKeyboardHandlers=!1)},removeFullscreenEventHandlers:function(){var t,i=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange"],s=i.length;if(this.hasFullscreenEventHandlers&&e.Z.isBrowser){for(t=0;t<s;t++)e.Z.removeEvent(this.document,i[t],this.fullscreenListener,this);this.hasFullscreenEventHandlers=!1}},removePointerEventHandlers:function(){if(this.hasPointerHandlers&&e.Z.isBrowser){var t=this.attr.movetarget||this.containerObj;window.navigator.msPointerEnabled?(e.Z.removeEvent(this.containerObj,"MSPointerDown",this.pointerDownListener,this),e.Z.removeEvent(t,"MSPointerMove",this.pointerMoveListener,this)):(e.Z.removeEvent(this.containerObj,"pointerdown",this.pointerDownListener,this),e.Z.removeEvent(t,"pointermove",this.pointerMoveListener,this),e.Z.removeEvent(t,"pointerleave",this.pointerLeaveListener,this),e.Z.removeEvent(t,"click",this.pointerClickListener,this),e.Z.removeEvent(t,"dblclick",this.pointerDblClickListener,this)),this.hasWheelHandlers&&(e.Z.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),e.Z.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasPointerUp&&(window.navigator.msPointerEnabled?e.Z.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.Z.removeEvent(this.document,"pointerup",this.pointerUpListener,this),e.Z.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this.hasPointerHandlers=!1}},removeMouseEventHandlers:function(){if(this.hasMouseHandlers&&e.Z.isBrowser){var t=this.attr.movetarget||this.containerObj;e.Z.removeEvent(this.containerObj,"mousedown",this.mouseDownListener,this),e.Z.removeEvent(t,"mousemove",this.mouseMoveListener,this),e.Z.removeEvent(t,"click",this.mouseClickListener,this),e.Z.removeEvent(t,"dblclick",this.mouseDblClickListener,this),this.hasMouseUp&&(e.Z.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.hasWheelHandlers&&(e.Z.removeEvent(this.containerObj,"mousewheel",this.mouseWheelListener,this),e.Z.removeEvent(this.containerObj,"DOMMouseScroll",this.mouseWheelListener,this)),this.hasMouseHandlers=!1}},removeTouchEventHandlers:function(){if(this.hasTouchHandlers&&e.Z.isBrowser){var t=this.attr.movetarget||this.containerObj;e.Z.removeEvent(this.containerObj,"touchstart",this.touchStartListener,this),e.Z.removeEvent(t,"touchmove",this.touchMoveListener,this),this.hasTouchEnd&&(e.Z.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,r,o,n,a,l,c,d,p,f,_,g,m=!1,b=this.attr.zoom.factorx,v=this.attr.zoom.factory,Z=!1;return this.mode!==this.BOARD_MODE_ZOOM||(t.preventDefault(),l=h.Z.distance([t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY],2),void 0===t.scale&&(t.scale=l/this.prevDist),!!s.Z.exists(this.prevCoords)&&(r=[t.touches[0].clientX-this.prevCoords[0][0],t.touches[0].clientY-this.prevCoords[0][1]],o=[t.touches[1].clientX-this.prevCoords[1][0],t.touches[1].clientY-this.prevCoords[1][1]],r[0]*r[0]+r[1]*r[1]<100&&o[0]*o[0]+o[1]*o[1]<100||(n=h.Z.rad(r,[0,0],o),"pan"!==this.isPreviousGesture&&Math.abs(n)>.2*Math.PI&&Math.abs(n)<1.8*Math.PI&&(m=!0),"pan"===this.isPreviousGesture||m||(Math.abs(t.scale)<.77||Math.abs(t.scale)>1.3)&&(m=!0),a=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 u.Z(i.Z.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!m?(this.isPreviousGesture="pan",this.moveOrigin(e.scrCoords[1],e.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(a-1)<.5&&(Z=!1,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(p=Math.abs(t.touches[0].clientX-t.touches[1].clientX),f=Math.abs(t.touches[0].clientY-t.touches[1].clientY),c=Math.abs(Math.atan2(f,p)),d=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&c<d?(this.attr.zoom.factorx=a,this.attr.zoom.factory=1,_=0,g=0,Z=!0):!this.keepaspectratio&&this.attr.zoom.pinchvertical&&Math.abs(c-.5*Math.PI)<d?(this.attr.zoom.factorx=1,this.attr.zoom.factory=a,_=0,g=0,Z=!0):this.attr.zoom.pinch&&(this.attr.zoom.factorx=a,this.attr.zoom.factory=a,_=e.usrCoords[1],g=e.usrCoords[2],Z=!0),Z&&(this.zoomIn(_,g),this.attr.zoom.factorx=b,this.attr.zoom.factory=v))),!1))},gestureStartListener:function(t){var e;return t.preventDefault(),this.prevScale=1,this.prevDist=h.Z.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(e.Z.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,i,r){var o,n,a,h,l,c,d,u,p,f,_;if(!i&&this._isPointerRegistered(t))return!1;if(null===s.Z.evaluate(this.attr.movetarget)&&s.Z.exists(t.target)&&s.Z.exists(t.target.releasePointerCapture)&&t.target.releasePointerCapture(t.pointerId),!i&&t.isPrimary,this.hasPointerUp||(window.navigator.msPointerEnabled?e.Z.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.Z.addEvent(this.document,"pointerup",this.pointerUpListener,this),e.Z.addEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&s.Z.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(c=window.getSelection()).removeAllRanges)try{c.removeAllRanges()}catch(t){}if(this._inputDevice=this._getPointerInputDevice(t),u=this._inputDevice,this.options.precision.hasPoint=this.options.precision[u],h=this.getMousePosition(t),this._testForSelection(t),this.selectingMode)return this._startSelecting(h),void this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[t]);if(this.attr.drag.enabled&&i?(l=[i],this.mode=this.BOARD_MODE_DRAG):l=this.initMoveObject(h[0],h[1],t,u),d={num:t.pointerId,X:h[0],Y:h[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},l.length>0){for(f=l[l.length-1],p=!1,o=0;o<this.touches.length;o++)if(this.touches[o].obj===f){n=o,a=this.touches[o].targets.push(d)-1,p=!0;break}p||(a=0,n=this.touches.push({obj:f,targets:[d]})-1),this.dehighlightAll(),f.highlight(!0),this.saveStartPos(f,this.touches[n].targets[a]),t&&t.preventDefault&&!r&&t.preventDefault()}return this.touches.length>0&&!r&&(t.preventDefault(),t.stopPropagation()),!!e.Z.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))),_="none",this.mode!==this.BOARD_MODE_NONE||!s.Z.evaluate(this.attr.browserpan)||s.Z.evaluate(this.attr.pan.enabled)&&!s.Z.evaluate(this.attr.pan.needtwofingers)||(_="pan-x pan-y"),this.containerObj.style.touchAction=_,this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[t]),!0)},_waitForDblClick:function(t){var e=this.downObjects[t].eventHandlers;s.Z.exists(e.dblclick)&&e.dblclick.length>0||s.Z.exists(e.mousedblclick)&&e.mousedblclick.length>0?(e.clicks+=1,2!==e.clicks&&(this.downObjects.splice(t,1),setTimeout((function(){e.clicks=0}),400))):this.downObjects.splice(t,1)},pointerClickListener:function(t){var e;if(this.triggerEventHandlers(["click","pointerclick"],[t]),!this.selectingMode)for(e=this.downObjects.length-1;e>-1;e--)this.downObjects[e].triggerEventHandlers(["click","pointerclick"],[t]),this._waitForDblClick(e);t.stopPropagation()},mouseClickListener:function(t){var e;if(this.triggerEventHandlers(["click","mouseclick"],[t]),!this.selectingMode)for(e=this.downObjects.length-1;e>-1;e--)this.downObjects[e].triggerEventHandlers(["click","mouseclick"],[t]),this._waitForDblClick(e)},pointerDblClickListener:function(t){var e;if(this.triggerEventHandlers(["dblclick","pointerdblclick"],[t]),!this.selectingMode)for(e=this.downObjects.length-1;e>-1;e--)this.downObjects[e].triggerEventHandlers(["dblclick","pointerdblclick"],[t]),this.downObjects[e].eventHandlers.clicks=0,this.downObjects.splice(e,1);t.stopPropagation()},mouseDblClickListener:function(t){var e;if(this.triggerEventHandlers(["dblclick","mousedblclick"],[t]),!this.selectingMode)for(e=this.downObjects.length-1;e>-1;e--)this.downObjects[e].triggerEventHandlers(["dblclick","mousedblclick"],[t]),this.downObjects[e].eventHandlers.clicks=0,this.downObjects.splice(e,1)},pointerMoveListener:function(t){var e,i,r,o,n,a;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),a=this._inputDevice,this.options.precision.hasPoint=this.options.precision[a],o=.3333*this.options.precision.hasPoint,r=this.getMousePosition(t),null===s.Z.evaluate(this.attr.movetarget)&&r[0]<=o||r[1]<=o||r[0]>=this.canvasWidth-o||r[1]>=this.canvasHeight-o)return this.mode===this.BOARD_MODE_NONE;if(this.selectingMode)this._moveSelecting(r),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(n=this.touches[e].targets,i=0;i<n.length;i++)if(n[i].num===t.pointerId){n[i].X=r[0],n[i].Y=r[1],1===n.length?this.moveObject(r[0],r[1],this.touches[e],t,a):2===n.length&&(this.twoFingerMove(this.touches[e],t.pointerId,t),n[i].Xprev=r[0],n[i].Yprev=r[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(r[0],r[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 i,r,o,n,a,h=!1;if(this.triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[t]),this.displayInfobox(!1),t)for(i=0;i<this.touches.length;i++)for(a=this.touches[i].targets,r=0;r<a.length;r++)if(a[r].num===t.pointerId){a.splice(r,1),0===a.length&&this.touches.splice(i,1);break}if(this.originMoveEnd(),this.update(),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","pointerstopselecting","stopselecting"],[t]),this.stopSelectionMode();else for(i=this.downObjects.length-1;i>-1;i--){for(o=!1,r=0;r<this.touches.length;r++)this.touches[r].obj.id===this.downObjects[i].id&&(o=!0);o||(this.downObjects[i].triggerEventHandlers(["touchend","up","pointerup","MSPointerUp"],[t]),s.Z.exists(this.downObjects[i].coords)||(this.downObjects[i].snapToGrid(),this.downObjects[i].snapToPoints(),h=!0),n=this.downObjects[i].eventHandlers,s.Z.exists(n.click)&&n.click.length>0||s.Z.exists(n.pointerclick)&&n.pointerclick.length>0||s.Z.exists(n.dblclick)&&n.dblclick.length>0||s.Z.exists(n.pointerdblclick)&&n.pointerdblclick.length>0||this.downObjects.splice(i,1))}return this.hasPointerUp&&(window.navigator.msPointerEnabled?e.Z.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.Z.removeEvent(this.document,"pointerup",this.pointerUpListener,this),e.Z.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this._pointerClearTouches(t.pointerId),"touch"!==this._getPointerInputDevice(t)&&this.dehighlightAll(),h&&this.update(),!0},pointerLeaveListener:function(t){return this.displayInfobox(!1),this.dehighlightAll(),!0},touchStartListener:function(r){var o,n,a,h,l,c,d,u,p,f,_=this.options.precision.touch,g=r[t.Z.touchProperty];for(this.hasTouchEnd||(e.Z.addEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!0),this.document.selection&&s.Z.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,o=0;o<g.length;o++)g[o].jxg_isused=!1;for(o=0;o<this.touches.length;o++)for(f=this.touches[o].targets,h=0;h<f.length;h++){f[h].num=-1,_=this.options.precision.touch;do{for(l=0;l<g.length;l++)if(Math.abs(Math.pow(g[l].screenX-f[h].X,2)+Math.pow(g[l].screenY-f[h].Y,2))<_*_){f[h].num=l,f[h].X=g[l].screenX,f[h].Y=g[l].screenY,g[l].jxg_isused=!0;break}_*=2}while(-1===f[h].num&&_<this.options.precision.touchMax);-1===f[h].num&&(t.Z.debug("i couldn't find a targettouches for target no "+h+" on "+this.touches[o].obj.name+" ("+this.touches[o].obj.id+"). Removed the target."),t.Z.debug("eps = "+_+", touchMax = "+k.Z.precision.touchMax),f.splice(o,1))}for(o=0;o<g.length;o++)if(!g[o].jxg_isused){if(n=this.getMousePosition(r,o),this.selectingMode)return this._startSelecting(n),this.triggerEventHandlers(["touchstartselecting","startselecting"],[r]),r.preventDefault(),r.stopPropagation(),this.options.precision.hasPoint=this.options.precision.mouse,this.touches.length>0;if(0!==(a=this.initMoveObject(n[0],n[1],r,"touch")).length)if(c=a[a.length-1],p={num:o,X:g[o].screenX,Y:g[o].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},s.Z.isPoint(c)||c.elementClass===i.Z.OBJECT_CLASS_TEXT||c.type===i.Z.OBJECT_TYPE_TICKS||c.type===i.Z.OBJECT_TYPE_IMAGE)u=[p],this.saveStartPos(c,u[0]),this.touches.push({obj:c,targets:u}),c.highlight(!0);else if(c.elementClass===i.Z.OBJECT_CLASS_LINE||c.elementClass===i.Z.OBJECT_CLASS_CIRCLE||c.elementClass===i.Z.OBJECT_CLASS_CURVE||c.type===i.Z.OBJECT_TYPE_POLYGON){for(d=!1,h=0;h<this.touches.length;h++)c.id===this.touches[h].obj.id&&(d=!0,1===this.touches[h].targets.length&&(this.saveStartPos(c,p),this.touches[h].targets.push(p)),g[o].jxg_isused=!0);d||(u=[p],this.saveStartPos(c,u[0]),this.touches.push({obj:c,targets:u}),c.highlight(!0))}g[o].jxg_isused=!0}return this.touches.length>0&&(r.preventDefault(),r.stopPropagation()),1===g.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(r)||2!==g.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(r)),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[r]),!1},touchMoveListener:function(e){var i,s,r,o,n=e[t.Z.touchProperty];if(!this.checkFrameRate(e))return!1;if(this.mode!==this.BOARD_MODE_NONE&&(e.preventDefault(),e.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(i=0;i<n.length;i++)if(!n[i].jxg_isused){s=this.getMousePosition(e,i),this._moveSelecting(s),this.triggerEventHandlers(["touchmoves","moveselecting"],[e,this.mode]);break}}else if(!this.touchOriginMove(e))if(this.mode===this.BOARD_MODE_DRAG){for(i=0;i<this.touches.length;i++)if(1===(o=this.touches[i].targets).length){if(n[o[0].num]){if((s=this.getMousePosition(e,o[0].num))[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight)return;o[0].X=s[0],o[0].Y=s[1],this.moveObject(s[0],s[1],this.touches[i],e,"touch")}}else if(2===o.length&&o[0].num>-1&&o[1].num>-1&&n[o[0].num]&&n[o[1].num]){if(s=this.getMousePosition(e,o[0].num),r=this.getMousePosition(e,o[1].num),s[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight||r[0]<0||r[0]>this.canvasWidth||r[1]<0||r[1]>this.canvasHeight)return;o[0].X=s[0],o[0].Y=s[1],o[1].X=r[0],o[1].Y=r[1],this.twoFingerMove(this.touches[i],o[0].num,e),o[0].Xprev=s[0],o[0].Yprev=s[1],o[1].Xprev=r[0],o[1].Yprev=r[1]}}else 2===n.length&&this.gestureChangeListener(e),s=this.getMousePosition(e,0),this.highlightElements(s[0],s[1],e,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.displayInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[e,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(r){var o,n,a,h,l,c,d=this.options.precision.touch,u=[],p=r&&r[t.Z.touchProperty],f=!1;if(this.triggerEventHandlers(["touchend","up"],[r]),this.displayInfobox(!1),this.selectingMode)this._stopSelecting(r),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[r]),this.stopSelectionMode();else if(p&&p.length>0){for(o=0;o<this.touches.length;o++)u[o]=this.touches[o];for(this.touches.length=0,o=0;o<p.length;o++)p[o].jxg_isused=!1;for(o=0;o<u.length;o++){for(h=!1,l=0,c=u[o].targets,n=0;n<c.length;n++)for(c[n].found=!1,a=0;a<p.length;a++)if(Math.abs(Math.pow(p[a].screenX-c[n].X,2)+Math.pow(p[a].screenY-c[n].Y,2))<d*d){c[n].found=!0,c[n].num=a,c[n].X=p[a].screenX,c[n].Y=p[a].screenY,l+=1;break}if(s.Z.isPoint(u[o].obj)?h=c[0]&&c[0].found:u[o].obj.elementClass===i.Z.OBJECT_CLASS_LINE?h=c[0]&&c[0].found||c[1]&&c[1].found:u[o].obj.elementClass===i.Z.OBJECT_CLASS_CIRCLE&&(h=1===l||3===l),h)for(this.touches.push({obj:u[o].obj,targets:[]}),n=0;n<c.length;n++)c[n].found&&this.touches[this.touches.length-1].targets.push({num:c[n].num,X:c[n].screenX,Y:c[n].screenY,Xprev:NaN,Yprev:NaN,Xstart:c[n].Xstart,Ystart:c[n].Ystart,Zstart:c[n].Zstart});else u[o].obj.noHighlight()}}else this.touches.length=0;for(o=this.downObjects.length-1;o>-1;o--){for(h=!1,n=0;n<this.touches.length;n++)this.touches[n].obj.id===this.downObjects[o].id&&(h=!0);h||(this.downObjects[o].triggerEventHandlers(["touchup","up"],[r]),s.Z.exists(this.downObjects[o].coords)||(this.downObjects[o].snapToGrid(),this.downObjects[o].snapToPoints(),f=!0),this.downObjects.splice(o,1))}return p&&0!==p.length||(this.hasTouchEnd&&(e.Z.removeEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!1),this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.originMoveEnd(),f&&this.update()),!0},mouseDownListener:function(t){var i,r,o;if(this.document.selection&&s.Z.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),!this.hasMouseUp)return e.Z.addEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!0,this._inputDevice="mouse",this.options.precision.hasPoint=this.options.precision.mouse,i=this.getMousePosition(t),this._testForSelection(t),this.selectingMode?(this._startSelecting(i),void this.triggerEventHandlers(["mousestartselecting","startselecting"],[t])):(0===(r=this.initMoveObject(i[0],i[1],t,"mouse")).length?(this.mode=this.BOARD_MODE_NONE,o=!0):(this.mouse={obj:null,targets:[{X:i[0],Y:i[1],Xprev:NaN,Yprev:NaN}]},this.mouse.obj=r[r.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&&(o=this.mouseOriginMoveStart(t)),this.triggerEventHandlers(["mousedown","down"],[t]),o)},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 i;if(!1===this.selectingMode&&this.triggerEventHandlers(["mouseup","up"],[t]),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mouse&&this.mouse.obj&&(s.Z.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(i=0;i<this.downObjects.length;i++)this.downObjects[i].triggerEventHandlers(["mouseup","up"],[t]);this.downObjects.length=0,this.hasMouseUp&&(e.Z.removeEvent(this.document,"mouseup",this.mouseUpListener,this),this.hasMouseUp=!1),this.mouse=null},mouseWheelListener:function(t){if(!this.attr.zoom.enabled||!this.attr.zoom.wheel||!this._isRequiredKeyPressed(t,"zoom"))return!0;var e=(t=t||window.event).detail?-t.detail:t.wheelDelta/40,s=new u.Z(i.Z.COORDS_BY_SCREEN,this.getMousePosition(t),this);return e>0?this.zoomIn(s.usrCoords[1],s.usrCoords[2]):this.zoomOut(s.usrCoords[1],s.usrCoords[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1},keyDownListener:function(e){var r,o,n,a,h,l,c=e.target.id,d=0,u=0,p=s.Z.evaluate(this.attr.keyboard.dx)/this.unitX,f=s.Z.evaluate(this.attr.keyboard.dy)/this.unitY,_=!1,g=!0;return!(!this.attr.keyboard.enabled||""===c)&&((!(a=this.containerObj.shadowRoot||document).activeElement||"INPUT"!==(o=a.activeElement).tagName&&"textarea"!==o.tagName)&&(r=c.replace(this.containerObj.id+"_",""),o=this.select(r),s.Z.exists(o.coords)&&(l=o.coords.usrCoords.slice(1)),s.Z.evaluate(this.attr.keyboard.panshift)&&e.shiftKey||s.Z.evaluate(this.attr.keyboard.panctrl)&&e.ctrlKey?(!0===s.Z.evaluate(this.attr.zoom.enabled)&&(_=!0),38===e.keyCode?this.clickUpArrow():40===e.keyCode?this.clickDownArrow():37===e.keyCode?this.clickLeftArrow():39===e.keyCode?this.clickRightArrow():_&&171===e.keyCode?this.zoomIn():_&&173===e.keyCode?this.zoomOut():_&&79===e.keyCode?this.zoom100():g=!1):(s.Z.exists(o.visProp)&&(s.Z.exists(o.visProp.snaptogrid)&&o.visProp.snaptogrid&&s.Z.evaluate(o.visProp.snapsizex)&&s.Z.evaluate(o.visProp.snapsizey)?(p=d=(n=o.getSnapSizes())[0],f=u=n[1]):s.Z.exists(o.visProp.attracttogrid)&&o.visProp.attracttogrid&&s.Z.evaluate(o.visProp.attractordistance)&&s.Z.evaluate(o.visProp.attractorunit)&&(u=d=1.1*s.Z.evaluate(o.visProp.attractordistance),"screen"===s.Z.evaluate(o.visProp.attractorunit)&&(d/=this.unitX,u/=this.unitX),p=Math.max(d,p),f=Math.max(u,f))),38===e.keyCode?h=[0,f]:40===e.keyCode?h=[0,-f]:37===e.keyCode?h=[-p,0]:39===e.keyCode?h=[p,0]:g=!1,h&&o.isDraggable&&o.visPropCalc.visible&&(this.geonextCompatibilityMode&&(s.Z.isPoint(o)||o.elementClass===i.Z.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!s.Z.evaluate(o.visProp.fixed)&&(this.mode=this.BOARD_MODE_DRAG,s.Z.exists(o.coords)&&(h[0]+=l[0],h[1]+=l[1]),s.Z.exists(o.coords)?(o.setPosition(t.Z.COORDS_BY_USER,h),this.updateInfobox(o)):(this.displayInfobox(!1),o.setPositionDirectly(i.Z.COORDS_BY_USER,h,[0,0])),this.triggerEventHandlers(["keymove","move"],[e,this.mode]),o.triggerEventHandlers(["keydrag","drag"],[e]),this.mode=this.BOARD_MODE_NONE)),this.update(),g&&s.Z.exists(e.preventDefault)&&e.preventDefault(),g))},keyFocusInListener:function(t){var e,i,r=t.target.id;if(!this.attr.keyboard.enabled||""===r)return!1;e=r.replace(this.containerObj.id+"_",""),i=this.select(e),s.Z.exists(i.highlight)&&(i.highlight(!0),this.focusObjects=[e],i.triggerEventHandlers(["hit"],[t])),s.Z.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(){var t,e,i,r,o,n;t=(i=this.containerObj.getBoundingClientRect()).width,e=i.height,window&&window.getComputedStyle&&(r=window.getComputedStyle(this.containerObj,null),o=parseFloat(r.getPropertyValue("border-left-width"))+parseFloat(r.getPropertyValue("border-right-width")),isNaN(o)||(t-=o),n=parseFloat(r.getPropertyValue("border-top-width"))+parseFloat(r.getPropertyValue("border-bottom-width")),isNaN(n)||(e-=n)),t<=0||e<=0||isNaN(t)||isNaN(e)||(isNaN(this.getBoundingBox()[0])&&this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"keep"),s.Z.exists(this._prevDim)&&this._prevDim.w===t&&this._prevDim.h===e||(this.resizeContainer(t,e,!0),this._prevDim={w:t,h:e}))},startResizeObserver:function(){var t=this;e.Z.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&(this.resizeObserver=new ResizeObserver((function(e){t._isResizing||(t._isResizing=!0,window.setTimeout((function(){try{t.updateContainerDims()}catch(e){t.stopResizeObserver()}finally{t._isResizing=!1}}),t.attr.resize.throttle))})),this.resizeObserver.observe(this.containerObj))},stopResizeObserver:function(){e.Z.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&s.Z.exists(this.resizeObserver)&&this.resizeObserver.unobserve(this.containerObj)},resizeListener:function(){var t=this;e.Z.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 i=this;e.Z.isBrowser&&(this._isScrolling||(this._isScrolling=!0,window.setTimeout((function(){i._isScrolling=!1}),66)))},startIntersectionObserver:function(){var e=this;try{this.intersectionObserver=new IntersectionObserver((function(t){isNaN(e.getBoundingBox()[0])&&e.updateContainerDims()}),{root:null,rootMargin:"0px",threshold:.8}),this.intersectionObserver.observe(e.containerObj)}catch(e){t.Z.debug("JSXGraph: IntersectionObserver not available in this browser.")}},stopIntersectionObserver:function(){s.Z.exists(this.intersectionObserver)&&this.intersectionObserver.unobserve(this.containerObj)},initInfobox:function(t){var e=s.Z.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,r,o,n,a,h,l=s.Z.evaluate(t.visProp.showinfobox);return!s.Z.evaluate(this.attr.showinfobox)&&"inherit"===l||!l||s.Z.isPoint(t)&&(r=t.coords.usrCoords[1],o=t.coords.usrCoords[2],a=s.Z.evaluate(this.infobox.visProp.distancex),h=s.Z.evaluate(this.infobox.visProp.distancey),this.infobox.setCoords(r+a/this.unitX,o+h/this.unitY),n=s.Z.evaluate(t.visProp.infoboxdigits),"string"!=typeof t.infoboxText?("auto"===n?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(r),i=this.infobox.formatNumberLocale(o)):(e=s.Z.autoDigits(r),i=s.Z.autoDigits(o)):s.Z.isNumber(n)?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(r,n),i=this.infobox.formatNumberLocale(o,n)):(e=s.Z.toFixed(r,n),i=s.Z.toFixed(o,n)):(e=r,i=o),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===i.Z.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 s=this.getCoordsTopLeftCorner(),r=e.Z.getPosition(t,null,this.document),o=r[0]-s[0],n=r[1]-s[1];return new u.Z(i.Z.COORDS_BY_SCREEN,[o,n],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var i,s,r=this.getCoordsTopLeftCorner(),o=e.Z.getPosition(t,null,this.document),n=o[0]-r[0],a=o[1]-r[1],h=[],l=this.objectsList.length;for(i=0;i<l;i++)(s=this.objectsList[i]).visPropCalc.visible&&s.hasPoint&&s.hasPoint(n,a)&&(h[h.length]=s);return h},updateCoords:function(){var t,e,i=this.objectsList.length;for(e=0;e<i;e++)t=this.objectsList[e],s.Z.exists(t.coords)&&(s.Z.evaluate(t.visProp.frozen)?t.is3D?t.element2D.coords.screen2usr():t.coords.screen2usr():t.is3D?t.element2D.coords.usr2screen():t.coords.usr2screen());return this},moveOrigin:function(t,e,r){var o,n,a,h;return s.Z.exists(t)&&s.Z.exists(e)&&(o=this.origin.scrCoords[1],n=this.origin.scrCoords[2],this.origin.scrCoords[1]=t,this.origin.scrCoords[2]=e,r&&(this.origin.scrCoords[1]-=this.drag_dx,this.origin.scrCoords[2]-=this.drag_dy),a=new u.Z(i.Z.COORDS_BY_SCREEN,[0,0],this).usrCoords,h=new u.Z(i.Z.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords,(a[1]<this.maxboundingbox[0]||a[2]>this.maxboundingbox[1]||h[1]>this.maxboundingbox[2]||h[2]<this.maxboundingbox[3])&&(this.origin.scrCoords[1]=o,this.origin.scrCoords[2]=n)),this.updateCoords().clearTraces().fullUpdate(),this.triggerEventHandlers(["boundingbox"]),this},addConditions:function(e){var r,o,n,a,h,l,c,d=[],u=e.indexOf("<data>"),p=e.indexOf("</data>"),f=function(t,e,s,r){return function(){var o,n;n=(o=t.select(e.id)).coords.usrCoords[r],2===r?o.setPositionDirectly(i.Z.COORDS_BY_USER,[s(),n]):o.setPositionDirectly(i.Z.COORDS_BY_USER,[n,s()]),o.prepareUpdate().update()}},_=function(t,e,i){return function(){var s,r;s=t.select(e.id),r=i(),s.setAttribute({visible:r})}},g=function(t,e,i,s){return function(){var r,o;r=t.select(e.id),o=i(),"strokewidth"===s?r.visProp.strokewidth=o:(o=Y.Z.rgba2rgbo(o),r.visProp[s+"color"]=o[0],r.visProp[s+"opacity"]=o[1])}},m=function(t,e,i){return function(){t.select(e.id).position=i()}},b=function(t,e,i){return function(){t.select(e.id).setStyle(i())}};if(!(u<0)){for(;u>=0;){if(o=(r=e.slice(u+6,p)).indexOf("="),n=r.slice(0,o),a=r.slice(o+1),o=n.indexOf("."),h=n.slice(0,o),l=this.elementsByName[s.Z.unescapeHTML(h)],c=n.slice(o+1).replace(/\s+/g,"").toLowerCase(),a=s.Z.createFunction(a,this,"",!0),s.Z.exists(this.elementsByName[h]))switch(c){case"x":d.push(f(this,l,a,2));break;case"y":d.push(f(this,l,a,1));break;case"visible":d.push(_(this,l,a));break;case"position":d.push(m(this,l,a));break;case"stroke":d.push(g(this,l,a,"stroke"));break;case"style":d.push(b(this,l,a));break;case"strokewidth":d.push(g(this,l,a,"strokewidth"));break;case"fill":d.push(g(this,l,a,"fill"));break;case"label":break;default:t.Z.debug('property "'+c+'" in conditions not yet implemented:'+a)}else t.Z.debug("debug conditions: |"+h+"| undefined");u=(e=e.slice(p+7)).indexOf("<data>"),p=e.indexOf("</data>")}this.updateConditions=function(){var t;for(t=0;t<d.length;t++)d[t]();return this.prepareUpdate().updateElements(),!0},this.updateConditions()}},updateConditions:function(){return!1},calculateSnapSizes:function(){var t,e,r,o,n=this.getBoundingBox(),a=s.Z.evaluate(this.options.grid.majorStep),h=s.Z.evaluate(this.options.grid.gridX),l=s.Z.evaluate(this.options.grid.gridY);for(s.Z.isArray(a)||(a=[a,a]),a.length<2&&(a=[a[0],a[0]]),s.Z.exists(h)&&(a[0]=h),s.Z.exists(l)&&(a[1]=l),"auto"===a[0]?a[0]=1:a[0]=s.Z.parseNumber(a[0],Math.abs(n[1]-n[3]),1/this.unitX),"auto"===a[1]?a[1]=1:a[1]=s.Z.parseNumber(a[1],Math.abs(n[0]-n[2]),1/this.unitY),t=new u.Z(i.Z.COORDS_BY_USER,[0,0],this),e=new u.Z(i.Z.COORDS_BY_USER,[a[0],a[1]],this),r=t.scrCoords[1]-e.scrCoords[1],o=t.scrCoords[2]-e.scrCoords[2],this.options.grid.snapSizeX=a[0];Math.abs(r)>25;)this.options.grid.snapSizeX*=2,r/=2;for(this.options.grid.snapSizeY=a[1];Math.abs(o)>25;)this.options.grid.snapSizeY*=2,o/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),r=this.attr.zoom.factorx,o=this.attr.zoom.factory,n=(i[2]-i[0])*(1-1/r),a=(i[1]-i[3])*(1-1/o),h=.5,l=.5,c=this.attr.zoom.eps||this.attr.zoom.min||.001;return this.zoomX>this.attr.zoom.max&&r>1||this.zoomY>this.attr.zoom.max&&o>1||this.zoomX<c&&r<1||this.zoomY<c&&o<1?this:(s.Z.isNumber(t)&&s.Z.isNumber(e)&&(h=(t-i[0])/(i[2]-i[0]),l=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+n*h,i[1]-a*l,i[2]-n*(1-h),i[3]+a*(1-l)],this.keepaspectratio,"update"),this.applyZoom())},zoomOut:function(t,e){var i=this.getBoundingBox(),r=this.attr.zoom.factorx,o=this.attr.zoom.factory,n=(i[2]-i[0])*(1-r),a=(i[1]-i[3])*(1-o),h=.5,l=.5,c=this.attr.zoom.eps||this.attr.zoom.min||.001;return this.zoomX<c||this.zoomY<c?this:(s.Z.isNumber(t)&&s.Z.isNumber(e)&&(h=(t-i[0])/(i[2]-i[0]),l=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+n*h,i[1]-a*l,i[2]-n*(1-h),i[3]+a*(1-l)],this.keepaspectratio,"update"),this.applyZoom())},zoom100:function(){var t,e,i;return s.Z.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,r,o=0,n=0,a=0,h=0,l=this.objectsList.length;for(t=0;t<l;t++)r=this.objectsList[t],s.Z.isPoint(r)&&r.visPropCalc.visible&&(r.coords.usrCoords[1]<o?o=r.coords.usrCoords[1]:r.coords.usrCoords[1]>n&&(n=r.coords.usrCoords[1]),r.coords.usrCoords[2]>h?h=r.coords.usrCoords[2]:r.coords.usrCoords[2]<a&&(a=r.coords.usrCoords[2]));return 50,e=50/this.unitX,i=50/this.unitY,this.setBoundingBox([o-e,h+i,n+e,a-i],this.keepaspectratio,"update"),this.applyZoom()},zoomElements:function(t){var e,i,r,o,n,a,h,l=[1/0,-1/0,-1/0,1/0];if(!s.Z.isArray(t)||0===t.length)return this;for(e=0;e<t.length;e++)i=this.select(t[e]).bounds(),s.Z.isArray(i)&&(i[0]<l[0]&&(l[0]=i[0]),i[1]>l[1]&&(l[1]=i[1]),i[2]>l[2]&&(l[2]=i[2]),i[3]<l[3]&&(l[3]=i[3]));return s.Z.isArray(l)&&(r=.5*(l[0]+l[2]),o=.5*(l[1]+l[3]),n=1.5*(l[2]-l[0])*.5,a=1.5*(l[1]-l[3])*.5,h=Math.max(n,a),this.setBoundingBox([r-h,o+h,r+h,o-h],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(e,r){var o,n;if(s.Z.isArray(e)){for(n=0;n<e.length;n++)this._removeObj(e[n],r);return this}if(e=this.select(e),!s.Z.exists(e)||s.Z.isString(e))return this;try{for(o in e.childElements)e.childElements.hasOwnProperty(o)&&e.childElements[o].board._removeObj(e.childElements[o]);for(o in e.objects)e.objects.hasOwnProperty(o)&&e.objects[o].board._removeObj(e.objects[o]);if(r)for(o in this.objects)this.objects.hasOwnProperty(o)&&s.Z.exists(this.objects[o].childElements)&&s.Z.exists(this.objects[o].childElements.hasOwnProperty(e.id))&&(delete this.objects[o].childElements[e.id],delete this.objects[o].descendants[e.id]);else if(s.Z.exists(e.ancestors))for(o in e.ancestors)e.ancestors.hasOwnProperty(o)&&s.Z.exists(e.ancestors[o].childElements)&&s.Z.exists(e.ancestors[o].childElements.hasOwnProperty(e.id))&&(delete e.ancestors[o].childElements[e.id],delete e.ancestors[o].descendants[e.id]);if(e._pos>-1)for(this.objectsList.splice(e._pos,1),n=e._pos;n<this.objectsList.length;n++)this.objectsList[n]._pos--;else e.type!==i.Z.OBJECT_TYPE_TURTLE&&t.Z.debug("Board.removeObject: object "+e.id+" not found in list.");delete this.objects[e.id],delete this.elementsByName[e.name],e.visProp&&s.Z.evaluate(e.visProp.trace)&&e.clearTrace(),s.Z.exists(e.remove)&&e.remove()}catch(i){t.Z.debug(e.id+": Could not be removed: "+i)}return this},removeObject:function(t,e){var i;if(this.renderer.suspendRedraw(this),s.Z.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,n,a,h,l;return n=this.canvasWidth,a=this.canvasHeight,s||(r=this.getBoundingBox()),this.canvasWidth=Math.max(parseFloat(t),o.Z.eps),this.canvasHeight=Math.max(parseFloat(e),o.Z.eps),i||(this.containerObj.style.width=this.canvasWidth+"px",this.containerObj.style.height=this.canvasHeight+"px"),this.renderer.resize(this.canvasWidth,this.canvasHeight),s?(h=(this.canvasWidth-n)/2,l=(this.canvasHeight-a)/2,this.moveOrigin(this.origin.scrCoords[1]+h,this.origin.scrCoords[2]+l)):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>"+s.Z.escapeHTML(this.xmlString)+"</pre>"),t.document.close(),this},prepareUpdate:function(){var t,e,i=this.objectsList.length;for(t=0;t<i;t++)(e=this.objectsList[t]).needsUpdate=e.needsRegularUpdate||this.needsFullUpdate;for(t in this.groups)this.groups.hasOwnProperty(t)&&((e=this.groups[t]).needsUpdate=e.needsRegularUpdate||this.needsFullUpdate);return this},updateElements:function(t){var e,r;for(t=this.select(t),e=0;e<this.objectsList.length;e++)r=this.objectsList[e],this.needsFullUpdate&&r.elementClass===i.Z.OBJECT_CLASS_TEXT&&r.updateSize(),r.update(!s.Z.exists(t)||r.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=this.objectsList.length;if(this.renderer){if("canvas"===this.renderer.type)this.updateRendererCanvas();else for(t=0;t<e;t++)this.objectsList[t].updateRenderer();return this}},updateRendererCanvas:function(){var t,e,i,s,r,o=this.objectsList.length,n=this.options.layer,a=this.options.layer.numlayers,h=Number.NEGATIVE_INFINITY;for(i=0;i<a;i++){for(r in s=Number.POSITIVE_INFINITY,n)n.hasOwnProperty(r)&&n[r]>h&&n[r]<s&&(s=n[r]);for(h=s,t=0;t<o;t++)(e=this.objectsList[t]).visProp.layer===s&&e.prepareUpdate().updateRenderer()}return this},addHook:function(e,i,r){return t.Z.deprecated("Board.addHook()","Board.on()"),i=s.Z.def(i,"update"),r=s.Z.def(r,this),this.hooks.push([i,e]),this.on(i,e,r),this.hooks.length-1},addEvent:t.Z.shortcut(t.Z.Board.prototype,"on"),removeHook:function(e){return t.Z.deprecated("Board.removeHook()","Board.off()"),this.hooks[e]&&(this.off(this.hooks[e][0],this.hooks[e][1]),this.hooks[e]=null),this},removeEvent:t.Z.shortcut(t.Z.Board.prototype,"off"),updateHooks:function(e){var i=Array.prototype.slice.call(arguments,0);return t.Z.deprecated("Board.updateHooks()","Board.triggerEventHandlers()"),i[0]=s.Z.def(i[0],"update"),this.triggerEventHandlers([i[0]],arguments),this},addChild:function(t){return s.Z.exists(t)&&s.Z.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,r,o,n;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,"all"===this.attr.minimizereflow&&this.containerObj&&"vml"!==this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.containerObj)),"svg"===this.attr.minimizereflow&&"svg"===this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate().updateElements(t).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw(),this.triggerEventHandlers(["update"],[]),o&&(o(),n.focus()),i=this.dependentBoards.length,e=0;e<i;e++)r=this.dependentBoards[e],s.Z.exists(r)&&r!==this&&(r.updateQuality=this.updateQuality,r.prepareUpdate().updateElements().updateConditions(),r.renderer.suspendRedraw(this),r.updateRenderer(),r.renderer.unsuspendRedraw(),r.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(e,i,r){var o,n;for(e=e.toLowerCase(),s.Z.exists(i)||(i=[]),s.Z.exists(r)||(r={}),n=0;n<i.length;n++)!s.Z.isString(i[n])||"text"===e&&2===n||"solidofrevolution3d"===e&&2===n||!("input"!==e&&"checkbox"!==e&&"button"!==e||2!==n&&3!==n)||"curve"===e||"functiongraph"===e||"implicitcurve"===e||(i[n]=this.select(i[n]));if(!s.Z.isFunction(t.Z.elements[e]))throw new Error("JSXGraph: create: Unknown element type given: "+e);return o=t.Z.elements[e](this,i,r),s.Z.exists(o)?(o.prepareUpdate&&o.update&&o.updateRenderer&&o.fullUpdate(),o):(t.Z.debug("JSXGraph: create: failure creating "+e),o)},createElement:function(){return t.Z.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,i,r){var n,a,h,l,c,d,u,p,f,_=0,g=0,m=1,b=e.Z.getDimensions(this.container,this.document);return s.Z.isArray(t)?(t[0]<this.maxboundingbox[0]||t[1]>this.maxboundingbox[1]||t[2]>this.maxboundingbox[2]||t[3]<this.maxboundingbox[3]||(s.Z.exists(r)||(r="reset"),h=this.unitX,l=this.unitY,this.canvasWidth=parseFloat(b.width),this.canvasHeight=parseFloat(b.height),a=this.canvasWidth,n=this.canvasHeight,i?(c=h/l,"keep"===r&&(m=this.zoomX/this.zoomY),p=h*(d=t[2]-t[0]),f=l*(u=t[1]-t[3]),a>=n?p>=f?(this.unitY=n/u,this.unitX=this.unitY*c):(this.unitY=n/Math.abs(d)*o.Z.sign(u)/m,this.unitX=this.unitY*c):f>p?(this.unitX=a/d,this.unitY=this.unitX/c):(this.unitX=a/Math.abs(u)*o.Z.sign(d)*m,this.unitY=this.unitX/c),_=.5*(a/this.unitX-d),g=.5*(n/this.unitY-u),this.keepaspectratio=!0):(this.unitX=a/(t[2]-t[0]),this.unitY=n/(t[1]-t[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(t[0]-_),this.unitY*(t[1]+g)),"update"===r?(this.zoomX*=this.unitX/h,this.zoomY*=this.unitY/l):"reset"===r&&(this.zoomX=s.Z.exists(this.attr.zoomx)?this.attr.zoomx:1,this.zoomY=s.Z.exists(this.attr.zoomy)?this.attr.zoomy:1)),this):this},getBoundingBox:function(){var t=new u.Z(i.Z.COORDS_BY_SCREEN,[0,0],this).usrCoords,e=new u.Z(i.Z.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||!s.Z.isObject(e)||s.Z.exists(e.id)||s.Z.exists(e.name)?this.attr[t]=e:s.Z.mergeAttr(this.attr[t],e)},setAttribute:function(e){var r,o,n,a,h,l,c,d={};for(r=0;r<arguments.length;r++)o=arguments[r],s.Z.isString(o)?(n=o.split(":"),d[s.Z.trim(n[0])]=s.Z.trim(n[1])):s.Z.isArray(o)?d[o[0]]=o[1]:t.Z.extend(d,o);for(r in d)switch(d.hasOwnProperty(r)&&(a=r.replace(/\s+/g,"").toLowerCase(),h=d[r]),h=(!h.toLowerCase||"false"!==h.toLowerCase())&&h,l=this.attr[a],a){case"axis":!1===h&&s.Z.exists(this.defaultAxes)&&(this.defaultAxes.x.setAttribute({visible:!1}),this.defaultAxes.y.setAttribute({visible:!1}));break;case"boundingbox":this.setBoundingBox(h,this.keepaspectratio),this._set(a,h);break;case"defaultaxes":s.Z.exists(this.defaultAxes.x)&&s.Z.exists(h.x)&&this.defaultAxes.x.setAttribute(h.x),s.Z.exists(this.defaultAxes.y)&&s.Z.exists(h.y)&&this.defaultAxes.y.setAttribute(h.y);break;case"description":this.document.getElementById(this.container+"_ARIAdescription").innerHTML=h,this._set(a,h);break;case"title":this.document.getElementById(this.container+"_ARIAlabel").innerHTML=h,this._set(a,h);break;case"keepaspectratio":this._set(a,h),l=this.getBoundingBox(),this.setBoundingBox([0,this.canvasHeight,this.canvasWidth,0],!1,"keep"),this.setBoundingBox(l,h,"keep");break;case"document":case"maxboundingbox":this[a]=h,this._set(a,h);break;case"zoomx":case"zoomy":this[a]=h,this._set(a,h),this.setZoom(this.attr.zoomx,this.attr.zoomy);break;case"registerevents":case"renderer":break;case"fullscreen":case"screenshot":(c=this.containerObj.ownerDocument.getElementById(this.container+"_navigation_"+a))&&s.Z.exists(h.symbol)&&(c.innerHTML=s.Z.evaluate(h.symbol)),this._set(a,h);break;case"selection":h.visible=!1,h.withLines=!1,h.vertices={visible:!1},this._set(a,h);break;case"showcopyright":"svg"===this.renderer.type&&((c=this.containerObj.ownerDocument.getElementById(this.renderer.uniqName("licenseText")))?c.style.display=s.Z.evaluate(h)?"inline":"none":s.Z.evaluate(h)&&this.renderer.displayCopyright(i.Z.licenseText,parseInt(this.options.text.fontSize,10)));default:s.Z.exists(this.attr[a])&&this._set(a,h)}return this.containerObj.ownerDocument.getElementById(this.container+"_navigationbar").remove(),this.renderer.drawNavigationBar(this,this.attr.navbar),this.triggerEventHandlers(["attribute"],[d,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)&&s.Z.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,r,o,n,a,h,l,c=0,d=null;for(e in this.animationObjects)if(this.animationObjects.hasOwnProperty(e)&&s.Z.exists(this.animationObjects[e])){if(c+=1,(r=this.animationObjects[e]).animationPath&&(o=s.Z.isFunction(r.animationPath)?r.animationPath((new Date).getTime()-r.animationStart):r.animationPath.pop(),!s.Z.exists(o)||!s.Z.isArray(o)&&isNaN(o)?delete r.animationPath:(r.setPositionDirectly(i.Z.COORDS_BY_USER,o),r.fullUpdate(),d=r)),r.animationData){for(n in h=0,r.animationData)r.animationData.hasOwnProperty(n)&&(a=r.animationData[n].pop(),s.Z.exists(a)?(h+=1,(t={})[n]=a,r.setAttribute(t)):delete r.animationData[a]);0===h&&delete r.animationData}s.Z.exists(r.animationData)||s.Z.exists(r.animationPath)||(this.animationObjects[e]=null,delete this.animationObjects[e],s.Z.exists(r.animationCallback)&&(l=r.animationCallback,r.animationCallback=null,l()))}return 0===c?(window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode):this.update(d),this},migratePoint:function(t,e,i){var r,o,n,a,h,l,c=!1;for(o in t=this.select(t),e=this.select(e),s.Z.exists(t.label)&&(l=t.label.id,c=!0,this.removeObject(t.label)),t.childElements)if(t.childElements.hasOwnProperty(o)){for(n in a=!1,r=t.childElements[o])r.hasOwnProperty(n)&&r[n]===t&&(r[n]=e,a=!0);for(a&&delete t.childElements[o],h=0;h<r.parents.length;h++)r.parents[h]===t.id&&(r.parents[h]=e.id);e.addChild(r)}return i&&(c&&(delete e.childElements[l],delete e.descendants[l]),e.label&&this.removeObject(e.label),delete this.elementsByName[e.name],e.name=t.name,c&&e.createLabel()),this.removeObject(t),s.Z.exists(e.name)&&""!==e.name&&(this.elementsByName[e.name]=e),this.fullUpdate(),this},emulateColorblindness:function(e){var i,r;if(s.Z.exists(e)||(e="none"),this.currentCBDef===e)return this;for(i in this.objects)this.objects.hasOwnProperty(i)&&(r=this.objects[i],"none"!==e?("none"===this.currentCBDef&&(r.visPropOriginal={strokecolor:r.visProp.strokecolor,fillcolor:r.visProp.fillcolor,highlightstrokecolor:r.visProp.highlightstrokecolor,highlightfillcolor:r.visProp.highlightfillcolor}),r.setAttribute({strokecolor:Y.Z.rgb2cb(s.Z.evaluate(r.visPropOriginal.strokecolor),e),fillcolor:Y.Z.rgb2cb(s.Z.evaluate(r.visPropOriginal.fillcolor),e),highlightstrokecolor:Y.Z.rgb2cb(s.Z.evaluate(r.visPropOriginal.highlightstrokecolor),e),highlightfillcolor:Y.Z.rgb2cb(s.Z.evaluate(r.visPropOriginal.highlightfillcolor),e)})):s.Z.exists(r.visPropOriginal)&&t.Z.extend(r.visProp,r.visPropOriginal));return this.currentCBDef=e,this.update(),this},select:function(t,e){var i,r,o,n,a=t;if(null===a)return a;if(s.Z.isString(a)&&""!==a)s.Z.exists(this.objects[a])?a=this.objects[a]:s.Z.exists(this.elementsByName[a])?a=this.elementsByName[a]:s.Z.exists(this.groups[a])&&(a=this.groups[a]);else if(!e&&(s.Z.isFunction(a)||s.Z.isObject(a)&&!s.Z.isFunction(a.setAttribute))){for(r={},n=(i=s.Z.filterElements(this.objectsList,a)).length,o=0;o<n;o++)r[i[o].id]=i[o];a=new j(r)}else s.Z.isObject(a)&&s.Z.exists(a.id)&&!s.Z.exists(this.objects[a.id])&&(a=null);return a},hasPoint:function(t,e){var i=t,r=e,o=this.getBoundingBox();return s.Z.exists(t)&&s.Z.isArray(t.usrCoords)&&(i=t.usrCoords[1],r=t.usrCoords[2]),!!(s.Z.isNumber(i)&&s.Z.isNumber(r)&&o[0]<i&&i<o[2]&&o[1]>r&&r>o[3])},updateCSSTransforms:function(){var t=this.containerObj,i=t,r=t;if(this.cssTransMat=e.Z.getCSSTransformMatrix(i),s.Z.exists(i.getRootNode)){for(i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;i;)this.cssTransMat=o.Z.matMatMult(e.Z.getCSSTransformMatrix(i),this.cssTransMat),i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;this.cssTransMat=o.Z.inverse(this.cssTransMat)}else{for(i=i.offsetParent;i;){for(this.cssTransMat=o.Z.matMatMult(e.Z.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;r!==i;)this.cssTransMat=o.Z.matMatMult(e.Z.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;i=i.offsetParent}this.cssTransMat=o.Z.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 e=this.selectingBox[0],i=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(t.Z.COORDS_BY_SCREEN,[e[0],e[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(t.Z.COORDS_BY_SCREEN,[e[0],i[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(t.Z.COORDS_BY_SCREEN,[i[0],i[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(t.Z.COORDS_BY_SCREEN,[i[0],e[1]])},_testForSelection:function(t){this._isRequiredKeyPressed(t,"selection")&&(s.Z.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(t){var e;return s.Z.exists(this.selectionPolygon)||!0===(e=s.Z.copyAttributes(t,k.Z,"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,r,o,n=this.document;return t=t||this.container,this._fullscreen_inner_id=t,r=n.getElementById(t),e="fullscreenwrap_"+t,s.Z.exists(r._cssFullscreenStore)||(o=this.containerObj.getBoundingClientRect(),r._cssFullscreenStore={w:o.width,h:o.height}),n.getElementById(e)?i=n.getElementById(e):((i=document.createElement("div")).classList.add("JXG_wrap_private"),i.setAttribute("id",e),r.parentNode.insertBefore(i,r),i.appendChild(r)),i.requestFullscreen=i.requestFullscreen||i.webkitRequestFullscreen||i.mozRequestFullScreen||i.msRequestFullscreen,null===(void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement)?i.requestFullscreen&&(i.requestFullscreen(),this.startFullscreenResizeObserver(i)):(this.stopFullscreenResizeObserver(i),s.Z.exists(document.exitFullscreen)?document.exitFullscreen():s.Z.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(t){var i,r,o,n=this.document;i=this._fullscreen_inner_id,s.Z.exists(i)&&(o=void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement,r=n.getElementById(i),o?(r._cssFullscreenStore.id=o.id,r._cssFullscreenStore.isFullscreen=!0,r._cssFullscreenStore.margin=r.style.margin,r._cssFullscreenStore.width=r.style.width,r._cssFullscreenStore.height=r.style.height,r._cssFullscreenStore.transform=r.style.transform,r.style.width=r._cssFullscreenStore.w+"px",r.style.height=r._cssFullscreenStore.h+"px",r.style.margin="",e.Z.scaleJSXGraphDiv(o.id,i,n,s.Z.evaluate(this.attr.fullscreen.scale)),o=null):s.Z.exists(r._cssFullscreenStore)&&(r._cssFullscreenStore.isFullscreen=!1,r.style.margin=r._cssFullscreenStore.margin,r.style.width=r._cssFullscreenStore.width,r.style.height=r._cssFullscreenStore.height,r.style.transform=r._cssFullscreenStore.transform,r._cssFullscreenStore=null,r.parentElement.replaceWith(r)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(t){var i=this;return e.Z.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(this.resizeObserver=new ResizeObserver((function(r){var o,n,a=i.document;i._isResizing||(i._isResizing=!0,window.setTimeout((function(){try{o=i._fullscreen_inner_id,null!==(n=void 0!==a.fullscreenElement?a.fullscreenElement:void 0!==a.webkitFullscreenElement?a.webkitFullscreenElement:a.msFullscreenElement)&&e.Z.scaleJSXGraphDiv(n.id,o,a,s.Z.evaluate(i.attr.fullscreen.scale))}catch(e){i.stopFullscreenResizeObserver(t)}finally{i._isResizing=!1}}),i.attr.resize.throttle))})),this.resizeObserver.observe(t),this):this},stopFullscreenResizeObserver:function(t){return e.Z.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(s.Z.exists(this.resizeObserver)&&this.resizeObserver.unobserve(t),this):this},addLogEntry:function(t,e,i){var r,o,n=this.userLog.length-1;return s.Z.exists(e.elementClass)&&(o=e.id),s.Z.evaluate(this.attr.logging.enabled)&&(r=(new Date).getTime(),n>=0&&this.userLog[n].type===t&&this.userLog[n].id===o&&r-this.userLog[n].end<500?(this.userLog[n].end=r,this.userLog[n].endpos=i):this.userLog.push({type:t,id:o,start:r,startpos:i,end:r,endpos:i,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(t,e,i,s,r,n,a){var h=this;return new function(){var l,c=0,u=0,p=0,f=i,_=d.Z.root((function(i){var s=t.X(f),r=t.Y(f),o=e.X(i),n=e.Y(i);return(s-o)*(s-o)+(r-n)*(r-n)}),[0,2*Math.PI]),g=0,m=0,b=h.create("transform",[function(){return c}],{type:"rotate"}),v=h.create("transform",[function(){return c},function(){return t.X(f)},function(){return t.Y(f)}],{type:"rotate"}),Z=h.create("transform",[function(){return u},function(){return p}],{type:"translate"}),C=function(t,e,i){var s=d.Z.D(t.X)(e),r=d.Z.D(t.Y)(e),n=d.Z.D(t.X)(i),a=d.Z.D(t.Y)(i),h=d.Z.D(t.X)(.5*(e+i)),l=d.Z.D(t.Y)(.5*(e+i)),c=o.Z.hypot(s,r),u=o.Z.hypot(n,a);return(c+4*o.Z.hypot(h,l)+u)*(i-e)/6},y=function(t){return l-C(e,_,t)},P=Math.PI/18,E=9*P,O=null;return this.rolling=function(){var i,o,n,O,x;l=C(t,f,g=f+r*s),m=d.Z.root(y,_),i=new D(t.X(g),t.Y(g)),o=new D(e.X(m),e.Y(m)),n=new D(d.Z.D(t.X)(g),d.Z.D(t.Y)(g)),O=new D(d.Z.D(e.X)(m),d.Z.D(e.Y)(m)),x=D.C.div(n,O),c=Math.atan2(x.imaginary,x.real),x.div(D.C.abs(x)),x.mult(o),u=i.real-x.real,p=i.imaginary-x.imaginary,c<-P&&c>-E?(c=-P,v.applyOnce(a)):c>P&&c<E?(c=P,v.applyOnce(a)):(b.applyOnce(a),Z.applyOnce(a),f=g,_=m),h.update()},this.start=function(){return n>0&&(O=window.setInterval(this.rolling,n)),this},this.stop=function(){return window.clearInterval(O),this},this}}});var X=t.Z.Board;t.Z.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,r,o,n){var a,h,l,c,d,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"),(a=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset")).setAttributeNS(null,"in","SourceGraphic"),a.setAttributeNS(null,"result","offOut"),a.setAttributeNS(null,"dx",n[0]),a.setAttributeNS(null,"dy",n[1]),u.appendChild(a),(h=this.container.ownerDocument.createElementNS(this.svgNamespace,"feColorMatrix")).setAttributeNS(null,"in","offOut"),h.setAttributeNS(null,"result","colorOut"),h.setAttributeNS(null,"type","matrix"),"none"===e||!s.Z.isArray(e)||e.length<3?h.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,d=r+" 0 0 0 "+e[0]+" 0 "+r+" 0 0 "+e[1]+" 0 0 "+r+" 0 "+e[2]+" 0 0 0 "+i+" 0",h.setAttributeNS(null,"values",d)),u.appendChild(h),(l=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur")).setAttributeNS(null,"in","colorOut"),l.setAttributeNS(null,"result","blurOut"),l.setAttributeNS(null,"stdDeviation",o),u.appendChild(l),(c=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend")).setAttributeNS(null,"in","SourceGraphic"),c.setAttributeNS(null,"in2","blurOut"),c.setAttributeNS(null,"mode","normal"),u.appendChild(c),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 s.Z.exists(CSS)&&s.Z.exists(CSS.escape)&&(t=CSS.escape(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<k.Z.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}},t.Z.SVGRenderer.prototype=new L,t.Z.extend(t.Z.SVGRenderer.prototype,{_createArrowHead:function(t,e,r){var o,n,a,h,l=t.id+"Triangle";return s.Z.exists(e)&&(l+=e),s.Z.exists(r)&&(l+=r),(o=this.createPrim("marker",l)).setAttributeNS(null,"stroke",s.Z.evaluate(t.visProp.strokecolor)),o.setAttributeNS(null,"stroke-opacity",s.Z.evaluate(t.visProp.strokeopacity)),o.setAttributeNS(null,"fill",s.Z.evaluate(t.visProp.strokecolor)),o.setAttributeNS(null,"fill-opacity",s.Z.evaluate(t.visProp.strokeopacity)),o.setAttributeNS(null,"stroke-width",0),o.setAttributeNS(null,"orient","auto"),o.setAttributeNS(null,"markerUnits","strokeWidth"),n=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),h=5,"Start"===e?(a=0,2===r?n.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 L 5,5 z"):3===r?n.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z"):4===r?(h=3.31,n.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===r?(h=3.28,n.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===r?(h=2.84,n.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===r?(h=5.2,n.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")):n.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 z"),t.elementClass===i.Z.OBJECT_CLASS_LINE&&(a=2===r?4.9:3===r?3.3:4===r||5===r||6===r?6.66:7===r?0:10)):(a=10,2===r?n.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 L 5,5 z"):3===r?(a=3.3,n.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z")):4===r?(h=3.31,n.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===r?(h=3.28,n.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===r?(h=2.84,n.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===r?(h=5.2,n.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")):n.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 z"),t.elementClass===i.Z.OBJECT_CLASS_LINE&&(a=2===r?5.1:3===r?.02:4===r||5===r||6===r?3.33:7===r?10:.05)),7===r&&(o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"stroke-width",1)),o.setAttributeNS(null,"refY",h),o.setAttributeNS(null,"refX",a),o.appendChild(n),o},_setArrowColor:function(t,e,i,r,o){t&&(s.Z.isString(e)&&(7!==o?this._setAttribute((function(){t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"fill",e),t.setAttributeNS(null,"stroke-opacity",i),t.setAttributeNS(null,"fill-opacity",i)}),r.visPropOld.fillcolor):this._setAttribute((function(){t.setAttributeNS(null,"fill","none"),t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"stroke-opacity",i)}),r.visPropOld.fillcolor)),this.isIE&&r.rendNode.parentNode.insertBefore(r.rendNode,r.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"),this.isIE&&i.parentNode.insertBefore(i,i))},updateTicks:function(t){var e,i,r,o,n,a,h,l,c="",d=t.ticks.length,u=!0;for(e=0;e<d;e++){for(n=(r=t.ticks[e])[0],a=r[1],h=n.length,l=" M "+n[0]+" "+a[0],s.Z.isNumber(n[0])||(u=!1),i=1;u&&i<h;++i)s.Z.isNumber(n[i])?l+=" L "+n[i]+" "+a[i]:u=!1;u&&(c+=l)}o=t.rendNode,s.Z.exists(o)||(o=this.createPrim("path",t.id),this.appendChildPrim(o,s.Z.evaluate(t.visProp.layer)),t.rendNode=o),o.setAttributeNS(null,"stroke",s.Z.evaluate(t.visProp.strokecolor)),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"stroke-opacity",s.Z.evaluate(t.visProp.strokeopacity)),o.setAttributeNS(null,"stroke-width",s.Z.evaluate(t.visProp.strokewidth)),this.updatePathPrim(o,c,t.board),this.setObjectViewport(t)},displayCopyright:function(t,e){var i,s=this.createPrim("text","licenseText");s.setAttributeNS(null,"x","20px"),s.setAttributeNS(null,"y",2+e+"px"),s.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+e+"px; fill:#356AA0; opacity:0.3;"),i=this.container.ownerDocument.createTextNode(t),s.appendChild(i),this.appendChildPrim(s,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,s.Z.evaluate(t.visProp.layer)),e},updateInternalText:function(t){var e,i=t.plaintext,r=t.getAnchorX(),o=t.getAnchorY();t.rendNode.getAttributeNS(null,"class")!==t.visProp.cssclass&&(t.rendNode.setAttributeNS(null,"class",s.Z.evaluate(t.visProp.cssclass)),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!==i&&(t.rendNodeText.data=i,t.htmlStr=i),this.transformImage(t,t.transformations)},updateInternalTextStyle:function(t,e,i,s){this.setObjectViewport(t),this.setObjectFillColor(t,e,i)},drawImage:function(t){var e=this.createPrim("image",t.id);e.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(e,s.Z.evaluate(t.visProp.layer)),t.rendNode=e,this.updateImage(t)},transformImage:function(t,e){var r,o,n,a,h=t.rendNode,l="";if(e.length>0&&-1===(r=[(o=this.joinTransforms(t,e))[1][1],o[2][1],o[1][2],o[2][2],o[1][0],o[2][0]].join(",")).indexOf("NaN"))if(l+=" matrix("+r+") ",t.elementClass===i.Z.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(h.style.transform=l,n=-t.coords.scrCoords[1],a=-t.coords.scrCoords[2],s.Z.evaluate(t.visProp.anchorx)){case"right":n+=t.size[0];break;case"middle":n+=.5*t.size[0]}switch(s.Z.evaluate(t.visProp.anchory)){case"bottom":a+=t.size[1];break;case"middle":a+=.5*t.size[1]}h.style["transform-origin"]=n+"px "+a+"px"}else h.setAttributeNS(null,"transform",l)},updateImageURL:function(t){var e=s.Z.evaluate(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=s.Z.evaluate(e?t.visProp.highlightcssclass:t.visProp.cssclass);t.rendNode.setAttributeNS(null,"class",i)},drawForeignObject:function(t){t.rendNode=this.appendChildPrim(this.createPrim("foreignObject",t.id),s.Z.evaluate(t.visProp.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]),t.rendNode.innerHTML=t.content,this._updateVisual(t,{stroke:!0,dash:!0},!0)},appendChildPrim:function(t,e){return s.Z.exists(e)?e>=k.Z.layer.numlayers&&(e=k.Z.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){s.Z.exists(t)&&s.Z.exists(t.parentNode)&&t.parentNode.removeChild(t)},setLayer:function(t,e){s.Z.exists(e)?e>=k.Z.layer.numlayers&&(e=k.Z.layer.numlayers-1):e=0,this.layer[e].appendChild(t.rendNode)},makeArrows:function(t,e){var i,r,o=e.evFirst,n=e.evLast;this.isIE&&t.visPropCalc.visible&&(o||n)?t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode):(i=t.rendNodeTriangleStart,o?(r=this.toStr(this.container.id,"_",t.id,"TriangleStart",e.typeFirst),s.Z.exists(i)&&i.id===r||(null===(i=this.container.ownerDocument.getElementById(r))&&(i=this._createArrowHead(t,"Start",e.typeFirst),this.defs.appendChild(i)),t.rendNodeTriangleStart=i,t.rendNode.setAttributeNS(null,"marker-start",this.toURL(r)))):s.Z.exists(i)&&this.remove(i),i=t.rendNodeTriangleEnd,n?(r=this.toStr(this.container.id,"_",t.id,"TriangleEnd",e.typeLast),s.Z.exists(i)&&i.id===r||(null===(i=this.container.ownerDocument.getElementById(r))&&(i=this._createArrowHead(t,"End",e.typeLast),this.defs.appendChild(i)),t.rendNodeTriangleEnd=i,t.rendNode.setAttributeNS(null,"marker-end",this.toURL(r)))):s.Z.exists(i)&&this.remove(i))},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,r,o,n,a,h,l=" M ",c=l,u=5e3,p="",f=s.Z.evaluate(t.visProp.strokewidth),_="plot"!==s.Z.evaluate(t.visProp.curvetype);if(t.numberPoints<=0)return"";for(_&&t.board.options.curve.RDPsmoothing&&(t.points=d.Z.RamerDouglasPeucker(t.points,.5)),h=Math.min(t.points.length,t.numberPoints),i=1;i<3;i++)for(c=l,e=0;e<h;e++)o=t.points[e].scrCoords,isNaN(o[1])||isNaN(o[2])?c=l:(o[1]=Math.max(Math.min(o[1],u),-5e3),o[2]=Math.max(Math.min(o[2],u),-5e3),c===l?p+=c+o[1]+" "+o[2]:(r=2*i,p+=[c,n+.333*(o[1]-n)+f*(r*Math.random()-i)," ",a+.333*(o[2]-a)+f*(r*Math.random()-i)," ",n+.666*(o[1]-n)+f*(r*Math.random()-i)," ",a+.666*(o[2]-a)+f*(r*Math.random()-i)," ",o[1]," ",o[2]].join("")),c=" C ",n=o[1],a=o[2]);return p},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)},setPropertyPrim:function(t,e,i){"stroked"!==e&&t.setAttributeNS(null,e,i)},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"))},show:function(e){t.Z.deprecated("Board.renderer.show()","Board.renderer.display()"),this.display(e,!0)},hide:function(e){t.Z.deprecated("Board.renderer.hide()","Board.renderer.display()"),this.display(e,!1)},setBuffering:function(t,e){t.rendNode.setAttribute("buffered-rendering",e)},setDashStyle:function(t){var e=s.Z.evaluate(t.visProp.dash),i=s.Z.evaluate(t.visProp.dashscale)?.5*s.Z.evaluate(t.visProp.strokewidth):1,r=t.rendNode;e>0?r.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map((function(t){return t*i})).join(",")):r.hasAttributeNS(null,"stroke-dasharray")&&r.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,r,o=t.rendNode,n=s.Z.evaluate(t.visProp.gradient);"linear"===n||"radial"===n?(e=this.createPrim(n+"Gradient",t.id+"_gradient"),i=this.createPrim("stop",t.id+"_gradient1"),r=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(r),this.defs.appendChild(e),o.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=i,t.gradNode2=r,t.gradNode=e):o.removeAttributeNS(null,"style")},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+"%")},updateGradient:function(t){var e,i,r=t.gradNode1,o=t.gradNode2,n=s.Z.evaluate(t.visProp.gradient);s.Z.exists(r)&&s.Z.exists(o)&&(i=(i=s.Z.evaluate(t.visProp.fillopacity))>0?i:0,e=s.Z.evaluate(t.visProp.fillcolor),r.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),o.setAttributeNS(null,"style","stop-color:"+s.Z.evaluate(t.visProp.gradientsecondcolor)+";stop-opacity:"+s.Z.evaluate(t.visProp.gradientsecondopacity)),r.setAttributeNS(null,"offset",100*s.Z.evaluate(t.visProp.gradientstartoffset)+"%"),o.setAttributeNS(null,"offset",100*s.Z.evaluate(t.visProp.gradientendoffset)+"%"),"linear"===n?this.updateGradientAngle(t.gradNode,s.Z.evaluate(t.visProp.gradientangle)):"radial"===n&&this.updateGradientCircle(t.gradNode,s.Z.evaluate(t.visProp.gradientcx),s.Z.evaluate(t.visProp.gradientcy),s.Z.evaluate(t.visProp.gradientr),s.Z.evaluate(t.visProp.gradientfx),s.Z.evaluate(t.visProp.gradientfy),s.Z.evaluate(t.visProp.gradientfr)))},setObjectTransition:function(t,e){var i,r,o,n=[],a=0,h=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(void 0===e&&(e=s.Z.evaluate(t.visProp.transitionduration)),i=s.Z.evaluate(t.visProp.transitionproperties),e!==t.visPropOld.transitionduration||i!==t.visPropOld.transitionproperties){for(s.Z.exists(i)&&(a=i.length),o=0;o<a;o++)n.push(i[o]+" "+e+"ms");for(r=n.join(", "),a=h.length,o=0;o<a;++o)t[h[o]]&&(t[h[o]].style.transition=r);t.visPropOld.transitionduration=e,t.visPropOld.transitionproperties=i}},setObjectViewport:function(t,e){var i,r,o,n,a,h,l,c,d,u=s.Z.evaluate(t.visProp.viewport),p=["rendNode"];for("inherit"===u&&(u=s.Z.evaluate(t.board.attr.viewport)),e&&(n=t.rendNode.getBoundingClientRect(),a=this.container.getBoundingClientRect(),l=parseFloat(u[1]),c=parseFloat(u[2]),d=parseFloat(u[3]),h=parseFloat(u[0]),s.Z.isString(u[1])&&u[1].indexOf("%")>0&&(l=a.height*l/100),s.Z.isString(u[2])&&u[2].indexOf("%")>0&&(c=a.width*c/100),s.Z.isString(u[3])&&u[3].indexOf("%")>0&&(d=a.height*d/100),s.Z.isString(u[0])&&u[0].indexOf("%")>0&&(h=a.width*h/100),l=parseFloat(a.top)-parseFloat(n.top)+l,c=parseFloat(n.right)-parseFloat(a.right)+c,d=parseFloat(n.bottom)-parseFloat(a.bottom)+d,u=[h=parseFloat(a.left)-parseFloat(n.left)+h,l,c,d]),i=["number"==typeof u[1]?u[1]+"px":u[1],"number"==typeof u[2]?u[2]+"px":u[2],"number"==typeof u[3]?u[3]+"px":u[3],"number"==typeof u[0]?u[0]+"px":u[0]].join(" "),o=p.length,r=0;r<o;++r)t[p[r]]&&(e?t[p[r]].style.clipPath="inset("+i+")":t[p[r]].setAttributeNS(null,"clip-path","view-box inset("+i+")"))},_setAttribute:function(t,e){""===e?t():window.setTimeout(t,1)},setObjectFillColor:function(e,i,r,o){var n,a,h,l,c=s.Z.evaluate(i),d=s.Z.evaluate(r),u=s.Z.evaluate(e.visProp.gradient);d=d>0?d:0,e.visPropOld.fillcolor===c&&e.visPropOld.fillopacity===d&&null===u||(s.Z.exists(c)&&!1!==c&&(9!==c.length?(a=c,l=d):(h=Y.Z.rgba2rgbo(c),a=h[0],l=d*h[1]),n=void 0===o?e.rendNode:o,"none"!==a&&this._setAttribute((function(){n.setAttributeNS(null,"fill",a)}),e.visPropOld.fillcolor),e.type===t.Z.OBJECT_TYPE_IMAGE?this._setAttribute((function(){n.setAttributeNS(null,"opacity",l)}),e.visPropOld.fillopacity):("none"===a?(l=0,n.setAttributeNS(null,"pointer-events","visibleStroke")):n.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute((function(){n.setAttributeNS(null,"fill-opacity",l)}),e.visPropOld.fillopacity)),"linear"!==u&&"radial"!==u||this.updateGradient(e)),e.visPropOld.fillcolor=c,e.visPropOld.fillopacity=d)},setObjectStrokeColor:function(t,e,r){var o,n,a,h,l=s.Z.evaluate(e),c=s.Z.evaluate(r);c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.Z.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(n=Y.Z.rgba2rgbo(l),o=n[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.Z.OBJECT_CLASS_TEXT?"html"===s.Z.evaluate(t.visProp.display)?this._setAttribute((function(){h.style.color=o,h.style.opacity=a}),t.visPropOld.strokecolor):this._setAttribute((function(){h.setAttributeNS(null,"style","fill:"+o),h.setAttributeNS(null,"style","fill-opacity:"+a)}),t.visPropOld.strokecolor):this._setAttribute((function(){h.setAttributeNS(null,"stroke",o),h.setAttributeNS(null,"stroke-opacity",a)}),t.visPropOld.strokecolor),t.elementClass!==i.Z.OBJECT_CLASS_CURVE&&t.elementClass!==i.Z.OBJECT_CLASS_LINE||(s.Z.evaluate(t.visProp.firstarrow)&&this._setArrowColor(t.rendNodeTriangleStart,o,a,t,t.visPropCalc.typeFirst),s.Z.evaluate(t.visProp.lastarrow)&&this._setArrowColor(t.rendNodeTriangleEnd,o,a,t,t.visPropCalc.typeLast))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,r=s.Z.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),s.Z.exists(r)&&this.setPropertyPrim(i,"stroke-width",r+"px"),t.visPropOld.strokewidth=r)},setLineCap:function(t){var e=s.Z.evaluate(t.visProp.linecap);void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&s.Z.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setShadow:function(e){var i,r,o,n,a,h,l,c,d=s.Z.evaluate(e.visProp.shadow),u=!0,p=!1;(i=JSON.stringify(d))!==e.visPropOld.shadow&&("boolean"==typeof d?(u=!0,p=d,r="none",o=3,n=.1,a=[5,5],h=1):s.Z.evaluate(d.enabled)?(u=!1,p=!0,r=t.Z.rgbParser(s.Z.evaluate(d.color)),o=s.Z.evaluate(d.blur),n=s.Z.evaluate(d.blend),a=s.Z.evaluate(d.offset),h=s.Z.evaluate(d.opacity)):p=!1,s.Z.exists(e.rendNode)&&(p?u?e.rendNode.setAttributeNS(null,"filter",this.toURL(this.container.id+"_f1")):((c=this.container.ownerDocument.getElementById(l))&&this.defs.removeChild(c),l=e.rendNode.id+"_f1",this.defs.appendChild(this.createShadowFilter(l,r,h,n,o,a)),e.rendNode.setAttributeNS(null,"filter",this.toURL(l))):e.rendNode.removeAttributeNS(null,"filter")),e.visPropOld.shadow=i)},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,"stroke-opacity",1),r.setAttributeNS(null,"fill","#ffffff"),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]),e=e.concat(this._getValuesOfDOMElements(t)),t=t.nextSibling;return e},_getDataUri:function(t,e){var i=new Image;i.onload=function(){var t=document.createElement("canvas");t.width=this.naturalWidth,t.height=this.naturalHeight,t.getContext("2d").drawImage(this,0,0),e(t.toDataURL("image/png")),t.remove()},i.src=t},_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,r,o=this.svgRoot,n=window.btoa||S.encode,a=[];if(this.container.hasChildNodes()&&s.Z.exists(this.foreignObjLayer)&&!t)for(this.foreignObjLayer.setAttribute("display","inline");o.nextSibling;)a=a.concat(this._getValuesOfDOMElements(o.nextSibling)),this.foreignObjLayer.appendChild(o.nextSibling);if(this._getImgDataURL(o),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),e=(new XMLSerializer).serializeToString(o),!0!==t)for(r=a.length,i=0;i<r;i++)e=e.replace('id="'+a[i][0]+'"','id="'+a[i][0]+'" value="'+a[i][1]+'"');if((e.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g)||[]).length>1&&(e=e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),e=(e=e.replace(/ /g," ")).replace(/url\("(.*)"\)/g,"url($1)"),s.Z.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,"+n(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 r,o,n,a,h,l,c,d,u,p,f,_,g=this.container.ownerDocument,m=this.container.parentNode,b=t.attr.screenshot,v=!1;return"no"===this.type||(c=b.scale*this.container.getBoundingClientRect().width,d=b.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(v=!0,(a=new Image).style.width=c+"px",a.style.height=d+"px"):(v=!1,a=g.getElementById(e)),v&&((r=g.createElement("div")).style.cssText=b.css,r.style.width=c+"px",r.style.height=d+"px",r.style.zIndex=this.container.style.zIndex+120,r.style.position="absolute",r.style.top=this.container.offsetTop+"px",r.style.left=this.container.offsetLeft+"px"),o=g.createElement("canvas"),n=Math.random().toString(36).slice(2,7),o.setAttribute("id",n),o.setAttribute("width",c),o.setAttribute("height",d),o.style.width=c+"px",o.style.height=c+"px",o.style.display="none",m.appendChild(o),v&&(h=g.createElement("span"),l=g.createTextNode("✖"),h.style.cssText=b.cssButton,h.appendChild(l),h.onclick=function(){r.parentNode.removeChild(r)},r.appendChild(a),r.appendChild(h),m.insertBefore(r,this.container.nextSibling)),u=g.getElementById(this.uniqName("navigationbar")),s.Z.exists(u)&&(p=u.style.display,u.style.display="none",f=this.removeToInsertLater(u)),_=function(){a.src=o.toDataURL("image/png"),m.removeChild(o)},"Promise"in window?this.dumpToCanvas(n,c,d,i).then(_):(this.dumpToCanvas(n,c,d,i),window.setTimeout(_,200)),s.Z.exists(u)&&(u.style.display=p,f())),this}});var U=t.Z.SVGRenderer;t.Z.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,s.Z.exists(t.Z.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),t.Z.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),t.Z.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{e.ownerDocument.namespaces.jxgvml||e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("<jxgvml:"+t+' class="jxgvml">')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},t.Z.VMLRenderer.prototype=new L,t.Z.extend(t.Z.VMLRenderer.prototype,{_setAttr:function(e,i,s,r){try{8===this.container.ownerDocument.documentMode?e[i]=s:e.setAttribute(i,s,r)}catch(e){t.Z.debug("_setAttr: "+i+" "+s+"<br>\n")}},updateTicks:function(t){var e,i,r,o,n,a=this.resolution,h=[];for(i=t.ticks.length,e=0;e<i;e++)o=(r=t.ticks[e])[0],n=r[1],s.Z.isNumber(o[0])&&s.Z.isNumber(o[1])&&h.push(" m "+Math.round(a*o[0])+", "+Math.round(a*n[0])+" l "+Math.round(a*o[1])+", "+Math.round(a*n[1])+" ");s.Z.exists(t.rendNode)||(t.rendNode=this.createPrim("path",t.id),this.appendChildPrim(t.rendNode,s.Z.evaluate(t.visProp.layer))),this._setAttr(t.rendNode,"stroked","true"),this._setAttr(t.rendNode,"strokecolor",s.Z.evaluate(t.visProp.strokecolor),1),this._setAttr(t.rendNode,"strokeweight",s.Z.evaluate(t.visProp.strokewidth)),this._setAttr(t.rendNodeStroke,"opacity",100*s.Z.evaluate(t.visProp.strokeopacity)+"%"),this.updatePathPrim(t.rendNode,h,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,n,a,h=t.plaintext,l=this.joinTransforms(t,t.transformations),c=[0,0],d=t.rendNode,u=[],p=t.getAnchorX(),f=t.getAnchorY();if(!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])){for("right"===p?c[0]=1:"middle"===p&&(c[0]=.5),"bottom"===f?c[1]=1:"middle"===f&&(c[1]=.5),u[0]=o.Z.matVecMult(l,[1,t.coords.scrCoords[1]-c[0]*t.size[0],t.coords.scrCoords[2]+(1-c[1])*t.size[1]+this.vOffsetText]),u[0][1]/=u[0][0],u[0][2]/=u[0][0],u[1]=o.Z.matVecMult(l,[1,t.coords.scrCoords[1]+(1-c[0])*t.size[0],t.coords.scrCoords[2]+(1-c[1])*t.size[1]+this.vOffsetText]),u[1][1]/=u[1][0],u[1][2]/=u[1][0],u[2]=o.Z.matVecMult(l,[1,t.coords.scrCoords[1]+(1-c[0])*t.size[0],t.coords.scrCoords[2]-c[1]*t.size[1]+this.vOffsetText]),u[2][1]/=u[2][0],u[2][2]/=u[2][0],u[3]=o.Z.matVecMult(l,[1,t.coords.scrCoords[1]-c[0]*t.size[0],t.coords.scrCoords[2]-c[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],n=u[0][2],a=1;a<4;a++)i=Math.max(i,u[a][1]),r=Math.min(r,u[a][1]),s=Math.max(s,u[a][2]),n=Math.min(n,u[a][2]);e=1===c[0]?Math.floor(t.board.canvasWidth-i):Math.floor(r),t.visPropOld.left!==p+e&&(1===c[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=p+e),e=1===c[1]?Math.floor(t.board.canvasHeight-s):Math.floor(n),t.visPropOld.top!==f+e&&(1===c[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=f+e)}t.htmlStr!==h&&(t.rendNodeText.data=h,t.htmlStr=h),d.filters.item(0).M11=l[1][1],d.filters.item(0).M12=l[1][2],d.filters.item(0).M21=l[2][1],d.filters.item(0).M22=l[2][2],d.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,s.Z.evaluate(t.visProp.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)},transformImage:function(t,e){var i,s,r,n,a,h,l=t.rendNode,c=[];if(e.length>0){for(i=this.joinTransforms(t,e),c[0]=o.Z.matVecMult(i,t.coords.scrCoords),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=o.Z.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]]),c[1][1]/=c[1][0],c[1][2]/=c[1][0],c[2]=o.Z.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]-t.size[1]]),c[2][1]/=c[2][0],c[2][2]/=c[2][0],c[3]=o.Z.matVecMult(i,[1,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1]]),c[3][1]/=c[3][0],c[3][2]/=c[3][0],s=c[0][1],n=c[0][1],r=c[0][2],a=c[0][2],h=1;h<4;h++)s=Math.max(s,c[h][1]),n=Math.min(n,c[h][1]),r=Math.max(r,c[h][2]),a=Math.min(a,c[h][2]);l.style.left=Math.floor(n)+"px",l.style.top=Math.floor(a)+"px",l.filters.item(0).M11=i[1][1],l.filters.item(0).M12=i[1][2],l.filters.item(0).M21=i[2][1],l.filters.item(0).M22=i[2][2],l.filters.item(0).enabled=!0}},updateImageURL:function(t){var e=s.Z.evaluate(t.url);this._setAttr(t.rendNode,"src",e)},appendChildPrim:function(t,e){return s.Z.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){s.Z.exists(t)&&t.removeNode(!0)},makeArrows:function(t){var e,i=s.Z.evaluate(t.visProp.firstarrow),r=s.Z.evaluate(t.visProp.lastarrow);t.visPropOld.firstarrow===i&&t.visPropOld.lastarrow===r||(i?(e=t.rendNodeStroke,this._setAttr(e,"startarrow","block"),this._setAttr(e,"startarrowlength","long")):(e=t.rendNodeStroke,s.Z.exists(e)&&this._setAttr(e,"startarrow","none")),r?(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,s.Z.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r)},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,r,o,n,a,h=[],l=s.Z.evaluate(t.visProp.strokewidth),c=this.resolution,u=Math.round,p=" m ",f=p,_="plot"!==s.Z.evaluate(t.visProp.curvetype),g=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";for(_&&t.board.options.curve.RDPsmoothing&&(t.points=d.Z.RamerDouglasPeucker(t.points,1)),g=Math.min(g,t.points.length),i=1;i<3;i++)for(f=p,e=0;e<g;e++)o=t.points[e].scrCoords,isNaN(o[1])||isNaN(o[2])?f=p:(o[1]>2e4?o[1]=2e4:o[1]<-2e4&&(o[1]=-2e4),o[2]>2e4?o[2]=2e4:o[2]<-2e4&&(o[2]=-2e4),f===p?h.push([f,u(c*o[1])," ",u(c*o[2])].join("")):(r=2*i,h.push([f,u(c*(n+.333*(o[1]-n)+l*(r*Math.random()-i)))," ",u(c*(a+.333*(o[2]-a)+l*(r*Math.random()-i)))," ",u(c*(n+.666*(o[1]-n)+l*(r*Math.random()-i)))," ",u(c*(a+.666*(o[2]-a)+l*(r*Math.random()-i)))," ",u(c*o[1])," ",u(c*o[2])].join(""))),f=" c ",n=o[1],a=o[2]);return h.push(" e"),h},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 r,o="";switch(e){case"stroke":o="strokecolor";break;case"stroke-width":o="strokeweight";break;case"stroke-dasharray":o="dashstyle"}""!==o&&(r=s.Z.evaluate(i),this._setAttr(t,o,r))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(e){t.Z.deprecated("Board.renderer.show()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.Z.deprecated("Board.renderer.hide()","Board.renderer.display()"),e&&e.rendNode&&(e.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=s.Z.evaluate(t.visProp.gradient);"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",s.Z.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",s.Z.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"angle",s.Z.evaluate(t.visProp.gradientangle))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",s.Z.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",s.Z.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"focusposition",100*s.Z.evaluate(t.visProp.gradientpositionx)+"%,"+100*s.Z.evaluate(t.visProp.gradientpositiony)+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,r){var o,n,a,h=s.Z.evaluate(e),l=s.Z.evaluate(r),c=t.rendNode;l=l>0?l:0,t.visPropOld.fillcolor===h&&t.visPropOld.fillopacity===l||(s.Z.exists(h)&&!1!==h&&(9!==h.length?(o=h,a=l):(o=(n=Y.Z.rgba2rgbo(h))[0],a=l*n[1]),"none"===o||!1===o?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",o),s.Z.exists(a)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*a+"%")),t.type===i.Z.OBJECT_TYPE_IMAGE&&c.filters.length>1&&(c.filters.item(1).opacity=Math.round(100*a),c.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=h,t.visPropOld.fillopacity=l)},setObjectStrokeColor:function(t,e,r){var o,n,a,h,l=s.Z.evaluate(e),c=s.Z.evaluate(r),d=t.rendNode;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.Z.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=e.rgba2rgbo(l))[0],a=c*n[1]),t.elementClass===i.Z.OBJECT_CLASS_TEXT?(d.filters.length>1&&(d.filters.item(1).opacity=Math.round(100*a),d.filters.item(1).enabled=!0),d.style.color=o):(!1!==o&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",o)),h=t.rendNodeStroke,s.Z.exists(a)&&t.type!==i.Z.OBJECT_TYPE_IMAGE&&this._setAttr(h,"opacity",100*a+"%"))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,r=s.Z.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),s.Z.exists(r)&&(this.setPropertyPrim(i,"stroke-width",r),0===r&&s.Z.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=r)},setShadow:function(t){var e=t.rendNodeShadow,i=s.Z.evaluate(t.visProp.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 F=t.Z.VMLRenderer,z="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");t.Z.Util=t.Z.Util||{},t.Z.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]=z[19===i?3&e|8:e]);return t+s.join("")};var J=t.Z.Util;t.Z.CanvasRenderer=function(i,s){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=J.genUUID(),this.canvasNamespace=null,e.Z.isBrowser)this.container=i,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="',s.width,'px" height="',s.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(e.Z.isNode())try{this.canvasRoot=t.Z.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";\n JXG.createCanvas = createCanvas;\n')}},t.Z.CanvasRenderer.prototype=new L,t.Z.extend(t.Z.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 s,r,o,n,a,h,l,c,d,p,f,_,g=1,m=Math.cos(-e),b=Math.sin(-e),v=t.getBoundingBox();return Math.abs(m)>Math.abs(b)?g/=Math.abs(m):g/=Math.abs(b),m>=0?(o=0,n=m*g):(o=-m*g,n=0),b>=0?(a=0,h=b*g):(a=-b*g,h=0),s=new u.Z(i.Z.COORDS_BY_USER,[v[0],v[1]],t.board),f=(r=new u.Z(i.Z.COORDS_BY_USER,[v[2],v[3]],t.board)).scrCoords[1]-s.scrCoords[1],_=r.scrCoords[2]-s.scrCoords[2],l=s.scrCoords[1]+f*o,d=s.scrCoords[2]+_*a,c=s.scrCoords[1]+f*n,p=s.scrCoords[2]+_*h,this.context.createLinearGradient(l,d,c,p)},updateGradientCircle:function(t,e,s,r,o,n,a){var h,l,c,d,p,f,_,g,m,b,v=t.getBoundingBox();return h=new u.Z(i.Z.COORDS_BY_USER,[v[0],v[1]],t.board),m=(l=new u.Z(i.Z.COORDS_BY_USER,[v[2],v[3]],t.board)).scrCoords[1]-h.scrCoords[1],b=h.scrCoords[2]-l.scrCoords[2],c=h.scrCoords[1]+m*e,d=l.scrCoords[2]+b*s,f=h.scrCoords[1]+m*o,_=l.scrCoords[2]+b*n,p=r*(m+b)*.5,g=a*(m+b)*.5,this.context.createRadialGradient(f,_,g,c,d,p)},updateGradient:function(t){var e,i,r=s.Z.evaluate(t.visProp.gradient);return e=s.Z.evaluate(t.visProp.fillcolor),"linear"===r?i=this.updateGradientAngle(t,s.Z.evaluate(t.visProp.gradientangle)):"radial"===r&&(i=this.updateGradientCircle(t,s.Z.evaluate(t.visProp.gradientcx),s.Z.evaluate(t.visProp.gradientcy),s.Z.evaluate(t.visProp.gradientr),s.Z.evaluate(t.visProp.gradientfx),s.Z.evaluate(t.visProp.gradientfy),s.Z.evaluate(t.visProp.gradientfr))),i.addColorStop(s.Z.evaluate(t.visProp.gradientstartoffset),e),i.addColorStop(s.Z.evaluate(t.visProp.gradientendoffset),s.Z.evaluate(t.visProp.gradientsecondcolor)),i},_setColor:function(t,e,i){var r,o,n,a,h,l,c,d,u=!0,p=t.visProp;return e=e||"stroke",i=i||e,r=this._getHighlighted(t),"linear"===(d=s.Z.evaluate(t.visProp.gradient))||"radial"===d?(this.context[i+"Style"]=this.updateGradient(t),u):("none"!==(n=s.Z.evaluate(p[r+e+"color"]))&&!1!==n?(l=(l=s.Z.evaluate(p[r+e+"opacity"]))>0?l:0,9!==n.length?(h=n,c=l):(h=(a=Y.Z.rgba2rgbo(n))[0],c=l*a[1]),this.context.globalAlpha=c,this.context[i+"Style"]=h):u=!1,o=parseFloat(s.Z.evaluate(p[r+"strokewidth"])),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),"stroke"===e&&void 0!==p.linecap&&""!==p.linecap&&(this.context.lineCap=p.linecap),u)},_stroke:function(t){var e=this.context,i=s.Z.evaluate(t.visProp.dash),r=s.Z.evaluate(t.visProp.dashscale)?.5*s.Z.evaluate(t.visProp.strokewidth):1;e.save(),i>0?e.setLineDash&&e.setLineDash(this.dashArray[i-1].map((function(t){return t*r}))):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=s.Z.evaluate(t.visProp.face),i=s.Z.evaluate(t.visProp.size),r=t.coords.scrCoords,o=i*Math.sqrt(3)*.5,n=.5*i,a=parseFloat(s.Z.evaluate(t.visProp.strokewidth))/2,h=this.context;if(t.visPropCalc.visible)switch(e){case"cross":case"x":h.beginPath(),h.moveTo(r[1]-i,r[2]-i),h.lineTo(r[1]+i,r[2]+i),h.moveTo(r[1]+i,r[2]-i),h.lineTo(r[1]-i,r[2]+i),h.lineCap="round",h.lineJoin="round",h.closePath(),this._stroke(t);break;case"circle":case"o":h.beginPath(),h.arc(r[1],r[2],i+1+a,0,2*Math.PI,!1),h.closePath(),this._fill(t),this._stroke(t);break;case"square":case"[]":if(i<=0)break;h.save(),this._setColor(t,"stroke","fill")&&h.fillRect(r[1]-i-a,r[2]-i-a,2*i+3*a,2*i+3*a),h.restore(),h.save(),this._setColor(t,"fill"),h.fillRect(r[1]-i+a,r[2]-i+a,2*i-a,2*i-a),h.restore();break;case"plus":case"+":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1]+i,r[2]),h.moveTo(r[1],r[2]-i),h.lineTo(r[1],r[2]+i),h.lineCap="round",h.lineJoin="round",h.closePath(),this._stroke(t);break;case"divide":case"|":h.beginPath(),h.moveTo(r[1],r[2]-i),h.lineTo(r[1],r[2]+i),h.lineCap="round",h.lineJoin="round",h.closePath(),this._stroke(t);break;case"minus":case"-":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1]+i,r[2]),h.lineCap="round",h.lineJoin="round",h.closePath(),this._stroke(t);break;case"diamond2":case"<<>>":i*=1.41;case"diamond":case"<>":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1],r[2]+i),h.lineTo(r[1]+i,r[2]),h.lineTo(r[1],r[2]-i),h.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"A":case"a":case"^":h.beginPath(),h.moveTo(r[1],r[2]-i),h.lineTo(r[1]-o,r[2]+n),h.lineTo(r[1]+o,r[2]+n),h.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":h.beginPath(),h.moveTo(r[1],r[2]+i),h.lineTo(r[1]-o,r[2]-n),h.lineTo(r[1]+o,r[2]-n),h.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":h.beginPath(),h.moveTo(r[1]-i,r[2]),h.lineTo(r[1]+n,r[2]-o),h.lineTo(r[1]+n,r[2]+o),h.closePath(),this._fill(t),this._stroke(t);break;case"triangleright":case">":h.beginPath(),h.moveTo(r[1]+i,r[2]),h.lineTo(r[1]-n,r[2]-o),h.lineTo(r[1]-n,r[2]+o),h.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,r,o,n){var a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w=this.context,S=1,M=1,T=1,N=n.evFirst,A=n.evLast;if("none"!==s.Z.evaluate(t.visProp.strokecolor)&&(N||A)){if(t.elementClass===i.Z.OBJECT_CLASS_LINE)a=e.scrCoords[1],h=e.scrCoords[2],l=r.scrCoords[1],c=r.scrCoords[2],O=x=Math.atan2(c-h,l-a);else{if(a=t.points[0].scrCoords[1],h=t.points[0].scrCoords[2],(E=t.points.length-1)<1)return;l=t.points[t.points.length-1].scrCoords[1],c=t.points[t.points.length-1].scrCoords[2],Z=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],C=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],y=t.points[E].scrCoords[1]-t.points[E-1].scrCoords[1],P=t.points[E].scrCoords[2]-t.points[E-1].scrCoords[2],N&&(O=Math.atan2(C,Z)),A&&(x=Math.atan2(P,y))}if(d=s.Z.evaluate(t.visProp[o+"strokewidth"]),N)if(u=d*n.sizeFirst,_=S=n.typeFirst,2===S)f=[[u,.5*-u],[0,0],[u,.5*u],[.5*u,0]];else if(3===S)f=[[u/3,.5*-u],[0,.5*-u],[0,.5*u],[u/3,.5*u]];else if(4===S)for(u/=10,M=3,v=(f=[[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,b=0;b<v;b++)f[b][0]*=-u,f[b][1]*=u,f[b][0]+=10*u,f[b][1]-=3.31*u;else if(5===S)for(u/=10,M=3,v=(f=[[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,b=0;b<v;b++)f[b][0]*=-u,f[b][1]*=u,f[b][0]+=10*u,f[b][1]-=3.28*u;else if(6===S)for(u/=10,M=3,v=(f=[[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,b=0;b<v;b++)f[b][0]*=-u,f[b][1]*=u,f[b][0]+=10*u,f[b][1]-=2.84*u;else if(7===S)for(u=d,M=3,v=(f=[[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,b=0;b<v;b++)f[b][0]*=-u,f[b][1]*=u,f[b][0]+=10*u,f[b][1]-=5.2*u;else f=[[u,.5*-u],[0,0],[u,.5*u]];if(A)if(u=d*n.sizeLast,g=S=n.typeLast,2===S)p=[[-u,.5*-u],[0,0],[-u,.5*u],[.5*-u,0]];else if(3===S)p=[[-u/3,.5*-u],[0,.5*-u],[0,.5*u],[-u/3,.5*u]];else if(4===S)for(u/=10,T=3,v=(p=[[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,b=0;b<v;b++)p[b][0]*=u,p[b][1]*=u,p[b][0]-=10*u,p[b][1]-=3.31*u;else if(5===S)for(u/=10,T=3,v=(p=[[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,b=0;b<v;b++)p[b][0]*=u,p[b][1]*=u,p[b][0]-=10*u,p[b][1]-=3.28*u;else if(6===S)for(u/=10,T=3,v=(p=[[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,b=0;b<v;b++)p[b][0]*=u,p[b][1]*=u,p[b][0]-=10*u,p[b][1]-=2.84*u;else if(7===S)for(u=d,T=3,v=(p=[[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,b=0;b<v;b++)p[b][0]*=u,p[b][1]*=u,p[b][0]-=10*u,p[b][1]-=5.2*u;else p=[[-u,.5*-u],[0,0],[-u,.5*u]];w.save(),this._setColor(t,"stroke","fill")&&(this._setColor(t,"stroke"),N&&(m=7!==_,this._drawPolygon(this._translateShape(this._rotateShape(f,O),a,h),M,m)),A&&(m=7!==g,this._drawPolygon(this._translateShape(this._rotateShape(p,x),l,c),T,m))),w.restore()}},drawLine:function(t){var e,r,o,n,a,l=new u.Z(i.Z.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),c=new u.Z(i.Z.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),d=null;t.visPropCalc.visible&&(o=this._getHighlighted(t),n=s.Z.evaluate(t.visProp[o+"strokewidth"]),((a=this.getArrowHeadData(t,n,o)).evFirst||a.evLast)&&(d=-4),h.Z.calcStraight(t,l,c,d),this.handleTouchpoints(t,l,c,a),e=new u.Z(i.Z.COORDS_BY_USER,l.usrCoords,t.board),r=new u.Z(i.Z.COORDS_BY_USER,c.usrCoords,t.board),this.getPositionArrowHead(t,l,c,a),this.context.beginPath(),this.context.moveTo(l.scrCoords[1],l.scrCoords[2]),this.context.lineTo(c.scrCoords[1],c.scrCoords[2]),this._stroke(t),(a.evFirst||a.evLast)&&this.drawArrows(t,e,r,o,a))},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,r;s.Z.evaluate(t.visProp.handdrawing)?this.updatePathStringBezierPrim(t):this.updatePathStringPrim(t),t.numberPoints>1&&(e=this._getHighlighted(t),i=s.Z.evaluate(t.visProp[e+"strokewidth"]),((r=this.getArrowHeadData(t,i,e)).evFirst||r.evLast)&&this.drawArrows(t,null,null,e,r))},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,d=a/2*.5522848,u=h/2*.5522848,p=l+a,f=c+h,_=l+a/2,g=c+h/2,m=this.context;o>0&&n>0&&!isNaN(e+i)&&(m.beginPath(),m.moveTo(l,g),m.bezierCurveTo(l,g-u,_-d,c,_,c),m.bezierCurveTo(_+d,c,p,g-u,p,g),m.bezierCurveTo(p,g+u,_+d,f,_,f),m.bezierCurveTo(_-d,f,l,g+u,l,g),m.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context;i.save(),i.font=e+"px Arial",i.fillStyle="#aaa",i.lineWidth=.5,i.fillText(t,10,2+e),i.restore()},drawInternalText:function(t){var e=s.Z.evaluate(t.visProp.fontsize),i=s.Z.evaluate(t.visProp.fontunit),r=t.getAnchorX(),o=t.getAnchorY(),n=this.context;return n.save(),this._setColor(t,"stroke","fill")&&!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])&&(n.font=(e>0?e:0)+i+" Arial",this.transformImage(t,t.transformations),"left"===r?n.textAlign="left":"right"===r?n.textAlign="right":"middle"===r&&(n.textAlign="center"),"bottom"===o?n.textBaseline="bottom":"top"===o?n.textBaseline="top":"middle"===o&&(n.textBaseline="middle"),n.fillText(t.plaintext,t.coords.scrCoords[1],t.coords.scrCoords[2])),n.restore(),null},updateInternalText:function(t){this.drawInternalText(t)},setObjectStrokeColor:function(t,e,r){var o,n,a,h,l=s.Z.evaluate(e),c=s.Z.evaluate(r);c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.Z.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=Y.Z.rgba2rgbo(l))[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.Z.OBJECT_CLASS_TEXT&&"html"===s.Z.evaluate(t.visProp.display)&&(h.style.color=o,h.style.opacity=a)),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},drawImage:function(t){t.rendNode=new Image,t._src="",this.updateImage(t)},updateImage:function(t){var e=this.context,i=s.Z.evaluate(t.visProp.fillopacity),r=s.Z.bind((function(){t.imgIsLoaded=!0,t.size[0]<=0||t.size[1]<=0||(e.save(),e.globalAlpha=i,this.transformImage(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=r:t.imgIsLoaded&&r()},transformImage:function(t,e){var r,n,a,h,l,c=e.length,u=this.context;if(c>0)if(r=this.joinTransforms(t,e),t.elementClass===i.Z.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(n=" matrix("+[r[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0]].join(",")+") ").indexOf("NaN")){switch((l=t.rendNode).style.transform=n,a=-t.coords.scrCoords[1],h=-t.coords.scrCoords[2],s.Z.evaluate(t.visProp.anchorx)){case"right":a+=t.size[0];break;case"middle":a+=.5*t.size[0]}switch(s.Z.evaluate(t.visProp.anchory)){case"bottom":h+=t.size[1];break;case"middle":h+=.5*t.size[1]}l.style["transform-origin"]=a+"px "+h+"px"}}else Math.abs(d.Z.det(r))>=o.Z.eps&&u.transform(r[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0])},updateImageURL:function(t){var e;return e=s.Z.evaluate(t.url),t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.src=e,t._src=e,!0)},remove:function(t){s.Z.exists(t)&&s.Z.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",this._fill(t),this._stroke(t)}},updatePathStringBezierPrim:function(t){var e,i,r,o,n,a,h,l="M",c=l,u=5e3,p=s.Z.evaluate(t.visProp.strokewidth),f="plot"!==s.Z.evaluate(t.visProp.curvetype),_=this.context;if(!(t.numberPoints<=0)){for(f&&t.board.options.curve.RDPsmoothing&&(t.points=d.Z.RamerDouglasPeucker(t.points,.5)),h=Math.min(t.points.length,t.numberPoints),_.beginPath(),i=1;i<3;i++)for(c=l,e=0;e<h;e++)o=t.points[e].scrCoords,isNaN(o[1])||isNaN(o[2])?c=l:(o[1]>u?o[1]=u:o[1]<-5e3&&(o[1]=-5e3),o[2]>u?o[2]=u:o[2]<-5e3&&(o[2]=-5e3),c===l?_.moveTo(o[1],o[2]):(r=2*i,_.bezierCurveTo(n+.333*(o[1]-n)+p*(r*Math.random()-i),a+.333*(o[2]-a)+p*(r*Math.random()-i),n+.666*(o[1]-n)+p*(r*Math.random()-i),a+.666*(o[2]-a)+p*(r*Math.random()-i),o[1],o[2])),c="C",n=o[1],a=o[2]);_.lineCap="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(e){t.Z.deprecated("Board.renderer.show()","Board.renderer.display()"),s.Z.exists(e.rendNode)&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.Z.deprecated("Board.renderer.hide()","Board.renderer.display()"),s.Z.exists(e.rendNode)&&(e.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===i.Z.OBJECT_CLASS_TEXT&&"html"===s.Z.evaluate(t.visProp.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===i.Z.OBJECT_CLASS_TEXT&&"html"===s.Z.evaluate(t.visProp.display)?this.updateTextStyle(t,!1):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(e){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),e&&e.attr.showcopyright&&this.displayCopyright(t.Z.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 G=t.Z.CanvasRenderer;t.Z.NoRenderer=function(){this.enhancedRendering=!1,this.type="no"},t.Z.extend(t.Z.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){},transformImage:function(t,e){},updateImageURL:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},createPrim:function(t,e){return null},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){},display:function(t,e){t&&(t.visPropOld.visible=e)},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(){}}}),t.Z.NoRenderer.prototype=new L;var W=t.Z.NoRenderer;t.Z.JSXGraph={rendererType:(k.Z.board.renderer="no",e.Z.supportsVML()&&(k.Z.board.renderer="vml",document.onmousemove=function(){var t;return document.body&&(t=document.body.scrollLeft,t+=document.body.scrollTop),t}),e.Z.supportsCanvas()&&(k.Z.board.renderer="canvas"),e.Z.supportsSVG()&&(k.Z.board.renderer="svg"),e.Z.isNode()&&e.Z.supportsCanvas()&&(k.Z.board.renderer="canvas"),(e.Z.isNode()||"no"===k.Z.renderer)&&(k.Z.text.display="internal",k.Z.infobox.display="internal"),k.Z.board.renderer),initRenderer:function(t,e,i,r){var o;if(s.Z.exists(i)&&!1!==i||"object"!=typeof document||(i=document),"object"==typeof i&&null!==t)for(o=s.Z.isString(t)?i.getElementById(t):t;o.firstChild;)o.removeChild(o.firstChild);else o=t;return void 0!==r&&"auto"!==r||(r=this.rendererType),"svg"===r?new U(o,e):"vml"===r?new F(o):"canvas"===r?new G(o,e):new W},_setAttributes:function(t,e){var i,r,o=s.Z.copyAttributes(t,e,"board"),n=["drag","fullscreen","intl","keyboard","logging","navbar","pan","resize","screenshot","selection","zoom"],a=n.length;for(i=0;i<a;i++)o[r=n[i]]=s.Z.copyAttributes(o,e,"board",r);return o.movetarget=t.moveTarget||t.movetarget||e.board.moveTarget,o},_fillBoard:function(e,i,s){e.initInfobox(i.infobox),e.maxboundingbox=i.maxboundingbox,e.resizeContainer(s.width,s.height,!0,!0),e._createSelectionPolygon(i),e.renderer.drawNavigationBar(e,i.navbar),t.Z.boards[e.id]=e},_setARIA:function(t,i){var r,o,n,a,h,l,c=i.document;if("object"!=typeof c){if(!e.Z.isBrowser)return;c=document}r=(o=s.Z.isString(t)?c.getElementById(t):t).ownerDocument,a=o.parentNode,h=t+"_ARIAlabel",l=t+"_ARIAdescription",(n=r.createElement("div")).innerHTML=i.title,n.setAttribute("id",h),n.style.display="none",a.insertBefore(n,o),(n=r.createElement("div")).innerHTML=i.description,n.setAttribute("id",l),n.style.display="none",a.insertBefore(n,o),o.setAttribute("aria-labelledby",h),o.setAttribute("aria-describedby",l)},_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(i,r){var n,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C=0,y=0,P={};return"default"!==(r=r||{}).theme&&s.Z.exists(t.Z.themes[r.theme])&&(P=t.Z.themes[r.theme]),v=s.Z.deepCopy(k.Z,P,!0),_=this._setAttributes(r,v),p=e.Z.getDimensions(i,_.document),_.unitx||_.unity?(n=s.Z.def(_.originx,150),a=s.Z.def(_.originy,150),h=s.Z.def(_.unitx,50),l=s.Z.def(_.unity,50)):((f=_.boundingbox)[0]<_.maxboundingbox[0]&&(f[0]=_.maxboundingbox[0]),f[1]>_.maxboundingbox[1]&&(f[1]=_.maxboundingbox[1]),f[2]>_.maxboundingbox[2]&&(f[2]=_.maxboundingbox[2]),f[3]<_.maxboundingbox[3]&&(f[3]=_.maxboundingbox[3]),c=Math.max(parseInt(p.width,10),o.Z.eps),d=Math.max(parseInt(p.height,10),o.Z.eps),s.Z.exists(f)&&_.keepaspectratio?(h=c/(f[2]-f[0]),l=d/(f[1]-f[3]),Math.abs(h)<Math.abs(l)?y=.5*(d/(l=Math.abs(h)*l/Math.abs(l))-(f[1]-f[3])):C=.5*(c/(h=Math.abs(l)*h/Math.abs(h))-(f[2]-f[0]))):(h=c/(f[2]-f[0]),l=d/(f[1]-f[3])),n=-h*(f[0]-C),a=l*(f[1]+y)),u=this.initRenderer(i,p,_.document,_.renderer),this._setARIA(i,_),(Z=new X(i,u,_.id,[n,a],_.zoomx,_.zoomy,h,l,p.width,p.height,_)).keepaspectratio=_.keepaspectratio,this._fillBoard(Z,_,p),Z.suspendUpdate(),(_=Z.attr).axis&&(g="object"==typeof _.axis?_.axis:{},m=s.Z.deepCopy(v.board.defaultaxes.x,g),b=s.Z.deepCopy(v.board.defaultaxes.y,g),_.defaultaxes.x&&(m=s.Z.deepCopy(m,_.defaultaxes.x)),_.defaultaxes.y&&(b=s.Z.deepCopy(b,_.defaultaxes.y)),Z.defaultAxes={},Z.defaultAxes.x=Z.create("axis",[[0,0],[1,0]],m),Z.defaultAxes.y=Z.create("axis",[[0,0],[0,1]],b)),_.grid&&Z.create("grid",[],"object"==typeof _.grid?_.grid:{}),Z.unsuspendUpdate(),Z},loadBoardFromFile:function(t,i,s,r,o){var n,a,h,l,c;return r=r||{},n=this._setAttributes(r),l=e.Z.getDimensions(t,n.document),a=this.initRenderer(t,l,n.document,n.renderer),this._setARIA(t,n),h=new X(t,a,"",[150,150],1,1,50,50,l.width,l.height,n),this._fillBoard(h,n,l),c=n.encoding||"iso-8859-1",R.parseFileContent(i,h,s,!0,c,o),h},loadBoardFromString:function(t,i,s,r,o){var n,a,h,l;return r=r||{},n=this._setAttributes(r),l=e.Z.getDimensions(t,n.document),a=this.initRenderer(t,l,n.document,n.renderer),this._setARIA(t,n),h=new X(t,a,"",[150,150],1,1,50,50,l.width,l.height,n),this._fillBoard(h,n,l),R.parseString(i,h,s,!0,o),h},freeBoard:function(e){var i;for(i in"string"==typeof e&&(e=t.Z.boards[e]),this._removeARIANodes(e),e.removeEventHandlers(),e.suspendUpdate(),e.objects)e.objects.hasOwnProperty(i)&&e.objects[i].remove();for(;e.containerObj.firstChild;)e.containerObj.removeChild(e.containerObj.firstChild);for(i in e.objects)e.objects.hasOwnProperty(i)&&delete e.objects[i];delete e.renderer,e.jc.creator.clearCache(),delete e.jc,delete t.Z.boards[e.id]},registerElement:function(e,i){t.Z.deprecated("JXG.JSXGraph.registerElement()","JXG.registerElement()"),t.Z.registerElement(e,i)}},e.Z.isBrowser&&"object"==typeof window&&"object"==typeof document&&e.Z.addEvent(window,"load",(function(){var e,i,r,o,n,a,h,l,c,d,u,p,f,_,g,m,b,v,Z=!1,C=document.getElementsByTagName("script"),y=function(e,i,s){var r=t.Z.JSXGraph.initBoard(n,{boundingbox:s,keepaspectratio:!0,grid:g,axis:_,showReload:!0});if(i.toLowerCase().indexOf("script")>-1)r.construct(e);else try{r.jc.parse(e)}catch(e){t.Z.debug(e)}return r},P=function(e,i,s,r){return function(){var o;t.Z.JSXGraph.freeBoard(e),(o=y(i,s,r)).reload=P(o,i,s,r)}};for(i=0;i<C.length;i++)if(e=C[i].getAttribute("type",!1),s.Z.exists(e)&&("text/jessiescript"===e.toLowerCase()||"jessiescript"===e.toLowerCase()||"text/jessiecode"===e.toLowerCase()||"jessiecode"===e.toLowerCase())){if(p=C[i].getAttribute("class",!1)||"",l=C[i].getAttribute("width",!1)||"",c=C[i].getAttribute("height",!1)||"",d=C[i].getAttribute("maxwidth",!1)||"100%",u=C[i].getAttribute("aspectratio",!1)||"1/1",f=C[i].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",n=C[i].getAttribute("container",!1),b=C[i].getAttribute("src",!1),4!==(f=f.split(",")).length)f=[-5,5,5,-5];else for(r=0;r<f.length;r++)f[r]=parseFloat(f[r]);if(_=s.Z.str2Bool(C[i].getAttribute("axis",!1)||"false"),g=s.Z.str2Bool(C[i].getAttribute("grid",!1)||"false"),s.Z.exists(n))o=document.getElementById(n);else{n="jessiescript_autgen_jxg_"+i,(o=document.createElement("div")).setAttribute("id",n),h=""!==l?"width:"+l+";":"",h+=""!==c?"height:"+c+";":"",h+=""!==d?"max-width:"+d+";":"",h+=""!==u?"aspect-ratio:"+u+";":"",o.setAttribute("style",h),o.setAttribute("class","jxgbox "+p);try{document.body.insertBefore(o,C[i])}catch(t){"object"==typeof jQuery&&jQuery(o).insertBefore(C[i])}}m="",s.Z.exists(b)?(Z=!0,(v=new XMLHttpRequest).open("GET",b),v.overrideMimeType("text/plain; charset=x-user-defined"),v.addEventListener("load",(function(){if(!(this.status<400))throw new Error("\nJSXGraph: failed to load file",b,":",this.responseText);m=this.responseText+"\n"+m,(a=y(m,e,f)).reload=P(a,m,e,f)})),v.addEventListener("error",(function(t){throw new Error("\nJSXGraph: failed to load file",b,":",t)})),v.send()):Z=!1,document.getElementById(n)?(m=(m=C[i].innerHTML).replace(/<!\[CDATA\[/g,"").replace(/\]\]>/g,""),C[i].innerHTML=m,Z||((a=y(m,e,f)).reload=P(a,m,e,f))):t.Z.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}}),window);t.Z.JSXGraph;var H=__webpack_require__(958),V=__webpack_require__(218);t.Z.Point=function(t,e,s){this.constructor(t,s,i.Z.OBJECT_TYPE_POINT,i.Z.OBJECT_CLASS_POINT),this.element=this.board.select(s.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()},t.Z.Point.prototype=new H.Z,s.Z.copyPrototypeMethods(t.Z.Point,V.Z,"coordsConstructor"),t.Z.extend(t.Z.Point.prototype,{hasPoint:function(t,e){var i,r,o,n=this.coords.scrCoords,a=s.Z.evaluate(this.visProp.sizeunit);return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(o=this.board._inputDevice,r=s.Z.evaluate(this.visProp.precision[o])):r=this.board.options.precision.hasPoint,i=parseFloat(s.Z.evaluate(this.visProp.size)),"user"===a&&(i*=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY))),(i+=.5*parseFloat(s.Z.evaluate(this.visProp.strokewidth)))<r&&(i=r),Math.abs(n[1]-t)<i+2&&Math.abs(n[2]-e)<i+2},update:function(t){return this.needsUpdate?(this.updateCoords(t),s.Z.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),this):this},updateTransform:function(t){var e,s;if(0===this.transformations.length||null===this.baseElement)return this;for(this===this.baseElement?(e=this.transformations[0].apply(this.baseElement,"self"),this.coords.setCoordinates(i.Z.COORDS_BY_USER,e)):e=this.transformations[0].apply(this.baseElement),this.coords.setCoordinates(i.Z.COORDS_BY_USER,e),s=1;s<this.transformations.length;s++)this.coords.setCoordinates(i.Z.COORDS_BY_USER,this.transformations[s].apply(this));return 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,s,r){var o;t=this.board.select(t),e=this.board.select(e),o=h.Z.intersectionFunction(this.board,t,e,s,r,this.visProp.alwaysintersect),this.addConstraint([o]);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=i.Z.OBJECT_TYPE_INTERSECTION,this.elType="intersection",this.parents=[t.id,e.id,s,r],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(e){return t.Z.deprecated("Point.normalizeFace()","JXG.normalizePointFace()"),k.Z.normalizePointFace(e)},face:function(e){t.Z.deprecated("Point.face()","Point.setAttribute()"),this.setAttribute({face:e})},size:function(e){t.Z.deprecated("Point.size()","Point.setAttribute()"),this.setAttribute({size:e})},isOn:function(e,r){var n,a;return r=r||o.Z.eps,s.Z.isPoint(e)?this.Dist(e)<r:e.elementClass===i.Z.OBJECT_CLASS_LINE?("segment"!==e.elType||s.Z.evaluate(this.visProp.alwaysintersect)||(n=t.Z.Math.Geometry.projectCoordsToSegment(this.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords))[1]>=0&&n[1]<=1)&&h.Z.distPointLine(this.coords.usrCoords,e.stdform)<r:e.elementClass===i.Z.OBJECT_CLASS_CIRCLE?s.Z.evaluate(e.visProp.hasinnerpoints)?this.Dist(e.center)<e.Radius()+r:Math.abs(this.Dist(e.center)-e.Radius())<r:e.elementClass===i.Z.OBJECT_CLASS_CURVE?(a=h.Z.projectPointToCurve(this,e,this.board)[0],h.Z.distance(this.coords.usrCoords,a.usrCoords,3)<r):e.type===i.Z.OBJECT_TYPE_POLYGON?!(!s.Z.evaluate(e.visProp.hasinnerpoints)||!e.pnpoly(this.coords.usrCoords[1],this.coords.usrCoords[2],t.Z.COORDS_BY_USER))||(n=h.Z.projectCoordsToPolygon(this.coords.usrCoords,e),h.Z.distance(this.coords.usrCoords,n,3)<r):e.type===i.Z.OBJECT_TYPE_TURTLE&&(a=h.Z.projectPointToTurtle(this,e,this.board),h.Z.distance(this.coords.usrCoords,a.usrCoords,3)<r)},cloneToBackground:function(){var t={};return t.id=this.id+"T"+this.numTraces,this.numTraces+=1,t.coords=this.coords,t.visProp=s.Z.deepCopy(this.visProp,this.visProp.traceattributes,!0),t.visProp.layer=this.board.options.layer.trace,t.elementClass=i.Z.OBJECT_CLASS_POINT,t.board=this.board,s.Z.clearVisPropOld(t),t.visPropCalc={visible:s.Z.evaluate(t.visProp.visible)},this.board.renderer.drawPoint(t),this.traces[t.id]=t.rendNode,this}}),t.Z.createPoint=function(e,i,r){var o,n;if(n=s.Z.copyAttributes(r,e.options,"point"),!(o=V.Z.create(t.Z.Point,e,i,n)))throw new Error("JSXGraph: Can't create point with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return o},t.Z.createGlider=function(t,e,i){var r,o,n=s.Z.copyAttributes(i,t.options,"glider");return o=1===e.length?[0,0]:e.slice(0,2),(r=t.create("point",o,n)).makeGlider(e[e.length-1]),r},t.Z.createIntersectionPoint=function(t,e,r){var o,n,a,l,c,d,u=s.Z.copyAttributes(r,t.options,"intersection");e.push(0,0),n=t.select(e[0]),a=t.select(e[1]),c=e[2]||0,d=e[3]||0,o=t.create("point",[0,0,0],u),l=h.Z.intersectionFunction(t,n,a,c,d,o.visProp.alwaysintersect),o.addConstraint([l]);try{n.addChild(o),a.addChild(o)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.")}return o.type=i.Z.OBJECT_TYPE_INTERSECTION,o.elType="intersection",o.setParents([n.id,a.id]),o.intersectionNumbers=[c,d],o.getParents=function(){return this.parents.concat(this.intersectionNumbers)},o.generatePolynomial=function(){var t=n.generatePolynomial(o),e=a.generatePolynomial(o);return 0===t.length||0===e.length?[]:[t[0],e[0]]},o},t.Z.createOtherIntersectionPoint=function(t,e,r){var n,a,l,c;if(3!==e.length||!s.Z.isPoint(e[2])||e[0].elementClass!==i.Z.OBJECT_CLASS_LINE&&e[0].elementClass!==i.Z.OBJECT_CLASS_CIRCLE||e[1].elementClass!==i.Z.OBJECT_CLASS_LINE&&e[1].elementClass!==i.Z.OBJECT_CLASS_CIRCLE)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|line,circle|line,point]");return a=t.select(e[0]),l=t.select(e[1]),c=t.select(e[2]),(n=t.create("point",[function(){var t=h.Z.meet(a.stdform,l.stdform,0,a.board);return Math.abs(c.X()-t.usrCoords[1])>o.Z.eps||Math.abs(c.Y()-t.usrCoords[2])>o.Z.eps||Math.abs(c.Z()-t.usrCoords[0])>o.Z.eps?t:h.Z.meet(a.stdform,l.stdform,1,a.board)}],r)).type=i.Z.OBJECT_TYPE_INTERSECTION,n.elType="otherintersection",n.setParents([a.id,l.id,c]),a.addChild(n),l.addChild(n),n.generatePolynomial=function(){var t=a.generatePolynomial(n),e=l.generatePolynomial(n);return 0===t.length||0===e.length?[]:[t[0],e[0]]},n},t.Z.createPolePoint=function(e,s,r){var o,n,a,h,l,c,d;if(s.length>1&&(h=s[0].type===i.Z.OBJECT_TYPE_CONIC||s[0].elementClass===i.Z.OBJECT_CLASS_CIRCLE,l=s[1].type===i.Z.OBJECT_TYPE_CONIC||s[1].elementClass===i.Z.OBJECT_CLASS_CIRCLE,c=s[0].elementClass===i.Z.OBJECT_CLASS_LINE,d=s[1].elementClass===i.Z.OBJECT_CLASS_LINE),2!==s.length||!(h&&d||c&&l))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof s[0]+"' and '"+typeof s[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return d?(n=e.select(s[0]),a=e.select(s[1])):(n=e.select(s[1]),a=e.select(s[0])),(o=e.create("point",[function(){var e=n.quadraticform,i=a.stdform.slice(0,3);return[t.Z.Math.Numerics.det([i,e[1],e[2]]),t.Z.Math.Numerics.det([e[0],i,e[2]]),t.Z.Math.Numerics.det([e[0],e[1],i])]}],r)).elType="polepoint",o.setParents([n.id,a.id]),n.addChild(o),a.addChild(o),o},t.Z.registerElement("point",t.Z.createPoint),t.Z.registerElement("glider",t.Z.createGlider),t.Z.registerElement("intersection",t.Z.createIntersectionPoint),t.Z.registerElement("otherintersection",t.Z.createOtherIntersectionPoint),t.Z.registerElement("polepoint",t.Z.createPolePoint);var $=t.Z.Point;t.Z.Line=function(e,s,r,o){this.constructor(e,o,i.Z.OBJECT_TYPE_LINE,i.Z.OBJECT_CLASS_LINE),this.point1=this.board.select(s),this.point2=this.board.select(r),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=t.Z.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"})},t.Z.Line.prototype=new H.Z,t.Z.extend(t.Z.Line.prototype,{hasPoint:function(t,e){var r,n,a,l,c,d,p,f,_,g=[],m=[1,t,e],b=s.Z.evaluate(this.visProp.strokewidth);return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(_=this.board._inputDevice,f=s.Z.evaluate(this.visProp.precision[_])):f=this.board.options.precision.hasPoint,f+=.5*b,g[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,g[1]=this.stdform[1]/this.board.unitX,g[2]=this.stdform[2]/-this.board.unitY,r=h.Z.distPointLine(m,g),!(isNaN(r)||r>f)&&(!(!s.Z.evaluate(this.visProp.straightfirst)||!s.Z.evaluate(this.visProp.straightlast))||(a=this.point1.coords,l=this.point2.coords,n=[0,g[1],g[2]],n=o.Z.crossProduct(n,m),(n=o.Z.crossProduct(n,g))[1]/=n[0],n[2]/=n[0],n[0]=1,n=new u.Z(i.Z.COORDS_BY_SCREEN,n.slice(1),this.board).usrCoords,c=a.distance(i.Z.COORDS_BY_USER,l),a=a.usrCoords.slice(0),l=l.usrCoords.slice(0),c<o.Z.eps?d=0:(c===Number.POSITIVE_INFINITY&&(c=1/o.Z.eps,Math.abs(l[0])<o.Z.eps?(c/=h.Z.distance([0,0,0],l),l=[1,a[1]+l[1]*c,a[2]+l[2]*c]):(c/=h.Z.distance([0,0,0],a),a=[1,l[1]+a[1]*c,l[2]+a[2]*c])),c=l[p=1]-a[p],Math.abs(c)<o.Z.eps&&(c=l[p=2]-a[p]),d=(n[p]-a[p])/c),!(!s.Z.evaluate(this.visProp.straightfirst)&&d<0)&&!(!s.Z.evaluate(this.visProp.straightlast)&&d>1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(s.Z.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(s.Z.isFunction(this.funp1)&&(t=this.funp1(),s.Z.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(i.Z.COORDS_BY_USER,t)),s.Z.isFunction(this.funp2)&&(t=this.funp2(),s.Z.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(i.Z.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),s.Z.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,e,r,n,a,h,l,c;return this.hasFixedLength?(t=this.point1.Dist(this.point2),e=Math.abs(this.fixedLength()),r=this.fixedLengthOldCoords[0].distance(i.Z.COORDS_BY_USER,this.point1.coords),n=this.fixedLengthOldCoords[1].distance(i.Z.COORDS_BY_USER,this.point2.coords),(r>o.Z.eps||n>o.Z.eps||t!==e)&&(a=this.point1.isDraggable&&this.point1.type!==i.Z.OBJECT_TYPE_GLIDER&&!s.Z.evaluate(this.point1.visProp.fixed),h=this.point2.isDraggable&&this.point2.type!==i.Z.OBJECT_TYPE_GLIDER&&!s.Z.evaluate(this.point2.visProp.fixed),t>o.Z.eps?r>n&&h||r<=n&&h&&!a?(this.point2.setPositionDirectly(i.Z.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()):(r<=n&&a||r>n&&a&&!h)&&(this.point1.setPositionDirectly(i.Z.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()):(l=Math.random()-.5,c=Math.random()-.5,t=o.Z.hypot(l,c),h?(this.point2.setPositionDirectly(i.Z.COORDS_BY_USER,[this.point1.X()+l*e/t,this.point1.Y()+c*e/t]),this.point2.fullUpdate()):a&&(this.point1.setPositionDirectly(i.Z.COORDS_BY_USER,[this.point2.X()+l*e/t,this.point2.Y()+c*e/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(i.Z.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(i.Z.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=o.Z.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])&&o.Z.innerProduct(this.stdform,this.stdform,3)>=o.Z.eps*o.Z.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])>=o.Z.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=o.Z.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 u.Z(i.Z.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){s.Z.exists(this.label)&&(this.label.relativeCoords=new u.Z(i.Z.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,e,r=0,n=new u.Z(i.Z.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),a=new u.Z(i.Z.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),l=s.Z.evaluate(this.visProp.straightfirst),c=s.Z.evaluate(this.visProp.straightlast);if((l||c)&&h.Z.calcStraight(this,n,a,0),n=n.scrCoords,a=a.scrCoords,!s.Z.exists(this.label))return new u.Z(i.Z.COORDS_BY_SCREEN,[NaN,NaN],this.board);switch(s.Z.evaluate(this.label.visProp.position)){case"last":t=a[1],e=a[2];break;case"first":t=n[1],e=n[2];break;case"lft":case"llft":case"ulft":n[1]<=a[1]?(t=n[1],e=n[2]):(t=a[1],e=a[2]);break;case"rt":case"lrt":case"urt":n[1]>a[1]?(t=n[1],e=n[2]):(t=a[1],e=a[2]);break;default:t=.5*(n[1]+a[1]),e=.5*(n[2]+a[2])}return(l||c)&&(s.Z.exists(this.label)&&(r=s.Z.evaluate(this.label.visProp.fontsize)),Math.abs(t)<o.Z.eps?t=r:this.board.canvasWidth+o.Z.eps>t&&t>this.board.canvasWidth-r-o.Z.eps&&(t=this.board.canvasWidth-r),o.Z.eps+r>e&&e>-o.Z.eps?e=r:this.board.canvasHeight+o.Z.eps>e&&e>this.board.canvasHeight-r-o.Z.eps&&(e=this.board.canvasHeight-r)),new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board)},cloneToBackground:function(){var t,e,r,o={};return o.id=this.id+"T"+this.numTraces,o.elementClass=i.Z.OBJECT_CLASS_LINE,this.numTraces++,o.point1=this.point1,o.point2=this.point2,o.stdform=this.stdform,o.board=this.board,o.visProp=s.Z.deepCopy(this.visProp,this.visProp.traceattributes,!0),o.visProp.layer=this.board.options.layer.trace,s.Z.clearVisPropOld(o),o.visPropCalc={visible:s.Z.evaluate(o.visProp.visible)},e=this.getSlope(),t=this.getRise(),o.getSlope=function(){return e},o.getRise=function(){return t},r=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(o),this.board.renderer.enhancedRendering=r,this.traces[o.id]=o.rendNode,this},addTransform:function(t){var e,i=s.Z.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.point1.transformations.push(i[e]),this.point2.transformations.push(i[e]);return this},snapToGrid:function(t){var e,r,o,n,a,l,c,d;return s.Z.evaluate(this.visProp.snaptogrid)?this.parents.length<3?(this.point1.handleSnapToGrid(!0,!0),this.point2.handleSnapToGrid(!0,!0)):s.Z.exists(t)&&(c=s.Z.evaluate(this.visProp.snapsizex),d=s.Z.evaluate(this.visProp.snapsizey),a=(e=new u.Z(i.Z.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this.board)).usrCoords[1],l=e.usrCoords[2],c<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(c=(n=this.board.defaultAxes.x.defaultTicks).ticksDelta*(s.Z.evaluate(n.visProp.minorticks)+1)),d<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(d=(n=this.board.defaultAxes.y.defaultTicks).ticksDelta*(s.Z.evaluate(n.visProp.minorticks)+1)),c>0&&d>0&&(r=h.Z.projectPointToLine({coords:e},this,this.board),o=p.Z.subtract([1,Math.round(a/c)*c,Math.round(l/d)*d],r.usrCoords),this.board.create("transform",o.slice(1),{type:"translate"}).applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGrid(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var t=s.Z.evaluate(this.visProp.snaptopoints);return this.parents.length<3&&(this.point1.handleSnapToPoints(t),this.point2.handleSnapToPoints(t)),this},X:function(t){var e,i=this.stdform[2];return e=Math.abs(this.point1.coords.usrCoords[0])>o.Z.eps?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1],t=2*(t-.5),(1-Math.abs(t))*e-t*i},Y:function(t){var e,i=this.stdform[1];return e=Math.abs(this.point1.coords.usrCoords[0])>o.Z.eps?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2],t=2*(t-.5),(1-Math.abs(t))*e+t*i},Z:function(t){var e=Math.abs(this.point1.coords.usrCoords[0])>o.Z.eps?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0];return t=2*(t-.5),(1-Math.abs(t))*e},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(t){return this.hasFixedLength?(this.fixedLength=s.Z.createFunction(t,this.board),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(),H.Z.prototype.remove.call(this)}}),t.Z.createLine=function(e,i,r){var o,n,a,h,l,c,d,u=[],p=!1,f=!1;if(2===i.length){if(c=s.Z.copyAttributes(r,e.options,"line","point1"),s.Z.isArray(i[0])&&i[0].length>1)a=e.create("point",i[0],c);else if(s.Z.isString(i[0])||s.Z.isPoint(i[0]))a=e.select(i[0]);else if(s.Z.isFunction(i[0])&&s.Z.isPoint(i[0]()))a=i[0](),f=!0;else if(s.Z.isFunction(i[0])&&i[0]().length&&i[0]().length>=2)a=t.Z.createPoint(e,i[0](),c),f=!0;else{if(!s.Z.isObject(i[0])||!s.Z.isTransformationOrArray(i[1]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");p=!0,a=e.create("point",[i[0].point1,i[1]],c)}if(c=s.Z.copyAttributes(r,e.options,"line","point2"),p)h=e.create("point",[i[0].point2,i[1]],c);else if(s.Z.isArray(i[1])&&i[1].length>1)h=e.create("point",i[1],c);else if(s.Z.isString(i[1])||s.Z.isPoint(i[1]))h=e.select(i[1]);else if(s.Z.isFunction(i[1])&&s.Z.isPoint(i[1]()))h=i[1](),f=!0;else{if(!(s.Z.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");h=t.Z.createPoint(e,i[1](),c),f=!0}c=s.Z.copyAttributes(r,e.options,"line"),n=new t.Z.Line(e,a,h,c),f?(n.constrained=!0,n.funp1=i[0],n.funp2=i[1]):p||(n.isDraggable=!0),n.setParents([a.id,h.id])}else if(3===i.length){for(d=!0,l=0;l<3;l++)if(s.Z.isNumber(i[l]))u[l]=s.Z.createFunction(i[l]);else{if(!s.Z.isFunction(i[l]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u[l]=i[l],d=!1}c=s.Z.copyAttributes(r,e.options,"line","point1"),a=d?e.create("point",[u[2]()*u[2]()+u[1]()*u[1](),u[2]()-u[1]()*u[0]()+u[2](),-u[1]()-u[2]()*u[0]()-u[1]()],c):e.create("point",[function(){return.5*(u[2]()*u[2]()+u[1]()*u[1]())},function(){return.5*(u[2]()-u[1]()*u[0]()+u[2]())},function(){return.5*(-u[1]()-u[2]()*u[0]()-u[1]())}],c),c=s.Z.copyAttributes(r,e.options,"line","point2"),h=d?e.create("point",[u[2]()*u[2]()+u[1]()*u[1](),-u[1]()*u[0]()+u[2](),-u[2]()*u[0]()-u[1]()],c):e.create("point",[function(){return u[2]()*u[2]()+u[1]()*u[1]()},function(){return-u[1]()*u[0]()+u[2]()},function(){return-u[2]()*u[0]()-u[1]()}],c),a.prepareUpdate().update(),h.prepareUpdate().update(),c=s.Z.copyAttributes(r,e.options,"line"),(n=new t.Z.Line(e,a,h,c)).isDraggable=d,n.setParents([a,h])}else if(1===i.length&&s.Z.isFunction(i[0])&&2===i[0]().length&&s.Z.isPoint(i[0]()[0])&&s.Z.isPoint(i[0]()[1]))o=i[0](),c=s.Z.copyAttributes(r,e.options,"line"),(n=new t.Z.Line(e,o[0],o[1],c)).constrained=!0,n.funps=i[0],n.setParents(o);else{if(!(1===i.length&&s.Z.isFunction(i[0])&&3===i[0]().length&&s.Z.isNumber(i[0]()[0])&&s.Z.isNumber(i[0]()[1])&&s.Z.isNumber(i[0]()[2])))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");o=i[0],c=s.Z.copyAttributes(r,e.options,"line","point1"),a=e.create("point",[function(){var t=o();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])]}],c),c=s.Z.copyAttributes(r,e.options,"line","point2"),h=e.create("point",[function(){var t=o();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],c),c=s.Z.copyAttributes(r,e.options,"line"),(n=new t.Z.Line(e,a,h,c)).constrained=!0,n.funps=i[0],n.setParents([a,h])}return n},t.Z.registerElement("line",t.Z.createLine),t.Z.createSegment=function(t,e,r){var o,n;if(r.straightFirst=!1,r.straightLast=!1,n=s.Z.copyAttributes(r,t.options,"segment"),o=t.create("line",e.slice(0,2),n),3===e.length){if(o.hasFixedLength=!0,s.Z.isNumber(e[2]))o.fixedLength=function(){return e[2]};else{if(!s.Z.isFunction(e[2]))throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function");o.fixedLength=s.Z.createFunction(e[2],this.board)}o.getParents=function(){return this.parents.concat(this.fixedLength())},o.fixedLengthOldCoords=[],o.fixedLengthOldCoords[0]=new u.Z(i.Z.COORDS_BY_USER,o.point1.coords.usrCoords.slice(1,3),t),o.fixedLengthOldCoords[1]=new u.Z(i.Z.COORDS_BY_USER,o.point2.coords.usrCoords.slice(1,3),t)}return o.elType="segment",o},t.Z.registerElement("segment",t.Z.createSegment),t.Z.createArrow=function(t,e,r){var o,n;return r.straightFirst=!1,r.straightLast=!1,n=s.Z.copyAttributes(r,t.options,"arrow"),(o=t.create("line",e,n)).type=i.Z.OBJECT_TYPE_VECTOR,o.elType="arrow",o},t.Z.registerElement("arrow",t.Z.createArrow),t.Z.createAxis=function(e,r,o){var n,a,h,l;a=s.Z.copyAttributes(o,e.options,"axis");try{n=e.create("line",r,a)}catch(t){throw new Error("JSXGraph: Can't create axis with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}for(h in n.type=i.Z.OBJECT_TYPE_AXIS,n.isDraggable=!1,n.point1.isDraggable=!1,n.point2.isDraggable=!1,n._point1UsrCoordsOrg=n.point1.coords.usrCoords.slice(),n._point2UsrCoordsOrg=n.point2.coords.usrCoords.slice(),n.ancestors)n.ancestors.hasOwnProperty(h)&&(n.ancestors[h].type=i.Z.OBJECT_TYPE_AXISPOINT);return l=s.Z.exists(a.ticks.ticksdistance)?a.ticks.ticksdistance:s.Z.isArray(a.ticks.ticks)?a.ticks.ticks:1,n.defaultTicks=e.create("ticks",[n,l],a.ticks),n.defaultTicks.dump=!1,n.elType="axis",n.subs={ticks:n.defaultTicks},n.inherits.push(n.defaultTicks),n.update=function(){var e,i,r,o,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C;if(e=this.board.getBoundingBox(),i=s.Z.evaluate(this.visProp.position),o=this.Direction(),a=this.isHorizontal(),h=this.isVertical(),l=s.Z.evaluate(this.visProp.ticksautopos),c=s.Z.evaluate(this.visProp.ticksautoposthreshold),c=a?s.Z.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitX)*this.board.unitX:h?s.Z.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitY)*this.board.unitY:s.Z.parseNumber(c,1,1),p=(u=s.Z.evaluate(this.visProp.anchor)).indexOf("left")>-1,f=u.indexOf("right")>-1,_=s.Z.evaluate(this.visProp.anchordist),_=a?s.Z.parseNumber(_,Math.abs(e[1]-e[3]),1/this.board.unitX):h?s.Z.parseNumber(_,Math.abs(e[0]-e[2]),1/this.board.unitY):0,b=this.board.getPointLoc(this._point1UsrCoordsOrg,_),g=this.point1.coords.usrCoords.slice(),m=this.point2.coords.usrCoords.slice(),"static"===i||!h&&!a||("fixed"===i?(a&&(o[0]>0&&f||o[0]<0&&p?(g[2]=e[3]+_,m[2]=e[3]+_):o[0]>0&&p||o[0]<0&&f?(g[2]=e[1]-_,m[2]=e[1]-_):(g=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(o[1]>0&&p||o[1]<0&&f?(g[1]=e[0]+_,m[1]=e[0]+_):o[1]>0&&f||o[1]<0&&p?(g[1]=e[2]-_,m[1]=e[2]-_):(g=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice()))):"sticky"===i&&(a&&(b[1]<0&&(o[0]>0&&f||o[0]<0&&p)?(g[2]=e[3]+_,m[2]=e[3]+_):b[1]>0&&(o[0]>0&&p||o[0]<0&&f)?(g[2]=e[1]-_,m[2]=e[1]-_):(g=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(b[0]<0&&(o[1]>0&&p||o[1]<0&&f)?(g[1]=e[0]+_,m[1]=e[0]+_):b[0]>0&&(o[1]>0&&f||o[1]<0&&p)?(g[1]=e[2]-_,m[1]=e[2]-_):(g=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(t.Z.COORDS_BY_USER,g),this.point2.setPositionDirectly(t.Z.COORDS_BY_USER,m),v=this.defaultTicks.visProp.label,l&&(a||h)){if(s.Z.exists(v._anchorx_org)||(v._anchorx_org=s.Z.def(v.anchorx,this.board.options.text.anchorX)),s.Z.exists(v._anchory_org)||(v._anchory_org=s.Z.def(v.anchory,this.board.options.text.anchorY)),s.Z.exists(v._offset_org)||(v._offset_org=v.offset.slice()),C=v.offset,a){for(d=n.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,Z=v.anchory,d<0&&Math.abs(d)>c?"bottom"===v._side&&("top"===v.anchory&&(Z="bottom"),C[1]*=-1,v._side="top"):d>0&&Math.abs(d)>c?"top"===v._side&&("bottom"===v.anchory&&(Z="top"),C[1]*=-1,v._side="bottom"):(Z=v._anchory_org,C=v._offset_org.slice(),"top"===Z?v._side="bottom":"bottom"===Z?v._side="top":C[1]<0?v._side="bottom":v._side="top"),r=0;r<n.defaultTicks.labels.length;r++)this.defaultTicks.labels[r].visProp.anchory=Z;v.anchory=Z}else if(h){for((d=n.point1.coords.scrCoords[1]-.5*this.board.canvasWidth)<0&&Math.abs(d)>c?"right"===v._side&&("left"===v.anchorx&&(Z="right"),C[0]*=-1,v._side="left"):d>0&&Math.abs(d)>c?"left"===v._side&&("right"===v.anchorx&&(Z="left"),C[0]*=-1,v._side="right"):(Z=v._anchorx_org,C=v._offset_org.slice(),"left"===Z?v._side="right":"right"===Z||C[0]<0?v._side="left":v._side="right"),r=0;r<n.defaultTicks.labels.length;r++)this.defaultTicks.labels[r].visProp.anchorx=Z;v.anchorx=Z}v.offset=C}else delete v._anchorx_org,delete v._anchory_org,delete v._offset_org;return t.Z.Line.prototype.update.call(this),this.defaultTicks.needsUpdate=!0,this},n},t.Z.registerElement("axis",t.Z.createAxis),t.Z.createTangent=function(t,e,r){var n,a,h,l,c,u,p;if(1===e.length)n=e[0],a=n.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,line|curve|circle|conic]");if(s.Z.isPoint(e[0]))n=e[0],a=e[1];else{if(!s.Z.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,line|curve|circle|conic]");a=e[0],n=e[1]}}if(u=s.Z.copyAttributes(r,t.options,"tangent"),a.elementClass===i.Z.OBJECT_CLASS_LINE?(c=t.create("line",[a.point1,a.point2],u)).glider=n:a.elementClass===i.Z.OBJECT_CLASS_CURVE&&a.type!==i.Z.OBJECT_TYPE_CONIC?"plot"!==s.Z.evaluate(a.visProp.curvetype)?(c=t.create("line",[function(){var t=a.X,e=a.Y;return-n.X()*d.Z.D(e)(n.position)+n.Y()*d.Z.D(t)(n.position)},function(){return d.Z.D(a.Y)(n.position)},function(){return-d.Z.D(a.X)(n.position)}],u),n.addChild(c),c.glider=n):(p=function(t,e,i){var s,r,a,h,l,c,d,u,p,f,_,g,m=Math.floor(t);if(1===e.bezierDegree)m===e.numberPoints-1&&m--;else{if(3!==e.bezierDegree)return 0;a=(t*((g="sector"===e.elType?(_=e.points.slice(3,e.numberPoints-3)).length:(_=e.points).length)-1)-(m=3*Math.floor(t*(g-1)/3)))/3,m>=g-1&&(m=g-4,a=1)}if(m<0)return 1;switch(1===e.bezierDegree?(s=e.points[m].usrCoords,r=e.points[m+1].usrCoords):(h=_[m].usrCoords,l=_[m+1].usrCoords,c=_[m+2].usrCoords,d=_[m+3].usrCoords,u=(1-a)*(1-a)*(l[1]-h[1])+2*(1-a)*a*(c[1]-l[1])+a*a*(d[1]-c[1]),p=(1-a)*(1-a)*(l[2]-h[2])+2*(1-a)*a*(c[2]-l[2])+a*a*(d[2]-c[2]),u/=f=o.Z.hypot(u,p),p/=f,r=[1,(s=n.coords.usrCoords)[1]+u,s[2]+p]),i){case 0:return s[2]*r[1]-s[1]*r[2];case 1:return r[2]-s[2];case 2:return s[1]-r[1]}return 0},c=t.create("line",[function(){return p(n.position,a,0)},function(){return p(n.position,a,1)},function(){return p(n.position,a,2)}],u),n.addChild(c),c.glider=n):a.type===i.Z.OBJECT_TYPE_TURTLE?(c=t.create("line",[function(){var t=Math.floor(n.position);for(h=0;h<a.objects.length;h++)if((l=a.objects[h]).type===i.Z.OBJECT_TYPE_CURVE){if(t<l.numberPoints)break;t-=l.numberPoints}return t===l.numberPoints-1&&t--,t<0?1:l.Y(t)*l.X(t+1)-l.X(t)*l.Y(t+1)},function(){var t=Math.floor(n.position);for(h=0;h<a.objects.length;h++)if((l=a.objects[h]).type===i.Z.OBJECT_TYPE_CURVE){if(t<l.numberPoints)break;t-=l.numberPoints}return t===l.numberPoints-1&&t--,t<0?0:l.Y(t+1)-l.Y(t)},function(){var t=Math.floor(n.position);for(h=0;h<a.objects.length;h++)if((l=a.objects[h]).type===i.Z.OBJECT_TYPE_CURVE){if(t<l.numberPoints)break;t-=l.numberPoints}return t===l.numberPoints-1&&t--,t<0?0:l.X(t)-l.X(t+1)}],u),n.addChild(c),c.glider=n):a.elementClass!==i.Z.OBJECT_CLASS_CIRCLE&&a.type!==i.Z.OBJECT_TYPE_CONIC||(c=t.create("line",[function(){return o.Z.matVecMult(a.quadraticform,n.coords.usrCoords)[0]},function(){return o.Z.matVecMult(a.quadraticform,n.coords.usrCoords)[1]},function(){return o.Z.matVecMult(a.quadraticform,n.coords.usrCoords)[2]}],u),n.addChild(c),c.glider=n),!s.Z.exists(c))throw new Error("JSXGraph: Couldn't create tangent with the given parents.");return c.elType="tangent",c.type=i.Z.OBJECT_TYPE_TANGENT,c.setParents(e),c},t.Z.createRadicalAxis=function(t,e,s){var r,n,a;if(2!==e.length||e[0].elementClass!==i.Z.OBJECT_CLASS_CIRCLE||e[1].elementClass!==i.Z.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 n=t.select(e[0]),a=t.select(e[1]),(r=t.create("line",[function(){var t=n.stdform,e=a.stdform;return o.Z.matVecMult(o.Z.transpose([t.slice(0,3),e.slice(0,3)]),[e[3],-t[3]])}],s)).elType="radicalaxis",r.setParents([n.id,a.id]),n.addChild(r),a.addChild(r),r},t.Z.createPolarLine=function(t,e,r){var o,n,a,h,l,c,d;if(e.length>1&&(h=e[0].type===i.Z.OBJECT_TYPE_CONIC||e[0].elementClass===i.Z.OBJECT_CLASS_CIRCLE,l=e[1].type===i.Z.OBJECT_TYPE_CONIC||e[1].elementClass===i.Z.OBJECT_CLASS_CIRCLE,c=s.Z.isPoint(e[0]),d=s.Z.isPoint(e[1])),2!==e.length||!(h&&d||c&&l))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 d?(n=t.select(e[0]),a=t.select(e[1])):(n=t.select(e[1]),a=t.select(e[0])),(o=t.create("tangent",[n,a],r)).elType="polarline",o},t.Z.registerElement("tangent",t.Z.createTangent),t.Z.registerElement("polar",t.Z.createTangent),t.Z.registerElement("radicalaxis",t.Z.createRadicalAxis),t.Z.registerElement("polarline",t.Z.createPolarLine);t.Z.Line;t.Z.Group=function(t,e,r,o,n){var a,h,l,c;for(this.board=t,this.objects={},a=this.board.numObjects,this.board.numObjects+=1,""!==e&&s.Z.exists(e)?this.id=e:this.id=this.board.id+"Group"+a,this.board.groups[this.id]=this,this.type=i.Z.OBJECT_TYPE_POINT,this.elementClass=i.Z.OBJECT_CLASS_POINT,""!==r&&s.Z.exists(r)?this.name=r:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=n.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],h=s.Z.isArray(o)?o:Array.prototype.slice.call(arguments,3),l=0;l<h.length;l++)c=this.board.select(h[l]),!s.Z.evaluate(c.visProp.fixed)&&s.Z.exists(c.coords)&&this.addPoint(c);this.methodMap={ungroup:"ungroup",add:"addPoint",addPoint:"addPoint",addPoints:"addPoints",addGroup:"addGroup",remove:"removePoint",removePoint:"removePoint",setAttribute:"setAttribute",setProperty:"setAttribute"}},t.Z.extend(t.Z.Group.prototype,{ungroup:function(){var t,e,i;for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point,s.Z.isArray(e.groups)&&(i=s.Z.indexOf(e.groups,this.id))>=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,r;for(i=(r=s.Z.isArray(t)?t:arguments).length,e=0;e<i;++e)s.Z.isId(this.board,r[e])?this.parents.push(r[e]):s.Z.exists(r[e].id)&&this.parents.push(r[e].id);this.parents=s.Z.uniqueArray(this.parents)},setParents:function(t){return this.parents=[],this.addParents(t),this},getParents:function(){return s.Z.isArray(this.parents)?this.parents:[]},_updateCoordsCache:function(t){var e;""!==t&&s.Z.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,r,n,a,l,c,d,u,p=null;if(!this.needsUpdate)return this;if("nothing"===(t=this._update_find_drag_type()).action)return this._updateCoordsCache(t.id),this;if(p=this.objects[t.id].point,"translation"===t.action)d=[p.coords.usrCoords[1]-this.coords[t.id].usrCoords[1],p.coords.usrCoords[2]-this.coords[t.id].usrCoords[2]];else if("rotation"===t.action||"scaling"===t.action){if(i="rotation"===t.action?"rotationCenter":"scaleCenter",s.Z.isPoint(this[i]))u=this[i].coords.usrCoords.slice(1);else if("centroid"===this[i])u=this._update_centroid_center();else if(s.Z.isArray(this[i]))u=this[i];else{if(!s.Z.isFunction(this[i]))return this;u=this[i]()}if("rotation"===t.action)c=h.Z.rad(this.coords[t.id].usrCoords.slice(1),u,this.objects[t.id].point),(d=this.board.create("transform",[c,u[0],u[1]],{type:"rotate"})).update();else{if("scaling"!==t.action)return this;if(n=h.Z.distance(this.coords[t.id].usrCoords.slice(1),u),Math.abs(n)<o.Z.eps)return this;n=h.Z.distance(p.coords.usrCoords.slice(1),u)/n,a=this.scaleDirections[t.id].indexOf("x")>=0?n:1,l=this.scaleDirections[t.id].indexOf("y")>=0?n:1,(d=this.board.create("transform",[1,0,0,u[0]*(1-a),a,0,u[1]*(1-l),0,l],{type:"generic"})).update()}}for(e in this._update_apply_transformation(t,d),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(e))for(r in this.objects[e].descendants)this.objects[e].descendants.hasOwnProperty(r)&&(this.objects[e].descendants.needsUpdate=this.objects[e].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(e in this.board.updateElements(t),this.objects)this.objects.hasOwnProperty(e)&&this._updateCoordsCache(e);return this},_update_find_drag_type:function(){var t,e,r,n="nothing",a=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point).coords.distance(i.Z.COORDS_BY_USER,this.coords[t])>o.Z.eps&&a.push(e.id);return 0===a.length?{action:n,id:"",changed:a}:(r=a[0],e=this.objects[r].point,a.length>1?n="translation":s.Z.isInArray(this.rotationPoints,e)&&s.Z.exists(this.rotationCenter)?n="rotation":s.Z.isInArray(this.scalePoints,e)&&s.Z.exists(this.scaleCenter)?n="scaling":s.Z.isInArray(this.translationPoints,e)&&(n="translation"),{action:n,id:r,changed:a})},_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 r,n;for(r in this.objects)this.objects.hasOwnProperty(r)&&(s.Z.exists(this.board.objects[r])?(n=this.objects[r].point).id!==t.id?"translation"===t.action?s.Z.isInArray(t.changed,n.id)||n.coords.setCoordinates(i.Z.COORDS_BY_USER,[this.coords[r].usrCoords[1]+e[0],this.coords[r].usrCoords[2]+e[1]]):"rotation"!==t.action&&"scaling"!==t.action||e.applyOnce([n]):"rotation"!==t.action&&"scaling"!==t.action||n.coords.setCoordinates(i.Z.COORDS_BY_USER,o.Z.matVecMult(e.matrix,this.coords[n.id].usrCoords)):delete this.objects[r])},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=s.Z.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,r,o;for(o=(i=s.Z.isArray(t)?t:arguments).length,r=0;r<o;++r)this.scaleDirections[this.board.select(i[r]).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,r,o;for(o=(i=s.Z.isArray(e)?e:arguments).length,this[t+"Points"]=[],r=0;r<o;++r)this._addActionPoint(t,i[r]);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(){t.Z.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}}),t.Z.createGroup=function(e,i,r){var o=s.Z.copyAttributes(r,e.options,"group"),n=new t.Z.Group(e,o.id,o.name,i,o);return n.elType="group",n.setParents(i),n},t.Z.registerElement("group",t.Z.createGroup);t.Z.Group;t.Z.Circle=function(t,e,r,o,n){this.constructor(t,n,i.Z.OBJECT_TYPE_CIRCLE,i.Z.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(r),this.center=this.board.select(r),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],"twoPoints"===e?(this.point2=t.select(o),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=o,this.updateRadius=s.Z.createFunction(o,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):"pointLine"===e?(this.line=t.select(o),this.radius=this.line.point1.coords.distance(i.Z.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(o),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(),s.Z.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"pointRadius"===e?this.notifyParents(o):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&(s.Z.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=s.Z.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"})},t.Z.Circle.prototype=new H.Z,t.Z.extend(t.Z.Circle.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c=this.center.coords.usrCoords,d=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius();return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(n=this.board._inputDevice,r=s.Z.evaluate(this.visProp.precision[n])):r=this.board.options.precision.hasPoint,a=c[1]-d.usrCoords[1],h=c[2]-d.usrCoords[2],l=o.Z.hypot(a,h),r+=.5*s.Z.evaluate(this.visProp.strokewidth),r/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),s.Z.evaluate(this.visProp.hasinnerpoints)?l<p+r:Math.abs(l-p)<r},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,r,o="";return"twoPoints"===this.method?(t=this.center.symbolic.x,e=this.center.symbolic.y,o="(("+(i=this.point2.symbolic.x)+")-("+t+"))^2 + (("+(r=this.point2.symbolic.y)+")-("+e+"))^2"):"pointRadius"===this.method?s.Z.isNumber(this.radius)&&(o=(this.radius*this.radius).toString()):"pointLine"===this.method?(i=this.line.point1.symbolic.x,r=this.line.point1.symbolic.y,o="(("+i+")-("+this.line.point2.symbolic.x+"))^2 + (("+r+")-("+this.line.point2.symbolic.y+"))^2"):"pointCircle"===this.method&&(o=this.circle.Radius()),o},update:function(){var t,e,r,o,n,a;if(this.needsUpdate)for(s.Z.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),"pointLine"===this.method?this.radius=this.line.point1.coords.distance(i.Z.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(),r=this.center.coords.usrCoords[0],t=this.center.coords.usrCoords[1]/r,e=this.center.coords.usrCoords[2]/r,r/=r,o=this.Radius(),n=.551915024494,this.numberPoints=13,this.dataX=[t+o,t+o,t+o*n,t,t-o*n,t-o,t-o,t-o,t-o*n,t,t+o*n,t+o,t+o],this.dataY=[e,e+o*n,e+o,e+o,e+o,e+o*n,e,e-o*n,e-o,e-o,e-o,e-o*n,e],this.bezierDegree=3,a=0;a<this.numberPoints;a++)this.points[a]=new u.Z(i.Z.COORDS_BY_USER,[this.dataX[a],this.dataY[a]],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]=s.Z.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){s.Z.isString(t)&&B.Z.findDependencies(this,t,this.board)},setRadius:function(t){return this.updateRadius=s.Z.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return s.Z.exists(t)?(this.setRadius(t),this.Radius()):"twoPoints"===this.method?s.Z.cmpArrays(this.point2.coords.usrCoords,[0,0,0])||s.Z.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?Math.abs(this.updateRadius()):NaN},Diameter:function(){return 2*this.Radius()},getRadius:function(){return t.Z.deprecated("Circle.getRadius()","Circle.Radius()"),this.Radius()},getTextAnchor:function(){return this.center.coords},getLabelAnchor:function(){var t,e,r=this.Radius(),o=this.center.coords.usrCoords,n=.7071067811865;switch(s.Z.evaluate(this.visProp.label.position)){case"lft":t=o[1]-r,e=o[2];break;case"llft":t=o[1]-n*r,e=o[2]-n*r;break;case"rt":t=o[1]+r,e=o[2];break;case"lrt":t=o[1]+n*r,e=o[2]-n*r;break;case"urt":t=o[1]+n*r,e=o[2]+n*r;break;case"top":t=o[1],e=o[2]+r;break;case"bot":t=o[1],e=o[2]-r;break;default:t=o[1]-n*r,e=o[2]+n*r}return new u.Z(i.Z.COORDS_BY_USER,[t,e],this.board)},cloneToBackground:function(){var t,e=this.Radius(),r={id:this.id+"T"+this.numTraces,elementClass:i.Z.OBJECT_CLASS_CIRCLE,center:{coords:this.center.coords},Radius:function(){return e},getRadius:function(){return e},board:this.board,visProp:s.Z.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return r.visProp.layer=this.board.options.layer.trace,this.numTraces++,s.Z.clearVisPropOld(r),r.visPropCalc={visible:s.Z.evaluate(r.visProp.visible)},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawEllipse(r),this.board.renderer.enhancedRendering=t,this.traces[r.id]=r.rendNode,this},addTransform:function(t){var e,i=s.Z.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.center.transformations.push(i[e]),"twoPoints"===this.method&&this.point2.transformations.push(i[e]);return this},snapToGrid:function(){var t=s.Z.evaluate(this.visProp.snaptogrid);return this.center.handleSnapToGrid(t,!0),"twoPoints"===this.method&&this.point2.handleSnapToGrid(t,!0),this},snapToPoints:function(){var t=s.Z.evaluate(this.visProp.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}}),t.Z.createCircle=function(e,r,o){var n,a,h,l,c,d=["center","point2"];if(a=[],c=e.select(r[0]),s.Z.isObject(c)&&c.elementClass===i.Z.OBJECT_CLASS_CIRCLE&&s.Z.isTransformationOrArray(r[1]))return l=s.Z.copyAttributes(o,e.options,"circle"),(n=t.Z.createEllipse(e,[c.center,c.center,function(){return 2*c.Radius()}],l)).addTransform(r[1]),n;for(h=0;h<r.length;h++)if(s.Z.isPointType(e,r[h])){if(!1===(a=r.length<3?a.concat(s.Z.providePoints(e,[r[h]],o,"circle",[d[h]])):a.concat(s.Z.providePoints(e,[r[h]],o,"point")))[a.length-1])throw new Error("JSXGraph: Can't create circle from this type. Please provide a point type.")}else a.push(r[h]);if(l=s.Z.copyAttributes(o,e.options,"circle"),2===a.length&&s.Z.isPoint(a[0])&&s.Z.isPoint(a[1]))n=new t.Z.Circle(e,"twoPoints",a[0],a[1],l);else if((s.Z.isNumber(a[0])||s.Z.isFunction(a[0])||s.Z.isString(a[0]))&&s.Z.isPoint(a[1]))n=new t.Z.Circle(e,"pointRadius",a[1],a[0],l);else if((s.Z.isNumber(a[1])||s.Z.isFunction(a[1])||s.Z.isString(a[1]))&&s.Z.isPoint(a[0]))n=new t.Z.Circle(e,"pointRadius",a[0],a[1],l);else if(a[0].elementClass===i.Z.OBJECT_CLASS_CIRCLE&&s.Z.isPoint(a[1]))n=new t.Z.Circle(e,"pointCircle",a[1],a[0],l);else if(a[1].elementClass===i.Z.OBJECT_CLASS_CIRCLE&&s.Z.isPoint(a[0]))n=new t.Z.Circle(e,"pointCircle",a[0],a[1],l);else if(a[0].elementClass===i.Z.OBJECT_CLASS_LINE&&s.Z.isPoint(a[1]))n=new t.Z.Circle(e,"pointLine",a[1],a[0],l);else if(a[1].elementClass===i.Z.OBJECT_CLASS_LINE&&s.Z.isPoint(a[0]))n=new t.Z.Circle(e,"pointLine",a[0],a[1],l);else{if(!(3===r.length&&s.Z.isPoint(a[0])&&s.Z.isPoint(a[1])&&s.Z.isPoint(a[2])))throw new Error("JSXGraph: Can't create circle with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point], [circle,transformation]");if(!t.Z.elements.circumcircle)throw new Error("JSXGraph: Can't create circle with three points. Please include the circumcircle element (element/composition).");n=t.Z.elements.circumcircle(e,a,l)}for(n.isDraggable=!0,n.setParents(a),n.elType="circle",h=0;h<a.length;h++)s.Z.isPoint(a[h])&&n.inherits.push(a[h]);return n},t.Z.registerElement("circle",t.Z.createCircle);var K=t.Z.Circle;t.Z.createEllipse=function(t,e,r){var o,n,a,h,l,c,d,p=[],f=s.Z.copyAttributes(r,t.options,"conic","foci"),_=s.Z.copyAttributes(r,t.options,"conic","center"),g=s.Z.copyAttributes(r,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)p[c]=t.create("point",e[c],f);else if(s.Z.isPoint(e[c]))p[c]=t.select(e[c]);else if(s.Z.isFunction(e[c])&&s.Z.isPoint(e[c]()))p[c]=e[c]();else{if(!s.Z.isString(e[c]))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]");p[c]=t.select(e[c])}if(s.Z.isNumber(e[2]))l=s.Z.createFunction(e[2],t);else if(s.Z.isFunction(e[2])&&s.Z.isNumber(e[2]()))l=e[2];else{if(s.Z.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],f);else if(s.Z.isFunction(e[2])&&s.Z.isPoint(e[2]()))h=e[2]();else{if(!s.Z.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]");h=t.select(e[2])}l=function(){return h.Dist(p[0])+h.Dist(p[1])}}for(s.Z.exists(e[4])||(e[4]=2*Math.PI),s.Z.exists(e[3])||(e[3]=0),a=t.create("point",[function(){return.5*(p[0].X()+p[1].X())},function(){return.5*(p[0].Y()+p[1].Y())}],_),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],g)).majorAxis=l,d=n.hasPoint,o=function(t,e){var i,s,r,o,a,h,c,d,u;e||(s=(i=l())*i,r=p[0].X(),o=p[0].Y(),c=r-(a=p[1].X()),d=o-(h=p[1].Y()),u=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[u*u-a*a-h*h,u*c/i+a,u*d/i+h],[u*c/i+a,c*c/s-1,c*d/s],[u*d/i+h,c*d/s,d*d/s-1]])},n.X=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),n=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return e||o(0,e),p[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),o=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return p[0].Y()+Math.sin(o+t)*r},n.midpoint=n.center=a,n.type=i.Z.OBJECT_TYPE_CONIC,n.subs={center:n.center},n.inherits.push(n.center,p[0],p[1]),s.Z.isPoint(h)&&n.inherits.push(h),n.hasPoint=function(t,e){var r,o,n,a;return s.Z.evaluate(this.visProp.hasinnerpoints)?(r=p[0].coords,o=p[1].coords,n=this.majorAxis(),(a=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board)).distance(i.Z.COORDS_BY_USER,r)+a.distance(i.Z.COORDS_BY_USER,o)<=n):d.apply(this,arguments)},a.addChild(n),c=0;c<2;c++)s.Z.isPoint(p[c])&&p[c].addChild(n);return s.Z.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.Z.createHyperbola=function(t,e,r){var o,n,a,h,l,c,d=[],u=s.Z.copyAttributes(r,t.options,"conic","foci"),p=s.Z.copyAttributes(r,t.options,"conic","center"),f=s.Z.copyAttributes(r,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)d[c]=t.create("point",e[c],u);else if(s.Z.isPoint(e[c]))d[c]=t.select(e[c]);else if(s.Z.isFunction(e[c])&&s.Z.isPoint(e[c]()))d[c]=e[c]();else{if(!s.Z.isString(e[c]))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]");d[c]=t.select(e[c])}if(s.Z.isNumber(e[2]))l=s.Z.createFunction(e[2],t);else if(s.Z.isFunction(e[2])&&s.Z.isNumber(e[2]()))l=e[2];else{if(s.Z.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],u);else if(s.Z.isFunction(e[2])&&s.Z.isPoint(e[2]()))h=e[2]();else{if(!s.Z.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]");h=t.select(e[2])}l=function(){return h.Dist(d[0])-h.Dist(d[1])}}for(s.Z.exists(e[4])||(e[4]=1.0001*Math.PI),s.Z.exists(e[3])||(e[3]=-1.0001*Math.PI),a=t.create("point",[function(){return.5*(d[0].X()+d[1].X())},function(){return.5*(d[0].Y()+d[1].Y())}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],f)).majorAxis=l,o=function(t,e){var i,s,r,o,a,h,c,u,p;e||(s=(i=l())*i,r=d[0].X(),o=d[0].Y(),c=r-(a=d[1].X()),u=o-(h=d[1].Y()),p=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[p*p-a*a-h*h,p*c/i+a,p*u/i+h],[p*c/i+a,c*c/s-1,c*u/s],[p*u/i+h,c*u/s,u*u/s-1]])},n.X=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)+i),n=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return e||o(0,e),d[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)+i),o=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return d[0].Y()+Math.sin(o+t)*r},n.midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center,d[0],d[1]),s.Z.isPoint(h)&&n.inherits.push(h),n.type=i.Z.OBJECT_TYPE_CONIC,a.addChild(n),c=0;c<2;c++)s.Z.isPoint(d[c])&&d[c].addChild(n);return s.Z.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.Z.createParabola=function(t,e,r){var o,n,a,l,c=e[0],d=e[1],u=s.Z.copyAttributes(r,t.options,"conic","foci"),p=s.Z.copyAttributes(r,t.options,"conic","center"),f=s.Z.copyAttributes(r,t.options,"conic");if(e[0].length>1)c=t.create("point",e[0],u);else if(s.Z.isPoint(e[0]))c=t.select(e[0]);else if(s.Z.isFunction(e[0])&&s.Z.isPoint(e[0]()))c=e[0]();else{if(!s.Z.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]");c=t.select(e[0])}return s.Z.isArray(d)&&2===d.length&&(l=s.Z.copyAttributes(r,t.options,"conic","line"),d=t.create("line",d,l)),s.Z.exists(e[3])||(e[3]=2*Math.PI),s.Z.exists(e[2])||(e[2]=0),a=t.create("point",[function(){return h.Z.projectPointToLine(c,d,t).usrCoords}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],f)).midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center),o=function(t,e){var i,s,r,o,a,h;e||(i=d.stdform[1],s=d.stdform[2],r=d.stdform[0],o=i*i+s*s,a=c.X(),h=c.Y(),n.quadraticform=[[r*r-o*(a*a+h*h),r*i+o*a,r*s+o*h],[r*i+o*a,-s*s,i*s],[r*s+o*h,i*s,-i*i]])},n.X=function(t,e){var i,s=d.getAngle(),r=h.Z.distPointLine(c.coords.usrCoords,d.stdform),n=d.point1.coords.usrCoords,a=d.point2.coords.usrCoords,l=c.coords.usrCoords;return 0===n[0]?n=[1,a[1]+d.stdform[2],a[2]-d.stdform[1]]:0===a[0]&&(a=[1,n[1]+d.stdform[2],n[2]-d.stdform[1]]),i=((a[1]-n[1])*(l[2]-n[2])-(a[2]-n[2])*(l[1]-n[1])>=0?1:-1)*r/(1-Math.sin(t)),e||o(0,e),c.X()+Math.cos(t+s)*i},n.Y=function(t,e){var i,s=d.getAngle(),r=h.Z.distPointLine(c.coords.usrCoords,d.stdform),o=d.point1.coords.usrCoords,n=d.point2.coords.usrCoords,a=c.coords.usrCoords;return 0===o[0]?o=[1,n[1]+d.stdform[2],n[2]-d.stdform[1]]:0===n[0]&&(n=[1,o[1]+d.stdform[2],o[2]-d.stdform[1]]),i=((n[1]-o[1])*(a[2]-o[2])-(n[2]-o[2])*(a[1]-o[1])>=0?1:-1)*r/(1-Math.sin(t)),c.Y()+Math.sin(t+s)*i},n.type=i.Z.OBJECT_TYPE_CONIC,a.addChild(n),s.Z.isPoint(c)&&(c.addChild(n),n.inherits.push(c)),d.addChild(n),n.setParents(e),n},t.Z.createConic=function(t,e,r){var n,a,h,l,c,u,p,f,_,g,m,b,v,Z,C=[[1,0,0],[0,1,0],[0,0,1]],y=[[1,0,0],[0,1,0],[0,0,1]],P=[],E=[],O=s.Z.copyAttributes(r,t.options,"conic","point"),x=s.Z.copyAttributes(r,t.options,"conic","center"),w=s.Z.copyAttributes(r,t.options,"conic");if(5===e.length)Z=!0;else{if(6!==e.length)throw new Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");Z=!1}if(Z)for(b=0;b<5;b++)if(e[b].length>1)P[b]=t.create("point",e[b],O);else if(s.Z.isPoint(e[b]))P[b]=t.select(e[b]);else if(s.Z.isFunction(e[b])&&s.Z.isPoint(e[b]()))P[b]=e[b]();else{if(!s.Z.isString(e[b]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[b]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");P[b]=t.select(e[b])}else(v=[[0,0,0],[0,0,0],[0,0,0]])[0][0]=s.Z.isFunction(e[2])?function(){return e[2]()}:function(){return e[2]},v[0][1]=s.Z.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},v[0][2]=s.Z.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},v[1][1]=s.Z.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},v[1][2]=s.Z.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},v[2][2]=s.Z.isFunction(e[1])?function(){return e[1]()}:function(){return e[1]};if(c=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},l=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 c(r)},h=function(t,e,i){var s,r,n,a,h,l=[[0,0,0],[0,0,0],[0,0,0]];for(h=o.Z.matVecMult(e,i),n=o.Z.innerProduct(i,h),h=o.Z.matVecMult(t,i),a=o.Z.innerProduct(i,h),s=0;s<3;s++)for(r=0;r<3;r++)l[s][r]=n*t[s][r]-a*e[s][r];return l},a=t.create("curve",[function(t){return 0},function(t){return 0},0,2*Math.PI],w),n=function(t,e){var i,r,n;if(!e){if(Z){for(i=0;i<5;i++)E[i]=P[i].coords.usrCoords;g=l(o.Z.crossProduct(E[0],E[1]),o.Z.crossProduct(E[2],E[3])),m=l(o.Z.crossProduct(E[0],E[2]),o.Z.crossProduct(E[1],E[3])),y=h(g,m,E[4])}else for(i=0;i<3;i++)for(r=i;r<3;r++)y[i][r]=v[i][r](),r>i&&(y[r][i]=y[i][r]);a.quadraticform=y,(u=d.Z.Jacobi(y))[0][0][0]<0&&(u[0][0][0]*=-1,u[0][1][1]*=-1,u[0][2][2]*=-1),C=u[1],_=Math.sqrt(Math.abs(u[0][0][0])),p=Math.sqrt(Math.abs(u[0][1][1])),f=Math.sqrt(Math.abs(u[0][2][2]))}return u[0][1][1]<=0&&u[0][2][2]<=0?n=o.Z.matVecMult(C,[1/_,Math.cos(t)/p,Math.sin(t)/f]):u[0][1][1]<=0&&u[0][2][2]>0?n=o.Z.matVecMult(C,[Math.cos(t)/_,1/p,Math.sin(t)/f]):u[0][2][2]<0&&(n=o.Z.matVecMult(C,[Math.sin(t)/_,Math.cos(t)/p,1/f])),s.Z.exists(n)?(n[1]/=n[0],n[2]/=n[0],n[0]=1):n=[1,NaN,NaN],n},a.X=function(t,e){return n(t,e)[1]},a.Y=function(t,e){return n(t,e)[2]},a.midpoint=t.create("point",[function(){var t=a.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]]}],x),a.type=i.Z.OBJECT_TYPE_CONIC,a.center=a.midpoint,a.subs={center:a.center},a.inherits.push(a.center),a.inherits=a.inherits.concat(P),Z){for(b=0;b<5;b++)s.Z.isPoint(P[b])&&P[b].addChild(a);a.setParents(e)}return a.addChild(a.center),a},t.Z.registerElement("ellipse",t.Z.createEllipse),t.Z.registerElement("hyperbola",t.Z.createHyperbola),t.Z.registerElement("parabola",t.Z.createParabola),t.Z.registerElement("conic",t.Z.createConic),t.Z.Polygon=function(e,r,o){this.constructor(e,o,i.Z.OBJECT_TYPE_POLYGON,i.Z.OBJECT_CLASS_AREA);var n,a,h,l,c,d=s.Z.copyAttributes(o,e.options,"polygon","borders");for(this.withLines=o.withlines,this.attr_line=d,this.vertices=[],n=0;n<r.length;n++)this.vertices[n]=this.board.select(r[n]),this.vertices[n]._is_new&&(delete this.vertices[n]._is_new,this.vertices[n]._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(h=this.vertices.length-1,l=0;l<h;l++)n=(l+1)%h,d.id=d.ids&&d.ids[n],d.name=d.names&&d.names[n],d.strokecolor=s.Z.isArray(d.colors)&&d.colors[n%d.colors.length]||d.strokecolor,d.visible=s.Z.exists(o.borders.visible)?o.borders.visible:o.visible,!1===d.strokecolor&&(d.strokecolor="none"),(a=e.create("segment",[this.vertices[n],this.vertices[n+1]],d)).dump=!1,this.borders[n]=a,a.parentPolygon=this,this.addChild(a);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),n=0;n<this.vertices.length-1;n++)c=this.board.select(this.vertices[n]),s.Z.exists(c._is_new_pol)?(this.addChild(c),delete c._is_new_pol):c.addChild(this);this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="polygon",this.createLabel(),this.methodMap=t.Z.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"})},t.Z.Polygon.prototype=new H.Z,t.Z.extend(t.Z.Polygon.prototype,{pnpoly:function(t,e,i){return h.Z.pnpoly(t,e,this.vertices,i)},hasPoint:function(t,e){var i,r;if(s.Z.evaluate(this.visProp.hasinnerpoints)&&this.pnpoly(t,e))return!0;for(r=this.borders.length,i=0;i<r;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,s,r,o;if(0===this.vertices.length)return new u.Z(i.Z.COORDS_BY_USER,[1,0,0],this.board);for(s=t=this.vertices[0].X(),r=e=this.vertices[0].Y(),o=0;o<this.vertices.length;o++)this.vertices[o].X()<t&&(t=this.vertices[o].X()),this.vertices[o].X()>s&&(s=this.vertices[o].X()),this.vertices[o].Y()>e&&(e=this.vertices[o].Y()),this.vertices[o].Y()<r&&(r=this.vertices[o].Y());return new u.Z(i.Z.COORDS_BY_USER,[.5*(t+s),.5*(e+r)],this.board)},getLabelAnchor:t.Z.shortcut(t.Z.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var t,e={};return e.id=this.id+"T"+this.numTraces,this.numTraces++,e.vertices=this.vertices,e.visProp=s.Z.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,e.board=this.board,s.Z.clearVisPropOld(e),e.visPropCalc={visible:s.Z.evaluate(e.visProp.visible)},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(e){var i;if(t.Z.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),!e)for(i=0;i<this.borders.length;i++)this.borders[i].hideElement();this.hasLabel&&s.Z.exists(this.label)&&(this.label.hiddenByParent=!0,this.label.visPropCalc.visible&&this.label.hideElement())},showElement:function(e){var i;if(t.Z.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!0),!e)for(i=0;i<this.borders.length;i++)this.borders[i].showElement().updateRenderer();return s.Z.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(h.Z.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]);H.Z.prototype.remove.call(this)},findPoint:function(t){var e;if(!s.Z.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,r,o,n,a;if(0===arguments.length)return this;if(o=this.vertices.length-1,"polygon"===this.elType&&o--,t<-1||t>o)return this;for(r=arguments.length-1,i=1;i<r+1;i++)(a=s.Z.providePoints(this.board,[arguments[i]],{},"polygon",["vertices"])[0])._is_new&&(this.addChild(a),delete a._is_new),this.vertices.splice(t+i,0,a);if(this.withLines)for(n=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[n]:t>=0&&(t<this.borders.length?this.borders[t].point2=this.vertices[n]:n=t),i=n;i<n+r;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,r,o,n=[],a=[],h=[],l=[];for("polygon"===this.elType&&(o=this.vertices.pop()),e=0;e<arguments.length;e++)r=arguments[e],s.Z.isPoint(r)&&(r=this.findPoint(r)),s.Z.isNumber(r)&&r>-1&&r<this.vertices.length&&-1===s.Z.indexOf(h,r)&&h.push(r);if(0===h.length)return"polygon"===this.elType&&this.vertices.push(o),this;for(e=0;e<h.length;e++)this.vertices[h[e]].removeChild(this);for(h=h.sort(),n=this.vertices.slice(),a=this.borders.slice(),this.withLines&&l.push([h[h.length-1]]),e=h.length-1;e>-1;e--)n[h[e]]=-1,this.withLines&&h.length>1&&h[e]-1>h[e-1]&&(l[l.length-1][1]=h[e],l.push([h[e-1]]));for(this.withLines&&(l[l.length-1][1]=h[0]),this.vertices=[],e=0;e<n.length;e++)s.Z.isPoint(n[e])&&this.vertices.push(n[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<l.length;e++){for(i=l[e][1]-1;i<l[e][0]+1;i++)i<0?"polygon"===this.elType&&(this.board.removeObject(this.borders[a.length-1]),a[a.length-1]=-1):i<a.length&&(this.board.removeObject(this.borders[i]),a[i]=-1);0!==l[e][1]&&l[e][0]!==n.length-1&&(a[l[e][0]-1]=this.board.create("segment",[n[l[e][1]-1],n[l[e][0]+1]],this.attr_line))}for(this.borders=[],e=0;e<a.length;e++)-1!==a[e]&&this.borders.push(a[e]);"polygon"===this.elType&&this.vertices.length>2&&(l[0][1]===this.vertices.length-1||0===l[l.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=H.Z.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=!!s.Z.evaluate(this.visProp.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 u.Z(t,e,this.board),a=new u.Z(t,i,this.board);for(o=this.vertices.length-1,r=0;r<o;r++)if(!this.vertices[r].draggable())return this;return s=p.Z.subtract(n.usrCoords,a.usrCoords),this.board.create("transform",s.slice(1),{type:"translate"}).applyOnce(this.vertices.slice(0,-1)),this},sutherlandHodgman:function(e){var i,s,r,o,n,a,h,l=t.Z.Math.Geometry.sortVertices(this.vertices),c=t.Z.Math.Geometry.sortVertices(e.vertices),d=l.length-1,u=c.length-1,p=[],f=function(t,e,i){return(e[1]-t[1])*(i[2]-t[2])-(e[2]-t[2])*(i[1]-t[1])>=0};for(r=0;r<u;r++)p.push(c[r]);for(r=0;r<d;r++)for(s=p.slice(0),p=[],n=s[(i=s.length)-1],o=0;o<i;o++)a=s[o],f(l[r],l[r+1],a)?(f(l[r],l[r+1],n)||((h=t.Z.Math.Geometry.meetSegmentSegment(n,a,l[r],l[r+1]))[0][1]/=h[0][0],h[0][2]/=h[0][0],h[0][0]=1,p.push(h[0])),p.push(a)):f(l[r],l[r+1],n)&&((h=t.Z.Math.Geometry.meetSegmentSegment(n,a,l[r],l[r+1]))[0][1]/=h[0][0],h[0][2]/=h[0][0],h[0][0]=1,p.push(h[0])),n=a;return p},intersect:function(t){return this.sutherlandHodgman(t)}}),t.Z.createPolygon=function(e,r,o){var n,a,h,l,c,d,u=[],p=!1;if(s.Z.copyAttributes(o,e.options,"polygon"),null===(l=e.select(r[0]))&&(l=r[0]),s.Z.isObject(l)&&l.type===i.Z.OBJECT_TYPE_POLYGON&&s.Z.isTransformationOrArray(r[1]))for(p=!0,h=l.vertices.length-1,d=s.Z.copyAttributes(o,e.options,"polygon","vertices"),a=0;a<h;a++)d.withlabel&&(d.name=""===l.vertices[a].name?"":l.vertices[a].name+"'"),u.push(e.create("point",[l.vertices[a],r[1]],d));else if(!1===(u=s.Z.providePoints(e,r,o,"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(c=s.Z.copyAttributes(o,e.options,"polygon"),(n=new t.Z.Polygon(e,u,c)).isDraggable=!0,p)for(n.prepareUpdate().update().updateVisibility().updateRenderer(),h=l.vertices.length-1,a=0;a<h;a++)u[a].prepareUpdate().update().updateVisibility().updateRenderer();return n},t.Z.createRegularPolygon=function(t,e,r){var o,n,a,h,l,c,d,u=[];if(a=e[(l=e.length)-1],s.Z.isNumber(a)&&(3!==e.length||a<3))throw new Error("JSXGraph: A regular polygon needs two point types and a number > 2 as input.");if(s.Z.isNumber(t.select(a))?(l--,c=!1):(a=l,c=!0),!1===(u=s.Z.providePoints(t,e.slice(0,l),r,"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(d=s.Z.copyAttributes(r,t.options,"regularpolygon","vertices"),n=2;n<a;n++)h=t.create("transform",[Math.PI*(2-(a-2)/a),u[n-1]],{type:"rotate"}),c?(u[n].addTransform(u[n-2],h),u[n].fullUpdate()):(s.Z.isArray(d.ids)&&d.ids.length>=a-2&&(d.id=d.ids[n-2]),u[n]=t.create("point",[u[n-2],h],d),u[n].type=i.Z.OBJECT_TYPE_CAS,u[n].isDraggable=!0,u[n].visProp.fixed=!1);return d=s.Z.copyAttributes(r,t.options,"regularpolygon"),(o=t.create("polygon",u,d)).elType="regularpolygon",o},t.Z.createPolygonalChain=function(t,e,i){var r,o;return r=s.Z.copyAttributes(i,t.options,"polygonalchain"),(o=t.create("polygon",e,r)).elType="polygonalchain",o.vertices.pop(),t.removeObject(o.borders[o.borders.length-1]),o.borders.pop(),o},t.Z.createParallelogram=function(t,e,i){var r,o,n,a,h;if(!1===(n=s.Z.providePoints(t,e,i,"polygon",["vertices"]))||n.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 h=s.Z.copyAttributes(i,t.options,"parallelogram",["parallelpoint"]),o=t.create("parallelpoint",n,h),a=s.Z.copyAttributes(i,t.options,"parallelogram"),(r=t.create("polygon",[n[0],n[1],o,n[2]],a)).elType="parallelogram",r.parallelPoint=o,r.isDraggable=!0,o.isDraggable=!0,o.visProp.fixed=!1,r},t.Z.registerElement("polygon",t.Z.createPolygon),t.Z.registerElement("regularpolygon",t.Z.createRegularPolygon),t.Z.registerElement("polygonalchain",t.Z.createPolygonalChain),t.Z.registerElement("parallelogram",t.Z.createParallelogram);var q=t.Z.Polygon;t.Z.Curve=function(t,e,r){this.constructor(t,r,i.Z.OBJECT_TYPE_CURVE,i.Z.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=s.Z.evaluate(this.visProp.numberpointshigh),this.bezierDegree=1,this.dataX=null,this.dataY=null,this.ticks=[],this.qdt=null,s.Z.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(),s.Z.isString(this.xterm)&&this.notifyParents(this.xterm),s.Z.isString(this.yterm)&&this.notifyParents(this.yterm),this.methodMap=s.Z.deepCopy(this.methodMap,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"})},t.Z.Curve.prototype=new H.Z,t.Z.extend(t.Z.Curve.prototype,{minX:function(){return"polar"===s.Z.evaluate(this.visProp.curvetype)?0:new u.Z(i.Z.COORDS_BY_SCREEN,[.1*-this.board.canvasWidth,0],this.board,!1).usrCoords[1]},maxX:function(){return"polar"===s.Z.evaluate(this.visProp.curvetype)?2*Math.PI:new u.Z(i.Z.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},hasPoint:function(t,e,r){var n,a,l,c,d,p,f,_,g,m,b,v,Z,C,y,P,E=[],O=s.Z.evaluate(this.visProp.numberpointslow),x=(this.maxX()-this.minX())/O,w=1/0;if(s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(v=this.board._inputDevice,b=s.Z.evaluate(this.visProp.precision[v])):b=this.board.options.precision.hasPoint,t=(p=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=p.usrCoords[2],1===this.bezierDegree&&s.Z.evaluate(this.visProp.hasinnerpoints)&&0!==h.Z.windingNumber([1,t,e],this.points,!0))return!0;if(b+=.5*s.Z.evaluate(this.visProp.strokewidth),b*=b,Z=this.board.unitX*this.board.unitX,C=this.board.unitY*this.board.unitY,P=this.minX(),this.maxX(),s.Z.exists(this._visibleArea)&&(P=this._visibleArea[0],x=(this._visibleArea[1]-P)/O),"parameter"===(y=s.Z.evaluate(this.visProp.curvetype))||"polar"===y)for(this.transformations.length>0&&(this.updateTransformMatrix(),_=o.Z.inverse(this.transformMat),t=(a=o.Z.matVecMult(_,[1,t,e]))[1],e=a[2]),l=0,n=P;l<O;l++){if((w=(t-(c=this.X(n,true)))*(t-c)*Z+(e-(d=this.Y(n,true)))*(e-d)*C)<=b)return!0;n+=x}else if("plot"===y||"functiongraph"===y){for((!s.Z.exists(r)||r<0)&&(r=0),s.Z.exists(this.qdt)&&s.Z.evaluate(this.visProp.useqdt)&&3!==this.bezierDegree?f=(g=(m=this.qdt.query(new u.Z(i.Z.COORDS_BY_USER,[t,e],this.board))).points).length:(g=this.points,f=this.numberPoints-1),l=r;l<f;l++)if(3===this.bezierDegree?E=h.Z.projectCoordsToBeziersegment([1,t,e],this,l):m?(g[l].prev&&(E=h.Z.projectCoordsToSegment([1,t,e],g[l].prev.usrCoords,g[l].usrCoords)),g[l].next&&g[l+1]!==g[l].next&&(E=h.Z.projectCoordsToSegment([1,t,e],g[l].usrCoords,g[l].next.usrCoords))):E=h.Z.projectCoordsToSegment([1,t,e],g[l].usrCoords,g[l+1].usrCoords),E[1]>=0&&E[1]<=1&&(t-E[0][1])*(t-E[0][1])*Z+(e-E[0][2])*(e-E[0][2])*C<=b)return!0;return!1}return w<b},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 u.Z(i.Z.COORDS_BY_USER,[0,0],this.board,!1)},update:function(){return this.needsUpdate&&(s.Z.evaluate(this.visProp.trace)&&this.cloneToBackground(!0),this.updateCurve()),this},updateRenderer:function(){return this.needsUpdate?(this.visPropCalc.visible&&(this.isReal=f.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,r,o,n,a,h=this.visProp.plotversion,c=!1;if(this.updateTransformMatrix(),this.updateDataArray(),r=this.minX(),o=this.maxX(),s.Z.exists(this.dataX))for(this.numberPoints=this.dataX.length,e=this.numberPoints,this.allocatePoints(),t=0;t<e;t++)n=t,s.Z.exists(this.dataY)?(a=t,this.points[t].setCoordinates(i.Z.COORDS_BY_USER,[this.dataX[t],this.dataY[t]],!1)):(a=this.X(n),this.points[t].setCoordinates(i.Z.COORDS_BY_USER,[this.dataX[t],this.Y(a,c)],!1)),this.points[t]._t=t,c=!0;else if(s.Z.evaluate(this.visProp.doadvancedplot)?1===h||s.Z.evaluate(this.visProp.doadvancedplotold)?f.updateParametricCurveOld(this,r,o):2===h?f.updateParametricCurve_v2(this,r,o):3===h?f.updateParametricCurve_v3(this,r,o):4===h?f.updateParametricCurve_v4(this,r,o):f.updateParametricCurve_v2(this,r,o):(this.board.updateQuality===this.board.BOARD_QUALITY_HIGH?this.numberPoints=s.Z.evaluate(this.visProp.numberpointshigh):this.numberPoints=s.Z.evaluate(this.visProp.numberpointslow),this.allocatePoints(),f.updateParametricCurveNaive(this,r,o,this.numberPoints)),e=this.numberPoints,s.Z.evaluate(this.visProp.useqdt)&&this.board.updateQuality===this.board.BOARD_QUALITY_HIGH)for(this.qdt=new l(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"!==s.Z.evaluate(this.visProp.curvetype)&&s.Z.evaluate(this.visProp.rdpsmoothing)&&(this.points=d.Z.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=o.Z.matMatMult(t.matrix,this.transformMat);return this},updateTransform:function(t){var e;return this.transformations.length>0&&(e=o.Z.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(i.Z.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){var e,i=s.Z.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.transformations.push(i[e]);return this},interpolationFunctionFromArray:function(t){var e="data"+t,i=this;return function(t,r){var o,n,a,h,l=i[e],c=l.length,d=[];if(isNaN(t))return NaN;if(t<0)return s.Z.isFunction(l[0])?l[0]():l[0];if(3===i.bezierDegree){if(t>=(c-1)/3)return s.Z.isFunction(l[l.length-1])?l[l.length-1]():l[l.length-1];for(o=3*Math.floor(t),h=1-(a=t%1),n=0;n<4;n++)s.Z.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return h*h*(h*d[0]+3*a*d[1])+(3*h*d[2]+a*d[3])*a*a}if((o=t>c-2?c-2:parseInt(Math.floor(t),10))===t)return s.Z.isFunction(l[o])?l[o]():l[o];for(n=0;n<2;n++)s.Z.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return d[0]+(d[1]-d[0])*(t-o)}},generateTerm:function(t,e,i,r,o){var n,a;s.Z.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=s.Z.createFunction(e,this.board,t),s.Z.isString(e)?this.visProp.curvetype="functiongraph":(s.Z.isFunction(e)||s.Z.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),s.Z.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):this.Y=s.Z.createFunction(i,this.board,t),s.Z.isFunction(e)&&s.Z.isArray(i)&&(n=s.Z.createFunction(i[0],this.board,""),a=s.Z.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+n()},this.X.deps=n.deps,this.Y=function(t){return e(t)*Math.sin(t)+a()},this.Y.deps=a.deps,this.visProp.curvetype="polar"),s.Z.exists(r)?this.minX=s.Z.createFunction(r,this.board,""):delete this.minX,s.Z.exists(o)?this.maxX=s.Z.createFunction(o,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||B.Z.findDependencies(this,t,this.board)},getLabelAnchor:function(){var t,e,r,o=.05*this.board.canvasWidth,n=.05*this.board.canvasHeight,a=.95*this.board.canvasWidth,l=.95*this.board.canvasHeight;switch(s.Z.evaluate(this.visProp.label.position)){case"ulft":e=o,r=n;break;case"llft":e=o,r=l;break;case"rt":e=a,r=.5*l;break;case"lrt":e=a,r=l;break;case"urt":e=a,r=n;break;case"top":e=.5*a,r=n;break;case"bot":e=.5*a,r=l;break;default:e=o,r=.5*l}return t=new u.Z(i.Z.COORDS_BY_SCREEN,[e,r],this.board,!1),h.Z.projectCoordsToCurve(t.usrCoords[1],t.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,e={id:this.id+"T"+this.numTraces,elementClass:i.Z.OBJECT_CLASS_CURVE,points:this.points.slice(0),bezierDegree:this.bezierDegree,numberPoints:this.numberPoints,board:this.board,visProp:s.Z.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return e.visProp.layer=this.board.options.layer.trace,e.visProp.curvetype=this.visProp.curvetype,this.numTraces++,s.Z.clearVisPropOld(e),e.visPropCalc={visible:s.Z.evaluate(e.visProp.visible)},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,r=1/0,o=-1/0,n=1/0,a=-1/0,h=this.points.length;if(3===this.bezierDegree){for(t=0;t<h;t++)this.points[t].X=s.Z.bind((function(){return this.usrCoords[1]}),this.points[t]),this.points[t].Y=s.Z.bind((function(){return this.usrCoords[2]}),this.points[t]);return i=(e=d.Z.bezier(this.points))[3](),r=d.Z.fminbr((function(t){return e[0](t)}),[0,i]),o=d.Z.fminbr((function(t){return-e[0](t)}),[0,i]),n=d.Z.fminbr((function(t){return e[1](t)}),[0,i]),a=d.Z.fminbr((function(t){return-e[1](t)}),[0,i]),r=e[0](r),o=e[0](o),n=e[1](n),[r,a=e[1](a),o,n]}for(t=0;t<h;t++)r>this.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),o<this.points[t].usrCoords[1]&&(o=this.points[t].usrCoords[1]),n>this.points[t].usrCoords[2]&&(n=this.points[t].usrCoords[2]),a<this.points[t].usrCoords[2]&&(a=this.points[t].usrCoords[2]);return[r,a,o,n]},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,r=[];return this.points.length>0&&!s.Z.evaluate(this.visProp.fixed)&&(e=this.points[0],r=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(i.Z.COORDS_BY_USER,r)),this},getTransformationSource:function(){var t,e;return s.Z.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===i.Z.OBJECT_CLASS_CURVE&&(t=!0),[t,e]}}),t.Z.createCurve=function(e,r,o){var n,a,h=s.Z.copyAttributes(o,e.options,"curve");return n=e.select(r[0],!0),s.Z.isTransformationOrArray(r[1])&&s.Z.isObject(n)&&(n.type===i.Z.OBJECT_TYPE_CURVE||n.type===i.Z.OBJECT_TYPE_ANGLE||n.type===i.Z.OBJECT_TYPE_ARC||n.type===i.Z.OBJECT_TYPE_CONIC||n.type===i.Z.OBJECT_TYPE_SECTOR)?(n.type===i.Z.OBJECT_TYPE_SECTOR?h=s.Z.copyAttributes(o,e.options,"sector"):n.type===i.Z.OBJECT_TYPE_ARC?h=s.Z.copyAttributes(o,e.options,"arc"):n.type===i.Z.OBJECT_TYPE_ANGLE?(s.Z.exists(o.withLabel)||(o.withLabel=!1),h=s.Z.copyAttributes(o,e.options,"angle")):h=s.Z.copyAttributes(o,e.options,"curve"),h=s.Z.copyAttributes(h,e.options,"curve"),(a=new t.Z.Curve(e,["x",[],[]],h)).updateDataArray=function(){var t,e=n.numberPoints;for(this.bezierDegree=n.bezierDegree,this.dataX=[],this.dataY=[],t=0;t<e;t++)this.dataX.push(n.points[t].usrCoords[1]),this.dataY.push(n.points[t].usrCoords[2]);return this},a.addTransform(r[1]),n.addChild(a),a.setParents([n]),a._transformationSource=n,a):(h=s.Z.copyAttributes(o,e.options,"curve"),new t.Z.Curve(e,["x"].concat(r),h))},t.Z.registerElement("curve",t.Z.createCurve),t.Z.createFunctiongraph=function(e,i,r){var o,n=["x","x"].concat(i);return o=s.Z.copyAttributes(r,e.options,"functiongraph"),(o=s.Z.copyAttributes(o,e.options,"curve")).curvetype="functiongraph",new t.Z.Curve(e,n,o)},t.Z.registerElement("functiongraph",t.Z.createFunctiongraph),t.Z.registerElement("plot",t.Z.createFunctiongraph),t.Z.createSpline=function(e,i,r){var o,n,a;return n=function(){var t,e=[],r=[];return[function(o,n){var a,h,l;if(!n){if(e=[],r=[],2===i.length&&s.Z.isArray(i[0])&&s.Z.isArray(i[1])&&i[0].length===i[1].length)for(a=0;a<i[0].length;a++)s.Z.isFunction(i[0][a])?e.push(i[0][a]()):e.push(i[0][a]),s.Z.isFunction(i[1][a])?r.push(i[1][a]()):r.push(i[1][a]);else for(a=0;a<i.length;a++)if(s.Z.isPoint(i[a]))e.push(i[a].X()),r.push(i[a].Y());else if(s.Z.isArray(i[a])&&2===i[a].length)for(h=0;h<i.length;h++)s.Z.isFunction(i[h][0])?e.push(i[h][0]()):e.push(i[h][0]),s.Z.isFunction(i[h][1])?r.push(i[h][1]()):r.push(i[h][1]);else s.Z.isFunction(i[a])&&2===i[a]().length&&(l=i[a](),e.push(l[0]),r.push(l[1]));t=d.Z.splineDef(e,r)}return d.Z.splineEval(o,e,r,t)},function(){return e[0]},function(){return e[e.length-1]}]},(r=s.Z.copyAttributes(r,e.options,"curve")).curvetype="functiongraph",a=n(),(o=new t.Z.Curve(e,["x","x",a[0],a[1],a[2]],r)).setParents(i),o.elType="spline",o},t.Z.registerElement("spline",t.Z.createSpline),t.Z.createCardinalSpline=function(e,i,r){var n,a,h,l,c,u,p,f,_,g,m="\nPossible parent types: [points:array, tau:number|function, type:string]";if(!s.Z.exists(i[0])||!s.Z.isArray(i[0]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 1 'points' has to be array of points or coordinate pairs"+m);if(!s.Z.exists(i[1])||!s.Z.isNumber(i[1])&&!s.Z.isFunction(i[1]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 2 'tau' has to be number between [0,1] or function'"+m);if(!s.Z.exists(i[2])||!s.Z.isString(i[2]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 3 'type' has to be string 'uniform' or 'centripetal'"+m);if(r=s.Z.copyAttributes(r,e.options,"curve"),(r=s.Z.copyAttributes(r,e.options,"cardinalspline")).curvetype="parameter",u=i[0],p=[],!r.isarrayofcoordinates&&2===u.length&&s.Z.isArray(u[0])&&s.Z.isArray(u[1])&&u[0].length===u[1].length)for(f=0;f<u[0].length;f++)p[f]=[],s.Z.isFunction(u[0][f])?p[f].push(u[0][f]()):p[f].push(u[0][f]),s.Z.isFunction(u[1][f])?p[f].push(u[1][f]()):p[f].push(u[1][f]);else for(f=0;f<u.length;f++)s.Z.isString(u[f])?p.push(e.select(u[f])):s.Z.isPoint(u[f])?p.push(u[f]):s.Z.isArray(u[f])&&2===u[f].length?(p[f]=[],s.Z.isFunction(u[f][0])?p[f].push(u[f][0]()):p[f].push(u[f][0]),s.Z.isFunction(u[f][1])?p[f].push(u[f][1]()):p[f].push(u[f][1])):s.Z.isFunction(u[f])&&2===u[f]().length&&p.push(i[f]());if(!0===r.createpoints)h=s.Z.providePoints(e,p,r,"cardinalspline",["points"]);else for(h=[],a=function(t){return{X:function(){return p[t][0]},Y:function(){return p[t][1]},Dist:function(t){var e=this.X()-t.X(),i=this.Y()-t.Y();return o.Z.hypot(e,i)}}},f=0;f<p.length;f++)s.Z.isPoint(p[f])?h.push(p[f]):h.push(a(f));for(l=i[1],c=i[2],g=["x"].concat(d.Z.CardinalSpline(h,l,c)),n=new t.Z.Curve(e,g,r),_=h.length,n.setParents(h),f=0;f<_;f++)u=h[f],s.Z.isPoint(u)&&(s.Z.exists(u._is_new)?(n.addChild(u),delete u._is_new):u.addChild(n));return n.elType="cardinalspline",n},t.Z.registerElement("cardinalspline",t.Z.createCardinalSpline),t.Z.createMetapostSpline=function(e,i,r){var o,n,a,h,l,c,d,u,p="\nPossible parent types: [points:array, controls:object";if(!s.Z.exists(i[0])||!s.Z.isArray(i[0]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 1 'points' has to be array of points or coordinate pairs"+p);if(!s.Z.exists(i[1])||!s.Z.isObject(i[1]))throw new Error("JSXGraph: JXG.createMetapostSpline: argument 2 'controls' has to be a JavaScript object'"+p);if(r=s.Z.copyAttributes(r,e.options,"curve"),(r=s.Z.copyAttributes(r,e.options,"metapostspline")).curvetype="parameter",l=i[0],c=[],!r.isarrayofcoordinates&&2===l.length&&s.Z.isArray(l[0])&&s.Z.isArray(l[1])&&l[0].length===l[1].length)for(d=0;d<l[0].length;d++)c[d]=[],s.Z.isFunction(l[0][d])?c[d].push(l[0][d]()):c[d].push(l[0][d]),s.Z.isFunction(l[1][d])?c[d].push(l[1][d]()):c[d].push(l[1][d]);else for(d=0;d<l.length;d++)s.Z.isString(l[d])?c.push(e.select(l[d])):s.Z.isPoint(l[d])?c.push(l[d]):s.Z.isArray(l[d])&&2===l[d].length?(c[d]=[],s.Z.isFunction(l[d][0])?c[d].push(l[d][0]()):c[d].push(l[d][0]),s.Z.isFunction(l[d][1])?c[d].push(l[d][1]()):c[d].push(l[d][1])):s.Z.isFunction(l[d])&&2===l[d]().length&&c.push(i[d]());if(!0===r.createpoints)a=s.Z.providePoints(e,c,r,"metapostspline",["points"]);else for(a=[],n=function(t){return{X:function(){return c[t][0]},Y:function(){return c[t][1]}}},d=0;d<c.length;d++)s.Z.isPoint(c[d])?a.push(c[d]):a.push(n);for(h=i[1],(o=new t.Z.Curve(e,["t",[],[],0,l.length-1],r)).updateDataArray=function(){var t,e,i=a.length,s=[];for(e=0;e<i;e++)s.push([a[e].X(),a[e].Y()]);t=g.curve(s,h),this.dataX=t[0],this.dataY=t[1]},o.bezierDegree=3,u=a.length,o.setParents(a),d=0;d<u;d++)s.Z.isPoint(a[d])&&a[d].addChild(o);return o.elType="metapostspline",o},t.Z.registerElement("metapostspline",t.Z.createMetapostSpline),t.Z.createRiemannsum=function(t,e,i){var r,o,n,a,h,l;if((l=s.Z.copyAttributes(i,t.options,"riemannsum")).curvetype="plot",n=e[0],r=s.Z.createFunction(e[1],t,""),!s.Z.exists(r))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(o=s.Z.createFunction(e[2],t,""),!s.Z.exists(o))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 a=[[0],[0]].concat(e.slice(3)),(h=t.create("curve",a,l)).sum=0,h.Value=function(){return this.sum},h.updateDataArray=function(){var t=d.Z.riemann(n,r(),o(),this.minX(),this.maxX());this.dataX=t[0],this.dataY=t[1],this.sum=t[2]},h.addParentsFromJCFunctions([r,o]),h},t.Z.registerElement("riemannsum",t.Z.createRiemannsum),t.Z.createTracecurve=function(t,e,r){var o,n,a,h;if(2!==e.length)throw new Error("JSXGraph: Can't create trace curve with given parent'\nPossible parent types: [glider, point]");if(n=t.select(e[0]),a=t.select(e[1]),n.type!==i.Z.OBJECT_TYPE_GLIDER||!s.Z.isPoint(a))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(h=s.Z.copyAttributes(r,t.options,"tracecurve")).curvetype="plot",(o=t.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,s,r,o,l,c,d,u,p=h.numberpoints,f=n.position,_=n.slideObject,g=_.minX();for(e=(_.maxX()-g)/p,this.dataX=[],this.dataY=[],_.elementClass!==i.Z.OBJECT_CLASS_CURVE&&p++,t=0;t<p;t++){for(r in s=g+t*e,l=_.X(s)/_.Z(s),c=_.Y(s)/_.Z(s),n.setPositionDirectly(i.Z.COORDS_BY_USER,[l,c]),d=!1,this.board.objects)if(this.board.objects.hasOwnProperty(r)&&((o=this.board.objects[r])===n&&(d=!0),d&&o.needsRegularUpdate&&(u=o.visProp.trace,o.visProp.trace=!1,o.needsUpdate=!0,o.update(!0),o.visProp.trace=u,o===a)))break;this.dataX[t]=a.X(),this.dataY[t]=a.Y()}for(r in n.position=f,d=!1,this.board.objects)if(this.board.objects.hasOwnProperty(r)&&((o=this.board.objects[r])===n&&(d=!0),d&&o.needsRegularUpdate&&(u=o.visProp.trace,o.visProp.trace=!1,o.needsUpdate=!0,o.update(!0),o.visProp.trace=u,o===a)))break},o},t.Z.registerElement("tracecurve",t.Z.createTracecurve),t.Z.createStepfunction=function(t,e,i){var r,o;if(2!==e.length)throw new Error("JSXGraph: Can't create step function with given parent'\nPossible parent types: [array, array|function]");return o=s.Z.copyAttributes(i,t.options,"stepfunction"),(r=t.create("curve",e,o)).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},r},t.Z.registerElement("stepfunction",t.Z.createStepfunction),t.Z.createDerivative=function(t,e,r){var o,n,a,h,l;if(1!==e.length&&e[0].class!==i.Z.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create derivative curve with given parent'\nPossible parent types: [curve]");return l=s.Z.copyAttributes(r,t.options,"curve"),n=e[0],a=d.Z.D(n.X),h=d.Z.D(n.Y),(o=t.create("curve",[function(t){return n.X(t)},function(t){return h(t)/a(t)},n.minX(),n.maxX()],l)).setParents(n),o},t.Z.registerElement("derivative",t.Z.createDerivative),t.Z.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=A.intersection(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},t.Z.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=A.union(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},t.Z.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=A.difference(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},s},t.Z.registerElement("curvedifference",t.Z.createCurveDifference),t.Z.registerElement("curveintersection",t.Z.createCurveIntersection),t.Z.registerElement("curveunion",t.Z.createCurveUnion),t.Z.createBoxPlot=function(t,e,i){var r,o,n,a=s.Z.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(r=t.create("curve",[[],[]],a),n=e[0].length,r.Q=[],o=0;o<n;o++)r.Q[o]=s.Z.createFunction(e[0][o],t);return r.x=s.Z.createFunction(e[1],t),r.w=s.Z.createFunction(e[2],t),r.updateDataArray=function(){var t,e,i,r,o,n,a,h,l;a=s.Z.evaluate(this.visProp.smallwidth),h=s.Z.evaluate(this.visProp.dir),i=(l=this.x())-.5*this.w(),r=l-.5*this.w()*a,o=l+.5*this.w(),t=[l,r,n=l+.5*this.w()*a,l,l,i,i,o,o,l,NaN,i,o,NaN,l,l,r,n,l],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"===h?(this.dataX=t,this.dataY=e):(this.dataX=e,this.dataY=t)},r.addParentsFromJCFunctions([r.Q,r.x,r.w]),r},t.Z.registerElement("boxplot",t.Z.createBoxPlot),t.Z.createImplicitCurve=function(t,e,i){var r,o;if(1!==e.length&&3!==e.length)throw new Error("JSXGraph: Can't create curve implicitCurve with given parent'\nPossible parent types: [f] or [f, dfx, dfy]\nwith functions f, dfx, dfy");return o=s.Z.copyAttributes(i,t.options,"implicitcurve"),(r=t.create("curve",[[],[]],o)).f=s.Z.createFunction(e[0],t,"x, y"),r.dfx=s.Z.createFunction(e[1],t,"x, y"),r.dfy=s.Z.createFunction(e[2],t,"x, y"),r.updateDataArray=function(){var t,e,i,r=this.board.getBoundingBox(),o=s.Z.evaluate(this.visProp.margin);r[0]-=o,r[1]+=o,r[2]+=o,r[3]-=o,e={resolution_out:Math.max(.01,s.Z.evaluate(this.visProp.resolution_outer)),resolution_in:Math.max(.01,s.Z.evaluate(this.visProp.resolution_inner)),max_steps:s.Z.evaluate(this.visProp.max_steps),alpha_0:s.Z.evaluate(this.visProp.alpha_0),tol_u0:s.Z.evaluate(this.visProp.tol_u0),tol_newton:s.Z.evaluate(this.visProp.tol_newton),tol_cusp:s.Z.evaluate(this.visProp.tol_cusp),tol_progress:s.Z.evaluate(this.visProp.tol_progress),qdt_box:s.Z.evaluate(this.visProp.qdt_box),kappa_0:s.Z.evaluate(this.visProp.kappa_0),delta_0:s.Z.evaluate(this.visProp.delta_0),h_initial:s.Z.evaluate(this.visProp.h_initial),h_critical:s.Z.evaluate(this.visProp.h_critical),h_max:s.Z.evaluate(this.visProp.h_max),loop_dist:s.Z.evaluate(this.visProp.loop_dist),loop_dir:s.Z.evaluate(this.visProp.loop_dir),loop_detection:s.Z.evaluate(this.visProp.loop_detection),unitX:this.board.unitX,unitY:this.board.unitY},this.dataX=[],this.dataY=[],t=new _(r,e,this.f,this.dfx,this.dfy),this.qdt=t.qdt,i=t.plot(),this.dataX=i[0],this.dataY=i[1]},r.elType="implicitcurve",r},t.Z.registerElement("implicitcurve",t.Z.createImplicitCurve);t.Z.Curve;t.Z.createArc=function(e,r,n){var a,l,c;if(!1===(c=s.Z.providePoints(e,r,n,"arc",["center","radiuspoint","anglepoint"]))||c.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return l=s.Z.copyAttributes(n,e.options,"arc"),(a=e.create("curve",[[0],[0]],l)).elType="arc",a.setParents(c),a.type=i.Z.OBJECT_TYPE_ARC,a.center=c[0],a.radiuspoint=c[1],a.point2=a.radiuspoint,a.anglepoint=c[2],a.point3=a.anglepoint,s.Z.exists(a.center._is_new)?(a.addChild(a.center),delete a.center._is_new):a.center.addChild(a),s.Z.exists(a.radiuspoint._is_new)?(a.addChild(a.radiuspoint),delete a.radiuspoint._is_new):a.radiuspoint.addChild(a),s.Z.exists(a.anglepoint._is_new)?(a.addChild(a.anglepoint),delete a.anglepoint._is_new):a.anglepoint.addChild(a),a.useDirection=l.usedirection,a.updateDataArray=function(){var t,e,i,r,o,n=1,a=this.radiuspoint,l=this.center,d=this.anglepoint,u=s.Z.evaluate(this.visProp.selection);e=h.Z.rad(a,l,d),("minor"===u&&e>Math.PI||"major"===u&&e<Math.PI)&&(n=-1),this.useDirection&&(i=c[1].coords.usrCoords,r=c[3].coords.usrCoords,o=c[2].coords.usrCoords,(i[1]-o[1])*(i[2]-r[2])-(i[2]-o[2])*(i[1]-r[1])<0?(this.radiuspoint=c[1],this.anglepoint=c[2]):(this.radiuspoint=c[2],this.anglepoint=c[1])),a=a.coords.usrCoords,l=l.coords.usrCoords,d=d.coords.usrCoords,t=h.Z.bezierArc(a,l,d,!1,n),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},a.Radius=function(){return this.radiuspoint.Dist(this.center)},a.getRadius=function(){return t.Z.deprecated("Arc.getRadius()","Arc.Radius()"),this.Radius()},a.Value=function(t,e){var i;return e=e||h.Z.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},a.L=function(){return this.Value("length")},a.hasPoint=function(t,e){var r,n,a,l,c,d,p,f=this.Radius();return s.Z.evaluate(this.visProp.hasinnerpoints)?this.hasPointSector(t,e):(s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(p=this.board._inputDevice,d=s.Z.evaluate(this.visProp.precision[p])):d=this.board.options.precision.hasPoint,d/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),n=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board),this.transformations.length>0&&(this.updateTransformMatrix(),l=o.Z.inverse(this.transformMat),c=o.Z.matVecMult(l,n.usrCoords),n=new u.Z(i.Z.COORDS_BY_USER,c,this.board)),r=this.center.coords.distance(i.Z.COORDS_BY_USER,n),(a=Math.abs(r-f)<d)&&(a=h.Z.coordsOnArc(this,n)),a)},a.hasPointSector=function(t,e){var s=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board),r=this.Radius(),o=this.center.coords.distance(i.Z.COORDS_BY_USER,s)<r;return o&&(o=h.Z.coordsOnArc(this,s)),o},a.getTextAnchor=function(){return this.center.coords},a.getLabelAnchor=function(){var t,e,r,n,a,l=h.Z.rad(this.radiuspoint,this.center,this.anglepoint),c=10/this.board.unitX,d=10/this.board.unitY,p=this.point2.coords.usrCoords,f=this.center.coords.usrCoords,_=p[1]-f[1],g=p[2]-f[2],m=s.Z.evaluate(this.visProp.selection),b=this.label?this.label.visProp:this.visProp.label;return("minor"===m&&l>Math.PI||"major"===m&&l<Math.PI)&&(l=-(2*Math.PI-l)),r=(t=new u.Z(i.Z.COORDS_BY_USER,[f[1]+Math.cos(.5*l)*_-Math.sin(.5*l)*g,f[2]+Math.sin(.5*l)*_+Math.cos(.5*l)*g],this.board)).usrCoords[1]-f[1],n=t.usrCoords[2]-f[2],r=r*((a=o.Z.hypot(r,n))+c)/a,n=n*(a+d)/a,e=[f[1]+r,f[2]+n],b.position=h.Z.calcLabelQuadrant(h.Z.rad([1,0],[0,0],e)),new u.Z(i.Z.COORDS_BY_USER,e,this.board)},a.updateQuadraticform=K.prototype.updateQuadraticform,a.updateStdform=K.prototype.updateStdform,a.methodMap=t.Z.deepCopy(a.methodMap,{getRadius:"getRadius",radius:"Radius",Radius:"Radius",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint",Value:"Value",L:"L"}),a.prepareUpdate().update(),a},t.Z.registerElement("arc",t.Z.createArc),t.Z.createSemicircle=function(t,e,i){var r,o,n,a;if(!1===(a=s.Z.providePoints(t,e,i,"point"))||2!==a.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 n=s.Z.copyAttributes(i,t.options,"semicircle","center"),(o=t.create("midpoint",a,n)).dump=!1,n=s.Z.copyAttributes(i,t.options,"semicircle"),(r=t.create("arc",[o,a[1],a[0]],n)).elType="semicircle",r.setParents([a[0].id,a[1].id]),r.subs={midpoint:o},r.inherits.push(o),r.midpoint=r.center=o,r},t.Z.registerElement("semicircle",t.Z.createSemicircle),t.Z.createCircumcircleArc=function(t,e,i){var r,o,n,a;if(!1===(a=s.Z.providePoints(t,e,i,"point"))||3!==a.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 n=s.Z.copyAttributes(i,t.options,"circumcirclearc","center"),(o=t.create("circumcenter",a,n)).dump=!1,(n=s.Z.copyAttributes(i,t.options,"circumcirclearc")).usedirection=!0,(r=t.create("arc",[o,a[0],a[2],a[1]],n)).elType="circumcirclearc",r.setParents([a[0].id,a[1].id,a[2].id]),r.subs={center:o},r.inherits.push(o),r.center=o,r},t.Z.registerElement("circumcirclearc",t.Z.createCircumcircleArc),t.Z.createMinorArc=function(e,i,s){return s.selection="minor",t.Z.createArc(e,i,s)},t.Z.registerElement("minorarc",t.Z.createMinorArc),t.Z.createMajorArc=function(e,i,s){return s.selection="major",t.Z.createArc(e,i,s)},t.Z.registerElement("majorarc",t.Z.createMajorArc),t.Z.createSector=function(e,r,n){var a,l,c,d,f,_,g="invalid";if(r[0].elementClass===i.Z.OBJECT_CLASS_LINE&&r[1].elementClass===i.Z.OBJECT_CLASS_LINE&&(s.Z.isArray(r[2])||s.Z.isNumber(r[2]))&&(s.Z.isArray(r[3])||s.Z.isNumber(r[3]))&&(s.Z.isNumber(r[4])||s.Z.isFunction(r[4])||s.Z.isString(r[4])))g="2lines";else{if(!1===(_=s.Z.providePoints(e,r,n,"sector",["center","radiusPoint","anglePoint"])))throw new Error("JSXGraph: Can't create Sector with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"' and '"+typeof r[2]+"'.");g="3points"}if(l=s.Z.copyAttributes(n,e.options,"sector"),(a=e.create("curve",[[0],[0]],l)).type=i.Z.OBJECT_TYPE_SECTOR,a.elType="sector",a.autoRadius=function(){var t=20/a.board.unitX,e=1/0,i=50/a.board.unitX;return s.Z.isPoint(a.center)&&(e=.3333*a.center.Dist(a.point2)),Math.max(t,Math.min(e,i))},"2lines"===g)a.Radius=function(){var t=s.Z.evaluate(r[4]);return"auto"===t?this.autoRadius():t},a.line1=e.select(r[0]),a.line2=e.select(r[1]),a.line1.addChild(a),a.line2.addChild(a),a.setParents(r),a.point1={visProp:{}},a.point2={visProp:{}},a.point3={visProp:{}},d=h.Z.meetLineLine(a.line1.stdform,a.line2.stdform,0,e),s.Z.isArray(r[2])?(2===r[2].length&&(r[2]=[1].concat(r[2])),f=h.Z.projectPointToLine({coords:{usrCoords:r[2]}},a.line1,e),f=p.Z.subtract(f.usrCoords,d.usrCoords),a.direction1=o.Z.innerProduct(f,[0,a.line1.stdform[2],-a.line1.stdform[1]],3)>=0?1:-1):a.direction1=r[2]>=0?1:-1,s.Z.isArray(r[3])?(2===r[3].length&&(r[3]=[1].concat(r[3])),f=h.Z.projectPointToLine({coords:{usrCoords:r[3]}},a.line2,e),f=p.Z.subtract(f.usrCoords,d.usrCoords),a.direction2=o.Z.innerProduct(f,[0,a.line2.stdform[2],-a.line2.stdform[1]],3)>=0?1:-1):a.direction2=r[3]>=0?1:-1,a.updateDataArray=function(){var t,e,s,r,n,l,c=[0,0,0];if(e=this.line1,s=this.line2,c=o.Z.crossProduct(e.stdform,s.stdform),Math.abs(c[0])>o.Z.eps*o.Z.eps&&(c[1]/=c[0],c[2]/=c[0],c[0]/=c[0]),t=this.direction1*this.Radius(),r=p.Z.add(c,[0,t*e.stdform[2],-t*e.stdform[1]]),t=this.direction2*this.Radius(),n=p.Z.add(c,[0,t*s.stdform[2],-t*s.stdform[1]]),this.point2.coords=new u.Z(i.Z.COORDS_BY_USER,r,a.board),this.point1.coords=new u.Z(i.Z.COORDS_BY_USER,c,a.board),this.point3.coords=new u.Z(i.Z.COORDS_BY_USER,n,a.board),Math.abs(r[0])<o.Z.eps||Math.abs(c[0])<o.Z.eps||Math.abs(n[0])<o.Z.eps)return this.dataX=[NaN],void(this.dataY=[NaN]);l=h.Z.bezierArc(r,c,n,!0,1),this.dataX=l[0],this.dataY=l[1],this.bezierDegree=3};else if("3points"===g){for(a.point1=_[0],a.point2=_[1],a.point3=_[2],c=0;c<3;c++)s.Z.exists(_[c]._is_new)?(a.addChild(_[c]),delete _[c]._is_new):_[c].addChild(a);a.useDirection=n.usedirection,a.setParents(_),s.Z.exists(_[3])&&(a.point4=_[3],a.point4.addChild(a)),a.methodMap=t.Z.deepCopy(a.methodMap,{arc:"arc",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint"}),a.updateDataArray=function(){var t,e,i,r,o,n=this.point2,a=this.point1,l=this.point3,c=1,d=s.Z.evaluate(this.visProp.selection);if(!n.isReal||!a.isReal||!l.isReal)return this.dataX=[NaN],void(this.dataY=[NaN]);o=h.Z.rad(n,a,l),("minor"===d&&o>Math.PI||"major"===d&&o<Math.PI)&&(c=-1),this.useDirection&&s.Z.exists(this.point4)&&(e=this.point2.coords.usrCoords,i=this.point4.coords.usrCoords,r=this.point3.coords.usrCoords,(e[1]-r[1])*(e[2]-i[2])-(e[2]-r[2])*(e[1]-i[1])>=0&&(l=this.point2,n=this.point3)),n=n.coords.usrCoords,a=a.coords.usrCoords,l=l.coords.usrCoords,t=h.Z.bezierArc(n,a,l,!0,c),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},a.Radius=function(){return this.point2.Dist(this.point1)}}return a.center=a.point1,a.radiuspoint=a.point2,a.anglepoint=a.point3,l=s.Z.copyAttributes(n,e.options,"arc"),(l=s.Z.copyAttributes(l,e.options,"sector","arc")).withLabel=!1,l.name+="_arc","2lines"===g?(a.updateDataArray(),a.arc=e.create("arc",[function(){return a.point1.coords.usrCoords},function(){var t=a.point2.coords.distance(i.Z.COORDS_BY_USER,a.point1.coords);return 0===t?[a.point1.coords.usrCoords[1],a.point1.coords.usrCoords[2]]:[a.point1.coords.usrCoords[1]+a.Radius()*(a.point2.coords.usrCoords[1]-a.point1.coords.usrCoords[1])/t,a.point1.coords.usrCoords[2]+a.Radius()*(a.point2.coords.usrCoords[2]-a.point1.coords.usrCoords[2])/t]},function(){return a.point3.coords.usrCoords}],l)):a.arc=e.create("arc",[a.point1,function(){var t=a.point2.Dist(a.point1);return 0===t?[a.point1.X(),a.point1.Y()]:[a.point1.X()+a.Radius()*(a.point2.X()-a.point1.X())/t,a.point1.Y()+a.Radius()*(a.point2.Y()-a.point1.Y())/t]},a.point3],l),a.addChild(a.arc),a.hasPointCurve=function(t,e){var r,o,n,a,l,c,d=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius(),f=this.center.coords.distance(i.Z.COORDS_BY_USER,d),_=s.Z.evaluate(this.visProp.selection);return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(l=this.board._inputDevice,a=s.Z.evaluate(this.visProp.precision[l])):a=this.board.options.precision.hasPoint,a/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(c=Math.abs(f-p)<a)&&(r=h.Z.rad(this.point2,this.center,d.usrCoords.slice(1)),o=0,n=h.Z.rad(this.point2,this.center,this.point3),("minor"===_&&n>Math.PI||"major"===_&&n<Math.PI)&&(o=n,n=2*Math.PI),(r<o||r>n)&&(c=!1)),c},a.hasPointSector=function(t,e){var r,o,n,a=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board),l=this.Radius(),c=this.point1.coords.distance(i.Z.COORDS_BY_USER,a)<l,d=s.Z.evaluate(this.visProp.selection);return c&&(r=h.Z.rad(this.radiuspoint,this.center,a.usrCoords.slice(1)),o=0,n=h.Z.rad(this.radiuspoint,this.center,this.anglepoint),("minor"===d&&n>Math.PI||"major"===d&&n<Math.PI)&&(o=n,n=2*Math.PI),(r<o||r>n)&&(c=!1)),c},a.hasPoint=function(t,e){return s.Z.evaluate(this.visProp.highlightonsector)||s.Z.evaluate(this.visProp.hasinnerpoints)?this.hasPointSector(t,e):this.hasPointCurve(t,e)},a.getTextAnchor=function(){return this.point1.coords},a.getLabelAnchor=function(){var t,e,r,n,a,l=h.Z.rad(this.point2,this.point1,this.point3),c=13/this.board.unitX,d=13/this.board.unitY,p=this.point2.coords.usrCoords,f=this.point1.coords.usrCoords,_=p[1]-f[1],g=p[2]-f[2],m=s.Z.evaluate(this.visProp.selection),b=this.label?this.label.visProp:this.visProp.label;return("minor"===m&&l>Math.PI||"major"===m&&l<Math.PI)&&(l=-(2*Math.PI-l)),r=(t=new u.Z(i.Z.COORDS_BY_USER,[f[1]+Math.cos(.5*l)*_-Math.sin(.5*l)*g,f[2]+Math.sin(.5*l)*_+Math.cos(.5*l)*g],this.board)).usrCoords[1]-f[1],n=t.usrCoords[2]-f[2],r=r*((a=o.Z.hypot(r,n))+c)/a,n=n*(a+d)/a,e=[f[1]+r,f[2]+n],b.position=h.Z.calcLabelQuadrant(h.Z.rad([1,0],[0,0],e)),new u.Z(i.Z.COORDS_BY_USER,e,this.board)},a.setRadius=function(t){var e=s.Z.evaluate(t);"undefined"!==("auto"===t||"auto"===e?"auto":s.Z.isNumber(t)?"number":s.Z.isFunction(t)&&!s.Z.isString(e)?"function":"undefined")&&(this.visProp.radius=t),a.Radius=function(){var e=s.Z.evaluate(t);return"auto"===e?this.autoRadius():e}},a.getRadius=function(){return t.Z.deprecated("Sector.getRadius()","Sector.Radius()"),this.Radius()},a.Value=function(t){return this.arc.Value(t)},a.L=function(){return this.arc.L()},a.Area=function(){var t=this.Radius();return.5*t*t*this.Value("radians")},a.Perimeter=function(){return this.L()+2*this.Radius()},"3points"===g&&(a.setPositionDirectly=function(t,e,i){var s,r=new u.Z(t,e,this.board),o=new u.Z(t,i,this.board);return a.point1.draggable()&&a.point2.draggable()&&a.point3.draggable()?(s=p.Z.subtract(r.usrCoords,o.usrCoords),this.board.create("transform",s.slice(1),{type:"translate"}).applyOnce([a.point1,a.point2,a.point3]),this):this}),a.methodMap=t.Z.deepCopy(a.methodMap,{radius:"Radius",Radius:"Radius",getRadius:"Radius",setRadius:"setRadius",Value:"Value",L:"L",Area:"Area",Perimeter:"Perimeter"}),a},t.Z.registerElement("sector",t.Z.createSector),t.Z.createCircumcircleSector=function(t,e,i){var r,o,n,a;if(!1===(a=s.Z.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(o=t.create("circumcenter",a.slice(0,3),n)).dump=!1,n=s.Z.copyAttributes(i,t.options,"circumcirclesector"),(r=t.create("sector",[o,a[0],a[2],a[1]],n)).elType="circumcirclesector",r.setParents(a),r.center=o,r.subs={center:o},r},t.Z.registerElement("circumcirclesector",t.Z.createCircumcircleSector),t.Z.createMinorSector=function(e,i,s){return s.selection="minor",t.Z.createSector(e,i,s)},t.Z.registerElement("minorsector",t.Z.createMinorSector),t.Z.createMajorSector=function(e,i,s){return s.selection="major",t.Z.createSector(e,i,s)},t.Z.registerElement("majorsector",t.Z.createMajorSector),t.Z.createAngle=function(t,e,r){var n,a,l,c,d,p,f="invalid";if(e[0].elementClass===i.Z.OBJECT_CLASS_LINE&&e[1].elementClass===i.Z.OBJECT_CLASS_LINE&&(s.Z.isArray(e[2])||s.Z.isNumber(e[2]))&&(s.Z.isArray(e[3])||s.Z.isNumber(e[3])))f="2lines";else{if(l={name:""},!1===(p=s.Z.providePoints(t,e,l,"point")))throw new Error("JSXGraph: Can't create angle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");f="3points"}if(l=s.Z.copyAttributes(r,t.options,"angle"),s.Z.exists(l.name)&&""!==l.name||(l.name=t.generateName({type:i.Z.OBJECT_TYPE_ANGLE})),a=s.Z.exists(l.radius)?l.radius:0,t.suspendUpdate(),"2lines"===f?(e.push(a),(n=t.create("sector",e,l)).updateDataArraySector=n.updateDataArray,n.setAngle=function(t){},n.free=function(t){}):((n=t.create("sector",[p[1],p[0],p[2]],l)).arc.visProp.priv=!0,n.point=n.point2=n.radiuspoint=p[0],n.pointsquare=n.point3=n.anglepoint=p[2],n.Radius=function(){var t=s.Z.evaluate(a);return"auto"===t?n.autoRadius():t},n.updateDataArraySector=function(){var t,e,i=this.point2,r=this.point1,o=this.point3,n=this.Radius(),a=r.Dist(i),l=1,c=s.Z.evaluate(this.visProp.selection);e=h.Z.rad(i,r,o),("minor"===c&&e>Math.PI||"major"===c&&e<Math.PI)&&(l=-1),i=i.coords.usrCoords,r=r.coords.usrCoords,o=o.coords.usrCoords,i=[1,r[1]+(i[1]-r[1])*n/a,r[2]+(i[2]-r[2])*n/a],o=[1,r[1]+(o[1]-r[1])*n/a,r[2]+(o[2]-r[2])*n/a],t=h.Z.bezierArc(i,r,o,!0,l),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},n.setAngle=function(t){var e,i,r,n=this.anglepoint,a=this.radiuspoint;return n.draggable()&&(e=this.board.create("transform",[t,this.center],{type:"rotate"}),n.addTransform(a,e),e.update(),n.moveTo(o.Z.matVecMult(e.matrix,a.coords.usrCoords)),r=s.Z.isFunction(t)?function(){return 2*Math.PI-t()}:function(){return 2*Math.PI-t},i=this.board.create("transform",[r,this.center],{type:"rotate"}),n.coords.on("update",(function(){i.update(),a.moveTo(o.Z.matVecMult(i.matrix,n.coords.usrCoords))})),n.setParents(a),this.hasFixedAngle=!0),this},n.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},n.setParents(p)),s.Z.exists(n.visProp.text)&&n.label.setText(s.Z.evaluate(n.visProp.text)),n.elType="angle",n.type=i.Z.OBJECT_TYPE_ANGLE,n.subs={},n.updateDataArraySquare=function(){var t,e,i,s,r,n,a,l,c=this.Radius();"2lines"===f&&this.updateDataArraySector(),t=this.point2,e=this.point1,i=this.point3,t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,s=h.Z.distance(t,e,3),r=h.Z.distance(i,e,3),t=[1,e[1]+(t[1]-e[1])*c/s,e[2]+(t[2]-e[2])*c/s],i=[1,e[1]+(i[1]-e[1])*c/r,e[2]+(i[2]-e[2])*c/r],n=o.Z.crossProduct(i,e),a=[-t[1]*n[1]-t[2]*n[2],t[0]*n[1],t[0]*n[2]],n=o.Z.crossProduct(t,e),l=[-i[1]*n[1]-i[2]*n[2],i[0]*n[1],i[0]*n[2]],(n=o.Z.crossProduct(a,l))[1]/=n[0],n[2]/=n[0],this.dataX=[e[1],t[1],n[1],i[1],e[1]],this.dataY=[e[2],t[2],n[2],i[2],e[2]],this.bezierDegree=1},n.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},n.updateDataArray=function(){var t=s.Z.evaluate(this.visProp.type),e=h.Z.trueAngle(this.point2,this.point1,this.point3),i=s.Z.evaluate(this.visProp.selection);("minor"===i&&e>180||"major"===i&&e<180)&&(e=360-e),Math.abs(e-90)<s.Z.evaluate(this.visProp.orthosensitivity)+o.Z.eps&&(t=s.Z.evaluate(this.visProp.orthotype)),"none"===t?this.updateDataArrayNone():"square"===t?this.updateDataArraySquare():"sector"===t?this.updateDataArraySector():"sectordot"===t&&(this.updateDataArraySector(),this.dot.visProp.visible||this.dot.setAttribute({visible:!0})),(!this.visProp.visible||"sectordot"!==t&&this.dot.visProp.visible)&&this.dot.setAttribute({visible:!1})},c=s.Z.copyAttributes(r,t.options,"angle","dot"),n.dot=t.create("point",[function(){var t,e,i,r,a,l,c,d,u;return s.Z.exists(n.dot)&&!n.dot.visProp.visible?[0,0]:(t=n.point2.coords.usrCoords,e=n.point1.coords.usrCoords,i=n.Radius(),r=h.Z.distance(t,e,3),a=h.Z.rad(n.point2,n.point1,n.point3),("minor"===(u=s.Z.evaluate(n.visProp.selection))&&a>Math.PI||"major"===u&&a<Math.PI)&&(a=-(2*Math.PI-a)),a*=.5,l=Math.cos(a),c=Math.sin(a),t=[1,e[1]+(t[1]-e[1])*i/r,e[2]+(t[2]-e[2])*i/r],d=[[1,0,0],[e[1]-.5*e[1]*l+.5*e[2]*c,.5*l,.5*-c],[e[2]-.5*e[1]*c-.5*e[2]*l,.5*c,.5*l]],o.Z.matVecMult(d,t))}],c),n.dot.dump=!1,n.subs.dot=n.dot,"2lines"===f)for(d=0;d<2;d++)t.select(e[d]).addChild(n.dot);else for(d=0;d<3;d++)t.select(p[d]).addChild(n.dot);return t.unsuspendUpdate(),n.Value=function(t){return""===(t=t||"radians")&&(t="radians"),n.arc.Value(t)},n.getLabelAnchor=function(){var t,e,r,a,l,c,d,p,f,_=12,g=s.Z.evaluate(n.visProp.selection),m=this.label?this.label.visProp:this.visProp.label;return s.Z.exists(this.label)&&s.Z.exists(this.label.visProp.fontsize)&&(_=s.Z.evaluate(this.label.visProp.fontsize)),_/=this.board.unitX,e=n.point2.coords.usrCoords,r=n.point1.coords.usrCoords,a=n.Radius(),l=h.Z.distance(e,r,3),c=h.Z.rad(n.point2,n.point1,n.point3),("minor"===g&&c>Math.PI||"major"===g&&c<Math.PI)&&(c=-(2*Math.PI-c)),c*=.5,d=Math.cos(c),p=Math.sin(c),e=[1,r[1]+(e[1]-r[1])*a/l,r[2]+(e[2]-r[2])*a/l],f=[[1,0,0],[r[1]-.5*r[1]*d+.5*r[2]*p,.5*d,.5*-p],[r[2]-.5*r[1]*p-.5*r[2]*d,.5*p,.5*d]],(t=o.Z.matVecMult(f,e))[1]/=t[0],t[2]/=t[0],t[0]/=t[0],l=h.Z.distance(t,r,3),t=[t[0],r[1]+(t[1]-r[1])*(a+_)/l,r[2]+(t[2]-r[2])*(a+_)/l],m.position=h.Z.calcLabelQuadrant(h.Z.rad([1,0],[0,0],t)),new u.Z(i.Z.COORDS_BY_USER,t,this.board)},n.methodMap=s.Z.deepCopy(n.methodMap,{setAngle:"setAngle",Value:"Value",free:"free"}),n},t.Z.registerElement("angle",t.Z.createAngle),t.Z.createNonreflexAngle=function(e,i,r){var o;return r.selection="minor",r=s.Z.copyAttributes(r,e.options,"nonreflexangle"),(o=t.Z.createAngle(e,i,r)).Value=function(t){var e=h.Z.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)},o},t.Z.registerElement("nonreflexangle",t.Z.createNonreflexAngle),t.Z.createReflexAngle=function(e,i,r){var o;return r.selection="major",r=s.Z.copyAttributes(r,e.options,"reflexangle"),(o=t.Z.createAngle(e,i,r)).Value=function(t){var e=h.Z.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)},o},t.Z.registerElement("reflexangle",t.Z.createReflexAngle),t.Z.createOrthogonalProjection=function(t,e,r){var o,n,a,l;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.Z.isPointType(t,e[0])&&e[1].elementClass===i.Z.OBJECT_CLASS_LINE)n=s.Z.providePoints(t,[e[0]],r,"point")[0],o=e[1];else{if(!s.Z.isPointType(t,e[1])||e[0].elementClass!==i.Z.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]");n=s.Z.providePoints(t,[e[1]],r,"point")[0],o=e[0]}return l=s.Z.copyAttributes(r,t.options,"orthogonalprojection"),a=t.create("point",[function(){return h.Z.projectPointToLine(n,o,t)}],l),s.Z.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="orthogonalprojection",a.setParents([n.id,a.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.Z.createPerpendicular=function(e,r,o){var n,a,h,l;if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.Z.isPointType(e,r[0])&&r[1].elementClass===i.Z.OBJECT_CLASS_LINE)a=r[1],n=s.Z.providePoints(e,[r[0]],o,"point")[0];else{if(!s.Z.isPointType(e,r[1])||r[0].elementClass!==i.Z.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.Z.providePoints(e,[r[1]],o,"point")[0]}return l=s.Z.copyAttributes(o,e.options,"perpendicular"),(h=t.Z.createLine(e,[function(){return a.stdform[2]*n.X()-a.stdform[1]*n.Y()},function(){return-a.stdform[2]*n.Z()},function(){return a.stdform[1]*n.Z()}],l)).elType="perpendicular",h.setParents([a.id,n.id]),s.Z.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),a.addChild(h),h},t.Z.createPerpendicularPoint=function(t,e,r){var o,n,a;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.Z.isPointType(t,e[0])&&e[1].elementClass===i.Z.OBJECT_CLASS_LINE)n=s.Z.providePoints(t,[e[0]],r,"point")[0],o=e[1];else{if(!s.Z.isPointType(t,e[1])||e[0].elementClass!==i.Z.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]");n=s.Z.providePoints(t,[e[1]],r,"point")[0],o=e[0]}return a=t.create("point",[function(){return h.Z.perpendicular(o,n,t)[0]}],r),s.Z.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="perpendicularpoint",a.setParents([n.id,o.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.Z.createPerpendicularSegment=function(e,r,o){var n,a,l,c,d;if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.Z.isPointType(e,r[0])&&r[1].elementClass===i.Z.OBJECT_CLASS_LINE)a=r[1],n=s.Z.providePoints(e,[r[0]],o,"point")[0];else{if(!s.Z.isPointType(e,r[1])||r[0].elementClass!==i.Z.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.Z.providePoints(e,[r[1]],o,"point")[0]}return d=s.Z.copyAttributes(o,e.options,"perpendicularsegment","point"),(c=t.Z.createPerpendicularPoint(e,[a,n],d)).dump=!1,s.Z.exists(o.layer)||(o.layer=e.options.layer.line),d=s.Z.copyAttributes(o,e.options,"perpendicularsegment"),(l=t.Z.createLine(e,[function(){return h.Z.perpendicular(a,n,e)[1]?[c,n]:[n,c]}],d)).point=c,s.Z.exists(n._is_new)?(l.addChild(n),delete n._is_new):n.addChild(l),a.addChild(l),l.elType="perpendicularsegment",l.setParents([n.id,a.id]),l.subs={point:c},l.inherits.push(c),l},t.Z.createMidpoint=function(t,e,r){var n,a,h,l,c;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(2===e.length&&s.Z.isPointType(t,e[0])&&s.Z.isPointType(t,e[1]))e=s.Z.providePoints(t,e,r,"point"),n=e[0],a=e[1];else{if(1!==e.length||e[0].elementClass!==i.Z.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create midpoint.\nPossible parent types: [point,point], [line]");n=e[0].point1,a=e[0].point2}return c=s.Z.copyAttributes(r,t.options,"midpoint"),h=t.create("point",[function(){var t=n.coords.usrCoords[1]+a.coords.usrCoords[1];return isNaN(t)||Math.abs(n.coords.usrCoords[0])<o.Z.eps||Math.abs(a.coords.usrCoords[0])<o.Z.eps?NaN:.5*t},function(){var t=n.coords.usrCoords[2]+a.coords.usrCoords[2];return isNaN(t)||Math.abs(n.coords.usrCoords[0])<o.Z.eps||Math.abs(a.coords.usrCoords[0])<o.Z.eps?NaN:.5*t}],c),s.Z.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),s.Z.exists(a._is_new)?(h.addChild(a),delete a._is_new):a.addChild(h),h.elType="midpoint",h.setParents([n.id,a.id]),h.prepareUpdate().update(),h.generatePolynomial=function(){var t=n.symbolic.x,e=n.symbolic.y,i=a.symbolic.x,s=a.symbolic.y,r=h.symbolic.x,o=h.symbolic.y;return["("+e+")*("+r+")-("+e+")*("+i+")+("+o+")*("+i+")-("+t+")*("+o+")+("+t+")*("+s+")-("+r+")*("+s+")","("+t+")^2 - 2*("+t+")*("+r+")+("+e+")^2-2*("+e+")*("+o+")-("+i+")^2+2*("+i+")*("+r+")-("+s+")^2+2*("+s+")*("+o+")"]},h},t.Z.createParallelPoint=function(t,e,r){var o,n,a,h,l,c;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(3===e.length&&s.Z.isPointType(t,e[0])&&s.Z.isPointType(t,e[1])&&s.Z.isPointType(t,e[2]))e=s.Z.providePoints(t,e,r,"point"),o=e[0],n=e[1],a=e[2];else if(s.Z.isPointType(t,e[0])&&e[1].elementClass===i.Z.OBJECT_CLASS_LINE)a=s.Z.providePoints(t,[e[0]],r,"point")[0],o=e[1].point1,n=e[1].point2;else{if(!s.Z.isPointType(t,e[1])||e[0].elementClass!==i.Z.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]");a=s.Z.providePoints(t,[e[1]],r,"point")[0],o=e[0].point1,n=e[0].point2}return c=s.Z.copyAttributes(r,t.options,"parallelpoint"),h=t.create("point",[function(){return a.coords.usrCoords[1]+n.coords.usrCoords[1]-o.coords.usrCoords[1]},function(){return a.coords.usrCoords[2]+n.coords.usrCoords[2]-o.coords.usrCoords[2]}],c),s.Z.exists(o._is_new)?(h.addChild(o),delete o._is_new):o.addChild(h),s.Z.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),s.Z.exists(a._is_new)?(h.addChild(a),delete a._is_new):a.addChild(h),h.elType="parallelpoint",h.setParents([o.id,n.id,a.id]),h.prepareUpdate().update(),h.generatePolynomial=function(){var t=o.symbolic.x,e=o.symbolic.y,i=n.symbolic.x,s=n.symbolic.y,r=a.symbolic.x,l=a.symbolic.y,c=h.symbolic.x,d=h.symbolic.y;return["("+s+")*("+c+")-("+s+")*("+r+")-("+e+")*("+c+")+("+e+")*("+r+")-("+d+")*("+i+")+("+d+")*("+t+")+("+l+")*("+i+")-("+l+")*("+t+")","("+d+")*("+t+")-("+d+")*("+r+")-("+s+")*("+t+")+("+s+")*("+r+")-("+c+")*("+e+")+("+c+")*("+l+")+("+i+")*("+e+")-("+i+")*("+l+")"]},h},t.Z.createParallel=function(t,e,i){var r,n,a,h,l,c,d=1;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);return r=null,3===e.length?(r=(e=s.Z.providePoints(t,e,i,"point"))[2],d=0):s.Z.isPointType(t,e[0])?(r=s.Z.providePoints(t,[e[0]],i,"point")[0],h=function(){return e[1].stdform}):s.Z.isPointType(t,e[1])&&(r=s.Z.providePoints(t,[e[1]],i,"point")[0],h=function(){return e[0].stdform}),s.Z.exists(i.layer)||(i.layer=t.options.layer.line),c=s.Z.copyAttributes(i,t.options,"parallel","point"),(n=1===d?t.create("point",[function(){return o.Z.crossProduct([1,0,0],h())}],c):t.create("parallelpoint",e,c)).isDraggable=!0,c=s.Z.copyAttributes(i,t.options,"parallel"),(a=t.create("line",[r,n],c)).elType="parallel",a.subs={point:n},a.inherits.push(n),a.setParents([e[0].id,e[1].id]),3===e.length&&a.addParents(e[2].id),a.point=n,a},t.Z.createArrowParallel=function(e,r,o){var n,a;try{return!1===(a=s.Z.copyAttributes(o,e.options,"arrowparallel")).lastArrow&&(a.lastArrow=!0),(n=t.Z.createParallel(e,r,a).setAttribute({straightFirst:!1,straightLast:!1})).type=i.Z.OBJECT_TYPE_VECTOR,n.elType="arrowparallel",n}catch(t){throw new Error("JSXGraph: Can't create arrowparallel with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point], [point,point,point]")}},t.Z.createNormal=function(t,e,r){var n,a,h,l,c,u,p,f,_;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(1===e.length)n=e[0],a=n.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(s.Z.isPointType(t,e[0]))n=s.Z.providePoints(t,[e[0]],r,"point")[0],a=e[1];else{if(!s.Z.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]");a=e[0],n=s.Z.providePoints(t,[e[1]],r,"point")[0]}}if(p=s.Z.copyAttributes(r,t.options,"normal"),a.elementClass===i.Z.OBJECT_CLASS_LINE)_=s.Z.copyAttributes(r,t.options,"normal","point"),f=t.create("point",[function(){var t=o.Z.crossProduct([1,0,0],a.stdform);return[t[0],-t[2],t[1]]}],_),f.isDraggable=!0,(h=t.create("line",[n,f],p)).point=f,h.subs={point:f},h.inherits.push(f);else if(a.elementClass===i.Z.OBJECT_CLASS_CIRCLE)h=t.create("line",[a.midpoint,n],p);else if(a.elementClass===i.Z.OBJECT_CLASS_CURVE)"plot"!==s.Z.evaluate(a.visProp.curvetype)?(c=a.X,u=a.Y,h=t.create("line",[function(){return-n.X()*d.Z.D(c)(n.position)-n.Y()*d.Z.D(u)(n.position)},function(){return d.Z.D(c)(n.position)},function(){return d.Z.D(u)(n.position)}],p)):h=t.create("line",[function(){var t,e,i,s,r,h,l,c,d,u,p=Math.floor(n.position),f=n.position-p;if(1===a.bezierdegree)p===a.numberPoints-1&&(p-=1,f=1);else{if(3!==a.bezierDegree)return 0;p=3*Math.floor(n.position*(a.numberPoints-1)/3),i=(n.position*(a.numberPoints-1)-p)/3,p>=a.numberPoints-1&&(p=a.numberPoints-4,i=1)}return p<0?1:1===a.bezierDegree?(a.Y(p)+f*(a.Y(p+1)-a.Y(p)))*(a.Y(p)-a.Y(p+1))-(a.X(p)+f*(a.X(p+1)-a.X(p)))*(a.X(p+1)-a.X(p)):(s=a.points[p].usrCoords,r=a.points[p+1].usrCoords,h=a.points[p+2].usrCoords,l=a.points[p+3].usrCoords,c=(1-i)*(1-i)*(r[1]-s[1])+2*(1-i)*i*(h[1]-r[1])+i*i*(l[1]-h[1]),d=(1-i)*(1-i)*(r[2]-s[2])+2*(1-i)*i*(h[2]-r[2])+i*i*(l[2]-h[2]),c/=u=o.Z.hypot(c,d),d/=u,e=[1,(t=n.coords.usrCoords)[1]-d,t[2]+c],t[2]*e[1]-t[1]*e[2])},function(){var t,e,i,s,r,h,l,c,d,u=Math.floor(n.position);if(1===a.bezierdegree)u===a.numberPoints-1&&(u-=1);else{if(3!==a.bezierDegree)return 0;u=3*Math.floor(n.position*(a.numberPoints-1)/3),e=(n.position*(a.numberPoints-1)-u)/3,u>=a.numberPoints-1&&(u=a.numberPoints-4,e=1)}return u<0?0:1===a.bezierDegree?a.X(u+1)-a.X(u):(i=a.points[u].usrCoords,s=a.points[u+1].usrCoords,r=a.points[u+2].usrCoords,h=a.points[u+3].usrCoords,l=(1-e)*(1-e)*(s[1]-i[1])+2*(1-e)*e*(r[1]-s[1])+e*e*(h[1]-r[1]),c=(1-e)*(1-e)*(s[2]-i[2])+2*(1-e)*e*(r[2]-s[2])+e*e*(h[2]-r[2]),l/=d=o.Z.hypot(l,c),c/=d,[1,(t=n.coords.usrCoords)[1]-c,t[2]+l][2]-t[2])},function(){var t,e,i,s,r,h,l,c,d,u,p=Math.floor(n.position);if(1===a.bezierdegree)p===a.numberPoints-1&&(p-=1);else{if(3!==a.bezierDegree)return 0;p=3*Math.floor(n.position*(a.numberPoints-1)/3),i=(n.position*(a.numberPoints-1)-p)/3,p>=a.numberPoints-1&&(p=a.numberPoints-4,i=1)}return p<0?0:1===a.bezierDegree?a.Y(p+1)-a.Y(p):(s=a.points[p].usrCoords,r=a.points[p+1].usrCoords,h=a.points[p+2].usrCoords,l=a.points[p+3].usrCoords,c=(1-i)*(1-i)*(r[1]-s[1])+2*(1-i)*i*(h[1]-r[1])+i*i*(l[1]-h[1]),d=(1-i)*(1-i)*(r[2]-s[2])+2*(1-i)*i*(h[2]-r[2])+i*i*(l[2]-h[2]),c/=u=o.Z.hypot(c,d),d/=u,e=[1,(t=n.coords.usrCoords)[1]-d,t[2]+c],t[1]-e[1])}],p);else{if(a.type!==i.Z.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]");h=t.create("line",[function(){var t,e,s=Math.floor(n.position),r=n.position-s;for(e=0;e<a.objects.length;e++)if((t=a.objects[e]).type===i.Z.OBJECT_TYPE_CURVE){if(s<t.numberPoints)break;s-=t.numberPoints}return s===t.numberPoints-1&&(s-=1,r=1),s<0?1:(t.Y(s)+r*(t.Y(s+1)-t.Y(s)))*(t.Y(s)-t.Y(s+1))-(t.X(s)+r*(t.X(s+1)-t.X(s)))*(t.X(s+1)-t.X(s))},function(){var t,e,s=Math.floor(n.position);for(e=0;e<a.objects.length;e++)if((t=a.objects[e]).type===i.Z.OBJECT_TYPE_CURVE){if(s<t.numberPoints)break;s-=t.numberPoints}return s===t.numberPoints-1&&(s-=1),s<0?0:t.X(s+1)-t.X(s)},function(){var t,e,s=Math.floor(n.position);for(e=0;e<a.objects.length;e++)if((t=a.objects[e]).type===i.Z.OBJECT_TYPE_CURVE){if(s<t.numberPoints)break;s-=t.numberPoints}return s===t.numberPoints-1&&(s-=1),s<0?0:t.Y(s+1)-t.Y(s)}],p)}return h.elType="normal",h.setParents(e),s.Z.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),a.addChild(h),h},t.Z.createBisector=function(e,i,r){var o,n,a,l;if(i=s.Z.providePoints(e,i,r,"point"),s.Z.isPoint(i[0])&&s.Z.isPoint(i[1])&&s.Z.isPoint(i[2])){for((l=s.Z.copyAttributes(r,e.options,"bisector","point")).snapToGrid=!1,(o=e.create("point",[function(){return h.Z.angleBisector(i[0],i[1],i[2],e)}],l)).dump=!1,a=0;a<3;a++)s.Z.exists(i[a]._is_new)?(o.addChild(i[a]),delete i[a]._is_new):i[a].addChild(o);return s.Z.exists(r.layer)||(r.layer=e.options.layer.line),l=s.Z.copyAttributes(r,e.options,"bisector"),(n=t.Z.createLine(e,[i[1],o],l)).point=o,n.elType="bisector",n.setParents(i),n.subs={point:o},n.inherits.push(o),n}throw new Error("JSXGraph: Can't create angle bisector with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point,point]")},t.Z.createAngularBisectorsOfTwoLines=function(t,e,r){var n,a,h,l,c=t.select(e[0]),d=t.select(e[1]);if(c.elementClass!==i.Z.OBJECT_CLASS_LINE||d.elementClass!==i.Z.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 s.Z.exists(r.layer)||(r.layer=t.options.layer.line),h=s.Z.copyAttributes(r,t.options,"bisectorlines","line1"),n=t.create("line",[function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[0]/t-d.stdform[0]/e},function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[1]/t-d.stdform[1]/e},function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[2]/t-d.stdform[2]/e}],h),s.Z.exists(r.layer)||(r.layer=t.options.layer.line),h=s.Z.copyAttributes(r,t.options,"bisectorlines","line2"),a=t.create("line",[function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[0]/t+d.stdform[0]/e},function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[1]/t+d.stdform[1]/e},function(){var t=o.Z.hypot(c.stdform[1],c.stdform[2]),e=o.Z.hypot(d.stdform[1],d.stdform[2]);return c.stdform[2]/t+d.stdform[2]/e}],h),l=new j({line1:n,line2:a}),n.dump=!1,a.dump=!1,l.elType="bisectorlines",l.setParents([c.id,d.id]),l.subs={line1:n,line2:a},l},t.Z.createCircumcenter=function(e,i,r){var o,n,a,l,c;if(i=s.Z.providePoints(e,i,r,"point"),s.Z.isPoint(i[0])&&s.Z.isPoint(i[1])&&s.Z.isPoint(i[2])){for(a=i[0],l=i[1],c=i[2],o=t.Z.createPoint(e,[function(){return h.Z.circumcenter(a,l,c,e)}],r),n=0;n<3;n++)s.Z.exists(i[n]._is_new)?(o.addChild(i[n]),delete i[n]._is_new):i[n].addChild(o);return o.elType="circumcenter",o.setParents(i),o.generatePolynomial=function(){var t=a.symbolic.x,e=a.symbolic.y,i=l.symbolic.x,s=l.symbolic.y,r=c.symbolic.x,n=c.symbolic.y,h=o.symbolic.x,d=o.symbolic.y;return[["((",h,")-(",t,"))^2+((",d,")-(",e,"))^2-((",h,")-(",i,"))^2-((",d,")-(",s,"))^2"].join(""),["((",h,")-(",t,"))^2+((",d,")-(",e,"))^2-((",h,")-(",r,"))^2-((",d,")-(",n,"))^2"].join("")]},o}throw new Error("JSXGraph: Can't create circumcircle midpoint with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")},t.Z.createIncenter=function(t,e,r){var n,a,h,l,c;if(!((e=s.Z.providePoints(t,e,r,"point")).length>=3&&s.Z.isPoint(e[0])&&s.Z.isPoint(e[1])&&s.Z.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(a=e[0],h=e[1],l=e[2],n=t.create("point",[function(){var e,s,r;return e=o.Z.hypot(h.X()-l.X(),h.Y()-l.Y()),s=o.Z.hypot(a.X()-l.X(),a.Y()-l.Y()),r=o.Z.hypot(h.X()-a.X(),h.Y()-a.Y()),new u.Z(i.Z.COORDS_BY_USER,[(e*a.X()+s*h.X()+r*l.X())/(e+s+r),(e*a.Y()+s*h.Y()+r*l.Y())/(e+s+r)],t)}],r),c=0;c<3;c++)s.Z.exists(e[c]._is_new)?(n.addChild(e[c]),delete e[c]._is_new):e[c].addChild(n);return n.elType="incenter",n.setParents(e),n},t.Z.createCircumcircle=function(e,i,r){var o,n,a,h;if(!1===(i=s.Z.providePoints(e,i,r,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(a=s.Z.copyAttributes(r,e.options,"circumcircle","center"),(o=t.Z.createCircumcenter(e,i,a)).dump=!1,s.Z.exists(r.layer)||(r.layer=e.options.layer.circle),a=s.Z.copyAttributes(r,e.options,"circumcircle"),(n=t.Z.createCircle(e,[o,i[0]],a)).elType="circumcircle",n.setParents(i),n.subs={center:o},n.inherits.push(n),h=0;h<3;h++)s.Z.exists(i[h]._is_new)?(n.addChild(i[h]),delete i[h]._is_new):i[h].addChild(n)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return n},t.Z.createIncircle=function(e,i,r){var n,a,h,l;if(!1===(i=s.Z.providePoints(e,i,r,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(l=s.Z.copyAttributes(r,e.options,"incircle","center"),(a=t.Z.createIncenter(e,i,l)).dump=!1,s.Z.exists(r.layer)||(r.layer=e.options.layer.circle),l=s.Z.copyAttributes(r,e.options,"incircle"),(h=t.Z.createCircle(e,[a,function(){var t=o.Z.hypot(i[1].X()-i[2].X(),i[1].Y()-i[2].Y()),e=o.Z.hypot(i[0].X()-i[2].X(),i[0].Y()-i[2].Y()),s=o.Z.hypot(i[1].X()-i[0].X(),i[1].Y()-i[0].Y()),r=(t+e+s)/2;return Math.sqrt((r-t)*(r-e)*(r-s)/r)}],l)).elType="incircle",h.setParents(i),n=0;n<3;n++)s.Z.exists(i[n]._is_new)?(h.addChild(i[n]),delete i[n]._is_new):i[n].addChild(h);h.center=a,h.subs={center:h.center},h.inherits.push(a)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return h},t.Z.createReflection=function(e,r,o){var n,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(d=0;d<r.length;++d)r[d]=e.select(r[d]);if(u=s.Z.copyAttributes(o,e.options,"reflection"),s.Z.isPoint(r[0]))a=s.Z.providePoints(e,[r[0]],p)[0];else{if(r[0].elementClass!==i.Z.OBJECT_CLASS_CURVE&&r[0].elementClass!==i.Z.OBJECT_CLASS_LINE&&r[0].type!==i.Z.OBJECT_TYPE_POLYGON&&r[0].elementClass!==i.Z.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create reflection element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);a=r[0]}if(r[1].elementClass!==i.Z.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);if(n=r[1],c=t.Z.createTransform(e,[n],{type:"reflect"}),s.Z.isPoint(a))h=t.Z.createPoint(e,[a,c],u);else if(a.elementClass===i.Z.OBJECT_CLASS_CURVE)h=t.Z.createCurve(e,[a,c],u);else if(a.elementClass===i.Z.OBJECT_CLASS_LINE)h=t.Z.createLine(e,[a,c],u);else if(a.type===i.Z.OBJECT_TYPE_POLYGON)h=t.Z.createPolygon(e,[a,c],u);else{if(a.elementClass!==i.Z.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create reflected element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);"euclidean"===u.type.toLowerCase()?(p=s.Z.copyAttributes(o,e.options,"reflection","center"),(l=t.Z.createPoint(e,[a.center,c],p)).prepareUpdate().update().updateVisibility(s.Z.evaluate(l.visProp.visible)).updateRenderer(),h=t.Z.createCircle(e,[l,function(){return a.Radius()}],u)):h=t.Z.createCircle(e,[a,c],u)}return s.Z.exists(a._is_new)&&(h.addChild(a),delete a._is_new),n.addChild(h),h.elType="reflection",h.addParents(n),h.prepareUpdate().update(),s.Z.isPoint(h)&&(h.generatePolynomial=function(){var t=n.point1.symbolic.x,e=n.point1.symbolic.y,i=n.point2.symbolic.x,s=n.point2.symbolic.y,r=a.symbolic.x,o=a.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return[["((",c,")-(",o,"))*((",e,")-(",s,"))+((",t,")-(",i,"))*((",l,")-(",r,"))"].join(""),["((",l,")-(",t,"))^2+((",c,")-(",e,"))^2-((",r,")-(",t,"))^2-((",o,")-(",e,"))^2"].join("")]}),h},t.Z.createMirrorElement=function(e,r,o){var n,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, point]";for(a=0;a<r.length;++a)r[a]=e.select(r[a]);if(u=s.Z.copyAttributes(o,e.options,"mirrorelement"),s.Z.isPoint(r[0]))n=s.Z.providePoints(e,[r[0]],u)[0];else{if(r[0].elementClass!==i.Z.OBJECT_CLASS_CURVE&&r[0].elementClass!==i.Z.OBJECT_CLASS_LINE&&r[0].type!==i.Z.OBJECT_TYPE_POLYGON&&r[0].elementClass!==i.Z.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);n=r[0]}if(!s.Z.isPoint(r[1]))throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);if(p=s.Z.copyAttributes(o,e.options,"mirrorelement","point"),h=s.Z.providePoints(e,[r[1]],p)[0],d=t.Z.createTransform(e,[Math.PI,h],{type:"rotate"}),s.Z.isPoint(n))l=t.Z.createPoint(e,[n,d],u);else if(n.elementClass===i.Z.OBJECT_CLASS_CURVE)l=t.Z.createCurve(e,[n,d],u);else if(n.elementClass===i.Z.OBJECT_CLASS_LINE)l=t.Z.createLine(e,[n,d],u);else if(n.type===i.Z.OBJECT_TYPE_POLYGON)l=t.Z.createPolygon(e,[n,d],u);else{if(n.elementClass!==i.Z.OBJECT_CLASS_CIRCLE)throw new Error("JSXGraph: Can't create mirror element with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'."+f);"euclidean"===u.type.toLowerCase()?(p=s.Z.copyAttributes(o,e.options,"mirrorelement","center"),(c=t.Z.createPoint(e,[n.center,d],p)).prepareUpdate().update().updateVisibility(s.Z.evaluate(c.visProp.visible)).updateRenderer(),l=t.Z.createCircle(e,[c,function(){return n.Radius()}],u)):l=t.Z.createCircle(e,[n,d],u)}return s.Z.exists(n._is_new)&&(l.addChild(n),delete n._is_new),h.addChild(l),l.elType="mirrorelement",l.addParents(h),l.prepareUpdate().update(),l},t.Z.createMirrorPoint=function(e,i,s){var r=t.Z.createMirrorElement(e,i,s);return r.elType="mirrorpoint",r},t.Z.createIntegral=function(e,r,o){var n,a,h,l,c,p,f,_,g,m,b,v,Z,C,y,P=null;if(s.Z.isArray(r[0])&&r[1].elementClass===i.Z.OBJECT_CLASS_CURVE)n=r[0],a=r[1];else{if(!s.Z.isArray(r[1])||r[0].elementClass!==i.Z.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create integral with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [[number|function,number|function],curve]");n=r[1],a=r[0]}return(h=s.Z.copyAttributes(o,e.options,"integral")).withLabel=!1,y=e.create("curve",[[0],[0]],h),l=n[0],c=n[1],s.Z.isFunction(l)?(f=function(){return a.Y(p())},l=(p=l)()):(p=l,f=a.Y(l)),s.Z.isFunction(c)?(g=function(){return a.Y(_())},c=(_=c)()):(_=c,g=a.Y(c)),h=s.Z.copyAttributes(o,e.options,"integral","curveLeft"),m=e.create("glider",[p,f,a],h),s.Z.isFunction(p)&&m.hideElement(),h=s.Z.copyAttributes(o,e.options,"integral","baseLeft"),b=e.create("point",[function(){return"y"===s.Z.evaluate(y.visProp.axis)?0:m.X()},function(){return"y"===s.Z.evaluate(y.visProp.axis)?m.Y():0}],h),h=s.Z.copyAttributes(o,e.options,"integral","curveRight"),v=e.create("glider",[_,g,a],h),s.Z.isFunction(_)&&v.hideElement(),h=s.Z.copyAttributes(o,e.options,"integral","baseRight"),Z=e.create("point",[function(){return"y"===s.Z.evaluate(y.visProp.axis)?0:v.X()},function(){return"y"===s.Z.evaluate(y.visProp.axis)?v.Y():0}],h),!1!==(h=s.Z.copyAttributes(o,e.options,"integral")).withlabel&&"y"!==h.axis&&(h=s.Z.copyAttributes(o,e.options,"integral","label"),h=s.Z.copyAttributes(h,e.options,"label"),C=function(){var t=d.Z.NewtonCotes([b.X(),Z.X()],a.Y),e=s.Z.evaluate(P.visProp.digits);return"∫ = "+(P.useLocale()?P.formatNumberLocale(t,e):s.Z.toFixed(t,e))},(P=e.create("text",[function(){var t=new u.Z(i.Z.COORDS_BY_SCREEN,[s.Z.evaluate(this.visProp.offset[0])+this.board.origin.scrCoords[1],0],this.board,!1),e=this.board.getBoundingBox(),r=.1*(e[2]-e[0]),o=v.X();return o<e[0]?o=e[0]+r:o>e[2]&&(o=e[2]-r),o+t.usrCoords[1]},function(){var t=new u.Z(i.Z.COORDS_BY_SCREEN,[0,s.Z.evaluate(this.visProp.offset[1])+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),r=.1*(e[1]-e[3]),o=v.Y();return o>e[1]?o=e[1]-r:o<e[3]&&(o=e[3]+r),o+t.usrCoords[2]},""],h)).setText(C),P.dump=!1,m.addChild(P),v.addChild(P)),m.dump=!1,b.dump=!1,v.dump=!1,Z.dump=!1,y.elType="integral",y.setParents([a.id,n]),y.subs={curveLeft:m,baseLeft:b,curveRight:v,baseRight:Z},y.inherits.push(m,b,v,Z),h.withLabel&&(y.subs.label=P,y.inherits.push(P)),y.Value=function(){return d.Z.I([b.X(),Z.X()],a.Y)},y.updateDataArray=function(){var t,e,i,r,o,n,h,l,c;if("y"===s.Z.evaluate(this.visProp.axis)){for(m.Y()<v.Y()?(n=m.X(),l=m.Y(),h=v.X(),c=v.Y()):(n=v.X(),l=v.Y(),h=m.X(),c=m.Y()),r=Math.min(n,h),o=Math.max(n,h),t=[0,n],e=[l,l],i=0;i<a.numberPoints;i++)l<=a.points[i].usrCoords[2]&&r<=a.points[i].usrCoords[1]&&a.points[i].usrCoords[2]<=c&&a.points[i].usrCoords[1]<=o&&(t.push(a.points[i].usrCoords[1]),e.push(a.points[i].usrCoords[2]));t.push(h),e.push(c),t.push(0),e.push(c),t.push(0),e.push(l)}else{for(b.X()<Z.X()?(r=b.X(),o=Z.X()):(r=Z.X(),o=b.X()),t=[r,r],e=[0,a.Y(r)],i=0;i<a.numberPoints;i++)r<=a.points[i].usrCoords[1]&&a.points[i].usrCoords[1]<=o&&(t.push(a.points[i].usrCoords[1]),e.push(a.points[i].usrCoords[2]));t.push(o),e.push(a.Y(o)),t.push(o),e.push(0),t.push(r),e.push(0)}this.dataX=t,this.dataY=e},m.addChild(y),v.addChild(y),b.addChild(y),Z.addChild(y),y.baseLeft=b,y.baseRight=Z,y.curveLeft=m,y.curveRight=v,y.methodMap=t.Z.deepCopy(y.methodMap,{curveLeft:"curveLeft",baseLeft:"baseLeft",curveRight:"curveRight",baseRight:"baseRight",Value:"Value"}),y.label=P,y},t.Z.createInequality=function(t,e,r){var n,a,l;if(l=s.Z.copyAttributes(r,t.options,"inequality"),e[0].elementClass===i.Z.OBJECT_CLASS_LINE)(a=t.create("curve",[[],[]],l)).hasPoint=function(){return!1},a.updateDataArray=function(){var r,n,a,l=t.getBoundingBox(),c=s.Z.evaluate(this.visProp.inverse),d=c?-1:1,u=1.5*Math.max(l[2]-l[0],l[1]-l[3]),p={coords:{usrCoords:[1,.5*(l[0]+l[2]),c?l[1]:l[3]]}},f=e[0].stdform.slice(1),_=f;a=1.5*Math.max(h.Z.perpendicular(e[0],p,t)[0].distance(i.Z.COORDS_BY_USER,p.coords),u),a*=d,p={coords:{usrCoords:[1,.5*(l[0]+l[2]),.5*(l[1]+l[3])]}},r=[1,(p=Math.abs(o.Z.innerProduct(p.coords.usrCoords,e[0].stdform,3))>=o.Z.eps?h.Z.perpendicular(e[0],p,t)[0].usrCoords:p.coords.usrCoords)[1]+f[1]*u,p[2]-f[0]*u],n=[1,p[1]-_[1]*u,p[2]+_[0]*u],this.dataX=[r[1],r[1]+f[0]*a,n[1]+_[0]*a,n[1],r[1]],this.dataY=[r[2],r[2]+f[1]*a,n[2]+_[1]*a,n[2],r[2]]};else if(e[0].elementClass===i.Z.OBJECT_CLASS_CURVE&&"functiongraph"===e[0].visProp.curvetype)(a=t.create("curve",[[],[]],l)).updateDataArray=function(){var t,i,r,o,n,a,h,l,c,d=this.board.getBoundingBox(),u=[],p=e[0].minX(),f=e[0].maxX(),_=.3*(d[1]-d[3]);if(t=s.Z.evaluate(this.visProp.inverse)?1:3,this.dataX=[],this.dataY=[],0!==(o=e[0].points.length))for(d[1]+=_,d[3]-=_,r=-1;r<o-1;){for(n=r+1,i=o;n<o;n++)if(e[0].points[n].isReal()){i=n;break}if(i>=o)break;for(n=i,r=o-1;n<o-1;n++)if(!e[0].points[n+1].isReal()){r=n;break}for(l=e[0].points[i].usrCoords[1],c=e[0].points[r].usrCoords[1],a=d[0]<p?p:d[0],h=d[2]>f?f:d[2],a=0===i?a:Math.max(a,l),h=r===o-1?h:Math.min(h,c),h=r===o-1?f:c,(u=[]).push([1,a=0===i?p:l,d[t]]),u.push([1,a,e[0].points[i].usrCoords[2]]),n=i;n<=r;n++)u.push(e[0].points[n].usrCoords);for(u.push([1,h,e[0].points[r].usrCoords[2]]),u.push([1,h,d[t]]),u.push(u[0]),n=0;n<u.length;n++)this.dataX.push(u[n][1]),this.dataY.push(u[n][2]);r<o-1&&(this.dataX.push(NaN),this.dataY.push(NaN))}},a.hasPoint=function(){return!1};else if(n=s.Z.createFunction(e[0]),a.addParentsFromJCFunctions([n]),!s.Z.exists(n))throw new Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]");return a.addParents(e[0]),a},t.Z.registerElement("arrowparallel",t.Z.createArrowParallel),t.Z.registerElement("bisector",t.Z.createBisector),t.Z.registerElement("bisectorlines",t.Z.createAngularBisectorsOfTwoLines),t.Z.registerElement("msector",t.Z.createMsector),t.Z.registerElement("circumcircle",t.Z.createCircumcircle),t.Z.registerElement("circumcirclemidpoint",t.Z.createCircumcenter),t.Z.registerElement("circumcenter",t.Z.createCircumcenter),t.Z.registerElement("incenter",t.Z.createIncenter),t.Z.registerElement("incircle",t.Z.createIncircle),t.Z.registerElement("integral",t.Z.createIntegral),t.Z.registerElement("midpoint",t.Z.createMidpoint),t.Z.registerElement("mirrorelement",t.Z.createMirrorElement),t.Z.registerElement("mirrorpoint",t.Z.createMirrorPoint),t.Z.registerElement("normal",t.Z.createNormal),t.Z.registerElement("orthogonalprojection",t.Z.createOrthogonalProjection),t.Z.registerElement("parallel",t.Z.createParallel),t.Z.registerElement("parallelpoint",t.Z.createParallelPoint),t.Z.registerElement("perpendicular",t.Z.createPerpendicular),t.Z.registerElement("perpendicularpoint",t.Z.createPerpendicularPoint),t.Z.registerElement("perpendicularsegment",t.Z.createPerpendicularSegment),t.Z.registerElement("reflection",t.Z.createReflection),t.Z.registerElement("inequality",t.Z.createInequality),t.Z.createGrid=function(e,r,n){const a=o.Z.eps,h=5e3;var l,c,d,u,p,f,_,g,m=[],b=[];if((d=r).length>2||d.length>=1&&"axis"!==d[0].elType||d.length>=2&&"axis"!==d[1].elType)throw new Error("JSXGraph: Can't create 'grid' with parent type '"+r[0].elType+"'. Possible parent types: [axis,axis]");return!s.Z.exists(d[0])&&s.Z.exists(e.defaultAxes)&&(d[0]=e.defaultAxes.x),!s.Z.exists(d[1])&&s.Z.exists(e.defaultAxes)&&(d[1]=e.defaultAxes.y),g=function(t,e,i,r,o,n,a){var h,l,c,d,u,p,f;switch(t.toLowerCase()){case".":case"point":return e.visProp.linecap="round",[[i,i,NaN],[r,r,NaN]];case"o":case"circle":return e.visProp.linecap="square",e.bezierDegree=3,[[i+o,i+o,i+(l=4*Math.tan(Math.PI/8)/3)*o,i,i-l*o,i-o,i-o,i-o,i-l*o,i,i+l*o,i+o,i+o,NaN],[r,r+l*n,r+n,r+n,r+n,r+l*n,r,r-l*n,r-n,r-n,r-n,r-l*n,r,NaN]];case"regpol":case"regularpolygon":for(e.visProp.linecap="round",d=s.Z.evaluate(e.visProp.polygonvertices),u=[[],[]],h=0;h<=2*Math.PI;h+=2*Math.PI/d)u[0].push(i-o*Math.sin(h)),u[1].push(r-n*Math.cos(h));return u[0].push(NaN),u[1].push(NaN),u;case"[]":case"square":return e.visProp.linecap="square",[[i-o,i+o,i+o,i-o,i-o,NaN],[r+n,r+n,r-n,r-n,r+n,NaN]];case"<>":case"diamond":return e.visProp.linecap="square",[[i,i+o,i,i-o,i,NaN],[r+n,r,r-n,r,r+n,NaN]];case"<<>>":case"diamond2":return e.visProp.linecap="square",[[i,i+(p=o*Math.sqrt(2)),i,i-p,i,NaN],[r+(f=n*Math.sqrt(2)),r,r-f,r,r+f,NaN]];case"x":case"cross":return[[i-o,i+o,NaN,i-o,i+o,NaN],[r+n,r-n,NaN,r-n,r+n,NaN]];case"+":case"plus":return[[i-o,i+o,NaN,i,i,NaN],[r,r,NaN,r-n,r+n,NaN]];case"-":case"minus":return[[i-o,i+o,NaN],[r,r,NaN]];case"|":case"divide":return[[i,i,NaN],[r-n,r+n,NaN]];case"^":case"a":case"A":case"triangleup":return[[i-o,i,i+o,NaN],[r-n,r,r-n,NaN]];case"v":case"triangledown":return[[i-o,i,i+o,NaN],[r+n,r,r+n,NaN]];case"<":case"triangleleft":return[[i+o,i,i+o,NaN],[r+n,r,r-n,NaN]];case">":case"triangleright":return[[i-o,i,i-o,NaN],[r+n,r,r-n,NaN]];case"line":return c=s.Z.evaluate(e.visProp.margin),[[i,i,NaN,a[0]-c/e.board.unitX,a[2]+c/e.board.unitX,NaN],[a[1]+c/e.board.unitY,a[3]-c/e.board.unitY,NaN,r,r,NaN]];default:return[[],[]]}},u=s.Z.copyAttributes(n,e.options,"grid"),s.Z.mergeAttr(e.options.grid,u.themes[u.theme],!1),u=s.Z.copyAttributes(n,e.options,"grid"),p=s.Z.copyAttributes(n,e.options,"grid","major"),s.Z.mergeAttr(p,u,!0),(l=e.create("curve",[[null],[null]],p)).elType="grid",l.type=i.Z.OBJECT_TYPE_GRID,f=s.Z.copyAttributes(n,e.options,"grid","minor"),s.Z.mergeAttr(f,u,!0),f.id===p.id&&(f.id=p.id+"_minor"),f.name===p.name&&(f.name=p.name+"_minor"),(c=e.create("curve",[[null],[null]],f)).elType="grid",c.type=i.Z.OBJECT_TYPE_GRID,l.minorGrid=c,c.majorGrid=l,l.hasPoint=function(){return!1},c.hasPoint=function(){return!1},l.inherits.push(c),l.updateDataArray=function(){var e,i,r,n,c,u,p=this.board.getBoundingBox(),f=s.Z.evaluate(this.visProp.gridx),v=s.Z.evaluate(this.visProp.gridy),Z=s.Z.evaluate(this.visProp.face),C=s.Z.evaluate(this.visProp.drawzero),y=!0===C||s.Z.isObject(C)&&!0===s.Z.evaluate(C.origin),P=!0===C||s.Z.isObject(C)&&!0===s.Z.evaluate(C.x),E=!0===C||s.Z.isObject(C)&&!0===s.Z.evaluate(C.y),O=s.Z.evaluate(this.visProp.includeboundaries),x=s.Z.evaluate(this.visProp.forcesquare);for(this.dataX=[],this.dataY=[],_=s.Z.evaluate(this.visProp.majorstep),s.Z.isArray(_)||(_=[_,_]),_.length<2&&(_=[_[0],_[0]]),s.Z.exists(f)&&(t.Z.deprecated("gridX","majorStep"),_[0]=f),s.Z.exists(v)&&(t.Z.deprecated("gridY","majorStep"),_[1]=v),"auto"===_[0]?(_[0]=1,s.Z.exists(d[0])&&(_[0]=d[0].ticks[0].getDistanceMajorTicks())):_[0]=s.Z.parseNumber(_[0],Math.abs(p[1]-p[3]),1/this.board.unitX),"auto"===_[1]?(_[1]=1,s.Z.exists(d[1])&&(_[1]=d[1].ticks[0].getDistanceMajorTicks())):_[1]=s.Z.parseNumber(_[1],Math.abs(p[0]-p[2]),1/this.board.unitY),"min"===x||!0===x?_[0]*this.board.unitX<=_[1]*this.board.unitY?_[1]=_[0]/this.board.unitY*this.board.unitX:_[0]=_[1]/this.board.unitX*this.board.unitY:"max"===x&&(_[0]*this.board.unitX<=_[1]*this.board.unitY?_[0]=_[1]/this.board.unitX*this.board.unitY:_[1]=_[0]/this.board.unitY*this.board.unitX),m=s.Z.evaluate(this.visProp.size),s.Z.isArray(m)||(m=[m,m]),m.length<2&&(m=[m[0],m[0]]),(s.Z.isNumber(m[0],!0)||m[0].indexOf("abs")>-1)&&(m[0]=(""+m[0]).replace(/\s+abs\s+/,"")+"px"),(s.Z.isNumber(m[1],!0)||m[1].indexOf("abs")>-1)&&(m[1]=(""+m[1]).replace(/\s+abs\s+/,"")+"px"),m[0]=s.Z.parseNumber(m[0],_[0],1/this.board.unitX),b[0]=m[0]/2,m[1]=s.Z.parseNumber(m[1],_[1],1/this.board.unitY),b[1]=m[1]/2,e=o.Z.roundToStep(p[0],_[0]),i=o.Z.roundToStep(p[1],_[1]),u=isFinite(e)&&isFinite(i)&&isFinite(p[2])&&isFinite(p[3])&&Math.abs(p[2])<Math.abs(_[0]*h)&&Math.abs(p[3])<Math.abs(_[1]*h),n=i;u&&n>=p[3];n-=_[1])for(r=e;u&&r<=p[2];r+=_[0])!y&&Math.abs(n)<a&&Math.abs(r)<a||!P&&Math.abs(n)<a&&Math.abs(r)>=a||!E&&Math.abs(r)<a&&Math.abs(n)>=a||!O&&(r<=p[0]+b[0]||r>=p[2]-b[0]||n<=p[3]+b[1]||n>=p[1]-b[1])||(c=g(Z,l,r,n,b[0],b[1],p),this.dataX=this.dataX.concat(c[0]),this.dataY=this.dataY.concat(c[1]))},c.updateDataArray=function(){var t,e,i,r,n,l,u,p,f,m,v,Z,C,y,P,E,O,x,w=this.board.getBoundingBox(),S=[],M=[],T=s.Z.evaluate(this.visProp.minorelements),N=s.Z.evaluate(this.visProp.size),A=s.Z.evaluate(this.visProp.face),D=s.Z.evaluate(this.visProp.drawzero),k=!0===D||s.Z.isObject(D)&&!0===s.Z.evaluate(D.x),L=!0===D||s.Z.isObject(D)&&!0===s.Z.evaluate(D.y),R=s.Z.evaluate(this.majorGrid.visProp.face),B=s.Z.evaluate(this.majorGrid.visProp.drawzero),I=!0===B||s.Z.isObject(B)&&!0===s.Z.evaluate(B.origin),Y=!0===B||s.Z.isObject(B)&&!0===s.Z.evaluate(B.x),j=!0===B||s.Z.isObject(B)&&!0===s.Z.evaluate(B.y),X=s.Z.evaluate(this.visProp.includeboundaries);for(this.dataX=[],this.dataY=[],s.Z.isArray(T)||(T=[T,T]),T.length<2&&(T=[T[0],T[0]]),s.Z.isNumber(T[0],!0)?T[0]=parseFloat(T[0]):(T[0]=0,s.Z.exists(d[0])&&(T[0]=s.Z.evaluate(d[0].getAttribute("ticks").minorticks))),S[0]=_[0]/(T[0]+1),s.Z.isNumber(T[1],!0)?T[1]=parseFloat(T[1]):(T[1]=0,s.Z.exists(d[1])&&(T[1]=s.Z.evaluate(d[1].getAttribute("ticks").minorticks))),S[1]=_[1]/(T[1]+1),s.Z.isArray(N)||(N=[N,N]),N.length<2&&(N=[N[0],N[0]]),N[0]=s.Z.parseNumber(N[0],S[0],1/this.board.unitX),N[1]=s.Z.parseNumber(N[1],S[1],1/this.board.unitY),M[0]=.5*N[0],M[1]=.5*N[1],t=o.Z.roundToStep(w[0],S[0]),e=o.Z.roundToStep(w[1],S[1]),l=isFinite(t)&&isFinite(e)&&isFinite(w[2])&&isFinite(w[3])&&Math.abs(w[2])<=Math.abs(S[0]*h)&&Math.abs(w[3])<Math.abs(S[1]*h),r=e;l&&r>=w[3];r-=S[1])for(i=t;l&&i<=w[2];i+=S[0]){if(u=o.Z.roundToStep(Math.abs(i),_[0]),u=Math.abs(u-Math.abs(i)),p=_[0]-u,f=o.Z.roundToStep(Math.abs(r),_[1]),f=Math.abs(f-Math.abs(r)),m=_[1]-f,"line"===R){if(u-M[0]-b[0]<a||p-M[0]-b[0]<a||f-M[1]-b[1]<a||m-M[1]-b[1]<a)continue}else if((u-M[0]-b[0]<a||p-M[0]-b[0]<a)&&(f-M[1]-b[1]<a||m-M[1]-b[1]<a)&&(I||b[1]-Math.abs(r)+M[1]<a||b[0]-Math.abs(i)+M[0]<a)&&(Y||b[1]-Math.abs(r)+M[1]<a||b[0]+Math.abs(i)-M[0]<a)&&(j||b[0]-Math.abs(i)+M[0]<a||b[1]+Math.abs(r)-M[1]<a))continue;!L&&Math.abs(i)<a||!k&&Math.abs(r)<a||(v=Math.abs(w[0]%_[0]),Z=Math.abs(w[1]%_[1]),C=Math.abs(w[2]%_[0]),y=Math.abs(w[3]%_[1]),P=_[0]-v,E=_[1]-Z,O=_[0]-C,x=_[1]-y,!X&&(i-M[0]-w[0]-b[0]+P<a&&P-b[0]<a||i-M[0]-w[0]-b[0]-v<a&&v-b[0]<a||-i-M[0]+w[2]-b[0]+O<a&&O-b[0]<a||-i-M[0]+w[2]-b[0]-C<a&&C-b[0]<a||-r-M[1]+w[1]-b[1]+E<a&&E-b[1]<a||-r-M[1]+w[1]-b[1]-Z<a&&Z-b[1]<a||r-M[1]-w[3]-b[1]+x<a&&x-b[1]<a||r-M[1]-w[3]-b[1]-y<a&&y-b[1]<a||-r-M[1]+w[1]<a||i-M[0]-w[0]<a||r-M[1]-w[3]<a||-i-M[0]+w[2]<a)||(n=g(A,c,i,r,M[0],M[1],w),this.dataX=this.dataX.concat(n[0]),this.dataY=this.dataY.concat(n[1])))}},e.grids.push(l),e.grids.push(c),l},t.Z.registerElement("grid",t.Z.createGrid),t.Z.createLocus=function(t,e,i){var r,o;if(!s.Z.isArray(e)||1!==e.length||!s.Z.isPoint(e[0]))throw new Error("JSXGraph: Can't create locus with parent of type other than point.\nPossible parent types: [point]");return o=e[0],(r=t.create("curve",[[null],[null]],i)).dontCallServer=!1,r.elType="locus",r.setParents([o.id]),r.updateDataArray=function(){var e,i,s;r.board.mode>0||(e=N.generatePolynomials(t,o,!0).join("|"))!==r.spe&&(r.spe=e,i=function(t,e,i,s){var o;r.dataX=t,r.dataY=e,r.eq=i,r.ctime=s,r.generatePolynomial=(o=i,function(t){var e,i="("+t.symbolic.x+")",s="("+t.symbolic.y+")",r=[];for(e=0;e<o.length;e++)r[e]=o[e].replace(/\*\*/g,"^").replace(/x/g,i).replace(/y/g,s);return r})},i((s=N.geometricLocusByGroebnerBase(t,o,i)).datax,s.datay,s.polynomial,s.exectime))},r},t.Z.registerElement("locus",t.Z.createLocus);__webpack_require__(573);t.Z.Image=function(e,r,o,n,a){this.constructor(e,o,i.Z.OBJECT_TYPE_IMAGE,i.Z.OBJECT_CLASS_OTHER),this.element=this.board.select(o.anchor),this.coordsConstructor(r),this.W=s.Z.createFunction(a[0],this.board,""),this.H=s.Z.createFunction(a[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*e.unitX),Math.abs(this.usrSize[1]*e.unitY)],this.url=n,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=t.Z.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H",setSize:"setSize"})},t.Z.Image.prototype=new H.Z,s.Z.copyPrototypeMethods(t.Z.Image,V.Z,"coordsConstructor"),t.Z.extend(t.Z.Image.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c,d,p,f,_=this.transformations.length;return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(h=this.board._inputDevice,l=s.Z.evaluate(this.visProp.precision[h])):l=this.board.options.precision.hasPoint,0===_?(r=t-this.coords.scrCoords[1],n=this.coords.scrCoords[2]-e,r>=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],c[1]-this.span[0][1],c[2]-this.span[0][2]],0<=(p=(f=o.Z.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(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]=o.Z.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(s.Z.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=s.Z.createFunction(t,this.board,""),this.H=s.Z.createFunction(e,this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}),t.Z.createImage=function(e,i,r){var o,n,a=i[0],h=i[1],l=i[2];if(o=s.Z.copyAttributes(r,e.options,"image"),!(n=V.Z.create(t.Z.Image,e,h,o,a,l)))throw new Error("JSXGraph: Can't create image with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==o.rotate&&n.addRotation(o.rotate),n},t.Z.registerElement("image",t.Z.createImage);t.Z.Image;t.Z.createSlider=function(t,e,r){var n,a,h,l,c,d,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M;return P=(M=s.Z.copyAttributes(r,t.options,"slider")).withticks,y=M.withlabel,x=M.snapwidth,E=M.snapvalues,O=M.snapvaluedistance,p=t.create("point",e[0],M.point1),f=t.create("point",e[1],M.point2),(g=t.create("segment",[p,f],M.baseline)).updateStdform(),n=p.coords.usrCoords.slice(1),a=f.coords.usrCoords.slice(1),h=e[2][0],l=e[2][1],c=e[2][2],d=c-h,S=-1===(w=s.Z.evaluate(x))?l:Math.round(l/w)*w,Z=n[0]+(a[0]-n[0])*(S-h)/(c-h),C=n[1]+(a[1]-n[1])*(S-h)/(c-h),M.withLabel=!1,(_=t.create("glider",[Z,C,g],M)).setAttribute({snapwidth:x,snapvalues:E,snapvaluedistance:O}),m=t.create("segment",[p,_],M.highline),_.Value=function(){var t=this._smax-this._smin,e=s.Z.evaluate(this.visProp.snapwidth);return-1===e?this.position*t+this._smin:Math.round((this.position*t+this._smin)/e)*e},_.methodMap=s.Z.deepCopy(_.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"}),_._smax=c,_._smin=h,_.setMax=function(t){return this._smax=t,this},_.setValue=function(t){var e=this._smax-this._smin;return Math.abs(e)>o.Z.eps?this.position=(t-this._smin)/e:this.position=0,this.position=Math.max(0,Math.min(1,this.position)),this},_.setMin=function(t){return this._smin=t,this},y&&(v=t.create("text",[function(){return.05*(f.X()-p.X())+f.X()},function(){return.05*(f.Y()-p.Y())+f.Y()},function(){var t,e=s.Z.evaluate(_.visProp.digits),i=s.Z.evaluate(_.visProp.suffixlabel),r=s.Z.evaluate(_.visProp.unitlabel),o=s.Z.evaluate(_.visProp.postlabel);return 2===e&&2!==s.Z.evaluate(_.visProp.precision)&&(e=s.Z.evaluate(_.visProp.precision)),t=null!==i?i:_.name&&""!==_.name?_.name+" = ":"",_.useLocale()?t+=_.formatNumberLocale(_.Value(),e):t+=s.Z.toFixed(_.Value(),e),null!==r&&(t+=r),null!==o&&(t+=o),t}],M.label),_.label=v,_.visProp.withlabel=!0,_.hasLabel=!0),_.point1=p,_.point2=f,_.baseline=g,_.highline=m,P&&(s.Z.exists(M.generatelabeltext)||(M.ticks.generateLabelText=function(t,e,i){var s=_.point1.Dist(_.point2),r=_._smin,n=_._smax,a=this.getDistanceFromZero(e,t)*(n-r)/s+r;return s<o.Z.eps||Math.abs(a)<o.Z.eps?"0":this.formatLabelText(a)}),2,b=t.create("ticks",[_.baseline,_.point1.Dist(p)/2,function(t){var e=_.point1.Dist(_.point2),s=_.point1.coords.distance(i.Z.COORDS_BY_USER,t);return e<o.Z.eps?0:s/e*d+h}],M.ticks),_.ticks=b),_.remove=function(){y&&t.removeObject(v),t.removeObject(m),t.removeObject(g),t.removeObject(f),t.removeObject(p),$.prototype.remove.call(_)},p.dump=!1,f.dump=!1,g.dump=!1,m.dump=!1,y&&(v.dump=!1),_.elType="slider",_.parents=e,_.subs={point1:p,point2:f,baseLine:g,highLine:m},_.inherits.push(p,f,g,m),P&&(b.dump=!1,_.subs.ticks=b,_.inherits.push(b)),_.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]]},_.baseline.on("up",(function(t){var e,r;s.Z.evaluate(_.visProp.moveonup)&&!s.Z.evaluate(_.visProp.fixed)&&(e=g.board.getMousePosition(t,0),r=new u.Z(i.Z.COORDS_BY_SCREEN,e,this.board),_.moveTo([r.usrCoords[1],r.usrCoords[2]]),_.triggerEventHandlers(["drag"],[t]))})),_.prepareUpdate().update(),t.isSuspendedUpdate||(_.updateVisibility().updateRenderer(),_.baseline.updateVisibility().updateRenderer(),_.highline.updateVisibility().updateRenderer(),P&&_.ticks.updateVisibility().updateRenderer()),_},t.Z.registerElement("slider",t.Z.createSlider),t.Z.PrefixParser={parse:function(t,e){var i,r,n,a,h,l;if(s.Z.isNumber(t)||s.Z.isString(t))return t;if(!s.Z.isArray(t)||t.length<2)throw new Error("prefixParser.parse: term is not an array, number or string");if(i=t[0],n=t.length,"execute"===e)if(s.Z.isInArray(["+","-","*","/"],i))for(a=this.parse(t[1],e),r=2;r<n;r++)switch(l=this.parse(t[r],e),i){case"+":a+=l;break;case"-":a-=l;break;case"*":a*=l;break;case"/":a/=l}else if("exec"===i){for(h=t[1],l=[],r=2;r<n;r++)l.push(this.parse(t[r],e));if(s.Z.exists(Math[h]))a=Math[h].apply(this,l);else{if(!s.Z.exists(o.Z[h]))throw new Error("PrefixParser.parse: "+h+" is not allowed");a=o.Z[h].apply(this,l)}}else{if("V"===(h=t[0])&&(h="Value"),!s.Z.exists(t[1][h]))throw new Error("PrefixParser.parse: "+h+" is not a method of "+t[1]);for(l=[],r=2;r<n;r++)l.push(this.parse(t[r],e));a=t[1][h].apply(t[1],l)}return a},dimension:function(t){var e,r,o,n,a,h,l,c;if(s.Z.isNumber(t))return 0;if(!s.Z.isArray(t)||t.length<2)throw new Error("PrefixParser.dimension: term is not an array");if(e=t[0],o=t.length,s.Z.isInArray(["+","-","*","/"],e))for(n=this.dimension(t[1]),r=2;r<o;r++)switch(l=this.dimension(t[r]),e){case"+":case"-":l!==n&&(n=NaN);break;case"*":n+=l;break;case"/":n-=l}else if("exec"===e)t[2].type===s.Z.OBJECT_TYPE_MEASUREMENT?(n=t[2].Dimension(),s.Z.exists(t[2].visProp.dim)&&null!==(h=s.Z.evaluate(t[2].visProp.dim))&&(n=h)):n=0;else switch(a=t[0]){case"L":case"Length":case"Perimeter":case"Radius":case"R":n=1;break;case"Area":case"A":n=2;break;default:t[1].type===s.Z.OBJECT_TYPE_MEASUREMENT?(n=t[1].Dimension(),s.Z.exists(t[1].visProp.dim)&&null!==(h=s.Z.evaluate(t[1].visProp.dim))&&(n=h)):(n=0,"Value"!==a&&"V"!==a||[i.Z.OBJECT_TYPE_ARC,i.Z.OBJECT_TYPE_SECTOR,i.Z.OBJECT_TYPE_ANGLE].indexOf(t[1].type)>=0&&(c="",3===t.length&&s.Z.isString(t[2])&&(c=t[2].toLowerCase()),n=""===c?t[1].type===i.Z.OBJECT_TYPE_ANGLE?0:1:0===c.indexOf("len")?1:0))}return n},toPrefix:function(t){var e,i,r,o;if(s.Z.isNumber(t))return t;if(!s.Z.isArray(t)||t.length<2)throw new Error("PrefixParser.toPrefix: term is not an array");for(e=t[0],r=t.length,o=[e],i=1;i<r;i++)s.Z.isInArray(["+","-","*","/"],e)?o.push(this.toPrefix(t[i])):"V"===e&&t[i].type===s.Z.OBJECT_TYPE_MEASUREMENT?o=t[i].toPrefix():"exec"===e?1===i?o.push(t[i]):o.push(this.toPrefix(t[i])):o=[e,t[i].id];return o},getParents:function(t){var e,i,r,o;if(s.Z.isNumber(t))return[];if(!s.Z.isArray(t)||t.length<2)throw new Error("PrefixParser.getParents: term is not an array");for(e=t[0],r=t.length,o=[],i=1;i<r;i++)s.Z.isInArray(["+","-","*","/"],e)?o=o.concat(this.getParents(t[i])):"V"===e&&t[i].type===s.Z.OBJECT_TYPE_MEASUREMENT?o=o.concat(t[i].getParents()):"exec"===e?i>1&&(o=o.concat(this.getParents(t[i]))):o.push(t[i]);return o}};var Q=t.Z.PrefixParser;t.Z.createTapemeasure=function(e,i,r){var o,n,a,h,l,c,d,u,p,f;return o=i[0],n=i[1],a=s.Z.copyAttributes(r,e.options,"tapemeasure","point1"),d=e.create("point",o,a),a=s.Z.copyAttributes(r,e.options,"tapemeasure","point2"),u=e.create("point",n,a),d.setAttribute({ignoredSnapToPoints:[u]}),u.setAttribute({ignoredSnapToPoints:[d]}),a=s.Z.copyAttributes(r,e.options,"tapemeasure"),h=a.withticks,l=a.withlabel,2===a.digits&&2!==a.precision&&a.precision,l&&(a.withlabel=!0),c=e.create("segment",[d,u],a),l&&(p=r.name&&""!==r.name?r.name+" = ":"",c.label.setText((function(){var t=s.Z.evaluate(c.label.visProp.digits);return c.label.useLocale()?p+c.label.formatNumberLocale(d.Dist(u),t):p+s.Z.toFixed(d.Dist(u),t)}))),h&&(a=s.Z.copyAttributes(r,e.options,"tapemeasure","ticks"),f=e.create("ticks",[c,.1],a),c.inherits.push(f)),c.remove=function(){h&&c.removeTicks(f),e.removeObject(u),e.removeObject(d),H.Z.prototype.remove.call(this)},c.Value=function(){return d.Dist(u)},d.dump=!1,u.dump=!1,c.elType="tapemeasure",c.getParents=function(){return[[d.X(),d.Y()],[u.X(),u.Y()]]},c.subs={point1:d,point2:u},h&&(f.dump=!1),c.methodMap=t.Z.deepCopy(c.methodMap,{Value:"Value"}),c.prepareUpdate().update(),e.isSuspendedUpdate||(c.updateVisibility().updateRenderer(),c.point1.updateVisibility().updateRenderer(),c.point2.updateVisibility().updateRenderer()),c},t.Z.registerElement("tapemeasure",t.Z.createTapemeasure),t.Z.createMeasurement=function(t,e,i){var r,o,n,a,h,l;for(o=s.Z.copyAttributes(i,t.options,"measurement"),n=e[0],a=e[1],h=e[2],(r=t.create("text",[n,a,""],o)).type=s.Z.OBJECT_TYPE_MEASUREMENT,r.elType="measurement",r.Value=function(){return Q.parse(h,"execute")},r.Dimension=function(){var t=s.Z.evaluate(r.visProp.dim);return null!==t?t:Q.dimension(h)},r.Unit=function(){let t="",e=s.Z.evaluate(r.visProp.units),i=r.Dimension();return s.Z.isObject(e)&&s.Z.exists(e[i])&&!1!==e[i]?t=s.Z.evaluate(e[i]):s.Z.isObject(e)&&s.Z.exists(e["dim"+i])&&!1!==e["dim"+i]?t=s.Z.evaluate(e["dim"+i]):(t=s.Z.evaluate(r.visProp.baseunit),0===i?t="":i>1&&""!==t&&(t=t+"^{"+i+"}")),t},r.getTerm=function(){return h},r.toPrefix=function(){return Q.toPrefix(h)},r.getParents=function(){return Q.getParents(h)},r.addParents(r.getParents()),l=0;l<r.parents.length;l++)t.select(r.parents[l]).addChild(r);return r.setText((function(){var t,e="",i="",o=r.Dimension(),n=s.Z.evaluate(r.visProp.digits),a=r.Unit(),h=r.Value();if(s.Z.evaluate(r.visProp.showprefix)&&(e=r.visProp.formatprefix.apply(r,[s.Z.evaluate(r.visProp.prefix)])),s.Z.evaluate(r.visProp.showsuffix)&&(i=r.visProp.formatsuffix.apply(r,[s.Z.evaluate(r.visProp.suffix)])),s.Z.isNumber(h))"none"===n||(h="auto"===n?r.useLocale()?r.formatNumberLocale(h):s.Z.autoDigits(h):r.useLocale()?r.formatNumberLocale(h,n):s.Z.toFixed(h,n));else if(s.Z.isArray(h))for(t=0;t<h.length;t++)s.Z.isNumber(h[t])&&("none"===n||("auto"===n?r.useLocale()?h[t]=r.formatNumberLocale(h[t]):h[t]=s.Z.autoDigits(h[t]):r.useLocale()?h[t]=r.formatNumberLocale(h[t],n):h[t]=s.Z.toFixed(h[t],n)));return"coords"===o&&s.Z.isArray(h)&&(2===h.length&&h.unshift(void 0),h=r.visProp.formatcoords.apply(r,[h[1],h[2],h[0]])),"direction"===o&&s.Z.isArray(h)&&(2===h.length&&h.unshift(void 0),h=r.visProp.formatdirection.apply(r,[h[1],h[2]])),s.Z.isString(o)?e+h+i:isNaN(o)?e+"NaN"+i:e+h+a+i})),r.methodMap=s.Z.deepCopy(r.methodMap,{Value:"Value",Dimension:"Dimension",Unit:"Unit",getTerm:"getTerm",Term:"getTerm",getTermPrefix:"getTermPrefix",TermPrefix:"getTermPrefix",getParents:"getParents",Parents:"getParents"}),r},t.Z.registerElement("measurement",t.Z.createMeasurement),t.Z.DataSource=function(){return this.data=[],this.columnHeaders=[],this.rowHeaders=[],this},t.Z.extend(t.Z.DataSource.prototype,{loadFromArray:function(t,e,i){var r,o,n;if(s.Z.isArray(e)&&(this.columnHeaders=e,e=!1),s.Z.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),s.Z.exists(t)){for(this.data=[],r=0;r<t.length;r++)for(this.data[r]=[],o=0;o<t[r].length;o++)n=t[r][o],parseFloat(n).toString()===n?this.data[r][o]=parseFloat(n):this.data[r][o]="-"!==n?n: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},loadFromTable:function(t,e,i){var r,o,n,a,h;if(s.Z.isArray(e)&&(this.columnHeaders=e,e=!1),s.Z.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),t=document.getElementById(t),s.Z.exists(t)){for(r=t.getElementsByTagName("tr"),this.data=[],o=0;o<r.length;o++)for(a=r[o].getElementsByTagName("td"),this.data[o]=[],n=0;n<a.length;n++)h=a[n].innerHTML,parseFloat(h).toString()===h?this.data[o][n]=parseFloat(h):this.data[o][n]="-"!==h?h:NaN;if(e&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),i)for(this.rowHeaders=[],o=0;o<this.data.length;o++)this.rowHeaders.push(this.data[o][0]),this.data[o]=this.data[o].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(s.Z.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(s.Z.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 tt=t.Z.DataSource;t.Z.Chart=function(t,e,i){var r,o,n,a,h,l;if(this.constructor(t,i),!s.Z.isArray(e)||0===e.length)throw new Error("JSXGraph: Can't create a chart without data");if(this.elements=[],s.Z.isNumber(e[0]))for(o=e,r=[],n=0;n<o.length;n++)r[n]=n+1;else if(1===e.length&&s.Z.isArray(e[0]))for(o=e[0],r=[],l=s.Z.evaluate(o).length,n=0;n<l;n++)r[n]=n+1;else 2===e.length&&(l=Math.min(e[0].length,e[1].length),r=e[0].slice(0,l),o=e[1].slice(0,l));if(s.Z.isArray(o)&&0===o.length)throw new Error("JSXGraph: Can't create charts without data.");for(h=i.chartstyle.replace(/ /g,"").split(","),n=0;n<h.length;n++){switch(h[n]){case"bar":a=this.drawBar(t,r,o,i);break;case"line":a=this.drawLine(t,r,o,i);break;case"fit":a=this.drawFit(t,r,o,i);break;case"spline":a=this.drawSpline(t,r,o,i);break;case"pie":a=this.drawPie(t,o,i);break;case"point":a=this.drawPoints(t,r,o,i);break;case"radar":a=this.drawRadar(t,e,i)}this.elements.push(a)}return this.id=this.board.setId(this,"Chart"),this.elements},t.Z.Chart.prototype=new H.Z,t.Z.extend(t.Z.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",[d.Z.regressionPolynomial(r,e,i)],s)},drawBar:function(t,e,i,r){var o,n,a,h,l,c,d,u,p,f,_=[],g=[],m=function(t,i){return function(){return e[t]()-i*a}},b={fixed:!0,withLabel:!1,visible:!1,name:""};if((p=s.Z.copyAttributes(r,t.options,"chart"))&&p.width)a=p.width;else{if(e.length<=1)a=1;else for(a=e[1]-e[0],o=1;o<e.length-1;o++)a=e[o+1]-e[o]<a?e[o+1]-e[o]:a;a*=.8}for(f=s.Z.copyAttributes(r,t.options,"chart","label"),o=0;o<e.length;o++)s.Z.isFunction(e[o])?(h=m(o,-.5),l=m(o,0),c=m(o,.5)):(h=e[o]-.5*a,l=e[o],c=e[o]+.5*a),d=s.Z.isFunction(i[o])?i[o]():i[o],d=i[o],"horizontal"===p.dir?(g[0]=t.create("point",[0,h],b),g[1]=t.create("point",[d,h],b),g[2]=t.create("point",[d,c],b),g[3]=t.create("point",[0,c],b),s.Z.exists(p.labels)&&s.Z.exists(p.labels[o])&&(f.anchorY="middle",(n=t.create("text",[d,l,p.labels[o]],f)).visProp.anchorx=function(t){return function(){return t.X()>=0?"left":"right"}}(n))):(g[0]=t.create("point",[h,0],b),g[1]=t.create("point",[h,d],b),g[2]=t.create("point",[c,d],b),g[3]=t.create("point",[c,0],b),s.Z.exists(p.labels)&&s.Z.exists(p.labels[o])&&(f.anchorX="middle",(n=t.create("text",[l,d,p.labels[o]],f)).visProp.anchory=function(t){return function(){return t.Y()>=0?"bottom":"top"}}(n))),s.Z.isArray(p.colors)&&(u=p.colors,p.fillcolor=u[o%u.length]),_[o]=t.create("polygon",g,p),s.Z.exists(p.labels)&&s.Z.exists(p.labels[o])&&(_[o].text=n);return _},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,r){var o,n,a=[],h=[],l=(p.Z.sum(e),r.colors),c=r.highlightcolors,d=r.labels,f=r.radius||4,_=f,g=r.center||[0,0],m=g[0],b=g[1],v=function(t,i,r){return function(){var o,n,a,h=0;for(n=0;n<=t;n++)h+=parseFloat(s.Z.evaluate(e[n]));for(o=h,n=t+1;n<e.length;n++)o+=parseFloat(s.Z.evaluate(e[n]));return a=0!==o?2*Math.PI*h/o:0,_()*Math[i](a)+r}},Z=function(t,e){var r=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],o=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];s.Z.exists(this.label)&&(this.label.rendNode.style.fontSize=e*s.Z.evaluate(this.label.visProp.fontsize)+"px",this.label.fullUpdate()),this.point2.coords=new u.Z(i.Z.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+r*t,this.point1.coords.usrCoords[2]+o*t],this.board),this.fullUpdate()},C=function(){this.highlighted||(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this),Z.call(this,1.1,2))},y=function(){this.highlighted&&(this.highlighted=!1,this.board.renderer.noHighlight(this),Z.call(this,.9090909,1))},P={fixed:!0,withLabel:!1,visible:!1,name:""};if(!s.Z.isArray(d))for(d=[],o=0;o<e.length;o++)d[o]="";for(s.Z.isFunction(f)||(_=function(){return f}),r.highlightonsector=r.highlightonsector||!1,r.straightfirst=!1,r.straightlast=!1,n=t.create("point",[m,b],P),a[0]=t.create("point",[function(){return _()+m},function(){return b}],P),o=0;o<e.length;o++)a[o+1]=t.create("point",[v(o,"cos",m),v(o,"sin",b)],P),r.name=d[o],r.withlabel=""!==r.name,r.fillcolor=l&&l[o%l.length],r.labelcolor=l&&l[o%l.length],r.highlightfillcolor=c&&c[o%c.length],h[o]=t.create("sector",[n,a[o],a[o+1]],r),r.highlightonsector&&(h[o].hasPoint=h[o].hasPointSector),r.highlightbysize&&(h[o].highlight=C,h[o].noHighlight=y);return{sectors:h,points:a,midpoint:n}},drawRadar:function(e,r,o){var n,a,h,l,c,d,p,f,_,g,m,b,v,Z,C,y,P,E,O,x,w,S,M,T,N,A,D,k,L,R,B,I,Y,j,X,U,F,z,J,G,W,H,V=r.length,$=function(){var t,e,r,o,n=s.Z.evaluate(this.visProp.label.offset).slice(0);return t=this.point1.X(),e=this.point2.X(),r=this.point1.Y(),o=this.point2.Y(),e<t&&(n[0]=-n[0]),o<r&&(n[1]=-n[1]),this.setLabelRelativeCoords(n),new u.Z(i.Z.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},K=function(t,i){var s,r,o;return s=e.create("transform",[-(C[i]-v[i]),0],{type:"translate"}),r=e.create("transform",[O/(y[i]+Z[i]-(C[i]-v[i])),1],{type:"scale"}),s.melt(r),o=e.create("transform",[t],{type:"rotate"}),s.melt(o),s};if(V<=0)throw new Error("JSXGraph radar chart: no data");if(h=o.paramarray,!s.Z.exists(h))throw new Error("JSXGraph radar chart: need paramArray attribute");if((l=h.length)<=1)throw new Error("JSXGraph radar chart: need more than one param in paramArray");for(n=0;n<V;n++)if(l!==r[n].length)throw new Error("JSXGraph radar chart: use data length equal to number of params ("+r[n].length+" != "+l+")");for(c=[],d=[],a=0;a<l;a++)c[a]=r[0][a],d[a]=c[a];for(n=1;n<V;n++)for(a=0;a<l;a++)r[n][a]>c[a]&&(c[a]=r[n][a]),r[n][a]<d[a]&&(d[a]=r[n][a]);for(p=[],f=[],n=0;n<V;n++)p[n]="",f[n]=[];for(_=[],g=[],m=o.startshiftratio||0,b=o.endshiftratio||0,n=0;n<l;n++)_[n]=(c[n]-d[n])*m,g[n]=(c[n]-d[n])*b;if(v=o.startshiftarray||_,Z=o.endshiftarray||g,C=o.startarray||d,s.Z.exists(o.start))for(n=0;n<l;n++)C[n]=o.start;if(y=o.endarray||c,s.Z.exists(o.end))for(n=0;n<l;n++)y[n]=o.end;if(v.length!==l)throw new Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(Z.length!==l)throw new Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(C.length!==l)throw new Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(y.length!==l)throw new Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(P=o.labelarray||p,E=o.colors,o.highlightcolors,O=o.radius||10,W=o.strokewidth||1,s.Z.exists(o.highlightonsector)||(o.highlightonsector=!1),x={name:o.name,id:o.id,strokewidth:W,polystrokewidth:o.polystrokewidth||W,strokecolor:o.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:o.fillColor||"#FFFF88",fillopacity:o.fillOpacity||.4,highlightfillcolor:o.highlightFillColor||"#FF7400",highlightstrokecolor:o.highlightStrokeColor||"black",gradient:o.gradient||"none"},S=(w=o.center||[0,0])[0],M=w[1],T=e.create("point",[S,M],{name:"",fixed:!0,withlabel:!1,visible:!1}),Math.PI/2-Math.PI/l,A=N=o.startangle||0,D=[],k=[],n=0;n<l;n++)for(A+=2*Math.PI/l,R=O*Math.cos(A)+S,B=O*Math.sin(A)+M,D[n]=e.create("point",[R,B],{name:"",fixed:!0,withlabel:!1,visible:!1}),k[n]=e.create("line",[T,D[n]],{name:h[n],strokeColor:x.strokecolor,strokeWidth:x.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:x.highlightstrokecolor}),k[n].getLabelAnchor=$,L=K(A,n),a=0;a<r.length;a++)H=r[a][n],f[a][n]=e.create("point",[H,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),f[a][n].addTransform(f[a][n],L);for(I=[],n=0;n<V;n++)for(x.labelcolor=E&&E[n%E.length],x.strokecolor=E&&E[n%E.length],x.fillcolor=E&&E[n%E.length],I[n]=e.create("polygon",f[n],{withLines:!0,withLabel:!1,fillColor:x.fillcolor,fillOpacity:x.fillopacity,highlightFillColor:x.highlightfillcolor}),a=0;a<l;a++)I[n].borders[a].setAttribute("strokecolor:"+E[n%E.length]),I[n].borders[a].setAttribute("strokewidth:"+x.polystrokewidth);switch(o.legendposition||"none"){case"right":j=o.legendleftoffset||2,X=o.legendtopoffset||1,this.legend=e.create("legend",[S+O+j,M+O-X],{labels:P,colors:E});break;case"none":break;default:t.Z.debug("Unknown legend position")}if(Y=[],o.showcircles){for(U=[],n=0;n<6;n++)U[n]=20*n;if(U[0]="0",(z=(F=o.circlelabelarray||U).length)<2)throw new Error("JSXGraph radar chart: too less circles in circleLabelArray");for(J=[],L=K(N+Math.PI/l,0),x.fillcolor="none",x.highlightfillcolor="none",x.strokecolor=o.strokecolor||"black",x.strokewidth=o.circlestrokewidth||.5,x.layer=0,G=(y[0]-C[0])/(z-1),n=0;n<z;n++)J[n]=e.create("point",[C[0]+n*G,0],{name:F[n],size:0,fixed:!0,withLabel:!0,visible:!0}),J[n].addTransform(J[n],L),Y[n]=e.create("circle",[T,J[n]],x)}return this.rendNode=I[0].rendNode,{circles:Y,lines:k,points:f,midpoint:T,polygons:I}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){return this}}),t.Z.createChart=function(i,r,o){var n,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C,y=[],P=e.Z.isBrowser?i.document.getElementById(r[0]):null;if(1===r.length&&s.Z.isString(r[0])){if(s.Z.exists(P)){if(f=s.Z.copyAttributes(o,i.options,"chart"),n=(P=(new tt).loadFromTable(r[0],f.withheaders,f.withheaders)).data,c=P.columnHeaders,a=P.rowHeaders,_=f.width,g=f.name,m=f.strokecolor,b=f.fillcolor,v=f.highlightstrokecolor,Z=f.highlightfillcolor,i.suspendUpdate(),C=n.length,p=[],f.rows&&s.Z.isArray(f.rows)){for(h=0;h<C;h++)for(l=0;l<f.rows.length;l++)if(f.rows[l]===h||f.withheaders&&f.rows[l]===a[h]){p.push(n[h]);break}}else p=n;for(C=p.length,h=0;h<C;h++){if(u=[],f.chartstyle&&-1!==f.chartstyle.indexOf("bar")){for(d=_||.8,u.push(1-d/2+(h+.5)*d/C),l=1;l<p[h].length;l++)u.push(u[l-1]+1);f.width=d/C}g&&g.length===C?f.name=g[h]:f.withheaders&&(f.name=c[h]),m&&m.length===C?f.strokecolor=m[h]:f.strokecolor=Y.Z.hsv2rgb((h+1)/C*360,.9,.6),b&&b.length===C?f.fillcolor=b[h]:f.fillcolor=Y.Z.hsv2rgb((h+1)/C*360,.9,1),v&&v.length===C?f.highlightstrokecolor=v[h]:f.highlightstrokecolor=Y.Z.hsv2rgb((h+1)/C*360,.9,1),Z&&Z.length===C?f.highlightfillcolor=Z[h]:f.highlightfillcolor=Y.Z.hsv2rgb((h+1)/C*360,.9,.6),f.chartstyle&&-1!==f.chartstyle.indexOf("bar")?y.push(new t.Z.Chart(i,[u,p[h]],f)):y.push(new t.Z.Chart(i,[p[h]],f))}i.unsuspendUpdate()}return y}return f=s.Z.copyAttributes(o,i.options,"chart"),new t.Z.Chart(i,r,f)},t.Z.registerElement("chart",t.Z.createChart),t.Z.Legend=function(t,e,r){var o;if(this.constructor(),o=s.Z.copyAttributes(r,t.options,"legend"),this.board=t,this.coords=new u.Z(i.Z.COORDS_BY_USER,e,this.board),this.myAtts={},this.label_array=o.labelarray||o.labels,this.color_array=o.colorarray||o.colors,this.lines=[],this.myAtts.strokewidth=o.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.myAtts.fixed=!0,this.style=o.legendstyle||o.style,"vertical"!==this.style)throw new Error("JSXGraph: Unknown legend style: "+this.style);this.drawVerticalLegend(t,o)},t.Z.Legend.prototype=new H.Z,t.Z.Legend.prototype.drawVerticalLegend=function(t,e){var r,o=e.linelength||1,n=(e.rowheight||20)/this.board.unitY,a=function(){return this.setLabelRelativeCoords(this.visProp.label.offset),new u.Z(i.Z.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)};for(r=0;r<this.label_array.length;r++)this.myAtts.name=this.label_array[r],this.myAtts.strokecolor=this.color_array[r%this.color_array.length],this.myAtts.highlightstrokecolor=this.color_array[r%this.color_array.length],this.myAtts.label={offset:[10,0],strokeColor:this.color_array[r%this.color_array.length],strokeWidth:this.myAtts.strokewidth},this.lines[r]=t.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-r*n],[this.coords.usrCoords[1]+o,this.coords.usrCoords[2]-r*n]],this.myAtts),this.lines[r].getLabelAnchor=a,this.lines[r].prepareUpdate().update().updateVisibility(s.Z.evaluate(this.lines[r].visProp.visible)).updateRenderer()},t.Z.createLegend=function(e,i,r){var o=[0,0];if(!s.Z.exists(i)||2!==i.length)throw new Error("JSXGraph: Legend element needs two numbers as parameters");return o=i,new t.Z.Legend(e,o,r)},t.Z.registerElement("legend",t.Z.createLegend);t.Z.Chart,t.Z.Legend;t.Z.Transformation=function(t,e,s){this.elementClass=i.Z.OBJECT_CLASS_OTHER,this.type=i.Z.OBJECT_TYPE_TRANSFORMATION,this.matrix=[[1,0,0],[0,1,0],[0,0,1]],this.board=t,this.isNumericMatrix=!1,this.setMatrix(t,e,s),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bindTo",melt:"melt"}},t.Z.Transformation.prototype={},t.Z.extend(t.Z.Transformation.prototype,{update:function(){return this},setMatrix:function(t,e,i){var r;for(this.isNumericMatrix=!0,r=0;r<i.length;r++)if("number"!=typeof i[r]){this.isNumericMatrix=!1;break}if("translate"===e){if(2!==i.length)throw new Error("JSXGraph: translate transformation needs 2 parameters.");this.evalParam=s.Z.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=s.Z.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=s.Z.createEvalFunction(t,i,4)),this.update=function(){var t,e,s,r,n,a,h,l;1===i.length?h=i[0].stdform:2===i.length?h=o.Z.crossProduct(i[1].coords.usrCoords,i[0].coords.usrCoords):4===i.length&&(h=o.Z.crossProduct([1,this.evalParam(2),this.evalParam(3)],[1,this.evalParam(0),this.evalParam(1)])),t=h[1],e=h[2],a=(l=[-(s=h[0])*t,-s*e,t*t+e*e])[2],r=l[0]/l[2],n=l[1]/l[2],t=-h[2],e=h[1],this.matrix[1][1]=(t*t-e*e)/a,this.matrix[1][2]=2*t*e/a,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])-n*this.matrix[1][2],this.matrix[2][0]=n*(1-this.matrix[2][2])-r*this.matrix[2][1]};else if("rotate"===e)3===i.length?this.evalParam=s.Z.createEvalFunction(t,i,3):i.length>0&&i.length<=2&&(this.evalParam=s.Z.createEvalFunction(t,i,1),2!==i.length||s.Z.isArray(i[1])||(i[1]=t.select(i[1]))),this.update=function(){var t,e,r=this.evalParam(0),o=Math.cos(r),n=Math.sin(r);this.matrix[1][1]=o,this.matrix[1][2]=-n,this.matrix[2][1]=n,this.matrix[2][2]=o,i.length>1&&(3===i.length?(t=this.evalParam(1),e=this.evalParam(2)):s.Z.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-o)+e*n,this.matrix[2][0]=e*(1-o)-t*n)};else if("shear"===e){if(2!==i.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=s.Z.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=s.Z.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)}}},apply:function(t,e){return this.update(),s.Z.exists(e)?o.Z.matVecMult(this.matrix,t.initialCoords.usrCoords):o.Z.matVecMult(this.matrix,t.coords.usrCoords)},applyOnce:function(t){var e,r,n;for(s.Z.isArray(t)||(t=[t]),r=t.length,n=0;n<r;n++)this.update(),e=o.Z.matVecMult(this.matrix,t[n].coords.usrCoords),t[n].coords.setCoordinates(i.Z.COORDS_BY_USER,e)},bindTo:function(t){var e,i;if(s.Z.isArray(t))for(i=t.length,e=0;e<i;e++)t[e].transformations.push(this);else t.transformations.push(this)},setProperty:function(e){t.Z.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){var e,i,s,r,o,n,a=[];for(i=t.matrix.length,s=this.matrix[0].length,e=0;e<i;e++)a[e]=[];for(this.update(),t.update(),e=0;e<i;e++)for(n=0;n<s;n++){for(o=0,r=0;r<i;r++)o+=t.matrix[e][r]*this.matrix[r][n];a[e][n]=o}return this.update=function(){var t=this.matrix.length,i=this.matrix[0].length;for(e=0;e<t;e++)for(n=0;n<i;n++)this.matrix[e][n]=a[e][n]},this},getParents:function(){var t=[[].concat.apply([],this.matrix)];return 0!==this.parents.length&&(t=this.parents),t}}),t.Z.createTransform=function(e,i,s){return new t.Z.Transformation(e,s.type,i)},t.Z.registerElement("transform",t.Z.createTransform);t.Z.Transformation;t.Z.Turtle=function(t,e,r){var o,n,a;return this.constructor(t,r,i.Z.OBJECT_TYPE_TURTLE,i.Z.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=t,this.visProp.curveType="plot",this._attributes=s.Z.copyAttributes(this.visProp,t.options,"turtle"),delete this._attributes.id,o=0,n=0,a=90,0!==e.length&&(3===e.length?(o=e[0],n=e[1],a=e[2]):2===e.length?s.Z.isArray(e[0])?(o=e[0][0],n=e[0][1],a=e[1]):(o=e[0],n=e[1]):(o=e[0][0],n=e[0][1])),this.init(o,n,a),this.methodMap=s.Z.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},t.Z.Turtle.prototype=new H.Z,t.Z.extend(t.Z.Turtle.prototype,{init:function(t,e,i){var s={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/o.Z.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===i.Z.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(){var t,e,i=this.objects.length;for(t=0;t<i;t++)e=this.objects[t],this.board.removeObject(e);return this.init(0,0,90),this},setPos:function(t,e){return s.Z.isArray(t)?this.pos=t:this.pos=[t,e],this.turtleIsHidden||(this.turtle.setPositionDirectly(i.Z.COORDS_BY_USER,[t,e]),this.turtle2.setPositionDirectly(i.Z.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,s.Z.evaluate(this.objects[e].visProp[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,r,o,n=this.objects.length;for(e=0;e<n;e++)(r=this.objects[e]).type===i.Z.OBJECT_TYPE_CURVE&&r.setAttribute(t);return o=this.visProp.id,this.visProp=s.Z.deepCopy(this.curve.visProp),this.visProp.id=o,this._attributes=s.Z.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,r,o,n;return s.Z.isArray(t)?(e=this.pos[0],i=this.pos[1],r=t[0],o=t[1],n=Math.atan2(o-i,r-e),this.right(this.dir-180*n/Math.PI)):s.Z.isNumber(t)&&this.right(this.dir-t),this},moveTo:function(t){var e,i,r;return s.Z.isArray(t)&&(e=t[0]-this.pos[0],i=t[1]-this.pos[1],this.turtleIsHidden||((r=this.board.create("transform",[e,i],{type:"translate"})).applyOnce(this.turtle),r.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 s,r,o,n,a=this.objects.length;for(s=0,r=0;s<a;s++)if((o=this.objects[s]).elementClass===i.Z.OBJECT_CLASS_CURVE){if(r<=t&&t<r+o.numberPoints)return n=t-r,o[e](n);r+=o.numberPoints}return this[e]()},X:function(t){return s.Z.exists(t)?this.evalAt(t,"X"):this.pos[0]},Y:function(t){return s.Z.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,s=0;for(t=0;t<e;t++)this.objects[t].elementClass===i.Z.OBJECT_CLASS_CURVE&&(s+=this.objects[t].numberPoints);return s},hasPoint:function(t,e){var s,r;for(s=0;s<this.objects.length;s++)if((r=this.objects[s]).type===i.Z.OBJECT_TYPE_CURVE&&r.hasPoint(t,e))return!0;return!1}}),t.Z.createTurtle=function(e,i,r){var o;return i=i||[],o=s.Z.copyAttributes(r,e.options,"turtle"),new t.Z.Turtle(e,i,o)},t.Z.registerElement("turtle",t.Z.createTurtle);t.Z.Turtle;t.Z.Ticks=function(t,e,r){if(this.constructor(t.board,r,i.Z.OBJECT_TYPE_TICKS,i.Z.OBJECT_CLASS_OTHER),this.line=t,this.board=this.line.board,this.fixedTicks=null,this.equidistant=!1,this.labelsData=[],s.Z.isFunction(e))throw this.ticksFunction=e,new Error("Function arguments are no longer supported.");s.Z.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")},t.Z.Ticks.prototype=new H.Z,t.Z.extend(t.Z.Ticks.prototype,{hasPoint:function(t,e){var r,n,a,h,l=this.ticks&&this.ticks.length||0;if(s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(h=this.board._inputDevice,a=s.Z.evaluate(this.visProp.precision[h])):a=this.board.options.precision.hasPoint,a+=.5*s.Z.evaluate(this.visProp.strokewidth),!s.Z.evaluate(this.line.visProp.scalable)||this.line.elementClass===i.Z.OBJECT_CLASS_CURVE)return!1;if(0!==this.line.stdform[1]&&0!==this.line.stdform[2]&&this.line.type!==i.Z.OBJECT_TYPE_AXIS)return!1;for(r=0;r<l;r++)if((n=this.ticks[r])[2]&&!(0===this.line.stdform[1]&&Math.abs(n[0][0]-this.line.point1.coords.scrCoords[1])<o.Z.eps||0===this.line.stdform[2]&&Math.abs(n[1][0]-this.line.point1.coords.scrCoords[2])<o.Z.eps)&&(Math.abs(n[0][0]-n[0][1])>=1||Math.abs(n[1][0]-n[1][1])>=1))if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*a&&n[0][0]-a<t&&t<n[0][1]+a)return!0}else if(0===this.line.stdform[2]&&Math.abs(t-this.line.point1.coords.scrCoords[1])<2*a&&n[1][0]-a<e&&e<n[1][1]+a)return!0;return!1},setPositionDirectly:function(t,e,r){var n,a,h=new u.Z(t,e,this.board),l=new u.Z(t,r,this.board),c=this.board.getBoundingBox();return this.line.type===i.Z.OBJECT_TYPE_AXIS&&s.Z.evaluate(this.line.visProp.scalable)?(Math.abs(this.line.stdform[1])<o.Z.eps&&Math.abs(h.usrCoords[1]*l.usrCoords[1])>o.Z.eps?(n=l.usrCoords[1]/h.usrCoords[1],c[0]*=n,c[2]*=n,this.board.setBoundingBox(c,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])<o.Z.eps&&Math.abs(h.usrCoords[2]*l.usrCoords[2])>o.Z.eps&&(a=l.usrCoords[2]/h.usrCoords[2],c[3]*=a,c[1]*=a,this.board.setBoundingBox(c,this.board.keepaspectratio,"update")),this):this},calculateTicksCoordinates:function(){var t,e,r,n;if(!(this.line.elementClass===i.Z.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)<o.Z.eps&&Math.abs(this.dy)<o.Z.eps)))return t=this.getZeroCoordinates(),e=this.line.elementClass===i.Z.OBJECT_CLASS_LINE?this.getLowerAndUpperBounds(t,"ticksdistance"):{lower:this.line.minX(),upper:this.line.maxX(),a1:0,a2:0,m1:0,m2:0},"polar"===s.Z.evaluate(this.visProp.type)&&(n=this.board.getBoundingBox(),r=Math.max(o.Z.hypot(n[0],n[1]),o.Z.hypot(n[2],n[3])),e.upper=r),this.ticks=[],this.labelsData=[],this.equidistant?this.generateEquidistantTicks(t,e):this.generateFixedTicks(t,e),this},setTicksSizeVariables:function(t){var e,i,r,n,a=.5*s.Z.evaluate(this.visProp.majorheight),h=.5*s.Z.evaluate(this.visProp.minorheight);s.Z.exists(t)?(i=this.line.minX(),r=this.line.maxX(),(n=this.line.points.length)<2?(this.dxMaj=0,this.dyMaj=0):o.Z.relDif(t,i)<o.Z.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]):o.Z.relDif(t,r)<o.Z.eps?(this.dxMaj=this.line.points[n-2].usrCoords[2]-this.line.points[n-1].usrCoords[2],this.dyMaj=this.line.points[n-1].usrCoords[1]-this.line.points[n-2].usrCoords[1]):(this.dxMaj=-d.Z.D(this.line.Y)(t),this.dyMaj=d.Z.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=o.Z.hypot(this.dxMaj*this.board.unitX,this.dyMaj*this.board.unitY),this.dxMaj*=a/e*this.board.unitX,this.dyMaj*=a/e*this.board.unitY,this.dxMin*=h/e*this.board.unitX,this.dyMin*=h/e*this.board.unitY,this.minStyle=s.Z.evaluate(this.visProp.minorheight)<0?"infinite":"finite",this.majStyle=s.Z.evaluate(this.visProp.majorheight)<0?"infinite":"finite"},getZeroCoordinates:function(){var t,e,r,o,n,a,l,c,d=s.Z.evaluate(this.visProp.anchor);return this.line.elementClass===i.Z.OBJECT_CLASS_LINE?this.line.type===i.Z.OBJECT_TYPE_AXIS?h.Z.projectPointToLine({coords:{usrCoords:[1,0,0]}},this.line,this.board):(r=this.line.point1.coords.usrCoords[0],t=this.line.point1.coords.usrCoords[1],e=this.line.point1.coords.usrCoords[2],a=this.line.point2.coords.usrCoords[0],o=this.line.point2.coords.usrCoords[1],n=this.line.point2.coords.usrCoords[2],"right"===d?this.line.point2.coords:"middle"===d?new u.Z(i.Z.COORDS_BY_USER,[.5*(r+a),.5*(t+o),.5*(e+n)],this.board):s.Z.isNumber(d)?new u.Z(i.Z.COORDS_BY_USER,[r+(a-r)*d,t+(o-t)*d,e+(n-e)*d],this.board):this.line.point1.coords):(l=this.line.minX(),c=this.line.maxX(),"right"===d?c:"middle"===d?.5*(l+c):s.Z.isNumber(d)?l*(1-d)+c*d:l)},getLowerAndUpperBounds:function(t,e){var r,n,a,l,c,d,p,f,_,g,m,b,v,Z,C,y=10*o.Z.eps,P=s.Z.evaluate(this.line.visProp.straightfirst),E=s.Z.evaluate(this.line.visProp.straightlast),O=s.Z.evaluate(this.visProp.includeboundaries);return this.line.elementClass===i.Z.OBJECT_CLASS_CURVE?{lower:this.line.minX(),upper:this.line.maxX()}:(c=new u.Z(i.Z.COORDS_BY_USER,this.line.point1.coords.usrCoords,this.board),d=new u.Z(i.Z.COORDS_BY_USER,this.line.point2.coords.usrCoords,this.board),p=Math.abs(c.usrCoords[0])>=o.Z.eps&&c.scrCoords[1]>=0&&c.scrCoords[1]<=this.board.canvasWidth&&c.scrCoords[2]>=0&&c.scrCoords[2]<=this.board.canvasHeight,f=Math.abs(d.usrCoords[0])>=o.Z.eps&&d.scrCoords[1]>=0&&d.scrCoords[1]<=this.board.canvasWidth&&d.scrCoords[2]>=0&&d.scrCoords[2]<=this.board.canvasHeight,s.Z.exists(e)&&"ticksdistance"===e?(h.Z.calcStraight(this.line,c,d,0),Z=this.getDistanceFromZero(t,c),C=this.getDistanceFromZero(t,d),h.Z.calcStraight(this.line,c,d,s.Z.evaluate(this.line.visProp.margin)),Z=this.getDistanceFromZero(t,c)-Z,C=this.getDistanceFromZero(t,d).m2):h.Z.calcLineDelimitingPoints(this.line,c,d),a=s.Z.evaluate(this.line.visProp.firstarrow),l=s.Z.evaluate(this.line.visProp.lastarrow),b=this.getDistanceFromZero(t,c),v=this.getDistanceFromZero(t,d),(a||l)&&(m=this.board.renderer.getArrowHeadData(this.line,s.Z.evaluate(this.line.visProp.strokewidth),""),this.board.renderer.getPositionArrowHead(this.line,c,d,m)),(_=this.getDistanceFromZero(t,c))<(g=this.getDistanceFromZero(t,d))?(r=_,n=g,P||!p||O||(r+=y),E||!f||O||(n-=y)):g<_?(r=g,n=_,E||!f||O||(r+=y),P||!p||O||(n-=y)):(r=0,n=0),{lower:r,upper:n,a1:b=_-b,a2:v=_-v,m1:Z,m2:C})},getDistanceFromZero:function(t,e){var s,r,n,a,h;return s=this.line.point1.coords,r=this.line.point2.coords,h=t.distance(i.Z.COORDS_BY_USER,e),n=[r.usrCoords[0]-s.usrCoords[0],r.usrCoords[1]-s.usrCoords[1],r.usrCoords[2]-s.usrCoords[2]],a=[e.usrCoords[0]-t.usrCoords[0],e.usrCoords[1]-t.usrCoords[1],e.usrCoords[2]-t.usrCoords[2]],o.Z.innerProduct(n,a,3)<0&&(h*=-1),h},generateEquidistantTicks:function(t,e){var r,n,a,h=o.Z.eps,l=s.Z.evaluate(this.visProp.minorticks);if(a=this.getDistanceMajorTicks(),this.line.elementClass===i.Z.OBJECT_CLASS_LINE&&(n=this.getXandYdeltas()),a*=s.Z.evaluate(this.visProp.scale),a/=l+1,this.ticksDelta=a,!(a<o.Z.eps)){for(r=0,s.Z.evaluate(this.visProp.drawzero)||(r=a);r<=e.upper+h&&(r>=e.lower-h&&this.processTickPosition(t,r,a,n),r+=a,!(e.upper-r>1e4*a)););for(r=-a;r>=e.lower-h&&(r<=e.upper+h&&this.processTickPosition(t,r,a,n),!((r-=a)-e.lower>1e4*a)););}},getDistanceMajorTicks:function(){var t,e,i,r,n,a,h,l;return s.Z.evaluate(this.visProp.insertticks)?(a=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/6/(n=s.Z.evaluate(this.visProp.scale)),h=s.Z.evaluate(this.visProp.minticksdistance)/n,l=s.Z.evaluate(this.visProp.minorticks),(r=this.getXandYdeltas()).x*=this.board.unitX,r.y*=this.board.unitY,h/=o.Z.hypot(r.x,r.y),h*=l+1,2*(t=Math.pow(10,Math.floor(Math.log(h)/Math.LN10)))>=h?t*=2:5*t>=h&&(t*=5),5*(e=Math.pow(10,Math.floor(Math.log(a)/Math.LN10)))<a?e*=5:2*e<a&&(e*=2),t=Math.max(t,e)):s.Z.evaluate(this.visProp.ticksdistance)},processTickPosition:function(t,e,r,o){var n,a,h,l,c,d=s.Z.evaluate(this.visProp.ticksperlabel),p=null;this.line.elementClass===i.Z.OBJECT_CLASS_LINE?(n=t.usrCoords[1]+e*o.x,a=t.usrCoords[2]+e*o.y):(n=this.line.X(t+e),a=this.line.Y(t+e)),h=new u.Z(i.Z.COORDS_BY_USER,[n,a],this.board),this.line.elementClass===i.Z.OBJECT_CLASS_CURVE&&(p=t+e,this.setTicksSizeVariables(p)),h.major=Math.round(e/r)%(s.Z.evaluate(this.visProp.minorticks)+1)==0,d||(d=s.Z.evaluate(this.visProp.minorticks)+1),c=Math.round(e/r)%d==0,3===(l=this.createTickPath(h,h.major)).length&&(this.ticks.push(l),c&&s.Z.evaluate(this.visProp.drawlabels)?this.labelsData.push(this.generateLabelData(this.generateLabelText(h,t,p),h,this.ticks.length)):this.labelsData.push(null))},generateFixedTicks:function(t,e){var r,n,a,h,l,c,d,p,f=o.Z.eps,_=s.Z.isArray(this.visProp.labels),g=s.Z.evaluate(this.visProp.drawlabels);for(this.line.elementClass===i.Z.OBJECT_CLASS_LINE&&(p=this.getXandYdeltas()),a=0;a<this.fixedTicks.length;a++)this.line.elementClass===i.Z.OBJECT_CLASS_LINE?(d=this.fixedTicks[a],l=t.usrCoords[1]+d*p.x,c=t.usrCoords[2]+d*p.y):(d=t+this.fixedTicks[a],l=this.line.X(d),c=this.line.Y(d)),r=new u.Z(i.Z.COORDS_BY_USER,[l,c],this.board),this.line.elementClass===i.Z.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(d),3===(h=this.createTickPath(r,!0)).length&&d>=e.lower-f&&d<=e.upper+f&&(this.ticks.push(h),g&&(_||s.Z.exists(this.visProp.labels[a]))?(n=_?s.Z.evaluate(this.visProp.labels[a]):d,this.labelsData.push(this.generateLabelData(this.generateLabelText(r,t,n),r,a))):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,r,n,a,l,c,d,u,p,f,_,g,m,b,v,Z,C,y=[-2e6,-2e6],P=[-2e6,-2e6];if(i=t.scrCoords,e?(a=this.dxMaj,l=this.dyMaj,p=this.majStyle,v=s.Z.evaluate(this.visProp.majortickendings[0])>0,Z=s.Z.evaluate(this.visProp.majortickendings[1])>0):(a=this.dxMin,l=this.dyMin,p=this.minStyle,v=s.Z.evaluate(this.visProp.tickendings[0])>0,Z=s.Z.evaluate(this.visProp.tickendings[1])>0),r=[-l*i[1]-a*i[2],l,a],e&&"polar"===s.Z.evaluate(this.visProp.type)){if(g=this.board.getBoundingBox(),b=(m=2*Math.PI)/180,i=t.usrCoords,(_=o.Z.hypot(i[1],i[2]))<Math.max(o.Z.hypot(g[0],g[1]),o.Z.hypot(g[2],g[3]))){for(y=[],P=[],f=0;f<=m;f+=b)y.push(this.board.origin.scrCoords[1]+_*Math.cos(f)*this.board.unitX),P.push(this.board.origin.scrCoords[2]+_*Math.sin(f)*this.board.unitY);return[y,P,e]}}else{if("infinite"===p){if(s.Z.evaluate(this.visProp.ignoreinfinitetickendings)&&(v=Z=!0),n=h.Z.meetLineBoard(r,this.board),v&&Z)y[0]=n[0].scrCoords[1],y[1]=n[1].scrCoords[1],P[0]=n[0].scrCoords[2],P[1]=n[1].scrCoords[2];else if((C=[o.Z.innerProduct(n[0].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0],o.Z.innerProduct(n[1].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0]])[0]<C[1]&&(n.reverse(),C.reverse()),v){if(C[0]<0)return[];C[1]<0?(y[0]=n[0].scrCoords[1],P[0]=n[0].scrCoords[2],y[1]=i[1],P[1]=i[2]):(y[0]=n[0].scrCoords[1],P[0]=n[0].scrCoords[2],y[1]=n[1].scrCoords[1],P[1]=n[1].scrCoords[2])}else if(Z){if(C[1]>0)return[];C[0]>0?(y[0]=i[1],P[0]=i[2],y[1]=n[1].scrCoords[1],P[1]=n[1].scrCoords[2]):(y[0]=n[0].scrCoords[1],P[0]=n[0].scrCoords[2],y[1]=n[1].scrCoords[1],P[1]=n[1].scrCoords[2])}}else u=">"===s.Z.evaluate(this.visProp.face)?Math.PI/4:"<"===s.Z.evaluate(this.visProp.face)?-Math.PI/4:0,c=Math.cos(u)*a-Math.sin(u)*l,d=Math.sin(u)*a+Math.cos(u)*l,y[0]=i[1]+c*v,P[0]=i[2]-d*v,y[1]=i[1],P[1]=i[2],u=-u,c=Math.cos(u)*a-Math.sin(u)*l,d=Math.sin(u)*a+Math.cos(u)*l,y[2]=i[1]-c*Z,P[2]=i[2]+d*Z;if(this._isInsideCanvas(y,P))return[y,P,e]}return[]},formatLabelText:function(t){var e,i,r=s.Z.evaluate(this.visProp.label.usemathjax),o=s.Z.evaluate(this.visProp.label.usekatex),n=s.Z.evaluate(this.visProp.scalesymbol);return s.Z.isNumber(t)?(s.Z.evaluate(this.visProp.label.tofraction)?e=r?"\\("+s.Z.toFraction(t,!0)+"\\)":s.Z.toFraction(t,o):(i=s.Z.evaluate(this.visProp.digits),this.useLocale()?e=this.formatNumberLocale(t,i):((e=(Math.round(1e11*t)/1e11).toString()).length>s.Z.evaluate(this.visProp.maxlabellength)||-1!==e.indexOf("e"))&&(3!==s.Z.evaluate(this.visProp.precision)&&3===i&&(i=s.Z.evaluate(this.visProp.precision)),e=t.toExponential(i).toString())),s.Z.evaluate(this.visProp.beautifulscientificticklabels)&&(e=this.beautifyScientificNotationLabel(e)),e.indexOf(".")>-1&&-1===e.indexOf("e")&&(e=(e=e.replace(/0+$/,"")).replace(/\.$/,""))):e=t.toString(),n.length>0&&("1"===e?e=n:"-1"===e?e="-"+n:"0"!==e&&(e+=n)),s.Z.evaluate(this.visProp.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 r;if(!s.Z.exists(i)){if(r=this.getDistanceFromZero(e,t),Math.abs(r)<o.Z.eps)return"0";i=r/s.Z.evaluate(this.visProp.scale)}return this.formatLabelText(i)},generateLabelData:function(t,e,i){var r,o,n,a;return a=s.Z.evaluate(this.visProp.label.fontsize),r=[e.scrCoords[1],e.scrCoords[1]],o=[e.scrCoords[2],e.scrCoords[2]],n=void 0===a?12:a,n*=.5,this._isInsideCanvas(r,o,n)?(r=s.Z.evaluate(this.visProp.label.offset[0]),o=s.Z.evaluate(this.visProp.label.offset[1]),{x:e.usrCoords[1]+r/this.board.unitX,y:e.usrCoords[2]+o/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 e,i,r,o,n,a,h,l;for(r=this.labelsData.length,o=this.labels.length,e=0,i=0;e<r;e++)null!==this.labelsData[e]&&(h=this.labelsData[e],i<o?((a=this.labels[i]).setText(h.t),a.setCoords(h.x,h.y),i++):(this.labelCounter+=1,n={isLabel:!0,layer:this.board.options.layer.line,highlightStrokeColor:this.board.options.text.strokeColor,highlightStrokeWidth:this.board.options.text.strokeWidth,highlightStrokeOpacity:this.board.options.text.strokeOpacity,priv:this.visProp.priv},(n=s.Z.deepCopy(n,this.visProp.label)).id=this.id+h.i+"Label"+this.labelCounter,a=t.Z.createText(this.board,[h.x,h.y,h.t],n),this.addChild(a),a.setParents(this),a.isDraggable=!1,a.dump=!1,this.labels.push(a)),"inherit"===(l=s.Z.evaluate(this.visProp.label.visible))&&(l=this.visPropCalc.visible),a.prepareUpdate().updateVisibility(l).updateRenderer(),a.distanceX=s.Z.evaluate(this.visProp.label.offset[0]),a.distanceY=s.Z.evaluate(this.visProp.label.offset[1]));for(i=r=i;i<o;i++)this.board.renderer.display(this.labels[i],!1),this.labels[i].visProp.visible=this.labels[i].visPropCalc.visible=!1;return this},hideElement:function(){var e;for(t.Z.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),e=0;e<this.labels.length;e++)s.Z.exists(this.labels[e])&&this.labels[e].hideElement();return this},showElement:function(){var e;for(t.Z.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!1),e=0;e<this.labels.length;e++)s.Z.exists(this.labels[e])&&this.labels[e].showElement();return this}}),t.Z.createTicks=function(e,r,o){var n,a,h=s.Z.copyAttributes(o,e.options,"ticks");if(a=r.length<2?h.ticksdistance:r[1],r[0].elementClass!==i.Z.OBJECT_CLASS_LINE&&r[0].elementClass!==i.Z.OBJECT_CLASS_CURVE)throw new Error("JSXGraph: Can't create Ticks with parent types '"+typeof r[0]+"'.");return n=new t.Z.Ticks(r[0],a,h),s.Z.isFunction(h.generatelabelvalue)&&(n.generateLabelText=h.generatelabelvalue),s.Z.isFunction(h.generatelabeltext)&&(n.generateLabelText=h.generatelabeltext),n.setParents(r[0]),n.isDraggable=!0,n.fullUpdate(r[0].visPropCalc.visible),n},t.Z.createHatchmark=function(t,e,r){var o,n,a,h,l,c=[],d=s.Z.copyAttributes(r,t.options,"hatch");if(e[0].elementClass!==i.Z.OBJECT_CLASS_LINE&&e[0].elementClass!==i.Z.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(a=.5*-(((o=e[1])-1)*(h=d.ticksdistance)),n=0;n<o;n++)c[n]=a+n*h;return(l=t.create("ticks",[e[0],c],d)).elType="hatch",e[0].inherits.push(l),l},t.Z.registerElement("ticks",t.Z.createTicks),t.Z.registerElement("hash",t.Z.createHatchmark),t.Z.registerElement("hatch",t.Z.createHatchmark);t.Z.Ticks;t.Z.CA=function(t,e,i){this.node=t,this.createNode=e,this.parser=i},t.Z.extend(t.Z.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,r=t.children[0].value,o=t.children[1];switch(r){case"abs":i=this.createNode("node_op","op_div",o[0],this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_mul",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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,s.Z.deepCopy(t.children[0]),s.Z.deepCopy(t.children[1]))));break;case"sin":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),s.Z.deepCopy(o));break;case"cos":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),s.Z.deepCopy(o)));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"),s.Z.deepCopy(o)),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"),s.Z.deepCopy(o)),this.createNode("node_const",2))));break;case"exp":i=this.createNode(t.type,t.value,s.Z.deepCopy(t.children[0]),s.Z.deepCopy(t.children[1]));break;case"pow":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_execfun",s.Z.deepCopy(t.children[0]),s.Z.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",s.Z.deepCopy(t.children[1][1]),s.Z.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"),[s.Z.deepCopy(t.children[1][0])]))));break;case"log":case"ln":i=this.createNode("node_op","op_div",this.createNode("node_const",1),s.Z.deepCopy(o[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),s.Z.deepCopy(o[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),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[0])))));break;case"sinh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cosh"),[s.Z.deepCopy(o[0])]);break;case"cosh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","sinh"),[s.Z.deepCopy(o[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"),[s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[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",s.Z.deepCopy(o[0]),s.Z.deepCopy(o[0]))));break;default:throw i=this.createNode("node_const",0),console.log('Derivative of "'+r+'" 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),s.Z.deepCopy(t.children[1])),this.createNode("node_op","op_mul",s.Z.deepCopy(t.children[0]),this.derivative(t.children[1],e))),this.createNode("node_op","op_mul",s.Z.deepCopy(t.children[1]),s.Z.deepCopy(t.children[1])));break;case"op_mul":i=this.createNode("node_op","op_add",this.createNode("node_op","op_mul",s.Z.deepCopy(t.children[0]),this.derivative(t.children[1],e)),this.createNode("node_op","op_mul",this.derivative(t.children[0],e),s.Z.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",s.Z.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",s.Z.deepCopy(t.children[1]),s.Z.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"),[s.Z.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 r,o,n,a,h,l,c,d,u,p,f,_;if(0,!t)return 0;for(this.line=t.line,this.col=t.col,r=t.children.length,o=0;o<r;++o)if(t.children[o]&&t.children[o].type)t.children[o]=this.expandDerivatives(t.children[o],t,i);else if(s.Z.isArray(t.children[o]))for(n=0;n<t.children[o].length;++n)t.children[o][n]&&t.children[o][n].type&&(t.children[o][n]=this.expandDerivatives(t.children[o][n],t,i));if("node_op"===t.type)if("op_execfun"===t.value)if(t.children[0]&&"D"===t.children[0].value){if(_=!1,"node_var"==t.children[1][0].type&&(d=t.children[1][0].value,null!==(a=this.findMapNode(d,i))&&(_=!0)),_?(p=a.children[0],u=t.children[1].length>=2?t.children[1][1].value:a.children[0][0],h=a.children[1]):(h=t.children[1][0],p=["x"],u=t.children[1].length>=2?t.children[1][1].value:"x"),c=h,(f=t.children[1].length>=3?t.children[1][2].value:1)>=1)for(;f>=1;)c=this.derivative(c,u),c=this.removeTrivialNodes(c),f--;l="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",p,c):c,this.setMath(l),t.type=l.type,t.value=l.value,l.children.length>0&&(t.children[0]=l.children[0]),l.children.length>1&&(t.children[1]=l.children[1])}return t},removeTrivialNodes:function(t){var e,i,r,o,n;if(s.Z.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(r=t.children[0],"node_var"==(o=t.children[1]).type)for(e=0;e<r.length;++e)if(r[e]==o.value){o.isMath=!0;break}break;case"op_add":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&0===r.value)return o;if("node_const"==o.type&&0===o.value)return r;if("node_const"==r.type&&"node_const"==o.type)return r.value+=o.value,r;break;case"op_mul":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&1==r.value)return o;if("node_const"==o.type&&1==o.value)return r;if("node_const"==r.type&&0===r.value)return r;if("node_const"==o.type&&0===o.value)return o;if("node_const"==o.type&&0===o.value)return o;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==o.type&&"op_neg"==o.value)return t.children=[r.children[0],o.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",r.children[0],o)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",r,o.children[0])],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=[o,r.children[1]],this.mayNotBeSimplified=!0,t;if("op_div"==o.value&&"node_const"==o.children[0].type&&1==o.children[0].value)return t.type="node_op",t.value="op_div",t.children=[r,o.children[1]],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_const"==o.type)return t.children=[o,r],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_op"==o.type&&"op_neg"==o.value&&"node_const"==o.children[0].type)return t.children=[o,r],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_execfun"!=r.value&&("node_var"==o.type||"node_op"==o.type&&"op_execfun"==o.value))return t.children=[o,r],this.mayNotBeSimplified=!0,t;if("node_op"!=r.type&&"node_op"==o.type&&"op_neg"==o.value&&"node_var"==o.children[0].type)return t.children=[o,r],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_op"==o.type&&("op_mul"==o.value||"op_div"==o.value)&&"node_const"==o.children[0].type)return n=o.children[0],o.children[0]=r,t.children=[n,o],this.mayNotBeSimplified=!0,t;if("node_const"!=o.type&&"node_op"==r.type&&"op_mul"==r.value&&"node_const"==r.children[0].type)return t.children=[r.children[0],this.createNode("node_op","op_mul",r.children[1],o)],this.mayNotBeSimplified=!0,t;if("node_const"==r.type&&"node_const"==o.type)return r.value*=o.value,r;if("node_const"==r.type&&"node_op"==o.type&&("op_mul"==o.value||"op_div"==o.value)&&"node_const"==o.children[0].type)return o.children[0].value*=r.value,o;if(r.hash=this.parser.compile(r),o.hash=this.parser.compile(o),r.hash===o.hash)return t.value="op_exp",t.children[1]=this.createNode("node_const",2),t;if("node_const"==r.type&&"node_op"==o.type&&("op_mul"==o.value||"op_div"==o.value)&&"node_const"==o.children[0].type)return o.children[0].value*=r.value,o;if("node_op"==o.type&&"op_exp"==o.value&&(r.hash||(r.hash=this.parser.compile(r)),o.children[0].hash||(o.children[0].hash=this.parser.compile(o.children[0])),r.hash===o.children[0].hash))return o.children[1]=this.createNode("node_op","op_add",o.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,o;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==o.type&&"op_exp"==o.value&&(r.children[0].hash=this.parser.compile(r.children[0]),o.children[0].hash=this.parser.compile(o.children[0]),r.children[0].hash===o.children[0].hash))return r.children[1]=this.createNode("node_op","op_add",r.children[1],o.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_sub":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&0===r.value)return t.value="op_neg",t.children[0]=o,t;if("node_const"==o.type&&0===o.value)return r;if("node_const"==r.type&&"node_const"==o.type&&r.value==o.value)return this.createNode("node_const",0);if("node_var"==r.type&&"node_var"==o.type&&r.value==o.value)return this.createNode("node_const",0);if("node_const"==r.type&&"node_const"==o.type)return r.value-=o.value,r;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==o.type&&"op_mul"==o.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.children[1].hash=this.parser.compile(o.children[1]),r.children[1].hash===o.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",r.children[0],o.children[0]),r.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.hash=this.parser.compile(o),r.children[1].hash===o.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",r.children[0],this.createNode("node_const",1)),o],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_mul"==o.value&&(o.children[1].hash=this.parser.compile(o.children[1]),r.hash=this.parser.compile(r),o.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_sub",this.createNode("node_const",1),o.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_neg":if("node_const"==(r=t.children[0]).type&&0===r.value)return r;if("node_op"==r.type&&"op_neg"==r.value)return r.children[0];break;case"op_div":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&"node_const"==o.type&&r.value==o.value&&0!==r.value)return r.value=1,r;if("node_const"==r.type&&0===r.value&&"node_const"==o.type&&0!==o.value)return r.value=0,r;if("node_const"==r.type&&0===r.value&&("node_op"==o.type||"node_var"==o.type))return t.type="node_const",t.value=0,t;if("node_var"==r.type&&"node_var"==o.type&&r.value==o.value)return this.createNode("node_const",1);if("node_const"==r.type&&0!==r.value&&"node_const"==o.type&&0===o.value)return r.value>0?r.value=1/0:r.value=-1/0,r;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==o.type&&"op_neg"==o.value)return t.children=[r.children[0],o.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r.children[0],o)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r,o.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&(o.hash||(o.hash=this.parser.compile(o)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),o.hash===r.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,r;if("node_const"!=o.type&&"node_op"==r.type&&"op_mul"==r.value&&"node_const"==r.children[0].type)return t.value="op_mul",t.children=[r.children[0],this.createNode("node_op","op_div",r.children[1],o)],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==o.type&&"op_exp"==o.value&&(r.children[0].hash=this.parser.compile(r.children[0]),o.children[0].hash=this.parser.compile(o.children[0]),r.children[0].hash===o.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],o.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_exp":if(r=t.children[0],"node_const"==(o=t.children[1]).type&&0===o.value)return o.value=1,o;if("node_const"==o.type&&1==o.value)return r;if("node_const"==r.type&&1==r.value)return r;if("node_const"==r.type&&0===r.value&&"node_const"==o.type&&0!==o.value)return r;if("node_op"==r.type&&"op_exp"==r.value)return t.children=[r.children[0],this.createNode("node_op","op_mul",r.children[1],o)],t}switch(t.value){case"op_add":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&"node_const"==o.type&&r.value==o.value)return r.value+=o.value,r;if("node_var"==r.type&&"node_var"==o.type&&r.value==o.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[0]=o,t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_neg"==o.value)return t.value="op_sub",t.children[1]=o.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==o.type&&"op_mul"==o.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.children[1].hash=this.parser.compile(o.children[1]),r.children[1].hash===o.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],o.children[0]),r.children[1]],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.hash=this.parser.compile(o),r.children[1].hash===o.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),o],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_mul"==o.value&&(o.children[1].hash=this.parser.compile(o.children[1]),r.hash=this.parser.compile(r),o.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),o.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(r=t.children[0],"node_op"==(o=t.children[1]).type&&"op_neg"==o.value)return t.value="op_add",t.children[1]=o.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}});t.Z.CA;t.Z.Dump={addMarkers:function(t,e,i){var r,o,n;for(r in s.Z.isArray(e)||(e=[e]),s.Z.isArray(i)||(i=[i]),o=Math.min(e.length,i.length),e.length=o,i.length=o,t.objects)if(t.objects.hasOwnProperty(r))for(n=0;n<o;n++)t.objects[r][e[n]]=i[n]},deleteMarkers:function(t,e){var i,r,o;for(i in s.Z.isArray(e)||(e=[e]),r=e.length,e.length=r,t.objects)if(t.objects.hasOwnProperty(i))for(o=0;o<r;o++)delete t.objects[i][e[o]]},str:function(t){return"string"==typeof t&&"function"!==t.slice(0,7)&&(t='"'+t+'"'),t},minimizeObject:function(e,i){var r,o,n,a={},h=s.Z.deepCopy(e),l=[];for(n=1;n<arguments.length;n++)l.push(arguments[n]);for(a=s.Z.deepCopy(a,t.Z.Options.elements,!0),n=l.length;n>0;n--)a=s.Z.deepCopy(a,l[n-1],!0);for(r in a)a.hasOwnProperty(r)&&(o=r.toLowerCase(),"object"!=typeof a[r]&&a[r]===h[o]&&delete h[o]);return h},prepareAttributes:function(e,i){var s,r;for(r in s=this.minimizeObject(i.getAttributes(),t.Z.Options[i.elType]),i.subs)i.subs.hasOwnProperty(r)&&(s[r]=this.minimizeObject(i.subs[r].getAttributes(),t.Z.Options[i.elType][r],t.Z.Options[i.subs[r].elType]),s[r].id=i.subs[r].id,s[r].name=i.subs[r].name);return s.id=i.id,s.name=i.name,s},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),e.keepaspectratio]}),t},dump:function(t){var e,i,r,o,n=[],a=[],h=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),e=0;e<h;e++)if(r={},!(i=t.objectsList[e]).dumped&&i.dump){for(r.type=i.getType(),r.parents=i.getParents().slice(),"point"===r.type&&1===r.parents[0]&&(r.parents=r.parents.slice(1)),o=0;o<r.parents.length;o++)s.Z.isString(r.parents[o])&&"'"!==r.parents[o][0]&&'"'!==r.parents[o][0]?r.parents[o]='"'+r.parents[o]+'"':s.Z.isArray(r.parents[o])&&(r.parents[o]="["+r.parents[o].toString()+"]");r.attributes=this.prepareAttributes(t,i),"glider"===r.type&&i.onPolygon&&n.push({obj:i.id,prop:"onPolygon",val:!0}),a.push(r)}return this.deleteMarkers(t,"dumped"),{elements:a,props:n,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,r;switch(typeof t){case"object":if(t){if(i=[],s.Z.isArray(t)){for(e=0;e<t.length;e++)i.push(this.toJCAN(t[e]));return"["+i.join(",")+"]"}for(r in t)t.hasOwnProperty(r)&&i.push(r+": "+this.toJCAN(t[r]));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,r,o=this.dump(t),n=[];for(o.methods=this.setBoundingBox(o.methods,t,"board"),i=o.elements,e=0;e<i.length;e++)n.push('board.create("'+i[e].type+'", ['+i[e].parents.join(", ")+"], "+s.Z.toJSON(i[e].attributes)+");"),"axis"===i[e].type&&(r=i[e].attributes.id,null===t.objects[r].defaultTicks&&n.push('board.objects["'+r+'"].removeTicks(board.objects["'+r+'"].defaultTicks);'));for(e=0;e<o.methods.length;e++)n.push(o.methods[e].obj+"."+o.methods[e].method+"("+this.arrayToParamStr(o.methods[e].params,s.Z.toJSON)+");"),n.push("");for(e=0;e<o.props.length;e++)n.push(o.props[e].obj+"."+o.props[e].prop+" = "+s.Z.toJSON(o.props[e].val)+";"),n.push("");return n.join("\n")}};t.Z.Dump;t.Z.createComb=function(e,i,r){var o,n,a,h,l;if(2!==i.length)throw l=i.map((function(t){return"'"+typeof t+"'"})),new Error("JSXGraph: Can't create comb with parent types "+l.join(", ")+".\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");if(s.Z.isArray(i[0])&&i[0].length>1)h=s.Z.copyAttributes(r,e.options,"comb","point1"),o=e.create("point",i[0],h);else if(s.Z.isString(i[0])||s.Z.isPoint(i[0]))o=e.select(i[0]);else if(s.Z.isFunction(i[0])&&s.Z.isPoint(i[0]()))o=i[0]();else{if(!(s.Z.isFunction(i[0])&&i[0]().length&&i[0]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.Z.copyAttributes(r,e.options,"comb","point1"),o=t.Z.createPoint(e,i[0](),h)}if(s.Z.isArray(i[1])&&i[1].length>1)h=s.Z.copyAttributes(r,e.options,"comb","point2"),n=e.create("point",i[1],h);else if(s.Z.isString(i[1])||s.Z.isPoint(i[1]))n=e.select(i[1]);else if(s.Z.isFunction(i[1])&&s.Z.isPoint(i[1]()))n=i[1]();else{if(!(s.Z.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.Z.copyAttributes(r,e.options,"comb","point2"),n=t.Z.createPoint(e,i[1](),h)}return h=s.Z.copyAttributes(r,e.options,"comb"),(a=e.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,i,r,h,l,c,d,u,p,f=0,_=o.Dist(n),g=o,m=n;for(d=s.Z.evaluate(a.visProp.frequency),u=-s.Z.evaluate(a.visProp.angle),p=s.Z.evaluate(a.visProp.width),s.Z.evaluate(a.visProp.reverse)&&(g=n,m=o,u=-u),t=Math.cos(u),e=Math.sin(u),i=(m.X()-g.X())/_,r=(m.Y()-g.Y())/_,t*=p/Math.abs(e),e*=p/Math.abs(e),this.dataX=[],this.dataY=[];f<_;)h=g.X()+i*f,l=g.Y()+r*f,e*=c=Math.min(t,_-f)/Math.abs(t),t*=c,this.dataX.push(h),this.dataY.push(l),this.dataX.push(h+i*t+r*e),this.dataY.push(l-i*e+r*t),this.dataX.push(NaN),this.dataY.push(NaN),f+=d},a},t.Z.registerElement("comb",t.Z.createComb);var et=function(){q.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)},it=function(){return this.tangent.getSlope()},st=function(){return this.tangent.Direction()};t.Z.createSlopeTriangle=function(e,r,o){var n,a,h,l,c,d,u,p,f,_=!1;if(1===r.length&&r[0].type===i.Z.OBJECT_TYPE_TANGENT)a=r[0],h=a.glider;else if(1===r.length&&r[0].type===i.Z.OBJECT_TYPE_GLIDER)h=r[0],f=s.Z.copyAttributes(o,e.options,"slopetriangle","tangent"),a=e.create("tangent",[h],f),_=!0;else{if(2!==r.length||r[0].elementClass!==i.Z.OBJECT_CLASS_LINE||!s.Z.isPoint(r[1]))throw new Error("JSXGraph: Can't create slope triangle with parent types '"+typeof r[0]+"'.");a=r[0],h=r[1]}return f=s.Z.copyAttributes(o,e.options,"slopetriangle","basepoint"),u=e.create("point",[function(){return[h.X()+1,h.Y()]}],f),f=s.Z.copyAttributes(o,e.options,"slopetriangle","baseline"),d=e.create("line",[h,u],f),f=s.Z.copyAttributes(o,e.options,"slopetriangle","glider"),l=e.create("glider",[h.X()+1,h.Y(),d],f),f=s.Z.copyAttributes(o,e.options,"slopetriangle","toppoint"),c=e.create("point",[function(){return[l.X(),l.Y()+(l.X()-h.X())*a.getSlope()]}],f),f=s.Z.copyAttributes(o,e.options,"slopetriangle"),(n=e.create("polygon",[h,l,c],f)).Value=it,n.Direction=st,n.tangent=a,n._isPrivateTangent=_,n.borders[2].setArrow(!1,!1),f=s.Z.copyAttributes(o,e.options,"slopetriangle","label"),(f=s.Z.copyAttributes(f,e.options,"label")).isLabel=!0,f.anchor=n.borders[1],f.priv=n.borders[1].visProp.priv,f.id=n.borders[1].id+"Label",(p=e.create("text",[0,0,function(){return""}],f)).needsUpdate=!0,p.dump=!1,n.borders[1].label=p,n.borders[1].hasLabel=!0,n.borders[1].visProp.withlabel=!0,p._setText((function(){var t=s.Z.evaluate(p.visProp.digits);return p.useLocale()?p.formatNumberLocale(n.Value(),t):s.Z.toFixed(n.Value(),t)})),p.fullUpdate(),n.glider=l,n.basepoint=u,n.baseline=d,n.toppoint=c,n.label=p,n.subs={glider:l,basePoint:u,baseLine:d,topPoint:c,label:p},n.inherits.push(l,u,d,c,p),n.methodMap=t.Z.deepCopy(n.methodMap,{tangent:"tangent",glider:"glider",basepoint:"basepoint",baseline:"baseline",toppoint:"toppoint",label:"label",Value:"Value",V:"Value",Direction:"Direction"}),n.remove=et,n},t.Z.registerElement("slopetriangle",t.Z.createSlopeTriangle);var rt=function(){this._value=this.rendNodeCheckbox.checked,this.board.update()};t.Z.createCheckbox=function(i,r,o){var n,a,h=s.Z.copyAttributes(o,i.options,"checkbox");return a=[r[0],r[1],'<span style="display:inline"><input type="checkbox" /><label for=""></label></span>'],(n=i.create("text",a,h)).type=s.Z.OBJECT_TYPE_CHECKBOX,n.rendNodeCheckbox=n.rendNode.childNodes[0].childNodes[0],n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[1],n.rendNodeTag=n.rendNodeCheckbox,n.rendNodeTag.disabled=!!h.disabled,n.rendNodeCheckbox.id=n.rendNode.id+"_checkbox",n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeLabel.setAttribute("for",n.rendNodeCheckbox.id),n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n.rendNodeCheckbox.checked=h.checked,n._value=h.checked,n.Value=function(){return this._value},n.update=function(){return this.needsUpdate&&(t.Z.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},e.Z.addEvent(n.rendNodeCheckbox,"change",rt,n),n},t.Z.registerElement("checkbox",t.Z.createCheckbox);var ot=function(t){this._value=this.rendNodeInput.value,this.board.update()};t.Z.createInput=function(i,r,o){var n,a,h=s.Z.copyAttributes(o,i.options,"input");return a=[r[0],r[1],'<span style="display:inline; white-space:nowrap; padding:0px;"><span></span><input type="text" maxlength="'+h.maxlength+'" style="width:100%"/></span>'],(n=i.create("text",a,h)).type=s.Z.OBJECT_TYPE_INPUT,n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[0],n.rendNodeInput=n.rendNode.childNodes[0].childNodes[1],n.rendNodeInput.value=r[2],n.rendNodeTag=n.rendNodeInput,n.rendNodeTag.disabled=!!h.disabled,n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeInput.id=n.rendNode.id+"_input",n.setText(r[3]),n._value=r[2],n.update=function(){return this.needsUpdate&&(t.Z.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},n.Value=function(){return this._value},n.set=function(t){return this._value=t,this.rendNodeInput.value=t,this},e.Z.addEvent(n.rendNodeInput,"input",ot,n),e.Z.addEvent(n.rendNodeInput,"mousedown",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),e.Z.addEvent(n.rendNodeInput,"touchstart",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),e.Z.addEvent(n.rendNodeInput,"pointerdown",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n},t.Z.registerElement("input",t.Z.createInput);var nt=function(){this._handler&&this._handler(),this.board.update()};t.Z.createButton=function(i,r,o){var n,a,h=s.Z.copyAttributes(o,i.options,"button");return a=[r[0],r[1],'<button type="button" style="width:100%;"></button>'],(n=i.create("text",a,h)).type=s.Z.OBJECT_TYPE_BUTTON,n.rendNodeButton=n.rendNode.childNodes[0],n.rendNodeButton.id=n.rendNode.id+"_button",n.rendNodeTag=n.rendNodeButton,n.rendNodeTag.disabled=!!h.disabled,n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),r[3]&&(s.Z.isString(r[3])?(n._jc=new t.Z.JessieCode,n._jc.use(i),n._handler=function(){n._jc.parse(r[3])}):n._handler=r[3]),e.Z.addEvent(n.rendNodeButton,"click",nt,n),e.Z.addEvent(n.rendNodeButton,"mousedown",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),e.Z.addEvent(n.rendNodeButton,"touchstart",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),e.Z.addEvent(n.rendNodeButton,"pointerdown",(function(t){s.Z.exists(t.stopPropagation)&&t.stopPropagation()}),n),n},t.Z.registerElement("button",t.Z.createButton),t.Z.createVectorField=function(t,e,i){var r,o;if(!(e.length>=3&&(s.Z.isArray(e[0])||s.Z.isFunction(e[0])||s.Z.isString(e[0]))&&s.Z.isArray(e[1])&&3===e[1].length&&s.Z.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 o=s.Z.copyAttributes(i,t.options,"vectorfield"),(r=t.create("curve",[[],[]],o)).elType="vectorfield",r.setF=function(t,e){var i,o;return s.Z.isArray(t)?(i=s.Z.createFunction(t[0],this.board,e),o=s.Z.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),o(t,e)]}):this.F=s.Z.createFunction(t,r.board,e),this},r.setF(e[0],"x, y"),r.xData=e[1],r.yData=e[2],r.updateDataArray=function(){var e,i,r,o,n,a,h,l,c,d,u,p,f=s.Z.evaluate(this.visProp.scale),_=s.Z.evaluate(this.xData[0]),g=s.Z.evaluate(this.xData[1]),m=(s.Z.evaluate(this.xData[2])-_)/g,b=s.Z.evaluate(this.yData[0]),v=s.Z.evaluate(this.yData[1]),Z=(s.Z.evaluate(this.yData[2])-b)/v,C=s.Z.evaluate(this.visProp.arrowhead.enabled);for(C&&(d=(c=s.Z.evaluate(this.visProp.arrowhead.size))/t.unitX,u=c/t.unitY,p=s.Z.evaluate(this.visProp.arrowhead.angle)),this.dataX=[],this.dataY=[],r=0,e=_;r<=g;e+=m,r++)for(o=0,i=b;o<=v;i+=Z,o++)(n=this.F(e,i))[0]*=f,n[1]*=f,this.dataX=this.dataX.concat([e,e+n[0],NaN]),this.dataY=this.dataY.concat([i,i+n[1],NaN]),C&&Math.abs(n[0])+Math.abs(n[1])>0&&(h=(a=Math.atan2(n[1],n[0]))+p,l=a-p,this.dataX=this.dataX.concat([e+n[0]-Math.cos(h)*d,e+n[0],e+n[0]-Math.cos(l)*d,NaN]),this.dataY=this.dataY.concat([i+n[1]-Math.sin(h)*u,i+n[1],i+n[1]-Math.sin(l)*u,NaN]))},r.methodMap=s.Z.deepCopy(r.methodMap,{setF:"setF"}),r},t.Z.registerElement("vectorfield",t.Z.createVectorField),t.Z.createSlopeField=function(t,e,i){var r,o,n;if(!(e.length>=3&&(s.Z.isFunction(e[0])||s.Z.isString(e[0]))&&s.Z.isArray(e[1])&&3===e[1].length&&s.Z.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 o=s.Z.createFunction(e[0],t,"x, y"),e[0]=function(t,e){var i=o(t,e),s=Math.sqrt(1+i*i);return[1/s,i/s]},n=s.Z.copyAttributes(i,t.options,"slopefield"),(r=t.create("vectorfield",e,n)).elType="slopefield",r.setF=function(t,e){var i=s.Z.createFunction(t,r.board,e);this.F=function(t,e){var s=i(t,e),r=Math.sqrt(1+s*s);return[1/r,s/r]}},r.methodMap=s.Z.deepCopy(r.methodMap,{setF:"setF"}),r},t.Z.registerElement("slopefield",t.Z.createSlopeField),t.Z.createSmartLabel=function(t,e,r){var o,n,a,h,l,c;if(0===e.length||[i.Z.OBJECT_CLASS_POINT,i.Z.OBJECT_CLASS_LINE,i.Z.OBJECT_CLASS_CIRCLE].indexOf(e[0].elementClass)<0&&[i.Z.OBJECT_TYPE_POLYGON,i.Z.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 a=e[0],h=e[1]||"",a.elementClass===i.Z.OBJECT_CLASS_POINT?n=s.Z.copyAttributes(r,t.options,"smartlabelpoint"):a.elementClass===i.Z.OBJECT_CLASS_LINE?((n=s.Z.copyAttributes(r,t.options,"smartlabelline")).rotate=function(){return 180*Math.atan(a.getSlope())/Math.PI},n.visible=function(){return!(a.L()<1.5)}):a.elementClass===i.Z.OBJECT_CLASS_CIRCLE?(n=s.Z.copyAttributes(r,t.options,"smartlabelcircle")).visible=function(){return!(a.Radius()<1.5)}:a.type===i.Z.OBJECT_TYPE_POLYGON?n=s.Z.copyAttributes(r,t.options,"smartlabelpolygon"):a.type===i.Z.OBJECT_TYPE_ANGLE&&((n=s.Z.copyAttributes(r,t.options,"smartlabelangle")).rotate=function(){var t=a.center.coords.usrCoords,e=a.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?i+180:i},n.anchorX=function(){var t=a.center.coords.usrCoords,e=a.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?"right":"left"}),l=function(t,e,i,r){var o;switch(r){case"length":o=function(){return e.L()};break;case"slope":o=function(){return e.Slope()};break;case"area":o=function(){return e.Area()};break;case"radius":o=function(){return e.Radius()};break;case"perimeter":o=function(){return e.Perimeter()};break;case"rad":o=function(){return e.Value()};break;case"deg":o=function(){return 180*e.Value()/Math.PI};break;default:o=function(){return 0}}return function(){var e,i="",r=s.Z.evaluate(h),n=s.Z.evaluate(t.visProp.digits),a=s.Z.evaluate(t.visProp.unit),l=s.Z.evaluate(t.visProp.prefix),c=s.Z.evaluate(t.visProp.suffix),d=s.Z.evaluate(t.visProp.usemathjax)||s.Z.evaluate(t.visProp.usekatex);return""===r?(e=t.useLocale()?t.formatNumberLocale(o(),n):s.Z.toFixed(o(),n),i=d?["\\(",l,e,"\\,",a,c,"\\)"].join(""):[l,e,a,c].join("")):i=r,i}},a.elementClass===i.Z.OBJECT_CLASS_POINT?(o=t.create("text",[function(){return a.X()},function(){return a.Y()},""],n),c=function(){var t,e,i="",r=s.Z.evaluate(h),n=s.Z.evaluate(o.visProp.digits),l=s.Z.evaluate(o.visProp.unit),c=s.Z.evaluate(o.visProp.prefix),d=s.Z.evaluate(o.visProp.suffix),u=s.Z.evaluate(o.visProp.dir),p=s.Z.evaluate(o.visProp.usemathjax)||s.Z.evaluate(o.visProp.usekatex);return o.useLocale()?(t=o.formatNumberLocale(a.X(),n),e=o.formatNumberLocale(a.Y(),n)):(t=s.Z.toFixed(a.X(),n),e=s.Z.toFixed(a.Y(),n)),""===r?"row"===u?i=p?["\\(",c,t,"\\,",l," / ",e,"\\,",l,d,"\\)"].join(""):[c,t," ",l," / ",e," ",l,d].join(""):0===u.indexOf("col")&&(i=p?["\\(",c,"\\left(\\array{",t,"\\,",l,"\\\\ ",e,"\\,",l,"}\\right)",d,"\\)"].join(""):[c,t," ",l,"<br/>",e," ",l,d].join("")):i=r,i}):a.elementClass===i.Z.OBJECT_CLASS_LINE?"length"===n.measure?c=l(o=t.create("text",[function(){return.5*(a.point1.X()+a.point2.X())},function(){return.5*(a.point1.Y()+a.point2.Y())},""],n),a,0,"length"):"slope"===n.measure&&(c=l(o=t.create("text",[function(){return.25*a.point1.X()+.75*a.point2.X()},function(){return.25*a.point1.Y()+.75*a.point2.Y()},""],n),a,0,"slope")):a.elementClass===i.Z.OBJECT_CLASS_CIRCLE?"radius"===n.measure?c=l(o=t.create("text",[function(){return a.center.X()+.5*a.Radius()},function(){return a.center.Y()},""],n),a,0,"radius"):"area"===n.measure?c=l(o=t.create("text",[function(){return a.center.X()},function(){return a.center.Y()+.5*a.Radius()},""],n),a,0,"area"):"circumference"!==n.measure&&"perimeter"!==n.measure||(c=l(o=t.create("text",[function(){return a.getLabelAnchor()},""],n),a,0,"perimeter")):a.type===i.Z.OBJECT_TYPE_POLYGON?"area"===n.measure?c=l(o=t.create("text",[function(){return a.getTextAnchor()},""],n),a,0,"area"):"perimeter"===n.measure&&(c=l(o=t.create("text",[function(){var t=a.borders.length-1;return t>=0?[.5*(a.borders[t].point1.X()+a.borders[t].point2.X()),.5*(a.borders[t].point1.Y()+a.borders[t].point2.Y())]:a.getTextAnchor()},""],n),a,0,"perimeter")):a.type===i.Z.OBJECT_TYPE_ANGLE&&(c=l(o=t.create("text",[function(){return a.getLabelAnchor()},""],n),a,0,n.measure)),s.Z.exists(o)&&(o.setText(c),a.addChild(o),o.setParents([a])),o},t.Z.registerElement("smartlabel",t.Z.createSmartLabel),t.Z.ForeignObject=function(e,r,o,n,a){this.constructor(e,o,i.Z.OBJECT_TYPE_FOREIGNOBJECT,i.Z.OBJECT_CLASS_OTHER),this.element=this.board.select(o.anchor),this.coordsConstructor(r),this._useUserSize=!1,this.size=[1,1],s.Z.exists(a)&&a.length>0&&(this._useUserSize=!0,this.W=s.Z.createFunction(a[0],this.board,""),this.H=s.Z.createFunction(a[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=n,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this),this.methodMap=t.Z.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"})},t.Z.ForeignObject.prototype=new H.Z,s.Z.copyPrototypeMethods(t.Z.ForeignObject,V.Z,"coordsConstructor"),t.Z.extend(t.Z.ForeignObject.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c,d,p,f,_=this.transformations.length;return s.Z.isObject(s.Z.evaluate(this.visProp.precision))?(h=this.board._inputDevice,l=s.Z.evaluate(this.visProp.precision[h])):l=this.board.options.precision.hasPoint,0===_?(r=t-this.coords.scrCoords[1],n=this.coords.scrCoords[2]-e,r>=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.Z(i.Z.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],c[1]-this.span[0][1],c[2]-this.span[0][2]],0<=(p=(f=o.Z.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(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]=o.Z.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(s.Z.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=s.Z.createFunction(t,this.board,""),this.H=s.Z.createFunction(e,this.board,""),this._useUserSize=!0,this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}),t.Z.createForeignObject=function(e,i,r){var o,n,a=i[0],h=i[1],l=[];if(i.length>=2&&(l=i[2]),o=s.Z.copyAttributes(r,e.options,"foreignobject"),!(n=V.Z.create(t.Z.ForeignObject,e,h,o,a,l)))throw new Error("JSXGraph: Can't create foreignObject with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]");return n},t.Z.registerElement("foreignobject",t.Z.createForeignObject),t.Z.registerElement("fo",t.Z.createForeignObject);t.Z.ForeignObject;t.Z.extend(k.Z,{axes3d:{axesPosition:"center",xAxis:{visible:!0,point2:{name:"x"}},yAxis:{visible:!0,point2:{name:"y"}},zAxis:{visible:!0,point2:{name:"z"}},xPlaneRear:{visible:!0,layer:0,mesh3d:{layer:1}},yPlaneRear:{visible:!0,layer:0,mesh3d:{layer:1}},zPlaneRear:{visible:!0,layer:0,mesh3d:{layer:1}},xPlaneFront:{visible:!1,layer:0,mesh3d:{layer:1}},yPlaneFront:{visible:!1,layer:0,mesh3d:{layer:1}},zPlaneFront:{visible:!1,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,strokecolor:"black",strokeWidth:1,tabindex:null,point1:{visible:!1,name:""},point2:{visible:!1,name:"",label:{visible:!0}}},curve3d:{highlight:!1,tabindex:-1,strokeWidth:1,numberPointsHigh:200},mesh3d:{strokeWidth:1,strokeColor:"#9a9a9a",strokeOpacity:.6,highlight:!1,fillColor:"#9a9a9a",fillOpacity:.1,tabindex:null,visible:"inherit"},line3d:{strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",point:{visible:!1,name:""},point1:{visible:!1,name:""},point2:{visible:!1,name:""}},plane3d:{strokeWidth:0,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#a7a7a7",fillOpacity:.6,point:{visible:!1,name:"",fixed:!0}},point3d:{infoboxDigits:"auto",strokeWidth:0,gradient:"radial",gradientSecondColor:"#555555",fillColor:"yellow",highlightStrokeColor:"#555555"},surface3d:{highlight:!1,tabindex:-1,strokeWidth:1,stepsU:30,stepsV:30},vectorfield3d:{scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI}},view3d:{needsRegularUpdate:!0,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:!0,style:6,point1:{frozen:!0},point2:{frozen:!0},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:!0,style:6,point1:{frozen:!0},point2:{frozen:!0},min:0,max:2*Math.PI,start:.3}},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]],_currentView:-1}});t.Z.Options;t.Z.View3D=function(t,e,r){this.constructor(t,r,i.Z.OBJECT_TYPE_VIEW3D,i.Z.OBJECT_CLASS_3D),this.objects={},this.elementsByName={},this.defaultAxes=null,this.matrix3D=[[1,0,0,0],[0,1,0,0],[0,0,1,0]],this.llftCorner=e[0],this.size=e[1],this.bbox3D=e[2],this.r=-1,this.projectionType="parallel",this.timeoutAzimuth=null,this.id=this.board.setId(this,"V"),this.board.finalizeAdding(this),this.elType="view3d",this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.View3D.prototype=new H.Z,t.Z.extend(t.Z.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,r,o,n,a=t;if(null===a)return a;if(s.Z.isString(a)&&""!==a)s.Z.exists(this.objects[a])?a=this.objects[a]:s.Z.exists(this.elementsByName[a])&&(a=this.elementsByName[a]);else if(!e&&(s.Z.isFunction(a)||s.Z.isObject(a)&&!s.Z.isFunction(a.setAttribute))){for(r={},n=(i=s.Z.filterElements(this.objectsList,a)).length,o=0;o<n;o++)r[i[o].id]=i[o];a=new j(r)}else s.Z.isObject(a)&&s.Z.exists(a.id)&&!s.Z.exists(this.objects[a.id])&&(a=null);return a},updateParallelProjection:function(){var t,e,i,s,r=[[1,0,0,0],[0,1,0,0],[0,0,1,0]];return i=this.el_slide.Value(),t=this.r,e=this.az_slide.Value(),s=t*Math.sin(i),r[1][1]=t*Math.cos(e),r[1][2]=-t*Math.sin(e),r[2][1]=s*Math.sin(e),r[2][2]=s*Math.cos(e),r[2][3]=Math.cos(i),r},_updateCentralProjection:function(){var t,e,i,r,n,a,h,l,c,d,u,p,f,_=1/Math.tan(.5*s.Z.evaluate(this.visProp.fov)),g=[.5*(this.bbox3D[0][0]+this.bbox3D[0][1]),.5*(this.bbox3D[0][0]+this.bbox3D[0][1]),.5*(this.bbox3D[0][0]+this.bbox3D[0][1])],m=[[0,0,0,-1],[0,_,0,0],[0,0,_,0],[320/-12,0,0,28/-12]];return f=function(t,e,i){return[i*Math.cos(t)*Math.cos(e),-i*Math.sin(t)*Math.cos(e),i*Math.sin(e)]},i=this.az_slide.Value()+3*Math.PI*.5,e=2*this.el_slide.Value(),"auto"===(t=s.Z.evaluate(this.visProp.r))&&(t=1.01*Math.sqrt(Math.pow(this.bbox3D[0][0]-this.bbox3D[0][1],2)+Math.pow(this.bbox3D[1][0]-this.bbox3D[1][1],2)+Math.pow(this.bbox3D[2][0]-this.bbox3D[2][1],2))),r=f(i,e+Math.PI/2,1),p=[(u=f(i,e,t))[0]-g[0],u[1]-g[1],u[2]-g[2]],c=o.Z.norm(p,3),n=[p[0]/c,p[1]/c,p[2]/c],c=o.Z.norm(r,3),l=[r[0]/c,r[1]/c,r[2]/c],a=o.Z.crossProduct(l,n),h=o.Z.crossProduct(n,a),d=[[1,0,0,0],[-(l=o.Z.matVecMult([a,h,n],u))[0],a[0],a[1],a[2]],[-l[1],h[0],h[1],h[2]],[-l[2],n[0],n[1],n[2]]],m=o.Z.matMatMult(m,d)},update:function(){var t,e;if(!s.Z.exists(this.el_slide)||!s.Z.exists(this.az_slide)||!this.needsUpdate)return this;if(t=[[1,0,0],[0,1,0],[0,0,1]],this.projectionType=s.Z.evaluate(this.visProp.projection).toLowerCase(),"central"===this.projectionType)this.matrix3D=this._updateCentralProjection(),.4,t[1][1]=this.size[0]/.8,t[2][2]=this.size[1]/.8,t[1][0]=this.llftCorner[0]+.5*t[1][1]*.8,t[2][0]=this.llftCorner[1]+.5*t[2][2]*.8,this.viewPortTransform=t;else e=[[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]],t[1][1]=this.size[0]/(this.bbox3D[0][1]-this.bbox3D[0][0]),t[2][2]=this.size[1]/(this.bbox3D[1][1]-this.bbox3D[1][0]),t[1][0]=this.llftCorner[0]+.5*t[1][1]*(this.bbox3D[0][1]-this.bbox3D[0][0]),t[2][0]=this.llftCorner[1]+.5*t[2][2]*(this.bbox3D[1][1]-this.bbox3D[1][0]),this.matrix3D=this.updateParallelProjection(),this.matrix3D=o.Z.matMatMult(t,o.Z.matMatMult(this.matrix3D,e));return this},updateRenderer:function(){return this.needsUpdate=!1,this},removeObject:function(e,i){var r;if(s.Z.isArray(e)){for(r=0;r<e.length;r++)this.removeObject(e[r]);return this}if(e=this.select(e),!s.Z.exists(e)||s.Z.isString(e))return this;try{delete this.objects[e.id]}catch(i){t.Z.debug("View3D "+e.id+": Could not be removed: "+i)}return this.board.removeObject(e,i),this},project3DTo2D:function(t,e,i){var s,r;return s=3===arguments.length?[1,t,e,i]:3===t.length?[1].concat(t):t,r=o.Z.matVecMult(this.matrix3D,s),"central"===this.projectionType?(r[1]/=r[0],r[2]/=r[0],r[3]/=r[0],r[0]/=r[0],o.Z.matVecMult(this.viewPortTransform,r.slice(0,3))):r},project2DTo3DPlane:function(t,e,i){var s,r,n,a,h,l=e.slice(1);i=i||[1,0,0,0],a=o.Z.norm(l,3),n=o.Z.innerProduct(i.slice(1),l,3)/a,(s=this.matrix3D.slice(0,3)).push([0].concat(l)),r=t.coords.usrCoords.concat([n]);try{1===s[2][3]&&(s[2][1]=s[2][2]=.001*o.Z.eps),h=o.Z.Numerics.Gauss(s,r)}catch(t){h=[0,NaN,NaN,NaN]}return h},project2DTo3DVertical:function(t,e){var i=this.matrix3D[2],s=i[3],r=t.coords.usrCoords[2];return r-=i[0]*e[0]+i[1]*e[1]+i[2]*e[2],Math.abs(s)<o.Z.eps?e:e.slice(0,3).concat([r/s])},project3DToCube:function(t){var e=this.bbox3D;return t[1]<e[0][0]&&(t[1]=e[0][0]),t[1]>e[0][1]&&(t[1]=e[0][1]),t[2]<e[1][0]&&(t[2]=e[1][0]),t[2]>e[1][1]&&(t[2]=e[1][1]),t[3]<e[2][0]&&(t[3]=e[2][0]),t[3]>e[2][1]&&(t[3]=e[2][1]),t},intersectionLineCube:function(t,e,i){var s,r,o,n;for(s=i,r=0;r<3;r++)0!==e[r]&&(o=(this.bbox3D[r][0]-t[r])/e[r],n=(this.bbox3D[r][1]-t[r])/e[r],s=i<0?Math.max(s,Math.min(o,n)):Math.min(s,Math.max(o,n)));return s},isInCube:function(t){return t[0]>this.bbox3D[0][0]-o.Z.eps&&t[0]<this.bbox3D[0][1]+o.Z.eps&&t[1]>this.bbox3D[1][0]-o.Z.eps&&t[1]<this.bbox3D[1][1]+o.Z.eps&&t[2]>this.bbox3D[2][0]-o.Z.eps&&t[2]<this.bbox3D[2][1]+o.Z.eps},intersectionPlanePlane:function(t,e,i){var s,r,n,a,h=[[],[]];return i=i||e.d,s=o.Z.Geometry.meet3Planes(t.normal,t.d,e.normal,i,o.Z.crossProduct(t.normal,e.normal),0),r=o.Z.Geometry.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),n=this.intersectionLineCube(s,r,1/0),a=o.Z.axpy(n,r,s),this.isInCube(a)&&(h[0]=a),n=this.intersectionLineCube(s,r,-1/0),a=o.Z.axpy(n,r,s),this.isInCube(a)&&(h[1]=a),h},getMesh:function(t,e,i){var r,o,n,a,h,l,c,d=[0,0,0],u=e[2],p=i[2],f=[],_=[];for(l=(s.Z.evaluate(e[1])-s.Z.evaluate(e[0]))/u,c=(s.Z.evaluate(i[1])-s.Z.evaluate(i[0]))/p,r=0;r<=u;r++){for(n=e[0]+l*r,o=0;o<=p;o++)a=i[0]+c*o,d=s.Z.isFunction(t)?t(n,a):[t[0](n,a),t[1](n,a),t[2](n,a)],h=this.project3DTo2D(d),f.push(h[1]),_.push(h[2]);f.push(NaN),_.push(NaN)}for(o=0;o<=p;o++){for(a=i[0]+c*o,r=0;r<=u;r++)n=e[0]+l*r,d=s.Z.isFunction(t)?t(n,a):[t[0](n,a),t[1](n,a),t[2](n,a)],h=this.project3DTo2D(d),f.push(h[1]),_.push(h[2]);f.push(NaN),_.push(NaN)}return[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.update(),this.timeoutAzimuth=setTimeout(function(){this.animateAzimuth()}.bind(this),200)},stopAzimuth:function(){clearTimeout(this.timeoutAzimuth),this.timeoutAzimuth=null},isVerticalDrag:function(){var t=this.board;return!!s.Z.evaluate(this.visProp.verticaldrag.enabled)&&t["_"+s.Z.evaluate(this.visProp.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=s.Z.evaluate(this.visProp.values),e=this.visProp._currentview;return e=(e+1)%t.length,this.setCurrentView(e),this},previousView:function(){var t=s.Z.evaluate(this.visProp.values),e=this.visProp._currentview;return e=(e+t.length-1)%t.length,this.setCurrentView(e),this},setCurrentView:function(t){var e=s.Z.evaluate(this.visProp.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,r=(e-i)/this.board.canvasWidth*s.Z.evaluate(this.visProp.az.pointer.speed),o=t.movementX,n=this.az_slide.Value(),a=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(s.Z.evaluate(this.visProp.az.keyboard.enabled)&&("ArrowRight"===t.key?n+=s.Z.evaluate(this.visProp.az.keyboard.step)*Math.PI/180:"ArrowLeft"===t.key&&(n-=s.Z.evaluate(this.visProp.az.keyboard.step)*Math.PI/180)),s.Z.evaluate(this.visProp.az.pointer.enabled)&&0!==o&&null==t.key&&(n+=o*r),s.Z.evaluate(this.visProp.az.continuous)?n=(n%e+e)%e:n>0?n=Math.min(e,n):n<0&&(n=Math.max(i,n)),this.setView(n,a)),this},_elEventHandler:function(t){var e=this.el_slide._smax,i=this.el_slide._smin,r=(e-i)/this.board.canvasHeight*s.Z.evaluate(this.visProp.el.pointer.speed),o=t.movementY,n=this.az_slide.Value(),a=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(s.Z.evaluate(this.visProp.el.keyboard.enabled)&&("ArrowUp"===t.key?a-=s.Z.evaluate(this.visProp.el.keyboard.step)*Math.PI/180:"ArrowDown"===t.key&&(a+=s.Z.evaluate(this.visProp.el.keyboard.step)*Math.PI/180)),s.Z.evaluate(this.visProp.el.pointer.enabled)&&0!==o&&null==t.key&&(a+=o*r),s.Z.evaluate(this.visProp.el.continuous)?a=(a%e+e)%e:a>0?a=Math.min(e,a):a<0&&(a=Math.max(i,a)),this.setView(n,a)),this}}),t.Z.createView3D=function(i,r,o){var n,a,h,l,c,d,u,p,f=r[0],_=r[1];return a=s.Z.copyAttributes(o,i.options,"view3d"),(n=new t.Z.View3D(i,r,a)).defaultAxes=n.create("axes3d",r,o),c=f[0],d=f[1],u=_[0],p=_[1],(h=s.Z.copyAttributes(o,i.options,"view3d","az","slider")).name="az",(l=s.Z.copyAttributes(o,i.options,"view3d","el","slider")).name="el",n.az_slide=i.create("slider",[[c-1,d-2],[c+u+1,d-2],[s.Z.evaluate(h.min),s.Z.evaluate(h.start),s.Z.evaluate(h.max)]],h),n.el_slide=i.create("slider",[[c-1,d],[c-1,d+p],[s.Z.evaluate(l.min),s.Z.evaluate(l.start),s.Z.evaluate(l.max)]],l),n.board.highlightInfobox=function(t,e,i){var r,o,a,h,l,c,d='<span style="color:black; font-size:200%">⇄ </span>',u=i.board,p=null;for(n.isVerticalDrag()&&(d='<span style="color:black; font-size:200%">⇅ </span>'),o=0;o<i.parents.length&&!(p=u.objects[i.parents[o]]).is3D;o++);if(p){if(h=[1,0,0,p.coords[3]],a=n.project2DTo3DPlane(p.element2D,[1,0,0,1],h),!n.isInCube(a))return void n.board.highlightCustomInfobox("",p);r=s.Z.evaluate(p.visProp.infoboxdigits),c=n.board.infobox,l="auto"===r?c.useLocale()?[d,"(",c.formatNumberLocale(p.X())," | ",c.formatNumberLocale(p.Y())," | ",c.formatNumberLocale(p.Z()),")"]:[d,"(",s.Z.autoDigits(p.X())," | ",s.Z.autoDigits(p.Y())," | ",s.Z.autoDigits(p.Z()),")"]:c.useLocale()?[d,"(",c.formatNumberLocale(p.X(),r)," | ",c.formatNumberLocale(p.Y(),r)," | ",c.formatNumberLocale(p.Z(),r),")"]:[d,"(",s.Z.toFixed(p.X(),r)," | ",s.Z.toFixed(p.Y(),r)," | ",s.Z.toFixed(p.Z(),r),")"],n.board.highlightCustomInfobox(l.join(""),p)}else n.board.highlightCustomInfobox("("+t+", "+e+")",i)},n.BOARD_MODE_NONE=0,e.Z.addEvent(i.containerObj,"keydown",(function(t){var e;!s.Z.evaluate(n.visProp.el.keyboard.enabled)||"ArrowUp"!==t.key&&"ArrowDown"!==t.key||("none"===(e=s.Z.evaluate(n.visProp.el.keyboard.key))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&n._elEventHandler(t),!s.Z.evaluate(n.visProp.el.keyboard.enabled)||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||("none"===(e=s.Z.evaluate(n.visProp.az.keyboard.key))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&n._azEventHandler(t),"PageUp"===t.key?n.nextView():"PageDown"===t.key&&n.previousView(),t.preventDefault()}),n),i.containerObj.addEventListener("pointerdown",(function(t){var r,o,a;s.Z.evaluate(n.visProp.az.pointer.enabled)&&(r=s.Z.evaluate(n.visProp.az.pointer.button),o=s.Z.evaluate(n.visProp.az.pointer.key),-1!==r&&r!==t.button||!("none"===o||o.indexOf("shift")>-1&&t.shiftKey||o.indexOf("ctrl")>-1&&t.ctrlKey)||(a=s.Z.evaluate(n.visProp.az.pointer.outside)?document:i.containerObj,e.Z.addEvent(a,"pointermove",n._azEventHandler,n),n._hasMoveAz=!0)),s.Z.evaluate(n.visProp.el.pointer.enabled)&&(r=s.Z.evaluate(n.visProp.el.pointer.button),o=s.Z.evaluate(n.visProp.el.pointer.key),-1!==r&&r!==t.button||!("none"===o||o.indexOf("shift")>-1&&t.shiftKey||o.indexOf("ctrl")>-1&&t.ctrlKey)||(a=s.Z.evaluate(n.visProp.el.pointer.outside)?document:i.containerObj,e.Z.addEvent(a,"pointermove",n._elEventHandler,n),n._hasMoveEl=!0)),e.Z.addEvent(document,"pointerup",(function t(){var i;n._hasMoveAz&&(i=s.Z.evaluate(n.visProp.az.pointer.outside)?document:n.board.containerObj,e.Z.removeEvent(i,"pointermove",n._azEventHandler,n),n._hasMoveAz=!1),n._hasMoveEl&&(i=s.Z.evaluate(n.visProp.el.pointer.outside)?document:n.board.containerObj,e.Z.removeEvent(i,"pointermove",n._elEventHandler,n),n._hasMoveEl=!1),e.Z.removeEvent(document,"pointerup",t,n)}),n)})),n.board.update(),n},t.Z.registerElement("view3d",t.Z.createView3D);t.Z.View3D;t.Z.GeometryElement3D=function(t,e){this.elType=e,this.id=this.board.setId(this,e),this.view=t,this.element2D=null,this.is3D=!0,this.view.objects[this.id]=this,""!==this.name&&(this.view.elementsByName[this.name]=this)},t.Z.extend(t.Z.GeometryElement3D.prototype,{setAttr2D:function(t){var e=t;return e.name=this.name,e},setAttribute:function(e){var i,r,o,n,a,h={};for(i=0;i<arguments.length;i++)n=arguments[i],s.Z.isString(n)?(a=n.split(":"),h[s.Z.trim(a[0])]=s.Z.trim(a[1])):s.Z.isArray(n)?h[n[0]]=n[1]:t.Z.extend(h,n);for(i in h)if(h.hasOwnProperty(i))switch(r=i.replace(/\s+/g,"").toLowerCase(),o=h[i],r){case"numberpointshigh":case"stepsu":case"stepsv":s.Z.exists(this.visProp[r])&&(!t.Z.Validator[r]||t.Z.Validator[r]&&t.Z.Validator[r](o)||t.Z.Validator[r]&&s.Z.isFunction(o)&&t.Z.Validator[r](o()))&&(o=(!o.toLowerCase||"false"!==o.toLowerCase())&&o,this._set(r,o));break;default:s.Z.exists(this.element2D)&&this.element2D.setAttribute(h)}},getAttribute:function(t){var e;switch(t=t.toLowerCase()){case"numberpointshigh":case"stepsu":case"stepsv":e=this.visProp[t];break;default:s.Z.exists(this.element2D)&&(e=this.element2D.getAttribute(t))}return e},getAttributes:function(){var t,e,i={},r=["numberpointshigh","stepsu","stepsv"],o=r.length;for(s.Z.exists(this.element2D)&&(i=s.Z.merge(this.element2D.getAttributes())),t=0;t<o;t++)e=r[t],s.Z.exists(this.visProp[e])&&(i[e]=this.visProp[e]);return i},remove:function(){}});t.Z.GeometryElement3D;t.Z.createAxes3D=function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,_,g,m,b,v,Z,C=e[0],y=["x","y","z"],P="Axis",E=["Rear","Front"],O=[0,0,0],x=[0,0,0],w={};if(s.Z.exists(C.bbox3D))for(r=0;r<y.length;r++)O[r]=C.bbox3D[r][0],x[r]=C.bbox3D[r][1];else for(r=0;r<y.length;r++)O[r]=e[1][r],x[r]=e[2][1];for(c=(l=s.Z.copyAttributes(i,t.options,"axes3d")).axesposition,r=0;r<y.length;r++)b=(d=y[r])+P,"center"===c?(u=[0,0,0],(p=[0,0,0])[r]=x[r],w[b]=C.create("axis3d",[u,p],l[b.toLowerCase()])):(b+="Border",u=O.slice(),p=x.slice(),2===r?(u[1]=x[1],p[0]=O[0]):(u[r]=x[r],p[2]=O[2]),p[r]=x[r],l[b.toLowerCase()].lastArrow=!1,w[b]=C.create("axis3d",[u,p],l[b.toLowerCase()]),Z={visible:!0,minorTicks:0,tickEndings:[0,1],drawLabels:!1},2===r&&(Z.tickEndings=[1,0]),w[b+"Ticks"]=C.create("ticks",[w[b],1],Z));for(w.O=C.create("intersection",[w[y[0]+P],w[y[1]+P]],{name:"",visible:!1,withLabel:!1}),r=0;r<y.length;r++)for(a=(r+1)%3,h=(r+2)%3,d=y[r],o=0;o<E.length;o++)(u=[0,0,0])[r]=0===o?O[r]:x[r],_=[0,0,0],(f=[0,0,0])[a]=1,_[h]=1,g=[O[a],x[a]],m=[O[h],x[h]],b=d+"Plane"+E[o],l=s.Z.copyAttributes(i,t.options,"axes3d",b),w[b]=C.create("plane3d",[u,f,_,g,m],l),w[b].elType="axisplane3d";for(r=0;r<y.length;r++)for(d=y[r],o=0;o<E.length;o++)for(n=1;n<=2;n++)b=d+"Plane"+E[o]+y[a=(r+n)%3].toUpperCase()+"Axis",v=d+"Plane"+E[o],(u=[0,0,0])[r]=(p=[0,0,0])[r]=0===o?O[r]:x[r],u[a]=O[a],p[a]=x[a],l=s.Z.copyAttributes(i,t.options,"axes3d",b),w[b]=C.create("axis3d",[u,p],l),w[v].addChild(w[b]),w[v].element2D.inherits.push(w[b]);return w},t.Z.registerElement("axes3d",t.Z.createAxes3D),t.Z.createAxis3D=function(t,e,i){var r,o,n,a,h,l,c=e[0],d=e[1],u=e[2];return r=s.Z.copyAttributes(i.point1,t.options,"axis3d","point1"),o=c.create("point",[(a=d[0],h=d[1],l=d[2],function(){return c.project3DTo2D(a,h,l)[1]}),function(t,e,i){return function(){return c.project3DTo2D(t,e,i)[2]}}(d[0],d[1],d[2])],r),r=s.Z.copyAttributes(i.point2,t.options,"axis3d","point2"),n=c.create("point",[function(t,e,i){return function(){return c.project3DTo2D(t,e,i)[1]}}(u[0],u[1],u[2]),function(t,e,i){return function(){return c.project3DTo2D(t,e,i)[2]}}(u[0],u[1],u[2])],r),r=s.Z.copyAttributes(i,t.options,"axis3d"),c.create("arrow",[o,n],r)},t.Z.registerElement("axis3d",t.Z.createAxis3D),t.Z.createMesh3D=function(e,i,r){var o,n=i[0],a=i[1],h=i[2],l=i[3],c=i[4],d=i[5];return(o=n.create("curve",[[],[]],r)).updateDataArray=function(){var e,i,r,o,u=l[0],p=l[1],f=d[0],_=d[1],g=[0,0,0],m=[0,0,0],b=[0,0,0];if(this.dataX=[],this.dataY=[],s.Z.isFunction(a))b=a().slice(1);else for(o=0;o<3;o++)b[o]=s.Z.evaluate(a[o]);for(o=0;o<3;o++)g[o]=s.Z.evaluate(h[o]),m[o]=s.Z.evaluate(c[o]);for(e=t.Z.Math.norm(g,3),i=t.Z.Math.norm(m,3),o=0;o<3;o++)g[o]/=e,m[o]/=i;r=n.getMesh([function(t,e){return b[0]+t*g[0]+e*m[0]},function(t,e){return b[1]+t*g[1]+e*m[1]},function(t,e){return b[2]+t*g[2]+e*m[2]}],[Math.ceil(u),Math.floor(p),(Math.ceil(p)-Math.floor(u))/1],[Math.ceil(f),Math.floor(_),(Math.ceil(_)-Math.floor(f))/1]),this.dataX=r[0],this.dataY=r[1]},o},t.Z.registerElement("mesh3d",t.Z.createMesh3D),t.Z.Point3D=function(t,e,r,o){this.constructor(t.board,o,i.Z.OBJECT_TYPE_POINT3D,i.Z.OBJECT_CLASS_3D),this.constructor3D(t,"point3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.F=e,this.slide=r,this.X=function(){return this.coords[1]},this.Y=function(){return this.coords[2]},this.Z=function(){return this.coords[3]},this._params=null,this._c2d=null,this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.Point3D.prototype=new t.Z.GeometryElement,s.Z.copyPrototypeMethods(t.Z.Point3D,t.Z.GeometryElement3D,"constructor3D"),t.Z.extend(t.Z.Point3D.prototype,{updateCoords:function(){var t;if(s.Z.isFunction(this.F))this.coords=[1].concat(s.Z.evaluate(this.F));else for(this.coords[0]=1,t=0;t<3;t++)s.Z.isFunction(this.F[t])&&(this.coords[t+1]=s.Z.evaluate(this.F[t]));return this},initCoords:function(){var t;if(s.Z.isFunction(this.F))this.coords=[1].concat(s.Z.evaluate(this.F));else for(this.coords[0]=1,t=0;t<3;t++)this.coords[t+1]=s.Z.evaluate(this.F[t]);return this},normalizeCoords:function(){return Math.abs(this.coords[0])>o.Z.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;this.coords.slice();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,s;return this.element2D.draggable()&&0!==h.Z.distance(this._c2d,this.element2D.coords.usrCoords)?this.slide?this.projectCoords2Surface():(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(s=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],s)),0!==e[0]&&(this.coords=this.view.project3DToCube(e))):(this.updateCoords(),this.element2D.coords.setCoordinates(i.Z.COORDS_BY_USER,this.view.project3DTo2D([1,this.X(),this.Y(),this.Z()]))),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords2Surface:function(){var t,e,r,n=[0,0],a=this.slide,h=this;null!==a&&(r=function(t,e,i,s){var r=[1,a.X(i[0],i[1]),a.Y(i[0],i[1]),a.Z(i[0],i[1])],o=h.view.project3DTo2D(r);return s[0]=h.element2D.X()-o[1],s[1]=h.element2D.Y()-o[2],s[0]*s[0]+s[1]*s[1]},s.Z.exists(this._params)&&(n=this._params.slice()),o.Z.Nlp.FindMinimum(r,2,2,n,5,1e-6,0,200),t=[1,a.X(n[0],n[1]),a.Y(n[0],n[1]),a.Z(n[0],n[1])],e=this.view.project3DTo2D(t),this._params=n,this.coords=t,this.element2D.coords.setCoordinates(i.Z.COORDS_BY_USER,e),this._c2d=e)},__evt__update3D:function(t){}}),t.Z.createPoint3D=function(e,i,r){var o,n,a,h,l,c=i[0];if(a=i.length>2&&s.Z.exists(i[i.length-1].is3D)?i.pop():null,2===i.length)n=i[1];else{if(4!==i.length)throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [[x,y,z]], [x,y,z]");n=i.slice(1)}return o=s.Z.copyAttributes(r,e.options,"point3d"),(l=new t.Z.Point3D(c,n,a,o)).initCoords(),h=c.project3DTo2D(l.coords),o=l.setAttr2D(o),l.element2D=c.create("point",h,o),l.addChild(l.element2D),l.inherits.push(l.element2D),l.element2D.setParents(l),l._c2d=l.element2D.coords.usrCoords.slice(),l},t.Z.registerElement("point3d",t.Z.createPoint3D),t.Z.Curve3D=function(t,e,r,o,n,a,h){this.constructor(t.board,h,i.Z.OBJECT_TYPE_CURVE3D,i.Z.OBJECT_CLASS_3D),this.constructor3D(t,"curve3d"),this.board.finalizeAdding(this),this.F=e,this.X=r,this.Y=o,this.Z=n,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]}),this.range=a,this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.Curve3D.prototype=new t.Z.GeometryElement,s.Z.copyPrototypeMethods(t.Z.Curve3D,t.Z.GeometryElement3D,"constructor3D"),t.Z.extend(t.Z.Curve3D.prototype,{updateDataArray2D:function(){var t,e,i,r,o,n,a,h,l,c=s.Z.evaluate(this.visProp.numberpointshigh),d=[0,0,0];if(a=[],h=[],s.Z.exists(this.dataX))for(c=this.dataX.length,n=0;n<c;n++)d=[this.dataX[n],this.dataY[n],this.dataZ[n]],o=this.view.project3DTo2D(d),a.push(o[1]),h.push(o[2]);else if(s.Z.isArray(this.X))for(c=this.X.length,n=0;n<c;n++)d=[this.X[n],this.Y[n],this.Z[n]],o=this.view.project3DTo2D(d),a.push(o[1]),h.push(o[2]);else for(t=s.Z.evaluate(this.range),e=s.Z.evaluate(t[0]),r=((i=s.Z.evaluate(t[1]))-e)/(c-1),l=0,n=e;l<c&&n<=i;l++,n+=r)d=null!==this.F?this.F(n):[this.X(n),this.Y(n),this.Z(n)],o=this.view.project3DTo2D(d),a.push(o[1]),h.push(o[2]);return{X:a,Y:h}},updateDataArray:function(){},update:function(){return this.updateDataArray(),this},updateRenderer:function(){return this.needsUpdate=!1,this}}),t.Z.createCurve3D=function(e,i,r){var o,n,a,h,l,c,d,u=i[0];return 3===i.length?(o=i[1],l=i[2],n=null,a=null,h=null):(n=i[1],a=i[2],h=i[3],l=i[4],o=null),c=s.Z.copyAttributes(r,e.options,"curve3d"),c=(d=new t.Z.Curve3D(u,o,n,a,h,l,c)).setAttr2D(c),d.element2D=u.create("curve",[[],[]],c),d.element2D.updateDataArray=function(){var t=d.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},d.addChild(d.element2D),d.inherits.push(d.element2D),d.element2D.setParents(d),d.element2D.prepareUpdate().update(),e.isSuspendedUpdate||d.element2D.updateVisibility().updateRenderer(),d},t.Z.registerElement("curve3d",t.Z.createCurve3D),t.Z.createVectorfield3D=function(t,e,i){var r,n,a=e[0];if(!(e.length>=5&&(s.Z.isArray(e[1])||s.Z.isFunction(e[0])||s.Z.isString(e[0]))&&s.Z.isArray(e[2])&&3===e[1].length&&s.Z.isArray(e[3])&&3===e[2].length&&s.Z.isArray(e[4])&&3===e[3].length))throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.'"+typeof e[1]+"', ");return n=s.Z.copyAttributes(i,t.options,"vectorfield3d"),(r=a.create("curve3d",[[],[],[]],n)).setF=function(t,e){var i,o,n;return s.Z.isArray(t)?(i=s.Z.createFunction(t[0],this.board,e),o=s.Z.createFunction(t[1],this.board,e),n=s.Z.createFunction(t[2],this.board,e),this.F=function(t,e,s){return[i(t,e,s),o(t,e,s),n(t,e,s)]}):this.F=s.Z.createFunction(t,r.board,e),this},r.setF(e[1],"x, y, z"),r.xData=e[2],r.yData=e[3],r.zData=e[4],r.updateDataArray=function(){var e,i,r,n,a,h,l,c,d,u,p,f,_,g,m,b,v,Z=s.Z.evaluate(this.visProp.scale),C=[s.Z.evaluate(this.xData[0]),s.Z.evaluate(this.yData[0]),s.Z.evaluate(this.zData[0])],y=[s.Z.evaluate(this.xData[1]),s.Z.evaluate(this.yData[1]),s.Z.evaluate(this.zData[1])],P=[s.Z.evaluate(this.xData[2]),s.Z.evaluate(this.yData[2]),s.Z.evaluate(this.zData[2])],E=[(P[0]-C[0])/y[0],(P[1]-C[1])/y[1],(P[2]-C[2])/y[2]],O=s.Z.evaluate(this.visProp.arrowhead.enabled);for(O&&(_=s.Z.evaluate(this.visProp.arrowhead.size),v=s.Z.evaluate(this.visProp.arrowhead.angle),g=_/t.unitX,m=_/t.unitY,b=_/Math.sqrt(t.unitX*t.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],i=0,h=C[0];i<=y[0];h+=E[0],i++)for(r=0,l=C[1];r<=y[1];l+=E[1],r++)for(e=0,c=C[2];e<=y[2];c+=E[2],e++)n=this.F(h,l,c),(a=o.Z.norm(n))<Number.EPSILON||(n[0]*=Z,n[1]*=Z,n[2]*=Z,this.dataX=this.dataX.concat([h,h+n[0],NaN]),this.dataY=this.dataY.concat([l,l+n[1],NaN]),this.dataZ=this.dataZ.concat([c,c+n[2],NaN]),O&&(a*=Z,d=Math.atan2(n[1],n[0]),u=(f=Math.asin(n[2]/a))-v,p=f+v,this.dataX=this.dataX.concat([h+n[0]-g*Math.cos(d)*Math.cos(u),h+n[0],h+n[0]-g*Math.cos(d)*Math.cos(p),NaN]),this.dataY=this.dataY.concat([l+n[1]-m*Math.sin(d)*Math.cos(u),l+n[1],l+n[1]-m*Math.sin(d)*Math.cos(p),NaN]),this.dataZ=this.dataZ.concat([c+n[2]-b*Math.sin(p),c+n[2],c+n[2]-b*Math.sin(u),NaN])))},r.methodMap=s.Z.deepCopy(r.methodMap,{setF:"setF"}),r},t.Z.registerElement("vectorfield3D",t.Z.createVectorfield3D),t.Z.Line3D=function(t,e,r,o,n){this.constructor(t.board,n,i.Z.OBJECT_TYPE_LINE3D,i.Z.OBJECT_CLASS_3D),this.constructor3D(t,"line3d"),this.board.finalizeAdding(this),this.point=e,this.direction=r,this.range=o||[-1/0,1/0],this.point1=null,this.point2=null,this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.Line3D.prototype=new t.Z.GeometryElement,s.Z.copyPrototypeMethods(t.Z.Line3D,t.Z.GeometryElement3D,"constructor3D"),t.Z.extend(t.Z.Line3D.prototype,{getPointCoords:function(t){var e,i,r,o=[];if(e=[this.point.X(),this.point.Y(),this.point.Z()],s.Z.isFunction(this.direction))o=this.direction();else for(i=1;i<4;i++)o.push(s.Z.evaluate(this.direction[i]));return r=s.Z.evaluate(t),Math.abs(r)===1/0&&(t=this.view.intersectionLineCube(e,o,r)),[e[0]+o[0]*r,e[1]+o[1]*r,e[2]+o[2]*r]},update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this}}),t.Z.createLine3D=function(e,i,r){var o,n,a,h,l,c,d,u,p=i[0];return o=s.Z.copyAttributes(r,e.options,"line3d"),s.Z.isPoint3D(i[2])||3===i.length&&(s.Z.isArray(i[2])||s.Z.isFunction(i[2]))?(c=s.Z.providePoints3D(p,[i[1]],r,"line3d",["point1"])[0],d=s.Z.providePoints3D(p,[i[2]],r,"line3d",["point2"])[0],h=function(){return[d.X()-c.X(),d.Y()-c.Y(),d.Z()-c.Z()]},l=[0,1],u=new t.Z.Line3D(p,c,h,l,o)):(a=s.Z.providePoints3D(p,[i[1]],r,"line3d",["point"])[0],s.Z.isFunction(i[2])?h=i[2]:3===i[2].length?h=[1].concat(i[2]):4===i[2].length&&(h=i[2]),l=i[3],n=s.Z.providePoints3D(p,[[0,0,0],[0,0,0]],r,"line3d",["point1","point2"]),u=new t.Z.Line3D(p,a,h,l,o),n[0].F=function(){return u.getPointCoords(s.Z.evaluate(u.range[0]))},n[0].prepareUpdate().update(),c=n[0],n[1].F=function(){return u.getPointCoords(s.Z.evaluate(u.range[1]))},n[1].prepareUpdate().update(),d=n[1]),o=u.setAttr2D(o),u.element2D=p.create("segment",[c.element2D,d.element2D],o),u.addChild(u.element2D),u.inherits.push(u.element2D),u.element2D.setParents(u),u.point1=c,u.point2=d,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),s.Z.exists(a)&&(a._is_new?(u.addChild(a),delete a._is_new):a.addChild(u)),u.update(),u.element2D.prepareUpdate().update().updateRenderer(),u},t.Z.registerElement("line3d",t.Z.createLine3D),t.Z.Plane3D=function(t,e,r,o,n,a,h){this.constructor(t.board,h,i.Z.OBJECT_TYPE_PLANE3D,i.Z.OBJECT_CLASS_3D),this.constructor3D(t,"plane3d"),this.board.finalizeAdding(this),this.point=e,this.direction1=r,this.direction2=n,this.range1=o||[-1/0,1/0],this.range2=a||[-1/0,1/0],this.vec1=[0,0,0],this.vec2=[0,0,0],this.grid=null,this.normal=[0,0,0],this.d=0,this.updateNormal(),this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.Plane3D.prototype=new t.Z.GeometryElement,s.Z.copyPrototypeMethods(t.Z.Plane3D,t.Z.GeometryElement3D,"constructor3D"),t.Z.extend(t.Z.Plane3D.prototype,{updateNormal:function(){var t,e;for(t=0;t<3;t++)this.vec1[t]=s.Z.evaluate(this.direction1[t]),this.vec2[t]=s.Z.evaluate(this.direction2[t]);if(this.normal=o.Z.crossProduct(this.vec1,this.vec2),e=o.Z.norm(this.normal),Math.abs(e)>o.Z.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.d=o.Z.innerProduct(this.point.coords.slice(1),this.normal,3),this},updateDataArray:function(){var t,e,i,r,n,a,l,c,d,u,p,f,_,g,m=["xPlaneRear","yPlaneRear","zPlaneRear"],b=[],v=[0,0,0],Z=[0,0,0],C=[0,0,0],y=[0,0,0],P=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&P.defaultAxes&&s.Z.evaluate(this.range1[0])===-1/0&&s.Z.evaluate(this.range1[1])===1/0&&s.Z.evaluate(this.range2[0])===-1/0&&s.Z.evaluate(this.range2[1])===1/0){for(u=0;u<m.length;u++){if(3===(y=P.intersectionPlanePlane(this,P.defaultAxes[m[u]]))[0].length&&3===y[1].length){for(d=0;d<b.length&&!(h.Z.distance(y[0],b[d][0],3)<o.Z.eps&&h.Z.distance(y[1],b[d][1],3)<o.Z.eps||h.Z.distance(y[0],b[d][1],3)<o.Z.eps&&h.Z.distance(y[1],b[d][0],3)<o.Z.eps);d++);d===b.length&&b.push(y.slice())}if((y=[0,0,0])[u]=P.bbox3D[u][1],c=o.Z.innerProduct(y,P.defaultAxes[m[u]].normal,3),3===(y=P.intersectionPlanePlane(this,P.defaultAxes[m[u]],c))[0].length&&3===y[1].length){for(d=0;d<b.length&&!(h.Z.distance(y[0],b[d][0],3)<o.Z.eps&&h.Z.distance(y[1],b[d][1],3)<o.Z.eps||h.Z.distance(y[0],b[d][1],3)<o.Z.eps&&h.Z.distance(y[1],b[d][0],3)<o.Z.eps);d++);d===b.length&&b.push(y.slice())}}0,_=0,d=0;do{for(3===(y=b[_][d]).length&&(n=P.project3DTo2D(y),this.dataX.push(n[1]),this.dataY.push(n[2])),d=(d+1)%2,y=b[_][d],g=_,u=0;u<b.length;u++){if(u!==_&&h.Z.distance(y,b[u][0])<o.Z.eps){_=u,d=0;break}if(u!==_&&h.Z.distance(y,b[u][1])<o.Z.eps){_=u,d=1;break}}if(_===g){console.log("Error: update plane3d: did not find next",_);break}}while(0!==_);n=P.project3DTo2D(b[0][0]),this.dataX.push(n[1]),this.dataY.push(n[2])}else{for(t=s.Z.evaluate(this.range1[0]),e=s.Z.evaluate(this.range1[1]),i=s.Z.evaluate(this.range2[0]),r=s.Z.evaluate(this.range2[1]),C=this.point.coords.slice(1),v=this.vec1.slice(),Z=this.vec2.slice(),a=o.Z.norm(v,3),l=o.Z.norm(Z,3),d=0;d<3;d++)v[d]/=a,Z[d]/=l;for(u=0;u<4;u++){switch(u){case 0:p=t,f=i;break;case 1:p=e,f=i;break;case 2:p=e,f=r;break;case 3:p=t,f=r}for(d=0;d<3;d++)y[d]=C[d]+p*v[d]+f*Z[d];n=P.project3DTo2D(y),this.dataX.push(n[1]),this.dataY.push(n[2])}this.dataX.push(this.dataX[0]),this.dataY.push(this.dataY[0])}return{X:this.dataX,Y:this.dataY}},update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this}}),t.Z.createPlane3D=function(e,i,r){var o,n,a,h,l=i[0],c=i[2],d=i[3],u=i[4]||[-1/0,1/0],p=i[5]||[-1/0,1/0];return n=s.Z.providePoints3D(l,[i[1]],r,"plane3d",["point"])[0],o=s.Z.copyAttributes(r,e.options,"plane3d"),a=new t.Z.Plane3D(l,n,c,u,d,p,o),n.addChild(a),o=a.setAttr2D(o),a.element2D=l.create("curve",[[],[]],o),a.element2D.updateDataArray=function(){var t=a.updateDataArray();this.dataX=t.X,this.dataY=t.Y},a.addChild(a.element2D),a.inherits.push(a.element2D),a.element2D.setParents(a),o=s.Z.copyAttributes(r.mesh3d,e.options,"mesh3d"),Math.abs(a.range1[0])!==1/0&&Math.abs(a.range1[1])!==1/0&&Math.abs(a.range2[0])!==1/0&&Math.abs(a.range2[1])!==1/0&&(h=l.create("mesh3d",[function(){return n.coords},c,u,d,p],o),a.grid=h,a.addChild(h),a.inherits.push(h),h.setParents(a)),a.element2D.prepareUpdate().update(),e.isSuspendedUpdate||a.element2D.updateVisibility().updateRenderer(),a},t.Z.registerElement("plane3d",t.Z.createPlane3D),t.Z.Surface3D=function(t,e,r,o,n,a,h,l){this.constructor(t.board,l,i.Z.OBJECT_TYPE_SURFACE3D,i.Z.OBJECT_CLASS_3D),this.constructor3D(t,"surface3d"),this.board.finalizeAdding(this),this.F=e,this.X=r,this.Y=o,this.Z=n,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]}),this.range_u=a,this.range_v=h,this.methodMap=s.Z.deepCopy(this.methodMap,{})},t.Z.Surface3D.prototype=new t.Z.GeometryElement,s.Z.copyPrototypeMethods(t.Z.Surface3D,t.Z.GeometryElement3D,"constructor3D"),t.Z.extend(t.Z.Surface3D.prototype,{updateDataArray:function(){var t,e,i=s.Z.evaluate(this.visProp.stepsu),r=s.Z.evaluate(this.visProp.stepsv),o=s.Z.evaluate(this.range_u),n=s.Z.evaluate(this.range_v);return t=null!==this.F?this.F:[this.X,this.Y,this.Z],{X:(e=this.view.getMesh(t,o.concat([i]),n.concat([r])))[0],Y:e[1]}},update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this}}),t.Z.createParametricSurface3D=function(e,i,r){var o,n,a,h,l,c,d,u,p=i[0];return 4===i.length?(o=i[1],l=i[2],c=i[3],n=null,a=null,h=null):(n=i[1],a=i[2],h=i[3],l=i[4],c=i[5],o=null),d=s.Z.copyAttributes(r,e.options,"surface3d"),d=(u=new t.Z.Surface3D(p,o,n,a,h,l,c,d)).setAttr2D(d),u.element2D=p.create("curve",[[],[]],d),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),u.element2D.prepareUpdate().update(),e.isSuspendedUpdate||u.element2D.updateVisibility().updateRenderer(),u},t.Z.registerElement("parametricsurface3d",t.Z.createParametricSurface3D),t.Z.createFunctiongraph3D=function(t,e,i){var s=e[0],r=e[1],o=e[2],n=e[3];return s.create("parametricsurface3d",[function(t,e){return t},function(t,e){return e},r,o,n],i)},t.Z.registerElement("functiongraph3d",t.Z.createFunctiongraph3D);let at=.75,ht="#000";t.Z.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:ht,highlightStrokeColor:ht,fillColor:"none",highlightFillColor:"none",strokeOpacity:.6,highlightStrokeOpacity:1},angle:{strokeColor:ht,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3,label:{strokeColor:ht}},arc:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at},axis:{},boxplot:{strokeWidth:at,strokeColor:ht,fillColor:ht,fillOpacity:.2,highlightStrokeWidth:at,highlightStrokeColor:ht,highlightFillColor:ht,highlightFillOpacity:.1},circle:{strokeWidth:at,highlightStrokeWidth:1.125,strokeColor:ht,highlightFillColor:"none",highlightStrokeColor:ht,center:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},point2:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht}},circumcircle:{strokeWidth:at,highlightStrokeWidth:1.125,strokeColor:ht,highlightFillColor:"none",highlightStrokeColor:ht,center:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht}},circumcirclearc:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at},circumcirclesector:{strokeColor:ht,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},comb:{strokeColor:ht,strokeWidth:at},conic:{strokeWidth:at,highlightStrokeWidth:1.125,strokeColor:ht,highlightStrokeColor:ht,fillColor:"none",highlightFillColor:"none"},curve:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at},grid:{strokeWidth:at},hatch:{strokeColor:ht,strokeWidth:at},incircle:{strokeWidth:at,highlightStrokeWidth:1.125,strokeColor:ht,highlightFillColor:"none",highlightStrokeColor:ht,center:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht}},inequality:{fillColor:"#aaaaaa55",fillOpacity:.2},label:{strokeColor:ht},line:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at,point1:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},point2:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht}},normal:{strokeColor:ht},parallel:{strokeColor:ht},perpendicular:{strokeColor:ht},perpendicularsegment:{strokeColor:ht},point:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},polygon:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaaa33",fillOpacity:.3,highlightFillOpacity:.3,vertices:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},borders:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at}},sector:{strokeColor:ht,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},semicircle:{center:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht}},slider:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht,baseline:{strokeWidth:at,strokeColor:ht,highlightStrokeColor:ht},label:{strokeColor:ht},highline:{strokeWidth:2.25,name:"",strokeColor:ht,highlightStrokeColor:ht},ticks:{strokeColor:ht}},slopefield:{strokeWidth:.5625,highlightStrokeWidth:at,highlightStrokeColor:ht,highlightStrokeOpacity:.8},tapemeasure:{strokeColor:ht,strokeWidth:at,highlightStrokeColor:ht,highlightStrokeWidth:at,point1:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},point2:{size:at,fillColor:ht,strokeColor:ht,highlightStrokeWidth:3,highlightFillColor:ht,highlightStrokeColor:ht},ticks:{strokeWidth:at}},text:{strokeColor:ht},tracecurve:{strokeColor:ht},turtle:{strokeWidth:at,strokeColor:ht,arrow:{strokeWidth:1.5,strokeColor:"#aaaaaa55"}},vectorfield:{strokeWidth:.5625,highlightStrokeWidth:at,highlightStrokeColor:ht,highlightStrokeOpacity:.8}};t.Z.COORDS_BY_SCREEN,t.Z.COORDS_BY_USER,t.Z.Dump,t.Z.Expect,t.Z.JSXGraph,t.Z.Math,t.Z.Options,t.Z.boards,t.Z.elements,t.Z.palette,t.Z.paletteWong,t.Z.Board,t.Z.Chart,t.Z.Circle,t.Z.Complex,t.Z.Composition,t.Z.Coords,t.Z.CoordsElement,t.Z.Curve,t.Z.GeometryElement,t.Z.Group,t.Z.Image,t.Z.JessieCode,t.Z.PrefixParser,t.Z.Line,t.Z.Point,t.Z.Polygon,t.Z.Text,t.Z.Ticks,t.Z.Transformation,t.Z.Turtle,t.Z.View3D,t.Z.LMS2rgb,t.Z.addEvent,t.Z.autoDigits,t.Z.autoHighlight,t.Z.bind,t.Z.capitalize,t.Z.clearVisPropOld,t.Z.clone,t.Z.cloneAndCopy,t.Z.cmpArrays,t.Z.coordsArrayToMatrix,t.Z.copyAttributes,t.Z.createEvalFunction,t.Z.createFunction,t.Z.createHTMLSlider,t.Z.darkenColor,t.Z.debug,t.Z.debugInt,t.Z.debugLine,t.Z.debugWST,t.Z.deepCopy,t.Z.def,t.Z.deprecated,t.Z.eliminateDuplicates,t.Z.escapeHTML,t.Z.evalSlider,t.Z.evaluate,t.Z.filterElements,t.Z.getBoardByContainerId,t.Z.getCSSTransformMatrix,t.Z.getCSSTransform,t.Z.getDimensions,t.Z.getOffset,t.Z.getPosition,t.Z.getProp,t.Z.hex2rgb,t.Z.hsv2rgb,t.Z.isAndroid,t.Z.isApple,t.Z.isArray,t.Z.isDesktop,t.Z.isInArray,t.Z.isInObject,t.Z.isMetroApp,t.Z.isMobile,t.Z.isMozilla,t.Z.isBoard,t.Z.isName,t.Z.isNode,t.Z.isNumber,t.Z.isObject,t.Z.isPointType,t.Z.isString,t.Z.isTouchDevice,t.Z.isTransformationOrArray,t.Z.isWebWorker,t.Z.isWebkitAndroid,t.Z.isWebkitApple,t.Z.keys,t.Z.lightenColor,t.Z.merge,t.Z.normalizePointFace,t.Z.providePoints,t.Z.registerElement,t.Z.registerReader,t.Z.removeAllEvents,t.Z.removeElementFromArray,t.Z.removeEvent,t.Z.rgb2LMS,t.Z.rgb2bw,t.Z.rgb2cb,t.Z.rgb2css,t.Z.rgb2hex,t.Z.rgb2hsv,t.Z.rgbParser,t.Z.rgba2rgbo,t.Z.rgbo2rgba,t.Z.sanitizeHTML,t.Z.shortcut,t.Z.str2Bool,t.Z.supportsCanvas,t.Z.supportsPointerEvents,t.Z.supportsSVG,t.Z.supportsVML,t.Z.swap,t.Z.timedChunk,t.Z.toFixed,t.Z.toFullscreen,t.Z.toJSON,t.Z.trim,t.Z.trimNumber,t.Z.truncate,t.Z.unescapeHTML,t.Z.uniqueArray,t.Z.useBlackWhiteOptions,t.Z.useStandardOptions,t.Z.warn;e.Z.isBrowser?window.JXG=t.Z:e.Z.isWebWorker()&&(self.JXG=t.Z);var lt=t.Z}(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__}()})); \ No newline at end of file +!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(){"use strict";var __webpack_modules__={561:function(t,e,i){var i=i(443),s="1.10.1",s={version:s,licenseText:"JSXGraph v"+s+" Copyright (C) see https://jsxgraph.org",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_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};i.A.extendConstants(i.A,s),e.A=s},904:function(t,e,i){var s=i(443),l=i(561),r=i(454),o=i(188),n=i(477);s.A.Coords=function(t,e,i,s){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!o.A.exists(s)||s,this.emitter&&r.A.eventify(this),this.setCoordinates(t,e,!1,!0)},s.A.extend(s.A.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>n.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=this.usrCoords,r=this.scrCoords;return t===l.A.COORDS_BY_USER?(i=e.usrCoords,(t=s[0]-i[0])*t>n.A.eps*n.A.eps?Number.POSITIVE_INFINITY:n.A.hypot(s[1]-i[1],s[2]-i[2])):(i=e.scrCoords,n.A.hypot(r[1]-i[1],r[2]-i[2]))},setCoordinates:function(t,e,i,s){var r=this.usrCoords,o=this.scrCoords,n=[r[0],r[1],r[2]],a=[o[0],o[1],o[2]];return t===l.A.COORDS_BY_USER?(2===e.length?(r[0]=1,r[1]=e[0],r[2]=e[1]):(r[0]=e[0],r[1]=e[1],r[2]=e[2],this.normalizeUsrCoords()),this.usr2screen(i)):(2===e.length?(o[1]=e[0],o[2]=e[1]):(o[1]=e[1],o[2]=e[2]),this.screen2usr()),!this.emitter||s||a[1]===o[1]&&a[2]===o[2]||this.triggerEventHandlers(["update"],[n,a]),this},copy:function(t,e){return this[t].slice(e=void 0===e?0:e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>n.A.eps},__evt__update:function(t,e){},__evt:function(){}}),e.A=s.A.Coords},102:function(t,e,i){var n=i(443),m=i(477),y=i(571),d=i(171),a=i(588),b=i(904),v=i(561),C=i(188);n.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 b.A(v.A.COORDS_BY_USER,t,this.board),this.initialCoords=new b.A(v.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},n.A.extend(n.A.CoordsElement.prototype,{updateConstraint:function(){return this},updateCoords:function(t){return this.needsUpdate&&(C.A.exists(t)||(t=!1),C.A.evaluate(this.visProp.frozen)||this.updateConstraint(),this.type===v.A.OBJECT_TYPE_GLIDER&&((t=this.isConstrained?!1:t)?this.updateGliderFromParent():this.updateGlider()),this.updateTransform(t)),this},updateGlider:function(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_=2*Math.PI,f=!1,A=this.slideObject,g=[];if(this.needsUpdateFromParent=!1,A.elementClass===v.A.OBJECT_CLASS_CIRCLE)C.A.evaluate(this.visProp.isgeonext)&&(_=1),a=y.A.projectPointToCircle(this,A,this.board),l=y.A.rad([A.center.X()+1,A.center.Y()],A.center,this)/_;else if(A.elementClass===v.A.OBJECT_CLASS_LINE){if(this.onPolygon){if(s=A.point1.coords.usrCoords,i=(p=A.point2.coords.usrCoords)[t=1]-s[t],Math.abs(i)<m.A.eps&&(i=p[t=2]-s[t]),u=(y.A.projectPointToLine(this,A,this.board).usrCoords[t]-s[t])/i,e=A.parentPolygon,u<0){for(t=0;t<e.borders.length;t++)if(A===e.borders[t]){A=e.borders[(t-1+e.borders.length)%e.borders.length];break}}else if(1<u)for(t=0;t<e.borders.length;t++)if(A===e.borders[t]){A=e.borders[(t+1+e.borders.length)%e.borders.length];break}A.id!==this.slideObject.id&&(this.slideObject=A)}s=A.point1.coords,p=A.point2.coords,l=(i=s.distance(v.A.COORDS_BY_USER,p))<m.A.eps?(a=s,f=!0,0):(a=y.A.projectPointToLine(this,A,this.board),s=s.usrCoords.slice(0),p=p.usrCoords.slice(0),Math.abs(p[0])<m.A.eps?(i=p[t=1],Math.abs(i)<m.A.eps&&(i=p[t=2]),(0<=(i=(a.usrCoords[t]-s[t])/i)?1:-1)*(i=Math.abs(i))/(i+1)):Math.abs(s[0])<m.A.eps?(i=s[t=1],Math.abs(i)<m.A.eps&&(i=s[t=2]),(i=(a.usrCoords[t]-p[t])/i)<0?(1-2*i)/(1-i):1/(i+1)):(i=p[t=1]-s[t],Math.abs(i)<m.A.eps&&(i=p[t=2]-s[t]),(a.usrCoords[t]-s[t])/i)),null!==(u=this.findClosestSnapValue(l))?(l=(C.A.evaluate(this.visProp.snapvalues)[u]-this._smin)/(this._smax-this._smin),this.update(!0)):(h=C.A.evaluate(this.visProp.snapwidth),0<C.A.evaluate(h)&&Math.abs(this._smax-this._smin)>=m.A.eps&&(i=(l=Math.max(Math.min(l,1),0))*(this._smax-this._smin)+this._smin,l=(Math.round(i/h)*h-this._smin)/(this._smax-this._smin),this.update(!0))),s=A.point1.coords,!C.A.evaluate(A.visProp.straightfirst)&&Math.abs(s.usrCoords[0])>m.A.eps&&l<0&&(a=s,f=!0,l=0),p=A.point2.coords,!C.A.evaluate(A.visProp.straightlast)&&Math.abs(p.usrCoords[0])>m.A.eps&&1<l&&(a=p,f=!0,l=1)}else if(A.type===v.A.OBJECT_TYPE_TURTLE)this.updateConstraint(),a=(c=y.A.projectPointToTurtle(this,A,this.board))[0],l=c[1];else if(A.elementClass===v.A.OBJECT_CLASS_CURVE)if(A.type===v.A.OBJECT_TYPE_ARC||A.type===v.A.OBJECT_TYPE_SECTOR)a=y.A.projectPointToCircle(this,A,this.board),u=y.A.rad(A.radiuspoint,A.center,this),i=0,s=y.A.rad(A.radiuspoint,A.center,A.anglepoint),l=u,("minor"===(h=C.A.evaluate(A.visProp.selection))&&s>Math.PI||"major"===h&&s<Math.PI)&&(i=s,s=2*Math.PI),(u<i||s<u)&&(l=s,(u<i&&.5*i<u||s<u&&u>.5*s+Math.PI)&&(l=i),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),_=s-i,this.visProp.isgeonext&&(_=1),Math.abs(_)>m.A.eps&&(l/=_);else if(this.updateConstraint(),0<A.transformations.length){for(p=!1,(c=A.getTransformationSource())[0]&&(p=c[0],g.push(A),g.push(c[1]));c[0]&&C.A.exists(c[1]._transformationSource);)c=c[1].getTransformationSource(),g.push(c[1]);if(d=this.coords.usrCoords,p){for(t=0;t<g.length;t++)g[t].updateTransformMatrix(),n=m.A.inverse(g[t].transformMat),d=m.A.matVecMult(n,d);for(r=new b.A(v.A.COORDS_BY_USER,d,this.board).usrCoords,d=(o=y.A.projectCoordsToCurve(r[1],r[2],this.position||0,g[g.length-1],this.board))[0].usrCoords,t=g.length-2;0<=t;t--)d=m.A.matVecMult(g[t].transformMat,d);o[0]=new b.A(v.A.COORDS_BY_USER,d,this.board)}else A.updateTransformMatrix(),n=m.A.inverse(A.transformMat),d=m.A.matVecMult(n,d),r=new b.A(v.A.COORDS_BY_USER,d,this.board).usrCoords,o=y.A.projectCoordsToCurve(r[1],r[2],this.position||0,A,this.board);a=o[0],l=o[1]}else a=(c=y.A.projectPointToCurve(this,A,this.board))[0],l=c[1];else C.A.isPoint(A)&&(a=y.A.projectPointToPoint(this,A,this.board),l=this.position);this.coords.setCoordinates(v.A.COORDS_BY_USER,a.usrCoords,f),this.position=l},findClosestSnapValue:function(t){var e,i,s=null,r=C.A.evaluate(this.visProp.snapvalues),o=C.A.evaluate(this.visProp.snapvaluedistance);if(C.A.isArray(r)&&Math.abs(this._smax-this._smin)>=m.A.eps&&0<o)for(e=0;e<r.length;e++)(i=Math.abs(t*(this._smax-this._smin)+this._smin-r[e]))<o&&(o=i,s=e);return s},updateGliderFromParent:function(){var t,e,i,s,r,o,n,a,l,h=this.slideObject,u=[],c=2*Math.PI;if(this.needsUpdateFromParent){if(h.elementClass===v.A.OBJECT_CLASS_CIRCLE)t=h.Radius(),C.A.evaluate(this.visProp.isgeonext)&&(c=1),e=[h.center.X()+t*Math.cos(this.position*c),h.center.Y()+t*Math.sin(this.position*c)];else if(h.elementClass===v.A.OBJECT_CLASS_LINE)n=h.point1.coords.usrCoords,o=h.point2.coords.usrCoords,e=0===n[0]&&0===n[1]&&0===n[2]||0===o[0]&&0===o[1]&&0===o[2]?[0,0,0]:Math.abs(o[0])<m.A.eps?(r=Math.min(Math.abs(this.position),1-m.A.eps),r/=1-r,this.position<0&&(r=-r),[n[0]+r*o[0],n[1]+r*o[1],n[2]+r*o[2]]):Math.abs(n[0])<m.A.eps?(r=Math.max(this.position,m.A.eps),r=1<(r=Math.min(r,2-m.A.eps))?(r-1)/(r-2):(1-r)/r,[o[0]+r*n[0],o[1]+r*n[1],o[2]+r*n[2]]):(r=this.position,[n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2])]);else if(h.type===v.A.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(v.A.COORDS_BY_USER,[h.Z(this.position),h.X(this.position),h.Y(this.position)]),this.updateConstraint(),e=y.A.projectPointToTurtle(this,h,this.board)[0].usrCoords;else if(h.elementClass===v.A.OBJECT_CLASS_CURVE){for(r=!1,(i=h.getTransformationSource())[0]&&(r=i[0],u.push(h),u.push(i[1]));i[0]&&C.A.exists(i[1]._transformationSource);)i=i[1].getTransformationSource(),u.push(i[1]);if(r?this.coords.setCoordinates(v.A.COORDS_BY_USER,[u[u.length-1].Z(this.position),u[u.length-1].X(this.position),u[u.length-1].Y(this.position)]):this.coords.setCoordinates(v.A.COORDS_BY_USER,[h.Z(this.position),h.X(this.position),h.Y(this.position)]),h.type===v.A.OBJECT_TYPE_ARC||h.type===v.A.OBJECT_TYPE_SECTOR)o=y.A.rad([h.center.X()+1,h.center.Y()],h.center,h.radiuspoint),n=0,l=y.A.rad(h.radiuspoint,h.center,h.anglepoint),("minor"===h.visProp.selection&&l>Math.PI||"major"===h.visProp.selection&&l<Math.PI)&&(n=l,l=2*Math.PI),c=l-n,C.A.evaluate(this.visProp.isgeonext)&&(c=1),((a=this.position*c)<n||l<a)&&(((a=l)<n&&.5*n<a||l<a&&a>.5*l+Math.PI)&&(a=n),this.position=a,Math.abs(c)>m.A.eps&&(this.position/=c)),t=h.Radius(),e=[h.center.X()+t*Math.cos(this.position*c+o),h.center.Y()+t*Math.sin(this.position*c+o)];else if(this.updateConstraint(),r)for(e=y.A.projectPointToCurve(this,u[u.length-1],this.board)[0].usrCoords,s=u.length-2;0<=s;s--)e=new b.A(v.A.COORDS_BY_USER,m.A.matVecMult(u[s].transformMat,e),this.board).usrCoords;else e=y.A.projectPointToCurve(this,h,this.board)[0].usrCoords}else C.A.isPoint(h)&&(e=y.A.projectPointToPoint(this,h,this.board).usrCoords);this.coords.setCoordinates(v.A.COORDS_BY_USER,e,!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])>m.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},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(v.A.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,s,r,o,n,a,l,h=1/0,u=null,c=C.A.evaluate(this.visProp.ignoredsnaptopoints),d=!1,p=this.board.objectsList.length;if(c&&(n=c.length),C.A.evaluate(this.visProp.snaptopoints)||t){for(r=C.A.evaluate(this.visProp.attractorunit),o=C.A.evaluate(this.visProp.attractordistance),e=0;e<p;e++){if(i=this.board.objectsList[e],c){for(d=!1,a=0;a<n;a++)if(i===this.board.select(c[a])){d=!0;break}if(d)continue}C.A.isPoint(i)&&i!==this&&i.visPropCalc.visible&&(s=y.A.projectPointToPoint(this,i,this.board),(l="screen"===r?s.distance(v.A.COORDS_BY_SCREEN,this.coords):s.distance(v.A.COORDS_BY_USER,this.coords))<o&&l<h&&(h=l,u=s))}null!==u&&this.coords.setCoordinates(v.A.COORDS_BY_USER,u.usrCoords)}return this},snapToPoints:function(t){return this.handleSnapToPoints(t)},handleAttractors:function(){var t,e,i,s,r=C.A.evaluate(this.visProp.attractorunit),o=C.A.evaluate(this.visProp.attractordistance),n=C.A.evaluate(this.visProp.snatchdistance),a=C.A.evaluate(this.visProp.attractors),l=a.length;if(0!==o){for(t=0;t<l;t++)if(e=this.board.select(a[t]),C.A.exists(e)&&e!==this){if(C.A.isPoint(e)?i=y.A.projectPointToPoint(this,e,this.board):e.elementClass===v.A.OBJECT_CLASS_LINE?(s=y.A.projectCoordsToSegment(this.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),i=!C.A.evaluate(e.visProp.straightfirst)&&s[1]<0?e.point1.coords:!C.A.evaluate(e.visProp.straightlast)&&1<s[1]?e.point2.coords:new b.A(v.A.COORDS_BY_USER,s[0],this.board)):e.elementClass===v.A.OBJECT_CLASS_CIRCLE?i=y.A.projectPointToCircle(this,e,this.board):e.elementClass===v.A.OBJECT_CLASS_CURVE?i=y.A.projectPointToCurve(this,e,this.board)[0]:e.type===v.A.OBJECT_TYPE_TURTLE?i=y.A.projectPointToTurtle(this,e,this.board)[0]:e.type===v.A.OBJECT_TYPE_POLYGON&&(i=new b.A(v.A.COORDS_BY_USER,y.A.projectCoordsToPolygon(this.coords.usrCoords,e),this.board)),(s="screen"===r?i.distance(v.A.COORDS_BY_SCREEN,this.coords):i.distance(v.A.COORDS_BY_USER,this.coords))<o){this.type===v.A.OBJECT_TYPE_GLIDER&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)||this.makeGlider(e);break}n<=s&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,s,r,o,n=this.coords;if(this.relativeCoords)return s=new b.A(t,e,this.board),C.A.evaluate(this.visProp.islabel)?(r=a.A.subtract(s.scrCoords,n.scrCoords),this.relativeCoords.scrCoords[1]+=r[1],this.relativeCoords.scrCoords[2]+=r[2]):(r=a.A.subtract(s.usrCoords,n.usrCoords),this.relativeCoords.usrCoords[1]+=r[1],this.relativeCoords.usrCoords[2]+=r[2]),this;for(this.coords.setCoordinates(t,e),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),i=this.transformations.length-1;0<=i;i--)o=t===v.A.COORDS_BY_SCREEN?new b.A(t,e,this.board).usrCoords:e=2===e.length?[1].concat(e):e,this.initialCoords.setCoordinates(v.A.COORDS_BY_USER,m.A.matVecMult(m.A.inverse(this.transformations[i].matrix),o));return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===v.A.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(t,e){return e=new b.A(t,e,this.board),t=this.board.create("transform",e.usrCoords.slice(1),{type:"translate"}),0<this.transformations.length&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(t):this.addTransform(this,t),this.prepareUpdate().update(),this},setPosition:function(t,e){return this.setPositionDirectly(t,e)},setGliderPosition:function(t){return this.type===v.A.OBJECT_TYPE_GLIDER&&(this.position=t,this.board.update()),this},makeGlider:function(t){var e,i,s,r=this.board.select(t),o=!1;if(r.type===v.A.OBJECT_TYPE_POLYGON){for(e=Number.MAX_VALUE,i=0;i<r.borders.length;i++)(s=n.A.Math.Geometry.distPointLine(this.coords.usrCoords,r.borders[i].stdform))<e&&(e=s,t=r.borders[i]);r=this.board.select(t),o=!0}if(!C.A.exists(r))throw new Error("JSXGraph: slide object undefined.");if(r.type===v.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=v.A.OBJECT_TYPE_GLIDER,this.elType="glider",this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.onPolygon=o,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this.updateGlider(),this.needsUpdateFromParent=!0,this.updateGliderFromParent(),this},popSlideObject:function(){0<this.slideObjects.length&&(this.slideObjects.pop(),this.slideObject.removeChild(this),0===this.slideObjects.length?(this.type=this._org_type,this.type===v.A.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===v.A.OBJECT_CLASS_TEXT?this.elType="text":this.type===v.A.OBJECT_TYPE_IMAGE?this.elType="image":this.type===v.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!==v.A.OBJECT_TYPE_GLIDER){if(this.transformations.length=0,delete this.updateConstraint,this.isConstrained=!1,this.isDraggable)return;this.isDraggable=!0,this.elementClass===v.A.OBJECT_CLASS_POINT&&(this.type=v.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===v.A.OBJECT_CLASS_POINT?(this.type=v.A.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===v.A.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===v.A.OBJECT_CLASS_OTHER&&(this.type=this._org_type,this.elType="image")},addConstraint:function(t){var e,i,s=[],r=["X","Y"];for(this.elementClass===v.A.OBJECT_CLASS_POINT&&(this.type=v.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]=function(t){return function(){return t}}(i):C.A.isObject(i)&&C.A.isFunction(i.Value)&&(s[e]=function(t){return function(){return t.Value()}}(i)),s[e].origin=i;return 1===t.length?this.updateConstraint=function(){var t=s[0]();return C.A.isArray(t)?this.coords.setCoordinates(v.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(v.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(v.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 b.A(v.A.COORDS_BY_SCREEN,t.slice(0,2),this.board):new b.A(v.A.COORDS_BY_USER,t,this.board),this.element.addChild(this),e&&this.addParents(this.element),this.XEval=function(){var t,e;return C.A.evaluate(this.visProp.islabel)?(e=C.A.evaluate(this.visProp.offset),e=parseFloat(e[0]),t=this.element.getLabelAnchor(),new b.A(v.A.COORDS_BY_SCREEN,[e+this.relativeCoords.scrCoords[1]+t.scrCoords[1],0],this.board).usrCoords[1]):(t=this.element.getTextAnchor(),this.relativeCoords.usrCoords[1]+t.usrCoords[1])},this.YEval=function(){var t,e;return C.A.evaluate(this.visProp.islabel)?(e=C.A.evaluate(this.visProp.offset),e=-parseFloat(e[1]),t=this.element.getLabelAnchor(),new b.A(v.A.COORDS_BY_SCREEN,[0,e+this.relativeCoords.scrCoords[2]+t.scrCoords[2]],this.board).usrCoords[2]):(t=this.element.getTextAnchor(),this.relativeCoords.usrCoords[2]+t.usrCoords[2])},this.ZEval=C.A.createFunction(1,this.board,""),this.updateConstraint=function(){this.coords.setCoordinates(v.A.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()])},this.isConstrained=!0,this.updateConstraint()},updateTransform:function(t){var e;if(0===this.transformations.length)return this;for(e=0;e<this.transformations.length;e++)this.transformations[e].update();return 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){var s=C.A.evaluate(t),r=C.A.evaluate(e),o=this;return i=C.A.evaluate(i)||250,this.type!==v.A.OBJECT_TYPE_GLIDER||C.A.exists(this.intervalCode)||(this.intervalCode=window.setInterval(function(){o._anim(s,r)},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(i,t,e){e=e||{};function s(t,e){return function(){return i[t][e]}}var r,o,n,a,l,h=[],u=[],c=t/this.board.attr.animationdelay;if(C.A.isArray(i)){for(n=i.length,r=0;r<n;r++)C.A.isPoint(i[r])?u[r]=i[r]:u[r]={elementClass:v.A.OBJECT_CLASS_POINT,X:s(r,0),Y:s(r,1)};if(0===(t=t||0))return this.setPosition(v.A.COORDS_BY_USER,[u[u.length-1].X(),u[u.length-1].Y()]),this.board.update(this);if(!C.A.exists(e.interpolate)||e.interpolate)for(o=d.A.Neville(u),r=0;r<c;r++)h[r]=[],h[r][0]=o[0]((c-r)/c*o[3]()),h[r][1]=o[1]((c-r)/c*o[3]());else{for(n=i.length-1,r=0;r<c;++r)l=r/c*n-(a=Math.floor(r/c*n)),h[r]=[],h[r][0]=(1-l)*u[a].X()+l*u[a+1].X(),h[r][1]=(1-l)*u[a].Y()+l*u[a+1].Y();h.push([u[n].X(),u[n].Y()]),h.reverse()}this.animationPath=h}else C.A.isFunction(i)&&(this.animationPath=i,this.animationStart=(new Date).getTime());return this.animationCallback=e.callback,this.board.addAnimation(this),this},moveTo:function(t,e,i){i=i||{},t=new b.A(v.A.COORDS_BY_USER,t,this.board);function s(t){var e=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)return t/n;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return t/n}var r,o=this.board.attr.animationdelay,n=Math.ceil(e/o),a=[],l=this.coords.usrCoords[1],h=this.coords.usrCoords[2],u=t.usrCoords[1]-l,c=t.usrCoords[2]-h;if(!C.A.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>m.A.eps)return this.setPosition(v.A.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!C.A.exists(i.callback)&&Math.abs(u)<m.A.eps&&Math.abs(c)<m.A.eps)return this;for(r=n;0<=r;r--)a[n-r]=[t.usrCoords[0],l+u*s(r),h+c*s(r)];return this.animationPath=a,this.animationCallback=i.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new b.A(v.A.COORDS_BY_USER,t,this.board);function s(t){if(t=t<n/2?2*t/n:2*(n-t)/n,i.effect){if("<>"===i.effect)return Math.pow(Math.sin(t*Math.PI/2),2);if("<"===i.effect)return t*t*t;if(">"===i.effect)return 1-Math.pow(1-t,3);if("=="===i.effect)return t;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return t}var r,o,n,a=this.board.attr.animationdelay,l=[],h=this.coords.usrCoords[1],u=this.coords.usrCoords[2],c=t.usrCoords[1]-h,d=t.usrCoords[2]-u;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;0<=r;r--)l[o*(n+1)+n-r]=[t.usrCoords[0],h+c*s(r),u+d*s(r)];return this.animationPath=l,this.animationCallback=i.callback,this.board.addAnimation(this),this},_anim:function(t,e){var i,s,r,o;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0),this.slideObject.elementClass===v.A.OBJECT_CLASS_LINE?(s=this.slideObject.point1.coords.scrCoords,r=this.slideObject.point2.coords.scrCoords,o=Math.round((r[1]-s[1])*this.intervalCount/e),r=Math.round((r[2]-s[2])*this.intervalCount/e),0<t?i=this.slideObject.point1:(i=this.slideObject.point2,o*=-1,r*=-1),this.coords.setCoordinates(v.A.COORDS_BY_SCREEN,[i.coords.scrCoords[1]+o,i.coords.scrCoords[2]+r])):this.slideObject.elementClass===v.A.OBJECT_CLASS_CURVE?(s=0<t?(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(v.A.COORDS_BY_USER,[this.slideObject.X(s),this.slideObject.Y(s)]),o=y.A.projectPointToCurve(this,this.slideObject,this.board),this.coords=o[0],this.position=o[1]):this.slideObject.elementClass===v.A.OBJECT_CLASS_CIRCLE&&(i=2*Math.PI,i*=t<0?this.intervalCount/e:(e-this.intervalCount)/e,r=this.slideObject.Radius(),this.coords.setCoordinates(v.A.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+r*Math.cos(i),this.slideObject.center.coords.usrCoords[2]+r*Math.sin(i)])),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),t=this.type===v.A.OBJECT_TYPE_GLIDER?[this.X(),this.Y(),this.slideObject.id]:t}}),n.A.CoordsElement.create=function(t,e,i,s,r,o){for(var n,a=!1,l=0;l<i.length;l++)(C.A.isFunction(i[l])||C.A.isString(i[l]))&&(a=!0);if(a)(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=n.A.CoordsElement},144:function(t,e,i){var d=i(443),p=i(561),s=i(904),r=i(477),o=i(588),n=i(378),a=i(454),g=i(873),m=i(188);d.A.GeometryElement=function(t,e,i,s){var r,o;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},a.A.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,this.view=null,0<arguments.length){for(r in this.board=t,this.type=i,this._org_type=i,this.elementClass=s||p.A.OBJECT_CLASS_OTHER,this.id=e.id,t=e.name,""!==(t=m.A.exists(t)?t:this.board.generateName(this))&&(this.board.elementsByName[t]=this),this.name=t,this.needsRegularUpdate=e.needsregularupdate,m.A.clearVisPropOld(this),o=this.resolveShortcuts(e))o.hasOwnProperty(r)&&this._set(r,o[r]);this.visProp.draft=o.draft&&o.draft.draft}},d.A.extend(d.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).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){for(var e in(this.descendants[t.id]=t).childElements)t.childElements.hasOwnProperty(e)&&this.addDescendants(t.childElements[e]);return this},addParents:function(t){for(var e,i=(e=m.A.isArray(t)?t:arguments).length,s=0;s<i;++s)m.A.exists(e[s])&&(m.A.isId(this.board,e[s])?this.parents.push(e[s]):m.A.exists(e[s].id)&&this.parents.push(e[s].id));this.parents=m.A.uniqueArray(this.parents)},setParents:function(t){this.parents=[],this.addParents(t)},addParentsFromJCFunctions:function(t){for(var e,i,s=0;s<t.length;s++)for(e in t[s].deps)i=t[s].deps[e],this.addParents(i),i.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){for(var 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&&!m.A.evaluate(this.visProp.fixed)&&this.type!==p.A.OBJECT_TYPE_GLIDER},setPosition:function(t,e){var i,s,r,o,n=[];if(!m.A.exists(this.parents))return this;for(r=this.parents.length,s=0;s<r;++s)if(i=this.board.select(this.parents[s]),m.A.isPoint(i)){if(!i.draggable())return this;n.push(i)}if(3===e.length&&(e=e.slice(1)),o=this.board.create("transform",e,{type:"translate"}),0<(r=n.length)){if(o.applyOnce(n),m.A.exists(this.view)&&"view3d"===this.view.elType)for(s=0;s<this.parents.length;++s)i=this.view.select(this.parents[s]),m.A.exists(i.setPosition2D)&&i.setPosition2D(o)}else 0<this.transformations.length&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(o):this.addTransform(o);for(s=0;s<r;++s)n[s].type===p.A.OBJECT_TYPE_GLIDER&&n[s].updateGlider();return this},setPositionDirectly:function(t,e,i){e=new s.A(t,e,this.board,!1),t=new s.A(t,i,this.board,!1),i=o.A.subtract(e.usrCoords,t.usrCoords);return this.setPosition(p.A.COORDS_BY_USER,i),this},generatePolynomial:function(){return[]},animate:function(t,e,i){i=i||{};function s(t,e,i,s){var r,o;if(t=parseFloat(t),e=parseFloat(e),!isNaN(t)&&!isNaN(e))for(o=(e-t)/l,h.animationData[i]=[],n=0;n<l;n++)r=t+(n+1)*o,h.animationData[i][l-n-1]=s?Math.floor(r):r}var r,o,n,a=this.board.attr.animationdelay,l=Math.ceil(e/a),h=this;for(r in this.animationData={},t)if(t.hasOwnProperty(r))switch(o=r.toLowerCase()){case"strokecolor":case"fillcolor":A=f=_=u=p=void 0;var u=this.visProp[o],c=t[r],d=o,p=g.A.rgb2hsv(u),_=((u=g.A.rgb2hsv(c))[0]-p[0])/l,f=(u[1]-p[1])/l,A=(u[2]-p[2])/l;for(h.animationData[d]=[],n=0;n<l;n++)h.animationData[d][l-n-1]=g.A.hsv2rgb(p[0]+(n+1)*_,p[1]+(n+1)*f,p[2]+(n+1)*A);break;case"size":if(!m.A.isPoint(this))break;s(this.visProp[o],t[r],o,!0);break;case"strokeopacity":case"strokewidth":case"fillopacity":s(this.visProp[o],t[r],o,!1)}return this.animationCallback=i.callback,this.board.addAnimation(this),this},update:function(){return m.A.evaluate(this.visProp.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((t=void 0===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],m.A.isArray(o))for(r=o.length,e=0;e<r;e++)m.A.exists(o[e])&&m.A.exists(o[e].rendNode)&&"inherit"===m.A.evaluate(o[e].visProp.visible)&&o[e].setDisplayRendNode(t);else m.A.exists(o)&&m.A.exists(o.rendNode)&&"inherit"===m.A.evaluate(o.visProp.visible)&&o.setDisplayRendNode(t);return this.hasLabel&&m.A.exists(this.label)&&m.A.exists(this.label.rendNode)&&"inherit"===m.A.evaluate(this.label.visProp.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;if(this.needsUpdate){if(m.A.exists(this.view)&&!1===m.A.evaluate(this.view.visProp.visible))this.visPropCalc.visible=!1;else for(void 0!==t?this.visPropCalc.visible=t:(t=m.A.evaluate(this.visProp.visible),"inherit"!==(t=m.A.exists(this.hiddenByParent)&&this.hiddenByParent?!1:t)&&(this.visPropCalc.visible=t)),i=this.inherits.length,s=0;s<i;s++)if(o=this.inherits[s],m.A.isArray(o))for(r=o.length,e=0;e<r;e++)m.A.exists(o[e])&&"inherit"===m.A.evaluate(o[e].visProp.visible)&&o[e].prepareUpdate().updateVisibility(this.visPropCalc.visible);else m.A.exists(o)&&"inherit"===m.A.evaluate(o.visProp.visible)&&o.prepareUpdate().updateVisibility(this.visPropCalc.visible);m.A.exists(this.label)&&m.A.exists(this.label.visProp)&&m.A.evaluate(this.label.visProp.visible)&&this.label.prepareUpdate().updateVisibility(this.visPropCalc.visible)}return this},_set:function(t,e){if(t=t.toLocaleLowerCase(),this.visProp.hasOwnProperty(t)&&0<=t.indexOf("color")&&m.A.isString(e)&&9===e.length&&"#"===e.charAt(0))e=g.A.rgba2rgbo(e),this.visProp[t]=e[0],this.visProp[t.replace("color","opacity")]=e[1];else if(null===e||!m.A.isObject(e)||m.A.exists(e.id)||m.A.exists(e.name))this.visProp[t]=e;else for(var 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 n.A.shortcuts)if(n.A.shortcuts.hasOwnProperty(e)){if(m.A.exists(t[e]))for(i=0;i<n.A.shortcuts[e].length;i++)m.A.exists(t[n.A.shortcuts[e][i]])||(t[n.A.shortcuts[e][i]]=t[e]);for(s=0;s<r.length;s++)m.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 m.A.exists(this.label)&&(t=t.replace(/</g,"<").replace(/>/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(/</g,"<").replace(/>/g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){d.A.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(t){for(var e,i,s,r,o,n,a,l,h={},u=0;u<arguments.length;u++)m.A.isString(o=arguments[u])?(a=o.split(":"),h[m.A.trim(a[0])]=m.A.trim(a[1])):m.A.isArray(o)?h[o[0]]=o[1]:d.A.extend(h,o);for(u in h=this.resolveShortcuts(h))if(h.hasOwnProperty(u)){if(s=u.replace(/\s+/g,"").toLowerCase(),r=h[u],m.A.isObject(r)&&m.A.exists(this.visProp[s])){if(this.visProp[s]=m.A.merge(this.visProp[s],r),this.type===p.A.OBJECT_TYPE_TICKS&&m.A.exists(this.labels))for(i=this.labels.length,e=0;e<i;e++)this.labels[e].setAttribute(r);else if(m.A.exists(this[s]))if(m.A.isArray(this[s]))for(e=0;e<this[s].length;e++)this[s][e].setAttribute(r);else this[s].setAttribute(r);continue}switch(l=this.visProp[s],s){case"checked":m.A.exists(this.rendNodeTag)&&(this.rendNodeCheckbox.checked=!!r);break;case"disabled":m.A.exists(this.rendNodeTag)&&(this.rendNodeTag.disabled=!!r);break;case"face":m.A.isPoint(this)&&(this.visProp.face=r,this.board.renderer.changePointStyle(this));break;case"generatelabelvalue":this.type===p.A.OBJECT_TYPE_TICKS&&m.A.isFunction(r)&&(this.generateLabelValue=r);break;case"gradient":this.visProp.gradient=r,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":r=g.A.rgba2rgbo(r),this.visProp.gradientsecondcolor=r[0],this.visProp.gradientsecondopacity=r[1],this.board.renderer.updateGradient(this);break;case"gradientsecondopacity":this.visProp.gradientsecondopacity=r,this.board.renderer.updateGradient(this);break;case"infoboxtext":m.A.isString(r)?this.infoboxText=r:this.infoboxText=!1;break;case"labelcolor":n=(r=g.A.rgba2rgbo(r))[1],r=r[0],0===n&&m.A.exists(this.label)&&this.hasLabel&&this.label.hideElement(),m.A.exists(this.label)&&this.hasLabel&&(this.label.visProp.strokecolor=r,this.board.renderer.setObjectStrokeColor(this.label,r,n)),this.elementClass===p.A.OBJECT_CLASS_TEXT&&(this.visProp.strokecolor=r,this.visProp.strokeopacity=n,this.board.renderer.setObjectStrokeColor(this,r,n));break;case"layer":this.board.renderer.setLayer(this,m.A.evaluate(r)),this._set(s,r);break;case"maxlength":m.A.exists(this.rendNodeTag)&&(this.rendNodeTag.maxlength=!!r);break;case"name":l=this.name,delete this.board.elementsByName[this.name],this.name=r,this.board.elementsByName[this.name]=this;break;case"needsregularupdate":this.needsRegularUpdate=!("false"===r||!1===r),this.board.renderer.setBuffering(this,this.needsRegularUpdate?"auto":"static");break;case"onpolygon":this.type===p.A.OBJECT_TYPE_GLIDER&&(this.onPolygon=!!r);break;case"radius":this.type!==p.A.OBJECT_TYPE_ANGLE&&this.type!==p.A.OBJECT_TYPE_SECTOR||this.setRadius(r);break;case"rotate":(this.elementClass===p.A.OBJECT_CLASS_TEXT&&"internal"===m.A.evaluate(this.visProp.display)||this.type===p.A.OBJECT_TYPE_IMAGE)&&this.addRotation(r);break;case"tabindex":m.A.exists(this.rendNode)&&(this.rendNode.setAttribute("tabindex",r),this._set(s,r));break;case"trace":"false"===r||!1===r?(this.clearTrace(),this.visProp.trace=!1):this.visProp.trace="pause"!==r;break;case"visible":this.visProp.visible="false"!==r&&("true"===r||r),this.setDisplayRendNode(m.A.evaluate(this.visProp.visible)),m.A.evaluate(this.visProp.visible)&&m.A.exists(this.updateSize)&&this.updateSize();break;case"withlabel":this.visProp.withlabel=r,m.A.evaluate(r)?(this.label||this.createLabel(),this.label.setAttribute({visible:"inherit"})):this.label&&this.hasLabel&&this.label.setAttribute({visible:!1}),this.hasLabel=r;break;case"straightfirst":case"straightlast":for(e in this._set(s,r),this.childElements)this.childElements.hasOwnProperty(e)&&"glider"===this.childElements[e].elType&&this.childElements[e].fullUpdate();break;default:m.A.exists(this.visProp[s])&&(!d.A.Validator[s]||d.A.Validator[s]&&d.A.Validator[s](r)||d.A.Validator[s]&&m.A.isFunction(r)&&d.A.Validator[s](r()))&&(r=(!r.toLowerCase||"false"!==r.toLowerCase())&&r,this._set(s,r))}this.triggerEventHandlers(["attribute:"+s],[l,r,this])}return this.triggerEventHandlers(["attribute"],[h,this]),m.A.evaluate(this.visProp.needsregularupdate)?this.board.update(this):this.board.fullUpdate(),this.elementClass===p.A.OBJECT_CLASS_TEXT&&this.updateSize(),this},getProperty:function(){d.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},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 s.A(p.A.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new s.A(p.A.COORDS_BY_USER,[0,0],this.board)},setArrow:function(t,e){return this.visProp.firstarrow=t,(this.visProp.lastarrow=e)&&(this.type=p.A.OBJECT_TYPE_VECTOR,this.elType="arrow"),this.prepareUpdate().update().updateVisibility().updateRenderer(),this},createGradient:function(){var t=m.A.evaluate(this.visProp.gradient);"linear"!==t&&"radial"!==t||this.board.renderer.setGradient(this)},createLabel:function(){var t,e=this;return d.A.elements.text?((t=m.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=d.A.elements.text(this.board,[0,0,function(){return m.A.isFunction(e.name)?e.name():e.name}],t),this.label.needsUpdate=!0,this.label.dump=!1,this.label.fullUpdate(),this.hasLabel=!0)):d.A.debug("JSXGraph: Can't create label: text element is not available. Make sure you include base/text"),this},highlight:function(t){return t=m.A.def(t,!1),!m.A.evaluate(this.visProp.highlight)||this.highlighted&&!t||(this.highlighted=!0,(this.board.highlightedObjects[this.id]=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(){for(var 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=r.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)&&m.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,r,o,n=this;return this.elementClass!==p.A.OBJECT_CLASS_TEXT&&this.type!==p.A.OBJECT_TYPE_IMAGE||0===t||(e=this.board.create("transform",[function(){return-n.X()},function(){return-n.Y()}],{type:"translate"}),i=this.board.create("transform",[function(){return n.X()},function(){return n.Y()}],{type:"translate"}),s=this.board.create("transform",[function(){return n.board.unitX/n.board.unitY},function(){return 1}],{type:"scale"}),r=this.board.create("transform",[function(){return n.board.unitY/n.board.unitX},function(){return 1}],{type:"scale"}),o=this.board.create("transform",[function(){return m.A.evaluate(t)*Math.PI/180}],{type:"rotate"}),e.bindTo(this),s.bindTo(this),o.bindTo(this),r.bindTo(this),i.bindTo(this)),this},highlightStrokeColor:function(t){return d.A.deprecated("highlightStrokeColor()","setAttribute()"),this.setAttribute({highlightStrokeColor:t}),this},strokeColor:function(t){return d.A.deprecated("strokeColor()","setAttribute()"),this.setAttribute({strokeColor:t}),this},strokeWidth:function(t){return d.A.deprecated("strokeWidth()","setAttribute()"),this.setAttribute({strokeWidth:t}),this},fillColor:function(t){return d.A.deprecated("fillColor()","setAttribute()"),this.setAttribute({fillColor:t}),this},highlightFillColor:function(t){return d.A.deprecated("highlightFillColor()","setAttribute()"),this.setAttribute({highlightFillColor:t}),this},labelColor:function(t){return d.A.deprecated("labelColor()","setAttribute()"),this.setAttribute({labelColor:t}),this},dash:function(t){return d.A.deprecated("dash()","setAttribute()"),this.setAttribute({dash:t}),this},visible:function(t){return d.A.deprecated("visible()","setAttribute()"),this.setAttribute({visible:t}),this},shadow:function(t){return d.A.deprecated("shadow()","setAttribute()"),this.setAttribute({shadow:t}),this},getType:function(){return this.elType},getParents:function(){return m.A.isArray(this.parents)?this.parents:[]},snapToGrid:function(){return this},snapToPoints:function(){return this},getAttributes:function(){var t,e=m.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&&m.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(m.A.exists(this.ticks)){for(t=this.ticks.length-1;0<=t;t--)this.removeTicks(this.ticks[t]);this.ticks=[],this.board.update()}},removeTicks:function(t){var e,i;if(m.A.exists(this.defaultTicks)&&this.defaultTicks===t&&(this.defaultTicks=null),m.A.exists(this.ticks))for(e=this.ticks.length-1;0<=e;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++)m.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=m.A.evaluate(this.visProp.snapsizex),i=m.A.evaluate(this.visProp.snapsizey);return[e=e<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks?(t=this.board.defaultAxes.x.defaultTicks).ticksDelta*(m.A.evaluate(t.visProp.minorticks)+1):e,i=i<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks?(t=this.board.defaultAxes.y.defaultTicks).ticksDelta*(m.A.evaluate(t.visProp.minorticks)+1):i]},handleSnapToGrid:function(t,e){var i,s,r,o,n,a,l,h=m.A.evaluate(this.visProp.attracttogrid),u=m.A.evaluate(this.visProp.attractorunit),c=m.A.evaluate(this.visProp.attractordistance);return m.A.exists(this.coords)&&!m.A.evaluate(this.visProp.fixed)&&(m.A.evaluate(this.visProp.snaptogrid)||h||!0===t)&&(t=this.coords.usrCoords[1],i=this.coords.usrCoords[2],a=(l=this.getSnapSizes())[0],l=l[1],0<a&&0<l&&(n=this.board.getBoundingBox(),s=Math.round(t/a)*a,r=Math.round(i/l)*l,o=new d.A.Coords(p.A.COORDS_BY_USER,[s,r],this.board),(!h||o.distance("screen"===u?p.A.COORDS_BY_SCREEN:p.A.COORDS_BY_USER,this.coords)<c)&&(t=s,i=r,e||(h=Math.min(n[0],n[2]),o=Math.max(n[0],n[2]),t<h&&h-a<t?t+=a:o<t&&t<o+a&&(t-=a),h=Math.min(n[1],n[3]),o=Math.max(n[1],n[3]),i<h&&h-l<i?i+=l:o<i&&i<o+l&&(i-=l)),this.coords.setCoordinates(p.A.COORDS_BY_USER,[t,i])))),this},getBoundingBox:function(){var t,e,i,s,r,o=[1/0,1/0,-1/0,-1/0];if(this.type===p.A.OBJECT_TYPE_POLYGON){if((e=this.vertices.length-1)<=0)return o;for(t=0;t<e;t++)i=this.vertices[t].X(),o[0]=i<o[0]?i:o[0],o[2]=i>o[2]?i:o[2],i=this.vertices[t].Y(),o[1]=i<o[1]?i:o[1],o[3]=i>o[3]?i:o[3]}else if(this.elementClass===p.A.OBJECT_CLASS_CIRCLE)s=this.center.X(),r=this.center.Y(),o=[s-this.radius,r+this.radius,s+this.radius,r-this.radius];else if(this.elementClass===p.A.OBJECT_CLASS_CURVE){if(0===(e=this.vertices.length))return o;for(t=0;t<e;t++)i=this.points[t].coords.usrCoords[1],o[0]=i<o[0]?i:o[0],o[2]=i>o[2]?i:o[2],i=this.points[t].coords.usrCoords[1],o[1]=i<o[1]?i:o[1],o[3]=i>o[3]?i:o[3]}return o},addEvent:d.A.shortcut(d.A.GeometryElement.prototype,"on"),removeEvent:d.A.shortcut(d.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(m.A.exists(Intl)&&this.useLocale()){for(r in i=m.A.evaluate(this.visProp.intl.locale)||m.A.evaluate(this.board.attr.intl.locale),s=m.A.evaluate(this.visProp.intl.options)||{})s.hasOwnProperty(r)&&(n.hasOwnProperty(r)?o[n[r]]=m.A.evaluate(s[r]):o[r]=m.A.evaluate(s[r]));return m.A.exists(s[r="maximumfractiondigits"])||(o[n[r]]=e),Intl.NumberFormat(i,o).format(t)}return t},useLocale:function(){var t;return!(!m.A.exists(this.visProp.intl)||!m.A.exists(this.visProp.intl.enabled))&&(!0===(t=m.A.evaluate(this.visProp.intl.enabled))||"inherit"===t&&!0===m.A.evaluate(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=d.A.GeometryElement},925:function(t,e,i){function r(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()}var o=i(443),n=i(561),s=i(144),a=i(86),l=i(133),y=i(188),h=i(477),u=i(102);o.A.Text=function(t,e,i,s){this.constructor(t,i,n.A.OBJECT_TYPE_TEXT,n.A.OBJECT_CLASS_TEXT),this.element=this.board.select(i.anchor),this.coordsConstructor(e,y.A.evaluate(this.visProp.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),t=this.visProp.visible,this.visProp.visible=!0,this.setText(s),this.visProp.visible=t,y.A.isString(this.content)&&this.notifyParents(this.content),this.elType="text",this.methodMap=y.A.deepCopy(this.methodMap,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"})},o.A.Text.prototype=new s.A,y.A.copyPrototypeMethods(o.A.Text,u.A,"coordsConstructor"),o.A.extend(o.A.Text.prototype,{hasPoint:function(t,e){var i,s,r,o,n=y.A.isObject(y.A.evaluate(this.visProp.precision))?(n=this.board._inputDevice,y.A.evaluate(this.visProp.precision[n])):this.board.options.precision.hasPoint;return 0<this.transformations.length&&(t=(i=h.A.matVecMult(h.A.inverse(this.board.renderer.joinTransforms(this,this.transformations)),[1,t,e]))[1],e=i[2]),r=(i="right"===(r=this.getAnchorX())?this.coords.scrCoords[1]-this.size[0]:"middle"===r?this.coords.scrCoords[1]-.5*this.size[0]:this.coords.scrCoords[1])+this.size[0],s=(o="top"===(o=this.getAnchorY())?this.coords.scrCoords[2]+this.size[1]:"middle"===o?this.coords.scrCoords[2]+.5*this.size[1]:this.coords.scrCoords[2])-this.size[1],"all"===y.A.evaluate(this.visProp.dragarea)?i-n<=t&&t<r+n&&s-n<=e&&e<=o+n:s-n<=e&&e<=o+n&&(i-n<=t&&t<=i+2*n||r-2*n<=t&&t<=r+n)},_createFctUpdateText:function(t){var e,i,s,r,o,n,a=y.A.evaluate(this.visProp.parse),l=y.A.evaluate(this.visProp.usemathjax),h=y.A.evaluate(this.visProp.usekatex),u=!1;if(this.orgText=t,y.A.isFunction(t))this.updateText=function(){r=t().toString(),this.plaintext=!a||l||h?r:this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(r,!1)))};else if(y.A.isNumber(t)&&y.A.evaluate(this.visProp.formatnumber)?y.A.evaluate(this.visProp.tofraction)?this.content=l?"\\("+y.A.toFraction(t,!0)+"\\)":y.A.toFraction(t,h):(s=y.A.evaluate(this.visProp.digits),this.useLocale()?this.content=this.formatNumberLocale(t,s):this.content=y.A.toFixed(t,s)):y.A.isString(t)&&a?(y.A.evaluate(this.visProp.useasciimathml)?this.content="'`"+t+"`'":l||h?(this.content=this.valueTagToJessieCode(t),y.A.isArray(this.content)||(this.content=this.content.replace(/\\/g,"\\\\"))):this.content=this.poorMansTeX(this.valueTagToJessieCode(t)),u=!0):this.content=t,u){if(y.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(){for(var t,e=y.A.evaluate(n.visProp.digits),i="",s=0;s<n.content.length;s++)y.A.isFunction(n.content[s])?(t=n.content[s](),t=n.useLocale()?n.formatNumberLocale(t,e):y.A.toFixed(t,e)):'"'===(t=n.content[s])[0]&&'"'===t[t.length-1]&&(t=t.slice(1,-1)),i+=t;return i}}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=y.A.isFunction(t)?function(){return y.A.sanitizeHTML(t())}:y.A.isNumber(t)?t:y.A.sanitizeHTML(t),this._setText(e)},setText:function(t){return this._setText(t)},updateSize:function(){var t,e,i,s=y.A.evaluate(this.visProp.display);return l.A.isBrowser&&"no"!==this.board.renderer.type&&(i=this.rendNode,"html"===s||"vml"===this.board.renderer.type?y.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},crudeSizeEstimate:function(){var t=parseFloat(y.A.evaluate(this.visProp.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("_{");0<=i;)i=(t=0<=(e=(t=t.slice(0,i)+t.slice(i).replace(/_\{/,"<sub>")).indexOf("}",i+4))?t.slice(0,e)+t.slice(e).replace(/\}/,"</sub>"):t).indexOf("_{");for(i=t.indexOf("_");0<=i;)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("^{");0<=i;)i=(t=0<=(e=(t=t.slice(0,i)+t.slice(i).replace(/\^\{/,"<sup>")).indexOf("}",i+4))?t.slice(0,e)+t.slice(e).replace(/\}/,"</sup>"):t).indexOf("^{");for(i=t.indexOf("^");0<=i;)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;return y.A.isArray(t)&&1<t.length&&(e=t[1],t=t[0]),y.A.evaluate(this.visProp.islabel)&&y.A.exists(this.element)?(i=(t-(s=this.element.getLabelAnchor()).usrCoords[1])*this.board.unitX,s=-(e-s.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(n.A.COORDS_BY_SCREEN,[i,s])):this.coords.setCoordinates(n.A.COORDS_BY_USER,[t,e]),this.fullUpdate(),this},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateText(),"internal"===y.A.evaluate(this.visProp.display)&&y.A.isString(this.plaintext)&&(this.plaintext=this.utf8_decode(this.plaintext)),this.checkForSizeUpdate(),this.needsSizeUpdate&&this.updateSize()),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 y.A.evaluate(this.visProp.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=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/"/g,"'")).replace(/'/g,"\\'")).replace(/&arc;/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<sqrt\s*\/>/g,"√")).replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>")).indexOf("<value>"),n=t.indexOf("</value>");if(0<=o)for(;0<=o;)r+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,o)))+'"',s=(s=t.slice(o+7,n)).replace(/\s+/g,""),!0===e&&(s=this.expandShortMath(s)),(s=(s=(s=i?s:a.A.geonext2JS(s,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")<0&&y.A.isNumber(y.A.bind(this.board.jc.snippet(s,!0,"",!1),this)())?r+="+("+s+").toFixed("+y.A.evaluate(this.visProp.digits)+")":r+="+("+s+")",o=(t=t.slice(n+8)).indexOf("<value>"),n=t.indexOf("</value>");return r+=' + "'+this.replaceSub(this.replaceSup(t))+'"',(r=(r=this.convertGeonextAndSketchometry2CSS(r)).replace(/&/g,"&")).replace(/"/g,"'")},valueTagToJessieCode:function(t){var e,i=[],s=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>")).indexOf("<value>"),r=t.indexOf("</value>");if(0<=s)for(;0<=s;)i.push('"'+this.escapeTicks(t.slice(0,s))+'"'),e=(e=t.slice(s+7,r)).replace(/\s+/g,""),e=(e=e=this.expandShortMath(e)).replace(/\\"/g,"'").replace(/\\'/g,"'"),i.push("("+e+")"),s=(t=t.slice(r+8)).indexOf("<value>"),r=t.indexOf("</value>");for(i.push('"'+this.escapeTicks(t)+'"'),s=0;s<i.length;s++)i[s]=i[s].replace(/&/g,"&");return i},poorMansTeX:function(t){var e,i;if(y.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,"∠").replace(/<arc\s*\/*>/g,"∠").replace(/<sqrt\s*\/*>/g,"√").replace(/<sqrt\s*\/*>/g,"√"),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 t=y.A.isString(t)?(t=(t=(t=t.replace(/(<|<)overline(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/overline(>|>)/g,"</span>")).replace(/(<|<)arrow(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/arrow(>|>)/g,"</span>"):t},convertSketchometry2CSS:function(t,e){var i='<span class="sketcho sketcho-inherit sketcho-',s='"></span>';return y.A.isString(t)&&(e&&(i=this.escapeTicks(i),s=this.escapeTicks(s)),t=(t=t.replace(/(<|<)sketchofont(>|>)/g,i)).replace(/(<|<)\/sketchofont(>|>)/g,s)),t},convertGeonextAndSketchometry2CSS:function(t,e){return t=this.convertGeonext2CSS(t),this.convertSketchometry2CSS(t,e)},notifyParents:function(t){var e,i;for(t=(t=t.replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>");null!==(i=(e=/<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/).exec(t))&&(a.A.findDependencies(this,i[1],this.board),t=(t=t.slice(i.index)).replace(e,"")),null!==i;);return this},getParents:function(){var t=void 0!==this.relativeCoords?[this.relativeCoords.usrCoords[1],this.relativeCoords.usrCoords[2],this.orgText]:[this.Z(),this.X(),this.Y(),this.orgText];return t=0!==this.parents.length?this.parents:t},bounds:function(){var t=this.coords.usrCoords;return y.A.evaluate(this.visProp.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=y.A.evaluate(this.visProp.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=y.A.evaluate(this.visProp.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,r){r=r||[];var o,n,a,l,h=0,u=this.board.options.precision.hasPoint;for(this.board.options.precision.hasPoint=.25*(i+s),o=0,a=this.board.objectsList.length;o<a;o++)l=(n=this.board.objectsList[o]).visProp.hasinnerpoints,n.visProp.hasinnerpoints=!1,n.visPropCalc.visible&&"axis"!==n.elType&&"ticks"!==n.elType&&n!==this.board.infobox&&n!==this&&n.hasPoint(t,e)&&-1===r.indexOf(n.id)&&h++,n.visProp.hasinnerpoints=l;return this.board.options.precision.hasPoint=u,h},setAutoPosition:function(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_,f=this.size[0],A=this.size[1],g={conflicts:1/0,angle:0,r:0},m=2*Math.PI/12;if(this===this.board.infobox||!this.visPropCalc.visible||!y.A.evaluate(this.visProp.islabel)||!this.element)return this;if(d=y.A.evaluate(this.visProp.offset),i=(c=this.element.getLabelAnchor()).scrCoords[1],s=c.scrCoords[2],c=d[0],d=d[1],0===(l=this.getNumberOfConflicts(i+c,s-d,f,A,y.A.evaluate(this.visProp.autopositionwhitelist))))return this;for(h=y.A.evaluate(this.visProp.autopositionmindistance),n=y.A.evaluate(this.visProp.autopositionmaxdistance),a=.2*h,r=Math.atan2(d,c),g.conflicts=l,g.angle=r,g.r=h;0<g.conflicts&&h<=n;){for(u=1,o=r+m;u<12&&0<g.conflicts&&(t=i+h*(p=Math.cos(o)),e=s-h*(_=Math.sin(o)),(l=this.getNumberOfConflicts(t,e,f,A,y.A.evaluate(this.visProp.autopositionwhitelist)))<g.conflicts&&(g.conflicts=l,g.angle=o,g.r=h),0!==g.conflicts);u++)o+=m;h+=a}return h=g.r,p=Math.cos(g.angle),_=Math.sin(g.angle),this.visProp.offset=[h*p,h*_],this.visProp.anchorx=p<-.2?"right":.2<p?"left":"middle",this}}),o.A.createText=function(t,e,i){var i=y.A.copyAttributes(i,t.options,"text"),s=e.slice(0,-1),r=e[e.length-1];if(i.anchor=i.parent||i.anchor,t=u.A.create(o.A.Text,t,s,i,r))return 0!==i.rotate&&t.addRotation(i.rotate),t;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]")},o.A.registerElement("text",o.A.createText),o.A.createHTMLSlider=function(t,e,i){var s,i=y.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]]");i.anchor=i.parent||i.anchor,i.fixed=i.fixed||!0,s=[e[0][0],e[0][1],'<form style="display:inline"><input type="range" /><span></span><input type="text" /></form>'],(s=o.A.createText(t,s,i)).type=y.A.OBJECT_TYPE_HTMLSLIDER,s.rendNodeForm=s.rendNode.childNodes[0],s.rendNodeRange=s.rendNodeForm.childNodes[0],s.rendNodeRange.min=e[1][0],s.rendNodeRange.max=e[1][2],s.rendNodeRange.step=i.step,s.rendNodeRange.value=e[1][1],s.rendNodeLabel=s.rendNodeForm.childNodes[1],s.rendNodeLabel.id=s.rendNode.id+"_label",i.withlabel&&(s.rendNodeLabel.innerHTML=s.name+"="),s.rendNodeOut=s.rendNodeForm.childNodes[2],s.rendNodeOut.value=e[1][1];try{s.rendNodeForm.id=s.rendNode.id+"_form",s.rendNodeRange.id=s.rendNode.id+"_range",s.rendNodeOut.id=s.rendNode.id+"_out"}catch(t){o.A.debug(t)}return s.rendNodeRange.style.width=i.widthrange+"px",s.rendNodeRange.style.verticalAlign="middle",s.rendNodeOut.style.width=i.widthout+"px",s._val=e[1][1],o.A.supportsVML()?l.A.addEvent(s.rendNodeForm,"change",r,s):l.A.addEvent(s.rendNodeForm,"input",r,s),s.Value=function(){return this._val},s},o.A.registerElement("htmlslider",o.A.createHTMLSlider),e.A=o.A.Text},443:function(t,e){var r={};try{"object"!=typeof JXG||JXG.extend||(r=JXG)}catch(t){}r.extend=function(t,e,i,s){for(var r in i=i||!1,s=s||!1,e)i&&!e.hasOwnProperty(r)||(t[s?r.toLowerCase():r]=e[r])},r.defineConstant=function(t,e,i,s){(s=s||!1)&&r.exists(t[e])||Object.defineProperty(t,e,{value:i,writable:!1,enumerable:!0,configurable:!1})},r.extendConstants=function(t,e,i,s){var r,o;for(r in i=i||!1,s=s||!1,e)i&&!e.hasOwnProperty(r)||(o=s?r.toUpperCase():r,this.defineConstant(t,o,e[r]))},r.extend(r,{boards:{},readers:{},elements:{},registerElement:function(t,e){t=t.toLowerCase(),this.elements[t]=e},registerReader:function(t,e){for(var i,s=0;s<e.length;s++)i=e[s].toLowerCase(),"function"!=typeof this.readers[i]&&(this.readers[i]=t)},shortcut:function(t,e){return function(){return t[e].apply(this,arguments)}},getRef:function(t,e){return r.deprecated("JXG.getRef()","Board.select()"),t.select(e)},getReference:function(t,e){return r.deprecated("JXG.getReference()","Board.select()"),t.select(e)},getBoardByContainerId:function(t){for(var e in JXG.boards)if(JXG.boards.hasOwnProperty(e)&&JXG.boards[e].container===t)return JXG.boards[e];return null},deprecated:function(t,e){t+=" is deprecated.";e&&(t+=" Please use "+e+" instead."),r.warn(t)},warn:function(t){"object"==typeof window&&window.console&&console.warn?console.warn("WARNING:",t):"object"==typeof document&&document.getElementById("warning")&&(document.getElementById("debug").innerHTML+="WARNING: "+t+"<br />")},debugInt:function(t){for(var e,i=0;i<arguments.length;i++)e=arguments[i],"object"==typeof window&&window.console&&console.log?console.log(e):"object"==typeof document&&document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=e+"<br/>")},debugWST:function(t){var e=new Error;r.debugInt.apply(this,arguments),e&&e.stack&&(r.debugInt("stacktrace"),r.debugInt(e.stack.split("\n").slice(1).join("\n")))},debugLine:function(t){var e=new Error;r.debugInt.apply(this,arguments),e&&e.stack&&r.debugInt("Called from",e.stack.split("\n").slice(2,3).join("\n"))},debug:function(t){r.debugInt.apply(this,arguments)},themes:{}}),e.A=r},571:function(t,e,i){var p=i(443),S=i(561),T=i(904),v=i(477),N=i(171),j=i(188),n=i(713);v.A.Geometry={},p.A.extend(v.A.Geometry,{angle:function(t,e,i){var s=[],r=[],o=[];return p.A.deprecated("Geometry.angle()","Geometry.rad()"),t.coords?(s[0]=t.coords.usrCoords[1],s[1]=t.coords.usrCoords[2]):(s[0]=t[0],s[1]=t[1]),e.coords?(r[0]=e.coords.usrCoords[1],r[1]=e.coords.usrCoords[2]):(r[0]=e[0],r[1]=e[1]),i.coords?(o[0]=i.coords.usrCoords[1],o[1]=i.coords.usrCoords[2]):(o[0]=i[0],o[1]=i[1]),t=s[0]-r[0],e=s[1]-r[1],i=o[0]-r[0],s=o[1]-r[1],Math.atan2(t*s-e*i,t*i+e*s)},trueAngle:function(t,e,i){return 57.29577951308232*this.rad(t,e,i)},rad:function(t,e,i){var s,r,o,t=t.coords?(s=t.coords.usrCoords[1],t.coords.usrCoords[2]):(s=t[0],t[1]),e=e.coords?(r=e.coords.usrCoords[1],e.coords.usrCoords[2]):(r=e[0],e[1]),i=i.coords?(o=i.coords.usrCoords[1],i.coords.usrCoords[2]):(o=i[0],i[1]);return(i=Math.atan2(i-e,o-r)-Math.atan2(t-e,s-r))<0&&(i+=6.283185307179586),i},angleBisector:function(t,e,i,s){var r,o,n=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords;return j.A.exists(s)||(s=t.board),0===e[0]?new T.A(S.A.COORDS_BY_USER,[1,.5*(n[1]+i[1]),.5*(n[2]+i[2])],s):(t=n[1]-e[1],n=n[2]-e[2],r=Math.atan2(n,t),t=i[1]-e[1],n=i[2]-e[2],o=.5*(r+(i=Math.atan2(n,t))),i<r&&(o+=Math.PI),t=Math.cos(o)+e[1],n=Math.sin(o)+e[2],new T.A(S.A.COORDS_BY_USER,[1,t,n],s))},reflection:function(t,e,i){var s,r=e.coords.usrCoords,o=t.point1.coords.usrCoords,t=t.point2.coords.usrCoords;return j.A.exists(i)||(i=e.board),e=t[1]-o[1],t=t[2]-o[2],s=r[1]-o[1],o=(e*(r[2]-o[2])-t*s)/(e*e+t*t),s=r[1]+2*o*t,t=r[2]-2*o*e,new T.A(S.A.COORDS_BY_USER,[s,t],i)},rotation:function(t,e,i,s){var r,o,n=e.coords.usrCoords,t=t.coords.usrCoords;return j.A.exists(s)||(s=e.board),e=n[1]-t[1],n=n[2]-t[2],o=e*(r=Math.cos(i))-n*(i=Math.sin(i))+t[1],e=e*i+n*r+t[2],new T.A(S.A.COORDS_BY_USER,[o,e],s)},perpendicular:function(t,e,i){var s,r,o,n,a,l=t.point1.coords.usrCoords,h=t.point2.coords.usrCoords,u=e.coords.usrCoords;return j.A.exists(i)||(i=e.board),e===t.point1?(s=l[1]+h[2]-l[2],r=l[2]-h[1]+l[1],a=l[0]*h[0],Math.abs(a)<v.A.eps&&(s=h[2],r=-h[1]),n=[a,s,r],o=!0):e===t.point2?(s=h[1]+l[2]-h[2],r=h[2]-l[1]+h[1],a=l[0]*h[0],Math.abs(a)<v.A.eps&&(s=l[2],r=-l[1]),o=!(n=[a,s,r])):Math.abs(v.A.innerProduct(u,t.stdform,3))<v.A.eps?(s=u[1]+h[2]-u[2],r=u[2]-h[1]+u[1],a=h[0],Math.abs(a)<v.A.eps&&(s=h[2],r=-h[1]),o=!0,Math.abs(a)>v.A.eps&&Math.abs(s-u[1])<v.A.eps&&Math.abs(r-u[2])<v.A.eps&&(s=u[1]+l[2]-u[2],r=u[2]-l[1]+u[1],o=!1),n=[a,s,r]):(n=[0,t.stdform[1],t.stdform[2]],n=v.A.crossProduct(n,u),n=v.A.crossProduct(n,t.stdform),o=!0),[new T.A(S.A.COORDS_BY_USER,n,i),o]},circumcenterMidpoint:function(){p.A.deprecated("Geometry.circumcenterMidpoint()","Geometry.circumcenter()"),this.circumcenter.apply(this,arguments)},circumcenter:function(t,e,i,s){var r,o=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords;return j.A.exists(s)||(s=t.board),t=[e[0]-o[0],-e[2]+o[2],e[1]-o[1]],o=[.5*(o[0]+e[0]),.5*(o[1]+e[1]),.5*(o[2]+e[2])],r=v.A.crossProduct(t,o),t=[i[0]-e[0],-i[2]+e[2],i[1]-e[1]],o=[.5*(e[0]+i[0]),.5*(e[1]+i[1]),.5*(e[2]+i[2])],e=v.A.crossProduct(t,o),new T.A(S.A.COORDS_BY_USER,v.A.crossProduct(r,e),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){return(i=this.distance(t,e,i))>v.A.eps&&(Math.abs(t[0])<v.A.eps||Math.abs(e[0])<v.A.eps)?1/0:i},affineRatio:function(t,e,i){var s;return j.A.exists(t.usrCoords)&&(t=t.usrCoords),j.A.exists(e.usrCoords)&&(e=e.usrCoords),j.A.exists(i.usrCoords)&&(i=i.usrCoords),s=e[1]-t[1],Math.abs(s)>v.A.eps?(i[1]-t[1])/s:(i[2]-t[2])/(e[2]-t[2])},sortVertices:function(t){for(var i,e=n.A.each(t,n.A.coordsArray),s=e.length,r=null;e[0][0]===e[s-1][0]&&e[0][1]===e[s-1][1]&&e[0][2]===e[s-1][2];)r=e.pop(),s--;return i=e[0],e.sort(function(t,e){return(t[2]===i[2]&&t[1]===i[1]?-1/0:Math.atan2(t[2]-i[2],t[1]-i[1]))-(e[2]===i[2]&&e[1]===i[1]?-1/0:Math.atan2(e[2]-i[2],e[1]-i[1]))}),null!==r&&e.push(r),e},signedTriangle:function(t,e,i){t=n.A.coordsArray(t),e=n.A.coordsArray(e),i=n.A.coordsArray(i);return.5*((e[1]-t[1])*(i[2]-t[2])-(e[2]-t[2])*(i[1]-t[1]))},signedPolygon:function(t,e){var i,s,r=0,o=n.A.each(t,n.A.coordsArray);for((e=void 0===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){for(var e=1,i=n.A.each(t,n.A.coordsArray),s=(i.length,(i=this.sortVertices(i)).length),r=2;r<s;r++){for(;this.signedTriangle(i[e-1],i[e],i[r])<=0;){if(1<e)--e;else if(r===s-1)break;r+=1}e+=1,i=j.A.swap(i,e,r)}return i.slice(0,e)},calcStraight:function(t,e,i,s){var r,o,n,a,l,h,u;if(j.A.exists(s)||(s=10),n=j.A.evaluate(t.visProp.straightfirst),a=j.A.evaluate(t.visProp.straightlast),Math.abs(e.scrCoords[0])<v.A.eps&&(n=!0),Math.abs(i.scrCoords[0])<v.A.eps&&(a=!0),(n||a)&&((l=[])[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,l[1]=t.stdform[1]/t.board.unitX,l[2]=-t.stdform[2]/t.board.unitY,!isNaN(l[0]+l[1]+l[2]))){if(r=!n&&Math.abs(e.usrCoords[0])>=v.A.eps&&0<=e.scrCoords[1]&&e.scrCoords[1]<=t.board.canvasWidth&&0<=e.scrCoords[2]&&e.scrCoords[2]<=t.board.canvasHeight,o=!a&&Math.abs(i.usrCoords[0])>=v.A.eps&&0<=i.scrCoords[1]&&i.scrCoords[1]<=t.board.canvasWidth&&0<=i.scrCoords[2]&&i.scrCoords[2]<=t.board.canvasHeight,t=(l=this.meetLineBoard(l,t.board,s))[0],s=l[1],!r&&!o){if(!n&&a&&!this.isSameDirection(e,i,t)&&!this.isSameDirection(e,i,s))return;if(n&&!a&&!this.isSameDirection(i,e,t)&&!this.isSameDirection(i,e,s))return}r?o||(u=this.isSameDir(e,i,t,s)?s:t):o?h=this.isSameDir(e,i,t,s)?t:s:this.isSameDir(e,i,t,s)?(h=t,u=s):(u=t,h=s),h&&e.setCoordinates(S.A.COORDS_BY_USER,h.usrCoords),u&&i.setCoordinates(S.A.COORDS_BY_USER,u.usrCoords)}},calcLineDelimitingPoints:function(t,e,i){var s,r,o,n,a,l,h=j.A.evaluate(t.visProp.straightfirst),u=j.A.evaluate(t.visProp.straightlast);if(Math.abs(e.scrCoords[0])<v.A.eps&&(h=!0),Math.abs(i.scrCoords[0])<v.A.eps&&(u=!0),(a=[])[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,a[1]=t.stdform[1]/t.board.unitX,a[2]=-t.stdform[2]/t.board.unitY,!isNaN(a[0]+a[1]+a[2])){if(a=!h,l=!u,r=t.board.getBoundingBox(),r=0<=t.getSlope()?(s=this.projectPointToLine({coords:{usrCoords:[1,r[2],r[1]]}},t,t.board),this.projectPointToLine({coords:{usrCoords:[1,r[0],r[3]]}},t,t.board)):(s=this.projectPointToLine({coords:{usrCoords:[1,r[0],r[1]]}},t,t.board),this.projectPointToLine({coords:{usrCoords:[1,r[2],r[3]]}},t,t.board)),!a&&!l){if(!h&&!u){if(t=e.distance(S.A.COORDS_BY_USER,i),Math.abs(e.distance(S.A.COORDS_BY_USER,s)+s.distance(S.A.COORDS_BY_USER,i)-t)>v.A.eps)return;if(Math.abs(e.distance(S.A.COORDS_BY_USER,r)+r.distance(S.A.COORDS_BY_USER,i)-t)>v.A.eps)return}if(!h&&u&&!this.isSameDirection(e,i,s)&&!this.isSameDirection(e,i,r))return;if(h&&!u&&!this.isSameDirection(i,e,s)&&!this.isSameDirection(i,e,r))return}a?l||(n=this.isSameDir(e,i,s,r)?r:s):l?o=this.isSameDir(e,i,s,r)?s:r:this.isSameDir(e,i,s,r)?(o=s,n=r):(n=s,o=r),o&&e.setCoordinates(S.A.COORDS_BY_USER,o.usrCoords),n&&i.setCoordinates(S.A.COORDS_BY_USER,n.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],n=s.usrCoords[1]-i.usrCoords[1],s=s.usrCoords[2]-i.usrCoords[2];return Math.abs(e.usrCoords[0])<v.A.eps&&(r=e.usrCoords[1],o=e.usrCoords[2]),Math.abs(t.usrCoords[0])<v.A.eps&&(r=-t.usrCoords[1],o=-t.usrCoords[2]),0<=r*n+o*s},isSameDirection:function(t,e,i){var s=!1,r=e.usrCoords[1]-t.usrCoords[1],e=e.usrCoords[2]-t.usrCoords[2],o=i.usrCoords[1]-t.usrCoords[1],i=i.usrCoords[2]-t.usrCoords[2];return Math.abs(r)<v.A.eps&&(r=0),Math.abs(e)<v.A.eps&&(e=0),Math.abs(o)<v.A.eps&&(o=0),Math.abs(i)<v.A.eps&&(i=0),s=0<=r&&0<=o||r<=0&&o<=0?0<=e&&0<=i||e<=0&&i<=0:s},det3p:function(t,e,i){t=j.A.isPoint(t)?t.Coords(!0):t,e=j.A.isPoint(e)?e.Coords(!0):e,i=j.A.isPoint(i)?i.Coords(!0):i;return(t[1]-i[1])*(e[2]-i[2])-(e[1]-i[1])*(t[2]-i[2])},windingNumber:function(t,e,i){var s,r,o,n,a,l,h=0,u=e.length,c=t[1],d=t[2],p=0;if(0===u)return 0;if((i=i||!1)&&(p=1),isNaN(c)||isNaN(d))return 1;if(r=j.A.exists(e[0].coords)?(s=e[0].coords,e[u-1].coords):(s=e[0],e[u-1]),s.usrCoords[1]===c&&s.usrCoords[2]===d)return 1;for(l=0;l<u-p;l++)if(o=j.A.exists(e[l].coords)?(r=e[l].coords.usrCoords,e[(l+1)%u].coords.usrCoords):(r=e[l].usrCoords,e[(l+1)%u].usrCoords),!(0===r[0]||0===o[0]||isNaN(r[1])||isNaN(o[1])||isNaN(r[2])||isNaN(o[2]))){if(o[2]===d){if(o[1]===c)return 1;if(r[2]===d&&o[1]>c==r[1]<c)return 0}if(r[2]<d!=o[2]<d)if(a=2*(o[2]>r[2]?1:0)-1,r[1]>=c)if(o[1]>c)h+=a;else{if(0===(n=this.det3p(r,o,t)))return 0;n>0+v.A.eps==o[2]>r[2]&&(h+=a)}else o[1]>c&&(n=this.det3p(r,o,t))>0+v.A.eps==o[2]>r[2]&&(h+=a)}return h},pnpoly:function(t,e,i,s){for(var r,o,n,a,l=i,h=!1,u=s===S.A.COORDS_BY_USER?(a=(s=new T.A(S.A.COORDS_BY_USER,[t,e],this.board)).scrCoords[1],s.scrCoords[2]):(a=t,e),c=0,d=(n=i.length)-2;c<n-1;d=c++)r=j.A.exists(l[c].coords)?l[c].coords:l[c],o=j.A.exists(l[d].coords)?l[d].coords:l[d],r.scrCoords[2]>u!=o.scrCoords[2]>u&&a<(o.scrCoords[1]-r.scrCoords[1])*(u-r.scrCoords[2])/(o.scrCoords[2]-r.scrCoords[2])+r.scrCoords[1]&&(h=!h);return h},intersectionFunction:function(t,o,n,a,e,l){var h=this,u=o.elementClass===S.A.OBJECT_CLASS_CURVE&&(o.type===S.A.OBJECT_TYPE_ARC||o.type===S.A.OBJECT_TYPE_SECTOR),c=n.elementClass===S.A.OBJECT_CLASS_CURVE&&(n.type===S.A.OBJECT_TYPE_ARC||n.type===S.A.OBJECT_TYPE_SECTOR);return o.elementClass!==S.A.OBJECT_CLASS_CURVE&&n.elementClass!==S.A.OBJECT_CLASS_CURVE||o.elementClass!==S.A.OBJECT_CLASS_CURVE&&o.elementClass!==S.A.OBJECT_CLASS_CIRCLE||n.elementClass!==S.A.OBJECT_CLASS_CURVE&&n.elementClass!==S.A.OBJECT_CLASS_CIRCLE?o.elementClass===S.A.OBJECT_CLASS_CURVE&&!u&&n.elementClass===S.A.OBJECT_CLASS_LINE||n.elementClass===S.A.OBJECT_CLASS_CURVE&&!c&&o.elementClass===S.A.OBJECT_CLASS_LINE?function(){return h.meetCurveLine(o,n,a,o.board,j.A.evaluate(l))}:o.type===S.A.OBJECT_TYPE_POLYGON||n.type===S.A.OBJECT_TYPE_POLYGON?o.elementClass===S.A.OBJECT_CLASS_LINE?function(){var t=j.A.evaluate(o.visProp.straightfirst),e=j.A.evaluate(o.visProp.straightlast),i=j.A.evaluate(n.visProp.straightfirst),s=j.A.evaluate(n.visProp.straightlast),t=!(j.A.evaluate(l)||t&&e&&i&&s);return h.meetPolygonLine(n,o,a,o.board,t)}:n.elementClass===S.A.OBJECT_CLASS_LINE?function(){var t=j.A.evaluate(o.visProp.straightfirst),e=j.A.evaluate(o.visProp.straightlast),i=j.A.evaluate(n.visProp.straightfirst),s=j.A.evaluate(n.visProp.straightlast),t=!(j.A.evaluate(l)||t&&e&&i&&s);return h.meetPolygonLine(o,n,a,o.board,t)}:function(){return h.meetPathPath(o,n,a,o.board)}:o.elementClass===S.A.OBJECT_CLASS_LINE&&n.elementClass===S.A.OBJECT_CLASS_LINE?function(){var t,e=j.A.evaluate(o.visProp.straightfirst),i=j.A.evaluate(o.visProp.straightlast),s=j.A.evaluate(n.visProp.straightfirst),r=j.A.evaluate(n.visProp.straightlast);return j.A.evaluate(l)||e&&i&&s&&r?h.meet(o.stdform,n.stdform,a,o.board):(t=h.meetSegmentSegment(o.point1.coords.usrCoords,o.point2.coords.usrCoords,n.point1.coords.usrCoords,n.point2.coords.usrCoords),e=!e&&t[1]<0||!i&&1<t[1]||!s&&t[2]<0||!r&&1<t[2]?[0,NaN,NaN]:t[0],new T.A(S.A.COORDS_BY_USER,e,o.board))}:function(){var t,e,i,s=h.meet(o.stdform,n.stdform,a,o.board),r=!0;return!j.A.evaluate(l)&&(o.elementClass===S.A.OBJECT_CLASS_LINE&&(t=j.A.evaluate(o.visProp.straightfirst),e=j.A.evaluate(o.visProp.straightlast),(!t||!e)&&(i=h.affineRatio(o.point1.coords,o.point2.coords,s),!e&&i>1+v.A.eps||!t&&i<0-v.A.eps))||n.elementClass===S.A.OBJECT_CLASS_LINE&&(t=j.A.evaluate(n.visProp.straightfirst),e=j.A.evaluate(n.visProp.straightlast),(!t||!e)&&(i=h.affineRatio(n.point1.coords,n.point2.coords,s),!e&&i>1+v.A.eps||!t&&i<0-v.A.eps))||u&&!(r=(r=h.coordsOnArc(o,s))&&c?h.coordsOnArc(n,s):r))?new T.A(p.A.COORDS_BY_USER,[0,NaN,NaN],o.board):s}:function(){return h.meetCurveCurve(o,n,a,e,o.board)}},otherIntersectionFunction:function(t,n,a,l){var h=this,u=t[0],c=t[1],d=u.board;return function(){for(var t,e,i,s=n.length,r=j.A.evaluate(l),o=s;0<=o;o--){for(u.elementClass===S.A.OBJECT_CLASS_CIRCLE&&0<=[S.A.OBJECT_CLASS_CIRCLE,S.A.OBJECT_CLASS_LINE].indexOf(c.elementClass)?e=h.meet(u.stdform,c.stdform,o,d):u.elementClass===S.A.OBJECT_CLASS_CURVE&&0<=[S.A.OBJECT_CLASS_CURVE,S.A.OBJECT_CLASS_CIRCLE].indexOf(c.elementClass)?e=h.meetCurveCurve(u,c,o,0,d,"segment"):u.elementClass===S.A.OBJECT_CLASS_CURVE&&c.elementClass===S.A.OBJECT_CLASS_LINE&&(e=j.A.exists(u.dataX)?p.A.Math.Geometry.meetCurveLine(u,c,o,u.board,j.A.evaluate(a)):p.A.Math.Geometry.meetCurveLineContinuous(u,c,o,u.board)),i=!1,t=0;!i&&t<s;t++)e.distance(p.A.COORDS_BY_USER,n[t].coords)<r&&(i=!0);if(!i)return e}return e}},intersectionFunction3D:function(t,e,i,s){var r;return e.type===S.A.OBJECT_TYPE_PLANE3D?i.type===S.A.OBJECT_TYPE_PLANE3D?r=()=>t.intersectionPlanePlane(e,i)[s]:i.type===S.A.OBJECT_TYPE_SPHERE3D&&(r=this.meetPlaneSphere(e,i)):e.type===S.A.OBJECT_TYPE_SPHERE3D&&(i.type===S.A.OBJECT_TYPE_PLANE3D?r=this.meetPlaneSphere(i,e):i.type===S.A.OBJECT_TYPE_SPHERE3D&&(r=this.meetSphereSphere(e,i))),r},coordsOnArc:function(t,e){var e=this.rad(t.radiuspoint,t.center,e.usrCoords.slice(1)),i=0,s=this.rad(t.radiuspoint,t.center,t.anglepoint),t=j.A.evaluate(t.visProp.selection);return("minor"===t&&s>Math.PI||"major"===t&&s<Math.PI)&&(i=s,s=2*Math.PI),!(e<i||s<e)},meet:function(t,e,i,s){var r=v.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,r,o,n=[];for(j.A.exists(i)||(i=0),n[0]=v.A.crossProduct(t,[i,0,1]),n[1]=v.A.crossProduct(t,[i,1,0]),n[2]=v.A.crossProduct(t,[-i-e.canvasHeight,0,1]),n[3]=v.A.crossProduct(t,[-i-e.canvasWidth,1,0]),r=0;r<4;r++)if(Math.abs(n[r][0])>v.A.eps){for(o=2;0<o;o--)n[r][o]/=n[r][0];n[r][0]=1}return t=Math.abs(n[1][0])<v.A.eps?(s=n[0],n[2]):Math.abs(n[0][0])<v.A.eps?(s=n[1],n[3]):n[1][2]<0?(s=n[0],n[3][2]>e.canvasHeight?n[2]:n[3]):n[1][2]>e.canvasHeight?(s=n[2],n[3][2]<0?n[0]:n[3]):(s=n[1],n[3][2]<0?n[0]:n[3][2]>e.canvasHeight?n[2]:n[3]),[new T.A(S.A.COORDS_BY_SCREEN,s.slice(1),e),new T.A(S.A.COORDS_BY_SCREEN,t.slice(1),e)]},meetLineLine:function(t,e,i,s){t=isNaN(t[5]+e[5])?[0,0,0]:v.A.crossProduct(t,e);return Math.abs(t[0])<1e-14&&(t[0]=0),new T.A(S.A.COORDS_BY_USER,t,s)},meetLineCircle:function(t,e,i,s){var r,o,n,a,l;return e[4]<v.A.eps?Math.abs(v.A.innerProduct([1,e[6],e[7]],t,3))<v.A.eps?new T.A(S.A.COORDS_BY_USER,e.slice(6,8),s):new T.A(S.A.COORDS_BY_USER,[NaN,NaN],s):(r=e[0],l=e.slice(1,3),e=e[3],o=t[0],t=t.slice(1,3),(e=(a=l[0]*t[1]-l[1]*t[0])*a-4*(n=e)*(e*o*o-(l[0]*t[0]+l[1]*t[1])*o+r))>-v.A.eps*v.A.eps?(l=[(-a+(e=Math.sqrt(Math.abs(e))))/(2*n),(-a-e)/(2*n)],0===j.A.evaluate(i)?new T.A(S.A.COORDS_BY_USER,[-l[0]*-t[1]-o*t[0],-l[0]*t[0]-o*t[1]],s):new T.A(S.A.COORDS_BY_USER,[-l[1]*-t[1]-o*t[0],-l[1]*t[0]-o*t[1]],s)):new T.A(S.A.COORDS_BY_USER,[0,0,0],s))},meetCircleCircle:function(t,e,i,s){return t[4]<v.A.eps?Math.abs(this.distance(t.slice(6,2),e.slice(6,8))-e[4])<v.A.eps?new T.A(S.A.COORDS_BY_USER,t.slice(6,8),s):new T.A(S.A.COORDS_BY_USER,[0,0,0],s):e[4]<v.A.eps?Math.abs(this.distance(e.slice(6,2),t.slice(6,8))-t[4])<v.A.eps?new T.A(S.A.COORDS_BY_USER,e.slice(6,8),s):new T.A(S.A.COORDS_BY_USER,[0,0,0],s):(e=[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],e=v.A.normalize(e),this.meetLineCircle(e,t,i,s))},meetCurveCurve:function(t,e,i,s,r,o){o=j.A.exists(o)&&"newton"===o?N.A.generalizedNewton(t,e,j.A.evaluate(i),s):3===t.bezierDegree||3===e.bezierDegree?this.meetBezierCurveRedBlueSegments(t,e,i):this.meetCurveRedBlueSegments(t,e,i);return new T.A(S.A.COORDS_BY_USER,o,r)},meetCurveLine:function(t,e,i,s,r){var o;return j.A.exists(s)||(s=t.board),e=t.elementClass===S.A.OBJECT_CLASS_CURVE?(o=t,e):(o=e,t),this.meetCurveLineDiscrete(o,e,i,s,!r)},meetCurveLineContinuous:function(i,e,t,s,r){for(var o,n,a=v.A.eps,l=v.A.eps,t=this.meetCurveLineDiscrete(i,e,t,s,r),h=t.usrCoords[1],u=t.usrCoords[2],c=function(t){var e;return t>i.maxX()||t<i.minX()?1/0:(e=i.X(t)-h)*e+(e=i.Y(t)-u)*e},r=function(t){t=e.stdform[0]+e.stdform[1]*i.X(t)+e.stdform[2]*i.Y(t);return t*t},d=(i.maxX()-i.minX())/50,p=i.minX(),_=1e-4,f=NaN,A=0;A<50&&(o=N.A.root(c,[Math.max(p,i.minX()),Math.min(p+d,i.maxX())]),!((n=Math.abs(c(o)))<=_&&(f=o,(_=n)<a)));A++)p+=d;return o=f,n=r(o=N.A.root(r,[Math.max(o-d,i.minX()),Math.min(o+d,i.maxX())])),t=isNaN(n)||Math.abs(n)>l?0:1,new T.A(S.A.COORDS_BY_USER,[t,i.X(o),i.Y(o)],s)},meetCurveLineDiscrete:function(t,e,i,s,r){var o,n,a,l,h,u,c=j.A.evaluate(i),d=e.point1.coords.usrCoords,p=e.point2.coords.usrCoords,_=0,f=t.numberPoints,A=j.A.evaluate(e.visProp.straightfirst),g=j.A.evaluate(e.visProp.straightlast),m=new T.A(S.A.COORDS_BY_USER,[0,NaN,NaN],s);for(0===d[0]?d=[1,p[1]+e.stdform[2],p[2]-e.stdform[1]]:0===p[0]&&(p=[1,d[1]+e.stdform[2],d[2]-e.stdform[1]]),l=t.points[0].usrCoords,o=1;o<f;o+=t.bezierDegree)if(a=l.slice(0),l=t.points[o].usrCoords,this.distance(a,l)>v.A.eps)for(u=3===t.bezierDegree?this.meetBeziersegmentBeziersegment([t.points[o-1].usrCoords.slice(1),t.points[o].usrCoords.slice(1),t.points[o+1].usrCoords.slice(1),t.points[o+2].usrCoords.slice(1)],[d.slice(1),p.slice(1)],r):[this.meetSegmentSegment(a,l,d,p)],n=0;n<u.length;n++)if(0<=(h=u[n])[1]&&h[1]<=1){if(_===c)return r&&(!A&&h[2]<0||!g&&1<h[2])?m:new T.A(S.A.COORDS_BY_USER,h[0],s);_+=1}return m},meetCurveRedBlueSegments:function(t,e,i){var s,r,o,n,a,l,h,u,c,d=j.A.evaluate(i),p=0,_=e.numberPoints,f=t.numberPoints;if(_<=1||f<=1)return[0,NaN,NaN];for(s=1;s<f;s++)for(o=t.points[s-1].usrCoords,n=t.points[s].usrCoords,u=Math.min(o[1],n[1]),c=Math.max(o[1],n[1]),l=e.points[0].usrCoords,r=1;r<_;r++)if(a=l,l=e.points[r].usrCoords,Math.min(a[1],l[1])<c&&Math.max(a[1],l[1])>u&&0<=(h=this.meetSegmentSegment(o,n,a,l))[1]&&0<=h[2]&&(h[1]<1&&h[2]<1||s===f-1&&1===h[1]||r===_-1&&1===h[2])){if(p===d)return h[0];p++}return[0,NaN,NaN]},meetSegmentSegment:function(t,e,i,s){var r=v.A.crossProduct(t,e),o=v.A.crossProduct(i,s),r=v.A.crossProduct(r,o);return Math.abs(r[0])<v.A.eps?[r,1/0,1/0]:(r[1]/=r[0],r[2]/=r[0],r[0]/=r[0],t=t[o=Math.abs(e[1]-e[0]*t[1])<v.A.eps?2:1]/t[0],e=(r[o]-t)/(0!==e[0]?e[o]/e[0]-t:e[o]),t=i[o=Math.abs(s[1]-s[0]*i[1])<v.A.eps?2:1]/i[0],[r,e,(r[o]-t)/(0!==s[0]?s[o]/s[0]-t:s[o])])},meetPathPath:function(t,e,i,s){var r,o=j.A.evaluate(i);return 0<(r=(t=p.A.Math.Clip._getPath(t,s)).length)&&this.distance(t[0].coords.usrCoords,t[r-1].coords.usrCoords,3)<v.A.eps&&t.pop(),0<(r=(e=p.A.Math.Clip._getPath(e,s)).length)&&this.distance(e[0].coords.usrCoords,e[r-1].coords.usrCoords,3)<v.A.eps*v.A.eps&&e.pop(),i<0||p.A.Math.Clip.isEmptyCase(t,e,"intersection")?new T.A(S.A.COORDS_BY_USER,[0,0,0],s):(p.A.Math.Clip.makeDoublyLinkedList(t),p.A.Math.Clip.makeDoublyLinkedList(e),o<(r=p.A.Math.Clip.findIntersections(t,e,s)[0]).length?r[o].coords:new T.A(S.A.COORDS_BY_USER,[0,0,0],s))},meetPolygonLine:function(t,e,i,s,r){for(var o,i=j.A.evaluate(i),n=[0,0,0],a=t.borders.length,l=[],h=0;h<a;h++)o=t.borders[h],o=this.meetSegmentSegment(o.point1.coords.usrCoords,o.point2.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),(!r||0<=o[2]&&o[2]<1)&&0<=o[1]&&o[1]<1&&l.push(o[0]);return 0<=i&&i<l.length&&(n=l[i]),new T.A(S.A.COORDS_BY_USER,n,s)},meetPlaneSphere:function(t,i){function s(){return t.normal[0]*i.center.X()+t.normal[1]*i.center.Y()+t.normal[2]*i.center.Z()-t.d}return[[function(){return i.center.X()-s()*t.normal[0]},function(){return i.center.Y()-s()*t.normal[1]},function(){return i.center.Z()-s()*t.normal[2]}],[()=>t.normal[0],()=>t.normal[1],()=>t.normal[2]],function(){var t=i.Radius(),e=s();return Math.sqrt(t*t-e*e)}]},meetSphereSphere:function(r,o){function n(){var t=r.center.distance(o.center),e=r.Radius(),i=o.Radius();return(e-i)*(e+i)/(t*t)}return[[function(){var t=n();return.5*((1-t)*r.center.X()+(1+t)*o.center.X())},function(){var t=n();return.5*((1-t)*r.center.Y()+(1+t)*o.center.Y())},function(){var t=n();return.5*((1-t)*r.center.Z()+(1+t)*o.center.Z())}],[()=>o.center.X()-r.center.X(),()=>o.center.Y()-r.center.Y(),()=>o.center.Z()-r.center.Z()],function(){var t=r.center.distance(o.center),e=r.Radius(),i=o.Radius(),s=n();return Math.sqrt(.5*(e*e+i*i-.5*t*t*(1+s*s)))}]},_bezierSplit:function(t){var e,i=[.5*(t[0][0]+t[1][0]),.5*(t[0][1]+t[1][1])],s=[.5*(t[1][0]+t[2][0]),.5*(t[1][1]+t[2][1])],r=[.5*(t[2][0]+t[3][0]),.5*(t[2][1]+t[3][1])],o=[.5*((e=[.5*(i[0]+s[0]),.5*(i[1]+s[1])])[0]+(s=[.5*(s[0]+r[0]),.5*(s[1]+r[1])])[0]),.5*(e[1]+s[1])];return[[t[0],i,e,o],[o,s,r,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){for(var r=j.A.exists(s),o=0,n=e.length,a=t.length,l=o=0<a&&0<n&&(1===t[a-1][1]&&0===e[0][1]||r&&1===t[a-1][2]&&0===e[0][2])?1:o;l<n;l++)r&&(e[l][2]*=.5,e[l][2]+=s),e[l][1]*=.5,e[l][1]+=i,t.push(e[l])},_bezierMeetSubdivision:function(t,e,i){var s,r,o=[],n=this._bezierBbox(e),a=this._bezierBbox(t);return this._bezierOverlap(n,a)?i<5?(a=(n=this._bezierSplit(t))[0],s=n[1],r=(n=this._bezierSplit(e))[0],n=n[1],this._bezierListConcat(o,this._bezierMeetSubdivision(a,r,i+1),0,0),this._bezierListConcat(o,this._bezierMeetSubdivision(a,n,i+1),0,.5),this._bezierListConcat(o,this._bezierMeetSubdivision(s,r,i+1),.5,0),this._bezierListConcat(o,this._bezierMeetSubdivision(s,n,i+1),.5,.5),o):(a=[1].concat(t[0]),r=[1].concat(t[3]),s=[1].concat(e[0]),n=[1].concat(e[3]),0<=(i=this.meetSegmentSegment(a,r,s,n))[1]&&0<=i[2]&&i[1]<=1&&i[2]<=1?[i]:[]):[]},_bezierLineMeetSubdivision:function(t,e,i,s){var r=[],o=this._bezierBbox(e),n=this._bezierBbox(t);return s&&!this._bezierOverlap(n,o)?[]:i<5?(o=(n=this._bezierSplit(t))[0],n=n[1],this._bezierListConcat(r,this._bezierLineMeetSubdivision(o,e,i+1),0),this._bezierListConcat(r,this._bezierLineMeetSubdivision(n,e,i+1),.5),r):(o=[1].concat(t[0]),n=[1].concat(t[3]),i=[1].concat(e[0]),r=[1].concat(e[1]),0<=(t=this.meetSegmentSegment(o,n,i,r))[1]&&t[1]<=1&&(!s||0<=t[2]&&t[2]<=1)?[t]:[])},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,r,o,n,a,l,h,u,c,d,p,_,f,A=j.A.evaluate(i),i=0,g=0,m=[];if(e.numberPoints<e.bezierDegree+1||t.numberPoints<t.bezierDegree+1)return[0,NaN,NaN];for(1===t.bezierDegree&&3===e.bezierDegree&&(l=t,t=e,e=l),_=e.numberPoints-e.bezierDegree,f=t.numberPoints-t.bezierDegree,t.type===S.A.OBJECT_TYPE_SECTOR&&(f-=i=3),e.type===S.A.OBJECT_TYPE_SECTOR&&(_-=g=3),r=i;r<f;r+=t.bezierDegree)for(h=[(s=t.points)[r].usrCoords.slice(1),s[r+1].usrCoords.slice(1)],3===t.bezierDegree&&(h[2]=s[r+2].usrCoords.slice(1),h[3]=s[r+3].usrCoords.slice(1)),c=this._bezierBbox(h),o=g;o<_;o+=e.bezierDegree)if(u=[(s=e.points)[o].usrCoords.slice(1),s[o+1].usrCoords.slice(1)],3===e.bezierDegree&&(u[2]=s[o+2].usrCoords.slice(1),u[3]=s[o+3].usrCoords.slice(1)),d=this._bezierBbox(u),this._bezierOverlap(c,d)){if(0===(p=this.meetBeziersegmentBeziersegment(h,u)).length)continue;for(n=0;n<p.length;n++)(a=p[n])[1]<-v.A.eps||a[1]>1+v.A.eps||a[2]<-v.A.eps||a[2]>1+v.A.eps||m.push(a);if(m.length>A)return m[A][0]}return m.length>A?m[A][0]:[0,NaN,NaN]},bezierSegmentEval:function(t,e){var i,s=1-t,r=0,o=0;return r+=(i=s*s*s)*e[0][0],o+=i*e[0][1],r+=(i=3*t*s*s)*e[1][0],o+=i*e[1][1],r+=(i=3*t*t*s)*e[2][0],o+=i*e[2][1],[1,r+=(i=t*t*t)*e[3][0],o+=i*e[3][1]]},bezierArc:function(t,e,i,s,r){var o,n,a,l,h,u,c,d,p,_,f=e[1],A=e[2],g=e[0],m=[],y=[],b=this.distance(e,t);for(f/=g,A/=g,a=this.rad(t.slice(1),e.slice(1),i.slice(1)),h=(a=-1===r?2*Math.PI-a:a)/4,(o=t)[1]/=o[0],o[2]/=o[0],o[0]/=o[0],n=o.slice(0),y=s?(m=[f,f+.333*(o[1]-f),f+.666*(o[1]-f),o[1]],[A,A+.333*(o[2]-A),A+.666*(o[2]-A),o[2]]):(m=[o[1]],[o[2]]);a>v.A.eps;)h<a?a-=l=h:(l=a,a=0),_=[[1,0,0],[f*(1-(d=Math.cos(r*l)))+A*(_=Math.sin(r*l)),d,-_],[A*(1-d)-f*_,_,d]],n=[(d=v.A.matVecMult(_,o))[0]/d[0],d[1]/d[0],d[2]/d[0]],_=o[1]-f,d=o[2]-A,u=n[1]-f,c=n[2]-A,p=v.A.hypot(_+u,d+c),p=Math.abs(c-d)>v.A.eps?(_+u)*(b/p-.5)/(c-d)*8/3:(d+c)*(b/p-.5)/(_-u)*8/3,d=[1,o[1]-p*d,o[2]+p*_],_=[1,n[1]+p*c,n[2]-p*u],j.A.concat(m,[d[1],_[1],n[1]]),j.A.concat(y,[d[2],_[2],n[2]]),o=n.slice(0);return s&&(j.A.concat(m,[n[1]+.333*(f-n[1]),n[1]+.666*(f-n[1]),f]),j.A.concat(y,[n[2]+.333*(A-n[2]),n[2]+.666*(A-n[2]),A])),[m,y]},projectPointToCircle:function(t,e,i){var s,r=e.center.coords.usrCoords;return j.A.exists(i)||(i=t.board),t=j.A.isPoint(t)?(s=t.coords.distance(S.A.COORDS_BY_USER,e.center.coords),t.coords.usrCoords):(s=t.distance(S.A.COORDS_BY_USER,e.center.coords),t.usrCoords),Math.abs(s)<v.A.eps&&(s=v.A.eps),e=e.Radius()/s,s=r[1]+e*(t[1]-r[1]),e=r[2]+e*(t[2]-r[2]),new T.A(S.A.COORDS_BY_USER,[s,e],i)},projectPointToLine:function(t,e,i){var s=[0,e.stdform[1],e.stdform[2]];return j.A.exists(i)||(i=(j.A.exists(t.coords)?t:e).board),t=(j.A.exists(t.coords)?t.coords:t).usrCoords,s=v.A.crossProduct(s,t),new T.A(S.A.COORDS_BY_USER,v.A.crossProduct(s,e.stdform),i)},projectCoordsToSegment:function(t,e,i){var i=[i[1]-e[1],i[2]-e[2]],t=[t[1]-e[1],t[2]-e[2]];return Math.abs(i[0])<v.A.eps&&Math.abs(i[1])<v.A.eps?[e,0]:(t=v.A.innerProduct(t,i),[[1,(t/=v.A.innerProduct(i,i))*i[0]+e[1],t*i[1]+e[2]],t])},projectCoordsToBeziersegment:function(e,i,s){var t=p.A.Math.Numerics.fminbr(function(t){t=[1,i.X(s+t),i.Y(s+t)];return t[1]-=e[1],t[2]-=e[2],t[1]*t[1]+t[2]*t[2]},[0,1]);return[[1,i.X(t+s),i.Y(t+s)],t]},projectPointToCurve:function(t,e,i){j.A.exists(i)||(i=t.board);var s=t.X(),r=t.Y(),t=t.position;return j.A.exists(t)||(t="functiongraph"===j.A.evaluate(e.visProp.curvetype)?s:0),this.projectCoordsToCurve(s,r,t,e,i)},projectCoordsToCurve:function(i,s,t,r,e){var o,n,a,l,h,u,c,d,p,_,f,A,g,m,y,b,v,C,x,P,E,O,M,w=Number.POSITIVE_INFINITY;if(j.A.exists(e)||(e=r.board),"plot"===j.A.evaluate(r.visProp.curvetype)){if(h=w,o=(t=0)===r.numberPoints?[0,1,1]:[r.Z(0),r.X(0),r.Y(0)],1<r.numberPoints)for(d=[1,i,s],3===r.bezierDegree?l=0:_=[r.Z(0),r.X(0),r.Y(0)],a=0;a<r.numberPoints-1;a++)c=(A=3===r.bezierDegree?this.projectCoordsToBeziersegment(d,r,l):(f=[r.Z(a+1),r.X(a+1),r.Y(a+1)],this.projectCoordsToSegment(d,_,f)))[1],A=A[0],0<=c&&c<=1?(u=this.distance(A,d),p=a+c):c<0?(A=_,u=this.distance(_,d),p=a):1<c&&a===r.numberPoints-2&&(A=f,u=this.distance(A,d),p=r.numberPoints-1),u<h&&(h=u,t=p,o=A),3===r.bezierDegree?(l++,a+=2):_=f;n=new T.A(S.A.COORDS_BY_USER,o,e)}else{for(M=r.minX(),w=r.maxX(),E=M,O=w,"functiongraph"===j.A.evaluate(r.visProp.curvetype)&&(v=Math.abs(s-r.Y(i)),isNaN(v)||(E=i-v,O=i+v)),b=(g=function(t){var e;return t<M||t>r.maxX_glob?1/0:(e=i-r.X(t))*e+(e=s-r.Y(t))*e})(t),C=(O-E)/50,m=E,a=0;a<50;a++)((y=g(m))<b||b===1/0||isNaN(b))&&(t=m,b=y),m+=C;for(x=C,a=0;a<20&&isNaN(g(t-x));a++,x*=.5);for(isNaN(g(t-x))&&(x=0),P=C,a=0;a<20&&isNaN(g(t+P));a++,P*=.5);isNaN(g(t+P))&&(P=0),t=(t=(t=N.A.fminbr(g,[Math.max(t-x,E),Math.min(t+P,O)]))<M?M:t)>w?w:t,n=new T.A(S.A.COORDS_BY_USER,[r.X(t),r.Y(t)],e)}return[r.updateTransform(n),t]},projectCoordsToPolygon:function(t,e){for(var i,s,r,o=e.vertices.length,n=1/0,a=0;a<o-1;a++)s=0<=(s=p.A.Math.Geometry.projectCoordsToSegment(t,e.vertices[a].coords.usrCoords,e.vertices[a+1].coords.usrCoords))[1]&&s[1]<=1?(i=p.A.Math.Geometry.distance(s[0],t,3),s[0]):s[1]<0?(i=p.A.Math.Geometry.distance(e.vertices[a].coords.usrCoords,t,3),e.vertices[a].coords.usrCoords):(i=p.A.Math.Geometry.distance(e.vertices[a+1].coords.usrCoords,t,3),e.vertices[a+1].coords.usrCoords),i<n&&(r=s.slice(0),n=i);return r},projectPointToTurtle:function(t,e,i){var s,r,o,n,a,l,h,u,c,d=0,p=0,_=Number.POSITIVE_INFINITY,f=e.objects.length;for(j.A.exists(i)||(i=t.board),a=0;a<f;a++)(h=e.objects[a]).elementClass===S.A.OBJECT_CLASS_CURVE&&(s=(c=this.projectPointToCurve(t,h))[0],c=c[1],(l=this.distance(s.usrCoords,t.coords.usrCoords))<_&&(o=s.usrCoords[1],n=s.usrCoords[2],r=c,_=l,u=h,p=d),d+=h.numberPoints);return s=new T.A(S.A.COORDS_BY_USER,[o,n],i),[u.updateTransform(s),r+p]},projectPointToPoint:function(t,e){return e.coords},projectPointToBoard:function(t,e){for(var i,s=e||t.board,r=[[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]],o=t.coords||t,n=s.getBoundingBox(),a=0;a<4;a++)(i=r[a])[0]*o.usrCoords[i[1]]<i[0]*n[i[2]]&&((i=v.A.crossProduct([1,n[i[3]],n[i[4]]],[1,n[i[5]],n[i[6]]]))[3]=0,i=v.A.normalize(i),o=this.projectPointToLine({coords:o},{stdform:i},s));return o},projectCoordsToParametric:function(a,l,t){var e,i=t.length;return 1===i?e=.1*(l.range[1]-l.range[0]):2===i&&(e=.1*Math.min(l.range_u[1]-l.range_u[0],l.range_v[1]-l.range_v[0])),v.A.Nlp.FindMinimum(function(t,e,i,s){var r=a[0]-l.X.apply(null,i),o=a[1]-l.Y.apply(null,i),n=a[2]-l.Z.apply(null,i);return 1===t?(s[0]=i[0]-l.range[0],s[1]=-i[0]+l.range[1]):2===t&&(s[0]=i[0]-l.range_u[0],s[1]=-i[0]+l.range_u[1],s[2]=i[1]-l.range_v[0],s[3]=-i[1]+l.range_v[1]),r*r+o*o+n*n},i,2*i,t,e,e/5e6,0,200),[1,l.X.apply(null,t),l.Y.apply(null,t),l.Z.apply(null,t)]},projectScreenCoordsToParametric:function(n,a,t){var e,i=t.length;return 1===i?e=.1*(a.range[1]-a.range[0]):2===i&&(e=.1*Math.min(a.range_u[1]-a.range_u[0],a.range_v[1]-a.range_v[0])),v.A.Nlp.FindMinimum(function(t,e,i,s){var r=[1,a.X.apply(null,i),a.Y.apply(null,i),a.Z.apply(null,i)],r=a.view.project3DTo2D(r),o=n[0]-r[1],r=n[1]-r[2];return 1===t?(s[0]=i[0]-a.range[0],s[1]=-i[0]+a.range[1]):2===t&&(s[0]=i[0]-a.range_u[0],s[1]=-i[0]+a.range_u[1],s[2]=i[1]-a.range_v[0],s[3]=-i[1]+a.range_v[1]),o*o+r*r},i,2*i,t,e,e/5e6,0,200),[1,a.X.apply(null,t),a.Y.apply(null,t),a.Z.apply(null,t)]},distPointLine:function(t,e){var i=e[1],s=e[2],e=e[0];return Math.abs(i)+Math.abs(s)<v.A.eps?Number.POSITIVE_INFINITY:(t=i*t[1]+s*t[2]+e,i*=i,s*=s,Math.abs(t)/Math.sqrt(i+s))},distPointSegment:function(t,e,i){var s,r=v.A.eps*v.A.eps,o=1e6,n=(n=t[1]-e[1])==1/0?o:n===-1/0?-o:n,t=(t=t[2]-e[2])==1/0?o:t===-1/0?-o:t;return(e=(s=(s=i[1]-e[1])==1/0?o:s===-1/0?-o:s)*s+(i=(i=i[2]-e[2])==1/0?o:i===-1/0?-o:i)*i)>r&&((o=(n*s+t*i)/e)<0?o=0:1<o&&(o=1),n-=o*s,t-=o*i),v.A.hypot(n,t)},reuleauxPolygon:function(o,n){function t(s,r){return function(t,e){var t=(t%l+l)%l,i=Math.floor(t/h)%n;return e||(c=o[0].Dist(o[u]),a=v.A.Geometry.rad([o[0].X()+1,o[0].Y()],o[0],o[u%n])),isNaN(i)?i:(t=.5*t+i*h*.5+a,o[i][s]()+c*Math[r](t))}}var a,l=2*Math.PI,h=l/n,u=(n-1)/2,c=0;return[t("X","cos"),t("Y","sin"),0,l]},meet3Planes:function(t,e,i,s,r,o){for(var n=[0,0,0],a=v.A.crossProduct(r,t),l=v.A.crossProduct(t,i),h=v.A.crossProduct(i,r),u=v.A.innerProduct(t,h,3),c=0;c<3;c++)n[c]=(e*h[c]+s*a[c]+o*l[c])/u;return n},meetPlanePlane:function(t,e,i,s){for(var r,o,n=[0,0,0],a=[0,0,0],l=0;l<3;l++)n[l]=j.A.evaluate(t[l]),a[l]=j.A.evaluate(e[l]);for(r=v.A.crossProduct(n,a),l=0;l<3;l++)n[l]=j.A.evaluate(i[l]),a[l]=j.A.evaluate(s[l]);return o=v.A.crossProduct(n,a),v.A.crossProduct(r,o)},project3DTo3DPlane:function(t,e,i){var s;return i=i||[0,0,0],s=v.A.norm(e),i=(v.A.innerProduct(t,e,3)-v.A.innerProduct(i,e,3))/s,v.A.axpy(-i,e,t)},getPlaneBounds:function(t,e,i,s,r){var o,n;return t[2]+e[0]!==0?(t=[[t[0],e[0]],[t[1],e[1]]],e=[s-i[0],s-i[1]],o=(s=N.A.Gauss(t,e))[0],n=s[1],e=[r-i[0],r-i[1]],[o,(s=N.A.Gauss(t,e))[0],n,s[1]]):null}}),e.A=v.A.Geometry},733:function(t,e,i){function o(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 o(t[0],t[1]):new o(t,t);this.lo=this.hi=0}}var s=i(443),r=i(477),n=i(188),a=(s.A.Math.DoubleBits=function(){var t,e,i,s=new Float64Array(1),r=new Uint32Array(s.buffer);void 0!==Float64Array&&(s[0]=1,1072693248===r[1]?(t=function(t,e){return r[0]=t,r[1]=e,s[0]},e=function(t){return s[0]=t,r[0]},i=function(t){return s[0]=t,r[1]},this.doubleBits=function(t){return s[0]=t,[r[0],r[1]]},this.pack=t,this.lo=e,this.hi=i):1072693248===r[0]&&(t=function(t,e){return r[1]=t,r[0]=e,s[0]},e=function(t){return s[0]=t,r[1]},i=function(t){return s[0]=t,r[0]},this.doubleBits=function(t){return s[0]=t,[r[1],r[0]]},this.pack=t,this.lo=e,this.hi=i))},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),t=this.hi(t),i=1048575&t;return 2146435072&t&&(i+=1<<20),[e,i]},denormalized:function(t){return!(2146435072&this.hi(t))}}),new s.A.Math.DoubleBits);s.A.extend(o.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)||e<t?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 o).set(this.lo,this.hi)}}),s.A.Math.IntervalArithmetic={Interval:function(t,e){return new o(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 n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),new o(this.addLo(t.lo,e.lo),this.addHi(t.hi,e.hi))},sub:function(t,e){return n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),new o(this.subLo(t.lo,e.hi),this.subHi(t.hi,e.lo))},mul:function(t,e){var i,s,r;return n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=t.lo,t=t.hi,s=e.lo,e=e.hi,r=new o,i<0?0<t?s<0?0<e?(r.lo=Math.min(this.mulLo(i,e),this.mulLo(t,s)),r.hi=Math.max(this.mulHi(i,s),this.mulHi(t,e))):(r.lo=this.mulLo(t,s),r.hi=this.mulHi(i,s)):0<e?(r.lo=this.mulLo(i,e),r.hi=this.mulHi(t,e)):(r.lo=0,r.hi=0):s<0?(r.lo=0<e?this.mulLo(i,e):this.mulLo(t,e),r.hi=this.mulHi(i,s)):0<e?(r.lo=this.mulLo(i,e),r.hi=this.mulHi(t,s)):(r.lo=0,r.hi=0):0<t?s<0?0<e?(r.lo=this.mulLo(t,s),r.hi=this.mulHi(t,e)):(r.lo=this.mulLo(t,s),r.hi=this.mulHi(i,e)):0<e?(r.lo=this.mulLo(i,s),r.hi=this.mulHi(t,e)):(r.lo=0,r.hi=0):(r.lo=0,r.hi=0),r)},div:function(t,e){return n.A.isNumber(t)&&(t=this.Interval(t)),n.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 o(t.lo,t.hi)},negative:function(t){return n.A.isNumber(t)?new o(-t):new o(-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,t=t.hi,s=e.lo,e=e.hi,r=new o;return t<0?e<0?(r.lo=this.divLo(t,s),r.hi=this.divHi(i,e)):(r.lo=this.divLo(i,s),r.hi=this.divHi(t,e)):i<0?e<0?(r.lo=this.divLo(t,e),r.hi=this.divHi(i,e)):(r.lo=this.divLo(i,s),r.hi=this.divHi(t,s)):e<0?(r.lo=this.divLo(t,e),r.hi=this.divHi(i,s)):(r.lo=this.divLo(i,e),r.hi=this.divHi(t,s)),r},divPositive:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new o(Number.NEGATIVE_INFINITY,this.divHi(t.hi,e)):new o(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 o(this.divLo(t.hi,e),Number.POSITIVE_INFINITY):new o(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;return n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=t.lo<0?e.lo:e.hi,i=(i=t.lo/i)<0?Math.ceil(i):Math.floor(i),this.sub(t,this.mul(e,new o(i))))},multiplicativeInverse:function(t){return n.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 o(Number.NEGATIVE_INFINITY,this.divHi(1,t.lo)):0!==t.hi?new o(this.divLo(1,t.hi),Number.POSITIVE_INFINITY):this.EMPTY.clone():new o(this.divLo(1,t.hi),this.divHi(1,t.lo))},pow:function(t,e){var i,s;if(n.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: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 o(i,s):new o(-s,-i)):t.lo<0?1&~e?new o(0,this.powHi(Math.max(-t.lo,t.hi),e)):new o(-this.powLo(-t.lo,e),this.powHi(t.hi,e)):new o(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 n.A.isNumber(t)&&(t=this.Interval(t)),this.nthRoot(t,2)},nthRoot:function(t,e){var i,s,r;if(n.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 o(-s,-r)):t.lo<0?(s=this.powHi(t.hi,i),e%1!=0||1&~e?new o(0,s):(r=-this.powHi(-t.lo,i),new o(r,s))):new o(this.powLo(t.lo,i),this.powHi(t.hi,i))},exp:function(t){return n.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():new o(this.expLo(t.lo),this.expHi(t.hi))},log:function(t){var e;return n.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 o(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 o(10,10)))},log2:function(t){return this.isEmpty(t)?this.EMPTY.clone():this.div(this.log(t),this.log(new o(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 o(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},intersection:function(t,e){var i;return!this.isEmpty(t)&&!this.isEmpty(e)&&(i=Math.max(t.lo,e.lo))<=(t=Math.min(t.hi,e.hi))?new o(i,t):this.EMPTY.clone()},union:function(t,e){if(this.intervalsOverlap(t,e))return new o(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi));throw new Error("Interval#unions do not overlap")},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 o).halfOpenLeft(e.hi,t.hi):(new o).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 n.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():0<=t.lo?t.clone():t.hi<=0?this.negative(t):new o(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 o(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 o(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;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(t=(new o).set(t.lo,t.hi),this._handleNegative(t),e=this.PI_TWICE,t=this.fmod(t,e),this.width(t)>=e.lo?new o(-1,1):t.lo>=this.piHigh?(s=this.cos(this.sub(t,this.PI)),this.negative(s)):(s=t.lo,t=t.hi,i=this.cosLo(t),s=this.cosHi(s),t<=this.piLow?new o(i,s):t<=e.lo?new o(-1,Math.max(i,s)):new o(-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;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(t=(new o).set(t.lo,t.hi),this._handleNegative(t),e=this.PI,(t=(t=this.fmod(t,e)).lo>=this.piHalfLow?this.sub(t,e):t).lo<=-this.piHalfLow||t.hi>=this.piHalfLow?this.WHOLE.clone():new o(this.tanLo(t.lo),this.tanHi(t.hi)))},asin:function(t){var e;return this.isEmpty(t)||t.hi<-1||1<t.lo?this.EMPTY.clone():(e=t.lo<=-1?-this.piHalfHigh:this.asinLo(t.lo),t=1<=t.hi?this.piHalfHigh:this.asinHi(t.hi),new o(e,t))},acos:function(t){var e;return this.isEmpty(t)||t.hi<-1||1<t.lo?this.EMPTY.clone():(e=1<=t.hi?0:this.acosLo(t.hi),t=t.lo<=-1?this.piHigh:this.acosHi(t.lo),new o(e,t))},acot:function(t){return this.isEmpty(t)?this.EMPTY.clone():new o(this.acotLo(t.lo),this.acotHi(t.hi))},atan:function(t){return this.isEmpty(t)?this.EMPTY.clone():new o(this.atanLo(t.lo),this.atanHi(t.hi))},sinh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new o(this.sinhLo(t.lo),this.sinhHi(t.hi))},cosh:function(t){return this.isEmpty(t)?this.EMPTY.clone():t.hi<0?new o(this.coshLo(t.hi),this.coshHi(t.lo)):0<=t.lo?new o(this.coshLo(t.lo),this.coshHi(t.hi)):new o(1,this.coshHi(-t.lo>t.hi?t.lo:t.hi))},tanh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new o(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 n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<e.lo},gt:function(t,e){return n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.lo>e.hi},leq:function(t,e){return n.A.isNumber(t)&&(t=this.Interval(t)),n.A.isNumber(e)&&(e=this.Interval(e)),!this.isEmpty(t)&&!this.isEmpty(e)&&t.hi<=e.lo},geq:function(t,e){return n.A.isNumber(t)&&(t=this.Interval(t)),n.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;0<e;)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;0<e;)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=a.hi(t),i=a.lo(t),t<e==0<t?i===this.UINT_MAX?(s+=1,i=0):i+=1:0===i?(i=this.UINT_MAX,--s):--i,a.pack(i,s))}},s.A.Math.IntervalArithmetic.PI=new o(r.A.IntervalArithmetic.piLow,r.A.IntervalArithmetic.piHigh),s.A.Math.IntervalArithmetic.PI_HALF=new o(r.A.IntervalArithmetic.piHalfLow,r.A.IntervalArithmetic.piHalfHigh),s.A.Math.IntervalArithmetic.PI_TWICE=new o(r.A.IntervalArithmetic.piTwiceLow,r.A.IntervalArithmetic.piTwiceHigh),s.A.Math.IntervalArithmetic.ZERO=new o(0),s.A.Math.IntervalArithmetic.ONE=new o(1),s.A.Math.IntervalArithmetic.WHOLE=(new o).setWhole(),s.A.Math.IntervalArithmetic.EMPTY=(new o).setEmpty(),e.A=s.A.Math.IntervalArithmetic},477:function(t,e,i){function s(e){var i,s;return e.memo||(i={},s=Array.prototype.join,e.memo=function(){var t=s.call(arguments);return i[t]!==o?i[t]:i[t]=e.apply(this,arguments)}),e.memo}var o,n=i(443),d=i(188);n.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),s=.5*s;return this.clamp(this.wrap(t,r-s,r+s),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){for(var i=this.matrix(t,e=e===o&&"number"!=typeof e?t:e),s=0;s<Math.min(t,e);s++)i[s][s]=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){t=i*Math.tan(t/2),e*=t;return this.frustum(-e,e,-t,t,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=s=0;r<n;r++)s+=t[i][r]*e[r];a[i]=s}return a},matMatMult:function(t,e){for(var i,s,r,o=t.length,n=0<o?e[0].length:0,a=e.length,l=this.matrix(o,n),h=0;h<o;h++)for(i=0;i<n;i++){for(r=s=0;r<a;r++)s+=t[h][r]*e[r][i];l[h][i]=s}return l},transpose:function(t){for(var e,i=t.length,s=0<t.length?t[0].length:0,r=this.matrix(s,i),o=0;o<s;o++)for(e=0;e<i;e++)r[o][e]=t[e][o];return r},inverse:function(t){for(var e,i,s,r,o,n,a=t.length,l=[],h=[],u=[],c=0;c<a;c++){for(l[c]=[],e=0;e<a;e++)l[c][e]=t[c][e];h[c]=c}for(e=0;e<a;e++){for(r=Math.abs(l[e][e]),c=(o=e)+1;c<a;c++)Math.abs(l[c][e])>r&&(r=Math.abs(l[c][e]),o=c);if(r<=this.eps)return[];if(e<o){for(i=0;i<a;i++)n=l[e][i],l[e][i]=l[o][i],l[o][i]=n;n=h[e],h[e]=h[o],h[o]=n}for(s=1/l[e][e],c=0;c<a;c++)l[c][e]*=s;for(l[e][e]=s,i=0;i<a;i++)if(i!==e){for(c=0;c<a;c++)c!==e&&(l[c][i]-=l[c][e]*l[e][i]);l[e][i]=-s*l[e][i]}}for(c=0;c<a;c++){for(i=0;i<a;i++)u[h[i]]=l[c][i];for(i=0;i<a;i++)l[c][i]=u[i]}return l},innerProduct:function(t,e,i){var s,r=0;for(i!==o&&d.A.isNumber(i)||(i=t.length),s=0;s<i;s++)r+=t[s]*e[s];return r},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,s=0;for(e!==o&&d.A.isNumber(e)||(e=t.length),i=0;i<e;i++)s+=t[i]*t[i];return Math.sqrt(s)},axpy:function(t,e,i){for(var s=e.length,r=[],o=0;o<s;o++)r[o]=t*e[o]+i[o];return r},factorial:s(function(t){return t<0?NaN:0===(t=Math.floor(t))||1===t?1:t*this.factorial(t-1)}),binomial:s(function(t,e){var i,s;if(t<e||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=i*(t-s)/(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(0<=t?.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:0<t?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):0<t?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&&d.A.isNumber(e)?Math.log(t)/Math.log(e):Math.log(t)},sign:Math.sign||function(t){return 0==(t=+t)||isNaN(t)?t:0<t?1:-1},squampow:function(t,e){var i;if(Math.floor(e)!==e)return this.pow(t,e);for(i=1,e<0&&(t=1/t,e*=-1);0!==e;)1&e&&(i*=t),e>>=1,t*=t;return i},gcd:function(t,e){var i;if(t=Math.abs(t),e=Math.abs(e),!d.A.isNumber(t)||!d.A.isNumber(e))return NaN;for(t<e&&(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 d.A.isNumber(t)&&d.A.isNumber(e)?0!=(i=t*e)?i/this.gcd(t,e):0:NaN},roundToStep:function(t,e,i,s){var r,o;if(!d.A.exists(e)&&!d.A.exists(i)&&!d.A.exists(s))return t;if(n.A.exists(s)&&(t=Math.min(t,s)),n.A.exists(i)&&(t=Math.max(t,i)),o=i||0,n.A.exists(e)){if(r=(t-o)/e,Number.isInteger(r))return t;t=o+Math.round(r)*e}return n.A.exists(s)&&(t=Math.min(t,s)),t=n.A.exists(i)?Math.max(t,i):t},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(){for(var t,e=arguments.length,i=0,s=0;i<e;i++)s+=(t=arguments[i])*t;return Math.sqrt(s)},hstep:function(t){return 0<t?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,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 e<t},geq:function(t,e){return e<=t},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,o,n,a,l,h,u,c=0;for(e=d.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),u=o=n=r=0,l=h=a=1;t-Math.floor(t)>e&&c<20;)t=1/(t-r),o=a+(r=Math.floor(t))*n,l=u+r*h,a=n,u=h,n=o,h=l,c++;return[s,i,o,l]},normalize:function(t){var e=2*t[3],i=t[4]/e;return t[5]=i,t[6]=-t[1]/e,t[7]=-t[2]/e,isFinite(i)?1<=Math.abs(i)?(t[0]=(t[6]*t[6]+t[7]*t[7]-i*i)/(2*i),t[1]=-t[6]/i,t[2]=-t[7]/i,t[3]=1/(2*i),t[4]=1):(t[0]=(e=i<=0?-1:1)*(t[6]*t[6]+t[7]*t[7]-i*i)*.5,t[1]=-e*t[6],t[2]=-e*t[7],t[3]=e/2,t[4]=e*i):(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=new("function"==typeof Float32Array?Float32Array:Array)(16);if(4!==t.length&&4!==t[0].length)return s;for(e=0;e<4;e++)for(i=0;i<4;i++)s[e+4*i]=t[e][i];return s},Vieta:function(t){for(var e,i,s=t.length,r=[],r=t.slice(),o=1;o<s;++o){for(i=r[o],r[o]*=r[o-1],e=o-1;1<=e;--e)r[e]+=r[e-1]*i;r[0]+=i}return r}},e.A=n.A.Math},171:function(t,e,i){var j=i(443),D=i(188),d=i(133),k=i(477),m={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]}};k.A.Numerics={Gauss:function(t,e){var i,s,r,o,n,a=k.A.eps,l=0<t.length?t[0].length:0;if(l!==e.length||l!==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(o=[],n=e.slice(0,l),i=0;i<l;i++)o[i]=t[i].slice(0,l);for(s=0;s<l;s++){for(i=l-1;s<i;i--)if(Math.abs(o[i][s])>a)if(Math.abs(o[s][s])<a)D.A.swap(o,i,s),D.A.swap(n,i,s);else for(o[i][s]/=o[s][s],n[i]-=o[i][s]*n[s],r=s+1;r<l;r++)o[i][r]-=o[i][s]*o[s][r];if(Math.abs(o[s][s])<a)throw new Error("JXG.Math.Numerics.Gauss(): The given matrix seems to be singular.")}return this.backwardSolve(o,n,!0),n},backwardSolve:function(t,e,i){for(var s,r=i?e:e.slice(0,e.length),i=t.length,o=0<t.length?t[0].length:0,n=i-1;0<=n;n--){for(s=o-1;n<s;s--)r[n]-=t[n][s]*r[s];r[n]/=t[n][n]}return r},gaussBareiss:function(t){var e,i,s,r,o,n,a,l,h,u=k.A.eps;if((a=t.length)<=0)return 0;for(t[0].length<a&&(a=t[0].length),l=[],r=0;r<a;r++)l[r]=t[r].slice(0,a);for(s=i=1,e=0;e<a-1;e++){if(n=l[e][e],Math.abs(n)<u){for(r=e+1;r<a&&!(Math.abs(l[r][e])>=u);r++);if(r===a)return 0;for(o=e;o<a;o++)h=l[r][o],l[r][o]=l[e][o],l[e][o]=h;s=-s,n=l[e][e]}for(r=e+1;r<a;r++)for(o=e+1;o<a;o++)h=n*l[r][o]-l[r][e]*l[e][o],l[r][o]=h/i;i=n}return s*l[a-1][a-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){for(var e,i,s,r,o,n,a,l,h=k.A.eps*k.A.eps,u=0,c=t.length,d=[[0,0,0],[0,0,0],[0,0,0]],p=[[0,0,0],[0,0,0],[0,0,0]],_=0,f=0;f<c;f++){for(e=0;e<c;e++)d[f][e]=0,p[f][e]=t[f][e],u+=Math.abs(p[f][e]);d[f][f]=1}if(1===c)return[p,d];if(u<=0)return[p,d];u/=c*c;do{for(l=a=0,e=1;e<c;e++)for(f=0;f<e;f++)if((s=Math.abs(p[f][e]))>l&&(l=s),a+=s,h<=s){for(s=.5*Math.atan2(2*p[f][e],p[f][f]-p[e][e]),r=Math.sin(s),o=Math.cos(s),i=0;i<c;i++)n=p[i][f],p[i][f]=o*n+r*p[i][e],p[i][e]=-r*n+o*p[i][e],n=d[i][f],d[i][f]=o*n+r*d[i][e],d[i][e]=-r*n+o*d[i][e];for(p[f][f]=o*p[f][f]+r*p[e][f],p[e][e]=-r*p[f][e]+o*p[e][e],i=p[f][e]=0;i<c;i++)p[f][i]=p[i][f],p[e][i]=p[i][e]}}while(_+=1,Math.abs(a)/u>h&&_<2e3);return[p,d]},NewtonCotes:function(t,e,i){var s,r,o,n=0,a=i&&D.A.isNumber(i.number_of_nodes)?i.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},l=i&&i.integration_type&&l.hasOwnProperty(i.integration_type)&&l[i.integration_type]?i.integration_type:"milne",h=(t[1]-t[0])/a;switch(l){case"trapez":for(n=.5*(e(t[0])+e(t[1])),s=t[0],r=0;r<a-1;r++)n+=e(s+=h);n*=h;break;case"simpson":if(0<a%2)throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(o=a/2,n=e(t[0])+e(t[1]),s=t[0],r=0;r<o-1;r++)n+=2*e(s+=2*h);for(s=t[0]-h,r=0;r<o;r++)n+=4*e(s+=2*h);n*=h/3;break;default:if(0<a%4)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(o=.25*a,n=7*(e(t[0])+e(t[1])),s=t[0],r=0;r<o-1;r++)n+=14*e(s+=4*h);for(s=t[0]-3*h,r=0;r<o;r++)n+=32*(e(s+=4*h)+e(s+2*h));for(s=t[0]-2*h,r=0;r<o;r++)n+=12*e(s+=4*h);n*=2*h/45}return n},Romberg:function(t,e,i){var s,r,o,n,a=[],l=0,h=1/0,u=i&&D.A.isNumber(i.max_iterations)?i.max_iterations:20,c=i&&D.A.isNumber(i.eps)?i.eps:i.eps||1e-7,d=t[0],p=(i=t[1])-d,_=1;for(a[0]=.5*p*(e(d)+e(i)),r=0;r<u;++r){for(s=0,p*=.5,_*=2,o=n=1;o<_;o+=2)s+=e(d+o*p);for(a[r+1]=.5*a[r]+s*p,l=a[r+1],o=r-1;0<=o;--o)n*=4,a[o]=a[o+1]+(a[o+1]-a[o])/(n-1),l=a[o];if(Math.abs(l-h)<c*Math.abs(l))break;h=l}return l},GaussLegendre:function(t,e,i){var s,r,o,n,a,l,h,u=0,c=[],d=[],i=i&&D.A.isNumber(i.n)?i.n:12;if(18<i&&(i=18),c[2]=[.5773502691896257],d[2]=[1],c[4]=[.33998104358485626,.8611363115940526],d[4]=[.6521451548625461,.34785484513745385],c[6]=[.2386191860831969,.6612093864662645,.932469514203152],d[6]=[.46791393457269104,.3607615730481386,.17132449237917036],c[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],d[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],c[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],d[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],c[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],d[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],c[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],d[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],c[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],d[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],c[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],d[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],c[3]=[0,.7745966692414834],d[3]=[.8888888888888888,.5555555555555556],c[5]=[0,.5384693101056831,.906179845938664],d[5]=[.5688888888888889,.47862867049936647,.23692688505618908],c[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],d[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],c[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],d[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],c[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],d[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],c[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],d[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],c[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],d[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],c[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],d[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],s=t[0],t=t[1],o=i+1>>1,l=c[i],h=d[i],a=.5*(t-s),n=.5*(t+s),!0&i)for(u=h[0]*e(n),r=1;r<o;++r)u+=h[r]*(e(n+a*l[r])+e(n-a*l[r]));else for(r=u=0;r<o;++r)u+=h[r]*(e(n+a*l[r])+e(n-a*l[r]));return a*u},_rescale_error:function(t,e,i){var s;return t=Math.abs(t),0!==i&&0!==t&&(t=(s=Math.pow(200*t/i,1.5))<1?i*s:i),t=20041683600089728e-310<e&&(s=11102230246251565e-30*e)>t?s:t},_gaussKronrod:function(t,e,i,s,r,o,n){var a,l,h,u,c,d,p,_,f,A,g=t[0],t=t[1],m=.5*(g+t),y=.5*(t-g),t=Math.abs(y),g=e(m),b=0,v=g*o[i-1],C=Math.abs(v),x=0,P=[],E=[];for(i%2==0&&(b=g*r[i/2-1]),a=Math.floor((i-1)/2),u=0;u<a;u++)f=(p=e(m-(d=y*s[c=2*u+1])))+(_=e(m+d)),P[c]=p,E[c]=_,b+=r[u]*f,v+=o[c]*f,C+=o[c]*(Math.abs(p)+Math.abs(_));for(a=Math.floor(i/2),u=0;u<a;u++)p=e(m-(d=y*s[A=2*u])),_=e(m+d),P[A]=p,E[A]=_,v+=o[A]*(p+_),C+=o[A]*(Math.abs(p)+Math.abs(_));for(h=.5*v,x=o[i-1]*Math.abs(g-h),u=0;u<i-1;u++)x+=o[u]*(Math.abs(P[u]-h)+Math.abs(E[u]-h));return g=(v-b)*y,l=v*=y,n.abserr=this._rescale_error(g,C*=t,x*=t),n.resabs=C,n.resasc=x,l},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,l=this.order[a];if(o<2)return this.order[0]=0,this.order[1]=1,void(this.i=l);for(t=this.elist[l];0<a&&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]=l,e=this.elist[o],s=r-1;i-2<s&&e>=this.elist[this.order[s]];)this.order[s+1]=this.order[s],s--;this.order[s+1]=o,l=this.order[a],this.i=l,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 l=this.i,h=this.size,u=this.level[this.i]+1;s<a?(this.alist[l]=r,this.rlist[l]=n,this.elist[l]=a,this.level[l]=u,this.alist[h]=t,this.blist[h]=e,this.rlist[h]=i,this.elist[h]=s):(this.blist[l]=e,this.rlist[l]=i,this.elist[l]=s,this.level[l]=u,this.alist[h]=r,this.blist[h]=o,this.rlist[h]=n,this.elist[h]=a),this.level[h]=u,this.size++,u>this.maximum_level&&(this.maximum_level=u),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(){for(var t=this.size,e=0,i=0;i<t;i++)e+=this.rlist[i];return e},subinterval_too_small:function(t,e,i){e=1.0000000000000222*(Math.abs(e)+22250738585072014e-321);return Math.abs(t)<=e&&Math.abs(i)<=e}}},Qag:function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m,y,b,v,C=this._workspace(t,1e3),x=i&&D.A.isNumber(i.limit)?i.limit:15,P=i&&D.A.isNumber(i.epsrel)?i.epsrel:1e-7,E=i&&D.A.isNumber(i.epsabs)?i.epsabs:1e-7,O=i&&D.A.isFunction(i.q)?i.q:this.GaussKronrod15,M={},w=0,S=0,T=0,N=0;if(x>C.limit&&j.A.warn("iteration limit exceeds available workspace"),E<=0&&(P<50*k.A.eps||P<5e-29)&&j.A.warn("tolerance cannot be acheived with given epsabs and epsrel"),i=O.apply(this,[t,e,M]),t=M.resabs,n=M.resasc,C.set_initial_result(i,o=M.abserr),a=Math.max(E,P*Math.abs(i)),o<=11102230246251565e-30*t&&a<o)return j.A.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(o<=a&&o!==n||0===o)return i;if(1===x)return j.A.warn("a maximum of one iteration was insufficient"),-1/0;for(s=i,r=o,w=1;0,u=(f=C.retrieve()).a,c=f.b,d=f.r,p=f.e,h=l=.5*((u=u)+c),c=c,A=O.apply(this,[[u,l],e,M]),y=M.abserr,_=M.resasc,g=O.apply(this,[[h,c],e,M]),r+=(v=y+(b=M.abserr))-p,s+=(m=A+g)-d,_!==y&&M.resasc!==b&&(Math.abs(d-m)<=1e-5*Math.abs(m)&&.99*p<=v&&S++,10<=w&&p<v&&T++),r>(a=Math.max(E,P*Math.abs(s)))&&((6<=S||20<=T)&&(N=2),C.subinterval_too_small(u,h,c)&&(N=3)),C.update(u,l,A,y,h,c,g,b),(f=C.retrieve()).a_i,f.b_i,d=f.r_i,p=f.e_i,++w<x&&!N&&a<r;);return C.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,r=0,o=k.A.eps,n=t.apply(i,[e]);for(D.A.isArray(e)&&(e=e[0]);r<50&&Math.abs(n)>o;)s=this.D(t,i)(e),Math.abs(s)>o?e-=n/s:e+=.2*Math.random()-1,n=t.apply(i,[e]),r+=1;return e},root:function(t,e,i){return this.chandrupatla(t,e,i)},generalizedNewton:function(t,e,i,s){for(var r,o,n,a,l,h,u,c=0,d=this.generalizedNewton.t1memo?(r=this.generalizedNewton.t1memo,this.generalizedNewton.t2memo):(r=i,s),p=(l=t.X(r)-e.X(d))*l+(h=t.Y(r)-e.Y(d))*h,_=this.D(t.X,t),f=this.D(e.X,e),A=this.D(t.Y,t),g=this.D(e.Y,e);p>k.A.eps&&c<10;)o=_(r),n=-f(d),a=A(r),r-=((u=-g(d))*l-n*h)/(u=o*u-n*a),d-=(o*h-a*l)/u,p=(l=t.X(r)-e.X(d))*l+(h=t.Y(r)-e.Y(d))*h,c+=1;return this.generalizedNewton.t1memo=r,this.generalizedNewton.t2memo=d,Math.abs(r)<Math.abs(d)?[t.X(r),t.Y(r)]:[e.X(d),e.Y(d)]},Neville:function(c){function t(u){return function(t,e){var i,s,r,o=k.A.binomial,n=c.length,a=n-1,l=0,h=0;if(!e)for(r=1,i=0;i<n;i++)d[i]=o(a,i)*r,r*=-1;for(s=t,i=0;i<n;i++){if(0===s)return c[i][u]();r=d[i]/s,--s,l+=c[i][u]()*r,h+=r}return l/h}}var d=[];return[t("X"),t("Y"),0,function(){return c.length-1}]},splineDef:function(t,e){var i,s,r,o=Math.min(t.length,e.length),n=[],a=[],l=[],h=[],u=[],c=[];if(2===o)return[0,0];for(s=0;s<o;s++)i={X:t[s],Y:e[s]},l.push(i);for(l.sort(function(t,e){return t.X-e.X}),s=0;s<o;s++)t[s]=l[s].X,e[s]=l[s].Y;for(s=0;s<o-1;s++)h.push(t[s+1]-t[s]);for(s=0;s<o-2;s++)u.push(6*(e[s+2]-e[s+1])/h[s+1]-6*(e[s+1]-e[s])/h[s]);for(n.push(2*(h[0]+h[1])),a.push(u[0]),s=0;s<o-3;s++)r=h[s+1]/n[s],n.push(2*(h[s+1]+h[s+2])-r*h[s+1]),a.push(u[s+1]-r*a[s]);for(c[o-3]=a[o-3]/n[o-3],s=o-4;0<=s;s--)c[s]=(a[s]-h[s+1]*c[s+1])/n[s];for(s=o-3;0<=s;s--)c[s+1]=c[s];return c[0]=0,c[o-1]=0,c},splineEval:function(t,e,i,s){var r,o,n,a,l,h,u,c=Math.min(e.length,i.length),d=1,p=!1,_=[];for(D.A.isArray(t)?(d=t.length,p=!0):t=[t],r=0;r<d;r++){if(t[r]<e[0]||e[r]>e[c-1])return NaN;for(o=1;o<c&&!(t[r]<=e[o]);o++);n=i[--o],a=(i[o+1]-i[o])/(e[o+1]-e[o])-(e[o+1]-e[o])/6*(s[o+1]+2*s[o]),l=s[o]/2,h=(s[o+1]-s[o])/(6*(e[o+1]-e[o])),u=t[r]-e[o],_.push(n+(a+(l+h*u)*u)*u)}return p?_:_[0]},generatePolynomialTerm:function(t,e,i,s){for(var r=[],o=e;0<=o;o--)D.A.concat(r,["(",t[o].toPrecision(s),")"]),1<o?D.A.concat(r,["*",i,"<sup>",o,"<","/sup> + "]):1===o&&D.A.concat(r,["*",i," + "]);return r.join("")},lagrangePolynomial:function(h){function t(t,e){var i,s,r,o,n=h.length,a=0,l=0;if(!e)for(i=0;i<n;i++){for(u[i]=1,r=h[i].X(),s=0;s<n;s++)s!==i&&(u[i]*=r-h[s].X());u[i]=1/u[i]}for(i=0;i<n;i++){if(t===(r=h[i].X()))return h[i].Y();l+=o=u[i]/(t-r),a+=o*h[i].Y()}return a/l}var u=[],s=this;return t.getTerm=function(t,e,i){return s.lagrangePolynomialTerm(h,t,e,i)()},t.getCoefficients=function(){return s.lagrangePolynomialCoefficients(h)()},t},lagrangePolynomialTerm:function(a,l,h,u){var c=this;return function(){var t,e,i,s,r,o=a.length,n=!0;for(h=h||"x",void 0===u&&(u=" * "),e=o-1,t=c.lagrangePolynomialCoefficients(a)(),i="",s=0;s<t.length;s++)r=t[s],Math.abs(r)<k.A.eps||(j.A.exists(l)&&(r=d.A._round10(r,-l)),n?(i+=0<r?r:"-"+-r,n=!1):i+=0<r?" + "+r:" - "+-r,1<e-s?i+=u+h+"^"+(e-s):e-s==1&&(i+=u+h));return i}},lagrangePolynomialCoefficients:function(l){return function(){for(var t,e,i,s,r=l.length,o=[],n=[],a=0;a<r;a++)n[a]=0;for(t=0;t<r;t++){for(e=l[t].Y(),i=l[t].X(),o=[],a=0;a<r;a++)a!==t&&(e/=i-l[a].X(),o.push(l[a].X()));for(s=[1].concat(k.A.Vieta(o)),a=0;a<s.length;a++)n[a]+=(a%2==1?-1:1)*s[a]*e}return n}},_initCubicPoly:function(t,e,i,s){return[t,i,-3*t+3*e-2*i-s,2*t-2*e+i+s]},CardinalSpline:function(l,t,h){var u,e,c,d=[],p=this,_=D.A.isFunction(t)?t:function(){return t};return void 0===h&&(h="uniform"),[(e=function(a){return function(t,e){var i,s,r,o,n;if(l.length<2)return NaN;if(!e)for(c=_(),n=(u=[{X:function(){return 2*l[0].X()-l[1].X()},Y:function(){return 2*l[0].Y()-l[1].Y()},Dist:function(t){var e=this.X()-t.X(),t=this.Y()-t.Y();return k.A.hypot(e,t)}}].concat(l,[{X:function(){return 2*l[l.length-1].X()-l[l.length-2].X()},Y:function(){return 2*l[l.length-1].Y()-l[l.length-2].Y()},Dist:function(t){var e=this.X()-t.X(),t=this.Y()-t.Y();return k.A.hypot(e,t)}}])).length,d[a]=[],i=0;i<n-3;i++)"centripetal"===h?(s=u[i].Dist(u[i+1]),r=u[i+2].Dist(u[i+1]),o=u[i+3].Dist(u[i+2]),s=Math.sqrt(s),r=Math.sqrt(r),o=Math.sqrt(o),r<k.A.eps&&(r=1),s<k.A.eps&&(s=r),o<k.A.eps&&(o=r),s=(u[i+1][a]()-u[i][a]())/s-(u[i+2][a]()-u[i][a]())/(r+s)+(u[i+2][a]()-u[i+1][a]())/r,o=(u[i+2][a]()-u[i+1][a]())/r-(u[i+3][a]()-u[i+1][a]())/(o+r)+(u[i+3][a]()-u[i+2][a]())/o,s*=r,o*=r,d[a][i]=p._initCubicPoly(u[i+1][a](),u[i+2][a](),c*s,c*o)):d[a][i]=p._initCubicPoly(u[i+1][a](),u[i+2][a](),c*(u[i+2][a]()-u[i][a]()),c*(u[i+3][a]()-u[i+1][a]()));return isNaN(t)?NaN:(n=l.length,t<=0?l[0][a]():n<=t?l[n-1][a]():(i=Math.floor(t))===t?l[i][a]():(t-=i,void 0===(e=d[a][i])?NaN:((e[3]*t+e[2])*t+e[1])*t+e[0]))}})("X"),e("Y"),0,function(){return l.length-1}]},CatmullRomSpline:function(t,e){return this.CardinalSpline(t,.5,e)},regressionPolynomial:function(t,u,c){var d,p,_,f,A,e,g="";if(D.A.isPoint(t)&&D.A.isFunction(t.Value))p=function(){return t.Value()};else if(D.A.isFunction(t))p=t;else{if(!D.A.isNumber(t))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof t+"'.");p=function(){return t}}if(3===arguments.length&&D.A.isArray(u)&&D.A.isArray(c))A=0;else if(2===arguments.length&&D.A.isArray(u)&&0<u.length&&D.A.isPoint(u[0]))A=1;else{if(!(2===arguments.length&&D.A.isArray(u)&&0<u.length&&u[0].usrCoords&&u[0].scrCoords))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");A=2}return(e=function(t,e){var i,s,r,o,n,a,l=u.length,h=Math.floor(p());if(!e){if(1===A)for(_=[],f=[],i=0;i<l;i++)_[i]=u[i].X(),f[i]=u[i].Y();if(2===A)for(_=[],f=[],i=0;i<l;i++)_[i]=u[i].usrCoords[1],f[i]=u[i].usrCoords[2];if(0===A)for(_=[],f=[],i=0;i<l;i++)D.A.isFunction(u[i])?_.push(u[i]()):_.push(u[i]),D.A.isFunction(c[i])?f.push(c[i]()):f.push(c[i]);for(r=[],s=0;s<l;s++)r.push([1]);for(i=1;i<=h;i++)for(s=0;s<l;s++)r[s][i]=r[s][i-1]*_[s];e=f,n=k.A.transpose(r),o=k.A.matMatMult(n,r),n=k.A.matVecMult(n,e),d=k.A.Numerics.Gauss(o,n),g=k.A.Numerics.generatePolynomialTerm(d,h,"x",3)}for(a=d[h],i=h-1;0<=i;i--)a=a*t+d[i];return a}).getTerm=function(){return g},e},bezier:function(n){function t(o){return function(t,e){var i=3*Math.floor(t),s=t%1,r=1-s;return e||(l=3*Math.floor((n.length-1)/3),a=Math.floor(l/3)),t<0?n[0][o]():a<=t?n[l][o]():isNaN(t)?NaN:r*r*(r*n[i][o]()+3*s*n[1+i][o]())+(3*r*n[2+i][o]()+s*n[3+i][o]())*s*s}}var a,l;return[t("X"),t("Y"),0,function(){return Math.floor(n.length/3)}]},bspline:function(u,c){function t(h){return function(t,e){var i,s,r,o,n=u.length,a=n-1,l=c;if(a<=0)return NaN;if(2+a<=l&&(l=1+a),t<=0)return u[0][h]();if(a-l+2<=t)return u[a][h]();for(r=Math.floor(t)+l-1,o=function(t,e,i,s){var r,o,n,a,l,h=[];for(e[s]<=t&&t<e[1+s]?h[s]=1:h[s]=0,r=2;r<=i;r++)for(o=s-r+1;o<=s;o++)n=o<=s-r+1||o<0?0:h[o],a=s<=o?0:h[o+1],l=e[o+r-1]-e[o],h[o]=0===l?0:(t-e[o])/l*n,0!=(l=e[o+r]-e[o+1])&&(h[o]+=(e[o+r]-t)/l*a);return h}(t,function(t,e){for(var i=[],s=0;s<t+e+1;s++)i[s]=s<e?0:s<=t?s-e+1:t-e+2;return i}(a,l),l,r),i=0,s=r-l+1;s<=r;s++)s<n&&0<=s&&(i+=u[s][h]()*o[s]);return i}}return[t("X"),t("Y"),0,function(){return u.length-1}]},D:function(i,s){return D.A.exists(s)?function(t,e){return(i.apply(s,[t+1e-5,e])-i.apply(s,[t-1e-5,e]))/2e-5}:function(t,e){return(i(t+1e-5,e)-i(t-1e-5,e))/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,r){var o,n,a,l,h,u,c,d,p,_,f,A,g,m=[],y=[],b=s,v=0,C=D.A.isArray(t)?(g=t[0],t[1]):t;if((e=Math.floor(e))<=0)return[m,y,v];for(n=(r-s)/e,o=0;o<e;o++){if("simpson"===i){for(v+=this._riemannValue(b,C,i,n)*n,f=.5*n,c=C(b),d=C(b+f),l=((p=C(b+2*f))+c-2*d)/(f*f)*.5,h=(p-c)/(2*f),u=d,a=0;a<30;a++)m.push(b+(_=a*n/30-f)+f),y.push(l*_*_+h*_+u);b+=n,A=p}else A=this._riemannValue(b,C,i,n),m.push(b),y.push(A),b+=n,"trapezoidal"===i?(v+=.5*(A+(p=C(b)))*n,A=p):v+=A*n,m.push(b),y.push(A);m.push(b),y.push(A)}for(o=0;o<e;o++){if("simpson"===i&&g){for(v-=this._riemannValue(b,g,i,-n)*n,f=.5*n,c=g(b),d=g(b-f),l=((p=g(b-2*f))+c-2*d)/(f*f)*.5,h=(p-c)/(2*f),u=d,a=0;a<30;a++)m.push(b-(_=a*n/30-f)-f),y.push(l*_*_+h*_+u);b-=n,A=p}else A=g?this._riemannValue(b,g,i,-n):0,m.push(b),y.push(A),b-=n,g&&("trapezoidal"===i?(v-=.5*(A+(p=g(b)))*n,A=p):v-=A*n);m.push(b),y.push(A),m.push(b),y.push(C(b))}return[m,y,v]},riemannsum:function(t,e,i,s,r){return j.A.deprecated("Numerics.riemannsum()","Numerics.riemann()[2]"),this.riemann(t,e,i,s,r)[2]},rungeKutta:function(t,e,i,s,r){for(var o,n,a,l,h=[],u=[],c=(i[1]-i[0])/s,d=i[0],p=e.length,_=[],f=0,A=(t=D.A.isString(t)?m[t]||m.euler:t).s,h=e.slice(),g=0;g<=s;g++){for(_[f]=h.slice(),f++,a=[],n=0;n<A;n++){for(o=0;o<p;o++)u[o]=0;for(l=0;l<n;l++)for(o=0;o<p;o++)u[o]+=t.A[n][l]*c*a[l][o];for(o=0;o<p;o++)u[o]+=h[o];a.push(r(d+t.c[n]*c,u))}for(o=0;o<p;o++)u[o]=0;for(l=0;l<A;l++)for(o=0;o<p;o++)u[o]+=t.b[l]*a[l][o];for(o=0;o<p;o++)h[o]=h[o]+c*u[o];d+=c}return _},maxIterationsRoot:80,maxIterationsMinimize:500,findBracket:function(t,e,i){var s,r,o,n,a,l,h;if(D.A.isArray(e))return e;for(s=t.call(i,e=e),h=(r=[e-.1*(a=0===e?1:e),e+.1*a,e-1,e+1,e-.5*a,e+.5*a,e-.6*a,e+.6*a,e-+a,e+ +a,e-2*a,e+2*a,e-5*a,e+5*a,e-10*a,e+10*a,e-50*a,e+50*a,e-100*a,e+100*a]).length,l=0;l<h&&!(s*(n=t.call(i,o=r[l]))<=0);l++);return o<e&&(a=e,e=o,o=a,a=s,s=n,n=a),[e,s,o,n]},fzero:function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m=k.A.eps,y=this.maxIterationsRoot,b=0;if(D.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=(h=this.findDomain(t,e,i))[0],r=h[1],n=t.call(i,s),a=t.call(i,r)}else s=(h=this.findBracket(t,e,i))[0],n=h[1],r=h[2],a=h[3];if(Math.abs(n)<=m)return s;if(Math.abs(a)<=m)return r;if(0<n*a)return D.A.isArray(e)?this.fminbr(t,[s,r],i):this.Newton(t,s,i);for(o=s,l=n;b<y;){if(u=r-s,Math.abs(l)<Math.abs(a)&&(s=r,r=o,o=s,n=a,a=l,l=n),_=2*m*Math.abs(r)+.5*m,g=.5*(o-r),Math.abs(g)<=_||Math.abs(a)<=m)return r;Math.abs(u)>=_&&Math.abs(n)>Math.abs(a)&&(p=o-r,A=s===o?(f=p*(c=a/n),1-c):(f=(d=a/n)*(p*(A=n/l)*(A-(c=a/l))-(r-s)*(c-1)),(A-1)*(c-1)*(d-1)),0<f?A=-A:f=-f,f<.75*p*A-.5*Math.abs(_*A)&&f<Math.abs(u*A*.5)&&(g=f/A)),s=r,n=a,r+=g=Math.abs(g)<_?0<g?_:-_:g,(0<(a=t.call(i,r))&&0<l||a<0&&l<0)&&(o=s,l=n),b++}return r},chandrupatla:function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m,y=0,b=this.maxIterationsRoot,v=1+.001*Math.random(),C=.5*v,x=k.A.eps;if(D.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],o=t.call(i,s),r=e[1],n=t.call(i,r)}else s=(a=this.findBracket(t,e,i))[0],o=a[1],r=a[2],n=a[3];if(0<o*n)return D.A.isArray(e)?this.fminbr(t,[s,r],i):this.Newton(t,s,i);for(l=s,h=r,c=o,d=n;f=t.call(i,m=l+C*(h-l)),Math.sign(f)===Math.sign(c)?(u=l,l=m,p=c,c=f):(u=h,h=l,p=d,d=c),_=l=m,m=c=f,Math.abs(d)<Math.abs(c)&&(_=h,m=d),!(.5<(f=(2*x*Math.abs(_)+5e-6)/Math.abs(h-l))||0===m)&&(m=(l-h)/(u-h),A=(c-d)/(p-d),g=1-Math.sqrt(1-m),m=Math.sqrt(m),1-f<(C=(C=g<A&&A<m?c/(d-c)*(p/(d-p))+c/(p-c)*(d/(p-d))*((u-l)/(h-l)):.5*v)<f?f:C)&&(C=1-f),++y<=b););return _},findDomain:function(t,e,i){var s,r,o,n,a,l=.3819660112501453;if(!D.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.findDomain: length of array x0 has to be at least two.");if(s=(e=e.slice())[0],r=e[1],n=t.call(i,s),isNaN(n)){for(a=0;.001<r-s&&a<20;)n=t.call(i,o=(r-s)*l+s),isNaN(n)?s=o:r=o,a++;e[0]=s}if(s=e[0],r=e[1],n=t.call(i,r),isNaN(n)){for(a=0;.001<r-s&&a<20;)n=t.call(i,o=r-(r-s)*l),isNaN(n)?r=o:s=o,a++;e[0]=r}return e},fminbr:function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f,A=.5*(3-Math.sqrt(5)),g=k.A.eps,m=k.A.eps,y=this.maxIterationsMinimize,b=0;if(!D.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(o=n=(s=(e=this.findDomain(t,e,i))[0])+A*((r=e[1])-s),a=n,l=h=t.call(i,n),u=h;b<y;){if(d=r-s,p=.5*(s+r),c=m*Math.abs(o)+g/3,Math.abs(o-p)+.5*d<=2*c)return o;d=A*(o<p?r-o:s-o),Math.abs(o-a)>=c&&(f=(o-n)*(p=(o-n)*(l-u))-(o-a)*(_=(o-a)*(l-h)),0<(p=2*(p-_))?f=-f:p=-p,Math.abs(f)<Math.abs(d*p)&&p*(s-o+2*c)<f&&f<p*(r-o-2*c)&&(d=f/p)),Math.abs(d)<c&&(d=0<d?c:-c),(f=t.call(i,_=o+d))<=l?(_<o?r=o:s=o,n=a,a=o,o=_,h=u,u=l,l=f):(_<o?s=_:r=_,f<=u||a===o?(n=a,a=_,h=u,u=f):(f<=h||n===o||n===a)&&(n=_,h=f)),b+=1}return o},glomin:function(t,e){var i,s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m,y,b,v,C=k.A.eps,x=k.A.eps*k.A.eps,P=k.A.eps*k.A.eps*k.A.eps,E=e[0],O=e[1],e=t(E)<t(O)?E:O,M=i=O,w=E,S=f=t(O);if(f<(_=g=t(E))?_=f:M=E,O<=E)return _;for(l=.5*(1+16*P)*1e7,a=3,r=w-(p=e<=E||O<=e?.5*(E+O):e),n=9/11,(A=t(p))<_&&(M=p,_=A);;){if(o=p-i,v=O-w,h=c=(d=w-i)*d*(y=g-A)-r*r*(b=g-f),u=b=2*(r*b-d*y),a<1e6||g<=_)for(;u*(c*(S-g)+v*u*(g-_+C))<v*l*c*(v*u-c)&&(m=t(s=w+c/u))<_&&(M=s,_=m),u=1,!(v<=(c=1e-5*(O-E)*(a=1611*a%1048576))););else for(u=1,c=1e-5*(O-E)*(a=1611*a%1048576);c<v;)u*(c*(S-g)+v*u*(g-_+C))<v*l*c*(v*u-c)&&(m=t(s=w+c/u))<_&&(M=s,_=m),u=1,c=1e-5*(O-E)*(a=1611*a%1048576);for(h=(n=.5*(1+n))*(h+2*(c=l*r*d*o)*(d=Math.sqrt((g-_+C)/l))),c=(c=-.5*(r+(y+2.01*x)/(r*l)))<d||r<0?w+d:w+c,s=0<h*(u+=.5*b)?w+h/u:c;(m=O<=(s=Math.max(s,c))?(s=O,S):t(s))<_&&(M=s,_=m),r=s-w,!(s<=c||(h=2*(g-m)/(1e7*r),(1+9*P)*r<=Math.abs(h))||.5*l*(r*r+h*h)<=g-_+(m-_)+2*C);)s=.5*(w+s),n*=.9;if(O<=s)break;i=p,p=w,w=s,f=A,A=g,g=m}return[M,_]},polzeros:function(t,e,i,s,r){function h(t,e,i){var s,r,o=t.length-1;if(i=i||!1)for(r=j.A.C.mult(o,t[o]),s=o-1;0<s;s--)r.mult(e),r.add(j.A.C.mult(t[s],s));else for(r=j.A.C.copy(t[o]),s=o-1;0<=s;s--)r.mult(e),r.add(t[s]);return r}function o(t,e,i){var s,r,o=t.length-1;if(i=i||!1)for(r=j.A.C.mult(o,t[0]),s=o-1;0<s;s--)r.mult(e),r.add(j.A.C.mult(t[o-s],s));else for(r=j.A.C.copy(t[0]),s=o-1;0<=s;s--)r.mult(e),r.add(t[o-s]);return r}var n,a,l,u=[],c=[],d=[];for(i=i||Number.EPSILON,s=s||30,a=t.length,j.A.isNumber(e)&&0<=e&&e<a-1&&(a=e+1),n=0;n<a;n++)u.push(new j.A.Complex(t[n]));for(n=0;n<a;n++)if(0!==u[n].real||0!==u[n].imaginary){l=n;break}for(n=0;n<l;n++)c.push(new j.A.Complex(0));for(n=(a=(u=u.slice(l)).length)-1;0<=n&&0===u[n].real&&0===u[n].imaginary;n--)u.pop();if(0===(a=u.length))return[];if(r)for(n=0;n<a-1;n++)d.push(new j.A.Complex(r[n]));else d=function(t){var e,i,s,r,o=t.length-1,n=2*Math.PI/o,a=Math.PI/o*.5,l=[];for((s=j.A.C.mult(-1,t[o-1])).div(j.A.C.mult(o,t[o])),r=j.A.C.div(h(t,s),t[o]),0===(i=Math.pow(j.A.C.abs(r),1/o))&&(i=1),e=0;e<o;e++)t=new j.A.Complex(i*Math.cos(n*e+a),i*Math.sin(n*e+a)),l[e]=j.A.C.add(s,t);return l}(u);for(var p,_,f,A,g,m,y,b=u,v=i,C=s,x=d,P=[],E=[],O=0,M=x.length,w=0;w<M;w++)P.push(!1);for(w=0;w<b.length;w++)E.push(j.A.C.abs(b[w])*(4*w+1));for(p=0;p<C&&O<M;p++)for(w=0;w<M;w++)if(!P[w])if(A=h(b,x[w]),f=j.A.C.abs(x[w]),j.A.C.abs(A)<v*function(t,e){for(var i=t.length-1,s=t[i],r=i-1;0<=r;r--)s=s*e+t[r];return s}(E,f)){if(P[w]=!0,++O===M)break}else{for(1<f?(f=j.A.C.div(1,x[w]),(y=o(b,f,!0)).div(o(b,f)),y.mult(f),A=j.A.C.sub(M,y),A=j.A.C.div(x[w],A)):A.div(h(b,x[w],!0)),g=new j.A.Complex(0),_=0;_<M;_++)_!==w&&(m=j.A.C.sub(x[w],x[_]),m=j.A.C.div(1,m),g.add(m));g.mult(A),g=j.A.C.sub(1,g),A.div(g),x[w].sub(A)}return(d=c.concat(d)).sort(function(t,e){return t.real<e.real?-1:t.real>e.real?1:0}),d},RamerDouglasPeucker:function(t,e){for(var i,s=[],r=[],a=function(t,e,i,s,r){var o=function(t,e,i){var s,r,o,n,a,l,h,u,c,d=k.A.eps*k.A.eps,p=1e4,_=0,f=e;if(i-e<2)return[-1,0];if(r=t[e].scrCoords,o=t[i].scrCoords,isNaN(r[1])||isNaN(r[2]))return[NaN,e];if(isNaN(o[1])||isNaN(o[2]))return[NaN,i];for(s=e+1;s<i;s++){if(a=t[s].scrCoords,isNaN(a[1])||isNaN(a[2]))return[NaN,s];n=(n=(n=a[1]-r[1])==1/0?p:n)===-1/0?-p:n,a=(a=(a=a[2]-r[2])==1/0?p:a)===-1/0?-p:a,_<(u=(u=(l=(l=(l=o[1]-r[1])==1/0?p:l)===-1/0?-p:l)*l+(h=(h=(h=o[2]-r[2])==1/0?p:h)===-1/0?-p:h)*h)>d?((c=(n*l+a*h)/u)<0?c=0:1<c&&(c=1),(n-=c*l)*n+(a-=c*h)*a):(c=0,n*n+a*a))&&(_=u,f=s)}return[Math.sqrt(_),f]}(t,e,i),n=o[1];if(isNaN(o[0])){for(a(t,e,n-1,s,r),r.push(t[n]);++n<=i&&isNaN(t[n].scrCoords[1]+t[n].scrCoords[2]););n<=i&&r.push(t[n]),a(t,n+1,i,s,r)}else o[0]>s?(a(t,e,n,s,r),a(t,n,i,s,r)):r.push(t[i])},o=t.length,n=0;;){for(;n<o&&isNaN(t[n].scrCoords[1]+t[n].scrCoords[2]);)n+=1;for(i=n+1;i<o&&!isNaN(t[i].scrCoords[1]+t[i].scrCoords[2]);)i+=1;if(i--,n<o&&n<i&&((r=[])[0]=t[n],a(t,n,i,e,r),s=s.concat(r)),o<=n)break;i<o-1&&s.push(t[i+1]),n=i+1}return s},RamerDouglasPeuker:function(t,e){return j.A.deprecated("Numerics.RamerDouglasPeuker()","Numerics.RamerDouglasPeucker()"),this.RamerDouglasPeucker(t,e)},Visvalingam:function(t,e){var i,s,r,o,n,a,l,h,u=[],c=[],d=[];if((s=t.length)<=2)return t;for(u[0]={used:!0,lft:null,node:null},n=0,i=1;i<s-1;i++)r=Math.abs(j.A.Math.Numerics.det([t[i-1].usrCoords,t[i].usrCoords,t[i+1].usrCoords])),isNaN(r)||(c.push(h={v:r,idx:i}),u[i]={used:!0,lft:n,node:h},n=u[n].rt=i);for(u[s-1]={used:!0,rt:null,lft:n,node:null},u[n].rt=s-1,0;c.length>e;)c.sort(function(t,e){return e.v-t.v}),u[i=c.pop().idx].used=!1,o=u[i].node.v,n=u[i].lft,a=u[i].rt,u[n].rt=a,u[a].lft=n,null!==(l=u[n].lft)&&(r=Math.abs(j.A.Math.Numerics.det([t[l].usrCoords,t[n].usrCoords,t[a].usrCoords])),u[n].node.v=o<=r?r:o),null!==(l=u[a].rt)&&(r=Math.abs(j.A.Math.Numerics.det([t[n].usrCoords,t[a].usrCoords,t[l].usrCoords])),u[a].node.v=o<=r?r:o);for(d=[t[i=0]];i=u[i].rt,d.push(t[i]),null!==u[i].rt;);return d}},e.A=k.A.Numerics},588:function(t,e,i){var p=i(443),a=i(477),l=i(188);a.A.Statistics={sum:function(t){for(var e=t.length,i=0,s=0;s<e;s++)i+=t[s];return i},prod:function(t){for(var e=t.length,i=1,s=0;s<e;s++)i*=t[s];return i},mean:function(t){return 0<t.length?this.sum(t)/t.length:0},median:function(t){var e;return 0<t.length?(ArrayBuffer.isView(t)?(e=new Float64Array(t)).sort():(e=t.slice(0)).sort(function(t,e){return t-e}),1&(t=e.length)?e[parseInt(.5*t,10)]:.5*(e[.5*t-1]+e[.5*t])):0},percentile:function(t,e){var i,s,r,o,n,a=[];if(0<t.length){for(ArrayBuffer.isView(t)?(i=new Float64Array(t)).sort():(i=t.slice(0)).sort(function(t,e){return t-e}),s=i.length,o=l.A.isArray(e)?e:[e],r=0;r<o.length;r++)n=s*o[r]*.01,parseInt(n,10)===n?a.push(.5*(i[n-1]+i[n])):a.push(i[parseInt(n,10)]);return l.A.isArray(e)?a:a[0]}return 0},variance:function(t){var e,i,s,r=t.length;if(1<r){for(e=this.mean(t),s=i=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 0<t.length?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(l.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=l.A.evalSlider(t),e=l.A.evalSlider(e),l.A.isArray(t)&&l.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]+e;else if(l.A.isNumber(t)&&l.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t+e[i];else if(l.A.isArray(t)&&l.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=l.A.evalSlider(t),e=l.A.evalSlider(e),l.A.isArray(t)&&l.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]/e;else if(l.A.isNumber(t)&&l.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t/e[i];else if(l.A.isArray(t)&&l.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(){p.A.deprecated("Statistics.divide()","Statistics.div()"),a.A.Statistics.div.apply(a.A.Statistics,arguments)},mod:function(t,e,i){var s,r,o=[],n=function(t,e){return t%e};if((i=l.A.def(i,!1))&&(n=a.A.mod),t=l.A.evalSlider(t),e=l.A.evalSlider(e),l.A.isArray(t)&&l.A.isNumber(e))for(r=t.length,s=0;s<r;s++)o[s]=n(t[s],e);else if(l.A.isNumber(t)&&l.A.isArray(e))for(r=e.length,s=0;s<r;s++)o[s]=n(t,e[s]);else if(l.A.isArray(t)&&l.A.isArray(e))for(r=Math.min(t.length,e.length),s=0;s<r;s++)o[s]=n(t[s],e[s]);else o=n(t,e);return o},multiply:function(t,e){var i,s,r=[];if(t=l.A.evalSlider(t),e=l.A.evalSlider(e),l.A.isArray(t)&&l.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]*e;else if(l.A.isNumber(t)&&l.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t*e[i];else if(l.A.isArray(t)&&l.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=l.A.evalSlider(t),e=l.A.evalSlider(e),l.A.isArray(t)&&l.A.isNumber(e))for(s=t.length,i=0;i<s;i++)r[i]=t[i]-e;else if(l.A.isNumber(t)&&l.A.isArray(e))for(s=e.length,i=0;i<s;i++)r[i]=t-e[i];else if(l.A.isArray(t)&&l.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){for(var e,i=[],s=[],r=[],o=0;o<t.length;o++){for(e=s.length=0;e<t.length;e++)Math.abs(t[e].usrCoords[1]-t[o].usrCoords[1])>a.A.eps&&(s[e]=(t[e].usrCoords[2]-t[o].usrCoords[2])/(t[e].usrCoords[1]-t[o].usrCoords[1]));i[o]=this.median(s),r.push(t[o].usrCoords[2]-i[o]*t[o].usrCoords[1])}return[this.median(r),this.median(i),-1]},generateGaussian:function(t,e){var i,s,r;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+t;for(;1<=(r=(i=2*Math.random()-1)*i+(s=2*Math.random()-1)*s)||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;for(;0===(e=Math.random()););return-Math.log(e)/t},randomGamma:function(t,e,i){var s,r,o,n,a;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{for(s=Math.random();0===(r=Math.random()););}while((s<a?(o=Math.pow(r,1/t),Math.exp(-o)):(o=1-Math.log(r),Math.pow(o,t-1)))<=Math.random());return e*o+i}for(;n=Math.tan(Math.PI*Math.random()),0<(o=Math.sqrt(2*t-1)*n+t-1)&&(r=Math.random()),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){return t<=0||e<=0?NaN:(t=this.randomGamma(t))/(t+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||1<e||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(.5<e)return t-this.randomBinomial(t,1-e);if(t<100){if(i=-1,(s=0)===(r=Math.log(1-e)))return 0;for(;i+=1,(s+=Math.floor(Math.log(Math.random())/r)+1)<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||1<t?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){for(;r+=1,s<(o*=Math.random()););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=t+e-i,n=Math.min(t,e),a=n;if(t<1||e<1||t+e<i)return NaN;for(s=i;0<a*s;)r=Math.random(),a-=Math.floor(r+a/(o+s)),--s;return n=n-a,t<=e?n:i-n},histogram:function(t,e){for(var i,s,r,o,n=[],a=[],l=0,h=e.bins||10,u=!1===(u=e.range||!1)?(r=Math.min.apply(null,t),Math.max.apply(null,t)):(r=u[0],u[1]),c=0<h?(u-r)/(h-1):0,d=0;d<h;d++)n.push(0),a.push(r+d*c);for(i=t.length,d=0;d<i;d++)0<=(s=Math.floor((t[d]-r)/c))&&s<h?n[s]+=1:l+=1;if(e.density)for(o=p.A.Math.Statistics.sum(n)+l,d=0;d<h;d++)n[d]/=o*c;if(e.cumulative){if(e.density)for(d=0;d<h;d++)n[d]*=c;for(d=1;d<h;d++)n[d]+=n[d-1]}return[n,a]}},e.A=a.A.Statistics},378:function(t,e,i){var l=i(443),a=i(561),h=i(477),s=i(873),u=i(188);l.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,ticks:{label:{visible:"inherit",anchorX:"middle",anchorY:"top",fontSize:12,offset:[0,-3]},tickEndings:[0,1],majorTickEndings:[1,1],drawZero:!1,needsRegularUpdate:!1,visible:"inherit"}},y:{name:"y",fixed:!0,ticks:{label:{visible:"inherit",anchorX:"right",anchorY:"middle",fontSize:12,offset:[-6,0]},tickEndings:[1,0],majorTickEndings:[1,1],drawZero:!1,needsRegularUpdate:!1,visible:"inherit"}}},description:"",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,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",viewport:[0,0,0,0],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:{dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,fillColor:s.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:s.A.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:0,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,viewport:"inherit",withLabel:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{},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},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:s.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:s.A.palette.orange,highlightFillColor:s.A.palette.orange,strokeColor:s.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:s.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:s.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]}},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:s.A.palette.blue,fillColor:s.A.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:s.A.palette.blue,highlightFillColor:s.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:s.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:s.A.palette.red,strokeColor:s.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:s.A.palette.red,strokeColor:s.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:s.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:s.A.palette.red,strokeColor:s.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:s.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:s.A.palette.yellow,highlightFillColor:s.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:s.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:s.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:s.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:[]},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:h.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},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:s.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:s.A.palette.red,strokeColor:s.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:s.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]},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:s.A.palette.red,fillOpacity:.3,highlightFillColor:s.A.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:s.A.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:s.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,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"],rowHeight:20,strokeWidth:5},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:s.A.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:s.A.palette.red,strokeColor:s.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:s.A.palette.red,strokeColor:s.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:{},dim:null,showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatPrefix:function(t){return t},formatSuffix:function(t){return t},formatCoords:function(t,e,i){return 1!==parseFloat(i)?"(NaN | NaN)":"("+t+", "+e+")"},formatDirection:function(t,e){return"("+t+", "+e+")"}},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:s.A.palette.red,strokeColor:s.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:s.A.palette.yellow,highlightFillColor:s.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:s.A.palette.red,fillColor:s.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:s.A.palette.yellow,highlightFillColor:s.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:s.A.palette.red,fillColor:s.A.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:s.A.palette.yellow},sector:{fillColor:s.A.palette.yellow,highlightFillColor:s.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,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:s.A.palette.red,strokeColor:s.A.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:s.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,name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,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:s.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:.125*Math.PI}},slopetriangle:{fillColor:s.A.palette.red,fillOpacity:.4,highlightFillColor:s.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:s.A.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:s.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"]}},l.A.Validator=function(){function t(t){return u.A.isString(t)}function e(t){return Math.abs(t-Math.round(t))<h.A.eps}function i(t){return e(t)&&0<t}function s(t){return 0<t}function r(t){return 0<=t}var o,n={},a={attractorDistance:r,color:t,display:function(t){return"html"===t||"internal"===t},doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:function(t){return u.A.exists(l.A.normalizePointFace(t))},factor:u.A.isNumber,fillColor:t,fillOpacity:u.A.isNumber,firstArrow:!1,fontSize:e,dash:e,gridX:u.A.isNumber,gridY:u.A.isNumber,hasGrid:!1,highlightFillColor:t,highlightFillOpacity:u.A.isNumber,highlightStrokeColor:t,highlightStrokeOpacity:u.A.isNumber,insertTicks:!1,lastArrow:!1,layer:function(t){return e(t)&&0<=t},majorHeight:e,minorHeight:e,minorTicks:r,minTicksDistance:i,numberPointsHigh:i,numberPointsLow:i,opacity:u.A.isNumber,radius:u.A.isNumber,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:r,snapSizeX:s,snapSizeY:s,snapWidth:u.A.isNumber,snapToGrid:!1,snatchDistance:r,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:t,strokeOpacity:u.A.isNumber,strokeWidth:r,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(o in a)a.hasOwnProperty(o)&&(n[o.toLowerCase()]=a[o]);return n}(),l.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]},l.A.useStandardOptions=function(t){var e,i,s,r,o=l.A.Options,n=t.hasGrid;for(e in t.options.grid.hasGrid=o.grid.hasGrid,t.options.grid.gridX=o.grid.gridX,t.options.grid.gridY=o.grid.gridY,t.options.grid.gridColor=o.grid.gridColor,t.options.grid.gridOpacity=o.grid.gridOpacity,t.options.grid.gridDash=o.grid.gridDash,t.options.grid.snapToGrid=o.grid.snapToGrid,t.options.grid.snapSizeX=o.grid.SnapSizeX,t.options.grid.snapSizeY=o.grid.SnapSizeY,t.takeSizeFromFile=o.takeSizeFromFile,r=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((s=t.objects[e]).elementClass===a.A.OBJECT_CLASS_POINT)r(s,o.point);else if(s.elementClass===a.A.OBJECT_CLASS_LINE)for(r(s,o.line),i=0;i<s.ticks.length;i++)s.ticks[i].majorTicks=o.line.ticks.majorTicks,s.ticks[i].minTicksDistance=o.line.ticks.minTicksDistance,s.ticks[i].visProp.minorheight=o.line.ticks.minorHeight,s.ticks[i].visProp.majorheight=o.line.ticks.majorHeight;else s.elementClass===a.A.OBJECT_CLASS_CIRCLE?r(s,o.circle):s.type===a.A.OBJECT_TYPE_ANGLE?r(s,o.angle):s.type===a.A.OBJECT_TYPE_ARC?r(s,o.arc):s.type===a.A.OBJECT_TYPE_POLYGON?r(s,o.polygon):s.type===a.A.OBJECT_TYPE_CONIC?r(s,o.conic):s.type===a.A.OBJECT_TYPE_CURVE?r(s,o.curve):s.type===a.A.OBJECT_TYPE_SECTOR&&(s.arc.visProp.fillcolor=o.sector.fillColor,s.arc.visProp.highlightfillcolor=o.sector.highlightFillColor,s.arc.visProp.fillopacity=o.sector.fillOpacity,s.arc.visProp.highlightfillopacity=o.sector.highlightFillOpacity);t.fullUpdate(),n&&!t.hasGrid?t.removeGrids(t):!n&&t.hasGrid&&t.create("grid",[])},l.A.useBlackWhiteOptions=function(t){var e=l.A.Options;e.point.fillColor=s.A.rgb2bw(e.point.fillColor),e.point.highlightFillColor=s.A.rgb2bw(e.point.highlightFillColor),e.point.strokeColor=s.A.rgb2bw(e.point.strokeColor),e.point.highlightStrokeColor=s.A.rgb2bw(e.point.highlightStrokeColor),e.line.fillColor=s.A.rgb2bw(e.line.fillColor),e.line.highlightFillColor=s.A.rgb2bw(e.line.highlightFillColor),e.line.strokeColor=s.A.rgb2bw(e.line.strokeColor),e.line.highlightStrokeColor=s.A.rgb2bw(e.line.highlightStrokeColor),e.circle.fillColor=s.A.rgb2bw(e.circle.fillColor),e.circle.highlightFillColor=s.A.rgb2bw(e.circle.highlightFillColor),e.circle.strokeColor=s.A.rgb2bw(e.circle.strokeColor),e.circle.highlightStrokeColor=s.A.rgb2bw(e.circle.highlightStrokeColor),e.arc.fillColor=s.A.rgb2bw(e.arc.fillColor),e.arc.highlightFillColor=s.A.rgb2bw(e.arc.highlightFillColor),e.arc.strokeColor=s.A.rgb2bw(e.arc.strokeColor),e.arc.highlightStrokeColor=s.A.rgb2bw(e.arc.highlightStrokeColor),e.polygon.fillColor=s.A.rgb2bw(e.polygon.fillColor),e.polygon.highlightFillColor=s.A.rgb2bw(e.polygon.highlightFillColor),e.sector.fillColor=s.A.rgb2bw(e.sector.fillColor),e.sector.highlightFillColor=s.A.rgb2bw(e.sector.highlightFillColor),e.curve.strokeColor=s.A.rgb2bw(e.curve.strokeColor),e.grid.gridColor=s.A.rgb2bw(e.grid.gridColor),l.A.useStandardOptions(t)},l.A.Options.normalizePointFace=l.A.normalizePointFace,e.A=l.A.Options},86:function(t,e,i){var s=i(443),n=i(561),a=i(188);s.A.GeonextParser={replacePow:function(t){for(var e,i,s,r,o,n,a,l,h,u,c=(t=t.replace(/(\s*)\^(\s*)/g,"^")).indexOf("^"),d=-1;0<=c&&c<t.length-1;){if(d===c)throw new Error("JSXGraph: Error while parsing expression '"+t+"'");if(d=c,l=t.slice(0,c),h=t.slice(c+1),")"===l.charAt(l.length-1)){for(e=1,i=l.length-2;0<=i&&0<e;)")"===(s=l.charAt(i))?e++:"("===s&&--e,--i;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(r="",n=l.substring(0,i+1),a=i;0<=a&&n.slice(a,a+1).match(/([\w.]+)/);)r=RegExp.$1+r,--a;r=(r+=l.substring(i+1,l.length)).replace(/([()+*%^\-/\][])/g,"\\$1")}else r="[\\w\\.]+";if(h.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i<h.length&&0<e;)")"===(s=h.charAt(i))?--e:"("===s&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");o=(o=h.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1")}else o="[\\w\\.]+";u=new RegExp("("+r+")\\^("+o+")"),c=(t=t.replace(u,"pow($1,$2)")).indexOf("^")}return t},replaceIf:function(t){var e,i,s,r,o,n,a,l,h,u,c,d="";if((s=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");0<=s;){for(e=t.slice(0,s),i=t.slice(s+3),r=0,a=n=-(o=1);r<i.length&&0<o;)")"===(l=i.charAt(r))?--o:"("===l?o+=1:","===l&&1===o&&(n<0?n=r:a=r),r+=1;if(c=i.slice(0,r-1),i=i.slice(r),n<0)return"";if(a<0)return"";h=c.slice(0,n),u=c.slice(n+1,a),c=c.slice(a+1),d+=e+"(("+this.replaceIf(h)+")?("+this.replaceIf(u)+"):("+this.replaceIf(c)+"))",0,s=(t=i).indexOf("If(")}return d+i},replaceNameById:function(t,e,i){for(var s,r,o,n=0,a=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t},h=0;h<a.length;h++)for(n=t.indexOf(a[h]+"(");0<=n;)0<=n&&0<=(s=t.indexOf(")",n+2))&&(r=(r=t.slice(n+2,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+2)+(i?"$('":"")+l(o.id)+t.slice(s))),s=t.indexOf(")",n+2),n=t.indexOf(a[h]+"(",s);for(n=t.indexOf("Dist(");0<=n;)0<=n&&0<=(s=t.indexOf(",",n+5))&&(r=(r=t.slice(n+5,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+5)+l(o.id)+t.slice(s))),s=t.indexOf(",",n+5),n=t.indexOf(",",s),0<=(s=t.indexOf(")",n+1))&&(r=(r=t.slice(n+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",n+1),n=t.indexOf("Dist(",s);for(a=["Deg","Rad"],h=0;h<a.length;h++)for(n=t.indexOf(a[h]+"(");0<=n;)0<=n&&0<=(s=t.indexOf(",",n+4))&&(r=(r=t.slice(n+4,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+4)+l(o.id)+t.slice(s))),s=t.indexOf(",",n+4),n=t.indexOf(",",s),0<=(s=t.indexOf(",",n+1))&&(r=(r=t.slice(n+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+1)+l(o.id)+t.slice(s))),s=t.indexOf(",",n+1),n=t.indexOf(",",s),0<=(s=t.indexOf(")",n+1))&&(r=(r=t.slice(n+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,n+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",n+1),n=t.indexOf(a[h]+"(",s);return t},replaceIdByObj:function(t){return(t=(t=(t=(t=(t=t.replace(/(X|Y|L)\(([\w_]+)\)/g,"$('$2').$1()")).replace(/(V)\(([\w_]+)\)/g,"$('$2').Value()")).replace(/(Dist)\(([\w_]+),([\w_]+)\)/g,"dist($('$2'), $('$3'))")).replace(/(Deg)\(([\w_]+),([ \w[\w_]+),([\w_]+)\)/g,"deg($('$2'),$('$3'),$('$4'))")).replace(/Rad\(([\w_]+),([\w_]+),([\w_]+)\)/g,"rad($('$1'),$('$2'),$('$3'))")).replace(/N\((.+)\)/g,"($1)")},geonext2JS:function(t,e){var i,s,r=["Abs","ACos","ASin","ATan","Ceil","Cos","Exp","Factorial","Floor","Log","Max","Min","Random","Round","Sin","Sqrt","Tan","Trunc"],o=["abs","acos","asin","atan","ceil","cos","exp","factorial","floor","log","max","min","random","round","sin","sqrt","tan","ceil"],n=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&");for(n=this.replaceNameById(n,e),n=this.replaceIf(n),n=this.replacePow(n),n=this.replaceIdByObj(n),s=0;s<r.length;s++)i=new RegExp(["(\\W|^)(",r[s],")"].join(""),"ig"),n=n.replace(i,["$1",o[s]].join(""));return(n=(n=(n=(n=n.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,r,o;for(r in s=(i=a.A.exists(i)?i:t.board).elementsByName)!s.hasOwnProperty(r)||r===t.name||s[r].elementClass===n.A.OBJECT_CLASS_TEXT&&a.A.evaluate(s[r].visProp.islabel)||(o=(o=r.replace(/\[/g,"\\[")).replace(/\]/g,"\\]"),o=new RegExp("\\(([\\w\\[\\]'_ ]+,)*("+o+")(,[\\w\\[\\]'_ ]+)*\\)","g"),0<=e.search(o)&&s[r].addChild(t))},gxt2jc:function(t,e){t=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&");return(t=(t=(t=this.replaceNameById(t,e,!0)).replace(/True/g,"true")).replace(/False/g,"false")).replace(/fasle/g,"false")}},e.A=s.A.GeonextParser},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),priv=(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}),{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,parser=(_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)),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){for(var s=this.node(t,e,[]),r=2;r<arguments.length;r++)s.children.push(arguments[r]);return"node_const"===s.type&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(s.value)&&(s.isMath=!0),s.line=this.parCurLine,s.col=this.parCurColumn,s},pushScope:function(t){t={args:t,locals:{},context:null,previous:this.scope};return this.scope.hasChild=!0,(this.scope=t).id=this.scopes.push(t)-1,t},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(i){var t,s;return"function"==typeof _ccache[this.board.id+i]?t=_ccache[this.board.id+i]:(s=this,(t=function(t,e){return void 0===(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)?e:{}).name&&void 0===e.id&&(e.name=0!==s.lhs[s.scope.id]?s.lhs[s.scope.id]:""),s.board.create(i,t,e)}).creator=!0,_ccache[this.board.id+i]=t),t}).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(-1<_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.indexOf(e.args,t))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(i,s,r){return function(){var t,e=s.scope;for(s.scope=s.scopes[r],t=0;t<i.length;t++)s.scope.locals[i[t]]=arguments[t];return t=s.execute(node.children[1]),s.scope=e,t}}(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){for(var e={},i=0;i<arguments.length;i++)e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(e,arguments[i],!0);return e},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,l=t.replace(/\r\n/g,"\n").split("\n"),h=[];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<l.length;r++)i&&(l[r]=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.GeonextParser.geonext2JS(l[r],this.board)),h.push(l[r]);switch(t=h.join("\n"),n=parser.parse(t),this.CA&&(n=this.CA.expandDerivatives(n,null,n),n=this.CA.removeTrivialNodes(n)),e){case"parse":a=this.execute(n);break;case"manipulate":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)},getAST:function(t,e,i){return this._genericParse(t,"getAst",e,i)},snippet:function(t,e,i,s,r){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),this.parse((e?" function ("+i+") { return ":"")+t+(e?"; }":"")+";",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;0<e;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=void 0!==e?e:!1,e=t.value;if("node_op"===t.type&&"op_lhs"===e&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(e,!0):!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.getvar(e,!0))&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.elementsByName[e])&&(s&&"slider"!==this.board.elementsByName[e].elType&&(s=!1),t=this.createReplacementNode(t,s))),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=0;i<t.length;i++)t[i]=this.replaceNames(t[i],s);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)&&(s=!0),i=t.children.length;0<i;i--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[i-1])&&(t.children[i-1]=this.replaceNames(t.children[i-1],s));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,i=this.board.elementsByName[i];return(t=this.createNode("node_op","op_execfun",this.createNode("node_var",!0===e?"$value":"$"),[this.createNode("node_str",i.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&&"slider"===o.elType&&(i[o.id]=o),"node_op"===t.type&&"op_execfun"===t.value&&1<t.children.length&&("$"===t.children[0].value||"$value"===t.children[0].value)&&0<t.children[1].length&&(i[o=t.children[1][0].value]=this.board.objects[o]),t.children)for(s=t.children.length;0<s;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:e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.methodMap[e])?t.methodMap[e]:(t=t.visProp,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,l,h,u=[],c=0;if(!t)return c;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]&&(c=this.execute(t.children[1]));break;case"op_assign":e=this.getLHS(t.children[0]),this.lhs[this.scope.id]=e.what,e.o.type&&e.o.elementClass&&e.o.methodMap&&"label"===e.what&&this._error("Left-hand side of assignment is read-only."),c=this.execute(t.children[1]),e.o!==this.scope.locals||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e.o)&&"number"==typeof e.what?this.setProp(e.o,e.what,c):this.letvar(e.what,c),this.lhs[this.scope.id]=0;break;case"op_if":this.execute(t.children[0])&&(c=this.execute(t.children[1]));break;case"op_conditional":case"op_if_else":c=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":for(;this.execute(t.children[0]),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":c={};break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(t.children[0]),c=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(c=[],r=t.children[0].length,i=0;i<r;i++)c.push(this.execute(t.children[0][i]));break;case"op_extvalue":c=this.execute(t.children[0]),c="number"==typeof(i=this.execute(t.children[1]))&&Math.abs(Math.round(i)-i)<_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.eps?c[i]:void 0;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."),(a=this.defineFunction(t)).isMap=!0,c=a;break;case"op_function":(a=this.defineFunction(t)).isMap=!1,c=a;break;case"op_execfun":if(this.dpstack.push([]),this.pscope++,o=t.children[1],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[2]))if(t.children[3])for(n=t.children[2],l={},i=0;i<n.length;i++)l=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(l,this.execute(n[i]),!0);else l=this.execute(t.children[2]);for(t.children[0]._isFunctionName=!0,a=this.execute(t.children[0]),delete t.children[0]._isFunctionName,h=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(a)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(a.sc)?a.sc:this,!a.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."),i=0;i<o.length;i++)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(a.scope)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(a.scope.argtypes)&&"function"===a.scope.argtypes[i]?(o[i]._isFunctionName=!0,u[i]=this.execute(o[i]),delete o[i]._isFunctionName):u[i]=this.execute(o[i]),this.dpstack[this.pscope].push({line:t.children[1][i].line,col:t.children[1][i].ecol});if("function"!=typeof a||a.creator)if("function"==typeof a&&a.creator){s=this.line;try{for((c=a(u,l)).jcLineStart=s,c.jcLineEnd=t.eline,i=s;i<=t.line;i++)this.lineToElement[i]=c;c.debugParents=this.dpstack[this.pscope]}catch(t){this._error(t.toString())}}else this._error("Function '"+a+"' is undefined.");else c=a.apply(h,u);this.dpstack.pop(),this.pscope--;break;case"op_property":s=this.execute(t.children[0]),e=t.children[1],c=this.resolveProperty(s,e,!1),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(c)&&["number","string","boolean"].indexOf(typeof c)<0&&(c.sc=s);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."),e=this.getvar(t.children[0]),c=this.del(e);break;case"op_eq":c=this.execute(t.children[0])==this.execute(t.children[1]);break;case"op_neq":c=this.execute(t.children[0])!=this.execute(t.children[1]);break;case"op_approx":c=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":c=this.execute(t.children[0])>this.execute(t.children[1]);break;case"op_lt":c=this.execute(t.children[0])<this.execute(t.children[1]);break;case"op_geq":c=this.execute(t.children[0])>=this.execute(t.children[1]);break;case"op_leq":c=this.execute(t.children[0])<=this.execute(t.children[1]);break;case"op_or":c=this.execute(t.children[0])||this.execute(t.children[1]);break;case"op_and":c=this.execute(t.children[0])&&this.execute(t.children[1]);break;case"op_not":c=!this.execute(t.children[0]);break;case"op_add":c=this.add(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_sub":c=this.sub(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_div":c=this.div(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_mod":c=this.mod(this.execute(t.children[0]),this.execute(t.children[1]),!0);break;case"op_mul":c=this.mul(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_exp":c=this.pow(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_neg":c=this.neg(this.execute(t.children[0]))}break;case"node_var":c=this.getvar(t.value,!1,t._isFunctionName);break;case"node_const":c=null===t.value?null:Number(t.value);break;case"node_const_bool":c=t.value;break;case"node_str":c=t.value.replace(/\\(.)/g,"$1")}return c},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_assign":o=e?(i=this.getLHSCompiler(t.children[0],e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(i)?"$jc$.setProp("+i[0]+", "+i[1]+", "+this.compile(t.children[1],e)+");\n":(this.isLocalVariable(i)!==this.scope&&(this.scope.locals[i]=!0),"$jc$.scopes["+this.scope.id+"].locals['"+i+"'] = "+this.compile(t.children[1],e)+";\n")):(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.needsBrackets&&(o="{\n"+o+" }\n"),o=t.needsAngleBrackets?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__:_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):e<t},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):e<=t},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){for(var i,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 e=this,t={PI:Math.PI,EULER:Math.E,D:e.DDD,X:e.X,Y:e.Y,V:e.V,Value:e.V,L:e.L,Length:e.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:e.area,area:e.area,Area:e.area,perimeter:e.perimeter,Perimeter:e.perimeter,dist:e.dist,Dist:e.dist,R:e.radius,radius:e.radius,Radius:e.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:e.slope,Slope:e.slope,randint:e.randint,IfThen:e.ifthen,import:e.importModule,eval:e.eval,use:e.use,remove:e.del,$:e.getElementById,$value:function(t){return e.getElementById(t).Value()},getName:e.getName,name:e.getName,$board:e.board,$log:e.log};return t.rad.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,t.deg.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,t.factorial.sc=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A,t.X.src="$jc$.X",t.Y.src="$jc$.Y",t.V.src="$jc$.V",t.Value.src="$jc$.V",t.L.src="$jc$.L",t.Length.src="$jc$.L",t.acosh.src="JXG.Math.acosh",t.acot.src="JXG.Math.acot",t.asinh.src="JXG.Math.asinh",t.binomial.src="JXG.Math.binomial",t.cbrt.src="JXG.Math.cbrt",t.cot.src="JXG.Math.cot",t.cosh.src="JXG.Math.cosh",t.deg.src="JXG.Math.Geometry.trueAngle",t.erf.src="JXG.Math.erf",t.erfc.src="JXG.Math.erfc",t.erfi.src="JXG.Math.erfi",t.A.src="$jc$.area",t.area.src="$jc$.area",t.Area.src="$jc$.area",t.perimeter.src="$jc$.perimeter",t.Perimeter.src="$jc$.perimeter",t.dist.src="$jc$.dist",t.Dist.src="$jc$.dist",t.R.src="$jc$.radius",t.radius.src="$jc$.radius",t.Radius.src="$jc$.radius",t.factorial.src="JXG.Math.factorial",t.gcd.src="JXG.Math.gcd",t.lb.src="JXG.Math.log2",t.lcm.src="JXG.Math.lcm",t.ld.src="JXG.Math.log2",t.lg.src="JXG.Math.log10",t.ln.src="Math.log",t.log.src="JXG.Math.log",t.log10.src="JXG.Math.log10",t.log2.src="JXG.Math.log2",t.ndtr.src="JXG.Math.ndtr",t.ndtri.src="JXG.Math.ndtri",t.nthroot.src="JXG.Math.nthroot",t.pow.src="JXG.Math.pow",t.rad.src="JXG.Math.Geometry.rad",t.ratpow.src="JXG.Math.ratpow",t.trunc.src="JXG.trunc",t.sinh.src="JXG.Math.sinh",t.slope.src="$jc$.slope",t.Slope.src="$jc$.slope",t.randint.src="$jc$.randint",t.import.src="$jc$.importModule",t.eval.src="$jc$.eval",t.use.src="$jc$.use",t.remove.src="$jc$.del",t.IfThen.src="$jc$.ifthen",t.$.src="(function (n) { return $jc$.board.select(n); })",t.$value.src="(function (n) { return $jc$.board.select(n).Value(); })",t.getName.src="$jc$.getName",t.name.src="$jc$.getName",t.$board&&(t.$board.src="$jc$.board"),t.$log.src="$jc$.log",_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.merge(t,e._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(){for(var t,e,i,s,r,o,n,a=["E"],l=this.builtIn||this.defineBuiltIn(),h=Math,u=function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())},c=function(t,e){var i=null;if("jc"===e)i=l[t];else{if("Math"!==e)return;i=h[t]}if(!(0<=a.indexOf(t)))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))},d=Object.getOwnPropertyNames(l).sort(u),p=Object.getOwnPropertyNames(h).sort(u),_=[],f=0,A=0;f<d.length||A<p.length;)d[f]===p[A]?(t=c(p[A],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t)&&_.push(t),f++,A++):!_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(p[A])||d[f].toLowerCase().localeCompare(p[A].toLowerCase())<0?(t=c(d[f],"jc"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t)&&_.push(t),f++):(t=c(p[A],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t)&&_.push(t),A++);for(s=[],r=[],o=[],n={},e=_.length,f=0;f<e;f++){switch((i=_[f]).type){case"function":s.push(i.name),"jc"===i.origin&&r.push(i.name);break;case"constant":o.push(i.name)}n[i.name]=i}return{all:n,list:_,functions:s,functions_jessiecode:r,constants:o}},_debug:function(t){"object"==typeof console?console.log(t):_utils_env_js__WEBPACK_IMPORTED_MODULE_8__.A.isBrowser&&document&&null!==document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=t+"<br />")},_error:function(t){t=new Error("Error("+this.line+"): "+t);throw t.line=this.line,t},_warn:function(t){"object"==typeof console?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).innerHTML+="Warning("+this.line+"): "+t+"<br />")},_log:function(t){"object"!=typeof window&&"object"==typeof self&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+t.toString()}):console.log("Log: ",arguments)}}),function(){function t(t,e,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=e);return i}var e=[2,14],i=[1,13],s=[1,37],r=[1,14],o=[1,15],n=[1,21],a=[1,16],l=[1,17],h=[1,33],u=[1,18],c=[1,19],d=[1,12],p=[1,59],_=[1,60],f=[1,58],A=[1,46],g=[1,48],m=[1,49],y=[1,50],b=[1,51],v=[1,52],C=[1,53],x=[1,54],P=[1,45],E=[1,38],O=[1,39],L=[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],M=[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],w=[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],B=[2,48],I=[1,72],Y=[10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,66,83,86],X=[1,78],U=[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],F=[1,82],z=[8,10,16,32,34,35,37,39,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],J=[1,83],G=[1,84],W=[1,85],S=[8,10,16,32,34,35,37,39,41,42,43,50,51,53,54,55,57,64,65,66,83,86],T=[1,89],H=[1,90],V=[1,91],$=[1,92],K=[1,97],N=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,53,54,55,57,64,65,66,83,86],j=[1,103],D=[1,104],q=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,57,64,65,66,83,86],Z=[1,105],Q=[1,106],tt=[1,107],et=[1,126],it=[1,139],st=[83,86],rt=[1,150],ot=[10,66,86],nt=[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],at=[1,167],lt=[10,86],e={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.$=k.createNode(R(n[a-4]),"node_op","op_if",o[a-2],o[a]);break;case 3:this.$=k.createNode(R(n[a-6]),"node_op","op_if_else",o[a-4],o[a-2],o[a]);break;case 4:this.$=k.createNode(R(n[a-4]),"node_op","op_while",o[a-2],o[a]);break;case 5:this.$=k.createNode(R(n[a-8]),"node_op","op_for",o[a-6],o[a-4],o[a-2],o[a]);break;case 6:this.$=k.createNode(R(n[a-6]),"node_op","op_do",o[a-5],o[a-2]);break;case 7:this.$=k.createNode(R(n[a-1]),"node_op","op_use",o[a]);break;case 8:this.$=k.createNode(R(n[a-1]),"node_op","op_delete",o[a]);break;case 9:this.$=k.createNode(R(n[a-1]),"node_op","op_return",void 0);break;case 10:this.$=k.createNode(R(n[a-2]),"node_op","op_return",o[a-1]);break;case 11:case 14:this.$=k.createNode(R(n[a]),"node_op","op_none");break;case 12:this.$=o[a-1],this.$.needsBrackets=!0;break;case 13:this.$=k.createNode(R(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.$=k.createNode(R(n[a-2]),"node_op","op_assign",o[a-2],o[a]),this.$.isMath=!1;break;case 27:this.$=k.createNode(R(n[a-4]),"node_op","op_conditional",o[a-4],o[a-2],o[a]),this.$.isMath=!1;break;case 29:this.$=k.createNode(R(n[a-2]),"node_op","op_or",o[a-2],o[a]),this.$.isMath=!1;break;case 31:this.$=k.createNode(R(n[a-2]),"node_op","op_and",o[a-2],o[a]),this.$.isMath=!1;break;case 33:this.$=k.createNode(R(n[a-2]),"node_op","op_eq",o[a-2],o[a]),this.$.isMath=!1;break;case 34:this.$=k.createNode(R(n[a-2]),"node_op","op_neq",o[a-2],o[a]),this.$.isMath=!1;break;case 35:this.$=k.createNode(R(n[a-2]),"node_op","op_approx",o[a-2],o[a]),this.$.isMath=!1;break;case 37:this.$=k.createNode(R(n[a-2]),"node_op","op_lt",o[a-2],o[a]),this.$.isMath=!1;break;case 38:this.$=k.createNode(R(n[a-2]),"node_op","op_gt",o[a-2],o[a]),this.$.isMath=!1;break;case 39:this.$=k.createNode(R(n[a-2]),"node_op","op_leq",o[a-2],o[a]),this.$.isMath=!1;break;case 40:this.$=k.createNode(R(n[a-2]),"node_op","op_geq",o[a-2],o[a]),this.$.isMath=!1;break;case 42:this.$=k.createNode(R(n[a-2]),"node_op","op_add",o[a-2],o[a]),this.$.isMath=!0;break;case 43:this.$=k.createNode(R(n[a-2]),"node_op","op_sub",o[a-2],o[a]),this.$.isMath=!0;break;case 45:this.$=k.createNode(R(n[a-2]),"node_op","op_mul",o[a-2],o[a]),this.$.isMath=!0;break;case 46:this.$=k.createNode(R(n[a-2]),"node_op","op_div",o[a-2],o[a]),this.$.isMath=!0;break;case 47:this.$=k.createNode(R(n[a-2]),"node_op","op_mod",o[a-2],o[a]),this.$.isMath=!0;break;case 49:this.$=k.createNode(R(n[a-2]),"node_op","op_exp",o[a-2],o[a]),this.$.isMath=!0;break;case 51:this.$=k.createNode(R(n[a-1]),"node_op","op_not",o[a]),this.$.isMath=!1;break;case 53:this.$=k.createNode(R(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.$=k.createNode(R(n[a-2]),"node_op","op_property",o[a-2],o[a]),this.$.isMath=!0;break;case 60:case 90:this.$=k.createNode(R(n[a-3]),"node_op","op_extvalue",o[a-3],o[a-1]),this.$.isMath=!0;break;case 61:this.$=k.createNode(R(n[a]),"node_var",o[a]);break;case 69:this.$=o[a],this.$.isMath=!0;break;case 70:this.$=k.createNode(R(n[a]),"node_const",null);break;case 71:this.$=k.createNode(R(n[a]),"node_const_bool",!0);break;case 72:this.$=k.createNode(R(n[a]),"node_const_bool",!1);break;case 73:this.$=k.createNode(R(n[a]),"node_str",o[a].substring(1,o[a].length-1));break;case 74:this.$=k.createNode(R(n[a]),"node_const",parseFloat(o[a]));break;case 75:this.$=k.createNode(R(n[a]),"node_const",NaN);break;case 76:this.$=k.createNode(R(n[a]),"node_const",1/0);break;case 77:this.$=k.createNode(R(n[a-1]),"node_op","op_array",[]);break;case 78:this.$=k.createNode(R(n[a-2]),"node_op","op_array",o[a-1]);break;case 79:this.$=k.createNode(R(n[a-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=k.createNode(R(n[a-2]),"node_op","op_proplst_val",o[a-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=k.createNode(R(n[a-2]),"node_op","op_proplst",o[a-2],o[a]);break;case 83:this.$=k.createNode(R(n[a-2]),"node_op","op_prop",o[a-2],o[a]);break;case 87:case 89:this.$=k.createNode(R(n[a-1]),"node_op","op_execfun",o[a-1],o[a]),this.$.isMath=!0;break;case 88:this.$=k.createNode(R(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.$=k.createNode(R(n[a]),"node_var",o[a]),this.$.isMath=!0;break;case 100:this.$=k.createNode(R(n[a-3]),"node_op","op_function",[],o[a]),this.$.isMath=!1;break;case 101:this.$=k.createNode(R(n[a-4]),"node_op","op_function",o[a-2],o[a]),this.$.isMath=!1;break;case 102:this.$=k.createNode(R(n[a-4]),"node_op","op_map",[],o[a]);break;case 103:this.$=k.createNode(R(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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{1:[2,1]},t(L,[2,13]),t(M,[2,15]),t(M,[2,16]),t(M,[2,17]),t(M,[2,18]),t(M,[2,19]),t(M,[2,20]),t(M,[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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{20:[1,66]},{20:[1,67]},{8:s,9:69,16:[1,68],20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{16:[1,70]},t(M,[2,11]),t(w,[2,23]),t(w,[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],B,{32:[1,71],57:I}),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(Y,[2,54],{88:77,8:X,64:[1,75],65:[1,76]}),t(Y,[2,55],{88:79,8:X,64:[1,81],65:[1,80]}),t(U,[2,28],{39:F}),t(w,[2,56]),t(w,[2,57]),t(w,[2,58]),t(z,[2,30],{41:J,42:G,43:W}),t(w,[2,61]),t(w,[2,62]),t(w,[2,63]),t(w,[2,64]),{8:s,9:86,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:[1,87]},{8:[1,88]},t(S,[2,32],{45:T,46:H,47:V,48:$}),t(w,[2,66]),t(w,[2,67]),t(w,[2,68]),t(w,[2,69]),{20:K,72:98,73:99,77:b,78:v,79:C,80:x,83:[1,93],84:94,85:95,87:96},{8:s,20:h,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,81:101,82:P,91:E,93:O},t(N,[2,36],{50:j,51:D}),t(w,[2,70]),t(w,[2,71]),t(w,[2,72]),t(w,[2,73]),t(w,[2,74]),t(w,[2,75]),t(w,[2,76]),t(q,[2,41],{53:Z,54:Q,55:tt}),t(w,[2,44]),t(w,[2,50]),{8:s,20:h,31:109,50:p,51:_,52:108,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:110,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:111,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:113,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:114,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:115,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{14:[1,116]},t(M,[2,7]),t(M,[2,8]),t(M,[2,9]),{16:[1,117]},t(M,[2,22]),{8:s,20:h,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:119,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,36:121,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{20:[1,122]},{8:s,9:123,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(w,[2,87],{89:124,90:125,68:127,20:et,82:P}),{8:s,10:[1,128],20:h,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,81:129,82:P,91:E,93:O},t(w,[2,89]),{8:s,9:130,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{20:[1,131]},{8:s,20:h,31:109,38:132,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,40:133,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,40:134,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,40:135,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{10:[1,136]},{10:[1,137],20:it,92:138},{10:[1,140],20:it,92:141},{8:s,20:h,31:109,44:142,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,44:143,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,44:144,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,44:145,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(w,[2,79]),{83:[1,146],86:[1,147]},t(st,[2,81]),{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},t(w,[2,77]),{66:[1,149],86:rt},t(ot,[2,98]),{8:s,20:h,31:109,49:151,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,49:152,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:153,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:154,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,31:109,50:p,51:_,52:155,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(w,[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],B,{57:I}),t(w,[2,52]),t(w,[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(M,[2,10]),t(w,[2,25]),t(w,[2,49]),{35:[1,160]},t(U,[2,29],{39:F}),t(w,[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(w,[2,94]),t(w,[2,96]),t(w,[2,97]),t(nt,[2,92]),{10:[1,163],86:rt},{66:[1,164]},t(w,[2,91]),t(z,[2,31],{41:J,42:G,43:W}),t(S,[2,33],{45:T,46:H,47:V,48:$}),t(S,[2,34],{45:T,46:H,47:V,48:$}),t(S,[2,35],{45:T,46:H,47:V,48:$}),t(w,[2,65]),{25:165,26:d},{10:[1,166],86:at},t(lt,[2,104]),{94:[1,168]},{10:[1,169],86:at},t(N,[2,37],{50:j,51:D}),t(N,[2,38],{50:j,51:D}),t(N,[2,39],{50:j,51:D}),t(N,[2,40],{50:j,51:D}),t(w,[2,80]),{20:K,72:98,73:99,77:b,78:v,79:C,80:x,85:170,87:96},{8:s,20:h,29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(w,[2,78]),{8:s,20:h,29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(q,[2,42],{53:Z,54:Q,55:tt}),t(q,[2,43],{53:Z,54:Q,55:tt}),t(w,[2,45]),t(w,[2,46]),t(w,[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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:175,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:176,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,20:h,29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(w,[2,60]),{20:et,68:127,82:P,90:178},t(nt,[2,93]),t(w,[2,90]),t(w,[2,100]),{25:179,26:d},{20:[1,180]},{8:s,9:181,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{94:[1,182]},t(st,[2,82]),t(st,[2,83]),t(ot,[2,99]),t(L,[2,2],{12:[1,183]}),t(M,[2,4]),{16:[1,184]},{10:[1,185]},t(w,[2,27]),t(w,[2,95]),t(w,[2,101]),t(lt,[2,105]),t(w,[2,102]),{8:s,9:186,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{8:s,9:188,20:h,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},{16:[1,189]},t(w,[2,103]),t(M,[2,3]),{10:[1,190]},t(M,[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:l,20:h,21:u,22:9,23:c,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:_,52:56,56:57,58:f,59:26,60:27,61:29,62:30,63:31,65:A,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:g,75:m,76:y,77:b,78:v,79:C,80:x,82:P,91:E,93:O},t(M,[2,5])],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){var i;if(!e.recoverable)throw(i=new Error(t)).hash=e,i;this.trace(t)},parse:function(t){var e,i=this,s=[0],r=[null],o=[],n=this.table,a="",l=0,h=0,u=0,c=o.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(e in this.yy)Object.prototype.hasOwnProperty.call(this.yy,e)&&(p.yy[e]=this.yy[e]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var _=d.yylloc,f=(o.push(_),d.options&&d.options.ranges);"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var A,g,m,y,b,v,C,x={};;){if(m=s[s.length-1],void 0===(y=this.defaultActions[m]||(null==A&&(P=void 0,A=P="number"!=typeof(P=d.lex()||1)&&i.symbols_[P]||P),n[m]&&n[m][A]))||!y.length||!y[0]){var P,E=[];for(b in n[m])this.terminals_[b]&&2<b&&E.push("'"+this.terminals_[b]+"'");P=d.showPosition?"Parse error on line "+(l+1)+":\n"+d.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[A]||A)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==A?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(P,{text:d.match,token:this.terminals_[A]||A,line:d.yylineno,loc:_,expected:E})}if(y[0]instanceof Array&&1<y.length)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+A);switch(y[0]){case 1:s.push(A),r.push(d.yytext),o.push(d.yylloc),s.push(y[1]),A=null,g?(A=g,g=null):(h=d.yyleng,a=d.yytext,l=d.yylineno,_=d.yylloc,0<u&&u--);break;case 2:if(v=this.productions_[y[1]][1],x.$=r[r.length-v],x._$={first_line:o[o.length-(v||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(v||1)].first_column,last_column:o[o.length-1].last_column},f&&(x._$.range=[o[o.length-(v||1)].range[0],o[o.length-1].range[1]]),void 0!==(C=this.performAction.apply(x,[a,h,l,p.yy,y[1],r,o].concat(c))))return C;v&&(s=s.slice(0,-1*v*2),r=r.slice(0,-1*v),o=o.slice(0,-1*v)),s.push(this.productions_[y[1]][0]),r.push(x.$),o.push(x._$),C=n[s[s.length-2]][s[s.length-1]],s.push(C);break;case 3:return!0}}return!0}},k={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,s){for(var r=this.node(e,i,[]),o=3;o<arguments.length;o++)r.children.push(arguments[o]);return r.line=t[0],r.col=t[1],r.eline=t[2],r.ecol=t[3],r}},R=function(t){return[t.first_line,t.first_column,t.last_line,t.last_column]};function ht(){this.yy={}}return e.lexer={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),t=(this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e,this.match.split(/(?:\r\n?|\n)/g)),s=(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),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===t.length?this.yylloc.first_column:0)+t[t.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[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(20<t.length?"...":"")+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)+(20<t.length?"...":"")).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;if(this.options.backtrack_lexer&&(s={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&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.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 r in s)this[r]=s[r];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(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return 0<this.conditionStack.length-1?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]]:this.conditions.INITIAL).rules},topState:function(t){return 0<=(t=this.conditionStack.length-1-Math.abs(t||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 5:case 6:break;case 1:case 2:return 78;case 3:case 4:return 77;case 7:return 7;case 8:return 12;case 9:return 14;case 10:return 17;case 11:return 15;case 12:return 91;case 13:return 93;case 14:return 19;case 15:return 23;case 16:return 21;case 17:return 75;case 18:return 76;case 19:return 74;case 20:return 80;case 21:case 22:return 94;case 23:return 82;case 24:return 83;case 25:return 26;case 26:return 27;case 27:return 16;case 28:return"#";case 29:return 34;case 30:return 35;case 31:return 79;case 32:return 64;case 33:return 65;case 34:return 66;case 35:return 8;case 36:return 10;case 37:return 58;case 38:case 39:return 57;case 40:return 53;case 41:return 54;case 42:return 55;case 43:return 50;case 44:return 51;case 45:return 47;case 46:return 45;case 47:return 48;case 48:return 46;case 49:return 41;case 50:return 43;case 51:return 42;case 52:return 39;case 53:return 37;case 54:return 32;case 55:return 86;case 56:return 5;case 57:return 20;case 58:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[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],inclusive:!0}}},new((ht.prototype=e).Parser=ht)}());parser.yy.parseError=parser.parseError,__webpack_exports__.A=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode},873:function(t,e,i){var p=i(443),d=i(188),u=i(477),_={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",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},f=[{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)]}}];p.A.rgbParser=function(t,e,i){var s,r,o,n,a,l,h,u,c=t;if(!d.A.exists(t))return[];if(s=c=d.A.exists(e)&&d.A.exists(i)?[t,e,i]:c,u=!1,d.A.isArray(s)){for(n=0;n<3;n++)u=u||/\./.test(c[n].toString());for(n=0;n<3;n++)u=u&&0<=c[n]&&c[n]<=1;return u?[Math.ceil(255*c[0]),Math.ceil(255*c[1]),Math.ceil(255*c[2])]:c}for(s=(s="#"===(s="string"==typeof c?c:s).charAt(0)?s.slice(1,7):s).replace(/ /g,"").toLowerCase(),s=_[s]||s,n=0;n<f.length;n++)o=f[n].re,r=f[n].process,(o=o.exec(s))&&(a=(r=r(o))[0],l=r[1],h=r[2]);return isNaN(a)||isNaN(l)||isNaN(h)?[]:[a=a<0||isNaN(a)?0:255<a?255:a,l=l<0||isNaN(l)?0:255<l?255:l,h=h<0||isNaN(h)?0:255<h?255:h]},p.A.isColor=function(t){var e=(new Option).style;return e.color=t,""!==e.color},p.A.rgb2css=function(t,e,i){return"rgb("+(t=p.A.rgbParser(t,e,i))[0]+", "+t[1]+", "+t[2]+")"},p.A.rgb2hex=function(t,e,i){e=(t=p.A.rgbParser(t,e,i))[1],i=t[2],t=(t=t[0]).toString(16);return e=e.toString(16),i=i.toString(16),"#"+(t=1===t.length?"0"+t:t)+(e=1===e.length?"0"+e:e)+(i=1===i.length?"0"+i:i)},p.A.hex2rgb=function(t){return p.A.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),p.A.rgb2css(t)},p.A.hsv2rgb=function(t,e,i){var s,r,o,n,a,l,h;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t<u.A.eps))return"#ffffff";o=r=s=i}else switch(t=360<=t?0:t,a=i*(1-e),l=i*(1-e*(n=(t/=60)-(t=Math.floor(t)))),h=i*(1-e*(1-n)),t){case 0:s=i,r=h,o=a;break;case 1:s=l,r=i,o=a;break;case 2:s=a,r=i,o=h;break;case 3:s=a,r=l,o=i;break;case 4:s=h,r=a,o=i;break;case 5:s=i,r=a,o=l}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",o=2===(o=Math.round(255*o).toString(16)).length?o:1===o.length?"0"+o:"00"].join("")},p.A.rgb2hsv=function(t,e,i){var s,e=(t=p.A.rgbParser(t,e,i))[1],i=t[2],r=(t=t[0])/255,o=e/255,n=i/255,a=Math.max(t,e,i),l=(i=Math.min(t,e,i))/255,h=0;return 0<(s=a/255)&&(h=(s-l)/s),l=1/(s-l),0<h&&(a===t?l*=o-n:l=a===e?2+(n-r)*l:4+(r-o)*l),(l*=60)<0&&(l+=360),[l=a===i?0:l,h,s]},p.A.rgb2LMS=function(t,e,i){var s,r,o=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]],e=(t=p.A.rgbParser(t,e,i))[1],i=t[2],t=t[0];return t=Math.pow(t,.476190476),e=Math.pow(e,.476190476),i=Math.pow(i,.476190476),(e=[s=t*o[0][0]+e*o[0][1]+i*o[0][2],r=t*o[1][0]+e*o[1][1]+i*o[1][2],t=t*o[2][0]+e*o[2][1]+i*o[2][2]]).l=s,e.m=r,e.s=t,e},p.A.LMS2rgb=function(t,e,i){function s(t){for(var e=127,i=64;0<i;){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}var r=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]],o=t*r[0][0]+e*r[0][1]+i*r[0][2],n=t*r[1][0]+e*r[1][1]+i*r[1][2],t=t*r[2][0]+e*r[2][1]+i*r[2][2];return(e=[o=s(o),n=s(n),t=s(t)]).r=o,e.g=n,e.b=t,e},p.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]},p.A.rgbo2rgba=function(t,e){return"none"===t||"transparent"===t?t:(1===(e=Math.round(255*e).toString(16)).length&&(e="0"+e),p.A.rgb2hex(t)+e)},p.A.rgb2bw=function(t){var e="0123456789ABCDEF";return"none"===t?t:(t=p.A.rgbParser(t),t=Math.floor(.3*t[0]+.59*t[1]+.11*t[2]),"#"+(e=e.charAt(t>>4&15)+e.charAt(15&t))+e+e)},p.A.rgb2cb=function(t,e){var i,s,r,o,n,a,l,h,u,c,d="0123456789ABCDEF";if("none"===t)return t;switch(i=(o=p.A.rgb2LMS(t))[0],s=o[1],r=o[2],e=e.toLowerCase()){case"protanopia":n=-.06150039994295001,a=.08277001656812001,l=-.013200141220000003,h=.05858939668799999,u=-.07934519995360001,c=.013289415272000003,i=r/s<.6903216543277437?-(a*s+l*r)/n:-(u*s+c*r)/h;break;case"tritanopia":n=-.00058973116217,a=.007690316482,l=-.01011703519052,h=.025495080838999994,u=-.0422740347,c=.017005316784,r=s/i<.8349489908460004?-(n*i+a*s)/l:-(h*i+u*s)/c;break;default:n=-.06150039994295001,a=.08277001656812001,l=-.013200141220000003,h=.05858939668799999,u=-.07934519995360001,c=.013289415272000003,s=r/i<.5763833686400911?-(n*i+l*r)/a:-(h*i+c*r)/u}return o=p.A.LMS2rgb(i,s,r),t="#"+(d.charAt(o[0]>>4&15)+d.charAt(15&o[0])),(t+=d.charAt(o[1]>>4&15)+d.charAt(15&o[1]))+(d.charAt(o[2]>>4&15)+d.charAt(15&o[2]))},p.A.shadeColor=function(t,e){var t=p.A.rgbParser(t),i=t[0],s=t[1],t=t[2],i=(i=0<(i=parseInt(i+255*e))?i:0)<255?i:255,s=(s=0<(s=parseInt(s+255*e))?s:0)<255?s:255,t=(t=0<(t=parseInt(t+255*e))?t:0)<255?t:255;return i=Math.round(i),s=Math.round(s),t=Math.round(t),p.A.rgb2hex([i,s,t])},p.A.lightenColor=function(t,e){return p.A.shadeColor(t,e)},p.A.darkenColor=function(t,e){return p.A.shadeColor(t,-1*e)},p.A.autoHighlight=function(t){var e=p.A.rgba2rgbo(t),i=e[0],e=e[1];return"#"===t.charAt(0)?p.A.rgbo2rgba(i,e*=e<.3?1.8:.4):t},p.A.contrast=function(t,e,i,s){var r;return e=e||"#000000",i=i||"#ffffff",s=s||7,t=p.A.rgbParser(t),r=p.A.rgbParser("#000000"),r=(t=.2126*Math.pow(t[0]/255,2.2)+.7152*Math.pow(t[1]/255,2.2)+.0722*Math.pow(t[2]/255,2.2))>(r=.2126*Math.pow(r[0]/255,2.2)+.7152*Math.pow(r[1]/255,2.2)+.0722*Math.pow(r[2]/255,2.2))?Math.floor((.05+t)/(.05+r)):Math.floor((.05+r)/(.05+t)),--r>s?e:i},p.A.setClassicColors=function(){p.A.Options.elements.strokeColor="blue",p.A.Options.elements.fillColor="red",p.A.Options.hatch.strokeColor="blue",p.A.Options.angle.fillColor="#ff7f00",p.A.Options.angle.highlightFillColor="#ff7f00",p.A.Options.angle.strokeColor="#ff7f00",p.A.Options.angle.label.strokeColor="blue",p.A.Options.arc.strokeColor="blue",p.A.Options.circle.center.fillColor="red",p.A.Options.circle.center.strokeColor="blue",p.A.Options.circumcircle.strokeColor="blue",p.A.Options.circumcircle.center.fillColor="red",p.A.Options.circumcircle.center.strokeColor="blue",p.A.Options.circumcirclearc.strokeColor="blue",p.A.Options.circumcirclesector.strokeColor="blue",p.A.Options.circumcirclesector.fillColor="green",p.A.Options.circumcirclesector.highlightFillColor="green",p.A.Options.conic.strokeColor="blue",p.A.Options.curve.strokeColor="blue",p.A.Options.incircle.strokeColor="blue",p.A.Options.incircle.center.fillColor="red",p.A.Options.incircle.center.strokeColor="blue",p.A.Options.inequality.fillColor="red",p.A.Options.integral.fillColor="red",p.A.Options.integral.curveLeft.color="red",p.A.Options.integral.curveRight.color="red",p.A.Options.line.strokeColor="blue",p.A.Options.point.fillColor="red",p.A.Options.point.strokeColor="red",p.A.Options.polygon.fillColor="green",p.A.Options.polygon.highlightFillColor="green",p.A.Options.polygon.vertices.strokeColor="red",p.A.Options.polygon.vertices.fillColor="red",p.A.Options.regularpolygon.fillColor="green",p.A.Options.regularpolygon.highlightFillColor="green",p.A.Options.regularpolygon.vertices.strokeColor="red",p.A.Options.regularpolygon.vertices.fillColor="red",p.A.Options.riemannsum.fillColor="yellow",p.A.Options.sector.fillColor="green",p.A.Options.sector.highlightFillColor="green",p.A.Options.semicircle.center.fillColor="red",p.A.Options.semicircle.center.strokeColor="blue",p.A.Options.slopetriangle.fillColor="red",p.A.Options.slopetriangle.highlightFillColor="red",p.A.Options.turtle.arrow.strokeColor="blue"},p.A.extend(p.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"}}),p.A.palette=p.A.paletteWong,e.A=p.A},133:function(t,e,i){var p=i(443),u=i(188);p.A.extendConstants(p.A,{}),p.A.extend(p.A,{isTouchEvent:function(t){return p.A.exists(t.touches)},isPointerEvent:function(t){return p.A.exists(t.pointerId)},isMouseEvent:function(t){return!p.A.isTouchEvent(t)&&!p.A.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return e=p.A.isTouchEvent(t)?t.touches.length:e},isFirstTouch:function(t){var e=p.A.getNumberOfTouchPoints(t);return p.A.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:"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(t=this.isNode()?!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 u.A.exists(navigator)&&-1<navigator.userAgent.toLowerCase().indexOf("android")},isWebkitAndroid:function(){return this.isAndroid()&&-1<navigator.userAgent.indexOf(" AppleWebKit/")},isApple:function(){return u.A.exists(navigator)&&(-1<navigator.userAgent.indexOf("iPad")||-1<navigator.userAgent.indexOf("iPhone"))},isWebkitApple:function(){return this.isApple()&&-1<navigator.userAgent.search(/Mobile\/[0-9A-Za-z.]*Safari/)},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&-1<window.clientInformation.appVersion.indexOf("MSAppHost")},isMozilla:function(){return u.A.exists(navigator)&&-1<navigator.userAgent.toLowerCase().indexOf("mozilla")&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return u.A.exists(navigator)&&-1===navigator.userAgent.toLowerCase().indexOf("android")&&-1===navigator.userAgent.toLowerCase().indexOf("apple")&&-1<navigator.userAgent.toLowerCase().indexOf("mobile")&&-1<navigator.userAgent.toLowerCase().indexOf("mozilla")},isDesktop:function(){return!0},isMobile:function(){return!0},ieVersion:function(){var t,e,i=3;if("object"!=typeof document)return 0;for(e=(t=document.createElement("div")).getElementsByTagName("i");t.innerHTML="\x3c!--[if gt IE "+ ++i+"]><i></i><![endif]--\x3e",e[0];);return 4<i?i:void 0}(),getDimensions:function(t,e){var i,s,r,o,n=/\d+(\.\d*)?px/;if(!this.isBrowser||null===t)return{width:500,height:500};if(e=e||document,e=u.A.isString(t)?e.getElementById(t):t,u.A.exists(e))return"none"!==(o=e.style.display)&&null!==o?0<e.clientWidth&&0<e.clientHeight?{width:e.clientWidth,height:e.clientHeight}:(o=window.getComputedStyle?window.getComputedStyle(e):e.style,{width:n.test(o.width)?parseFloat(o.width):0,height:n.test(o.height)?parseFloat(o.height):0}):(o=(n=e.style).visibility,i=n.position,s=n.display,n.visibility="hidden",n.position="absolute",n.display="block",r=e.clientWidth,e=e.clientHeight,n.display=s,n.position=i,n.visibility=o,{width:r,height:e});throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.")},addEvent:function(t,e,i,s,r){function o(){return i.apply(s,arguments)}o.origin=i,"object"==typeof s&&u.A.exists(s.BOARD_MODE_NONE)&&(s["x_internal"+e]=s["x_internal"+e]||[],s["x_internal"+e].push(o)),u.A.exists(t)&&u.A.exists(t.addEventListener)&&t.addEventListener(e,o,r=r||!1),u.A.exists(t)&&u.A.exists(t.attachEvent)&&t.attachEvent("on"+e,o)},removeEvent:function(t,e,i,s){var r;if(u.A.exists(s))if(u.A.exists(s["x_internal"+e]))if(u.A.isArray(s["x_internal"+e]))if(-1!==(r=u.A.indexOf(s["x_internal"+e],i,"origin"))){try{u.A.exists(t)&&u.A.exists(t.removeEventListener)&&t.removeEventListener(e,s["x_internal"+e][r],!1),u.A.exists(t)&&u.A.exists(t.detachEvent)&&t.detachEvent("on"+e,s["x_internal"+e][r])}catch(t){p.A.debug("removeEvent: event not registered in browser: ("+e+" -- "+i+")")}s["x_internal"+e].splice(r,1)}else p.A.debug("removeEvent: no such event function in internal list: "+i);else p.A.debug("owner[x_internal + "+e+"] is not an array");else p.A.debug("removeEvent: no such type: "+e);else p.A.debug("no such owner")},removeAllEvents:function(t,e,i){var s;if(i["x_internal"+e]){for(s=i["x_internal"+e].length-1;0<=s;s--)p.A.removeEvent(t,e,i["x_internal"+e][s].origin,i);0<i["x_internal"+e].length&&p.A.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var s,r,o,n=0,a=0;if(t=t||window.event,i=i||document,o=t.touches,u.A.exists(o)&&0===o.length&&(o=t.changedTouches),u.A.exists(e)&&u.A.exists(o))if(-1===e){for(r=o.length,s=0;s<r;s++)if(o[s]){t=o[s];break}}else t=o[e];return t.clientX&&(n=t.clientX,a=t.clientY),[n,a]},getOffset:function(t){for(var e,i=t,s=(o=t).offsetLeft-o.scrollLeft,r=o.offsetTop-o.scrollTop,s=(e=this.getCSSTransform([s,r],o))[0],r=e[1],o=o.offsetParent;o;){for(s+=o.offsetLeft,r+=o.offsetTop,o.offsetParent&&(s+=o.clientLeft-o.scrollLeft,r+=o.clientTop-o.scrollTop),s=(e=this.getCSSTransform([s,r],o))[0],r=e[1],i=i.parentNode;i!==o;)s+=i.clientLeft-i.scrollLeft,r+=i.clientTop-i.scrollTop,s=(e=this.getCSSTransform([s,r],i))[0],r=e[1],i=i.parentNode;o=o.offsetParent}return[s,r]},getStyle:function(t,e){var i,s=t.ownerDocument;return s.defaultView&&s.defaultView.getComputedStyle?i=s.defaultView.getComputedStyle(t,null).getPropertyValue(e):t.currentStyle&&9<=p.A.ieVersion?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){t=parseInt(this.getStyle(t,e),10);return isNaN(t)?0:t},getCSSTransform:function(t,e){for(var i,s,r,o,n=["transform","webkitTransform","MozTransform","msTransform","oTransform"],a=n.length,l=0,h="";l<a;l++)if(u.A.exists(e.style[n[l]])){h=e.style[n[l]];break}if(""!==h&&0<(s=h.indexOf("("))){for(a=h.length,i=0,r=(o=h.substring(s+1,a-1).split(",")).length;i<r;i++)o[i]=parseFloat(o[i]);0===h.indexOf("matrix")?(t[0]+=o[4],t[1]+=o[5]):0===h.indexOf("translateX")?t[0]+=o[0]:0===h.indexOf("translateY")?t[1]+=o[0]:0===h.indexOf("translate")&&(t[0]+=o[0],t[1]+=o[1])}return u.A.exists(e.style.zoom)&&""!==(h=e.style.zoom)&&(t[0]*=parseFloat(h),t[1]*=parseFloat(h)),t},getCSSTransformMatrix:function(t){var e,i,s,r,o,n,a=t.ownerDocument,l=["transform","webkitTransform","MozTransform","msTransform","oTransform"],h=[[1,0,0],[0,1,0],[0,0,1]];if(a.defaultView&&a.defaultView.getComputedStyle)s=(a=a.defaultView.getComputedStyle(t,null)).getPropertyValue("-webkit-transform")||a.getPropertyValue("-moz-transform")||a.getPropertyValue("-ms-transform")||a.getPropertyValue("-o-transform")||a.getPropertyValue("transform");else for(o=l.length,e=0,s="";e<o;e++)if(u.A.exists(t.style[l[e]])){s=t.style[l[e]];break}if(""!==s&&0<(a=s.indexOf("("))){for(o=s.length,i=0,n=(r=s.substring(a+1,o-1).split(",")).length;i<n;i++)r[i]=parseFloat(r[i]);0===s.indexOf("matrix")?h=[[1,0,0],[0,r[0],r[1]],[0,r[2],r[3]]]:0===s.indexOf("scaleX")?h[1][1]=r[0]:0===s.indexOf("scaleY")?h[2][2]=r[0]:0===s.indexOf("scale")&&(h[1][1]=r[0],h[2][2]=r[1])}return u.A.exists(t.style.zoom)&&""!==(s=t.style.zoom)&&(h[1][1]*=parseFloat(s),h[2][2]*=parseFloat(s)),h},timedChunk:function(e,i,s,r){function o(){for(var t=+new Date;i.call(s,n.shift()),0<n.length&&+new Date-t<300;);0<n.length?window.setTimeout(o,1):r(e)}var n=e.slice();window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,s){for(var r,o,n=(a=i.getElementById(t).getBoundingClientRect()).height,a=a.width,i=(o=i.getElementById(e))._cssFullscreenStore.w,l=(e=o._cssFullscreenStore.h)/i,h=i=n*s<(e=a*s<i?(i=a*s)*l:e)?(e=n*s)/l:i,u=l<n/a?a*s/i:n*s/e,c=.5*(n-(r=e)),d=0;d<4;d++)try{o.style.width=h+"px !important",o.style.height=r+"px !important",o.style.margin="0 auto",o.style.transform=o._cssFullscreenStore.transform+" matrix("+u+",0,0,"+u+",0,"+c+")";break}catch(t){p.A.debug("JXG.scaleJSXGraphDiv:\n"+t)}4===d&&p.A.debug("JXG.scaleJSXGraphDiv: Could not set any CSS property.")}}),e.A=p.A},454:function(t,e,i){var s=i(443),r=i(188);s.A.EventEmitter={eventHandlers:{},suspended:{},trigger:function(t,e){for(var i,s,r,o,n=t.length,a=0;a<n;a++)if(r=this.eventHandlers[t[a]],!this.suspended[t[a]]){if(this.suspended[t[a]]=!0,r)for(o=r.length,i=0;i<o;i++)(s=r[i]).handler.apply(s.context,e);this.suspended[t[a]]=!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){return t&&r.A.isArray(this.eventHandlers[t])&&(e?(-1<(e=r.A.indexOf(this.eventHandlers[t],e,"handler"))&&this.eventHandlers[t].splice(e,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t]),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},713:function(t,e,i){var s=i(443),n=i(188),r=i(561),o=i(904);s.A.Expect={each:function(t,e,i){var s,r,o=[];if(n.A.exists(t.length))for(r=t.length,s=0;s<r;s++)o.push(e.call(this,t[s],i));return o},coords:function(t,e){var i=t;return t&&t.elementClass===r.A.OBJECT_CLASS_POINT?i=t.coords:t.usrCoords&&t.scrCoords&&t.usr2screen&&(i=t),i=e?new o.A(r.A.COORDS_BY_USER,i.usrCoords,i.board):i},coordsArray:function(t,e){return(t=n.A.isArray(t)?t:this.coords(t).usrCoords).length<3&&t.unshift(1),t=e?[t[0],t[1],t[2]]:t}},e.A=s.A.Expect},188:function(t,e,i){var h=i(443),s=i(561),r=i(477);h.A.extend(h.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),s=i?s:s&&!isNaN(t)},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===s.A.OBJECT_CLASS_POINT},isPoint3D:function(t){return!(null===t||"object"!=typeof t||!this.exists(t.type))&&t.type===s.A.OBJECT_TYPE_POINT3D},isPointType:function(t,e){var i;return!!this.isArray(e)||!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&1<i.length))||(i=t.select(e),this.isPoint(i))},isPointType3D:function(t,e){var i;return!!(this.isArray(e)&&3<=e.length)||!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&3<=i.length))||(i=t.select(e),this.isPoint3D(i))},isTransformationOrArray:function(t){if(null!==t){if(this.isArray(t)&&0<t.length)return this.isTransformationOrArray(t[0]);if("object"==typeof t)return t.type===s.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){return this.isString(t)?(t='{"'+(t=(t=(t=t.replace(/\s*;\s*$/g,"")).replace(/\s*;\s*/g,'","')).replace(/\s*:\s*/g,'":"')).trim()+'"}',JSON.parse(t)):{}},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.trim()},createEvalFunction:function(t,e,i){for(var s,r,o=[],n={},a=0;a<i;a++)for(r in o[a]=h.A.createFunction(e[a],t),o[a].deps)n[r]=o[a].deps;return(s=function(t){return o[t]()}).deps=n,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)&&((r=function(){return t}).deps={}),null!==r&&(r.origin=t),r},providePoints:function(t,e,i,s,r){var o,n,a,l=0,h=[],u=(e=this.isArray(e)?e:[e]).length;for(0===(l=this.exists(r)?r.length:l)&&(n=this.copyAttributes(i,t.options,s)),o=0;o<u;++o)if(0<l&&(a=Math.min(o,l-1),n=this.copyAttributes(i,t.options,s,r[a].toLowerCase())),this.isArray(e[o])&&1<e[o].length?(h.push(t.create("point",e[o],n)),h[h.length-1]._is_new=!0):this.isFunction(e[o])?(a=e[o](),this.isArray(a)&&1<a.length&&(h.push(t.create("point",[e[o]],n)),h[h.length-1]._is_new=!0)):h.push(t.select(e[o])),!this.isPoint(h[o]))return!1;return h},providePoints3D:function(t,e,i,s,r){var o,n,a,l=0,h=[],u=(e=this.isArray(e)?e:[e]).length;for(0===(l=this.exists(r)?r.length:l)&&(n=this.copyAttributes(i,t.board.options,s)),o=0;o<u;++o)if(0<l&&(a=Math.min(o,l-1),n=this.copyAttributes(i,t.board.options,s,r[a])),this.isArray(e[o])&&1<e[o].length?(h.push(t.create("point3d",e[o],n)),h[h.length-1]._is_new=!0):this.isFunction(e[o])?(a=e[o](),this.isArray(a)&&1<a.length&&(h.push(t.create("point3d",[e[o]],n)),h[h.length-1]._is_new=!0)):h.push(t.select(e[o])),!this.isPoint3D(h[o]))return!1;return h},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){for(var e=t.length,i=[],s={},r=0;r<e;r++)s[t[r]]=0;for(r in s)s.hasOwnProperty(r)&&i.push(r);return i},swap:function(t,e,i){var s=t[e];return t[e]=t[i],t[i]=s,t},uniqueArray:function(t){var e,i,s,r=[];if(0===t.length)return[];for(e=0;e<t.length;e++)if(s=this.isArray(t[e]),this.exists(t[e]))for(i=e+1;i<t.length;i++)s&&h.A.cmpArrays(t[e],t[i])?t[e]=[]:s||t[e]!==t[i]||(t[e]="");else t[e]="";for(e=i=0;e<t.length;e++)(s=this.isArray(t[e]))||""===t[e]?s&&0!==t[e].length&&(r[i]=t[e].slice(0),i++):(r[i]=t[e],i++);return t=r},isInArray:function(t,e){return-1<h.A.indexOf(t,e)},coordsArrayToMatrix:function(t,e){for(var i=[],s=[],r=0;r<t.length;r++)e?(i.push(t[r].usrCoords[1]),s.push(t[r].usrCoords[2])):s.push([t[r].usrCoords[1],t[r].usrCoords[2]]);return s=e?[i,s]:s},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){for(var i=0;i<t.length;i++)if(t[i]===e)return t.splice(i,1),t;return t},trunc:function(t,e){return e=h.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.1<=e?this.toFixed(t,2):.01<=e?this.toFixed(t,4):1e-4<=e?this.toFixed(t,6):t},parseNumber:function(t,e,i){var s;return this.isString(t)&&-1<t.indexOf("%")?(s=t.replace(/\s+%\s+/,""),parseFloat(s)*e*.01):this.isString(t)&&-1<t.indexOf("fr")?(s=t.replace(/\s+fr\s+/,""),parseFloat(s)*e):this.isString(t)&&-1<t.indexOf("px")?(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);return s},clone:function(t){var e={};return e.prototype=t,e},cloneAndCopy:function(t,e){function i(){}for(var s in i.prototype=t,e)i[s]=e[s];return i},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 s,r,o,n,a,l=(o=arguments.length)<3||{circle:1,curve:1,foreignobject:1,image:1,line:1,point:1,polygon:1,text:1,ticks:1,integral:1}[i]?h.A.deepCopy(e.elements,null,!0):{};for(o<4&&this.exists(i)&&this.exists(e.layer[i])&&(l.layer=e.layer[i]),n=e,a=!0,r=2;r<o;r++){if(!this.exists(n[s=arguments[r]])){a=!1;break}n=n[s]}for(a&&(l=h.A.deepCopy(l,n,!0)),n="object"==typeof t?this.keysToLowerCase(t):{},a=!0,r=3;r<o;r++){if(s=arguments[r].toLowerCase(),!this.exists(n[s])){a=!1;break}n=n[s]}if(a&&this.mergeAttr(l,n,!0),"board"===i)return l;for(n=e,a=!0,r=2;r<o;r++){if(!this.exists(n[s=arguments[r]])){a=!1;break}n=n[s]}return a&&this.exists(n.label)&&(l.label=h.A.deepCopy(n.label,l.label,!0)),l.label=h.A.deepCopy(e.label,l.label,!0),l},copyPrototypeMethods:function(t,e,i){for(var s in t.prototype[i]=e.prototype.constructor,e.prototype)e.prototype.hasOwnProperty(s)&&(t.prototype[s]=e.prototype[s])},toJSON:function(t,e){var i,s,r,o;if(e=h.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(r=0;r<t.length;r++)i.push(h.A.toJSON(t[r],e));return"["+i.join(",")+"]"}for(s in t)if(t.hasOwnProperty(s)){try{o=h.A.toJSON(t[s],e)}catch(t){o=""}e?i.push(s+":"+o):i.push('"'+s+'":'+o)}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){for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e)return!0;return!1},escapeHTML:function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},unescapeHTML:function(t){return t.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()},trimNumber:function(t){return t="."!==(t="."!==(t=(t=t.replace(/^0+/,"")).replace(/0+$/,""))[t.length-1]&&","!==t[t.length-1]?t:t.slice(0,-1))[0]&&","!==t[0]?t:"0"+t},filterElements:function(t,e){var i,s,r,o,n,a,l=t.length,h=[];if("function"!=typeof e&&"object"!=typeof e)return h;for(i=0;i<l;i++){if(a=!0,r=t[i],"object"==typeof e){for(s in e)if(e.hasOwnProperty(s)&&(n=s.toLowerCase(),o="function"==typeof r[s]?r[s]():r[s],n=r.visProp&&"function"==typeof r.visProp[n]?r.visProp[n]():r.visProp&&r.visProp[n],!(a="function"==typeof e[s]?e[s](o)||e[s](n):o===e[s]||n===e[s])))break}else"function"==typeof e&&(a=e(r));a&&h.push(r)}return h},trim:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},toFraction:function(t,e,i){t=r.A.decToFraction(t,i),i="";return 0===t[1]&&0===t[2]?i+="0":(t[0]<0&&(i+="-"),0===t[2]?i+=t[1]:1===t[2]&&1===t[3]||(0!==t[1]&&(i+=t[1]+" "),i+=!0===e?"\\frac{"+t[2]+"}{"+t[3]+"}":t[2]+"/"+t[3])),i},concat:function(t,e){for(var i=e.length,s=0;s<i;s++)t.push(e[s]);return t},sanitizeHTML:function(t,e){return"function"==typeof html_sanitize&&e?html_sanitize(t,function(){},function(t){return t}):t=t&&"string"==typeof t?t.replace(/</g,"<").replace(/>/g,">"):t},evalSlider:function(t){return t&&t.type===s.A.OBJECT_TYPE_GLIDER&&"function"==typeof t.Value?t.Value():t},stack2jsxgraph:function(t){return t="["===(t=t.replace(/%pi/g,"PI").replace(/%e/g,"EULER").replace(/%phi/g,"1.618033988749895").replace(/%gamma/g,"0.5772156649015329").trim())[0]&&"]"===t[t.length-1]?t.slice(1,-1).split(/\s*,\s*/):t}}),e.A=h.A}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;e=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](e,e.exports,__webpack_require__),e.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__={},jxg=(__webpack_require__.d(__webpack_exports__,{default:function(){return src}}),__webpack_require__(443)),env=__webpack_require__(133),constants=__webpack_require__(561),utils_type=__webpack_require__(188),xml=(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){t=(new("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}})).parseFromString(t,"text/xml");return this.cleanWhitespace(t),t}},jxg.A.XML),utils_event=__webpack_require__(454),expect=__webpack_require__(713),math=__webpack_require__(477),probfuncs=(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;return t=Math.abs(t),e<0&&(t=-t),i=(s=this.MINV*Math.floor(this.M*t+.5))*s,s=2*s*(t=t-s)+t*t,e<0&&(i=-i,s=-s),i+s>this.MAXLOG?1/0:Math.exp(i)*Math.exp(s)},polevl:function(i,t,e){var s,r;if(utils_type.A.exists(t.reduce))return t.reduce(function(t,e){return t*i+e},0);for(s=r=0;r<=e;r++)s=s*i+t[r];return s},p1evl:function(i,t,e){var s,r;if(utils_type.A.exists(t.reduce))return t.reduce(function(t,e){return t*i+e},1);for(r=0,s=1;r<e;r++)s=s*i+t[r];return s},ndtr:function(t){var e,i,s=t*this.SQRTH;return(i=Math.abs(s))<1?e=.5+.5*this.erf(s):(e=.5*this.erfce(i),i=this.expx2(t,-1),e*=Math.sqrt(i),0<s&&(e=1-e)),e},_underflow:function(t){return console.log("erfc","UNDERFLOW"),t<0?2:0},erfc:function(t){var e,i,s;return(i=t<0?-t:t)<1?1-this.erf(t):-t*t<-this.MAXLOG?this._underflow(t):(s=this.expx2(t,-1),i=i<8?(e=this.polevl(i,this.P,8),this.p1evl(i,this.Q,8)):(e=this.polevl(i,this.R,5),this.p1evl(i,this.S,6)),s=s*e/i,0===(s=t<0?2-s:s)?this._underflow(t):s)},erfce:function(t){var e,t=t<8?(e=this.polevl(t,this.P,8),this.p1evl(t,this.Q,8)):(e=this.polevl(t,this.R,5),this.p1evl(t,this.S,6));return e/t},erf:function(t){return 1<Math.abs(t)?1-this.erfc(t):t*this.polevl(t=t*t,this.T,4)/this.p1evl(t,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;return t<=0?-1/0:1<=t?1/0:(i=1,.8646647167633873<(t=t)&&(t=1-t,i=0),.1353352832366127<t?(e=(t-=.5)+t*((e=t*t)*this.polevl(e,this.P0,4)/this.p1evl(e,this.Q0,8)))*this.s2pi:(t=1/(e=Math.sqrt(-2*Math.log(t))),e=e-Math.log(e)/e-(e<8?t*this.polevl(t,this.P1,8)/this.p1evl(t,this.Q1,8):t*this.polevl(t,this.P2,8)/this.p1evl(t,this.Q2,8)),e=0!==i?-e:e))},erfi:function(t){return this.ndtri(.5*(t+1))*this.SQRTH}},math.A.ProbFuncs),ia=__webpack_require__(733),extrapolate=(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;0<s;s--)r=o,o=i[s-1],n=i[s]-o,Math.abs(n)<=1e-15?i[s-1]=1e20:i[s-1]=+r+1/n;a=i[e%2]}return a},aitken:function(t,e,i){var s,r,o,n,a,l;if(i[e]=t,e<2)s=t;else{for(n=e/2,a=1;a<=n;a++)r=i[2+(l=e-2*a)]-2*i[1+l]+i[l],Math.abs(r)<1e-15?i[l]=1e20:(o=i[l]-i[1+l],i[l]-=o*o/r);s=i[e%2]}return s},brezinski:function(t,e,i){var s,r,o,n,a,l,h,u;if(i[e]=t,e<3)s=t;else{for(l=e/3,u=e,h=1;h<=l;h++)o=i[1+(u-=3)]-i[u],n=i[u+2]-i[u+1],r=(a=i[u+3]-i[u+2])*(n-o)-o*(a-n),Math.abs(r)<1e-15?i[u]=1e20:i[u]=i[u+1]-o*n*(a-n)/r;s=i[e%3]}return s},iteration:function(t,e,i,s,r){var o,n,a,l=NaN,h=[],u="finite",c=e;for(r=r||0,o=1;o<=this.upper;o++){if(n=i(t+(c=0===r?e/(o+1):.5*c),!0),a=this[s](n,o-1,h),isNaN(a)){u="NaN";break}if(0!==n&&a/n>this.infty){l=a,u="infinite";break}if(Math.abs(a-l)<1e-7)break;l=a}return[l,u,1-(o-1)/this.upper]},levin:function(t,e,i,s,r,o){var n,a,l,h=1/(s+e);if(r[e]=t/i,o[e]=1/i,0<e&&(r[e-1]=r[e]-r[e-1],o[e-1]=o[e]-o[e-1],1<e))for(l=(s+e-1)*h,n=2;n<=e;n++)a=(s+e-n)*Math.pow(l,n-2)*h,r[e-n]=r[e-n+1]-a*r[e-n],o[e-n]=o[e-n+1]-a*o[e-n],h*=l;return Math.abs(o[0])<1e-15?1e20:r[0]/o[0]},iteration_levin:function(t,e,i,s){var r,o,n,a,l,h=NaN,u=[],c=[],d="finite",p=e;for(s=s||0,n=i(t+e,!0),r=1;r<=this.upper;r++){if(l=(o=i(t+(p=0===s?e/(r+1):.5*p),!0))-n,l="u"==(Math.abs(l)<1?"u":"t")?(1+r)*l:l,a=(l=this.levin(n=o,r-1,l,1,u,c))-h,isNaN(l)){d="NaN";break}if(0!==o&&l/o>this.infty){h=l,d="infinite";break}if(Math.abs(a)<1e-7)break;h=l}return[h,d,1-(r-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}},math.A.Extrapolate),geometry=__webpack_require__(571),qdt=(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]))break;return!1;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,e=utils_type.A.exists(e)?(i=t,e):(i=t.usrCoords[1],t.usrCoords[2]);return this._query(i,e)},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))}}),math.A.Quadtree),bqdt=(math.A.BoxQuadtree=function(t,e,i){var s;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&&(t=i[0],e=i[1],s=i[2],i=i[3],this.cx=.5*(t+s),this.cy=.5*(e+i),this.bbox=[t,e,s,i])},utils_type.A.extend(math.A.BoxQuadtree.prototype,{insert:function(t){var e,i,s,r,o,n,a,l,h,u,c,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++)l=(a=t[e]).xlb<=this.cx&&a.yub>this.cy,u=a.xlb<=this.cx&&a.ylb<=this.cy,h=a.xub>this.cx&&a.yub>this.cy,c=a.xub>this.cx&&a.ylb<=this.cy,l&&h&&c&&u?this.items.push(a):(l&&d.push(a),u&&_.push(a),h&&p.push(a),c&&f.push(a));return this.subdivide(d,_,p,f,s,r,o,n),this},insertItem:function(t){var e,i,s,r,o,n,a,l,h=[],u=[],c=[],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):(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,l=t.xub>this.cx&&t.ylb<=this.cy,o&&n&&l&&a?this.items.push(t):(o&&h.push(t),a&&c.push(t),n&&u.push(t),l&&d.push(t)),this.subdivide(h,c,u,d,e,i,s,r)),this},subdivide:function(t,e,i,s,r,o,n,a){return 0<t.length&&(null===this.northWest&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,o,this.cx,this.cy])),this.northWest.insert(t)),0<e.length&&(null===this.southWest&&(this.southWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,this.cy,this.cx,a])),this.southWest.insert(e)),0<i.length&&(null===this.northEast&&(this.northEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,o,n,this.cy])),this.northEast.insert(i)),0<s.length&&(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){for(var e,i=[],s=this.items.length,r=0;r<s;r++)e=this.items[r],t[2]>=e.xlb&&t[0]<=e.xub&&t[3]<=e.yub&&t[1]>=e.ylb&&i.push(this.items[r]);return null!==this.northWest&&t[0]<=this.cx&t[1]>=this.cy&&utils_type.A.concat(i,this.northWest.find(t)),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&utils_type.A.concat(i,this.southWest.find(t)),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&utils_type.A.concat(i,this.northEast.find(t)),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&utils_type.A.concat(i,this.southEast.find(t)),i},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]}}),math.A.BoxQuadtree),numerics=__webpack_require__(171),nlp=(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(o,t,e,i,s,r,n,a,l){var h=e+2,u=this.arr(t+1),c=this;return this.lastNumberOfEvaluations=0,l&&console.log("Experimental feature 'testForRoundingErrors' is activated."),u[0]=0,this.arraycopy(i,0,u,1,t),e=this.cobylb(function(t,e,i,s){var r=c.arr(t);return c.lastNumberOfEvaluations=c.lastNumberOfEvaluations+1,c.arraycopy(i,1,r,0,t),i=c.arr(e),t=o(t,e,r,i),c.arraycopy(i,0,s,1,e),t},t,e,h,u,s,r,n,a,l),this.arraycopy(u,1,i,0,t),e},cobylb:function(L,t,e,i,s,B,I,r,Y,X){var o,n,a,l,h,u,U,c,d,p,_,f,A,g,F,z,J,G,W,H,V,$,K,m,q,Z,y,b,v,C=-1,x=0,P=0,E=t+1,O=e+1,M=B,w=0,Q=!1,tt=!1,et=0,it=0,st=0,S=this.arr(1+i),T=this.arr2(1+t,1+E),N=this.arr2(1+t,1+t),j=this.arr2(1+i,1+E),rt=this.arr2(1+t,1+O),D=this.arr(1+t),k=this.arr(1+t),ot=this.arr(1+t),R=this.arr(1+t),nt=this.arr(1+t);for(2<=r&&console.log("The initial value of RHO is "+M+" and PARMU is set to zero."),c=0,u=1/M,n=1;n<=t;++n)T[n][E]=s[n],T[n][n]=M,N[n][n]=u;d=E,p=!1;t:for(;;){if(Y<=c&&0<c){C=this.MaxIterationsReached;break}for(++c,x=L(t,e,s,S),P=0,l=1;l<=e;++l)P=Math.max(P,-S[l]);if(c!==r-1&&3!==r||this.PrintIterationResult(c,x,P,s,t,r),S[O]=x,S[i]=P,_=!0,!p){for(_=!1,n=1;n<=i;++n)j[n][d]=S[n];if(c<=E){if(d<=t)if(j[O][E]<=x)s[d]=T[d][E];else{for(T[d][E]=s[d],l=1;l<=i;++l)j[l][d]=j[l][E],j[l][E]=S[l];for(l=1;l<=d;++l){for(T[d][l]=-M,u=0,n=l;n<=d;++n)u-=N[n][l];N[d][l]=u}}if(c<=t){s[d=c]+=M;continue}}p=!0}e:for(;;){do{if(!_){for(f=j[O][E]+w*j[i][E],A=E,a=1;a<=t;++a)(u=j[O][a]+w*j[i][a])<f?(A=a,f=u):u===f&&0===w&&j[i][a]<j[i][A]&&(A=a);if(A<=t){for(n=1;n<=i;++n)u=j[n][E],j[n][E]=j[n][A],j[n][A]=u;for(n=1;n<=t;++n){for(u=T[n][A],T[n][A]=0,T[n][E]+=u,U=0,l=1;l<=t;++l)T[n][l]-=u,U-=N[l][n];N[A][n]=U}}if(g=0,X)for(n=1;n<=t;++n)for(a=1;a<=t;++a)u=this.DOT_PRODUCT_ROW_COL(N,n,T,a,1,t)-(n===a?1:0),g=Math.max(g,Math.abs(u));if(.1<g){C=this.DivergingRoundingErrors;break t}for(l=1;l<=O;++l){for(S[l]=-j[l][E],a=1;a<=t;++a)nt[a]=j[l][a]+S[l];for(n=1;n<=t;++n)rt[n][l]=(l===O?-1:1)*this.DOT_PRODUCT_ROW_COL(nt,-1,N,n,1,t)}for(Q=!0,et=.25*M,F=2.1*M,a=1;a<=t;++a){for(J=z=0,l=1;l<=t;++l)z+=N[a][l]*N[a][l],J+=T[l][a]*T[l][a];D[a]=1/Math.sqrt(z),k[a]=Math.sqrt(J),(D[a]<et||k[a]>F)&&(Q=!1)}if(!p&&!Q){for(d=0,u=F,a=1;a<=t;++a)k[a]>u&&(u=k[d=a]);if(0===d)for(a=1;a<=t;++a)D[a]<u&&(u=D[d=a]);for(u=.5*M*D[d],l=1;l<=t;++l)R[l]=u*N[d][l];for(o=W=G=0,l=1;l<=O;++l)o=this.DOT_PRODUCT_ROW_COL(R,-1,rt,l,1,t),l<O&&(u=j[l][E],G=Math.max(G,-o-u),W=Math.max(W,o-u));for(H=2*o<w*(G-W)?-1:1,u=0,n=1;n<=t;++n)R[n]=H*R[n],T[n][d]=R[n],u+=N[d][n]*R[n];for(l=1;l<=t;++l)N[d][l]/=u;for(a=1;a<=t;++a){if(a!==d)for(u=this.DOT_PRODUCT_ROW_COL(N,a,R,-1,1,t),l=1;l<=t;++l)N[a][l]-=u*N[d][l];s[a]=T[a][E]+R[a]}continue t}if(!(tt=this.trstlp(t,e,rt,S,M,R))){for(u=0,l=1;l<=t;++l)u+=R[l]*R[l];if(u<.25*M*M){p=!0;break}}for(S[O]=V=o=0,l=1;l<=O;++l)o=S[l]-this.DOT_PRODUCT_ROW_COL(R,-1,rt,l,1,t),l<O&&(V=Math.max(V,o));if(w<1.5*($=0<(it=j[i][E]-V)?o/it:0))for(w=2*$,2<=r&&console.log("Increase in PARMU to "+w),K=j[O][E]+w*j[i][E],a=1;a<=t;++a)if((u=j[O][a]+w*j[i][a])<K||u===K&&0===w&&j[i][a]<j[i][E])continue e;for(st=w*it-o,l=1;l<=t;++l)s[l]=T[l][E]+R[l];p=!0;continue t}for(_=!1,m=j[O][E]+w*j[i][E]-(x+w*P),0===w&&x===j[O][E]&&(st=it,m=j[i][E]-P),q=m<=0?1:0,d=0,a=1;a<=t;++a)(u=Math.abs(this.DOT_PRODUCT_ROW_COL(N,a,R,-1,1,t)))>q&&(d=a,q=u),ot[a]=u*D[a];for(Z=1.1*M,h=0,a=1;a<=t;++a)if(ot[a]>=et||ot[a]>=D[a]){if(u=k[a],0<m){for(u=0,l=1;l<=t;++l)u+=Math.pow(R[l]-T[l][a],2);u=Math.sqrt(u)}Z<u&&(h=a,Z=u)}if(0!==(d=0<h?h:d)){for(u=0,n=1;n<=t;++n)T[n][d]=R[n],u+=N[d][n]*R[n];for(l=1;l<=t;++l)N[d][l]/=u;for(a=1;a<=t;++a)if(a!==d)for(u=this.DOT_PRODUCT_ROW_COL(N,a,R,-1,1,t),l=1;l<=t;++l)N[a][l]-=u*N[d][l];for(l=1;l<=i;++l)j[l][d]=S[l];if(0<m&&.1*st<=m)continue e}}while(0);if(Q){if(M<=I){C=this.Normal;break t}if((M*=.5)<=1.5*I&&(M=I),(b=y=0)<w){for(v=0,l=1;l<=O;++l){for(b=y=j[l][E],n=1;n<=t;++n)y=Math.min(y,j[l][n]),b=Math.max(b,j[l][n]);l<=e&&y<.5*b&&(u=Math.max(b,0)-y,v=v<=0?u:Math.min(v,u))}0===v?w=0:b-y<w*v&&(w=(b-y)/v)}2<=r&&console.log("Reduction in RHO to "+M+" and PARMU = "+w),2===r&&this.PrintIterationResult(c,j[O][E],j[i][E],this.COL(T,E),t,r)}else p=!1}}switch(C){case this.Normal:if(1<=r&&console.log("%nNormal return from subroutine COBYLA%n"),tt)return 1<=r&&this.PrintIterationResult(c,x,P,s,t,r),C;break;case this.MaxIterationsReached:1<=r&&console.log("%nReturn from subroutine COBYLA because the MAXFUN limit has been reached.%n");break;case this.DivergingRoundingErrors:1<=r&&console.log("%nReturn from subroutine COBYLA because rounding errors are becoming damaging.%n")}for(l=1;l<=t;++l)s[l]=T[l][E];return x=j[O][E],P=j[i][E],1<=r&&this.PrintIterationResult(c,x,P,s,t,r),C},trstlp:function(t,e,i,s,L,r){for(var o,n,a,B,I,l,h,Y,X,u,U,F,c,d,p,_,f,A,g,m,y,b,v,z,J,C,G,x,P,W,H,V,E=0,$=0,K=0,O=this.arr2(1+t,1+t),M=this.arr(2+e),w=this.arr(2+e),S=this.arr(1+t),T=this.arr(1+t),N=this.arr(2+e),j=this.arr(2+e),D=e,k=0,R=1;R<=t;++R)O[R][R]=1,r[R]=0;if(n=o=0,1<=e){for(a=1;a<=e;++a)s[a]>n&&(n=s[a],o=a);for(a=1;a<=e;++a)w[j[a]=a]=n-s[a]}B=!0;do{t:for(;;){B&&0!==n||(o=D=e+1,w[j[D]=D]=0),B=!1,Y=h=l=I=0;do{if(X=D===e?n:-this.DOT_PRODUCT_ROW_COL(r,-1,i,D,1,t),0===l||X<I?(I=X,$=k,l=3):$<k?($=k,l=3):--l,0===l)break t;if(u=0,o<=k){if(o<k){U=j[o],F=w[o],a=o;do{for(p=j[d=a+1],_=this.DOT_PRODUCT(this.PART(this.COL(O,a),1,t),this.PART(this.COL(i,p),1,t)),E=math.A.hypot(_,M[d]),f=M[d]/E,A=_/E,M[d]=f*M[a],M[a]=E,R=1;R<=t;++R)E=f*O[R][d]+A*O[R][a],O[R][d]=f*O[R][a]-A*O[R][d],O[R][a]=E}while(j[a]=p,w[a]=w[d],(a=d)<k);j[a]=U,w[a]=F}if(--k,e<D)for(E=1/M[k],a=1;a<=t;++a)S[a]=E*O[a][k];else for(E=this.DOT_PRODUCT_ROW_COL(S,-1,O,k+1,1,t),a=1;a<=t;++a)S[a]-=E*O[a][k+1]}else{for(p=j[o],a=1;a<=t;++a)T[a]=i[a][p];for(g=0,a=t;k<a;){for(m=_=0,R=1;R<=t;++R)_+=E=O[R][a]*T[R],m+=Math.abs(E);if(y=m+.1*Math.abs(_),b=m+.2*Math.abs(_),(y<=m||b<=y)&&(_=0),0===g)g=_;else for(d=a+1,f=_/(E=math.A.hypot(_,g)),A=g/E,g=E,R=1;R<=t;++R)E=f*O[R][a]+A*O[R][d],O[R][d]=f*O[R][d]-A*O[R][a],O[R][a]=E;--a}if(0===g){u=-1,a=k;do{for(z=v=0,R=1;R<=t;++R)v+=E=O[R][a]*T[R],z+=Math.abs(E);if(y=z+.1*Math.abs(v),b=z+.2*Math.abs(v),z<y&&y<b){if(0<(E=v/M[a])&&j[a]<=e&&(V=w[a]/E,(u<0||V<u)&&(u=V)),2<=a)for(J=j[a],R=1;R<=t;++R)T[R]-=E*i[R][J];N[a]=E}else N[a]=0}while(0<--a);if(u<0)break t;for(a=1;a<=k;++a)w[a]=Math.max(0,w[a]-u*N[a]);if(o<k){U=j[o],F=w[o],a=o;do{for(J=j[d=a+1],_=this.DOT_PRODUCT(this.PART(this.COL(O,a),1,t),this.PART(this.COL(i,J),1,t)),E=math.A.hypot(_,M[d]),f=M[d]/E,A=_/E,M[d]=f*M[a],M[a]=E,R=1;R<=t;++R)E=f*O[R][d]+A*O[R][a],O[R][d]=f*O[R][a]-A*O[R][d],O[R][a]=E}while(j[a]=J,w[a]=w[d],(a=d)<k);j[a]=U,w[a]=F}if(0===(E=this.DOT_PRODUCT(this.PART(this.COL(O,k),1,t),this.PART(this.COL(i,p),1,t))))break t;M[k]=E,w[o]=0,w[k]=u}else M[++k]=g,w[o]=w[k],w[k]=0;if(j[o]=j[k],j[k]=p,e<D&&p!==D){for(_=this.DOT_PRODUCT(this.PART(this.COL(O,a=k-1),1,t),this.PART(this.COL(i,p),1,t)),E=math.A.hypot(_,M[k]),f=M[k]/E,A=_/E,M[k]=f*M[a],M[a]=E,R=1;R<=t;++R)E=f*O[R][k]+A*O[R][a],O[R][k]=f*O[R][a]-A*O[R][k],O[R][a]=E;j[k]=j[a],j[a]=p,E=w[a],w[a]=w[k],w[k]=E}if(e<D)for(E=1/M[k],a=1;a<=t;++a)S[a]=E*O[a][k];else for(p=j[k],E=(this.DOT_PRODUCT_ROW_COL(S,-1,i,p,1,t)-1)/M[k],a=1;a<=t;++a)S[a]-=E*O[a][k]}for(C=L*L,G=x=0,R=1;R<=t;++R)Math.abs(r[R])>=1e-6*L&&(C-=r[R]*r[R]),x+=r[R]*S[R],G+=S[R]*S[R];if(C<=0)break t;if(E=Math.sqrt(G*C),h=Y=C/((E=Math.abs(x)>=1e-6*E?Math.sqrt(G*C+x*x):E)+x),D===e){if(b=h+.2*n,h>=(y=h+.1*n)||b<=y)break;h=Math.min(h,n)}for(a=1;a<=t;++a)T[a]=r[a]+h*S[a];if(D===e)for(K=n,n=0,a=1;a<=k;++a)E=s[p=j[a]]-this.DOT_PRODUCT_ROW_COL(T,-1,i,p,1,t),n=Math.max(n,E);a=k;do{for(W=P=0,R=1;R<=t;++R)P+=E=O[R][a]*T[R],W+=Math.abs(E);if(y=W+.1*Math.abs(P),b=W+.2*Math.abs(P),N[a]=(P=y<=W||b<=y?0:P)/M[a],2<=a)for(p=j[a],R=1;R<=t;++R)T[R]-=N[a]*i[R][p]}while(2<=a--);for(e<D&&(N[k]=Math.max(0,N[k])),a=1;a<=t;++a)T[a]=r[a]+h*S[a];if(k<D)for(a=k+1;a<=D;++a){for(c=n-s[p=j[a]],H=n+Math.abs(s[p]),R=1;R<=t;++R)c+=E=i[R][p]*T[R],H+=Math.abs(E);y=H+.1*Math.abs(c),b=H+.2*Math.abs(c),N[a]=c=y<=H||b<=y?0:c}for(o=0,a=u=1;a<=D;++a)N[a]<0&&(E=w[a]/(w[a]-N[a]))<u&&(u=E,o=a);for(E=1-u,a=1;a<=t;++a)r[a]=E*r[a]+u*T[a];for(a=1;a<=D;++a)w[a]=Math.max(0,E*w[a]+u*N[a])}while(D===e&&(n=K+u*(n-K)),0<o);if(h===Y)return!0}}while(D===e);return!1},PrintIterationResult:function(t,e,i,s,r,o){1<o&&console.log("NFVALS = "+t+" F = "+e+" MAXCV = "+i),1<o&&console.log("X = "+this.PART(s,1,r))},ROW:function(t,e){return t[e].slice()},COL:function(t,e){for(var i=t.length,s=[],r=0;r<i;++r)s[r]=t[r][e];return s},PART:function(t,e,i){return t.slice(e,i+1)},FORMAT:function(t){return t.join(",")},DOT_PRODUCT:function(t,e){for(var i=0,s=t.length,r=0;r<s;++r)i+=t[r]*e[r];return i},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}},jxg.A.Math.Nlp),base_coords=__webpack_require__(904),statistics=__webpack_require__(588),plot=(math.A.Plot={checkReal:function(t){for(var e,i=!1,s=t.length,r=0;r<s;r++)if(e=t[r].usrCoords,!isNaN(e[1])&&!isNaN(e[2])&&Math.abs(e[0])>math.A.eps){i=!0;break}return i},updateParametricCurveNaive:function(t,e,i,s){for(var r,o=!1,n=(i-e)/s,a=0;a<s;a++)t.points[a].setCoordinates(constants.A.COORDS_BY_USER,[t.X(r=e+a*n,o),t.Y(r,o)],!1),t.points[a]._t=r,o=!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,l,h,u,c,d,p,_,f,A,g,m,y=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),b=[],v=[],C=[],x=[],P=!1,E=0;for(jxg.A.deprecated("Curve.updateParametricCurveOld()"),p=t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(c=15,d=10):(c=21,d=.7),x[0]=i-e,s=1;s<c;s++)x[s]=.5*x[s-1];b[0]=s=1,v[0]=0,y.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r=e,!1),t.Y(r,!1)],!1),a=y.scrCoords[1],l=y.scrCoords[2],y.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r=i,!0),t.Y(r,!0)],!1),o=y.scrCoords[1],n=y.scrCoords[2],C[0]=[o,n],h=1,u=0,t.points=[],t.points[E++]=new base_coords.A(constants.A.COORDS_BY_SCREEN,[a,l],t.board,!1);do{for(P=this.isDistOK(o-a,n-l,d,p)||this.isSegmentOutside(a,l,o,n,t.board);u<c&&(!P||u<6)&&(u<=7||this.isSegmentDefined(a,l,o,n));)b[h]=s,v[h]=u,C[h]=[o,n],h+=1,r=e+(s=2*s-1)*x[++u],y.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1,!0),o=y.scrCoords[1],n=y.scrCoords[2],P=this.isDistOK(o-a,n-l,d,p)||this.isSegmentOutside(a,l,o,n,t.board);1<E&&(_=t.points[E-2].scrCoords,f=[o,n],A=t.points[E-1].scrCoords,m=g=void 0,g=A[1]-_[1],A=A[2]-_[2],m=f[0]-_[1],f=f[1]-_[2],(_=m*m+f*f)>=math.A.eps&&0<(_=(g*m+A*f)/_)&&(_<=1?(g-=_*m,A-=_*f):(g-=m,A-=f)),math.A.hypot(g,A)<.015)&&--E,t.points[E]=new base_coords.A(constants.A.COORDS_BY_SCREEN,[o,n],t.board,!1),t.points[E]._t=r,E+=1,a=o,l=n,o=C[--h][0],n=C[h][1],u=v[h]+1,s=2*b[h]}while(0<h&&E<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;(!(r=r&&-500<e.scrCoords[1]&&-500<e.scrCoords[2]&&e.scrCoords[1]<o+500&&e.scrCoords[2]<n+500)&&s||r&&(!s||.7<Math.abs(e.scrCoords[1]-this._lastCrds[1])||.7<Math.abs(e.scrCoords[2]-this._lastCrds[2])))&&(e._t=i,t.points.push(e),this._lastCrds=e.copy("scrCoords"))},neighborhood_isNaN_v2:function(t,e){var i,s=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),r=e+math.A.eps;return s.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1),i=s.usrCoords,!(!isNaN(i[1]+i[2])&&(r=e-math.A.eps,s.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1),i=s.usrCoords,!isNaN(i[1]+i[2])))},_borderCase:function(t,e,i,s,r,o,n,a){var l,h,u,c,d,p,_,f=null;if(a<=1){if(h=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;c=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}}while(h.setCoordinates(constants.A.COORDS_BY_USER,[t.X(l=.5*(d+p),!0),t.Y(l,!0)],!1),u=h.usrCoords,(_=isNaN(u[1]+u[2]))?d=l:p=l,++c,_&&c<30);if(c<30&&(f=u.slice(),s=u.slice(),p=l),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,l,h,u,c,d=0,p=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);if(!(65536<t.numberPoints))return o<this.nanLevel&&this._isUndefined(t,e,i,s,r)||o<this.nanLevel&&this._isOutside(e,i,s,r,t.board)||(p.setCoordinates(constants.A.COORDS_BY_USER,[t.X(a=.5*(i+r),!0),t.Y(a,!0)],!1),l=p.scrCoords,this._borderCase(t,e,s,l,i,r,a,o)||(h=this._triangleDists(e,s,l),u=o<this.smoothLevel&&h[3]<n,c=o<=this.jumpLevel&&(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))||o<this.jumpLevel&&(h[2]>.99*h[0]||h[1]>.99*h[0]||h[0]===1/0||h[1]===1/0||h[2]===1/0),o<this.smoothLevel+2&&h[0]<.5*(h[1]+h[2])&&(d=0,u=!1),--o,c?this._insertPoint_v2(t,new base_coords.A(constants.A.COORDS_BY_SCREEN,[NaN,NaN],t.board,!1),a):o<=d||u?this._insertPoint_v2(t,p,a):(this._plotRecursive_v2(t,e,i,l,a,o,n),isNaN(p.scrCoords[1]+p.scrCoords[2])||this._insertPoint_v2(t,p,a),this._plotRecursive_v2(t,l,a,s,r,o,n)))),this},updateParametricCurve_v2:function(t,e,i){var s,r,o,n,a,l=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),h=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1);return t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(r=utils_type.A.evaluate(t.visProp.recursiondepthlow)||13,o=2,this.smoothLevel=r-6,this.jumpLevel=3):(r=utils_type.A.evaluate(t.visProp.recursiondepthhigh)||17,o=2,this.smoothLevel=r-9,this.jumpLevel=2),this.nanLevel=r-4,t.points=[],n="x"===this.xterm?(a=.3*((n=t.board.getBoundingBox())[2]-n[0]),s=Math.max(e,n[0]-a),Math.min(i,n[2]+a)):(s=e,i),l.setCoordinates(constants.A.COORDS_BY_USER,[t.X(s,!1),t.Y(s,!1)],!1),h.setCoordinates(constants.A.COORDS_BY_USER,[t.X(n,!0),t.Y(n,!0)],!1),a=this._findStartPoint(t,l.scrCoords,s,h.scrCoords,n),l.setCoordinates(constants.A.COORDS_BY_SCREEN,a[0],!1),s=a[1],a=this._findStartPoint(t,h.scrCoords,n,l.scrCoords,s),h.setCoordinates(constants.A.COORDS_BY_SCREEN,a[0],!1),n=a[1],this._visibleArea=[s,n],e=l.copy("scrCoords"),i=h.copy("scrCoords"),l._t=s,t.points.push(l),this._lastCrds=l.copy("scrCoords"),this._plotRecursive_v2(t,e,s,i,n,r,o),h._t=n,t.points.push(h),t.numberPoints=t.points.length,t},_insertLimesPoint:function(t,e,i,s,r){var o;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)||((o=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(o)),(e=new base_coords.A(constants.A.COORDS_BY_USER,[r.right_x,r.right_y],t.board))._t=i,t.points.push(e),this._lastScrCrds=e.copy("scrCoords"),this._lastUsrCrds=e.copy("usrCoords"))},_insertPoint:function(t,e,i,s,r){var o=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),n=!isNaN(e[1]+e[2]),a=t.board.canvasWidth,l=t.board.canvasHeight;utils_type.A.exists(r)?this._insertLimesPoint(t,e,i,s,r):(n=n&&-500<e[1]&&-500<e[2]&&e[1]<a+500&&e[2]<l+500,!o&&!n||n&&o&&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||((s=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(s),this._lastScrCrds=s.copy("scrCoords"),this._lastUsrCrds=s.copy("usrCoords")))},_triangleDists:function(t,e,i){var s=[t[0]*e[0],.5*(t[1]+e[1]),.5*(t[2]+e[2])];return[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=r.canvasWidth,r=r.canvasHeight;return!!(t[1]<-500&&i[1]<-500||t[2]<-500&&i[2]<-500||t[1]>o+500&&i[1]>o+500||t[2]>r+500&&i[2]>r+500)},_isOutsidePoint:function(t,e){var i=e.canvasWidth,e=e.canvasHeight;return!!(t[1]<-500||t[2]<-500||t[1]>i+500||t[2]>e+500)},_findStartPoint:function(t,e,i,s,r){return[e,i]},_getBorderPos:function(t,e,i,s,r,o,n){var a,l,h,u,c=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),d=0;if(isNaN(i[1]+i[2])&&!isNaN(r[1]+r[2]))u=e,h=s;else if(isNaN(n[1]+n[2])&&!isNaN(r[1]+r[2]))u=o,h=s;else if(isNaN(r[1]+r[2])&&!isNaN(n[1]+n[2]))u=s,h=o;else{if(!isNaN(r[1]+r[2])||isNaN(i[1]+i[2]))return!1;u=s,h=e}for(;c.setCoordinates(constants.A.COORDS_BY_USER,[t.X(a=.5*(h+u),!0),t.Y(a,!0)],!1),l=c.usrCoords,isNaN(l[1]+l[2])?u=a:h=a,++d<30&&Math.abs(h-u)>math.A.eps;);return a},_getCuspPos:function(e,t,i){var s=[e.X(t,!0),e.Y(t,!0)],r=[e.X(i,!0),e.Y(i,!0)];return numerics.A.fminbr(function(t){t=[e.X(t,!0),e.Y(t,!0)];return-(math.A.hypot(s[0]-t[0],s[1]-t[1])+math.A.hypot(r[0]-t[0],r[1]-t[1]))},[t,i],e)},_getJumpPos:function(s,t,e){return numerics.A.fminbr(function(t){var e=math.A.eps*math.A.eps,i=[s.X(t,!0),s.Y(t,!0)],t=[s.X(t+e,!0),s.Y(t+e,!0)];return-Math.abs((t[1]-i[1])/(t[0]-i[0]))},[t,e],s)},_getLimits:function(t,e){var i,s,r,o=2/(t.maxX()-t.minX()),n=(i=extrapolate.limit(e,-o,t.X))[0];return"infinite"===i[1]&&(n=Math.sign(n)*(1/0)),r=(i=extrapolate.limit(e,-o,t.Y))[0],"infinite"===i[1]&&(r=Math.sign(r)*(1/0)),s=(i=extrapolate.limit(e,o,t.X))[0],"infinite"===i[1]&&(s=Math.sign(s)*(1/0)),o=(i=extrapolate.limit(e,o,t.Y))[0],{left_x:n,left_y:r,right_x:s,right_y:o="infinite"===i[1]?Math.sign(o)*(1/0):o,t:e}},_getLimes:function(t,e,i,s,r,o,n,a,l){var h;return"border"===a?h=this._getBorderPos(t,e,i,s,r,o,n):"cusp"===a?h=this._getCuspPos(t,e,o):"jump"===a&&(h=this._getJumpPos(t,e,o)),this._getLimits(t,h)},_plotNonRecursive:function(t,e,i,s,r,o){var n,a,l,h,u,c,d,p=null,_=!1,f="",A=[],g=0,m=t.board.origin.scrCoords;for(A[g++]=[e,i,s,r,o,1/0];0<g;){if(e=(d=A[--g])[0],i=d[1],s=d[2],r=d[3],c=d[4],d=d[5],_=!1,f="",p=null,65536<t.points.length)return;if(c<this.nanLevel){if(this._isUndefined(t,e,i,s,r))continue;if(this._isOutside(e,i,s,r,t.board))continue}h=t.X(n=.5*(i+r),!0),u=t.Y(n,!0),h=[1,m[1]+h*t.board.unitX,m[2]-u*t.board.unitY],u=this._triangleDists(e,s,h),a=isNaN(e[1]+e[2]),l=isNaN(s[1]+s[2]),a&&!l||!a&&l?f="border":u[0]>.66*d||u[0]<this.cusp_threshold*(u[1]+u[2])||u[1]>5*u[2]||u[2]>5*u[1]?f="cusp":(u[2]>this.jump_threshold*u[0]||u[1]>this.jump_threshold*u[0]||u[0]===1/0||u[1]===1/0||u[2]===1/0)&&(f="jump"),_=""===f&&c<this.smoothLevel&&u[3]<this.smooth_threshold,c<this.testLevel&&!_&&(""===f?_=!0:p=this._getLimes(t,i,e,n,h,r,s,f,c)),null!==p?this._insertPoint(t,h=[1,NaN,NaN],n,c,p):c<=0||_?this._insertPoint(t,h,n,c,null):(A[g++]=[h,n,s,r,c-1,u[0]],A[g++]=[e,i,h,n,c-1,u[0]])}return this},updateParametricCurve_v3:function(t,e,i){var s,r,o,n=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),a=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],t.board,!1),l=t.board.updateQuality===t.board.BOARD_QUALITY_LOW?utils_type.A.evaluate(t.visProp.recursiondepthlow)||14:utils_type.A.evaluate(t.visProp.recursiondepthhigh)||17;return this.smoothLevel=7,this.nanLevel=l-4,this.testLevel=4,this.cusp_threshold=.5,this.jump_threshold=.99,this.smooth_threshold=2,t.points=[],r="x"===t.xterm?(o=.3*((r=t.board.getBoundingBox())[2]-r[0]),s=Math.max(e,r[0]-o),Math.min(i,r[2]+o)):(s=e,i),n.setCoordinates(constants.A.COORDS_BY_USER,[t.X(s,!1),t.Y(s,!1)],!1),a.setCoordinates(constants.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1),o=this._findStartPoint(t,n.scrCoords,s,a.scrCoords,r),n.setCoordinates(constants.A.COORDS_BY_SCREEN,o[0],!1),s=o[1],o=this._findStartPoint(t,a.scrCoords,r,n.scrCoords,s),a.setCoordinates(constants.A.COORDS_BY_SCREEN,o[0],!1),r=o[1],this._visibleArea=[s,r],e=n.copy("scrCoords"),i=a.copy("scrCoords"),n._t=s,t.points.push(n),this._lastScrCrds=n.copy("scrCoords"),this._lastUsrCrds=n.copy("usrCoords"),this._plotNonRecursive(t,e,s,i,r,l),a._t=r,t.points.push(a),t.numberPoints=t.points.length,t},_criticalInterval:function(t,e,i){var s,r,o,n,a,l,h=!1,u=-1/0,c=!1,d=!1,p=0,_=[],f=[],A=[],g=statistics.A.abs(t);for((n=statistics.A.median(g))<1e-7?(n=1e-7,c=!0):n*=this.criticalThreshold,s=0;s<e;s++)g[s]>n?(A.push({i:s,v:t[s],group:p}),u=s,h=h||!0):h&&u+4<s&&(0<A.length&&_.push(A.slice(0)),h=!(A=[]),p++);for(h&&1<A.length&&_.push(A.slice(0)),c&&0===_.length&&(d=!0),r=0;r<_.length;r++)if(f[r]="point",!((o=_[r].length)<64)){for(l=0,a=Math.sign(_[r][0].v),s=1;s<o;s++)Math.sign(_[r][s].v)!==a&&(l++,a=Math.sign(_[r][s].v));o<6*l&&(f[r]="interval")}return{smooth:d,groups:_,types:f}},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,l,h=[],u=0,c=0,d=0,p=!1,_=!1,f=(i-e)/s;for(h[u]=new this.Component,l=h[u],r=0,o=e;r<=s;r++,o+=f)n=t.X(o,_),a=t.Y(o,_),isNaN(n)||isNaN(a)?1<++d&&p&&(l.right_isNaN=!0,l.right_t=o-f,l.len=c,p=!1,h[++u]=new this.Component,l=h[u],d=0):(p||(p=!0,(c=0)<d&&(l.left_t=o-f,l.left_isNaN=!0)),d=0,l.t_values[c]=o,l.x_values[c]=n,l.y_values[c]=a,c++),0===r&&(_=!0);return p?l.len=c:h.pop(),h},getPointType:function(t,e,i,s,r,o,n){var r=r[0],o=o[0],a=s.length,i={idx:e,t:i,x:r[e],y:o[e],type:"other"};return e<5?(i.type="borderleft",i.idx=0,i.t=s[0],i.x=r[0],i.y=o[0]):n-6<e&&(i.type="borderright",i.idx=a-1,i.t=s[a-1],i.x=r[a-1],i.y=o[a-1]),i},newtonApprox:function(t,e,i,s,r){for(var o=0,n=s;0<n;n--)o=(o+r[n][t])*(e-(n-1)*i)/n;return o+r[0][t]},thiele:function(t,e,i,s,r){for(var o=0,n=r;1<n;n--)o=(t-i[s+n])/(e[n][s+1]-e[n-2][s+1]+o);return e[0][s+1]+(t-i[s+1])/(e[1][s+1]+o)},differenceMethodExperiments:function(t,e){var i,s,r,o,n,a,l,h,u,c,d=t.t_values,p=t.x_values,_=t.y_values,f=[],A=[],g=[],m=[],y=[],b=[],v=[],C=[],x=0,P=[],E=d[1]-d[0];for(y.push([]),b.push([]),v.push([]),C.push([]),r=_.length,i=0;i<r;i++)y[0][i]=p[i],b[0][i]=_[i],v[0][i]=p[i],C[0][i]=_[i];for(y.push([]),b.push([]),v.push([]),C.push([]),n=E,r=_.length-1,i=0;i<r;i++)f[i]=p[i+1]-p[i],A[i]=_[i+1]-_[i],g[i]=f[i],m[i]=A[i],y[1][i]=f[i],b[1][i]=A[i],v[1][i]=n/f[i],C[1][i]=n/A[i];for(r--,o=Math.min(8,_.length-1),s=1;s<o;s++){for(y.push([]),b.push([]),v.push([]),C.push([]),n*=E,i=0;i<r;i++)f[i]=f[i+1]-f[i],A[i]=A[i+1]-A[i],y[s+1][i]=f[i],b[s+1][i]=A[i],v[s+1][i]=n/(v[s][i+1]-v[s][i])+v[s-1][i+1],C[s+1][i]=n/(C[s][i+1]-C[s][i])+C[s-1][i+1];if(!1===(c=this._criticalPoints(A,r,s))){console.log("Polynomial of degree",s),c=[];break}if(0<c.length&&1<++x&&s%2==0)break;r--}for(i=0;i<c.length;i++){for(l=-1/0,h=0;h<c[i].length;h++)(u=Math.abs(c[i][h].v))>l&&(l=u,a=h);a=Math.floor(c[i][a].i+s/2),P.push(this.getPointType(e,a,d,p,_,g,m,r+1))}return[P,y,b,v,C]},getCenterOfCriticalInterval:function(t,e,i){for(var s,r,o,n=0,a=0,l=i[1]-i[0],h=[],u=-1/0,h=[],c=0;c<t.length;c++)(r=Math.abs(t[c].v))>u?(h=[c],u=r,s=c):u===r&&h.push(c);if(0<h.length&&(o=h.reduce(function(t,e){return t+e},0)/h.length,s=Math.floor(o),o+=t[0].i),u<1/0){for(c=0;c<t.length;c++)n+=Math.abs(t[c].v)*t[c].i,a+=Math.abs(t[c].v);o=n/a}return[t[s].i+e/2,o+=e/2,i[Math.floor(o)]+l*(o-Math.floor(o))]},differenceMethod:function(t,e){var i,s,r,o,n,a,l,h,u=t.t_values,c=t.x_values,t=t.y_values,d=[],p=[],_=0,f=-1,A=-1,g=[],m=[],y=t.length;for(d.push(new Float64Array(c)),p.push(new Float64Array(t)),y--,r=Math.min(12,y),s=0;s<r&&(d.push(new Float64Array(y)),p.push(new Float64Array(y)),d[s+1]=d[s].map(function(t,e,i){return i[e+1]-t}),p[s+1]=p[s].map(function(t,e,i){return i[e+1]-t}),!0===(a=this._criticalInterval(p[s+1],y,s)).smooth&&(A=s,g=[]),n=this._criticalInterval(d[s+1],y,s),-1===f&&!0===n.smooth&&(f=s),!(0<=A));s++){if(0<a.groups.length&&2<++_&&(s+1)%2==0){g=a.groups,h=a.types;break}y--}for(i=0;i<g.length;i++)"interval"!==h[i]&&(l=this.getCenterOfCriticalInterval(g[i],s+1,u),a[0],o=Math.floor(l[1]),l=l[2],m.push(this.getPointType(e,o,l,u,d,p,y+1)));return[m,d,p,f,A]},_insertPoint_v4:function(t,e,i,s){var r,o=null;0<t.points.length&&(o=t.points[t.points.length-1].scrCoords),e=new base_coords.A(constants.A.COORDS_BY_USER,e,t.board),null!==o&&(r=e.scrCoords[1]-o[1])*r+(r=e.scrCoords[2]-o[2])*r<.8*.8||(e._t=i,t.points.push(e))},getInterval:function(t,e,i){return ia.A.disable(),e=ia.A.Interval(e,i),t.board.mathLib=ia.A,t.board.mathLibJXG=ia.A,i=t.Y(e,!0),t.board.mathLib=Math,t.board.mathLibJXG=jxg.A.Math,i},sign:function(t){return t<0?-1:0<t?1:0},handleBorder:function(t,e,i,s,r){var o,n,a,l,h,u,c,d,p,_,f,A=i.idx,g=e.t_values[1]-e.t_values[0];if("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!==(_=this.findComponents(t,n,a,32)).length){for("borderleft"===i.type&&(n=_[0].left_t,a=_[0].t_values[0],g=_[0].t_values[1]-_[0].t_values[0],o=n=null===n?a-g:n,l=this.getInterval(t,n,a),utils_type.A.isObject(l)&&(c=l.lo,d=l.hi,h=t.X(o,!0),u=r[1][A]<0?d:c,this._insertPoint_v4(t,[1,h,u],o))),f=_[0].t_values.length,p=0;p<f;p++)o=_[0].t_values[p],h=_[0].x_values[p],u=_[0].y_values[p],this._insertPoint_v4(t,[1,h,u],o);"borderright"===i.type&&(n=_[0].t_values[f-1],a=_[0].right_t,g=_[0].t_values[1]-_[0].t_values[0],o=a=null===a?n+g:a,l=this.getInterval(t,n,a),utils_type.A.isObject(l)&&(c=l.lo,d=l.hi,h=t.X(o,!0),u=0<r[1][A]?d:c,this._insertPoint_v4(t,[1,h,u],o)))}},_seconditeration_v4:function(t,e,i,s,r){for(var o,n,a,l,h,u,c,d,p,_=e.t_values[i.idx-2],e=e.t_values[i.idx+2],f=this.findComponents(t,_,e,64),A=0;A<f.length;A++){for(a=f[A],l=(n=this.differenceMethod(a,t))[0],u=n[1],c=n[2],h=d=0;h<=l.length;h++){for(p=h===l.length?a.len:l[h].idx,o=d;o<p;o++)isNaN(a.x_values[o])||isNaN(a.y_values[o])||this._insertPoint_v4(t,[1,a.x_values[o],a.y_values[o]],a.t_values[o]);h<l.length&&(this.handleSingularity(t,a,l[h],u,c),d=l[h].idx+1)}p=a.len,A<f.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],a.right_t)}return this},_recurse_v4:function(t,e,i,s,r,o,n,a){var l,h,u=.5*(e+i),c=t.X(u,!0),d=t.Y(u,!0);0!==a?(l=(c-s)*t.board.unitX,h=(d-r)*t.board.unitY,2<math.A.hypot(l,h)?this._recurse_v4(t,e,u,s,r,c,d,a-1):this._insertPoint_v4(t,[1,c,d],u),l=(c-o)*t.board.unitX,h=(d-n)*t.board.unitY,2<math.A.hypot(l,h)?this._recurse_v4(t,u,i,c,d,o,n,a-1):this._insertPoint_v4(t,[1,c,d],u)):this._insertPoint_v4(t,[1,NaN,NaN],u)},handleSingularity:function(t,e,i,s,r){var o,n,a,l,h,u,c,d,p=i.idx,_=i.t;console.log("HandleSingularity at t =",_),o=e.t_values[p-5],n=e.t_values[p+5],u=this.getInterval(t,o,n),u=utils_type.A.isObject(u)?(h=u.lo,u.hi):r[0][p-1]<r[0][p+1]?(h=r[0][p-1],r[0][p+1]):(h=r[0][p+1],r[0][p-1]),l=t.X(_,!0),c=(r[0][p-3]-r[0][p-5])/(e.t_values[p-3]-e.t_values[p-5]),d=(r[0][p+3]-r[0][p+5])/(e.t_values[p+3]-e.t_values[p+5]),console.log(":::",c,d),c<-100?(this._insertPoint_v4(t,[1,l,h],_,!0),d<=100&&this._insertPoint_v4(t,[1,NaN,NaN],_)):100<c?(this._insertPoint_v4(t,[1,l,u],_),-100<=d&&this._insertPoint_v4(t,[1,NaN,NaN],_)):(h===-1/0&&(this._insertPoint_v4(t,[1,l,h],_,!0),this._insertPoint_v4(t,[1,NaN,NaN],_)),u===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],_),this._insertPoint_v4(t,[1,l,u],_,!0)),c=i.t<e.t_values[p]?(a=p-1,p):(a=p)+1,o=e.t_values[a],n=e.t_values[c],this._recurse_v4(t,o,n,s[0][a],r[0][a],s[0][c],r[0][c],10)),d<-100?this._insertPoint_v4(t,[1,l,u],_):100<d&&this._insertPoint_v4(t,[1,l,h],_)},steps:1021,criticalThreshold:1e3,plot_v4:function(e,t,i,s){for(var r,o,n,a,l,h,u,c,d,p,_,f,A=(i-t)/s,g=function(t){return e.Y(t,!0)},m=function(t){return-e.Y(t,!0)},y=this.findComponents(e,t,i,s),b=0;b<y.length;b++){for(n=y[b],a=(u=this.differenceMethod(n,e))[0],c=u[1],d=u[2],0!==a.length&&"borderleft"===a[0].type||a.unshift({idx:0,t:n.t_values[0],x:n.x_values[0],y:n.y_values[0],type:"borderleft"}),"borderright"!==a[a.length-1].type&&(o=n.t_values.length,a.push({idx:o-1,t:n.t_values[o-1],x:n.x_values[o-1],y:n.y_values[o-1],type:"borderright"})),l=h=0;l<=a.length;l++){for(o=l===a.length?n.len:a[l].idx-1,r=h;r<o-2;r++)this._insertPoint_v4(e,[1,n.x_values[r],n.y_values[r]],n.t_values[r]),h+3<=r&&r<o-3&&3<d.length&&Math.abs(d[2][r])>.2*Math.abs(d[0][r])&&(p=n.t_values[r],f=.25*A,_=this.getInterval(e,p,p+A),utils_type.A.isObject(_)?0<d[2][r]?this._insertPoint_v4(e,[1,p+f,_.lo],p+f):this._insertPoint_v4(e,[1,p+A-f,_.hi],p+A-f):(_=numerics.A.fminbr(g,[p,p+A]))<(f=numerics.A.fminbr(m,[p,p+A]))?(this._insertPoint_v4(e,[1,e.X(_,!0),e.Y(_,!0)],_),this._insertPoint_v4(e,[1,e.X(f,!0),e.Y(f,!0)],f)):(this._insertPoint_v4(e,[1,e.X(f,!0),e.Y(f,!0)],f),this._insertPoint_v4(e,[1,e.X(_,!0),e.Y(_,!0)],_)));l<a.length&&(r=a[l].idx,"borderleft"===a[l].type||"borderright"===a[l].type?this.handleBorder(e,n,a[l],c,d):this._seconditeration_v4(e,n,a[l],c,d),h=a[l].idx+1+1)}o=n.len,b<y.length-1&&this._insertPoint_v4(e,[1,NaN,NaN],n.right_t)}},updateParametricCurve_v4:function(t,e,i){var s,r,o="x"===t.xterm?(r=.3*((o=t.board.getBoundingBox())[2]-o[0]),s=Math.max(e,o[0]-r),Math.min(i,o[2]+r)):(s=e,i);t.points=[],this.plot_v4(t,s,o,this.steps),t.numberPoints=t.points.length},updateParametricCurve:function(t,e,i){return this.updateParametricCurve_v2(t,e,i)}},math.A.Plot),implicitplot=(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(){function t(t){return u.f(r,t)}function e(t){return-u.f(r,t)}function i(t){return u.f(t,o)}function s(t){return-u.f(t,o)}var r,o,n=[],a=[],l=[],h=0,u=this,c=Math.min(this.bbox[0],this.bbox[2])-math.A.eps,d=Math.max(this.bbox[0],this.bbox[2]),p=Math.min(this.bbox[1],this.bbox[3])+math.A.eps,_=Math.max(this.bbox[1],this.bbox[3]),f=this.config.resolution_out/this.config.unitX;for(f*=1+math.A.eps,r=c;r<d;r+=f)!1!==(l=this.searchLine(t,e,r,[p,_],"vertical",h,n,a))&&(n=l[0],a=l[1],h=l[2]);for(f=this.config.resolution_out/this.config.unitY,f*=1+math.A.eps,o=p;o<_;o+=f)!1!==(l=this.searchLine(i,s,o,[c,d],"horizontal",h,n,a))&&(n=l[0],a=l[1],h=l[2]);return[n,a,h]},searchLine:function(t,e,i,s,r,o,n,a){var l,h,u,c,d,p,_,f=this.config.tol_u0,A=s[0],s=s[1],g=t(l=numerics.A.fminbr(t,[A,s])),m=t(_=numerics.A.fminbr(e,[A,s]));if(g<f&&-f<m){if(f=l,l=Math.min(f,_),_=Math.max(f,_),l=t(f=numerics.A.fzero(t,[l,_])),Math.abs(l)>Math.max((m-g)*math.A.eps,.001))return!1;if(_="vertical"===r?(h=[1,i,f],this.config.resolution_in/this.config.unitY):(h=[1,f,i],this.config.resolution_in/this.config.unitX),_*=1+math.A.eps,!this.curveContainsPoint(h,n,a,2*_,this.config.qdt_box)&&0<(d=this.traceComponent(h,1)).length){for(0<o&&(n.push(NaN),a.push(NaN)),p=n.length,c=d[0].length,u=1;u<c;u++)this.qdt.insertItem({xlb:Math.min(d[0][u-1],d[0][u]),xub:Math.max(d[0][u-1],d[0][u]),ylb:Math.min(d[1][u-1],d[1][u]),yub:Math.max(d[1][u-1],d[1][u]),idx1:p+u-1,idx2:p+u,comp:o});o++,utils_type.A.concat(n,d[0]),utils_type.A.concat(a,d[1])}return(l=f-.01*_)-A>_&&!1!==(d=this.searchLine(t,e,i,[A,l],r,o,n,a))&&(n=d[0],a=d[1],o=d[2]),s-(l=f+.01*_)>_&&!1!==(d=this.searchLine(t,e,i,[l,s],r,o,n,a))&&(n=d[0],a=d[1],o=d[2]),[n,a,o]}return!1},curveContainsPoint:function(t,e,i,s,r){for(var o,n=t[1],a=t[2],l=(o=this.qdt.find([n-r,a+r,n+r,a-r])).length,h=0;h<l;h++)if(geometry.A.distPointSegment(t,[1,e[o[h].idx1],i[o[h].idx1]],[1,e[o[h].idx2],i[o[h].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<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,l,h,u,c,d,p,_,f,A,g,m=[],y=[],b=[],v=0,C=0,x=!1,P=!1,E=!1,O=this.config.kappa_0,M=this.config.delta_0,w=this.config.alpha_0,S=this.config.h_initial,T=this.config.max_steps,N=e,j=[],D=[],k=[],m=t.slice(1);if(j.push(m[0]),D.push(m[1]),!1===(i=this.tangent(m)))return[];this.dfx(m[0],m[1]),this.dfy(m[0],m[1]);do{if(!1===(i=this.tangent(m))){m=y.slice(),j.push(m[0]),D.push(m[1]);break}if(1===j.length)r=i.slice();else if(2===j.length)k.push(j.length-1);else if(P&&2<j.length&&!E){if(geometry.A.distPointSegment([1,m[0],m[1]],[1,j[0],D[0]],[1,j[1],D[1]])<this.config.loop_dist*S&&math.A.innerProduct(i,r,2)>this.config.loop_dir){m=t.slice(1),j.push(m[0]),D.push(m[1]),x=!0;break}if(this.config.loop_detection){for(_=j.length-1,f=Math.floor(math.A.log2(_)),A=0;A<=f&&!(geometry.A.distPointSegment([1,m[0],m[1]],[1,j[k[A]-1],D[k[A]-1]],[1,j[k[A]],D[k[A]]])<this.config.loop_dist*S&&(s=this.tangent([j[k[A]],D[k[A]]]),math.A.innerProduct(i,s,2)>this.config.loop_dir));A++);if(A<=f){x=!0;break}for(f=1,A=g=0;A<100&&(1+_)%f==0;A++)f*=2,g++;k[g]=_}}for(y[0]=m[0]+S*N*i[0],y[1]=m[1]+S*N*i[1],C=0;h=(o=[this.dfx(y[0],y[1]),this.dfy(y[0],y[1])])[0]*o[0]+o[1]*o[1],n=this.f(y[0],y[1])/h,b[0]=y[0]-o[0]*n,b[1]=y[1]-o[1]*n,0===C?a=Math.abs(n)*Math.sqrt(h):1===C&&(l=Math.abs(n)*Math.sqrt(h)),y[0]=b[0],y[1]=b[1],++C<20&&Math.abs(this.f(y[0],y[1]))>this.config.tol_newton;);if(c=a,u=1<C?l/a:0,s=this.tangent(y),p=math.A.innerProduct(i,s,2),p=Math.max(-1,Math.min(1,p)),d=Math.acos(p),E=!1,geometry.A.distance(m,y,2)<this.config.tol_progress){m=y.slice(),j.push(m[0]),D.push(m[1]);break}if(p<0&&!(S>this.config.h_critical)){if(E=!0,!this.isBifurcation(m,this.config.tol_cusp)){m=y.slice(),j.push(m[0]),D.push(m[1]);break}N*=-1,d=0}if(!E&&(p=Math.max(Math.sqrt(u/O),Math.sqrt(c/M),d/w),isNaN(p)&&(p=1),S/=p=Math.max(Math.min(p,2),.5),S=Math.min(this.config.h_max,S),2<=p)){if(++v>=3*T)break;P=!1}else m=y.slice(),j.push(m[0]),D.push(m[1]),P=!0,v++}while(v<T&&m[0]>=this.bbox[0]&&m[1]<=this.bbox[1]&&m[0]<=this.bbox[2]&&m[1]>=this.bbox[3]);return[j,D,x]},isBifurcation:function(t,e){var i=math.A.eps*math.A.eps*100,s=t[0],t=t[1],r=.5*(this.dfx(s+i,t)-this.dfx(s-i,t))/i,o=.5*(this.dfx(s,t+i)-this.dfx(s,t-i))/i,n=.5*(this.dfy(s+i,t)-this.dfy(s-i,t))/i,i=(t=r+(s=.5*(this.dfy(s,t+i)-this.dfy(s,t-i))/i))*t-4*(r*s-o*n),r=.5*(t+Math.sqrt(i)),s=.5*(t-Math.sqrt(i));return Math.abs(r)>e&&Math.abs(s)>e},handleCriticalPoint:function(i,t,s,e){e=Math.atan2(e*t[1],e*t[0]),t=numerics.A.root(function(t){var e=i[0]+s*Math.cos(t),t=i[1]+s*Math.sin(t);return this.f(e,t)},e);return[i[0]+s*Math.cos(t),i[1]+s*Math.sin(t)]},updateA:function(t,e,i){var s=[i[0]-e[0],i[1]-e[1]],i=this.f(i[0],i[1])-this.f(e[0],e[1])-(t[0]*s[0]+t[1]*s[1]);return t[0]+=(i/=s[0]*s[0]+s[1]*s[1])*s[0],t[1]+=i*s[1],t},tangent_A:function(t){var t=[-t[1],t[0]],e=math.A.norm(t,2);return math.A.eps,[t[0]/e,t[1]/e]},tangent:function(t){var t=[-this.dfy(t[0],t[1]),this.dfx(t[0],t[1])],e=math.A.norm(t,2);return!(e<math.A.eps*math.A.eps)&&[t[0]/e,t[1]/e]}}),math.A.ImplicitPlot),metapost=(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){for(var e,i,s,r,o,n,a,l,h,u,c,d,p,_,f=t[0];f&&(n=f.next,f.rtype>this.MP_EXPLICIT&&(f.x-n.x)*(f.x-n.x)+(f.y-n.y)*(f.y-n.y)<this.EPS_SQ&&(f.rtype=this.MP_EXPLICIT,f.ltype===this.MP_OPEN&&(f.ltype=this.MP_CURL,f.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)),f.rx=f.x,n.lx=f.x,f.ry=f.y,n.ly=f.y),(f=n)!==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(f=i;f;){if(n=f.next,f.rtype>=this.MP_GIVEN){for(;n.ltype===this.MP_OPEN&&n.rtype===this.MP_OPEN;)n=n.next;for(s=0,a=f,o=t.length,c=[],d=[],p=[],_=[null];h=a.next,c.push(h.x-a.x),d.push(h.y-a.y),p.push(this.mp_pyth_add(c[s],d[s])),0<s&&(u=d[s-1]/p[s-1],l=c[s-1]/p[s-1],_.push(Math.atan2(d[s]*l-c[s]*u,c[s]*l+d[s]*u))),s++,!((o=(a=h)===n?s:o)<=s&&a.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)))),f.rtype===this.MP_OPEN&&f.ltype===this.MP_EXPLICIT&&((r=f.x-f.lx)*r+(e=f.y-f.ly)*e<this.EPS_SQ?(f.rtype=this.MP_CURL,f.set_right_curl(this.UNITY)):(f.rtype=this.MP_GIVEN,f.set_right_given(Math.atan2(e,r)))),this.mp_solve_choices(f,n,o,c,d,p,_)}else f.rtype===this.MP_ENDPOINT&&(f.rx=f.x,f.ry=f.y,n.lx=n.x,n.ly=n.y);if((f=n)===i)break}},mp_solve_choices:function(t,e,i,s,r,o,n){for(var a,l,h,u,c,d,p,_,f,A,g,m,y,b,v,C,x,P,E,O=o.length+1,M=new Array(O),w=new Array(O),S=new Array(O),T=new Array(O),N=0;N<O;N++)T[N]=S[N]=w[N]=M[N]=0;for(c=t,p=u=0;;){if(_=c.next,0===u)if(c.rtype===this.MP_GIVEN){if(_.ltype===this.MP_GIVEN)return a=Math.atan2(r[0],s[0]),b=(y=this.mp_n_sin_cos(t.right_given()-a))[0],v=y[1],x=(C=this.mp_n_sin_cos(e.left_given()-a))[0],P=C[1],void this.mp_set_controls(t,e,s[0],r[0],v,b,-P,x);S[0]=c.right_given()-Math.atan2(r[0],s[0]),S[0]=this.reduce_angle(S[0]),w[M[0]=0]=0}else if(c.rtype===this.MP_CURL){if(_.ltype===this.MP_CURL)return t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT,d=Math.abs(e.left_tension()),A=Math.abs(t.right_tension()),f=this.UNITY/(3*A),t.rx=t.x+s[0]*f,t.ry=t.y+r[0]*f,f=this.UNITY/(3*d),e.lx=e.x-s[0]*f,void(e.ly=e.y-r[0]*f);m=c.right_curl(),d=Math.abs(_.left_tension()),A=Math.abs(c.right_tension()),M[0]=this.mp_curl_ratio(m,A,d),S[0]=-n[1]*M[0],w[0]=0}else c.rtype===this.MP_OPEN&&(w[S[M[0]=0]=0]=this.FRACTION_ONE);else if(c.ltype===this.MP_END_CYCLE||c.ltype===this.MP_OPEN){if(a=this.UNITY/(3*Math.abs(p.right_tension())-this.UNITY),g=o[u]*(this.FRACTION_THREE-this.UNITY/Math.abs(p.right_tension())),l=this.UNITY/(3*Math.abs(_.left_tension())-this.UNITY),h=o[u-1]*(this.FRACTION_THREE-this.UNITY/Math.abs(_.left_tension())),g*=m=this.FRACTION_ONE-M[u-1]*a,(d=Math.abs(c.left_tension()))<(A=Math.abs(c.right_tension()))?g*=Math.pow(d/A,2):A<d&&(h*=Math.pow(A/d,2)),M[u]=(f=h/(h+g))*l,h=-n[u+1]*M[u],p.rtype===this.MP_CURL?(w[u]=0,S[u]=h-n[1]*(this.FRACTION_ONE-f)):(f=(this.FRACTION_ONE-f)/m,h-=n[u]*f,f*=a,S[u]=h-S[u-1]*f,w[u]=-w[u-1]*f),c.ltype===this.MP_END_CYCLE){for(a=0,l=this.FRACTION_ONE;a=S[u=0==--u?i:u]-a*M[u],l=w[u]-l*M[u],u!==i;);for(a/=this.FRACTION_ONE-l,T[i]=a,S[0]=a,E=1;E<i;E++)S[E]=S[E]+a*w[E];break}}else{if(c.ltype===this.MP_CURL){m=c.left_curl(),d=Math.abs(c.left_tension()),A=Math.abs(p.right_tension()),f=this.mp_curl_ratio(m,d,A),T[i]=-S[i-1]*f/(this.FRACTION_ONE-f*M[i-1]);break}if(c.ltype===this.MP_GIVEN){T[i]=c.left_given()-Math.atan2(r[i-1],s[i-1]),T[i]=this.reduce_angle(T[i]);break}}p=c,c=_,u+=1}for(u=i-1;-1<u;u--)T[u]=S[u]-T[u+1]*M[u];for(c=t,u=0;_=c.next,b=(y=this.mp_n_sin_cos(T[u]))[0],v=y[1],x=(C=this.mp_n_sin_cos(-n[u+1]-T[u+1]))[0],P=C[1],this.mp_set_controls(c,_,s[u],r[u],v,b,P,x),c=_,++u!==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 l,h=Math.abs(e.left_tension()),u=Math.abs(t.right_tension()),u=this.mp_velocity(r,o,n,a,u),h=this.mp_velocity(n,a,r,o,h);(t.right_tension()<0||e.left_tension()<0)&&(0<=r&&0<=n||r<=0&&n<=0)&&0<(l=Math.abs(r)*a+Math.abs(n)*o)&&(l*=1.00024414062,t.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,u,l)<0&&(u=Math.abs(n)/l),e.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(r),this.FRACTION_ONE,h,l)<0&&(h=Math.abs(r)/l)),t.rx=t.x+(i*o-s*r)*u,t.ry=t.y+(s*o+i*r)*u,e.lx=e.x-(i*a+s*n)*h,e.ly=e.y-(s*a-i*n)*h,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){e=1/e,i=1/i;return Math.min(4,((3-e)*e*e*t+i*i*i)/(e*e*e*t+(3-i)*i*i))},mp_ab_vs_cd:function(t,e,i,s){return t*e==i*s?0:i*s<t*e?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&&(0<t?t-=this.THREE_SIXTY_DEG:t+=this.THREE_SIXTY_DEG),t},makeknots:function(t,e){for(var i=[],s=t.length,r=0;r<s;r++)i.push({x:t[r][0],y:t[r][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=i.length,r=0;r<s;r++)i[r].next=i[r+1]||i[r],i[r].set_right_given=i[r].set_right_curl,i[r].set_left_given=i[r].set_left_curl,i[r].right_given=i[r].right_curl,i[r].left_given=i[r].left_curl;return i[s-1].next=i[0],i},curve:function(t,e){var i,s,r,o,n,a=!1,l=[],h=[],u=1;for(o in(e=e||{tension:1,direction:{},curl:{},isClosed:!1}).hasOwnProperty("tension")&&(u=utils_type.A.evaluate(e.tension)),s=(i=this.makeknots(t,u)).length,(a=utils_type.A.exists(e.isClosed)&&utils_type.A.evaluate(e.isClosed)?!0:a)||(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||s<=r)continue;n=e[r],utils_type.A.exists(n.type)&&"curl"===n.type&&(u=utils_type.A.evaluate(n.curl),0===r?(i[r].rtype=this.MP_CURL,i[r].set_right_curl(u)):r===s-1?(i[r].ltype=this.MP_CURL,i[r].set_left_curl(u)):(i[r].ltype=this.MP_CURL,i[r].rtype=this.MP_CURL,i[r].lx=u,i[r].rx=u)),utils_type.A.exists(n.direction)&&(u=utils_type.A.evaluate(n.direction),utils_type.A.isArray(u)?(!1!==u[0]&&(i[r].lx=u[0]*Math.PI/180,i[r].ltype=this.MP_GIVEN),!1!==u[1]&&(i[r].rx=u[1]*Math.PI/180,i[r].rtype=this.MP_GIVEN)):(i[r].lx=u*Math.PI/180,i[r].rx=u*Math.PI/180,i[r].ltype=i[r].rtype=this.MP_GIVEN)),utils_type.A.exists(n.tension)&&(u=utils_type.A.evaluate(n.tension),utils_type.A.isArray(u)?(!1!==u[0]&&(i[r].ly=utils_type.A.evaluate(u[0])),!1!==u[1]&&(i[r].ry=utils_type.A.evaluate(u[1]))):(i[r].ly=u,i[r].ry=u))}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),h.push(i[r].y),h.push(i[r].ry),h.push(i[r+1].ly);return l.push(i[s-1].x),h.push(i[s-1].y),a&&(l.push(i[s-1].rx),h.push(i[s-1].ry),l.push(i[0].lx),h.push(i[0].ly),l.push(i[0].x),h.push(i[0].y)),[l,h]}},math.A.Metapost),clip=(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(0<r)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;0<s&&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){for(var e,i,s,r,o,n=[],a=t.length,l=0;l<a;l++)if(t[l].sort(function(t,e){return t.data.alpha>e.data.alpha?1:-1}),0<t[l].length){for(r=t[l].length-1,o=(s=(i=t[l][0]).data.path[i.pos])._next,l===a-1&&(s._end=!1),0===i.data.alpha&&"T"===i.data.type?(s.intersection=!0,s.data=i.data,s.neighbour=i.neighbour,(s.neighbour.neighbour=s).entry_exit=!1,t[l][0]=s):(i._prev=s,i._prev._next=i),e=1;e<=r;e++)(i=t[l][e])._prev=t[l][e-1],i._prev._next=i;(i=t[l][r])._next=o,i._next._prev=i,l===a-1&&(i._end=!0),n=n.concat(t[l])}return n},_inbetween:function(t,e,i){var s=math.A.eps*math.A.eps,r=i[1]-e[1],i=i[2]-e[2],o=t[1]-e[1],t=t[2]-e[2];return 0==r&&0==i&&0==o&&0==t||(e=Math.abs(o)<s&&Math.abs(r)<s?t/i:o/r,e=Math.abs(e)<s?0:e)},_print_array:function(t){for(var e,i=0;i<t.length;i++)try{e="",t[i]._end&&(e=" end"),console.log(i,t[i].coords.usrCoords,t[i].data.type,"\t","prev",t[i]._prev.coords.usrCoords,"next",t[i]._next.coords.usrCoords+e)}catch(e){console.log(i,t[i].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){for(var r,o,n,a,l=Math.sqrt(math.A.eps),h=!1,u=0;u<3;u++)if(r=Math.min(t[u],e[u]),o=Math.max(t[u],e[u]),n=Math.min(i[u],s[u]),a=Math.max(i[u],s[u]),o<n-l||a+l<r){h=!0;break}return h},findIntersections:function(t,e,i){for(var s,r,o,n,a,l,h,u,c,d,p,_=[],f=100*math.A.eps,A=t.length,g=e.length,m=[],y=[],b=[],v=!1,C=!1,x=0;x<g;x++)b.push([]);for(s=0;s<A;s++)if(y.push([]),this._isSeparator(t[s])||this._isSeparator(t[(s+1)%A]))v=!0;else{if(v&&s===A-1)break;for(o=t[s].coords.usrCoords,n=t[(s+1)%A].coords.usrCoords,x=0;x<g;x++)if(this._isSeparator(e[x])||this._isSeparator(e[(x+1)%g]))C=!0;else{if(C&&x===g-1)break;if(a=e[x].coords.usrCoords,u=e[(x+1)%g].coords.usrCoords,!this._noOverlap(o,n,a,u)&&(_=geometry.A.meetSegmentSegment(o,n,a,u),l=geometry.A.distance(o,n,3),h=geometry.A.distance(a,u,3),_[1]*l>-f&&_[1]<1-f/l&&_[2]*h>-f&&_[2]<1-f/h||_[1]===1/0&&_[2]===1/0&&math.A.norm(_[0],3)<f)){if(r=new base_coords.A(constants.A.COORDS_BY_USER,_[0],i),c="X",Math.abs(_[1])*l<f||Math.abs(_[2])*h<f)c="T",Math.abs(_[1])*l<f&&(_[1]=0),Math.abs(_[2])*h<f&&(_[2]=0),r=0===_[1]?new base_coords.A(constants.A.COORDS_BY_USER,o,i):new base_coords.A(constants.A.COORDS_BY_USER,a,i);else if(_[1]===1/0&&_[2]===1/0&&math.A.norm(_[0],3)<f){0<=(u=this._inbetween(o,a,u))&&u<1&&(c="T",r=new base_coords.A(constants.A.COORDS_BY_USER,o,i),_[1]=0,_[2]=u,d=new this.Vertex(r,s,_[1],t,"S",c),p=new this.Vertex(r,x,_[2],e,"C",c),(d.neighbour=p).neighbour=d,y[s].push(d),b[x].push(p)),u=this._inbetween(a,o,n),geometry.A.distance(o,a,3)>f&&0<=u&&u<1&&(c="T",r=new base_coords.A(constants.A.COORDS_BY_USER,a,i),_[1]=u,_[2]=0,d=new this.Vertex(r,s,_[1],t,"S",c),p=new this.Vertex(r,x,_[2],e,"C",c),(d.neighbour=p).neighbour=d,y[s].push(d),b[x].push(p));continue}d=new this.Vertex(r,s,_[1],t,"S",c),p=new this.Vertex(r,x,_[2],e,"C",c),(d.neighbour=p).neighbour=d,y[s].push(d),b[x].push(p)}}}for(m=this.sortIntersections(y),s=0;s<m.length;s++)m[s].data.idx=s,m[s].neighbour.data.idx=s;return[m,this.sortIntersections(b)]},_getPosition:function(t,e,i,s){var r=geometry.A.det3p(t,e,i),t=geometry.A.det3p(t,i,s);return 0<=geometry.A.det3p(e,i,s)?0<=r&&0<=t?"left":"right":0<=r||0<=t?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,s,r,o,n,a,l,h,u,c,d=geometry.A.det3p,p=0;for(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),l=d(t.coords.usrCoords,i,r),h=d(t.coords.usrCoords,e,s),u=d(t.coords.usrCoords,i,s),c=d(t.coords.usrCoords,e,r),0===l&&0===h&&0===u&&0===c&&(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],l=d(t.coords.usrCoords,i,r),h=d(t.coords.usrCoords,e,s),u=d(t.coords.usrCoords,i,s),c=d(t.coords.usrCoords,e,r)),a=!1,0===l?geometry.A.affineRatio(t.coords.usrCoords,i,r)<0&&(a=!0):0===h?geometry.A.affineRatio(t.coords.usrCoords,e,s)<0&&(a=!0):0===u?0<geometry.A.affineRatio(t.coords.usrCoords,i,s)&&(a=!0):0===c&&0<geometry.A.affineRatio(t.coords.usrCoords,e,r)&&(a=!0),a&&(a=r,r=s,s=a,a=l,l=u,u=a,a=h,h=c,c=a),utils_type.A.exists(t.delayedStatus)||(t.delayedStatus=[]),0===l&&0===h?t.delayedStatus=["on","on"]:0===l?(n=this._getPosition(e,r,o.coords.usrCoords,s),t.delayedStatus=["on",n]):0===h?(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++,3<t._tours||t._end||1e3<p){1e3<p&&console.log("Clipping: _classifyDegenerateIntersections exit"),utils_type.A.exists(t._tours)&&delete t._tours;break}t.intersection&&p++,t=t._next}},_handleIntersectionChains:function(t){for(var e,i=0,s="Null",r=!1,o=!1;!0===t.intersection&&("T"===t.data.type&&("on"!==t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(r=!0,s=(e=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++),!(o=t._end?!0:o)||r;){if(1e3<i){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}t=t._next}},_handleFullyDegenerateCase:function(t,e,i){for(var s,r,o,n,a,l,h,u,c,d,p,_=[t,e],f=0;f<2;f++){for(h=(s=_[f]).length,p=!(a=0);a<h;a++)if(!s[a].intersection){p=!1;break}if(p)for(u=(r=_[(f+1)%2]).length,a=0;a<h;a++){for(n=s[a].coords.usrCoords,d=s[a]._next.coords.usrCoords,c=!(o=[.5*(n[l=0]+d[0]),.5*(n[1]+d[1]),.5*(n[2]+d[2])]);l<u;l++)if(Math.abs(geometry.A.det3p(r[l].coords.usrCoords,r[(l+1)%u].coords.usrCoords,o))<math.A.eps){c=!0;break}if(!c){n={pos:a,intersection:!1,coords:new base_coords.A(constants.A.COORDS_BY_USER,o,i),elementClass:constants.A.OBJECT_CLASS_POINT},d=s[a]._next,(s[a]._next=n)._prev=s[a],(n._next=d)._prev=n,s[a]._end&&(s[a]._end=!1,n._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){for(var s,r,o,n,a=null,l=0,h=i.length,u=0;u<h;u++)for(n=i[u],this._classifyDegenerateIntersections(t[n]),this._handleIntersectionChains(t[n]),r=(n=this._getStatus(t[n],e))[0],s=n[1],r._starter=!0,a=null,l=o=0;!0===r.intersection&&("X"===r.data.type&&1===l&&("exit"===(a.entry_exit=s)&&(a.data.type="X"),l=2),"X"!==r.data.type&&"DB"!==r.data.type||(s="entry"===(r.entry_exit=s)?"exit":"entry"),"DX"===r.data.type&&(0===l?(a=r,l=1):1===l?(r.entry_exit=s,"exit"===(a.entry_exit=s)?a.data.type="X":r.data.type="X",s="entry"===s?"exit":"entry",a=null,l=0):2===l&&(r.entry_exit=s,r.data.type="X",s="entry"===s?"exit":"entry",a=null,l=0))),r=r._next,!(utils_type.A.exists(r._starter)||1e4<o);)o++},_stayOnPath:function(t,e){var i=!0;return i=t.intersection&&"B"!==t.data.type?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){for(var s,r,o,n,a=0,l=0,h=[],u=!1;l<e.length&&a<1e4;)if((o=e[l]).data.done||"X"!==o.data.type)l++;else{0<h.length&&h.push([NaN,NaN]),n=o.data.idx,s=t,u=this._addVertex(h,o,!1),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)){do{if(o=o._next,u=this._addVertex(h,o,!1))break}while(this._stayOnPath(o,r));a++}else{do{if(o=o._prev,u=this._addVertex(h,o,!1))break}while(this._stayOnPath(o,r));a++}if(u)break;if(!o.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",a),[[0],[0]]}while(!(o=o.neighbour).data.done&&(o.data.done=!0,r=o.entry_exit,s=o.data.path,o.data.idx!==n&&a<1e4));1e4<=a&&console.log("Tracing: stopping an infinite loop!",a),l++}return this._getCoordsArrays(h,!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){for(var i=[],s=[],r=t.length,o=0;o<r;o++)t[o].coords?(i.push(t[o].coords.usrCoords[1]),s.push(t[o].coords.usrCoords[2])):(i.push(t[o][0]),s.push(t[o][1]));return e&&0<r&&(t[0].coords?(i.push(t[0].coords.usrCoords[1]),s.push(t[0].coords.usrCoords[2])):(i.push(t[0][0]),s.push(t[0][1]))),[i,s]},handleEmptyIntersection:function(t,e,i){var s,r,o=!1,n=[];if(0===t.length)return this._getCoordsArrays(n="union"===i?e:[],!0);if(0===e.length)return this._getCoordsArrays(n="intersection"===i?[]:t,!0);if(0<t.length)for(s=t[0];s.intersection&&!(s=s._next)._end;);if(0<e.length)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]),0<geometry.A.signedPolygon(t)*geometry.A.signedPolygon(e)&&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){for(var e=t.length,i=0,s=0;s<e;s++)"X"===t[s].data.type&&i++;return i},_getPath:function(t,e){var i,s,r,o,n,a,l,h=[];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(h,t.points[i],i);else if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(i=0;i<t.vertices.length;i++)this._addToList(h,t.vertices[i].coords,i);else if(t.elementClass===constants.A.OBJECT_CLASS_CIRCLE)for(l=359,r=t.Radius(),o=2*Math.PI/l,i=0;i<=l;i++)this._addToList(h,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(h,t[i].coords,i):utils_type.A.isArray(t[i])?this._addToList(h,new base_coords.A(constants.A.COORDS_BY_USER,t[i],e),i):utils_type.A.exists(t[i].usrCoords)&&this._addToList(h,t[i],i)}else{for(n=geometry.A.rad(t.radiuspoint,t.center,t.anglepoint),l=Math.floor(180*n/Math.PI),r=t.Radius(),o=n/l,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(h,t.center.coords,0),i=0;i<=l;i++)this._addToList(h,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(h,t.center.coords,l+2)}return h},greinerHormann:function(t,e,i,s){var r,o=[],n=[];return 0<(t=(o=this._getPath(t,s)).length)&&geometry.A.distance(o[0].coords.usrCoords,o[t-1].coords.usrCoords,3)<math.A.eps&&o.pop(),0<(t=(n=this._getPath(e,s)).length)&&geometry.A.distance(n[0].coords.usrCoords,n[t-1].coords.usrCoords,3)<math.A.eps*math.A.eps&&n.pop(),this.isEmptyCase(o,n,i)?[[],[]]:(e=this.makeDoublyLinkedList(o),t=this.makeDoublyLinkedList(n),r=this.findIntersections(o,n,s)[0],this._handleFullyDegenerateCase(o,n,s),this.markEntryExit(o,n,e),this.markEntryExit(n,o,t),0===this._countCrossingIntersections(r)?this.handleEmptyIntersection(o,n,i):this.tracing(o,r,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)}},math.A.Clip),poly=(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(s=(i=(i=utils_type.A.isArray(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(){for(var t=[],e=0;e<this.ring.vars.length;e++)t.push(this.ring.vars[e]+"^"+this.exponents[e]);return this.coefficient+"*"+t.join("*")}}),math.A.Poly.Polynomial=function(t,e){if(!utils_type.A.exists(t))throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial missing parameter 'ring'.");e=utils_type.A.exists(e)&&utils_type.A.isString(e)?void 0:[],this.ring=t,this.monomials=e},jxg.A.extend(math.A.Poly.Polynomial.prototype,{findSignature:function(t){for(var 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;-1<(i=this.findSignature(t.exponents))?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(){for(var t=new math.A.Poly.Polynomial(this.ring),e=0;e<this.monomials.length;e++)t.monomials.push(this.monomials[e].copy());return t},print:function(){for(var t=[],e=0;e<this.monomials.length;e++)t.push("("+this.monomials[e].print()+")");return t.join("+")}}),math.A.Poly),complex=(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,this.absval=0,this.angle=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}}),jxg.A.C={},jxg.A.C.add=function(t,e){t=new jxg.A.Complex(t);return t.add(e),t},jxg.A.C.sub=function(t,e){t=new jxg.A.Complex(t);return t.sub(e),t},jxg.A.C.mult=function(t,e){t=new jxg.A.Complex(t);return t.mult(e),t},jxg.A.C.div=function(t,e){t=new jxg.A.Complex(t);return t.div(e),t},jxg.A.C.conj=function(t){t=new jxg.A.Complex(t);return t.conj(),t},jxg.A.C.abs=function(t){var e=new jxg.A.Complex(t);return e.conj(),e.mult(t),Math.sqrt(e.real)},jxg.A.C.copy=function(t){return new jxg.A.Complex(t)},jxg.A.Complex.C=jxg.A.C,jxg.A.Complex),src_options=__webpack_require__(378),renderer_abstract=(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.setObjectViewport(t),this.setObjectTransition(t),utils_type.A.evaluate(t.visProp.draft)?this.setDraft(t):(e.stroke||(t.highlighted?(this.setObjectStrokeColor(t,t.visProp.highlightstrokecolor,t.visProp.highlightstrokeopacity),this.setObjectStrokeWidth(t,t.visProp.highlightstrokewidth)):(this.setObjectStrokeColor(t,t.visProp.strokecolor,t.visProp.strokeopacity),this.setObjectStrokeWidth(t,t.visProp.strokewidth))),e.fill||(t.highlighted?this.setObjectFillColor(t,t.visProp.highlightfillcolor,t.visProp.highlightfillopacity):this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity)),e.dash||this.setDashStyle(t,t.visProp),e.shadow||this.setShadow(t),e.tabindex||this.setTabindex(t)))},_getHighlighted:function(t){var e=!1;return!(e=utils_type.A.exists(t.board)&&utils_type.A.exists(t.board.highlightedObjects)?e:!0)&&utils_type.A.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e=src_options.A.normalizePointFace(utils_type.A.evaluate(t.visProp.face)),e="o"===e?"ellipse":"[]"===e?"rect":"path";t.rendNode=this.appendChildPrim(this.createPrim(e,t.id),utils_type.A.evaluate(t.visProp.layer)),this.appendNodesToElement(t,e),this._updateVisual(t,{dash:!0,shadow:!0},!0),this.updatePoint(t)},updatePoint:function(t){var e=utils_type.A.evaluate(t.visProp.size),i=src_options.A.normalizePointFace(utils_type.A.evaluate(t.visProp.face)),s=utils_type.A.evaluate(t.visProp.sizeunit),r=utils_type.A.evaluate(t.visProp.zoom);isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===s&&(e*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),s=0==(e*=t.board&&r?Math.sqrt(t.board.zoomX*t.board.zoomY):1)?0:e+1,"o"===i?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],s,s):"[]"===i?this.updateRectPrim(t.rendNode,t.coords.scrCoords[1]-e,t.coords.scrCoords[2]-e,2*e,2*e):this.updatePathPrim(t.rendNode,this.updatePathStringPoint(t,e,i),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),utils_type.A.evaluate(t.visProp.draft)&&this.setDraft(t)},drawLine:function(t){t.rendNode=this.appendChildPrim(this.createPrim("line",t.id),utils_type.A.evaluate(t.visProp.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),utils_type.A.evaluate(t.visProp.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=t.visProp,s=e?"highlight":"",e=e&&i.highlightstrokewidth?Math.max(utils_type.A.evaluate(i.highlightstrokewidth),utils_type.A.evaluate(i.strokewidth)):utils_type.A.evaluate(i.strokewidth),i=this.getArrowHeadData(t,e,s);this.makeArrows(t,i),t.elementClass===constants.A.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,i):t.elementClass===constants.A.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,i)},getArrowHeadData:function(t,e,i){var s,r,o,n,a=math.A.eps,l=0,h=0,u=0,c=0,d=utils_type.A.evaluate(t.visProp.firstarrow),p=utils_type.A.evaluate(t.visProp.lastarrow);return(d||p)&&(s=utils_type.A.exists(d.type)?utils_type.A.evaluate(d.type):t.elementClass===constants.A.OBJECT_CLASS_LINE?1:7,r=utils_type.A.exists(p.type)?utils_type.A.evaluate(p.type):t.elementClass===constants.A.OBJECT_CLASS_LINE?1:7,d&&(n=6,utils_type.A.exists(d.size)&&(n=utils_type.A.evaluate(d.size)),o=e*(n=""!==i&&utils_type.A.exists(d[i+"size"])?utils_type.A.evaluate(d[i+"size"]):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,l+=o,u=n),p&&(n=6,utils_type.A.exists(p.size)&&(n=utils_type.A.evaluate(p.size)),o=e*(n=""!==i&&utils_type.A.exists(p[i+"size"])?utils_type.A.evaluate(p[i+"size"]):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,h+=o,c=n)),{evFirst:d,evLast:p,typeFirst:t.visPropCalc.typeFirst=s,typeLast:t.visPropCalc.typeLast=r,offFirst:l,offLast:h,sizeFirst:u,sizeLast:c,showFirst:1,showLast:1,minLen:a,strokeWidth:e}},updateLineWithEndings:function(t,e){var 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=utils_type.A.evaluate(t.visProp.margin);return 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 utils_type.A.evaluate(t.visProp.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,l;return(s.evFirst||s.evLast)&&(o=n=a=l=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,l=(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]-l],!1,!0)),this},handleTouchpoints:function(t,e,i,s){var r,o,n,a,l,h,u;return(s.evFirst||s.evLast)&&(n=a=l=h=u=0,r=utils_type.A.evaluate(t.point1.visProp.size)+utils_type.A.evaluate(t.point1.visProp.strokewidth),o=utils_type.A.evaluate(t.point2.visProp.size)+utils_type.A.evaluate(t.point2.visProp.strokewidth),s.evFirst&&utils_type.A.evaluate(t.visProp.touchfirstpoint)&&utils_type.A.evaluate(t.point1.visProp.visible)&&(n=e.distance(constants.A.COORDS_BY_SCREEN,i),a=(i.scrCoords[1]-e.scrCoords[1])*r/n,l=(i.scrCoords[2]-e.scrCoords[2])*r/n),s.evLast&&utils_type.A.evaluate(t.visProp.touchlastpoint)&&utils_type.A.evaluate(t.point2.visProp.visible)&&(n=e.distance(constants.A.COORDS_BY_SCREEN,i),h=(i.scrCoords[1]-e.scrCoords[1])*o/n,u=(i.scrCoords[2]-e.scrCoords[2])*o/n),e.setCoordinates(constants.A.COORDS_BY_SCREEN,[e.scrCoords[1]+a,e.scrCoords[2]+l],!1,!0),i.setCoordinates(constants.A.COORDS_BY_SCREEN,[i.scrCoords[1]-h,i.scrCoords[2]-u],!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),utils_type.A.evaluate(t.visProp.layer)),this.appendNodesToElement(t,"path")},updateTicks:function(t){},drawEllipse:function(t){t.rendNode=this.appendChildPrim(this.createPrim("ellipse",t.id),utils_type.A.evaluate(t.visProp.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),utils_type.A.evaluate(t.visProp.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){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var e,i,s;"html"===utils_type.A.evaluate(t.visProp.display)&&env.A.isBrowser&&"no"!==this.type?((e=this.container.ownerDocument.createElement("div")).style.position="absolute",e.className=utils_type.A.evaluate(t.visProp.cssclass),i=utils_type.A.evaluate(t.visProp.layer),utils_type.A.exists(i)||(i=0),s=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),e.style.zIndex=s+i,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)?(s=utils_type.A.evaluate(t.visProp.anchor.visProp.visible),t.prepareUpdate().updateVisibility(s)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateText:function(t){var e,i,s,r,o,n=t.plaintext;if(t.visPropCalc.visible)if(this.updateTextStyle(t,!1),"html"===utils_type.A.evaluate(t.visProp.display)&&"no"!==this.type){if(isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(o=t.coords.scrCoords[1],o=Math.abs(o)<1e6?o:1e6,r="right"===(i=t.getAnchorX())?(e=t.board.canvasWidth-o,"right"):"middle"===i?(e=o-.5*t.size[0],"center"):(e=o,"left"),t.visPropOld.left!==i+e&&("right"===i?(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=i+e),o=t.coords.scrCoords[2]+this.vOffsetText,o=Math.abs(o)<1e6?o:1e6,o="bottom"===(i=t.getAnchorY())?(e=t.board.canvasHeight-o,"bottom"):"middle"===i?(e=o-.5*t.size[1],"center"):(e=o,"top"),t.visPropOld.top!==i+e&&("bottom"===i?(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=i+e)),t.htmlStr!==n){try{t.type===utils_type.A.OBJECT_TYPE_BUTTON?t.rendNodeButton.innerHTML=n:t.type===utils_type.A.OBJECT_TYPE_CHECKBOX||t.type===utils_type.A.OBJECT_TYPE_INPUT?t.rendNodeLabel.innerHTML=n:t.rendNode.innerHTML=n}catch(e){i=t.rendNode.parentNode,t.rendNode.parentNode.removeChild(t.rendNode),t.rendNode.innerHTML=n,i.appendChild(t.rendNode)}if(t.htmlStr=n,utils_type.A.evaluate(t.visProp.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(utils_type.A.evaluate(t.visProp.usekatex))try{(s=0===t.rendNode.innerHTML.indexOf("<span")&&0<t.rendNode.innerHTML.indexOf("<label")&&(0<t.rendNode.innerHTML.indexOf("<checkbox")||0<t.rendNode.innerHTML.indexOf("<input"))?t.rendNodeLabel:0===t.rendNode.innerHTML.indexOf("<button")?t.rendNodeButton:t.rendNode)&&katex.render(n,s,{macros:utils_type.A.evaluate(t.visProp.katexmacros),throwOnError:!1})}catch(t){jxg.A.debug("KaTeX not loaded (yet)")}else if(utils_type.A.evaluate(t.visProp.useasciimathml))try{AMprocessNode(t.rendNode,!1)}catch(t){jxg.A.debug("AsciiMathML not loaded (yet)")}}0!==(i=utils_type.A.evaluate(t.visProp.rotate))&&(i*=Math.PI/180,n=Math.cos(i),s=Math.sin(i),t.rendNode.style.transform="matrix("+[n,-1*s,s,n,0,0].join(",")+")",t.rendNode.style["transform-origin"]=r+" "+o),this.transformImage(t,t.transformations)}else this.updateInternalText(t)},_css2js:function(t){for(var e,i,s=[],r=utils_type.A.trim(t).replace(/;$/,"").split(";"),o=r.length,n=0;n<o;++n)""!==utils_type.A.trim(r[n])&&(i=r[n].split(":"),e=utils_type.A.trim(i[0].replace(/-([a-z])/gi,function(t,e){return e.toUpperCase()})),i=utils_type.A.trim(i[1]),s.push({key:e,val:i}));return s},updateTextStyle:function(t,e){var i,s,r,o,n,a,l,h,u=t.visProp,c=env.A.isBrowser?u.display:"internal",d=["rendNode","rendNodeTag","rendNodeLabel"],p=d.length,_=utils_type.A.evaluate(u.fontunit),f=["cssdefaultstyle","cssstyle"],A=f.length,g=e?(r=u.highlightstrokecolor,s=u.highlightstrokeopacity,u.highlightcssclass):(r=u.strokecolor,s=u.strokeopacity,u.cssclass);if("no"!==this.type&&("html"===c||"canvas"!==this.type)){for(l=0;l<A;l++)if(""!==(h=utils_type.A.evaluate(u[(e?"highlight":"")+f[l]]))&&t.visPropOld[f[l]]!==h){for(n=this._css2js(h),o=0;o<p;o++)if(utils_type.A.exists(t[d[o]]))for(a in n)n.hasOwnProperty(a)&&(t[d[o]].style[n[a].key]=n[a].val);t.visPropOld[f[l]]=h}if(i=utils_type.A.evaluate(u.fontsize),t.visPropOld.fontsize!==i){t.needsSizeUpdate=!0;try{for(o=0;o<p;o++)utils_type.A.exists(t[d[o]])&&(t[d[o]].style.fontSize=i+_)}catch(e){for(o=0;o<p;o++)utils_type.A.exists(t[d[o]])&&(t[d[o]].style.fontSize=i)}t.visPropOld.fontsize=i}}return this.setTabindex(t),this.setObjectTransition(t),"html"===c&&"no"!==this.type?(this.setObjectViewport(t,!0),t.visPropOld.cssclass!==g&&(t.rendNode.className=g,t.visPropOld.cssclass=g,t.needsSizeUpdate=!0),this.setObjectStrokeColor(t,r,s)):this.updateInternalTextStyle(t,r,s),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.transformImage(t,t.transformations),this._updateVisual(t,{stroke:!0,dash:!0},!0)},joinTransforms:function(t,e){for(var i=t.board.origin.scrCoords[1],s=t.board.origin.scrCoords[2],r=t.board.unitX,t=t.board.unitY,o=e.length,n=[[1,0,0],[-i/r,1/r,0],[s/t,0,-1/t]],a=0;a<o;a++)n=math.A.matMatMult(e[a].matrix,n);return math.A.matMatMult([[1,0,0],[i,r,0],[s,0,-t]],n)},transformImage:function(t,e){},updateImageURL:function(t){},updateImageStyle:function(t,e){t.rendNode.className=utils_type.A.evaluate(e?t.visProp.highlightcssclass:t.visProp.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){},setPropertyPrim:function(t,e,i){},setTabindex:function(t){var e;t.board.attr.keyboard.enabled&&utils_type.A.exists(t.rendNode)&&(e=utils_type.A.evaluate(t.visProp.tabindex),(e=t.visPropCalc.visible&&!utils_type.A.evaluate(t.visProp.fixed)?e:null)!==t.visPropOld.tabindex&&(t.rendNode.setAttribute("tabindex",e),t.visPropOld.tabindex=e))},display:function(t,e){t&&(t.visPropOld.visible=e)},show:function(t){},hide:function(t){},setBuffering:function(t,e){},setDashStyle:function(t){},setDraft:function(t){var e,i;utils_type.A.evaluate(t.visProp.draft)&&(e=t.board.options.elements.draft.color,i=t.board.options.elements.draft.opacity,this.setObjectViewport(t),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)))},removeDraft:function(t){this.setObjectViewport(t),this.setObjectTransition(t),t.type===constants.A.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity):(t.type===constants.A.OBJECT_CLASS_POINT&&this.setObjectFillColor(t,t.visProp.fillcolor,t.visProp.fillopacity),this.setObjectStrokeColor(t,t.visProp.strokecolor,t.visProp.strokeopacity),this.setObjectStrokeWidth(t,t.visProp.strokewidth))},setGradient:function(t){},updateGradient:function(t){},setObjectTransition:function(t,e){},setObjectViewport:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setShadow:function(t){},highlight:function(t,e){var i,s,r=t.visProp;if(this.setObjectViewport(t),this.setObjectTransition(t),!r.draft){if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,r.highlightfillcolor,r.highlightfillopacity),s=utils_type.A.evaluate(r.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.setObjectStrokeColor(t,r.highlightstrokecolor,r.highlightstrokeopacity),this.setObjectFillColor(t,r.highlightfillcolor,r.highlightfillopacity));r.highlightstrokewidth&&!e&&(e=Math.max(utils_type.A.evaluate(r.highlightstrokewidth),utils_type.A.evaluate(r.strokewidth)),this.setObjectStrokeWidth(t,e),t.elementClass!==constants.A.OBJECT_CLASS_LINE&&t.elementClass!==constants.A.OBJECT_CLASS_CURVE||this.updatePathWithArrowHeads(t,!0))}return this},noHighlight:function(t){var e,i=t.visProp;if(this.setObjectViewport(t),this.setObjectTransition(t),!utils_type.A.evaluate(t.visProp.draft)){if(t.type===constants.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,i.fillcolor,i.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.setObjectStrokeColor(t,i.strokecolor,i.strokeopacity),this.setObjectFillColor(t,i.fillcolor,i.fillopacity));i=utils_type.A.evaluate(i.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},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(o,t){function e(t,e,i,s){var r;i=i||"",(r=n.createElement("span")).innerHTML=t,r.style.paddingLeft="7px",r.style.paddingRight="7px",void 0!==r.classList&&(r.classList.add("JXG_navigation_button"),r.classList.add("JXG_navigation_button_"+s)),r.setAttribute("id",i+"_navigation_"+s),a.appendChild(r),env.A.addEvent(r,"click",function(t){return utils_type.A.bind(e,o)(),!1},o),env.A.addEvent(r,"pointerup",l,o),env.A.addEvent(r,"pointerdown",l,o),env.A.addEvent(r,"pointerleave",l,o),env.A.addEvent(r,"mouseup",l,o),env.A.addEvent(r,"mousedown",l,o),env.A.addEvent(r,"touchend",l,o),env.A.addEvent(r,"touchstart",l,o)}var n,a,l=function(t){(t=t||window.event).stopPropagation?t.stopPropagation():t.cancelBubble=!0};env.A.isBrowser&&"no"!==this.type&&(n=o.containerObj.ownerDocument,(a=n.createElement("div")).setAttribute("id",o.container+"_navigationbar"),a.style.color=t.strokecolor,a.style.backgroundColor=t.fillcolor,a.style.padding=t.padding,a.style.position=t.position,a.style.fontSize=t.fontsize,a.style.cursor=t.cursor,a.style.zIndex=t.zindex,o.containerObj.appendChild(a),a.style.right=t.right,a.style.bottom=t.bottom,void 0!==a.classList&&a.classList.add("JXG_navigation"),o.attr.showfullscreen&&e(o.attr.fullscreen.symbol,function(){o.toFullscreen(o.attr.fullscreen.id)},o.container,"fullscreen"),o.attr.showscreenshot&&e(o.attr.screenshot.symbol,function(){window.setTimeout(function(){o.renderer.screenshot(o,"",!1)},330)},o.container,"screenshot"),o.attr.showreload&&e("↻",function(){o.reload()},o.container,"reload"),o.attr.showcleartraces&&e("⊗",function(){o.clearTraces()},o.container,"cleartraces"),o.attr.shownavigation&&(o.attr.showzoom&&(e("–",o.zoomOut,o.container,"out"),e("o",o.zoom100,o.container,"100"),e("+",o.zoomIn,o.container,"in")),e("←",o.clickLeftArrow,o.container,"left"),e("↓",o.clickUpArrow,o.container,"down"),e("↑",o.clickDownArrow,o.container,"up"),e("→",o.clickRightArrow,o.container,"right")))},getElementById:function(t){return utils_type.A.exists(this.container)?(t=this.container.id+"_"+t,utils_type.A.exists(CSS)&&utils_type.A.exists(CSS.escape)&&(t=CSS.escape(t)),this.container.querySelector("#"+t)):""},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){},setLayer:function(t,e){}}),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],utils_encoding=(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):(127<i&&i<2048?s+=String.fromCharCode(i>>6|192):s=(s+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128),s+=String.fromCharCode(63&i|128));return s},decode:function(t){for(var e,i,s=0,r=0,o=UTF8_ACCEPT,n=[],a=t.length,l=[],h=0;h<a;h++)e=t.charCodeAt(h),i=UTF8D[e],r=o!==UTF8_ACCEPT?63&e|r<<6:255>>i&e,(o=UTF8D[256+o+i])===UTF8_ACCEPT&&(65535<r?n.push(55232+(r>>10),56320+(1023&r)):n.push(r),++s%1e4==0&&(l.push(String.fromCharCode.apply(null,n)),n=[]));return l.push(String.fromCharCode.apply(null,n)),l.join("")},asciiCharCodeAt:function(t,e){var i=t.charCodeAt(e);if(255<i)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}},jxg.A.Util.UTF8),alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pad="=",base64=(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){for(var e,i,s,r=[],o=(i=(s=utils_encoding.encode(t)).length)%3,n=0;n<i-o;n+=3)e=this._getByte(s,n)<<16|this._getByte(s,n+1)<<8|this._getByte(s,n+2),r.push(alphabet.charAt(e>>18),alphabet.charAt(e>>12&63),alphabet.charAt(e>>6&63),alphabet.charAt(63&e));switch(o){case 1:e=this._getByte(s,i-1),r.push(alphabet.charAt(e>>2),alphabet.charAt(e<<4&63),pad,pad);break;case 2:e=this._getByte(s,i-2)<<8|this._getByte(s,i-1),r.push(alphabet.charAt(e>>10),alphabet.charAt(e>>4&63),alphabet.charAt(e<<2&63),pad)}return r.join("")},decode:function(t,e){var i,s,r,o,n,a=[],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&&(a.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 a.push(String.fromCharCode.apply(null,l)),t=a.join(""),t=e?utils_encoding.decode(t):t},decodeAsArray:function(t){for(var e=this.decode(t),i=[],s=e.length,r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}},jxg.A.Util.Base64),reader_file=(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;4===t.readyState&&(t=!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(t,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){t=t.target.result;this.parseString(t,e,i,o)},this.cb=utils_type.A.bind(this.cbp,this);s=new FileReader;s.onload=this.cb,"raw"===i.toLowerCase()?s.readAsText(t):s.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'),jxg.A.FileReader),geonext=__webpack_require__(86),jessiecode=__webpack_require__(428),utils_color=__webpack_require__(873),composition=(jxg.A.Composition=function(t){for(var i=this,e=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],s=0;s<e.length;s++)this[e[s]]=function(e){return function(){for(var t in i.elements)i.elements.hasOwnProperty(t)&&utils_type.A.exists(i.elements[t][e])&&i.elements[t][e].apply(i.elements[t],arguments);return i}}(e[s]);for(s 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(s)&&this.add(s,t[s]);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}}),jxg.A.Composition),base_board=(jxg.A.Board=function(t,e,i,s,r,o,n,a,l,h,u){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(u.document)&&!1!==u.document?this.document=u.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=u,"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=l,this.canvasHeight=h,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.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.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?["","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω"]:["","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;0<i;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)._pos=this.objectsList.length,this.objectsList[this.objectsList.length]=t,r},finalizeAdding:function(t){!1===utils_type.A.evaluate(t.visProp.visible)&&this.renderer.display(t,!1)},finalizeLabel:function(t){t.hasLabel&&!utils_type.A.evaluate(t.label.visProp.islabel)&&!1===utils_type.A.evaluate(t.label.visProp.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=!e&&1e3<=(i-this.touchMoveLast)*this.attr.maxframerate?!0:e)&&(this.touchMoveLast=i),e},getCoordsTopLeftCorner:function(){var t,e,i,s,r=this.document.ownerDocument||this.document,o=r.documentElement||this.document.body.parentNode,r=r.body,n=this.containerObj;if(0<this.cPos.length&&(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(),n.getBoundingClientRect){for(e=n.getBoundingClientRect(),i=1,s=n;s&&utils_type.A.exists(s.parentNode);)utils_type.A.exists(s.style)&&utils_type.A.exists(s.style.zoom)&&""!==s.style.zoom&&(i*=parseFloat(s.style.zoom)),s=s.parentNode;return(e=[e.left*i,e.top*i])[0]+=env.A.getProp(n,"border-left-width"),e[1]+=env.A.getProp(n,"border-top-width"),"vml"!==this.renderer.type&&(e[0]+=env.A.getProp(n,"padding-left"),e[1]+=env.A.getProp(n,"padding-top")),this.cPos=e.slice(),this.cPos}return e=env.A.getOffset(n),t=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&t.defaultView&&(e[0]+=env.A.getProp(o,"margin-left"),e[1]+=env.A.getProp(o,"margin-top"),e[0]+=env.A.getProp(o,"border-left-width"),e[1]+=env.A.getProp(o,"border-top-width"),e[0]+=env.A.getProp(o,"padding-left"),e[1]+=env.A.getProp(o,"padding-top")),r&&(e[0]+=env.A.getProp(r,"left"),e[1]+=env.A.getProp(r,"top")),"object"==typeof google&&google.translate&&(e[0]+=10,e[1]+=25),e[0]+=env.A.getProp(n,"border-left-width"),e[1]+=env.A.getProp(n,"border-top-width"),"vml"!==this.renderer.type&&(e[0]+=env.A.getProp(n,"padding-left"),e[1]+=env.A.getProp(n,"padding-top")),e[0]+=this.attr.offsetx,e[1]+=this.attr.offsety,this.cPos=e.slice(),this.cPos},getPointLoc:function(t,e){var i,s=this.getBoundingBox();return 2===(t=t).length&&t.unshift(void 0),i=[0,0],utils_type.A.isNumber(e=e||0)&&(e=[e,e,e,e]),t[1]>s[2]-e[1]&&(i[0]=1),t[1]<s[0]+e[3]&&(i[0]=-1),t[2]>s[1]-e[0]&&(i[1]=1),t[2]<s[3]+e[2]&&(i[1]=-1),i},getLocationOrigin:function(t){return this.getPointLoc([0,0],t)},getMousePosition:function(t,e){var i=this.getCoordsTopLeftCorner(),t=env.A.getPosition(t,e,this.document);return this.updateCSSTransforms(),e=[1,t[0]-i[0],t[1]-i[1]],(e=math.A.matVecMult(this.cssTransMat,e))[1]/=e[0],e[2]/=e[0],[e[1],e[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=[],l=[],h=this.objectsList.length,u={visProp:{layer:-1e4}};for(this._shiftKey=i.shiftKey,this._ctrlKey=i.ctrlKey,o=0;o<h;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)&&!utils_type.A.evaluate(r.visProp.fixed)&&(r.visProp.layer>u.visProp.layer||r.visProp.layer===u.visProp.layer&&r.lastDragTime.getTime()>=u.lastDragTime.getTime())&&(this.attr.ignorelabels&&utils_type.A.exists(u.label)&&r===u.label||(u=r,a.push(u),utils_type.A.exists(u.coords)?l.push(statistics.A.subtract(u.coords.scrCoords.slice(1),[t,e])):l.push([0,0])));return this.attr.drag.enabled&&0<a.length&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(a.length=1,this._drag_offset=l[0]):(a=a.slice(-1),this._drag_offset=l[l.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&utils_type.A.exists(a[0])&&utils_type.A.evaluate(a[0].visProp.dragtotopoflayer)&&1===a.length&&utils_type.A.exists(a[0].rendNode)&&a[0].rendNode.parentNode.appendChild(a[0].rendNode),1<=a.length&&(a[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[i,a[0]])),a},moveObject:function(t,e,i,s,r){var o,n,t=new base_coords.A(constants.A.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,e),this);i&&i.obj&&((e=i.obj).coords&&(o=e.coords.scrCoords.slice()),this.addLogEntry("drag",e,t.usrCoords.slice(1)),this.drag_position=[t.scrCoords[1],t.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(e.coords)?e.setPositionDirectly(constants.A.COORDS_BY_SCREEN,this.drag_position):(this.displayInfobox(!1),isNaN(i.targets[0].Xprev+i.targets[0].Yprev)||e.setPositionDirectly(constants.A.COORDS_BY_SCREEN,[t.scrCoords[1],t.scrCoords[2]],[i.targets[0].Xprev,i.targets[0].Yprev]),i.targets[0].Xprev=t.scrCoords[1],i.targets[0].Yprev=t.scrCoords[2]),utils_type.A.exists(e.coords)&&(e.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(e),e.prepareUpdate().update(!0).updateRenderer()),e.coords&&(n=e.coords.scrCoords),e.coords&&o[1]===n[1]&&o[2]===n[2]||(e.triggerEventHandlers([r+"drag","drag"],[s]),this.update()),e.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[s,e]),e.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,l,h=(o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this).usrCoords)[1],u=o[2],c=(o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[e.Xprev,e.Yprev],this).usrCoords)[1],d=o[2],t=(o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.X,t.Y],this).usrCoords)[1],p=o[2],_=((n=(e=(o=new base_coords.A(constants.A.COORDS_BY_SCREEN,[e.X,e.Y],this).usrCoords)[1])-t)*(l=c-h)+(f=(o=o[2])-p)*(r=d-u))/(a=l*l+r*r),f=(f*l-n*r)/a;return i||(_/=l=math.A.hypot(_,f),f/=l),[1,0,0,.5*(t+e-_*(h+c)+(f=s?f:0)*(u+d)),_,-f,.5*(p+o-f*(h+c)-_*(u+d)),f,_]},twoFingerTouchObject:function(t,e,i){var s,r,o,n,a=!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(t=this.getTwoFingerTransform(t[0],t[1],utils_type.A.evaluate(e.visProp.scalable),utils_type.A.evaluate(e.visProp.rotatable)),(t=this.create("transform",t,{type:"generic"})).update(),e.elementClass===constants.A.OBJECT_CLASS_LINE)s=[],e.point1.draggable()&&s.push(e.point1),e.point2.draggable()&&s.push(e.point2),t.applyOnce(s);else if(e.type===constants.A.OBJECT_TYPE_POLYGON){for(o=e.vertices.length-1,n=e.visProp,a=utils_type.A.evaluate(n.snaptogrid)||utils_type.A.evaluate(n.snaptopoints),r=0;r<o&&!a;++r)n=e.vertices[r].visProp,a=(a=a||utils_type.A.evaluate(n.snaptogrid)||utils_type.A.evaluate(n.snaptopoints))||!e.vertices[r].draggable();if(!a){for(s=[],r=0;r<o;++r)e.vertices[r].draggable()&&s.push(e.vertices[r]);t.applyOnce(s)}}this.update(),e.highlight(!0)}},twoFingerTouchCircle:function(t,e,i){var s,r,o,n;"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=i===t[0].num?(s=t[1],t[0]):(s=t[0],t[1]),t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[s.Xprev,s.Yprev],this).usrCoords,s=new base_coords.A(constants.A.COORDS_BY_SCREEN,[i.Xprev,i.Yprev],this).usrCoords,i=new base_coords.A(constants.A.COORDS_BY_SCREEN,[i.X,i.Y],this).usrCoords,n=geometry.A.rad(s.slice(1),t.slice(1),i.slice(1)),o=this.create("transform",[-t[1],-t[2]],{type:"translate"}),n=this.create("transform",[n],{type:"rotate"}),o.melt(n),utils_type.A.evaluate(e.visProp.scalable)&&(r=geometry.A.distance(t,i)/geometry.A.distance(t,s),n=this.create("transform",[r,r],{type:"scale"}),o.melt(n)),i=this.create("transform",[t[1],t[2]],{type:"translate"}),o.melt(i),e.center.draggable()&&o.applyOnce([e.center]),"twoPoints"===e.method?e.point2.draggable()&&o.applyOnce([e.point2]):"pointRadius"===e.method&&utils_type.A.isNumber(e.updateRadius.origin)&&e.setRadius(e.radius*r),this.update(e.center),e.highlight(!0))},highlightElements:function(t,e,i,s){for(var r,o,n={},a=this.objectsList.length,l=0;l<a;l++)o=(r=this.objectsList[l]).id,utils_type.A.exists(r.hasPoint)&&r.visPropCalc.visible&&r.hasPoint(t,e)&&(this.updateInfobox(r),utils_type.A.exists(this.highlightedObjects[o])||((n[o]=r).highlight(),this.triggerEventHandlers(["mousehit","hit"],[i,r,s])),r.mouseover?r.triggerEventHandlers(["mousemove","move"],[i]):(r.triggerEventHandlers(["mouseover","over"],[i]),r.mouseover=!0));for(l=0;l<a;l++)o=(r=this.objectsList[l]).id,!r.mouseover||n[o]||(r.triggerEventHandlers(["mouseout","out"],[i]),r.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)0<t.points.length&&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;return(e=this._isRequiredKeyPressed(t,"pan"))&&(t=this.getMousePosition(t),this.initMoveOrigin(t[0],t[1])),e},mouseOriginMove:function(t){var e=this.mode===this.BOARD_MODE_MOVE_ORIGIN;return e&&(t=this.getMousePosition(t),this.moveOrigin(t[0],t[1],!0)),e},touchStartMoveOriginOneFinger:function(t){var e=t.touches;return(e=this.attr.pan.enabled&&!this.attr.pan.needtwofingers&&1===e.length)&&(t=this.getMousePosition(t,0),this.initMoveOrigin(t[0],t[1])),e},touchOriginMove:function(t){var e=this.mode===this.BOARD_MODE_MOVE_ORIGIN;return e&&(t=this.getMousePosition(t,0),this.moveOrigin(t[0],t[1],!0)),e},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(0<this.resizeHandlers.length&&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(){var t;!this.hasPointerHandlers&&env.A.isBrowser&&(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(){var t;!this.hasMouseHandlers&&env.A.isBrowser&&(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){var e;!this.hasTouchHandlers&&env.A.isBrowser&&(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(){var t;this.hasPointerHandlers&&env.A.isBrowser&&(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(){var t;this.hasMouseHandlers&&env.A.isBrowser&&(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(){var t;this.hasTouchHandlers&&env.A.isBrowser&&(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=!1,l=this.attr.zoom.factorx,h=this.attr.zoom.factory,u=!1;return this.mode!==this.BOARD_MODE_ZOOM||(t.preventDefault(),i=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=i/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]],e=[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&&e[0]*e[0]+e[1]*e[1]<100||(i=geometry.A.rad(i,[0,0],e),"pan"!==this.isPreviousGesture&&Math.abs(i)>.2*Math.PI&&Math.abs(i)<1.8*Math.PI&&(a=!0),"pan"===this.isPreviousGesture||a||(Math.abs(t.scale)<.77||1.3<Math.abs(t.scale))&&(a=!0),e=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]],i=new base_coords.A(constants.A.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!a?(this.isPreviousGesture="pan",this.moveOrigin(i.scrCoords[1],i.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(e-1)<.5&&(u=!1,a=this.attr.zoom.center,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(r=Math.abs(t.touches[0].clientX-t.touches[1].clientX),t=Math.abs(t.touches[0].clientY-t.touches[1].clientY),r=Math.abs(Math.atan2(t,r)),s=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&r<s?(this.attr.zoom.factorx=e,this.attr.zoom.factory=1,u=!(n=o=0)):!this.keepaspectratio&&this.attr.zoom.pinchvertical&&Math.abs(r-.5*Math.PI)<s?(this.attr.zoom.factorx=1,this.attr.zoom.factory=e,u=!(n=o=0)):this.attr.zoom.pinch&&(this.attr.zoom.factorx=e,this.attr.zoom.factory=e,o=i.usrCoords[1],n=i.usrCoords[2],u=!0),u&&("board"===a?this.zoomIn():this.zoomIn(o,n),this.attr.zoom.factorx=l,this.attr.zoom.factory=h))),!1))},gestureStartListener:function(t){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",t=this.getMousePosition(t,0),this.initMoveOrigin(t[0],t[1]),this.mode=this.BOARD_MODE_ZOOM,!1},_isRequiredKeyPressed:function(t,e){e=this.attr[e];return!!e.enabled&&!(!(e.needshift&&t.shiftKey||!e.needshift&&!t.shiftKey)||!(e.needctrl&&t.ctrlKey||!e.needctrl&&!t.ctrlKey))},_isPointerRegistered:function(t){for(var e=this._board_touches.length,i=0;i<e;i++)if(this._board_touches[i].pointerId===t.pointerId)return!0;return!1},_pointerStorePosition:function(t){for(var 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){for(var 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){0<this._board_touches.length&&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&&1<window.navigator.msMaxTouchPoints)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,l,h,u,c;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),h=this._inputDevice,this.options.precision.hasPoint=this.options.precision[h],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,h),l={num:t.pointerId,X:n[0],Y:n[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},0<a.length){for(c=a[a.length-1],u=!1,s=0;s<this.touches.length;s++)if(this.touches[s].obj===c){r=s,o=this.touches[s].targets.push(l)-1,u=!0;break}u||(o=0,r=this.touches.push({obj:c,targets:[l]})-1),this.dehighlightAll(),c.highlight(!0),this.saveStartPos(c,this.touches[r].targets[o]),t&&t.preventDefault&&!i&&t.preventDefault()}return 0<this.touches.length&&!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))),e="none",this.mode!==this.BOARD_MODE_NONE||!utils_type.A.evaluate(this.attr.browserpan)||utils_type.A.evaluate(this.attr.pan.enabled)&&!utils_type.A.evaluate(this.attr.pan.needtwofingers)||(e="pan-x pan-y"),this.containerObj.style.touchAction=e,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){if(this.selectingMode)t.stopPropagation();else{for(var 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;-1<e;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)&&0<r.click.length||utils_type.A.exists(r.pointerclick)&&0<r.pointerclick.length||utils_type.A.exists(r.dblclick)&&0<r.dblclick.length||utils_type.A.exists(r.pointerdblclick)&&0<r.pointerdblclick.length)&&(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,l,h,u=this.options.precision.touch,c=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<c.length;e++)c[e].jxg_isused=!1;for(e=0;e<this.touches.length;e++)for(h=this.touches[e].targets,s=0;s<h.length;s++){h[s].num=-1,u=this.options.precision.touch;do{for(r=0;r<c.length;r++)if(Math.abs(Math.pow(c[r].screenX-h[s].X,2)+Math.pow(c[r].screenY-h[s].Y,2))<u*u){h[s].num=r,h[s].X=c[r].screenX,h[s].Y=c[r].screenY,c[r].jxg_isused=!0;break}}while(u*=2,-1===h[s].num&&u<this.options.precision.touchMax);-1===h[s].num&&(jxg.A.debug("i couldn't find a targettouches for target no "+s+" 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),h.splice(e,1))}for(e=0;e<c.length;e++)if(!c[e].jxg_isused){if(i=this.getMousePosition(t,e),this.selectingMode)return this._startSelecting(i),this.triggerEventHandlers(["touchstartselecting","startselecting"],[t]),t.preventDefault(),t.stopPropagation(),this.options.precision.hasPoint=this.options.precision.mouse,0<this.touches.length;if(0!==(i=this.initMoveObject(i[0],i[1],t,"touch")).length)if(o=i[i.length-1],l={num:e,X:c[e].screenX,Y:c[e].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},utils_type.A.isPoint(o)||o.elementClass===constants.A.OBJECT_CLASS_TEXT||o.type===constants.A.OBJECT_TYPE_TICKS||o.type===constants.A.OBJECT_TYPE_IMAGE)this.saveStartPos(o,(a=[l])[0]),this.touches.push({obj:o,targets:a}),o.highlight(!0);else if(o.elementClass===constants.A.OBJECT_CLASS_LINE||o.elementClass===constants.A.OBJECT_CLASS_CIRCLE||o.elementClass===constants.A.OBJECT_CLASS_CURVE||o.type===constants.A.OBJECT_TYPE_POLYGON){for(n=!1,s=0;s<this.touches.length;s++)o.id===this.touches[s].obj.id&&(n=!0,1===this.touches[s].targets.length&&(this.saveStartPos(o,l),this.touches[s].targets.push(l)),c[e].jxg_isused=!0);n||(this.saveStartPos(o,(a=[l])[0]),this.touches.push({obj:o,targets:a}),o.highlight(!0))}c[e].jxg_isused=!0}return 0<this.touches.length&&(t.preventDefault(),t.stopPropagation()),1===c.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(t)||2!==c.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&&-1<r[0].num&&-1<r[1].num&&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,l=[],h=t&&t.touches,u=!1;if(this.triggerEventHandlers(["touchend","up"],[t]),this.displayInfobox(!1),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[t]),this.stopSelectionMode();else if(h&&0<h.length){for(e=0;e<this.touches.length;e++)l[e]=this.touches[e];for(e=this.touches.length=0;e<h.length;e++)h[e].jxg_isused=!1;for(e=0;e<l.length;e++){for(r=!1,n=l[e].targets,i=o=0;i<n.length;i++)for(n[i].found=!1,s=0;s<h.length;s++)if(Math.abs(Math.pow(h[s].screenX-n[i].X,2)+Math.pow(h[s].screenY-n[i].Y,2))<a*a){n[i].found=!0,n[i].num=s,n[i].X=h[s].screenX,n[i].Y=h[s].screenY,o+=1;break}if(utils_type.A.isPoint(l[e].obj)?r=n[0]&&n[0].found:l[e].obj.elementClass===constants.A.OBJECT_CLASS_LINE?r=n[0]&&n[0].found||n[1]&&n[1].found:l[e].obj.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&(r=1===o||3===o),r)for(this.touches.push({obj:l[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 l[e].obj.noHighlight()}}else this.touches.length=0;for(e=this.downObjects.length-1;-1<e;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(),u=!0),this.downObjects.splice(e,1))}return h&&0!==h.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(),u&&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,0<e?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=t.target.id,n=0,a=0,l=utils_type.A.evaluate(this.attr.keyboard.dx)/this.unitX,h=utils_type.A.evaluate(this.attr.keyboard.dy)/this.unitY,u=!1,c=!0;return!(!this.attr.keyboard.enabled||""===o)&&(!(i=this.containerObj.shadowRoot||document).activeElement||"INPUT"!==(e=i.activeElement).tagName&&"textarea"!==e.tagName)&&(i=o.replace(this.containerObj.id+"_",""),e=this.select(i),utils_type.A.exists(e.coords)&&(r=e.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)&&(u=!0),38===t.keyCode?this.clickUpArrow():40===t.keyCode?this.clickDownArrow():37===t.keyCode?this.clickLeftArrow():39===t.keyCode?this.clickRightArrow():u&&171===t.keyCode?this.zoomIn():u&&173===t.keyCode?this.zoomOut():u&&79===t.keyCode?this.zoom100():c=!1):(utils_type.A.exists(e.visProp)&&(utils_type.A.exists(e.visProp.snaptogrid)&&e.visProp.snaptogrid&&utils_type.A.evaluate(e.visProp.snapsizex)&&utils_type.A.evaluate(e.visProp.snapsizey)?(l=n=(o=e.getSnapSizes())[0],h=a=o[1]):utils_type.A.exists(e.visProp.attracttogrid)&&e.visProp.attracttogrid&&utils_type.A.evaluate(e.visProp.attractordistance)&&utils_type.A.evaluate(e.visProp.attractorunit)&&(a=n=1.1*utils_type.A.evaluate(e.visProp.attractordistance),"screen"===utils_type.A.evaluate(e.visProp.attractorunit)&&(n/=this.unitX,a/=this.unitX),l=Math.max(n,l),h=Math.max(a,h))),38===t.keyCode?s=[0,h]:40===t.keyCode?s=[0,-h]:37===t.keyCode?s=[-l,0]:39===t.keyCode?s=[l,0]:c=!1,s&&e.isDraggable&&e.visPropCalc.visible&&(this.geonextCompatibilityMode&&(utils_type.A.isPoint(e)||e.elementClass===constants.A.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!utils_type.A.evaluate(e.visProp.fixed)&&(this.mode=this.BOARD_MODE_DRAG,utils_type.A.exists(e.coords)&&(s[0]+=r[0],s[1]+=r[1]),utils_type.A.exists(e.coords)?(e.setPosition(jxg.A.COORDS_BY_USER,s),this.updateInfobox(e)):(this.displayInfobox(!1),e.setPositionDirectly(constants.A.COORDS_BY_USER,s,[0,0])),this.triggerEventHandlers(["keymove","move"],[t,this.mode]),e.triggerEventHandlers(["keydrag","drag"],[t]),this.mode=this.BOARD_MODE_NONE)),this.update(),c&&utils_type.A.exists(t.preventDefault)&&t.preventDefault(),c)},keyFocusInListener:function(t){var e,i=t.target.id;if(!this.attr.keyboard.enabled||""===i)return!1;i=i.replace(this.containerObj.id+"_",""),e=this.select(i),utils_type.A.exists(e.highlight)&&(e.highlight(!0),this.focusObjects=[i],e.triggerEventHandlers(["hit"],[t])),utils_type.A.exists(e.coords)&&this.updateInfobox(e)},keyFocusOutListener:function(t){if(!this.attr.keyboard.enabled)return!1;this.focusObjects=[],this.dehighlightAll(),this.displayInfobox(!1)},updateContainerDims:function(t,e){var i,s=t;void 0===t&&(s=this.containerObj.offsetWidth,e=this.containerObj.offsetHeight),void 0===t&&window&&window.getComputedStyle&&(t=window.getComputedStyle(this.containerObj,null),i=parseFloat(t.getPropertyValue("border-left-width"))+parseFloat(t.getPropertyValue("border-right-width")),isNaN(i)||(s-=i),i=parseFloat(t.getPropertyValue("border-top-width"))+parseFloat(t.getPropertyValue("border-bottom-width")),isNaN(i)||(e-=i)),s<=0||e<=0||isNaN(s)||isNaN(e)||(isNaN(this.getBoundingBox()[0])&&this.setBoundingBox(this.attr.boundingbox,this.keepaspectratio,"keep"),utils_type.A.exists(this._prevDim)&&this._prevDim.w===s&&this._prevDim.h===e||(this.resizeContainer(s,e,!0),this._prevDim={w:s,h:e}))},startResizeObserver:function(){var i=this;env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&(this.resizeObserver=new ResizeObserver(function(t){var e;i._isResizing||(i._isResizing=!0,e=t[0].contentRect,window.setTimeout(function(){try{i.updateContainerDims(e.width,e.height)}catch(t){i.stopResizeObserver()}finally{i._isResizing=!1}},i.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 e=this;try{this.intersectionObserver=new IntersectionObserver(function(t){isNaN(e.getBoundingBox()[0])&&e.updateContainerDims()},{root:null,rootMargin:"0px",threshold:.8}),this.intersectionObserver.observe(e.containerObj)}catch(e){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){t=utils_type.A.copyAttributes(t,this.options,"infobox");return t.id=this.id+"_infobox",this.infobox=this.create("text",[0,0,"0,0"],t),this.infobox.dump=!1,this.displayInfobox(!1),this},updateInfobox:function(t){var e,i,s,r,o=utils_type.A.evaluate(t.visProp.showinfobox);return(utils_type.A.evaluate(this.attr.showinfobox)||"inherit"!==o)&&o&&utils_type.A.isPoint(t)&&(o=t.coords.usrCoords[1],i=t.coords.usrCoords[2],s=utils_type.A.evaluate(this.infobox.visProp.distancex),r=utils_type.A.evaluate(this.infobox.visProp.distancey),this.infobox.setCoords(o+s/this.unitX,i+r/this.unitY),s=utils_type.A.evaluate(t.visProp.infoboxdigits),"string"!=typeof t.infoboxText?(r="auto"===s?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(o),this.infobox.formatNumberLocale(i)):(e=utils_type.A.autoDigits(o),utils_type.A.autoDigits(i)):utils_type.A.isNumber(s)?this.infobox.useLocale()?(e=this.infobox.formatNumberLocale(o,s),this.infobox.formatNumberLocale(i,s)):(e=utils_type.A.toFixed(o,s),utils_type.A.toFixed(i,s)):(e=o,i),this.highlightInfobox(e,r,t)):this.highlightCustomInfobox(t.infoboxText,t),this.displayInfobox(!0)),this},displayInfobox:function(t){return!t&&0<this.focusObjects.length&&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(),t=env.A.getPosition(t,null,this.document),i=t[0]-e[0],t=t[1]-e[1];return new base_coords.A(constants.A.COORDS_BY_SCREEN,[i,t],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){for(var e,i=this.getCoordsTopLeftCorner(),t=env.A.getPosition(t,null,this.document),s=t[0]-i[0],r=t[1]-i[1],o=[],n=this.objectsList.length,a=0;a<n;a++)(e=this.objectsList[a]).visPropCalc.visible&&e.hasPoint&&e.hasPoint(s,r)&&(o[o.length]=e);return o},updateCoords:function(){for(var t,e=this.objectsList.length,i=0;i<e;i++)t=this.objectsList[i],utils_type.A.exists(t.coords)&&(utils_type.A.evaluate(t.visProp.frozen)?(t.is3D?t.element2D:t).coords.screen2usr():(t.is3D?t.element2D:t).coords.usr2screen());return this},moveOrigin:function(t,e,i){var s,r;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),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,(t[1]<this.maxboundingbox[0]||t[2]>this.maxboundingbox[1]||e[1]>this.maxboundingbox[2]||e[2]<this.maxboundingbox[3])&&(this.origin.scrCoords[1]=s,this.origin.scrCoords[2]=r)),this.updateCoords().clearTraces().fullUpdate(),this.triggerEventHandlers(["boundingbox"]),this},addConditions:function(t){function e(i,s,r,o){return function(){var t,e=(t=i.select(s.id)).coords.usrCoords[o];2===o?t.setPositionDirectly(constants.A.COORDS_BY_USER,[r(),e]):t.setPositionDirectly(constants.A.COORDS_BY_USER,[e,r()]),t.prepareUpdate().update()}}function i(i,s,r,o){return function(){var t=i.select(s.id),e=r();"strokewidth"===o?t.visProp.strokewidth=e:(e=utils_color.A.rgba2rgbo(e),t.visProp[o+"color"]=e[0],t.visProp[o+"opacity"]=e[1])}}var s,r,o,n,a,l,h=[],u=t.indexOf("<data>"),c=t.indexOf("</data>");if(!(u<0)){for(;0<=u;){if(s=(n=t.slice(u+6,c)).indexOf("="),r=n.slice(0,s),o=n.slice(s+1),s=r.indexOf("."),n=r.slice(0,s),a=this.elementsByName[utils_type.A.unescapeHTML(n)],l=r.slice(s+1).replace(/\s+/g,"").toLowerCase(),o=utils_type.A.createFunction(o,this,"",!0),utils_type.A.exists(this.elementsByName[n]))switch(l){case"x":h.push(e(this,a,o,2));break;case"y":h.push(e(this,a,o,1));break;case"visible":h.push(function(i,s,r){return function(){var t=i.select(s.id),e=r();t.setAttribute({visible:e})}}(this,a,o));break;case"position":h.push(function(t,e,i){return function(){t.select(e.id).position=i()}}(this,a,o));break;case"stroke":h.push(i(this,a,o,"stroke"));break;case"style":h.push(function(t,e,i){return function(){t.select(e.id).setStyle(i())}}(this,a,o));break;case"strokewidth":h.push(i(this,a,o,"strokewidth"));break;case"fill":h.push(i(this,a,o,"fill"));break;case"label":break;default:jxg.A.debug('property "'+l+'" in conditions not yet implemented:'+o)}else jxg.A.debug("debug conditions: |"+n+"| undefined");u=(t=t.slice(c+7)).indexOf("<data>"),c=t.indexOf("</data>")}this.updateConditions=function(){for(var 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=this.getBoundingBox(),s=utils_type.A.evaluate(this.options.grid.majorStep),r=utils_type.A.evaluate(this.options.grid.gridX),o=utils_type.A.evaluate(this.options.grid.gridY);for((s=utils_type.A.isArray(s)?s:[s,s]).length<2&&(s=[s[0],s[0]]),utils_type.A.exists(r)&&(s[0]=r),utils_type.A.exists(o)&&(s[1]=o),"auto"===s[0]?s[0]=1:s[0]=utils_type.A.parseNumber(s[0],Math.abs(i[1]-i[3]),1/this.unitX),"auto"===s[1]?s[1]=1:s[1]=utils_type.A.parseNumber(s[1],Math.abs(i[0]-i[2]),1/this.unitY),r=new base_coords.A(constants.A.COORDS_BY_USER,[0,0],this),o=new base_coords.A(constants.A.COORDS_BY_USER,[s[0],s[1]],this),t=r.scrCoords[1]-o.scrCoords[1],e=r.scrCoords[2]-o.scrCoords[2],this.options.grid.snapSizeX=s[0];25<Math.abs(t);)this.options.grid.snapSizeX*=2,t/=2;for(this.options.grid.snapSizeY=s[1];25<Math.abs(e);)this.options.grid.snapSizeY*=2,e/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),s=this.attr.zoom.factorx,r=this.attr.zoom.factory,o=(i[2]-i[0])*(1-1/s),n=(i[1]-i[3])*(1-1/r),a=.5,l=.5,h=this.attr.zoom.eps||this.attr.zoom.min||.001;return this.zoomX>this.attr.zoom.max&&1<s||this.zoomY>this.attr.zoom.max&&1<r||this.zoomX<h&&s<1||this.zoomY<h&&r<1?this:(utils_type.A.isNumber(t)&&utils_type.A.isNumber(e)&&(a=(t-i[0])/(i[2]-i[0]),l=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+o*a,i[1]-n*l,i[2]-o*(1-a),i[3]+n*(1-l)],this.keepaspectratio,"update"),this.applyZoom())},zoomOut:function(t,e){var i=this.getBoundingBox(),s=this.attr.zoom.factorx,r=this.attr.zoom.factory,s=(i[2]-i[0])*(1-s),r=(i[1]-i[3])*(1-r),o=.5,n=.5,a=this.attr.zoom.eps||this.attr.zoom.min||.001;return this.zoomX<a||this.zoomY<a?this:(utils_type.A.isNumber(t)&&utils_type.A.isNumber(e)&&(o=(t-i[0])/(i[2]-i[0]),n=(i[1]-e)/(i[1]-i[3])),this.setBoundingBox([i[0]+s*o,i[1]-r*n,i[2]-s*(1-o),i[3]+r*(1-n)],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(){for(var t,e,i,s=0,r=0,o=0,n=0,a=this.objectsList.length,l=0;l<a;l++)i=this.objectsList[l],utils_type.A.isPoint(i)&&i.visPropCalc.visible&&(i.coords.usrCoords[1]<s?s=i.coords.usrCoords[1]:i.coords.usrCoords[1]>r&&(r=i.coords.usrCoords[1]),i.coords.usrCoords[2]>n?n=i.coords.usrCoords[2]:i.coords.usrCoords[2]<o&&(o=i.coords.usrCoords[2]));return t=50/this.unitX,e=50/this.unitY,this.setBoundingBox([s-t,n+e,r+t,o-e],this.keepaspectratio,"update"),this.applyZoom()},zoomElements:function(t){var e,i,s,r,o,n,a=[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]<a[0]&&(a[0]=i[0]),i[1]>a[1]&&(a[1]=i[1]),i[2]>a[2]&&(a[2]=i[2]),i[3]<a[3]&&(a[3]=i[3]));return utils_type.A.isArray(a)&&(s=.5*(a[0]+a[2]),r=.5*(a[1]+a[3]),n=1.5*(a[2]-a[0])*.5,o=1.5*(a[1]-a[3])*.5,n=Math.max(n,o),this.setBoundingBox([s-n,r+n,s+n,r-n],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(-1<t._pos)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&&utils_type.A.evaluate(t.visProp.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){for(var e in t.ancestors)t.ancestors.hasOwnProperty(e)&&this.removeAncestors(t.ancestors[e]);return this.removeObject(t),this},initGeonextBoard:function(){var 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});return 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=this.canvasWidth,n=this.canvasHeight;return 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?(t=.5*(this.canvasWidth-o),e=.5*(this.canvasHeight-n),this.moveOrigin(this.origin.scrCoords[1]+t,this.origin.scrCoords[2]+e)):this.setBoundingBox(r,this.keepaspectratio,"keep"),this},showDependencies:function(){var t,e,i,s,r="<p>\n";for(t in this.objects)if(this.objects.hasOwnProperty(t)){for(e in s=0,this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(e)&&(s+=1);for(e in 0<=s&&(r+="<strong>"+this.objects[t].id+":</strong> "),this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(e)&&(r+=this.objects[t].childElements[e].id+"("+this.objects[t].childElements[e].name+"), ");r+="<p>\n"}return r+="</p>\n",(i=window.open()).document.open(),i.document.write(r),i.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(){for(var t,e=this.objectsList.length,i=0;i<e;i++)(t=this.objectsList[i]).needsUpdate=t.needsRegularUpdate||this.needsFullUpdate;for(i in this.groups)this.groups.hasOwnProperty(i)&&((t=this.groups[i]).needsUpdate=t.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=this.objectsList.length;if(this.renderer){if("canvas"===this.renderer.type)this.updateRendererCanvas();else for(t=0;t<e;t++)this.objectsList[t].updateRenderer();return this}},updateRendererCanvas:function(){for(var t,e,i,s,r=this.objectsList.length,o=this.options.layer,n=this.options.layer.numlayers,a=Number.NEGATIVE_INFINITY,l=0;l<n;l++){for(s in i=Number.POSITIVE_INFINITY,o)o.hasOwnProperty(s)&&o[s]>a&&o[s]<i&&(i=o[s]);for(a=i,t=0;t<r;t++)(e=this.objectsList[t]).visProp.layer===i&&e.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){for(var e=this.dependentBoards.length-1;0<=e;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().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(){for(var 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;for(t=t.toLowerCase(),utils_type.A.exists(e)||(e=[]),utils_type.A.exists(i)||(i={}),s=0;s<e.length;s++)!utils_type.A.isString(e[s])||"text"===t&&2===s||"solidofrevolution3d"===t&&2===s||"text3d"===t&&(2===s||4===s)||!("input"!==t&&"checkbox"!==t&&"button"!==t||2!==s&&3!==s)||"curve"===t||"functiongraph"===t||"implicitcurve"===t||(e[s]=this.select(e[s]));if(utils_type.A.isFunction(jxg.A.elements[t]))return i=jxg.A.elements[t](this,e,i),utils_type.A.exists(i)?i.prepareUpdate&&i.update&&i.updateRenderer&&i.fullUpdate():jxg.A.debug("JSXGraph: create: failure creating "+t),i;throw new Error("JSXGraph: create: Unknown element type given: "+t)},createElement:function(){return jxg.A.deprecated("Board.createElement()","Board.create()"),this.create.apply(this,arguments)},clearTraces:function(){for(var 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,l,h,u=0,c=0,d=1,p=env.A.getDimensions(this.containerObj,this.document);return utils_type.A.isArray(t)&&(t[0]<this.maxboundingbox[0]||t[1]>this.maxboundingbox[1]||t[2]>this.maxboundingbox[2]||t[3]<this.maxboundingbox[3]||(utils_type.A.exists(i)||(i="reset"),r=this.unitX,o=this.unitY,this.canvasWidth=parseFloat(p.width),this.canvasHeight=parseFloat(p.height),p=this.canvasWidth,s=this.canvasHeight,e?(this.keepaspectratio?(n=r/o,isNaN(n)&&(n=1)):n=1,"keep"===i&&(d=this.zoomX/this.zoomY),l=r*(e=t[2]-t[0]),h=o*(a=t[1]-t[3]),s<=p?(this.unitY=h<=l?s/a:s/Math.abs(e)*math.A.sign(a)/d,this.unitX=this.unitY*n):(this.unitX=l<h?p/e:p/Math.abs(a)*math.A.sign(e)*d,this.unitY=this.unitX/n),u=.5*(p/this.unitX-e),c=.5*(s/this.unitY-a),this.keepaspectratio=!0):(this.unitX=p/(t[2]-t[0]),this.unitY=s/(t[1]-t[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(t[0]-u),this.unitY*(t[1]+c)),"update"===i?(this.zoomX*=this.unitX/r,this.zoomY*=this.unitY/o):"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},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){for(var e,i,s,r,o,n={},a=0;a<arguments.length;a++)utils_type.A.isString(e=arguments[a])?(i=e.split(":"),n[utils_type.A.trim(i[0])]=utils_type.A.trim(i[1])):utils_type.A.isArray(e)?n[e[0]]=e[1]:jxg.A.extend(n,e);for(a in n)if(n.hasOwnProperty(a)&&(s=a.replace(/\s+/g,"").toLowerCase(),r=n[a]),r=(!r.toLowerCase||"false"!==r.toLowerCase())&&r,this.attr[s]!==r)switch(s){case"axis":!1===r&&utils_type.A.exists(this.defaultAxes)&&(this.defaultAxes.x.setAttribute({visible:!1}),this.defaultAxes.y.setAttribute({visible:!1}));break;case"boundingbox":this.setBoundingBox(r,this.keepaspectratio),this._set(s,r);break;case"defaultaxes":utils_type.A.exists(this.defaultAxes.x)&&utils_type.A.exists(r.x)&&this.defaultAxes.x.setAttribute(r.x),utils_type.A.exists(this.defaultAxes.y)&&utils_type.A.exists(r.y)&&this.defaultAxes.y.setAttribute(r.y);break;case"description":this.document.getElementById(this.container+"_ARIAdescription").innerHTML=r,this._set(s,r);break;case"title":this.document.getElementById(this.container+"_ARIAlabel").innerHTML=r,this._set(s,r);break;case"keepaspectratio":this._set(s,r),this.setBoundingBox(this.getBoundingBox(),r,"keep");break;case"document":case"maxboundingbox":this[s]=r,this._set(s,r);break;case"zoomx":case"zoomy":this[s]=r,this._set(s,r),this.setZoom(this.attr.zoomx,this.attr.zoomy);break;case"registerevents":case"renderer":break;case"fullscreen":case"screenshot":(o=this.containerObj.ownerDocument.getElementById(this.container+"_navigation_"+s))&&utils_type.A.exists(r.symbol)&&(o.innerHTML=utils_type.A.evaluate(r.symbol)),this._set(s,r);break;case"selection":r.visible=!1,r.withLines=!1,r.vertices={visible:!1},this._set(s,r);break;case"showcopyright":"svg"===this.renderer.type&&((o=this.containerObj.ownerDocument.getElementById(this.renderer.uniqName("licenseText")))?o.style.display=utils_type.A.evaluate(r)?"inline":"none":utils_type.A.evaluate(r)&&this.renderer.displayCopyright(constants.A.licenseText,parseInt(this.options.text.fontSize,10)));default:utils_type.A.exists(this.attr[s])&&this._set(s,r)}return this.containerObj.ownerDocument.getElementById(this.container+"_navigationbar").remove(),this.renderer.drawNavigationBar(this,this.attr.navbar),this.triggerEventHandlers(["attribute"],[n,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(){for(var 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=0,l=null;for(e in this.animationObjects)if(this.animationObjects.hasOwnProperty(e)&&utils_type.A.exists(this.animationObjects[e])){if(a+=1,(i=this.animationObjects[e]).animationPath&&(n=utils_type.A.isFunction(i.animationPath)?i.animationPath((new Date).getTime()-i.animationStart):i.animationPath.pop(),!utils_type.A.exists(n)||!utils_type.A.isArray(n)&&isNaN(n)?delete i.animationPath:(i.setPositionDirectly(constants.A.COORDS_BY_USER,n),i.fullUpdate(),l=i)),i.animationData){for(s in o=0,i.animationData)i.animationData.hasOwnProperty(s)&&(r=i.animationData[s].pop(),utils_type.A.exists(r)?(o+=1,(t={})[s]=r,i.setAttribute(t)):delete i.animationData[r]);0===o&&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)&&(n=i.animationCallback,i.animationCallback=null,n()))}return 0===a?(window.clearInterval(this.animationIntervalCode),delete this.animationIntervalCode):this.update(l),this},migratePoint:function(t,e,i){var s,r,o,n,a,l,h=!1;for(r in t=this.select(t),e=this.select(e),utils_type.A.exists(t.label)&&(l=t.label.id,h=!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&&(h&&(delete e.childElements[l],delete e.descendants[l]),e.label&&this.removeObject(e.label),delete this.elementsByName[e.name],e.name=t.name,h&&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(utils_type.A.evaluate(i.visPropOriginal.strokecolor),t),fillcolor:utils_color.A.rgb2cb(utils_type.A.evaluate(i.visPropOriginal.fillcolor),t),highlightstrokecolor:utils_color.A.rgb2cb(utils_type.A.evaluate(i.visPropOriginal.highlightstrokecolor),t),highlightfillcolor:utils_color.A.rgb2cb(utils_type.A.evaluate(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;if(null===t)return t;if(utils_type.A.isString(t)&&""!==t)utils_type.A.exists(this.objects[t])?t=this.objects[t]:utils_type.A.exists(this.elementsByName[t])?t=this.elementsByName[t]:utils_type.A.exists(this.groups[t])&&(t=this.groups[t]);else if(!e&&(utils_type.A.isFunction(t)||utils_type.A.isObject(t)&&!utils_type.A.isFunction(t.setAttribute))){for(s={},o=(i=utils_type.A.filterElements(this.objectsList,t)).length,r=0;r<o;r++)s[i[r].id]=i[r];t=new composition(s)}else utils_type.A.isObject(t)&&utils_type.A.exists(t.id)&&!utils_type.A.exists(this.objects[t.id])&&(t=null);return t},hasPoint:function(t,e){var i=t,s=this.getBoundingBox();return utils_type.A.exists(t)&&utils_type.A.isArray(t.usrCoords)&&(i=t.usrCoords[1],e=t.usrCoords[2]),!!(utils_type.A.isNumber(i)&&utils_type.A.isNumber(e)&&s[0]<i&&i<s[2]&&s[1]>e&&e>s[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){t=this.getMousePosition(t);this.isSelecting=!1,this.selectingBox[1]=[t[0],t[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){return utils_type.A.exists(this.selectionPolygon)||!0===(t=utils_type.A.copyAttributes(t,src_options.A,"board","selection")).enabled&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],t)),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=this.document;return t=t||this.container,this._fullscreen_inner_id=t,i=r.getElementById(t),t="fullscreenwrap_"+t,utils_type.A.exists(i._cssFullscreenStore)||(s=this.containerObj.getBoundingClientRect(),i._cssFullscreenStore={w:s.width,h:s.height}),r.getElementById(t)?e=r.getElementById(t):((e=document.createElement("div")).classList.add("JXG_wrap_private"),e.setAttribute("id",t),i.parentNode.insertBefore(e,i),e.appendChild(i)),e.requestFullscreen=e.requestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen,null===(void 0!==r.fullscreenElement?r.fullscreenElement:void 0!==r.webkitFullscreenElement?r.webkitFullscreenElement:r.msFullscreenElement)?e.requestFullscreen&&(e.requestFullscreen(),this.startFullscreenResizeObserver(e)):(this.stopFullscreenResizeObserver(e),utils_type.A.exists(document.exitFullscreen)?document.exitFullscreen():utils_type.A.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(t){var e,i,s=this.document,r=this._fullscreen_inner_id;utils_type.A.exists(r)&&(i=void 0!==s.fullscreenElement?s.fullscreenElement:void 0!==s.webkitFullscreenElement?s.webkitFullscreenElement:s.msFullscreenElement,e=s.getElementById(r),i?(e._cssFullscreenStore.id=i.id,e._cssFullscreenStore.isFullscreen=!0,e._cssFullscreenStore.margin=e.style.margin,e._cssFullscreenStore.width=e.style.width,e._cssFullscreenStore.height=e.style.height,e._cssFullscreenStore.transform=e.style.transform,e.style.width=e._cssFullscreenStore.w+"px",e.style.height=e._cssFullscreenStore.h+"px",e.style.margin="",env.A.scaleJSXGraphDiv(i.id,r,s,utils_type.A.evaluate(this.attr.fullscreen.scale))):utils_type.A.exists(e._cssFullscreenStore)&&(e._cssFullscreenStore.isFullscreen=!1,e.style.margin=e._cssFullscreenStore.margin,e.style.width=e._cssFullscreenStore.width,e.style.height=e._cssFullscreenStore.height,e.style.transform=e._cssFullscreenStore.transform,e._cssFullscreenStore=null,e.parentElement.replaceWith(e)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(r){var o=this;return env.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled&&(this.resizeObserver=new ResizeObserver(function(t){var e,i,s=o.document;o._isResizing||(o._isResizing=!0,window.setTimeout(function(){try{e=o._fullscreen_inner_id,null!==(i=void 0!==s.fullscreenElement?s.fullscreenElement:void 0!==s.webkitFullscreenElement?s.webkitFullscreenElement:s.msFullscreenElement)&&env.A.scaleJSXGraphDiv(i.id,e,s,utils_type.A.evaluate(o.attr.fullscreen.scale))}catch(t){o.stopFullscreenResizeObserver(r)}finally{o._isResizing=!1}},o.attr.resize.throttle))}),this.resizeObserver.observe(r)),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},addLogEntry:function(t,e,i){var s,r=this.userLog.length-1;return utils_type.A.exists(e.elementClass)&&(s=e.id),utils_type.A.evaluate(this.attr.logging.enabled)&&(e=(new Date).getTime(),0<=r&&this.userLog[r].type===t&&this.userLog[r].id===s&&e-this.userLog[r].end<500?(this.userLog[r].end=e,this.userLog[r].endpos=i):this.userLog.push({type:t,id:s,start:e,startpos:i,end:e,endpos:i,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(y,b,e,v,C,i,x){var P=this;return new function(){function r(t){return o-A(b,d,t)}var o,n,a,l=0,h=0,u=0,c=e,d=numerics.A.root(function(t){var e=y.X(c),i=y.Y(c),s=b.X(t),t=b.Y(t);return(e-s)*(e-s)+(i-t)*(i-t)},[0,2*Math.PI]),p=P.create("transform",[function(){return l}],{type:"rotate"}),_=P.create("transform",[function(){return l},function(){return y.X(c)},function(){return y.Y(c)}],{type:"rotate"}),f=P.create("transform",[function(){return h},function(){return u}],{type:"translate"}),A=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)),t=numerics.A.D(t.Y)(.5*(e+i)),s=math.A.hypot(s,r),r=math.A.hypot(o,n);return(s+4*math.A.hypot(a,t)+r)*(i-e)/6},g=Math.PI/18,m=9*g,t=null;return this.rolling=function(){var t,e,i,s;o=A(y,c,n=c+C*v),a=numerics.A.root(r,d),t=new complex(y.X(n),y.Y(n)),e=new complex(b.X(a),b.Y(a)),s=new complex(numerics.A.D(y.X)(n),numerics.A.D(y.Y)(n)),i=new complex(numerics.A.D(b.X)(a),numerics.A.D(b.Y)(a)),s=complex.C.div(s,i),l=Math.atan2(s.imaginary,s.real),s.div(complex.C.abs(s)),s.mult(e),h=t.real-s.real,u=t.imaginary-s.imaginary,l<-g&&-m<l?(l=-g,_.applyOnce(x)):g<l&&l<m?(l=g,_.applyOnce(x)):(p.applyOnce(x),f.applyOnce(x),c=n,d=a),P.update()},this.start=function(){return 0<i&&(t=window.setInterval(this.rolling,i)),this},this.stop=function(){return window.clearInterval(t),this},this}}}),jxg.A.Board),svg=(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=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter");return n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"width","300%"),n.setAttributeNS(null,"height","300%"),n.setAttributeNS(null,"filterUnits","userSpaceOnUse"),(t=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset")).setAttributeNS(null,"in","SourceGraphic"),t.setAttributeNS(null,"result","offOut"),t.setAttributeNS(null,"dx",o[0]),t.setAttributeNS(null,"dy",o[1]),n.appendChild(t),(o=this.container.ownerDocument.createElementNS(this.svgNamespace,"feColorMatrix")).setAttributeNS(null,"in","offOut"),o.setAttributeNS(null,"result","colorOut"),o.setAttributeNS(null,"type","matrix"),"none"===e||!utils_type.A.isArray(e)||e.length<3?o.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,t=s+" 0 0 0 "+e[0]+" 0 "+s+" 0 0 "+e[1]+" 0 0 "+s+" 0 "+e[2]+" 0 0 0 "+i+" 0",o.setAttributeNS(null,"values",t)),n.appendChild(o),(s=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur")).setAttributeNS(null,"in","colorOut"),s.setAttributeNS(null,"result","blurOut"),s.setAttributeNS(null,"stdDeviation",r),n.appendChild(s),(e=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend")).setAttributeNS(null,"in","SourceGraphic"),e.setAttributeNS(null,"in2","blurOut"),e.setAttributeNS(null,"mode","normal"),n.appendChild(e),n},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 t=utils_type.A.exists(CSS)&&utils_type.A.exists(CSS.escape)?CSS.escape(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=t.id+"Triangle";return utils_type.A.exists(e)&&(n+=e),utils_type.A.exists(i)&&(n+=i),(n=this.createPrim("marker",n)).setAttributeNS(null,"stroke",utils_type.A.evaluate(t.visProp.strokecolor)),n.setAttributeNS(null,"stroke-opacity",utils_type.A.evaluate(t.visProp.strokeopacity)),n.setAttributeNS(null,"fill",utils_type.A.evaluate(t.visProp.strokecolor)),n.setAttributeNS(null,"fill-opacity",utils_type.A.evaluate(t.visProp.strokeopacity)),n.setAttributeNS(null,"stroke-width",0),n.setAttributeNS(null,"orient","auto"),n.setAttributeNS(null,"markerUnits","strokeWidth"),s=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),o=5,"Start"===e?(r=0,2===i?s.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 L 5,5 z"):3===i?s.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z"):4===i?(o=3.31,s.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?(o=3.28,s.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?(o=2.84,s.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?(o=5.2,s.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")):s.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 z"),t.elementClass===constants.A.OBJECT_CLASS_LINE&&(r=2===i?4.9:3===i?3.3:4===i||5===i||6===i?6.66:7===i?0:10)):(r=10,2===i?s.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 L 5,5 z"):3===i?(r=3.3,s.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z")):4===i?(o=3.31,s.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?(o=3.28,s.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?(o=2.84,s.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?(o=5.2,s.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")):s.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 z"),t.elementClass===constants.A.OBJECT_CLASS_LINE&&(r=2===i?5.1:3===i?.02:4===i||5===i||6===i?3.33:7===i?10:.05)),7===i&&(n.setAttributeNS(null,"fill","none"),n.setAttributeNS(null,"stroke-width",1)),n.setAttributeNS(null,"refY",o),n.setAttributeNS(null,"refX",r),n.appendChild(s),n},_setArrowColor:function(t,e,i,s,r){t&&(utils_type.A.isString(e)&&(7!==r?this._setAttribute(function(){t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"fill",e),t.setAttributeNS(null,"stroke-opacity",i),t.setAttributeNS(null,"fill-opacity",i)},s.visPropOld.fillcolor):this._setAttribute(function(){t.setAttributeNS(null,"fill","none"),t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"stroke-opacity",i)},s.visPropOld.fillcolor)),this.isIE&&s.rendNode.parentNode.insertBefore(s.rendNode,s.rendNode))},_setArrowWidth:function(t,e,i,s){t&&(s=e*s,t.setAttributeNS(null,"viewBox","0 0 "+10*e+" "+10*e),t.setAttributeNS(null,"markerHeight",s),t.setAttributeNS(null,"markerWidth",s),t.setAttributeNS(null,"display","inherit"),this.isIE&&i.parentNode.insertBefore(i,i))},updateTicks:function(t){for(var e,i,s,r,o,n,a,l="",h=t.ticks.length,u=!0,c=0;c<h;c++){for(r=(i=t.ticks[c])[0],o=i[1],n=r.length,a=" M "+r[0]+" "+o[0],utils_type.A.isNumber(r[0])||(u=!1),e=1;u&&e<n;++e)utils_type.A.isNumber(r[e])?a+=" L "+r[e]+" "+o[e]:u=!1;u&&(l+=a)}s=t.rendNode,utils_type.A.exists(s)||(s=this.createPrim("path",t.id),this.appendChildPrim(s,utils_type.A.evaluate(t.visProp.layer)),t.rendNode=s),s.setAttributeNS(null,"stroke",utils_type.A.evaluate(t.visProp.strokecolor)),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"stroke-opacity",utils_type.A.evaluate(t.visProp.strokeopacity)),s.setAttributeNS(null,"stroke-width",utils_type.A.evaluate(t.visProp.strokewidth)),this.updatePathPrim(s,l,t.board),this.setObjectViewport(t)},displayCopyright:function(t,e){var i=this.createPrim("text","licenseText");i.setAttributeNS(null,"x","20px"),i.setAttributeNS(null,"y",2+e+"px"),i.setAttributeNS(null,"style","font-family:Arial,Helvetica,sans-serif; font-size:"+e+"px; fill:#356AA0; opacity:0.3;"),e=this.container.ownerDocument.createTextNode(t),i.appendChild(e),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,utils_type.A.evaluate(t.visProp.layer)),e},updateInternalText:function(t){var e,i=t.plaintext,s=t.getAnchorX(),r=t.getAnchorY();t.rendNode.getAttributeNS(null,"class")!==t.visProp.cssclass&&(t.rendNode.setAttributeNS(null,"class",utils_type.A.evaluate(t.visProp.cssclass)),t.needsSizeUpdate=!0),isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(e=t.coords.scrCoords[1],t.visPropOld.left!==s+e&&(t.rendNode.setAttributeNS(null,"x",e+"px"),"left"===s?t.rendNode.setAttributeNS(null,"text-anchor","start"):"right"===s?t.rendNode.setAttributeNS(null,"text-anchor","end"):"middle"===s&&t.rendNode.setAttributeNS(null,"text-anchor","middle"),t.visPropOld.left=s+e),e=t.coords.scrCoords[2],t.visPropOld.top!==r+e&&(t.rendNode.setAttributeNS(null,"y",e+.5*this.vOffsetText+"px"),"bottom"===r?(t.rendNode.setAttributeNS(null,"dy","0"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"top"===r?(t.rendNode.setAttributeNS(null,"dy","1.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"middle"===r&&(t.rendNode.setAttributeNS(null,"dy","0.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")),t.visPropOld.top=r+e)),t.htmlStr!==i&&(t.rendNodeText.data=i,t.htmlStr=i),this.transformImage(t,t.transformations)},updateInternalTextStyle:function(t,e,i,s){this.setObjectViewport(t),this.setObjectFillColor(t,e,i)},drawImage:function(t){var e=this.createPrim("image",t.id);e.setAttributeNS(null,"preserveAspectRatio","none"),this.appendChildPrim(e,utils_type.A.evaluate(t.visProp.layer)),t.rendNode=e,this.updateImage(t)},transformImage:function(t,e){var i,s,r=t.rendNode,o="";if(0<e.length&&-1===(e=[(e=this.joinTransforms(t,e))[1][1],e[2][1],e[1][2],e[2][2],e[1][0],e[2][0]].join(",")).indexOf("NaN"))if(o+=" matrix("+e+") ",t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(r.style.transform=o,i=-t.coords.scrCoords[1],s=-t.coords.scrCoords[2],utils_type.A.evaluate(t.visProp.anchorx)){case"right":i+=t.size[0];break;case"middle":i+=.5*t.size[0]}switch(utils_type.A.evaluate(t.visProp.anchory)){case"bottom":s+=t.size[1];break;case"middle":s+=.5*t.size[1]}r.style["transform-origin"]=i+"px "+s+"px"}else r.setAttributeNS(null,"transform",o)},updateImageURL:function(t){var e=utils_type.A.evaluate(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){e=utils_type.A.evaluate(e?t.visProp.highlightcssclass:t.visProp.cssclass);t.rendNode.setAttributeNS(null,"class",e)},drawForeignObject:function(t){t.rendNode=this.appendChildPrim(this.createPrim("foreignObject",t.id),utils_type.A.evaluate(t.visProp.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]),t.rendNode.innerHTML=t.content,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.setAttributeNS(null,"marker-start",null)),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.setAttributeNS(null,"marker-end",null)))},updateEllipsePrim:function(t,e,i,s,r){e=Math.abs(e)<2e5?e:2e5*e/Math.abs(e),i=Math.abs(i)<2e5?i:2e5*i/Math.abs(i),s=Math.abs(s)<2e5?s:2e5*s/Math.abs(s),r=Math.abs(r)<2e5?r:2e5*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){isNaN(e+i+s+r)||(e=Math.abs(e)<2e5?e:2e5*e/Math.abs(e),i=Math.abs(i)<2e5?i:2e5*i/Math.abs(i),s=Math.abs(s)<2e5?s:2e5*s/Math.abs(s),r=Math.abs(r)<2e5?r:2e5*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){t.setAttributeNS(null,"d",e=""===e?"M 0 0":e)},updatePathStringPoint:function(t,e,i){var s="",t=t.coords.scrCoords,r=e*Math.sqrt(3)*.5,o=.5*e;return"x"===i?s=" M "+(t[1]-e)+" "+(t[2]-e)+" L "+(t[1]+e)+" "+(t[2]+e)+" M "+(t[1]+e)+" "+(t[2]-e)+" L "+(t[1]-e)+" "+(t[2]+e):"+"===i?s=" M "+(t[1]-e)+" "+t[2]+" L "+(t[1]+e)+" "+t[2]+" M "+t[1]+" "+(t[2]-e)+" L "+t[1]+" "+(t[2]+e):"|"===i?s=" M "+t[1]+" "+(t[2]-e)+" L "+t[1]+" "+(t[2]+e):"-"===i?s=" M "+(t[1]-e)+" "+t[2]+" L "+(t[1]+e)+" "+t[2]:"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s=" M "+(t[1]-e)+" "+t[2]+" L "+t[1]+" "+(t[2]+e)+" L "+(t[1]+e)+" "+t[2]+" L "+t[1]+" "+(t[2]-e)+" Z "):"^"===i?s=" M "+t[1]+" "+(t[2]-e)+" L "+(t[1]-r)+" "+(t[2]+o)+" L "+(t[1]+r)+" "+(t[2]+o)+" Z ":"v"===i?s=" M "+t[1]+" "+(t[2]+e)+" L "+(t[1]-r)+" "+(t[2]-o)+" L "+(t[1]+r)+" "+(t[2]-o)+" Z ":">"===i?s=" M "+(t[1]+e)+" "+t[2]+" L "+(t[1]-o)+" "+(t[2]-r)+" L "+(t[1]-o)+" "+(t[2]+r)+" Z ":"<"===i&&(s=" M "+(t[1]-e)+" "+t[2]+" L "+(t[1]+o)+" "+(t[2]-r)+" L "+(t[1]+o)+" "+(t[2]+r)+" Z "),s},updatePathStringPrim:function(t){var e,i,s,r=" M ",o="";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,r=isNaN(i[1])||isNaN(i[2])?" M ":(i[1]=Math.max(Math.min(i[1],5e3),-5e3),i[2]=Math.max(Math.min(i[2],5e3),-5e3),o+=r+i[1]+" "+i[2]," L ");else if(3===t.bezierDegree)for(e=0;e<s;)i=t.points[e].scrCoords,r=isNaN(i[1])||isNaN(i[2])?" M ":(o+=r+i[1]+" "+i[2]," C "===r&&(o=(o+=" "+(i=t.points[e+=1].scrCoords)[1]+" "+i[2])+(" "+(i=t.points[e+=1].scrCoords)[1]+" "+i[2]))," C "),e+=1;return o},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a,l=" M ",h="",u=utils_type.A.evaluate(t.visProp.strokewidth),c="plot"!==utils_type.A.evaluate(t.visProp.curvetype);if(t.numberPoints<=0)return"";for(c&&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=" M ",e=0;e<a;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?l=" M ":(r[1]=Math.max(Math.min(r[1],5e3),-5e3),r[2]=Math.max(Math.min(r[2],5e3),-5e3)," M "===l?h+=l+r[1]+" "+r[2]:h+=[l,o+.333*(r[1]-o)+u*((s=2*i)*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]].join(""),l=" C ",o=r[1],n=r[2]);return h},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)},setPropertyPrim:function(t,e,i){"stroked"!==e&&t.setAttributeNS(null,e,i)},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t=t.rendNode,e?(t.setAttributeNS(null,"display","inline"),t.style.visibility="inherit"):(t.setAttributeNS(null,"display","none"),t.style.visibility="hidden"))},show:function(t){jxg.A.deprecated("Board.renderer.show()","Board.renderer.display()"),this.display(t,!0)},hide:function(t){jxg.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),this.display(t,!1)},setBuffering:function(t,e){t.rendNode.setAttribute("buffered-rendering",e)},setDashStyle:function(t){var e=utils_type.A.evaluate(t.visProp.dash),i=utils_type.A.evaluate(t.visProp.dashscale)?.5*utils_type.A.evaluate(t.visProp.strokewidth):1,t=t.rendNode;0<e?t.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map(function(t){return t*i}).join(",")):t.hasAttributeNS(null,"stroke-dasharray")&&t.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,s=t.rendNode,r=utils_type.A.evaluate(t.visProp.gradient);"linear"===r||"radial"===r?(r=this.createPrim(r+"Gradient",t.id+"_gradient"),e=this.createPrim("stop",t.id+"_gradient1"),i=this.createPrim("stop",t.id+"_gradient2"),r.appendChild(e),r.appendChild(i),this.defs.appendChild(r),s.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=e,t.gradNode2=i,t.gradNode=r):s.removeAttributeNS(null,"style")},updateGradientAngle:function(t,e){var i=1,s=Math.cos(e),e=Math.sin(e);Math.abs(s)>Math.abs(e)?i/=Math.abs(s):i/=Math.abs(e),0<=s?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",s*i)):(t.setAttributeNS(null,"x1",-s*i),t.setAttributeNS(null,"x2",0)),0<=e?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",e*i)):(t.setAttributeNS(null,"y1",-e*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+"%")},updateGradient:function(t){var e,i,s=t.gradNode1,r=t.gradNode2,o=utils_type.A.evaluate(t.visProp.gradient);utils_type.A.exists(s)&&utils_type.A.exists(r)&&(i=0<(i=utils_type.A.evaluate(t.visProp.fillopacity))?i:0,e=utils_type.A.evaluate(t.visProp.fillcolor),s.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),r.setAttributeNS(null,"style","stop-color:"+utils_type.A.evaluate(t.visProp.gradientsecondcolor)+";stop-opacity:"+utils_type.A.evaluate(t.visProp.gradientsecondopacity)),s.setAttributeNS(null,"offset",100*utils_type.A.evaluate(t.visProp.gradientstartoffset)+"%"),r.setAttributeNS(null,"offset",100*utils_type.A.evaluate(t.visProp.gradientendoffset)+"%"),"linear"===o?this.updateGradientAngle(t.gradNode,utils_type.A.evaluate(t.visProp.gradientangle)):"radial"===o&&this.updateGradientCircle(t.gradNode,utils_type.A.evaluate(t.visProp.gradientcx),utils_type.A.evaluate(t.visProp.gradientcy),utils_type.A.evaluate(t.visProp.gradientr),utils_type.A.evaluate(t.visProp.gradientfx),utils_type.A.evaluate(t.visProp.gradientfy),utils_type.A.evaluate(t.visProp.gradientfr)))},setObjectTransition:function(t,e){var i,s,r,o=[],n=0,a=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(void 0===e&&(e=utils_type.A.evaluate(t.visProp.transitionduration)),i=utils_type.A.evaluate(t.visProp.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}},setObjectViewport:function(t,e){},_setAttribute:function(t,e){""===e?t():window.setTimeout(t,1)},setObjectFillColor:function(t,e,i,s){var r,o,n,a,e=utils_type.A.evaluate(e),i=utils_type.A.evaluate(i),l=utils_type.A.evaluate(t.visProp.gradient),i=0<i?i:0;t.visPropOld.fillcolor===e&&t.visPropOld.fillopacity===i&&null===l||(utils_type.A.exists(e)&&!1!==e&&(a=9!==e.length?(o=e,i):(n=utils_color.A.rgba2rgbo(e),o=n[0],i*n[1]),r=void 0===s?t.rendNode:s,"none"!==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"!==l&&"radial"!==l||this.updateGradient(t)),t.visPropOld.fillcolor=e,t.visPropOld.fillopacity=i)},setObjectStrokeColor:function(t,e,i){var s,r,o,n,e=utils_type.A.evaluate(e),i=0<(i=utils_type.A.evaluate(i))?i:0;t.visPropOld.strokecolor===e&&t.visPropOld.strokeopacity===i||(utils_type.A.exists(e)&&!1!==e&&(o=9!==e.length?(s=e,i):(r=utils_color.A.rgba2rgbo(e),s=r[0],i*r[1]),n=t.rendNode,t.elementClass===constants.A.OBJECT_CLASS_TEXT?"html"===utils_type.A.evaluate(t.visProp.display)?this._setAttribute(function(){n.style.color=s,n.style.opacity=o},t.visPropOld.strokecolor):this._setAttribute(function(){n.setAttributeNS(null,"style","fill:"+s),n.setAttributeNS(null,"style","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||(utils_type.A.evaluate(t.visProp.firstarrow)&&this._setArrowColor(t.rendNodeTriangleStart,s,o,t,t.visPropCalc.typeFirst),utils_type.A.evaluate(t.visProp.lastarrow)&&this._setArrowColor(t.rendNodeTriangleEnd,s,o,t,t.visPropCalc.typeLast))),t.visPropOld.strokecolor=e,t.visPropOld.strokeopacity=i)},setObjectStrokeWidth:function(t,e){var i,e=utils_type.A.evaluate(e);isNaN(e)||t.visPropOld.strokewidth===e||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),utils_type.A.exists(e)&&this.setPropertyPrim(i,"stroke-width",e+"px"),t.visPropOld.strokewidth=e)},setLineCap:function(t){var e=utils_type.A.evaluate(t.visProp.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)},setShadow:function(t){var e,i,s,r,o,n,a,l=utils_type.A.evaluate(t.visProp.shadow),h=!0,u=!1;(e=JSON.stringify(l))!==t.visPropOld.shadow&&("boolean"==typeof l?(h=!0,u=l,i="none",s=3,r=.1,o=[5,5],n=1):utils_type.A.evaluate(l.enabled)?(u=!(h=!1),i=jxg.A.rgbParser(utils_type.A.evaluate(l.color)),s=utils_type.A.evaluate(l.blur),r=utils_type.A.evaluate(l.blend),o=utils_type.A.evaluate(l.offset),n=utils_type.A.evaluate(l.opacity)):u=!1,utils_type.A.exists(t.rendNode)&&(u?h?t.rendNode.setAttributeNS(null,"filter",this.toURL(this.container.id+"_f1")):((l=this.container.ownerDocument.getElementById(a))&&this.defs.removeChild(l),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)},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;for(this.touchpoints=[],e=0;e<t;e++)i=this.createPrim("path","touchpoint1_"+e),this.appendChildPrim(i,19),i.setAttributeNS(null,"d","M 0 0"),this.touchpoints.push(i),this.setPropertyPrim(i,"stroked","true"),this.setPropertyPrim(i,"stroke-width","1px"),i.setAttributeNS(null,"stroke","#000000"),i.setAttributeNS(null,"stroke-opacity",1),i.setAttributeNS(null,"display","none"),i=this.createPrim("ellipse","touchpoint2_"+e),this.appendChildPrim(i,19),this.updateEllipsePrim(i,0,0,0,0),this.touchpoints.push(i),this.setPropertyPrim(i,"stroked","true"),this.setPropertyPrim(i,"stroke-width","1px"),i.setAttributeNS(null,"stroke","#000000"),i.setAttributeNS(null,"stroke-opacity",1),i.setAttributeNS(null,"fill","#ffffff"),i.setAttributeNS(null,"fill-opacity",0),i.setAttributeNS(null,"display","none")},showTouchpoint:function(t){this.touchpoints&&0<=t&&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&&0<=t&&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&&0<=t&&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(0<(i=(e=t.getElementsByTagName("image")).length))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(e=(e=(e=this.isIE&&1<(e.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g)||[]).length?e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,""):e).replace(/ /g," ")).replace(/url\("(.*)"\)/g,"url($1)"),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,i,s,e){var r,o;return(t=this.container.ownerDocument.getElementById(t)).width=t.width,o=t.getContext("2d"),void 0!==i&&void 0!==s&&(t.style.width=parseFloat(i)+"px",t.style.height=parseFloat(s)+"px",t.setAttribute("width",parseFloat(i)),t.setAttribute("height",parseFloat(s))),r=new Image,t=this.dumpToDataURI(e),r.src=t,"Promise"in window?new Promise(function(t,e){try{r.onload=function(){o.drawImage(r,0,0,i,s),t()}}catch(t){e(t)}}):(r.onload=function(){window.setTimeout(function(){try{o.drawImage(r,0,0,i,s)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(t,e,i){var s,r,o,n,a,l,h,u,c=this.container.ownerDocument,d=this.container.parentNode,t=t.attr.screenshot,p=!1;return"no"!==this.type&&(n=t.scale*this.container.getBoundingClientRect().width,a=t.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(p=!0,(o=new Image).style.width=n+"px",o.style.height=a+"px"):(p=!1,o=c.getElementById(e)),p&&((s=c.createElement("div")).style.cssText=t.css,s.style.width=n+"px",s.style.height=a+"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=c.createElement("canvas"),e=Math.random().toString(36).slice(2,7),r.setAttribute("id",e),r.setAttribute("width",n),r.setAttribute("height",a),r.style.width=n+"px",r.style.height=n+"px",r.style.display="none",d.appendChild(r),p&&(p=c.createElement("span"),u=c.createTextNode("✖"),p.style.cssText=t.cssButton,p.appendChild(u),p.onclick=function(){s.parentNode.removeChild(s)},s.appendChild(o),s.appendChild(p),d.insertBefore(s,this.container.nextSibling)),t=c.getElementById(this.uniqName("navigationbar")),utils_type.A.exists(t)&&(l=t.style.display,t.style.display="none",h=this.removeToInsertLater(t)),u=function(){o.src=r.toDataURL("image/png"),d.removeChild(r)},"Promise"in window?this.dumpToCanvas(e,n,a,i).then(u):(this.dumpToCanvas(e,n,a,i),window.setTimeout(u,200)),utils_type.A.exists(t)&&(t.style.display=l,h())),this}}),jxg.A.SVGRenderer),vml=(jxg.A.VMLRenderer=function(e){this.type="vml",this.container=e,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)||(e.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{e.ownerDocument.namespaces.jxgvml||e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("<jxgvml:"+t+' class="jxgvml">')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' 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){for(var e,i,s=this.resolution,r=[],o=t.ticks.length,n=0;n<o;n++)e=(i=t.ticks[n])[0],i=i[1],utils_type.A.isNumber(e[0])&&utils_type.A.isNumber(e[1])&&r.push(" m "+Math.round(s*e[0])+", "+Math.round(s*i[0])+" l "+Math.round(s*e[1])+", "+Math.round(s*i[1])+" ");utils_type.A.exists(t.rendNode)||(t.rendNode=this.createPrim("path",t.id),this.appendChildPrim(t.rendNode,utils_type.A.evaluate(t.visProp.layer))),this._setAttr(t.rendNode,"stroked","true"),this._setAttr(t.rendNode,"strokecolor",utils_type.A.evaluate(t.visProp.strokecolor),1),this._setAttr(t.rendNode,"strokeweight",utils_type.A.evaluate(t.visProp.strokewidth)),this._setAttr(t.rendNodeStroke,"opacity",100*utils_type.A.evaluate(t.visProp.strokeopacity)+"%"),this.updatePathPrim(t.rendNode,r,t.board)},displayCopyright:function(t,e){var i;(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)",e=this.container.ownerDocument.createTextNode(t),i.appendChild(e),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,l=this.joinTransforms(t,t.transformations),h=[0,0],u=t.rendNode,c=[],d=t.getAnchorX(),p=t.getAnchorY();if(!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])){for("right"===d?h[0]=1:"middle"===d&&(h[0]=.5),"bottom"===p?h[1]=1:"middle"===p&&(h[1]=.5),c[0]=math.A.matVecMult(l,[1,t.coords.scrCoords[1]-h[0]*t.size[0],t.coords.scrCoords[2]+(1-h[1])*t.size[1]+this.vOffsetText]),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=math.A.matVecMult(l,[1,t.coords.scrCoords[1]+(1-h[0])*t.size[0],t.coords.scrCoords[2]+(1-h[1])*t.size[1]+this.vOffsetText]),c[1][1]/=c[1][0],c[1][2]/=c[1][0],c[2]=math.A.matVecMult(l,[1,t.coords.scrCoords[1]+(1-h[0])*t.size[0],t.coords.scrCoords[2]-h[1]*t.size[1]+this.vOffsetText]),c[2][1]/=c[2][0],c[2][2]/=c[2][0],c[3]=math.A.matVecMult(l,[1,t.coords.scrCoords[1]-h[0]*t.size[0],t.coords.scrCoords[2]-h[1]*t.size[1]+this.vOffsetText]),c[3][1]/=c[3][0],c[3][2]/=c[3][0],i=c[0][1],r=c[0][1],s=c[0][2],o=c[0][2],n=1;n<4;n++)i=Math.max(i,c[n][1]),r=Math.min(r,c[n][1]),s=Math.max(s,c[n][2]),o=Math.min(o,c[n][2]);e=1===h[0]?Math.floor(t.board.canvasWidth-i):Math.floor(r),t.visPropOld.left!==d+e&&(1===h[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===h[1]?Math.floor(t.board.canvasHeight-s):Math.floor(o),t.visPropOld.top!==p+e&&(1===h[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),u.filters.item(0).M11=l[1][1],u.filters.item(0).M12=l[1][2],u.filters.item(0).M21=l[2][1],u.filters.item(0).M22=l[2][2],u.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,utils_type.A.evaluate(t.visProp.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)},transformImage:function(t,e){var i,s,r,o,n,a=t.rendNode,l=[];if(0<e.length){for(e=this.joinTransforms(t,e),l[0]=math.A.matVecMult(e,t.coords.scrCoords),l[0][1]/=l[0][0],l[0][2]/=l[0][0],l[1]=math.A.matVecMult(e,[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(e,[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(e,[1,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1]]),l[3][1]/=l[3][0],l[3][2]/=l[3][0],i=l[0][1],r=l[0][1],s=l[0][2],o=l[0][2],n=1;n<4;n++)i=Math.max(i,l[n][1]),r=Math.min(r,l[n][1]),s=Math.max(s,l[n][2]),o=Math.min(o,l[n][2]);a.style.left=Math.floor(r)+"px",a.style.top=Math.floor(o)+"px",a.filters.item(0).M11=e[1][1],a.filters.item(0).M12=e[1][2],a.filters.item(0).M21=e[2][1],a.filters.item(0).M22=e[2][2],a.filters.item(0).enabled=!0}},updateImageURL:function(t){var e=utils_type.A.evaluate(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=utils_type.A.evaluate(t.visProp.firstarrow),s=utils_type.A.evaluate(t.visProp.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=this.resolution;isNaN(e+i+s+r)||(e=["m ",Math.floor(n*e),", ",Math.floor(n*i)," l ",Math.floor(n*s),", ",Math.floor(n*r)],this.updatePathPrim(t,e,o))},updatePathPrim:function(t,e,i){var s=i.canvasWidth,i=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=s,t.style.height=i,this._setAttr(t,"coordsize",[Math.floor(this.resolution*s),Math.floor(this.resolution*i)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var s=[],r=Math.round,t=t.coords.scrCoords,o=e*Math.sqrt(3)*.5,n=.5*e,a=this.resolution;return"x"===i?s.push([" m ",r(a*(t[1]-e)),", ",r(a*(t[2]-e))," l ",r(a*(t[1]+e)),", ",r(a*(t[2]+e))," m ",r(a*(t[1]+e)),", ",r(a*(t[2]-e))," l ",r(a*(t[1]-e)),", ",r(a*(t[2]+e))].join("")):"+"===i?s.push([" m ",r(a*(t[1]-e)),", ",r(a*t[2])," l ",r(a*(t[1]+e)),", ",r(a*t[2])," m ",r(a*t[1]),", ",r(a*(t[2]-e))," l ",r(a*t[1]),", ",r(a*(t[2]+e))].join("")):"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s.push([" m ",r(a*(t[1]-e)),", ",r(a*t[2])," l ",r(a*t[1]),", ",r(a*(t[2]+e))," l ",r(a*(t[1]+e)),", ",r(a*t[2])," l ",r(a*t[1]),", ",r(a*(t[2]-e))," x e "].join(""))):"^"===i?s.push([" m ",r(a*t[1]),", ",r(a*(t[2]-e))," l ",r(a*(t[1]-o)),", ",r(a*(t[2]+n))," l ",r(a*(t[1]+o)),", ",r(a*(t[2]+n))," x e "].join("")):"v"===i?s.push([" m ",r(a*t[1]),", ",r(a*(t[2]+e))," l ",r(a*(t[1]-o)),", ",r(a*(t[2]-n))," l ",r(a*(t[1]+o)),", ",r(a*(t[2]-n))," x e "].join("")):">"===i?s.push([" m ",r(a*(t[1]+e)),", ",r(a*t[2])," l ",r(a*(t[1]-n)),", ",r(a*(t[2]-o))," l ",r(a*(t[1]-n)),", ",r(a*(t[2]+o))," l ",r(a*(t[1]+e)),", ",r(a*t[2])].join("")):"<"===i&&s.push([" m ",r(a*(t[1]-e)),", ",r(a*t[2])," l ",r(a*(t[1]+n)),", ",r(a*(t[2]-o))," l ",r(a*(t[1]+n)),", ",r(a*(t[2]+o))," x e "].join("")),s},updatePathStringPrim:function(t){var e,i,s=[],r=this.resolution,o=Math.round,n=" m ",a=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(a=Math.min(a,t.points.length),1===t.bezierDegree)for(e=0;e<a;e++)i=t.points[e].scrCoords,n=isNaN(i[1])||isNaN(i[2])?" m ":(2e4<i[1]?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),2e4<i[2]?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),s.push([n,o(r*i[1]),", ",o(r*i[2])].join(""))," l ");else if(3===t.bezierDegree)for(e=0;e<a;)i=t.points[e].scrCoords,n=isNaN(i[1])||isNaN(i[2])?" m ":(s.push([n,o(r*i[1]),", ",o(r*i[2])].join(""))," c "===n&&(i=t.points[e+=1].scrCoords,s.push([" ",o(r*i[1]),", ",o(r*i[2])].join("")),i=t.points[e+=1].scrCoords,s.push([" ",o(r*i[1]),", ",o(r*i[2])].join("")))," c "),e+=1;return s.push(" e"),s},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a=[],l=utils_type.A.evaluate(t.visProp.strokewidth),h=this.resolution,u=Math.round,c=" m ",d="plot"!==utils_type.A.evaluate(t.visProp.curvetype),p=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";for(d&&t.board.options.curve.RDPsmoothing&&(t.points=numerics.A.RamerDouglasPeucker(t.points,1)),p=Math.min(p,t.points.length),i=1;i<3;i++)for(c=" m ",e=0;e<p;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?c=" m ":(2e4<r[1]?r[1]=2e4:r[1]<-2e4&&(r[1]=-2e4),2e4<r[2]?r[2]=2e4:r[2]<-2e4&&(r[2]=-2e4)," m "===c?a.push([c,u(h*r[1])," ",u(h*r[2])].join("")):a.push([c,u(h*(o+.333*(r[1]-o)+l*((s=2*i)*Math.random()-i)))," ",u(h*(n+.333*(r[2]-n)+l*(s*Math.random()-i)))," ",u(h*(o+.666*(r[1]-o)+l*(s*Math.random()-i)))," ",u(h*(n+.666*(r[2]-n)+l*(s*Math.random()-i)))," ",u(h*r[1])," ",u(h*r[2])].join("")),c=" 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",0<=s&&(t.style.width=s+"px"),0<=r&&(t.style.height=r+"px")},setPropertyPrim:function(t,e,i){var s="";switch(e){case"stroke":s="strokecolor";break;case"stroke-width":s="strokeweight";break;case"stroke-dasharray":s="dashstyle"}""!==s&&(e=utils_type.A.evaluate(i),this._setAttr(t,s,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()"),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){0<=e.dash&&(t=t.rendNodeStroke,this._setAttr(t,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=utils_type.A.evaluate(t.visProp.gradient);"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",utils_type.A.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",utils_type.A.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"angle",utils_type.A.evaluate(t.visProp.gradientangle))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",utils_type.A.evaluate(t.visProp.gradientsecondcolor)),this._setAttr(e,"opacity2",utils_type.A.evaluate(t.visProp.gradientsecondopacity)),this._setAttr(e,"focusposition",100*utils_type.A.evaluate(t.visProp.gradientpositionx)+"%,"+100*utils_type.A.evaluate(t.visProp.gradientpositiony)+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,i){var s,r,e=utils_type.A.evaluate(e),i=utils_type.A.evaluate(i),o=t.rendNode,i=0<i?i:0;t.visPropOld.fillcolor===e&&t.visPropOld.fillopacity===i||(utils_type.A.exists(e)&&!1!==e&&(r=9!==e.length?(s=e,i):(s=(r=utils_color.A.rgba2rgbo(e))[0],i*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(r)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*r+"%")),t.type===constants.A.OBJECT_TYPE_IMAGE&&1<o.filters.length&&(o.filters.item(1).opacity=Math.round(100*r),o.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=e,t.visPropOld.fillopacity=i)},setObjectStrokeColor:function(t,e,i){var s,r=utils_type.A.evaluate(e),i=utils_type.A.evaluate(i),o=t.rendNode,i=0<i?i:0;t.visPropOld.strokecolor===r&&t.visPropOld.strokeopacity===i||(utils_type.A.exists(r)&&!1!==r&&(e=9!==r.length?(s=r,i):(s=(e=e.rgba2rgbo(r))[0],i*e[1]),t.elementClass===constants.A.OBJECT_CLASS_TEXT?(1<o.filters.length&&(o.filters.item(1).opacity=Math.round(100*e),o.filters.item(1).enabled=!0),o.style.color=s):(!1!==s&&(this._setAttr(o,"stroked","true"),this._setAttr(o,"strokecolor",s)),o=t.rendNodeStroke,utils_type.A.exists(e)&&t.type!==constants.A.OBJECT_TYPE_IMAGE&&this._setAttr(o,"opacity",100*e+"%"))),t.visPropOld.strokecolor=r,t.visPropOld.strokeopacity=i)},setObjectStrokeWidth:function(t,e){var i,e=utils_type.A.evaluate(e);isNaN(e)||t.visPropOld.strokewidth===e||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),utils_type.A.exists(e)&&(this.setPropertyPrim(i,"stroke-width",e),0===e&&utils_type.A.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=e)},setShadow:function(t){var e=t.rendNodeShadow,i=utils_type.A.evaluate(t.visProp.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=""}}),jxg.A.VMLRenderer),uuidCharsStr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",uuidChars=uuidCharsStr.split(""),uuid=(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":(e=15&(r=r<=2?33554432+16777216*Math.random()|0:r),r>>=4,s[i]=uuidChars[19===i?3&e|8:e]);return t+s.join("")},jxg.A.Util),canvas=(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(0<r){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=1,o=Math.cos(-e),e=Math.sin(-e),n=t.getBoundingBox();return Math.abs(o)>Math.abs(e)?r/=Math.abs(o):r/=Math.abs(e),o=0<=o?(i=0,o*r):(i=-o*r,0),e=0<=e?(s=0,e*r):(s=-e*r,0),r=new base_coords.A(constants.A.COORDS_BY_USER,[n[0],n[1]],t.board),t=(n=new base_coords.A(constants.A.COORDS_BY_USER,[n[2],n[3]],t.board)).scrCoords[1]-r.scrCoords[1],n=n.scrCoords[2]-r.scrCoords[2],i=r.scrCoords[1]+t*i,s=r.scrCoords[2]+n*s,t=r.scrCoords[1]+t*o,o=r.scrCoords[2]+n*e,this.context.createLinearGradient(i,s,t,o)},updateGradientCircle:function(t,e,i,s,r,o,n){var a=t.getBoundingBox(),l=new base_coords.A(constants.A.COORDS_BY_USER,[a[0],a[1]],t.board),t=(a=new base_coords.A(constants.A.COORDS_BY_USER,[a[2],a[3]],t.board)).scrCoords[1]-l.scrCoords[1],h=l.scrCoords[2]-a.scrCoords[2],e=l.scrCoords[1]+t*e,i=a.scrCoords[2]+h*i,l=l.scrCoords[1]+t*r,r=a.scrCoords[2]+h*o;return this.context.createRadialGradient(l,r,n*(t+h)*.5,e,i,s*(t+h)*.5)},updateGradient:function(t){var e,i=utils_type.A.evaluate(t.visProp.gradient),s=utils_type.A.evaluate(t.visProp.fillcolor);return"linear"===i?e=this.updateGradientAngle(t,utils_type.A.evaluate(t.visProp.gradientangle)):"radial"===i&&(e=this.updateGradientCircle(t,utils_type.A.evaluate(t.visProp.gradientcx),utils_type.A.evaluate(t.visProp.gradientcy),utils_type.A.evaluate(t.visProp.gradientr),utils_type.A.evaluate(t.visProp.gradientfx),utils_type.A.evaluate(t.visProp.gradientfy),utils_type.A.evaluate(t.visProp.gradientfr))),e.addColorStop(utils_type.A.evaluate(t.visProp.gradientstartoffset),s),e.addColorStop(utils_type.A.evaluate(t.visProp.gradientendoffset),utils_type.A.evaluate(t.visProp.gradientsecondcolor)),e},_setColor:function(t,e,i){var s,r,o,n=!0,a=t.visProp;return e=e||"stroke",i=i||e,s=this._getHighlighted(t),"linear"===(o=utils_type.A.evaluate(t.visProp.gradient))||"radial"===o?this.context[i+"Style"]=this.updateGradient(t):("none"!==(o=utils_type.A.evaluate(a[s+e+"color"]))&&!1!==o?(t=0<(t=utils_type.A.evaluate(a[s+e+"opacity"]))?t:0,t=9!==o.length?(r=o,t):(r=(o=utils_color.A.rgba2rgbo(o))[0],t*o[1]),this.context.globalAlpha=t,this.context[i+"Style"]=r):n=!1,o=parseFloat(utils_type.A.evaluate(a[s+"strokewidth"])),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),"stroke"===e&&void 0!==a.linecap&&""!==a.linecap&&(this.context.lineCap=a.linecap)),n},_stroke:function(t){var e=this.context,i=utils_type.A.evaluate(t.visProp.dash),s=utils_type.A.evaluate(t.visProp.dashscale)?.5*utils_type.A.evaluate(t.visProp.strokewidth):1;e.save(),0<i?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=utils_type.A.evaluate(t.visProp.face),i=utils_type.A.evaluate(t.visProp.size),s=t.coords.scrCoords,r=i*Math.sqrt(3)*.5,o=.5*i,n=parseFloat(utils_type.A.evaluate(t.visProp.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,l,h,u,c,d,p,_,f,A,g,m,y,b,v=this.context,C=1,x=1,P=1,E=r.evFirst,O=r.evLast;if("none"!==utils_type.A.evaluate(t.visProp.strokecolor)&&(E||O)){if(t.elementClass===constants.A.OBJECT_CLASS_LINE)o=e.scrCoords[1],n=e.scrCoords[2],a=i.scrCoords[1],l=i.scrCoords[2],y=b=Math.atan2(l-n,a-o);else{if(o=t.points[0].scrCoords[1],n=t.points[0].scrCoords[2],(e=t.points.length-1)<1)return;a=t.points[t.points.length-1].scrCoords[1],l=t.points[t.points.length-1].scrCoords[2],i=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],g=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],m=t.points[e].scrCoords[1]-t.points[e-1].scrCoords[1],e=t.points[e].scrCoords[2]-t.points[e-1].scrCoords[2],E&&(y=Math.atan2(g,i)),O&&(b=Math.atan2(e,m))}if(g=utils_type.A.evaluate(t.visProp[s+"strokewidth"]),E)if(h=g*r.sizeFirst,d=C=r.typeFirst,2===C)c=[[h,.5*-h],[0,0],[h,.5*h],[.5*h,0]];else if(3===C)c=[[h/3,.5*-h],[0,.5*-h],[0,.5*h],[h/3,.5*h]];else if(4===C)for(h/=10,x=3,A=(c=[[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,f=0;f<A;f++)c[f][0]*=-h,c[f][1]*=h,c[f][0]+=10*h,c[f][1]-=3.31*h;else if(5===C)for(h/=10,x=3,A=(c=[[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,f=0;f<A;f++)c[f][0]*=-h,c[f][1]*=h,c[f][0]+=10*h,c[f][1]-=3.28*h;else if(6===C)for(h/=10,x=3,A=(c=[[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,f=0;f<A;f++)c[f][0]*=-h,c[f][1]*=h,c[f][0]+=10*h,c[f][1]-=2.84*h;else if(7===C)for(h=g,x=3,A=(c=[[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,f=0;f<A;f++)c[f][0]*=-h,c[f][1]*=h,c[f][0]+=10*h,c[f][1]-=5.2*h;else c=[[h,.5*-h],[0,0],[h,.5*h]];if(O)if(h=g*r.sizeLast,p=C=r.typeLast,2===C)u=[[-h,.5*-h],[0,0],[-h,.5*h],[.5*-h,0]];else if(3===C)u=[[-h/3,.5*-h],[0,.5*-h],[0,.5*h],[-h/3,.5*h]];else if(4===C)for(h/=10,P=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,f=0;f<A;f++)u[f][0]*=h,u[f][1]*=h,u[f][0]-=10*h,u[f][1]-=3.31*h;else if(5===C)for(h/=10,P=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,f=0;f<A;f++)u[f][0]*=h,u[f][1]*=h,u[f][0]-=10*h,u[f][1]-=3.28*h;else if(6===C)for(h/=10,P=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,f=0;f<A;f++)u[f][0]*=h,u[f][1]*=h,u[f][0]-=10*h,u[f][1]-=2.84*h;else if(7===C)for(h=g,P=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,f=0;f<A;f++)u[f][0]*=h,u[f][1]*=h,u[f][0]-=10*h,u[f][1]-=5.2*h;else u=[[-h,.5*-h],[0,0],[-h,.5*h]];v.save(),this._setColor(t,"stroke","fill")&&(this._setColor(t,"stroke"),E&&(_=7!==d,this._drawPolygon(this._translateShape(this._rotateShape(c,y),o,n),x,_)),O&&(_=7!==p,this._drawPolygon(this._translateShape(this._rotateShape(u,b),a,l),P,_))),v.restore()}},drawLine:function(t){var e,i,s,r=new base_coords.A(constants.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),o=new base_coords.A(constants.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),n=null;t.visPropCalc.visible&&(i=this._getHighlighted(t),s=utils_type.A.evaluate(t.visProp[i+"strokewidth"]),((s=this.getArrowHeadData(t,s,i)).evFirst||s.evLast)&&(n=-4),geometry.A.calcStraight(t,r,o,n),this.handleTouchpoints(t,r,o,s),n=new base_coords.A(constants.A.COORDS_BY_USER,r.usrCoords,t.board),e=new base_coords.A(constants.A.COORDS_BY_USER,o.usrCoords,t.board),this.getPositionArrowHead(t,r,o,s),this.context.beginPath(),this.context.moveTo(r.scrCoords[1],r.scrCoords[2]),this.context.lineTo(o.scrCoords[1],o.scrCoords[2]),this._stroke(t),(s.evFirst||s.evLast)&&this.drawArrows(t,n,e,i,s))},updateLine:function(t){this.drawLine(t)},drawTicks:function(){},updateTicks:function(t){var e,i,s,r,o,n,a=t.ticks.length,l=this.context;for(l.beginPath(),e=0;e<a;e++)for(s=(i=t.ticks[e])[0],r=i[1],o=s.length,l.moveTo(s[0],r[0]),n=1;n<o;++n)l.lineTo(s[n],r[n]);l.lineCap="round",this._stroke(t)},drawCurve:function(t){var e,i;utils_type.A.evaluate(t.visProp.handdrawing)?this.updatePathStringBezierPrim(t):this.updatePathStringPrim(t),1<t.numberPoints&&(e=this._getHighlighted(t),i=utils_type.A.evaluate(t.visProp[e+"strokewidth"]),((i=this.getArrowHeadData(t,i,e)).evFirst||i.evLast)&&this.drawArrows(t,null,null,e,i))},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(),s=o*s,r=n*r,a=e-s/2,l=i-r/2,h=s/2*.5522848,u=r/2*.5522848,c=a+s,d=l+r,s=a+s/2,r=l+r/2,p=this.context;0<o&&0<n&&!isNaN(e+i)&&(p.beginPath(),p.moveTo(a,r),p.bezierCurveTo(a,r-u,s-h,l,s,l),p.bezierCurveTo(s+h,l,c,r-u,c,r),p.bezierCurveTo(c,r+u,s+h,d,s,d),p.bezierCurveTo(s-h,d,a,r+u,a,r),p.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context;i.save(),i.font=e+"px Arial",i.fillStyle="#aaa",i.lineWidth=.5,i.fillText(t,10,2+e),i.restore()},drawInternalText:function(t){var e=utils_type.A.evaluate(t.visProp.fontsize),i=utils_type.A.evaluate(t.visProp.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=(0<e?e:0)+i+" Arial",this.transformImage(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,e=utils_type.A.evaluate(e),i=0<(i=utils_type.A.evaluate(i))?i:0;t.visPropOld.strokecolor===e&&t.visPropOld.strokeopacity===i||(utils_type.A.exists(e)&&!1!==e&&(r=9!==e.length?(s=e,i):(s=(r=utils_color.A.rgba2rgbo(e))[0],i*r[1]),o=t.rendNode,t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===utils_type.A.evaluate(t.visProp.display)&&(o.style.color=s,o.style.opacity=r)),t.visPropOld.strokecolor=e,t.visPropOld.strokeopacity=i)},drawImage:function(t){t.rendNode=new Image,t._src="",this.updateImage(t)},updateImage:function(t){var e=this.context,i=utils_type.A.evaluate(t.visProp.fillopacity),s=utils_type.A.bind(function(){t.imgIsLoaded=!0,t.size[0]<=0||t.size[1]<=0||(e.save(),e.globalAlpha=i,this.transformImage(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()},transformImage:function(t,e){var i,s,r,o=e.length,n=this.context;if(0<o)if(o=this.joinTransforms(t,e),t.elementClass===constants.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(e=" matrix("+[o[1][1],o[2][1],o[1][2],o[2][2],o[1][0],o[2][0]].join(",")+") ").indexOf("NaN")){switch((r=t.rendNode).style.transform=e,i=-t.coords.scrCoords[1],s=-t.coords.scrCoords[2],utils_type.A.evaluate(t.visProp.anchorx)){case"right":i+=t.size[0];break;case"middle":i+=.5*t.size[0]}switch(utils_type.A.evaluate(t.visProp.anchory)){case"bottom":s+=t.size[1];break;case"middle":s+=.5*t.size[1]}r.style["transform-origin"]=i+"px "+s+"px"}}else Math.abs(numerics.A.det(o))>=math.A.eps&&n.transform(o[1][1],o[2][1],o[1][2],o[2][2],o[1][0],o[2][0])},updateImageURL:function(t){var e=utils_type.A.evaluate(t.url);return 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=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),a.beginPath(),1===t.bezierDegree)for(e=0;e<o;e++)i=t.points[e].scrCoords,n=isNaN(i[1])||isNaN(i[2])?"M":(5e3<i[1]?i[1]=5e3:i[1]<-5e3&&(i[1]=-5e3),5e3<i[2]?i[2]=5e3:i[2]<-5e3&&(i[2]=-5e3),"M"===n?a.moveTo(i[1],i[2]):a.lineTo(i[1],i[2]),"L");else if(3===t.bezierDegree)for(e=0;e<o;)i=t.points[e].scrCoords,n=isNaN(i[1])||isNaN(i[2])?"M":("M"===n?a.moveTo(i[1],i[2]):(s=t.points[e+=1].scrCoords,r=t.points[e+=1].scrCoords,a.bezierCurveTo(i[1],i[2],s[1],s[2],r[1],r[2])),"C"),e+=1;a.lineCap="round",this._fill(t),this._stroke(t)}},updatePathStringBezierPrim:function(t){var e,i,s,r,o,n,a,l="M",h=utils_type.A.evaluate(t.visProp.strokewidth),u="plot"!==utils_type.A.evaluate(t.visProp.curvetype),c=this.context;if(!(t.numberPoints<=0)){for(u&&t.board.options.curve.RDPsmoothing&&(t.points=numerics.A.RamerDouglasPeucker(t.points,.5)),a=Math.min(t.points.length,t.numberPoints),c.beginPath(),i=1;i<3;i++)for(l="M",e=0;e<a;e++)r=t.points[e].scrCoords,isNaN(r[1])||isNaN(r[2])?l="M":(5e3<r[1]?r[1]=5e3:r[1]<-5e3&&(r[1]=-5e3),5e3<r[2]?r[2]=5e3:r[2]<-5e3&&(r[2]=-5e3),"M"===l?c.moveTo(r[1],r[2]):c.bezierCurveTo(o+.333*(r[1]-o)+h*((s=2*i)*Math.random()-i),n+.333*(r[2]-n)+h*(s*Math.random()-i),o+.666*(r[1]-o)+h*(s*Math.random()-i),n+.666*(r[2]-n)+h*(s*Math.random()-i),r[1],r[2]),l="C",o=r[1],n=r[2]);c.lineCap="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"===utils_type.A.evaluate(t.visProp.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"===utils_type.A.evaluate(t.visProp.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&&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(){}}}),jxg.A.CanvasRenderer),no=(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){},transformImage:function(t,e){},updateImageURL:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},createPrim:function(t,e){return null},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){},display:function(t,e){t&&(t.visPropOld.visible=e)},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,jxg.A.NoRenderer),jsxgraph=(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("object"==typeof(i=utils_type.A.exists(i)&&!1!==i||"object"!=typeof document?i:document)&&null!==t)for(r=utils_type.A.isString(t)?i.getElementById(t):t;r.firstChild;)r.removeChild(r.firstChild);else r=t;return"svg"===(s=void 0!==s&&"auto"!==s?s:this.rendererType)?new svg(r,e):"vml"===s?new vml(r):"canvas"===s?new canvas(r,e):new no},_setAttributes:function(t,e){for(var i,s=utils_type.A.copyAttributes(t,e,"board"),r=["drag","fullscreen","intl","keyboard","logging","pan","resize","screenshot","selection","zoom"],o=r.length,n=0;n<o;n++)s[i=r[n]]=utils_type.A.copyAttributes(s,e,"board",i);return s.navbar=utils_type.A.copyAttributes(s.navbar,e,"navbar"),s.movetarget=t.moveTarget||t.movetarget||e.board.moveTarget,s},_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,r,o,n=e.document;if("object"!=typeof n){if(!env.A.isBrowser)return;n=document}i=(n=utils_type.A.isString(t)?n.getElementById(t):t).ownerDocument,r=n.parentNode,o=t+"_ARIAlabel",t=t+"_ARIAdescription",(s=i.createElement("div")).innerHTML=e.title,s.setAttribute("id",o),s.style.display="none",r.insertBefore(s,n),(s=i.createElement("div")).innerHTML=e.description,s.setAttribute("id",t),s.style.display="none",r.insertBefore(s,n),n.setAttribute("aria-labelledby",o),n.setAttribute("aria-describedby",t)},_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,l,h,u=0,c=0,d={};return"default"!==(e=e||{}).theme&&utils_type.A.exists(jxg.A.themes[e.theme])&&(d=jxg.A.themes[e.theme]),d=utils_type.A.deepCopy(src_options.A,d,!0),e=this._setAttributes(e,d),a=env.A.getDimensions(t,e.document),e.unitx||e.unity?(i=utils_type.A.def(e.originx,150),s=utils_type.A.def(e.originy,150),r=utils_type.A.def(e.unitx,50),o=utils_type.A.def(e.unity,50)):((l=e.boundingbox)[0]<e.maxboundingbox[0]&&(l[0]=e.maxboundingbox[0]),l[1]>e.maxboundingbox[1]&&(l[1]=e.maxboundingbox[1]),l[2]>e.maxboundingbox[2]&&(l[2]=e.maxboundingbox[2]),l[3]<e.maxboundingbox[3]&&(l[3]=e.maxboundingbox[3]),n=parseInt(a.width,10),h=parseInt(a.height,10),utils_type.A.exists(l)&&e.keepaspectratio?(r=n/(l[2]-l[0]),o=h/(l[1]-l[3]),Math.abs(r)<Math.abs(o)?c=.5*(h/(o=Math.abs(r)*o/Math.abs(o))-(l[1]-l[3])):u=.5*(n/(r=Math.abs(o)*r/Math.abs(r))-(l[2]-l[0]))):(r=n/(l[2]-l[0]),o=h/(l[1]-l[3])),i=-r*(l[0]-u),s=o*(l[1]+c)),n=this.initRenderer(t,a,e.document,e.renderer),this._setARIA(t,e),(h=new base_board(t,n,e.id,[i,s],e.zoomx,e.zoomy,r,o,a.width,a.height,e)).keepaspectratio=e.keepaspectratio,this._fillBoard(h,e,a),h.suspendUpdate(),(e=h.attr).axis&&(u="object"==typeof e.axis?e.axis:{},l=utils_type.A.deepCopy(d.board.defaultaxes.x,u),c=utils_type.A.deepCopy(d.board.defaultaxes.y,u),e.defaultaxes.x&&(l=utils_type.A.deepCopy(l,e.defaultaxes.x)),e.defaultaxes.y&&(c=utils_type.A.deepCopy(c,e.defaultaxes.y)),h.defaultAxes={},h.defaultAxes.x=h.create("axis",[[0,0],[1,0]],l),h.defaultAxes.y=h.create("axis",[[0,0],[0,1]],c)),e.grid&&h.create("grid",[],"object"==typeof e.grid?e.grid:{}),h.unsuspendUpdate(),h},loadBoardFromFile:function(t,e,i,s,r){var s=this._setAttributes(s=s||{}),o=env.A.getDimensions(t,s.document),n=this.initRenderer(t,o,s.document,s.renderer);return this._setARIA(t,s),t=new base_board(t,n,"",[150,150],1,1,50,50,o.width,o.height,s),this._fillBoard(t,s,o),n=s.encoding||"iso-8859-1",reader_file.parseFileContent(e,t,i,!0,n,r),t},loadBoardFromString:function(t,e,i,s,r){var s=this._setAttributes(s=s||{}),o=env.A.getDimensions(t,s.document),n=this.initRenderer(t,o,s.document,s.renderer);return this._setARIA(t,s),t=new base_board(t,n,"",[150,150],1,1,50,50,o.width,o.height,s),this._fillBoard(t,s,o),reader_file.parseString(e,t,i,!0,r),t},freeBoard:function(t){for(var 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(){for(var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_,f=!1,A=document.getElementsByTagName("script"),g=function(t,e,i){i=jxg.A.JSXGraph.initBoard(s,{boundingbox:i,keepaspectratio:!0,grid:c,axis:u,showReload:!0});if(-1<e.toLowerCase().indexOf("script"))i.construct(t);else try{i.jc.parse(t)}catch(t){jxg.A.debug(t)}return i},m=function(e,i,s,r){return function(){var t;jxg.A.JSXGraph.freeBoard(e),(t=g(i,s,r)).reload=m(t,i,s,r)}},y=0;y<A.length;y++)if(t=A[y].getAttribute("type",!1),utils_type.A.exists(t)&&("text/jessiescript"===t.toLowerCase()||"jessiescript"===t.toLowerCase()||"text/jessiecode"===t.toLowerCase()||"jessiecode"===t.toLowerCase())){if(l=A[y].getAttribute("class",!1)||"",o=A[y].getAttribute("width",!1)||"",_=A[y].getAttribute("height",!1)||"",n=A[y].getAttribute("maxwidth",!1)||"100%",a=A[y].getAttribute("aspectratio",!1)||"1/1",h=A[y].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",s=A[y].getAttribute("container",!1),p=A[y].getAttribute("src",!1),4!==(h=h.split(",")).length)h=[-5,5,5,-5];else for(e=0;e<h.length;e++)h[e]=parseFloat(h[e]);if(u=utils_type.A.str2Bool(A[y].getAttribute("axis",!1)||"false"),c=utils_type.A.str2Bool(A[y].getAttribute("grid",!1)||"false"),utils_type.A.exists(s))i=document.getElementById(s);else{s="jessiescript_autgen_jxg_"+y,(i=document.createElement("div")).setAttribute("id",s),o=""!==o?"width:"+o+";":"",o=(o+=""!==_?"height:"+_+";":"")+(""!==n?"max-width:"+n+";":"")+(""!==a?"aspect-ratio:"+a+";":""),i.setAttribute("style",o),i.setAttribute("class","jxgbox "+l);try{document.body.insertBefore(i,A[y])}catch(t){"object"==typeof jQuery&&jQuery(i).insertBefore(A[y])}}d="",utils_type.A.exists(p)?(f=!0,(_=new XMLHttpRequest).open("GET",p),_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("load",function(){if(!(this.status<400))throw new Error("\nJSXGraph: failed to load file",p,":",this.responseText);d=this.responseText+"\n"+d,(r=g(d,t,h)).reload=m(r,d,t,h)}),_.addEventListener("error",function(t){throw new Error("\nJSXGraph: failed to load file",p,":",t)}),_.send()):f=!1,document.getElementById(s)?(d=(d=A[y].innerHTML).replace(/<!\[CDATA\[/g,"").replace(/\]\]>/g,""),A[y].innerHTML=d,f||((r=g(d,t,h)).reload=m(r,d,t,h))):jxg.A.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window),jxg.A.JSXGraph),base_element=__webpack_require__(144),coordselement=__webpack_require__(102),point=(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=this.coords.scrCoords,s=utils_type.A.evaluate(this.visProp.sizeunit),r=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint,o=parseFloat(utils_type.A.evaluate(this.visProp.size));return"user"===s&&(o*=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY))),(o+=.5*parseFloat(utils_type.A.evaluate(this.visProp.strokewidth)))<r&&(o=r),Math.abs(i[1]-t)<o+2&&Math.abs(i[2]-e)<o+2},update:function(t){return this.needsUpdate&&(this.updateCoords(t),utils_type.A.evaluate(this.visProp.trace)&&this.cloneToBackground(!0)),this},updateTransform:function(t){var e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this===this.baseElement?(e=this.transformations[0].apply(this.baseElement,"self"),this.coords.setCoordinates(constants.A.COORDS_BY_USER,e)):e=this.transformations[0].apply(this.baseElement),this.coords.setCoordinates(constants.A.COORDS_BY_USER,e),i=1;i<this.transformations.length;i++)this.coords.setCoordinates(constants.A.COORDS_BY_USER,this.transformations[i].apply(this));return this},updateRenderer:function(){return this.updateRendererGeneric("updatePoint"),this},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))},makeIntersection:function(i,s,t,e){var r;i=this.board.select(i),s=this.board.select(s),r=geometry.A.intersectionFunction(this.board,i,s,t,e,this.visProp.alwaysintersect),this.addConstraint([r]);try{i.addChild(this),s.addChild(this)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof i+"' and '"+typeof s+"'.")}this.type=constants.A.OBJECT_TYPE_INTERSECTION,this.elType="intersection",this.parents=[i.id,s.id,t,e],this.generatePolynomial=function(){var t=i.generatePolynomial(this),e=s.generatePolynomial(this);return 0===t.length||0===e.length?[]:[t[0],e[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||utils_type.A.evaluate(this.visProp.alwaysintersect)||0<=(i=jxg.A.Math.Geometry.projectCoordsToSegment(this.coords.usrCoords,t.point1.coords.usrCoords,t.point2.coords.usrCoords))[1]&&i[1]<=1)&&geometry.A.distPointLine(this.coords.usrCoords,t.stdform)<e:t.elementClass===constants.A.OBJECT_CLASS_CIRCLE?utils_type.A.evaluate(t.visProp.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?!(!utils_type.A.evaluate(t.visProp.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={};return t.id=this.id+"T"+this.numTraces,this.numTraces+=1,t.coords=this.coords,t.visProp=utils_type.A.deepCopy(this.visProp,this.visProp.traceattributes,!0),t.visProp.layer=this.board.options.layer.trace,t.elementClass=constants.A.OBJECT_CLASS_POINT,t.board=this.board,utils_type.A.clearVisPropOld(t),t.visPropCalc={visible:utils_type.A.evaluate(t.visProp.visible)},this.board.renderer.drawPoint(t),this.traces[t.id]=t.rendNode,this}}),jxg.A.createPoint=function(t,e,i){i=utils_type.A.copyAttributes(i,t.options,"point");if(t=coordselement.A.create(jxg.A.Point,t,e,i))return t;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]")},jxg.A.createGlider=function(t,e,i){var i=utils_type.A.copyAttributes(i,t.options,"glider"),s=1===e.length?[0,0]:e.slice(0,2);return(t=t.create("point",s,i)).makeGlider(e[e.length-1]),t},jxg.A.createIntersectionPoint=function(t,e,i){var s,r,o,n,a,i=utils_type.A.copyAttributes(i,t.options,"intersection");e.push(0,0),r=t.select(e[0]),o=t.select(e[1]),n=e[2]||0,a=e[3]||0,s=t.create("point",[0,0,0],i),i=geometry.A.intersectionFunction(t,r,o,n,a,s.visProp.alwaysintersect),s.addConstraint([i]);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=[n,a],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,l,h=!0,i=utils_type.A.copyAttributes(i,t.options,"otherintersection");if(3!==e.length)h=!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])){h=!1;break}h&&((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)&&(h=!1))}if(h)return s=t.create("point",[0,0,0],i),i=geometry.A.otherIntersectionFunction(l,a,s.visProp.alwaysintersect,s.visProp.precision),s.addConstraint([i]),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;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")},jxg.A.createPolePoint=function(t,e,i){var s,r,o,n,a,l;if(1<e.length&&(o=e[0].type===constants.A.OBJECT_TYPE_CONIC||e[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE,n=e[1].type===constants.A.OBJECT_TYPE_CONIC||e[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE,a=e[0].elementClass===constants.A.OBJECT_CLASS_LINE,l=e[1].elementClass===constants.A.OBJECT_CLASS_LINE),2===e.length&&(o&&l||a&&n))return r=l?(s=t.select(e[0]),t.select(e[1])):(s=t.select(e[1]),t.select(e[0])),(o=t.create("point",[function(){var t=s.quadraticform,e=r.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",o.setParents([s.id,r.id]),s.addChild(o),r.addChild(o),o;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]")},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),jxg.A.Point),line=(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=[],t=[1,t,e],e=utils_type.A.evaluate(this.visProp.strokewidth),r=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint;return r+=.5*e,s[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,s[1]=this.stdform[1]/this.board.unitX,s[2]=this.stdform[2]/-this.board.unitY,e=geometry.A.distPointLine(t,s),!(isNaN(e)||r<e||(!utils_type.A.evaluate(this.visProp.straightfirst)||!utils_type.A.evaluate(this.visProp.straightlast))&&(r=this.point1.coords,e=this.point2.coords,i=[0,s[1],s[2]],i=math.A.crossProduct(i,t),(i=math.A.crossProduct(i,s))[1]/=i[0],i[2]/=i[0],i[0]=1,i=new base_coords.A(constants.A.COORDS_BY_SCREEN,i.slice(1),this.board).usrCoords,t=r.distance(constants.A.COORDS_BY_USER,e),r=r.usrCoords.slice(0),e=e.usrCoords.slice(0),e=t<math.A.eps?0:(t===Number.POSITIVE_INFINITY&&(t=1/math.A.eps,Math.abs(e[0])<math.A.eps?(t/=geometry.A.distance([0,0,0],e),e=[1,r[1]+e[1]*t,r[2]+e[2]*t]):(t/=geometry.A.distance([0,0,0],r),r=[1,e[1]+r[1]*t,e[2]+r[2]*t])),t=e[s=1]-r[s],Math.abs(t)<math.A.eps&&(t=e[s=2]-r[s]),(i[s]-r[s])/t),!utils_type.A.evaluate(this.visProp.straightfirst)&&e<0||!utils_type.A.evaluate(this.visProp.straightlast)&&1<e))},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(),utils_type.A.evaluate(this.visProp.trace)&&this.cloneToBackground(!0)),this},updateSegmentFixedLength:function(){var t,e,i,s,r,o;return this.hasFixedLength&&(t=this.point1.Dist(this.point2),e=utils_type.A.evaluate(this.visProp.nonnegativeonly)?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),o=this.fixedLengthOldCoords[0].distance(constants.A.COORDS_BY_USER,this.point1.coords),r=this.fixedLengthOldCoords[1].distance(constants.A.COORDS_BY_USER,this.point2.coords),(o>math.A.eps||r>math.A.eps||t!==e)&&(i=this.point1.isDraggable&&this.point1.type!==constants.A.OBJECT_TYPE_GLIDER&&!utils_type.A.evaluate(this.point1.visProp.fixed),s=this.point2.isDraggable&&this.point2.type!==constants.A.OBJECT_TYPE_GLIDER&&!utils_type.A.evaluate(this.point2.visProp.fixed),t>math.A.eps?r<o&&s||o<=r&&s&&!i?(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()):(o<=r&&i||r<o&&i&&!s)&&(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()):(r=Math.random()-.5,o=Math.random()-.5,t=math.A.hypot(r,o),s?(this.point2.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point1.X()+r*e/t,this.point1.Y()+o*e/t]),this.point2.fullUpdate()):i&&(this.point1.setPositionDirectly(constants.A.COORDS_BY_USER,[this.point2.X()+r*e/t,this.point2.Y()+o*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},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},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,t=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",s,")+(",t,")*(",s,")-(",e,")*(",t,")+(",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=1.5,l=0,h=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),c=utils_type.A.evaluate(this.visProp.straightfirst),d=utils_type.A.evaluate(this.visProp.straightlast);if((c||d)&&geometry.A.calcStraight(this,h,u,0),h=h.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=utils_type.A.evaluate(this.label.visProp.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=h[1],e=h[2];break;case"lft":case"llft":case"ulft":e=h[1]<u[1]+math.A.eps?(t=h[1],h[2]):(t=u[1],u[2]);break;case"rt":case"lrt":case"urt":e=h[1]>u[1]+math.A.eps?(t=h[1],h[2]):(t=u[1],u[2]);break;default:t=.5*(h[1]+u[1]),e=.5*(h[2]+u[2])}else i=utils_type.A.parsePosition(i),s=utils_type.A.parseNumber(i.pos,1,1),r=u[1]-h[1],o=u[2]-h[2],n=math.A.hypot(r,o),e=0<=i.pos.indexOf("px")||0<=i.pos.indexOf("fr")||0<=i.pos.indexOf("%")?(0<=i.pos.indexOf("px")&&(s/=n),t=h[1]+s*r,h[2]+s*o):(t=h[1]+s*this.board.unitX*r/n,h[2]+s*this.board.unitY*o/n),"left"===i.side?r*=-1:o*=-1,utils_type.A.exists(this.label)&&(a=.5*utils_type.A.evaluate(this.label.visProp.distance)/n),t+=o*this.label.size[0]*a,e+=r*this.label.size[1]*a;return(c||d)&&(utils_type.A.exists(this.label)&&(l=utils_type.A.evaluate(this.label.visProp.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={};return s.id=this.id+"T"+this.numTraces,s.elementClass=constants.A.OBJECT_CLASS_LINE,this.numTraces++,s.point1=this.point1,s.point2=this.point2,s.stdform=this.stdform,s.board=this.board,s.visProp=utils_type.A.deepCopy(this.visProp,this.visProp.traceattributes,!0),s.visProp.layer=this.board.options.layer.trace,utils_type.A.clearVisPropOld(s),s.visPropCalc={visible:utils_type.A.evaluate(s.visProp.visible)},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){for(var e=utils_type.A.isArray(t)?t:[t],i=e.length,s=0;s<i;s++)this.point1.transformations.push(e[s]),this.point2.transformations.push(e[s]);return this},snapToGrid:function(t){var e,i,s,r,o;return utils_type.A.evaluate(this.visProp.snaptogrid)?this.parents.length<3?(this.point1.handleSnapToGrid(!0,!0),this.point2.handleSnapToGrid(!0,!0)):utils_type.A.exists(t)&&(r=utils_type.A.evaluate(this.visProp.snapsizex),o=utils_type.A.evaluate(this.visProp.snapsizey),i=(t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this.board)).usrCoords[1],s=t.usrCoords[2],r<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(r=(e=this.board.defaultAxes.x.defaultTicks).ticksDelta*(utils_type.A.evaluate(e.visProp.minorticks)+1)),o<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(o=(e=this.board.defaultAxes.y.defaultTicks).ticksDelta*(utils_type.A.evaluate(e.visProp.minorticks)+1)),0<r&&0<o&&(e=geometry.A.projectPointToLine({coords:t},this,this.board),t=statistics.A.subtract([1,Math.round(i/r)*r,Math.round(s/o)*o],e.usrCoords),this.board.create("transform",t.slice(1),{type:"translate"}).applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGrid(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var t=utils_type.A.evaluate(this.visProp.snaptopoints);return this.parents.length<3&&(this.point1.handleSnapToPoints(t),this.point2.handleSnapToPoints(t)),this},X:function(t){var e=this.stdform[2],i=(Math.abs(this.point1.coords.usrCoords[0])>math.A.eps?this.point1:this.point2).coords.usrCoords[1];return t=2*(t-.5),(1-Math.abs(t))*i-t*e},Y:function(t){var e=this.stdform[1],i=(Math.abs(this.point1.coords.usrCoords[0])>math.A.eps?this.point1:this.point2).coords.usrCoords[2];return t=2*(t-.5),(1-Math.abs(t))*i+t*e},Z:function(t){var e=(Math.abs(this.point1.coords.usrCoords[0])>math.A.eps?this.point1:this.point2).coords.usrCoords[0];return t=2*(t-.5),(1-Math.abs(t))*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},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,l,h,u=[],c=!1,d=!1;if(2===e.length){if(l=utils_type.A.copyAttributes(i,t.options,"line","point1"),utils_type.A.isArray(e[0])&&1<e[0].length)o=t.create("point",e[0],l);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&&2<=e[0]().length)o=jxg.A.createPoint(t,e[0](),l),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]");c=!0,o=t.create("point",[e[0].point1,e[1]],l)}if(l=utils_type.A.copyAttributes(i,t.options,"line","point2"),c)n=t.create("point",[e[0].point2,e[1]],l);else if(utils_type.A.isArray(e[1])&&1<e[1].length)n=t.create("point",e[1],l);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&&2<=e[1]().length))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](),l),d=!0}l=utils_type.A.copyAttributes(i,t.options,"line"),r=new jxg.A.Line(t,o,n,l),d?(r.constrained=!0,r.funp1=e[0],r.funp2=e[1]):c||(r.isDraggable=!0),r.setParents([o.id,n.id])}else if(3===e.length){for(h=!0,a=0;a<3;a++)if(utils_type.A.isNumber(e[a]))u[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]");u[a]=e[a],h=!1}l=utils_type.A.copyAttributes(i,t.options,"line","point1"),o=h?t.create("point",[u[2]()*u[2]()+u[1]()*u[1](),u[2]()-u[1]()*u[0]()+u[2](),-u[1]()-u[2]()*u[0]()-u[1]()],l):t.create("point",[function(){return.5*(u[2]()*u[2]()+u[1]()*u[1]())},function(){return.5*(u[2]()-u[1]()*u[0]()+u[2]())},function(){return.5*(-u[1]()-u[2]()*u[0]()-u[1]())}],l),l=utils_type.A.copyAttributes(i,t.options,"line","point2"),n=h?t.create("point",[u[2]()*u[2]()+u[1]()*u[1](),-u[1]()*u[0]()+u[2](),-u[2]()*u[0]()-u[1]()],l):t.create("point",[function(){return u[2]()*u[2]()+u[1]()*u[1]()},function(){return-u[1]()*u[0]()+u[2]()},function(){return-u[2]()*u[0]()-u[1]()}],l),o.prepareUpdate().update(),n.prepareUpdate().update(),l=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,o,n,l)).isDraggable=h,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](),l=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,s[0],s[1],l)).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],l=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])]}],l),l=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]]}],l),l=utils_type.A.copyAttributes(i,t.options,"line"),(r=new jxg.A.Line(t,o,n,l)).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){if(i.straightFirst=!1,i.straightLast=!1,i=utils_type.A.copyAttributes(i,t.options,"segment"),i=t.create("line",e.slice(0,2),i),3===e.length){try{i.hasFixedLength=!0,i.fixedLengthOldCoords=[],i.fixedLengthOldCoords[0]=new base_coords.A(constants.A.COORDS_BY_USER,i.point1.coords.usrCoords.slice(1,3),t),i.fixedLengthOldCoords[1]=new base_coords.A(constants.A.COORDS_BY_USER,i.point2.coords.usrCoords.slice(1,3),t),i.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")}i.getParents=function(){return this.parents.concat(this.fixedLength())}}return i.elType="segment",i},jxg.A.registerElement("segment",jxg.A.createSegment),jxg.A.createArrow=function(t,e,i){return i.straightFirst=!1,i.straightLast=!1,i=utils_type.A.copyAttributes(i,t.options,"arrow"),(t=t.create("line",e,i)).type=constants.A.OBJECT_TYPE_VECTOR,t.elType="arrow",t},jxg.A.registerElement("arrow",jxg.A.createArrow),jxg.A.createAxis=function(t,e,i){var A,s,i=utils_type.A.copyAttributes(i,t.options,"axis");try{A=t.create("line",e,i)}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(s in A.type=constants.A.OBJECT_TYPE_AXIS,A.isDraggable=!1,A.point1.isDraggable=!1,A.point2.isDraggable=!1,A._point1UsrCoordsOrg=A.point1.coords.usrCoords.slice(),A._point2UsrCoordsOrg=A.point2.coords.usrCoords.slice(),A.ancestors)A.ancestors.hasOwnProperty(s)&&(A.ancestors[s].type=constants.A.OBJECT_TYPE_AXISPOINT);return e=utils_type.A.exists(i.ticks.ticksdistance)?i.ticks.ticksdistance:utils_type.A.isArray(i.ticks.ticks)?i.ticks.ticks:1,A.defaultTicks=t.create("ticks",[A,e],i.ticks),A.defaultTicks.dump=!1,A.elType="axis",A.subs={ticks:A.defaultTicks},A.inherits.push(A.defaultTicks),A.update=function(){var t,e,i,s,r,o,n,a,l,h=this.board.getBoundingBox(),u=utils_type.A.evaluate(this.visProp.position),c=this.Direction(),d=this.isHorizontal(),p=this.isVertical(),_=utils_type.A.evaluate(this.visProp.ticksautopos),f=utils_type.A.evaluate(this.visProp.ticksautoposthreshold);if(f=d?utils_type.A.parseNumber(f,Math.abs(h[1]-h[3]),1/this.board.unitX)*this.board.unitX:p?utils_type.A.parseNumber(f,Math.abs(h[1]-h[3]),1/this.board.unitY)*this.board.unitY:utils_type.A.parseNumber(f,1,1),i=-1<(s=utils_type.A.evaluate(this.visProp.anchor)).indexOf("left"),s=-1<s.indexOf("right"),r=utils_type.A.evaluate(this.visProp.anchordist),r=d?utils_type.A.parseNumber(r,Math.abs(h[1]-h[3]),1/this.board.unitX):p?utils_type.A.parseNumber(r,Math.abs(h[0]-h[2]),1/this.board.unitY):0,l=this.board.getPointLoc(this._point1UsrCoordsOrg,r),o=this.point1.coords.usrCoords.slice(),n=this.point2.coords.usrCoords.slice(),"static"!==u&&(p||d)&&("fixed"===u?(d&&(0<c[0]&&s||c[0]<0&&i?(o[2]=h[3]+r,n[2]=h[3]+r):0<c[0]&&i||c[0]<0&&s?(o[2]=h[1]-r,n[2]=h[1]-r):(o=this._point1UsrCoordsOrg.slice(),n=this._point2UsrCoordsOrg.slice())),p&&(0<c[1]&&i||c[1]<0&&s?(o[1]=h[0]+r,n[1]=h[0]+r):0<c[1]&&s||c[1]<0&&i?(o[1]=h[2]-r,n[1]=h[2]-r):(o=this._point1UsrCoordsOrg.slice(),n=this._point2UsrCoordsOrg.slice()))):"sticky"===u&&(d&&(l[1]<0&&(0<c[0]&&s||c[0]<0&&i)?(o[2]=h[3]+r,n[2]=h[3]+r):0<l[1]&&(0<c[0]&&i||c[0]<0&&s)?(o[2]=h[1]-r,n[2]=h[1]-r):(o=this._point1UsrCoordsOrg.slice(),n=this._point2UsrCoordsOrg.slice())),p&&(l[0]<0&&(0<c[1]&&i||c[1]<0&&s)?(o[1]=h[0]+r,n[1]=h[0]+r):0<l[0]&&(0<c[1]&&s||c[1]<0&&i)?(o[1]=h[2]-r,n[1]=h[2]-r):(o=this._point1UsrCoordsOrg.slice(),n=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(jxg.A.COORDS_BY_USER,o),this.point2.setPositionDirectly(jxg.A.COORDS_BY_USER,n),utils_type.A.exists(this.defaultTicks)){if(u=this.defaultTicks.visProp.label,_&&(d||p)){if(utils_type.A.exists(u._anchorx_org)||(u._anchorx_org=utils_type.A.def(u.anchorx,this.board.options.text.anchorX)),utils_type.A.exists(u._anchory_org)||(u._anchory_org=utils_type.A.def(u.anchory,this.board.options.text.anchorY)),utils_type.A.exists(u._offset_org)||(u._offset_org=u.offset.slice()),l=u.offset,d){for(e=A.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,a=u.anchory,e<0&&Math.abs(e)>f?"bottom"===u._side&&("top"===u.anchory&&(a="bottom"),l[1]*=-1,u._side="top"):0<e&&Math.abs(e)>f?"top"===u._side&&("bottom"===u.anchory&&(a="top"),l[1]*=-1,u._side="bottom"):(a=u._anchory_org,l=u._offset_org.slice(),"top"===a||"bottom"!==a&&l[1]<0?u._side="bottom":u._side="top"),t=0;t<A.defaultTicks.labels.length;t++)this.defaultTicks.labels[t].visProp.anchory=a;u.anchory=a}else if(p){for((e=A.point1.coords.scrCoords[1]-.5*this.board.canvasWidth)<0&&Math.abs(e)>f?"right"===u._side&&("left"===u.anchorx&&(a="right"),l[0]*=-1,u._side="left"):0<e&&Math.abs(e)>f?"left"===u._side&&("right"===u.anchorx&&(a="left"),l[0]*=-1,u._side="right"):(a=u._anchorx_org,l=u._offset_org.slice(),"left"!==a&&("right"===a||l[0]<0)?u._side="left":u._side="right"),t=0;t<A.defaultTicks.labels.length;t++)this.defaultTicks.labels[t].visProp.anchorx=a;u.anchorx=a}u.offset=l}else delete u._anchorx_org,delete u._anchory_org,delete u._offset_org;this.defaultTicks.needsUpdate=!0}return jxg.A.Line.prototype.update.call(this),this},A},jxg.A.registerElement("axis",jxg.A.createAxis),jxg.A.createTangent=function(l,t,e){var h,u,i,s,r,o,n,c,d=[];if(1===t.length)h=t[0],u=h.slideObject;else{if(2!==t.length)throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");if(utils_type.A.isPoint(t[0]))h=t[0],u=t[1];else{if(!utils_type.A.isPoint(t[1]))throw new Error("JSXGraph: Can't create tangent with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");u=t[0],h=t[1]}}if(e=utils_type.A.copyAttributes(e,l.options,"tangent"),u.elementClass===constants.A.OBJECT_CLASS_LINE)(r=l.create("line",[u.point1,u.point2],e)).glider=h;else if(u.elementClass===constants.A.OBJECT_CLASS_CURVE&&u.type!==constants.A.OBJECT_TYPE_CONIC){if(n=u.getTransformationSource(),c=n[0])for(d.push(u);n[0]&&utils_type.A.exists(n[1]._transformationSource);)d.push(n[1]),n=n[1].getTransformationSource();r="plot"!==utils_type.A.evaluate(u.visProp.curvetype)||c?l.create("line",[function(){var t,e,i,s,r=u.X,o=u.Y,n=h.type===constants.A.OBJECT_TYPE_GLIDER?h.position:"functiongraph"===utils_type.A.evaluate(u.visProp.curvetype)?h.X():geometry.A.projectPointToCurve(h,u,l)[1],a=h.Coords(!0);if(c){for(r=(i=d[d.length-1]._transformationSource).X,o=i.Y,e=0;e<d.length;e++)d[e].updateTransformMatrix(),s=math.A.inverse(d[e].transformMat),a=math.A.matVecMult(s,a);h.type!==constants.A.OBJECT_TYPE_GLIDER&&(a[1]/=a[0],a[2]/=a[0],a[0]/=a[0],n=geometry.A.projectCoordsToCurve(a[1],a[2],0,i,l)[1])}if(i=numerics.A.D(o)(n),o=numerics.A.D(r)(n),t=[-a[1]*i+a[2]*o,a[0]*i,-a[0]*o],c)for(e=d.length-1;0<=e;e--)s=math.A.transpose(math.A.inverse(d[e].transformMat)),t=math.A.matVecMult(s,t);return t}],e):(o=function(t,e,i){var s,r,o,n,a,l=Math.floor(t);if(1===e.bezierDegree)l===e.numberPoints-1&&l--;else{if(3!==e.bezierDegree)return 0;o=(t*((a=(n="sector"===e.elType?e.points.slice(3,e.numberPoints-3):e.points).length)-1)-(l=3*Math.floor(t*(a-1)/3)))/3,a-1<=l&&(l=a-4,o=1)}if(l<0)return 1;switch(r=1===e.bezierDegree?(s=e.points[l].usrCoords,e.points[l+1].usrCoords):(t=n[l].usrCoords,a=n[l+1].usrCoords,e=n[l+2].usrCoords,n=n[l+3].usrCoords,l=(1-o)*(1-o)*(a[1]-t[1])+2*(1-o)*o*(e[1]-a[1])+o*o*(n[1]-e[1]),t=(1-o)*(1-o)*(a[2]-t[2])+2*(1-o)*o*(e[2]-a[2])+o*o*(n[2]-e[2]),l/=a=math.A.hypot(l,t),[1,(s=h.coords.usrCoords)[1]+l,s[2]+(t/=a)]),i){case 0:return s[2]*r[1]-s[1]*r[2];case 1:return r[2]-s[2];case 2:return s[1]-r[1];default:return[s[2]*r[1]-s[1]*r[2],r[2]-s[2],s[1]-r[1]]}},l.create("line",[function(){var t=h.type===constants.A.OBJECT_TYPE_GLIDER?h.position:geometry.A.projectPointToCurve(h,u,l)[1];return o(t,u)}],e)),h.addChild(r),r.glider=h}else u.type===constants.A.OBJECT_TYPE_TURTLE?(r=l.create("line",[function(){var t=h.type===constants.A.OBJECT_TYPE_GLIDER?h.position:geometry.A.projectPointToTurtle(h,u,l)[1],e=Math.floor(t);for(i=0;i<u.objects.length;i++)if((s=u.objects[i]).type===constants.A.OBJECT_TYPE_CURVE){if(e<s.numberPoints)break;e-=s.numberPoints}return e===s.numberPoints-1&&e--,e<0?[1,0,0]:[s.Y(e)*s.X(e+1)-s.X(e)*s.Y(e+1),s.Y(e+1)-s.Y(e),s.X(e)-s.X(e+1)]}],e),h.addChild(r),r.glider=h):u.elementClass!==constants.A.OBJECT_CLASS_CIRCLE&&u.type!==constants.A.OBJECT_TYPE_CONIC||(r=l.create("line",[function(){return math.A.matVecMult(u.quadraticform,h.coords.usrCoords)}],e),h.addChild(r),r.glider=h);if(utils_type.A.exists(r))return r.elType="tangent",r.type=constants.A.OBJECT_TYPE_TANGENT,r.setParents(t),r;throw new Error("JSXGraph: Couldn't create tangent with the given parents.")},jxg.A.createNormal=function(l,t,e){for(var u,h,i,s,r,o,c,d=[],n=0;n<t.length;++n)t[n]=l.select(t[n]);if(1===t.length)u=t[0],h=u.slideObject;else{if(2!==t.length)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");if(utils_type.A.isPointType(l,t[0]))u=utils_type.A.providePoints(l,[t[0]],e,"point")[0],h=t[1];else{if(!utils_type.A.isPointType(l,t[1]))throw new Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");h=t[0],u=utils_type.A.providePoints(l,[t[1]],e,"point")[0]}}if(s=utils_type.A.copyAttributes(e,l.options,"normal"),h.elementClass===constants.A.OBJECT_CLASS_LINE)e=utils_type.A.copyAttributes(e,l.options,"normal","point"),(e=l.create("point",[function(){var t=math.A.crossProduct([1,0,0],h.stdform);return[t[0],-t[2],t[1]]}],e)).isDraggable=!0,(i=l.create("line",[u,e],s)).point=e,i.subs={point:e},i.inherits.push(e);else if(h.elementClass===constants.A.OBJECT_CLASS_CIRCLE)i=l.create("line",[h.midpoint,u],s);else if(h.elementClass===constants.A.OBJECT_CLASS_CURVE){if(o=h.getTransformationSource(),c=o[0])for(d.push(h);o[0]&&utils_type.A.exists(o[1]._transformationSource);)d.push(o[1]),o=o[1].getTransformationSource();"plot"!==utils_type.A.evaluate(h.visProp.curvetype)||c?i=l.create("line",[function(){var t,e,i,s,r=h.X,o=h.Y,n=u.type===constants.A.OBJECT_TYPE_GLIDER?u.position:"functiongraph"===utils_type.A.evaluate(h.visProp.curvetype)?u.X():geometry.A.projectPointToCurve(u,h,l)[1],a=u.Coords(!0);if(c){for(r=(i=d[d.length-1]._transformationSource).X,o=i.Y,e=0;e<d.length;e++)d[e].updateTransformMatrix(),s=math.A.inverse(d[e].transformMat),a=math.A.matVecMult(s,a);u.type!==constants.A.OBJECT_TYPE_GLIDER&&(a[1]/=a[0],a[2]/=a[0],a[0]/=a[0],n=geometry.A.projectCoordsToCurve(a[1],a[2],0,i,l)[1])}if(i=numerics.A.D(o)(n),o=numerics.A.D(r)(n),t=[-a[1]*o-a[2]*i,a[0]*o,a[0]*i],c)for(e=d.length-1;0<=e;e--)s=math.A.transpose(math.A.inverse(d[e].transformMat)),t=math.A.matVecMult(s,t);return t}],s):(r=function(t,e,i){var s,r,o,n,a,l,h=Math.floor(t);if(1===e.bezierDegree)h===e.numberPoints-1&&h--,o=t;else{if(3!==e.bezierDegree)return 0;o=(t*((l=(a="sector"===e.elType?e.points.slice(3,e.numberPoints-3):e.points).length)-1)-(h=3*Math.floor(t*(l-1)/3)))/3,l-1<=h&&(h=l-4,o=1)}if(h<0)return 1;switch(t=o-h,n=1===e.bezierDegree?(s=e.points[h].usrCoords,r=e.points[h+1].usrCoords,l=[s[0]+t*(r[0]-s[0]),s[1]+t*(r[1]-s[1]),s[2]+t*(r[2]-s[2])],n=math.A.crossProduct(s,r),e=[(e=math.A.crossProduct([1,0,0],n))[0],-e[2],e[1]],math.A.crossProduct(l,e)):(t=a[h].usrCoords,l=a[h+1].usrCoords,e=a[h+2].usrCoords,a=a[h+3].usrCoords,h=(1-o)*(1-o)*(l[1]-t[1])+2*(1-o)*o*(e[1]-l[1])+o*o*(a[1]-e[1]),t=(1-o)*(1-o)*(l[2]-t[2])+2*(1-o)*o*(e[2]-l[2])+o*o*(a[2]-e[2]),h/=l=math.A.hypot(h,t),r=[1,(s=u.coords.usrCoords)[1]-(t/=l),s[2]+h],[s[2]*r[1]-s[1]*r[2],r[2]-s[2],s[1]-r[1]]),i){case 0:return n[0];case 1:return n[1];case 2:return n[2];default:return n}},i=l.create("line",[function(){var t=u.type===constants.A.OBJECT_TYPE_GLIDER?u.position:geometry.A.projectPointToCurve(u,h,l)[1];return r(t,h)}],s),u.addChild(i),i.glider=u)}else{if(h.type!==constants.A.OBJECT_TYPE_TURTLE)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof t[0]+"' and '"+typeof t[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");i=l.create("line",[function(){for(var t,e=Math.floor(u.position),i=u.position-e,s=0;s<h.objects.length;s++)if((t=h.objects[s]).type===constants.A.OBJECT_TYPE_CURVE){if(e<t.numberPoints)break;e-=t.numberPoints}return e===t.numberPoints-1&&(--e,i=1),e<0?1:(t.Y(e)+i*(t.Y(e+1)-t.Y(e)))*(t.Y(e)-t.Y(e+1))-(t.X(e)+i*(t.X(e+1)-t.X(e)))*(t.X(e+1)-t.X(e))},function(){for(var t,e=Math.floor(u.position),i=0;i<h.objects.length;i++)if((t=h.objects[i]).type===constants.A.OBJECT_TYPE_CURVE){if(e<t.numberPoints)break;e-=t.numberPoints}return e===t.numberPoints-1&&--e,e<0?0:t.X(e+1)-t.X(e)},function(){for(var t,e=Math.floor(u.position),i=0;i<h.objects.length;i++)if((t=h.objects[i]).type===constants.A.OBJECT_TYPE_CURVE){if(e<t.numberPoints)break;e-=t.numberPoints}return e===t.numberPoints-1&&--e,e<0?0:t.Y(e+1)-t.Y(e)}],s)}return i.elType="normal",i.setParents(t),utils_type.A.exists(u._is_new)?(i.addChild(u),delete u._is_new):u.addChild(i),h.addChild(i),i},jxg.A.createRadicalAxis=function(t,e,i){var s,r;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 s=t.select(e[0]),r=t.select(e[1]),(e=t.create("line",[function(){var t=s.stdform,e=r.stdform;return math.A.matVecMult(math.A.transpose([t.slice(0,3),e.slice(0,3)]),[e[3],-t[3]])}],i)).elType="radicalaxis",e.setParents([s.id,r.id]),s.addChild(e),r.addChild(e),e},jxg.A.createPolarLine=function(t,e,i){var s,r,o,n,a;if(1<e.length&&(r=e[0].type===constants.A.OBJECT_TYPE_CONIC||e[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE,o=e[1].type===constants.A.OBJECT_TYPE_CONIC||e[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE,n=utils_type.A.isPoint(e[0]),a=utils_type.A.isPoint(e[1])),2===e.length&&(r&&a||n&&o))return r=a?(s=t.select(e[0]),t.select(e[1])):(s=t.select(e[1]),t.select(e[0])),(n=t.create("tangent",[s,r],i)).elType="polarline",n;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]")},jxg.A.createTangentTo=function(t,e,i){var s=t.select(e[0]),r=utils_type.A.providePoints(t,e[1],i,"point")[0],o=utils_type.A.def(e[2],0);if(s.type!==constants.A.OBJECT_TYPE_CIRCLE&&s.type!==constants.A.OBJECT_TYPE_CONIC||r.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 e=utils_type.A.copyAttributes(i,t.options,"tangentto"),i=t.create("polar",[s,r],e.polar),r=t.create("intersection",[i,s,o],e.point),(o=t.create("tangent",[s,r],e)).point=r,o.polar=i,o.elType="tangentto",o},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),jxg.A.Line),group=(jxg.A.Group=function(t,e,i,s,r){var o,n,a;for(this.board=t,this.objects={},t=this.board.numObjects,this.board.numObjects+=1,""!==e&&utils_type.A.exists(e)?this.id=e:this.id=this.board.id+"Group"+t,(this.board.groups[this.id]=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=[],o=utils_type.A.isArray(s)?s:Array.prototype.slice.call(arguments,3),n=0;n<o.length;n++)a=this.board.select(o[n]),!utils_type.A.evaluate(a.visProp.fixed)&&utils_type.A.exists(a.coords)&&this.addPoint(a);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)&&0<=(i=utils_type.A.indexOf(e.groups,this.id))&&delete e.groups[i]);return this.objects={},this},addParents:function(t){for(var e,i=(e=utils_type.A.isArray(t)?t:arguments).length,s=0;s<i;++s)utils_type.A.isId(this.board,e[s])?this.parents.push(e[s]):utils_type.A.exists(e[s].id)&&this.parents.push(e[s].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){""!==t&&utils_type.A.exists(this.objects[t])&&(t=this.objects[t].point,this.coords[t.id]={usrCoords:t.coords.usrCoords.slice(0)})},update:function(){var t,e,i,s,r,o,n=null;if(!this.needsUpdate)return this;if("nothing"===(t=this._update_find_drag_type()).action)return this._updateCoordsCache(t.id),this;if(n=this.objects[t.id].point,"translation"===t.action)r=[n.coords.usrCoords[1]-this.coords[t.id].usrCoords[1],n.coords.usrCoords[2]-this.coords[t.id].usrCoords[2]];else if("rotation"===t.action||"scaling"===t.action){if(s="rotation"===t.action?"rotationCenter":"scaleCenter",utils_type.A.isPoint(this[s]))o=this[s].coords.usrCoords.slice(1);else if("centroid"===this[s])o=this._update_centroid_center();else if(utils_type.A.isArray(this[s]))o=this[s];else{if(!utils_type.A.isFunction(this[s]))return this;o=this[s]()}if("rotation"===t.action)s=geometry.A.rad(this.coords[t.id].usrCoords.slice(1),o,this.objects[t.id].point),(r=this.board.create("transform",[s,o[0],o[1]],{type:"rotate"})).update();else{if("scaling"!==t.action)return this;if(s=geometry.A.distance(this.coords[t.id].usrCoords.slice(1),o),Math.abs(s)<math.A.eps)return this;s=geometry.A.distance(n.coords.usrCoords.slice(1),o)/s,n=0<=this.scaleDirections[t.id].indexOf("x")?s:1,s=0<=this.scaleDirections[t.id].indexOf("y")?s:1,(r=this.board.create("transform",[1,0,0,o[0]*(1-n),n,0,o[1]*(1-s),0,s],{type:"generic"})).update()}}for(e in this._update_apply_transformation(t,r),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(e))for(i in this.objects[e].descendants)this.objects[e].descendants.hasOwnProperty(i)&&(this.objects[e].descendants.needsUpdate=this.objects[e].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(e in this.board.updateElements(t),this.objects)this.objects.hasOwnProperty(e)&&this._updateCoordsCache(e);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,1<r.length?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=[0,0],i=0;for(t in this.coords)this.coords.hasOwnProperty(t)&&(e[0]+=this.coords[t].usrCoords[1],e[1]+=this.coords[t].usrCoords[2],++i);return 0<i&&(e[0]/=i,e[1]/=i),e},_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.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||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){for(var e=0;e<t.length;e++)this.addPoint(t[e]);return this},addGroup:function(t){for(var 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){for(var i,s=(i=utils_type.A.isArray(t)?t:arguments).length,r=0;r<s;++r)this.scaleDirections[this.board.select(i[r]).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=(i=utils_type.A.isArray(e)?e:arguments).length;for(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){e=this[t+"Points"].indexOf(this.board.select(e));return-1<e&&this[t+"Points"].splice(e,1),this},setProperty:function(){jxg.A.deprecated("Group.setProperty","Group.setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(){for(var 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){i=utils_type.A.copyAttributes(i,t.options,"group"),t=new jxg.A.Group(t,i.id,i.name,e,i);return t.elType="group",t.setParents(e),t},jxg.A.registerElement("group",jxg.A.createGroup),jxg.A.Group),circle=(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=this.center.coords.usrCoords,t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),e=this.Radius(),s=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(s=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[s])):this.board.options.precision.hasPoint,r=i[1]-t.usrCoords[1],i=i[2]-t.usrCoords[2],t=math.A.hypot(r,i);return s=(s+=.5*utils_type.A.evaluate(this.visProp.strokewidth))/Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),utils_type.A.evaluate(this.visProp.hasinnerpoints)?t<e+s:Math.abs(t-e)<s},generatePolynomial:function(t){var e=this.center.symbolic.x,i=this.center.symbolic.y,s=t.symbolic.x,t=t.symbolic.y,r=this.generateRadiusSquared();return""===r?[]:["(("+s+")-("+e+"))^2 + (("+t+")-("+i+"))^2 - ("+r+")"]},generateRadiusSquared:function(){var t,e,i,s="";return"twoPoints"===this.method?(i=this.center.symbolic.x,t=this.center.symbolic.y,s="(("+(e=this.point2.symbolic.x)+")-("+i+"))^2 + (("+(i=this.point2.symbolic.y)+")-("+t+"))^2"):"pointRadius"===this.method?utils_type.A.isNumber(this.radius)&&(s=(this.radius*this.radius).toString()):"pointLine"===this.method?(e=this.line.point1.symbolic.x,i=this.line.point1.symbolic.y,s="(("+e+")-("+this.line.point2.symbolic.x+"))^2 + (("+i+")-("+this.line.point2.symbolic.y+"))^2"):"pointCircle"===this.method&&(s=this.circle.Radius()),s},update:function(){var t,e,i,s,r;if(this.needsUpdate)for(utils_type.A.evaluate(this.visProp.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(),e=this.center.coords.usrCoords[0],t=this.center.coords.usrCoords[1]/e,e=this.center.coords.usrCoords[2]/e,i=this.Radius(),s=.551915024494,this.numberPoints=13,this.dataX=[t+i,t+i,t+i*s,t,t-i*s,t-i,t-i,t-i,t-i*s,t,t+i*s,t+i,t+i],this.dataY=[e,e+i*s,e+i,e+i,e+i,e+i*s,e,e-i*s,e-i,e-i,e-i,e-i*s,e],this.bezierDegree=3,r=0;r<this.numberPoints;r++)this.points[r]=new base_coords.A(constants.A.COORDS_BY_USER,[this.dataX[r],this.dataY[r]],this.board);return this},updateQuadraticform:function(){var t=this.center,e=t.X(),t=t.Y(),i=this.Radius();this.quadraticform=[[e*e+t*t-i*i,-e,-t],[-e,1,0],[-t,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},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?utils_type.A.evaluate(this.visProp.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=1.5,n=this.Radius(),a=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=utils_type.A.evaluate(this.label.visProp.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 a=this.center.coords.scrCoords,i=utils_type.A.parsePosition(i),s=utils_type.A.parseNumber(i.pos,2*Math.PI,1),i.pos.indexOf("fr")<0&&i.pos.indexOf("%")<0&&(0<=i.pos.indexOf("px")?s=0:s*=Math.PI/180),r=1,"left"===i.side&&(r=-1),utils_type.A.exists(this.label)&&(o=.5*r*utils_type.A.evaluate(this.label.visProp.distance)),t=a[1]+(n*this.board.unitX+this.label.size[0]*o)*Math.cos(s),e=a[2]-(n*this.board.unitY+this.label.size[1]*o)*Math.sin(s),new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board);switch(utils_type.A.evaluate(this.visProp.label.position)){case"lft":t=a[1]-n,e=a[2];break;case"llft":t=a[1]-l*n,e=a[2]-l*n;break;case"rt":t=a[1]+n,e=a[2];break;case"lrt":t=a[1]+l*n,e=a[2]-l*n;break;case"urt":t=a[1]+l*n,e=a[2]+l*n;break;case"top":t=a[1],e=a[2]+n;break;case"bot":t=a[1],e=a[2]-n;break;default:t=a[1]-l*n,e=a[2]+l*n}return new base_coords.A(constants.A.COORDS_BY_USER,[t,e],this.board)},cloneToBackground:function(){var t,e=this.Radius(),i={id:this.id+"T"+this.numTraces,elementClass:constants.A.OBJECT_CLASS_CIRCLE,center:{coords:this.center.coords},Radius:function(){return e},getRadius:function(){return e},board:this.board,visProp:utils_type.A.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return i.visProp.layer=this.board.options.layer.trace,this.numTraces++,utils_type.A.clearVisPropOld(i),i.visPropCalc={visible:utils_type.A.evaluate(i.visProp.visible)},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){for(var e=utils_type.A.isArray(t)?t:[t],i=e.length,s=0;s<i;s++)this.center.transformations.push(e[s]),"twoPoints"===this.method&&this.point2.transformations.push(e[s]);return this},snapToGrid:function(){var t=utils_type.A.evaluate(this.visProp.snaptogrid);return this.center.handleSnapToGrid(t,!0),"twoPoints"===this.method&&this.point2.handleSnapToGrid(t,!0),this},snapToPoints:function(){var t=utils_type.A.evaluate(this.visProp.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=["center","point2"],a=[],l=t.select(e[0]);if(utils_type.A.isObject(l)&&l.elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isTransformationOrArray(e[1]))return o=utils_type.A.copyAttributes(i,t.options,"circle"),(s=jxg.A.createEllipse(t,[l.center,l.center,function(){return 2*l.Radius()}],o)).addTransform(e[1]),s;for(r=0;r<e.length;r++)if(utils_type.A.isPointType(t,e[r])){if(e.length<3?a.push(utils_type.A.providePoints(t,[e[r]],i,"circle",[n[r]])[0]):a.push(utils_type.A.providePoints(t,[e[r]],i,"point")[0]),!1===a[a.length-1])throw new Error("JSXGraph: Can't create circle from this type. Please provide a point type.")}else a.push(e[r]);if(o=utils_type.A.copyAttributes(i,t.options,"circle"),2===a.length&&utils_type.A.isPoint(a[0])&&utils_type.A.isPoint(a[1]))s=new jxg.A.Circle(t,"twoPoints",a[0],a[1],o);else if((utils_type.A.isNumber(a[0])||utils_type.A.isFunction(a[0])||utils_type.A.isString(a[0]))&&utils_type.A.isPoint(a[1]))s=new jxg.A.Circle(t,"pointRadius",a[1],a[0],o);else if((utils_type.A.isNumber(a[1])||utils_type.A.isFunction(a[1])||utils_type.A.isString(a[1]))&&utils_type.A.isPoint(a[0]))s=new jxg.A.Circle(t,"pointRadius",a[0],a[1],o);else if(a[0].elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isPoint(a[1]))s=new jxg.A.Circle(t,"pointCircle",a[1],a[0],o);else if(a[1].elementClass===constants.A.OBJECT_CLASS_CIRCLE&&utils_type.A.isPoint(a[0]))s=new jxg.A.Circle(t,"pointCircle",a[0],a[1],o);else if(a[0].elementClass===constants.A.OBJECT_CLASS_LINE&&utils_type.A.isPoint(a[1]))s=new jxg.A.Circle(t,"pointLine",a[1],a[0],o);else if(a[1].elementClass===constants.A.OBJECT_CLASS_LINE&&utils_type.A.isPoint(a[0]))s=new jxg.A.Circle(t,"pointLine",a[0],a[1],o);else{if(!(3===e.length&&utils_type.A.isPoint(a[0])&&utils_type.A.isPoint(a[1])&&utils_type.A.isPoint(a[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,a,o)}for(s.isDraggable=!0,s.setParents(a),s.elType="circle",r=0;r<a.length;r++)utils_type.A.isPoint(a[r])&&s.inherits.push(a[r]);return s},jxg.A.registerElement("circle",jxg.A.createCircle),jxg.A.Circle),polygon=(jxg.A.createEllipse=function(t,e,i){for(var r,h,s,u,o,c=[],n=utils_type.A.copyAttributes(i,t.options,"conic","foci"),a=utils_type.A.copyAttributes(i,t.options,"conic","center"),i=utils_type.A.copyAttributes(i,t.options,"conic"),l=0;l<2;l++)if(1<e[l].length)c[l]=t.create("point",e[l],n);else if(utils_type.A.isPoint(e[l]))c[l]=t.select(e[l]);else if(utils_type.A.isFunction(e[l])&&utils_type.A.isPoint(e[l]()))c[l]=e[l]();else{if(!utils_type.A.isString(e[l]))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[l]=t.select(e[l])}if(utils_type.A.isNumber(e[2]))u=utils_type.A.createFunction(e[2],t);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isNumber(e[2]()))u=e[2];else{if(utils_type.A.isPoint(e[2]))s=t.select(e[2]);else if(1<e[2].length)s=t.create("point",e[2],n);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isPoint(e[2]()))s=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]");s=t.select(e[2])}u=function(){return s.Dist(c[0])+s.Dist(c[1])}}for(utils_type.A.exists(e[4])||(e[4]=2*Math.PI),utils_type.A.exists(e[3])||(e[3]=0),a=t.create("point",[function(){return.5*(c[0].X()+c[1].X())},function(){return.5*(c[0].Y()+c[1].Y())}],a),(h=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],i)).majorAxis=u,o=h.hasPoint,r=function(t,e){var i,s,r,o,n,a,l;e||(i=(e=u())*e,l=c[0].X(),s=c[0].Y(),n=l-(r=c[1].X()),a=s-(o=c[1].Y()),h.quadraticform=[[(l=(i-l*l-s*s+r*r+o*o)/(2*e))*l-r*r-o*o,l*n/e+r,l*a/e+o],[l*n/e+r,n*n/i-1,n*a/i],[l*a/e+o,n*a/i,a*a/i-1]])},h.X=function(t,e){var i=u(),s=c[1].Dist(c[0]),s=.5*(s*s-i*i)/(s*Math.cos(t)-i),i=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return e||r(0,e),c[0].X()+Math.cos(i+t)*s},h.Y=function(t,e){var i=u(),s=c[1].Dist(c[0]),s=.5*(s*s-i*i)/(s*Math.cos(t)-i),i=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return c[0].Y()+Math.sin(i+t)*s},h.midpoint=h.center=a,h.type=constants.A.OBJECT_TYPE_CONIC,h.subs={center:h.center},h.inherits.push(h.center,c[0],c[1]),utils_type.A.isPoint(s)&&h.inherits.push(s),h.hasPoint=function(t,e){var i,s,r;return utils_type.A.evaluate(this.visProp.hasinnerpoints)?(i=c[0].coords,s=c[1].coords,r=this.majorAxis(),(t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board)).distance(constants.A.COORDS_BY_USER,i)+t.distance(constants.A.COORDS_BY_USER,s)<=r):o.apply(this,arguments)},a.addChild(h),l=0;l<2;l++)utils_type.A.isPoint(c[l])&&c[l].addChild(h);return utils_type.A.isPoint(s)&&s.addChild(h),h.setParents(e),h},jxg.A.createHyperbola=function(t,e,i){for(var r,h,s,u,c=[],o=utils_type.A.copyAttributes(i,t.options,"conic","foci"),n=utils_type.A.copyAttributes(i,t.options,"conic","center"),i=utils_type.A.copyAttributes(i,t.options,"conic"),a=0;a<2;a++)if(1<e[a].length)c[a]=t.create("point",e[a],o);else if(utils_type.A.isPoint(e[a]))c[a]=t.select(e[a]);else if(utils_type.A.isFunction(e[a])&&utils_type.A.isPoint(e[a]()))c[a]=e[a]();else{if(!utils_type.A.isString(e[a]))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]");c[a]=t.select(e[a])}if(utils_type.A.isNumber(e[2]))u=utils_type.A.createFunction(e[2],t);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isNumber(e[2]()))u=e[2];else{if(utils_type.A.isPoint(e[2]))s=t.select(e[2]);else if(1<e[2].length)s=t.create("point",e[2],o);else if(utils_type.A.isFunction(e[2])&&utils_type.A.isPoint(e[2]()))s=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]");s=t.select(e[2])}u=function(){return s.Dist(c[0])-s.Dist(c[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),n=t.create("point",[function(){return.5*(c[0].X()+c[1].X())},function(){return.5*(c[0].Y()+c[1].Y())}],n),(h=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],i)).majorAxis=u,r=function(t,e){var i,s,r,o,n,a,l;e||(i=(e=u())*e,l=c[0].X(),s=c[0].Y(),n=l-(r=c[1].X()),a=s-(o=c[1].Y()),h.quadraticform=[[(l=(i-l*l-s*s+r*r+o*o)/(2*e))*l-r*r-o*o,l*n/e+r,l*a/e+o],[l*n/e+r,n*n/i-1,n*a/i],[l*a/e+o,n*a/i,a*a/i-1]])},h.X=function(t,e){var i=u(),s=c[1].Dist(c[0]),s=.5*(s*s-i*i)/(s*Math.cos(t)+i),i=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return e||r(0,e),c[0].X()+Math.cos(i+t)*s},h.Y=function(t,e){var i=u(),s=c[1].Dist(c[0]),s=.5*(s*s-i*i)/(s*Math.cos(t)+i),i=Math.atan2(c[1].Y()-c[0].Y(),c[1].X()-c[0].X());return c[0].Y()+Math.sin(i+t)*s},h.midpoint=h.center=n,h.subs={center:h.center},h.inherits.push(h.center,c[0],c[1]),utils_type.A.isPoint(s)&&h.inherits.push(s),h.type=constants.A.OBJECT_TYPE_CONIC,n.addChild(h),a=0;a<2;a++)utils_type.A.isPoint(c[a])&&c[a].addChild(h);return utils_type.A.isPoint(s)&&s.addChild(h),h.setParents(e),h},jxg.A.createParabola=function(t,e,i){var a,l,h=e[0],u=e[1],s=utils_type.A.copyAttributes(i,t.options,"conic","foci"),r=utils_type.A.copyAttributes(i,t.options,"conic","center"),o=utils_type.A.copyAttributes(i,t.options,"conic");if(1<e[0].length)h=t.create("point",e[0],s);else if(utils_type.A.isPoint(e[0]))h=t.select(e[0]);else if(utils_type.A.isFunction(e[0])&&utils_type.A.isPoint(e[0]()))h=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]");h=t.select(e[0])}return utils_type.A.isArray(u)&&2===u.length&&(s=utils_type.A.copyAttributes(i,t.options,"conic","line"),u=t.create("line",u,s)),utils_type.A.exists(e[3])||(e[3]=2*Math.PI),utils_type.A.exists(e[2])||(e[2]=0),i=t.create("point",[function(){return geometry.A.projectPointToLine(h,u,t).usrCoords}],r),(l=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],o)).midpoint=l.center=i,l.subs={center:l.center},l.inherits.push(l.center),a=function(t,e){var i,s,r,o,n;e||(e=u.stdform[1],i=u.stdform[2],s=u.stdform[0],r=e*e+i*i,o=h.X(),n=h.Y(),l.quadraticform=[[s*s-r*(o*o+n*n),s*e+r*o,s*i+r*n],[s*e+r*o,-i*i,e*i],[s*i+r*n,e*i,-e*e]])},l.X=function(t,e){var i=u.getAngle(),s=geometry.A.distPointLine(h.coords.usrCoords,u.stdform),r=u.point1.coords.usrCoords,o=u.point2.coords.usrCoords,n=h.coords.usrCoords;return 0===r[0]?r=[1,o[1]+u.stdform[2],o[2]-u.stdform[1]]:0===o[0]&&(o=[1,r[1]+u.stdform[2],r[2]-u.stdform[1]]),o=(0<=(o[1]-r[1])*(n[2]-r[2])-(o[2]-r[2])*(n[1]-r[1])?1:-1)*s/(1-Math.sin(t)),e||a(0,e),h.X()+Math.cos(t+i)*o},l.Y=function(t,e){var i=u.getAngle(),s=geometry.A.distPointLine(h.coords.usrCoords,u.stdform),r=u.point1.coords.usrCoords,o=u.point2.coords.usrCoords,n=h.coords.usrCoords;return 0===r[0]?r=[1,o[1]+u.stdform[2],o[2]-u.stdform[1]]:0===o[0]&&(o=[1,r[1]+u.stdform[2],r[2]-u.stdform[1]]),o=(0<=(o[1]-r[1])*(n[2]-r[2])-(o[2]-r[2])*(n[1]-r[1])?1:-1)*s/(1-Math.sin(t)),h.Y()+Math.sin(t+i)*o},l.type=constants.A.OBJECT_TYPE_CONIC,i.addChild(l),utils_type.A.isPoint(h)&&(h.addChild(l),l.inherits.push(h)),u.addChild(l),l.setParents(e),l},jxg.A.createConic=function(t,e,i){var s,o,n,a,l,h,u,c,d,r,p,_,f=[[1,0,0],[0,1,0],[0,0,1]],A=[[1,0,0],[0,1,0],[0,0,1]],g=[],m=[],y=utils_type.A.copyAttributes(i,t.options,"conic","point"),b=utils_type.A.copyAttributes(i,t.options,"conic","center"),i=utils_type.A.copyAttributes(i,t.options,"conic");if(5===e.length)_=!0;else{if(6!==e.length)throw new Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");_=!1}if(_)for(r=0;r<5;r++)if(1<e[r].length)g[r]=t.create("point",e[r],y);else if(utils_type.A.isPoint(e[r]))g[r]=t.select(e[r]);else if(utils_type.A.isFunction(e[r])&&utils_type.A.isPoint(e[r]()))g[r]=e[r]();else{if(!utils_type.A.isString(e[r]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[r]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");g[r]=t.select(e[r])}else(p=[[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]},p[0][1]=utils_type.A.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},p[0][2]=utils_type.A.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},p[1][1]=utils_type.A.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},p[1][2]=utils_type.A.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},p[2][2]=utils_type.A.isFunction(e[1])?function(){return e[1]()}:function(){return e[1]};if(l=function(t){for(var e,i=0;i<3;i++)for(e=i;e<3;e++)t[i][e]+=t[e][i];for(i=0;i<3;i++)for(e=0;e<i;e++)t[i][e]=t[e][i];return t},a=function(t,e){for(var i,s=[[0,0,0],[0,0,0],[0,0,0]],r=0;r<3;r++)for(i=0;i<3;i++)s[r][i]=t[r]*e[i];return l(s)},n=function(t,e,i){var s,r,o,n=[[0,0,0],[0,0,0],[0,0,0]],a=math.A.matVecMult(e,i),l=math.A.innerProduct(i,a);for(a=math.A.matVecMult(t,i),o=math.A.innerProduct(i,a),s=0;s<3;s++)for(r=0;r<3;r++)n[s][r]=l*t[s][r]-o*e[s][r];return n},o=t.create("curve",[function(t){return 0},function(t){return 0},0,2*Math.PI],i),s=function(t,e){var i,s,r;if(!e){if(_){for(i=0;i<5;i++)m[i]=g[i].coords.usrCoords;c=a(math.A.crossProduct(m[0],m[1]),math.A.crossProduct(m[2],m[3])),d=a(math.A.crossProduct(m[0],m[2]),math.A.crossProduct(m[1],m[3])),A=n(c,d,m[4])}else for(i=0;i<3;i++)for(s=i;s<3;s++)A[i][s]=p[i][s](),i<s&&(A[s][i]=A[i][s]);o.quadraticform=A,(c=numerics.A.Jacobi(A))[0][0][0]<0&&(c[0][0][0]*=-1,c[0][1][1]*=-1,c[0][2][2]*=-1),f=c[1],d=Math.sqrt(Math.abs(c[0][0][0])),h=Math.sqrt(Math.abs(c[0][1][1])),u=Math.sqrt(Math.abs(c[0][2][2]))}return c[0][1][1]<=0&&c[0][2][2]<=0?r=math.A.matVecMult(f,[1/d,Math.cos(t)/h,Math.sin(t)/u]):c[0][1][1]<=0&&0<c[0][2][2]?r=math.A.matVecMult(f,[Math.cos(t)/d,1/h,Math.sin(t)/u]):c[0][2][2]<0&&(r=math.A.matVecMult(f,[Math.sin(t)/d,Math.cos(t)/h,1/u])),utils_type.A.exists(r)?(r[1]/=r[0],r[2]/=r[0],r[0]=1):r=[1,NaN,NaN],r},o.X=function(t,e){return s(t,e)[1]},o.Y=function(t,e){return s(t,e)[2]},o.midpoint=t.create("point",[function(){var t=o.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]]}],b),o.type=constants.A.OBJECT_TYPE_CONIC,o.center=o.midpoint,o.subs={center:o.center},o.inherits.push(o.center),o.inherits=o.inherits.concat(g),_){for(r=0;r<5;r++)utils_type.A.isPoint(g[r])&&g[r].addChild(o);o.setParents(e)}return o.addChild(o.center),o},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,l=utils_type.A.copyAttributes(i,t.options,"polygon","borders");for(this.withLines=i.withlines,this.attr_line=l,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(0<this.vertices.length&&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,l.id=l.ids&&l.ids[s],l.name=l.names&&l.names[s],l.strokecolor=utils_type.A.isArray(l.colors)&&l.colors[s%l.colors.length]||l.strokecolor,l.visible=(utils_type.A.exists(i.borders.visible)?i.borders:i).visible,!1===l.strokecolor&&(l.strokecolor="none"),(r=t.create("segment",[this.vertices[s],this.vertices[s+1]],l)).dump=!1,((this.borders[s]=r).parentPolygon=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)},hasPoint:function(t,e){var i,s;if(utils_type.A.evaluate(this.visProp.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={};return e.id=this.id+"T"+this.numTraces,this.numTraces++,e.vertices=this.vertices,e.visProp=utils_type.A.deepCopy(this.visProp,this.visProp.traceattributes,!0),e.visProp.layer=this.board.options.layer.trace,e.board=this.board,utils_type.A.clearVisPropOld(e),e.visPropCalc={visible:utils_type.A.evaluate(e.visProp.visible)},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(){for(var t=this.vertices.length,e=0,i=1;i<t;++i)e+=this.vertices[i].Dist(this.vertices[i-1]);return e},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(){for(var 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=Array.prototype.slice.call(arguments),i="polygonalchain"===this.elType?this.vertices.length-1:this.vertices.length-2;return this.insertPoints.apply(this,[i].concat(e))},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||r<t)return this;for(s=arguments.length-1,i=1;i<1+s;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]:0<=t&&(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=[],l=[];for("polygon"===this.elType&&(r=this.vertices.pop()),e=0;e<arguments.length;e++)utils_type.A.isPoint(s=arguments[e])&&(s=this.findPoint(s)),utils_type.A.isNumber(s)&&-1<s&&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&&l.push([a[a.length-1]]),e=a.length-1;-1<e;e--)o[a[e]]=-1,this.withLines&&1<a.length&&a[e]-1>a[e-1]&&(l[l.length-1][1]=a[e],l.push([a[e-1]]));for(this.withLines&&(l[l.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&&1<this.vertices.length&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(e=0;e<l.length;e++){for(i=l[e][1]-1;i<l[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!==l[e][1]&&l[e][0]!==o.length-1&&(n[l[e][0]-1]=this.board.create("segment",[o[l[e][1]-1],o[l[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&&2<this.vertices.length&&(l[0][1]===this.vertices.length-1||0===l[l.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(){for(var t=!!utils_type.A.evaluate(this.visProp.snaptogrid),e=0;e<this.vertices.length;e++)this.vertices[e].handleSnapToGrid(t,!0)},setPositionDirectly:function(t,e,i){for(var e=new base_coords.A(t,e,this.board),t=new base_coords.A(t,i,this.board),s=this.vertices.length-1,r=0;r<s;r++)if(!this.vertices[r].draggable())return this;return i=statistics.A.subtract(e.usrCoords,t.usrCoords),this.board.create("transform",i.slice(1),{type:"translate"}).applyOnce(this.vertices.slice(0,-1)),this},sutherlandHodgman:function(t){for(var e,i,s,r,o,n,a=jxg.A.Math.Geometry.sortVertices(this.vertices),l=jxg.A.Math.Geometry.sortVertices(t.vertices),h=a.length-1,u=l.length-1,c=[],d=function(t,e,i){return 0<=(e[1]-t[1])*(i[2]-t[2])-(e[2]-t[2])*(i[1]-t[1])},p=0;p<u;p++)c.push(l[p]);for(p=0;p<h;p++)for(i=c.slice(0),c=[],r=i[(e=i.length)-1],s=0;s<e;s++)o=i[s],d(a[p],a[p+1],o)?(d(a[p],a[p+1],r)||((n=jxg.A.Math.Geometry.meetSegmentSegment(r,o,a[p],a[p+1]))[0][1]/=n[0][0],n[0][2]/=n[0][0],n[0][0]=1,c.push(n[0])),c.push(o)):d(a[p],a[p+1],r)&&((n=jxg.A.Math.Geometry.meetSegmentSegment(r,o,a[p],a[p+1]))[0][1]/=n[0][0],n[0][2]/=n[0][0],n[0][0]=1,c.push(n[0])),r=o;return c},intersect:function(t){return this.sutherlandHodgman(t)}}),jxg.A.createPolygon=function(t,e,i){var s,r,o,n,a=[],l=!1;if(utils_type.A.copyAttributes(i,t.options,"polygon"),null===(o=t.select(e[0]))&&(o=e[0]),utils_type.A.isObject(o)&&o.type===constants.A.OBJECT_TYPE_POLYGON&&utils_type.A.isTransformationOrArray(e[1]))for(l=!0,r=o.vertices.length-1,n=utils_type.A.copyAttributes(i,t.options,"polygon","vertices"),s=0;s<r;s++)n.withlabel&&(n.name=""===o.vertices[s].name?"":o.vertices[s].name+"'"),a.push(t.create("point",[o.vertices[s],e[1]],n));else if(!1===(a=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(i=utils_type.A.copyAttributes(i,t.options,"polygon"),(i=new jxg.A.Polygon(t,a,i)).isDraggable=!0,l)for(i.prepareUpdate().update().updateVisibility().updateRenderer(),r=o.vertices.length-1,s=0;s<r;s++)a[s].prepareUpdate().update().updateVisibility().updateRenderer();return i},jxg.A.createRegularPolygon=function(t,e,i){var s,r,o,n,a,l=[],h=e[(o=e.length)-1];if(utils_type.A.isNumber(h)&&(3!==e.length||h<3))throw new Error("JSXGraph: A regular polygon needs two point types and a number > 2 as input.");if(n=utils_type.A.isNumber(t.select(h))?(o--,!1):(h=o,!0),!1===(l=utils_type.A.providePoints(t,e.slice(0,o),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(a=utils_type.A.copyAttributes(i,t.options,"regularpolygon","vertices"),s=2;s<h;s++)r=t.create("transform",[Math.PI*(2-(h-2)/h),l[s-1]],{type:"rotate"}),n?(l[s].addTransform(l[s-2],r),l[s].fullUpdate()):(utils_type.A.isArray(a.ids)&&a.ids.length>=h-2&&(a.id=a.ids[s-2]),l[s]=t.create("point",[l[s-2],r],a),l[s].type=constants.A.OBJECT_TYPE_CAS,l[s].isDraggable=!0,l[s].visProp.fixed=!1);return a=utils_type.A.copyAttributes(i,t.options,"regularpolygon"),(e=t.create("polygon",l,a)).elType="regularpolygon",e},jxg.A.createPolygonalChain=function(t,e,i){i=utils_type.A.copyAttributes(i,t.options,"polygonalchain");return(e=t.create("polygon",e,i)).elType="polygonalchain",e.vertices.pop(),t.removeObject(e.borders[e.borders.length-1]),e.borders.pop(),e},jxg.A.createParallelogram=function(t,e,i){var s;if(!1===(e=utils_type.A.providePoints(t,e,i,"polygon",["vertices"]))||e.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 s=utils_type.A.copyAttributes(i,t.options,"parallelogram","parallelpoint"),s=t.create("parallelpoint",e,s),i=utils_type.A.copyAttributes(i,t.options,"parallelogram"),(t=t.create("polygon",[e[0],e[1],s,e[2]],i)).elType="parallelogram",t.parallelPoint=s,t.isDraggable=!0,s.isDraggable=!0,s.visProp.fixed=!1,t},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),jxg.A.Polygon),curve=(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=utils_type.A.evaluate(this.visProp.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"===utils_type.A.evaluate(this.visProp.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"===utils_type.A.evaluate(this.visProp.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},hasPoint:function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_=[],f=utils_type.A.evaluate(this.visProp.numberpointslow),A=(this.maxX()-this.minX())/f,g=1/0,m=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(p=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[p])):this.board.options.precision.hasPoint;if(t=(p=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=p.usrCoords[2],1===this.bezierDegree&&utils_type.A.evaluate(this.visProp.hasinnerpoints)&&0!==geometry.A.windingNumber([1,t,e],this.points,!0))return!0;if(m=(m+=.5*utils_type.A.evaluate(this.visProp.strokewidth))*m,u=this.board.unitX*this.board.unitX,c=this.board.unitY*this.board.unitY,p=this.minX(),this.maxX(),utils_type.A.exists(this._visibleArea)&&(p=this._visibleArea[0],A=(this._visibleArea[1]-p)/f),"parameter"===(d=utils_type.A.evaluate(this.visProp.curvetype))||"polar"===d)for(0<this.transformations.length&&(this.updateTransformMatrix(),a=math.A.inverse(this.transformMat),t=(a=math.A.matVecMult(a,[1,t,e]))[1],e=a[2]),r=0,s=p;r<f;r++){if((g=(t-(o=this.X(s,!0)))*(t-o)*u+(e-(o=this.Y(s,!0)))*(e-o)*c)<=m)return!0;s+=A}else if("plot"===d||"functiongraph"===d){for((!utils_type.A.exists(i)||i<0)&&(i=0),n=utils_type.A.exists(this.qdt)&&utils_type.A.evaluate(this.visProp.useqdt)&&3!==this.bezierDegree?(l=(h=this.qdt.query(new base_coords.A(constants.A.COORDS_BY_USER,[t,e],this.board))).points).length:(l=this.points,this.numberPoints-1),r=i;r<n;r++)if(3===this.bezierDegree?_=geometry.A.projectCoordsToBeziersegment([1,t,e],this,r):h?(l[r].prev&&(_=geometry.A.projectCoordsToSegment([1,t,e],l[r].prev.usrCoords,l[r].usrCoords)),l[r].next&&l[r+1]!==l[r].next&&(_=geometry.A.projectCoordsToSegment([1,t,e],l[r].usrCoords,l[r].next.usrCoords))):_=geometry.A.projectCoordsToSegment([1,t,e],l[r].usrCoords,l[r+1].usrCoords),0<=_[1]&&_[1]<=1&&(t-_[0][1])*(t-_[0][1])*u+(e-_[0][2])*(e-_[0][2])*c<=m)return!0;return!1}return g<m},allocatePoints:function(){var t,e=this.numberPoints;if(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&&(utils_type.A.evaluate(this.visProp.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},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(utils_type.A.evaluate(this.visProp.doadvancedplot)?1===n||utils_type.A.evaluate(this.visProp.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=utils_type.A.evaluate(this.visProp.numberpointshigh):this.numberPoints=utils_type.A.evaluate(this.visProp.numberpointslow),this.allocatePoints(),plot.updateParametricCurveNaive(this,i,s,this.numberPoints)),e=this.numberPoints,utils_type.A.evaluate(this.visProp.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]),0<t&&(this.points[t].prev=this.points[t-1]),t<e-1&&(this.points[t].next=this.points[t+1]);for("plot"!==utils_type.A.evaluate(this.visProp.curvetype)&&utils_type.A.evaluate(this.visProp.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 0<this.transformations.length&&(e=math.A.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(constants.A.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){for(var e=utils_type.A.isArray(t)?t:[t],i=e.length,s=0;s<i;s++)this.transformations.push(e[s]);return this},interpolationFunctionFromArray:function(t){var h="data"+t,u=this;return function(t,e){var i,s,r,o,n=u[h],a=n.length,l=[];if(isNaN(t))return NaN;if(t<0)return utils_type.A.isFunction(n[0])?n[0]():n[0];if(3===u.bezierDegree){if((a-1)/3<=t)return utils_type.A.isFunction(n[n.length-1])?n[n.length-1]():n[n.length-1];for(i=3*Math.floor(t),o=1-(r=t%1),s=0;s<4;s++)utils_type.A.isFunction(n[i+s])?l[s]=n[i+s]():l[s]=n[i+s];return o*o*(o*l[0]+3*r*l[1])+(3*o*l[2]+r*l[3])*r*r}if((i=a-2<t?a-2:parseInt(Math.floor(t),10))===t)return utils_type.A.isFunction(n[i])?n[i]():n[i];for(s=0;s<2;s++)utils_type.A.isFunction(n[i+s])?l[s]=n[i+s]():l[s]=n[i+s];return l[0]+(l[1]-l[0])*(t-i)}},generateTerm:function(t,e,i,s,r){var o,n;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.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"])):this.Y=utils_type.A.createFunction(i,this.board,t),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)},getLabelAnchor:function(){var t,e,i,s,r,o,n,a=1.5,l=.05*this.board.canvasWidth,h=.05*this.board.canvasHeight,u=.95*this.board.canvasWidth,c=.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=utils_type.A.evaluate(this.label.visProp.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 i=utils_type.A.parsePosition(i),r=utils_type.A.parseNumber(i.pos,this.maxX()-this.minX(),1),i.pos.indexOf("fr")<0&&i.pos.indexOf("%")<0&&(r=0),r=this.minX()+r,t=this.X(r),e=this.Y(r),n=new base_coords.A(constants.A.COORDS_BY_USER,[t,e],this.board).scrCoords,o=math.A.eps,r=r<this.minX()+o?(s=(this.X(r+o)-this.X(r))/o,(this.Y(r+o)-this.Y(r))/o):r>this.maxX()-o?(s=(this.X(r)-this.X(r-o))/o,(this.Y(r)-this.Y(r-o))/o):(s=.5*(this.X(r+o)-this.X(r-o))/o,.5*(this.Y(r+o)-this.Y(r-o))/o),o=math.A.hypot(s,r),"left"===i.side?r*=-1:s*=-1,utils_type.A.exists(this.label)&&(a=.5*utils_type.A.evaluate(this.label.visProp.distance)/o),t=n[1]+r*this.label.size[0]*a,e=n[2]-s*this.label.size[1]*a,new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board);switch(utils_type.A.evaluate(this.visProp.label.position)){case"ulft":t=l,e=h;break;case"llft":t=l,e=c;break;case"rt":t=u,e=.5*c;break;case"lrt":t=u,e=c;break;case"urt":t=u,e=h;break;case"top":t=.5*u,e=h;break;case"bot":t=.5*u,e=c;break;default:t=l,e=.5*c}return n=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board,!1),geometry.A.projectCoordsToCurve(n.usrCoords[1],n.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,e={id:this.id+"T"+this.numTraces,elementClass:constants.A.OBJECT_CLASS_CURVE,points:this.points.slice(0),bezierDegree:this.bezierDegree,numberPoints:this.numberPoints,board:this.board,visProp:utils_type.A.deepCopy(this.visProp,this.visProp.traceattributes,!0)};return e.visProp.layer=this.board.options.layer.trace,e.visProp.curvetype=this.visProp.curvetype,this.numTraces++,utils_type.A.clearVisPropOld(e),e.visPropCalc={visible:utils_type.A.evaluate(e.visProp.visible)},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 t=0!==this.parents.length?this.parents:t},moveTo:function(t){var e;return 0<this.points.length&&!utils_type.A.evaluate(this.visProp.fixed)?(e=this.points[0],t=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,t),this.board.update(this)):this},getTransformationSource:function(){var t,e;return[t=utils_type.A.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===constants.A.OBJECT_CLASS_CURVE?!0:t,e]}}),jxg.A.createCurve=function(t,e,i){var s,r=utils_type.A.copyAttributes(i,t.options,"curve"),o=t.select(e[0],!0);return utils_type.A.isTransformationOrArray(e[1])&&utils_type.A.isObject(o)&&(o.type===constants.A.OBJECT_TYPE_CURVE||o.type===constants.A.OBJECT_TYPE_ANGLE||o.type===constants.A.OBJECT_TYPE_ARC||o.type===constants.A.OBJECT_TYPE_CONIC||o.type===constants.A.OBJECT_TYPE_SECTOR)?(r=o.type===constants.A.OBJECT_TYPE_SECTOR?utils_type.A.copyAttributes(i,t.options,"sector"):o.type===constants.A.OBJECT_TYPE_ARC?utils_type.A.copyAttributes(i,t.options,"arc"):o.type===constants.A.OBJECT_TYPE_ANGLE?(utils_type.A.exists(i.withLabel)||(i.withLabel=!1),utils_type.A.copyAttributes(i,t.options,"angle")):utils_type.A.copyAttributes(i,t.options,"curve"),r=utils_type.A.copyAttributes(r,t.options,"curve"),(s=new jxg.A.Curve(t,["x",[],[]],r)).updateDataArray=function(){var t,e=o.numberPoints;for(this.bezierDegree=o.bezierDegree,this.dataX=[],this.dataY=[],t=0;t<e;t++)this.dataX.push(o.points[t].usrCoords[1]),this.dataY.push(o.points[t].usrCoords[2]);return this},s.addTransform(e[1]),o.addChild(s),s.setParents([o]),s._transformationSource=o,s):(r=utils_type.A.copyAttributes(i,t.options,"curve"),new jxg.A.Curve(t,["x"].concat(e),r))},jxg.A.registerElement("curve",jxg.A.createCurve),jxg.A.createFunctiongraph=function(t,e,i){e=["x","x"].concat(e),i=utils_type.A.copyAttributes(i,t.options,"functiongraph");return(i=utils_type.A.copyAttributes(i,t.options,"curve")).curvetype="functiongraph",new jxg.A.Curve(t,e,i)},jxg.A.registerElement("functiongraph",jxg.A.createFunctiongraph),jxg.A.registerElement("plot",jxg.A.createFunctiongraph),jxg.A.createSpline=function(t,l,e){var i=function(){var o,n=[],a=[];return[function(t,e){var i,s,r;if(!e){if(n=[],a=[],2===l.length&&utils_type.A.isArray(l[0])&&utils_type.A.isArray(l[1])&&l[0].length===l[1].length)for(i=0;i<l[0].length;i++)utils_type.A.isFunction(l[0][i])?n.push(l[0][i]()):n.push(l[0][i]),utils_type.A.isFunction(l[1][i])?a.push(l[1][i]()):a.push(l[1][i]);else for(i=0;i<l.length;i++)if(utils_type.A.isPoint(l[i]))n.push(l[i].X()),a.push(l[i].Y());else if(utils_type.A.isArray(l[i])&&2===l[i].length)for(s=0;s<l.length;s++)utils_type.A.isFunction(l[s][0])?n.push(l[s][0]()):n.push(l[s][0]),utils_type.A.isFunction(l[s][1])?a.push(l[s][1]()):a.push(l[s][1]);else utils_type.A.isFunction(l[i])&&2===l[i]().length&&(r=l[i](),n.push(r[0]),a.push(r[1]));o=numerics.A.splineDef(n,a)}return numerics.A.splineEval(t,n,a,o)},function(){return n[0]},function(){return n[n.length-1]}]};return(e=utils_type.A.copyAttributes(e,t.options,"curve")).curvetype="functiongraph",i=i(),(t=new jxg.A.Curve(t,["x","x",i[0],i[1],i[2]],e)).setParents(l),t.elType="spline",t},jxg.A.registerElement("spline",jxg.A.createSpline),jxg.A.createCardinalSpline=function(t,e,i){var s,r,o,n,a,l,h,u,c="\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"+c);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'"+c);if(!utils_type.A.exists(e[2])||!utils_type.A.isString(e[2]))throw new Error("JSXGraph: JXG.createCardinalSpline: argument 3 'type' has to be string 'uniform' or 'centripetal'"+c);if(i=utils_type.A.copyAttributes(i,t.options,"curve"),(i=utils_type.A.copyAttributes(i,t.options,"cardinalspline")).curvetype="parameter",a=e[0],l=[],!i.isarrayofcoordinates&&2===a.length&&utils_type.A.isArray(a[0])&&utils_type.A.isArray(a[1])&&a[0].length===a[1].length)for(h=0;h<a[0].length;h++)l[h]=[],utils_type.A.isFunction(a[0][h])?l[h].push(a[0][h]()):l[h].push(a[0][h]),utils_type.A.isFunction(a[1][h])?l[h].push(a[1][h]()):l[h].push(a[1][h]);else for(h=0;h<a.length;h++)utils_type.A.isString(a[h])?l.push(t.select(a[h])):utils_type.A.isPoint(a[h])?l.push(a[h]):utils_type.A.isArray(a[h])&&2===a[h].length?(l[h]=[],utils_type.A.isFunction(a[h][0])?l[h].push(a[h][0]()):l[h].push(a[h][0]),utils_type.A.isFunction(a[h][1])?l[h].push(a[h][1]()):l[h].push(a[h][1])):utils_type.A.isFunction(a[h])&&2===a[h]().length&&l.push(e[h]());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(),t=this.Y()-t.Y();return math.A.hypot(e,t)}}},h=0;h<l.length;h++)utils_type.A.isPoint(l[h])?o.push(l[h]):o.push(r(h));for(c=e[1],n=e[2],c=["x"].concat(numerics.A.CardinalSpline(o,c,n)),s=new jxg.A.Curve(t,c,i),u=o.length,s.setParents(o),h=0;h<u;h++)a=o[h],utils_type.A.isPoint(a)&&(utils_type.A.exists(a._is_new)?(s.addChild(a),delete a._is_new):a.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,l,h,u,c="\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"+c);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'"+c);if(i=utils_type.A.copyAttributes(i,t.options,"curve"),(i=utils_type.A.copyAttributes(i,t.options,"metapostspline")).curvetype="parameter",a=e[0],l=[],!i.isarrayofcoordinates&&2===a.length&&utils_type.A.isArray(a[0])&&utils_type.A.isArray(a[1])&&a[0].length===a[1].length)for(h=0;h<a[0].length;h++)l[h]=[],utils_type.A.isFunction(a[0][h])?l[h].push(a[0][h]()):l[h].push(a[0][h]),utils_type.A.isFunction(a[1][h])?l[h].push(a[1][h]()):l[h].push(a[1][h]);else for(h=0;h<a.length;h++)utils_type.A.isString(a[h])?l.push(t.select(a[h])):utils_type.A.isPoint(a[h])?l.push(a[h]):utils_type.A.isArray(a[h])&&2===a[h].length?(l[h]=[],utils_type.A.isFunction(a[h][0])?l[h].push(a[h][0]()):l[h].push(a[h][0]),utils_type.A.isFunction(a[h][1])?l[h].push(a[h][1]()):l[h].push(a[h][1])):utils_type.A.isFunction(a[h])&&2===a[h]().length&&l.push(e[h]());if(!0===i.createpoints)o=utils_type.A.providePoints(t,l,i,"metapostspline",["points"]);else for(o=[],r=function(t){return{X:function(){return l[t][0]},Y:function(){return l[t][1]}}},h=0;h<l.length;h++)utils_type.A.isPoint(l[h])?o.push(l[h]):o.push(r);for(n=e[1],(s=new jxg.A.Curve(t,["t",[],[],0,a.length-1],i)).updateDataArray=function(){for(var t,e=o.length,i=[],s=0;s<e;s++)i.push([o[s].X(),o[s].Y()]);t=metapost.curve(i,n),this.dataX=t[0],this.dataY=t[1]},s.bezierDegree=3,u=o.length,s.setParents(o),h=0;h<u;h++)utils_type.A.isPoint(o[h])&&o[h].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;if((i=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))return e=[[0],[0]].concat(e.slice(3)),(t=t.create("curve",e,i)).sum=0,t.Value=function(){return this.sum},t.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]},t.addParentsFromJCFunctions([s,r]),t;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]")},jxg.A.registerElement("riemannsum",jxg.A.createRiemannsum),jxg.A.createTracecurve=function(t,e,i){var d,p,_;if(2!==e.length)throw new Error("JSXGraph: Can't create trace curve with given parent'\nPossible parent types: [glider, point]");if(d=t.select(e[0]),p=t.select(e[1]),d.type===constants.A.OBJECT_TYPE_GLIDER&&utils_type.A.isPoint(p))return(_=utils_type.A.copyAttributes(i,t.options,"tracecurve")).curvetype="plot",(i=t.create("curve",[[0],[0]],_)).updateDataArray=function(){var t,e,i,s,r,o,n,a=_.numberpoints,l=d.position,h=d.slideObject,u=h.minX(),c=(h.maxX()-u)/a;for(this.dataX=[],this.dataY=[],h.elementClass!==constants.A.OBJECT_CLASS_CURVE&&a++,t=0;t<a;t++){for(e in s=h.X(r=u+t*c)/h.Z(r),r=h.Y(r)/h.Z(r),d.setPositionDirectly(constants.A.COORDS_BY_USER,[s,r]),o=!1,this.board.objects)if(this.board.objects.hasOwnProperty(e)&&((i=this.board.objects[e])===d&&(o=!0),o&&i.needsRegularUpdate&&(n=i.visProp.trace,i.visProp.trace=!1,i.needsUpdate=!0,i.update(!0),i.visProp.trace=n,i===p)))break;this.dataX[t]=p.X(),this.dataY[t]=p.Y()}for(e in d.position=l,o=!1,this.board.objects)if(this.board.objects.hasOwnProperty(e)&&((i=this.board.objects[e])===d&&(o=!0),o&&i.needsRegularUpdate&&(n=i.visProp.trace,i.visProp.trace=!1,i.needsUpdate=!0,i.update(!0),i.visProp.trace=n,i===p)))break},i;throw new Error("JSXGraph: Can't create trace curve with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider, point]")},jxg.A.registerElement("tracecurve",jxg.A.createTracecurve),jxg.A.createStepfunction=function(t,e,i){if(2!==e.length)throw new Error("JSXGraph: Can't create step function with given parent'\nPossible parent types: [array, array|function]");return i=utils_type.A.copyAttributes(i,t.options,"stepfunction"),(t=t.create("curve",e,i)).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],this.dataX[++e]=this.xterm[t],this.dataY[e]=this.yterm[t],++e},t},jxg.A.registerElement("stepfunction",jxg.A.createStepfunction),jxg.A.createDerivative=function(t,e,i){var s,r,o;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 i=utils_type.A.copyAttributes(i,t.options,"curve"),s=e[0],r=numerics.A.D(s.X),o=numerics.A.D(s.Y),(e=t.create("curve",[function(t){return s.X(t)},function(t){return o(t)/r(t)},s.minX(),s.maxX()],i)).setParents(s),e},jxg.A.registerElement("derivative",jxg.A.createDerivative),jxg.A.createCurveIntersection=function(t,e,i){if(2!==e.length)throw new Error("JSXGraph: Can't create curve intersection with given parent'\nPossible parent types: [array, array|function]");return(t=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.intersection(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},t},jxg.A.createCurveUnion=function(t,e,i){if(2!==e.length)throw new Error("JSXGraph: Can't create curve union with given parent'\nPossible parent types: [array, array|function]");return(t=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.union(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},t},jxg.A.createCurveDifference=function(t,e,i){if(2!==e.length)throw new Error("JSXGraph: Can't create curve difference with given parent'\nPossible parent types: [array, array|function]");return(t=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=clip.difference(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},t},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,i=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",[[],[]],i),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=utils_type.A.evaluate(this.visProp.smallwidth),i=utils_type.A.evaluate(this.visProp.dir),s=(t=this.x())-.5*this.w(),r=t-.5*this.w()*e,o=t+.5*this.w(),s=[t,r,e=t+.5*this.w()*e,t,t,s,s,o,o,t,NaN,s,o,NaN,t,t,r,e,t],o=[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"===i?(this.dataX=s,this.dataY=o):(this.dataX=o,this.dataY=s)},s.addParentsFromJCFunctions([s.Q,s.x,s.w]),s},jxg.A.registerElement("boxplot",jxg.A.createBoxPlot),jxg.A.createImplicitCurve=function(t,e,i){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 i=utils_type.A.copyAttributes(i,t.options,"implicitcurve"),(i=t.create("curve",[[],[]],i)).f=utils_type.A.createFunction(e[0],t,"x, y"),i.dfx=utils_type.A.createFunction(e[1],t,"x, y"),i.dfy=utils_type.A.createFunction(e[2],t,"x, y"),i.domain=null,5===e.length?i.domain=[e[3],e[4]]:3===e.length&&(i.domain=[e[1],e[2]]),i.updateDataArray=function(){var t,e,i;null===this.domain?(i=utils_type.A.evaluate(this.visProp.margin),(e=this.board.getBoundingBox())[0]-=i,e[1]+=i,e[2]+=i,e[3]-=i):(i=utils_type.A.evaluate(this.domain[0]),t=utils_type.A.evaluate(this.domain[1]),e=[i[0],t[1],i[1],t[0]]),i={resolution_out:Math.max(.01,utils_type.A.evaluate(this.visProp.resolution_outer)),resolution_in:Math.max(.01,utils_type.A.evaluate(this.visProp.resolution_inner)),max_steps:utils_type.A.evaluate(this.visProp.max_steps),alpha_0:utils_type.A.evaluate(this.visProp.alpha_0),tol_u0:utils_type.A.evaluate(this.visProp.tol_u0),tol_newton:utils_type.A.evaluate(this.visProp.tol_newton),tol_cusp:utils_type.A.evaluate(this.visProp.tol_cusp),tol_progress:utils_type.A.evaluate(this.visProp.tol_progress),qdt_box:utils_type.A.evaluate(this.visProp.qdt_box),kappa_0:utils_type.A.evaluate(this.visProp.kappa_0),delta_0:utils_type.A.evaluate(this.visProp.delta_0),h_initial:utils_type.A.evaluate(this.visProp.h_initial),h_critical:utils_type.A.evaluate(this.visProp.h_critical),h_max:utils_type.A.evaluate(this.visProp.h_max),loop_dist:utils_type.A.evaluate(this.visProp.loop_dist),loop_dir:utils_type.A.evaluate(this.visProp.loop_dir),loop_detection:utils_type.A.evaluate(this.visProp.loop_detection),unitX:this.board.unitX,unitY:this.board.unitY},this.dataX=[],this.dataY=[],t=new implicitplot(e,i,this.f,this.dfx,this.dfy),this.qdt=t.qdt,e=t.plot(),this.dataX=e[0],this.dataY=e[1]},i.elType="implicitcurve",i},jxg.A.registerElement("implicitcurve",jxg.A.createImplicitCurve),jxg.A.Curve),base_text=(jxg.A.createArc=function(t,e,i){var a;if(!1===(a=utils_type.A.providePoints(t,e,i,"arc",["center","radiuspoint","anglepoint"]))||a.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 e=utils_type.A.copyAttributes(i,t.options,"arc"),(i=t.create("curve",[[0],[0]],e)).elType="arc",i.setParents(a),i.type=constants.A.OBJECT_TYPE_ARC,i.center=a[0],i.radiuspoint=a[1],i.point2=i.radiuspoint,i.anglepoint=a[2],i.point3=i.anglepoint,utils_type.A.exists(i.center._is_new)?(i.addChild(i.center),delete i.center._is_new):i.center.addChild(i),utils_type.A.exists(i.radiuspoint._is_new)?(i.addChild(i.radiuspoint),delete i.radiuspoint._is_new):i.radiuspoint.addChild(i),utils_type.A.exists(i.anglepoint._is_new)?(i.addChild(i.anglepoint),delete i.anglepoint._is_new):i.anglepoint.addChild(i),i.useDirection=e.usedirection,i.updateDataArray=function(){var t,e=1,i=this.radiuspoint,s=this.center,r=this.anglepoint,o=utils_type.A.evaluate(this.visProp.selection),n=geometry.A.rad(i,s,r);("minor"===o&&n>Math.PI||"major"===o&&n<Math.PI)&&(e=-1),this.useDirection&&(o=a[1].coords.usrCoords,n=a[3].coords.usrCoords,t=a[2].coords.usrCoords,(o[1]-t[1])*(o[2]-n[2])-(o[2]-t[2])*(o[1]-n[1])<0?(this.radiuspoint=a[1],this.anglepoint=a[2]):(this.radiuspoint=a[2],this.anglepoint=a[1])),i=i.coords.usrCoords,s=s.coords.usrCoords,r=r.coords.usrCoords,t=geometry.A.bezierArc(i,s,r,!1,e),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},i.Radius=function(){return this.radiuspoint.Dist(this.center)},i.getRadius=function(){return jxg.A.deprecated("Arc.getRadius()","Arc.Radius()"),this.Radius()},i.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},i.L=function(){return this.Value("length")},i.hasPoint=function(t,e){var i,s=this.Radius();return utils_type.A.evaluate(this.visProp.hasinnerpoints)?this.hasPointSector(t,e):(i=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(i=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[i])):this.board.options.precision.hasPoint,i/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),0<this.transformations.length&&(this.updateTransformMatrix(),e=math.A.inverse(this.transformMat),e=math.A.matVecMult(e,t.usrCoords),t=new base_coords.A(constants.A.COORDS_BY_USER,e,this.board)),e=this.center.coords.distance(constants.A.COORDS_BY_USER,t),e=(e=Math.abs(e-s)<i)?geometry.A.coordsOnArc(this,t):e)},i.hasPointSector=function(t,e){t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),e=this.Radius();return this.center.coords.distance(constants.A.COORDS_BY_USER,t)<e&&geometry.A.coordsOnArc(this,t)},i.getTextAnchor=function(){return this.center.coords},i.getLabelAnchor=function(){var t=geometry.A.rad(this.radiuspoint,this.center,this.anglepoint),e=10/this.board.unitX,i=10/this.board.unitY,s=this.point2.coords.usrCoords,r=this.center.coords.usrCoords,o=s[1]-r[1],s=s[2]-r[2],n=utils_type.A.evaluate(this.visProp.selection),a=this.label?this.label.visProp:this.visProp.label;return("minor"===n&&t>Math.PI||"major"===n&&t<Math.PI)&&(t=-(2*Math.PI-t)),o=(n=new base_coords.A(constants.A.COORDS_BY_USER,[r[1]+Math.cos(.5*t)*o-Math.sin(.5*t)*s,r[2]+Math.sin(.5*t)*o+Math.cos(.5*t)*s],this.board)).usrCoords[1]-r[1],t=n.usrCoords[2]-r[2],o=o*((s=math.A.hypot(o,t))+e)/s,n=[r[1]+o,r[2]+t*(s+i)/s],a.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],n)),new base_coords.A(constants.A.COORDS_BY_USER,n,this.board)},i.updateQuadraticform=circle.prototype.updateQuadraticform,i.updateStdform=circle.prototype.updateStdform,i.methodMap=jxg.A.deepCopy(i.methodMap,{getRadius:"getRadius",radius:"Radius",Radius:"Radius",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint",Value:"Value",L:"L"}),i.prepareUpdate().update(),i},jxg.A.registerElement("arc",jxg.A.createArc),jxg.A.createSemicircle=function(t,e,i){var s,r;if(!1===(r=utils_type.A.providePoints(t,e,i,"point"))||2!==r.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 e=utils_type.A.copyAttributes(i,t.options,"semicircle","center"),(s=t.create("midpoint",r,e)).dump=!1,e=utils_type.A.copyAttributes(i,t.options,"semicircle"),(i=t.create("arc",[s,r[1],r[0]],e)).elType="semicircle",i.setParents([r[0].id,r[1].id]),i.subs={midpoint:s},i.inherits.push(s),i.midpoint=i.center=s,i},jxg.A.registerElement("semicircle",jxg.A.createSemicircle),jxg.A.createCircumcircleArc=function(t,e,i){var s,r;if(!1===(r=utils_type.A.providePoints(t,e,i,"point"))||3!==r.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 e=utils_type.A.copyAttributes(i,t.options,"circumcirclearc","center"),(s=t.create("circumcenter",r,e)).dump=!1,(e=utils_type.A.copyAttributes(i,t.options,"circumcirclearc")).usedirection=!0,(i=t.create("arc",[s,r[0],r[2],r[1]],e)).elType="circumcirclearc",i.setParents([r[0].id,r[1].id,r[2].id]),i.subs={center:s},i.inherits.push(s),i.center=s,i},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 r,s,o,n,a,l,h="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])))h="2lines";else{if(!1===(l=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]+"'.");h="3points"}if(s=utils_type.A.copyAttributes(i,t.options,"sector"),(r=t.create("curve",[[0],[0]],s)).type=constants.A.OBJECT_TYPE_SECTOR,r.elType="sector",r.autoRadius=function(){var t=20/r.board.unitX,e=1/0,i=50/r.board.unitX;return utils_type.A.isPoint(r.center)&&(e=.3333*r.center.Dist(r.point2)),Math.max(t,Math.min(e,i))},"2lines"===h)r.Radius=function(){var t=utils_type.A.evaluate(e[4]);return"auto"===t?this.autoRadius():t},r.line1=t.select(e[0]),r.line2=t.select(e[1]),r.line1.addChild(r),r.line2.addChild(r),r.setParents(e),r.point1={visProp:{}},r.point2={visProp:{}},r.point3={visProp:{}},n=geometry.A.meetLineLine(r.line1.stdform,r.line2.stdform,0,t),utils_type.A.isArray(e[2])?(2===e[2].length&&(e[2]=[1].concat(e[2])),a=geometry.A.projectPointToLine({coords:{usrCoords:e[2]}},r.line1,t),a=statistics.A.subtract(a.usrCoords,n.usrCoords),r.direction1=0<=math.A.innerProduct(a,[0,r.line1.stdform[2],-r.line1.stdform[1]],3)?1:-1):r.direction1=0<=e[2]?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]}},r.line2,t),a=statistics.A.subtract(a.usrCoords,n.usrCoords),r.direction2=0<=math.A.innerProduct(a,[0,r.line2.stdform[2],-r.line2.stdform[1]],3)?1:-1):r.direction2=0<=e[3]?1:-1,r.methodMap=jxg.A.deepCopy(r.methodMap,{arc:"arc",center:"center",line1:"line1",line2:"line2"}),r.updateDataArray=function(){var t,e=[0,0,0],i=this.line1,s=this.line2,e=math.A.crossProduct(i.stdform,s.stdform);if(Math.abs(e[0])>math.A.eps*math.A.eps&&(e[1]/=e[0],e[2]/=e[0],e[0]/=e[0]),t=this.direction1*this.Radius(),i=statistics.A.add(e,[0,t*i.stdform[2],-t*i.stdform[1]]),t=this.direction2*this.Radius(),t=statistics.A.add(e,[0,t*s.stdform[2],-t*s.stdform[1]]),this.point2.coords=new base_coords.A(constants.A.COORDS_BY_USER,i,r.board),this.point1.coords=new base_coords.A(constants.A.COORDS_BY_USER,e,r.board),this.point3.coords=new base_coords.A(constants.A.COORDS_BY_USER,t,r.board),Math.abs(i[0])<math.A.eps||Math.abs(e[0])<math.A.eps||Math.abs(t[0])<math.A.eps)return this.dataX=[NaN],void(this.dataY=[NaN]);s=geometry.A.bezierArc(i,e,t,!0,1),this.dataX=s[0],this.dataY=s[1],this.bezierDegree=3};else if("3points"===h){for(r.point1=l[0],r.point2=l[1],r.point3=l[2],o=0;o<3;o++)utils_type.A.exists(l[o]._is_new)?(r.addChild(l[o]),delete l[o]._is_new):l[o].addChild(r);r.useDirection=i.usedirection,r.setParents(l),utils_type.A.exists(l[3])&&(r.point4=l[3],r.point4.addChild(r)),r.methodMap=jxg.A.deepCopy(r.methodMap,{arc:"arc",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint"}),r.updateDataArray=function(){var t,e,i=this.point2,s=this.point1,r=this.point3,o=1,n=utils_type.A.evaluate(this.visProp.selection);if(!i.isReal||!s.isReal||!r.isReal)return this.dataX=[NaN],void(this.dataY=[NaN]);e=geometry.A.rad(i,s,r),("minor"===n&&e>Math.PI||"major"===n&&e<Math.PI)&&(o=-1),this.useDirection&&utils_type.A.exists(this.point4)&&(n=this.point2.coords.usrCoords,e=this.point4.coords.usrCoords,t=this.point3.coords.usrCoords,0<=(n[1]-t[1])*(n[2]-e[2])-(n[2]-t[2])*(n[1]-e[1])&&(r=this.point2,i=this.point3)),i=i.coords.usrCoords,s=s.coords.usrCoords,r=r.coords.usrCoords,t=geometry.A.bezierArc(i,s,r,!0,o),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},r.Radius=function(){return this.point2.Dist(this.point1)}}return r.center=r.point1,r.radiuspoint=r.point2,r.anglepoint=r.point3,s=utils_type.A.copyAttributes(i,t.options,"arc"),(s=utils_type.A.copyAttributes(s,t.options,"sector","arc")).withLabel=!1,s.selection=r.visProp.selection,s.name+="_arc","2lines"===h?(r.updateDataArray(),r.arc=t.create("arc",[function(){return r.point1.coords.usrCoords},function(){var t=r.point2.coords.distance(constants.A.COORDS_BY_USER,r.point1.coords);return 0===t?[r.point1.coords.usrCoords[1],r.point1.coords.usrCoords[2]]:[r.point1.coords.usrCoords[1]+r.Radius()*(r.point2.coords.usrCoords[1]-r.point1.coords.usrCoords[1])/t,r.point1.coords.usrCoords[2]+r.Radius()*(r.point2.coords.usrCoords[2]-r.point1.coords.usrCoords[2])/t]},function(){return r.point3.coords.usrCoords}],s)):r.arc=t.create("arc",[r.point1,function(){var t=r.point2.Dist(r.point1);return 0===t?[r.point1.X(),r.point1.Y()]:[r.point1.X()+r.Radius()*(r.point2.X()-r.point1.X())/t,r.point1.Y()+r.Radius()*(r.point2.Y()-r.point1.Y())/t]},r.point3],s),r.addChild(r.arc),r.hasPointCurve=function(t,e){var t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),e=this.Radius(),i=this.center.coords.distance(constants.A.COORDS_BY_USER,t),s=utils_type.A.evaluate(this.visProp.selection),r=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint;return r/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(i=Math.abs(i-e)<r)&&(e=geometry.A.rad(this.point2,this.center,t.usrCoords.slice(1)),r=0,t=geometry.A.rad(this.point2,this.center,this.point3),("minor"===s&&t>Math.PI||"major"===s&&t<Math.PI)&&(r=t,t=2*Math.PI),(e<r||t<e)&&(i=!1)),i},r.hasPointSector=function(t,e){var i,s,t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board),e=this.Radius(),e=this.point1.coords.distance(constants.A.COORDS_BY_USER,t)<e,r=utils_type.A.evaluate(this.visProp.selection);return e&&(t=geometry.A.rad(this.radiuspoint,this.center,t.usrCoords.slice(1)),i=0,s=geometry.A.rad(this.radiuspoint,this.center,this.anglepoint),("minor"===r&&s>Math.PI||"major"===r&&s<Math.PI)&&(i=s,s=2*Math.PI),(t<i||s<t)&&(e=!1)),e},r.hasPoint=function(t,e){return utils_type.A.evaluate(this.visProp.highlightonsector)||utils_type.A.evaluate(this.visProp.hasinnerpoints)?this.hasPointSector(t,e):this.hasPointCurve(t,e)},r.getTextAnchor=function(){return this.point1.coords},r.getLabelAnchor=function(){var t=geometry.A.rad(this.point2,this.point1,this.point3),e=13/this.board.unitX,i=13/this.board.unitY,s=this.point2.coords.usrCoords,r=this.point1.coords.usrCoords,o=s[1]-r[1],s=s[2]-r[2],n=utils_type.A.evaluate(this.visProp.selection),a=this.label?this.label.visProp:this.visProp.label;return("minor"===n&&t>Math.PI||"major"===n&&t<Math.PI)&&(t=-(2*Math.PI-t)),o=(n=new base_coords.A(constants.A.COORDS_BY_USER,[r[1]+Math.cos(.5*t)*o-Math.sin(.5*t)*s,r[2]+Math.sin(.5*t)*o+Math.cos(.5*t)*s],this.board)).usrCoords[1]-r[1],t=n.usrCoords[2]-r[2],o=o*((s=math.A.hypot(o,t))+e)/s,n=[r[1]+o,r[2]+t*(s+i)/s],a.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],n)),new base_coords.A(constants.A.COORDS_BY_USER,n,this.board)},r.setRadius=function(e){var t=utils_type.A.evaluate(e);"undefined"!=("auto"===e||"auto"===t?"auto":utils_type.A.isNumber(e)?"number":utils_type.A.isFunction(e)&&!utils_type.A.isString(t)?"function":"undefined")&&(this.visProp.radius=e),r.Radius=function(){var t=utils_type.A.evaluate(e);return"auto"===t?this.autoRadius():t}},r.getRadius=function(){return jxg.A.deprecated("Sector.getRadius()","Sector.Radius()"),this.Radius()},r.Value=function(t){return this.arc.Value(t)},r.L=function(){return this.arc.L()},r.Area=function(){var t=this.Radius();return.5*t*t*this.Value("radians")},r.Perimeter=function(){return this.L()+2*this.Radius()},"3points"===h&&(r.setPositionDirectly=function(t,e,i){e=new base_coords.A(t,e,this.board),t=new base_coords.A(t,i,this.board);return r.point1.draggable()&&r.point2.draggable()&&r.point3.draggable()&&(i=statistics.A.subtract(e.usrCoords,t.usrCoords),this.board.create("transform",i.slice(1),{type:"translate"}).applyOnce([r.point1,r.point2,r.point3])),this}),r.methodMap=jxg.A.deepCopy(r.methodMap,{radius:"Radius",Radius:"Radius",getRadius:"Radius",setRadius:"setRadius",Value:"Value",L:"L",Area:"Area",Perimeter:"Perimeter"}),r},jxg.A.registerElement("sector",jxg.A.createSector),jxg.A.createCircumcircleSector=function(t,e,i){var s;if(!1===(s=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(e=t.create("circumcenter",s.slice(0,3),void 0)).dump=!1,i=utils_type.A.copyAttributes(i,t.options,"circumcirclesector"),(t=t.create("sector",[e,s[0],s[2],s[1]],i)).elType="circumcirclesector",t.setParents(s),t.center=e,t.subs={center:e},t},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 l,s,r,o,n,a="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])))a="2lines";else{if(!(r={name:""})===(n=utils_type.A.providePoints(t,e,r,"point")))throw new Error("JSXGraph: Can't create angle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");a="3points"}if(r=utils_type.A.copyAttributes(i,t.options,"angle"),utils_type.A.exists(r.name)||(r.name=t.generateName({type:constants.A.OBJECT_TYPE_ANGLE})),s=utils_type.A.exists(r.radius)?r.radius:0,t.suspendUpdate(),"2lines"===a?(e.push(s),(l=t.create("sector",e,r)).updateDataArraySector=l.updateDataArray,l.setAngle=function(t){},l.free=function(t){}):((l=t.create("sector",[n[1],n[0],n[2]],r)).arc.visProp.priv=!0,l.point=l.point2=l.radiuspoint=n[0],l.pointsquare=l.point3=l.anglepoint=n[2],l.Radius=function(){var t=utils_type.A.evaluate(s);return"auto"===t?l.autoRadius():t},l.updateDataArraySector=function(){var t=this.point2,e=this.point1,i=this.point3,s=this.Radius(),r=e.Dist(t),o=1,n=utils_type.A.evaluate(this.visProp.selection),a=geometry.A.rad(t,e,i);("minor"===n&&a>Math.PI||"major"===n&&a<Math.PI)&&(o=-1),t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,t=[1,e[1]+(t[1]-e[1])*s/r,e[2]+(t[2]-e[2])*s/r],i=[1,e[1]+(i[1]-e[1])*s/r,e[2]+(i[2]-e[2])*s/r],n=geometry.A.bezierArc(t,e,i,!0,o),this.dataX=n[0],this.dataY=n[1],this.bezierDegree=3},l.setAngle=function(t){var e,i,s=this.anglepoint,r=this.radiuspoint;return s.draggable()&&(i=this.board.create("transform",[t,this.center],{type:"rotate"}),s.addTransform(r,i),i.update(),s.moveTo(math.A.matVecMult(i.matrix,r.coords.usrCoords)),i=utils_type.A.isFunction(t)?function(){return 2*Math.PI-t()}:function(){return 2*Math.PI-t},e=this.board.create("transform",[i,this.center],{type:"rotate"}),s.coords.on("update",function(){e.update(),r.moveTo(math.A.matVecMult(e.matrix,s.coords.usrCoords))}),s.setParents(r),this.hasFixedAngle=!0),this},l.free=function(){var t=this.anglepoint;return 0<t.transformations.length&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[],t.coords.off("update")),this.hasFixedAngle=!1,this},l.setParents(n)),utils_type.A.exists(l.visProp.text)&&l.label.setText(utils_type.A.evaluate(l.visProp.text)),l.elType="angle",l.type=constants.A.OBJECT_TYPE_ANGLE,l.subs={},l.updateDataArraySquare=function(){var t,e,i,s,r,o=this.Radius();"2lines"===a&&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])*o/s,e[2]+(t[2]-e[2])*o/s],i=[1,e[1]+(i[1]-e[1])*o/r,e[2]+(i[2]-e[2])*o/r],s=math.A.crossProduct(i,e),o=[-t[1]*s[1]-t[2]*s[2],t[0]*s[1],t[0]*s[2]],s=math.A.crossProduct(t,e),r=[-i[1]*s[1]-i[2]*s[2],i[0]*s[1],i[0]*s[2]],(s=math.A.crossProduct(o,r))[1]/=s[0],s[2]/=s[0],this.dataX=[e[1],t[1],s[1],i[1],e[1]],this.dataY=[e[2],t[2],s[2],i[2],e[2]],this.bezierDegree=1},l.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},l.updateDataArray=function(){var t=utils_type.A.evaluate(this.visProp.type),e=geometry.A.trueAngle(this.point2,this.point1,this.point3),i=utils_type.A.evaluate(this.visProp.selection);("minor"===i&&180<e||"major"===i&&e<180)&&(e=360-e),"none"===(t=Math.abs(e-90)<utils_type.A.evaluate(this.visProp.orthosensitivity)+math.A.eps?utils_type.A.evaluate(this.visProp.orthotype):t)?this.updateDataArrayNone():"square"===t?this.updateDataArraySquare():"sector"===t?this.updateDataArraySector():"sectordot"===t&&(this.updateDataArraySector(),this.dot.visProp.visible||this.dot.setAttribute({visible:!0})),(!this.visProp.visible||"sectordot"!==t&&this.dot.visProp.visible)&&this.dot.setAttribute({visible:!1})},r=utils_type.A.copyAttributes(i,t.options,"angle","dot"),l.dot=t.create("point",[function(){var t,e,i,s,r,o;return utils_type.A.exists(l.dot)&&!l.dot.visProp.visible?[0,0]:(t=l.point2.coords.usrCoords,e=l.point1.coords.usrCoords,r=l.Radius(),i=geometry.A.distance(t,e,3),s=geometry.A.rad(l.point2,l.point1,l.point3),("minor"===(o=utils_type.A.evaluate(l.visProp.selection))&&s>Math.PI||"major"===o&&s<Math.PI)&&(s=-(2*Math.PI-s)),s*=.5,o=Math.cos(s),s=Math.sin(s),t=[1,e[1]+(t[1]-e[1])*r/i,e[2]+(t[2]-e[2])*r/i],r=[[1,0,0],[e[1]-.5*e[1]*o+.5*e[2]*s,.5*o,.5*-s],[e[2]-.5*e[1]*s-.5*e[2]*o,.5*s,.5*o]],math.A.matVecMult(r,t))}],r),l.dot.dump=!1,l.subs.dot=l.dot,"2lines"===a)for(o=0;o<2;o++)t.select(e[o]).addChild(l.dot);else for(o=0;o<3;o++)t.select(n[o]).addChild(l.dot);return t.unsuspendUpdate(),l.Value=function(t){return""===(t=t||"radians")&&(t="radians"),l.arc.Value(t)},l.getLabelAnchor=function(){var t,e,i,s,r,o=12,n=utils_type.A.evaluate(l.visProp.selection),a=this.label?this.label.visProp:this.visProp.label;return utils_type.A.exists(this.label)&&utils_type.A.exists(this.label.visProp.fontsize)&&(o=utils_type.A.evaluate(this.label.visProp.fontsize)),o/=this.board.unitX,t=l.point2.coords.usrCoords,e=l.point1.coords.usrCoords,i=l.Radius(),s=geometry.A.distance(t,e,3),r=geometry.A.rad(l.point2,l.point1,l.point3),("minor"===n&&r>Math.PI||"major"===n&&r<Math.PI)&&(r=-(2*Math.PI-r)),r*=.5,n=Math.cos(r),r=Math.sin(r),t=[1,e[1]+(t[1]-e[1])*i/s,e[2]+(t[2]-e[2])*i/s],r=[[1,0,0],[e[1]-.5*e[1]*n+.5*e[2]*r,.5*n,.5*-r],[e[2]-.5*e[1]*r-.5*e[2]*n,.5*r,.5*n]],(n=math.A.matVecMult(r,t))[1]/=n[0],n[2]/=n[0],n[0]/=n[0],s=geometry.A.distance(n,e,3),n=[n[0],e[1]+(n[1]-e[1])*(i+o)/s,e[2]+(n[2]-e[2])*(i+o)/s],a.position=geometry.A.calcLabelQuadrant(geometry.A.rad([1,0],[0,0],n)),new base_coords.A(constants.A.COORDS_BY_USER,n,this.board)},l.methodMap=utils_type.A.deepCopy(l.methodMap,{setAngle:"setAngle",Value:"Value",free:"free"}),l},jxg.A.registerElement("angle",jxg.A.createAngle),jxg.A.createNonreflexAngle=function(t,e,i){return i.selection="minor",i=utils_type.A.copyAttributes(i,t.options,"nonreflexangle"),(t=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)},t},jxg.A.registerElement("nonreflexangle",jxg.A.createNonreflexAngle),jxg.A.createReflexAngle=function(t,e,i){return i.selection="major",i=utils_type.A.copyAttributes(i,t.options,"reflexangle"),(t=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)},t},jxg.A.registerElement("reflexangle",jxg.A.createReflexAngle),jxg.A.createOrthogonalProjection=function(t,e,i){var l,h,u;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)h=utils_type.A.providePoints(t,[e[0]],i,"point")[0],l=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]");h=utils_type.A.providePoints(t,[e[1]],i,"point")[0],l=e[0]}return e=utils_type.A.copyAttributes(i,t.options,"orthogonalprojection"),u=t.create("point",[function(){return geometry.A.projectPointToLine(h,l,t)}],e),utils_type.A.exists(h._is_new)?(u.addChild(h),delete h._is_new):h.addChild(u),l.addChild(u),u.elType="orthogonalprojection",u.setParents([h.id,u.id]),u.update(),u.generatePolynomial=function(){var t=l.point1.symbolic.x,e=l.point1.symbolic.y,i=l.point2.symbolic.x,s=l.point2.symbolic.y,r=h.symbolic.x,o=h.symbolic.y,n=u.symbolic.x,a=u.symbolic.y;return["("+e+")*("+n+")-("+e+")*("+i+")+("+a+")*("+i+")-("+t+")*("+a+")+("+t+")*("+s+")-("+n+")*("+s+")","("+o+")*("+e+")-("+o+")*("+s+")-("+a+")*("+e+")+("+a+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+n+")*("+t+")+("+n+")*("+i+")"]},u},jxg.A.createPerpendicular=function(t,e,i){var s,r;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 e=utils_type.A.copyAttributes(i,t.options,"perpendicular"),(i=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()}],e)).elType="perpendicular",i.setParents([r.id,s.id]),utils_type.A.exists(s._is_new)?(i.addChild(s),delete s._is_new):s.addChild(i),r.addChild(i),i},jxg.A.createPerpendicularPoint=function(t,e,i){var l,h,u;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)h=utils_type.A.providePoints(t,[e[0]],i,"point")[0],l=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]");h=utils_type.A.providePoints(t,[e[1]],i,"point")[0],l=e[0]}return u=t.create("point",[function(){return geometry.A.perpendicular(l,h,t)[0]}],i),utils_type.A.exists(h._is_new)?(u.addChild(h),delete h._is_new):h.addChild(u),l.addChild(u),u.elType="perpendicularpoint",u.setParents([h.id,l.id]),u.update(),u.generatePolynomial=function(){var t=l.point1.symbolic.x,e=l.point1.symbolic.y,i=l.point2.symbolic.x,s=l.point2.symbolic.y,r=h.symbolic.x,o=h.symbolic.y,n=u.symbolic.x,a=u.symbolic.y;return["("+e+")*("+n+")-("+e+")*("+i+")+("+a+")*("+i+")-("+t+")*("+a+")+("+t+")*("+s+")-("+n+")*("+s+")","("+o+")*("+e+")-("+o+")*("+s+")-("+a+")*("+e+")+("+a+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+n+")*("+t+")+("+n+")*("+i+")"]},u},jxg.A.createPerpendicularSegment=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=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 e=utils_type.A.copyAttributes(i,t.options,"perpendicularsegment","point"),(o=jxg.A.createPerpendicularPoint(t,[r,s],e)).dump=!1,utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),e=utils_type.A.copyAttributes(i,t.options,"perpendicularsegment"),(i=jxg.A.createLine(t,[function(){return geometry.A.perpendicular(r,s,t)[1]?[o,s]:[s,o]}],e)).point=o,utils_type.A.exists(s._is_new)?(i.addChild(s),delete s._is_new):s.addChild(i),r.addChild(i),i.elType="perpendicularsegment",i.setParents([s.id,r.id]),i.subs={point:o},i.inherits.push(o),i},jxg.A.createMidpoint=function(t,e,i){for(var n,a,l,s=0;s<e.length;++s)e[s]=t.select(e[s]);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"),n=e[0],a=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]");n=e[0].point1,a=e[0].point2}return i=utils_type.A.copyAttributes(i,t.options,"midpoint"),l=t.create("point",[function(){var t=n.coords.usrCoords[1]+a.coords.usrCoords[1];return isNaN(t)||Math.abs(n.coords.usrCoords[0])<math.A.eps||Math.abs(a.coords.usrCoords[0])<math.A.eps?NaN:.5*t},function(){var t=n.coords.usrCoords[2]+a.coords.usrCoords[2];return isNaN(t)||Math.abs(n.coords.usrCoords[0])<math.A.eps||Math.abs(a.coords.usrCoords[0])<math.A.eps?NaN:.5*t}],i),utils_type.A.exists(n._is_new)?(l.addChild(n),delete n._is_new):n.addChild(l),utils_type.A.exists(a._is_new)?(l.addChild(a),delete a._is_new):a.addChild(l),l.elType="midpoint",l.setParents([n.id,a.id]),l.prepareUpdate().update(),l.generatePolynomial=function(){var t=n.symbolic.x,e=n.symbolic.y,i=a.symbolic.x,s=a.symbolic.y,r=l.symbolic.x,o=l.symbolic.y;return["("+e+")*("+r+")-("+e+")*("+i+")+("+o+")*("+i+")-("+t+")*("+o+")+("+t+")*("+s+")-("+r+")*("+s+")","("+t+")^2 - 2*("+t+")*("+r+")+("+e+")^2-2*("+e+")*("+o+")-("+i+")^2+2*("+i+")*("+r+")-("+s+")^2+2*("+s+")*("+o+")"]},l},jxg.A.createParallelPoint=function(t,e,i){for(var l,h,u,c,s=0;s<e.length;++s)e[s]=t.select(e[s]);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"),l=e[0],h=e[1],u=e[2];else if(utils_type.A.isPointType(t,e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_LINE)u=utils_type.A.providePoints(t,[e[0]],i,"point")[0],l=e[1].point1,h=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]");u=utils_type.A.providePoints(t,[e[1]],i,"point")[0],l=e[0].point1,h=e[0].point2}return i=utils_type.A.copyAttributes(i,t.options,"parallelpoint"),c=t.create("point",[function(){return u.coords.usrCoords[1]+h.coords.usrCoords[1]-l.coords.usrCoords[1]},function(){return u.coords.usrCoords[2]+h.coords.usrCoords[2]-l.coords.usrCoords[2]}],i),utils_type.A.exists(l._is_new)?(c.addChild(l),delete l._is_new):l.addChild(c),utils_type.A.exists(h._is_new)?(c.addChild(h),delete h._is_new):h.addChild(c),utils_type.A.exists(u._is_new)?(c.addChild(u),delete u._is_new):u.addChild(c),c.elType="parallelpoint",c.setParents([l.id,h.id,u.id]),c.prepareUpdate().update(),c.generatePolynomial=function(){var t=l.symbolic.x,e=l.symbolic.y,i=h.symbolic.x,s=h.symbolic.y,r=u.symbolic.x,o=u.symbolic.y,n=c.symbolic.x,a=c.symbolic.y;return["("+s+")*("+n+")-("+s+")*("+r+")-("+e+")*("+n+")+("+e+")*("+r+")-("+a+")*("+i+")+("+a+")*("+t+")+("+o+")*("+i+")-("+o+")*("+t+")","("+a+")*("+t+")-("+a+")*("+r+")-("+s+")*("+t+")+("+s+")*("+r+")-("+n+")*("+e+")+("+n+")*("+o+")+("+i+")*("+e+")-("+i+")*("+o+")"]},c},jxg.A.createParallel=function(t,e,i){for(var s,r,o,n=1,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],n=0):utils_type.A.isPointType(t,e[0])?(s=utils_type.A.providePoints(t,[e[0]],i,"point")[0],r=function(){return e[1].stdform}):utils_type.A.isPointType(t,e[1])&&(s=utils_type.A.providePoints(t,[e[1]],i,"point")[0],r=function(){return e[0].stdform}),utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),o=utils_type.A.copyAttributes(i,t.options,"parallel","point"),(n=1===n?t.create("point",[function(){return math.A.crossProduct([1,0,0],r())}],o):t.create("parallelpoint",e,o)).isDraggable=!0,o=utils_type.A.copyAttributes(i,t.options,"parallel"),(i=t.create("line",[s,n],o)).elType="parallel",i.subs={point:n},i.inherits.push(n),i.setParents([e[0].id,e[1].id]),3===e.length&&i.addParents(e[2].id),i.point=n,i},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;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=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)}],o)).dump=!1,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 utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),o=utils_type.A.copyAttributes(i,t.options,"bisector"),(i=jxg.A.createLine(t,[e[1],s],o)).point=s,i.elType="bisector",i.setParents(e),i.subs={point:s},i.inherits.push(s),i}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=t.select(e[0]),o=t.select(e[1]);if(r.elementClass!==constants.A.OBJECT_CLASS_LINE||o.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),e=utils_type.A.copyAttributes(i,t.options,"bisectorlines","line1"),s=t.create("line",[function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[0]/t-o.stdform[0]/e},function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[1]/t-o.stdform[1]/e},function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[2]/t-o.stdform[2]/e}],e),utils_type.A.exists(i.layer)||(i.layer=t.options.layer.line),e=utils_type.A.copyAttributes(i,t.options,"bisectorlines","line2"),i=t.create("line",[function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[0]/t+o.stdform[0]/e},function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[1]/t+o.stdform[1]/e},function(){var t=math.A.hypot(r.stdform[1],r.stdform[2]),e=math.A.hypot(o.stdform[1],o.stdform[2]);return r.stdform[2]/t+o.stdform[2]/e}],e),t=new composition({line1:s,line2:i}),s.dump=!1,i.dump=!1,t.elType="bisectorlines",t.setParents([r.id,o.id]),t.subs={line1:s,line2:i},t},jxg.A.createCircumcenter=function(t,e,i){var l,s,h,u,c;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(h=e[0],u=e[1],c=e[2],l=jxg.A.createPoint(t,[function(){return geometry.A.circumcenter(h,u,c,t)}],i),s=0;s<3;s++)utils_type.A.exists(e[s]._is_new)?(l.addChild(e[s]),delete e[s]._is_new):e[s].addChild(l);return l.elType="circumcenter",l.setParents(e),l.generatePolynomial=function(){var t=h.symbolic.x,e=h.symbolic.y,i=u.symbolic.x,s=u.symbolic.y,r=c.symbolic.x,o=c.symbolic.y,n=l.symbolic.x,a=l.symbolic.y;return[["((",n,")-(",t,"))^2+((",a,")-(",e,"))^2-((",n,")-(",i,"))^2-((",a,")-(",s,"))^2"].join(""),["((",n,")-(",t,"))^2+((",a,")-(",e,"))^2-((",n,")-(",r,"))^2-((",a,")-(",o,"))^2"].join("")]},l}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(s,t,e){var i,r,o,n,a;if(!(3<=(t=utils_type.A.providePoints(s,t,e,"point")).length&&utils_type.A.isPoint(t[0])&&utils_type.A.isPoint(t[1])&&utils_type.A.isPoint(t[2])))throw new Error("JSXGraph: Can't create incenter with parent types '"+typeof t[0]+"', '"+typeof t[1]+"' and '"+typeof t[2]+"'.\nPossible parent types: [point,point,point]");for(r=t[0],o=t[1],n=t[2],i=s.create("point",[function(){var t=math.A.hypot(o.X()-n.X(),o.Y()-n.Y()),e=math.A.hypot(r.X()-n.X(),r.Y()-n.Y()),i=math.A.hypot(o.X()-r.X(),o.Y()-r.Y());return new base_coords.A(constants.A.COORDS_BY_USER,[(t*r.X()+e*o.X()+i*n.X())/(t+e+i),(t*r.Y()+e*o.Y()+i*n.Y())/(t+e+i)],s)}],e),a=0;a<3;a++)utils_type.A.exists(t[a]._is_new)?(i.addChild(t[a]),delete t[a]._is_new):t[a].addChild(i);return i.elType="incenter",i.setParents(t),i},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,r,e){var i,s,o,n;if(!1===(r=utils_type.A.providePoints(t,r,e,"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof r[0]+"', '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point]");try{for(n=utils_type.A.copyAttributes(e,t.options,"incircle","center"),(s=jxg.A.createIncenter(t,r,n)).dump=!1,utils_type.A.exists(e.layer)||(e.layer=t.options.layer.circle),n=utils_type.A.copyAttributes(e,t.options,"incircle"),(o=jxg.A.createCircle(t,[s,function(){var t=math.A.hypot(r[1].X()-r[2].X(),r[1].Y()-r[2].Y()),e=math.A.hypot(r[0].X()-r[2].X(),r[0].Y()-r[2].Y()),i=math.A.hypot(r[1].X()-r[0].X(),r[1].Y()-r[0].Y()),s=(t+e+i)/2;return Math.sqrt((s-t)*(s-e)*(s-i)/s)}],n)).elType="incircle",o.setParents(r),i=0;i<3;i++)utils_type.A.exists(r[i]._is_new)?(o.addChild(r[i]),delete r[i]._is_new):r[i].addChild(o);o.center=s,o.subs={center:o.center},o.inherits.push(s)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof r[0]+"', '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point]")}return o},jxg.A.createReflection=function(t,e,i){for(var l,h,u,s,r,o,n="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]",a=0;a<e.length;++a)e[a]=t.select(e[a]);if(r=utils_type.A.copyAttributes(i,t.options,"reflection"),utils_type.A.isPoint(e[0]))h=utils_type.A.providePoints(t,[e[0]],o)[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]+"'."+n);h=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]+"'."+n);if(l=e[1],s=jxg.A.createTransform(t,[l],{type:"reflect"}),utils_type.A.isPoint(h))u=jxg.A.createPoint(t,[h,s],r);else if(h.elementClass===constants.A.OBJECT_CLASS_CURVE)u=jxg.A.createCurve(t,[h,s],r);else if(h.elementClass===constants.A.OBJECT_CLASS_LINE)u=jxg.A.createLine(t,[h,s],r);else if(h.type===constants.A.OBJECT_TYPE_POLYGON)u=jxg.A.createPolygon(t,[h,s],r);else{if(h.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]+"'."+n);u="euclidean"===r.type.toLowerCase()?(o=utils_type.A.copyAttributes(i,t.options,"reflection","center"),(n=jxg.A.createPoint(t,[h.center,s],o)).prepareUpdate().update().updateVisibility(utils_type.A.evaluate(n.visProp.visible)).updateRenderer(),jxg.A.createCircle(t,[n,function(){return h.Radius()}],r)):jxg.A.createCircle(t,[h,s],r)}return utils_type.A.exists(h._is_new)&&(u.addChild(h),delete h._is_new),l.addChild(u),u.elType="reflection",u.addParents(l),u.prepareUpdate().update(),utils_type.A.isPoint(u)&&(u.generatePolynomial=function(){var t=l.point1.symbolic.x,e=l.point1.symbolic.y,i=l.point2.symbolic.x,s=l.point2.symbolic.y,r=h.symbolic.x,o=h.symbolic.y,n=u.symbolic.x,a=u.symbolic.y;return[["((",a,")-(",o,"))*((",e,")-(",s,"))+((",t,")-(",i,"))*((",n,")-(",r,"))"].join(""),["((",n,")-(",t,"))^2+((",a,")-(",e,"))^2-((",r,")-(",t,"))^2-((",o,")-(",e,"))^2"].join("")]}),u},jxg.A.createMirrorElement=function(t,e,i){for(var s,r,o,n,a,l,h="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, point]",u=0;u<e.length;++u)e[u]=t.select(e[u]);if(a=utils_type.A.copyAttributes(i,t.options,"mirrorelement"),utils_type.A.isPoint(e[0]))s=utils_type.A.providePoints(t,[e[0]],a)[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]+"'."+h);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]+"'."+h);if(l=utils_type.A.copyAttributes(i,t.options,"mirrorelement","point"),r=utils_type.A.providePoints(t,[e[1]],l)[0],n=jxg.A.createTransform(t,[Math.PI,r],{type:"rotate"}),utils_type.A.isPoint(s))o=jxg.A.createPoint(t,[s,n],a);else if(s.elementClass===constants.A.OBJECT_CLASS_CURVE)o=jxg.A.createCurve(t,[s,n],a);else if(s.elementClass===constants.A.OBJECT_CLASS_LINE)o=jxg.A.createLine(t,[s,n],a);else if(s.type===constants.A.OBJECT_TYPE_POLYGON)o=jxg.A.createPolygon(t,[s,n],a);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]+"'."+h);o="euclidean"===a.type.toLowerCase()?(l=utils_type.A.copyAttributes(i,t.options,"mirrorelement","center"),(h=jxg.A.createPoint(t,[s.center,n],l)).prepareUpdate().update().updateVisibility(utils_type.A.evaluate(h.visProp.visible)).updateRenderer(),jxg.A.createCircle(t,[h,function(){return s.Radius()}],a)):jxg.A.createCircle(t,[s,n],a)}return utils_type.A.exists(s._is_new)&&(o.addChild(s),delete s._is_new),r.addChild(o),o.elType="mirrorelement",o.addParents(r),o.prepareUpdate().update(),o},jxg.A.createMirrorPoint=function(t,e,i){t=jxg.A.createMirrorElement(t,e,i);return t.elType="mirrorpoint",t},jxg.A.createIntegral=function(t,e,i){var s,h,r,o,n,a,l,u,c,d,p,_,f,A=null;if(utils_type.A.isArray(e[0])&&e[1].elementClass===constants.A.OBJECT_CLASS_CURVE)s=e[0],h=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],h=e[0]}return(e=utils_type.A.copyAttributes(i,t.options,"integral")).withLabel=!1,f=t.create("curve",[[0],[0]],e),_=s[0],r=s[1],utils_type.A.isFunction(_)?(n=function(){return h.Y(o())},_=(o=_)()):(o=_,n=h.Y(_)),utils_type.A.isFunction(r)?(l=function(){return h.Y(a())},r=(a=r)()):(a=r,l=h.Y(r)),e=utils_type.A.copyAttributes(i,t.options,"integral","curveleft"),u=t.create("glider",[o,n,h],e),utils_type.A.isFunction(o)&&u.hideElement(),e=utils_type.A.copyAttributes(i,t.options,"integral","baseleft"),c=t.create("point",[function(){return"y"===utils_type.A.evaluate(f.visProp.axis)?0:u.X()},function(){return"y"===utils_type.A.evaluate(f.visProp.axis)?u.Y():0}],e),e=utils_type.A.copyAttributes(i,t.options,"integral","curveright"),d=t.create("glider",[a,l,h],e),utils_type.A.isFunction(a)&&d.hideElement(),e=utils_type.A.copyAttributes(i,t.options,"integral","baseright"),p=t.create("point",[function(){return"y"===utils_type.A.evaluate(f.visProp.axis)?0:d.X()},function(){return"y"===utils_type.A.evaluate(f.visProp.axis)?d.Y():0}],e),!1!==(e=utils_type.A.copyAttributes(i,t.options,"integral")).withlabel&&"y"!==e.axis&&(e=utils_type.A.copyAttributes(i,t.options,"integral","label"),e=utils_type.A.copyAttributes(e,t.options,"label"),_=function(){var t=numerics.A.NewtonCotes([c.X(),p.X()],h.Y),e=utils_type.A.evaluate(A.visProp.digits);return"∫ = "+(A.useLocale()?A.formatNumberLocale(t,e):utils_type.A.toFixed(t,e))},(A=t.create("text",[function(){var t=new base_coords.A(constants.A.COORDS_BY_SCREEN,[utils_type.A.evaluate(this.visProp.offset[0])+this.board.origin.scrCoords[1],0],this.board,!1),e=this.board.getBoundingBox(),i=.1*(e[2]-e[0]),s=d.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,utils_type.A.evaluate(this.visProp.offset[1])+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),i=.1*(e[1]-e[3]),s=d.Y();return s>e[1]?s=e[1]-i:s<e[3]&&(s=e[3]+i),s+t.usrCoords[2]},""],e)).setText(_),A.dump=!1,u.addChild(A),d.addChild(A)),u.dump=!1,c.dump=!1,d.dump=!1,p.dump=!1,f.elType="integral",f.setParents([h.id,s]),f.subs={curveLeft:u,baseLeft:c,curveRight:d,baseRight:p},f.inherits.push(u,c,d,p),e.withLabel&&(f.subs.label=A,f.inherits.push(A)),f.Value=function(){return numerics.A.I([c.X(),p.X()],h.Y)},f.updateDataArray=function(){var t,e,i,s,r,o,n,a,l;if("y"===utils_type.A.evaluate(this.visProp.axis)){for(l=u.Y()<d.Y()?(o=u.X(),a=u.Y(),n=d.X(),d.Y()):(o=d.X(),a=d.Y(),n=u.X(),u.Y()),s=Math.min(o,n),r=Math.max(o,n),t=[0,o],e=[a,a],i=0;i<h.numberPoints;i++)a<=h.points[i].usrCoords[2]&&s<=h.points[i].usrCoords[1]&&h.points[i].usrCoords[2]<=l&&h.points[i].usrCoords[1]<=r&&(t.push(h.points[i].usrCoords[1]),e.push(h.points[i].usrCoords[2]));t.push(n),e.push(l),t.push(0),e.push(l),t.push(0),e.push(a)}else{for(r=c.X()<p.X()?(s=c.X(),p.X()):(s=p.X(),c.X()),t=[s,s],e=[0,h.Y(s)],i=0;i<h.numberPoints;i++)s<=h.points[i].usrCoords[1]&&h.points[i].usrCoords[1]<=r&&(t.push(h.points[i].usrCoords[1]),e.push(h.points[i].usrCoords[2]));t.push(r),e.push(h.Y(r)),t.push(r),e.push(0),t.push(s),e.push(0)}this.dataX=t,this.dataY=e},u.addChild(f),d.addChild(f),c.addChild(f),p.addChild(f),f.baseLeft=c,f.baseRight=p,f.curveLeft=u,f.curveRight=d,f.methodMap=jxg.A.deepCopy(f.methodMap,{curveLeft:"curveLeft",baseLeft:"baseLeft",curveRight:"curveRight",baseRight:"baseRight",Value:"Value"}),f.label=A,f},jxg.A.createInequality=function(a,_,t){var e,t=utils_type.A.copyAttributes(t,a.options,"inequality");if(_[0].elementClass===constants.A.OBJECT_CLASS_LINE)(e=a.create("curve",[[],[]],t)).hasPoint=function(){return!1},e.updateDataArray=function(){var t=a.getBoundingBox(),e=utils_type.A.evaluate(this.visProp.inverse),i=e?-1:1,s=1.5*Math.max(t[2]-t[0],t[1]-t[3]),e={coords:{usrCoords:[1,.5*(t[0]+t[2]),e?t[1]:t[3]]}},r=_[0].stdform.slice(1),o=r,n=1.5*Math.max(geometry.A.perpendicular(_[0],e,a)[0].distance(constants.A.COORDS_BY_USER,e.coords),s);n*=i,e={coords:{usrCoords:[1,.5*(t[0]+t[2]),.5*(t[1]+t[3])]}},i=[1,(e=(Math.abs(math.A.innerProduct(e.coords.usrCoords,_[0].stdform,3))>=math.A.eps?geometry.A.perpendicular(_[0],e,a)[0]:e.coords).usrCoords)[1]+r[1]*s,e[2]-r[0]*s],t=[1,e[1]-o[1]*s,e[2]+o[0]*s],this.dataX=[i[1],i[1]+r[0]*n,t[1]+o[0]*n,t[1],i[1]],this.dataY=[i[2],i[2]+r[1]*n,t[2]+o[1]*n,t[2],i[2]]};else if(_[0].elementClass===constants.A.OBJECT_CLASS_CURVE&&"functiongraph"===_[0].visProp.curvetype)(e=a.create("curve",[[],[]],t)).updateDataArray=function(){var t,e,i,s,r,o,n,a,l=this.board.getBoundingBox(),h=[],u=_[0].minX(),c=_[0].maxX(),d=.3*(l[1]-l[3]),p=utils_type.A.evaluate(this.visProp.inverse)?1:3;if(this.dataX=[],this.dataY=[],0!==(i=_[0].points.length))for(l[1]+=d,l[3]-=d,e=-1;e<i-1;){for(s=e+1,t=i;s<i;s++)if(_[0].points[s].isReal()){t=s;break}if(i<=t)break;for(s=t,e=i-1;s<i-1;s++)if(!_[0].points[s+1].isReal()){e=s;break}for(n=_[0].points[t].usrCoords[1],a=_[0].points[e].usrCoords[1],r=l[0]<u?u:l[0],o=l[2]>c?c:l[2],r=0===t?r:Math.max(r,n),o=e===i-1?o:Math.min(o,a),o=e===i-1?c:a,(h=[]).push([1,r=0===t?u:n,l[p]]),h.push([1,r,_[0].points[t].usrCoords[2]]),s=t;s<=e;s++)h.push(_[0].points[s].usrCoords);for(h.push([1,o,_[0].points[e].usrCoords[2]]),h.push([1,o,l[p]]),h.push(h[0]),s=0;s<h.length;s++)this.dataX.push(h[s][1]),this.dataY.push(h[s][2]);e<i-1&&(this.dataX.push(NaN),this.dataY.push(NaN))}},e.hasPoint=function(){return!1};else if(t=utils_type.A.createFunction(_[0]),e.addParentsFromJCFunctions([t]),!utils_type.A.exists(t))throw new Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]");return e.addParents(_[0]),e},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 A,j,D,s,k,R,L=math.A.eps,g=[],B=[];if(2<(D=e).length||1<=D.length&&"axis"!==D[0].elType||2<=D.length&&"axis"!==D[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(D[0])&&utils_type.A.exists(t.defaultAxes)&&(D[0]=t.defaultAxes.x),!utils_type.A.exists(D[1])&&utils_type.A.exists(t.defaultAxes)&&(D[1]=t.defaultAxes.y),R=function(t,e,i,s,r,o,n){var a,l,h,u;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+(u=4*Math.tan(Math.PI/8)/3)*r,i,i-u*r,i-r,i-r,i-r,i-u*r,i,i+u*r,i+r,i+r,NaN],[s,s+u*o,s+o,s+o,s+o,s+u*o,s,s-u*o,s-o,s-o,s-o,s-u*o,s,NaN]];case"regpol":case"regularpolygon":for(e.visProp.linecap="round",l=utils_type.A.evaluate(e.visProp.polygonvertices),h=[[],[]],a=0;a<=2*Math.PI;a+=2*Math.PI/l)h[0].push(i-r*Math.sin(a)),h[1].push(s-o*Math.cos(a));return h[0].push(NaN),h[1].push(NaN),h;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+(u=r*Math.sqrt(2)),i,i-u,i,NaN],[s+(u=o*Math.sqrt(2)),s,s-u,s,s+u,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 u=utils_type.A.evaluate(e.visProp.margin),[[i,i,NaN,n[0]-u/e.board.unitX,n[2]+u/e.board.unitX,NaN],[n[1]+u/e.board.unitY,n[3]-u/e.board.unitY,NaN,s,s,NaN]];default:return[[],[]]}},e=utils_type.A.copyAttributes(i,t.options,"grid"),utils_type.A.mergeAttr(e,e.themes[e.theme],!1),utils_type.A.mergeAttr(i={},e,!0,!0),utils_type.A.mergeAttr(i,e.major,!0,!0),(A=t.create("curve",[[null],[null]],i)).elType="grid",A.type=constants.A.OBJECT_TYPE_GRID,utils_type.A.mergeAttr(s={},e,!0,!0),utils_type.A.mergeAttr(s,e.minor,!0,!0),s.id===i.id&&(s.id=A.id+"_minor"),s.name===i.name&&(s.name=A.name+"_minor"),(j=t.create("curve",[[null],[null]],s)).elType="grid",j.type=constants.A.OBJECT_TYPE_GRID,((A.minorGrid=j).majorGrid=A).hasPoint=function(){return!1},j.hasPoint=function(){return!1},A.inherits.push(j),A.updateDataArray=function(){var t,e,i,s,r,o,n,a=this.board.getBoundingBox(),l=utils_type.A.evaluate(this.visProp.gridx),h=utils_type.A.evaluate(this.visProp.gridy),u=utils_type.A.evaluate(this.visProp.face),c=utils_type.A.evaluate(this.visProp.drawzero),d=!0===c||utils_type.A.isObject(c)&&!0===utils_type.A.evaluate(c.origin),p=!0===c||utils_type.A.isObject(c)&&!0===utils_type.A.evaluate(c.x),_=!0===c||utils_type.A.isObject(c)&&!0===utils_type.A.evaluate(c.y),f=utils_type.A.evaluate(this.visProp.includeboundaries),c=utils_type.A.evaluate(this.visProp.forcesquare);if(this.dataX=[],this.dataY=[],k=utils_type.A.evaluate(this.visProp.majorstep),(k=utils_type.A.isArray(k)?k:[k,k]).length<2&&(k=[k[0],k[0]]),utils_type.A.exists(l)&&(jxg.A.deprecated("gridX","majorStep"),k[0]=l),utils_type.A.exists(h)&&(jxg.A.deprecated("gridY","majorStep"),k[1]=h),"auto"===k[0]?(n=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),k[0]=n,utils_type.A.exists(D[0])&&(k[0]=D[0].ticks[0].getDistanceMajorTicks())):k[0]=utils_type.A.parseNumber(k[0],Math.abs(a[1]-a[3]),1/this.board.unitX),"auto"===k[1]?(n=Math.pow(10,Math.floor(Math.log(50/this.board.unitY)/Math.LN10)),k[1]=n,utils_type.A.exists(D[1])&&(k[1]=D[1].ticks[0].getDistanceMajorTicks())):k[1]=utils_type.A.parseNumber(k[1],Math.abs(a[0]-a[2]),1/this.board.unitY),"min"===c||!0===c?k[0]*this.board.unitX<=k[1]*this.board.unitY?k[1]=k[0]/this.board.unitY*this.board.unitX:k[0]=k[1]/this.board.unitX*this.board.unitY:"max"===c&&(k[0]*this.board.unitX<=k[1]*this.board.unitY?k[0]=k[1]/this.board.unitX*this.board.unitY:k[1]=k[0]/this.board.unitY*this.board.unitX),g=utils_type.A.evaluate(this.visProp.size),(g=utils_type.A.isArray(g)?g:[g,g]).length<2&&(g=[g[0],g[0]]),utils_type.A.isNumber(g[0],!0)&&(g[0]=g[0]+"px"),utils_type.A.isNumber(g[1],!0)&&(g[1]=g[1]+"px"),g[0]=utils_type.A.parseNumber(g[0],k[0],1/this.board.unitX),g[1]=utils_type.A.parseNumber(g[1],k[1],1/this.board.unitY),B[0]=g[0]/2,B[1]=g[1]/2,t=math.A.roundToStep(a[0],k[0]),l=math.A.roundToStep(a[1],k[1]),o=isFinite(t)&&isFinite(l)&&isFinite(a[2])&&isFinite(a[3])&&Math.abs(a[2])<Math.abs(5e3*k[0])&&Math.abs(a[3])<Math.abs(5e3*k[1]),"line"===u.toLowerCase()){for(s=utils_type.A.evaluate(A.visProp.margin),i=l;o&&i>=a[3];i-=k[1])!d&&Math.abs(i)<L||!_&&Math.abs(i)<L||!f&&(i<=a[3]+B[1]||i>=a[1]-B[1])||(r=[[a[0]-s/A.board.unitX,a[2]+s/A.board.unitX,NaN],[i,i,NaN]],utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1]));for(e=t;o&&e<=a[2];e+=k[0])!d&&Math.abs(e)<L||!p&&Math.abs(e)<L||!f&&(e<=a[0]+B[0]||e>=a[2]-B[0])||(r=[[e,e,NaN],[a[1]+s/A.board.unitY,a[3]-s/A.board.unitY,NaN]],utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1]))}else for(i=l;o&&i>=a[3];i-=k[1])for(e=t;o&&e<=a[2];e+=k[0])!d&&Math.abs(i)<L&&Math.abs(e)<L||!p&&Math.abs(i)<L&&Math.abs(e)>=L||!_&&Math.abs(e)<L&&Math.abs(i)>=L||!f&&(e<=a[0]+B[0]||e>=a[2]-B[0]||i<=a[3]+B[1]||i>=a[1]-B[1])||(r=R(u,A,e,i,B[0],B[1],a),utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1]))},j.updateDataArray=function(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m=this.board.getBoundingBox(),y=[],b=[],v=utils_type.A.evaluate(this.visProp.minorelements),C=utils_type.A.evaluate(this.visProp.size),x=utils_type.A.evaluate(this.visProp.face),P=utils_type.A.evaluate(this.visProp.drawzero),E=!0===P||utils_type.A.isObject(P)&&!0===utils_type.A.evaluate(P.x),O=!0===P||utils_type.A.isObject(P)&&!0===utils_type.A.evaluate(P.y),M=utils_type.A.evaluate(this.majorGrid.visProp.face),P=utils_type.A.evaluate(this.majorGrid.visProp.drawzero),w=!0===P||utils_type.A.isObject(P)&&!0===utils_type.A.evaluate(P.origin),S=!0===P||utils_type.A.isObject(P)&&!0===utils_type.A.evaluate(P.x),T=!0===P||utils_type.A.isObject(P)&&!0===utils_type.A.evaluate(P.y),N=utils_type.A.evaluate(this.visProp.includeboundaries);if(this.dataX=[],this.dataY=[],(v=utils_type.A.isArray(v)?v:[v,v]).length<2&&(v=[v[0],v[0]]),utils_type.A.isNumber(v[0],!0)?v[0]=parseFloat(v[0]):(v[0]=3,utils_type.A.exists(D[0])&&(v[0]=utils_type.A.evaluate(D[0].getAttribute("ticks").minorticks))),y[0]=k[0]/(v[0]+1),utils_type.A.isNumber(v[1],!0)?v[1]=parseFloat(v[1]):(v[1]=3,utils_type.A.exists(D[1])&&(v[1]=utils_type.A.evaluate(D[1].getAttribute("ticks").minorticks))),y[1]=k[1]/(v[1]+1),(C=utils_type.A.isArray(C)?C:[C,C]).length<2&&(C=[C[0],C[0]]),utils_type.A.isNumber(C[0],!0)&&(C[0]=C[0]+"px"),utils_type.A.isNumber(C[1],!0)&&(C[1]=C[1]+"px"),C[0]=utils_type.A.parseNumber(C[0],y[0],1/this.board.unitX),C[1]=utils_type.A.parseNumber(C[1],y[1],1/this.board.unitY),b[0]=.5*C[0],b[1]=.5*C[1],t=math.A.roundToStep(m[0],y[0]),P=math.A.roundToStep(m[1],y[1]),o=isFinite(t)&&isFinite(P)&&isFinite(m[2])&&isFinite(m[3])&&Math.abs(m[2])<=Math.abs(5e3*y[0])&&Math.abs(m[3])<Math.abs(5e3*y[1]),"line"!==x.toLowerCase())for(i=P;o&&i>=m[3];i-=y[1])for(e=t;o&&e<=m[2];e+=y[0]){if(n=math.A.roundToStep(Math.abs(e),k[0]),n=Math.abs(n-Math.abs(e)),a=k[0]-n,l=math.A.roundToStep(Math.abs(i),k[1]),l=Math.abs(l-Math.abs(i)),h=k[1]-l,"line"===M){if(n-b[0]-B[0]<L||a-b[0]-B[0]<L||l-b[1]-B[1]<L||h-b[1]-B[1]<L)continue}else if((n-b[0]-B[0]<L||a-b[0]-B[0]<L)&&(l-b[1]-B[1]<L||h-b[1]-B[1]<L)&&(w||B[1]-Math.abs(i)+b[1]<L||B[0]-Math.abs(e)+b[0]<L)&&(S||B[1]-Math.abs(i)+b[1]<L||B[0]+Math.abs(e)-b[0]<L)&&(T||B[0]-Math.abs(e)+b[0]<L||B[1]+Math.abs(i)-b[1]<L))continue;!O&&Math.abs(e)<L||!E&&Math.abs(i)<L||(u=Math.abs(m[0]%k[0]),c=Math.abs(m[1]%k[1]),d=Math.abs(m[2]%k[0]),p=Math.abs(m[3]%k[1]),_=k[0]-u,f=k[1]-c,A=k[0]-d,g=k[1]-p,!N&&(e-b[0]-m[0]-B[0]+_<L&&_-B[0]<L||e-b[0]-m[0]-B[0]-u<L&&u-B[0]<L||-e-b[0]+m[2]-B[0]+A<L&&A-B[0]<L||-e-b[0]+m[2]-B[0]-d<L&&d-B[0]<L||-i-b[1]+m[1]-B[1]+f<L&&f-B[1]<L||-i-b[1]+m[1]-B[1]-c<L&&c-B[1]<L||i-b[1]-m[3]-B[1]+g<L&&g-B[1]<L||i-b[1]-m[3]-B[1]-p<L&&p-B[1]<L||-i-b[1]+m[1]<L||e-b[0]-m[0]<L||i-b[1]-m[3]<L||-e-b[0]+m[2]<L)||(r=R(x,j,e,i,b[0],b[1],m),utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1])))}else{for(s=utils_type.A.evaluate(j.visProp.margin),i=P;o&&i>=m[3];i-=y[1]){if(l=math.A.roundToStep(Math.abs(i),k[1]),l=Math.abs(l-Math.abs(i)),h=k[1]-l,"line"===M){if(l-b[1]-B[1]<L||h-b[1]-B[1]<L)continue}else if((l-b[1]-B[1]<L||h-b[1]-B[1]<L)&&(w||B[1]-Math.abs(i)+b[1]<L)&&(S||B[1]-Math.abs(i)+b[1]<L)&&(T||B[1]+Math.abs(i)-b[1]<L))continue;!E&&Math.abs(i)<L||(u=Math.abs(m[0]%k[0]),c=Math.abs(m[1]%k[1]),d=Math.abs(m[2]%k[0]),p=Math.abs(m[3]%k[1]),_=k[0]-u,f=k[1]-c,A=k[0]-d,g=k[1]-p,!N&&(-i-b[1]+m[1]-B[1]+f<L&&f-B[1]<L||-i-b[1]+m[1]-B[1]-c<L&&c-B[1]<L||i-b[1]-m[3]-B[1]+g<L&&g-B[1]<L||i-b[1]-m[3]-B[1]-p<L&&p-B[1]<L||-i-b[1]+m[1]<L||i-b[1]-m[3]<L)||(r=[[m[0]-s/j.board.unitX,m[2]+s/j.board.unitX,NaN],[i,i,NaN]],utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1])))}for(e=t;o&&e<=m[2];e+=y[0]){if(n=math.A.roundToStep(Math.abs(e),k[0]),n=Math.abs(n-Math.abs(e)),a=k[0]-n,"line"===M){if(n-b[0]-B[0]<L||a-b[0]-B[0]<L)continue}else if((n-b[0]-B[0]<L||a-b[0]-B[0]<L)&&(w||B[0]-Math.abs(e)+b[0]<L)&&(S||B[0]+Math.abs(e)-b[0]<L)&&(T||B[0]-Math.abs(e)+b[0]<L))continue;!O&&Math.abs(e)<L||(u=Math.abs(m[0]%k[0]),c=Math.abs(m[1]%k[1]),d=Math.abs(m[2]%k[0]),p=Math.abs(m[3]%k[1]),_=k[0]-u,f=k[1]-c,A=k[0]-d,g=k[1]-p,!N&&(e-b[0]-m[0]-B[0]+_<L&&_-B[0]<L||e-b[0]-m[0]-B[0]-u<L&&u-B[0]<L||-e-b[0]+m[2]-B[0]+A<L&&A-B[0]<L||-e-b[0]+m[2]-B[0]-d<L&&d-B[0]<L||e-b[0]-m[0]<L||-e-b[0]+m[2]<L)||(r=[[e,e,NaN],[m[1]+s/j.board.unitY,m[3]-s/j.board.unitY,NaN]],utils_type.A.concat(this.dataX,r[0]),utils_type.A.concat(this.dataY,r[1])))}}},t.grids.push(A),t.grids.push(j),A},jxg.A.registerElement("grid",jxg.A.createGrid),__webpack_require__(925)),base_image=(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=this.transformations.length,r=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint;return 0===s?(s=t-this.coords.scrCoords[1],i=this.coords.scrCoords[2]-e,s>=-(r=r)&&s-this.size[0]<=r&&-r<=i&&i-this.size[1]<=r):(i=[(s=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board).usrCoords)[0]-this.span[0][0],s[1]-this.span[0][1],s[2]-this.span[0][2]],0<=(t=(r=math.A.innerProduct)(i,this.span[1]))&&t<=r(this.span[1],this.span[1])&&0<=(t=r(i,this.span[2]))&&t<=r(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateSize(),this.updateSpan()),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 t=0!==this.parents.length?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=e[0],r=e[1],o=e[2],i=utils_type.A.copyAttributes(i,t.options,"image");if(t=coordselement.A.create(jxg.A.Image,t,r,i,s,o))return 0!==i.rotate&&t.addRotation(i.rotate),t;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]")},jxg.A.registerElement("image",jxg.A.createImage),jxg.A.Image),prefix=(jxg.A.createSlider=function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f=(i=utils_type.A.copyAttributes(i,t.options,"slider")).withticks,A=i.withlabel,g=i.snapwidth,m=i.snapvalues,y=i.snapvaluedistance,b=t.create("point",e[0],i.point1),v=t.create("point",e[1],i.point2);return(l=t.create("segment",[b,v],i.baseline)).updateStdform(),s=b.coords.usrCoords.slice(1),d=v.coords.usrCoords.slice(1),r=e[2][0],_=e[2][1],o=e[2][2],n=o-r,_=-1===(p=utils_type.A.evaluate(g))?_:Math.round(_/p)*p,p=s[0]+(d[0]-s[0])*(_-r)/(o-r),d=s[1]+(d[1]-s[1])*(_-r)/(o-r),i.withlabel=!1,(a=t.create("glider",[p,d,l],i)).setAttribute({snapwidth:g,snapvalues:m,snapvaluedistance:y}),h=t.create("segment",[b,a],i.highline),a.Value=function(){var t=this._smax-this._smin,e=utils_type.A.evaluate(this.visProp.snapwidth);return-1===e?this.position*t+this._smin:Math.round((this.position*t+this._smin)/e)*e},a.methodMap=utils_type.A.deepCopy(a.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"}),a._smax=o,a._smin=r,a.setMax=function(t){return this._smax=t,this},a.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},a.setMin=function(t){return this._smin=t,this},A&&(c=t.create("text",[function(){return.05*(v.X()-b.X())+v.X()},function(){return.05*(v.Y()-b.Y())+v.Y()},function(){var t=utils_type.A.evaluate(a.visProp.digits),e=utils_type.A.evaluate(a.visProp.suffixlabel),i=utils_type.A.evaluate(a.visProp.unitlabel),s=utils_type.A.evaluate(a.visProp.postlabel);return 2===t&&2!==utils_type.A.evaluate(a.visProp.precision)&&(t=utils_type.A.evaluate(a.visProp.precision)),e=null!==e?e:a.name&&""!==a.name?a.name+" = ":"",a.useLocale()?e+=a.formatNumberLocale(a.Value(),t):e+=utils_type.A.toFixed(a.Value(),t),null!==i&&(e+=i),null!==s&&(e+=s),e}],i.label),a.label=c,a.visProp.withlabel=!0,a.hasLabel=!0),a.point1=b,a.point2=v,a.baseline=l,a.highline=h,f&&(utils_type.A.exists(i.generatelabeltext)||(i.ticks.generateLabelText=function(t,e,i){var s=a.point1.Dist(a.point2),r=a._smin,o=a._smax,e=this.getDistanceFromZero(e,t)*(o-r)/s+r;return s<math.A.eps||Math.abs(e)<math.A.eps?"0":this.formatLabelText(e)}),u=t.create("ticks",[a.baseline,a.point1.Dist(b)/2,function(t){var e=a.point1.Dist(a.point2),t=a.point1.coords.distance(constants.A.COORDS_BY_USER,t);return e<math.A.eps?0:t/e*n+r}],i.ticks),a.ticks=u),a.remove=function(){A&&t.removeObject(c),t.removeObject(h),t.removeObject(l),t.removeObject(v),t.removeObject(b),point.prototype.remove.call(a)},b.dump=!1,v.dump=!1,l.dump=!1,h.dump=!1,A&&(c.dump=!1),a.elType="slider",a.parents=e,a.subs={point1:b,point2:v,baseLine:l,highLine:h},a.inherits.push(b,v,l,h),l.inherits=[],h.inherits=[],f&&(u.dump=!1,a.subs.ticks=u,a.inherits.push(u)),a.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]]},a.baseline.on("up",function(t){var e;utils_type.A.evaluate(a.visProp.moveonup)&&!utils_type.A.evaluate(a.visProp.fixed)&&(e=l.board.getMousePosition(t,0),e=new base_coords.A(constants.A.COORDS_BY_SCREEN,e,this.board),a.moveTo([e.usrCoords[1],e.usrCoords[2]]),a.triggerEventHandlers(["drag"],[t]))}),a.prepareUpdate().update(),t.isSuspendedUpdate||(a.updateVisibility().updateRenderer(),a.baseline.updateVisibility().updateRenderer(),a.highline.updateVisibility().updateRenderer(),f&&a.ticks.updateVisibility().updateRenderer()),a},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("Coords"===(n="V"===(n=t[0])?"Value":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,l;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=utils_type.A.evaluate(t[2].visProp.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=utils_type.A.evaluate(t[1].visProp.dim))&&(r=n)):(r=0,"Value"!==o&&"V"!==o||0<=[constants.A.OBJECT_TYPE_ARC,constants.A.OBJECT_TYPE_SECTOR,constants.A.OBJECT_TYPE_ANGLE].indexOf(t[1].type)&&(r=(l="")===(l=3===t.length&&utils_type.A.isString(t[2])?t[2].toLowerCase():l)?t[1].type===constants.A.OBJECT_TYPE_ANGLE?0:1:0===l.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?1<i&&utils_type.A.concat(r,this.getParents(t[i])):r.push(t[i]);return r}},jxg.A.PrefixParser),datasource=(jxg.A.createTapemeasure=function(t,e,i){var s,r,o,n,a,l=e[0],e=e[1],h=utils_type.A.copyAttributes(i,t.options,"tapemeasure","point1"),u=t.create("point",l,h);return h=utils_type.A.copyAttributes(i,t.options,"tapemeasure","point2"),o=t.create("point",e,h),u.setAttribute({ignoredSnapToPoints:[o.id]}),o.setAttribute({ignoredSnapToPoints:[u.id]}),h=utils_type.A.copyAttributes(i,t.options,"tapemeasure"),s=h.withticks,l=h.withlabel,2===h.digits&&2!==h.precision&&h.precision,l&&(h.withlabel=!0),r=t.create("segment",[u,o],h),l&&(n=i.name&&""!==i.name?i.name+" = ":"",r.label.setText(function(){var t=utils_type.A.evaluate(r.label.visProp.digits);return r.label.useLocale()?n+r.label.formatNumberLocale(u.Dist(o),t):n+utils_type.A.toFixed(u.Dist(o),t)})),s&&(h=utils_type.A.copyAttributes(i,t.options,"tapemeasure","ticks"),a=t.create("ticks",[r,.1],h),r.inherits.push(a)),r.remove=function(){s&&r.removeTicks(a),t.removeObject(o),t.removeObject(u),base_element.A.prototype.remove.call(this)},r.Value=function(){return u.Dist(o)},u.dump=!1,o.dump=!1,r.elType="tapemeasure",r.getParents=function(){return[[u.X(),u.Y()],[o.X(),o.Y()]]},r.subs={point1:u,point2:o},s&&(a.dump=!1),r.methodMap=jxg.A.deepCopy(r.methodMap,{Value:"Value"}),r.prepareUpdate().update(),t.isSuspendedUpdate||(r.updateVisibility().updateRenderer(),r.point1.updateVisibility().updateRenderer(),r.point2.updateVisibility().updateRenderer()),r},jxg.A.registerElement("tapemeasure",jxg.A.createTapemeasure),jxg.A.createMeasurement=function(t,e,i){var a,s,i=utils_type.A.copyAttributes(i,t.options,"measurement"),r=e[0],o=e[1],n=e[2];for((a=t.create("text",[r,o,""],i)).type=utils_type.A.OBJECT_TYPE_MEASUREMENT,a.elType="measurement",a.Value=function(){return prefix.parse(n,"execute")},a.Dimension=function(){var t=utils_type.A.evaluate(a.visProp.dim);return null!==t?t:prefix.dimension(n)},a.Unit=function(){var t="",e=utils_type.A.evaluate(a.visProp.units),i=a.Dimension();return utils_type.A.isObject(e)&&utils_type.A.exists(e[i])&&!1!==e[i]?t=utils_type.A.evaluate(e[i]):utils_type.A.isObject(e)&&utils_type.A.exists(e["dim"+i])&&!1!==e["dim"+i]?t=utils_type.A.evaluate(e["dim"+i]):(t=utils_type.A.evaluate(a.visProp.baseunit),0===i?t="":1<i&&""!==t&&(t=t+"^{"+i+"}")),t},a.getTerm=function(){return n},a.getMethod=function(){var t=n[0];return t="V"===t?"Value":t},a.toPrefix=function(){return prefix.toPrefix(n)},a.getParents=function(){return prefix.getParents(n)},a.addParents(a.getParents()),s=0;s<a.parents.length;s++)t.select(a.parents[s]).addChild(a);return a.setText(function(){var t,e="",i="",s=a.Dimension(),r=utils_type.A.evaluate(a.visProp.digits),o=a.Unit(),n=a.Value();if(utils_type.A.evaluate(a.visProp.showprefix)&&(e=a.visProp.formatprefix.apply(a,[utils_type.A.evaluate(a.visProp.prefix)])),utils_type.A.evaluate(a.visProp.showsuffix)&&(i=a.visProp.formatsuffix.apply(a,[utils_type.A.evaluate(a.visProp.suffix)])),utils_type.A.isNumber(n))"none"!==r&&(n="auto"===r?a.useLocale()?a.formatNumberLocale(n):utils_type.A.autoDigits(n):a.useLocale()?a.formatNumberLocale(n,r):utils_type.A.toFixed(n,r));else if(utils_type.A.isArray(n))for(t=0;t<n.length;t++)!utils_type.A.isNumber(n[t])||"none"!==r&&("auto"===r?a.useLocale()?n[t]=a.formatNumberLocale(n[t]):n[t]=utils_type.A.autoDigits(n[t]):a.useLocale()?n[t]=a.formatNumberLocale(n[t],r):n[t]=utils_type.A.toFixed(n[t],r));return"coords"===s&&utils_type.A.isArray(n)&&(2===n.length&&n.unshift(void 0),n=a.visProp.formatcoords.apply(a,[n[1],n[2],n[0]])),"direction"===s&&utils_type.A.isArray(n)&&(n=a.visProp.formatdirection.apply(a,[n[0],n[1]])),utils_type.A.isString(s)?e+n+i:isNaN(s)?e+"NaN"+i:e+n+o+i}),a.methodMap=utils_type.A.deepCopy(a.methodMap,{Value:"Value",Dimension:"Dimension",Unit:"Unit",getTerm:"getTerm",Term:"getTerm",getMethod:"getMethod",Method:"getMethod",getParents:"getParents",Parents:"getParents"}),a},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].innerHTML,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}}),jxg.A.DataSource),chart=(jxg.A.Chart=function(t,e,i){var s,r,o,n,a,l;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=[],l=utils_type.A.evaluate(r).length,o=0;o<l;o++)s[o]=o+1;else 2===e.length&&(l=Math.min(e[0].length,e[1].length),s=e[0].slice(0,l),r=e[1].slice(0,l));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,r=Math.max(parseInt(r,10),1)||1;return s.fillcolor="none",s.highlightfillcolor="none",t.create("functiongraph",[numerics.A.regressionPolynomial(r,e,i)],s)},drawBar:function(t,i,e,s){function r(t,e){return function(){return i[t]()-e*a}}var o,n,a,l,h,u,c,d,p,_=[],f=[],A={fixed:!0,withLabel:!1,visible:!1,name:""};if((d=utils_type.A.copyAttributes(s,t.options,"chart"))&&d.width)a=d.width;else{if(i.length<=1)a=1;else for(a=i[1]-i[0],o=1;o<i.length-1;o++)a=i[o+1]-i[o]<a?i[o+1]-i[o]:a;a*=.8}for(p=utils_type.A.copyAttributes(s,t.options,"chart","label"),o=0;o<i.length;o++)c=utils_type.A.isFunction(i[o])?(l=r(o,-.5),h=r(o,0),r(o,.5)):(l=i[o]-.5*a,h=i[o],i[o]+.5*a),utils_type.A.isFunction(e[o])?e[o]():e[o],u=e[o],"horizontal"===d.dir?(f[0]=t.create("point",[0,l],A),f[1]=t.create("point",[u,l],A),f[2]=t.create("point",[u,c],A),f[3]=t.create("point",[0,c],A),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[o])&&(p.anchorY="middle",(n=t.create("text",[u,h,d.labels[o]],p)).visProp.anchorx=function(t){return function(){return 0<=t.X()?"left":"right"}}(n))):(f[0]=t.create("point",[l,0],A),f[1]=t.create("point",[l,u],A),f[2]=t.create("point",[c,u],A),f[3]=t.create("point",[c,0],A),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[o])&&(p.anchorX="middle",(n=t.create("text",[h,u,d.labels[o]],p)).visProp.anchory=function(t){return function(){return 0<=t.Y()?"bottom":"top"}}(n))),utils_type.A.isArray(d.colors)&&(c=d.colors,d.fillcolor=c[o%c.length]),_[o]=t.create("polygon",f,d),utils_type.A.exists(d.labels)&&utils_type.A.exists(d.labels[o])&&(_[o].text=n);return _},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,a,e){function i(r,o,n){return function(){for(var t,e,i=0,s=0;s<=r;s++)i+=parseFloat(utils_type.A.evaluate(a[s]));for(t=i,s=r+1;s<a.length;s++)t+=parseFloat(utils_type.A.evaluate(a[s]));return e=0!==t?2*Math.PI*i/t:0,f()*Math[o](e)+n}}function s(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*utils_type.A.evaluate(this.label.visProp.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()}function r(){this.highlighted||(this.highlighted=!0,(this.board.highlightedObjects[this.id]=this).board.renderer.highlight(this),s.call(this,1.1,2))}function o(){this.highlighted&&(this.highlighted=!1,this.board.renderer.noHighlight(this),s.call(this,.9090909,1))}var n,l,h=[],u=[],c=e.colors,d=e.highlightcolors,p=e.labels,_=e.radius||4,f=_,A=e.center||[0,0],g=A[0],m=A[1],y={fixed:!0,withLabel:!1,visible:!1,name:""};if(!utils_type.A.isArray(p))for(p=[],n=0;n<a.length;n++)p[n]="";for(utils_type.A.isFunction(_)||(f=function(){return _}),e.highlightonsector=e.highlightonsector||!1,e.straightfirst=!1,e.straightlast=!1,l=t.create("point",[g,m],y),h[0]=t.create("point",[function(){return f()+g},function(){return m}],y),n=0;n<a.length;n++)h[n+1]=t.create("point",[i(n,"cos",g),i(n,"sin",m)],y),e.name=p[n],e.withlabel=""!==e.name,e.fillcolor=c&&c[n%c.length],e.labelcolor=c&&c[n%c.length],e.highlightfillcolor=d&&d[n%d.length],u[n]=t.create("sector",[l,h[n],h[n+1]],e),e.highlightonsector&&(u[n].hasPoint=u[n].hasPointSector),e.highlightbysize&&(u[n].highlight=r,u[n].noHighlight=o);return{sectors:u,points:h,midpoint:l}},drawRadar:function(s,t,e){function L(){var t=utils_type.A.evaluate(this.visProp.label.offset).slice(0),e=this.point1.X(),i=this.point2.X(),s=this.point1.Y(),r=this.point2.Y();return i<e&&(t[0]=-t[0]),r<s&&(t[1]=-t[1]),this.setLabelRelativeCoords(t),new base_coords.A(constants.A.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)}function i(t,e){var i=s.create("transform",[-(g[e]-f[e]),0],{type:"translate"}),e=s.create("transform",[b/(m[e]+A[e]-(g[e]-f[e])),1],{type:"scale"});return i.melt(e),e=s.create("transform",[t],{type:"rotate"}),i.melt(e),i}var r,o,n,a,l,h,u,c,d,p,_,B,f,A,g,m,I,y,b,v,C,x,P,E,O,M,w,Y,X,S,T,U,F,N,z,j,D,J,k,G,R=t.length;if(R<=0)throw new Error("JSXGraph radar chart: no data");if(n=e.paramarray,!utils_type.A.exists(n))throw new Error("JSXGraph radar chart: need paramArray attribute");if((a=n.length)<=1)throw new Error("JSXGraph radar chart: need more than one param in paramArray");for(r=0;r<R;r++)if(a!==t[r].length)throw new Error("JSXGraph radar chart: use data length equal to number of params ("+t[r].length+" != "+a+")");for(l=[],h=[],o=0;o<a;o++)l[o]=t[0][o],h[o]=l[o];for(r=1;r<R;r++)for(o=0;o<a;o++)t[r][o]>l[o]&&(l[o]=t[r][o]),t[r][o]<h[o]&&(h[o]=t[r][o]);for(u=[],c=[],r=0;r<R;r++)u[r]="",c[r]=[];for(d=[],p=[],_=e.startshiftratio||0,B=e.endshiftratio||0,r=0;r<a;r++)d[r]=(l[r]-h[r])*_,p[r]=(l[r]-h[r])*B;if(f=e.startshiftarray||d,A=e.endshiftarray||p,g=e.startarray||h,utils_type.A.exists(e.start))for(r=0;r<a;r++)g[r]=e.start;if(m=e.endarray||l,utils_type.A.exists(e.end))for(r=0;r<a;r++)m[r]=e.end;if(f.length!==a)throw new Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(A.length!==a)throw new Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(g.length!==a)throw new Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(m.length!==a)throw new Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(I=e.labelarray||u,y=e.colors,b=e.radius||10,k=e.strokewidth||1,utils_type.A.exists(e.highlightonsector)||(e.highlightonsector=!1),v={name:e.name,id:e.id,strokewidth:k,polystrokewidth:e.polystrokewidth||k,strokecolor:e.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:e.fillColor||"#FFFF88",fillopacity:e.fillOpacity||.4,highlightfillcolor:e.highlightFillColor||"#FF7400",highlightstrokecolor:e.highlightStrokeColor||"black",gradient:e.gradient||"none"},C=(k=e.center||[0,0])[0],x=k[1],P=s.create("point",[C,x],{name:"",fixed:!0,withlabel:!1,visible:!1}),Math.PI,Math.PI,E=k=e.startangle||0,O=[],M=[],r=0;r<a;r++)for(E+=2*Math.PI/a,Y=b*Math.cos(E)+C,X=b*Math.sin(E)+x,O[r]=s.create("point",[Y,X],{name:"",fixed:!0,withlabel:!1,visible:!1}),M[r]=s.create("line",[P,O[r]],{name:n[r],strokeColor:v.strokecolor,strokeWidth:v.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:v.highlightstrokecolor}),M[r].getLabelAnchor=L,w=i(E,r),o=0;o<t.length;o++)G=t[o][r],c[o][r]=s.create("point",[G,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),c[o][r].addTransform(c[o][r],w);for(S=[],r=0;r<R;r++)for(v.labelcolor=y&&y[r%y.length],v.strokecolor=y&&y[r%y.length],v.fillcolor=y&&y[r%y.length],S[r]=s.create("polygon",c[r],{withLines:!0,withLabel:!1,fillColor:v.fillcolor,fillOpacity:v.fillopacity,highlightFillColor:v.highlightfillcolor}),o=0;o<a;o++)S[r].borders[o].setAttribute("strokecolor:"+y[r%y.length]),S[r].borders[o].setAttribute("strokewidth:"+v.polystrokewidth);switch(e.legendposition||"none"){case"right":U=e.legendleftoffset||2,F=e.legendtopoffset||1,this.legend=s.create("legend",[C+b+U,x+b-F],{labels:I,colors:y});break;case"none":break;default:jxg.A.debug("Unknown legend position")}if(T=[],e.showcircles){for(N=[],r=0;r<6;r++)N[r]=20*r;if(N[0]="0",(j=(z=e.circlelabelarray||N).length)<2)throw new Error("JSXGraph radar chart: too less circles in circleLabelArray");for(D=[],w=i(k+Math.PI/a,0),v.fillcolor="none",v.highlightfillcolor="none",v.strokecolor=e.strokecolor||"black",v.strokewidth=e.circlestrokewidth||.5,v.layer=0,J=(m[0]-g[0])/(j-1),r=0;r<j;r++)D[r]=s.create("point",[g[0]+r*J,0],{name:z[r],size:0,fixed:!0,withLabel:!0,visible:!0}),D[r].addTransform(D[r],w),T[r]=s.create("circle",[P,D[r]],v)}return this.rendNode=S[0].rendNode,{circles:T,lines:M,points:c,midpoint:P,polygons:S}},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,l,h,u,c,d,p,_,f,A,g,m,y=[],b=env.A.isBrowser?t.document.getElementById(e[0]):null;if(1===e.length&&utils_type.A.isString(e[0])){if(utils_type.A.exists(b)){if(c=utils_type.A.copyAttributes(i,t.options,"chart"),s=(b=(new datasource).loadFromTable(e[0],c.withheaders,c.withheaders)).data,a=b.columnHeaders,r=b.rowHeaders,d=c.width,p=c.name,_=c.strokecolor,f=c.fillcolor,A=c.highlightstrokecolor,g=c.highlightfillcolor,t.suspendUpdate(),m=s.length,u=[],c.rows&&utils_type.A.isArray(c.rows)){for(o=0;o<m;o++)for(n=0;n<c.rows.length;n++)if(c.rows[n]===o||c.withheaders&&c.rows[n]===r[o]){u.push(s[o]);break}}else u=s;for(m=u.length,o=0;o<m;o++){if(h=[],c.chartstyle&&-1!==c.chartstyle.indexOf("bar")){for(h.push(1-(l=d||.8)/2+(o+.5)*l/m),n=1;n<u[o].length;n++)h.push(h[n-1]+1);c.width=l/m}p&&p.length===m?c.name=p[o]:c.withheaders&&(c.name=a[o]),_&&_.length===m?c.strokecolor=_[o]:c.strokecolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,.6),f&&f.length===m?c.fillcolor=f[o]:c.fillcolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,1),A&&A.length===m?c.highlightstrokecolor=A[o]:c.highlightstrokecolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,1),g&&g.length===m?c.highlightfillcolor=g[o]:c.highlightfillcolor=utils_color.A.hsv2rgb((o+1)/m*360,.9,.6),c.chartstyle&&-1!==c.chartstyle.indexOf("bar")?y.push(new jxg.A.Chart(t,[h,u[o]],c)):y.push(new jxg.A.Chart(t,[u[o]],c))}t.unsuspendUpdate()}return y}return c=utils_type.A.copyAttributes(i,t.options,"chart"),new jxg.A.Chart(t,e,c)},jxg.A.registerElement("chart",jxg.A.createChart),jxg.A.Legend=function(t,e,i){if(this.constructor(),i=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=i.labelarray||i.labels,this.color_array=i.colorarray||i.colors,this.lines=[],this.myAtts.strokewidth=i.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.myAtts.fixed=!0,this.style=i.legendstyle||i.style,"vertical"!==this.style)throw new Error("JSXGraph: Unknown legend style: "+this.style);this.drawVerticalLegend(t,i)},jxg.A.Legend.prototype=new base_element.A,jxg.A.Legend.prototype.drawVerticalLegend=function(t,e){for(var i=e.linelength||1,s=(e.rowheight||20)/this.board.unitY,r=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)},o=0;o<this.label_array.length;o++)this.myAtts.name=this.label_array[o],this.myAtts.strokecolor=this.color_array[o%this.color_array.length],this.myAtts.highlightstrokecolor=this.color_array[o%this.color_array.length],this.myAtts.label={offset:[10,0],strokeColor:this.color_array[o%this.color_array.length],strokeWidth:this.myAtts.strokewidth},this.lines[o]=t.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-o*s],[this.coords.usrCoords[1]+i,this.coords.usrCoords[2]-o*s]],this.myAtts),this.lines[o].getLabelAnchor=r,this.lines[o].prepareUpdate().update().updateVisibility(utils_type.A.evaluate(this.lines[o].visProp.visible)).updateRenderer()},jxg.A.createLegend=function(t,e,i){if(utils_type.A.exists(e)&&2===e.length)return new jxg.A.Legend(t,e,i);throw new Error("JSXGraph: Legend element needs two numbers as parameters")},jxg.A.registerElement("legend",jxg.A.createLegend),{Chart:jxg.A.Chart,Legend:jxg.A.Legend}),transformation=(jxg.A.Transformation=function(t,e,i){this.elementClass=constants.A.OBJECT_CLASS_OTHER,this.type=constants.A.OBJECT_TYPE_TRANSFORMATION,this.matrix=[[1,0,0],[0,1,0],[0,0,1]],this.board=t,this.isNumericMatrix=!1,this.setMatrix(t,e,i),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bindTo",melt:"melt"}},jxg.A.Transformation.prototype={},jxg.A.extend(jxg.A.Transformation.prototype,{update:function(){return this},setMatrix:function(t,e,n){var i;for(this.isNumericMatrix=!0,i=0;i<n.length;i++)if("number"!=typeof n[i]){this.isNumericMatrix=!1;break}if("translate"===e){if(2!==n.length)throw new Error("JSXGraph: translate transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,n,2),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1)}}else if("scale"===e){if(2!==n.length)throw new Error("JSXGraph: scale transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,n,2),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[2][2]=this.evalParam(1)}}else if("reflect"===e)n.length<4&&(n[0]=t.select(n[0])),2===n.length&&(n[1]=t.select(n[1])),4===n.length&&(this.evalParam=utils_type.A.createEvalFunction(t,n,4)),this.update=function(){var t,e,i,s,r,o;1===n.length?r=n[0].stdform:2===n.length?r=math.A.crossProduct(n[1].coords.usrCoords,n[0].coords.usrCoords):4===n.length&&(r=math.A.crossProduct([1,this.evalParam(2),this.evalParam(3)],[1,this.evalParam(0),this.evalParam(1)])),t=r[1],e=r[2],s=(o=[-(o=r[0])*t,-o*e,t*t+e*e])[2],i=o[0]/o[2],o=o[1]/o[2],t=-r[2],e=r[1],this.matrix[1][1]=(t*t-e*e)/s,this.matrix[1][2]=2*t*e/s,this.matrix[2][1]=this.matrix[1][2],this.matrix[2][2]=-this.matrix[1][1],this.matrix[1][0]=i*(1-this.matrix[1][1])-o*this.matrix[1][2],this.matrix[2][0]=o*(1-this.matrix[2][2])-i*this.matrix[2][1]};else if("rotate"===e)3===n.length?this.evalParam=utils_type.A.createEvalFunction(t,n,3):0<n.length&&n.length<=2&&(this.evalParam=utils_type.A.createEvalFunction(t,n,1),2!==n.length||utils_type.A.isArray(n[1])||(n[1]=t.select(n[1]))),this.update=function(){var t,e,i=this.evalParam(0),s=Math.cos(i),i=Math.sin(i);this.matrix[1][1]=s,this.matrix[1][2]=-i,this.matrix[2][1]=i,this.matrix[2][2]=s,1<n.length&&(e=3===n.length?(t=this.evalParam(1),this.evalParam(2)):utils_type.A.isArray(n[1])?(t=n[1][0],n[1][1]):(t=n[1].X(),n[1].Y()),this.matrix[1][0]=t*(1-s)+e*i,this.matrix[2][0]=e*(1-s)-t*i)};else if("shear"===e){if(2!==n.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,n,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("generic"===e){if(9!==n.length)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=utils_type.A.createEvalFunction(t,n,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)}}},apply:function(t,e){return this.update(),utils_type.A.exists(e)?math.A.matVecMult(this.matrix,t.initialCoords.usrCoords):math.A.matVecMult(this.matrix,t.coords.usrCoords)},applyOnce:function(t){for(var e,i=(t=utils_type.A.isArray(t)?t:[t]).length,s=0;s<i;s++)this.update(),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)},setProperty:function(t){jxg.A.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){for(var e,i,s,r=[],o=t.matrix.length,n=this.matrix[0].length,a=0;a<o;a++)r[a]=[];for(this.update(),t.update(),a=0;a<o;a++)for(s=0;s<n;s++){for(e=i=0;e<o;e++)i+=t.matrix[a][e]*this.matrix[e][s];r[a][s]=i}return this.update=function(){var t=this.matrix.length,e=this.matrix[0].length;for(a=0;a<t;a++)for(s=0;s<e;s++)this.matrix[a][s]=r[a][s]},this},getParents:function(){var t=[[].concat.apply([],this.matrix)];return t=0!==this.parents.length?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.Transformation),turtle=(jxg.A.Turtle=function(t,e,i){var s;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,i=90,(s=t=0)!==e.length&&(3===e.length?(t=e[0],s=e[1],i=e[2]):2===e.length?utils_type.A.isArray(e[0])?(t=e[0][0],s=e[0][1],i=e[1]):(t=e[0],s=e[1]):(t=e[0][0],s=e[0][1])),this.init(t,s,i),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),t=t*Math.sin(this.dir*Math.PI/180);return this.turtleIsHidden||((e=this.board.create("transform",[i,t],{type:"translate"})).applyOnce(this.turtle),e.applyOnce(this.turtle2)),this.isPenDown&&8192<=this.curve.dataX.length&&(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]+=t,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){return this.dir-=t,this.dir%=360,this.turtleIsHidden||this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2),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(){for(var t,e=0;e<this.objects.length;e++)(t=this.objects[e]).type===constants.A.OBJECT_TYPE_CURVE&&(this.board.removeObject(t),this.objects.splice(e,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(){for(var t,e=this.objects.length,i=0;i<e;i++)t=this.objects[i],this.board.removeObject(t);return 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=this.objects.length;return utils_type.A.evaluate(this.objects[4===e?0:e-1].visProp[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){for(var e,i,s=this.objects.length,r=0;r<s;r++)(e=this.objects[r]).type===constants.A.OBJECT_TYPE_CURVE&&e.setAttribute(t);return i=this.visProp.id,this.visProp=utils_type.A.deepCopy(this.curve.visProp),this.visProp.id=i,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;return utils_type.A.isArray(t)?(e=this.pos[0],i=this.pos[1],s=t[0],r=t[1],r=Math.atan2(r-i,s-e),this.right(this.dir-180*r/Math.PI)):utils_type.A.isNumber(t)&&this.right(this.dir-t),this},moveTo:function(t){var e,i;return utils_type.A.isArray(t)&&(i=t[0]-this.pos[0],e=t[1]-this.pos[1],this.turtleIsHidden||((i=this.board.create("transform",[i,e],{type:"translate"})).applyOnce(this.turtle),i.applyOnce(this.turtle2)),this.isPenDown&&8192<=this.curve.dataX.length&&(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){for(var i,s=this.objects.length,r=0,o=0;r<s;r++)if((i=this.objects[r]).elementClass===constants.A.OBJECT_CLASS_CURVE){if(o<=t&&t<o+i.numberPoints)return i[e](t-o);o+=i.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(){for(var t=this.objects.length,e=0,i=0;i<t;i++)this.objects[i].elementClass===constants.A.OBJECT_CLASS_CURVE&&(e+=this.objects[i].numberPoints);return e},hasPoint:function(t,e){for(var i,s=0;s<this.objects.length;s++)if((i=this.objects[s]).type===constants.A.OBJECT_TYPE_CURVE&&i.hasPoint(t,e))return!0;return!1}}),jxg.A.createTurtle=function(t,e,i){return e=e||[],i=utils_type.A.copyAttributes(i,t.options,"turtle"),new jxg.A.Turtle(t,e,i)},jxg.A.registerElement("turtle",jxg.A.createTurtle),jxg.A.Turtle),ticks=(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=this.ticks&&this.ticks.length||0,n=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint;if(n+=.5*utils_type.A.evaluate(this.visProp.strokewidth),!utils_type.A.evaluate(this.line.visProp.scalable)||this.line.elementClass===constants.A.OBJECT_CLASS_CURVE)return!1;if(0!==this.line.stdform[1]&&0!==this.line.stdform[2]&&this.line.type!==constants.A.OBJECT_TYPE_AXIS)return!1;for(i=0;i<o;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)&&(1<=Math.abs(s[0][0]-s[0][1])||1<=Math.abs(s[1][0]-s[1][1])))if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*n&&s[0][0]-n<t&&t<s[0][1]+n)return!0}else if(0===this.line.stdform[2]&&Math.abs(t-this.line.point1.coords.scrCoords[1])<2*n&&s[1][0]-n<e&&e<s[1][1]+n)return!0;return!1},setPositionDirectly:function(t,e,i){var s,e=new base_coords.A(t,e,this.board),t=new base_coords.A(t,i,this.board),i=this.board.getBoundingBox();return this.line.type===constants.A.OBJECT_TYPE_AXIS&&utils_type.A.evaluate(this.line.visProp.scalable)&&(Math.abs(this.line.stdform[1])<math.A.eps&&Math.abs(e.usrCoords[1]*t.usrCoords[1])>math.A.eps?(s=t.usrCoords[1]/e.usrCoords[1],i[0]*=s,i[2]*=s,this.board.setBoundingBox(i,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])<math.A.eps&&Math.abs(e.usrCoords[2]*t.usrCoords[2])>math.A.eps&&(s=t.usrCoords[2]/e.usrCoords[2],i[3]*=s,i[1]*=s,this.board.setBoundingBox(i,this.board.keepaspectratio,"update"))),this},calculateTicksCoordinates:function(){var t,e,i;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"===utils_type.A.evaluate(this.visProp.type)&&(i=this.board.getBoundingBox(),i=Math.max(math.A.hypot(i[0],i[1]),math.A.hypot(i[2],i[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=.5*utils_type.A.evaluate(this.visProp.majorheight),o=.5*utils_type.A.evaluate(this.visProp.minorheight);utils_type.A.exists(t)?(e=this.line.minX(),i=this.line.maxX(),(s=this.line.points.length)<2?(this.dxMaj=0,this.dyMaj=0):math.A.relDif(t,e)<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,i)<math.A.eps?(this.dxMaj=this.line.points[s-2].usrCoords[2]-this.line.points[s-1].usrCoords[2],this.dyMaj=this.line.points[s-1].usrCoords[1]-this.line.points[s-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*=r/e*this.board.unitX,this.dyMaj*=r/e*this.board.unitY,this.dxMin*=o/e*this.board.unitX,this.dyMin*=o/e*this.board.unitY,this.minStyle=utils_type.A.evaluate(this.visProp.minorheight)<0?"infinite":"finite",this.majStyle=utils_type.A.evaluate(this.visProp.majorheight)<0?"infinite":"finite"},getZeroCoordinates:function(){var t,e,i,s,r,o,n=utils_type.A.evaluate(this.visProp.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):(o=this.line.point1.coords.usrCoords[0],t=this.line.point1.coords.usrCoords[1],e=this.line.point1.coords.usrCoords[2],r=this.line.point2.coords.usrCoords[0],i=this.line.point2.coords.usrCoords[1],s=this.line.point2.coords.usrCoords[2],"right"===n?this.line.point2.coords:"middle"===n?new base_coords.A(constants.A.COORDS_BY_USER,[.5*(o+r),.5*(t+i),.5*(e+s)],this.board):utils_type.A.isNumber(n)?new base_coords.A(constants.A.COORDS_BY_USER,[o+(r-o)*n,t+(i-t)*n,e+(s-e)*n],this.board):this.line.point1.coords):(r=this.line.minX(),o=this.line.maxX(),"right"===n?o:"middle"===n?.5*(r+o):utils_type.A.isNumber(n)?r*(1-n)+o*n:r)},getLowerAndUpperBounds:function(t,e){var i,s,r,o,n,a,l,h,u,c,d,p=10*math.A.eps,_=utils_type.A.evaluate(this.line.visProp.straightfirst),f=utils_type.A.evaluate(this.line.visProp.straightlast),A=utils_type.A.evaluate(this.visProp.includeboundaries);return this.line.elementClass===constants.A.OBJECT_CLASS_CURVE?{lower:this.line.minX(),upper:this.line.maxX()}:(r=new base_coords.A(constants.A.COORDS_BY_USER,this.line.point1.coords.usrCoords,this.board),o=new base_coords.A(constants.A.COORDS_BY_USER,this.line.point2.coords.usrCoords,this.board),n=Math.abs(r.usrCoords[0])>=math.A.eps&&0<=r.scrCoords[1]&&r.scrCoords[1]<=this.board.canvasWidth&&0<=r.scrCoords[2]&&r.scrCoords[2]<=this.board.canvasHeight,a=Math.abs(o.usrCoords[0])>=math.A.eps&&0<=o.scrCoords[1]&&o.scrCoords[1]<=this.board.canvasWidth&&0<=o.scrCoords[2]&&o.scrCoords[2]<=this.board.canvasHeight,utils_type.A.exists(e)&&"ticksdistance"===e?(geometry.A.calcStraight(this.line,r,o,0),c=this.getDistanceFromZero(t,r),d=this.getDistanceFromZero(t,o),geometry.A.calcStraight(this.line,r,o,utils_type.A.evaluate(this.line.visProp.margin)),c=this.getDistanceFromZero(t,r)-c,d=this.getDistanceFromZero(t,o).m2):geometry.A.calcLineDelimitingPoints(this.line,r,o),e=utils_type.A.evaluate(this.line.visProp.firstarrow),l=utils_type.A.evaluate(this.line.visProp.lastarrow),h=this.getDistanceFromZero(t,r),u=this.getDistanceFromZero(t,o),(e||l)&&(e=this.board.renderer.getArrowHeadData(this.line,utils_type.A.evaluate(this.line.visProp.strokewidth),""),this.board.renderer.getPositionArrowHead(this.line,r,o,e)),(l=this.getDistanceFromZero(t,r))<(e=this.getDistanceFromZero(t,o))?(i=l,s=e,_||!n||A||(i+=p),f||!a||A||(s-=p)):e<l?(i=e,s=l,f||!a||A||(i+=p),_||!n||A||(s-=p)):s=i=0,{lower:i,upper:s,a1:l-h,a2:l-u,m1:c,m2:d})},getDistanceFromZero:function(t,e){var i=this.line.point1.coords,s=this.line.point2.coords,r=t.distance(constants.A.COORDS_BY_USER,e),s=[s.usrCoords[0]-i.usrCoords[0],s.usrCoords[1]-i.usrCoords[1],s.usrCoords[2]-i.usrCoords[2]],i=[e.usrCoords[0]-t.usrCoords[0],e.usrCoords[1]-t.usrCoords[1],e.usrCoords[2]-t.usrCoords[2]];return math.A.innerProduct(s,i,3)<0&&(r*=-1),r},generateEquidistantTicks:function(t,e){var i,s,r=math.A.eps,o=utils_type.A.evaluate(this.visProp.minorticks),n=this.getDistanceMajorTicks();if(this.line.elementClass===constants.A.OBJECT_CLASS_LINE&&(s=this.getXandYdeltas()),n*=utils_type.A.evaluate(this.visProp.scale),!((this.ticksDelta=n/=o+1)<math.A.eps)){for(i=0,utils_type.A.evaluate(this.visProp.drawzero)||(i=n);i<=e.upper+r&&(i>=e.lower-r&&this.processTickPosition(t,i,n,s),!(e.upper-(i+=n)>1e4*n)););for(i=-n;i>=e.lower-r&&(i<=e.upper+r&&this.processTickPosition(t,i,n,s),!((i-=n)-e.lower>1e4*n)););}},getDistanceMajorTicks:function(){var t,e,i,s;return utils_type.A.evaluate(this.visProp.insertticks)?(e=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/6/(i=utils_type.A.evaluate(this.visProp.scale)),i=utils_type.A.evaluate(this.visProp.minticksdistance)/i,s=utils_type.A.evaluate(this.visProp.minorticks),(t=this.getXandYdeltas()).x*=this.board.unitX,t.y*=this.board.unitY,i=i/math.A.hypot(t.x,t.y)*(s+1),2*(t=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)))>=i?t*=2:i<=5*t&&(t*=5),5*(s=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)))<e?s*=5:2*s<e&&(s*=2),Math.max(t,s)):utils_type.A.evaluate(this.visProp.ticksdistance)},processTickPosition:function(t,e,i,s){var r=utils_type.A.evaluate(this.visProp.ticksperlabel),o=null,s=this.line.elementClass===constants.A.OBJECT_CLASS_LINE?(n=t.usrCoords[1]+e*s.x,t.usrCoords[2]+e*s.y):(n=this.line.X(t+e),this.line.Y(t+e)),n=new base_coords.A(constants.A.COORDS_BY_USER,[n,s],this.board);this.line.elementClass===constants.A.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(o=t+e),n.major=Math.round(e/i)%(utils_type.A.evaluate(this.visProp.minorticks)+1)==0,r=r||utils_type.A.evaluate(this.visProp.minorticks)+1,s=Math.round(e/i)%r==0,3===(e=this.createTickPath(n,n.major)).length&&(this.ticks.push(e),s&&utils_type.A.evaluate(this.visProp.drawlabels)?this.labelsData.push(this.generateLabelData(this.generateLabelText(n,t,o),n,this.ticks.length)):this.labelsData.push(null))},generateFixedTicks:function(t,e){var i,s,r,o,n,a,l=math.A.eps,h=utils_type.A.isArray(this.visProp.labels),u=utils_type.A.evaluate(this.visProp.drawlabels);for(this.line.elementClass===constants.A.OBJECT_CLASS_LINE&&(a=this.getXandYdeltas()),i=0;i<this.fixedTicks.length;i++)o=this.line.elementClass===constants.A.OBJECT_CLASS_LINE?(n=this.fixedTicks[i],r=t.usrCoords[1]+n*a.x,t.usrCoords[2]+n*a.y):(n=t+this.fixedTicks[i],r=this.line.X(n),this.line.Y(n)),o=new base_coords.A(constants.A.COORDS_BY_USER,[r,o],this.board),this.line.elementClass===constants.A.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(n),3===(s=this.createTickPath(o,!0)).length&&n>=e.lower-l&&n<=e.upper+l&&(this.ticks.push(s),u&&(h||utils_type.A.exists(this.visProp.labels[i]))?(s=h?utils_type.A.evaluate(this.visProp.labels[i]):n,this.labelsData.push(this.generateLabelData(this.generateLabelText(o,t,s),o,i))):this.labelsData.push(null))},getXandYdeltas:function(){var t,e=this.line.point1.Dist(this.line.point2),i=this.line.point1.coords.usrCoords;return{x:((t=this.line.point2.coords.usrCoords)[1]-i[1])/e,y:(t[2]-i[2])/e}},_isInsideCanvas:function(t,e,i){var s=this.board.canvasWidth,r=this.board.canvasHeight;return t[0]>=(i=void 0===i?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,l,h,u,c=[-2e6,-2e6],d=[-2e6,-2e6],p=t.scrCoords,_=e?(i=this.dxMaj,s=this.dyMaj,r=this.majStyle,h=0<utils_type.A.evaluate(this.visProp.majortickendings[0]),0<utils_type.A.evaluate(this.visProp.majortickendings[1])):(i=this.dxMin,s=this.dyMin,r=this.minStyle,h=0<utils_type.A.evaluate(this.visProp.tickendings[0]),0<utils_type.A.evaluate(this.visProp.tickendings[1])),f=[-s*p[1]-i*p[2],s,i];if(e&&"polar"===utils_type.A.evaluate(this.visProp.type)){if(u=this.board.getBoundingBox(),l=(a=2*Math.PI)/180,p=t.usrCoords,(n=math.A.hypot(p[1],p[2]))<Math.max(math.A.hypot(u[0],u[1]),math.A.hypot(u[2],u[3]))){for(c=[],d=[],o=0;o<=a;o+=l)c.push(this.board.origin.scrCoords[1]+n*Math.cos(o)*this.board.unitX),d.push(this.board.origin.scrCoords[2]+n*Math.sin(o)*this.board.unitY);return[c,d,e]}}else{if("infinite"===r){if(utils_type.A.evaluate(this.visProp.ignoreinfinitetickendings)&&(h=_=!0),t=geometry.A.meetLineBoard(f,this.board),h&&_)c[0]=t[0].scrCoords[1],c[1]=t[1].scrCoords[1],d[0]=t[0].scrCoords[2],d[1]=t[1].scrCoords[2];else if((u=[math.A.innerProduct(t[0].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0],math.A.innerProduct(t[1].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0]])[0]<u[1]&&(t.reverse(),u.reverse()),h){if(u[0]<0)return[];u[1]<0?(c[0]=t[0].scrCoords[1],d[0]=t[0].scrCoords[2],c[1]=p[1],d[1]=p[2]):(c[0]=t[0].scrCoords[1],d[0]=t[0].scrCoords[2],c[1]=t[1].scrCoords[1],d[1]=t[1].scrCoords[2])}else if(_){if(0<u[1])return[];0<u[0]?(c[0]=p[1],d[0]=p[2]):(c[0]=t[0].scrCoords[1],d[0]=t[0].scrCoords[2]),c[1]=t[1].scrCoords[1],d[1]=t[1].scrCoords[2]}}else r=">"===utils_type.A.evaluate(this.visProp.face)?Math.PI/4:"<"===utils_type.A.evaluate(this.visProp.face)?-Math.PI/4:0,f=Math.cos(r)*i-Math.sin(r)*s,u=Math.sin(r)*i+Math.cos(r)*s,c[0]=p[1]+f*h,d[0]=p[2]-u*h,c[1]=p[1],d[1]=p[2],r=-r,f=Math.cos(r)*i-Math.sin(r)*s,u=Math.sin(r)*i+Math.cos(r)*s,c[2]=p[1]-f*_,d[2]=p[2]+u*_;if(this._isInsideCanvas(c,d))return[c,d,e]}return[]},formatLabelText:function(t){var e,i=utils_type.A.evaluate(this.visProp.label.usemathjax),s=utils_type.A.evaluate(this.visProp.label.usekatex),r=utils_type.A.evaluate(this.visProp.scalesymbol);return utils_type.A.isNumber(t)?(utils_type.A.evaluate(this.visProp.label.tofraction)?e=i?"\\("+utils_type.A.toFraction(t,!0)+"\\)":utils_type.A.toFraction(t,s):(i=utils_type.A.evaluate(this.visProp.digits),this.useLocale()?e=this.formatNumberLocale(t,i):((e=(Math.round(1e11*t)/1e11).toString()).length>utils_type.A.evaluate(this.visProp.maxlabellength)||-1!==e.indexOf("e"))&&(3!==utils_type.A.evaluate(this.visProp.precision)&&3===i&&(i=utils_type.A.evaluate(this.visProp.precision)),e=t.toExponential(i).toString())),-1<(e=utils_type.A.evaluate(this.visProp.beautifulscientificticklabels)?this.beautifyScientificNotationLabel(e):e).indexOf(".")&&-1===e.indexOf("e")&&(e=(e=e.replace(/0+$/,"")).replace(/\.$/,""))):e=t.toString(),0<r.length&&("1"===e?e=r:"-1"===e?e="-"+r:"0"!==e&&(e+=r)),e=utils_type.A.evaluate(this.visProp.useunicodeminus)?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){return"•10"+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){if(!utils_type.A.exists(i)){if(e=this.getDistanceFromZero(e,t),Math.abs(e)<math.A.eps)return"0";i=e/utils_type.A.evaluate(this.visProp.scale)}return this.formatLabelText(i)},generateLabelData:function(t,e,i){var s=utils_type.A.evaluate(this.visProp.label.fontsize),r=[e.scrCoords[1],e.scrCoords[1]],o=[e.scrCoords[2],e.scrCoords[2]],s=void 0===s?12:s;return this._isInsideCanvas(r,o,s*=.5)?(r=utils_type.A.evaluate(this.visProp.label.offset[0]),o=utils_type.A.evaluate(this.visProp.label.offset[1]),{x:e.usrCoords[1]+r/this.board.unitX,y:e.usrCoords[2]+o/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},updateRendererLabels:function(){for(var t,e,i,s=this.labelsData.length,r=this.labels.length,o=0,n=0;o<s;o++)null!==this.labelsData[o]&&(i=this.labelsData[o],n<r?((e=this.labels[n]).setText(i.t),e.setCoords(i.x,i.y),n++):(this.labelCounter+=1,t={isLabel:!0,layer:this.board.options.layer.line,highlightStrokeColor:this.board.options.text.strokeColor,highlightStrokeWidth:this.board.options.text.strokeWidth,highlightStrokeOpacity:this.board.options.text.strokeOpacity,priv:this.visProp.priv},(t=utils_type.A.deepCopy(t,this.visProp.label)).id=this.id+i.i+"Label"+this.labelCounter,e=jxg.A.createText(this.board,[i.x,i.y,i.t],t),this.addChild(e),e.setParents(this),e.isDraggable=!1,e.dump=!1,this.labels.push(e)),"inherit"===(i=utils_type.A.evaluate(this.visProp.label.visible))&&(i=this.visPropCalc.visible),e.prepareUpdate().updateVisibility(i).updateRenderer(),e.distanceX=utils_type.A.evaluate(this.visProp.label.offset[0]),e.distanceY=utils_type.A.evaluate(this.visProp.label.offset[1]));for(n=s=n;n<r;n++)this.board.renderer.display(this.labels[n],!1),this.labels[n].visProp.visible=this.labels[n].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 i=utils_type.A.copyAttributes(i,t.options,"ticks"),t=e.length<2?i.ticksdistance:e[1];if(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 t=new jxg.A.Ticks(e[0],t,i),utils_type.A.isFunction(i.generatelabelvalue)&&(t.generateLabelText=i.generatelabelvalue),utils_type.A.isFunction(i.generatelabeltext)&&(t.generateLabelText=i.generatelabeltext),t.setParents(e[0]),t.isDraggable=!0,t.fullUpdate(e[0].visPropCalc.visible),t},jxg.A.createHatchmark=function(t,e,i){var s,r,o,n,a=[],i=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=i.ticksdistance)),r=0;r<s;r++)a[r]=o+r*n;return(t=t.create("ticks",[e[0],a],i)).elType="hatch",e[0].inherits.push(t),t},jxg.A.registerElement("ticks",jxg.A.createTicks),jxg.A.registerElement("hash",jxg.A.createHatchmark),jxg.A.registerElement("hatch",jxg.A.createHatchmark),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,zip=(jxg.A.Util=jxg.A.Util||{},jxg.A.Util.Unzip=function(t){var n,r,o,a=[],l=0,h=[],_=new Array(32768),f=0,u=!1,e=t.length,i=0,A=1,g=new Array(288),m=new Array(32),c=0,d=null,p=0,y=new Array(17),b=[];function v(){return i<e?t[i++]:-1}function C(){A=1}function x(){var t;try{t=1&A,0==(A>>=1)&&(t=1&(A=v()),A=A>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function P(t){var e=0,i=t;try{for(;i--;)e=e<<1|x();t&&(e=bitReverse[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function E(t){_[f++]=t,a.push(String.fromCharCode(t)),32768===f&&(f=0)}function O(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function M(){for(;;){if(y[p]>=o)return-1;if(r[y[p]]===p)return y[p]++;y[p]++}}function w(t,e,i){var s;for(d=t,r=i,o=e,s=c=0;s<17;s++)y[s]=0;return p=0,function t(){var e,i=d[c];if(17===p)return 1;if(c++,p++,0<=(e=M()))i.b0=e;else if(i.b0=32768,t())return 1;if(0<=(e=M()))i.b1=e,i.jump=null;else if(i.b1=32768,i.jump=d[c],i.jumppos=c,t())return 1;return p--,0}()&&-1}function S(t){for(var e,i,s=0,r=t[s];;)if(x()){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 T(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p;do{if(t=x(),0===(e=P(2)))for(C(),l=v(),l|=v()<<8,d=v(),65535&(l^~(d|=v()<<8))&&jxg.A.debug("BlockLen checksum mismatch\n");l--;)E(v());else if(1===e)for(;;)if(23<(s=bitReverse[P(7)]>>1)?199<(s=s<<1|x())?s=(s-=128)<<1|x():143<(s-=48)&&(s+=136):s+=256,s<256)E(s);else{if(256===s)break;for(a=P(cplext[s-=257])+cplens[s],s=bitReverse[P(5)]>>3,8<cpdext[s]?(h=P(8),h|=P(cpdext[s]-8)<<8):h=P(cpdext[s]),h+=cpdist[s],s=0;s<a;s++)E(_[f-h&32767])}else if(2===e){for(o=new Array(320),c=257+P(5),d=1+P(5),p=4+P(4),s=0;s<19;s++)o[s]=0;for(s=0;s<p;s++)o[border[s]]=P(3);for(a=m.length,i=0;i<a;i++)m[i]=new O;if(w(m,19,o))return f=0;for(u=c+d,i=0;i<u;)if((s=S(m))<16)o[i++]=s;else if(16===s){if(i+(s=3+P(2))>u)return f=0;for(r=i?o[i-1]:0;s--;)o[i++]=r}else{if(i+(s=17===s?3+P(3):11+P(7))>u)return f=0;for(;s--;)o[i++]=0}for(a=g.length,i=0;i<a;i++)g[i]=new O;if(w(g,c,o))return f=0;for(a=g.length,i=0;i<a;i++)m[i]=new O;for(n=[],i=c;i<o.length;i++)n[i-c]=o[i];if(w(m,d,n))return f=0;for(;;)if(256<=(s=S(g))){if(0==(s-=256))break;for(a=P(cplext[--s])+cplens[s],s=S(m),8<cpdext[s]?(h=P(8),h|=P(cpdext[s]-8)<<8):h=P(cpdext[s]),h+=cpdist[s];a--;)E(_[f-h&32767])}else E(s)}}while(!t);f=0,A=1}function s(){var t,e,i,s,r,o=[];try{if(u=!(a=[]),o[0]=v(),o[1]=v(),120===o[0]&&218===o[1]&&(T(),h[l]=[a.join(""),"geonext.gxt"],l++),31===o[0]&&139===o[1]&&(N(),h[l]=[a.join(""),"file"],l++),80===o[0]&&75===o[1]){if(u=!0,o[2]=v(),o[3]=v(),3===o[2]&&4===o[3]){for(o[0]=v(),o[1]=v(),n=v(),n|=v()<<8,r=v(),r|=v()<<8,v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),v(),s=v(),s|=v()<<8,i=v(),i|=v()<<8,t=0,b=[];s--;)"/"===(e=v())|":"===e?t=0:t<NAMEMAX-1&&(b[t++]=String.fromCharCode(e));for(t=0;t<i;)e=v(),t++;if(8==r&&(T(),h[l]=new Array(2),h[l][0]=a.join(""),h[l][1]=b.join(""),l++),N())return}return 1}}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}}function N(){var t,e,i=[];if(8&n&&(i[0]=v(),i[1]=v(),i[2]=v(),i[3]=v(),80===i[0]&&75===i[1]&&7===i[2]&&8===i[3]?(v(),v(),v(),v()):(i[0],i[1],i[2],i[3]),v(),v(),v(),v(),v(),v(),v(),v()),!u||!s()){if(i[0]=v(),8!==i[0])return 1;if(n=v(),v(),v(),v(),v(),v(),v(),4&n)for(i[0]=v(),i[2]=v(),p=i[0]+256*i[1],t=0;t<p;t++)v();if(8&n)for(t=0,b=[],e=v();e;)(t="7"!==e&&":"!==e?t:0)<NAMEMAX-1&&(b[t++]=e),e=v();if(16&n)for(e=v();e;)e=v();return 2&n&&(v(),v()),T(),v(),v(),v(),v(),v(),v(),v(),v(),u&&s(),0}}y[0]=0,jxg.A.Util.Unzip.prototype.unzipFile=function(t){var e;for(this.unzip(),e=0;e<h.length;e++)if(h[e][1]===t)return h[e][0];return""},jxg.A.Util.Unzip.prototype.unzip=function(){return s(),h}},jxg.A.Util),ca=(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,l,h,u,c,d;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&&"op_execfun"===t.value&&t.children[0]&&"D"===t.children[0].value){if(d=!1,"node_var"==t.children[1][0].type&&(l=t.children[1][0].value,null!==(l=this.findMapNode(l,i))&&(d=!0)),d?(u=l.children[0],h=2<=t.children[1].length?t.children[1][1].value:l.children[0][0],n=l.children[1]):(n=t.children[1][0],u=["x"],h=2<=t.children[1].length?t.children[1][1].value:"x"),a=n,1<=(c=3<=t.children[1].length?t.children[1][2].value:1))for(;1<=c;)a=this.derivative(a,h),a=this.removeTrivialNodes(a),c--;d="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",u,a):a,this.setMath(d),t.type=d.type,t.value=d.value,0<d.children.length&&(t.children[0]=d.children[0]),1<d.children.length&&(t.children[1]=d.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)for(this.mayNotBeSimplified=!1;t.children[e]=this.removeTrivialNodes(t.children[e]),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 0<s.value?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}}),jxg.A.CA),dump=(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=(e=utils_type.A.isArray(e)?e:[e]).length;for(i in e.length=r,t.objects)if(t.objects.hasOwnProperty(i))for(s=0;s<r;s++)delete t.objects[i][e[s]]},str:function(t){return t="string"==typeof t&&"function"!==t.slice(0,7)?'"'+t+'"':t},minimizeObject:function(t,e){for(var i,s,r={},o=utils_type.A.deepCopy(t),n=[],a=1;a<arguments.length;a++)n.push(arguments[a]);for(r=utils_type.A.deepCopy(r,jxg.A.Options.elements,!0),a=n.length;0<a;a--)r=utils_type.A.deepCopy(r,n[a-1],!0);for(i in r)r.hasOwnProperty(i)&&(s=i.toLowerCase(),"object"!=typeof r[i]&&r[i]===o[s]&&delete o[s]);return o},prepareAttributes:function(t,e){var i,s=this.minimizeObject(e.getAttributes(),jxg.A.Options[e.elType]);for(i in e.subs)e.subs.hasOwnProperty(i)&&(s[i]=this.minimizeObject(e.subs[i].getAttributes(),jxg.A.Options[e.elType][i],jxg.A.Options[e.subs[i].elType]),s[i].id=e.subs[i].id,s[i].name=e.subs[i].name);return s.id=e.id,s.name=e.name,s},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){for(var i=[],s=0;s<t.length;s++)i.push(e.call(this,t[s]));return i.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++)0<i[e].attributes.name.length&&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")}},jxg.A.Dump),priv=(jxg.A.createComb=function(t,e,i){var _,f,A,s,r;if(2!==e.length)throw r=e.map(function(t){return"'"+typeof t+"'"}),new Error("JSXGraph: Can't create comb with parent types "+r.join(", ")+".\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");if(utils_type.A.isArray(e[0])&&1<e[0].length)s=utils_type.A.copyAttributes(i,t.options,"comb","point1"),_=t.create("point",e[0],s);else if(utils_type.A.isString(e[0])||utils_type.A.isPoint(e[0]))_=t.select(e[0]);else if(utils_type.A.isFunction(e[0])&&utils_type.A.isPoint(e[0]()))_=e[0]();else{if(!(utils_type.A.isFunction(e[0])&&e[0]().length&&2<=e[0]().length))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]]");s=utils_type.A.copyAttributes(i,t.options,"comb","point1"),_=jxg.A.createPoint(t,e[0](),s)}if(utils_type.A.isArray(e[1])&&1<e[1].length)s=utils_type.A.copyAttributes(i,t.options,"comb","point2"),f=t.create("point",e[1],s);else if(utils_type.A.isString(e[1])||utils_type.A.isPoint(e[1]))f=t.select(e[1]);else if(utils_type.A.isFunction(e[1])&&utils_type.A.isPoint(e[1]()))f=e[1]();else{if(!(utils_type.A.isFunction(e[1])&&e[1]().length&&2<=e[1]().length))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]]");s=utils_type.A.copyAttributes(i,t.options,"comb","point2"),f=jxg.A.createPoint(t,e[1](),s)}return s=utils_type.A.copyAttributes(i,t.options,"comb"),(A=t.create("curve",[[0],[0]],s)).updateDataArray=function(){var t,e,i,s,r,o,n,a=0,l=_.Dist(f),h=_,u=f,c=utils_type.A.evaluate(A.visProp.frequency),d=-utils_type.A.evaluate(A.visProp.angle),p=utils_type.A.evaluate(A.visProp.width);for(utils_type.A.evaluate(A.visProp.reverse)&&(h=f,u=_,d=-d),t=Math.cos(d),e=Math.sin(d),i=(u.X()-h.X())/l,s=(u.Y()-h.Y())/l,t*=p/Math.abs(e),e*=p/Math.abs(e),this.dataX=[],this.dataY=[];a<l;)r=h.X()+i*a,o=h.Y()+s*a,e*=n=Math.min(t,l-a)/Math.abs(t),t*=n,this.dataX.push(r),this.dataY.push(o),this.dataX.push(r+i*t+s*e),this.dataY.push(o-i*e+s*t),this.dataX.push(NaN),this.dataY.push(NaN),a+=c},A},jxg.A.registerElement("comb",jxg.A.createComb),{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()}}),checkbox_priv=(jxg.A.createSlopeTriangle=function(t,e,i){var s,r,o,n,a,l,h,u,c=!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),c=!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"),e=t.create("point",[function(){return[o.X()+1,o.Y()]}],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","baseline"),l=t.create("line",[o,e],u),u=utils_type.A.copyAttributes(i,t.options,"slopetriangle","glider"),n=t.create("glider",[o.X()+1,o.Y(),l],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=c,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",(h=t.create("text",[0,0,function(){return""}],u)).needsUpdate=!0,h.dump=!1,s.borders[1].label=h,s.borders[1].hasLabel=!0,s.borders[1].visProp.withlabel=!0,h._setText(function(){var t=utils_type.A.evaluate(h.visProp.digits);return h.useLocale()?h.formatNumberLocale(s.Value(),t):utils_type.A.toFixed(s.Value(),t)}),h.fullUpdate(),s.glider=n,s.basepoint=e,s.baseline=l,s.toppoint=a,s.label=h,s.subs={glider:n,basePoint:e,baseLine:l,topPoint:a,label:h},s.inherits.push(n,e,l,a,h),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),{CheckboxChangeEventHandler:function(){this._value=this.rendNodeCheckbox.checked,this.board.update()}}),input_priv=(jxg.A.createCheckbox=function(t,e,i){var i=utils_type.A.copyAttributes(i,t.options,"checkbox"),s=[e[0],e[1],'<span style="display:inline"><input type="checkbox" /><label for=""></label></span>'];return(s=t.create("text",s,i)).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=!!i.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=i.checked,s._value=i.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),{InputInputEventHandler:function(t){this._value=this.rendNodeInput.value,this.board.update()}}),button_priv=(jxg.A.createInput=function(t,e,i){var i=utils_type.A.copyAttributes(i,t.options,"input"),s=[e[0],e[1],'<span style="display:inline; white-space:nowrap; padding:0px;"><span></span><input type="text" maxlength="'+i.maxlength+'" style="width:100%"/></span>'];return(s=t.create("text",s,i)).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=!!i.disabled,s.rendNodeLabel.id=s.rendNode.id+"_label",s.rendNodeInput.id=s.rendNode.id+"_input",s.setText(e[3]),s._value=e[2],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),{ButtonClickEventHandler:function(){this._handler&&this._handler(),this.board.update()}}),foreignobject=(jxg.A.createButton=function(t,e,i){var s,i=utils_type.A.copyAttributes(i,t.options,"button"),r=[e[0],e[1],'<button type="button" style="width:100%;"></button>'];return(s=t.create("text",r,i)).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=!!i.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(y,t,e){var r;if(3<=t.length&&(utils_type.A.isArray(t[0])||utils_type.A.isFunction(t[0])||utils_type.A.isString(t[0]))&&utils_type.A.isArray(t[1])&&3===t[1].length&&utils_type.A.isArray(t[2])&&3===t[2].length)return e=utils_type.A.copyAttributes(e,y.options,"vectorfield"),(r=y.create("curve",[[],[]],e)).elType="vectorfield",r.setF=function(t,e){var i,s;return utils_type.A.isArray(t)?(i=utils_type.A.createFunction(t[0],this.board,e),s=utils_type.A.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),s(t,e)]}):this.F=utils_type.A.createFunction(t,r.board,e),this},r.setF(t[0],"x, y"),r.xData=t[1],r.yData=t[2],r.updateDataArray=function(){var t,e,i,s,r,o,n,a,l,h,u,c=utils_type.A.evaluate(this.visProp.scale),d=utils_type.A.evaluate(this.xData[0]),p=utils_type.A.evaluate(this.xData[1]),_=(utils_type.A.evaluate(this.xData[2])-d)/p,f=utils_type.A.evaluate(this.yData[0]),A=utils_type.A.evaluate(this.yData[1]),g=(utils_type.A.evaluate(this.yData[2])-f)/A,m=utils_type.A.evaluate(this.visProp.arrowhead.enabled);for(m&&(l=(a=utils_type.A.evaluate(this.visProp.arrowhead.size))/y.unitX,h=a/y.unitY,u=utils_type.A.evaluate(this.visProp.arrowhead.angle)),this.dataX=[],this.dataY=[],i=0,t=d;i<=p;t+=_,i++)for(s=0,e=f;s<=A;e+=g,s++)(r=this.F(t,e))[0]*=c,r[1]*=c,utils_type.A.concat(this.dataX,[t,t+r[0],NaN]),utils_type.A.concat(this.dataY,[e,e+r[1],NaN]),m&&0<Math.abs(r[0])+Math.abs(r[1])&&(o=(n=Math.atan2(r[1],r[0]))+u,n=n-u,utils_type.A.concat(this.dataX,[t+r[0]-Math.cos(o)*l,t+r[0],t+r[0]-Math.cos(n)*l,NaN]),utils_type.A.concat(this.dataY,[e+r[1]-Math.sin(o)*h,e+r[1],e+r[1]-Math.sin(n)*h,NaN]))},r.methodMap=utils_type.A.deepCopy(r.methodMap,{setF:"setF"}),r;throw new Error("JSXGraph: Can't create vector field with parent types '"+typeof t[0]+"', '"+typeof t[1]+"', '"+typeof t[2]+"'.")},jxg.A.registerElement("vectorfield",jxg.A.createVectorField),jxg.A.createSlopeField=function(t,e,i){var s,r;if(3<=e.length&&(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)return r=utils_type.A.createFunction(e[0],t,"x, y"),e[0]=function(t,e){t=r(t,e),e=Math.sqrt(1+t*t);return[1/e,t/e]},i=utils_type.A.copyAttributes(i,t.options,"slopefield"),(s=t.create("vectorfield",e,i)).elType="slopefield",s.setF=function(t,e){var i=utils_type.A.createFunction(t,s.board,e);this.F=function(t,e){t=i(t,e),e=Math.sqrt(1+t*t);return[1/e,t/e]}},s.methodMap=utils_type.A.deepCopy(s.methodMap,{setF:"setF"}),s;throw new Error("JSXGraph: Can't create slope field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.")},jxg.A.registerElement("slopefield",jxg.A.createSlopeField),jxg.A.createSmartLabel=function(t,e,i){var h,s,u,c,r;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 u=e[0],c=e[1]||"",u.elementClass===constants.A.OBJECT_CLASS_POINT?s=utils_type.A.copyAttributes(i,t.options,"smartlabelpoint"):u.elementClass===constants.A.OBJECT_CLASS_LINE?((s=utils_type.A.copyAttributes(i,t.options,"smartlabelline")).rotate=function(){return 180*Math.atan(u.getSlope())/Math.PI},s.visible=function(){return!(u.L()<1.5)}):u.elementClass===constants.A.OBJECT_CLASS_CIRCLE?(s=utils_type.A.copyAttributes(i,t.options,"smartlabelcircle")).visible=function(){return!(u.Radius()<1.5)}:u.type===constants.A.OBJECT_TYPE_POLYGON?s=utils_type.A.copyAttributes(i,t.options,"smartlabelpolygon"):u.type===constants.A.OBJECT_TYPE_ANGLE&&((s=utils_type.A.copyAttributes(i,t.options,"smartlabelangle")).rotate=function(){var t=u.center.coords.usrCoords,e=u.getLabelAnchor().usrCoords,e=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return 90<e&&e<270?180+e:e},s.anchorX=function(){var t=u.center.coords.usrCoords,e=u.getLabelAnchor().usrCoords,e=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return 90<e&&e<270?"right":"left"}),e=function(n,t,e,i){var a;switch(i){case"length":a=function(){return t.L()};break;case"slope":a=function(){return t.Slope()};break;case"area":a=function(){return t.Area()};break;case"radius":a=function(){return t.Radius()};break;case"perimeter":a=function(){return t.Perimeter()};break;case"rad":a=function(){return t.Value()};break;case"deg":a=function(){return 180*t.Value()/Math.PI};break;default:a=function(){return 0}}return function(){var t=utils_type.A.evaluate(c),e=utils_type.A.evaluate(n.visProp.digits),i=utils_type.A.evaluate(n.visProp.unit),s=utils_type.A.evaluate(n.visProp.prefix),r=utils_type.A.evaluate(n.visProp.suffix),o=utils_type.A.evaluate(n.visProp.usemathjax)||utils_type.A.evaluate(n.visProp.usekatex);return""===t?(e=n.useLocale()?n.formatNumberLocale(a(),e):utils_type.A.toFixed(a(),e),(o?["\\(",s,e,"\\,",i,r,"\\)"]:[s,e,i,r]).join("")):t}},u.elementClass===constants.A.OBJECT_CLASS_POINT?(h=t.create("text",[function(){return u.X()},function(){return u.Y()},""],s),r=function(){var t,e="",i=utils_type.A.evaluate(c),s=utils_type.A.evaluate(h.visProp.digits),r=utils_type.A.evaluate(h.visProp.unit),o=utils_type.A.evaluate(h.visProp.prefix),n=utils_type.A.evaluate(h.visProp.suffix),a=utils_type.A.evaluate(h.visProp.dir),l=utils_type.A.evaluate(h.visProp.usemathjax)||utils_type.A.evaluate(h.visProp.usekatex),s=h.useLocale()?(t=h.formatNumberLocale(u.X(),s),h.formatNumberLocale(u.Y(),s)):(t=utils_type.A.toFixed(u.X(),s),utils_type.A.toFixed(u.Y(),s));return""===i?"row"===a?e=(l?["\\(",o,t,"\\,",r," / ",s,"\\,",r,n,"\\)"]:[o,t," ",r," / ",s," ",r,n]).join(""):0===a.indexOf("col")&&(e=(l?["\\(",o,"\\left(\\array{",t,"\\,",r,"\\\\ ",s,"\\,",r,"}\\right)",n,"\\)"]:[o,t," ",r,"<br/>",s," ",r,n]).join("")):e=i,e}):u.elementClass===constants.A.OBJECT_CLASS_LINE?"length"===s.measure?r=e(h=t.create("text",[function(){return.5*(u.point1.X()+u.point2.X())},function(){return.5*(u.point1.Y()+u.point2.Y())},""],s),u,0,"length"):"slope"===s.measure&&(r=e(h=t.create("text",[function(){return.25*u.point1.X()+.75*u.point2.X()},function(){return.25*u.point1.Y()+.75*u.point2.Y()},""],s),u,0,"slope")):u.elementClass===constants.A.OBJECT_CLASS_CIRCLE?"radius"===s.measure?r=e(h=t.create("text",[function(){return u.center.X()+.5*u.Radius()},function(){return u.center.Y()},""],s),u,0,"radius"):"area"===s.measure?r=e(h=t.create("text",[function(){return u.center.X()},function(){return u.center.Y()+.5*u.Radius()},""],s),u,0,"area"):"circumference"!==s.measure&&"perimeter"!==s.measure||(r=e(h=t.create("text",[function(){return u.getLabelAnchor()},""],s),u,0,"perimeter")):u.type===constants.A.OBJECT_TYPE_POLYGON?"area"===s.measure?r=e(h=t.create("text",[function(){return u.getTextAnchor()},""],s),u,0,"area"):"perimeter"===s.measure&&(r=e(h=t.create("text",[function(){var t=u.borders.length-1;return 0<=t?[.5*(u.borders[t].point1.X()+u.borders[t].point2.X()),.5*(u.borders[t].point1.Y()+u.borders[t].point2.Y())]:u.getTextAnchor()},""],s),u,0,"perimeter")):u.type===constants.A.OBJECT_TYPE_ANGLE&&(r=e(h=t.create("text",[function(){return u.getLabelAnchor()},""],s),u,0,s.measure)),utils_type.A.exists(h)&&(h.setText(r),u.addChild(h),h.setParents([u])),h},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)&&0<r.length&&(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=this.transformations.length,r=utils_type.A.isObject(utils_type.A.evaluate(this.visProp.precision))?(r=this.board._inputDevice,utils_type.A.evaluate(this.visProp.precision[r])):this.board.options.precision.hasPoint;return 0===s?(s=t-this.coords.scrCoords[1],i=this.coords.scrCoords[2]-e,s>=-(r=r)&&s-this.size[0]<=r&&-r<=i&&i-this.size[1]<=r):(i=[(s=new base_coords.A(constants.A.COORDS_BY_SCREEN,[t,e],this.board).usrCoords)[0]-this.span[0][0],s[1]-this.span[0][1],s[2]-this.span[0][2]],0<=(t=(r=math.A.innerProduct)(i,this.span[1]))&&t<=r(this.span[1],this.span[1])&&0<=(t=r(i,this.span[2]))&&t<=r(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateSize()),this},updateRenderer:function(){return this.updateRendererGeneric("updateForeignObject")},updateSize:function(){var t;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 t=0!==this.parents.length?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=e[0],r=e[1],o=[];if(2<=e.length&&(o=e[2]),i=utils_type.A.copyAttributes(i,t.options,"foreignobject"),t=coordselement.A.create(jxg.A.ForeignObject,t,r,i,s,o))return t;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]")},jxg.A.registerElement("foreignobject",jxg.A.createForeignObject),jxg.A.registerElement("fo",jxg.A.createForeignObject),jxg.A.ForeignObject),options3d=(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:""},point2:{visible:!1,name:"",label:{visible:!0}}},circle3d:{point:{visible:!1,name:""}},curve3d:{highlight:!1,tabindex:-1,strokeWidth:1,numberPointsHigh:200},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",point:{visible:!1,name:""},point1:{visible:!1,name:""},point2:{visible:!1,name:""}},mesh3d:{strokeWidth:1,strokeColor:"#9a9a9a",strokeOpacity:.6,highlight:!1,tabindex:null,visible:"inherit"},plane3d:{strokeWidth:0,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#a7a7a7",fillOpacity:.6,point:{visible:!1,name:"",fixed:!0}},point3d:{infoboxDigits:"auto",strokeWidth:0,gradient:"radial",gradientSecondColor:"#555555",fillColor:"yellow",highlightStrokeColor:"#555555",gradientFX:.7,gradientFY:.3},polygon3d:{highlight:!1,tabindex:-1,strokeWidth:1,fillColor:"none"},sphere3d:{highlight:!1,strokeWidth:1,strokeColor:"#00ff80",fillColor:"white",gradient:"radial",gradientSecondColor:"#00ff80",gradientFX:.7,gradientFY:.3,fillOpacity:.4},surface3d:{highlight:!1,tabindex:-1,strokeWidth:1,stepsU:30,stepsV:30},text3d:{},ticks3d:{visible:!0,ticksDistance:1,majorHeight:10,minorTicks:0,tickEndings:[0,1],drawLabels:!0,label:{visible:!0}},vectorfield3d:{scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI}},view3d:{needsRegularUpdate:!0,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:{frozen:!0},point2:{frozen:!0},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:!0},point2:{frozen:!0},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:!0},point2:{frozen:!0},min:-Math.PI,max:Math.PI,start:0}},trackball:{enabled:!1,outside:!0,button:-1,key:"none"},r:"auto",fov:.4*Math.PI,depthOrderPoints:!1,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:24,useKatex:!1,useMathjax:!1},_currentView:-1}}),jxg.A.Options),view3d=(jxg.A.View3D=function(t,e,i){this.constructor(t,i,constants.A.OBJECT_TYPE_VIEW3D,constants.A.OBJECT_CLASS_3D),this.objects={},this.points=this.visProp.depthorderpoints?[]:null,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.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.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 0<t.indexOf("3d")&&s.push(this),this.board.create(t,s.concat(e),i)},select:function(t,e){var i,s,r,o;if(null===t)return t;if(utils_type.A.isString(t)&&""!==t)utils_type.A.exists(this.objects[t])?t=this.objects[t]:utils_type.A.exists(this.elementsByName[t])&&(t=this.elementsByName[t]);else if(!e&&(utils_type.A.isFunction(t)||utils_type.A.isObject(t)&&!utils_type.A.isFunction(t.setAttribute))){for(s={},o=(i=utils_type.A.filterElements(this.objectsList,t)).length,r=0;r<o;r++)s[i[r].id]=i[r];t=new composition(s)}else utils_type.A.isObject(t)&&utils_type.A.exists(t.id)&&!utils_type.A.exists(this.objects[t.id])&&(t=null);return t},setAnglesFromRotation:function(){var t,e=this.matrix3DRot,i=(i=Math.sqrt(e[1][3]*e[1][3]+e[2][3]*e[2][3]))>math.A.eps?(t=e[2][3]/i,e[1][3]/i):(t=Math.cos(this.angles.bank),Math.sin(this.angles.bank)),e=math.A.matMatMult([[1,0,0,0],[0,t,-i,0],[0,i,t,0],[0,0,0,1]],e);this.angles.bank=Math.atan2(i,t),i=e[2][3],t=e[3][3],e=math.A.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,i,t],[0,0,-t,i]],e),this.angles.el=Math.atan2(t,i),t=-e[1][1],i=e[3][1],this.angles.az=Math.atan2(i,t),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=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],e=this.angles.az,i=this.angles.el,s=this.angles.bank,r=-Math.sin(i);return t[1][1]=-Math.cos(e),t[1][2]=Math.sin(e),t[1][3]=0,t[2][1]=r*Math.sin(e),t[2][2]=r*Math.cos(e),t[2][3]=Math.cos(i),t[3][1]=Math.cos(i)*Math.sin(e),t[3][2]=Math.cos(i)*Math.cos(e),t[3][3]=Math.sin(i),r=Math.cos(s),e=Math.sin(s),math.A.matMatMult([[1,0,0,0],[0,r,e,0],[0,-e,r,0],[0,0,0,1]],t)},_projectToSphere:function(t,e,i){e=math.A.hypot(e,i);return e<.7071067811865475*t?Math.sqrt(t*t-e*e):(i=t/1.414213562373095)*i/e},updateProjectionTrackball:function(t){var e,i,s,r,o,n,a=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return utils_type.A.exists(this._trackball)?((r=this._trackball.dx)*r+(o=this._trackball.dy)*o>math.A.eps&&(n=.25*(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY),s=[i=this._trackball.x,e=this._trackball.y,this._projectToSphere(n,i,e)],r=[i-=r,e-=o,this._projectToSphere(n,i,e)],o=math.A.crossProduct(r,s),i=math.A.hypot(o[0],o[1],o[2]),o[0]/=i,o[1]/=i,o[2]/=i,e=(e=1<(e=geometry.A.distance(s,r,3)/(2*n))?1:e)<-1?-1:e,i=2*Math.asin(e),e=1-(s=Math.cos(i)),r=Math.sin(i),a[1][1]=s+o[0]*o[0]*e,a[2][1]=o[1]*o[0]*e+o[2]*r,a[3][1]=o[2]*o[0]*e-o[1]*r,a[1][2]=o[0]*o[1]*e-o[2]*r,a[2][2]=s+o[1]*o[1]*e,a[3][2]=o[2]*o[1]*e+o[0]*r,a[1][3]=o[0]*o[2]*e+o[1]*r,a[2][3]=o[1]*o[2]*e-o[0]*r,a[3][3]=s+o[2]*o[2]*e),math.A.matMatMult(a,this.matrix3DRot)):this.matrix3DRot},updateAngleSliderBounds:function(){var t,e,i,s,r,o,n,a,l;this.trackballEnabled=utils_type.A.evaluate(this.visProp.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,a=this.bank_slide._smax,l=this.bank_slide._smin,this.trackballEnabled?(n=math.A.mod(this.angles.el,2*Math.PI),.5*Math.PI<n&&n<1.5*Math.PI&&(this.angles.el=Math.PI-n,this.angles.az=math.A.wrap(this.angles.az+Math.PI,e,t),this.angles.bank=math.A.wrap(this.angles.bank+Math.PI,l,a)),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,l,a)):(n=function(t){return t<s?s-t:i<t?t-i:0},o=.5*(s+i),r=math.A.wrap(this.angles.el,o-Math.PI,o+Math.PI),o=math.A.wrap(Math.PI-this.angles.el,o-Math.PI,o+Math.PI),n(r)<=n(o)?this.angles.el=math.A.clamp(r,s,i):(this.angles.el=math.A.clamp(o,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,l,a)),this.angles.az=math.A.wrapAndClamp(this.angles.az,e,t,2*Math.PI),this.angles.bank=math.A.wrapAndClamp(this.angles.bank,l,a,2*Math.PI),this.matrix3DRot=this.getRotationFromAngles()),this.setSlidersFromAngles()},_updateCentralProjection:function(){var t;return"auto"===(t=utils_type.A.evaluate(this.visProp.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(t=>t.slice()),this.boxToCam[3][0]=-t,this.focalDist=1/Math.tan(.5*utils_type.A.evaluate(this.visProp.fov)),t=[[0,0,0,-1],[0,this.focalDist,0,0],[0,0,this.focalDist,0],[320/-12,0,0,28/-12]],math.A.matMatMult(t,this.boxToCam)},compareDepth:function(t,e){t=[0,t.coords[1]-e.coords[1],t.coords[2]-e.coords[2],t.coords[3]-e.coords[3]];return math.A.matVecMult(this.matrix3DRot,math.A.matVecMult(this.shift,t))[3]},update:function(){var t,e,i,s=this.r,s=[[1,0,0,0],[0,-s,0,0],[0,0,-s,0],[0,0,0,1]];return utils_type.A.exists(this.el_slide)&&utils_type.A.exists(this.az_slide)&&utils_type.A.exists(this.bank_slide)&&this.needsUpdate&&(t=[[1,0,0],[0,1,0],[0,0,1]],this.projectionType=utils_type.A.evaluate(this.visProp.projection).toLowerCase(),this.trackballEnabled!==utils_type.A.evaluate(this.visProp.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?(t[1][1]=this.size[0]/.8,t[2][2]=this.size[1]/.8,t[1][0]=this.llftCorner[0]+.5*t[1][1]*.8,t[2][0]=this.llftCorner[1]+.5*t[2][2]*.8,this.viewPortTransform=t,i=this._updateCentralProjection(),this.matrix3D=math.A.matMatMult(i,this.shift)):(i=this.bbox3D[0][1]-this.bbox3D[0][0],e=this.bbox3D[1][1]-this.bbox3D[1][0],t[1][1]=this.size[0]/i,t[2][2]=this.size[1]/e,t[1][0]=this.llftCorner[0]+.5*t[1][1]*i,t[2][0]=this.llftCorner[1]+.5*t[2][2]*e,this.matrix3D=math.A.matMatMult(t,math.A.matMatMult(math.A.matMatMult(this.matrix3DRot,s),this.shift).slice(0,3))),this.visProp.depthorderpoints&&null===this.points&&(i=Object.values(this.objects),this.points=i.filter(t=>t.type===constants.A.OBJECT_TYPE_POINT3D)),this.visProp.depthorderpoints||null===this.points||(this.points=null),this.visProp.depthorderpoints&&this.board.renderer&&"svg"===this.board.renderer.type&&this.points.filter(t=>utils_type.A.evaluate(t.element2D.visProp.visible)).sort(this.compareDepth.bind(this)).forEach(t=>this.board.renderer.setLayer(t.element2D,t.element2D.visProp.layer))),this},updateRenderer:function(){return this.needsUpdate=!1,this},removeObject:function(t,e){var i;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{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;return 3===arguments.length?s=[1,t,e,i]:3===t.length?(s=t.slice()).unshift(1):s=t,e=math.A.matVecMult(this.matrix3D,s),"central"===this.projectionType?(e[1]/=e[0],e[2]/=e[0],e[3]/=e[0],e[0]/=e[0],math.A.matVecMult(this.viewPortTransform,e.slice(0,3))):e},_getW0:function(t,e,i){var t=math.A.inverse(t),s=t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],e=t[3][0]+e[1]*t[3][1]+e[2]*t[3][2],r=i*t[0][3]-t[3][3];return[1/((e*t[0][3]-s*t[3][3])/r),(e-s*i)/r]},project2DTo3DPlane:function(t,e,i){var s,r,o,n,e=e.slice(1);if(i=i||[1,0,0,0],n=math.A.norm(e,3),i=math.A.innerProduct(i.slice(1),e,3)/n,"parallel"===this.projectionType){(s=this.matrix3D.slice(0,3)).push([0,e[0],e[1],e[2]]),(r=t.coords.usrCoords.slice()).push(i);try{1===s[2][3]&&(s[2][1]=s[2][2]=.001*math.A.eps),o=math.A.Numerics.Gauss(s,r)}catch(t){o=[0,NaN,NaN,NaN]}}else{s=this.matrix3D,r=t.coords.usrCoords.slice(),n=math.A.Numerics.Gauss(this.viewPortTransform,r),i=(e=this._getW0(s,n,i))[0],r=[n[0]*i,n[1]*i,n[2]*i,e[1]*i];try{1===s[2][3]&&(s[2][1]=s[2][2]=.001*math.A.eps),(o=math.A.Numerics.Gauss(s,r))[1]/=o[0],o[2]/=o[0],o[3]/=o[0],o[0]/=o[0]}catch(t){o=[0,NaN,NaN,NaN]}}return o},projectScreenToSegment:function(t,e,i){var s=this.project3DTo2D(e).slice(1,3),r=this.project3DTo2D(i).slice(1,3),r=[r[0]-s[0],r[1]-s[1]],o=math.A.innerProduct(r,r),t=[t[0]-s[0],t[1]-s[1]],t=math.A.innerProduct(t,r)/o,n="central"===this.projectionType?(n=[.5*(e[0]+i[0]),.5*(e[1]+i[1]),.5*(e[2]+i[2])],n=[(n=this.project3DTo2D(n).slice(1,3))[0]-s[0],n[1]-s[1]],(1-(s=math.A.innerProduct(n,r)/o))*t/((1-2*s)*t+s)):t;return[1,(o=1-(r=Math.min(Math.max(n,0),1)))*e[0]+r*i[0],o*e[1]+r*i[1],o*e[2]+r*i[2]]},project2DTo3DVertical:function(t,e){var t=t.coords.usrCoords.slice(1,3),i=[e[1],e[2],this.bbox3D[2][0]],e=[e[1],e[2],this.bbox3D[2][1]];return this.projectScreenToSegment(t,i,e)},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){for(var s,r,o=i,n=0;n<3;n++)0!==e[n]&&(s=(this.bbox3D[n][0]-t[n])/e[n],r=(this.bbox3D[n][1]-t[n])/e[n],o=i<0?Math.max(o,Math.min(s,r)):Math.min(o,Math.max(s,r)));return o},isInCube:function(t){return t[0]>this.bbox3D[0][0]-math.A.eps&&t[0]<this.bbox3D[0][1]+math.A.eps&&t[1]>this.bbox3D[1][0]-math.A.eps&&t[1]<this.bbox3D[1][1]+math.A.eps&&t[2]>this.bbox3D[2][0]-math.A.eps&&t[2]<this.bbox3D[2][1]+math.A.eps},intersectionPlanePlane:function(t,e,i){var s,r=[[],[]];return i=i||e.d,i=math.A.Geometry.meet3Planes(t.normal,t.d,e.normal,i,math.A.crossProduct(t.normal,e.normal),0),t=math.A.Geometry.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),e=this.intersectionLineCube(i,t,1/0),s=math.A.axpy(e,t,i),this.isInCube(s)&&(r[0]=s),e=this.intersectionLineCube(i,t,-1/0),s=math.A.axpy(e,t,i),this.isInCube(s)&&(r[1]=s),r},getMesh:function(t,e,i){for(var s,r,o,n,a=[0,0,0],l=e[2],h=i[2],u=[],c=[],d=(utils_type.A.evaluate(e[1])-utils_type.A.evaluate(e[0]))/l,p=(utils_type.A.evaluate(i[1])-utils_type.A.evaluate(i[0]))/h,_=0;_<=l;_++){for(r=e[0]+d*_,s=0;s<=h;s++)o=i[0]+p*s,a=utils_type.A.isFunction(t)?t(r,o):[t[0](r,o),t[1](r,o),t[2](r,o)],n=this.project3DTo2D(a),u.push(n[1]),c.push(n[2]);u.push(NaN),c.push(NaN)}for(s=0;s<=h;s++){for(o=i[0]+p*s,_=0;_<=l;_++)r=e[0]+d*_,a=utils_type.A.isFunction(t)?t(r,o):[t[0](r,o),t[1](r,o),t[2](r,o)],n=this.project3DTo2D(a),u.push(n[1]),c.push(n[2]);u.push(NaN),c.push(NaN)}return[u,c]},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,1<this.az_slide.position&&(this.az_slide.position=0),this.board.update(),this.timeoutAzimuth=setTimeout(function(){this.animateAzimuth()}.bind(this),200)},stopAzimuth:function(){clearTimeout(this.timeoutAzimuth),this.timeoutAzimuth=null},isVerticalDrag:function(){var t=this.board;return!!utils_type.A.evaluate(this.visProp.verticaldrag.enabled)&&t["_"+utils_type.A.evaluate(this.visProp.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=utils_type.A.evaluate(this.visProp.values),t=(this.visProp._currentview+1)%t.length;return this.setCurrentView(t),this},previousView:function(){var t=utils_type.A.evaluate(this.visProp.values),t=(this.visProp._currentview+t.length-1)%t.length;return this.setCurrentView(t),this},setCurrentView:function(t){var e=utils_type.A.evaluate(this.visProp.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*utils_type.A.evaluate(this.visProp.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&&(utils_type.A.evaluate(this.visProp.az.keyboard.enabled)&&("ArrowRight"===t.key?o+=utils_type.A.evaluate(this.visProp.az.keyboard.step)*Math.PI/180:"ArrowLeft"===t.key&&(o-=utils_type.A.evaluate(this.visProp.az.keyboard.step)*Math.PI/180)),utils_type.A.evaluate(this.visProp.az.pointer.enabled)&&0!==r&&null==t.key&&(o+=r*s),utils_type.A.evaluate(this.visProp.az.continuous)?o=math.A.wrap(o,i,e):0<o?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*utils_type.A.evaluate(this.visProp.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&&(utils_type.A.evaluate(this.visProp.el.keyboard.enabled)&&("ArrowUp"===t.key?n-=utils_type.A.evaluate(this.visProp.el.keyboard.step)*Math.PI/180:"ArrowDown"===t.key&&(n+=utils_type.A.evaluate(this.visProp.el.keyboard.step)*Math.PI/180)),utils_type.A.evaluate(this.visProp.el.pointer.enabled)&&0!==r&&null==t.key&&(n+=r*s),utils_type.A.evaluate(this.visProp.el.continuous)&&!this.trackballEnabled?n=math.A.wrap(n,i,e):0<n?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&&(utils_type.A.evaluate(this.visProp.bank.keyboard.enabled)&&(e=utils_type.A.evaluate(this.visProp.bank.keyboard.step)*Math.PI/180,"."===t.key||"<"===t.key?o-=e:","!==t.key&&">"!==t.key||(o+=e)),utils_type.A.evaluate(this.visProp.bank.pointer.enabled)&&0!==r&&null==t.key&&(o+=r*((i-s)/this.board.canvasHeight*utils_type.A.evaluate(this.visProp.bank.pointer.speed)),t.preventDefault()),o=utils_type.A.evaluate(this.visProp.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=this.board.getMousePosition(t),i=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),s=e[0]-i.scrCoords[1],e=e[1]-i.scrCoords[2];return this._trackball={dx:t.movementX,dy:-t.movementY,x:s,y:-e},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&&(utils_type.A.evaluate(this.visProp.trackball.enabled)?(e=utils_type.A.evaluate(this.visProp.trackball.button),i=utils_type.A.evaluate(this.visProp.trackball.key),-1!==e&&e!==t.button||!("none"===i||-1<i.indexOf("shift")&&t.shiftKey||-1<i.indexOf("ctrl")&&t.ctrlKey)||(s=utils_type.A.evaluate(this.visProp.trackball.outside)?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(utils_type.A.evaluate(this.visProp.az.pointer.enabled)&&(e=utils_type.A.evaluate(this.visProp.az.pointer.button),i=utils_type.A.evaluate(this.visProp.az.pointer.key),-1!==e&&e!==t.button||!("none"===i||-1<i.indexOf("shift")&&t.shiftKey||-1<i.indexOf("ctrl")&&t.ctrlKey)||(s=utils_type.A.evaluate(this.visProp.az.pointer.outside)?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),utils_type.A.evaluate(this.visProp.el.pointer.enabled)&&(e=utils_type.A.evaluate(this.visProp.el.pointer.button),i=utils_type.A.evaluate(this.visProp.el.pointer.key),-1!==e&&e!==t.button||!("none"===i||-1<i.indexOf("shift")&&t.shiftKey||-1<i.indexOf("ctrl")&&t.ctrlKey)||(s=utils_type.A.evaluate(this.visProp.el.pointer.outside)?document:this.board.containerObj,env.A.addEvent(s,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0)),utils_type.A.evaluate(this.visProp.bank.pointer.enabled)&&(e=utils_type.A.evaluate(this.visProp.bank.pointer.button),i=utils_type.A.evaluate(this.visProp.bank.pointer.key),-1!==e&&e!==t.button||!("none"===i||-1<i.indexOf("shift")&&t.shiftKey||-1<i.indexOf("ctrl")&&t.ctrlKey)||(s=utils_type.A.evaluate(this.visProp.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=utils_type.A.evaluate(this.visProp.az.pointer.outside)?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(e=utils_type.A.evaluate(this.visProp.el.pointer.outside)?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(e=utils_type.A.evaluate(this.visProp.bank.pointer.outside)?document:this.board.containerObj,env.A.removeEvent(e,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(e=utils_type.A.evaluate(this.visProp.az.pointer.outside)?document:this.board.containerObj,env.A.removeEvent(e,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),env.A.removeEvent(document,"pointerup",this.pointerUpHandler,this)}}),jxg.A.createView3D=function(t,e,i){var h,s,r,o,n,a=e[0],l=e[1],i=utils_type.A.copyAttributes(i,t.options,"view3d");return(h=new jxg.A.View3D(t,e,i)).defaultAxes=h.create("axes3d",[],i),e=a[0],a=a[1],n=l[0],l=l[1],(s=utils_type.A.copyAttributes(i,t.options,"view3d","az","slider")).name="az",(r=utils_type.A.copyAttributes(i,t.options,"view3d","el","slider")).name="el",(o=utils_type.A.copyAttributes(i,t.options,"view3d","bank","slider")).name="bank",h.az_slide=t.create("slider",[[e-1,a-2],[e+n+1,a-2],[utils_type.A.evaluate(s.min),utils_type.A.evaluate(s.start),utils_type.A.evaluate(s.max)]],s),h.inherits.push(h.az_slide),h.el_slide=t.create("slider",[[e-1,a],[e-1,a+l],[utils_type.A.evaluate(r.min),utils_type.A.evaluate(r.start),utils_type.A.evaluate(r.max)]],r),h.inherits.push(h.el_slide),h.bank_slide=t.create("slider",[[e-1,a+l+2],[e+n+1,a+l+2],[utils_type.A.evaluate(o.min),utils_type.A.evaluate(o.start),utils_type.A.evaluate(o.max)]],o),h.inherits.push(h.bank_slide),h.board.infobox.visProp=utils_type.A.merge(h.board.infobox.visProp,i.infobox),h.board.highlightInfobox=function(t,e,i){var s,r,o,n="",a=i.board,l=null;for(this.mode===this.BOARD_MODE_DRAG&&(n=h.isVerticalDrag()?'<span style="color:black; font-size:200%">⇅ </span>':'<span style="color:black; font-size:200%">⇄ </span>'),s=0;s<i.parents.length&&!(l=a.objects[i.parents[s]]).is3D;s++);l?(r=[1,0,0,l.coords[3]],h._w0=math.A.innerProduct(h.matrix3D[0],r,4),r=h.project2DTo3DPlane(l.element2D,[1,0,0,1],r),h.isInCube(r)?(r=utils_type.A.evaluate(l.visProp.infoboxdigits),o=h.board.infobox,o="auto"===r?o.useLocale()?[n,"(",o.formatNumberLocale(l.X())," | ",o.formatNumberLocale(l.Y())," | ",o.formatNumberLocale(l.Z()),")"]:[n,"(",utils_type.A.autoDigits(l.X())," | ",utils_type.A.autoDigits(l.Y())," | ",utils_type.A.autoDigits(l.Z()),")"]:o.useLocale()?[n,"(",o.formatNumberLocale(l.X(),r)," | ",o.formatNumberLocale(l.Y(),r)," | ",o.formatNumberLocale(l.Z(),r),")"]:[n,"(",utils_type.A.toFixed(l.X(),r)," | ",utils_type.A.toFixed(l.Y(),r)," | ",utils_type.A.toFixed(l.Z(),r),")"],h.board.highlightCustomInfobox(o.join(""),l)):h.board.highlightCustomInfobox("",l)):h.board.highlightCustomInfobox("("+t+", "+e+")",i)},h.BOARD_MODE_NONE=0,env.A.addEvent(t.containerObj,"keydown",function(t){var e,i=!1;!utils_type.A.evaluate(h.visProp.el.keyboard.enabled)||"ArrowUp"!==t.key&&"ArrowDown"!==t.key||("none"===(e=utils_type.A.evaluate(h.visProp.el.keyboard.key))||-1<e.indexOf("shift")&&t.shiftKey||-1<e.indexOf("ctrl")&&t.ctrlKey)&&(h._elEventHandler(t),i=!0),!utils_type.A.evaluate(h.visProp.el.keyboard.enabled)||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||("none"===(e=utils_type.A.evaluate(h.visProp.az.keyboard.key))||-1<e.indexOf("shift")&&t.shiftKey||-1<e.indexOf("ctrl")&&t.ctrlKey)&&(h._azEventHandler(t),i=!0),!utils_type.A.evaluate(h.visProp.bank.keyboard.enabled)||","!==t.key&&"<"!==t.key&&"."!==t.key&&">"!==t.key||("none"===(e=utils_type.A.evaluate(h.visProp.bank.keyboard.key))||-1<e.indexOf("shift")&&t.shiftKey||-1<e.indexOf("ctrl")&&t.ctrlKey)&&(h._bankEventHandler(t),i=!0),"PageUp"===t.key?(h.nextView(),i=!0):"PageDown"===t.key&&(h.previousView(),i=!0),i&&t.preventDefault()},h),env.A.addEvent(t.containerObj,"pointerdown",h.pointerDownHandler,h),h.getAnglesFromSliders(),h.matrix3DRot=h.getRotationFromAngles(),h.updateAngleSliderBounds(),h.board.update(),h},jxg.A.registerElement("view3d",jxg.A.createView3D),jxg.A.View3D),element3d=(jxg.A.GeometryElement3D=function(t,e){this.elType=e,this.id=this.board.setId(this,e),this.view=t,this.element2D=null,this.is3D=!0,""!==(this.view.objects[this.id]=this).name&&(this.view.elementsByName[this.name]=this)},jxg.A.extend(jxg.A.GeometryElement3D.prototype,{setAttr2D:function(t){return t.name=this.name,t},setAttribute:function(t){for(var e,i,s,r,o={},n=0;n<arguments.length;n++)utils_type.A.isString(s=arguments[n])?(r=s.split(":"),o[utils_type.A.trim(r[0])]=utils_type.A.trim(r[1])):utils_type.A.isArray(s)?o[s[0]]=s[1]:jxg.A.extend(o,s);for(n in o)if(o.hasOwnProperty(n))switch(e=n.replace(/\s+/g,"").toLowerCase(),i=o[n],e){case"numberpointshigh":case"stepsu":case"stepsv":utils_type.A.exists(this.visProp[e])&&(!jxg.A.Validator[e]||jxg.A.Validator[e]&&jxg.A.Validator[e](i)||jxg.A.Validator[e]&&utils_type.A.isFunction(i)&&jxg.A.Validator[e](i()))&&(i=(!i.toLowerCase||"false"!==i.toLowerCase())&&i,this._set(e,i));break;default:utils_type.A.exists(this.element2D)&&this.element2D.setAttribute(o)}},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++)utils_type.A.exists(this.visProp[e=s[t]])&&(i[e]=this.visProp[e]);return i},setPosition2D:function(t){},remove:function(){}}),jxg.A.GeometryElement3D);jxg.A.createAxes3D=function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f,A,g,m,y,b,v=e[0],C=["x","y","z"],x=["Rear","Front"],P=[0,0,0],E=[0,0,0],O={};if(utils_type.A.exists(v.bbox3D))for(s=0;s<C.length;s++)P[s]=v.bbox3D[s][0],E[s]=v.bbox3D[s][1];else for(s=0;s<C.length;s++)P[s]=e[1][s],E[s]=e[2][1];for(h=(l=utils_type.A.copyAttributes(i,t.options,"axes3d")).axesposition,s=0;s<C.length;s++)m=(u=C[s])+"Axis","center"===h?(d=[0,0,0],(p=[0,0,0])[s]=E[s],O[m]=v.create("axis3d",[d,p],l[m.toLowerCase()]),O[m].view=v):"border"===h&&(m+="Border",d=P.slice(),p=E.slice(),"z"===u?(d[1]=E[1],p[0]=P[0]):p=(d="x"===u?[P[0],E[1],P[2]]:[E[0],P[1],P[2]],[E[0],E[1],P[2]]),p[s]=E[s],O[m]=v.create("axis3d",[d,p],l[m.toLowerCase()]),O[m].view=v,b=l[m.toLowerCase()].ticks3d,c=E[s]-P[s],O[m+"Ticks"]="x"===u?v.create("ticks3d",[d,[1,0,0],c,[0,1,0]],b):"y"===u?v.create("ticks3d",[d,[0,1,0],c,[1,0,0]],b):v.create("ticks3d",[d,[0,0,1],c,[0,1,0]],b),O[m+"Ticks"].view=v);for("center"===h?(O.O=v.create("intersection",[O[C[0]+"Axis"],O[C[1]+"Axis"]],{name:"",visible:!1,withLabel:!1}),O.O.view=v):O.O=null,s=0;s<C.length;s++)for(n=(s+1)%3,a=(s+2)%3,u=C[s],r=0;r<x.length;r++)(d=[0,0,0])[s]=(0===r?P:E)[s],f=[0,0,0],(_=[0,0,0])[n]=1,f[a]=1,A=[P[n],E[n]],g=[P[a],E[a]],l=utils_type.A.copyAttributes(i,t.options,"axes3d",m=u+"Plane"+x[r]),O[m]=v.create("plane3d",[d,_,f,A,g],l),O[m].elType="axisplane3d";for(s=0;s<C.length;s++)for(u=C[s],r=0;r<x.length;r++)for(o=1;o<=2;o++)m=u+"Plane"+x[r]+C[n=(s+o)%3].toUpperCase()+"Axis",y=u+"Plane"+x[r],(d=[0,0,0])[s]=(p=[0,0,0])[s]=(0===r?P:E)[s],d[n]=P[n],p[n]=E[n],l=utils_type.A.copyAttributes(i,t.options,"axes3d",m),O[m]=v.create("axis3d",[d,p],l),O[m].view=v,O[y].addChild(O[m]),O[y].element2D.inherits.push(O[m]);return O},jxg.A.registerElement("axes3d",jxg.A.createAxes3D),jxg.A.createAxis3D=function(t,e,i){var s,r,o,n,a,l,h,u,c,d,p,_,f=e[0],A=e[1],e=e[2],g=utils_type.A.copyAttributes(i.point1,t.options,"axis3d","point1"),A=f.create("point",[(s=A[0],r=A[1],o=A[2],function(){return f.project3DTo2D(s,r,o)[1]}),(d=A[0],p=A[1],_=A[2],function(){return f.project3DTo2D(d,p,_)[2]})],g);return g=utils_type.A.copyAttributes(i.point2,t.options,"axis3d","point2"),e=f.create("point",[(h=e[0],u=e[1],c=e[2],function(){return f.project3DTo2D(h,u,c)[1]}),(n=e[0],a=e[1],l=e[2],function(){return f.project3DTo2D(n,a,l)[2]})],g),g=utils_type.A.copyAttributes(i,t.options,"axis3d"),f.create("arrow",[A,e],g)},jxg.A.registerElement("axis3d",jxg.A.createAxis3D),jxg.A.createMesh3D=function(t,e,i){var c=e[0],s=e[1],r=e[2],o=e[3],n=e[4],a=e[5],e=e[6]||1;return(i=c.create("curve",[[],[]],i)).point=s,i.direction1=r,i.range1=o,i.direction2=n,i.range2=a,i.step=e,i.updateDataArray=function(){var t,e,i,s=utils_type.A.evaluate(this.range1),r=utils_type.A.evaluate(this.range2),o=s[0],s=s[1],n=r[0],r=r[1],a=[0,0,0],l=[0,0,0],h=utils_type.A.evaluate(this.step),u=[0,0,0];if(this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))u=this.point().slice(1);else for(i=0;i<3;i++)u[i]=utils_type.A.evaluate(this.point[i]);for(i=0;i<3;i++)a[i]=utils_type.A.evaluate(this.direction1[i]),l[i]=utils_type.A.evaluate(this.direction2[i]);for(t=jxg.A.Math.norm(a,3),e=jxg.A.Math.norm(l,3),i=0;i<3;i++)a[i]/=t,l[i]/=e;s=c.getMesh([function(t,e){return u[0]+t*a[0]+e*l[0]},function(t,e){return u[1]+t*a[1]+e*l[1]},function(t,e){return u[2]+t*a[2]+e*l[2]}],[Math.ceil(o),Math.floor(s),(Math.ceil(s)-Math.floor(o))/h],[Math.ceil(n),Math.floor(r),(Math.ceil(r)-Math.floor(n))/h]),this.dataX=s[0],this.dataY=s[1]},i},jxg.A.registerElement("mesh3d",jxg.A.createMesh3D),jxg.A.Circle3D=function(t,e,i,s,r){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.normal=[0,0,0],this.curve,this.frame1,this.frame2,this.updateNormal=function(){for(var t,e=0;e<3;e++)this.normal[e]=utils_type.A.evaluate(i[e]);if(t=math.A.norm(this.normal),Math.abs(t)>math.A.eps)for(e=0;e<3;e++)this.normal[e]/=t},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,[1,0,0]),e=math.A.crossProduct(this.normal,[-.5,.8660254037844386,0]),math.A.norm(e)>math.A.norm(this.frame1)&&(this.frame1=e),this.frame2=math.A.crossProduct(this.normal,this.frame1),this.normalizeFrame(),this.curve=t.create("curve3d",[t=>this.center.X()+this.Radius()*(Math.cos(t)*this.frame1[0]+Math.sin(t)*this.frame2[0]),t=>this.center.Y()+this.Radius()*(Math.cos(t)*this.frame1[1]+Math.sin(t)*this.frame2[1]),t=>this.center.Z()+this.Radius()*(Math.cos(t)*this.frame1[2]+Math.sin(t)*this.frame2[2]),[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.updateNormal(),this.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(){for(var t=math.A.norm(this.frame1),e=math.A.norm(this.frame2),i=0;i<3;i++)this.frame1[i]/=t,this.frame2[i]/=e},updateFrame:function(){this.frame1=math.A.crossProduct(this.frame2,this.normal),this.frame2=math.A.crossProduct(this.normal,this.frame1),this.normalizeFrame()},projectCoords:function(t,e){return this.curve.projectCoords(t,e)},projectScreenCoords:function(t,e){return this.curve.projectScreenCoords(t,e)}}),jxg.A.createCircle3D=function(t,e,i){var s=e[0],t=utils_type.A.copyAttributes(i,t.options,"circle3d"),i=utils_type.A.providePoints3D(s,[e[1]],i,"circle3d",["point"])[0],r=e[2],e=e[3];return(s=new jxg.A.Circle3D(s,i,r,e,t)).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=e[0],r=e[1],o=e[2],i=utils_type.A.copyAttributes(i,t.options,"intersectioncircle3d"),n=geometry.A.intersectionFunction3D(s,r,o),a=s.create("point3d",n[0],{visible:!1}),s=s.create("circle3d",[a,n[1],n[2]],i);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_CIRCLE3D,s.elType="intersectioncircle3d",s.setParents([r.id,o.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),t.visProp.depthorderpoints&&t.points.push(this),this.coords=[0,0,0,0],this.F=e,this.slide=i,this.X=function(){return this.coords[1]},this.Y=function(){return this.coords[2]},this.Z=function(){return this.coords[3]},this._params=[],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,{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;return this.element2D.draggable()&&0!==geometry.A.distance(this._c2d,this.element2D.coords.usrCoords)?this.slide?(this.coords=this.slide.projectScreenCoords([this.element2D.X(),this.element2D.Y()],this._params),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))):0!==(e=this.view.isVerticalDrag()?this.view.project2DTo3DVertical(this.element2D,this.coords):(e=[1,0,0,this.coords[3]],this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],e)))[0]&&(e=this.view.project3DToCube(e),this.coords=e[0],e[1]&&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._params)),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D([1,this.X(),this.Y(),this.Z()]))),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},isIllDefined:function(){return utils_type.A.cmpArrays(this.coords,[0,0,0,0])},distance:function(t){var e=math.A.eps*math.A.eps,i=this.coords,t=t.coords;return i[0]*i[0]>e&&t[0]*t[0]>e?math.A.hypot(t[1]-i[1],t[2]-i[2],t[3]-i[3]):Number.POSITIVE_INFINITY},__evt__update3D:function(t){}}),jxg.A.createPoint3D=function(t,e,i){var s,r=e[0],o=2<e.length&&utils_type.A.exists(e[e.length-1].is3D)?e.pop():null;if(2===e.length)s=e[1];else{if(4!==e.length)throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [[x,y,z]], [x,y,z]");s=e.slice(1)}return e=utils_type.A.copyAttributes(i,t.options,"point3d"),(i=new jxg.A.Point3D(r,s,o,e)).initCoords(),t=r.project3DTo2D(i.coords),e=i.setAttr2D(e),i.element2D=r.create("point",t,e),i.element2D.view=r,i.addChild(i.element2D),i.inherits.push(i.element2D),i.element2D.setParents(i),i.slide&&(i.slide.addChild(i),i.setParents(i.slide)),i._c2d=i.element2D.coords.usrCoords.slice(),i},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.dataX=null,this.dataY=null,(this.dataZ=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]}),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,{updateDataArray2D:function(){var t,e,i,s,r,o,n,a=utils_type.A.evaluate(this.visProp.numberpointshigh),l=[0,0,0],h=[],u=[];if(utils_type.A.exists(this.dataX))for(a=this.dataX.length,o=0;o<a;o++)l=[this.dataX[o],this.dataY[o],this.dataZ[o]],r=this.view.project3DTo2D(l),h.push(r[1]),u.push(r[2]);else if(utils_type.A.isArray(this.X))for(a=this.X.length,o=0;o<a;o++)l=[this.X[o],this.Y[o],this.Z[o]],r=this.view.project3DTo2D(l),h.push(r[1]),u.push(r[2]);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)/(a-1),n=0,o=e;n<a&&o<=i;n++,o+=s)l=null!==this.F?this.F(o):[this.X(o),this.Y(o),this.Z(o)],r=this.view.project3DTo2D(l),h.push(r[1]),u.push(r[2]);return{X:h,Y:u}},updateDataArray:function(){},update:function(){return this.updateDataArray(),this},updateRenderer:function(){return this.needsUpdate=!1,this},initParamsIfNeeded:function(t){0===t.length&&t.unshift(.5*(this.range[0]+this.range[1]))},projectCoords:function(t,e){return this.initParamsIfNeeded(e),geometry.A.projectCoordsToParametric(t,this,e)},projectScreenCoords:function(t,e){return this.initParamsIfNeeded(e),geometry.A.projectScreenCoordsToParametric(t,this,e)}}),jxg.A.createCurve3D=function(t,e,i){var s,r,o,n,a,l,h=e[0];return 3===e.length?(s=e[1],a=e[2],n=o=r=null):(r=e[1],o=e[2],n=e[3],a=e[4],s=null),e=utils_type.A.copyAttributes(i,t.options,"curve3d"),e=(l=new jxg.A.Curve3D(h,s,r,o,n,a,e)).setAttr2D(e),l.element2D=h.create("curve",[[],[]],e),l.element2D.view=h,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(b,t,e){var i,s=t[0];if(5<=t.length&&(utils_type.A.isArray(t[1])||utils_type.A.isFunction(t[1])||utils_type.A.isString(t[1]))&&utils_type.A.isArray(t[2])&&3===t[1].length&&utils_type.A.isArray(t[3])&&3===t[2].length&&utils_type.A.isArray(t[4])&&3===t[3].length)return e=utils_type.A.copyAttributes(e,b.options,"vectorfield3d"),(i=s.create("curve3d",[[],[],[]],e)).setF=function(t,e){var s,r,o;return utils_type.A.isArray(t)?(s=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,i){return[s(t,e,i),r(t,e,i),o(t,e,i)]}):this.F=utils_type.A.createFunction(t,i.board,e),this},i.setF(t[1],"x, y, z"),i.xData=t[2],i.yData=t[3],i.zData=t[4],i.updateDataArray=function(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_=utils_type.A.evaluate(this.visProp.scale),f=[utils_type.A.evaluate(this.xData[0]),utils_type.A.evaluate(this.yData[0]),utils_type.A.evaluate(this.zData[0])],A=[utils_type.A.evaluate(this.xData[1]),utils_type.A.evaluate(this.yData[1]),utils_type.A.evaluate(this.zData[1])],g=[utils_type.A.evaluate(this.xData[2]),utils_type.A.evaluate(this.yData[2]),utils_type.A.evaluate(this.zData[2])],m=[(g[0]-f[0])/A[0],(g[1]-f[1])/A[1],(g[2]-f[2])/A[2]],y=utils_type.A.evaluate(this.visProp.arrowhead.enabled);for(y&&(g=utils_type.A.evaluate(this.visProp.arrowhead.size),p=utils_type.A.evaluate(this.visProp.arrowhead.angle),u=g/b.unitX,c=g/b.unitY,d=g/Math.sqrt(b.unitX*b.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],r=f[e=0];e<=A[0];r+=m[0],e++)for(i=0,o=f[1];i<=A[1];o+=m[1],i++)for(t=0,n=f[2];t<=A[2];n+=m[2],t++)s=this.F(r,o,n),(h=math.A.norm(s))<Number.EPSILON||(s[0]*=_,s[1]*=_,s[2]*=_,utils_type.A.concat(this.dataX,[r,r+s[0],NaN]),utils_type.A.concat(this.dataY,[o,o+s[1],NaN]),utils_type.A.concat(this.dataZ,[n,n+s[2],NaN]),y&&(h*=_,a=Math.atan2(s[1],s[0]),l=(h=Math.asin(s[2]/h))-p,h=h+p,utils_type.A.concat(this.dataX,[r+s[0]-u*Math.cos(a)*Math.cos(l),r+s[0],r+s[0]-u*Math.cos(a)*Math.cos(h),NaN]),utils_type.A.concat(this.dataY,[o+s[1]-c*Math.sin(a)*Math.cos(l),o+s[1],o+s[1]-c*Math.sin(a)*Math.cos(h),NaN]),utils_type.A.concat(this.dataZ,[n+s[2]-d*Math.sin(h),n+s[2],n+s[2]-d*Math.sin(l),NaN])))},i.methodMap=utils_type.A.deepCopy(i.methodMap,{setF:"setF"}),i;throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof t[1]+"', '"+typeof t[2]+"', '"+typeof t[3]+"'.'"+typeof t[4]+"', ")},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.board.finalizeAdding(this),this.point=e,this.direction=i,this.range=s||[-1/0,1/0],this.point1=null,this.point2=null,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,{getPointCoords:function(t){var e,i,s=[],r=[this.point.X(),this.point.Y(),this.point.Z()];if(utils_type.A.isFunction(this.direction))s=this.direction();else for(e=1;e<4;e++)s.push(utils_type.A.evaluate(this.direction[e]));return i=utils_type.A.evaluate(t),t=this.view.intersectionLineCube(r,s,i),[r[0]+s[0]*t,r[1]+s[1]*t,r[2]+s[2]*t]},update:function(){return this},setPosition2D:function(t){for(var e,i=0;i<this.parents.length;i++)"point3d"===(e=this.view.select(this.parents[i])).elType&&e.element2D.draggable()&&t.applyOnce(e.element2D)},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t){var e=this.getPointCoords(0),i=this.getPointCoords(1),i=[i[0]-e[0],i[1]-e[1],i[2]-e[2]],t=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],e=math.A.innerProduct(t,i)/math.A.innerProduct(i,i),t=Math.min(Math.max(e,this.range[0]),this.range[1]);return(i=this.getPointCoords(t).slice()).unshift(1),i},projectScreenCoords:function(t){var e=this.getPointCoords(0),i=this.getPointCoords(1);return this.view.projectScreenToSegment(t,e,i)}}),jxg.A.createLine3D=function(t,e,i){var s,r,o,n,a,l,h,u=e[0],t=utils_type.A.copyAttributes(i,t.options,"line3d");return utils_type.A.isPoint3D(e[2])||3===e.length&&(utils_type.A.isArray(e[2])||utils_type.A.isFunction(e[2]))?(n=utils_type.A.providePoints3D(u,[e[1]],i,"line3d",["point1"])[0],a=utils_type.A.providePoints3D(u,[e[2]],i,"line3d",["point2"])[0],h=new jxg.A.Line3D(u,n,r=function(){return[a.X()-n.X(),a.Y()-n.Y(),a.Z()-n.Z()]},o=[0,1],t),(l=utils_type.A.providePoints3D(u,[[0,0,0],[0,0,0]],{visible:!1},"line3d",["point1","point2"]))[0].F=function(){var t=0;return utils_type.A.evaluate(h.visProp.straightfirst)&&(t=-1/0),h.getPointCoords(t)},l[1].F=function(){var t=1;return utils_type.A.evaluate(h.visProp.straightlast)&&(t=1/0),h.getPointCoords(t)},l[0].prepareUpdate().update(),l[1].prepareUpdate().update(),(t=h.setAttr2D(t)).straightfirst=!1,t.straightlast=!1,h.element2D=u.create("segment",[l[0].element2D,l[1].element2D],t),h.element2D.view=u,h.endpoints=l,h.addChild(l[0]),h.addChild(l[1]),h.addParents([n,a])):(s=utils_type.A.providePoints3D(u,[e[1]],i,"line3d",["point"])[0],utils_type.A.isFunction(e[2])?r=e[2]:3===e[2].length?r=[1].concat(e[2]):4===e[2].length&&(r=e[2]),o=e[3],l=utils_type.A.providePoints3D(u,[[0,0,0],[0,0,0]],i,"line3d",["point1","point2"]),h=new jxg.A.Line3D(u,s,r,o,t),l[0].F=function(){return h.getPointCoords(utils_type.A.evaluate(h.range[0]))},l[0].prepareUpdate().update(),n=l[0],l[1].F=function(){return h.getPointCoords(utils_type.A.evaluate(h.range[1]))},l[1].prepareUpdate().update(),a=l[1],(t=h.setAttr2D(t)).straightfirst=!1,t.straightlast=!1,h.element2D=u.create("segment",[n.element2D,a.element2D],t),h.element2D.view=u,h.endpoints=l,h.addParents(s)),h.addChild(h.element2D),h.inherits.push(h.element2D),h.element2D.addParents(h),h.point1=n,h.point2=a,h.point1._is_new?(h.addChild(h.point1),delete h.point1._is_new):h.point1.addChild(h),h.point2._is_new?(h.addChild(h.point2),delete h.point2._is_new):h.point2.addChild(h),utils_type.A.exists(s)&&(s._is_new?(h.addChild(s),delete s._is_new):s.addChild(h)),h.update(),h.element2D.prepareUpdate().update().updateRenderer(),h},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.range1=s||[-1/0,1/0],this.range2=o||[-1/0,1/0],this.vec1=[0,0,0],this.vec2=[0,0,0],this.grid=null,this.normal=[0,0,0],this.d=0,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,{updateNormal:function(){var t,e;if(utils_type.A.isFunction(this.direction1))this.vec1=utils_type.A.evaluate(this.direction1);else for(t=0;t<3;t++)this.vec1[t]=utils_type.A.evaluate(this.direction1[t]);if(utils_type.A.isFunction(this.direction2))this.vec2=utils_type.A.evaluate(this.direction2);else for(t=0;t<3;t++)this.vec2[t]=utils_type.A.evaluate(this.direction2[t]);if(this.normal=math.A.crossProduct(this.vec1,this.vec2),e=math.A.norm(this.normal),Math.abs(e)>math.A.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.d=math.A.innerProduct(this.point.coords.slice(1),this.normal,3),this},updateDataArray:function(){var t,e,i,s,r,o,n,a,l,h,u,c,d,p,_,f=["xPlaneRear","yPlaneRear","zPlaneRear"],A=[],g=[0,0,0],m=[0,0,0],y=[0,0,0],b=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&b.defaultAxes&&utils_type.A.evaluate(this.range1[0])===-1/0&&utils_type.A.evaluate(this.range1[1])===1/0&&utils_type.A.evaluate(this.range2[0])===-1/0&&utils_type.A.evaluate(this.range2[1])===1/0){for(h=0;h<f.length;h++){if(3===(y=b.intersectionPlanePlane(this,b.defaultAxes[f[h]]))[0].length&&3===y[1].length){for(l=0;l<A.length&&!(geometry.A.distance(y[0],A[l][0],3)<math.A.eps&&geometry.A.distance(y[1],A[l][1],3)<math.A.eps||geometry.A.distance(y[0],A[l][1],3)<math.A.eps&&geometry.A.distance(y[1],A[l][0],3)<math.A.eps);l++);l===A.length&&A.push(y.slice())}if((y=[0,0,0])[h]=b.bbox3D[h][1],a=math.A.innerProduct(y,b.defaultAxes[f[h]].normal,3),3===(y=b.intersectionPlanePlane(this,b.defaultAxes[f[h]],a))[0].length&&3===y[1].length){for(l=0;l<A.length&&!(geometry.A.distance(y[0],A[l][0],3)<math.A.eps&&geometry.A.distance(y[1],A[l][1],3)<math.A.eps||geometry.A.distance(y[0],A[l][1],3)<math.A.eps&&geometry.A.distance(y[1],A[l][0],3)<math.A.eps);l++);l===A.length&&A.push(y.slice())}}if(0===A.length)return{X:this.dataX,Y:this.dataY};l=d=0;do{for(3===(y=A[d][l]).length&&(r=b.project3DTo2D(y),this.dataX.push(r[1]),this.dataY.push(r[2])),y=A[d][l=(l+1)%2],p=d,h=0;h<A.length;h++){if(h!==d&&geometry.A.distance(y,A[h][0])<math.A.eps){d=h,l=0;break}if(h!==d&&geometry.A.distance(y,A[h][1])<math.A.eps){d=h,l=1;break}}if(d===p){console.log("Error: update plane3d: did not find next",d);break}}while(0!==d);r=b.project3DTo2D(A[0][0]),this.dataX.push(r[1]),this.dataY.push(r[2])}else{for(t=utils_type.A.evaluate(this.range1[0]),e=utils_type.A.evaluate(this.range1[1]),i=utils_type.A.evaluate(this.range2[0]),s=utils_type.A.evaluate(this.range2[1]),_=this.point.coords.slice(1),g=this.vec1.slice(),m=this.vec2.slice(),o=math.A.norm(g,3),n=math.A.norm(m,3),l=0;l<3;l++)g[l]/=o,m[l]/=n;for(h=0;h<4;h++){switch(h){case 0:u=t,c=i;break;case 1:u=e,c=i;break;case 2:u=e,c=s;break;case 3:u=t,c=s}for(l=0;l<3;l++)y[l]=_[l]+u*g[l]+c*m[l];r=b.project3DTo2D(y),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}},update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this}}),jxg.A.createPlane3D=function(t,e,i){var s=e[0],r=e[2],o=e[3],n=e[4]||[-1/0,1/0],a=e[5]||[-1/0,1/0],l=utils_type.A.providePoints3D(s,[e[1]],i,"plane3d",["point"])[0],e=utils_type.A.copyAttributes(i,t.options,"plane3d"),h=new jxg.A.Plane3D(s,l,r,n,o,a,e);return l.addChild(h),e=h.setAttr2D(e),h.element2D=s.create("curve",[[],[]],e),h.element2D.view=s,h.element2D.updateDataArray=function(){var t=h.updateDataArray();this.dataX=t.X,this.dataY=t.Y},h.addChild(h.element2D),h.inherits.push(h.element2D),h.element2D.setParents(h),e=utils_type.A.copyAttributes(i.mesh3d,t.options,"mesh3d"),Math.abs(h.range1[0])!==1/0&&Math.abs(h.range1[1])!==1/0&&Math.abs(h.range2[0])!==1/0&&Math.abs(h.range2[1])!==1/0&&(i=s.create("mesh3d",[function(){return l.coords},r,n,o,a],e),h.grid=i,h.addChild(i),h.inherits.push(i),i.setParents(h),h.grid.view=s),h.element2D.prepareUpdate().update(),t.isSuspendedUpdate||h.element2D.updateVisibility().updateRenderer(),h},jxg.A.registerElement("plane3d",jxg.A.createPlane3D),jxg.A.createIntersectionLine3D=function(t,e,i){for(var s,r=e[0],o=e[1],n=e[2],a=utils_type.A.copyAttributes(i,t.options,"intersectionline3d"),l=[],h=0;h<2;h++)s=geometry.A.intersectionFunction3D(r,o,n,h),l[h]=r.create("point3d",s,a["point"+(h+1)]);i=r.create("line3d",l,a);try{o.addChild(i),n.addChild(i)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.")}return i.type=constants.A.OBJECT_TYPE_INTERSECTION_LINE3D,i.elType="intersectionline3d",i.setParents([o.id,n.id]),i},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),t.visProp.depthorderpoints&&t.points.push(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._params=[],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;return this.element2D.draggable()&&0!==geometry.A.distance(this._c2d,this.element2D.coords.usrCoords)?this.slide?(this.coords=this.slide.projectScreenCoords([this.element2D.X(),this.element2D.Y()],this._params),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))):0!==(e=this.view.isVerticalDrag()?this.view.project2DTo3DVertical(this.element2D,this.coords):(e=[1,0,0,this.coords[3]],this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],e)))[0]&&(e=this.view.project3DToCube(e),this.coords=e[0],e[1]&&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._params)),this.element2D.coords.setCoordinates(constants.A.COORDS_BY_USER,this.view.project3DTo2D([1,this.X(),this.Y(),this.Z()].slice(1))),this.element2D.prepareUpdate().update()),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},isIllDefined:function(){return utils_type.A.cmpArrays(this.coords,[0,0,0,0])},__evt__update3D:function(t){}}),jxg.A.createText3D=function(t,e,i){var s,r,o=e[0],n=3<e.length&&utils_type.A.exists(e[e.length-1].is3D)?e.pop():null;if(3===e.length)s=e[1],r=e[2];else{if(5!==e.length)throw new Error("JSXGraph: Can't create text3d with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [[x,y,z], text], [x,y,z, text]");s=e.slice(1,4),r=e[4]}return e=utils_type.A.copyAttributes(i,t.options,"text3d"),(i=new jxg.A.Text3D(o,s,r,n,e)).initCoords(),t=o.project3DTo2D(i.coords),e=i.setAttr2D(e),i.element2D=o.create("text",[t[1],t[2],r],e),i.element2D.view=o,i.addChild(i.element2D),i.inherits.push(i.element2D),i.element2D.setParents(i),i.slide&&(i.slide.addChild(i),i.setParents(i.slide)),i._c2d=i.element2D.coords.usrCoords.slice(),i},jxg.A.registerElement("text3d",jxg.A.createText3D),jxg.A.createTicks3D=function(A,t,e){var i,g=t[0],s=t[1],r=t[2],o=t[3],t=t[4],e=utils_type.A.copyAttributes(e,A.options,"ticks3d");return(i=g.create("curve",[[],[]],e)).point=s,i.direction1=r,i.len=o,i.direction2=t,i.drawLabels=function(t){var e,i,s,r,o,n,a=this.len,l=utils_type.A.evaluate(this.visProp.ticksdistance),h=utils_type.A.evaluate(this.visProp.tickendings),u=utils_type.A.evaluate(this.visProp.majorheight),c=[0,0,0],d=[0,0,0],p=[0,0,0],_=[],f=(u/=Math.sqrt(A.unitX*A.unitY))*h[1]*2;if(this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))p=this.point().slice(1);else for(s=0;s<3;s++)p[s]=utils_type.A.evaluate(this.point[s]);for(s=0;s<3;s++)c[s]=utils_type.A.evaluate(this.direction1[s]),d[s]=utils_type.A.evaluate(this.direction2[s]);for(e=jxg.A.Math.norm(c,3),i=jxg.A.Math.norm(d,3),s=0;s<3;s++)c[s]/=e,d[s]/=i;if(!(Math.abs(l)<math.A.eps)){for(r=0;r<=a;r+=l){for(n=[p[0]+r*c[0]+f*d[0],p[1]+r*c[1]+f*d[1],p[2]+r*c[2]+f*d[2]],s=0;s<3;s++)0!==c[s]&&(o=p[s]+r*c[s]);_.push(g.create("text3d",[n,o],t))}return _}},utils_type.A.evaluate(i.visProp.drawlabels)&&(i.labels=i.drawLabels(e.label)),i.updateDataArray=function(){var t,e,i,s,r,o,n=this.len,a=utils_type.A.evaluate(this.visProp.ticksdistance),l=utils_type.A.evaluate(this.visProp.tickendings),h=utils_type.A.evaluate(this.visProp.majorheight),u=[0,0,0],c=[0,0,0],d=[0,0,0],p=(h/=Math.sqrt(A.unitX*A.unitY))*-l[0],_=h*l[1];if(this.dataX=[],this.dataY=[],utils_type.A.isFunction(this.point))d=this.point().slice(1);else for(i=0;i<3;i++)d[i]=utils_type.A.evaluate(this.point[i]);for(i=0;i<3;i++)u[i]=utils_type.A.evaluate(this.direction1[i]),c[i]=utils_type.A.evaluate(this.direction2[i]);for(t=jxg.A.Math.norm(u,3),e=jxg.A.Math.norm(c,3),i=0;i<3;i++)u[i]/=t,c[i]/=e;if(!(Math.abs(a)<math.A.eps))for(s=0;s<=n;s+=a)o=[d[0]+s*u[0]+p*c[0],d[1]+s*u[1]+p*c[1],d[2]+s*u[2]+p*c[2]],r=g.project3DTo2D(o),this.dataX.push(r[1]),this.dataY.push(r[2]),o=[d[0]+s*u[0]+_*c[0],d[1]+s*u[1]+_*c[1],d[2]+s*u[2]+_*c[2]],r=g.project3DTo2D(o),this.dataX.push(r[1]),this.dataY.push(r[2]),this.dataX.push(NaN),this.dataY.push(NaN)},i},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}}),jxg.A.createPolygon3D=function(t,e,i){var s,r,o,n,a=e[0],l=[],h=[],u=!1,c=utils_type.A.copyAttributes(i,t.options,"polygon3d");if(null===(o=t.select(e[1]))&&(o=e[1]),utils_type.A.isObject(o)&&o.type===constants.A.OBJECT_TYPE_POLYGON3D&&utils_type.A.isTransformationOrArray(e[2]))for(u=!0,r=o.vertices.length-1,n=utils_type.A.copyAttributes(i,t.options,"polygon3d","vertices"),s=0;s<r;s++)n.withlabel&&(n.name=""===o.vertices[s].name?"":o.vertices[s].name+"'"),l.push(t.create("point3d",[o.vertices[s],e[2]],n));else if(!1===(l=utils_type.A.providePoints3D(a,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((i=new jxg.A.Polygon3D(a,l,c)).isDraggable=!0,c=i.setAttr2D(c),s=0;s<l.length;s++)h.push(l[s].element2D);if(i.element2D=t.create("polygon",h,c),i.element2D.view=a,i.addChild(i.element2D),i.inherits.push(i.element2D),i.element2D.setParents(i),u)for(i.prepareUpdate().update().updateVisibility().updateRenderer(),r=o.vertices.length-1,s=0;s<r;s++)l[s].prepareUpdate().update().updateVisibility().updateRenderer();return i},jxg.A.registerElement("polygon3d",jxg.A.createPolygon3D),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,{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.isIllDefined()||this.point2.isIllDefined()?NaN:this.center.distance(this.point2):"pointRadius"===this.method?Math.abs(this.updateRadius()):NaN},focusFn:function(i){var s=this;return function(){var t=s.view.boxToCam[3],e=s.Radius();return s.view.project3DTo2D([s.center.X()+i*e*t[1],s.center.Y()+i*e*t[2],s.center.Z()+i*e*t[3]]).slice(1,3)}},innerVertexFn:function(){var n=this;return function(){var t=n.view,e=t.worldToFocal(n.center.coords,!1),i=math.A.hypot(e[0],e[1]),s=t.boxToCam,r=[-(e[0]*s[1][1]+e[1]*s[2][1])/i,-(e[0]*s[1][2]+e[1]*s[2][2])/i,-(e[0]*s[1][3]+e[1]*s[2][3])/i],o=n.Radius(),i=Math.atan(-i/e[2])+Math.acos(o/math.A.norm(e)),e=Math.cos(i),i=Math.sin(i);return t.project3DTo2D([n.center.X()+o*(i*r[0]+e*s[3][1]),n.center.Y()+o*(i*r[1]+e*s[3][2]),n.center.Z()+o*(i*r[2]+e*s[3][3])])}},buildCentralProjection:function(){var t=this.view,e={visible:!1,withLabel:!1},i=t.create("point",this.focusFn(-1),e),s=t.create("point",this.focusFn(1),e),e=t.create("point",this.innerVertexFn(t),e);this.aux2D=[i,s,e],this.element2D=t.create("ellipse",this.aux2D,this.visProp)},buildParallelProjection:function(){var e=this;this.aux2D=[],this.element2D=this.view.create("circle",[function(){var t=[1,e.center.X(),e.center.Y(),e.center.Z()];return e.view.project3DTo2D(t)},function(){var t=e.view.bbox3D[0][1]-e.view.bbox3D[0][0];return e.Radius()*e.view.size[0]/t}],this.visProp)},rebuildProjection:function(){if(this.element2D)for(var t in this.view.board.removeObject(this.element2D),this.aux2D)this.aux2D.hasOwnProperty(t)&&this.view.board.removeObject(this.aux2D[t]);this.projectionType=this.view.projectionType,"central"===this.projectionType?this.buildCentralProjection():this.buildParallelProjection(),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view}}),jxg.A.createSphere3D=function(t,e,i){for(var s,r,o=e[0],n=utils_type.A.copyAttributes(i,t.options,"sphere3d"),a=[],l=1;l<e.length;l++)if(utils_type.A.isPointType3D(t,e[l])){if(s=0===a.length?"center":"point",!1===(s=utils_type.A.providePoints3D(o,[e[l]],i,"sphere3d",[s])[0]))throw new Error("JSXGraph: Can't create sphere3d from this type. Please provide a point type.");a.push(s)}else a.push(e[l]);if(utils_type.A.isPoint3D(a[0])&&utils_type.A.isPoint3D(a[1]))r=new jxg.A.Sphere3D(o,"twoPoints",a[0],a[1],n);else if((utils_type.A.isNumber(a[0])||utils_type.A.isFunction(a[0])||utils_type.A.isString(a[0]))&&utils_type.A.isPoint3D(a[1]))r=new jxg.A.Sphere3D(o,"pointRadius",a[1],a[0],n);else{if(!(utils_type.A.isNumber(a[1])||utils_type.A.isFunction(a[1])||utils_type.A.isString(a[1]))||!utils_type.A.isPoint3D(a[0]))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]");r=new jxg.A.Sphere3D(o,"pointRadius",a[0],a[1],n)}return r.rebuildProjection(),r.element2D.prepareUpdate().update().updateRenderer(),r},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]}),this.range_u=o,this.range_v=n,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,{updateDataArray:function(){var t=utils_type.A.evaluate(this.visProp.stepsu),e=utils_type.A.evaluate(this.visProp.stepsv),i=utils_type.A.evaluate(this.range_u),s=utils_type.A.evaluate(this.range_v),r=null!==this.F?this.F:[this.X,this.Y,this.Z];return i.push(t),s.push(e),{X:(t=this.view.getMesh(r,i,s))[0],Y:t[1]}},update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this},initParamsIfNeeded:function(t){0===t.length&&t.unshift(.5*(this.range_u[0]+this.range_u[1]),.5*(this.range_v[0]+this.range_v[1]))},projectCoords:function(t,e){return this.initParamsIfNeeded(e),geometry.A.projectCoordsToParametric(t,this,e)},projectScreenCoords:function(t,e){return this.initParamsIfNeeded(e),geometry.A.projectScreenCoordsToParametric(t,this,e)}}),jxg.A.createParametricSurface3D=function(t,e,i){var s,r,o,n,a,l,h,u=e[0];return 4===e.length?(s=e[1],a=e[2],l=e[3],n=o=r=null):(r=e[1],o=e[2],n=e[3],a=e[4],l=e[5],s=null),e=utils_type.A.copyAttributes(i,t.options,"surface3d"),e=(h=new jxg.A.Surface3D(u,s,r,o,n,a,l,e)).setAttr2D(e),h.element2D=u.create("curve",[[],[]],e),h.element2D.view=u,h.element2D.updateDataArray=function(){var t=h.updateDataArray();this.dataX=t.X,this.dataY=t.Y},h.addChild(h.element2D),h.inherits.push(h.element2D),h.element2D.setParents(h),h.element2D.prepareUpdate().update(),t.isSuspendedUpdate||h.element2D.updateVisibility().updateRenderer(),h},jxg.A.registerElement("parametricsurface3d",jxg.A.createParametricSurface3D),jxg.A.createFunctiongraph3D=function(t,e,i){var s=e[0],t=utils_type.A.createFunction(e[1],t,"x, y"),r=e[2],e=e[3];return s.create("parametricsurface3d",[function(t,e){return t},function(t,e){return e},t,r,e],i)},jxg.A.registerElement("functiongraph3d",jxg.A.createFunctiongraph3D);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,__webpack_exports__=__webpack_exports__.default;return __webpack_exports__}); \ No newline at end of file diff --git a/stack/cas/castext2/blocks/jsxgraph.block.php b/stack/cas/castext2/blocks/jsxgraph.block.php index a8ef4882f87804e43346ce29ed765396857da386..d3130c0cbe00ae37a0a26a672524807f4a641166 100644 --- a/stack/cas/castext2/blocks/jsxgraph.block.php +++ b/stack/cas/castext2/blocks/jsxgraph.block.php @@ -34,6 +34,10 @@ class stack_cas_castext2_jsxgraph extends stack_cas_castext2_block { 'css' => 'https://cdn.jsdelivr.net/npm/jsxgraph/distrib/jsxgraph.min.css', 'js' => 'https://cdn.jsdelivr.net/npm/jsxgraph/distrib/jsxgraphcore.js', ], + 'cdn-1.10.1' => [ + 'css' => 'https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.10.1/jsxgraph.min.css', + 'js' => 'https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.10.1/jsxgraphcore.min.js', + ], 'cdn-1.8.0' => [ 'css' => 'https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.8.0/jsxgraph.min.css', 'js' => 'https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/1.8.0/jsxgraphcore.min.js',