// intialization plugins
$(document).ready(function () {

    //animation icon toggler of navbar
    $(`.navbar-toggler`).click(function() {
        $(`.navbar-toggler`).toggleClass(`active`);
    });

    //Wow intit
    wow = new WOW({
        boxClass: 'wow',
        animateClass: 'animated',
        offset: 200,
        mobile: true,
        live: false
    });
    wow.init();

    //fancybox
    $("[data-fancybox]").fancybox({
        selector: '[data-fancybox="images"]',
        // loop: true
    });

    //  loader 
    // $(window).on("load", function() {
    //     $("#preloader").addClass("isdone");
    // });

    // codeButn
    $(`#codeButn`).click(function() {
        $(this).hide();
    });

});

// Swiper
$(document).ready(function () {
    
    //////////////////// target_swiper  ////////////////////
    var swiper = new Swiper('.target_sec .target_swiper', {
        // loop: true,
        speed: 900,
        slidesPerView: 1,
        spaceBetween: 15,
        // autoplay: {
        //     delay: 2500,
        // },
        navigation: {
            nextEl: '.target_sec .swiper-button-next',
            prevEl: '.target_sec .swiper-button-prev',
        },
        pagination: {
            el: '.target_sec .swiper-pagination',
            clickable: true
        },
        breakpoints: {
            640: {
                slidesPerView: 2,
                spaceBetween: 20,
            },
            768: {
                slidesPerView: 3,
                spaceBetween: 20,
            },
            1024: {
                slidesPerView: 4,
                spaceBetween: 20,
            },
        }
    });

    //////////////////// blog_swiper  ////////////////////
    var swiper = new Swiper('.blog_det_pg .blog_swiper', {
        loop: true,
        speed: 1000,
        slidesPerView: 1,
        spaceBetween: 15,
        effect: 'fade',
        autoplay: {
            delay: 3000,
        },
        navigation: {
            nextEl: '.blog_det_pg .swiper-button-next',
            prevEl: '.blog_det_pg .swiper-button-prev',
        },
        pagination: {
            el: '.blog_det_pg .swiper-pagination',
            clickable: true,
        },

    });

    //////////////////// Swiper  ////////////////////
    // var swiper = new Swiper(' .swiper-container', {
    //     // loop: true,
    //     speed: 900,
    //     slidesPerView: 1,
    //     spaceBetween: 15,
    //     // autoplay: {
    //     //     delay: 2500,
    //     // },
    //     //In Tabs
    //     // observer: true,
    //     // observeParents: true,
    //     navigation: {
    //         nextEl: '.swiper-button-next',
    //         prevEl: '.swiper-button-prev',
    //     },
    //     pagination: {
    //         el: '.swiper-pagination',
    //         clickable: true
    //     },
    //     breakpoints: {
    //         640: {
    //             slidesPerView: 2,
    //             spaceBetween: 20,
    //         },
    //         768: {
    //             slidesPerView: 3,
    //             spaceBetween: 20,
    //         },
    //         1024: {
    //             slidesPerView: 5,
    //             spaceBetween: 20,
    //             // Prevent swiper in lg screens
    //             // allowTouchMove: false,
    //             // preventClicks: false
    //         },
    //     }
    // });

});


// ------------ gsap scripts -----------
$(function () {

    gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

    const smoother = ScrollSmoother.create({
        content: "#scrollsmoother-container",
        smooth: 1.5,
        normalizeScroll: true,
        ignoreMobileResize: true,
        effects: true,
    });

    gsap.timeline({ scrollTrigger: { 
        trigger: ".about_sec",  start: "-600 top",  scrub: !0 
    } }).to(".about_sec .robot", {
            x: 200, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".about_sec",  start: "-600 top",  scrub: !0 
    } }).to(".about_sec .plane", {
            x: -50, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".target_sec",  start: "-600 top",  scrub: !0 
    } }).to(".target_sec .target", {
            x: -50, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".faq_sec",  start: "-600 top",  scrub: !0 
    } }).to(".faq_sec .plane", {
            x: 50, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".faq_sec",  start: "-600 top",  scrub: !0 
    } }).to(".faq_sec .chats", {
            x: -100, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".content_pg",  start: "-600 top",  scrub: !0 
    } }).to(".content_pg .plane", {
            x: 50, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".content_pg",  start: "-600 top",  scrub: !0 
    } }).to(".content_pg .chats", {
            x: -100, y: 0, scale: 1, duration: 20, ease: "linear", delay: 0 
        }
    ),
    gsap.timeline({ scrollTrigger: { 
        trigger: ".header",  start: "-600 top",  scrub: !0 
    } }).to(".header .secImg", {
        x: 50,
        y: 10,
        scale: 1.2,
        duration: 20,
        ease: "none",
        delay: 0,
        // rotationZ: -90,
        }
    );



});

// ------------ SHOW HED PASS ----------
$(".show_hide_password .show_pass").on('click', function(event) {
    event.preventDefault();
    if($(this).siblings("input").attr("type") == "text"){
        $(this).siblings("input").attr('type', 'password');
        $(this).addClass( "fa-eye-slash" );
        $(this).removeClass( "fa-eye" );
    }else if($(this).siblings("input").attr("type") == "password"){
        $(this).siblings("input").attr('type', 'text');
        $(this).removeClass( "fa-eye-slash" );
        $(this).addClass( "fa-eye" );
    }
});



// share_links 
$(`.share_butn`).click(function() {
    $(`.share_links`).toggleClass(`active`);
});


