/*!
 * jQuery UI Position 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}((function(t){return function(){t.ui=t.ui||{};var i,e,o=Math.max,n=Math.abs,l=Math.round,f=/left|center|right/,s=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,r=/^\w+/,p=/%$/,c=t.fn.position;function d(t,i,e){return[parseFloat(t[0])*(p.test(t[0])?i/100:1),parseFloat(t[1])*(p.test(t[1])?e/100:1)]}function a(i,e){return parseInt(t.css(i,e),10)||0}function g(i){var e=i[0];return 9===e.nodeType?{width:i.width(),height:i.height(),offset:{top:0,left:0}}:t.isWindow(e)?{width:i.width(),height:i.height(),offset:{top:i.scrollTop(),left:i.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:i.outerWidth(),height:i.outerHeight(),offset:i.offset()}}t.position={scrollbarWidth:function(){if(void 0!==i)return i;var e,o,n=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),l=n.children()[0];return t("body").append(n),e=l.offsetWidth,n.css("overflow","scroll"),e===(o=l.offsetWidth)&&(o=n[0].clientWidth),n.remove(),i=e-o},getScrollInfo:function(i){var e=i.isWindow||i.isDocument?"":i.element.css("overflow-x"),o=i.isWindow||i.isDocument?"":i.element.css("overflow-y"),n="scroll"===e||"auto"===e&&i.width<i.element[0].scrollWidth;return{width:"scroll"===o||"auto"===o&&i.height<i.element[0].scrollHeight?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(i){var e=t(i||window),o=t.isWindow(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:o,isDocument:n,offset:e.offset()||{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:o||n?e.width():e.outerWidth(),height:o||n?e.height():e.outerHeight()}}},t.fn.position=function(i){if(!i||!i.of)return c.apply(this,arguments);i=t.extend({},i);var p,u,m,w,W,v,y=t(i.of),b=t.position.getWithinInfo(i.within),H=t.position.getScrollInfo(b),x=(i.collision||"flip").split(" "),T={};return v=g(y),y[0].preventDefault&&(i.at="left top"),u=v.width,m=v.height,w=v.offset,W=t.extend({},w),t.each(["my","at"],(function(){var t,e,o=(i[this]||"").split(" ");1===o.length&&(o=f.test(o[0])?o.concat(["center"]):s.test(o[0])?["center"].concat(o):["center","center"]),o[0]=f.test(o[0])?o[0]:"center",o[1]=s.test(o[1])?o[1]:"center",t=h.exec(o[0]),e=h.exec(o[1]),T[this]=[t?t[0]:0,e?e[0]:0],i[this]=[r.exec(o[0])[0],r.exec(o[1])[0]]})),1===x.length&&(x[1]=x[0]),"right"===i.at[0]?W.left+=u:"center"===i.at[0]&&(W.left+=u/2),"bottom"===i.at[1]?W.top+=m:"center"===i.at[1]&&(W.top+=m/2),p=d(T.at,u,m),W.left+=p[0],W.top+=p[1],this.each((function(){var f,s,h=t(this),r=h.outerWidth(),c=h.outerHeight(),g=a(this,"marginLeft"),v=a(this,"marginTop"),L=r+g+a(this,"marginRight")+H.width,P=c+v+a(this,"marginBottom")+H.height,D=t.extend({},W),I=d(T.my,h.outerWidth(),h.outerHeight());"right"===i.my[0]?D.left-=r:"center"===i.my[0]&&(D.left-=r/2),"bottom"===i.my[1]?D.top-=c:"center"===i.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],e||(D.left=l(D.left),D.top=l(D.top)),f={marginLeft:g,marginTop:v},t.each(["left","top"],(function(e,o){t.ui.position[x[e]]&&t.ui.position[x[e]][o](D,{targetWidth:u,targetHeight:m,elemWidth:r,elemHeight:c,collisionPosition:f,collisionWidth:L,collisionHeight:P,offset:[p[0]+I[0],p[1]+I[1]],my:i.my,at:i.at,within:b,elem:h})})),i.using&&(s=function(t){var e=w.left-D.left,l=e+u-r,f=w.top-D.top,s=f+m-c,p={target:{element:y,left:w.left,top:w.top,width:u,height:m},element:{element:h,left:D.left,top:D.top,width:r,height:c},horizontal:l<0?"left":e>0?"right":"center",vertical:s<0?"top":f>0?"bottom":"middle"};u<r&&n(e+l)<u&&(p.horizontal="center"),m<c&&n(f+s)<m&&(p.vertical="middle"),o(n(e),n(l))>o(n(f),n(s))?p.important="horizontal":p.important="vertical",i.using.call(this,t,p)}),h.offset(t.extend(D,{using:s}))}))},t.ui.position={fit:{left:function(t,i){var e,n=i.within,l=n.isWindow?n.scrollLeft:n.offset.left,f=n.width,s=t.left-i.collisionPosition.marginLeft,h=l-s,r=s+i.collisionWidth-f-l;i.collisionWidth>f?h>0&&r<=0?(e=t.left+h+i.collisionWidth-f-l,t.left+=h-e):t.left=r>0&&h<=0?l:h>r?l+f-i.collisionWidth:l:h>0?t.left+=h:r>0?t.left-=r:t.left=o(t.left-s,t.left)},top:function(t,i){var e,n=i.within,l=n.isWindow?n.scrollTop:n.offset.top,f=i.within.height,s=t.top-i.collisionPosition.marginTop,h=l-s,r=s+i.collisionHeight-f-l;i.collisionHeight>f?h>0&&r<=0?(e=t.top+h+i.collisionHeight-f-l,t.top+=h-e):t.top=r>0&&h<=0?l:h>r?l+f-i.collisionHeight:l:h>0?t.top+=h:r>0?t.top-=r:t.top=o(t.top-s,t.top)}},flip:{left:function(t,i){var e,o,l=i.within,f=l.offset.left+l.scrollLeft,s=l.width,h=l.isWindow?l.scrollLeft:l.offset.left,r=t.left-i.collisionPosition.marginLeft,p=r-h,c=r+i.collisionWidth-s-h,d="left"===i.my[0]?-i.elemWidth:"right"===i.my[0]?i.elemWidth:0,a="left"===i.at[0]?i.targetWidth:"right"===i.at[0]?-i.targetWidth:0,g=-2*i.offset[0];p<0?((e=t.left+d+a+g+i.collisionWidth-s-f)<0||e<n(p))&&(t.left+=d+a+g):c>0&&((o=t.left-i.collisionPosition.marginLeft+d+a+g-h)>0||n(o)<c)&&(t.left+=d+a+g)},top:function(t,i){var e,o,l=i.within,f=l.offset.top+l.scrollTop,s=l.height,h=l.isWindow?l.scrollTop:l.offset.top,r=t.top-i.collisionPosition.marginTop,p=r-h,c=r+i.collisionHeight-s-h,d="top"===i.my[1]?-i.elemHeight:"bottom"===i.my[1]?i.elemHeight:0,a="top"===i.at[1]?i.targetHeight:"bottom"===i.at[1]?-i.targetHeight:0,g=-2*i.offset[1];p<0?((o=t.top+d+a+g+i.collisionHeight-s-f)<0||o<n(p))&&(t.top+=d+a+g):c>0&&((e=t.top-i.collisionPosition.marginTop+d+a+g-h)>0||n(e)<c)&&(t.top+=d+a+g)}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var i,o,n,l,f,s=document.getElementsByTagName("body")[0],h=document.createElement("div");for(f in i=document.createElement(s?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},s&&t.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"}),n)i.style[f]=n[f];i.appendChild(h),(o=s||document.documentElement).insertBefore(i,o.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",l=t(h).offset().left,e=l>10&&l<11,i.innerHTML="",o.removeChild(i)}()}(),t.ui.position}));