/* @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,e){function o(t){return t&&t.tfi&&s.IsS(t.tfi)&&(t.tfi=s.ToTFI(t.tfi)),t}return s.Inh(o(t),o(e))}function o(t){return null!=t}function i(t){return null==t}function n(t,e,o){return i(t)?~~o:s.s2F(t,e)}var r,s=s||window.exontrol,h=s.G,a=s.ToS,u=s.ToI,l=Math.max,p=Math.min;s.Shapes.Menu={dfitem:{normal:{},disabled:{opacity:.5},checked:{fillColor:"rgba(0,0,0,0.125)",frameColor:"rgba(0,0,0,0.25)",pad:-1},hover:{fillColor:"rgba(0,0,0,0.25)",frameColor:"rgba(0,0,0,0.5)",pad:-1},click:{fillColor:"rgba(0,0,0,0.30)",frameColor:"rgba(0,0,0,.55)",pad:-1},open:{fillColor:"rgba(0,0,0,0.30)",frameColor:"rgba(0,0,0,.55)",pad:-1}},dfcap:{normal:{formatText:s.DrawTextFormatEnum.exTextWordEllipsis}},dfsep:{normal:{fillColor:"rgba(0,0,0,0.20)"}},dfflat:{normal:{pad:-1,fillColor:"rgba(0,0,0,0.10)",frameColor:"rgba(0,0,0,0.5)"}},dfsub:{normal:{pad:-1,frameColor:"rgba(0,0,0,0.25)"}},dfarrow:{normal:{fillColor:"rgba(0,0,0,0.75)",primitive:"EllipticPolygon",pArg:{edges:3,startAngle:Math.PI/2}}},dfbarrow:{normal:{pArg:{startAngle:Math.PI}}}},s.Mrg(s,function(){function t(t,e){s.host.call(this,arguments)}function c(t,e,n){var r=i(t)||s.IsS(t);if(this.rgCI=[],this.caption=r?null:t.caption,this.flags=r?null:t.flags,this.id=void 0,this.oP=e||null,this.autoID=0,i(this.oP))c.AutoID=0;else{var h=this.oP.rgCI;h.splice(o(n)?n:h.length,0,this),this.setAutoID()}c.AutoID+=10,this.set(r?t:t.subText)}function f(){this.rgO=new s.BiM}function g(t,e){this.oM=t,this.oI=e,this.size={width:0,height:0},this.oD=new f,this.rgVP=new s.M1,this.mI2I=e.dscnID(),this.oST=this.getTabs(),this.mVAg=null;var i=t.GetClientRect(),n=null;if(t.isWrap()&&(n={width:i[2],height:i[3]}),this.size=this.build(n),o(n)&&t.isScroll()&&t.getScrollClip()){var r=t.getScrollSize(!0);r&&(this.size.width+r>i[2]&&(n.width-=r),this.size.height+r>i[3]&&(n.height-=r),this.size=this.build(n))}}t.version="5.5",t.type="Menu",t.reqEsc=",()[]\\\"'=",t.escape=function(e){for(var o,i="",n=t.reqEsc,r=0,s=e.length;r=0&&(o="\\"+o),i+=o;return i},t.FlatEnum={exNormal:0,exShowFlat:1,exAlwaysFlat:2},t.GroupPopupEnum={exNone:0,exGroup:1,exSameWidth:16,exSameHeight:32,exGroupVertical:256},t.ArrangeItemsEnum={exArrangeItemsHorizontal:1,exArrangeItemsVertical:2,exArrangeItemsHideTopArrow:16,exArrangeItemsPopupAlign:32,exArrangeItemsWrap:256,exArrangeItemsScroll:512,exArrangeItemsAlignCenter:1024,exArrangeItemsAlignReverse:2048},t.ShowAsButtonEnum={exNone:0,exButton:1,exSelectButton:17,exSelectButtonDown:273,exSelectList:512},t.ShowCheckedAsSelectedEnum={exDefault:0,exCheckHighlight:-1,exItemHighlight:1},t.DisplayTypeEnum={exNormal:0,exCheck:1,exRadio:2},t.ShowPopupAlignEnum={exNone:0,exDown:1,exRight:2},t.AlignContextMenuEnum={exLeftAlign:0,exCenterAlign:4,exRightAlign:8,exTopAlign:0,exVCenterAlign:16,exBottomAlign:32},t.CloseOnClickEnum={exCloseOnDefault:0,exCloseOnDisabled:1,exCloseOnSeparator:2,exCloseOnButton:4,exCloseOnCheck:8,exCloseOnRadio:16,exCloseOnState:24,exCloseOnAny:-1},t.Options={tfi:null,locked:null,readOnly:null,debug:null,wheelChange:null,items:null,criSize:null,criPad:null,criAlign:null,criFlat:null,pad:null,itemsPad:null,align:null,arrSize:null,arrangeItemsAs:null,subArrangeItemsAs:null,sepSize:null,btnPad:null,btnArrSize:null,show:null,scrollSize:null,scrollClip:null,scrollOpt:null,smoothSel:null,shapes:null,cursors:null,open:null,close:null,subOpen:null,subClose:null,outClose:null,popupRatio:null,closeOnClick:null,alignClient:null,alignContextMenu:null,allowToggleRadio:null,x:null,y:null},t.prototype.init=function(t,e){this.lI=0,this.lL=0,this.lUhI=0,this.bF=!1,this.handlers={oEF:null,oPM:null,oRI:null,rgF:null,oDI:null,oLyt:null,oLytVI:null},this.iLts(),this.oO=s.Cpy(this.defOpt()),this.SetClientRect(t),s.CC.GetCanvas(t)&&this.SetCanvas(t),this.SetOptions(e||this.defOpt(),!0),s.DPR.Reg(this),this.GetCanvas()||(o(this.GetX())||o(this.GetY()))&&this.Open()},t.prototype.defOpt=function(){return s[this.constructor.type].Options},s.SB.addProto(t.prototype),t.prototype.GetOptions=function(){return this.getRootMenu().oO},t.prototype.SetOptions=function(t,e){var i=!1;if(o(t)){var n=[],r=this.GetOptions();if(o(r)){for(var h in r){var a=t[h];void 0!==a&&(n.push(h),r[h]!==a&&(r[h]=s.CpV(a)))}if(e)for(var h in t)h in r||(r[h]=s.CpV(t[h]));(i=0!=n.length)&&(this.bU(),n.forEach(function(t){var e=s.setM(t);e in this&&this[e].call(this,r[t])},this),this.eU())}}return i},t.prototype.opt=function(t,e){var o=this.getRootMenu().GetOptions()[t];return i(o)&&null==(o=this.defOpt()[t])&&(o=e),o},t.prototype.GetCanvas=function(){return this.canvas},t.prototype.SetCanvas=function(t,e){this.isRootMenu()&&this.clearFloats(),o(this.oScrollBar)&&(this.oScrollBar.SetCanvas(null),this.oScrollBar=null),this.udefSts(this.oSts),this.oSts=null,this.resAO(),t=s.CC.GetCanvas(t),s.HP.off("change",this,"onimg"),t&&s.HP.on("change",this,"onimg"),!e&&s.CC.SetCanvas(this,t),this.canvas=t,s.CC.GetCanvas(this.canvas)&&(this.Shortcuts=this.oSts=new s.Sts,this.defSts(this.oSts))},s.ComboBox&&(t.prototype.dCBl=function(t,e,o){var i=this.oSelI;o.oO.label=i&&o.label(i.hasImage(),this.getCaption(i))||""},t.prototype.cCB=function(t){var e,o=this.e2M(t),i=!o||!o.item;return i||o&&(e=o.item)&&(i=!e.isPopup()&&!e.hasCheckRadio()),i},t.prototype.sCB=function(t){return t&&(this.oSelI=null),this.oSelI},t.prototype.SetCanvas=function(t,e){return s.ComboBox.implExHost(t,"onselect,oncheck,onuncheck")}(t.prototype.SetCanvas)),t.prototype.onimg=function(){this.Refresh()},t.prototype.SetClientRect=function(t){var e=s.CC.GetCanvas(t);e&&(t=[0,0,e.width,e.height]),this.client=s.C2R(t),this.visAO()||this.resAO(),this.onRL()},t.prototype.GetClientRect=function(){return this.client.slice()},t.prototype.GetCanvasRect=function(){var t=this.GetClientRect(),e=this.GetCanvas();return o(e)&&(t=[0,0,e.width,e.height]),t},t.prototype.GetVisibleRect=function(){return s.NRt(this.GetClientRect(),this.GetCanvasRect())},t.prototype.GetViewRect=function(){return s.EArtC(this.GetCanvas())},t.prototype.c2V=function(t,e){return s.CW.prototype.c2V.apply(this,arguments)},t.prototype.v2C=function(t,e){return s.CW.prototype.v2C.apply(this,arguments)},t.prototype.c2Vrt=function(t){var e=this.c2V(t);return[e.x,e.y,t[2],t[3]]},t.prototype.v2Crt=function(t){var e=this.v2C(t);return[e.x,e.y,t[2],t[3]]},t.prototype.postrfhAO=function(){if(this.GetCanvas()){var t=this;setTimeout(function(){t.rfhAO()},0)}},t.prototype.invAll=function(){this.reverseForEachFloatMenu(function(t){t.rfhAO()}),this.rfhAO()},t.prototype.asDisabled=function(t){return!this.isSelectable()||t.asDisabled()},t.prototype.asSelectable=function(t){return!!this.isSelectable()&&t.isSelectable()},t.prototype.setAO=function(t){if(this.visAO()){var e,o=!0;this.oEF?e=this.oEF.oAO:(e=t.gAO())&&(o=!1,!e.lU&&this.onSetAO(e),e.hasOf(this)&&e.onDrawAO(this.drawAO,this)),o&&this.drawAO(t,e)}else this.resAO()},t.prototype.isAM=function(t,e){function o(t,e){var o=t.v2C(e);return s.PInR(o.x,o.y,t.GetVisibleRect())}var i=this.c2V(t,e),n=o(this,i);return this.reverseForEachFloatMenu(function(t){if(o(t,i))return n=this==t,!0},this),n},t.prototype.isAP=function(t,e){var o;return this.isEnabled()&&((o=this.W())?o.isAP(t,e):this.isAM(t,e))},t.prototype.updateHoverItem=function(t,e){var n=null;if(o(t)&&this.e2FM(t)==this){var r=this.itemFromPointer(this.gPtr(t));o(n=o(r)?r.item:null)&&n==this.getDisplayItem()&&(n=null)}if(n!=this.oHoverItem){this.oHoverItem=n;var s=this,h=this.getRootMenu();0==h.lUhI++&&this.feM(function(e){e!=this&&(e.updateHoverItem(t,!1),o(e.oHoverItem)&&(s=e))},this),h.lUhI--,(i(e)||e)&&setTimeout(function(){s.onHoverItem(s.oHoverItem),s.invAll()})}},t.prototype.onmousemove=function(t){this.updateHoverItem(t);var e,o=this.gPtr(t),i=this.getCursor(o);return(e=this.GetCanvas())&&(e.style.cursor=i||"auto"),i},t.prototype.onmouseover=function(t){},t.prototype.onmouseout=function(t){this.updateHoverItem(t)},t.prototype.onwheel=function(t){var e=this.isSelectable();if(e){e=o(this.oScrollBar)||v.Is(this);var i=this.gPtr(t);o(i)&&s.PInR(i.x,i.y,this.GetClientRect())&&this.dowheel(t)}return e},t.prototype.dowheel=function(t){var e=!1;if(s.WhelInc(t)&&o(this.oScrollBar)){var i=this.getWheelChange();if(i)for(var n=0;n=0&&(r=!t.call(e,n[h],h+1));h--);r&&t.call(e,i,0)}},t.prototype.reverseForEachFloatMenu=function(t,e){if(t instanceof Function){e=e||this;var i=this.getRootMenu().handlers.rgF;if(o(i))for(var n=i.length,r=n-1;r>=0&&!t.call(e,i[r],r);r--);}},t.prototype.getFloatPopup=function(t){var e=null;return o(t)&&t.isPopup()&&this.reverseForEachFloatMenu(function(o){if(o.handlers.oDI==t)return e=o,!0}),e},t.prototype.getItemFloatLevel=function(t){var e=-1;return i(t)?e=this.getFloatLevel():this.feM(function(i,n){if(function(t,e){return o(t.getItemRect(e))}(i,t))return e=n,!0}),e},t.prototype.getFloatLevel=function(){var t=-1;return this.feM(function(e,o){if(e==this)return t=o,!0},this),t},t.prototype.resetHandlers=function(){for(var t in this.handlers)this.handlers[t]=null},t.prototype.getParentMenu=function(){return this.handlers.oPM},t.prototype.isRootMenu=function(){return i(this.getParentMenu())},t.prototype.isTopMenu=function(){return this==this.getTopMenu()},t.prototype.clearFloats=function(t){var e=this.getRootMenu(),o=e.handlers.rgF;if(o){var i=o.length;if(i>0){var n=l(0,t=t||0);if(n=n;h--){var a=o[h];e.saveScrollPos(a),a.SetCanvas(null),s.EF.Destroy(a.handlers.oEF),r.push(a)}o.splice(t),e.endFloat(),e.invAll(),r.length&&r.forEach(function(t){e.onCloseFloatMenu(t),t.resetHandlers()})}}}},s.Def.CN.floatMenu="exmenu",t.prototype.addFloat=function(e){var n=!0,r=null,h=this.getRootMenu(),a=o(e)&&e.isPopup(),u=this.getItemFloatLevel(e),l=h.getFloatCount();if(a&&l&&l==u+1){var p=this.getFloatPopup(e);p==h.getFloat(u)&&(n=!1,r=p)}if(n){if(h.beginFloat(),this.clearFloats(u),a){var c,f,g,v,y=this.getItemRect(e),d=i(e.oP);if(y?y=this.c2Vrt(s.NRt(y,this.GetVisibleRect())):d&&(y=[this.getX(),this.getY()||0,0,0]),y&&(c=this.CSSzom(),h.handlers.rgF=h.handlers.rgF||[],f=s.EF.Create({tag:"canvas",pointerEvents:"",class:s.Def.CN.floatMenu+" "+s.Def.CN.ppEF,inner:{style:{zoom:c}}}))){g=f.oHE,v=this.getAlignClient(),r=new t(g),h.handlers.rgF.push(r),r.handlers.oEF=f,r.handlers.oPM=this,r.handlers.oRI=this.getRootItem(),r.handlers.oDI=e,r.SetClientRect(g);var m=s.pgrt(),S=this.getPopupSize(m,r.Lyt().size),C=e.getPopupRect(this,y,S);s.IRt(m,-8,-8);var R=s.IBox(C,g);if(v||s.ORt(R,-(R[0]-C[0]),-(R[1]-C[1])),d){var I=v?C:R,P=this.getAlignContextMenu(),O=P&t.AlignContextMenuEnum.exCenterAlign?2:P&t.AlignContextMenuEnum.exRightAlign?1:0,A=P&t.AlignContextMenuEnum.exVCenterAlign?2:P&t.AlignContextMenuEnum.exBottomAlign?1:0;s.ORt(R,O?-I[2]/O:0,A?-I[3]/A:0)}if(c)for(var b=0;b<4;b++)m[b]/=c;if(s.FRt(R,m),s.ORt(C,R[0]-C[0],R[1]-C[1]),s.BOf(R)>s.BOf(y)){var w=s.NRt(y,s.IBox(R,g,-1));s.EyR(w)||(R[1]=s.BOf(y),s.FRt(R,m),s.ORt(C,R[0]-C[0],R[1]-C[1]))}f.SetClient(C),r.lL++,r.handlers.oLytVI=null,r.SetClientRect(g),r.lL--,h.restoreScrollPos(r),r.inv(),this.postrfhAO()}}h.endFloat(),o(r)&&(h.onfloat(r),setTimeout(function(){h.onOpenFloatMenu(r)}))}return r},t.prototype.getFloatCount=function(){return this.handlers.rgF&&this.handlers.rgF.length||0},t.prototype.getFloat=function(t){return t>=0&&o(this.handlers.rgF)&&t0){var e=t[0];if(o(e))return e.handlers.oDI==e.handlers.oRI}return!1},t.prototype.onFloatCountChange=function(){v.OnFloatCountChange(this),this.lockScrollBars()},t.prototype.doLockScrollBars=function(){var t=this.getActiveMenu();this.feM(function(e){var i=e.oScrollBar;o(i)&&i.SetLocked(e!=t)})},t.prototype.lockScrollBars=function(){this.nTimeoutLockSBS&&clearTimeout(this.nTimeoutLockSBS);var t=this.getRootMenu();this.nTimeoutLockSBS=setTimeout(function(){t.doLockScrollBars()})},t.prototype.onRL=function(t){o(t)&&!t||this.resAO(),this.sShs=null,this.sCrs=null,this.bDebug=null,this.lL||(this.oHoverItem=null,this.handlers.oLytVI=null,this.handlers.oLyt=null),this.onRecalcScrollBar()},t.prototype.onRecalcScrollBar=function(){var t=!1;if(this.isScroll()){var e=this.getScrollRange();if(t=0!=e){if(i(this.oScrollBar)){this.oScrollBar=new s.ScrollBar(this.GetCanvas(),this.getScrollOpt()),this.oScrollBar.SetIgnoreLargeChange(!1);var n=this.oScrollBar.onchange,r=this;this.oScrollBar.onchange=function(){n.call(this),r.onscroll(this)},this.oScrollBar.SetScrollRect=this.oScrollBar.SetClientRect,this.oScrollBar.SetClientRect=function(t){}}s.CC.SetZOrd(this.oScrollBar,s.CC.GetZOrd(this)+1);var h=this.GetClientRect().slice();this.isScrollVertical()?(h[0]=s.ROf(h)-this.getScrollSize(),h[2]=this.getScrollSize()):(h[1]=s.BOf(h)-this.getScrollSize(),h[3]=this.getScrollSize()),this.oScrollBar.SetScrollRect(h),this.oScrollBar.SetInfo({range:e,page:this.getScrollPage()})}}t||o(this.oScrollBar)&&(this.oScrollBar.SetCanvas(null),this.oScrollBar=null)},t.prototype.onscroll=function(t){this.resAO(),this.handlers.oLytVI=null,this.bF=!1,this.clearFloats(this.getFloatLevel())},t.prototype.onSetAO=function(t){var e=this.getVisibleItems();if(o(e)&&!t.hasOf(this)&&this.isSelectable()){var i=this.getSmoothSel();e.forEach(function(e,n){e.forEach(function(e,r){var h=this.getPartShapes(n,r,!1);h&&(!s.EyO(h.hover)&&t.set({owner:this,id:this.idAOfH(n,r),item:n,part:r,inv:this.inv,hitTest:function(t,e,i){return!!this.isAP(t,e)&&o(this.ptInPart(t,e,i.item))},duration:i}),!s.EyO(h.click)&&t.set({owner:this,id:this.idAOfC(n,r),item:n,part:r,inv:this.inv,hitTest:function(t,e,i){return!!this.isAP(t,e)&&o(this.ptInPart(t,e,i.item))},actOn:4,duration:i}))},this)},this)}},t.prototype.BeginUpdate=function(){this.lI++,s.AO.tlA(this.gAO(),!0)},t.prototype.bU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){--this.lI||(this.rfhAO(),s.AO.tlA(this.gAO(),!1))},t.prototype.eU=t.prototype.EndUpdate,t.prototype.Update=function(t,e){this.bU(),t&&t.call(e||this),this.eU()},t.prototype.GetClipRect=function(){var t=this.GetClientRect();if(o(this.oScrollBar)&&this.getScrollClip()){var e=this.getScrollSize();e&&(t[s[this.isScrollVertical()?"w":"h"]]-=e)}return t},t.prototype.getOrigin=function(t){var e={x:(t=t||this.GetClientRect())[0],y:t[1]},o=this.getScrollPos();return o&&(e[this.isScrollVertical()?"y":"x"]-=o),e},t.prototype.drawItem=function(t,o,i,n){function r(t,o,i){var n=t.gAO(),r=this,h=this.asDisabled(o),a=this.isOpenItem(o);i.forEach(function(i,u){!function(i,h,u){var l,p=(i=i||{}).normal||i;o.asChecked(r)&&(s.EyO(i.checked)||(p=e(i.checked,p))),r.asDisabled(o)?s.EyO(i.disabled)||(p=e(i.disabled,p)):o.isSeparator()||n&&(s.EyO(i.hover)||(l=n.get(r,r.idAOfH(o,h)))&&(p=s.R.Shape(l.state,l.range,{from:p,to:i.hover})),a?s.EyO(i.open)?s.EyO(i.click)||(p=e(i.click,p)):p=e(i.open,p):s.EyO(i.click)||(l=n.get(r,r.idAOfC(o,h)))&&(p=s.R.Shape(l.state,l.range,{from:p,to:i.click})));var f={object:o,part:h,state:o.getState()};switch(h){case c.PartEnum.exCaption:f.text=r.getCaption(o),f.formatText=(p?p.formatText:0)||0;break;case c.PartEnum.exImage:var g=o.hasImage();g&&(f.text=""+g+":"+u[2]+":"+u[3]+"",f.formatText=0)}t.drawShape(u,p,f)}(this.getPartShapes(o,u,h),u,i)},this)}var h=t.asDisabled(i);h&&s.H.lA++,r.call(t,o,i,n),h&&--s.H.lA},t.prototype.draw=function(t,e,o){var i=this.getVisibleItems(),n=this.getRootMenu();i&&(t.selClip(this.GetClipRect()),i.forEach(function(e,o){n.drawItem(this,t,o,e)},this),t.resClip())},t.prototype.getAOMaskID=function(t,e){var n="menu.hitTest.*.";return i(e)&&(e="*"),o(t)?n+=this.Lyt().op2k(t,e):n+="*:"+e,n},t.prototype.idAOfH=function(t,e){return"menu.hitTest.hover."+this.Lyt().op2k(t,e)},t.prototype.idAOfC=function(t,e){return"menu.hitTest.click."+this.Lyt().op2k(t,e)},t.prototype.isOpenItem=function(t){var e=!1;if(o(t)&&t.isPopup()&&o(this.getFloatPopup(t))&&(!this.oHoverItem||this.oHoverItem==t)){e=!0;var i=this.getParentMenu();o(i)&&(e=i.isOpenItem(this.getDisplayItem()))}return e},t.prototype.GetTfi=function(){return this.GetOptions().tfi},t.prototype.SetTfi=function(t){this.bU(),this.GetOptions().tfi=t||null,this.onRL(),this.eU()},t.prototype.getTfi=function(){return this.opt("tfi")},t.prototype.GetLocked=function(){return this.GetOptions().locked},t.prototype.SetLocked=function(t){this.bU(),this.GetOptions().locked=t,this.onRL(),this.eU()},t.prototype.getLocked=function(){return this.opt("locked",!1)},t.prototype.GetReadOnly=function(){return this.oO.readOnly},t.prototype.SetReadOnly=function(t){this.bU(),this.oO.readOnly=t,this.onRL(),this.eU()},t.prototype.isReadOnly=function(){return this.opt("readOnly",!1)},t.prototype.GetDebug=function(){return this.GetOptions().debug},t.prototype.SetDebug=function(t){this.bU(),this.GetOptions().debug=t,this.onRL(),this.eU()},t.prototype.getDebug=function(){var t=this.bDebug;return i(t)&&(t=this.opt("debug",!1),this.bDebug=t),t},t.prototype.GetWheelChange=function(){return this.GetOptions().wheelChange},t.prototype.SetWheelChange=function(t){this.bU(),this.GetOptions().wheelChange=t,this.onRL(),this.eU()},t.prototype.getWheelChange=function(){return this.opt("wheelChange",1)},t.prototype.GetPad=function(){return this.GetOptions().pad},t.prototype.SetPad=function(t){this.bU(),this.GetOptions().pad=t,this.onRL(),this.eU()},t.prototype.GetItemsPad=function(){return this.GetOptions().itemsPad},t.prototype.SetItemsPad=function(t){this.bU(),this.GetOptions().itemsPad=t,this.onRL(),this.eU()},t.prototype.GetCriSize=function(){return this.GetOptions().criSize},t.prototype.SetCriSize=function(t){this.bU(),this.GetOptions().criSize=t,this.onRL(),this.eU()},t.prototype.getCriSize=function(){return l(0,s.ToN(this.opt("criSize",16),0))},t.prototype.getFlatWidth=function(){var t=[0,0,this.getCriSize(),0];return s.PRt(t,this.getDisplayItem().getPad(this)),s.PRt(t,this.getCriPad()),t[2]},t.prototype.GetCriPad=function(){return this.GetOptions().criPad},t.prototype.SetCriPad=function(t){this.bU(),this.GetOptions().criPad=t,this.onRL(),this.eU()},t.prototype.getCriPad=function(){return s.pad2A(this.opt("criPad",[0,0]))},t.prototype.GetCriAlign=function(){return this.GetOptions().criAlign},t.prototype.SetCriAlign=function(t){this.bU(),this.GetOptions().criAlign=t,this.onRL(),this.eU()},t.prototype.getCriAlign=function(){return!!this.opt("criAlign",!1)},t.prototype.GetCriFlat=function(){return this.GetOptions().criFlat},t.prototype.SetCriFlat=function(t){this.bU(),this.GetOptions().criFlat=t,this.onRL(),this.eU()},t.prototype.getCriFlat=function(){return n(this.opt("criFlat"),t.FlatEnum,t.FlatEnum.exShowFlat)},t.prototype.GetAlign=function(){return this.GetOptions().align},t.prototype.SetAlign=function(t){this.bU(),this.GetOptions().align=t,this.onRL(),this.eU()},t.prototype.getAlign=function(){var t=this.getArrangeItemsAs();return 1024==(1024&t)?1:2048==(2048&t)?2:u(this.GetAlign(),-1)},t.prototype.GetArrSize=function(){return this.GetOptions().arrSize},t.prototype.SetArrSize=function(t){this.bU(),this.GetOptions().arrSize=t,this.onRL(),this.eU()},t.prototype.getArrSize=function(){return l(0,s.ToN(this.opt("arrSize",6),0))},t.prototype.GetArrangeItemsAs=function(){return n(this.GetOptions().arrangeItemsAs,s.Menu.ArrangeItemsEnum)},t.prototype.SetArrangeItemsAs=function(t){this.bU(),this.GetOptions().arrangeItemsAs=t,this.onRL(),this.eU()},t.prototype.getArrangeItemsAs=function(){return n(this.opt(this.isTopMenu()?"arrangeItemsAs":"subArrangeItemsAs"),s.Menu.ArrangeItemsEnum,546)},t.prototype.GetSubArrangeItemsAs=function(){return n(this.GetOptions().subArrangeItemsAs,s.Menu.ArrangeItemsEnum)},t.prototype.SetSubArrangeItemsAs=function(t){this.bU(),this.GetOptions().subArrangeItemsAs=t,this.onRL(),this.eU()},t.prototype.GetSepSize=function(){return this.GetOptions().sepSize},t.prototype.SetSepSize=function(t){this.bU(),this.GetOptions().sepSize=t,this.onRL(),this.eU()},t.prototype.getSepSize=function(){return l(0,s.ToN(this.opt("sepSize",1),0))},t.prototype.GetBtnPad=function(){return this.GetOptions().btnPad},t.prototype.SetBtnPad=function(t){this.bU(),this.GetOptions().btnPad=t,this.onRL(),this.eU()},t.prototype.getBtnPad=function(){return s.pad2A(this.opt("btnPad",[2,2]))},t.prototype.GetBtnArrSize=function(){return this.GetOptions().btnArrSize},t.prototype.SetBtnArrSize=function(t){this.bU(),this.GetOptions().btnArrSize=t,this.onRL(),this.eU()},t.prototype.getBtnArrSize=function(){return l(0,s.ToN(this.opt("btnArrSize",6),0))},t.prototype.GetShow=function(){return this.GetOptions().show},t.prototype.SetShow=function(t){this.bU(),this.GetOptions().show=t,this.onRL(),this.eU()},t.prototype.GetScrollSize=function(){return this.GetOptions().scrollSize},t.prototype.SetScrollSize=function(t){this.bU(),this.GetOptions().scrollSize=t,this.onRL(),this.eU()},t.prototype.getScrollSize=function(t){return i(this.oEF)||t?l(0,s.ToN(this.opt("scrollSize",8),0)):0},t.prototype.GetScrollClip=function(){return this.GetOptions().scrollClip},t.prototype.SetScrollClip=function(t){this.bU(),this.GetOptions().scrollClip=t,this.onRL(),this.eU()},t.prototype.getScrollClip=function(){return!!this.opt("scrollClip",!1)},t.prototype.GetScrollOpt=function(){return this.GetOptions().scrollOpt},t.prototype.SetScrollOpt=function(t){this.bU(),this.GetOptions().scrollOpt=t,this.onRL(),this.eU()},t.prototype.getScrollOpt=function(){return this.opt("scrollOpt",null)||{visibleParts:"t,b",cursors:"pointer(t,lo,b,up)",horizontalShapes:"tRange(t),range(b)",verticalShapes:"tRange(t),range(b)",wheelChange:16}},t.prototype.GetShapes=function(){return this.GetOptions().shapes},t.prototype.SetShapes=function(t){this.bU(),this.GetOptions().shapes=t,this.onRL(),this.eU()},t.prototype.getShapes=function(){return i(this.sShs)&&(this.sShs=a(this.opt("shapes","dfitem(item),dfcap(cap),dfsep(sep),dfflat(flat),dfsub(sub),Radio(rad),CheckBox(chk),Button(btn),dfarrow(arr,rarr,barr),dfbarrow(barr)"))),this.sShs},t.prototype.getTypeShape=function(t,e){if(o(e)){var i=this.getShapes();if(o(t)){var n=t.getShapes();o(n)&&(i=n)}return s.S.GetOf(e.toLowerCase(),i,"Menu")}return null},t.prototype.getPartShapes=function(t,o,i){var n=this.getTypeShape(t,o);return i&&o!=c.PartEnum.exItem&&(n=e(n,this.getTypeShape(t,c.PartEnum.exItem))),n},t.prototype.GetCursors=function(){return this.GetOptions().cursors},t.prototype.SetCursors=function(t){this.bU(),this.GetOptions().cursors=t,this.onRL(),this.eU()},t.prototype.getCursors=function(){return i(this.sCrs)&&(this.sCrs=a(this.opt("cursors","pointer(chk,rad,btn,anchor)"))),this.sCrs},t.prototype.getCursor=function(t){var e,o,i,n,r,h=this.getCursors();if(this.isSelectable()&&!this.isReadOnly())if(!s.H.lA&&this.p2A(t))i=s.GP.Get("anchor",h);else if(e=this.itemFromPointer(t),(o=e&&e.item)&&(r=o.getCursors())&&(h=r),n=this.partsFromPointer(t))for(var a=0,u=n.length;!i&&an}return t},t.prototype.getScrollRange=function(){var t=0,e=this.Lyt();return o(e)&&(t=this.isScrollVertical()?e.size.height:e.size.width)<=this.getScrollPage()&&(t=0),t},t.prototype.getScrollPage=function(){var t=this.GetClientRect();return this.isScrollVertical()?t[3]:t[2]},t.prototype.getScrollPos=function(){var t=0;return o(this.oScrollBar)&&(t=this.oScrollBar.GetValue()),t},t.prototype.setScrollPos=function(t){if(o(this.oScrollBar)){var e=this.oScrollBar.GetValue();return this.oScrollBar.SetValue(t),e!=this.oScrollBar.GetValue()}return!1},t.prototype.getID=function(){var t=0,e=this.getDisplayItem();return o(e)&&(t=e.getID()),t},t.prototype.saveScrollPos=function(t){this.rgFloatScrollPos=this.rgFloatScrollPos||new Map,this.rgFloatScrollPos.set(t.getID(),t.getScrollPos())},t.prototype.restoreScrollPos=function(t){o(this.rgFloatScrollPos)&&t.setScrollPos(this.rgFloatScrollPos.get(t.getID())||0)},t.prototype.isRURScrollEvent=function(t,e){var i=0;if(o(this.oScrollBar)){var n=this.gPtr(t);if(o(n)){e=e||this.GetVisibleRect();var r=n.x,h=s.LOf(e),a=s.ROf(e),u=n.y,l=s.TOf(e),p=s.BOf(e);if(this.isScrollVertical())up&&(i=+Math.ceil((u-p)/16));else if(r(a=s.ROf(e))&&(i=+Math.ceil((r-a)/16))}}}return i},t.prototype.rurScroll=function(t,e){if(o(this.oScrollBar)){s.Ptr.SetTargExclPad(this.GetCanvas());var i=this.isRURScrollEvent(t,e);if(s.Ptr.ResTargExclPad(),0!=i&&this.setScrollPos(this.getScrollPos()+i))return this}return null},t.prototype.getRootMenu=function(){for(var t=this,e=null;e=t.handlers.oPM;)t=e;return t},t.prototype.getTopMenu=function(){var t=this.getRootMenu();return this.isCM()&&(t=t.handlers.rgF[0]),t},t.prototype.getRootItem=function(){var t=this.getRootMenu();return i(t.handlers.oRI)&&(t.handlers.oRI=new c(t.GetOptions().items)),t.handlers.oRI},t.prototype.getDisplayItem=function(){return this.isRootMenu()?this.getRootItem():this.handlers.oDI},t.prototype.getDisplayPath=function(){var t=[],e=this.getDisplayItem();return o(e)&&(t=e.getPath()),t},t.prototype.Lyt=function(){if(0==this.lL++&&i(this.handlers.oLyt)){var t=this.gCtx(),e=null;t&&(e=s.TFI.bCTX(t,this.getTfi())),this.handlers.oLyt=new g(this,this.getDisplayItem()),this.onlayoutchange(this.handlers.oLyt),t&&s.TFI.eCTX(t,e)}return this.lL--,this.handlers.oLyt},t.prototype.onlayoutchange=function(t){this.oLts.onlayoutchange.do(t)},t.prototype.getVisibleItems=function(){var t=this.handlers.oLytVI;if(i(t)){var e=this.Lyt();o(e)&&(t=e.getVisibleItems(this.GetClientRect(),this.getOrigin())),this.handlers.oLytVI=t}return t},t.prototype.GetItems=function(){var t="",e=this.getDisplayItem();return o(e)&&(t=e.save()),t},t.prototype.SetItems=function(t){var e=this.getRootMenu(),i=e.handlers.oRI;e.rgFloatScrollPos=null,this.GetOptions().items=o(t)?t:"";var n=[];if(o(e.handlers.rgF)&&e.handlers.rgF.forEach(function(t){n.push(t.getDisplayPath())}),o(i)&&e!=this){o(l=this.getDisplayItem())&&(l.load(t),e.GetOptions().items=i.save())}e.handlers.oRI=null,e.handlers.oLyt=null;var r=[],s=e.getRootItem();if(s)for(var h=!0,a=0,u=n.length;h&&a0&&(i.width=p(i.width,t[2]*o),i.height=p(i.height,t[3]*o),this.isScroll()&&this.getScrollClip())){var n=this.getScrollSize();e.height>e.width?i.height=0&&o(r=t.split("\\"))&&1==r.length&&(r=null),i(r))n=e(h,t);else{n=h;for(var a=0,u=r.length;n&&an+r||h+a>n+r)&&(n=h-r+p(r,a))}else{var u=s.LOf(i),l=i[2];un+r||u+l>n+r)&&(n=u-r+p(r,l))}this.setScrollPos(n)}}return t},t.timeoutOC=32,t.prototype.Open=function(e){function n(t,e){if(t&&!s.EyR(t.GetViewRect())){t.bF=!0;for(var o=0,i=e.length;t&&o0},c.prototype.getChildren=function(){return this.rgCI},c.prototype.load=function(t){var e=this.oP;if(i(e))this.set(t);else{var n=e.rgCI,r=n.indexOf(this);if(r>=0&&(n.splice(r,1),o(t))){var h=s.B.split(t);h.length&&h.forEach(function(t){new c(t,e,r++)},this)}}},c.prototype.save=function(){var t="";if(t+=s.B.quoteC(this.caption),t+=s.B.quoteF(this.flags),this.rgCI.length){var e=[];this.rgCI.forEach(function(t){e.push(t.save())}),t+=s.B.quoteS(e,o(this.oP))}return t},c.prototype.setAutoID=function(){i(this.getFlag(null,"id"))&&(this.autoID=c.AutoID),this.id=this.getID()},c.prototype.getID=function(){return this.getFlag(null,"id",0)||this.autoID},c.prototype.getPathID=function(){return this.getID()||this.caption},c.prototype.getPath=function(){for(var t=[],e=this,i=null;o(i=e.oP);)t.push(e.getPathID()),e=i;return t.reverse(),t},c.prototype.findChildPathID=function(t){for(var e=null,o=0,i=this.rgCI.length;!e&&o0},c.prototype.hasCaption=function(){return!!o(this.caption)&&this.caption.toString()},c.prototype.isVisible=function(){var t=this.hasCaption()||this.hasFlags()||this.hasItems();if(t){var e=this.getFlag(null,"hid");if(void 0!==e&&(t=!!parseInt(e)),t){var i=this.hasWidth();if(o(i)&&(t=i>0),t){var n=this.hasHeight();o(n)&&(t=n>0)}}}return!!t},c.prototype.setVisible=function(t){this.setFlag("hid",t?void 0:null)},c.prototype.hasCaptionWidth=function(){var t=this.getFlagA(null,"captionWidth,cw");return void 0!==t&&(t=parseInt(t)||0)>=0?t:null},c.prototype.hasCaptionHeight=function(){var t=this.getFlagA(null,"captionHeight,ch");return void 0!==t&&(t=parseInt(t)||0)>=0?t:null},c.prototype.hasHeight=function(){var t=this.getFlag(null,"height");return void 0!==t&&(t=parseInt(t)||0)>=0?t:null},c.prototype.hasWidth=function(){var t=this.getFlag(null,"width");return void 0!==t&&(t=parseInt(t)||0)>=0?t:null},c.prototype.hasSize=function(){return o(this.hasWidth())||o(this.hasHeight())},c.prototype.hasButton=function(){var e;if(!this.isSeparator()&&void 0!==(e=this.getFlag(null,"button"))){if(i(e))return t.ShowAsButtonEnum.exButton;e=n(e,t.ShowAsButtonEnum,1)}return e||null},c.prototype.showPopupOnChecked=function(){var t=this.getFlag(null,"spchk");return void 0!==t&&(t=!(!i(t)&&!t)),t||!1},c.prototype.showCheckedAsSelected=function(e){return n(this.getFlag(e,"show",null),t.ShowCheckedAsSelectedEnum,0)},c.prototype.isEnabled=function(){function t(t){var e=t.getFlag(null,"dis");return void 0!==e&&(e=!e),!e}for(var e=this,o=!1;(o=t(e))&&e.oP;)e=e.oP;return o},c.prototype.setEnabled=function(t){this.setFlag("dis",t?void 0:null)},c.prototype.showAsDisabled=function(){function t(t){var e=t.getFlag(null,"showDis");return void 0!==e&&(e=!e),e||!1}for(var e=this,o=!1;!(o=t(e))&&e.oP;)e=e.oP;return o},c.prototype.asDisabled=function(){return!this.isEnabled()||this.showAsDisabled()},c.prototype.hasTab=function(){return this.getFlag(null,"tab",null)},c.prototype.isSelectable=function(){var t=!1;return this.isSeparator()||(t=this.isEnabled()),t},c.prototype.getShapes=function(){var t=this.getFlag(null,"shapes");return void 0!==t?o(t)?t.toString():"":null},c.prototype.getCursors=function(){var t=this.getFlag(null,"cursors");return void 0!==t?o(t)?t.toString():"":null},c.prototype.getClose=function(){return n(this.getFlag(null,"close",null),t.CloseOnClickEnum,null)},c.prototype.toString=function(){var t=o(this.caption)?this.caption.toString():"";return t&&(t+=" "),t+="["+this.getPath().join("\\")+"]"},c.prototype.getShowPopupAlign=function(e,i){var r=this.getFlagA(null,"popupalign,pa");if(null!=r&&(r=n(r,t.ShowPopupAlignEnum,3)),void 0===r){if(273==(273&this.hasButton())&&(r=1),void 0===r&&o(e)&&e.isPopupAlign()){r=1,e.isV()&&(r|=2);var h=e.getItemRect(this);if(o(h)){var a=[s.ROf(h),s.TOf(h),i.width,i.height],l=[s.LOf(h),s.BOf(h),i.width,i.height],p=e.itemsFromRect(a),c=e.itemsFromRect(l);p&&!c?r=1:c&&!p&&(r=3)}}}return u(r,3)},c.prototype.getPopupRect=function(t,e,o){var i=this.getShowPopupAlign(t,o),n=[e[0],e[1]-o.height,o.width,o.height];if(i){var r=2&i;1&i?r?(n[0]=s.ROf(e),n[1]=s.TOf(e)):n[1]=s.BOf(e):r&&(n[0]=s.ROf(e),n[1]=s.BOf(e)-o.height)}return n},c.prototype.forEachU=function(t,e){var o;e=e||this;for(var i,n=this.rgCI,r=0,s=n.length;!o&&r0){var i=this.rgO.getKey(parseInt(t.substr(0,e)));if(o(i))return{o:i,p:t.substr(e+1)}}}},g.prototype.getTabs=function(){var t={source:new Map,target:new Map};return this.mI2I.forEach(function(e){var n=function(t,e){if(e.getGroupPopup()){var i=e.hasTab();if(o(i)){var n=t.mI2I.get(i);if(n!=e)return n}}return null}(this,e);if(o(n)){t.source.set(e,n);var r=t.target.get(n);i(r)&&t.target.set(n,r=[]),r.push(e)}},this),t.source.size?t:null},g.prototype.op2k=function(t,e){return this.oD.op2k(t,e)},g.prototype.k2op=function(t){return this.oD.k2op(t)},g.prototype.targetGroupPopup=function(t){var e=null,i=this.oST;if(o(i)){var n=i.target.get(t);if(o(n))for(var r=0,s=n.length;!e&&r0&&h.oM.getCriFlat()){var l=a.get("e-flat");o(l)&&i(a.get(c.PartEnum.exCheck))&&i(a.get(c.PartEnum.exRadio))&&i(a.get(c.PartEnum.exImage))&&l.forEach(function(t){var i=h.k2op(t).o,r=h.op2k(i,"e-cri");n.remove(t),n.remove(r);var s=e.get(i);if(o(s)){var a=s.get(t)[2]+2*i.getPad()[0];s.remove(t),s.remove(r);var u=s.get(h.op2k(i,c.PartEnum.exItem));o(u)&&(u[0]+=a,u[2]-=a),s.offset(-a,0)}})}}}(this);var h=g.getUnionBuildItems(e,r);return o(h)&&(t?this.extItemsWidth(n,r,h[2]):this.offItemsHeight(e,r,h[3]),this.extItemsSep(t,n,r,h)),h},g.prototype.build=function(e){function n(t,e){return d.op2k(t,e)}function r(){return{width:y.getArrSize(),height:y.getArrSize()}}function h(e){if(d.isV(e)&&e==v)switch(y.getCriFlat()){case t.FlatEnum.exShowFlat:return e.itemsShowCRI(y);case t.FlatEnum.exAlwaysFlat:return!0}return!1}function a(t){var e=d.k2op(t);return!e||e.p.sWith("e-")}function u(t){var a=new s.M1,u=d.isV(t),l=0,f=0,g=0,m=null;if(d.getItems(t).forEach(function(t){var e=O.get(t);i(e)&&O.set(t,e=p(t)),e.origin(),m=s.URts(m,e.union())}),o(m)){var S=d.isGroupPopupEqualSize(t);if(S){var C={width:16&S?m[2]:null,height:32&S?m[3]:null};d.getItems(t).forEach(function(t){var e=O.get(t);s.EqR(m,e.union())||O.set(t,e=p(t,C))})}}var R=o(e)&&t==v,I=d.getItems(t),P=null;I.forEach(function(t){var n=O.get(t),r=n.union();if(o(r)&&R)if(i(P))P=[t];else if(u)if(f+r[3]0&&i.forEach(function(e){var o=t.get(e);o&&s.ORt(o,0,p)})}}}(A,t,e)}}),this.rgVP=function(t){var e=new s.M1;return t.forEach(function(t,o){a(o)||e.set(o,t)}),e}(A);var w=this.rgVP.union();w&&(f.width=w[2],f.height=w[3])}}return f},g.prototype.itemFromPoint=function(t,e){var i=null,n=this.rgVP.p2O(t,e);if(o(n)){var r=this.k2op(n);o(r)&&(i={item:r.o,part:r.p})}return i},g.prototype.ptInPart=function(t,e,i,n){var r=null;if(i||n){var s=this.rgVP.p2O(t,e);if(o(s)){var h=this.k2op(s).o,a=this.rgVP.p2rgO(t,e);if(a)for(var u=a.length,l=0;!r&&l=0&&(y=setTimeout(function(){!s.RUR.Rng()&&e()},i))}}function p(t){var e=(t=t.getRootMenu()).getFloatCount();o(f)&&(e&&t==f||function(){if(f){var t=f.getRootMenu();c(),a(),s.win.removeEventListener("mousedown",n),s.win.removeEventListener("mousemove",u),s.win.removeEventListener(s.wheel,n),s.supportTouch&&s.win.removeEventListener("touchstart",n),s.win.removeEventListener("keydown",r),s.win.removeEventListener("blur",h),g&&(s.CC.prototype.ondown=g,g=null),f.clearFloats(),f=null,setTimeout(function(){t.onEndModal()})}}()),e&&i(f)&&function(t){if(i(f)&&o(t)){t.getRootMenu().onStartModal(),d++,s.win.addEventListener("mousedown",n),!t.isCM()&&s.win.addEventListener("mousemove",u),s.win.addEventListener(s.wheel,n),s.supportTouch&&s.win.addEventListener("touchstart",n),s.win.addEventListener("keydown",r),s.win.addEventListener("blur",h),f=t,g=s.CC.prototype.ondown,s.CC.prototype.ondown=function(t){var e=g;return n(t),e&&e.call(this,t)},setTimeout(function(){d--})}}(t)}function c(){o(v)&&clearTimeout(v),v=null}var f=null,g=null,v=null,y=null,d=0,m=0;return{Is:t,OnFloatCountChange:p,OnHover:function(e,n){if(0==m++&&(c(),o(n)&&(i(f)||t(e))))if(n.isPopup()&&e.asSelectable(n)){var r=e.getTimeout("Open"),s=i(n.hasButton());s&&(s=r>=0||e.isRootMenu()&&e.bF&&e.getTimeout("Close")>=0)&&(v=setTimeout(function(){e.addFloat(n)},r))}else(r=e.getTimeout("Close"))>=0&&(v=setTimeout(function(){e.clearFloats(e.getFloatLevel())},r));m--},LockHover:function(){0==m++&&c()},UnlockHover:function(){m=l(0,m-1)}}}();return s.expOL({root:null,parent:null,children:null,path:null,state:null},c.prototype),s.expO({image:null},c.prototype,null,!1,s.expL("has")),s.expO({visible:null,enabled:null},c.prototype,null,!1,s.expL("is")),s.expO(s.Mrg({Canvas:null,Options:null},t.Options),t.prototype),t.Item=c,t.Layout=g,{Menu:t}}()),t.Menu=s.Menu});