File "lottie.5d87915e3481174579d5.bundle.min.js"

Full path: /home/kosmetik/public_html/wp-content/plugins/elementor-pro/assets/js/lottie.5d87915e3481174579d5.bundle.min.js
File size: 17.42 B
MIME-type: text/plain
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

/*! elementor-pro - v3.3.0 - 06-06-2021 */
(self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[]).push([[288],{4927:(t,e,i)=>{"use strict";var n=i(7971);i(7394)(e,"__esModule",{value:!0}),e.default=void 0;var o=n(i(4899));i(1954);var s=n(i(1959)),a=n(i(9041)),r=n(i(6700)),l=n(i(4263)),c=n(i(7371)),u=n(i(8537)),m=function(t){(0,c.default)(lottieHandler,t);var e=(0,u.default)(lottieHandler);function lottieHandler(){return(0,s.default)(this,lottieHandler),e.apply(this,arguments)}return(0,a.default)(lottieHandler,[{key:"getDefaultSettings",value:function getDefaultSettings(){return{selectors:{container:".e-lottie__container",containerLink:".e-lottie__container__link",animation:".e-lottie__animation",caption:".e-lottie__caption"},classes:{caption:"e-lottie__caption"}}}},{key:"getDefaultElements",value:function getDefaultElements(){var t=this.getSettings().selectors;return{$widgetWrapper:this.$element,$container:this.$element.find(t.container),$containerLink:this.$element.find(t.containerLink),$animation:this.$element.find(t.animation),$caption:this.$element.find(t.caption),$sectionParent:this.$element.closest(".elementor-section"),$columnParent:this.$element.closest(".elementor-column")}}},{key:"onInit",value:function onInit(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];(t=(0,r.default)((0,l.default)(lottieHandler.prototype),"onInit",this)).call.apply(t,[this].concat(i)),this.lottie=null,this.state={isAnimationScrollUpdateNeededOnFirstLoad:!0,isNewLoopCycle:!1,isInViewport:!1,loop:!1,animationDirection:"forward",currentAnimationTrigger:"",effectsRelativeTo:"",hoverOutMode:"",hoverArea:"",caption:"",playAnimationCount:0,animationSpeed:0,linkTimeout:0,viewportOffset:{start:0,end:100}},this.intersectionObservers={animation:{observer:null,element:null},lazyload:{observer:null,element:null}},this.animationFrameRequest={timer:null,lastScrollY:0},this.listeners={collection:[],elements:{$widgetArea:{triggerAnimationHoverIn:null,triggerAnimationHoverOut:null},$container:{triggerAnimationClick:null}}},this.initLottie()}},{key:"initLottie",value:function initLottie(){this.getLottieSettings().lazyload?this.lazyloadLottie():this.generateLottie()}},{key:"lazyloadLottie",value:function lazyloadLottie(){var t=this;this.intersectionObservers.lazyload.observer=elementorModules.utils.Scroll.scrollObserver({offset:"0px 0px ".concat(200,"px"),callback:function callback(e){e.isInViewport&&(t.generateLottie(),t.intersectionObservers.lazyload.observer.unobserve(t.intersectionObservers.lazyload.element))}}),this.intersectionObservers.lazyload.element=this.elements.$container[0],this.intersectionObservers.lazyload.observer.observe(this.intersectionObservers.lazyload.element)}},{key:"generateLottie",value:function generateLottie(){this.createLottieInstance(),this.setLottieEvents()}},{key:"createLottieInstance",value:function createLottieInstance(){var t=this.getLottieSettings();this.lottie=bodymovin.loadAnimation({container:this.elements.$animation[0],path:this.getAnimationPath(),renderer:t.renderer,autoplay:!1,name:"lottie-widget"}),this.elements.$animation.data("lottie",this.lottie)}},{key:"getAnimationPath",value:function getAnimationPath(){var t,e,i=this.getLottieSettings();return(null===(t=i.source_json)||void 0===t?void 0:t.url)&&"json"===i.source_json.url.toLowerCase().substr(-4)?i.source_json.url:(null===(e=i.source_external_url)||void 0===e?void 0:e.url)?i.source_external_url.url:elementorProFrontend.config.lottie.defaultAnimationUrl}},{key:"setCaption",value:function setCaption(){var t=this.getLottieSettings();("external_url"===t.source||"media_file"===t.source&&"custom"===t.caption_source)&&this.getCaptionElement().text(t.caption)}},{key:"getCaptionElement",value:function getCaptionElement(){if(!this.elements.$caption.length){var t=this.getSettings().classes;return this.elements.$caption=jQuery("<p>",{class:t.caption}),this.elements.$container.append(this.elements.$caption),this.elements.$caption}return this.elements.$caption}},{key:"setLottieEvents",value:function setLottieEvents(){var t=this;this.lottie.addEventListener("DOMLoaded",(function(){return t.onLottieDomLoaded()})),this.lottie.addEventListener("complete",(function(){return t.onComplete()}))}},{key:"saveInitialValues",value:function saveInitialValues(){var t,e=this.getLottieSettings();this.lottie.__initialTotalFrames=this.lottie.totalFrames,this.lottie.__initialFirstFrame=this.lottie.firstFrame,this.state.currentAnimationTrigger=e.trigger,this.state.effectsRelativeTo=e.effects_relative_to,this.state.viewportOffset.start=e.viewport?e.viewport.sizes.start:0,this.state.viewportOffset.end=e.viewport?e.viewport.sizes.end:100,this.state.animationSpeed=null===(t=e.play_speed)||void 0===t?void 0:t.size,this.state.linkTimeout=e.link_timeout,this.state.caption=e.caption,this.state.loop=e.loop}},{key:"setAnimationFirstFrame",value:function setAnimationFirstFrame(){var t=this.getAnimationFrames();t.first=t.first-this.lottie.__initialFirstFrame,this.lottie.goToAndStop(t.first,!0)}},{key:"initAnimationTrigger",value:function initAnimationTrigger(){switch(this.getLottieSettings().trigger){case"none":this.playLottie();break;case"arriving_to_viewport":this.playAnimationWhenArrivingToViewport();break;case"bind_to_scroll":this.playAnimationWhenBindToScroll();break;case"on_click":this.bindAnimationClickEvents();break;case"on_hover":this.bindAnimationHoverEvents()}}},{key:"playAnimationWhenArrivingToViewport",value:function playAnimationWhenArrivingToViewport(){var t=this,e=this.getOffset();this.intersectionObservers.animation.observer=elementorModules.utils.Scroll.scrollObserver({offset:"".concat(e.end,"% 0% ").concat(e.start,"%"),callback:function callback(e){e.isInViewport?(t.state.isInViewport=!0,t.playLottie()):(t.state.isInViewport=!1,t.lottie.pause())}}),this.intersectionObservers.animation.element=this.elements.$widgetWrapper[0],this.intersectionObservers.animation.observer.observe(this.intersectionObservers.animation.element)}},{key:"getOffset",value:function getOffset(){var t=this.getLottieSettings();return{start:-t.viewport.sizes.start||0,end:-(100-t.viewport.sizes.end)||0}}},{key:"playAnimationWhenBindToScroll",value:function playAnimationWhenBindToScroll(){var t=this,e=this.getLottieSettings(),i=this.getOffset();this.intersectionObservers.animation.observer=elementorModules.utils.Scroll.scrollObserver({offset:"".concat(i.end,"% 0% ").concat(i.start,"%"),callback:function callback(e){return t.onLottieIntersection(e)}}),this.intersectionObservers.animation.element="viewport"===e.effects_relative_to?this.elements.$widgetWrapper[0]:document.documentElement,this.intersectionObservers.animation.observer.observe(this.intersectionObservers.animation.element)}},{key:"updateAnimationByScrollPosition",value:function updateAnimationByScrollPosition(){var t;t="page"===this.getLottieSettings().effects_relative_to?this.getLottiePagePercentage():"fixed"===this.getCurrentDeviceSetting("_position")?this.getLottieViewportHeightPercentage():this.getLottieViewportPercentage();var e=this.getFrameNumberByPercent(t);e-=this.lottie.__initialFirstFrame,this.lottie.goToAndStop(e,!0)}},{key:"getLottieViewportPercentage",value:function getLottieViewportPercentage(){return elementorModules.utils.Scroll.getElementViewportPercentage(this.elements.$widgetWrapper,this.getOffset())}},{key:"getLottiePagePercentage",value:function getLottiePagePercentage(){return elementorModules.utils.Scroll.getPageScrollPercentage(this.getOffset())}},{key:"getLottieViewportHeightPercentage",value:function getLottieViewportHeightPercentage(){return elementorModules.utils.Scroll.getPageScrollPercentage(this.getOffset(),window.innerHeight)}},{key:"getFrameNumberByPercent",value:function getFrameNumberByPercent(t){var e=this.getAnimationFrames();return t=Math.min(100,Math.max(0,t)),e.first+(e.last-e.first)*t/100}},{key:"getAnimationFrames",value:function getAnimationFrames(){var t=this.getLottieSettings(),e=this.getAnimationCurrentFrame(),i=this.getAnimationRange().start,n=this.getAnimationRange().end,o=this.lottie.__initialFirstFrame,s=0===this.lottie.__initialFirstFrame?this.lottie.__initialTotalFrames:this.lottie.__initialFirstFrame+this.lottie.__initialTotalFrames;return i&&i>o&&(o=i),n&&n<s&&(s=n),this.state.isNewLoopCycle||"bind_to_scroll"===t.trigger||(o=i&&i>e?i:e),"backward"===this.state.animationDirection&&this.isReverseMode()&&(o=e,s=i&&i>this.lottie.__initialFirstFrame?i:this.lottie.__initialFirstFrame),{first:o,last:s,current:e,total:this.lottie.__initialTotalFrames}}},{key:"getAnimationRange",value:function getAnimationRange(){var t=this.getLottieSettings();return{start:this.getInitialFrameNumberByPercent(t.start_point.size),end:this.getInitialFrameNumberByPercent(t.end_point.size)}}},{key:"getInitialFrameNumberByPercent",value:function getInitialFrameNumberByPercent(t){return t=Math.min(100,Math.max(0,t)),this.lottie.__initialFirstFrame+(this.lottie.__initialTotalFrames-this.lottie.__initialFirstFrame)*t/100}},{key:"getAnimationCurrentFrame",value:function getAnimationCurrentFrame(){return 0===this.lottie.firstFrame?this.lottie.currentFrame:this.lottie.firstFrame+this.lottie.currentFrame}},{key:"setLinkTimeout",value:function setLinkTimeout(){var t,e=this,i=this.getLottieSettings();"on_click"===i.trigger&&(null===(t=i.custom_link)||void 0===t?void 0:t.url)&&i.link_timeout&&this.elements.$containerLink.on("click",(function(t){t.preventDefault(),e.isEdit||setTimeout((function(){var t="on"===i.custom_link.is_external?"_blank":"_self";window.open(i.custom_link.url,t)}),i.link_timeout)}))}},{key:"bindAnimationClickEvents",value:function bindAnimationClickEvents(){var t=this;this.listeners.elements.$container.triggerAnimationClick=function(){t.playLottie()},this.addSessionEventListener(this.elements.$container,"click",this.listeners.elements.$container.triggerAnimationClick)}},{key:"getLottieSettings",value:function getLottieSettings(){var t=this.getElementSettings();return(0,o.default)((0,o.default)({},t),{},{lazyload:"yes"===t.lazyload,loop:"yes"===t.loop})}},{key:"playLottie",value:function playLottie(){var t=this.getAnimationFrames();this.lottie.stop(),this.lottie.playSegments([t.first,t.last],!0),this.state.isNewLoopCycle=!1}},{key:"bindAnimationHoverEvents",value:function bindAnimationHoverEvents(){this.createAnimationHoverInEvents(),this.createAnimationHoverOutEvents()}},{key:"createAnimationHoverInEvents",value:function createAnimationHoverInEvents(){var t=this,e=this.getLottieSettings(),i=this.getHoverAreaElement();this.state.hoverArea=e.hover_area,this.listeners.elements.$widgetArea.triggerAnimationHoverIn=function(){t.state.animationDirection="forward",t.playLottie()},this.addSessionEventListener(i,"mouseenter",this.listeners.elements.$widgetArea.triggerAnimationHoverIn)}},{key:"addSessionEventListener",value:function addSessionEventListener(t,e,i){t.on(e,i),this.listeners.collection.push({$el:t,event:e,callback:i})}},{key:"createAnimationHoverOutEvents",value:function createAnimationHoverOutEvents(){var t=this,e=this.getLottieSettings(),i=this.getHoverAreaElement();"pause"!==e.on_hover_out&&"reverse"!==e.on_hover_out||(this.state.hoverOutMode=e.on_hover_out,this.listeners.elements.$widgetArea.triggerAnimationHoverOut=function(){"pause"===e.on_hover_out?t.lottie.pause():(t.state.animationDirection="backward",t.playLottie())},this.addSessionEventListener(i,"mouseleave",this.listeners.elements.$widgetArea.triggerAnimationHoverOut))}},{key:"getHoverAreaElement",value:function getHoverAreaElement(){var t=this.getLottieSettings();return"section"===t.hover_area?this.elements.$sectionParent:"column"===t.hover_area?this.elements.$columnParent:this.elements.$container}},{key:"setLoopOnAnimationComplete",value:function setLoopOnAnimationComplete(){var t=this.getLottieSettings();this.state.isNewLoopCycle=!0,t.loop&&!this.isReverseMode()?this.setLoopWhenNotReverse():t.loop&&this.isReverseMode()?this.setReverseAnimationOnLoop():!t.loop&&this.isReverseMode()&&this.setReverseAnimationOnSingleTrigger()}},{key:"isReverseMode",value:function isReverseMode(){var t=this.getLottieSettings();return"yes"===t.reverse_animation||"reverse"===t.on_hover_out&&"backward"===this.state.animationDirection}},{key:"setLoopWhenNotReverse",value:function setLoopWhenNotReverse(){var t=this.getLottieSettings();t.number_of_times>0?(this.state.playAnimationCount++,this.state.playAnimationCount<t.number_of_times?this.playLottie():this.state.playAnimationCount=0):this.playLottie()}},{key:"setReverseAnimationOnLoop",value:function setReverseAnimationOnLoop(){var t=this.getLottieSettings();!t.number_of_times||this.state.playAnimationCount<t.number_of_times?(this.state.animationDirection="forward"===this.state.animationDirection?"backward":"forward",this.playLottie(),"backward"===this.state.animationDirection&&this.state.playAnimationCount++):(this.state.playAnimationCount=0,this.state.animationDirection="forward")}},{key:"setReverseAnimationOnSingleTrigger",value:function setReverseAnimationOnSingleTrigger(){this.state.playAnimationCount<1?(this.state.playAnimationCount++,this.state.animationDirection="backward",this.playLottie()):this.state.playAnimationCount>=1&&"forward"===this.state.animationDirection?(this.state.animationDirection="backward",this.playLottie()):(this.state.playAnimationCount=0,this.state.animationDirection="forward")}},{key:"setAnimationSpeed",value:function setAnimationSpeed(){var t=this.getLottieSettings();t.play_speed&&this.lottie.setSpeed(t.play_speed.size)}},{key:"onElementChange",value:function onElementChange(){this.updateLottieValues(),this.resetAnimationTrigger()}},{key:"updateLottieValues",value:function updateLottieValues(){var t,e=this,i=this.getLottieSettings();[{sourceVal:null===(t=i.play_speed)||void 0===t?void 0:t.size,stateProp:"animationSpeed",callback:function callback(){return e.setAnimationSpeed()}},{sourceVal:i.link_timeout,stateProp:"linkTimeout",callback:function callback(){return e.setLinkTimeout()}},{sourceVal:i.caption,stateProp:"caption",callback:function callback(){return e.setCaption()}},{sourceVal:i.effects_relative_to,stateProp:"effectsRelativeTo",callback:function callback(){return e.updateAnimationByScrollPosition()}},{sourceVal:i.loop,stateProp:"loop",callback:function callback(){return e.onLoopStateChange()}}].forEach((function(t){void 0!==t.sourceVal&&t.sourceVal!==e.state[t.stateProp]&&(e.state[t.stateProp]=t.sourceVal,t.callback())}))}},{key:"onLoopStateChange",value:function onLoopStateChange(){var t="arriving_to_viewport"===this.state.currentAnimationTrigger&&this.state.isInViewport;this.state.loop&&(t||"none"===this.state.currentAnimationTrigger)&&this.playLottie()}},{key:"resetAnimationTrigger",value:function resetAnimationTrigger(){var t=this.getLottieSettings(),e=t.trigger!==this.state.currentAnimationTrigger,i=!!t.viewport&&this.isViewportOffsetChange(),n=!!t.on_hover_out&&this.isHoverOutModeChange(),o=!!t.hover_area&&this.isHoverAreaChange();(e||i||n||o)&&(this.removeAnimationFrameRequests(),this.removeObservers(),this.removeEventListeners(),this.initAnimationTrigger())}},{key:"isViewportOffsetChange",value:function isViewportOffsetChange(){var t=this.getLottieSettings(),e=t.viewport.sizes.start!==this.state.viewportOffset.start,i=t.viewport.sizes.end!==this.state.viewportOffset.end;return e||i}},{key:"isHoverOutModeChange",value:function isHoverOutModeChange(){return this.getLottieSettings().on_hover_out!==this.state.hoverOutMode}},{key:"isHoverAreaChange",value:function isHoverAreaChange(){return this.getLottieSettings().hover_area!==this.state.hoverArea}},{key:"removeEventListeners",value:function removeEventListeners(){this.listeners.collection.forEach((function(t){t.$el.off(t.event,null,t.callback)}))}},{key:"removeObservers",value:function removeObservers(){for(var t in this.intersectionObservers)this.intersectionObservers[t].observer&&this.intersectionObservers[t].element&&this.intersectionObservers[t].observer.unobserve(this.intersectionObservers[t].element)}},{key:"removeAnimationFrameRequests",value:function removeAnimationFrameRequests(){cancelAnimationFrame(this.animationFrameRequest.timer)}},{key:"onDestroy",value:function onDestroy(){(0,r.default)((0,l.default)(lottieHandler.prototype),"onDestroy",this).call(this),this.destroyLottie()}},{key:"destroyLottie",value:function destroyLottie(){this.removeAnimationFrameRequests(),this.removeObservers(),this.removeEventListeners(),this.elements.$animation.removeData("lottie"),this.lottie&&this.lottie.destroy()}},{key:"onLottieDomLoaded",value:function onLottieDomLoaded(){this.saveInitialValues(),this.setAnimationSpeed(),this.setLinkTimeout(),this.setCaption(),this.setAnimationFirstFrame(),this.initAnimationTrigger()}},{key:"onComplete",value:function onComplete(){this.setLoopOnAnimationComplete()}},{key:"onLottieIntersection",value:function onLottieIntersection(t){var e=this;if(t.isInViewport)this.state.isAnimationScrollUpdateNeededOnFirstLoad&&(this.state.isAnimationScrollUpdateNeededOnFirstLoad=!1,this.updateAnimationByScrollPosition()),this.animationFrameRequest.timer=requestAnimationFrame((function(){return e.onAnimationFrameRequest()}));else{var i=this.getAnimationFrames(),n="up"===t.intersectionScrollDirection?i.first:i.last;this.state.isAnimationScrollUpdateNeededOnFirstLoad=!1,cancelAnimationFrame(this.animationFrameRequest.timer),this.lottie.goToAndStop(n,!0)}}},{key:"onAnimationFrameRequest",value:function onAnimationFrameRequest(){var t=this;window.scrollY!==this.animationFrameRequest.lastScrollY&&(this.updateAnimationByScrollPosition(),this.animationFrameRequest.lastScrollY=window.scrollY),this.animationFrameRequest.timer=requestAnimationFrame((function(){return t.onAnimationFrameRequest()}))}}]),lottieHandler}(elementorModules.frontend.handlers.Base);e.default=m}}]);