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