%PDF- %PDF-
Direktori : /var/www/projetos/romanian.ongrace.com/wp-content/plugins/otter-blocks/build/blocks/ |
Current File : /var/www/projetos/romanian.ongrace.com/wp-content/plugins/otter-blocks/build/blocks/sticky.js |
!function(){"use strict";const t=t=>{const e=document.querySelectorAll("lottie-player");if(0==e.length)return void(null==t||t());const o=e.length,i=Array(e.length).fill(0),n=()=>i.reduce(((t,e)=>t+e),0);let s=!0;const l=["load","loop","ready","complete","loop","rendered","error"];e.forEach(((e,r)=>{let a=150;const c=()=>{var l,d;null!=e&&null!==(l=e.shadowRoot)&&void 0!==l&&l.querySelector("svg")||null!=e&&null!==(d=e.shadowRoot)&&void 0!==d&&d.querySelector(".error")?(i[r]=1,n()>=o&&s&&(s=!1,null==t||t())):(a+=a*(.5+Math.random()),setTimeout(c,a))},d=setTimeout(c,a);l.forEach((l=>{const a=()=>{i[r]=1,e.removeEventListener(l,a),clearTimeout(d),n()>=o&&s&&(s=!1,null==t||t())};e.addEventListener(l,a)}))}))};window.debugSticky=!1;const e=(t,e)=>e.some((e=>t.classList.contains(e))),o="none",i="bottom",n="constrain-top",s="constrain-bottom";let l=0;class r{constructor(t,e,i){var n,s,r,a,c,d;this.index=l++,this.config=e,this.selector=t,this.containerSelector=i,this.orderInPage=-1,this.isActive=!1,this.isDormant=!0,this.positionStatus=o,this.status="inactive",this.triggerLimit="bottom"===(null==e?void 0:e.position)?window.innerHeight-this.offset:0,this.elem="string"==typeof t?document.querySelector(t):t,this.container="string"==typeof i?document.querySelector(i):i,this.scrollTop=window.pageYOffset||document.documentElement.scrollTop,this.scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;const{top:h,left:u,height:f,width:p}=this.elem.getBoundingClientRect();if(this.width=p,this.height=f,this.elemTopPositionInPage=h+this.scrollTop,this.elemLeftPositionInPage=u+this.scrollLeft,this.elemBottomPositionInPage=this.elemTopPositionInPage+f,this.elemBottomPositionInPage<this.triggerLimit)return console.groupCollapsed("Sticky Warning"),console.warn(this.elem,"This element needs to be position lower in the page when using position 'Bottom'. You can use position 'Top' as an alternative."),void console.groupEnd();this.containerHeight=(null===(n=this.container)||void 0===n||null===(s=n.getBoundingClientRect())||void 0===s?void 0:s.height)||0,this.containerTopPosition=this.container?(null===(r=this.container)||void 0===r||null===(a=r.getBoundingClientRect())||void 0===a?void 0:a.top)+this.scrollTop:0,this.containerBottomPosition=this.containerTopPosition+((null===(c=this.container)||void 0===c||null===(d=c.getBoundingClientRect())||void 0===d?void 0:d.height)||0),this.offsetY=this.offset,this.activationOffset=this.offset+20,this.placeholder=document.createElement("div"),this.placeholder.style.height=f+"px",this.placeholder.style.width=p+"px",this.elem.classList.remove("o-sticky-float"),this.stylingNodeName=`o-sticky-node-${this.index}`,this.stylingNode=document.createElement("style"),document.head.appendChild(this.stylingNode)}get position(){return this.config.position||"top"}get offset(){var t;return void 0!==(null===(t=this.config)||void 0===t?void 0:t.offset)?this.config.offset:40}get side(){var t,e;return null!==(t=null===(e=this.config)||void 0===e?void 0:e.side)&&void 0!==t?t:"left"}get sideOffset(){return this.config.sideOffset}get displayWidth(){var t;return null!==(t=this.config)&&void 0!==t&&t.isFloatMode?this.config.width:this.width+"px"}set styling(t){this.stylingNode.innerHTML=`\n\t\t.${this.stylingNodeName} {\n\t\t\tword-break: break-all;\n\t\t\t${t}\n\t\t}\n\t`}}class a{constructor(){this.orderInPageCounter=0,this.items=[]}register(t){t.elem&&(t.orderInPage=this.orderInPageCounter,this.items.push(t),this.orderInPageCounter++)}run(){this.items.forEach((t=>t.elem&&this.update(t))),this.items.forEach((t=>t.elem&&this.align(t)))}update(t){var e;null!==(e=window)&&void 0!==e&&e.debugSticky&&(t.container&&(t.container.style.border="1px dashed black"),t.elem.style.border="1px dashed red"),t.status="inactive",this.getCurrentPosition(t,this.calculateEarlyActivation(t))&&(t.status="dormant"),t.positionStatus=this.getCurrentPosition(t,"o-sticky-bhvr-stack"===t.config.behaviour?this.calculateGap(t):0),t.positionStatus!==o&&(t.status="active")}align(t){if(800>window.innerWidth&&!t.config.useOnMobile)return;const e=[];if("inactive"===t.status&&(e.push("position: relative !important"),e.push(`z-index: ${(9999+(t.orderInPage||0)).toString()}`)),"active"===t.status){t.elem.classList.add("o-is-sticky"),t.config.isFloatMode||e.push("transition: transform 2s"),e.push(`width: ${t.displayWidth} !important`),e.push("position: fixed !important"),t.container&&"BODY"!==t.container.tagName&&(t.container.style.height=0<t.containerHeight?t.containerHeight+"px":"");const l="o-sticky-bhvr-stack"===t.config.behaviour?this.calculateGap(t):0,r=window.pageYOffset||document.documentElement.scrollTop,a=r+window.innerHeight;switch(t.config.isFloatMode?t.elem.classList.contains("alignfull")&&t.displayWidth.includes("%")&&100<=parseInt(t.displayWidth)||("left"===t.side?e.push(`left: ${t.sideOffset}`):e.push(`right: ${t.sideOffset}`)):e.push(`left: ${t.elemLeftPositionInPage}px`),t.positionStatus){case"top":e.push("top: 0px"),e.push(`transform: translateY(${t.offsetY+l}px)`);break;case i:e.push(`bottom: ${t.offsetY+l}px`),e.push("transform: unset");break;case n:e.push("top: 0px"),e.push(`transform: translateY(${t.containerBottomPosition-t.height-r}px)`);break;case s:e.push("bottom: 0px"),e.push("transform-origin: left bottom"),e.push(`transform: translateY(${t.containerBottomPosition-a}px)`);break;default:console.warn("Unknown position",t.positionStatus)}this.insertPlaceholder(t),"o-sticky-bhvr-hide"===t.config.behaviour&&e.push(`opacity: ${(o=this.calculateOpacity(t),1-(1-o)*(1-o)).toString()}`)}else t.isActive=!1,t.elem.classList.remove("o-is-sticky"),this.removePlaceholder(t);var o;t.styling=e.join(";\n"),t.isActive||t.isDormant?t.elem.classList.add(t.stylingNodeName):t.elem.classList.remove(t.stylingNodeName)}resize(){for(const t of this.items)t.elemLeftPositionInPage=(t.isActive?t.placeholder:t.elem).getBoundingClientRect().left+t.scrollLeft}insertPlaceholder(t){t.config.isFloatMode||t.elem.parentElement.contains(t.placeholder)||t.elem.parentElement.insertBefore(t.placeholder,t.elem)}removePlaceholder(t){!t.config.isFloatMode&&t.elem.parentElement.contains(t.placeholder)&&t.elem.parentElement.removeChild(t.placeholder)}getCurrentPosition(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const l=window.pageYOffset||document.documentElement.scrollTop,r=l+window.innerHeight;if("top"===t.position&&(l+t.activationOffset+e>t.elemTopPositionInPage&&(!t.container||l+t.activationOffset+t.height+e<t.containerBottomPosition)||t.config.isFloatMode))return"top";if("bottom"===t.position&&(r-t.activationOffset-e>t.elemBottomPositionInPage&&(!t.container||r-t.activationOffset-e<t.containerBottomPosition)||t.config.isFloatMode))return i;if(t.container){if("top"===t.position&&(l+t.activationOffset+t.height+e>t.containerBottomPosition||t.config.isFloatMode))return n;if("bottom"===t.position&&(r-t.activationOffset-e>=t.containerBottomPosition||t.config.isFloatMode))return s}return o}calculateGap(t){var e;let o=0;const i=(null===(e=t.elem.getBoundingClientRect())||void 0===e?void 0:e.width)||0;for(const e of this.active){var n,s;e.orderInPage!==t.orderInPage&&e.container===t.container&&e.orderInPage<t.orderInPage&&"o-sticky-bhvr-stack"===(null===(n=e.config)||void 0===n?void 0:n.behaviour)&&i>Math.abs(t.elemLeftPositionInPage-e.elemLeftPositionInPage)&&(o+=e.offset+(null==e||null===(s=e.elem.getBoundingClientRect())||void 0===s?void 0:s.height)||0)}return o}calculateEarlyActivation(t){let e=0;for(const n of this.active){var o,i;n.orderInPage!==t.orderInPage&&n.orderInPage<t.orderInPage&&(e+=n.activationOffset+((null===(o=n.elem)||void 0===o||null===(i=o.getBoundingClientRect())||void 0===i?void 0:i.height)||0))}return e}calculateOpacity(t){var e,o;let i=1;const n=(null===(e=t.elem.getBoundingClientRect())||void 0===e?void 0:e.height)||0,s=(null===(o=t.elem.getBoundingClientRect())||void 0===o?void 0:o.width)||0,l=n+t.config.offset+(window.pageYOffset||document.documentElement.scrollTop);for(const e of[...this.dormant,...this.active])if(e.orderInPage!==t.orderInPage&&t.container===e.container&&e.orderInPage>t.orderInPage){var r;const o=(null===(r=e.elem.getBoundingClientRect())||void 0===r?void 0:r.height)||0;if(s>Math.abs(t.elemLeftPositionInPage-e.elemLeftPositionInPage)){const t=Math.min(n,o);return i=Math.min(1,Math.max(0,e.elemTopPositionInPage+t-l)/t),i}}return i}get active(){return this.items.filter((t=>"active"===t.status))}get dormant(){return this.items.filter((t=>"dormant"===t.status))}get isEmpty(){return 0===this.items.length}}var c;c=()=>{const o=document.querySelectorAll(".o-sticky");let i="\n\t\t.o-is-sticky {\n\t\t\tposition: fixed;\n\t\t\tz-index: 9999;\n\t\t}\n\t";i=i.replace(/(\r\n|\n|\r|\t)/gm,"");let n=!1;!function(e,o){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,n=0,s=!0;if(0==o.length)return void(null==e||e());const l=setTimeout((()=>{s&&(null==e||e())}),1e3*i),r=()=>{n+=1,n>=o.length&&s&&(s=!1,clearTimeout(l),null==e||e())};o.forEach((e=>{"lottie"===e&&t(r)}))}((()=>{const t=new a;o.forEach((o=>{try{if(!n){const t=document.createElement("style");t.innerText=i,document.head.appendChild(t),n=!0}const s=(t=>Array.from(t.classList).reduce(((t,e)=>{if(e.includes("o-sticky-pos-bottom"))t.position="bottom";else if(e.includes("o-sticky-offset")){var o;t.offset=parseInt(null===(o=e.split("-"))||void 0===o?void 0:o.pop())}else if(e.includes("o-sticky-scope"))t.scope=e;else if(e.includes("o-sticky-bhvr"))t.behaviour=e;else if(e.includes("o-sticky-use-mobile"))t.useOnMobile=!0;else if(e.includes("o-sticky-float"))t.isFloatMode=!0;else if(e.includes("o-sticky-width")){var i;t.width=null===(i=e.split("-"))||void 0===i?void 0:i.pop()}else if(e.includes("o-sticky-opt-side-offset")){var n;t.sideOffset=null===(n=e.split("-"))||void 0===n?void 0:n.pop()}else e.includes("o-sticky-side-right")&&(t.side="right");return t}),{position:"top",offset:40,scope:"o-sticky-scope-main-area",behaviour:"o-sticky-bhvr-keep",useOnMobile:!1,isFloatMode:!1,width:"100%",sideOffset:"20px",side:"left"}))(o),l=((t,o)=>{let i=null==t?void 0:t.parentElement;const n=[];for(;i;){if(e(i,["wp-block-themeisle-blocks-advanced-column","wp-block-group","wp-block-column"])&&"o-sticky-scope-parent"===o)return i;if(e(i,["wp-block-themeisle-blocks-advanced-columns","wp-block-group","wp-block-columns"])){if("o-sticky-scope-section"===o)return i;"o-sticky-scope-main-area"===o&&n.push(i)}i=i.parentElement}return"o-sticky-scope-main-area"===o?n.pop():document.body})(o,s.scope);t.register(new r(o,s,l))}catch(t){console.error(t)}})),t.isEmpty||(t.run(),window.addEventListener("scroll",(()=>{t.run()})),window.addEventListener("resize",(()=>{t.resize()})))}),["lottie"])},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",c):c())}();