/* @license Copyright (C) Exontrol. All rights reserved. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t(e.exontrol||{}))}(this,function(e){"use strict";function t(e){return null!=e}function i(e){return null==e}function r(e,t,i,r,o,s){e.drawLine([n(t),n(i)],[n(r),n(o)],s)}var o=o||window.exontrol,n=Math.round,s=Math.max,l=Math.min;o.Def.Bezier={},o.Mrg(o,function(){function e(e,t){this.init(e,t)}return e.version="4.4",e.type="Bezier",e.Options={tfi:null,locked:null,readOnly:null,wheelChange:null,bezierCoord:null,sizeBezier:null,colorBezier:null,sizeHoverPointControl:null,showBezierControl:null,showBezierDuplicateControl:null,sizeBezierControl:null,colorBezierControl:null,colorLineBezierControl:null,showBezierValue:null,colorBezierValue:null,colorTextBezierValue:null,colorShadowBezierValue:null,colorBezierValueOutside:null,colorTextBezierValueOutside:null,colorShadowBezierValueOutside:null,formatColorBezierValue:null,primitiveBezierValue:null,pArgBezierValue:null,formatBezierValue:null,showBezierScale:null,colorBezierScale:null,colorTextBezierScale:null,colorTextMarginsBezierScale:null,showBezierScaleControl:null,bezierScaleX:null,bezierScaleRangeX:null,bezierScaleY:null,bezierScaleRangeY:null,colorBezierScaleControl:null,highlightBezierScaleProgress:null,showBezierCoord:null,clipBezier:null,restrictBezier:null},e.p1h="bezier.p1.hover",e.p2h="bezier.p2.hover",e.sph="bezier.sp.hover",e.prototype.init=function(t,i){this.oBezier=new o.G.Bezier,this.oBezier.onchange={callback:this.onChange,thisArg:this},this.rtBezierP1=null,this.rtBezierP2=null,this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.oO=o.Mrg(o.Cpy(e.Options),i),this.Shortcuts=null,this.oSts=null,this.oBezierScale={x:.1,y:.1},this.rtBezierScalePoint=null,this.rgMeasureBezierValue=null,this.oMeasureBezierScaleTime=null,this.oMeasureBezierScaleProgress=null,this.oBezierValueExpr=null,this.oColorBezierValueExpr=null,this.canvas=null,this.client=null,this.Listeners=null,this.oLts=null,this.iLts(),this.SetClientRect(t),this.SetOptions(this.oO),o.CC.GetCanvas(t)&&this.SetCanvas(t),o.DPR.Reg(this)},o.SB.addProto(e.prototype),e.prototype.Refresh=function(){this.inv()},e.prototype.GetOption=function(r){function o(e,i){if(t(e)){var r=e[i];if(t(r))return r}}var n=o(this.oO,r);return i(n)&&(void 0!==this.oDefOpts&&(n=o(this.oDefOpts,r)),i(n)&&(n=e.Options[r])),n},e.prototype.opt=function(e,t){var r=this.GetOption(e);return i(r)&&i(r=o.Def.Bezier[e])&&(r=t),r},e.prototype.SetOptions=function(e){this.oO=o.Mrg(this.oO,e),this.oO&&this.oO.bezierCoord&&this.SetBezierCoord(this.oO.bezierCoord),this.updateBezierScale(),this.inv()},e.prototype.GetOptions=function(){return this.oO},e.prototype.GetCanvas=function(){var e=this.canvas;return o.CC.GetCanvas(e)?e:null},e.prototype.SetCanvas=function(e,t){this.udefSts(this.oSts),this.oSts=null,this.resAO(),e=o.CC.GetCanvas(e),!t&&o.CC.SetCanvas(this,e),this.canvas=e,o.CC.GetCanvas(this.canvas)&&this.defSts(this.Shortcuts=this.oSts=new o.Sts)},o.ComboBox&&(e.prototype.dCBl=function(e,t){this.drawBezier(e,t),this.showBezierCoord()&&this.drawBezierCoord(e,t,0)},e.prototype.sCB=function(e){return e&&this.SetOptions({bezierCoord:[0,0,1,1]}),!this.oBezier.isL()},e.prototype.SetCanvas=function(e,t){return o.ComboBox.implExHost(e,"onchange")}(e.prototype.SetCanvas)),e.prototype.SetClientRect=function(e){var t=o.CC.GetCanvas(e);t&&(e=[0,0,t.width,t.height]),this.client=o.C2R(e),this.visAO()||this.resAO()},e.prototype.GetClientRect=function(){return this.client.slice()},e.prototype.GetClientBezier=function(e){var i=(e=e||this.GetClientRect()).slice(),r=[0,0,0,0];if(this.showBezierControl()){var o=this.sizeBezierControl(),n=o[0],l=o[1];r[0]=s(r[0],n/2),r[1]=s(r[1],n/2),r[2]=s(r[2],l/2),r[3]=s(r[3],l/2)}return this.showBezierValue()&&t(this.rgMeasureBezierValue)&&(r[0]=s(r[0],this.rgMeasureBezierValue[0].width/2+4),r[3]=s(r[3],this.rgMeasureBezierValue[0].height/2+4),r[1]=s(r[1],this.rgMeasureBezierValue[1].width/2+4),r[2]=s(r[2],this.rgMeasureBezierValue[1].height/2+4)),this.showBezierScale()&&(t(this.oMeasureBezierScaleTime)&&(r[1]=s(r[1],this.oMeasureBezierScaleTime.width/2),r[3]+=this.oMeasureBezierScaleTime.height+4),t(this.oMeasureBezierScaleProgress)&&(r[0]+=this.oMeasureBezierScaleProgress.width+4)),i[0]+=r[0],i[1]+=r[1],i[2]-=r[0]+r[2],i[3]-=r[1]+r[3],i},e.prototype.showBezierCoord=function(){return this.opt("showBezierCoord",!0)},e.prototype.getBezierCoord=function(){var e="[",t="";return this.oBezier.GetP12().forEach(function(e){t.length&&(t+=", "),t+=o.Format(e)}),e+=t,e+="]"},e.prototype.drawBezierCoord=function(e,t,r){var n=this.oBezier.GetName();i(n)?n="":(n=""+n+"",n+="\n"),n+=this.getBezierCoord(),e.drawHTMLText(n,o.IRt(t.slice(),-4,-4),o.ToI(r,262170))},e.prototype.clipBezier=function(){return this.opt("clipBezier",!1)},e.prototype.initMeasureBezier=function(e){this.showBezierValue()&&(this.rgMeasureBezierValue=[],this.rgMeasureBezierValue.push(this.measureBezierValue(e,this.getBezierValue(0))),this.rgMeasureBezierValue.push(this.measureBezierValue(e,this.getBezierValue(1)))),this.showBezierScale()&&(this.oMeasureBezierScaleTime=this.measureBezierScaleTime(e,this.getBezierScaleTime(1)),this.oMeasureBezierScaleProgress=this.measureBezierScaleProgress(e,this.getBezierScaleProgress(1)))},e.prototype.draw=function(e,i,r){if(this.rtBezierP1=null,this.rtBezierP2=null,this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.rtBezierScalePoint=null,e&&!o.EyR(i)){this.initMeasureBezier(e);var n=this.GetClientBezier(i);if(!o.EyR(n)){t(r)&&(this.oDefOpts=this.GetOptions(),this.SetOptions(r));var s=this.showBezierScale(),l=this.showBezierValue(),a=this.clipBezier();a&&e.selClip(i),s&&this.drawBezierScale(e,n),this.drawBezier(e,n),l&&this.drawBezierValue(e,n),this.showBezierScaleControl()&&this.drawBezierScaleControl(e,n),this.showBezierControl()&&this.drawBezierControl(e,i,n),this.showBezierCoord()&&this.drawBezierCoord(e,n),a&&e.resClip(),void 0!==this.oDefOpts&&(this.SetOptions(this.oDefOpts),this.oDefOpts=void 0)}}},e.prototype.convertBezierToView=function(e,t){return{x:(t=t||this.GetClientBezier())[0]+e.x*t[2],y:t[1]+(1-e.y)*t[3]}},e.prototype.convertViewToBezier=function(e,t){var i=this.GetClientBezier(),r=this.convertBezierToView({x:0,y:0},i);return{x:e=(e-r.x)/i[2],y:t=-(t-r.y)/i[3]}},e.prototype.sizeBezierControl=function(){return this.opt("sizeBezierControl",[8,8])},e.prototype.getControlViewPointToRect=function(e){var t=this.sizeBezierControl();return o.RRt(o.G.C2R(e,t[0],t[1]))},e.prototype.sizeHoverPointControl=function(){return this.opt("sizeHoverPointControl",2)},e.prototype.showBezierControl=function(){return!this.isLocked()&&!!this.opt("showBezierControl",!0)},e.prototype.showBezierDuplicateControl=function(){return!this.isLocked()&&this.opt("showBezierDuplicateControl",!0)},e.prototype.colorBezierControl=function(){return this.opt("colorBezierControl","#404040")},e.prototype.colorLineBezierControl=function(){return this.opt("colorLineBezierControl","#808080")},e.prototype.drawBezierControl=function(i,n,s){function l(e,t){o.D.P.fill(i,e,t,"Ellipse")}var a=this.colorBezierControl(),h=this.colorLineBezierControl(),u=i.gAO();i.saveSts("lineDash"),i.setLineDash([2,2]);var c=this.convertBezierToView({x:0,y:0},s),z=this.convertBezierToView(this.oBezier.GetP1(),s);r(i,c.x,c.y,z.x,z.y,h),this.rtBezierP1=this.getControlViewPointToRect(z);var p=this.rtBezierP1;if(u){t(S=u.get(this,e.p1h))&&(p=o.R.RectInc(S.state,S.range,p,this.sizeHoverPointControl()))}l(p,a);var B=this.convertBezierToView({x:1,y:1},s),f=this.convertBezierToView(this.oBezier.GetP2(),s);r(i,B.x,B.y,f.x,f.y,h),this.rtBezierP2=this.getControlViewPointToRect(f);var y=this.rtBezierP2;if(u){var S=u.get(this,e.p2h);t(S)&&(y=o.R.RectInc(S.state,S.range,y,this.sizeHoverPointControl()))}if(l(y,a),i.loadSts(),this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.showBezierDuplicateControl()){var v=i.globalAlpha;if(this.clipBezier()||(i.globalAlpha=.5),!o.PInR(z.x,z.y,n)){var d=o.G.RDir(c,z.x-c.x,z.y-c.y,n);t(d)&&(this.rtBezierP1Duplicate=this.getControlViewPointToRect(d),l(this.rtBezierP1Duplicate,a))}if(!o.PInR(f.x,f.y,n)){var g=o.G.RDir(B,f.x-B.x,f.y-B.y,n);t(g)&&(this.rtBezierP2Duplicate=this.getControlViewPointToRect(g),l(this.rtBezierP2Duplicate,a))}i.globalAlpha=v}},e.prototype.sizeBezier=function(){return this.opt("sizeBezier",3)},e.prototype.colorBezier=function(){return this.opt("colorBezier","black")},e.prototype.drawBezier=function(e,t){!function(e,t,i,r){var o;t&&e&&((o=e.exontrol=e.exontrol||{}).ll1x=o.ll1x||0,o.ll1x++),i&&i.call(r),o&&--o.ll1x}(e,!0,function(){var i=t[0],r=t[1],o=t[2],n=t[3];e.saveSts("lineWidth","strokeStyle"),e.lineWidth=this.sizeBezier(),e.strokeStyle=this.colorBezier(),e.beginPath();for(var s=i,l=i+o;s<=l;s++){var a=(s-i)/o,h=r+(1-this.oBezier.Get(a))*n;s===i?e.moveTo(s,h):e.lineTo(s,h)}e.stroke(),e.closePath(),e.loadSts()},this)},e.prototype.AdjustBezierPointToScaleView=function(e){var t=this.GetBezierScale();return e.x=t.x*Math.round(e.x/t.x),e.y=t.y*Math.round(e.y/t.y),e},e.prototype.restrictBezier=function(){return this.opt("restrictBezier",!1)},e.prototype.onChange=function(e,t){this.onchange({point:e,bezier:t})},e.prototype.onchange=function(e){this.oLts.onchange.do(e)},e.prototype.GetBezierCoord=function(){return this.oBezier.GetP12()},e.prototype.SetBezierCoord=function(e){this.oBezier.SetP12(e)},e.prototype.GetBezierP=function(e){switch(e){case 1:return this.oBezier.GetP1();case 2:return this.oBezier.GetP2()}return null},e.prototype.SetBezierP=function(e,t){switch(this.restrictBezier()&&(t.x=o.G.Bezier.adjustX(t.x),t.y=o.G.Bezier.adjustX(t.y)),e){case 1:this.oBezier.SetP1(t);break;case 2:this.oBezier.SetP2(t)}},e.prototype.bezierScaleRange=function(e){var i=e;if(t(i)&&(i.min||i.max)){if(t(i.min)&&(i.min=s(0,~~i.min)),t(i.max)&&(i.max=s(0,~~i.max)),t(i.min)&&t(i.max)){var r=l(i.min,i.max),o=s(i.min,i.max);i.min=r,i.max=o}return i}return null},e.prototype.bezierScaleX=function(){return s(0,o.ToI(this.opt("bezierScaleX",10),10))},e.prototype.bezierScaleRangeX=function(){return this.bezierScaleRange(this.opt("bezierScaleRangeX",{min:1,max:100}))},e.prototype.limitBezierScaleX=function(e){var i=this.bezierScaleRangeX();return t(i)&&(t(i.min)&&(e=s(i.min,e)),t(i.max)&&(e=l(i.max,e))),s(1,e)},e.prototype.bezierScaleY=function(){return s(0,o.ToI(this.opt("bezierScaleY",10),10))},e.prototype.bezierScaleRangeY=function(){return this.bezierScaleRange(this.opt("bezierScaleRangeY",{min:1,max:100}))},e.prototype.limitBezierScaleY=function(e){var i=this.bezierScaleRangeY();return t(i)&&(t(i.min)&&(e=s(i.min,e)),t(i.max)&&(e=l(i.max,e))),s(1,e)},e.prototype.updateBezierScale=function(){var e={x:1/this.limitBezierScaleX(this.bezierScaleX()),y:1/this.limitBezierScaleY(this.bezierScaleY())};this.SetBezierScale(e)},e.prototype.GetBezierScale=function(){var e=this.oBezierScale;return{x:e.x,y:e.y}},e.prototype.SetBezierScale=function(e){e.x=l(1,s(e.x,0)),e.y=l(1,s(e.y,0));var t=this.GetClientRect();if(!o.EyR(t)){var i=t[2],r=t[3],n=Math.round(i/s(1,e.x*i));n=this.limitBezierScaleX(n),e.x=1/n;var a=Math.round(r/s(1,e.y*r));a=this.limitBezierScaleY(a),e.y=1/a}return this.oBezierScale=e},e.prototype.IncBezierScale=function(e,t){var i=this.GetBezierScale(),r=this.GetBezierScale();0!=(e=~~e)&&(i.x=1/s(1/i.x+e)),0!=(t=~~t)&&(i.y=1/s(1/i.y+t)),this.SetBezierScale(i);var o=this.GetBezierScale();return r.x!=o.x||r.y!=o.y},e.prototype.getTfi=function(){return this.opt("tfi")},e.prototype.showBezierScaleControl=function(){return!this.isLocked()&&this.opt("showBezierScaleControl",!0)},e.prototype.colorBezierScaleControl=function(){return this.opt("colorBezierScaleControl","black")},e.prototype.drawBezierScaleControl=function(i,r){var n=this.colorBezierScaleControl();this.rtBezierScalePoint=this.getControlViewPointToRect(this.convertBezierToView(this.GetBezierScale(),r));var s=this.rtBezierScalePoint,l=i.gAO();if(l){var a=l.get(this,e.sph);t(a)&&(s=o.R.RectInc(a.state,a.range,s,this.sizeHoverPointControl()))}o.D.P.fill(i,s,n,"RoundRect",{x:2,y:2})},e.prototype.showBezierScale=function(){return this.opt("showBezierScale",!0)},e.prototype.colorTextBezierScale=function(){return this.opt("colorTextBezierScale","#A0A0A0")},e.prototype.colorTextMarginsBezierScale=function(){return this.opt("colorTextMarginsBezierScale","black")},e.prototype.colorBezierScale=function(){return this.opt("colorBezierScale","rgba(0,0,0,.10)")},e.prototype.highlightBezierScaleProgress=function(){return this.opt("highlightBezierScaleProgress",!0)},e.prototype.getBezierScaleTime=function(e){var t=Math.round(1*e/this.GetBezierScale().x);return{x:e,value:t,sValue:t.toString()}},e.prototype.measureBezierScaleTime=function(e,t){var i=e.sizeHTMLText(t.sValue);return{width:i.width+4,height:i.height+4}},e.prototype.getBezierScaleProgress=function(e){var t=Math.round(1*e/this.GetBezierScale().y);return{y:e,value:t,sValue:t.toString()}},e.prototype.measureBezierScaleProgress=function(e,t){var i=e.sizeHTMLText(t.sValue);return{width:i.width+4,height:i.height+4}},e.prototype.drawBezierScale=function(e,n){var s=n[0],l=n[1],a=n[2],h=n[3],u=this.colorBezierScale(),c=this.colorTextBezierScale(),z=this.colorTextMarginsBezierScale();e.save(),e.setLineDash([1,1]);var p=this.convertBezierToView({x:0,y:0}),B=this.convertBezierToView({x:1,y:0}),f=this.GetBezierScale(),y=(B.x-p.x)*f.x,S=null,v=8,d=null;if(y>0){var g=this.convertBezierToView({x:0,y:0}),C=this.convertBezierToView({x:0,y:1}),x=(g.y-C.y)*f.y;if(x>0){var w=this.highlightBezierScaleProgress(),V=null;w&&(V=new o.Arr);for(var P=Math.round(a/y),m=Math.round(h/x),S=null,v=8,d=null,T=0,b=p.x,G=0;G<=P;b+=y,G++,T+=f.x){var R=0==G,M=G==P;if(i(S)||S+v"+k+"",(R||M)&&(k=""+k+"");var A=this.measureBezierScaleTime(e,D),E=o.G.C2R([b,O+4],A.width,A.height,18);(i(d)||o.EyR(o.NRt(d,E))||R||M)&&(e.drawHTMLText(k,E,o.DrawTextFormatEnum.exTextAlignCenter),d=E)}if(w){var L=this.oBezier.Get(T),F=Math.round(m*o.G.Bezier.adjustX(L));V.add(F)}}e.drawEdge(n,8,c);for(var I=null,X=null,H=0,b=g.y,G=0;G<=m;b-=x,G++,H+=f.y){var R=0==G,M=G==m;if(i(I)||I-v>b||R||M){var Y=s-8;r(e,Y,b,s+a+8,b,u),I=b}var j=this.getBezierScaleProgress(H),N=j.sValue,W=R||M,K=!W;t(V)&&V.has(G)&&(W=!0,K=!1),W&&(N=""+(N=""+N+"")+""),K&&(N=""+N+"");var U=this.measureBezierScaleProgress(e,j),q=o.G.C2R([Y,b],U.width,U.height,36);(i(X)||o.EyR(o.NRt(X,q))||R||M)&&(e.drawHTMLText(N,q,o.DrawTextFormatEnum.exTextAlignCenter|o.DrawTextFormatEnum.exTextAlignVCenter),X=q)}e.drawEdge(n,1,c)}}e.restore()},e.prototype.showBezierValue=function(){return this.opt("showBezierValue",!0)},e.prototype.colorBezierValue=function(){return o.C.Convert(this.opt("colorBezierValue","#FFFF00"))},e.prototype.colorTextBezierValue=function(){return this.opt("colorTextBezierValue","black")},e.prototype.colorShadowBezierValue=function(){return this.opt("colorShadowBezierValue","#808080")},e.prototype.colorBezierValueOutside=function(){return o.C.Convert(this.opt("colorBezierValueOutside","#FFFF00"))},e.prototype.colorTextBezierValueOutside=function(){return this.opt("colorTextBezierValueOutside","black")},e.prototype.colorShadowBezierValueOutside=function(){return this.opt("colorShadowBezierValueOutside","#808080")},e.prototype.primitiveBezierValue=function(){return this.opt("primitiveBezierValue","Ellipse")},e.prototype.pArgBezierValue=function(){return this.opt("pArgBezierValue",null)},e.prototype.formatBezierValue=function(){return this.opt("formatBezierValue","` ` + round( (value MIN 0 MAX 1) * scale) + ` `")},e.prototype.getFormatBezierValue=function(e){var r=this.formatBezierValue(),n=1/this.GetBezierScale().y;if(t(r)){var s=this.oBezierValueExpr;if((i(s)||s.GetExpr()!=r)&&(s=o.E.Create(r,"value,scale"),this.oBezierValueExpr=s),s.IsValid())return s.Evaluate(function(t){switch(t){case-1:return e;case-2:return n}})}return" "+Math.round(n*o.G.Bezier.adjustX(e))+" "},e.prototype.getBezierValue=function(e){var t=this.oBezier.Get(e);return{x:e,value:t,sValue:this.getFormatBezierValue(t).toString()}},e.prototype.measureBezierValue=function(e,t){var i=e.sizeHTMLText(t.sValue),r=Math.round(3*this.sizeBezier()/2)+1,o=i.width+r,n=i.height+r;n=o=s(n,o);return{width:Math.round(o),height:Math.round(n)}},e.prototype.formatColorBezierValue=function(){return this.opt("formatColorBezierValue","round( color/2 + (color/2 * value))")},e.prototype.getFormatColorBezierValue=function(e,r){var n=this.formatColorBezierValue();this.GetBezierScale().y;if(t(n)){var s=this.oColorBezierValueExpr;if((i(s)||s.GetExpr()!=n)&&(s=o.E.Create(n,"value,color"),this.oColorBezierValueExpr=s),s.IsValid())return s.Evaluate(function(t){switch(t){case-1:return e;case-2:return r}})}return Math.round(r/2+r/2*e)},e.prototype.drawBezierValue=function(e,r){function n(e,t){return s.getFormatColorBezierValue(e,t)}var s=this,l=(r[0],r[1]),a=r[2],h=r[3],u=this.convertBezierToView({x:0,y:0}),c=this.convertBezierToView({x:1,y:0}),z=this.GetBezierScale(),p=(c.x-u.x)*z.x,B=null;if(p>0){var f=this.convertBezierToView({x:0,y:0}),y=this.convertBezierToView({x:0,y:1});if((f.y-y.y)*z.y>0){var S=this.colorBezierValue(),v=this.colorTextBezierValue(),d=this.colorShadowBezierValue(),g=this.colorBezierValueOutside(),C=this.colorTextBezierValueOutside(),x=this.colorShadowBezierValueOutside(),w=this.primitiveBezierValue(),V=this.pArgBezierValue();e.saveSts("fillStyle","strokeStyle"),e.strokeStyle=e.fillStyle=v;for(var P=Math.round(a/p),m=0,m=0,T=u.x,b=0;b<=P;T+=p,b++,m+=z.x){var G=0==b,R=b==P,M=this.getBezierValue(m),O=this.measureBezierValue(e,M),D=o.G.C2R([T,l+(1-M.value)*h],O.width,O.height);if(i(B)||o.EyR(o.NRt(B,D))||G||R){var k=M.value<0||M.value>1,A=k?g:S;if(!A.IsTrans()){var E="rgb("+n(M.value,A.r)+","+n(M.value,A.g)+","+n(M.value,A.b)+")";o.D.P.fillS(e,D,E,k?x:d,{blur:8,x:0,y:0},w,V)}var L=null;k&&(L=e.fillStyle,e.strokeStyle=e.fillStyle=C),e.drawHTMLText(M.sValue,D,o.DrawTextFormatEnum.exTextAlignCenter|o.DrawTextFormatEnum.exTextAlignVCenter),t(L)&&(e.strokeStyle=e.fillStyle=L),B=D}}e.loadSts()}}},e.prototype.bezierControlFromPoint=function(e){var i=o.G.X(e),r=o.G.Y(e);return t(this.rtBezierP1)&&o.PInfR(i,r,this.rtBezierP1)?1:t(this.rtBezierP1Duplicate)&&o.PInfR(i,r,this.rtBezierP1Duplicate)?1:t(this.rtBezierP2)&&o.PInfR(i,r,this.rtBezierP2)?2:t(this.rtBezierP2Duplicate)&&o.PInfR(i,r,this.rtBezierP2Duplicate)?2:null},e.prototype.bezierScaleFromPoint=function(e){var i=o.G.X(e),r=o.G.Y(e);return!(!t(this.rtBezierScalePoint)||!o.PInfR(i,r,this.rtBezierScalePoint))},e.prototype.onClickBezierScale=function(e,i){o.RUR.Do(e,function(e){switch(e.drag.status){case 1:this.save=this.GetBezierScale();break;case 0:t(this.save)&&(this.SetBezierScale(this.save),delete this.save,this.inv());break;case 2:var i=e.drag.current,r=this.convertViewToBezier(i.x,i.y);if(e.drag.long||e.ctrlKey||e.altKey){var o=s(r.x,r.y);r.x=o,r.y=o}this.SetBezierScale(r),this.inv()}},this)},e.prototype.onClickBezierControl=function(e,i){var r=i.code;o.RUR.Do(e,function(e){switch(e.drag.status){case 1:this.save=this.GetBezierP(r);break;case 0:t(this.save)&&(this.SetBezierP(r,this.save),delete this.save,this.inv());break;case 2:var i=e.drag.current,o=this.convertViewToBezier(i.x,i.y);(e.drag.long||e.ctrlKey||e.altKey)&&(o=this.AdjustBezierPointToScaleView(o)),this.SetBezierP(r,o),this.inv()}},this)},e.prototype.onmousemove=function(e){var t,i=this.hitTest(this.gPtr(e));return!!i&&(i.cursor&&(t=this.GetCanvas())&&(t.style.cursor=i.cursor),!0)},e.prototype.onwheel=function(e){if(this.isSelectable()){var i=this.gPtr(e);if(t(i)&&o.PInR(i.x,i.y,this.GetClientRect()))return this.dowheel(e)}return!1},e.prototype.dowheel=function(e){var t=o.WhelInc(e);if(t){var i=this.getWheelChange();if(i&&this.showBezierScaleControl()){var r=t<0?-i:i;if(this.IncBezierScale(r,r))return this.inv(),!0}}return!1},e.prototype.oncontextmenu=function(e){var i=this.gPtr(e);return t(i)&&o.PInR(i.x,i.y,this.GetClientRect()),!1},e.prototype.ondown=function(e){var i=this.gPtr(e),r=this.hitTest(i);return!!t(r)&&(r.callback instanceof Function&&r.callback.call(r.thisArg,e,r),!0)},e.prototype.onkeydown=function(e){this.onkey(e,-1)},e.prototype.onkeyup=function(e){this.onkey(e,0)},e.prototype.onkeypress=function(e){this.onkey(e,1)},e.prototype.onkey=function(e,i){t(this.oSts)&&this.oSts.onkey(e,i)},e.prototype.onlayout=function(e){if(e.IsSave())e.Add("p12",this.oBezier.GetP12()),e.Add("x-scale",this.oBezierScale.x),e.Add("y-scale",this.oBezierScale.y);else{var i=e.GetValue("p12");t(i)&&this.oBezier.SetP12(i);var r=e.GetValue("x-scale");t(r)&&(this.oBezierScale.x=r);var o=e.GetValue("y-scale");t(o)&&(this.oBezierScale.y=o)}},e.prototype.udefSts=function(e){e&&e.RemoveOf(this)},e.prototype.defSts=function(e){},e.prototype.iLts=function(){this.Listeners=this.oLts=new o.Lts,this.oLts.add("onchange")},e.prototype.on=function(e,t,i){},e.prototype.off=function(e,t,i){},o.Lts.Onf(e.prototype),e.prototype.hitTest=function(e){var i=null;if(t(e)&&this.isSelectable()){var r=this.bezierControlFromPoint(e),o=this;r?i={cursor:"pointer",code:r,callback:o.onClickBezierControl,thisArg:o}:this.bezierScaleFromPoint(e)&&(i={cursor:"pointer",code:!0,callback:o.onClickBezierScale,thisArg:o})}return i},e.prototype.onSetAO=function(t){if(t){0!=this.sizeHoverPointControl()&&(this.showBezierScaleControl()&&!t.has(this,e.sph)&&t.set({owner:this,id:e.sph,inv:this.inv,duration:125,hitTest:function(e,t){return this.isAP(e,t)&&this.bezierScaleFromPoint({x:e,y:t})}}),this.showBezierControl()&&(!t.has(this,e.p1h)&&t.set({owner:this,id:e.p1h,inv:this.inv,duration:125,hitTest:function(e,t){return this.isAP(e,t)&&1==this.bezierControlFromPoint({x:e,y:t})}}),!t.has(this,e.p2h)&&t.set({owner:this,id:e.p2h,inv:this.inv,duration:125,hitTest:function(e,t){return this.isAP(e,t)&&2==this.bezierControlFromPoint({x:e,y:t})}})))}},e.prototype.getLocked=function(){return this.opt("locked",!1)||this.opt("readOnly",!1)},e.prototype.getWheelChange=function(){return this.opt("wheelChange",1)},Object.defineProperty(e.prototype,"Options",{get:function(){return this.GetOptions()},set:function(e){this.SetOptions(e)},configurable:!0}),{Bezier:e}}()),e.Bezier=o.Bezier});