!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StuckJs=e():t.StuckJs=e()}(this,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=4)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.noop=function(){},e.stableSort=function(t,e){return t.map(function(t,e){return{item:t,index:e}}).sort(function(t,i){var n=e(t.item,i.item);return 0!==n?n:t.index-i.index}).map(function(t){return t.item})}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(0),r=function(){function t(e,i,r){var s=this;void 0===i&&(i=!0),void 0===r&&(r=n.noop),this.$$shouldPlacehold=!0,this.original=e,this.onUpdate="function"==typeof r?r:n.noop,this.initialComputedStyles=window.getComputedStyle(this.original),this.initiallyHidden="none"===this.initialComputedStyles.display,this.initiallyHidden&&this.execWhileStucking(function(){s.initialComputedStyles=window.getComputedStyle(s.original)}),this.element=t.createPlaceholderElement(),this.applyInitialStyles(),t.wrap(this.original,this.element),this.cachedRect=this.updateRect(),i&&(this.observer=t.createObserver(this.original,function(){return s.update()}))}return Object.defineProperty(t.prototype,"shouldPlacehold",{get:function(){return!this.initiallyHidden&&this.$$shouldPlacehold},set:function(t){this.shouldPlacehold!==t&&(this.$$shouldPlacehold=t,this.update(!0))},enumerable:!0,configurable:!0}),t.prototype.update=function(t){void 0===t&&(t=!1),this.shouldPlacehold?this.applyStyles(t):this.removeStyles(),this.onUpdate()},t.prototype.updateRect=function(){var t=this;return this.cachedRect=this.element.getBoundingClientRect(),this.initiallyHidden&&this.execWhileStucking(function(){t.cachedRect=t.element.getBoundingClientRect()}),this.cachedRect},t.prototype.destroy=function(){this.observer&&(this.observer.disconnect(),delete this.observer),t.unwrap(this.original),delete this.element,delete this.original,delete this.cachedRect,delete this.onUpdate},t.prototype.execWhileStucking=function(t){var e=this.original.dataset.stuck;this.original.dataset.stuck="true",t(),this.original.dataset.stuck=e},t.prototype.applyInitialStyles=function(){this.initialComputedStyles&&!this.initiallyHidden&&(this.element.style.margin=this.initialComputedStyles.margin,this.element.style.minWidth=this.initialComputedStyles.minWidth,this.element.style.minHeight=this.initialComputedStyles.minHeight,this.element.style.width=this.initialComputedStyles.width,this.element.style.height=this.initialComputedStyles.height)},t.prototype.applyStyles=function(t){if(void 0===t&&(t=!1),this.original&&this.element){var e=this.original.getBoundingClientRect(),i=e.width,n=e.height,r=i!==this.cachedRect.width,s=n!==this.cachedRect.height;(t||r||s)&&((t||r)&&(this.element.style.width=i+"px"),(t||s)&&(this.element.style.height=n+"px"),this.updateRect())}},t.prototype.removeStyles=function(){this.original&&this.element&&(this.element.style.width="",this.element.style.height="")},t.createObserver=function(t,e){if(!t)throw new TypeError("[Stuck.js] Could not create mutation observer on targetNode "+String(t)+". This should be HTMLElement");var i=function(t){var e=t.type;return"childList"===e||"attributes"===e},n=new MutationObserver(function(t){t.some(i)&&e()});return n.observe(t,{attributes:!0,attributeFilter:["style","class"],childList:!0,subtree:!0}),n},t.unwrap=function(t){var e=t.parentNode;if(e instanceof HTMLElement){e.insertAdjacentElement("beforebegin",t);var i=e.parentNode;i instanceof HTMLElement&&i.removeChild(e)}return t},t.wrap=function(t,e){return t.parentNode!==e&&(t.insertAdjacentElement("beforebegin",e),e.appendChild(t)),e},t.createPlaceholderElement=function(t){return void 0===t&&(t="div"),document.createElement(t)},t}();e.default=r},function(t,e,i){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i=e&&!this.isStickToBottom?(this.top=e-this.rect.height,void(this.isStickToBottom=!0)):this.isStickToBottom?this.rect.top>=this.marginTop?(this.top=this.marginTop,void(this.isStickToBottom=!1)):void(this.rect.topt.top)this.isSticky=!0;else if(this.isSticky){if(t.top>=this.marginTop)return void(this.isSticky=!1);this.rect=this.element.getBoundingClientRect(),this.rect.left!==t.left&&(this.element.style.left=t.left+"px"),this.computePositionTopFromRect(this.rect)}},t}();e.default=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.$$stickies=[],this.$$activated=!1,this.$$bulkUpdateRequestId=null,this.$$window=t,this.bulkUpdate=this.bulkUpdate.bind(this),this.bulkPlaceholderUpdate=this.bulkPlaceholderUpdate.bind(this)}return t.getInstance=function(e){return this.$$instance||(this.$$instance=new t(e)),this.$$instance},t.prototype.register=function(t){return this.$$stickies=this.$$stickies.concat([t]),this},t.prototype.unregister=function(t){return this.$$stickies=this.$$stickies.filter(function(e){return e!==t}),this.$$stickies.length<1&&this.deactivate(),this},t.prototype.bulkUpdate=function(){var t=this;return this.$$bulkUpdateRequestId&&this.$$window.cancelAnimationFrame(this.$$bulkUpdateRequestId),this.$$bulkUpdateRequestId=this.$$window.requestAnimationFrame(function(){t.$$stickies.forEach(function(t){return t.update()})}),this},t.prototype.destroyAll=function(){return this.$$stickies.forEach(function(t){return t.destroy()}),this.$$stickies=[],this.deactivate(),this},t.prototype.activate=function(){return!this.$$activated&&this.$$stickies.length>0&&(this.$$window.addEventListener("scroll",this.bulkUpdate),this.$$window.addEventListener("resize",this.bulkPlaceholderUpdate),this.$$activated=!0),this.bulkUpdate(),this},t.prototype.deactivate=function(){return this.$$activated&&(this.$$window.removeEventListener("scroll",this.bulkUpdate),this.$$window.removeEventListener("resize",this.bulkPlaceholderUpdate),this.$$activated=!1),this},t.prototype.bulkPlaceholderUpdate=function(){var t=this;this.$$bulkUpdateRequestId&&this.$$window.cancelAnimationFrame(this.$$bulkUpdateRequestId),this.$$bulkUpdateRequestId=this.$$window.requestAnimationFrame(function(){t.$$stickies.forEach(function(t){t.placeholder.update(),t.update()})})},t}();e.getStickyManagerInstance=function(t){return n.getInstance(t)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(1);e.Placeholder=n.default;var r=i(2);e.Sticky=r.default;var s=i(5);e.Stuck=s.default,e.default=s.default},function(t,e,i){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&this.update(),this},t.prototype.update=function(){return this.$$stackingStickies=this.stackingStickies.filter(function(t,e,i){return i.indexOf(t)===e}).map(function(t){return{instance:t,rect:t.placeholder.updateRect()}}).sort(function(t,e){var i=t.rect,n=e.rect;return i.top-n.top}).reduce(function(t,e){var i=t.instances,n=t.ceiling,r=e.instance;return r.marginTop=r.options.marginTop+n,{instances:i.concat([r]),ceiling:r.rect.height+r.marginTop}},{instances:[],ceiling:0}).instances,n.getStickyManagerInstance(this.$$window).bulkUpdate(),this.$$stickies=r.stableSort(this.stickies,function(t,e){return t.placeholder.cachedRect.top-e.placeholder.cachedRect.top}),this},t}();e.getStuckManagerInstance=function(t){return s.getInstance(t)}}])});