function Lg(){this.Init()}v("AdfDhtmlPositionManager",Lg);v("AdfDhtmlPositionManager",Lg);z.l(Lg);Lg.da=function(){this.Zz=0;v("AdfDhtmlPositionManager.TOP",Lg.Zz);this.$Fa=1;v("AdfDhtmlPositionManager.MIDDLE",Lg.$Fa);this.jq=2;v("AdfDhtmlPositionManager.BOTTOM",Lg.jq);this.Oz=3;v("AdfDhtmlPositionManager.LEFT",Lg.Oz);this.EFa=4;v("AdfDhtmlPositionManager.CENTER",Lg.EFa);this.Cq=5;v("AdfDhtmlPositionManager.RIGHT",Lg.Cq);this.aGa=32;v("AdfDhtmlPositionManager.MIN_WIDTH",Lg.aGa)};
v("AdfDhtmlPositionManager.InitClass",Lg.da);Lg.prototype.Init=function(){Lg.f.Init.call(this);var a=D.i;a.getLevel(D.FINEST)&&(this.mY=a);this.ni=[];this.fb=F.c.Ma().Oa()};z.a("AdfDhtmlPositionManager.prototype.Init",{Init:Lg.prototype.Init});Lg.prototype.wi=function(){var a=0,b=this.ni,d;for(d in b)d&&a++;return a};z.a("AdfDhtmlPositionManager.prototype.getElementCount",{wi:Lg.prototype.wi});Lg.prototype.Bb=function(){this.ni=n};z.a("AdfDhtmlPositionManager.prototype.dispose",{Bb:Lg.prototype.Bb});
Lg.prototype.zea=function(a,b){a.cy()||B.p(a.Xr());return $g(this,a,b)};z.a("AdfDhtmlPositionManager.prototype.addFloatingElement",{zea:Lg.prototype.zea});Lg.prototype.Aea=function(a,b){a.Ty(b);return $g(this,a,AdfRichPopup.of)};z.a("AdfDhtmlPositionManager.prototype.addFloatingElementByPosition",{Aea:Lg.prototype.Aea});Lg.prototype.o_=function(a,b,d,e,f){var g=ah(this,d);d=g.VC;g=g.BD;a={top:0,right:b,bottom:a,left:0,width:b,height:a};e=bh(e,f);f=ch(this,d,a,e);d=ch(this,g,a,e);return dh(f,d,a,e)};
z.a("AdfDhtmlPositionManager.prototype.calculatePlacementPosition",{o_:Lg.prototype.o_});function $g(a,b,d){B.p(b.La());if(1>a.wi()){var e=w.b,f=e.R(),g=e.w(),h=a.gza;h||(h=a.gza=a.o(a.$_a));var m=e.G()==w.aa;e.CJ()&&(e.S(g,"mousewheel",h),e.S(f,"scroll",h),m||e.S(g,"DOMMouseScroll",h));e.S(f,"resize",h)}f=ah(a,d);d=f.BD;e=f.VC;f=f.$ga;g=(g=b.Xr())?a.xha(g):p;a.ni.push({element:b,K5a:d,R3a:e,k9a:g,$ga:f});return a.ni.length-1}
function ah(a,b){var d=Lg.jq,e=Lg.Zz,f=eh(a,"start"),g=eh(a,"end"),h=p,m,q;switch(b){case AdfRichPopup.of:q=[d,e];m=[f,f];break;case AdfRichPopup.jK:q=[d,e];m=[g,g];break;case AdfRichPopup.DD:q=[e,d];m=[f,f];break;case AdfRichPopup.w2:q=[e,d];m=[g,g];break;case AdfRichPopup.x2:q=[d,d];m=[g,f];break;case AdfRichPopup.bz:q=[e,e];m=[g,f];break;case AdfRichPopup.y2:q=[d,d];m=[f,g];break;case AdfRichPopup.z2:q=[e,e];m=[f,g];break;case AdfRichPopup.kK:q=[e,e];m=[f,f];break;case AdfRichPopup.CS:h=l;q=[e,
e];m=[g,g];break;case AdfRichPopup.DS:h=l;q=[e,e];m=[f,f];break;case AdfRichPopup.BS:q=[e,d,e,d];m=[g,g,g,f];break;default:B.assert(p,"Invalid alignmentHint provided")}return{VC:fh(a,m),BD:fh(a,q),$ga:h}}function gh(a){switch(a){case Lg.Zz:return Lg.jq;case Lg.jq:return Lg.Zz;case Lg.Oz:return Lg.Cq;case Lg.Cq:return Lg.Oz}}function hh(a){switch(a){case Lg.Zz:return"Top";case Lg.jq:return"Bottom";case Lg.Oz:return"Left";case Lg.Cq:return"Right"}}
function fh(a,b){for(var d=[],e=0;e<b.length;e+=2)d.splice(0,0,{Gea:b[e],Du:b[e+1],hBa:a["_prefer"+hh(gh(b[e]))+hh(gh(b[e+1]))+"Condition"]},{Gea:gh(b[e]),Du:gh(b[e+1]),hBa:a["_prefer"+hh(b[e])+hh(b[e+1])+"Condition"]});return d}
function bh(a,b,d){var e=w.b,f,g;a?(e=e.Ub(a),a instanceof SVGElement?(d=e.y,b=e.x,a=a.getBoundingClientRect(),e=a.width,g=a.height):d?(d=e.y+a.clientTop,b=e.x+a.clientLeft,e=a.clientWidth,g=a.clientHeight):(d=e.y,b=e.x,e=a.offsetWidth,g=a.offsetHeight),a=d+g,f=b+e):(g=e=0,b==n?f=b=a=d=0:(a=d=b.y,f=b=b.x));return{top:d,bottom:a,left:b,right:f,width:e,height:g}}
Lg.prototype.Eya=function(a,b,d){var e=w.b,f=e.getWindowHeight(),g=e.xf(),h=qg.Fp(),e=b.top+a.height<=f+g,f=b.bottom+h<=f+g;b=b.bottom-(a.height-h)>=g&&f;a=d?e:b;(f=this.mY)&&f.ks(D.FINEST,(d?"_preferBottomBottomCondition":"_preferTopTopCondition")+" fitsBelow\x3d"+e+" fitsAbove\x3d"+b+" return\x3d"+a+" usedBy\x3d"+(d?"end_before, start_before, overlap":"end_after, start_after"));return a};Lg.prototype._preferTopTopCondition=Lg.prototype.Eya;Lg.prototype.w_a=function(a,b){return this.Eya(a,b,l)};
Lg.prototype._preferBottomBottomCondition=Lg.prototype.w_a;Lg.prototype.Bya=function(a,b,d){var e=w.b,f=e.getWindowHeight(),g=e.xf(),e=qg.Fp(),h=b.top+e<=f+g,e=b.top-(a.height-e)>=g&&h;b=b.bottom+a.height<=f+g;a=d?b:e;(f=this.mY)&&f.ks(D.FINEST,(d?"_preferTopBottomCondition":"_preferBottomTopCondition")+" fitsAbove\x3d"+e+" fitsBelow\x3d"+b+" return\x3d"+a+" usedBy\x3d"+(d?"after_start, after_end":"before_start, before_end, before_after"));return a};Lg.prototype._preferBottomTopCondition=Lg.prototype.Bya;
Lg.prototype.z_a=function(a,b){return this.Bya(a,b,l)};Lg.prototype._preferTopBottomCondition=Lg.prototype.z_a;
Lg.prototype.Cya=function(a,b,d){var e=w.b,f=e.getWindowWidth(),e=e.De(),g=qg.Fp(),h=a.width-g,m;this.fb?(m=b.right-a.width>=e,a=b.left-g>=e,a=b.left+h<=f+e&&a):(a=b.left+a.width<=f+e,f=b.right+g<=f+e,m=b.right-h>=e&&f);b=d?a:m;(f=this.mY)&&f.ks(D.FINEST,(d?"_preferRightRightCondition":"_preferLeftLeftCondition")+" fitsToRight\x3d"+a+" fitsToLeft\x3d"+m+" return\x3d"+b+" usedBy\x3d"+(d?"after_start, before_start, overlap":"after_end, before_end, before_after"));return b};
Lg.prototype._preferLeftLeftCondition=Lg.prototype.Cya;Lg.prototype.y_a=function(a,b){return this.Cya(a,b,l)};Lg.prototype._preferRightRightCondition=Lg.prototype.y_a;
Lg.prototype.Dya=function(a,b,d){var e=w.b,f=e.getWindowWidth(),e=e.De(),g=qg.Fp(),h=a.width-g;this.fb?(g=b.right-g>=e,f=b.right+h<f+e&&g,h=b.left-a.width>=e):(g=b.left+g<f+e,h=b.left-h>=e&&g,f=b.right+a.width<f+e);a=d?f:h;(b=this.mY)&&b.ks(D.FINEST,(d?"_preferLeftRightCondition":"_preferRightLeftCondition")+" fitsToLeft\x3d"+h+" fitsToRight\x3d"+f+" return\x3d"+a+" usedBy\x3d"+(d?"end_before, before_after":"start_after, start_before"));return a};Lg.prototype._preferRightLeftCondition=Lg.prototype.Dya;
Lg.prototype.x_a=function(a,b){return this.Dya(a,b,l)};Lg.prototype._preferLeftRightCondition=Lg.prototype.x_a;function eh(a,b){return"start"==b&&a.fb||"end"==b&&!a.fb?Lg.Cq:Lg.Oz}Lg.prototype.Ci=function(a){delete this.ni[a];if(1>this.wi()){a=w.b;var b=a.R(),d=a.w(),e=this.gza;e&&(a.sa(d,"mousewheel",e),a.sa(b,"scroll",e),a.sa(d,"DOMMouseScroll",e),a.sa(b,"resize",e))}};z.a("AdfDhtmlPositionManager.prototype.removeElement",{Ci:Lg.prototype.Ci});Lg.prototype.xha=function(a){return F.c.Mf().vC(a)};
z.a("AdfDhtmlPositionManager.prototype.managesElement",{xha:Lg.prototype.xha});
Lg.prototype.fK=function(a){var b=F.c.fg();if(!b||!b.im())if(b=this.ni[a],b!=n){a=b.element;var d=a.Xr(),e=a.cy(),f=b.$ga;w.b.G();var g=w.b,h=a.La(),m=h.offsetWidth,q=h.offsetHeight,s=g.Ub(h),g=s.y,s=s.x;if(0==m&&(h=h.firstChild))m=h.offsetWidth,q=h.offsetHeight;h=qg.Fp();q+=h;m+=h;m={top:g,right:s+m,bottom:g+q,left:s,width:m,height:q};m.inversePosition=a.YJ();d=bh(d,e,f);e=ch(this,b.K5a,m,d);f=ch(this,b.R3a,m,d);b.BW={};b.BW.BD=e;b.BW.VC=f;b=b.BW;b=dh(b.VC,b.BD,m,d);a.setPosition(b.y,b.x)}};
z.a("AdfDhtmlPositionManager.prototype.validatePosition",{fK:Lg.prototype.fK});function ch(a,b,d,e){if(!d.inversePosition)return b[0];for(var f,g=0;!f&&g<b.length;g++)b[g].hBa.call(a,d,e)&&(f=b[g]);f||(f=b[0]);return f}Lg.prototype.aR=function(a){a=this.ni[a];if(a!=n)return a.BW};z.a("AdfDhtmlPositionManager.prototype.getComputedBehavior",{aR:Lg.prototype.aR});
function dh(a,b,d,e){var f,g,h=qg.Fp(),m=d.height-h,h=d.width-h;switch(b.Gea){case Lg.Zz:f=e.top;break;case Lg.jq:f=e.bottom;break;default:B.assert(p,"Invalid alignElementAnchor for verticalBehavior provided")}switch(a.Gea){case Lg.Oz:g=e.left;break;case Lg.Cq:g=e.right;break;default:B.assert(p,"Invalid alignElementAnchor for horizontalBehavior provided")}var q,s;switch(b.Du){case Lg.Zz:q=f;break;case Lg.jq:q=f-m;break;default:B.assert(p,"Invalid floatingElementAnchor for verticalBehavior provided")}switch(a.Du){case Lg.Oz:s=
g;break;case Lg.Cq:s=g-h;break;default:B.assert(p,"Invalid floatingElementAnchor for horizontalBehavior provided")}F.c.dv()&&(f=w.b,b=f.xf(),a=f.De(),e=f.getWindowWidth(),f=f.getWindowHeight(),q=Math.max(0,q),f=f+b-(q+d.height),0>f&&(q=Math.max(b,q+f)),s=Math.max(0,s),d=e+a-(s+d.width),0>d&&(s=Math.max(a,s+d)));return{x:s,y:q}}Lg.prototype.$_a=function(){var a=w.b.R();this.fza==n&&(this.fza=this.o(this.a0a));this.Sca&&a.clearTimeout(this.Sca);this.Sca=a.setTimeout(this.fza,200)};
Lg.prototype.a0a=function(){delete this.Sca;for(var a=this.ni,b=a.length-1;-1<b;b--)if(a[b]!=n){var d=a[b].element,e=d.Xr();if(!d.Ip())if(e){for(var f=e,e=w.b,g=e.Uc(f),h=e.getWindowWidth(),m=e.De(),q=e.getWindowHeight(),s=e.xf(),h=Lg.Ywa(g,{top:s,bottom:q+s,left:m,right:m+h}),f=f.parentNode;h&&f&&!Lg.fYa(f);)1==f.nodeType&&(h=e.Uc(f),h=Lg.Ywa(g,h)),f=f.parentNode;!h?d.rj()&&d.cancel():this.fK(b)}else{if(e=d.cy())g=d,e=w.b,d=g.getWidth(),g=g.getHeight(),f=e.getWindowWidth(),e=e.getWindowHeight(),
e=!(d>f||g>e);e&&this.fK(b)}}};Lg.fYa=function(a){var b=w.b.Ga(a);if("FORM"==b||"BODY"==b)return l;if(a=a.getAttribute("id"))if(a=a.split(":"),b=a.length,0<b)return Hg.XD==a[b-1];return p};Lg.Ywa=function(a,b){return-2>a.top-b.top||-2>b.bottom-a.bottom||-2>a.left-b.left||2<a.right-b.right?p:l};Lg.prototype.Zha=function(a){var b=this.pfa(a);if(b&&!(b instanceof he)){var d=b.La();if(H.sb(d,a))return b.Lr(),l}return p};z.a("AdfDhtmlPositionManager.prototype.resizeFloatingElement",{Zha:Lg.prototype.Zha});
Lg.prototype.pfa=function(a){for(var b=this.ni,d=0;d<b.length;d++)if(d in b){var e=b[d];if(e&&(e=e.element)){var f=e.La();if(H.sb(f,a))return e}}return n};z.a("AdfDhtmlPositionManager.prototype.findFloatingElement",{pfa:Lg.prototype.pfa});