text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs")):"function"==typeof define&&define.amd?define("ngx-bootstrap/positioning",["exports","@angular/core","@angular/common","rxjs"],e):e((t["ngx-bootstrap"]=t["ngx-bootstrap"]||{},t["ngx-bootstrap"].positioning={}),t.ng.core,t.ng.common,t.rxjs)}(this,function(t,e,r,n){"use strict";var d=function(){return(d=Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function b(t,e){if(1!==t.nodeType)return[];var o=t.ownerDocument.defaultView.getComputedStyle(t,null);return e?o[e]:o}function h(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function g(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=b(t),o=e.overflow,r=e.overflowX,n=e.overflowY;return/(auto|scroll|overlay)/.test(String(o)+String(n)+String(r))?t:g(h(t))}var o="undefined"!=typeof window&&"undefined"!=typeof document,i=o&&!(!window.MSInputMethodContext||!document.documentMode),a=o&&!(!window.MSInputMethodContext||!/MSIE 10/.test(navigator.userAgent));function v(t){return 11===t?i:10===t?a:i||a}function l(t){if(!t)return document.documentElement;for(var e,o=v(10)?document.body:null,r=t.offsetParent||null;r===o&&t.nextElementSibling&&"BODY"!==t.nodeName;)r=(e=t.nextElementSibling).offsetParent;var n=r&&r.nodeName;return n&&"BODY"!==n&&"HTML"!==n?-1!==["TH","TD","TABLE"].indexOf(r.nodeName)&&"static"===b(r,"position")?l(r):r:e?e.ownerDocument.documentElement:document.documentElement}function u(t){return null!==t.parentNode?u(t.parentNode):t}function w(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var o=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,r=o?t:e,n=o?e:t,i=document.createRange();i.setStart(r,0),i.setEnd(n,0);var a=i.commonAncestorContainer;if(t!==a&&e!==a||r.contains(n))return function f(t){var e=t.nodeName;return"BODY"!==e&&("HTML"===e||l(t.firstElementChild)===t)}(a)?a:l(a);var s=u(t);return s.host?w(s.host,e):w(t,u(e).host)}function m(t,e){var o="x"===e?"Left":"Top",r="Left"===o?"Right":"Bottom";return parseFloat(t["border"+o+"Width"])+parseFloat(t["border"+r+"Width"])}function s(t,e,o,r){return Math.max(e["offset"+t],e["scroll"+t],o["client"+t],o["offset"+t],o["scroll"+t],v(10)?parseInt(o["offset"+t],10)+parseInt(r["margin"+("Height"===t?"Top":"Left")],10)+parseInt(r["margin"+("Height"===t?"Bottom":"Right")],10):0)}function N(t){var e=t.body,o=t.documentElement,r=v(10)&&getComputedStyle(o);return{height:s("Height",e,o,r),width:s("Width",e,o,r)}}function y(t,e){void 0===e&&(e="top");var o="top"===e?"scrollTop":"scrollLeft",r=t.nodeName;if("BODY"!==r&&"HTML"!==r)return t[o];var n=t.ownerDocument.documentElement;return(t.ownerDocument.scrollingElement||n)[o]}function M(t){return d({},t,{right:t.left+t.width,bottom:t.top+t.height})}function x(t){var e={};try{if(v(10)){e=t.getBoundingClientRect();var o=y(t,"top"),r=y(t,"left");e.top+=o,e.left+=r,e.bottom+=o,e.right+=r}else e=t.getBoundingClientRect()}catch(c){return undefined}var n={left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top},i="HTML"===t.nodeName?N(t.ownerDocument):{},a=i.width||t.clientWidth||n.right-n.left,s=i.height||t.clientHeight||n.bottom-n.top,f=t.offsetWidth-a,l=t.offsetHeight-s;if(f||l){var u=b(t);f-=m(u,"x"),l-=m(u,"y"),n.width-=f,n.height-=l}return M(n)}function E(t,e,o){void 0===o&&(o=!1);var r=v(10),n="HTML"===e.nodeName,i=x(t),a=x(e),s=g(t),f=b(e),l=parseFloat(f.borderTopWidth),u=parseFloat(f.borderLeftWidth);o&&n&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var c=M({top:i.top-a.top-l,left:i.left-a.left-u,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&n){var m=parseFloat(f.marginTop),p=parseFloat(f.marginLeft);c.top-=l-m,c.bottom-=l-m,c.left-=u-p,c.right-=u-p,c.marginTop=m,c.marginLeft=p}return(r&&!o?e.contains(s):e===s&&"BODY"!==s.nodeName)&&(c=function h(t,e,o){void 0===o&&(o=!1);var r=y(e,"top"),n=y(e,"left"),i=o?-1:1;return t.top+=r*i,t.bottom+=r*i,t.left+=n*i,t.right+=n*i,t}(c,e)),c}function T(t){if(!t||!t.parentElement||v())return document.documentElement;for(var e=t.parentElement;e&&"none"===b(e,"transform");)e=e.parentElement;return e||document.documentElement}function O(t,e,o,r,n){void 0===o&&(o=0),void 0===n&&(n=!1);var i={top:0,left:0},a=n?T(t):w(t,e);if("viewport"===r)i=function m(t,e){void 0===e&&(e=!1);var o=t.ownerDocument.documentElement,r=E(t,o),n=Math.max(o.clientWidth,window.innerWidth||0),i=Math.max(o.clientHeight,window.innerHeight||0),a=e?0:y(o),s=e?0:y(o,"left");return M({top:a-Number(r.top)+Number(r.marginTop),left:s-Number(r.left)+Number(r.marginLeft),width:n,height:i})}(a,n);else{var s=void 0;"scrollParent"===r?"BODY"===(s=g(h(e))).nodeName&&(s=t.ownerDocument.documentElement):s="window"===r?t.ownerDocument.documentElement:r;var f=E(s,a,n);if("HTML"!==s.nodeName||function p(t){var e=t.nodeName;return"BODY"!==e&&"HTML"!==e&&("fixed"===b(t,"position")||p(h(t)))}(a))i=f;else{var l=N(t.ownerDocument),u=l.height,c=l.width;i.top+=f.top-f.marginTop,i.bottom=Number(u)+Number(f.top),i.left+=f.left-f.marginLeft,i.right=Number(c)+Number(f.left)}}return i.left+=o,i.top+=o,i.right-=o,i.bottom-=o,i}function f(t,e,r,o,n,i,a){if(void 0===n&&(n=["top","left","bottom","right"]),void 0===i&&(i="viewport"),void 0===a&&(a=0),-1===t.indexOf("auto"))return t;var s=O(r,o,a,i),f={top:{width:s.width,height:e.top-s.top},right:{width:s.right-e.right,height:s.height},bottom:{width:s.width,height:s.bottom-e.bottom},left:{width:e.left-s.left,height:s.height}},l=Object.keys(f).map(function(t){return d({key:t},f[t],{area:function e(t){return t.width*t.height}(f[t])})}).sort(function(t,e){return e.area-t.area}),u=l.filter(function(t){var e=t.width,o=t.height;return e>=r.clientWidth&&o>=r.clientHeight}),c=0<(u=n.reduce(function(t,e){var o;return d({},t,((o={})[e]=u[e],o))},{})).length?u[0].key:l[0].key,m=t.split(" ")[1];return r.className=r.className.replace(/auto/g,c),c+(m?"-"+m:"")}function L(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),o=parseFloat(e.marginTop||0)+parseFloat(e.marginBottom||0),r=parseFloat(e.marginLeft||0)+parseFloat(e.marginRight||0);return{width:Number(t.offsetWidth)+r,height:Number(t.offsetHeight)+o}}function c(t,e,o){return void 0===o&&(o=null),E(e,o?T(t):w(t,e),o)}function D(t,e,o){var r=o.split(" ")[0],n=L(t),i={width:n.width,height:n.height},a=-1!==["right","left"].indexOf(r),s=a?"top":"left",f=a?"left":"top",l=a?"height":"width",u=a?"width":"height";return i[s]=e[s]+e[l]/2-n[l]/2,i[f]=r===f?e[f]-n[u]:e[function c(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(t){return e[t]})}(f)],i}function p(t,e){var o=t.instance.target,r=function n(t){return{width:t.offsets.target.width,height:t.offsets.target.height,left:Math.floor(t.offsets.target.left),top:Math.round(t.offsets.target.top),bottom:Math.round(t.offsets.target.bottom),right:Math.floor(t.offsets.target.right)}}(t);S(o,{"will-change":"transform",top:"0px",left:"0px",transform:"translate3d("+r.left+"px, "+r.top+"px, 0px)"},e),t.instance.arrow&&S(t.instance.arrow,t.offsets.arrow,e),t.placementAuto&&(e?(e.setAttribute(o,"class",o.className.replace(/bs-popover-auto/g,"bs-popover-"+t.placement)),e.setAttribute(o,"class",o.className.replace(/bs-tooltip-auto/g,"bs-tooltip-"+t.placement)),e.setAttribute(o,"class",o.className.replace(/\sauto/g,"s"+t.placement)),o.className.match(/popover/g)&&e.addClass(o,"popover-auto"),o.className.match(/tooltip/g)&&e.addClass(o,"tooltip-auto")):(o.className=o.className.replace(/bs-popover-auto/g,"bs-popover-"+t.placement),o.className=o.className.replace(/bs-tooltip-auto/g,"bs-tooltip-"+t.placement),o.className=o.className.replace(/\sauto/g,"s"+t.placement),o.className.match(/popover/g)&&o.classList.add("popover-auto"),o.className.match(/tooltip/g)&&o.classList.add("tooltip-auto"))),e?e.setAttribute(o,"class",o.className.replace(/left|right|top|bottom/g,""+t.placement)):o.className=o.className.replace(/left|right|top|bottom/g,""+t.placement)}function S(r,n,i){Object.keys(n).forEach(function(t){var e="";-1!==["width","height","top","right","bottom","left"].indexOf(t)&&function o(t){return""!==t&&!isNaN(parseFloat(t))&&isFinite(t)}(n[t])&&(e="px"),i?i.setStyle(r,t,""+String(n[t])+e):r.style[t]=String(n[t])+e})}function F(t){var e,o=t.offsets.target,r=t.instance.target.querySelector(".arrow");if(!r)return t;var n=-1!==["left","right"].indexOf(t.placement),i=n?"height":"width",a=n?"Top":"Left",s=a.toLowerCase(),f=n?"left":"top",l=n?"bottom":"right",u=L(r)[i];t.offsets.host[l]-u<o[s]&&(o[s]-=o[s]-(t.offsets.host[l]-u)),Number(t.offsets.host[s])+Number(u)>o[l]&&(o[s]+=Number(t.offsets.host[s])+Number(u)-Number(o[l])),o=M(o);var c=Number(t.offsets.host[s])+Number(t.offsets.host[i]/2-u/2),m=b(t.instance.target),p=parseFloat(m["margin"+a]),h=parseFloat(m["border"+a+"Width"]),g=c-o[s]-p-h;return g=Math.max(Math.min(o[i]-u,g),0),t.offsets.arrow=((e={})[s]=Math.round(g),e[f]="",e),t.instance.arrow=r,t}function H(c){if(c.offsets.target=M(c.offsets.target),!function n(t,e){return t&&t.modifiers&&t.modifiers[e]&&t.modifiers[e].enabled}(c.options,"flip"))return c.offsets.target=d({},c.offsets.target,D(c.instance.target,c.offsets.host,c.placement)),c;var m=O(c.instance.target,c.instance.host,0,"viewport",!1),p=c.placement.split(" ")[0],h=c.placement.split(" ")[1]||"",t=c.offsets.host,e=c.instance.target,o=c.instance.host,r=h?f("auto",t,e,o,["top","bottom"]):f("auto",t,e,o),g=[p,r];return g.forEach(function(t,e){if(p!==t||g.length===e+1)return c;var o="left"===(p=c.placement.split(" ")[0])&&Math.floor(c.offsets.target.right)>Math.floor(c.offsets.host.left)||"right"===p&&Math.floor(c.offsets.target.left)<Math.floor(c.offsets.host.right)||"top"===p&&Math.floor(c.offsets.target.bottom)>Math.floor(c.offsets.host.top)||"bottom"===p&&Math.floor(c.offsets.target.top)<Math.floor(c.offsets.host.bottom),r=Math.floor(c.offsets.target.left)<Math.floor(m.left),n=Math.floor(c.offsets.target.right)>Math.floor(m.right),i=Math.floor(c.offsets.target.top)<Math.floor(m.top),a=Math.floor(c.offsets.target.bottom)>Math.floor(m.bottom),s="left"===p&&r||"right"===p&&n||"top"===p&&i||"bottom"===p&&a,f=-1!==["top","bottom"].indexOf(p),l=f&&"left"===h&&r||f&&"right"===h&&n||!f&&"left"===h&&i||!f&&"right"===h&&a;(o||s||l)&&((o||s)&&(p=g[e+1]),l&&(h=function u(t){return"right"===t?"left":"left"===t?"right":t}(h)),c.placement=p+(h?" "+h:""),c.offsets.target=d({},c.offsets.target,D(c.instance.target,c.offsets.host,c.placement)))}),c}function B(n){var t="transform",e=n.instance.target.style,o=e.top,r=e.left,i=e.transform;e.top="",e.left="",e[t]="";var a=O(n.instance.target,n.instance.host,0,"scrollParent",!1);e.top=o,e.left=r,e[t]=i;var s,f={primary:function(t){var e,o=n.offsets.target[t];return n.offsets.target[t]<a[t]&&(o=Math.max(n.offsets.target[t],a[t])),(e={})[t]=o,e},secondary:function(t){var e,o="right"===t?"left":"top",r=n.offsets.target[o];return n.offsets.target[t]>a[t]&&(r=Math.min(n.offsets.target[o],a[t]-("right"===t?n.offsets.target.width:n.offsets.target.height))),(e={})[o]=r,e}};return["left","right","top","bottom"].forEach(function(t){s=-1!==["left","top"].indexOf(t)?"primary":"secondary",n.offsets.target=d({},n.offsets.target,f[s](t))}),n}function P(t){var e,o,r=t.placement,n=r.split(" ")[0],i=r.split(" ")[1];if(i){var a=t.offsets,s=a.host,f=a.target,l=-1!==["bottom","top"].indexOf(n),u=l?"left":"top",c=l?"width":"height",m={left:(e={},e[u]=s[u],e),right:(o={},o[u]=s[u]+s[c]-s[c],o)};t.offsets.target=d({},f,m[i])}return t}var C=function(){function t(){}return t.prototype.position=function(t,e,o){return void 0===o&&(o=!0),this.offset(t,e,!1)},t.prototype.offset=function(t,e,o){return void 0===o&&(o=!0),c(e,t)},t.prototype.positionElements=function(t,e,o,r,n){return[H,P,B,F].reduce(function(t,e){return e(t)},function s(t,e,o,r){var n=c(t,e),i=!!o.match(/auto/g),a=o.match(/auto\s(left|right|top|bottom)/g)?o.split(" ")[1]||"":o;return{options:r,instance:{target:t,host:e,arrow:null},offsets:{target:D(t,n,a),host:n,arrow:null},positionFixed:!1,placement:a=f(a,n,t,e),placementAuto:i}}(e,t,o,n))},t}(),W=new C;function j(t,e,o,r,n,i){p(W.positionElements(t,e,o,r,n),i)}var I=function(){function t(e,t){var o=this;this.update$$=new n.Subject,this.positionElements=new Map,r.isPlatformBrowser(t)&&n.merge(n.fromEvent(window,"scroll"),n.fromEvent(window,"resize"),n.of(0,n.animationFrameScheduler),this.update$$).subscribe(function(){o.positionElements.forEach(function(t){j(A(t.target),A(t.element),t.attachment,t.appendToBody,o.options,e.createRenderer(null,null))})})}return t.prototype.position=function(t){this.addPositionElement(t),this.update$$.next()},t.prototype.addPositionElement=function(t){this.positionElements.set(A(t.element),t)},t.prototype.deletePositionElement=function(t){this.positionElements["delete"](A(t))},t.prototype.setOptions=function(t){this.options=t},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:e.RendererFactory2},{type:Number,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]},t}();function A(t){return"string"==typeof t?document.querySelector(t):t instanceof e.ElementRef?t.nativeElement:t}t.positionElements=j,t.Positioning=C,t.PositioningService=I,Object.defineProperty(t,"__esModule",{value:!0})});
  //# sourceMappingURL=ngx-bootstrap-positioning.umd.min.js.map