!function(t,i){"use strict";var e={init:function(){i.hooks.addAction("frontend/element_ready/widget",e.elementorWidget)},elementorWidget:function(t){new wpkoiWidgetParallax(t).init(),new wpkoiWidgetSatellite(t).init(),new wpkoiWidgetTooltip(t).init()}};t(window).on("elementor/frontend/init",e.init);var o=function(i){var e,o={};return!!window.elementor.hasOwnProperty("elements")&&(!!(e=window.elementor.elements).models&&(t.each(e.models,function(e,n){t.each(n.attributes.elements.models,function(e,n){t.each(n.attributes.elements.models,function(t,e){i==e.id&&(o=e.attributes.settings.attributes)})})}),{speed:o.wpkoi_tricks_widget_parallax_speed||{size:50,unit:"%"},parallax:o.wpkoi_tricks_widget_parallax||"false",invert:o.wpkoi_tricks_widget_parallax_invert||"false",stickyOn:o.wpkoi_tricks_widget_parallax_on||["desktop","tablet","mobile"],satellite:o.wpkoi_tricks_widget_satellite||"false",satelliteType:o.wpkoi_tricks_widget_satellite_type||"text",satellitePosition:o.wpkoi_tricks_widget_satellite_position||"top-center",tooltip:o.wpkoi_tricks_widget_tooltip||"false",tooltipDescription:o.wpkoi_tricks_widget_tooltip_description||"",tooltipPlacement:o.wpkoi_tricks_widget_tooltip_placement||"top",xOffset:o.wpkoi_tricks_widget_tooltip_x_offset||0,yOffset:o.wpkoi_tricks_widget_tooltip_y_offset||0,tooltipAnimation:o.wpkoi_tricks_widget_tooltip_animation||"shift-toward",zIndex:o.wpkoi_tricks_widget_tooltip_z_index||"999"}))};window.wpkoiWidgetParallax=function(e){var n=this,a=t("> .elementor-widget-container",e),l=e.closest(".elementor-top-section"),s=e.data("id"),r={},d=Boolean(i.isEditMode()),p=t(window),w=(navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),"MacIntel"==navigator.platform?" is-mac":"");n.init=function(){return e.addClass(w),!!(r=d?o(s):e.data("wpkoi-tricks-settings"))&&(void 0!==r&&("false"!==r.parallax&&void 0!==r.parallax&&void p.on("scroll.wpkoiWidgetParallax resize.wpkoiWidgetParallax",n.scrollHandler).trigger("resize.wpkoiWidgetParallax")))},n.scrollHandler=function(t){var i=.01*+r.speed.size,o="true"==r.invert?-1:1,n=p.height(),s=p.scrollTop(),d=e.offset().top,w=(e.outerHeight(),l.outerHeight(),s-d+n/2),c=(w>0?1:-1)*Math.pow(Math.abs(w),.85),_=r.stickyOn||[],k=elementorFrontend.getCurrentDeviceMode();c=o*Math.ceil(i*c),-1!==_.indexOf(k)?a.css({transform:"translateY("+c+"px)"}):a.css({transform:"translateY(0)"})}},window.wpkoiWidgetSatellite=function(e){var n=e.data("id"),a={},l=Boolean(i.isEditMode());this.init=function(){return!!(a=l?o(n):e.data("wpkoi-tricks-settings"))&&(void 0!==a&&("false"!==a.satellite&&void 0!==a.satellite&&(e.addClass("wpkoi-satellite-widget"),void t(".wpkoi-tricks-satellite",e).addClass("wpkoi-tricks-satellite--"+a.satellitePosition))))}},window.wpkoiWidgetTooltip=function(t){var e=t.data("id"),n=t[0],a={},l=Boolean(i.isEditMode()),s=l?"click":"mouseenter";this.init=function(){if(!(a=l?o(e):t.data("wpkoi-tricks-settings")))return!1;if(void 0===a)return!1;if("false"===a.tooltip||void 0===a.tooltip||""===a.tooltipDescription)return!1;t.addClass("wpkoi-tooltip-widget"),n._tippy&&n._tippy.destroy();tippy([n],{html:document.querySelector("#wpkoi-tricks-tooltip-content-"+e),appendTo:n,arrow:!0,placement:a.tooltipPlacement,flipBehavior:"clockwise",trigger:s,offset:a.xOffset+", "+a.yOffset,animation:a.tooltipAnimation,zIndex:a.zIndex});l&&n._tippy&&n._tippy.show()}}}(jQuery,window.elementorFrontend);

jQuery(document).ready(function ($) {
    // Ensure there's a style element to append the keyframes to
    let styleSheet = $('head').find('#wpkoi-pulse-animations');
    if (styleSheet.length === 0) {
        styleSheet = $('<style id="wpkoi-pulse-animations"></style>').appendTo('head');
    }

    // Iterate through each element with the class
    $('.wpkoi-pulse-effect-yes').each(function () {
        const $this = $(this);
        const from = parseFloat($this.data('wpkoipulse-from')) / 10;
        const to = parseFloat($this.data('wpkoipulse-to')) / 10;
        const speed = parseFloat($this.data('wpkoipulse-speed'));

        // Generate unique keyframe name
        const animationName = `wpkoipulsefrom${from * 10}to${to * 10}`;

        // Build keyframes CSS
        const keyframes = `
            @keyframes ${animationName} {
                0% {
                    transform: scale(${from});
                }
                50% {
                    transform: scale(${to});
                }
                100% {
                    transform: scale(${from});
                }
            }
        `;

        // Append keyframes to the style element
        styleSheet.append(keyframes);

        // Apply the animation to the element
        $this.css({
            animation: `${animationName} ${speed}s infinite`, // Adjust timing as needed
        });
    });
});
