"use strict";function needToExecuteOnDcoumentReadyAndAfterAjaxCall(){if(void 0!==$.fn.iFrameResize&&$("iframe").iFrameResize(),void 0!==$.fn.colorpicker&&$(".demo2").colorpicker(),void 0!==$.fn.tooltip&&$.initTooltip(),"function"==typeof $.fn.popover){var a=[];$.each($("[data-toggle=popover]"),function(){a.push($(this).attr("data-src"))}),$.preloadImages(a),$.initPopover()}if($(".info-text").length>0){var b=$(".info-text");$.each(b,function(){var a=$(this);a.height(a.height())})}if($(".megamenu-item-capacity").length>0){var c=$(".megamenu-item-capacity"),d=$("select[name=selected_menu]"),e=c.height();-1===d.val().indexOf("megamenu")?c.height(0):c.height(e),d.on("change",function(){-1===d.val().indexOf("megamenu")?c.height(0):c.height(e)})}}$.preloadImages=function(){for(var a=0,b=arguments[0].length;a<b;a++)$("<img />").attr("src",arguments[0][a])},$.initPopover=function(){$('[data-toggle="popover"]').popover({trigger:"hover",html:!0,content:function(){return'<img src="'+$(this).attr("data-src")+'" alt="'+$(this).attr("data-alt")+'">'}})},$.initTooltip=function(){$('[data-toggle="tooltip"]').tooltip()},$(document).ready(function(){var a=$("#messageModal"),b=$("#confirmModal"),c=null,d="#panelXtLiveElements",e=$(d),f=a.attr("data-message");needToExecuteOnDcoumentReadyAndAfterAjaxCall(),$(document).ajaxStart(function(b){a.find("#message").html(f),a.css("pointer-events","none").modal()}),$(document).ajaxComplete(function(a){needToExecuteOnDcoumentReadyAndAfterAjaxCall()});var g=function(b){var c=b.closest("form"),f=e.find(".collapse.in").attr("id");c.find("input[name=action]").val(b.data("action")),$.ajax({url:c.attr("action"),type:"POST",data:c.serializeArray()}).done(function(b){e.html($(b).find(d).html()),e.find("#"+f).addClass("in"),a.css("pointer-events","").modal("hide")})};$(document).on("click",".elements button.btn-confirm",function(a){c=$(this),b.modal()}),$(document).on("click",".elements .btn-action",function(a){a.preventDefault(),g($(this).hasClass("btn-confirm-target")?c:$(this))}),$(document).on("click",".elements .btn-insert-liveelement",function(a){a.preventDefault(),$("form[name=insertLiveElementForm]").find("input[name=parent]").val($(this).data("parent"))}),$(document).on("click",".elements .label-ctype",function(){var a=$(this),b=$(".btn-no");$(".elements .label-ctype").removeClass("selected"),a.addClass("selected"),$(".elements .label-ctype.selected").length>0?b.fadeIn().addClass("selected"):b.fadeOut().removeClass("selected")}),$(document).on("click","#radioBtn a",function(){var a=$(this).data("title"),b=$(this).data("toggle"),c=$(".info-text");$("#"+b).prop("value",a),$('a[data-toggle="'+b+'"]').not('[data-title="'+a+'"]').removeClass("active").addClass("notActive"),$('a[data-toggle="'+b+'"][data-title="'+a+'"]').removeClass("notActive").addClass("active"),"N"==a?c.addClass("off"):c.removeClass("off")}),$(document).on("click",".template .btn-reset",function(){var a=$(this).closest("form"),b=a.find(".default");if(a.find("input[type=text]").val(""),b.length>0){var c=b.is("option")?"selected":"checked";b.prop(c,!0)}else b=a.find("[data-default-color]"),b.colorpicker("setValue",b.attr("data-default-color"))}),$(document).on("click",".template .btn-save",function(){var b=$(this).closest("form");$.ajax({url:b.attr("action"),type:"POST",data:b.serializeArray()}).done(function(b){a.find("#message").html($(b).find("#message").html()),a.css("pointer-events","")})}),$(document).on("click",".template .js-merchant li, .elements .js-merchant li",function(a){a.preventDefault();var b=$(this),c=b.closest("form");c.find("input[name=newMerchant]").val(b.attr("data-store-id")),c.submit()}),$(document).on("click",".manager .btn-action, .template .btn-action",function(b){b.preventDefault();var c=$(this).closest("form");c.find("input[name=action]").val($(this).data("action")),$.ajax({url:c.attr("action"),type:"POST",data:c.serializeArray()}).done(function(b){$("#content").length>0?$("#content").html($(b).find("#content").html()):($("#content1").html($(b).find("#content1").html()),$("#content2").html($(b).find("#content2").html())),a.css("pointer-events","").modal("hide")})})});