/*
 * HC-Sticky
 * =========
 * Version: 2.3.0
 * Author: Some Web Media
 * Author URL: https://github.com/somewebmedia
 * Plugin URL: https://github.com/somewebmedia/hc-sticky
 * Description: JavaScript library that makes any element on your page visible while you scroll
 * License: MIT
 */
((t,e)=>{if("object"==typeof module&&"object"==typeof module.exports){if(!t.document)throw new Error("HC-Sticky requires a browser to run.");module.exports=e(t)}else"function"==typeof define&&define.amd?define("hcSticky",[],e(t)):e(t)})("undefined"!=typeof window?window:this,function(U){function X(n,c){var o=this;if(c=c||{},!(n="string"==typeof n?G.querySelector(n):n))return!1;function t(){L.onBeforeResize&&L.onBeforeResize.call(n,Object.assign({},L)),P(),L.onResize&&L.onResize.call(n,Object.assign({},L))}function e(){I||(U.addEventListener("resize",V,x.supportsPassive),I=!0),q(),(B()?R:M)()}c.queries&&K("queries","responsive","option"),c.queryFlow&&K("queryFlow","mobileFirst","option");var i,s,r,a,l,f,p,u,d,m,g,h,y,b,v,S,w,k,A,L={},x=X.Helpers,E=n.parentNode,T=("static"===x.getStyle(E,"position")&&(E.style.position="relative"),function(t){x.isEmptyObject(t=t||{})&&!x.isEmptyObject(L)||(L=Object.assign({},J,L,t))}),F=function(t){L=Object.assign({},J,t||{})},B=function(){return L.disable},q=function(){var t=L.responsive||L.queries;if(t){var e=U.innerWidth;if(F(c),L.mobileFirst)for(var o in t)o<=e&&!x.isEmptyObject(t[o])&&T(t[o]);else{var i,n=[];for(i in t){var s={};s[i]=t[i],n.push(s)}for(var r=n.length-1;0<=r;r--){var a=n[r],l=Object.keys(a)[0];e<=l&&!x.isEmptyObject(a[l])&&T(a[l])}}}},W=function(t){var e=x.getCascadedStyle(t),o=x.getStyle(t),i={height:t.offsetHeight+"px",left:e.left,right:e.right,top:e.top,bottom:e.bottom,position:o.position,display:o.display,verticalAlign:o.verticalAlign,boxSizing:o.boxSizing,marginLeft:e.marginLeft,marginRight:e.marginRight,marginTop:e.marginTop,marginBottom:e.marginBottom,paddingLeft:e.paddingLeft,paddingRight:e.paddingRight};return e.float&&(i.float=e.float||"none"),e.cssFloat&&(i.cssFloat=e.cssFloat||"none"),i.width="auto"!==e.width?e.width:"border-box"===i.boxSizing?t.offsetWidth+"px":o.width,i},j={css:{},position:null,stick:function(t){t=t||{},n.classList.contains(L.stickyClass)||(!1===O.isAttached&&O.attach(),j.position="fixed",n.style.position="fixed",n.style.left=O.offsetLeft+"px",n.style.width=O.width,n.style.bottom=void 0===t.bottom?"auto":t.bottom+"px",n.style.top=void 0===t.top?"auto":t.top+"px",n.classList.add(L.stickyClass),L.onStart&&L.onStart.call(n,Object.assign({},L)))},release:function(t){var e;(t=t||{}).stop=t.stop||!1,!0!==t.stop&&"fixed"!==j.position&&null!==j.position&&(void 0===t.top&&void 0===t.bottom||void 0!==t.top&&(parseInt(x.getStyle(n,"top"))||0)===t.top||void 0!==t.bottom&&(parseInt(x.getStyle(n,"bottom"))||0)===t.bottom)||(!0===t.stop?!0===O.isAttached&&O.detach():!1===O.isAttached&&O.attach(),e=t.position||j.css.position,j.position=e,n.style.position=e,n.style.left=!0===t.stop?j.css.left:O.positionLeft+"px",n.style.width=("absolute"!==e?j.css:O).width,n.style.bottom=void 0===t.bottom?!0===t.stop?"":"auto":t.bottom+"px",n.style.top=void 0===t.top?!0===t.stop?"":"auto":t.top+"px",n.classList.remove(L.stickyClass),L.onStop&&L.onStop.call(n,Object.assign({},L)))}},O={el:G.createElement("div"),offsetLeft:null,positionLeft:null,width:null,isAttached:!1,init:function(){for(var t in O.el.className="sticky-spacer",j.css)O.el.style[t]=j.css[t];O.el.style["z-index"]="-1";var e=x.getStyle(n);O.offsetLeft=x.offset(n).left-(parseInt(e.marginLeft)||0),O.positionLeft=x.position(n).left,O.width=x.getStyle(n,"width")},attach:function(){E.insertBefore(O.el,n),O.isAttached=!0},detach:function(){O.el=E.removeChild(O.el),O.isAttached=!1}},D=function(){j.css=W(n),O.init(),i=!(!L.stickTo||!("document"===L.stickTo||L.stickTo.nodeType&&9===L.stickTo.nodeType||"object"==typeof L.stickTo&&L.stickTo instanceof Document)),s=L.stickTo?i?G:x.getElement(L.stickTo):E,v=(k=function(){var t=n.offsetHeight+(parseInt(j.css.marginTop)||0)+(parseInt(j.css.marginBottom)||0),e=(v||0)-t;return-1<=e&&e<=1?v:t})(),a=(w=function(){return i?Math.max(G.documentElement.clientHeight,G.body.scrollHeight,G.documentElement.scrollHeight,G.body.offsetHeight,G.documentElement.offsetHeight):s.offsetHeight})(),l=i?0:x.offset(s).top,f=L.stickTo?i?0:x.offset(E).top:l,p=U.innerHeight,S=n.offsetTop-(parseInt(j.css.marginTop)||0),r=x.getElement(L.innerSticker),u=isNaN(L.top)&&-1<L.top.indexOf("%")?parseFloat(L.top)/100*p:L.top,d=isNaN(L.bottom)&&-1<L.bottom.indexOf("%")?parseFloat(L.bottom)/100*p:L.bottom,m=r?r.offsetTop:L.innerTop||0,g=isNaN(L.bottomEnd)&&-1<L.bottomEnd.indexOf("%")?parseFloat(L.bottomEnd)/100*p:L.bottomEnd,h=l-u+m+S},N=U.scrollY,z=0,C=function(){v=k(),a=w(),y=l+a-u-g,b=p<v;var t,e=U.scrollY,o=x.offset(n).top,i=o-e;A=e<N?"up":"down",z=e-N,h<(N=e)?y+u+(b?d:0)-(L.followScroll&&b?0:u)<=e+v-m-(p-(h-m)<v-m&&L.followScroll&&0<(t=v-p-m)?t:0)?j.release({position:"absolute",bottom:f+E.offsetHeight-y-u}):b&&L.followScroll?"down"===A?i+v+d<=p+.9?j.stick({bottom:d}):"fixed"===j.position&&j.release({position:"absolute",top:o-u-h-z+m}):Math.ceil(i+m)<0&&"fixed"===j.position?j.release({position:"absolute",top:o-u-h+m-z}):e+u-m<=o&&j.stick({top:u-m}):j.stick({top:u-m}):j.release({stop:!0})},H=!1,I=!1,R=function(){H&&(U.removeEventListener("scroll",C,x.supportsPassive),H=!1)},M=function(){null===n.offsetParent||"none"===x.getStyle(n,"display")||(D(),a<v)?R():(C(),H||(U.addEventListener("scroll",C,x.supportsPassive),H=!0))},Q=function(){n.style.position="",n.style.left="",n.style.top="",n.style.bottom="",n.style.width="",n.classList.remove(L.stickyClass),j.css={},!(j.position=null)===O.isAttached&&O.detach()},P=function(){Q(),q(),(B()?R:M)()},V=L.resizeDebounce?x.debounce(t,L.resizeDebounce):t,Y=function(){I&&(U.removeEventListener("resize",V,x.supportsPassive),I=!1),R()};this.options=function(t){return t?L[t]:Object.assign({},L)},this.refresh=P,this.update=function(t){T(t),c=Object.assign({},c,t||{}),P()},this.attach=e,this.detach=Y,this.destroy=function(){Y(),Q()},this.triggerMethod=function(t,e){"function"==typeof o[t]&&o[t](e)},this.reinit=function(){K("reinit","refresh","method"),P()},T(c),e(),U.addEventListener("load",P)}var i,n,G=U.document,J={top:0,bottom:0,bottomEnd:0,innerTop:0,innerSticker:null,stickyClass:"sticky",stickTo:null,followScroll:!0,responsive:null,mobileFirst:!1,onStart:null,onStop:null,onBeforeResize:null,onResize:null,resizeDebounce:100,disable:!1},K=function(t,e,o){console.warn("%cHC Sticky:%c "+o+"%c '"+t+"'%c is now deprecated and will be removed. Use%c '"+e+"'%c instead.","color: #fa253b","color: default","color: #5595c6","color: default","color: #5595c6","color: default")};return void 0!==U.jQuery&&(i=U.jQuery,n="hcSticky",i.fn.extend({hcSticky:function(e,o){return this.length?"options"===e?i.data(this.get(0),n).options():this.each(function(){var t=i.data(this,n);t?t.triggerMethod(e,o):(t=new X(this,e),i.data(this,n,t))}):this}})),U.hcSticky=U.hcSticky||X,X}),(o=>{function n(t,e){return t=document.defaultView.getComputedStyle(t,null),e?t.getPropertyValue(e):t}function s(t){return{top:(t=t.getBoundingClientRect()).top+o.pageYOffset,left:t.left+o.pageXOffset}}var t=o.hcSticky,e=(()=>{var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t={passive:!1}}});o.addEventListener("testPassive",null,e),o.removeEventListener("testPassive",null,e)}catch(t){}return t})();t.Helpers={supportsPassive:e,isEmptyObject:function(t){for(var e in t)return!1;return!0},debounce:function(i,n,s){var r;return function(){var t=this,e=arguments,o=s&&!r;clearTimeout(r),r=setTimeout(function(){r=null,s||i.apply(t,e)},n),o&&i.apply(t,e)}},offset:s,position:function(t){var e=t.offsetParent,o=s(e),i=s(t),e=n(e),t=n(t);return o.top+=parseInt(e.borderTopWidth)||0,o.left+=parseInt(e.borderLeftWidth)||0,{top:i.top-o.top-(parseInt(t.marginTop)||0),left:i.left-o.left-(parseInt(t.marginLeft)||0)}},getElement:function(t){return"string"==typeof t?document.querySelector(t):o.jQuery&&t instanceof o.jQuery&&t.length?t[0]:t instanceof Element?t:null},getStyle:n,getCascadedStyle:function(t){var e,o,i,n=t.cloneNode(!0),s=(n.style.display="none",n.querySelectorAll('input[type="radio"]').forEach(function(t){t.removeAttribute("name")}),t.parentNode.insertBefore(n,t.nextSibling),document.defaultView.getComputedStyle(n,null)),r={};for(e in s)!isNaN(e)||"string"!=typeof s[e]&&"number"!=typeof s[e]||(r[e]=s[e]);if(Object.keys(r).length<3)for(var a in r={},s)isNaN(a)||(r[s[a].replace(/-\w/g,function(t){return t.toUpperCase().replace("-","")})]=s.getPropertyValue(s[a]));return r.margin||"auto"!==r.marginLeft?r.margin||r.marginLeft!==r.marginRight||r.marginLeft!==r.marginTop||r.marginLeft!==r.marginBottom||(r.margin=r.marginLeft):r.margin="auto",r.margin||"0px"!==r.marginLeft||"0px"!==r.marginRight||(i=(o=t.offsetLeft-t.parentNode.offsetLeft)-(parseInt(r.left)||0)-(parseInt(r.right)||0),0!=(t=t.parentNode.offsetWidth-t.offsetWidth-o-(parseInt(r.right)||0)+(parseInt(r.left)||0)-i)&&1!=t)||(r.margin="auto"),n.parentNode.removeChild(n),n=null,r}}})(window);