// source --> https://medcell.co/wp-content/themes/Total/assets/js/frontend/sticky/topbar.min.js?ver=6.1 
!function(t){const e=document.querySelector("#top-bar-wrap.wpex-top-bar-sticky");if(!e)return;let i=!1,n=!1,o=!1;const s=()=>Math.max(window.scrollY||0,0),r=t=>!!t&&!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length),d=t=>{const e=t.getBoundingClientRect();return{top:e.top+s(),left:e.left+s(),bottom:e.bottom+s()}},c=()=>{let t=0;return document.querySelectorAll(".wpex-sticky-el-offset,#wpadminbar").forEach((e=>{const i=window.getComputedStyle(e).position;((t,e)=>{if("wpadminbar"===t.id)return!0;if(!t||!e)return;return 4===t.compareDocumentPosition(e)})(e,o)&&r(e)&&("fixed"===i||"sticky"===i)&&(t+=e.getBoundingClientRect().height)})),t},p=()=>{let t=e.getBoundingClientRect().height;return Math.round(t)!==t&&(t=t.toFixed(2)),t},l=()=>{if(i)return;const t=p();o.style.height=`${t}px`,o.classList.remove("not-sticky"),o.classList.add("is-sticky"),e.style.top=c()+"px",e.style.width=o.getBoundingClientRect().width+"px",e.style.position="fixed",i=!0},a=()=>{i&&(o.style.height="",o.classList.remove("is-sticky"),o.classList.add("not-sticky"),e.style.width="",e.style.top="",e.style.position="",i=!1)},y=()=>{if(!r(e)||t.breakpoint&&(()=>{let t="inner",e=window;return"innerWidth"in window||(t="client",e=document.documentElement||document.body),e[t+"Width"]})()<t.breakpoint)return o.classList.contains("wpex-can-sticky")&&(o.classList.remove("wpex-can-sticky"),document.body.style.removeProperty("--wpex-sticky-topbar-height")),a();o.classList.add("wpex-can-sticky");const y=p();let w=!1;if(n!==y&&(w=!0,n=y),!w&&document.body.style.getPropertyValue("--wpex-sticky-topbar-height")||document.body.style.setProperty("--wpex-sticky-topbar-height",`${n}px`),i)w&&(o.style.height=`${n}px`),e.style.top=c()+"px",e.style.width=o.getBoundingClientRect().width+"px";else{const t=s();0!==t&&t>d(o).top-c()?l():a()}},w=()=>{if(!o||!o.classList.contains("wpex-can-sticky"))return;const t=s();0!==t&&t>=d(o).top-c()?l():a()},h=()=>{o=document.createElement("div"),o.id="top-bar-wrap-sticky-wrapper",o.className="wpex-sticky-top-bar-holder not-sticky wpex-print-hidden",e.childNodes||(e=[e]),e.nextSibling?e.parentNode.insertBefore(o,e.nextSibling):e.parentNode.appendChild(o),o.appendChild(e),y(),window.addEventListener("scroll",w,{passive:!0}),window.addEventListener("resize",y),o.classList.contains("wpex-can-sticky")&&window.addEventListener("load",(()=>{setTimeout((()=>{const t=p();n!==t&&(n=t,document.body.style.setProperty("--wpex-sticky-topbar-height",`${n}px`),o.style.height=`${n}px`)}),0)}))};t.runOnWindowLoad?window.addEventListener("load",(()=>{h()})):h()}(wpex_sticky_topbar_params);