@innovastudio/contentbox-runtime-base 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3514,7 +3514,7 @@ class Yi {
|
|
|
3514
3514
|
let n = r.nextElementSibling;
|
|
3515
3515
|
return n ? n.classList.contains("is-section") ? n : i(n) : !1;
|
|
3516
3516
|
};
|
|
3517
|
-
document.querySelectorAll(".is-arrow-down a").forEach(
|
|
3517
|
+
document.querySelectorAll(".is-arrow-down a").forEach((r) => {
|
|
3518
3518
|
r.addEventListener("click", (n) => {
|
|
3519
3519
|
let h = n.target.closest(".is-section");
|
|
3520
3520
|
if (h) {
|
|
@@ -3646,7 +3646,7 @@ class Yi {
|
|
|
3646
3646
|
}
|
|
3647
3647
|
inViewSetup() {
|
|
3648
3648
|
document.querySelectorAll(".is-overlay-content").forEach((e) => {
|
|
3649
|
-
e.querySelector("video.is-video-bg") && e.setAttribute("data-scroll", "");
|
|
3649
|
+
(e.querySelector("video.is-video-bg") || e.querySelector('[data-cb-type="video-background"]')) && e.setAttribute("data-scroll", "");
|
|
3650
3650
|
}), document.querySelectorAll(".is-container video").forEach((e) => {
|
|
3651
3651
|
e.parentNode.setAttribute("data-scroll", "");
|
|
3652
3652
|
});
|
|
@@ -3678,7 +3678,7 @@ class Yi {
|
|
|
3678
3678
|
},
|
|
3679
3679
|
out: (e) => {
|
|
3680
3680
|
e.element.querySelectorAll("video").forEach((r) => {
|
|
3681
|
-
|
|
3681
|
+
r.paused || r.pause();
|
|
3682
3682
|
});
|
|
3683
3683
|
}
|
|
3684
3684
|
}
|
|
@@ -45,4 +45,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
45
45
|
<button class="gprev gbtn" aria-label="Previous" data-taborder="2">{prevSVG}</button>
|
|
46
46
|
<button class="gnext gbtn" aria-label="Next" data-taborder="1">{nextSVG}</button>
|
|
47
47
|
</div>
|
|
48
|
-
</div>`;class Ke{constructor(t={}){this.customOptions=t,this.settings=Rt(ke,t),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}init(){const t=this.getSelector();t&&(this.baseEvents=Xt("click",{onElement:t,withCallback:(i,s)=>{i.preventDefault(),this.open(s)}})),this.elements=this.getElements()}open(t=null,i=null){if(this.elements.length===0)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;let s=re(i)?i:this.settings.startAt;if($t(t)){const n=t.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),zt(s)&&(s=this.getElementIndex(t),s<0&&(s=0))}re(s)||(s=0),this.build(),Gt(this.overlay,this.settings.openEffect==="none"?"none":this.settings.cssEfects.fade.in);const e=document.body,a=window.innerWidth-document.documentElement.clientWidth;if(a>0){var r=document.createElement("style");r.type="text/css",r.className="gcss-styles",r.innerText=`.gscrollbar-fixer {margin-right: ${a}px}`,document.head.appendChild(r),Y(e,"gscrollbar-fixer")}Y(e,"glightbox-open"),Y(Le,"glightbox-open"),Fe&&(Y(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(s,!0),this.elements.length===1?(Y(this.prevButton,"glightbox-button-hidden"),Y(this.nextButton,"glightbox-button-hidden")):(ft(this.prevButton,"glightbox-button-hidden"),ft(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),D(this.settings.onOpen)&&this.settings.onOpen(),Ue&&this.settings.touchNavigation&&xi(this),this.settings.keyboardNavigation&&gi(this)}openAt(t=0){this.open(null,t)}showSlide(t=0,i=!1){De(this.loader),this.index=parseInt(t);let s=this.slidesContainer.querySelector(".current");s&&ft(s,"current"),this.slideAnimateOut();let e=this.slidesContainer.querySelectorAll(".gslide")[t];if(_t(e,"loaded"))this.slideAnimateIn(e,i),Ee(this.loader);else{De(this.loader);const a=this.elements[t],r={index:this.index,slide:e,slideNode:e,slideConfig:a.slideConfig,slideIndex:this.index,trigger:a.node,player:null};this.trigger("slide_before_load",r),a.instance.setContent(e,()=>{Ee(this.loader),this.resize(),this.slideAnimateIn(e,i),this.trigger("slide_after_load",r)})}this.slideDescription=e.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&_t(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=e}preloadSlide(t){if(t<0||t>this.elements.length-1||zt(this.elements[t]))return!1;let i=this.slidesContainer.querySelectorAll(".gslide")[t];if(_t(i,"loaded"))return!1;const s=this.elements[t],e=s.type,a={index:t,slide:i,slideNode:i,slideConfig:s.slideConfig,slideIndex:t,trigger:s.node,player:null};this.trigger("slide_before_load",a),e==="video"||e==="external"?setTimeout(()=>{s.instance.setContent(i,()=>{this.trigger("slide_after_load",a)})},200):s.instance.setContent(i,()=>{this.trigger("slide_after_load",a)})}prevSlide(){this.goToSlide(this.index-1)}nextSlide(){this.goToSlide(this.index+1)}goToSlide(t=!1){if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(t<0||t>this.elements.length-1))return!1;t<0?t=this.elements.length-1:t>=this.elements.length&&(t=0),this.showSlide(t)}insertSlide(t={},i=-1){i<0&&(i=this.elements.length);const s=new le(t,this,i),e=s.getConfig(),a=Rt({},e),r=s.create(),n=this.elements.length-1;a.index=i,a.node=!1,a.instance=s,a.slideConfig=e,this.elements.splice(i,0,a);let h=null,l=null;if(this.slidesContainer){if(i>n)this.slidesContainer.appendChild(r);else{let c=this.slidesContainer.querySelectorAll(".gslide")[i];this.slidesContainer.insertBefore(r,c)}(this.settings.preload&&this.index==0&&i==0||this.index-1==i||this.index+1==i)&&this.preloadSlide(i),this.index===0&&i===0&&(this.index=1),this.updateNavigationClasses(),h=this.slidesContainer.querySelectorAll(".gslide")[i],l=this.getSlidePlayerInstance(i),a.slideNode=h}this.trigger("slide_inserted",{index:i,slide:h,slideNode:h,slideConfig:e,slideIndex:i,trigger:null,player:l}),D(this.settings.slideInserted)&&this.settings.slideInserted({index:i,slide:h,player:l})}removeSlide(t=-1){if(t<0||t>this.elements.length-1)return!1;const i=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[t];i&&(this.getActiveSlideIndex()==t&&(t==this.elements.length-1?this.prevSlide():this.nextSlide()),i.parentNode.removeChild(i)),this.elements.splice(t,1),this.trigger("slide_removed",t),D(this.settings.slideRemoved)&&this.settings.slideRemoved(t)}slideAnimateIn(t,i){let s=t.querySelector(".gslide-media"),e=t.querySelector(".gslide-description"),a={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},r={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(s.offsetWidth>0&&e&&(Ee(e),e.style.display=""),ft(t,this.effectsClasses),i)Gt(t,this.settings.cssEfects[this.settings.openEffect].in,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(t),this.trigger("slide_changed",{prev:a,current:r}),D(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[a,r])});else{let n=this.settings.slideEffect,h=n!=="none"?this.settings.cssEfects[n].in:n;this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(h=this.settings.cssEfects.slideBack.in),Gt(t,h,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(t),this.trigger("slide_changed",{prev:a,current:r}),D(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[a,r])})}setTimeout(()=>{this.resize(t)},100),Y(t,"current")}slideAnimateOut(){if(!this.prevActiveSlide)return!1;let t=this.prevActiveSlide;ft(t,this.effectsClasses),Y(t,"prev");let i=this.settings.slideEffect,s=i!=="none"?this.settings.cssEfects[i].out:i;this.slidePlayerPause(t),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),D(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(s=this.settings.cssEfects.slideBack.out),Gt(t,s,()=>{let e=t.querySelector(".ginner-container"),a=t.querySelector(".gslide-media"),r=t.querySelector(".gslide-description");e.style.transform="",a.style.transform="",ft(a,"greset"),a.style.opacity="",r&&(r.style.opacity=""),ft(t,"prev")})}getAllPlayers(){return this.videoPlayers}getSlidePlayerInstance(t){const i="gvideo"+t,s=this.getAllPlayers();return gt(s,i)&&s[i]?s[i]:!1}stopSlideVideo(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");const i=this.getSlidePlayerInstance(t);i&&i.playing&&i.pause()}slidePlayerPause(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}const i=this.getSlidePlayerInstance(t);i&&i.playing&&i.pause()}playSlideVideo(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");const i=this.getSlidePlayerInstance(t);i&&!i.playing&&i.play()}slidePlayerPlay(t){if(Fe&&!this.settings.plyr.config?.muted)return;if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}const i=this.getSlidePlayerInstance(t);i&&!i.playing&&(i.play(),this.settings.autofocusVideos&&i.elements.container.focus())}setElements(t){this.settings.elements=!1;const i=[];t&&t.length&&tt(t,(s,e)=>{const a=new le(s,this,e),r=a.getConfig(),n=Rt({},r);n.slideConfig=r,n.instance=a,n.index=e,i.push(n)}),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(tt(this.elements,()=>{let s=Ft(this.settings.slideHTML);this.slidesContainer.appendChild(s)}),this.showSlide(0,!0)))}getElementIndex(t){let i=!1;return tt(this.elements,(s,e)=>{if(gt(s,"node")&&s.node==t)return i=e,!0}),i}getElements(){let t=[];this.elements=this.elements?this.elements:[],!zt(this.settings.elements)&&Xe(this.settings.elements)&&this.settings.elements.length&&tt(this.settings.elements,(e,a)=>{const r=new le(e,this,a),n=r.getConfig(),h=Rt({},n);h.node=!1,h.index=a,h.instance=r,h.slideConfig=n,t.push(h)});let i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i&&tt(i,(e,a)=>{const r=new le(e,this,a),n=r.getConfig(),h=Rt({},n);h.node=e,h.index=a,h.instance=r,h.slideConfig=n,h.gallery=e.getAttribute("data-gallery"),t.push(h)}),t}getGalleryElements(t,i){return t.filter(s=>s.gallery==i)}getSelector(){return this.settings.elements?!1:this.settings.selector&&this.settings.selector.substring(0,5)=="data-"?`*[${this.settings.selector}]`:this.settings.selector}getActiveSlide(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}getActiveSlideIndex(){return this.index}getAnimationClasses(){let t=[];for(let i in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(i)){let s=this.settings.cssEfects[i];t.push(`g${s.in}`),t.push(`g${s.out}`)}return t.join(" ")}build(){if(this.built)return!1;const t=document.body.childNodes,i=[];tt(t,l=>{l.parentNode==document.body&&l.nodeName.charAt(0)!=="#"&&l.hasAttribute&&!l.hasAttribute("aria-hidden")&&(i.push(l),l.setAttribute("aria-hidden","true"))});const s=gt(this.settings.svg,"next")?this.settings.svg.next:"",e=gt(this.settings.svg,"prev")?this.settings.svg.prev:"",a=gt(this.settings.svg,"close")?this.settings.svg.close:"";let r=this.settings.lightboxHTML;r=r.replace(/{nextSVG}/g,s),r=r.replace(/{prevSVG}/g,e),r=r.replace(/{closeSVG}/g,a),r=Ft(r),document.body.appendChild(r);const n=document.getElementById("glightbox-body");this.modal=n;let h=n.querySelector(".gclose");this.prevButton=n.querySelector(".gprev"),this.nextButton=n.querySelector(".gnext"),this.overlay=n.querySelector(".goverlay"),this.loader=n.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},Y(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&h&&(this.events.close=Xt("click",{onElement:h,withCallback:(l,c)=>{l.preventDefault(),this.close()}})),h&&!this.settings.closeButton&&h.parentNode.removeChild(h),this.nextButton&&(this.events.next=Xt("click",{onElement:this.nextButton,withCallback:(l,c)=>{l.preventDefault(),this.nextSlide()}})),this.prevButton&&(this.events.prev=Xt("click",{onElement:this.prevButton,withCallback:(l,c)=>{l.preventDefault(),this.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=Xt("click",{onElement:n,withCallback:(l,c)=>{!this.preventOutsideClick&&!_t(document.body,"glightbox-mobile")&&!Bt(l.target,".ginner-container")&&!Bt(l.target,".gbtn")&&!_t(l.target,"gnext")&&!_t(l.target,"gprev")&&this.close()}})),tt(this.elements,(l,c)=>{this.slidesContainer.appendChild(l.instance.create()),l.slideNode=this.slidesContainer.querySelectorAll(".gslide")[c]}),Ue&&Y(document.body,"glightbox-touch"),this.events.resize=Xt("resize",{onElement:window,withCallback:()=>{this.resize()}}),this.built=!0}resize(t=null){if(t=t||this.activeSlide,!t||_t(t,"zoomed"))return;const i=ze(),s=t.querySelector(".gvideo-wrapper"),e=t.querySelector(".gslide-image"),a=this.slideDescription;let r=i.width,n=i.height;if(r<=768?Y(document.body,"glightbox-mobile"):ft(document.body,"glightbox-mobile"),!s&&!e)return;let h=!1;if(a&&(_t(a,"description-bottom")||_t(a,"description-top"))&&!_t(a,"gabsolute")&&(h=!0),e){if(r<=768)e.querySelector("img");else if(h){let l=a.offsetHeight,c=e.querySelector("img");const b=this.elements[this.index].node.getAttribute("data-height")??"100vh";c.setAttribute("style",`max-height: calc(${b} - ${l}px)`),a.setAttribute("style",`max-width: ${c.offsetWidth}px;`)}}if(s){let l=gt(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!l){const A=s.clientWidth,E=s.clientHeight,Q=A/E;l=`${A/Q}:${E/Q}`}let c=l.split(":"),u=this.settings.videosWidth,b=this.settings.videosWidth;re(u)||u.indexOf("px")!==-1?b=parseInt(u):u.indexOf("vw")!==-1?b=r*parseInt(u)/100:u.indexOf("vh")!==-1?b=n*parseInt(u)/100:u.indexOf("%")!==-1?b=r*parseInt(u)/100:b=parseInt(s.clientWidth);let j=b/(parseInt(c[0])/parseInt(c[1]));if(j=Math.floor(j),h&&(n=n-a.offsetHeight),b>r||j>n||n<j&&r>b){let A=s.offsetWidth,E=s.offsetHeight,Q=n/E,pt={width:A*Q};s.parentNode.setAttribute("style",`max-width: ${pt.width}px`),h&&a.setAttribute("style",`max-width: ${pt.width}px;`)}else s.parentNode.style.maxWidth=`${u}`,h&&a.setAttribute("style",`max-width: ${u};`)}}reload(){this.init()}updateNavigationClasses(){const t=this.loop();ft(this.nextButton,"disabled"),ft(this.prevButton,"disabled"),this.index==0&&this.elements.length-1==0?(Y(this.prevButton,"disabled"),Y(this.nextButton,"disabled")):this.index===0&&!t?Y(this.prevButton,"disabled"):this.index===this.elements.length-1&&!t&&Y(this.nextButton,"disabled")}loop(){let t=gt(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return t=gt(this.settings,"loop")?this.settings.loop:t,t}close(){if(!this.lightboxOpen){if(this.events){for(let t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&tt(this.bodyHiddenChildElms,t=>{t.removeAttribute("aria-hidden")}),Y(this.modal,"glightbox-closing"),Gt(this.overlay,this.settings.openEffect=="none"?"none":this.settings.cssEfects.fade.out),Gt(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,()=>{if(this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null,this.built=!1,this.events){for(let s in this.events)this.events.hasOwnProperty(s)&&this.events[s].destroy();this.events=null}const t=document.body;ft(Le,"glightbox-open"),ft(t,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),this.modal.parentNode.removeChild(this.modal),this.trigger("close"),D(this.settings.onClose)&&this.settings.onClose();const i=document.querySelector(".gcss-styles");i&&i.parentNode.removeChild(i),this.lightboxOpen=!1,this.closing=null})}destroy(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}on(t,i,s=!1){if(!t||!D(i))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:t,once:s,callback:i})}once(t,i){this.on(t,i,!0)}trigger(t,i=null){const s=[];tt(this.apiEvents,(e,a)=>{const{evt:r,once:n,callback:h}=e;r==t&&(h(i),n&&s.push(a))}),s.length&&tt(s,e=>this.apiEvents.splice(e,1))}clearAllEvents(){this.apiEvents.splice(0,this.apiEvents.length)}version(){return Ci}}class ji{constructor(t={}){this.animationTime=t.animationTime??800,this.frameRate=t.frameRate??150,this.stepSize=t.stepSize??120,this.accelerationDelta=t.accelerationDelta??300,this.accelerationMax=t.accelerationMax??2,this.pulseScale=t.pulseScale??4,this.pulseNormalize=1,this.keyboardSupport=t.keyboardSupport??!0,this.arrowScroll=t.arrowScroll??50,this.fixedBackground=t.fixedBackground??!1,this.queue=[],this.pending=!1,this.lastScrollTime=Date.now(),this.direction={x:0,y:0},this.activeElement=null,this.deltaBuffer=[],this.deltaBufferTimer=null,this.isMac=/^Mac/.test(navigator.platform),this.scrollBehaviorCache=new WeakMap,this.pulseNormalize=1/this._pulseRaw(1),this._init()}_init(){const t="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.addEventListener(t,this._onWheel.bind(this),{passive:!1}),this.keyboardSupport&&window.addEventListener("keydown",this._onKeydown.bind(this),!1),window.addEventListener("mousedown",this._onMousedown.bind(this),!1),this.fixedBackground||(document.body.style.backgroundAttachment="scroll",document.documentElement.style.backgroundAttachment="scroll")}destroy(){const t="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.removeEventListener(t,this._onWheel.bind(this)),window.removeEventListener("keydown",this._onKeydown.bind(this)),window.removeEventListener("mousedown",this._onMousedown.bind(this)),this.queue=[],this.pending=!1}_onMousedown(t){this.activeElement=t.target}_onKeydown(t){const i=t.target,s=t.ctrlKey||t.altKey||t.metaKey||t.shiftKey&&t.code!=="Space",e=/^(textarea|select|embed|object)$/i,a=/^(button|submit|radio|checkbox|file|color|image)$/i;if(t.defaultPrevented||e.test(i.nodeName)||i.nodeName==="INPUT"&&!a.test(i.type)||i.isContentEditable||s)return!0;let r=0,n=0;const h=this._findScrollableAncestor(this.activeElement||document.activeElement);if(!h)return;const l=h===document.body?window.innerHeight:h.clientHeight;switch(t.code){case"ArrowUp":n=-this.arrowScroll;break;case"ArrowDown":n=this.arrowScroll;break;case"Space":n=-(t.shiftKey?1:-1)*l*.9;break;case"PageUp":n=-l*.9;break;case"PageDown":n=l*.9;break;case"Home":n=-h.scrollTop;break;case"End":const u=h.scrollHeight-h.scrollTop-l;n=u>0?u+10:0;break;case"ArrowLeft":r=-this.arrowScroll;break;case"ArrowRight":r=this.arrowScroll;break;default:return!0}this._enqueueScroll(h,r,n),t.preventDefault()}_onWheel(t){if(t.ctrlKey||t.defaultPrevented)return;let i=-t.wheelDeltaX||t.deltaX||0,s=-t.wheelDeltaY||t.deltaY||0;if(this.isMac&&(t.wheelDeltaX&&this._isDivisible(t.wheelDeltaX,120)&&(i=-120*(t.wheelDeltaX/Math.abs(t.wheelDeltaX))),t.wheelDeltaY&&this._isDivisible(t.wheelDeltaY,120)&&(s=-120*(t.wheelDeltaY/Math.abs(t.wheelDeltaY)))),!i&&!s&&(s=-t.wheelDelta||0),t.deltaMode===1&&(i*=40,s*=40),this._isTouchpad(s))return!0;Math.abs(i)>1.2&&(i*=this.stepSize/120),Math.abs(s)>1.2&&(s*=this.stepSize/120);const e=t.target,a=this._findScrollableAncestor(e);if(!a)return;const r=Math.sign(i),n=Math.sign(s);(r!==this.direction.x||n!==this.direction.y)&&(this.direction={x:r,y:n},this.queue=[],this.lastScrollTime=0);const h=Date.now(),l=h-this.lastScrollTime;if(l<this.accelerationDelta){const c=(1+50/l)/2;if(c>1){const u=Math.min(c,this.accelerationMax);i*=u,s*=u}}this.lastScrollTime=h,this._enqueueScroll(a,i,s),t.preventDefault()}_isDivisible(t,i){return Math.floor(t/i)===t/i}_isTouchpad(t){if(!t)return!1;this.deltaBuffer.length||(this.deltaBuffer=[t,t,t]);const i=Math.abs(t);this.deltaBuffer.push(i),this.deltaBuffer.shift(),clearTimeout(this.deltaBufferTimer),this.deltaBufferTimer=setTimeout(()=>{this.deltaBuffer=[]},1e3);const s=this.deltaBuffer.every(n=>this._isDivisible(n,120)),e=this.deltaBuffer.every(n=>this._isDivisible(n,100)),a=i>120&&this.deltaBuffer.every(n=>this._isDivisible(n,i)),r=!s&&!e&&!a;return i<50?!0:r}_findScrollableAncestor(t){const i=document.scrollingElement||document.documentElement;let s=t;for(;s&&s!==document.body;){const e=window.getComputedStyle(s),a=e.overflowY,r=e.overflowX,n=["auto","scroll"].includes(a),h=["auto","scroll"].includes(r),l=s.scrollHeight>s.clientHeight,c=s.scrollWidth>s.clientWidth;if(n&&l||h&&c)return s;if(s===i)return i;s=s.parentElement}return i}_enqueueScroll(t,i,s){if(!this.scrollBehaviorCache.has(t)){const e=window.getComputedStyle(t).scrollBehavior;e==="smooth"&&(this.scrollBehaviorCache.set(t,e),t.style.scrollBehavior="auto")}this.queue.push({element:t,x:i,y:s,lastX:i<0?.99:-.99,lastY:s<0?.99:-.99,start:Date.now()}),this.pending||(this._animate(t),this.pending=!0)}_animate(t){const i=()=>{const s=Date.now();let e=0,a=0;for(let n=this.queue.length-1;n>=0;n--){const h=this.queue[n],l=s-h.start,c=l>=this.animationTime,u=c?1:l/this.animationTime,b=this._pulse(u),j=h.x*b-h.lastX>>0,A=h.y*b-h.lastY>>0;e+=j,a+=A,h.lastX+=j,h.lastY+=A,c&&this.queue.splice(n,1)}if(t===document.scrollingElement||t===document.documentElement||t===document.body?window.scrollBy(e,a):(e&&(t.scrollLeft+=e),a&&(t.scrollTop+=a)),this.queue.length>0)requestAnimationFrame(i);else if(this.pending=!1,this.scrollBehaviorCache.has(t)){const n=this.scrollBehaviorCache.get(t);t.style.scrollBehavior=n,this.scrollBehaviorCache.delete(t)}};requestAnimationFrame(i)}_pulseRaw(t){if(t*=this.pulseScale,t<1)return t-(1-Math.exp(-t));{const i=Math.exp(-1);t-=1;const s=1-Math.exp(-t);return i+s*(1-i)}}_pulse(t){return t>=1?1:t<=0?0:this._pulseRaw(t)*this.pulseNormalize}}class Li{constructor(t={}){this.config={plugins:{},autoLoad:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[],onReInit:()=>{},...t},this.plugins=new Map,this.loadedStyles=new Set,this.components=new Map,this.externalPlugins=new Map}async autoLoadPlugins(){const i=this.detectComponentTypes().filter(s=>this.config.plugins[s]&&!this.plugins.has(s));return i.length>0&&await Promise.all(i.map(s=>this.loadPlugin(s))),i}detectComponentTypes(){const t=new Set;return document.querySelectorAll("[data-cb-type]").forEach(i=>{t.add(i.dataset.cbType)}),document.querySelectorAll('[class*="cb-"]').forEach(i=>{i.classList.forEach(s=>{if(s.startsWith("cb-")){const e=s.replace("cb-","");t.add(e)}})}),Array.from(t)}async loadPlugin(t){if(this.plugins.has(t))return this.plugins.get(t);const i=this.config.plugins[t];if(!i)return console.warn(`[PluginManager] Plugin "${t}" not found in registry`),null;try{i.css&&this.loadCSS(this.resolveUrl(i.css));const s=this.resolveUrl(i.url),e=await this.importModule(s),a=e.default||e;return this.plugins.set(t,a),typeof a.init=="function"&&await a.init(this),this.emit("plugin-loaded",{name:t,plugin:a}),a}catch(s){return console.error(`[PluginManager] Failed to load plugin "${t}":`,s),null}}async importModule(t){return import(t)}loadCSS(t){if(this.loadedStyles.has(t))return;const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.onload=()=>{this.emit("css-loaded",{url:t})},i.onerror=()=>{console.error(`[PluginManager] Failed to load CSS: ${t}`)},document.head.appendChild(i),this.loadedStyles.add(t)}resolveUrl(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")?t:this.config.pluginBaseUrl+t}initializeComponents(){return document.querySelectorAll("[data-cb-type]").forEach((i,s)=>{const e=i.dataset.cbType,a=this.plugins.get(e);if(a&&typeof a.mount=="function")try{const r=this.parseOptions(i);let n=i.querySelector(".grid-sortable");n||i.classList.contains("grid-sortable")&&(n=i),n&&Array.from(n.children).forEach((c,u)=>{c.nodeType===1&&c.tagName!=="STYLE"&&c.tagName!=="SCRIPT"&&c.setAttribute("data-index",u)}),i.querySelectorAll(".edit").forEach((c,u)=>{const b=`content-${Date.now()}-${s}-${u}`;c.setAttribute("data-edit-id",b)}),i.hasAttribute("data-cb-original-content")||i.setAttribute("data-cb-original-content",i.innerHTML);const l=a.mount(i,r);this.components.set(i,l),this.setupInlineEditing(i,r),i.setAttribute("data-cb-loaded","true"),typeof i.mount=="function"&&i.mount()}catch(r){console.error(`[PluginManager] Failed to mount component "${e}":`,r)}}),this.components.size}parseOptions(t){const i={};return Array.from(t.attributes).forEach(s=>{if(s.name.startsWith("data-cb-")){const e=s.name.replace("data-cb-","").replace(/-([a-z])/g,(a,r)=>r.toUpperCase());i[e]=this.parseValue(s.value)}}),i}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!isNaN(t)&&t!=="")return Number(t);try{return JSON.parse(t)}catch{return t}}setupInlineEditing(t,i){if(!t.closest(".data-editor"))return;const s=t.querySelectorAll(".edit[data-edit-id]");if(s.length===0)return;t.querySelectorAll('.edit[contenteditable="true"]').forEach(r=>{r.removeAttribute("contenteditable"),r._cbObserver&&(r._cbObserver.disconnect(),delete r._cbObserver),r._cbKeydownHandler&&(r.removeEventListener("keydown",r._cbKeydownHandler),delete r._cbKeydownHandler)});const a=(r,n)=>{const h=t.getAttribute("data-cb-original-content");if(!h)return;const l=document.createElement("template");l.innerHTML=h.trim();const u=l.content.querySelector(`[data-edit-id="${r}"]`);if(u){u.innerHTML=n;const b=l.innerHTML;t.setAttribute("data-cb-original-content",b)}};s.forEach(r=>{r.setAttribute("contenteditable","true");const n=c=>{var u=document.createRange();u.selectNodeContents(c);var b=window.getSelection();b.removeAllRanges(),b.addRange(u)},h=c=>{if((c.ctrlKey||c.metaKey)&&c.which===65){let u;try{window.getSelection?u=window.getSelection().getRangeAt(0).commonAncestorContainer.parentNode:document.selection&&(u=document.selection.createRange().parentElement()),n(u),c.preventDefault(),c.stopImmediatePropagation()}catch{}}};r.addEventListener("keydown",h),r._cbKeydownHandler=h;const l=new MutationObserver(()=>{const c=r.getAttribute("data-edit-id"),u=r.innerHTML;a(c,u)});l.observe(r,{childList:!0,characterData:!0,subtree:!0,attributes:!0}),r._cbObserver=l})}async use(t){return await this.loadPlugin(t)}getPlugin(t){return this.plugins.get(t)}getAllPlugins(){return Array.from(this.plugins.entries())}hasPlugin(t){return this.plugins.has(t)}getComponent(t){return this.components.get(t)}async reinitialize(t=document){if(this.reinitializeInProgress)return clearTimeout(this.pendingReinitialize),new Promise(i=>{this.pendingReinitialize=setTimeout(async()=>{this.pendingReinitialize=null;const s=await this.reinitialize(t);i(s)},100)});this.reinitializeInProgress=!0;try{const i=[];this.components.forEach((n,h)=>{(t===document||t.contains(h))&&i.push({element:h,instance:n})}),i.forEach(({element:n,instance:h})=>{const l=n.dataset.cbType,c=this.plugins.get(l);c&&typeof c.unmount=="function"&&c.unmount(n,h),this.components.delete(n)});const e=this.detectComponentTypesInContainer(t).filter(n=>this.config.plugins[n]&&!this.plugins.has(n));e.length>0&&await Promise.all(e.map(n=>this.loadPlugin(n)));const a=t.querySelectorAll("[data-cb-type]");let r=0;for(const n of a){const h=n.dataset.cbType,l=this.plugins.get(h);if(l&&typeof l.mount=="function")try{const c=this.parseOptions(n);let u=n.querySelector(".grid-sortable");if(u||n.classList.contains("grid-sortable")&&(u=n),u&&Array.from(u.children).forEach((A,E)=>{A.nodeType===1&&A.tagName!=="STYLE"&&A.tagName!=="SCRIPT"&&A.setAttribute("data-index",E)}),n.querySelectorAll(".edit").forEach((A,E)=>{const Q=`content-${Date.now()}-${r}-${E}`;A.setAttribute("data-edit-id",Q)}),!n.hasAttribute("data-cb-original-content"))n.setAttribute("data-cb-original-content",n.innerHTML);else{let A=document.createRange();n.innerHTML="",n.appendChild(A.createContextualFragment(n.getAttribute("data-cb-original-content")))}const j=await l.mount(n,c);this.components.set(n,j),this.setupInlineEditing(n,c),n.setAttribute("data-cb-loaded","true"),typeof n.mount=="function"&&n.mount(),r++}catch(c){console.error(`[PluginManager] Failed to mount component "${h}":`,c)}}return typeof this.config.onReInit=="function"&&this.config.onReInit(),this.emit("reinitialized",{container:t,count:r}),r}finally{this.reinitializeInProgress=!1}}detectComponentTypesInContainer(t){const i=new Set;return t.querySelectorAll("[data-cb-type]").forEach(e=>{i.add(e.dataset.cbType)}),Array.from(i)}async loadExternalPlugin(t,i){if(!t||typeof t!="string")throw new Error("Plugin ID is required and must be a string");if(!i.url)throw new Error("Plugin URL is required");if(this.plugins.has(t))return console.warn(`[PluginManager] Plugin "${t}" is already loaded`),this.plugins.get(t);const s=this.validatePluginSource(i.url);if(!s.allowed)throw new Error(`Security: ${s.reason}`);s.warning&&(console.warn(`[PluginManager] ${s.warning}`),this.emit("plugin-security-warning",{pluginId:t,url:i.url,warning:s.warning}));try{this.config.plugins[t]={url:i.url,css:i.css||null,source:"external",loadedAt:new Date().toISOString()},this.externalPlugins.set(t,this.config.plugins[t]);const e=await this.loadPlugin(t);return this.emit("external-plugin-loaded",{pluginId:t,url:i.url}),e}catch(e){throw delete this.config.plugins[t],this.externalPlugins.delete(t),console.error(`[PluginManager] Failed to load external plugin "${t}":`,e),e}}validatePluginSource(t){const i=t.includes("localhost")||t.includes("127.0.0.1");if(!t.startsWith("https://")&&!i)return{allowed:!1,reason:"Only HTTPS URLs are allowed (except localhost for development)"};if(!this.config.allowExternalPlugins)return{allowed:!1,reason:"External plugins are disabled. Enable allowExternalPlugins in configuration."};if(this.config.trustedDomains.length>0){const e=new URL(t).hostname;if(!this.config.trustedDomains.some(r=>{if(r.startsWith("*.")){const n=r.slice(2);return e===n||e.endsWith("."+n)}return e===r}))return{allowed:!0,warning:`Loading plugin from external domain: ${e}. Only add plugins from sources you trust.`}}else return{allowed:!0,warning:`Loading external plugin from: ${new URL(t).hostname}. This plugin will have full access to your page.`};return{allowed:!0}}async loadExternalPlugins(t){const i=[];for(const[s,e]of Object.entries(t))try{const a=await this.loadExternalPlugin(s,e);i.push({pluginId:s,success:!0,plugin:a})}catch(a){i.push({pluginId:s,success:!1,error:a.message}),console.error(`[PluginManager] Failed to load external plugin "${s}":`,a)}return i}unregisterPlugin(t){if(!this.externalPlugins.has(t))return console.warn(`[PluginManager] Plugin "${t}" is not an external plugin`),!1;const i=this.plugins.get(t),s=[];return this.components.forEach((e,a)=>{a.dataset.cbType===t&&s.push({element:a,instance:e})}),s.forEach(({element:e,instance:a})=>{i&&typeof i.unmount=="function"&&i.unmount(e,a),this.components.delete(e)}),i&&typeof i.destroy=="function"&&i.destroy(this),this.plugins.delete(t),this.externalPlugins.delete(t),delete this.config.plugins[t],this.emit("plugin-unregistered",{pluginId:t}),!0}getExternalPlugins(){return Array.from(this.externalPlugins.entries()).map(([t,i])=>({id:t,...i}))}isExternalPlugin(t){return this.externalPlugins.has(t)}destroy(){this.components.forEach((t,i)=>{const s=i.dataset.cbType,e=this.plugins.get(s);e&&typeof e.unmount=="function"&&e.unmount(i,t)}),this.components.forEach((t,i)=>{i.querySelectorAll('.edit[contenteditable="true"]').forEach(e=>{e.removeAttribute("contenteditable"),e._cbObserver&&(e._cbObserver.disconnect(),delete e._cbObserver),e._cbKeydownHandler&&(e.removeEventListener("keydown",e._cbKeydownHandler),delete e._cbKeydownHandler)})}),this.plugins.forEach((t,i)=>{typeof t.destroy=="function"&&t.destroy(this)}),this.components.clear(),this.plugins.clear()}emit(t,i){if(this.runtime&&typeof this.runtime.emit=="function")this.runtime.emit(t,i);else{const s=new CustomEvent(`contentbox:${t}`,{detail:i});document.dispatchEvent(s)}}setRuntime(t){this.runtime=t}}class ki{constructor(t={}){const i={skin:"light",smoothScroll:!0,plugins:{},autoLoadPlugins:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[]};this.settings={...i,...t},this.initialized=!1,this.pluginManager=new Li({plugins:this.settings.plugins,autoLoad:this.settings.autoLoadPlugins,pluginBaseUrl:this.settings.pluginBaseUrl,allowExternalPlugins:this.settings.allowExternalPlugins,trustedDomains:this.settings.trustedDomains,onReInit:()=>{this.functionLightboxInit()}}),this.pluginManager.setRuntime(this),window.pageReRender=()=>{this.pageReRender()}}async use(t){return await this.pluginManager.use(t)}getPlugin(t){return this.pluginManager.getPlugin(t)}getPlugins(){return this.pluginManager.getAllPlugins()}hasPlugin(t){return this.pluginManager.hasPlugin(t)}getComponent(t){return this.pluginManager.getComponent(t)}getComponents(){return this.pluginManager.components}async reinitialize(t){return await this.pluginManager.reinitialize(t)}async loadExternalPlugin(t,i){return await this.pluginManager.loadExternalPlugin(t,i)}async loadExternalPlugins(t){return await this.pluginManager.loadExternalPlugins(t)}unregisterPlugin(t){return this.pluginManager.unregisterPlugin(t)}emit(t,i){const s=new CustomEvent(`contentbox:${t}`,{detail:i});document.dispatchEvent(s)}on(t,i){document.addEventListener(`contentbox:${t}`,i)}off(t,i){document.removeEventListener(`contentbox:${t}`,i)}async init(){this.initialized||(this.initCore(),this.initPlugins(),this.initialized=!0,this.emit("init"))}async initPlugins(){this.settings.autoLoadPlugins&&await this.pluginManager.autoLoadPlugins(),this.pluginManager.initializeComponents()}initCore(){this.prepareContent(),this.updateOnResize(),this.blockInit(),this.initeSkrollrr(),this.contentBoxOnRenderUpdate(),this.functionLightboxInit(),this.inViewSetup(),setTimeout(()=>{Je.init({duration:1200})},300),this.settings.smoothScroll&&new ji}prepareContent(){const t=document.querySelector(".is-wrapper");t.classList.add("box-v2");const i=function(r){let n=r.nextElementSibling;return n?n.classList.contains("is-section")?n:i(n):!1};document.querySelectorAll(".is-arrow-down a").forEach(function(r){r.addEventListener("click",n=>{let h=n.target.closest(".is-section");if(h){let l=i(h);l&&this.scrollIt(l,1e3,"easeInQuad")}n.preventDefault(),n.stopImmediatePropagation()})}),t&&(t.classList.contains("is-edit")||t.querySelectorAll("a").forEach(n=>{n.addEventListener("click",h=>{let l=n.getAttribute("href");if(l&&l.indexOf("#")===0)if(l.indexOf("#section")===0){let c=l.replace("#section","");if(!isNaN(parseInt(c))){let u=document.querySelectorAll(".is-section"),b,j=0;u.forEach(function(A){A.classList.contains("is-section-navbar")||(j===c-1&&(b=A),j++)}),b&&this.scrollIt(b,1e3,"easeInQuad"),h.preventDefault()}}else try{let c=document.querySelector(l);c&&(this.scrollIt(c,1e3,"easeInQuad"),h.preventDefault())}catch{}})})),document.querySelectorAll(".section-inview").forEach(function(r){r.classList.remove("section-inview")});let a=document.querySelectorAll(".is-animated,.is-scale-animated");a.forEach(function(r){r.classList.contains("once")?(r.removeAttribute("data-scroll",""),r.setAttribute("data-scroll-once","")):(r.removeAttribute("data-scroll-once",""),r.setAttribute("data-scroll",""))}),a=document.querySelectorAll(".is-container > div"),a.forEach(function(r){let n=r.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),h=0;n.length>1&&n.forEach(function(l){l.className.indexOf("delay-")===-1&&(h>0&&(l.style.transitionDelay=h+"s",l.style.animationDelay=h+"s"),h=h+.2)})}),this.skrollrSetup(),this.adjustBgPos()}updateOnResize(){function t(s){var e;return function(a){e&&clearTimeout(e),e=setTimeout(s,100,a)}}const i=document.querySelector(".is-wrapper");window.addEventListener("resize",t(s=>{document.body.classList.contains("data-editor")&&(i.querySelector(".pin-wrap")&&!window.noRender?this.pageReRender():window.skrollrr&&window.skrollrr.refresh(),window.noRender=!1,this.adjustBgPos())})),i.classList.contains("is-edit")&&(window.onbeforeunload=function(s){localStorage.setItem("_lastscrollpos",document.documentElement.scrollTop),window.scrollTo(0,0)},setTimeout(()=>{localStorage.getItem("_lastscrollpos")&&window.scrollTo(0,localStorage.getItem("_lastscrollpos"))},300))}initeSkrollrr(){var t=document.querySelectorAll(".is-overlay-bg");t.forEach(s=>{s.style&&s.style.filter&&s.style.filter.indexOf("grayscale")!==-1&&(s.parentNode.style.filter="grayscale(1)")});const i=new ii({transition:"all 0.3s ease-out"});i.init(),window.skrollrr=i}_scrollTo(t,i=0){const s=t.getBoundingClientRect().top+window.pageYOffset+i;window.scrollTo({top:s,behavior:"smooth"})}scrollIt(t,i=200,s="linear",e){this._scrollTo(t)}skrollrSetup(){document.querySelectorAll(".pin-wrap").forEach(n=>{const h=n.firstElementChild;n.after(h),n.parentNode.removeChild(n)}),document.querySelectorAll(".is-section").forEach(n=>{n.hasAttribute("data-section-clone")&&n.parentNode.removeChild(n),n.hasAttribute("data-section-original")&&(n.style.display="",n.removeAttribute("data-section-original"))});let s=window.innerWidth;s<=760&&document.querySelectorAll(".section-wrap").forEach(h=>{h.outerHTML=h.innerHTML});const e=window.self!==window.top;let a;e?a=document.querySelectorAll(".is-wrapper .section-pin"):a=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),a.length>0&&window.scrollTo(0,0),a.forEach(function(n){s<=970&&n.querySelector(".is-box")&&(n.querySelectorAll(".is-box").forEach(l=>{const c=n.cloneNode(!1);l.getAttributeNames().map(u=>{u.indexOf("data-")!==-1&&c.setAttribute(u,l.getAttribute(u))}),c.classList.add("is-box"),l.classList.forEach(u=>{(u.indexOf("is-box-")!==-1||u.indexOf("is-content-")!==-1||u.indexOf("box-autofit")!==-1||u.indexOf("is-light-text")!==-1||u.indexOf("is-dark-text")!==-1||u.indexOf("is-align-")!==-1||u.indexOf("type-")!==-1||u.indexOf("block-click")!==-1||u.indexOf("hover-zoom")!==-1)&&c.classList.add(u)}),c.setAttribute("data-section-clone",""),c.innerHTML=l.innerHTML,n.parentNode.insertBefore(c,n)}),n.setAttribute("data-section-original",""),n.style.display="none")}),e?a=document.querySelectorAll(".is-wrapper .section-pin"):a=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),a.forEach(function(n){if(n.parentNode.closest(".section-wrap")||s<=970&&n.hasAttribute("data-section-original"))return;const h=document.createElement("div");h.classList.add("pin-wrap"),n.classList.contains("m-skrollrr-off")&&h.classList.add("m-skrollrr-off"),n.classList.contains("pin-space-lg")&&h.classList.add("pin-space-lg"),n.classList.contains("pin-space-xl")&&h.classList.add("pin-space-xl"),n.classList.contains("xs-hidden")&&h.classList.add("xs-hidden"),n.classList.contains("sm-hidden")&&h.classList.add("sm-hidden"),n.classList.contains("desktop-hidden")&&h.classList.add("desktop-hidden"),n.after(h),h.appendChild(n)});const r=n=>{document.querySelectorAll(".is-section").forEach(l=>{const c=l.getBoundingClientRect().top;let u,b;l.parentNode.classList.contains("pin-wrap")?(u=l.parentNode.nextElementSibling,b=l.parentNode.previousElementSibling):(u=l.nextElementSibling,b=l.previousElementSibling),u&&u.classList.contains("pin-wrap")&&(u=u.querySelector(".is-section")),b&&b.classList.contains("pin-wrap")&&(b=b.querySelector(".is-section")),c<=0&&((l.classList.contains("no-spacing")||l.classList.contains("pin-overlap"))&&l.classList.add("section-inview"),document.querySelectorAll(".is-section").forEach(A=>{A!==l&&A.classList.remove("section-inview")}))})};setTimeout(()=>{(!document.querySelector(".is-wrapper").classList.contains("is-edit")||e)&&!window.funcScroll&&(window.addEventListener("scroll",r),window.funcScroll=!0)},300)}adjustBgPos(){const t=a=>{const r=document.createElement("div");r.style.backgroundPositionX=a.style.backgroundPositionX,r.style.backgroundPositionY=a.style.backgroundPositionY,r.style.backgroundSize=a.style.backgroundSize,a.hasAttribute("data-bg-ori")||a.setAttribute("data-bg-ori",r.style.cssText)},i=a=>{if(a.hasAttribute("data-bg-ori")){const r=document.createElement("div");r.style.cssText=a.getAttribute("data-bg-ori"),a.style.backgroundPositionX=r.style.backgroundPositionX,a.style.backgroundPositionY=r.style.backgroundPositionY,a.style.backgroundSize=r.style.backgroundSize,a.removeAttribute("data-bg-ori")}};let s=window.innerWidth;document.querySelectorAll("[data-bg-xs],[data-bg-sm],[data-bg-md],[data-bg-lg]").forEach(a=>{t(a),s<=760&&(a.hasAttribute("data-bg-xs")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-xs"):i(a)),s>760&&s<=970&&(a.hasAttribute("data-bg-sm")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-sm"):i(a)),s>970&&s<=1280&&(a.hasAttribute("data-bg-md")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-md"):i(a)),s>1280&&(a.hasAttribute("data-bg-lg")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-lg"):i(a))})}inViewSetup(){document.querySelectorAll(".is-overlay-content").forEach(e=>{e.querySelector("video.is-video-bg")&&e.setAttribute("data-scroll","")}),document.querySelectorAll(".is-container video").forEach(e=>{e.parentNode.setAttribute("data-scroll","")});const s=new di({trigger:{once:!0,offset:{element:{x:0,y:(e,a,r)=>.1},viewport:{x:0,y:(e,a,r)=>e.visible?0:.1}},toggle:{class:{in:"is-inview",out:[""]},callback:{in:e=>{e.element.querySelectorAll("video").forEach(r=>{if(r.innerHTML.trim()==="")return;let n=r.parentNode.querySelector(".video-bg-play");r.autoplay?n?n.innerHTML.indexOf("play")===-1&&r.play():r.play():n&&n.innerHTML.indexOf("play")===-1&&r.play()})},out:e=>{e.element.querySelectorAll("video").forEach(r=>{!r.paused&&!r.closest("[data-html]")&&r.pause()})}}}}});s.add("[data-scroll-once]"),s.add("[data-scroll]",{once:!1}),window.trigger=s}contentBoxOnRenderUpdate(){try{if(window.contentbox||parent.contentbox){let t;window.contentbox?t=window.contentbox.onRender:parent.contentbox&&(t=parent.contentbox.onRender);const i=()=>{t.call(this);try{window.trigger&&window.trigger.kill()}catch{}let s=document.querySelectorAll(".is-animated,.is-scale-animated");s.forEach(function(e){e.classList.contains("once")?(e.removeAttribute("data-scroll",""),e.setAttribute("data-scroll-once","")):(e.removeAttribute("data-scroll-once",""),e.setAttribute("data-scroll",""))}),s=document.querySelectorAll(".is-container > div"),s.forEach(function(e){let a=e.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),r=0;a.length>1&&a.forEach(function(n){n.className.indexOf("delay-")===-1&&(r>0&&(n.style.transitionDelay=r+"s",n.style.animationDelay=r+"s"),r=r+.2)})}),setTimeout(()=>{this.inViewSetup()},100)};window.contentbox?window.contentbox.onRender=i:parent.contentbox&&(parent.contentbox.onRender=i)}}catch{}}functionLightboxInit(){const t={touchNavigation:!0,selector:".glightbox",loop:!0,autoplayVideos:!0,zoomable:!0,slideEffect:"slide",descPosition:"bottom",skin:this.settings.skin};this.refreshLightbox(t),document.querySelectorAll(".is-lightbox,.block-click").forEach(s=>{const e=a=>{let r=s.getAttribute("href")||s.getAttribute("data-modal-url");this.openLightbox(r,s,t),a.preventDefault(),a.stopImmediatePropagation()};s.addEventListener("click",e),s._lightboxHandler=e})}refreshLightbox(t){this.glightbox&&this.glightbox.destroy(),this.glightbox=new Ke(t),window.GLightbox=Ke.default}openLightbox(t,i,s){let e=[],a=0;if(i){const n=i.closest("[data-gallery]");let h=[];n?h=n.querySelectorAll(".is-lightbox"):document.querySelectorAll(".is-lightbox,.block-click").forEach(c=>{c.closest("[data-gallery]")||h.push(c)}),h.forEach((l,c)=>{let u=l.getAttribute("href");u||(u=l.getAttribute("data-modal-url")),e.push({href:u}),t===u&&(a=c)})}const r=document.activeElement;r?.blur(),e.length>0?(this.glightbox.setElements(e),this.glightbox.openAt(a)):(this.glightbox.setElements([{href:t}]),this.glightbox.open()),this.glightbox.on("close",()=>{this.refreshLightbox(s),r?.focus()})}blockInit(){const t={start:()=>{document.querySelectorAll(".is-block").forEach(e=>{e.hasAttribute("data--t")||e.setAttribute("data--t",e.style.top),e.hasAttribute("data--l")||e.setAttribute("data--l",e.style.left),e.hasAttribute("data--b")||e.setAttribute("data--b",e.style.bottom),e.hasAttribute("data--r")||e.setAttribute("data--r",e.style.right),e.hasAttribute("data--w")||e.setAttribute("data--w",e.style.width),e.hasAttribute("data--h")||e.setAttribute("data--h",e.style.height),e.removeAttribute("data-prev"),e.removeAttribute("data-fluid"),e.removeAttribute("data-fluid-val"),e.classList.remove("fluid"),e.style.transition=""})},apply:(e,a,r)=>{if(a&&e.getAttribute("data-prev")!==a+""){if(r||(e.style.transition="all 0.35s ease"),a!==1e4){if(e.setAttribute("data-breakpoint",a),e.hasAttribute("data--t-"+a)){let n=e.getAttribute("data--t-"+a);e.style.top=n}if(e.hasAttribute("data--l-"+a)){let n=e.getAttribute("data--l-"+a);e.style.left=n}if(e.hasAttribute("data--b-"+a)){let n=e.getAttribute("data--b-"+a);e.style.bottom=n}if(e.hasAttribute("data--r-"+a)){let n=e.getAttribute("data--r-"+a);e.style.right=n}if(e.hasAttribute("data--w-"+a)){let n=e.getAttribute("data--w-"+a);e.style.width=n}if(e.hasAttribute("data--h-"+a)){let n=e.getAttribute("data--h-"+a);e.style.height=n}if(e.hasAttribute("data--transform-"+a)){let n=e.getAttribute("data--transform-"+a);e.style.transform=n,e.setAttribute("data--transform-val",a)}}else{if(e.removeAttribute("data-breakpoint"),e.hasAttribute("data--t")){let n=e.getAttribute("data--t");e.style.top=n}if(e.hasAttribute("data--l")){let n=e.getAttribute("data--l");e.style.left=n}if(e.hasAttribute("data--b")){let n=e.getAttribute("data--b");e.style.bottom=n}if(e.hasAttribute("data--r")){let n=e.getAttribute("data--r");e.style.right=n}if(e.hasAttribute("data--w")){let n=e.getAttribute("data--w");e.style.width=n}if(e.hasAttribute("data--h")){let n=e.getAttribute("data--h");e.style.height=n}if(e.hasAttribute("data--transform")){let n=e.getAttribute("data--transform");e.style.transform=n,e.setAttribute("data--transform-val","")}}e.setAttribute("data-prev",a),setTimeout(()=>{r||(e.style.transition="")},400)}},applyFluid:(e,a)=>{e.classList.toggle("fluid",a==="yes"),e.setAttribute("data-fluid",a)},resize:e=>{const a=window.innerWidth;document.querySelectorAll(".is-box").forEach(r=>{let n=[];const h=r.attributes;for(let l=0;l<h.length;l++){let u=h[l].name.match(/^data--h-(\d+)$/);if(u){const b=parseInt(u[1],10);n.push(b)}}n=[...new Set(n)],n.sort((l,c)=>c-l);for(let l=0;l<n.length;l++){const c=n[l];if(l===0){if(a>c){let u=r.getAttribute("data--h");u?r.style.height=u:r.style.height=""}}else{const u=n[l-1];if(u>=a&&a>c){let b=r.getAttribute("data--h-"+u);b&&(r.style.height=b)}}}if(n.length>0&&n[n.length-1]>=a){const c=n[n.length-1];let u=r.getAttribute("data--h-"+c);u&&(r.style.height=u)}}),document.querySelectorAll(".is-block").forEach(r=>{if(!r.classList.contains("locked")){r.offsetWidth+0>a&&!r.classList.contains("fluid")&&(r.setAttribute("data-fluid-val",r.offsetWidth),t.applyFluid(r,"yes"));let l=r.getAttribute("data-fluid-val");l&&parseInt(l)+0<=a&&r.classList.contains("fluid")&&t.applyFluid(r,"no")}let n=[];const h=r.attributes;for(let l=0;l<h.length;l++){const c=h[l].name;let u=c.match(/^data--t-(\d+)$/);if(u){const b=parseInt(u[1],10);n.push(b)}if(u=c.match(/^data--w-(\d+)$/),u){const b=parseInt(u[1],10);n.push(b)}if(u=c.match(/^data--transform-(\d+)$/),u){const b=parseInt(u[1],10);n.push(b)}}n=[...new Set(n)],n.sort((l,c)=>c-l);for(let l=0;l<n.length;l++){const c=n[l];if(l===0)a>c&&t.apply(r,1e4,e);else{const u=n[l-1];u>=a&&a>c&&t.apply(r,u,e)}}if(n.length>0){const l=n[n.length-1];l>=a&&t.apply(r,l,e)}})},render:()=>{t.start(),t.resize(!0)}},s=((e,a)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),a)}})(()=>{t.resize()},0);window.addEventListener("resize",s),t.start(),t.resize(!0),this.Block=t}pageReRender(){this.prepareContent(),this.contentBoxOnRenderUpdate(),window.skrollrr?window.skrollrr.refresh():this.initeSkrollrr(),this.functionLightboxInit(),this.inViewSetup(),this.Block.start(),this.Block.resize()}destroy(){this.glightbox&&(this.glightbox.destroy(),this.glightbox=null),document.querySelectorAll(".is-lightbox,.block-click").forEach(i=>{i._lightboxHandler&&(i.removeEventListener("click",i._lightboxHandler),delete i._lightboxHandler)}),this.pluginManager.destroy(),this.initialized=!1,this.emit("destroy")}}return ki})();
|
|
48
|
+
</div>`;class Ke{constructor(t={}){this.customOptions=t,this.settings=Rt(ke,t),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}init(){const t=this.getSelector();t&&(this.baseEvents=Xt("click",{onElement:t,withCallback:(i,s)=>{i.preventDefault(),this.open(s)}})),this.elements=this.getElements()}open(t=null,i=null){if(this.elements.length===0)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;let s=re(i)?i:this.settings.startAt;if($t(t)){const n=t.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),zt(s)&&(s=this.getElementIndex(t),s<0&&(s=0))}re(s)||(s=0),this.build(),Gt(this.overlay,this.settings.openEffect==="none"?"none":this.settings.cssEfects.fade.in);const e=document.body,a=window.innerWidth-document.documentElement.clientWidth;if(a>0){var r=document.createElement("style");r.type="text/css",r.className="gcss-styles",r.innerText=`.gscrollbar-fixer {margin-right: ${a}px}`,document.head.appendChild(r),Y(e,"gscrollbar-fixer")}Y(e,"glightbox-open"),Y(Le,"glightbox-open"),Fe&&(Y(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(s,!0),this.elements.length===1?(Y(this.prevButton,"glightbox-button-hidden"),Y(this.nextButton,"glightbox-button-hidden")):(ft(this.prevButton,"glightbox-button-hidden"),ft(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),D(this.settings.onOpen)&&this.settings.onOpen(),Ue&&this.settings.touchNavigation&&xi(this),this.settings.keyboardNavigation&&gi(this)}openAt(t=0){this.open(null,t)}showSlide(t=0,i=!1){De(this.loader),this.index=parseInt(t);let s=this.slidesContainer.querySelector(".current");s&&ft(s,"current"),this.slideAnimateOut();let e=this.slidesContainer.querySelectorAll(".gslide")[t];if(_t(e,"loaded"))this.slideAnimateIn(e,i),Ee(this.loader);else{De(this.loader);const a=this.elements[t],r={index:this.index,slide:e,slideNode:e,slideConfig:a.slideConfig,slideIndex:this.index,trigger:a.node,player:null};this.trigger("slide_before_load",r),a.instance.setContent(e,()=>{Ee(this.loader),this.resize(),this.slideAnimateIn(e,i),this.trigger("slide_after_load",r)})}this.slideDescription=e.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&_t(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=e}preloadSlide(t){if(t<0||t>this.elements.length-1||zt(this.elements[t]))return!1;let i=this.slidesContainer.querySelectorAll(".gslide")[t];if(_t(i,"loaded"))return!1;const s=this.elements[t],e=s.type,a={index:t,slide:i,slideNode:i,slideConfig:s.slideConfig,slideIndex:t,trigger:s.node,player:null};this.trigger("slide_before_load",a),e==="video"||e==="external"?setTimeout(()=>{s.instance.setContent(i,()=>{this.trigger("slide_after_load",a)})},200):s.instance.setContent(i,()=>{this.trigger("slide_after_load",a)})}prevSlide(){this.goToSlide(this.index-1)}nextSlide(){this.goToSlide(this.index+1)}goToSlide(t=!1){if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(t<0||t>this.elements.length-1))return!1;t<0?t=this.elements.length-1:t>=this.elements.length&&(t=0),this.showSlide(t)}insertSlide(t={},i=-1){i<0&&(i=this.elements.length);const s=new le(t,this,i),e=s.getConfig(),a=Rt({},e),r=s.create(),n=this.elements.length-1;a.index=i,a.node=!1,a.instance=s,a.slideConfig=e,this.elements.splice(i,0,a);let h=null,l=null;if(this.slidesContainer){if(i>n)this.slidesContainer.appendChild(r);else{let c=this.slidesContainer.querySelectorAll(".gslide")[i];this.slidesContainer.insertBefore(r,c)}(this.settings.preload&&this.index==0&&i==0||this.index-1==i||this.index+1==i)&&this.preloadSlide(i),this.index===0&&i===0&&(this.index=1),this.updateNavigationClasses(),h=this.slidesContainer.querySelectorAll(".gslide")[i],l=this.getSlidePlayerInstance(i),a.slideNode=h}this.trigger("slide_inserted",{index:i,slide:h,slideNode:h,slideConfig:e,slideIndex:i,trigger:null,player:l}),D(this.settings.slideInserted)&&this.settings.slideInserted({index:i,slide:h,player:l})}removeSlide(t=-1){if(t<0||t>this.elements.length-1)return!1;const i=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[t];i&&(this.getActiveSlideIndex()==t&&(t==this.elements.length-1?this.prevSlide():this.nextSlide()),i.parentNode.removeChild(i)),this.elements.splice(t,1),this.trigger("slide_removed",t),D(this.settings.slideRemoved)&&this.settings.slideRemoved(t)}slideAnimateIn(t,i){let s=t.querySelector(".gslide-media"),e=t.querySelector(".gslide-description"),a={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},r={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(s.offsetWidth>0&&e&&(Ee(e),e.style.display=""),ft(t,this.effectsClasses),i)Gt(t,this.settings.cssEfects[this.settings.openEffect].in,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(t),this.trigger("slide_changed",{prev:a,current:r}),D(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[a,r])});else{let n=this.settings.slideEffect,h=n!=="none"?this.settings.cssEfects[n].in:n;this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(h=this.settings.cssEfects.slideBack.in),Gt(t,h,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(t),this.trigger("slide_changed",{prev:a,current:r}),D(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[a,r])})}setTimeout(()=>{this.resize(t)},100),Y(t,"current")}slideAnimateOut(){if(!this.prevActiveSlide)return!1;let t=this.prevActiveSlide;ft(t,this.effectsClasses),Y(t,"prev");let i=this.settings.slideEffect,s=i!=="none"?this.settings.cssEfects[i].out:i;this.slidePlayerPause(t),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:zt(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),D(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(s=this.settings.cssEfects.slideBack.out),Gt(t,s,()=>{let e=t.querySelector(".ginner-container"),a=t.querySelector(".gslide-media"),r=t.querySelector(".gslide-description");e.style.transform="",a.style.transform="",ft(a,"greset"),a.style.opacity="",r&&(r.style.opacity=""),ft(t,"prev")})}getAllPlayers(){return this.videoPlayers}getSlidePlayerInstance(t){const i="gvideo"+t,s=this.getAllPlayers();return gt(s,i)&&s[i]?s[i]:!1}stopSlideVideo(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");const i=this.getSlidePlayerInstance(t);i&&i.playing&&i.pause()}slidePlayerPause(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}const i=this.getSlidePlayerInstance(t);i&&i.playing&&i.pause()}playSlideVideo(t){if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");const i=this.getSlidePlayerInstance(t);i&&!i.playing&&i.play()}slidePlayerPlay(t){if(Fe&&!this.settings.plyr.config?.muted)return;if($t(t)){let s=t.querySelector(".gvideo-wrapper");s&&(t=s.getAttribute("data-index"))}const i=this.getSlidePlayerInstance(t);i&&!i.playing&&(i.play(),this.settings.autofocusVideos&&i.elements.container.focus())}setElements(t){this.settings.elements=!1;const i=[];t&&t.length&&tt(t,(s,e)=>{const a=new le(s,this,e),r=a.getConfig(),n=Rt({},r);n.slideConfig=r,n.instance=a,n.index=e,i.push(n)}),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(tt(this.elements,()=>{let s=Ft(this.settings.slideHTML);this.slidesContainer.appendChild(s)}),this.showSlide(0,!0)))}getElementIndex(t){let i=!1;return tt(this.elements,(s,e)=>{if(gt(s,"node")&&s.node==t)return i=e,!0}),i}getElements(){let t=[];this.elements=this.elements?this.elements:[],!zt(this.settings.elements)&&Xe(this.settings.elements)&&this.settings.elements.length&&tt(this.settings.elements,(e,a)=>{const r=new le(e,this,a),n=r.getConfig(),h=Rt({},n);h.node=!1,h.index=a,h.instance=r,h.slideConfig=n,t.push(h)});let i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i&&tt(i,(e,a)=>{const r=new le(e,this,a),n=r.getConfig(),h=Rt({},n);h.node=e,h.index=a,h.instance=r,h.slideConfig=n,h.gallery=e.getAttribute("data-gallery"),t.push(h)}),t}getGalleryElements(t,i){return t.filter(s=>s.gallery==i)}getSelector(){return this.settings.elements?!1:this.settings.selector&&this.settings.selector.substring(0,5)=="data-"?`*[${this.settings.selector}]`:this.settings.selector}getActiveSlide(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}getActiveSlideIndex(){return this.index}getAnimationClasses(){let t=[];for(let i in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(i)){let s=this.settings.cssEfects[i];t.push(`g${s.in}`),t.push(`g${s.out}`)}return t.join(" ")}build(){if(this.built)return!1;const t=document.body.childNodes,i=[];tt(t,l=>{l.parentNode==document.body&&l.nodeName.charAt(0)!=="#"&&l.hasAttribute&&!l.hasAttribute("aria-hidden")&&(i.push(l),l.setAttribute("aria-hidden","true"))});const s=gt(this.settings.svg,"next")?this.settings.svg.next:"",e=gt(this.settings.svg,"prev")?this.settings.svg.prev:"",a=gt(this.settings.svg,"close")?this.settings.svg.close:"";let r=this.settings.lightboxHTML;r=r.replace(/{nextSVG}/g,s),r=r.replace(/{prevSVG}/g,e),r=r.replace(/{closeSVG}/g,a),r=Ft(r),document.body.appendChild(r);const n=document.getElementById("glightbox-body");this.modal=n;let h=n.querySelector(".gclose");this.prevButton=n.querySelector(".gprev"),this.nextButton=n.querySelector(".gnext"),this.overlay=n.querySelector(".goverlay"),this.loader=n.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},Y(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&h&&(this.events.close=Xt("click",{onElement:h,withCallback:(l,c)=>{l.preventDefault(),this.close()}})),h&&!this.settings.closeButton&&h.parentNode.removeChild(h),this.nextButton&&(this.events.next=Xt("click",{onElement:this.nextButton,withCallback:(l,c)=>{l.preventDefault(),this.nextSlide()}})),this.prevButton&&(this.events.prev=Xt("click",{onElement:this.prevButton,withCallback:(l,c)=>{l.preventDefault(),this.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=Xt("click",{onElement:n,withCallback:(l,c)=>{!this.preventOutsideClick&&!_t(document.body,"glightbox-mobile")&&!Bt(l.target,".ginner-container")&&!Bt(l.target,".gbtn")&&!_t(l.target,"gnext")&&!_t(l.target,"gprev")&&this.close()}})),tt(this.elements,(l,c)=>{this.slidesContainer.appendChild(l.instance.create()),l.slideNode=this.slidesContainer.querySelectorAll(".gslide")[c]}),Ue&&Y(document.body,"glightbox-touch"),this.events.resize=Xt("resize",{onElement:window,withCallback:()=>{this.resize()}}),this.built=!0}resize(t=null){if(t=t||this.activeSlide,!t||_t(t,"zoomed"))return;const i=ze(),s=t.querySelector(".gvideo-wrapper"),e=t.querySelector(".gslide-image"),a=this.slideDescription;let r=i.width,n=i.height;if(r<=768?Y(document.body,"glightbox-mobile"):ft(document.body,"glightbox-mobile"),!s&&!e)return;let h=!1;if(a&&(_t(a,"description-bottom")||_t(a,"description-top"))&&!_t(a,"gabsolute")&&(h=!0),e){if(r<=768)e.querySelector("img");else if(h){let l=a.offsetHeight,c=e.querySelector("img");const b=this.elements[this.index].node.getAttribute("data-height")??"100vh";c.setAttribute("style",`max-height: calc(${b} - ${l}px)`),a.setAttribute("style",`max-width: ${c.offsetWidth}px;`)}}if(s){let l=gt(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!l){const A=s.clientWidth,E=s.clientHeight,Q=A/E;l=`${A/Q}:${E/Q}`}let c=l.split(":"),u=this.settings.videosWidth,b=this.settings.videosWidth;re(u)||u.indexOf("px")!==-1?b=parseInt(u):u.indexOf("vw")!==-1?b=r*parseInt(u)/100:u.indexOf("vh")!==-1?b=n*parseInt(u)/100:u.indexOf("%")!==-1?b=r*parseInt(u)/100:b=parseInt(s.clientWidth);let j=b/(parseInt(c[0])/parseInt(c[1]));if(j=Math.floor(j),h&&(n=n-a.offsetHeight),b>r||j>n||n<j&&r>b){let A=s.offsetWidth,E=s.offsetHeight,Q=n/E,pt={width:A*Q};s.parentNode.setAttribute("style",`max-width: ${pt.width}px`),h&&a.setAttribute("style",`max-width: ${pt.width}px;`)}else s.parentNode.style.maxWidth=`${u}`,h&&a.setAttribute("style",`max-width: ${u};`)}}reload(){this.init()}updateNavigationClasses(){const t=this.loop();ft(this.nextButton,"disabled"),ft(this.prevButton,"disabled"),this.index==0&&this.elements.length-1==0?(Y(this.prevButton,"disabled"),Y(this.nextButton,"disabled")):this.index===0&&!t?Y(this.prevButton,"disabled"):this.index===this.elements.length-1&&!t&&Y(this.nextButton,"disabled")}loop(){let t=gt(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return t=gt(this.settings,"loop")?this.settings.loop:t,t}close(){if(!this.lightboxOpen){if(this.events){for(let t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&tt(this.bodyHiddenChildElms,t=>{t.removeAttribute("aria-hidden")}),Y(this.modal,"glightbox-closing"),Gt(this.overlay,this.settings.openEffect=="none"?"none":this.settings.cssEfects.fade.out),Gt(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,()=>{if(this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null,this.built=!1,this.events){for(let s in this.events)this.events.hasOwnProperty(s)&&this.events[s].destroy();this.events=null}const t=document.body;ft(Le,"glightbox-open"),ft(t,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),this.modal.parentNode.removeChild(this.modal),this.trigger("close"),D(this.settings.onClose)&&this.settings.onClose();const i=document.querySelector(".gcss-styles");i&&i.parentNode.removeChild(i),this.lightboxOpen=!1,this.closing=null})}destroy(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}on(t,i,s=!1){if(!t||!D(i))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:t,once:s,callback:i})}once(t,i){this.on(t,i,!0)}trigger(t,i=null){const s=[];tt(this.apiEvents,(e,a)=>{const{evt:r,once:n,callback:h}=e;r==t&&(h(i),n&&s.push(a))}),s.length&&tt(s,e=>this.apiEvents.splice(e,1))}clearAllEvents(){this.apiEvents.splice(0,this.apiEvents.length)}version(){return Ci}}class ji{constructor(t={}){this.animationTime=t.animationTime??800,this.frameRate=t.frameRate??150,this.stepSize=t.stepSize??120,this.accelerationDelta=t.accelerationDelta??300,this.accelerationMax=t.accelerationMax??2,this.pulseScale=t.pulseScale??4,this.pulseNormalize=1,this.keyboardSupport=t.keyboardSupport??!0,this.arrowScroll=t.arrowScroll??50,this.fixedBackground=t.fixedBackground??!1,this.queue=[],this.pending=!1,this.lastScrollTime=Date.now(),this.direction={x:0,y:0},this.activeElement=null,this.deltaBuffer=[],this.deltaBufferTimer=null,this.isMac=/^Mac/.test(navigator.platform),this.scrollBehaviorCache=new WeakMap,this.pulseNormalize=1/this._pulseRaw(1),this._init()}_init(){const t="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.addEventListener(t,this._onWheel.bind(this),{passive:!1}),this.keyboardSupport&&window.addEventListener("keydown",this._onKeydown.bind(this),!1),window.addEventListener("mousedown",this._onMousedown.bind(this),!1),this.fixedBackground||(document.body.style.backgroundAttachment="scroll",document.documentElement.style.backgroundAttachment="scroll")}destroy(){const t="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.removeEventListener(t,this._onWheel.bind(this)),window.removeEventListener("keydown",this._onKeydown.bind(this)),window.removeEventListener("mousedown",this._onMousedown.bind(this)),this.queue=[],this.pending=!1}_onMousedown(t){this.activeElement=t.target}_onKeydown(t){const i=t.target,s=t.ctrlKey||t.altKey||t.metaKey||t.shiftKey&&t.code!=="Space",e=/^(textarea|select|embed|object)$/i,a=/^(button|submit|radio|checkbox|file|color|image)$/i;if(t.defaultPrevented||e.test(i.nodeName)||i.nodeName==="INPUT"&&!a.test(i.type)||i.isContentEditable||s)return!0;let r=0,n=0;const h=this._findScrollableAncestor(this.activeElement||document.activeElement);if(!h)return;const l=h===document.body?window.innerHeight:h.clientHeight;switch(t.code){case"ArrowUp":n=-this.arrowScroll;break;case"ArrowDown":n=this.arrowScroll;break;case"Space":n=-(t.shiftKey?1:-1)*l*.9;break;case"PageUp":n=-l*.9;break;case"PageDown":n=l*.9;break;case"Home":n=-h.scrollTop;break;case"End":const u=h.scrollHeight-h.scrollTop-l;n=u>0?u+10:0;break;case"ArrowLeft":r=-this.arrowScroll;break;case"ArrowRight":r=this.arrowScroll;break;default:return!0}this._enqueueScroll(h,r,n),t.preventDefault()}_onWheel(t){if(t.ctrlKey||t.defaultPrevented)return;let i=-t.wheelDeltaX||t.deltaX||0,s=-t.wheelDeltaY||t.deltaY||0;if(this.isMac&&(t.wheelDeltaX&&this._isDivisible(t.wheelDeltaX,120)&&(i=-120*(t.wheelDeltaX/Math.abs(t.wheelDeltaX))),t.wheelDeltaY&&this._isDivisible(t.wheelDeltaY,120)&&(s=-120*(t.wheelDeltaY/Math.abs(t.wheelDeltaY)))),!i&&!s&&(s=-t.wheelDelta||0),t.deltaMode===1&&(i*=40,s*=40),this._isTouchpad(s))return!0;Math.abs(i)>1.2&&(i*=this.stepSize/120),Math.abs(s)>1.2&&(s*=this.stepSize/120);const e=t.target,a=this._findScrollableAncestor(e);if(!a)return;const r=Math.sign(i),n=Math.sign(s);(r!==this.direction.x||n!==this.direction.y)&&(this.direction={x:r,y:n},this.queue=[],this.lastScrollTime=0);const h=Date.now(),l=h-this.lastScrollTime;if(l<this.accelerationDelta){const c=(1+50/l)/2;if(c>1){const u=Math.min(c,this.accelerationMax);i*=u,s*=u}}this.lastScrollTime=h,this._enqueueScroll(a,i,s),t.preventDefault()}_isDivisible(t,i){return Math.floor(t/i)===t/i}_isTouchpad(t){if(!t)return!1;this.deltaBuffer.length||(this.deltaBuffer=[t,t,t]);const i=Math.abs(t);this.deltaBuffer.push(i),this.deltaBuffer.shift(),clearTimeout(this.deltaBufferTimer),this.deltaBufferTimer=setTimeout(()=>{this.deltaBuffer=[]},1e3);const s=this.deltaBuffer.every(n=>this._isDivisible(n,120)),e=this.deltaBuffer.every(n=>this._isDivisible(n,100)),a=i>120&&this.deltaBuffer.every(n=>this._isDivisible(n,i)),r=!s&&!e&&!a;return i<50?!0:r}_findScrollableAncestor(t){const i=document.scrollingElement||document.documentElement;let s=t;for(;s&&s!==document.body;){const e=window.getComputedStyle(s),a=e.overflowY,r=e.overflowX,n=["auto","scroll"].includes(a),h=["auto","scroll"].includes(r),l=s.scrollHeight>s.clientHeight,c=s.scrollWidth>s.clientWidth;if(n&&l||h&&c)return s;if(s===i)return i;s=s.parentElement}return i}_enqueueScroll(t,i,s){if(!this.scrollBehaviorCache.has(t)){const e=window.getComputedStyle(t).scrollBehavior;e==="smooth"&&(this.scrollBehaviorCache.set(t,e),t.style.scrollBehavior="auto")}this.queue.push({element:t,x:i,y:s,lastX:i<0?.99:-.99,lastY:s<0?.99:-.99,start:Date.now()}),this.pending||(this._animate(t),this.pending=!0)}_animate(t){const i=()=>{const s=Date.now();let e=0,a=0;for(let n=this.queue.length-1;n>=0;n--){const h=this.queue[n],l=s-h.start,c=l>=this.animationTime,u=c?1:l/this.animationTime,b=this._pulse(u),j=h.x*b-h.lastX>>0,A=h.y*b-h.lastY>>0;e+=j,a+=A,h.lastX+=j,h.lastY+=A,c&&this.queue.splice(n,1)}if(t===document.scrollingElement||t===document.documentElement||t===document.body?window.scrollBy(e,a):(e&&(t.scrollLeft+=e),a&&(t.scrollTop+=a)),this.queue.length>0)requestAnimationFrame(i);else if(this.pending=!1,this.scrollBehaviorCache.has(t)){const n=this.scrollBehaviorCache.get(t);t.style.scrollBehavior=n,this.scrollBehaviorCache.delete(t)}};requestAnimationFrame(i)}_pulseRaw(t){if(t*=this.pulseScale,t<1)return t-(1-Math.exp(-t));{const i=Math.exp(-1);t-=1;const s=1-Math.exp(-t);return i+s*(1-i)}}_pulse(t){return t>=1?1:t<=0?0:this._pulseRaw(t)*this.pulseNormalize}}class Li{constructor(t={}){this.config={plugins:{},autoLoad:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[],onReInit:()=>{},...t},this.plugins=new Map,this.loadedStyles=new Set,this.components=new Map,this.externalPlugins=new Map}async autoLoadPlugins(){const i=this.detectComponentTypes().filter(s=>this.config.plugins[s]&&!this.plugins.has(s));return i.length>0&&await Promise.all(i.map(s=>this.loadPlugin(s))),i}detectComponentTypes(){const t=new Set;return document.querySelectorAll("[data-cb-type]").forEach(i=>{t.add(i.dataset.cbType)}),document.querySelectorAll('[class*="cb-"]').forEach(i=>{i.classList.forEach(s=>{if(s.startsWith("cb-")){const e=s.replace("cb-","");t.add(e)}})}),Array.from(t)}async loadPlugin(t){if(this.plugins.has(t))return this.plugins.get(t);const i=this.config.plugins[t];if(!i)return console.warn(`[PluginManager] Plugin "${t}" not found in registry`),null;try{i.css&&this.loadCSS(this.resolveUrl(i.css));const s=this.resolveUrl(i.url),e=await this.importModule(s),a=e.default||e;return this.plugins.set(t,a),typeof a.init=="function"&&await a.init(this),this.emit("plugin-loaded",{name:t,plugin:a}),a}catch(s){return console.error(`[PluginManager] Failed to load plugin "${t}":`,s),null}}async importModule(t){return import(t)}loadCSS(t){if(this.loadedStyles.has(t))return;const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.onload=()=>{this.emit("css-loaded",{url:t})},i.onerror=()=>{console.error(`[PluginManager] Failed to load CSS: ${t}`)},document.head.appendChild(i),this.loadedStyles.add(t)}resolveUrl(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")?t:this.config.pluginBaseUrl+t}initializeComponents(){return document.querySelectorAll("[data-cb-type]").forEach((i,s)=>{const e=i.dataset.cbType,a=this.plugins.get(e);if(a&&typeof a.mount=="function")try{const r=this.parseOptions(i);let n=i.querySelector(".grid-sortable");n||i.classList.contains("grid-sortable")&&(n=i),n&&Array.from(n.children).forEach((c,u)=>{c.nodeType===1&&c.tagName!=="STYLE"&&c.tagName!=="SCRIPT"&&c.setAttribute("data-index",u)}),i.querySelectorAll(".edit").forEach((c,u)=>{const b=`content-${Date.now()}-${s}-${u}`;c.setAttribute("data-edit-id",b)}),i.hasAttribute("data-cb-original-content")||i.setAttribute("data-cb-original-content",i.innerHTML);const l=a.mount(i,r);this.components.set(i,l),this.setupInlineEditing(i,r),i.setAttribute("data-cb-loaded","true"),typeof i.mount=="function"&&i.mount()}catch(r){console.error(`[PluginManager] Failed to mount component "${e}":`,r)}}),this.components.size}parseOptions(t){const i={};return Array.from(t.attributes).forEach(s=>{if(s.name.startsWith("data-cb-")){const e=s.name.replace("data-cb-","").replace(/-([a-z])/g,(a,r)=>r.toUpperCase());i[e]=this.parseValue(s.value)}}),i}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!isNaN(t)&&t!=="")return Number(t);try{return JSON.parse(t)}catch{return t}}setupInlineEditing(t,i){if(!t.closest(".data-editor"))return;const s=t.querySelectorAll(".edit[data-edit-id]");if(s.length===0)return;t.querySelectorAll('.edit[contenteditable="true"]').forEach(r=>{r.removeAttribute("contenteditable"),r._cbObserver&&(r._cbObserver.disconnect(),delete r._cbObserver),r._cbKeydownHandler&&(r.removeEventListener("keydown",r._cbKeydownHandler),delete r._cbKeydownHandler)});const a=(r,n)=>{const h=t.getAttribute("data-cb-original-content");if(!h)return;const l=document.createElement("template");l.innerHTML=h.trim();const u=l.content.querySelector(`[data-edit-id="${r}"]`);if(u){u.innerHTML=n;const b=l.innerHTML;t.setAttribute("data-cb-original-content",b)}};s.forEach(r=>{r.setAttribute("contenteditable","true");const n=c=>{var u=document.createRange();u.selectNodeContents(c);var b=window.getSelection();b.removeAllRanges(),b.addRange(u)},h=c=>{if((c.ctrlKey||c.metaKey)&&c.which===65){let u;try{window.getSelection?u=window.getSelection().getRangeAt(0).commonAncestorContainer.parentNode:document.selection&&(u=document.selection.createRange().parentElement()),n(u),c.preventDefault(),c.stopImmediatePropagation()}catch{}}};r.addEventListener("keydown",h),r._cbKeydownHandler=h;const l=new MutationObserver(()=>{const c=r.getAttribute("data-edit-id"),u=r.innerHTML;a(c,u)});l.observe(r,{childList:!0,characterData:!0,subtree:!0,attributes:!0}),r._cbObserver=l})}async use(t){return await this.loadPlugin(t)}getPlugin(t){return this.plugins.get(t)}getAllPlugins(){return Array.from(this.plugins.entries())}hasPlugin(t){return this.plugins.has(t)}getComponent(t){return this.components.get(t)}async reinitialize(t=document){if(this.reinitializeInProgress)return clearTimeout(this.pendingReinitialize),new Promise(i=>{this.pendingReinitialize=setTimeout(async()=>{this.pendingReinitialize=null;const s=await this.reinitialize(t);i(s)},100)});this.reinitializeInProgress=!0;try{const i=[];this.components.forEach((n,h)=>{(t===document||t.contains(h))&&i.push({element:h,instance:n})}),i.forEach(({element:n,instance:h})=>{const l=n.dataset.cbType,c=this.plugins.get(l);c&&typeof c.unmount=="function"&&c.unmount(n,h),this.components.delete(n)});const e=this.detectComponentTypesInContainer(t).filter(n=>this.config.plugins[n]&&!this.plugins.has(n));e.length>0&&await Promise.all(e.map(n=>this.loadPlugin(n)));const a=t.querySelectorAll("[data-cb-type]");let r=0;for(const n of a){const h=n.dataset.cbType,l=this.plugins.get(h);if(l&&typeof l.mount=="function")try{const c=this.parseOptions(n);let u=n.querySelector(".grid-sortable");if(u||n.classList.contains("grid-sortable")&&(u=n),u&&Array.from(u.children).forEach((A,E)=>{A.nodeType===1&&A.tagName!=="STYLE"&&A.tagName!=="SCRIPT"&&A.setAttribute("data-index",E)}),n.querySelectorAll(".edit").forEach((A,E)=>{const Q=`content-${Date.now()}-${r}-${E}`;A.setAttribute("data-edit-id",Q)}),!n.hasAttribute("data-cb-original-content"))n.setAttribute("data-cb-original-content",n.innerHTML);else{let A=document.createRange();n.innerHTML="",n.appendChild(A.createContextualFragment(n.getAttribute("data-cb-original-content")))}const j=await l.mount(n,c);this.components.set(n,j),this.setupInlineEditing(n,c),n.setAttribute("data-cb-loaded","true"),typeof n.mount=="function"&&n.mount(),r++}catch(c){console.error(`[PluginManager] Failed to mount component "${h}":`,c)}}return typeof this.config.onReInit=="function"&&this.config.onReInit(),this.emit("reinitialized",{container:t,count:r}),r}finally{this.reinitializeInProgress=!1}}detectComponentTypesInContainer(t){const i=new Set;return t.querySelectorAll("[data-cb-type]").forEach(e=>{i.add(e.dataset.cbType)}),Array.from(i)}async loadExternalPlugin(t,i){if(!t||typeof t!="string")throw new Error("Plugin ID is required and must be a string");if(!i.url)throw new Error("Plugin URL is required");if(this.plugins.has(t))return console.warn(`[PluginManager] Plugin "${t}" is already loaded`),this.plugins.get(t);const s=this.validatePluginSource(i.url);if(!s.allowed)throw new Error(`Security: ${s.reason}`);s.warning&&(console.warn(`[PluginManager] ${s.warning}`),this.emit("plugin-security-warning",{pluginId:t,url:i.url,warning:s.warning}));try{this.config.plugins[t]={url:i.url,css:i.css||null,source:"external",loadedAt:new Date().toISOString()},this.externalPlugins.set(t,this.config.plugins[t]);const e=await this.loadPlugin(t);return this.emit("external-plugin-loaded",{pluginId:t,url:i.url}),e}catch(e){throw delete this.config.plugins[t],this.externalPlugins.delete(t),console.error(`[PluginManager] Failed to load external plugin "${t}":`,e),e}}validatePluginSource(t){const i=t.includes("localhost")||t.includes("127.0.0.1");if(!t.startsWith("https://")&&!i)return{allowed:!1,reason:"Only HTTPS URLs are allowed (except localhost for development)"};if(!this.config.allowExternalPlugins)return{allowed:!1,reason:"External plugins are disabled. Enable allowExternalPlugins in configuration."};if(this.config.trustedDomains.length>0){const e=new URL(t).hostname;if(!this.config.trustedDomains.some(r=>{if(r.startsWith("*.")){const n=r.slice(2);return e===n||e.endsWith("."+n)}return e===r}))return{allowed:!0,warning:`Loading plugin from external domain: ${e}. Only add plugins from sources you trust.`}}else return{allowed:!0,warning:`Loading external plugin from: ${new URL(t).hostname}. This plugin will have full access to your page.`};return{allowed:!0}}async loadExternalPlugins(t){const i=[];for(const[s,e]of Object.entries(t))try{const a=await this.loadExternalPlugin(s,e);i.push({pluginId:s,success:!0,plugin:a})}catch(a){i.push({pluginId:s,success:!1,error:a.message}),console.error(`[PluginManager] Failed to load external plugin "${s}":`,a)}return i}unregisterPlugin(t){if(!this.externalPlugins.has(t))return console.warn(`[PluginManager] Plugin "${t}" is not an external plugin`),!1;const i=this.plugins.get(t),s=[];return this.components.forEach((e,a)=>{a.dataset.cbType===t&&s.push({element:a,instance:e})}),s.forEach(({element:e,instance:a})=>{i&&typeof i.unmount=="function"&&i.unmount(e,a),this.components.delete(e)}),i&&typeof i.destroy=="function"&&i.destroy(this),this.plugins.delete(t),this.externalPlugins.delete(t),delete this.config.plugins[t],this.emit("plugin-unregistered",{pluginId:t}),!0}getExternalPlugins(){return Array.from(this.externalPlugins.entries()).map(([t,i])=>({id:t,...i}))}isExternalPlugin(t){return this.externalPlugins.has(t)}destroy(){this.components.forEach((t,i)=>{const s=i.dataset.cbType,e=this.plugins.get(s);e&&typeof e.unmount=="function"&&e.unmount(i,t)}),this.components.forEach((t,i)=>{i.querySelectorAll('.edit[contenteditable="true"]').forEach(e=>{e.removeAttribute("contenteditable"),e._cbObserver&&(e._cbObserver.disconnect(),delete e._cbObserver),e._cbKeydownHandler&&(e.removeEventListener("keydown",e._cbKeydownHandler),delete e._cbKeydownHandler)})}),this.plugins.forEach((t,i)=>{typeof t.destroy=="function"&&t.destroy(this)}),this.components.clear(),this.plugins.clear()}emit(t,i){if(this.runtime&&typeof this.runtime.emit=="function")this.runtime.emit(t,i);else{const s=new CustomEvent(`contentbox:${t}`,{detail:i});document.dispatchEvent(s)}}setRuntime(t){this.runtime=t}}class ki{constructor(t={}){const i={skin:"light",smoothScroll:!0,plugins:{},autoLoadPlugins:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[]};this.settings={...i,...t},this.initialized=!1,this.pluginManager=new Li({plugins:this.settings.plugins,autoLoad:this.settings.autoLoadPlugins,pluginBaseUrl:this.settings.pluginBaseUrl,allowExternalPlugins:this.settings.allowExternalPlugins,trustedDomains:this.settings.trustedDomains,onReInit:()=>{this.functionLightboxInit()}}),this.pluginManager.setRuntime(this),window.pageReRender=()=>{this.pageReRender()}}async use(t){return await this.pluginManager.use(t)}getPlugin(t){return this.pluginManager.getPlugin(t)}getPlugins(){return this.pluginManager.getAllPlugins()}hasPlugin(t){return this.pluginManager.hasPlugin(t)}getComponent(t){return this.pluginManager.getComponent(t)}getComponents(){return this.pluginManager.components}async reinitialize(t){return await this.pluginManager.reinitialize(t)}async loadExternalPlugin(t,i){return await this.pluginManager.loadExternalPlugin(t,i)}async loadExternalPlugins(t){return await this.pluginManager.loadExternalPlugins(t)}unregisterPlugin(t){return this.pluginManager.unregisterPlugin(t)}emit(t,i){const s=new CustomEvent(`contentbox:${t}`,{detail:i});document.dispatchEvent(s)}on(t,i){document.addEventListener(`contentbox:${t}`,i)}off(t,i){document.removeEventListener(`contentbox:${t}`,i)}async init(){this.initialized||(this.initCore(),this.initPlugins(),this.initialized=!0,this.emit("init"))}async initPlugins(){this.settings.autoLoadPlugins&&await this.pluginManager.autoLoadPlugins(),this.pluginManager.initializeComponents()}initCore(){this.prepareContent(),this.updateOnResize(),this.blockInit(),this.initeSkrollrr(),this.contentBoxOnRenderUpdate(),this.functionLightboxInit(),this.inViewSetup(),setTimeout(()=>{Je.init({duration:1200})},300),this.settings.smoothScroll&&new ji}prepareContent(){const t=document.querySelector(".is-wrapper");t.classList.add("box-v2");const i=function(r){let n=r.nextElementSibling;return n?n.classList.contains("is-section")?n:i(n):!1};document.querySelectorAll(".is-arrow-down a").forEach(r=>{r.addEventListener("click",n=>{let h=n.target.closest(".is-section");if(h){let l=i(h);l&&this.scrollIt(l,1e3,"easeInQuad")}n.preventDefault(),n.stopImmediatePropagation()})}),t&&(t.classList.contains("is-edit")||t.querySelectorAll("a").forEach(n=>{n.addEventListener("click",h=>{let l=n.getAttribute("href");if(l&&l.indexOf("#")===0)if(l.indexOf("#section")===0){let c=l.replace("#section","");if(!isNaN(parseInt(c))){let u=document.querySelectorAll(".is-section"),b,j=0;u.forEach(function(A){A.classList.contains("is-section-navbar")||(j===c-1&&(b=A),j++)}),b&&this.scrollIt(b,1e3,"easeInQuad"),h.preventDefault()}}else try{let c=document.querySelector(l);c&&(this.scrollIt(c,1e3,"easeInQuad"),h.preventDefault())}catch{}})})),document.querySelectorAll(".section-inview").forEach(function(r){r.classList.remove("section-inview")});let a=document.querySelectorAll(".is-animated,.is-scale-animated");a.forEach(function(r){r.classList.contains("once")?(r.removeAttribute("data-scroll",""),r.setAttribute("data-scroll-once","")):(r.removeAttribute("data-scroll-once",""),r.setAttribute("data-scroll",""))}),a=document.querySelectorAll(".is-container > div"),a.forEach(function(r){let n=r.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),h=0;n.length>1&&n.forEach(function(l){l.className.indexOf("delay-")===-1&&(h>0&&(l.style.transitionDelay=h+"s",l.style.animationDelay=h+"s"),h=h+.2)})}),this.skrollrSetup(),this.adjustBgPos()}updateOnResize(){function t(s){var e;return function(a){e&&clearTimeout(e),e=setTimeout(s,100,a)}}const i=document.querySelector(".is-wrapper");window.addEventListener("resize",t(s=>{document.body.classList.contains("data-editor")&&(i.querySelector(".pin-wrap")&&!window.noRender?this.pageReRender():window.skrollrr&&window.skrollrr.refresh(),window.noRender=!1,this.adjustBgPos())})),i.classList.contains("is-edit")&&(window.onbeforeunload=function(s){localStorage.setItem("_lastscrollpos",document.documentElement.scrollTop),window.scrollTo(0,0)},setTimeout(()=>{localStorage.getItem("_lastscrollpos")&&window.scrollTo(0,localStorage.getItem("_lastscrollpos"))},300))}initeSkrollrr(){var t=document.querySelectorAll(".is-overlay-bg");t.forEach(s=>{s.style&&s.style.filter&&s.style.filter.indexOf("grayscale")!==-1&&(s.parentNode.style.filter="grayscale(1)")});const i=new ii({transition:"all 0.3s ease-out"});i.init(),window.skrollrr=i}_scrollTo(t,i=0){const s=t.getBoundingClientRect().top+window.pageYOffset+i;window.scrollTo({top:s,behavior:"smooth"})}scrollIt(t,i=200,s="linear",e){this._scrollTo(t)}skrollrSetup(){document.querySelectorAll(".pin-wrap").forEach(n=>{const h=n.firstElementChild;n.after(h),n.parentNode.removeChild(n)}),document.querySelectorAll(".is-section").forEach(n=>{n.hasAttribute("data-section-clone")&&n.parentNode.removeChild(n),n.hasAttribute("data-section-original")&&(n.style.display="",n.removeAttribute("data-section-original"))});let s=window.innerWidth;s<=760&&document.querySelectorAll(".section-wrap").forEach(h=>{h.outerHTML=h.innerHTML});const e=window.self!==window.top;let a;e?a=document.querySelectorAll(".is-wrapper .section-pin"):a=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),a.length>0&&window.scrollTo(0,0),a.forEach(function(n){s<=970&&n.querySelector(".is-box")&&(n.querySelectorAll(".is-box").forEach(l=>{const c=n.cloneNode(!1);l.getAttributeNames().map(u=>{u.indexOf("data-")!==-1&&c.setAttribute(u,l.getAttribute(u))}),c.classList.add("is-box"),l.classList.forEach(u=>{(u.indexOf("is-box-")!==-1||u.indexOf("is-content-")!==-1||u.indexOf("box-autofit")!==-1||u.indexOf("is-light-text")!==-1||u.indexOf("is-dark-text")!==-1||u.indexOf("is-align-")!==-1||u.indexOf("type-")!==-1||u.indexOf("block-click")!==-1||u.indexOf("hover-zoom")!==-1)&&c.classList.add(u)}),c.setAttribute("data-section-clone",""),c.innerHTML=l.innerHTML,n.parentNode.insertBefore(c,n)}),n.setAttribute("data-section-original",""),n.style.display="none")}),e?a=document.querySelectorAll(".is-wrapper .section-pin"):a=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),a.forEach(function(n){if(n.parentNode.closest(".section-wrap")||s<=970&&n.hasAttribute("data-section-original"))return;const h=document.createElement("div");h.classList.add("pin-wrap"),n.classList.contains("m-skrollrr-off")&&h.classList.add("m-skrollrr-off"),n.classList.contains("pin-space-lg")&&h.classList.add("pin-space-lg"),n.classList.contains("pin-space-xl")&&h.classList.add("pin-space-xl"),n.classList.contains("xs-hidden")&&h.classList.add("xs-hidden"),n.classList.contains("sm-hidden")&&h.classList.add("sm-hidden"),n.classList.contains("desktop-hidden")&&h.classList.add("desktop-hidden"),n.after(h),h.appendChild(n)});const r=n=>{document.querySelectorAll(".is-section").forEach(l=>{const c=l.getBoundingClientRect().top;let u,b;l.parentNode.classList.contains("pin-wrap")?(u=l.parentNode.nextElementSibling,b=l.parentNode.previousElementSibling):(u=l.nextElementSibling,b=l.previousElementSibling),u&&u.classList.contains("pin-wrap")&&(u=u.querySelector(".is-section")),b&&b.classList.contains("pin-wrap")&&(b=b.querySelector(".is-section")),c<=0&&((l.classList.contains("no-spacing")||l.classList.contains("pin-overlap"))&&l.classList.add("section-inview"),document.querySelectorAll(".is-section").forEach(A=>{A!==l&&A.classList.remove("section-inview")}))})};setTimeout(()=>{(!document.querySelector(".is-wrapper").classList.contains("is-edit")||e)&&!window.funcScroll&&(window.addEventListener("scroll",r),window.funcScroll=!0)},300)}adjustBgPos(){const t=a=>{const r=document.createElement("div");r.style.backgroundPositionX=a.style.backgroundPositionX,r.style.backgroundPositionY=a.style.backgroundPositionY,r.style.backgroundSize=a.style.backgroundSize,a.hasAttribute("data-bg-ori")||a.setAttribute("data-bg-ori",r.style.cssText)},i=a=>{if(a.hasAttribute("data-bg-ori")){const r=document.createElement("div");r.style.cssText=a.getAttribute("data-bg-ori"),a.style.backgroundPositionX=r.style.backgroundPositionX,a.style.backgroundPositionY=r.style.backgroundPositionY,a.style.backgroundSize=r.style.backgroundSize,a.removeAttribute("data-bg-ori")}};let s=window.innerWidth;document.querySelectorAll("[data-bg-xs],[data-bg-sm],[data-bg-md],[data-bg-lg]").forEach(a=>{t(a),s<=760&&(a.hasAttribute("data-bg-xs")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-xs"):i(a)),s>760&&s<=970&&(a.hasAttribute("data-bg-sm")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-sm"):i(a)),s>970&&s<=1280&&(a.hasAttribute("data-bg-md")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-md"):i(a)),s>1280&&(a.hasAttribute("data-bg-lg")?a.style.cssText=a.style.cssText+";"+a.getAttribute("data-bg-lg"):i(a))})}inViewSetup(){document.querySelectorAll(".is-overlay-content").forEach(e=>{(e.querySelector("video.is-video-bg")||e.querySelector('[data-cb-type="video-background"]'))&&e.setAttribute("data-scroll","")}),document.querySelectorAll(".is-container video").forEach(e=>{e.parentNode.setAttribute("data-scroll","")});const s=new di({trigger:{once:!0,offset:{element:{x:0,y:(e,a,r)=>.1},viewport:{x:0,y:(e,a,r)=>e.visible?0:.1}},toggle:{class:{in:"is-inview",out:[""]},callback:{in:e=>{e.element.querySelectorAll("video").forEach(r=>{if(r.innerHTML.trim()==="")return;let n=r.parentNode.querySelector(".video-bg-play");r.autoplay?n?n.innerHTML.indexOf("play")===-1&&r.play():r.play():n&&n.innerHTML.indexOf("play")===-1&&r.play()})},out:e=>{e.element.querySelectorAll("video").forEach(r=>{r.paused||r.pause()})}}}}});s.add("[data-scroll-once]"),s.add("[data-scroll]",{once:!1}),window.trigger=s}contentBoxOnRenderUpdate(){try{if(window.contentbox||parent.contentbox){let t;window.contentbox?t=window.contentbox.onRender:parent.contentbox&&(t=parent.contentbox.onRender);const i=()=>{t.call(this);try{window.trigger&&window.trigger.kill()}catch{}let s=document.querySelectorAll(".is-animated,.is-scale-animated");s.forEach(function(e){e.classList.contains("once")?(e.removeAttribute("data-scroll",""),e.setAttribute("data-scroll-once","")):(e.removeAttribute("data-scroll-once",""),e.setAttribute("data-scroll",""))}),s=document.querySelectorAll(".is-container > div"),s.forEach(function(e){let a=e.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),r=0;a.length>1&&a.forEach(function(n){n.className.indexOf("delay-")===-1&&(r>0&&(n.style.transitionDelay=r+"s",n.style.animationDelay=r+"s"),r=r+.2)})}),setTimeout(()=>{this.inViewSetup()},100)};window.contentbox?window.contentbox.onRender=i:parent.contentbox&&(parent.contentbox.onRender=i)}}catch{}}functionLightboxInit(){const t={touchNavigation:!0,selector:".glightbox",loop:!0,autoplayVideos:!0,zoomable:!0,slideEffect:"slide",descPosition:"bottom",skin:this.settings.skin};this.refreshLightbox(t),document.querySelectorAll(".is-lightbox,.block-click").forEach(s=>{const e=a=>{let r=s.getAttribute("href")||s.getAttribute("data-modal-url");this.openLightbox(r,s,t),a.preventDefault(),a.stopImmediatePropagation()};s.addEventListener("click",e),s._lightboxHandler=e})}refreshLightbox(t){this.glightbox&&this.glightbox.destroy(),this.glightbox=new Ke(t),window.GLightbox=Ke.default}openLightbox(t,i,s){let e=[],a=0;if(i){const n=i.closest("[data-gallery]");let h=[];n?h=n.querySelectorAll(".is-lightbox"):document.querySelectorAll(".is-lightbox,.block-click").forEach(c=>{c.closest("[data-gallery]")||h.push(c)}),h.forEach((l,c)=>{let u=l.getAttribute("href");u||(u=l.getAttribute("data-modal-url")),e.push({href:u}),t===u&&(a=c)})}const r=document.activeElement;r?.blur(),e.length>0?(this.glightbox.setElements(e),this.glightbox.openAt(a)):(this.glightbox.setElements([{href:t}]),this.glightbox.open()),this.glightbox.on("close",()=>{this.refreshLightbox(s),r?.focus()})}blockInit(){const t={start:()=>{document.querySelectorAll(".is-block").forEach(e=>{e.hasAttribute("data--t")||e.setAttribute("data--t",e.style.top),e.hasAttribute("data--l")||e.setAttribute("data--l",e.style.left),e.hasAttribute("data--b")||e.setAttribute("data--b",e.style.bottom),e.hasAttribute("data--r")||e.setAttribute("data--r",e.style.right),e.hasAttribute("data--w")||e.setAttribute("data--w",e.style.width),e.hasAttribute("data--h")||e.setAttribute("data--h",e.style.height),e.removeAttribute("data-prev"),e.removeAttribute("data-fluid"),e.removeAttribute("data-fluid-val"),e.classList.remove("fluid"),e.style.transition=""})},apply:(e,a,r)=>{if(a&&e.getAttribute("data-prev")!==a+""){if(r||(e.style.transition="all 0.35s ease"),a!==1e4){if(e.setAttribute("data-breakpoint",a),e.hasAttribute("data--t-"+a)){let n=e.getAttribute("data--t-"+a);e.style.top=n}if(e.hasAttribute("data--l-"+a)){let n=e.getAttribute("data--l-"+a);e.style.left=n}if(e.hasAttribute("data--b-"+a)){let n=e.getAttribute("data--b-"+a);e.style.bottom=n}if(e.hasAttribute("data--r-"+a)){let n=e.getAttribute("data--r-"+a);e.style.right=n}if(e.hasAttribute("data--w-"+a)){let n=e.getAttribute("data--w-"+a);e.style.width=n}if(e.hasAttribute("data--h-"+a)){let n=e.getAttribute("data--h-"+a);e.style.height=n}if(e.hasAttribute("data--transform-"+a)){let n=e.getAttribute("data--transform-"+a);e.style.transform=n,e.setAttribute("data--transform-val",a)}}else{if(e.removeAttribute("data-breakpoint"),e.hasAttribute("data--t")){let n=e.getAttribute("data--t");e.style.top=n}if(e.hasAttribute("data--l")){let n=e.getAttribute("data--l");e.style.left=n}if(e.hasAttribute("data--b")){let n=e.getAttribute("data--b");e.style.bottom=n}if(e.hasAttribute("data--r")){let n=e.getAttribute("data--r");e.style.right=n}if(e.hasAttribute("data--w")){let n=e.getAttribute("data--w");e.style.width=n}if(e.hasAttribute("data--h")){let n=e.getAttribute("data--h");e.style.height=n}if(e.hasAttribute("data--transform")){let n=e.getAttribute("data--transform");e.style.transform=n,e.setAttribute("data--transform-val","")}}e.setAttribute("data-prev",a),setTimeout(()=>{r||(e.style.transition="")},400)}},applyFluid:(e,a)=>{e.classList.toggle("fluid",a==="yes"),e.setAttribute("data-fluid",a)},resize:e=>{const a=window.innerWidth;document.querySelectorAll(".is-box").forEach(r=>{let n=[];const h=r.attributes;for(let l=0;l<h.length;l++){let u=h[l].name.match(/^data--h-(\d+)$/);if(u){const b=parseInt(u[1],10);n.push(b)}}n=[...new Set(n)],n.sort((l,c)=>c-l);for(let l=0;l<n.length;l++){const c=n[l];if(l===0){if(a>c){let u=r.getAttribute("data--h");u?r.style.height=u:r.style.height=""}}else{const u=n[l-1];if(u>=a&&a>c){let b=r.getAttribute("data--h-"+u);b&&(r.style.height=b)}}}if(n.length>0&&n[n.length-1]>=a){const c=n[n.length-1];let u=r.getAttribute("data--h-"+c);u&&(r.style.height=u)}}),document.querySelectorAll(".is-block").forEach(r=>{if(!r.classList.contains("locked")){r.offsetWidth+0>a&&!r.classList.contains("fluid")&&(r.setAttribute("data-fluid-val",r.offsetWidth),t.applyFluid(r,"yes"));let l=r.getAttribute("data-fluid-val");l&&parseInt(l)+0<=a&&r.classList.contains("fluid")&&t.applyFluid(r,"no")}let n=[];const h=r.attributes;for(let l=0;l<h.length;l++){const c=h[l].name;let u=c.match(/^data--t-(\d+)$/);if(u){const b=parseInt(u[1],10);n.push(b)}if(u=c.match(/^data--w-(\d+)$/),u){const b=parseInt(u[1],10);n.push(b)}if(u=c.match(/^data--transform-(\d+)$/),u){const b=parseInt(u[1],10);n.push(b)}}n=[...new Set(n)],n.sort((l,c)=>c-l);for(let l=0;l<n.length;l++){const c=n[l];if(l===0)a>c&&t.apply(r,1e4,e);else{const u=n[l-1];u>=a&&a>c&&t.apply(r,u,e)}}if(n.length>0){const l=n[n.length-1];l>=a&&t.apply(r,l,e)}})},render:()=>{t.start(),t.resize(!0)}},s=((e,a)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),a)}})(()=>{t.resize()},0);window.addEventListener("resize",s),t.start(),t.resize(!0),this.Block=t}pageReRender(){this.prepareContent(),this.contentBoxOnRenderUpdate(),window.skrollrr?window.skrollrr.refresh():this.initeSkrollrr(),this.functionLightboxInit(),this.inViewSetup(),this.Block.start(),this.Block.resize()}destroy(){this.glightbox&&(this.glightbox.destroy(),this.glightbox=null),document.querySelectorAll(".is-lightbox,.block-click").forEach(i=>{i._lightboxHandler&&(i.removeEventListener("click",i._lightboxHandler),delete i._lightboxHandler)}),this.pluginManager.destroy(),this.initialized=!1,this.emit("destroy")}}return ki})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innovastudio/contentbox-runtime-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.22",
|
|
5
5
|
"description": "Runtime libraries (base) for ContentBox generated content",
|
|
6
6
|
"main": "dist/contentbox-runtime-base.esm.js",
|
|
7
7
|
"module": "dist/contentbox-runtime-base.esm.js",
|