File: /home/salamatk/takarzan.ir/wp-content/themes/xts-luman/js/scripts/stickyContainer.min.js
XTSThemeModule.xtsElementorAddAction("frontend/element_ready/container",function(){XTSThemeModule.stickyContainer()});let windowWidth=XTSThemeModule.windowWidth;XTSThemeModule.stickyContainer=function(){function a(){return document.querySelector("html").hasAttributes("dir")&&"rtl"===document.querySelector("html").getAttribute("dir")}function u(t,n){var e=Object.keys(n);0!==e.length&&e.forEach(function(e){t.style[e]=n[e]})}function p(e,t){var n=window.getComputedStyle(e),n={position:"fixed",width:n.width,marginTop:n.marginTop,marginBottom:n.marginBottom,top:t+"px",bottom:"",zIndex:99};return a()?n.insetInlineEnd=e.getBoundingClientRect().left+"px":n.insetInlineStart=e.getBoundingClientRect().left+"px",n}function y(e,t){e.parentNode.removeChild(t),e.style=""}function n(t,n){var i,o,s,r,d,l,c=t.dataset.id;if(void 0!==c){let e=document.querySelector(`.elementor-element-${c}.xts-sticky-spacer`);n.is_mobile&&!t.classList.contains("xts-sticky-con-mobile-yes")||n.is_tablet&&!t.classList.contains("xts-sticky-con-tablet-yes")||n.is_desktop&&!t.classList.contains("xts-sticky-con-yes")?null!==e&&y(t,e):(c=Array.from(t.classList).find(function(e){return-1!==e.indexOf("xts-sticky-offset")}),n=void 0!==c?parseInt(c.substring(c.lastIndexOf("-")+1)):150,c=XTSThemeModule.$window.scrollTop(),i=t.offsetHeight,o=t.getBoundingClientRect().top+window.scrollY-n,d=t.parentNode.parentNode.classList.contains("entry-content"),null!==(e=!d&&null===e&&o<c?(l=p(d=t,l=n),(s=d.cloneNode(!0)).classList.add("xts-sticky-spacer"),u(s,{visibility:"hidden"}),(r=s.querySelector("#xts-wtl-policy-check"))&&(r.id=r.id+"-clone"),d.parentNode.insertBefore(s,d),u(d,l),s):e)&&(r=e.parentNode.getBoundingClientRect().top+window.scrollY-n+e.parentNode.offsetHeight,c<e.getBoundingClientRect().top+window.scrollY-n?y(t,e):"fixed"!==t.style.position&&c<r-i?(void 0===(t=>{var n=[];if(t.parentNode){let e=t.parentNode.firstChild;for(;e;)1===e.nodeType&&e!==t&&n.push(e),e=e.nextSibling}return n})(t).find(function(e){return"absolute"===e.style.position})&&u(t.parentNode,{position:""}),u(t,p(e,n))):"absolute"!==t.style.position&&r<o+i&&(u(t.parentNode,{position:"relative"}),u(t,(d=e,l={position:"absolute",top:"",bottom:"0px",zIndex:99},a()?l.insetInlineEnd=d.offsetLeft+"px":l.insetInlineStart=d.offsetLeft+"px",l)))))}}document.querySelectorAll(".xts-sticky-con-yes, .xts-sticky-con-tablet-yes, .xts-sticky-con-mobile-yes").forEach(function(e){var e=e.dataset.id,t=document.querySelector(`.elementor-element-${e}.xts-sticky-spacer`);t&&t.remove(),document.querySelector(".elementor-element-"+e).style=""}),window.addEventListener("scroll",function(){var e=document.querySelectorAll(".xts-sticky-con-yes:not(.xts-sticky-spacer), .xts-sticky-con-tablet-yes:not(.xts-sticky-spacer), .xts-sticky-con-mobile-yes:not(.xts-sticky-spacer)");let t={is_desktop:1024<windowWidth,is_tablet:768<windowWidth&&windowWidth<1024,is_mobile:windowWidth<=768};e.forEach(function(e){n(e,t)})})},window.addEventListener("resize",function(){"undefined"!=typeof elementor&&(windowWidth=isNaN(parseInt(elementor.$preview.css("--e-editor-preview-width")))?1025:parseInt(elementor.$preview.css("--e-editor-preview-width")))}),window.addEventListener("load",function(){XTSThemeModule.stickyContainer()});