/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.exontrol||{}))}(this,function(t){"use strict";function e(t){return null!=t}function i(t){return null==t}function o(t,i){var o=!1;if(e(i.gridLineColor)){if(e(i.gridLineColor)){var n=1;e(i.gridLineSize)&&(n=h(0,a.ToN(i.gridLineSize,0))),(o=n>0)&&(t.save(),t.strokeStyle=i.gridLineColor,1!=n&&(t.lineWidth=n),e(i.gridLineDash)&&t.setLineDash(i.gridLineDash),e(i.gridLineJoin)&&(t.lineJoin=i.gridLineJoin),e(i.gridLineCap)&&(t.lineCap=i.gridLineCap))}}return o}function n(t){t.restore()}function r(t){if(a.EyR(t)){var e=u.R2C(t);t=[u.X(e),u.Y(e),0,0]}return new u.Ellipse(t)}function s(t,e){switch(t){case 1:break;case 2:e>=c&&(e-=c);break;case 3:e<3*c/2&&(e>=c?e-=c:e>=c/2&&(e+=c));break;case 4:e-=c/2;break;default:e=0}return e}var a=a||window.exontrol,p=a.ToS,h=Math.max,l=Math.min,u=a.G,c=Math.PI,f=a.Gauge,y=f.prototype,g=f.Layer,d=g.prototype,m=f.Layers.prototype,C=f.LayerObject.prototype;a.Shapes.RadialMenu={dfsubitems:{normal:{gridLineColor:"#A4A4A4",frameColor:"#808080",fillColor:"#F4F4F4",pad:-2,primitive:"Ellipse"},hover:{frameColor:"#666666",fillColor:"#A4A4A4",primitive:"Pie"},disabled:{opacity:.5}},dfitems:{normal:{gridLineColor:"#A4A4A4",frameColor:"#808080",fillColor:"#FFFFFF",pad:-2,primitive:"Ellipse"},hover:{frameColor:"#666666",fillColor:"#E4E4E4",primitive:"Pie"},disabled:{opacity:.5}},dfparent:{normal:{gridLineColor:"#A4A4A4",frameColor:"#808080",fillColor:"#F4F4F4",pad:-2,primitive:"Ellipse"},hover:{frameColor:"#666666",fillColor:"#A4A4A4",primitive:"Ellipse"},disabled:{opacity:.5}}},a.RadialMenu=f,f.states="DisplayAngle,"+f.states,f.vAlpha=16,d.isEmpty=function(t){return function(){return t.apply(this,arguments)&&!this.isSubItemsLayer()&&!this.isItemsLayer()&&!this.isParentLayer()}}(d.isEmpty),d.lP2A=function(t){return function(e,i){var o,n=t.apply(this,arguments),r=this.key;return!n&&this.rfeVIU(function(t){var s=t.oA[r];if(s&&s.axy){var p=s.axy[0],h=e,l=i;return p&&(o=u.RPO([h,l],[s.axy[1],s.axy[2]],-p),h=u.X(o),l=u.Y(o)),n=a.H.P2A(s,h,l)}}),n}}(d.lP2A),d.onA=function(t){return function(e,i){t.apply(this,arguments),e&&i.item&&a.H.VisitA(i.item.oA[i.layer.key],e)}}(d.onA),d.refresh_Pointer=function(){var t,e=this.oLys.oT,i=e.nHP,o=i>=0;this.bU(),this.SetVisible(o),this.SetSelectable(!1),(t=e.oVRI.getVRI(i))&&this.SetRotateAngle(u.R2D(t.startAngle+t.sweepAngle/2)),this.eU()},d.isSubItemsLayer=function(){return this==this.oLys.oLSu},d.isItemsLayer=function(){return this==this.oLys.oLIt},d.isParentLayer=function(){return this==this.oLys.oLPa},d.rfeVIU=function(t,e){if(t instanceof Function){if(this.onDrawLayer==this.onDrawParent)return t(this.oLys.oT.oBI,e);if(this.onDrawLayer!=d.onDrawLayer)return this.oLys.oT.oVRI.rforEachIU(t,e)}},g.Drags=a.BiM.Split("move(1),rotate(2),rotamove(3),sweep(4)"),d.GetDisplayAngle=function(){return this.oLys.oT.GetDisplayAngle()},d.SetDisplayAngle=function(t){this.oLys.oT.SetDisplayAngle(t)},d.getShape=function(t){return this.oLys.oT.getShape(t)},d.oVRI=function(){return this.oLys.oT.oVRI},d.isClick=function(){return!!this.oLys.oT.lClk},d.onDrawSubItems=function(t,i){var s=this.oLys.oT,p=~~i[2],h=~~i[3];if(p>0&&h>0){var l=s.getCompatCanvas(p,h);(function(t,i,p){var h=r(i),l=s.getSubItemsClip(i),u=r(l);if(e(p)&&(l[2]!=i[2]||l[2]!=i[2])){var c=(this.isClick()?p.click:p.hover)||p.hover;p=p.normal||p;var f=t.drawShape(i,p),y=e(c)?s.nHP:-1;h=r(f);var g=o(t,p);if(g&&t.selClip(f,p.primitive,p.pArg),this.oVRI().forEach(function(e){if(s.radBk(t,f,e,"SubColor",this),s.isPieEnabled(e.index)&&e.index==y){var i=c.pArg;c.pArg=e,t.drawShape(f,c),c.pArg=i}if(g){t.beginPath(),t.moveTo(h.xm,h.ym);var o=h.a2P(e.startAngle);t.lineTo(o.x,o.y),t.stroke()}},this),g&&(t.resClip(),n(t)),!a.EyR(l)){u=r(t.drawShape(l,{frameColor:p.frameColor,frameSize:p.frameSize,frameDash:p.frameDash,frameJoin:p.frameJoin,frameCap:p.frameCap,pad:p.pad,primitive:p.primitive,pArg:p.pArg}));var d=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",t.drawShape(a.IRt(l,-.5,-.5),{fillColor:"#000000",pad:p.pad,primitive:p.primitive,pArg:p.pArg}),t.globalCompositeOperation=d}}this.oVRI().forEach(function(e){(function(t,e,i){var o=this.pieToItem(e.pie.index);o&&this.display(t,o,i,this.getDisplaySubItems(),{caption:o.getSubCaption(),image:o.getSubImage(),disabled:!o.isEnabled(),hasChildren:0!=o.visible().length},e)}).call(s,t,{out:h,in:u,pie:e},this)},this)}).call(this,l.getContext("2d"),[0,0,p,h],this.getShape("subitems")),t.drawImage(l,i[0],i[1]),l=null}},d.onDrawItems=function(t,i){var s=this.oLys.oT,p=~~i[2],h=~~i[3];if(p>0&&h>0){var l=s.getCompatCanvas(p,h);(function(t,i,p){var h=r(i),l=s.getItemsClip(i),u=r(l);if(e(p)&&(l[2]!=i[2]||l[2]!=i[2])){var c=(this.isClick()?p.click:p.hover)||p.hover;p=p.normal||p;var f=t.drawShape(i,p),y=r(f),g=f[2]!=f[3],d=e(c)?s.nHP:-1;h=y,g&&(t.selClip(f,p.primitive,p.pArg),f=s.getSubItemsClip(f,!0),h=r(f));var m=o(t,p);if(m&&t.selClip(f,p.primitive,p.pArg),this.oVRI().forEach(function(e){if(s.radBk(t,f,e,"Color",this),s.isPieEnabled(e.index)&&e.index==d){var i=c.pArg;c.pArg=e,t.drawShape(f,c),c.pArg=i}if(m){t.beginPath(),t.moveTo(h.xm,h.ym);var o=h.a2P(e.startAngle);t.lineTo(o.x,o.y),t.stroke()}},this),m&&(t.resClip(),n(t)),!a.EyR(l)){u=r(t.drawShape(l,{frameColor:p.frameColor,frameSize:p.frameSize,frameDash:p.frameDash,frameJoin:p.frameJoin,frameCap:p.frameCap,pad:p.pad,primitive:p.primitive,pArg:p.pArg}));var C=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",t.drawShape(a.IRt(l,-.5,-.5),{fillColor:"#000000",pad:p.pad,primitive:p.primitive,pArg:p.pArg}),t.globalCompositeOperation=C}g&&(t.resClip(),h=y)}this.oVRI().forEach(function(e){(function(t,e,i){var o=this.pieToItem(e.pie.index);o&&this.display(t,o,i,this.getDisplayItems(),{caption:o.getCaption(),image:o.getImage(),disabled:!o.isEnabled(),hasChildren:0!=o.visible().length},e)}).call(s,t,{out:h,in:u,pie:e},this)},this)}).call(this,l.getContext("2d"),s.getSubItemsClip([0,0,p,h]),this.getShape("items")),t.drawImage(l,i[0],i[1]),l=null}},d.onDrawParent=function(t,e){function i(t,e,i){if(i){var n=o.oBI,s=!n.isEnabled(),p=(this.isClick()?i.click:i.hover)||i.hover;s&&(a.EyO(i.disabled)||(i=p=a.Inh(i.disabled,i.normal||i))),i=i.normal||i,t.drawShape(e,(o.bHP?p:i)||i),function(t,e,i){var o,n=i.oLObj.oLR.getRotateCenter(),s=2*this.getParentSize(),a={out:r(u.C2R(n,s,s)),in:r(u.C2R(n)),pie:{index:-1,startAngle:0,sweepAngle:0}},p=this.getDisplayParent(),h=p.visible,l=this.getParent(e),c=l.caption,f=l.image;16&h?(o=this.gCnt(this.gCtx(),c,f))&&o.rtImage&&(c=null):(1&h||(c=null),2&h||(f=null)),e&&this.display(t,e,i,p,{caption:c,image:f,disabled:!e.isEnabled(),hasChildren:0!=e.visible().length},a)}.call(o,t,n,this)}}var o=this.oLys.oT;i.call(this,t,o.getItemsClip(e),this.getShape("parent"))},C.GetValue=function(t){return function(){switch(this.onDrag){case 4:return this.oLayer.oVRI().getDisplayAngle()}return t.apply(this,arguments)}}(C.GetValue),C.getDValue=function(t){return function(){switch(this.onDrag){case 4:return this.oLayer.oVRI().getDisplayAngle()}return t.apply(this,arguments)}}(C.getDValue),C.setDValue=function(t){return function(e){switch(this.onDrag){case 4:var i=this.oLayer.getLayerRect(this.oLayer.getLayersClientRect()),o=u.Angle(u.R2C(i),e.drag.start,e.drag.current),n=e.value+o;return this.oLayer.oVRI().setDisplayAngle(n)}return t.apply(this,arguments)}}(C.setDValue),C.SetValue=function(t){return function(e){switch(this.onDrag){case 4:this.oLayer.oVRI().setDisplayAngle(e)}t.apply(this,arguments)}}(C.SetValue),m.init=function(t){return function(e){t.apply(this,arguments)}}(m.init),m.getVisibleLayers=function(t){return function(){var e=t.apply(this,arguments);return function(t){return t instanceof a.RadialMenu}(this.oT)&&(this.oT.isExpanded()||(e=this.oT.getCollapseLayers())),e}}(m.getVisibleLayers),m.onChangeLayers=function(t){return function(){function e(t,e,i,o){var n=this[t];n&&n._onDrawLayer&&(n.onDrawLayer=n._onDrawLayer,n._onDrawLayer=null),(n=this.item(i)||o&&this.item(o))&&(n._onDrawLayer=n.onDrawLayer,n.onDrawLayer=n[e]),this[t]=n}t.apply(this,arguments),e.call(this,"oLSu","onDrawSubItems","subitems","background"),e.call(this,"oLIt","onDrawItems","items"),e.call(this,"oLPa","onDrawParent","parent"),this.onPointerLayer()}}(m.onChangeLayers),m.onPointerLayer=function(){var t=this.oLPo;t&&t._refresh&&(t.refresh=t._refresh,t._refresh=null),(t=this.item("pointer")||null)&&(t._refresh=t.refresh,(t.refresh=t.refresh_Pointer).call(t)),this.oLPo=t},a.Mrg(a,function(){function t(t,e){a.host.call(this,arguments)}function o(t){this.set(t)}function n(t){this.oT=t}function r(t){this.init(t)}function c(t){this.init(null,t)}Object.addPrototypeOf(t.prototype,y),t.version="5.5",t.type="RadialMenu",t.OnDragLayerEnum={exDoNothing:0,exDoMove:1,exDoRotate:2,exDoRotamove:3,exDoSweep:4},t.DisplayRadialEnum={exDisplayRadialFlat:0,exDisplayRadialRotated:1,exDisplayRadialRotated180:2,exDisplayRadialRotated270:3,exDisplayRadialRotated90:4};t.DisplayItemsType={arrow:null,arrowColor:null,arrowSize:null,image:null,imageAlign:null,imageSize:null,caption:null,content:null,radial:null};return t.DisplayParentType={image:null,imageAlign:null,imageSize:null,caption:null,content:null,visible:null},a.Mrg(f.Options,{shapes:null,displayAngle:null,minVisibleCount:null,circular:null,subItemsSize:null,parentSize:null,expanded:null,collapseLayers:null,allowToggleExpand:null,displaySubItems:{},displayItems:{},displayParent:{},items:null,sweepOnSelect:null,highlightAny:null,browseItem:null,parent:null,root:null}),t.prototype.init=function(t){return function(e,i){this.oVRI=new n(this),this.lClk=0,this.lHov=0,this.nHP=-1,this.oR=new c(this),this.oBI=this.oR,this.nBHP=-1,t.apply(this,arguments)}}(t.prototype.init),a.ComboBox&&(t.prototype.dCBl=function(t,e,i){i.oO.label=this.oClkI&&this.oClkI.i&&i.label(2==this.oClkI.ht&&this.oClkI.i.getSubImage()||this.oClkI.i.getImage(),2==this.oClkI.ht&&this.oClkI.i.getSubCaption()||this.oClkI.i.getCaption())||""},t.prototype.cCB=function(t){var e,i=this.htItem(t),o=i.hitTest;return!i.pie&&4!=o||(1==o||2==o)&&(e=i.item)&&(!e.rgC||!e.rgC.len())},t.prototype.sCB=function(t){return t&&(this.oClkI=null),this.oClkI},t.prototype.SetCanvas=function(t,e){return a.ComboBox.implExHost(t,"onselect,onbrowse,onexpand,onchange")}(t.prototype.SetCanvas)),t.prototype.GetLayersClientRect=function(t){return function(){var e=t.apply(this,arguments);if(this.getCircular()){var i=l(e[2],e[3])/2,o=u.R2C(e);e=[o[0]-i,o[1]-i,2*i,2*i]}return e}}(t.prototype.GetLayersClientRect),t.prototype.onSwipe=function(t){return function(e,i,o,n){switch(t.apply(this,arguments),e.GetOnDrag()){case 4:n.push({f:e.GetDisplayAngle(),d:2.66*o*u.Angle(e.oLObj.oLR.getRotateCenter(!0),i,[i.x+i.dx,i.y+i.dy]),c:e.SetDisplayAngle})}}}(t.prototype.onSwipe),t.prototype.getRadius=function(){var t=this.GetLayersClientRect();return h(0,l(t[2],t[3])/2)},t.prototype.onRURStart=function(t){return function(e){t.apply(this,arguments),this.lClk++,this.lHov++,this.Refresh()}}(t.prototype.onRURStart),t.prototype.onRUREnd=function(t){return function(e){t.apply(this,arguments),this.lClk--,this.lHov--,this.onHover(this.gPtr(e)),this.Refresh()}}(t.prototype.onRUREnd),t.prototype.onHover=function(t){return function(e){if(0==this.lHov++){var i=this.p2L(e);this.oPtr=e?[u.X(e),u.Y(e)]:null,t.apply(this,arguments),this.onHoverPie(this.p2IP(e)),this.onHoverParent(i&&i.isParentLayer())}this.lHov--}}(t.prototype.onHover),t.prototype.onHoverPie=function(t){this.isLocked()||this.nHP==t||(this.nHP=t,this.resetILV()&&(this.bU(),function(t){t&&(a.A.Rng(this.sSA)?(e(this.nRefreshLayerID)&&clearTimeout(this.nRefreshLayerID),this.nRefreshLayerID=setTimeout(function(){t.refresh()})):t.refresh())}.call(this,this.oLys.oLPo),this.eU()))},t.prototype.onHoverParent=function(t){this.isLocked()||this.bHP==t||(this.bHP=t,this.oLys.oLPa&&this.oLys.oLPa.refresh())},t.prototype.resetILV=function(){var t=!1,i=this.oLys;return[i.oLSu,i.oLIt,i.oLPa,i.oLPo].forEach(function(i){e(i)&&(t=!0,this.resetLV(i))},this),t},t.prototype.defSts=function(t){return function(e){t.apply(this,arguments),e&&e.Add("Esc",this.GoBack,this)}}(t.prototype.defSts),t.prototype.iLts=function(t){return function(){t.apply(this,arguments),this.oLts.Add("onselect"),this.oLts.Add("onbrowse"),this.oLts.Add("onexpand")}}(t.prototype.iLts),t.prototype.toClick=function(t){return function(e,i){var o;return t.apply(this,arguments),this.htItem(e,i),this.isReadOnly()||a.ComboBox&&4!=i.hitTest&&((o=i.item)&&o.rgC&&o.rgC.len()||(this.oClkI={i:o,ht:i.hitTest})),i}}(t.prototype.toClick),t.prototype.onClick=function(t){return function(e){var o=t.apply(this,arguments);return this.isLocked()||o.dblClick||(this.bHP?function(){!this.isExpanded()||i(this.oBI.oP)?this.onToggleExpand():this.GoBack()}.call(this):this.nHP>=0&&function(t){var e=this.pieToItem(t);e&&e.isEnabled()&&(this.onBrowseItem(e)||this.isReadOnly()||this.onSelect(e))}.call(this,this.nHP)),o}}(t.prototype.onClick),a.ComboBox&&(t.prototype.onClick=function(t){return function(e){this.setTimeout(function(){t.call(this,e);var i=this.GetCanvas().parentElement;i&&i.oCV&&i.oCV.inv&&i.oCV.inv()})}}(t.prototype.onClick)),t.prototype.onSelect=function(t){this.onselect(t)},t.prototype.onselect=function(t){this.oLts.onselect.do(t)},t.prototype.onBrowse=function(t){this.onbrowse(t)},t.prototype.onbrowse=function(t){this.oLts.onbrowse.do(t)},t.prototype.onExpand=function(){this.onexpand(this.oR)},t.prototype.onexpand=function(t){this.oLts.onexpand.do(t)},t.prototype.htItem=function(t,i){i=i||{};var o,n,r,s=this.gPtr(t),a=this.p2LV(s);return i.pie=this.oVRI.getVRI(this.p2IP(s)),i.item=null,(r=e(i.pie))?(n=a.oLayerView.oLayer.isItemsLayer(),i.item=this.pieToItem(i.pie.index)):a&&a.oLayerView&&(o=a.oLayerView.oLayer.isParentLayer())&&(i.item=this.oBI),i.hitTest=o?4:r?n?1:2:0,i},t.prototype.p2I=function(t){return this.pieToItem(this.p2IP(t))},t.prototype.onDrag=function(t){return function(e){this.oLys.onPointerLayer(),t.apply(this,arguments)}}(t.prototype.onDrag),t.prototype.EndUpdate=function(t){return function(){t.apply(this,arguments),this.lI||this.onHover(this.oPtr)}}(t.prototype.EndUpdate),t.prototype.eU=t.prototype.EndUpdate,t.prototype.p2IP=function(t){var e,i,o,n=-1;return t&&(e=this.p2LV(t))&&((i=e.oLayerView.oLayer).isSubItemsLayer()||i.isItemsLayer())&&(o=this.oVRI.VRIFromPointer(t,e.rtView,i.getRotateAngle()))&&(n=o.index),n},t.prototype.defLayers=function(t){return function(){return t.apply(this,arguments)+"[key=subitems][drag=sweep],[key=items][drag=sweep],[key=parent][drag=nothing]"}}(t.prototype.defLayers),t.prototype.getSmooth=function(){return h(0,a.ToN(this.opt("smooth",250)))},t.prototype.GetShapes=function(){return this.oO.shapes},t.prototype.SetShapes=function(t){this.bU(),this.sShs=null,this.oO.shapes=t,this.Refresh(),this.eU()},t.prototype.getShapes=function(){return i(this.sShs)&&(this.sShs=p(this.opt("shapes","dfsubitems(subitems),dfitems(items),dfparent(parent)"))),this.sShs},t.prototype.getShape=function(t){var i=null;return e(t)&&(i=a.S.GetOf(t,this.getShapes(),"RadialMenu")),i},t.prototype.GetDisplayAngle=function(){return this.oO.displayAngle},t.prototype.SetDisplayAngle=function(t){this.bU();var e=this.getDisplayAngle();this.oO.displayAngle=t,this.resetILV(),e!=this.getDisplayAngle()&&this.oLys.onChange(this.oLys.oLSu||this.oLys.oLIt),i(this.oBI.oP)&&(this.bDA=this.getDisplayAngle()),this.eU()},t.prototype.getDisplayAngle=function(){return a.ToN(this.opt("displayAngle",0))},t.prototype.GetMinVisibleCount=function(){return this.oO.minVisibleCount},t.prototype.SetMinVisibleCount=function(t){this.bU(),this.oO.minVisibleCount=t,this.resetILV(),this.eU()},t.prototype.getMinVisibleCount=function(){return l(360,a.ToN(this.opt("minVisibleCount",8)))},t.prototype.GetCircular=function(){return this.oO.circular},t.prototype.SetCircular=function(t){this.bU(),this.oO.circular=t,this.Refresh(),this.eU()},t.prototype.getCircular=function(){return!!this.opt("circular",!0)},t.prototype.getSubItemsClip=function(t,e){var i=(e?1:-1)*h(0,this.getSubItemsSize());return a.IRt(t.slice(),i,i)},t.prototype.GetSubItemsSize=function(){return this.oO.subItemsSize},t.prototype.SetSubItemsSize=function(t){this.bU(),this.oSIS=null,this.oO.subItemsSize=t,this.Refresh(),this.eU()},t.prototype.getSubItemsSize=function(){return i(this.oSIS)&&(this.oSIS=new o(this.opt("subItemsSize","24"))),this.oSIS.eval(this.getRadius())},t.prototype.getItemsClip=function(t){var e=2*h(0,this.getParentSize());return u.C2R(u.R2C(t),e,e)},t.prototype.GetParentSize=function(){return this.oO.parentSize},t.prototype.SetParentSize=function(t){this.bU(),this.oPS=null,this.oO.parentSize=t,this.Refresh(),this.eU()},t.prototype.getParentSize=function(){return i(this.oPS)&&(this.oPS=new o(this.opt("parentSize","24"))),this.oPS.eval(this.getRadius())},t.prototype.GetExpanded=function(){return this.oO.expanded},t.prototype.SetExpanded=function(t){this.smoothExpand(t)||(this.bU(),this.oO.expanded=t,this.oLys.rgSL=void 0,this.onExpand(),this.Refresh(),this.eU())},t.prototype.isExpanded=function(){return!!this.opt("expanded",!0)},t.prototype.smoothExpand=function(t){function i(t){var e=new a.Arr;return t.getVO().forEach(function(t,i){e.push(i.oLayer)}),e}function o(t,e){t.oO.expanded=e,t.oLys.rgSL=void 0,t.onExpand(),t.onRL()}function n(t,i){t.lock(),f.forEach(function(t,o){var n=t.transparency;e(n)&&o.SetTransparency(100*(1-(n.from+i*(n.to-n.from))));var r=t.rotate;e(r)&&o.SetDefaultRotateAngle(r.from+i*(r.to-r.from));var s=t.sweep;e(s)&&o.SetDisplayAngle(s.from+i*(s.to-s.from))}),t.unlock()}a.A.Cancel(this.sSA);var r=this.getSweepOnSelect()&&this.getSmooth();if(r){var s=i(this),p=this.GetExpanded();this.lock(),o(this,t),this.unlock();var h=i(this),l=new a.Arr(s),c=new a.Arr;if(l.push(h),l.forEach(function(t){s.has(t)&&h.has(t)||c.push(t)}),r=0!=c.len()){var f=new Map;c.forEach(function(t){var e,i=h.has(t),o={};o.transparency={restore:t.GetTransparency(),from:i?0:t.getAlpha(),to:i?t.getAlpha():0},t.oLObj.isRotate()?(e=t.GetDefaultRotateAngle(),o.rotate={restore:e,from:i?e+90:e,to:i?e:e+90}):(e=t.GetDisplayAngle(),o.sweep={restore:e,from:i?e+90:e,to:i?e:e+90}),f.set(t,o)},this),t||(this.lock(),o(this,p),this.unlock());var y=this.draw,g=0;this.draw=function(e,i,o){this.getVO().forEach(function(i,o){if(c.has(o.oLayer)){i=i.slice();for(var n=u.C2R(u.R2C(i)),r=0;r<4;r++)i[r]=n[r]+(t?g:1-g)*(n[r]-i[r])}o.draw(e,i)})},n(this,0);var d=!1;a.A.Progress(function(i){g=i,n(this,i),this.Refresh(),!d&&(d=1==i)&&(this.draw=y,this.bU(),this.lock(),f.forEach(function(t,i){e(t.transparency)&&i.SetTransparency(t.transparency.restore),e(t.rotate)&&i.SetDefaultRotateAngle(t.rotate.restore),e(t.sweep)&&i.SetDisplayAngle(t.sweep.restore)}),this.unlock(),o(this,t),this.eU())},{name:this.sSA,thisArg:this,duration:this.getSmooth(),transition:t?"ease-out":"ease-in"})}}return r},t.prototype.GetAllowToggleExpand=function(){return this.oO.allowToggleExpand},t.prototype.SetAllowToggleExpand=function(t){this.oO.allowToggleExpand=t},t.prototype.allowToggleExpand=function(){return this.opt("allowToggleExpand",!0)},t.prototype.onToggleExpand=function(){this.allowToggleExpand()&&this.SetExpanded(!this.isExpanded())},t.prototype.GetCollapseLayers=function(){return this.oO.collapseLayers},t.prototype.SetCollapseLayers=function(t){this.bU(),this.oO.collapseLayers=t,this.oLys.rgSL=void 0,this.Refresh(),this.eU()},t.prototype.getCollapseLayers=function(){return this.opt("collapseLayers","parent")},t.prototype.GetDisplaySubItems=function(){return this.oO.displaySubItems},t.prototype.SetDisplaySubItems=function(t){this.bU(),this.oDSI=void 0,this.oO.displaySubItems=t,this.Refresh(),this.eU()},t.prototype.getDisplaySubItems=function(){return void 0===this.oDSI&&(this.oDSI=a.IsO(this.GetDisplaySubItems())?this.GetDisplaySubItems():null,e(this.oDSI)&&(this.oDSI=a.Inh(this.oDSI,this.defOpt().displaySubItems||{arrow:.35,content:.5,radial:1}))),this.oDSI},t.prototype.GetDisplayItems=function(){return this.oO.displayItems},t.prototype.SetDisplayItems=function(t){this.bU(),this.oDI=void 0,this.oO.displayItems=t,this.Refresh(),this.eU()},t.prototype.getDisplayItems=function(){return void 0===this.oDI&&(this.oDI=a.IsO(this.GetDisplayItems())?this.GetDisplayItems():null,e(this.oDI)&&(this.oDI=a.Inh(this.oDI,this.defOpt().displayItems||{content:.35,radial:1}))),this.oDI},t.prototype.GetDisplayParent=function(){return this.oO.displayParent},t.prototype.SetDisplayParent=function(t){this.bU(),this.oDP=void 0,this.oO.displayParent=t,this.Refresh(),this.eU()},t.prototype.getDisplayParent=function(){return void 0===this.oDP&&(this.oDP=a.IsO(this.GetDisplayParent())?this.GetDisplayParent():null,e(this.oDP)&&(this.oDP=a.Inh(this.oDP,this.defOpt().displayParent||{imageSize:[24,24],visible:16,content:1}))),this.oDP},t.prototype.GetParent=function(){return this.oO.parent},t.prototype.SetParent=function(t){this.bU(),this.oO.parent=t,this.eU()},t.prototype.getParent=function(t){var e=this.GetParent();return t&&(i((e=a.Cpy(e)||{}).caption)&&(e.caption=t.getCaption()),i(e.image)&&(e.image=t.getImage())),e},t.prototype.GetRoot=function(){return this.oR},t.prototype.SetRoot=function(t){this.bU(),this.oR.SetOptions(t),this.eU()},t.prototype.GetItems=function(){return this.oR.Save()},t.prototype.SetItems=function(t){this.bU(),this.oR.Load(t),this.Refresh(),this.eU()},t.prototype.GetSweepOnSelect=function(){return this.oO.sweepOnSelect},t.prototype.SetSweepOnSelect=function(t){this.bU(),this.oO.sweepOnSelect=t,this.Refresh(),this.eU()},t.prototype.getSweepOnSelect=function(){return this.opt("sweepOnSelect",!0)},t.prototype.GoBack=function(){if(this.isSelectable()){var t,e=this.oBI.oP;e&&(t=this.nHP,this.nHP=-1,this.setBI(e),this.nHP=t)}},t.prototype.GetBrowseItem=function(){return this.oBI},t.prototype.SetBrowseItem=function(t){this.setBI(t,!0)},t.prototype.setBI=function(t,o){(function(){this.oLys.forEach(null,function(t){a.H.StoreA(t),t.rfeVIU(function(e){a.H.StoreA(e.oA[t.key])})})}).call(this);var n=this.oR.item(t),s=!0,p=!1;if(o){var h=n;if(i(n)&&t instanceof r)for(t=t.oP;t&&i(n=this.oR.item(t));)t=t.oP;for(i(n)&&(n=this.oR);n.oP&&(!n.isVisible()||!n.visible().length);)n=n.oP;s=h==n}if(n&&n!=this.oBI){var l=n.visible().length;if(p=!n.oP||l>0){var c;if(this.getSweepOnSelect()){var f=s?this.oVRI.getVRI(this.nHP):null,y=i(f);if(y?(c=u.D2R(this.bDA||0),e(n.oP)&&l180?c-=360:C<-180&&(c+=360),this.Smooth(function(){this.SetDisplayAngle(c)},this))}this.resetILV(),this.eU(),this.onBrowse(this.oBI)}}return p},t.prototype.GetHighlightAny=function(){return this.oO.highlightAny},t.prototype.SetHighlightAny=function(t){this.bU(),this.oO.highlightAny=t,this.Refresh(),this.eU()},t.prototype.getHighlightAny=function(){return this.opt("highlightAny",!0)},t.prototype.Item=function(t){return this.oR.Item(t)},t.prototype.pieToItem=function(t){var e=this.oBI.visible();return t>=0&&t0){var r=t.fillStyle,s=t.lineWidth;t.fillStyle=n.arrowColor,t.lineWidth=n.arrowSize,t.drawArr(e,o),t.fillStyle=r,t.lineWidth=s}},t.prototype.radBk=function(t,e,i,o,n){var r,s,p,h,l=this.pieToItem(i.index);l&&(s=!l.isEnabled(),(r=l["get"+o])&&(r=r.call(l)),(s||r)&&(s&&(h=this.getShape(n.key))&&(p=h.disabled),r&&(p=a.Inh(p,{fillColor:r})),p&&t.drawShape(e,a.Inh(p,{primitive:"Pie",pArg:i}))))},t.prototype.getImagePad=function(){return 4},t.prototype.getCaptionFlags=function(){return 261},t.prototype.gCnt=function(t,i,o,n){n=n||{};var r=null,s=e(i)?a.H.Measure(t,i,void 0,this.getCaptionFlags()):null,p=e(o)?a.HP.Measure(o,n.imageSize,t):null;if(s&&p){var h=[0,0,s.width,s.height],u=[0,0,p.width,p.height];switch(e(n.imageAlign)?n.imageAlign:2){case 3:a.ORt(u,(h[2]-u[2])/2,h[3]+this.getImagePad());break;case 2:a.ORt(u,(h[2]-u[2])/2,-(u[3]+this.getImagePad()));break;case 1:a.ORt(u,h[2]+this.getImagePad(),(h[3]-u[3])/2);break;default:a.ORt(u,-(u[2]+this.getImagePad()),(h[3]-u[3])/2)}var c=function(){var t=l(u[0],h[0]),e=l(u[1],h[1]);a.ORt(u,-t,-e),a.ORt(h,-t,-e);var i=a.URt(u,h);return{width:i[2],height:i[3]}}();r={rtCaption:h,rtImage:u,oSize:c}}else s?r={rtCaption:[0,0,s.width,s.height],oSize:s}:p&&(r={rtImage:[0,0,p.width,p.height],oSize:p});return r},t.prototype.dCnt=function(t,e,i,o,n,r,s,p){var h,l,c,f,y=this.gCnt(t,n,r,s);y&&(h=u.X(o),l=u.Y(o),c=h-y.oSize.width/2,f=l-y.oSize.height/2,p&&(t.save(),t.translate(h,l),t.rotate(p),t.translate(-h,-l)),e.oA[i.key].axy=[p,h,l],this.drawItem(t,e,i,n,y.rtCaption&&a.ORt(y.rtCaption,c,f),r,y.rtImage&&a.ORt(y.rtImage,c,f)),p&&t.restore())},t.prototype.drawItem=function(t,e,i,o,n,r,s){n&&t.drawHTMLText(o,n,this.getCaptionFlags()),s&&t.drawHTMLPicture(r,s)},t.prototype.display=function(t,i,o,n,r,p){n&&r&&a.H.StoreA(i.oA[o.key]=i.oA[o.key]||{},function(){var h,l,c,f=p.out,y=p.in,g=p.pie,d=g.startAngle+g.sweepAngle/2,m=f.a2P(d),C=y.a2P(d);r.disabled&&(a.H.lA++,(l=this.getShape(o.key))&&l.disabled&&(c=a.TFI.bCTX(t,l.disabled.tfi),h=t.globalAlpha,t.globalAlpha=l.disabled.opacity)),e(n.image)&&e(r.image)&&this.dCnt(t,i,o,u.LPR(m,C,n.image),null,r.image,n,s(n.radial,d)),e(n.caption)&&e(r.caption)&&this.dCnt(t,i,o,u.LPR(m,C,n.caption),r.caption,null,n,s(n.radial,d)),e(n.content)&&this.dCnt(t,i,o,u.LPR(m,C,n.content),r.caption,r.image,n,s(n.radial,d)),e(n.arrow)&&r.hasChildren&&this.radArr(t,{x:f.xm,y:f.ym},u.LPR(m,C,n.arrow),n),r.disabled&&(t.globalAlpha=h,c&&a.TFI.eCTX(t,c),--a.H.lA)},this)},o.prototype.set=function(t){return this.oExpr=a.E.Create(t,"value")},o.prototype.get=function(){return this.oExpr.GetExpr()},o.prototype.isValid=function(){return this.oExpr.IsValid()},o.prototype.eval=function(t,e){var i=e||0;return this.isValid()&&(i=a.ToN(this.oExpr.Evaluate(function(e){return t}))),i},n.prototype.getVRICount=function(){var t=this.oT.oBI.visible().length;return h(1,h(t,this.getMinVisibleCount()))},n.prototype.getVRI=function(t){var e,i,o;return t>=0&&t<(i=this.getVRICount())&&(o=360/i,e={index:t,startAngle:u.D2R(t*o-o/2+this.getDisplayAngle()),sweepAngle:u.D2R(l(359.99,o))}),e},n.prototype.forEach=function(t,e){if(t instanceof Function)for(var i=0,o=this.getVRICount();i=0;a--)n=this.getVRI(a),(o=r.pieToItem(n.index))&&(i=t.call(e,o));return i},n.prototype.VRIFromPointer=function(t,e,i){function o(t){if(i){var e=u.X(t)-a,o=u.Y(t)-p;return[a+(e*s-o*r),p+(o*s+e*r)]}return t}i=u.D2R(i)||0;for(var n=new u.Ellipse(e),r=Math.sin(i),s=Math.cos(i),a=n.xm,p=n.ym,h=[a,p],l=0,c=this.getVRICount(),f=this.getVRI(l),y=f.startAngle,g=y,d=o(n.a2P(y)),m=u.D236(u.Angle(h,d,t));l=m)break}return f},n.prototype.getDisplayAngle=function(){return this.oT.getDisplayAngle()},n.prototype.setDisplayAngle=function(t){var e=this.oT,i=this.getDisplayAngle();return e.lI++,e.SetDisplayAngle(t),e.lI--,i!=this.getDisplayAngle()},n.prototype.getMinVisibleCount=function(){return a.ToN(this.oT.getMinVisibleCount(),1)},t.ItemOptions={visible:!0,enabled:!0,key:null,caption:null,image:null,color:null,subCaption:null,subImage:null,subColor:null,parent:null},r.prototype.init=function(t){this.oO={},this.oA={},t&&(this.oR=t.oR,this.oP=t,this.add())},r.prototype.ownCol=function(t){var i=null;return e(this.oP)&&(i=this.oP.rgC,t&&(i=i||new a.Arr,this.oP.rgC=i)),i},r.prototype.resOwnCol=function(){var t=this.oP;e(t)&&e(t.rgC)&&0==t.rgC.len()&&(t.rgC=null)},r.prototype.resetParentVisible=function(){for(var t=this,i=null;e(i=t.oP);)i.rgV=void 0,t=i},r.prototype.add=function(){var t=this.ownCol(!0);e(t)&&t.push(this)},r.prototype.toString=function(){return this.getKey()},r.prototype.forEach=function(t,e){e=e||this,this.rgC&&this.rgC.forEach(function(i){t.call(e,i),i.forEach(t,e)})},r.prototype.parents=function(){for(var t=[],i=this.oP;e(i);)t.push(i),i=i.oP;return t},r.prototype.descendants=function(){var t=new a.Arr;if(this.rgC){t.push(this.rgC);for(var e=0;e=0&&(n=n||[]).push({o:s,p:h})}i(s,o.subText)}),e(n)&&(n.sort(function(t,e){return t.p-e.p}),n.forEach(function(t){t.o.SetPosition(t.p)}))}var o=this.oR,n=this.oP;return o.bU(),this.Remove(),i(n||this,t),o.eU(),this},r.prototype.Save=function(){function t(e){var o="",n=i(e.oP);if(!n){o=a.B.quoteC(e.getCaption());var s=r.F.Save(e);e.GetPosition()!=e.GetIndex()&&(s=s||new Map).set("pos",e.GetPosition()),o+=a.B.quoteF(s)}var p=[];return e.rgC&&e.rgC.forEachI(function(e){p.push(t(e))}),o+=a.B.quoteS(p,!n&&p.length)}return t(this)},r.prototype.GetOptions=function(){return this.oO},r.prototype.SetOptions=function(t){var e=this.oR;e.bU(),a.IsO(t)?a.Mrg(this.oO,t):this.SetCaption(t),e.onKey(this),e.eU()},r.prototype.GetKey=function(){return this.oO.key},r.prototype.SetKey=function(t){var e=this.oR;e.bU(),this.oO.key=t,e.onKey(this),e.eU()},r.prototype.getKey=function(){var t=this.GetKey();return(t=e(t)?t.toString():"")||this.getPlainCaption()},r.prototype.GetVisible=function(){return this.oO.visible},r.prototype.SetVisible=function(t){var e=this.oR;e.bU(),this.resetParentVisible(),this.oO.visible=t,e.eU()},r.prototype.isVisible=function(){var t=this.GetVisible();return!(!t&&!i(t))&&(!e(this.oP)||this.oP.isVisible())},r.prototype.GetEnabled=function(){return this.oO.enabled},r.prototype.SetEnabled=function(t){var e=this.oR;e.bU(),this.oO.enabled=t,e.eU()},r.prototype.GetDisabled=function(){return!this.GetEnabled()},r.prototype.SetDisabled=function(t){this.SetEnabled(!t)},r.prototype.SetDisabled=function(t){this.SetEnabled(!t)},r.prototype.isEnabled=function(){var t=this.GetEnabled();return!(!t&&!i(t))&&(!e(this.oP)||this.oP.isEnabled())},r.prototype.GetIndex=function(){var t=this.ownCol();return e(t)?t.indexOf(this):-1},r.prototype.GetPosition=function(){var t=this.ownCol();return e(t)?t.getPos(this):-1},r.prototype.SetPosition=function(t){if(e(t)){var i=this.ownCol(),o=this.oR;e(i)&&(o.bU(),this.resetParentVisible(),i.setPos(this,t),o.eU())}},r.prototype.GetCaption=function(){return this.oO.caption},r.prototype.SetCaption=function(t){var e=this.oR;return e.bU(),this.oO.caption=t,e.onKey(this),e.eU(),this},r.prototype.getCaption=function(){return this.GetCaption()},r.prototype.getPlainCaption=function(){return a.H.TextNoHTML(this.getCaption())},r.prototype.GetImage=function(){return this.oO.image},r.prototype.SetImage=function(t){var e=this.oR;e.bU(),this.oO.image=t,e.eU()},r.prototype.getImage=function(){return this.GetImage()},r.prototype.GetColor=function(){return this.oO.color},r.prototype.SetColor=function(t){var e=this.oR;e.bU(),this.oO.color=t,e.eU()},r.prototype.getColor=function(){return this.GetColor()},r.prototype.GetSubCaption=function(){return this.oO.subCaption},r.prototype.SetSubCaption=function(t){var e=this.oR;return e.bU(),this.oO.subCaption=t,e.eU(),this},r.prototype.getSubCaption=function(){return this.GetSubCaption()},r.prototype.GetSubImage=function(){return this.oO.subImage},r.prototype.SetSubImage=function(t){var e=this.oR;e.bU(),this.oO.subImage=t,e.eU()},r.prototype.getSubImage=function(){return this.GetSubImage()},r.prototype.GetSubColor=function(){return this.oO.subColor},r.prototype.SetSubColor=function(t){var e=this.oR;e.bU(),this.oO.subColor=t,e.eU()},r.prototype.getSubColor=function(){return this.GetSubColor()},r.prototype.GetParent=function(){return this.oP},r.prototype.getParent=r.prototype.GetParent,Object.addPrototypeOf(c.prototype,r.prototype),c.prototype.init=function(t){return function(e,i){t.call(this,e),this.lU=0,this.oR=this,this.oT=i,this.mK2I=null}}(c.prototype.init),c.prototype.item=function(t){function e(t,i){if(i=i||new Map,t.oP){var o=t.getKey();i.get(o)||i.set(o,t)}return t.rgC&&t.rgC.forEach(function(t){e(t,i)}),i}return this.has(t)?t:(i(this.mK2I)&&(this.mK2I=e(this)),this.mK2I.get(t)||null)},c.prototype.has=function(t){var e=t==this;if(!e&&t instanceof r&&this.rgC){for(var i=null;(i=t.ownCol())&&i.has(t);t=t.oP);e=t==this}return e},c.prototype.bU=function(){this.lU++,this.oT.bU()},c.prototype.eU=function(){0==--this.lU&&(this.oT.onRL(),this.oT.setBI(this.oT.oBI,!0)),this.oT.eU()},c.prototype.onKey=function(t){this.mK2I=null},c.prototype.onAdd=function(t){t.resetParentVisible(),this.onKey(t)},c.prototype.onRemove=function(t){for(var e in t.oA)a.H.StoreA(t.oA[e]);t.resetParentVisible(),this.onKey(t)},a.expO(a.Mrg({Canvas:null,Options:null},f.Options),t.prototype),a.expO(a.Mrg({Options:null,Disabled:null,Index:null,Position:null},t.ItemOptions),r.prototype),t.Item=r,{RadialMenu:t}}()),a.CMp(f,a.RadialMenu),t.RadialMenu=a.RadialMenu});