(function(d,c){c="undefined"===typeof c?{}:c;c.Core={SliderManager:{}};c.Scope={workground:{},layerControlList:{},layerSettingsForm:{},slideFormCtrl:{},slidePageCtrl:{},styleEditorForm:{},styleEditorCtrl:{},layerPresetList:{},styleModeSwitcher:{},layerStylePreview:{}}})(jQuery,MPSL);
(function(d,c){c.Preloader=can.Construct({className:".mpsl-preloader",preloaderEl:d('<div class="mpsl-preloader">'),globalPreloaderEl:d(".mpsl-global-preloader"),disabled:!1,start:function(a){if(this.disabled)return!1;"undefined"===typeof a?this.globalPreloaderEl.show():a.length&&a.append(this.preloaderEl.clone())},stop:function(a){"undefined"===typeof a?this.globalPreloaderEl.hide():a.length&&a.children(this.className).remove()},disable:function(){this.disabled=!0},enable:function(){this.disabled=
!1}},{})})(jQuery,MPSL);
(function(d,c){c.MediaLibrary=can.Control.extend({defaults:{id:"mpsl-media-library",multiple:!1,describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",searchable:!0,filterable:!1,sortable:!1,title:"tmp Title",button:{text:"tmp Text"},library:{type:"image"},contentUserSetting:!0,syncSelection:!0}},{frame:null,workground:null,init:function(a,b){this.frame=wp.media(b);this.frame.on("open",this.proxy("onOpen"));this.frame.on("select",this.proxy("onSelect"));this.frame.on("close",
this.proxy("onClose"))},onOpen:function(){this.frame.reset()},onSelect:function(){var a=this.frame.state().get("selection").models[0].attributes,b="full",c="full";a.sizes.hasOwnProperty("thumbnail")&&(b="thumbnail");a.sizes.hasOwnProperty("full")?c="full":a.sizes.hasOwnProperty("large")?c="large":a.sizes.hasOwnProperty("medium")?c="medium":a.sizes.hasOwnProperty("thumbnail")&&(c="thumbnail");return{id:a.id,thumbnail:a.sizes[b].url,src:a.sizes[c].url,width:a.width,height:a.height}},onClose:function(){},
linkWokground:function(a){this.workground=a},click:function(){this.frame.open()}})})(jQuery,MPSL);
(function(d,c){c.AddImageML=c.MediaLibrary.extend({},{onSelect:function(){c.Preloader.start(d(".mpsl-slider-wrapper"));c.Preloader.start(d(".mpsl-layers-list-wrapper"));var a=this,b=this._super();b.options={image_id:b.id};var e=c.Workground.width,f=c.Workground.height,g;g=b.width/b.height;var k=e>=b.width||f>=b.height?1:2,e=e>=f?f/k*g:e/k;e>b.width&&(e=b.width);b.options.width=e;var l=c.ImageLayer.create(b),e=d.Deferred(),f=e.promise();d.when(f).then(function(){var e=a.workground.initLayer(d(l.getDomElement())),
f=d.extend({},c.Layer.getCentralOffset(),{width:c.Layer.makeLayoutedOption(e.element.width()),image_id:b.id,image_url:b.src});e.updatePosition(c.Layer.getCentralOffset(!0));e.extendOptions(f);e.select();e.control.select();e.control.scrollToElement();a.workground.setCurrent(e);c.Preloader.stop(d(".mpsl-slider-wrapper"));c.Preloader.stop(d(".mpsl-layers-list-wrapper"))});if(l.getScope().layer.created)e.resolve();else d(l.getDomElement()).one("MPSLLayerCreate",e.resolve)}})})(jQuery,MPSL);
(function(d,c){c.FormController("MPSL.LayerSettingsForm",{},{optionControllers:{},dependency:{},disabled_dependency:{},layerController:null,optionsContainer:"layer",resettingOptionsMode:!1,init:function(a,b){this._super(a,b);c.Scope.layerSettingsForm=this;this.hide();var e=d(".mpsl-layer-settings-tabs");e.tabs({active:e.children("ul").children("li:visible:first").index()});this.constructor.ready()},hide:function(){this.element.addClass("mpsl-hide-options");this.element.removeAttr("id")},show:function(){this.element.removeClass("mpsl-hide-options");
this.element.attr("id","mpsl-layer-settings-wrapper-"+this.layerController.layer.getType())},reinit:function(a){if("undefined"===typeof a)if(null!==c.Scope.workground.current)a=c.Scope.workground.current.control;else return!1;var b=this;this.layerController=a;this.resetOptions();a=d.extend(!0,{},c.Vars.layer.layouted_defaults,b.layerController.layer.options);a=b.layerController.layer.getCleanSingleLayoutOptions(a);d.each(a,function(a,c){"order"!==a&&b.optionControllers.hasOwnProperty(a)&&(b.optionControllers[a].setValue(c,
!0),b.showDependencedOptions(a))});this.showAllDependencies();this.layerController.layer.isNew&&(this.layerController.layer.setOptions(this.getOptionsList()),this.layerController.layer.isNew=!1);this.show()},resetOptions:function(){this.resettingOptionsMode=!0;var a=this,b=this.layerController.layer.cleanOptions(c.Vars.layer.defaults,!0);d.each(b,function(b,c){a.optionControllers.hasOwnProperty(b)&&a.optionControllers[b].setValue(c,!0)});this.showAllDependencies();this.resettingOptionsMode=!1},setOptions:function(a,
b){b="undefined"!==typeof b?b:!1;var c=this;d.isPlainObject(a)&&d.each(a,function(a,b){c.optionControllers.hasOwnProperty(a)&&(c.optionControllers[a].setValue(b,!0),c.showDependencedOptions(a))});b?this.layerController.layer.setOptions(this.getOptionsList()):this.render()},isResettingOptionsMode:function(){return this.resettingOptionsMode},setType:function(a){this.type=a},render:function(){this.verifyOptions()&&this.layerController.setOptions(this.getOptionsList())}})})(jQuery,MPSL);
(function(d,c){c.FormController("MPSL.StyleEditorForm",{},{optionControllers:{},dependency:{},disabled_dependency:{},preset:null,optionsContainer:"preset",styleModeSwitcher:{},preview:{},presetList:{},styleEditor:{},allowStyleControl:{},styleMode:"",defaultStyleMode:"style",hoverStyleClass:"mpsl-style-editor-hover-style",privateSelectedClass:"mpsl-style-editor-private-selected",resettingOptionsMode:!1,init:function(a,b){this._super(a,b);c.Scope.styleEditorForm=this;this.hide();this.allowStyleControl=
this.getOption("allow_style");this.styleMode=this.defaultStyleMode;this.styleModeSwitcher=new c.StyleEditorModeSwitcher(d("#mpsl-style-mode-switcher"));this.preview=new c.LayerStylePreview(d("#mpsl-style-editor-preview-area"));can.bind.call(this.styleModeSwitcher,"switch",this.proxy("styleModeChanged"));can.bind.call(c.Scope.layerPresetList.element,"presetControlSelect",this.proxy("presetControlSelected"));this.constructor.ready()},hide:function(){this.element.addClass("mpsl-hide-options")},show:function(){this.element.removeClass("mpsl-hide-options")},
reinit:function(a){this.preset=a;this.resetOptions();var b=d.extend(!0,{},c.Vars.preset.defaults,this.preset.options);d.each(b[this.styleMode],this.proxy(function(b,c){if(this.optionControllers.hasOwnProperty(b)){var d=this.optionControllers[b].setValue(c,!0);this.optionControllers[b].isAdjustment()&&!d.hasBeenSet&&a.setOption(b,d.value,this.styleMode);this.showDependencedOptions(b)}}));this.showAllDependencies();this.show()},resetOptions:function(){this.resettingOptionsMode=!0;var a=this;d.each(c.Vars.preset.defaults[this.styleMode],
function(b,c){a.optionControllers.hasOwnProperty(b)&&a.optionControllers[b].setValue(c,!0)});this.showAllDependencies();this.resettingOptionsMode=!1},setOptions:function(a,b){b="undefined"!==typeof b?b:!1;var c=this;d.isPlainObject(a)&&d.each(a,function(a,b){c.optionControllers.hasOwnProperty(a)&&(c.optionControllers[a].setValue(b,!0),c.showDependencedOptions(a))});b?this.preset.setOptions(c.getOptionsList()):this.render()},render:function(){if(this.verifyOptions()){var a=this.getOptionsList();this.preset.setOptions(a)}},
styleModeChanged:function(a,b){this.setStyleMode(b);"style"===b?(this.element.removeClass(this.hoverStyleClass),this.allowStyleControl.disable()):(this.element.addClass(this.hoverStyleClass),this.allowStyleControl.enable());var e=this.presetList.getSelected();e&&(e.getType()!==c.LayerPreset.DEFAULT&&this.reinit(e),e.render())},presetControlSelected:function(a,b){b.getType()===c.LayerPreset.PRIVATE?this.element.addClass(this.privateSelectedClass):this.element.removeClass(this.privateSelectedClass);
b.getType()!==c.LayerPreset.DEFAULT?this.reinit(b):this.hide()},getStyleMode:function(){return this.styleMode},setStyleMode:function(a){this.styleMode=-1<d.inArray(a,["style","hover"])?a:this.defaultStyleMode},resetStyleMode:function(){this.styleModeSwitcher.setMode(this.defaultStyleMode)},linkPresetList:function(a){this.presetList=a},linkStyleEditor:function(a){this.styleEditor=a},isResettingOptionsMode:function(){return this.resettingOptionsMode}})})(jQuery,MPSL);
(function(d,c){c.FormController("MPSL.SlideFormController",{},{workground:null,options:{},dependency:{},disabled_dependency:{},init:function(a,b){this._super(a,b);c.Scope.slideFormCtrl=this;var e=d("#mpsl-slide-settings-tabs");e.tabs({active:e.children("ul").children("li:visible:first").index(),activate:function(a,b){c.CodeMirrorControl.refreshEditors(b.newPanel)}});this.constructor.ready()},linkWorkground:function(a){this.workground=a},render:function(a){c.Preloader.start(d(".mpsl-slider-wrapper"));
var b={general:{},backgrounds:{}};a="undefined"!==typeof a?a:this.getOptionsList();a.hasOwnProperty("bg_color_type")&&("color"===a.bg_color_type&&a.hasOwnProperty("bg_color")&&a.bg_color.length&&(b.backgrounds.color={},b.backgrounds.color.color=a.bg_color),"gradient"===a.bg_color_type&&(a.hasOwnProperty("bg_grad_color_1")&&a.bg_grad_color_1.length||a.hasOwnProperty("bg_grad_color_2")&&a.bg_grad_color_2.length)&&(b.backgrounds.gradient={},b.backgrounds.gradient.colorInitial=a.hasOwnProperty("bg_grad_color_1")&&
a.bg_grad_color_1.length?a.bg_grad_color_1:"transparent",b.backgrounds.gradient.colorFinal=a.hasOwnProperty("bg_grad_color_2")&&a.bg_grad_color_2.length?a.bg_grad_color_2:"transparent",a.hasOwnProperty("bg_grad_angle")&&(b.backgrounds.gradient.position=(a.bg_grad_angle.length?a.bg_grad_angle:"0")+"deg")),a.hasOwnProperty("bg_image_type")&&(a.hasOwnProperty("bg_internal_image_url")&&a.bg_internal_image_url.length||a.hasOwnProperty("bg_image_url")&&a.bg_image_url.length)&&(b.backgrounds.image={},"library"===
a.bg_image_type&&""!==a.bg_internal_image_url&&(b.backgrounds.image.src=a.bg_internal_image_url),"external"===a.bg_image_type&&""!==a.bg_image_url&&(b.backgrounds.image.src=a.bg_image_url),a.hasOwnProperty("bg_position")&&(b.backgrounds.image.position=a.bg_position),a.hasOwnProperty("bg_position_x")&&(b.backgrounds.image.positionX=a.bg_position_x),a.hasOwnProperty("bg_position_y")&&(b.backgrounds.image.positionY=a.bg_position_y),a.hasOwnProperty("bg_repeat")&&(b.backgrounds.image.repeat=a.bg_repeat),
a.hasOwnProperty("bg_fit")&&(b.backgrounds.image.fit=a.bg_fit),a.hasOwnProperty("bg_fit_x")&&(b.backgrounds.image.fitX=a.bg_fit_x),a.hasOwnProperty("bg_fit_y")&&(b.backgrounds.image.fitY=a.bg_fit_y)),a.hasOwnProperty("slide_classes")&&(b.general.classes=d.trim(a.slide_classes)),a.hasOwnProperty("slide_id")&&(b.general.id=d.trim(a.slide_id)));this.workground.slideApi.setOptions(b);this.workground.updateSlideBg();c.Preloader.stop(d(".mpsl-slider-wrapper"))}})})(jQuery,MPSL);
(function(d,c){c.SlidePageController=can.Control.extend({},{slideSettingsController:null,styleEditorController:null,presetList:null,workground:null,layout:null,sliderPreviewWrapper:null,sliderPreviewIframe:null,previewForm:null,optionsInput:null,idInput:null,typeInput:null,nonceInput:null,preloader:null,resBtns:null,resolutionWrapper:null,init:function(a,b){c.Scope.slidePageCtrl=this;this.workground=new c.Workground("#mpsl-workground",{});this.layout=new c.Layout("#mpsl-change-layout",{});this.slideSettingsController=
new c.SlideFormController(".mpsl_options_wrapper");this.slideSettingsController.linkWorkground(this.workground);this.styleEditorController=new c.StyleEditorController(d("#mpsl-style-editor-modal"));this.styleEditorController.linkWorkground(this.workground);this.sliderPreviewWrapper=d(".mpsl-slider-preview");this.preloader=this.sliderPreviewWrapper.find(".mpsl-preloader");this.sliderPreviewIframe=this.sliderPreviewWrapper.find("iframe");this.desktopIcon=this.sliderPreviewWrapper.find(".desktop");this.resolutionWrapper=
this.sliderPreviewWrapper.find(".mpsl-resolution-buttons-wrapper");this.footerMessageWrapper=this.sliderPreviewWrapper.find(".mpsl-slider-preview-footer-message");var e=this,f=c.Vars.menu_url,f=c.Functions.addParamToUrl(f,"view","preview"),f=c.Functions.addParamToUrl(f,"slider_id",c.Vars.page.slider_id),f=c.Functions.addParamToUrl(f,"slide_id",c.Vars.page.id),f=c.Functions.addParamToUrl(f,"type","slide");this.sliderPreviewWrapper.dialog({resizable:!1,draggable:!1,autoOpen:!1,modal:!0,width:d(window).width()-
100,height:d(window).height()-100,title:c.Vars.lang.preview_dialog_title,closeText:"",dialogClass:"mpsl-preview-dialog",close:function(){(e.sliderPreviewIframe[0].contentDocument||e.sliderPreviewIframe[0].contentWindow.document).documentElement.innerHTML=""},beforeClose:function(){d("body").css("overflow","inherit");e.footerMessageWrapper.addClass("hidden")},open:function(){e.footerMessageWrapper.removeClass("hidden");d("body").css("overflow","hidden");e.preloader.show();e.sliderPreviewIframe.attr("src",
f);e.sliderPreviewIframe.width("100%");e.desktopIcon.siblings().removeClass("active");e.desktopIcon.addClass("active")},create:function(){e.resolutionWrapper.removeClass("hidden")}});this.resBtns=[{type:"desktop",resolution:"100%"},{type:"tablet",resolution:"768px"},{type:"mobile",resolution:"480px"}];this.resBtns.forEach(function(a){d("."+a.type).on("click",function(){e.sliderPreviewIframe.width(a.resolution);d(this).siblings().removeClass("active");d(this).addClass("active");(e.sliderPreviewIframe[0].contentWindow||
e.sliderPreviewIframe[0].contentDocument)._mpslResizePreview()})});this.sliderPreviewIframe.on("load",function(){e.preloader.hide()})},disableBtns:function(){this.element.find("#save_slide, #delete_slide").attr("disabled","disabled")},enableBtns:function(){this.element.find("#save_slide, #delete_slide").removeAttr("disabled","disabled")},"#save_slide, #slider_preview click":function(a,b){var e="slider_preview"===d(a).attr("id");e||this.disableBtns();var f=this,g=c.Vars.page.id,k=this.slideSettingsController.getFormData(),
l=this.workground.getLayersData(),k={action:"mpsl_update_slide",nonce:c.Vars.nonces.update_slide,options:JSON.stringify(k),layers:JSON.stringify(l),preview:e};g&&(k.id=g);d.ajax({type:"POST",url:c.Vars.ajax_url,data:k,success:function(a){e?f.sliderPreviewWrapper.dialog("open"):(f.enableBtns(),a.hasOwnProperty("result")&&c.Functions.showMessage(c.Vars.lang.slide_updated,c.Functions.MSG_SUCCESS_TYPE))},error:function(a){console.log(a.responseText);a=d.parseJSON(a.responseText);a.debug?console.log(a.message):
c.Functions.showMessage(a.message,c.Functions.MSG_ERROR_TYPE);f.enableBtns()},dataType:"JSON"})},"#delete_slide click":function(a){this.disableBtns();a=c.Vars.page.id;if(0==confirm(c.Vars.lang.slide_want_delete_single.replace("%d",a)))return this.enableBtns(),!0;var b={action:"mpsl_delete_slide",nonce:c.Vars.nonces.delete_slide};a&&(b.id=a);d.ajax({type:"POST",url:c.Vars.ajax_url,data:b,success:function(a){deleteBtn.removeAttr("disabled");c.Functions.showMessage(c.Vars.lang.slide_deleted,c.Functions.MSG_SUCCESS_TYPE);
a=c.Vars.menu_url;a=c.Functions.addParamToUrl(a,"view","slides");a=c.Functions.addParamToUrl(a,"id",c.Vars.page.slider_id);window.location.href=a},error:function(a){a=d.parseJSON(a.responseText);a.debug?console.log(a.message):c.Functions.showMessage(a.message,c.Functions.MSG_ERROR_TYPE);self.enableBtns()},dataType:"JSON"})},"#create_slide click":function(a){var b=this;this.disableBtns();d.ajax({type:"POST",url:c.Vars.ajax_url,data:{action:"mpsl_create_slide",nonce:c.Vars.nonces.create_slide,slider_id:c.Vars.page.slider_id},
success:function(a){a.hasOwnProperty("result")?(c.Functions.showMessage(c.Vars.lang.slide_created,c.Functions.MSG_SUCCESS_TYPE),window.location.href=c.Vars.menu_url+"&view=slide&id="+a.id):(c.Functions.showMessage(c.Vars.lang.slider_created_error,c.Functions.MSG_ERROR_TYPE),b.enableBtns())},error:function(a){a=d.parseJSON(a.responseText);a.debug?console.log(a.message):c.Functions.showMessage(a.message,c.Functions.MSG_ERROR_TYPE);b.enableBtns()},dataType:"JSON"})}})})(jQuery,MPSL);
(function(d,c){c.StyleEditorController=can.Control.extend({},{styleSettings:{},presetList:{},workground:null,editorElement:null,editorWrapper:null,editorTabs:null,editorTabsContent:null,previewEl:null,linkedLayerControl:null,dialog:null,tabs:null,init:function(a,b){c.Scope.styleEditorCtrl=this;this.styleSettings=new c.StyleEditorForm(d(".mpsl-style-editor-settings-wrapper"),{showErrorType:"internal"});this.styleSettings.linkStyleEditor(this);this.presetList=new c.LayerPresetList("#mpsl-layer-preset-list-child-wrapper");
this.presetList.linkStyleSettings(this.styleSettings);this.presetList.linkStyleEditor(this);this.styleSettings.linkPresetList(this.presetList);this.dialog=null;this.editorElement=d("#mpsl-style-editor-modal");this.editorWrapper=d("#mpsl-style-editor-wrapper");this.presetListChildWrapper=d("#mpsl-layer-preset-list-child-wrapper");this.editorTabs=this.editorElement.find("#mpsl-style-editor-settings-wrapper");this.editorContentEl=this.editorElement.find(".mpsl-style-editor-content");this.editorFooterEl=
this.editorElement.find(".mpsl-style-editor-footer");this.previewEl=d("#mpsl-style-editor-preview-area");this.switcherEl=d("#mpsl-style-mode-switcher");this.linkedLayerControl=null;this.initEditor()},initEditor:function(){var a=this,b=null;this.editorElement.dialog({resizable:!1,draggable:!1,autoOpen:!1,modal:!0,appendTo:".mpsl-wrapper",width:1E3,height:d(window).height()-85,title:c.Vars.lang.style_editor_dialog_title,closeText:"",dialogClass:"mpsl-style-editor-dialog",position:{my:"center",at:"center",
of:window},beforeClose:function(){d("body").css("overflow","inherit")},close:function(){var c=a.linkedLayerControl.getValue();(c=a.presetList.getByName(c))&&b&&c.setOptions(b,!0);b=null;a.presetList.unselect();a.styleSettings.resetStyleMode()},open:function(){d("body").css("overflow","hidden");a.fixDialog();var e=setTimeout(function(){a.fixDialog();clearTimeout(e)},1E3);a.styleSettings.resetStyleMode();var f=a.linkedLayerControl.getValue();a.styleSettings.preview.reset();a.loadPrivateOptions();a.presetList.select(f,
!0);(f=a.presetList.getByName(f))&&(b=f.getOptions({},!0));c.CodeMirrorControl.refreshEditors(a.editorTabs.find(".ui-tabs-panel").eq(a.editorTabs.tabs("option","active")))},create:function(){var b=d(this).parent(".ui-dialog");b.parent(".mpsl-wrapper").length||b.appendTo(".mpsl-wrapper");a.dialog=d(this).data("ui-dialog");b=a.dialog.uiDialogTitlebar.find(".ui-dialog-title");b.addClass("mpsl-se-title-left");b.after(d('<span class="ui-dialog-title mpsl-se-title-right">'+c.Vars.lang.style_editor_dialog_presets_title+
"</span>"));a.editorTabs.tabs({create:function(b,c){a.tabs=d(this).data("ui-tabs");a.editorTabsContent=a.editorTabs.find(".ui-tabs-panel.ui-widget-content");d(window).on("resize",a.proxy("onWindowResize"))},activate:function(a,b){c.CodeMirrorControl.refreshEditors(b.newPanel)}});a.createPresetList();can.trigger(a.element,"create",[a])}})},fixDialog:function(){var a=d(window).height(),b=a-85,a=a-185;this.editorElement.dialog("option","position",{my:"center",at:"center",of:window});this.editorElement.dialog("option",
"height",0<b?b:0);this.editorContentEl.css("height",0<a?a:0);var a=this.editorWrapper.outerHeight(!0),c=this.editorFooterEl.outerHeight(!0),b=a-this.previewEl.outerHeight(!0)-this.switcherEl.outerHeight(!0)-this.tabs.tablist.outerHeight(!0)-c-3,a=a-c-3;this.editorTabsContent.height(0<b?b:0);this.presetListChildWrapper.height(0<a?a:0)},loadPrivateOptions:function(){var a=this.linkedLayerControl.helpers.private_styles.getValue(),b=this.presetList.getByName("private");b&&b.setOptions(can.isEmptyObject(a)?
c.LayerPreset.getDefaultsCopy():a,!0,!0)},createPresetList:function(){var a=this;this.presetList.add("private",c.LayerPreset.getDefaultsCopy(c.Vars.lang.layer_preset_private_name),c.LayerPreset.PRIVATE);d.each(c.Vars.preset.list,function(b){a.presetList.add(b,this)});d.each(c.Vars.preset.default_list,function(b){a.presetList.add(b,this,c.LayerPreset.DEFAULT)})},onWindowResize:function(){this.editorElement.dialog("isOpen")&&this.fixDialog()},linkWorkground:function(a){this.workground=a},linkControl:function(a){this.linkedLayerControl=
a},disableBtns:function(){this.element.find("#save_slide, #delete_slide").attr("disabled","disabled")},enableBtns:function(){this.element.find("#save_slide, #delete_slide").removeAttr("disabled","disabled")}})})(jQuery,MPSL);
(function(d,c){c.Workground=can.Control.extend({defaults:{},width:null,height:null,halfWidth:null,halfHeight:null},{layers:[],current:null,layerControls:null,sliderWrapper:null,sliderBgWrapper:null,sliderContainer:null,sliderEl:null,slide:null,slideControl:null,slideBg:null,addButtons:null,deleteButtons:null,duplicateButton:null,slideApi:null,$guidesWrapper:null,$guideV:null,$guideH:null,loaded:null,slideBorder:null,scrollbarWidth:null,init:function(a,b){c.Scope.workground=this;var e=this;this.layerControls=
new c.LayerControls(".mpsl-layers-list-child-wrapper");this.layerControls.linkWorkground(this);this.sliderWrapper=a.children(".mpsl-slider-wrapper");this.sliderContainer=this.sliderWrapper.children(".motoslider_wrapper");this.addButtons=a.find(".mpsl-layer-control-panel .mpsl-add-layer");this.deleteButtons=a.find('.mpsl-layer-control-panel [class*="mpsl-delete-"]');this.dropdownLayerListWrap=a.find(".mpsl-layer-control-panel .mpsl-dropdown-layer-list-wrapper");this.dropdownLayerListButton=a.find(".mpsl-layer-control-panel .mpsl-dropdown-layer-list");
this.duplicateButton=a.find(".mpsl-duplicate-layer");this.slideBorder=d(".mpsl-slide-border");this.loaded=!1;this.scrollbarWidth=c.Functions.getScrollbarWidth();this.initControls();var f=d("#mpsl-core-css");f.length&&d("#mpsl-preset-styles-wrapper").insertAfter(f);if(this.sliderContainer.length)this.sliderContainer.one("MPSliderLoad",function(){c.Core.SliderManager=MPSLManager.getSliderManager(e.sliderContainer[0]);e.sliderBgWrapper=e.sliderWrapper.children(".mpsl-slide-bg-wrapper");e.sliderEl=e.sliderContainer.children(".ms_wrapper");
e.slide=e.sliderEl.find(".ms_current_slide");e.slideApi=c.Core.SliderManager.getSlide(e.slide[0]);e.slideBg=e.slide.children(".ms_slide_wrapper");e.$guidesWrapper=e.sliderWrapper.children(".mpsl-guides");e.$guideV=e.$guidesWrapper.children("#mpsl-guide-v");e.$guideH=e.$guidesWrapper.children("#mpsl-guide-h");e.resizeWorkground(e.sliderEl.outerWidth(),e.sliderEl.outerHeight());e.sliderBgWrapper.append(e.slideBg.children().clone());e.initLayers();e.addButtons.removeAttr("disabled");e.deleteButtons.filter(".mpsl-delete-all-layers").removeAttr("disabled");
e.loaded=!0;can.trigger(e,"load");c.Preloader.stop()});else c.Preloader.stop()},resizeWorkground:function(a,b){c.Workground.width=a;c.Workground.height=b;c.Workground.halfWidth=c.Workground.width/2;c.Workground.halfHeight=c.Workground.height/2;this.sliderContainer.css("width",a);this.sliderBgWrapper.css({"min-width":a,height:b});this.$guidesWrapper.css({"min-width":a,height:b});this.slideBorder.css("width",a);this.sliderWrapper.css("max-height",b+this.scrollbarWidth)},initControls:function(){var a=
this.addButtons.filter('[data-type="image"]');(new c.AddImageML(a,{id:"mpsl-add-image-ml",title:"New Image",button:{text:c.Vars.layer.options.image_id.select_label}})).linkWokground(this)},updateSlideBg:function(){this.sliderBgWrapper.html(this.slide.children(".ms_slide_wrapper").children().clone())},initNewLayer:function(a,b){var e=d.Deferred(),f=e.promise();if(a){var g=this,k=d.Deferred(),l=k.promise();if(a.getScope().layer.created)k.resolve();else d(a.getDomElement()).one("MPSLLayerCreate",k.resolve);
d.when(l).then(function(){var f=g.initLayer(d(a.getDomElement())),h=d.extend(!0,{},b.options,c.Layer.getCentralOffset());f.updatePosition(c.Layer.getCentralOffset(!0));f.extendOptions(h);f.select();f.control.select();f.control.scrollToElement();g.current=f;c.Preloader.stop(d(".mpsl-slider-wrapper"));e.resolve(f)})}else e.reject();return f},'.mpsl-layer-control-panel .mpsl-add-layer:not([data-type="image"]) click':function(a){c.Preloader.start(d(".mpsl-slider-wrapper"));var b={options:{}},e=null;switch(a.attr("data-type")){case "html":b.options=
{type:"html",text:c.Vars.layer.defaults.text,html_width:c.Layer.makeLayoutedOption(c.Vars.layer.defaults.html_width),html_style:""};e=c.HtmlLayer.create(b);break;case "button":b.options={button_text:c.Vars.layer.defaults.button_text,button_link:c.Vars.layer.defaults.button_link,button_target:c.Vars.layer.defaults.button_target,button_style:""};e=c.ButtonLayer.create(b);break;case "video":b.options={video_type:"youtube",youtube_src:"https://www.youtube.com/watch?v=t0jFJmTDqno",youtube_thumbnail:"https://i.ytimg.com/vi/t0jFJmTDqno/maxresdefault.jpg",
video_preview_image:"",video_youtube_hide_controls:!1,video_width:c.Layer.makeLayoutedOption(c.Vars.layer.defaults.video_width),video_height:c.Layer.makeLayoutedOption(c.Vars.layer.defaults.video_height)},e=c.VideoLayer.create(b)}this.initNewLayer(e,b)},".mpsl-layer-control-panel .mpsl-delete-layer click":function(){this.remove()},".mpsl-layer-control-panel .mpsl-delete-all-layers click":function(){confirm(c.Vars.lang.layer_want_delete_all)&&(this.layerControls.removeAll(),this.removeAll(),this.onUnselect())},
".mpsl-layer-control-panel .mpsl-dropdown-layer-list click":function(){this.dropdownLayerListWrap.toggleClass("mpsl-dropdown-open");this.dropdownLayerListButton.toggleClass("active");this.layerControls.initStyles()},remove:function(){this.current&&(this.layerControls.remove(this.current.control),this.layers.splice(this.current.getOrder(),1),this.resetOrder(),this.current.api.remove(),this.current=null);this.onUnselect()},removeAll:function(){d.each(this.layers,function(){this.api.remove()});this.layers=
[];this.current=null},initLayers:function(){var a=this;this.slide.find(".ms_layers_wrapper > .layers").each(function(){a.initLayer(d(this),!1)})},initLayer:function(a,b){var e=c.Core.SliderManager.getLayer(a[0]),d=e.getType(),g=e.getOrder(),k=null,l={order:g};if("undefined"!==typeof d&&d){switch(d){case "html":l.type=d;k=new c.HtmlLayer(a,l,b);break;case "button":l.type=d;k=new c.ButtonLayer(a,l,b);break;case "image":l.type=d;k=new c.ImageLayer(a,l,b);break;case "video":l.type="video";l.video_type=
"html";k=new c.VideoLayer(a,l,b);break;case "youtube":l.type="video";l.video_type="youtube";k=new c.VideoLayer(a,l,b);break;case "vimeo":l.type="video",l.video_type="vimeo",k=new c.VideoLayer(a,l,b)}k.linkWorkground(this);k.linkAPI(e);this.layerControls.add(k,g,d+" "+g,{});this.layers.push(k)}return k},setCurrent:function(a){this.current=a},getCurrent:function(){return this.current},getLayersData:function(){return this.layerControls.getData()},onSelect:function(a){this.current=a;this.deleteButtons.filter(".mpsl-delete-layer").removeAttr("disabled")},
onUnselect:function(){this.deleteButtons.filter(".mpsl-delete-layer").attr("disabled","disabled");this.current=null},resetOrder:function(){d.each(this.layers,function(a,b){b.setOrder(a)})},reorder:function(){var a=this;d.each(this.layerControls.controls,function(b,c){a.layers[b]=c.layer;c.layer.setOrder(b)})},".mpsl-slider-wrapper mousedown":function(){d.each(this.layers,function(){this.unselect()});this.onUnselect()},repaintLayers:function(){d.each(this.layers,function(a,b){b.repaintLayer()})}})})(jQuery,
MPSL);
(function(d,c){c.LayerControl=can.Control.extend({defaults:{}},{layer:null,order:null,layersControls:{},init:function(a,b){},destroy:function(){this.unselect();can.Control.prototype.destroy.call(this)},click:function(a){this.layer.select();this.select()},select:function(){this.element.hasClass("layer-control-selected")||(this.element.siblings().removeClass("layer-control-selected"),this.element.addClass("layer-control-selected"),c.Scope.layerSettingsForm.reinit(this))},unselect:function(){this.element.hasClass("layer-control-selected")&&(this.element.removeClass("layer-control-selected"),
c.Scope.layerSettingsForm.hide())},linkLayer:function(a){this.layer=a},setOrder:function(a){this.order=a},getOrder:function(){return this.order},getData:function(){return this.layer.options},setOptions:function(a){a.hasOwnProperty("type")&&"video"===a.type&&this.updateLabel("html"===a.video_type?"video":a.video_type);this.layer.setOptions(a);this.layer.render()},updateLabel:function(a){this.layersControls.updateLayerLabel(this.getOrder(),a)},linkLayerControls:function(a){this.layersControls=a},scrollToElement:function(){this.layersControls.element.animate({scrollTop:this.layersControls.element.scrollTop()+
this.element.position().top-this.layersControls.element.position().top-this.layersControls.element.height()/2+this.element.height()/2},100)}})})(jQuery,MPSL);
(function(d,c){c.LayerControls=can.Control.extend({defaults:{}},{controls:[],listContainer:null,workground:null,formSettings:{},stylesInited:!1,init:function(a,b){c.Scope.layerControlList=this;this.listContainer=a.find(".mpsl-layers-table > tbody");this.makeSortable();this.formSettings=new c.LayerSettingsForm(d(".mpsl-layer-settings-wrapper"),{showErrorType:"internal"})},initStyles:function(){this.stylesInited||(this.element.css("max-height",250-d(".mpsl-layers-table-head").outerHeight()),this.stylesInited=
!0)},makeSortable:function(){var a=this;this.listContainer.sortable({handle:".mpsl-layer-drag-handle",scroll:!0,helper:function(a,c){c.children().each(function(){d(this).width(d(this).width())});return c},start:function(a,c){var f=d(c.item).control();f.select();f.layer.select()},update:function(){d(a.listContainer.children("tr").get().reverse()).each(function(b,c){a.controls[b]=d(c).control();a.controls[b].setOrder(b)});a.workground.reorder()}})},add:function(a,b,e,f){f=d("<tr>");var g=d('<td class="mpsl-layer-drag-handle">').text("");
e=d('<td class="mpsl-layer-label">').text(e);f.append(g,e);this.listContainer.prepend(f);e=new c.LayerControl(f);e.setOrder(b);e.linkLayer(a);e.linkLayerControls(this);a.linkControl(e);this.controls.push(e)},linkWorkground:function(a){this.workground=a},remove:function(a){this.controls.splice(a.getOrder(),1);this.resetOrder();a.element.remove()},removeAll:function(){d.each(this.controls,function(){this.element.remove()});this.controls=[]},resetOrder:function(){d.each(this.controls,function(a,b){b.setOrder(a)})},
getData:function(){var a=[];d.each(this.controls,function(b,c){a[c.getOrder()]=c.getData()});return a},updateLayerLabel:function(a,b,c){a=d(this.listContainer.children("tr").get().reverse()[a]).find(".mpsl-layer-label");var f=a.text().split(" ");f[0]=b;"undefined"!==typeof c&&(f[1]=c);b=f.join(" ");a.text(b)}})})(jQuery,MPSL);
(function(d,c){c.Layer=can.Control.extend({defaults:{},whiteSpaceClassPrefix:c.Vars.layer.white_space_class_prefix,create:function(){},getCentralOffset:function(a){var b=c.Vars.layer.defaults.hor_align,e=c.Vars.layer.defaults.vert_align,f={align:{hor:b,vert:e},hor_align:b,vert_align:e,offset_x:c.Vars.layer.defaults.offset_x,offset_y:c.Vars.layer.defaults.offset_y};("undefined"===typeof a?0:a)||d.each(f,function(a,b){f[a]=c.Layer.makeLayoutedOption(b)});return f},prepareOptionsForApi:function(a){a=
d.extend(!0,{},a);a.hasOwnProperty("classes")||(a.classes="");a.classes=c.Vars.preset.layer_class+" "+a.classes;return a},getByLayout:function(a){return c.Layer.isLayoutFormat(a)?a[c.Layout.getLayout()]:a},isLayoutFormat:function(a){return"object"===typeof a&&a.hasOwnProperty("desktop")},makeLayoutedOption:function(a,b,e){e="undefined"===typeof e?!0:e;var d={};if("undefined"===typeof b||!b){for(var g in c.Vars.layout.list)d[g]=e?null:a;d[c.Vars.layout["default"]]=a}d[c.Layout.getLayout()]=a;return d}},
{order:null,options:{},prevOptions:{},control:null,object:null,presetOwnerObject:null,handle:null,container:null,api:null,type:null,workground:null,resizableOptions:{},draggableOptions:{},droppableOptions:{},resizable:!1,isNew:!1,shiftPressed:!1,onChangeData:{},storage:{youtubeThumbnails:{},vimeoThumbnails:{}},needReinitFlag:!1,MIN_DISTANCE:10,setup:function(a,b,e){this.isNew=e="undefined"!==typeof e?e:!0;this._super(a,b);this.options={};this.order=b.order;e||"undefined"===typeof c.Vars.layer.list[this.order]?
d.extend(!0,this.options,c.Vars.layer.layouted_defaults,b):d.extend(!0,this.options,c.Vars.layer.list[this.order],b);this.options.private_styles=d.extend(!0,{},c.Vars.preset.defaults,this.options.private_styles);this.cleanOptions();this.options.hasOwnProperty("private_preset_class")&&"undefined"!==typeof this.options.private_preset_class&&this.options.private_preset_class||(this.options.private_preset_class=c.LayerPresetList.privateClassPrefix+c.LayerPresetList.getNextPrivateId());d.extend(!0,this.prevOptions,
this.options);this.presetOwnerObject=this.object=a.children();this.container=a.closest(".ms_wrapper")},resetObject:function(){this.presetOwnerObject=this.object=this.element.children(".ms_layer")},init:function(a,b){this.api=c.Core.SliderManager.getLayer(this.element[0]);this.type=this.api.getType();this.prepare();this.preventEvents();this.initWidgets();this.initEvents();this.element.on("MPSLLayerChange",this.proxy("onLayerChange"))},reinit:function(){this.resetObject();this.api=c.Core.SliderManager.getLayer(this.element[0]);
this.type=this.api.getType();this.object.addClass("mpsl-layer-child-fix");this.reprepare();this.preventEvents();this.object.on("MPSLLayerChange",this.proxy("onLayerChange"));this.needReinitFlag=!1},needReinit:function(){this.needReinitFlag=!0},isNeedReinit:function(){return this.needReinitFlag},prepare:function(){var a,b={top:this.object.position().top};"right"===this.getLayoutOption("hor_align")?(a="right",this.setLeftAuto()):a="left";b[a]=parseFloat(this.object.css(a));this.element.css(b);this.addFixClasses()},
addFixClasses:function(){this.element.addClass("mpsl-layer-fix");this.object.addClass("mpsl-layer-child-fix")},addCustomFixClasses:function(){},reprepare:function(){this.addFixClasses();this.addCustomFixClasses()},initWidgets:function(){this.addHelpers();this.resizable&&this.makeResizable();this.makeDraggable()},addHelpers:function(){this.element.append(d("<div>",{"class":"mpsl-layer-handle",tabindex:1}));this.handle=this.element.children(".mpsl-layer-handle")},computeGuidesForElement:function(a,
b,c,f){null!=a&&(a=d(a),b=a.offset(),c=a.outerWidth()-1,f=a.outerHeight()-1);return[{type:"h",left:b.left,top:b.top},{type:"h",left:b.left,top:b.top+f},{type:"v",left:b.left,top:b.top},{type:"v",left:b.left+c,top:b.top},{type:"h",left:b.left,top:b.top+f/2},{type:"v",left:b.left+c/2,top:b.top}]},makeDraggable:function(){var a=this,b,e,f,g,k,l,m,h={scroll:!1,grid:[1,1],start:function(b){a.isType("html")&&""===a.getLayoutOption("html_width")&&a.element.addClass("mpsl-editor-wh-auto");e=a.element.width();
var h=a.element.siblings(".layers");k=d.map(h,a.proxy("computeGuidesForElement"));f=b.originalEvent.offsetX;g=b.originalEvent.offsetY;l=c.Scope.workground.sliderContainer.offset();m=c.Scope.workground.sliderWrapper.offset();m.left-=c.Scope.workground.sliderWrapper.scrollLeft()},stop:function(e,d){a.isType("html")&&""===a.getLayoutOption("html_width")&&a.element.removeClass("mpsl-editor-wh-auto").css({width:"",height:""});b=a.getOffsets();a.workground.layerControls.formSettings.setOptions(b,!0);c.Scope.workground.$guideV.hide();
c.Scope.workground.$guideH.hide()},drag:function(b,h){var p={top:{dist:a.MIN_DISTANCE+1},left:{dist:a.MIN_DISTANCE+1}},t=a.element,r={top:b.originalEvent.pageY-g,left:b.originalEvent.pageX-f},q=t.outerWidth()-1,t=t.outerHeight()-1,s=a.computeGuidesForElement(null,r,q,t);d.each(k,function(a,b){d.each(s,function(a,c){if(b.type==c.type){var e="h"==b.type?"top":"left",d=Math.abs(c[e]-b[e]);d<p[e].dist&&(p[e].dist=d,p[e].offset=c[e]-r[e],p[e].guide=b)}})});p.top.dist<=a.MIN_DISTANCE?(c.Scope.workground.$guideH.css("top",
p.top.guide.top-l.top).show(),h.position.top=p.top.guide.top-p.top.offset-l.top):(c.Scope.workground.$guideH.hide(),h.position.top=r.top-l.top);p.left.dist<=a.MIN_DISTANCE?(c.Scope.workground.$guideV.css("left",p.left.guide.left-m.left).show(),h.position.left=p.left.guide.left-p.left.offset-l.left):(c.Scope.workground.$guideV.hide(),h.position.left=r.left-l.left);"right"===a.getLayoutOption("hor_align")&&a.element.css("right",Math.round(c.Workground.width-h.position.left-e))}};this.mergeWidgetOprions(h,
this.draggableOptions);this.element.draggable(h);this.afterMakeDraggable()},makeResizable:function(){var a=this,b={handles:"n, e, s, w, se, sw, ne, nw",minWidth:1,minHeight:1,start:function(b,c){a.resizeStart(d(this),b,c)},resize:function(){d(this).height(a.object.outerHeight(!0))},stop:function(b,c){a.resizeStop(d(this),b,c)}};this.mergeWidgetOprions(b,this.resizableOptions);this.element.resizable(b);this.afterMakeResizable()},afterMakeResizable:function(){},afterMakeDraggable:function(){},resizeStart:function(a,
b,c){b=this.object.outerWidth(!0)-this.object.width()+1;this.isType("image")&&(b+=this.image.outerWidth(!0)-this.image.width());a.resizable("option","minWidth",b)},resizeStop:function(a,b,c){a=this.getObjectWidth();b=this.getOffsets();this.isType("html")?b.html_width=a:b.width=a;this.workground.layerControls.formSettings.setOptions(b,!0);this.updateSize(a)},mergeWidgetOprions:function(a,b){d.each(b,function(b,c){a[b]=c});return a},getObjectWidth:function(){return this.isType("image")?this.image.width():
this.object.width()},mouseenter:function(a){this.element.hasClass("layer-selected")||(this.object.addClass(c.Vars.preset.layer_hover_class),this.presetOwnerObject.addClass(c.Vars.preset.layer_hover_class))},":not(.layer-selected) mouseleave":function(){this.element.hasClass("layer-selected")||(this.object.removeClass(c.Vars.preset.layer_hover_class),this.presetOwnerObject.removeClass(c.Vars.preset.layer_hover_class))},mousedown:function(a,b){b.stopPropagation();this.object.removeClass(c.Vars.preset.layer_hover_class);
this.presetOwnerObject.removeClass(c.Vars.preset.layer_hover_class);this.select();this.control.select();this.control.scrollToElement()},select:function(){this.workground.current&&this.workground.current.handle.blur();this.focusWithoutScrolling();this.element.hasClass("layer-selected")||(this.element.siblings(".layers").removeClass("layer-selected"),this.element.addClass("layer-selected"),this.workground.onSelect(this),can.trigger(this.workground,"layerSelect"))},unselect:function(){this.workground.current&&
this.workground.current.handle.blur();this.element.hasClass("layer-selected")&&(this.element.removeClass("layer-selected"),this.control.unselect())},linkControl:function(a){this.control=a},getOrder:function(){return this.order},setOrder:function(a){this.order=a;this.element.css("z-index",100+a)},getType:function(){return this.type},preventEvents:function(){this.object.off("click")},onLayerChange:function(a,b){this.isNeedReinit()&&this.reinit();this.isType(["html","image"])&&this.updateSize(this.onChangeData.width);
this.isType(["video","vimeo","youtube"])&&this.updateSize(this.onChangeData.width,this.onChangeData.height);this.updatePosition(this.onChangeData.offset);this.onChangeData.widthChanged&&this.workground.layerControls.formSettings.setOptions(this.getOffsets(),!0);c.Preloader.stop(d(".mpsl-slider-wrapper"))},isType:function(a){a="string"===typeof a?[a]:a;return-1<d.inArray(this.type,a)},getLayoutFontOptions:function(){var a={};d.each(c.Vars.layout.style_options,this.proxy(function(b,c){a[c]=this.getLayoutOption(c)}));
return a},repaintLayer:function(){this.isType(["html","button"])&&(this.api.setFontOptions(this.getLayoutFontOptions()),this.isType("html")&&this.api.setOption("whiteSpace",this.getLayoutOption("white-space")),this.isType("button")&&this.clearWH());var a="",b="";switch(this.getType()){case "html":this.options.hasOwnProperty("html_width")&&(a=this.getLayoutOption("html_width"));this.updateSize(a);break;case "image":this.options.hasOwnProperty("width")&&(a=this.getLayoutOption("width"));this.updateSize(a);
break;case "video":case "youtube":case "vimeo":this.options.hasOwnProperty("video_width")&&(a=this.getLayoutOption("video_width")),this.options.hasOwnProperty("video_height")&&(b=this.getLayoutOption("video_height")),this.updateSize(a,b)}this.updatePosition({hor_align:this.getLayoutOption("hor_align"),vert_align:this.getLayoutOption("vert_align"),offset_x:this.getLayoutOption("offset_x"),offset_y:this.getLayoutOption("offset_y")})},linkAPI:function(a){this.api=a},linkWorkground:function(a){this.workground=
a},getOption:function(a){return this.options[a]},getLayoutOption:function(a,b){b="undefined"===typeof b?"current":b;var e;e="object"===typeof b?b[a]:"current"===b?this.options[a]:this.prevOptions[a];var d=c.Scope.workground.layerControls.formSettings.optionControllers;d.hasOwnProperty(a)&&d[a].isLayoutDependent&&this.constructor.isLayoutFormat(e)&&(e=null!==e[c.Layout.getLayout()]?e[c.Layout.getLayout()]:this.getDependOnValue(e));return e},getDependOnValue:function(a,b){"undefined"===typeof b&&(b=
c.Vars.layout.list[c.Layout.getLayout()].depend_on);var e=a[b];if(null===e){var d=c.Vars.layout.list[b].depend_on;d!==b&&(e=this.getDependOnValue(a,d))}return e},setOptionValue:function(a,b){var e=c.Scope.workground.layerControls.formSettings.optionControllers;e.hasOwnProperty(a)&&e[a].isLayoutDependent?(e=c.Layout.getLayout(),this.options[a][e]=b):this.options[a]=b},getSingleLayoutOptions:function(a){var b="current";"undefined"===typeof a?a=this.options:b=a;var c=this,f={};d.each(a,function(a,d){f[a]=
c.getLayoutOption(a,b)});return f},cleanOptions:function(a,b){a="undefined"===typeof a?this.options:a;("undefined"===typeof b?0:b)&&(a=d.extend(!0,{},a));d.each(a,function(b){if(c.Vars.layer.options.hasOwnProperty(b)){var f=c.Vars.layer.options[b].layer_type;"string"===typeof f&&"all"==f||-1<d.inArray(a.type,f)||delete a[b]}});return a},getCleanSingleLayoutOptions:function(a,b){"undefined"===typeof a&&(a=this.options,b=!0);a=("undefined"===typeof b?0:b)?d.extend(!0,{},a):a;this.cleanOptions(a);return a=
this.getSingleLayoutOptions(a)},setOptions:function(a){a.order=this.order;d.extend(!0,this.prevOptions,this.options);var b=this;d.each(a,function(a,c){b.setOptionValue(a,c)})},extendOptions:function(a){d.extend(!0,this.options,a)},render:function(){var a=this;c.Preloader.start(d(".mpsl-slider-wrapper"));var b={},e=null,f=null,g=!1;this.options.hasOwnProperty("width")&&this.object.width()!=parseInt(this.getLayoutOption("width"))&&(g=!0);this.options.hasOwnProperty("html_width")&&""!==this.getLayoutOption("html_width")&&
this.object.width()!=parseInt(this.getLayoutOption("html_width"))&&(g=!0);if(this.options.hasOwnProperty("video_width")&&this.object.width()!=parseInt(this.getLayoutOption("video_width"))||this.options.hasOwnProperty("video_height")&&this.object.height()!=parseInt(this.getLayoutOption("video_height")))g=!0;var k=a.getLayoutOption("type"),l="video"===k?a.getLayoutOption("video_type"):"",m="classes";"image"===k&&d.trim(a.getLayoutOption("image_link"))&&(m="linkClasses");var h={},n={},u=[];d.each(this.getSingleLayoutOptions(),
function(k,g){switch(k){case "vert_align":case "hor_align":case "offset_x":case "offset_y":b[k]=g;break;case "text":a.getLayoutOption("text","prev")!==g&&(h.content=g);break;case "html_style":h.hasOwnProperty("classes")&&h.classes.length?h.classes+=" "+g:h.classes=g;break;case "html_width":e=g;break;case "button_text":h.title=g;break;case "button_style":h.hasOwnProperty("classes")&&h.classes.length?h.classes+=" "+g:h.classes=g;break;case "button_macros":h.button_macros=g;break;case "preset":var r=
"private"===g?a.getLayoutOption("private_preset_class"):g;h.hasOwnProperty(m)&&h[m].length?h[m]+=" "+r:h[m]=r;break;case "width":e=g;break;case "image_url":h.src=g;break;case "image_link":h.link=g;break;case "video_type":"youtube"===g&&(h.type="youtube");"vimeo"===g&&(h.type="vimeo");"html"===g&&(h.type="video");a.isType(h.type)||a.needReinit();break;case "video_src_mp4":if("html"!==l)break;h.hasOwnProperty("sources")||(h.sources={});h.sources.mp4=d.trim(g);break;case "video_src_webm":if("html"!==
l)break;h.hasOwnProperty("sources")||(h.sources={});h.sources.webm=d.trim(g);break;case "video_src_ogg":if("html"!==l)break;h.hasOwnProperty("sources")||(h.sources={});h.sources.ogg=d.trim(g);break;case "youtube_src":if("youtube"!==l)break;h.src=g;break;case "vimeo_src":if("vimeo"!==l)break;h.src=g;break;case "video_width":e=g;break;case "video_height":f=g;break;case "video_html_hide_controls":h.controls=!g;break;case "video_youtube_hide_controls":h.controls=!g;break;case "video_preview_image":if(d.trim(g).length)h.poster=
d.trim(g);else switch(l){case "html":h.poster="";break;case "youtube":var q=d.trim(a.getLayoutOption("youtube_src"));if(a.storage.youtubeThumbnails.hasOwnProperty(q))h.poster=a.storage.youtubeThumbnails[q];else{var s=d.Deferred();u.push(s.promise());d.ajax({type:"GET",url:c.Vars.ajax_url,cache:!0,data:{action:"mpsl_get_youtube_thumbnail",nonce:c.Vars.nonces.get_youtube_thumbnail,src:a.getLayoutOption("youtube_src")},success:function(b){h.poster=b.result;a.storage.youtubeThumbnails[q]=b.result;s.resolve()},
error:function(a){a=d.parseJSON(a.responseText);s.reject(a.message)},dataType:"JSON"})}break;case "vimeo":if(q=d.trim(a.getLayoutOption("vimeo_src")),a.storage.vimeoThumbnails.hasOwnProperty(q))h.poster=a.storage.vimeoThumbnails[q];else{var v=d.Deferred();u.push(v.promise());d.ajax({type:"GET",url:c.Vars.ajax_url,data:{action:"mpsl_get_vimeo_thumbnail",nonce:c.Vars.nonces.get_vimeo_thumbnail,src:a.getLayoutOption("vimeo_src")},success:function(b){h.poster=b.result;a.storage.vimeoThumbnails[q]=b.result;
v.resolve()},error:function(a){a=d.parseJSON(a.responseText);v.reject(a.message)},dataType:"JSON"})}}break;case "classes":h.hasOwnProperty("classes")&&h.classes.length?h.classes+=" "+g:h.classes=g;h.classes=d.trim(h.classes);break;case "image_link_classes":h.hasOwnProperty("linkClasses")&&h.linkClasses.length?h.linkClasses+=" "+g:h.linkClasses=g;h.linkClasses=d.trim(h.linkClasses);break;case "white-space":a.getLayoutOption("white-space","prev")!==g&&(h.whiteSpace=g);break;default:-1<d.inArray(k,c.Vars.layout.style_options)&&
(n[k]=g)}});h[m]=c.Vars.preset.layer_class+" "+h[m];this.onChangeData={widthChanged:g,offset:b,width:e,height:f};this.isType(["button"])&&this.clearWH();d.when.apply(d,u).then(function(){a.isType(["html","button"])&&a.api.setFontOptions(n);a.api.setOptions(h)},function(a){c.Functions.showMessage(a,c.Functions.MSG_ERROR_TYPE)})},getOffsets:function(a,b,e){var d=c.Workground.halfHeight,g=c.Workground.halfWidth;a="undefined"===typeof a?this.element.position().left:a;b="undefined"===typeof b?this.element.position().top:
b;var k="undefined"===typeof e?this.element.outerWidth(!0):e,l=this.element.outerHeight(!0),m=l/2,h=k/2,n={hor_align:this.getLayoutOption("hor_align"),vert_align:this.getLayoutOption("vert_align")};"left"===this.getLayoutOption("hor_align")?n.offset_x=a:"center"===this.getLayoutOption("hor_align")?(this.isType("html")&&""===this.getLayoutOption("html_width")&&"normal"===this.getLayoutOption("white-space")&&(this.addZeroLeftPos(),k="undefined"===typeof e?this.element.outerWidth(!0):e,h=k/2,this.removeZeroLeftPos()),
n.offset_x=a+h-g):n.offset_x=c.Workground.width-a-k;"top"===this.getLayoutOption("vert_align")?n.offset_y=b:"middle"===this.getLayoutOption("vert_align")?n.offset_y=b+m-d:n.offset_y=c.Workground.height-b-l;n.offset_x=Math.round(n.offset_x);n.offset_y=Math.round(n.offset_y);return n},updatePosition:function(a){a.offset_x=parseInt(a.offset_x);a.offset_y=parseInt(a.offset_y);var b=c.Workground.halfHeight,e=c.Workground.halfWidth,d=this.element.outerWidth(!0),d=d/2,g={left:"",right:""};"left"===a.hor_align?
g.left=a.offset_x:"center"===a.hor_align?(this.isType("html")&&""===this.getLayoutOption("html_width")&&"normal"===this.getLayoutOption("white-space")&&(this.addZeroLeftPos(),d=this.element.outerWidth(!0),d/=2,this.removeZeroLeftPos()),g.left=e-d+a.offset_x):g.right=a.offset_x;"right"===a.hor_align?this.setLeftAuto():this.setLeftCustom();this.element.css(g);e=this.element.outerHeight(!0);g={};g.top="top"===a.vert_align?a.offset_y:"middle"===a.vert_align?b-e/2+a.offset_y:c.Workground.height-e-a.offset_y;
this.element.css(g)},addZeroLeftPos:function(){this.element.addClass("mpsl-editor-layer-pos")},removeZeroLeftPos:function(){this.element.removeClass("mpsl-editor-layer-pos")},setLeftAuto:function(){this.element.addClass("mpsl-pos-left-auto")},setLeftCustom:function(){this.element.removeClass("mpsl-pos-left-auto")},initEvents:function(){var a=this,b,c,f,g,k;this.handle.on("keydown",function(l){b=parseInt(l.keyCode);16==b&&(a.shiftPressed=!0);if(-1<d.inArray(b,[46,8]))l.preventDefault(),a.workground.remove();
else if(-1<d.inArray(b,[37,38,39,40])){l.preventDefault();"right"===a.getLayoutOption("align").hor?(f="right",g=-1):(f="left",g=1);c={top:parseInt(a.element.css("top"))};c[f]=parseInt(a.element.css(f));k=1;a.shiftPressed&&(g*=10,k*=10);switch(b){case 37:a.element.css(f,c[f]-g);break;case 39:a.element.css(f,c[f]+g);break;case 38:k*=-1;case 40:a.element.css("top",c.top+k)}a.workground.layerControls.formSettings.setOptions(a.getOffsets(),!0)}});this.handle.on("keyup",function(c){b=parseInt(c.keyCode);
16==b&&(a.shiftPressed=!1)})},focusWithoutScrolling:function(){var a=window.scrollX,b=window.scrollY;this.handle.focus();window.scrollTo(a,b);this.workground.sliderWrapper.scrollTop(0)},clearWH:function(){this.element.css({width:"",height:""})}})})(jQuery,MPSL);
(function(d,c){c.HtmlLayer=c.Layer.extend({defaults:{},prepareOptionsForApi:function(a){a=this._super(a);var b={position:{},classes:""};a.hasOwnProperty("type")&&(b.type=a.type);a.hasOwnProperty("text")&&(b.content=a.text);a.hasOwnProperty("classes")&&(b.classes=a.classes);a.hasOwnProperty("html_style")&&(b.classes+=" "+a.html_style);a.hasOwnProperty("html_width")&&(b.width=c.Layer.getByLayout(a.html_width));a.hasOwnProperty("vertical_position")&&("top"===a.vertical_position&&a.hasOwnProperty("top")&&
(b.position.offsetTop=a.top),"bottom"===a.vertical_position&&a.hasOwnProperty("bottom")&&(b.position.offsetBottom=a.bottom));a.hasOwnProperty("horizontal_position")&&("left"===a.horizontal_position&&a.hasOwnProperty("left")&&(b.position.offsetLeft=a.left),"right"===a.horizontal_position&&a.hasOwnProperty("right")&&(b.position.offsetRight=a.right));return b},create:function(a){a=c.HtmlLayer.prepareOptionsForApi(a.options);return c.Core.SliderManager.createLayer("html",a)}},{resizable:!0,resizableOptions:{handles:"e, w",
grid:[1,1]},options:{},setup:function(a,b,c){this._super(a,b,c)},init:function(a,b){this._super(a,b)},prepare:function(){this._super();if(this.options.hasOwnProperty("html_width")&&""!==this.getLayoutOption("html_width")){var a=this.object[0].getBoundingClientRect();this.element.css("width",Math.round(a.width));this.object.css("width","")}},updateSize:function(a){if(""===a)this.element.css({width:"",height:""});else if(null!==a){a=parseFloat(a);var b=this.object.outerWidth(!0)-this.object.width();
this.element.css({width:a+b+"px",height:""})}},resizeStart:function(a,b,c){this._super(a,b,c)}})})(jQuery,MPSL);
(function(d,c){c.ButtonLayer=c.Layer.extend({defaults:{},prepareOptionsForApi:function(a){a=this._super(a);var b={position:{},classes:""};a.hasOwnProperty("type")&&(b.type=a.type);a.hasOwnProperty("button_text")&&(b.title=a.button_text);a.hasOwnProperty("button_link")&&(b.link=a.button_link);a.hasOwnProperty("button_target")&&(b.target=a.button_target);a.hasOwnProperty("classes")&&(b.classes=a.classes);a.hasOwnProperty("button_style")&&(b.classes+=" "+a.button_style);a.hasOwnProperty("vertical_position")&&
("top"===a.vertical_position&&a.hasOwnProperty("top")&&(b.position.offsetTop=a.top),"bottom"===a.vertical_position&&a.hasOwnProperty("bottom")&&(b.position.offsetBottom=a.bottom));a.hasOwnProperty("horizontal_position")&&("left"===a.horizontal_position&&a.hasOwnProperty("left")&&(b.position.offsetLeft=a.left),"right"===a.horizontal_position&&a.hasOwnProperty("right")&&(b.position.offsetRight=a.right));return b},create:function(a){a=c.ButtonLayer.prepareOptionsForApi(a.options);return c.Core.SliderManager.createLayer("button",
a)}},{resizable:!1,init:function(a,b){this._super(a,b)},preventEvents:function(){this._super();this.object.attr("href","javascript:void(0)").attr("disabled","disabled")},afterMakeResizable:function(){this.element.resizable("disable").removeClass("ui-state-disabled")}})})(jQuery,MPSL);
(function(d,c){c.ImageLayer=c.Layer.extend({prepareOptionsForApi:function(a){a=this._super(a);var b={position:{},classes:""};a.hasOwnProperty("classes")&&(b.classes=a.classes);a.hasOwnProperty("type")&&(b.type=a.type);a.hasOwnProperty("width")&&(b.width=a.width);a.hasOwnProperty("vertical_position")&&("top"===a.vertical_position&&a.hasOwnProperty("top")&&(b.position.offsetTop=a.top),"bottom"===a.vertical_position&&a.hasOwnProperty("bottom")&&(b.position.offsetBottom=a.bottom));a.hasOwnProperty("horizontal_position")&&
("left"===a.horizontal_position&&a.hasOwnProperty("left")&&(b.position.offsetLeft=a.left),"right"===a.horizontal_position&&a.hasOwnProperty("right")&&(b.position.offsetRight=a.right));return b},create:function(a){var b=c.ImageLayer.prepareOptionsForApi(a.options);b.src=a.src;return c.Core.SliderManager.createLayer("image",b)}},{image:null,resizable:!0,resizableOptions:{aspectRatio:!0,handles:"se, sw, ne, nw",grid:[1,1]},init:function(a,b){this.presetOwnerObject=this.image=this.object.children();this._super(a,
b)},prepare:function(){this._super();var a=this.object[0].getBoundingClientRect();this.element.css("width",Math.round(a.width));this.addCustomFixClasses()},addCustomFixClasses:function(){this.object.addClass("mpsl-image-layer-child-fix")},updateSize:function(a){if(null!==a){a=parseFloat(a);var b=this.object.outerWidth(!0)-this.object.width(),b=b+(this.image.outerWidth(!0)-this.image.width());this.element.css("width",a+b+"px");this.element.css("height","")}this.object.css("width","100%")}})})(jQuery,
MPSL);
(function(d,c){c.VideoLayer=c.Layer.extend({defaults:{},prepareOptionsForApi:function(a){a=this._super(a);var b={position:{},classes:""};if(a.hasOwnProperty("video_type"))switch(a.video_type){case "youtube":b.type="youtube",a.hasOwnProperty("youtube_src")&&(b.src=a.youtube_src),a.hasOwnProperty("video_youtube_hide_controls")&&(b.controls=!a.video_youtube_hide_controls),a.hasOwnProperty("video_preview_image")&&a.video_preview_length?b.poster=a.video_preview_image:a.hasOwnProperty("youtube_thumbnail")?b.poster=
a.youtube_thumbnail:b.poster=""}a.hasOwnProperty("video_width")&&(b.width=c.Layer.getByLayout(a.video_width));a.hasOwnProperty("video_height")&&(b.height=c.Layer.getByLayout(a.video_height));a.hasOwnProperty("classes")&&(b.classes=a.classes);a.hasOwnProperty("vertical_position")&&("top"===c.Layer.getByLayout(a.vertical_position)&&a.hasOwnProperty("top")&&(b.position.offsetTop=a.top),"bottom"===c.Layer.getByLayout(a.vertical_position)&&a.hasOwnProperty("bottom")&&(b.position.offsetBottom=a.bottom));
a.hasOwnProperty("horizontal_position")&&("left"===c.Layer.getByLayout(a.horizontal_position)&&a.hasOwnProperty("left")&&(b.position.offsetLeft=a.left),"right"===c.Layer.getByLayout(a.horizontal_position)&&a.hasOwnProperty("right")&&(b.position.offsetRight=a.right));return b},create:function(a){a=c.VideoLayer.prepareOptionsForApi(a.options);return c.Core.SliderManager.createLayer(a.type,a)}},{resizable:!0,resizableOptions:{grid:[1,1]},prepare:function(){this._super();var a=this.object[0].getBoundingClientRect();
this.element.css({width:Math.round(a.width),height:Math.round(a.height)});this.addCustomFixClasses()},addCustomFixClasses:function(){this.object.addClass("mpsl-video-layer-child-fix")},resizeStop:function(a,b,c){a=this.object.width();b=this.object.height();c=this.getOffsets();c.video_width=a;c.video_height=b;this.workground.layerControls.formSettings.setOptions(c,!0);this.updateSize(a,b)},resize:function(a,b,c){a.children("video, iframe").width(c.size.width).height(c.size.height)},updateSize:function(a,
b){var c;null!==a&&(a=parseFloat(a),c=this.object.outerWidth(!0)-this.object.width(),this.element.css("width",a+c+"px"));null!==b&&(b=parseFloat(b),c=this.object.outerHeight(!0)-this.object.height(),this.element.css("height",b+c+"px"));this.object.css("width","100%");this.object.css("height","100%")}})})(jQuery,MPSL);
(function(d,c){c.LayerPresetList=can.Control.extend({defaults:{},classPrefix:c.Vars.preset.class_prefix,privateClassPrefix:c.Vars.preset.private_class_prefix,getLastId:function(){return c.Vars.preset.last_id},getNextId:function(){this.incLastId();return c.LayerPresetList.getLastId()},incLastId:function(){c.Vars.preset.last_id++},getLastPrivateId:function(){return c.Vars.preset.last_private_id},getNextPrivateId:function(){c.LayerPresetList.incLastPrivateId();return c.LayerPresetList.getLastPrivateId()},
incLastPrivateId:function(){c.Vars.preset.last_private_id++}},{listContainer:null,workground:null,styleSettings:{},styleEditor:{},init:function(a,b){c.Scope.layerPresetList=this;this.listContainer=a.find(".mpsl-layer-presets-table > tbody");can.bind.call(a,"presetSelect",this.proxy("onPresetSelect"))},onPresetSelect:function(a,b){b&&b.getType()===c.LayerPreset.PRIVATE&&(this.styleEditor.loadPrivateOptions(),b.select(!0))},add:function(a,b,e){e="undefined"===typeof e?c.LayerPreset.CUSTOM:e;var f=d("<tr>").attr("data-name",
a);e===c.LayerPreset.PRIVATE?f.addClass("mpsl-layer-preset-private"):e===c.LayerPreset.DEFAULT&&f.addClass("mpsl-layer-preset-default");var g=d("<td>").addClass("mpsl-layer-preset-label").text(b.settings.label),k=d("<td>").attr("title",c.Vars.lang["delete"]).text("");-1<d.inArray(e,[c.LayerPreset.PRIVATE,c.LayerPreset.DEFAULT])?k.addClass("mpsl-layer-preset-label"):k.addClass("mpsl-layer-preset-remove-handle");f.append(g,k);e===c.LayerPreset.CUSTOM?this.listContainer.children(".mpsl-layer-preset-private, :not(.mpsl-layer-preset-default)").eq(-1).after(f):
this.listContainer.append(f);f=new c.LayerPreset(f,b,{name:a,type:e});f.linkPresetList(this);can.trigger(this.element,"presetAdd",{name:a,label:b.settings.label,preset:f,isPrivate:e===c.LayerPreset.PRIVATE});return f},addNew:function(a){var b=c.LayerPresetList.classPrefix+c.LayerPresetList.getNextId();return this.add(b,c.LayerPreset.getDefaultsCopy(a))},duplicate:function(a,b){b="undefined"===typeof b?this.getSelected():b;if(!b)return!1;var d=b.getOptions({settings:{label:a}},!0),f=c.LayerPresetList.classPrefix+
c.LayerPresetList.getNextId();return this.add(f,d)},select:function(a,b){if("undefined"===typeof a)return!1;b="undefined"===typeof b?!1:b;"string"===typeof a&&(a=this.getByName(a?a:"private"));a||(a=this.getByName("private"));return a?(a.select(b),a.getName()):!1},unselect:function(a){a="undefined"===typeof a?this.getSelected():a;return(a="string"===typeof a&&a?this.getByName(a):a)?(a.unselect(),!0):!1},getSelected:function(){return this.listContainer.children(".layer-preset-control-selected").length?
this.listContainer.children(".layer-preset-control-selected").control():!1},getByName:function(a,b){b="undefined"===typeof b?!1:b;var c=this.listContainer.children('[data-name="'+a+'"]');return c.length?b?c:c.control():!1},linkStyleEditor:function(a){this.styleEditor=a},linkStyleSettings:function(a){this.styleSettings=a},remove:function(a){a.remove()},getStyleMode:function(){return this.styleSettings.getStyleMode()}})})(jQuery,MPSL);
(function(d,c){c.LayerPreset=can.Control.extend({CUSTOM:0,PRIVATE:1,DEFAULT:2,defaults:{},getDefaultsCopy:function(a){var b=d.extend(!0,{},c.Vars.preset.defaults);"undefined"!==typeof a&&(b.settings.label=a);return b},getFontWeightsByFont:function(a){return a?c.Vars.preset.font_list[a].variants:this.getDefaultFontWeights()},getDefaultFontWeights:function(){return c.Vars.preset.default_font_weight_list}},{type:null,name:null,label:null,lableEl:null,removeHandle:null,presetList:{},setup:function(a,
b,e){this._super(a,b);this.name=e.name;this.type=e.type;this.lableEl=a.children(".mpsl-layer-preset-label");c.Functions.disableSelection(this.lableEl);d.extend(!0,this.options,b)},destroy:function(){this.unselect();can.Control.prototype.destroy.call(this)},select:function(a){if(("undefined"===typeof a?0:a)||!this.isSelected())this.element.siblings().removeClass("layer-preset-control-selected"),this.element.addClass("layer-preset-control-selected"),this.render(),can.trigger(this.presetList.element,
"presetControlSelect",[this])},unselect:function(){this.isSelected()&&(this.element.removeClass("layer-preset-control-selected"),c.Scope.styleEditorForm.hide())},isSelected:function(){return this.element.hasClass("layer-preset-control-selected")},getData:function(a){a="undefined"===typeof a?!0:a;var b=d.extend(!0,{},this.options);a&&(b.settings.hover=b.hover.allow_style);return b},getName:function(){return this.name},getType:function(){return this.type},getOption:function(a,b){return this.options[void 0===
b?"style":b][a]},setOption:function(a,b,c){this.options[void 0===c?"style":c][a]=b},getOptions:function(a,b){a="object"===typeof a?a:{};if("undefined"===typeof b?0:b)a=d.extend(!0,{},this.options,a),d.each(["style","hover"],function(b,e){d.each(a[e],function(b){c.Vars.preset.options.hasOwnProperty(b)||delete a[e][b]})});else{var e=this.presetList.getStyleMode();a=d.extend(!0,{},this.options[e],a);d.each(a,function(b){c.Vars.preset.options.hasOwnProperty(b)||delete a[b]})}return a},setOptions:function(a,
b,c){c="undefined"===typeof c?!1:c;("undefined"===typeof b?0:b)?this.options=a:(b=this.presetList.getStyleMode(),this.options[b]=a);this.options.settings.hover=this.options.hover.allow_style;c||this.render()},render:function(){var a=c.Scope.workground.getCurrent();if(a){var b=this.getType()===c.LayerPreset.PRIVATE;this.presetList.styleSettings.preview.update(this.getOptions({},!0),b?a.options.private_preset_class:this.getName(),!0,b)}},getLabel:function(){var a=this.options.settings.label;return a?
a:c.Vars.lang.layer_preset_private_name},updateLabel:function(a){this.options.settings.label=a;this.lableEl.text(a);can.trigger(this.presetList.element,"presetUpdate",{name:this.getName(),label:a,preset:this})},linkPresetList:function(a){this.presetList=a},scrollToElement:function(){this.presetList.element.animate({scrollTop:this.presetList.element.scrollTop()+this.element.position().top-this.presetList.element.position().top-this.presetList.element.height()/2+this.element.height()/2},100)}})})(jQuery,
MPSL);
(function(d,c){c.StyleEditorModeSwitcher=can.Control.extend({mode:"style",NORMAL_MODE:"style",HOVER_MODE:"hover"},{buttons:{},init:function(a){c.Scope.styleModeSwitcher=this;a.buttonset();this.buttons=this.element.children("input")},"> input change":function(a){a=a.data("mode");c.StyleEditorModeSwitcher.mode=a;can.trigger(this,"switch",a)},getMode:function(){return c.StyleEditorModeSwitcher.mode},setMode:function(a){this.buttons.removeAttr("checked");this.element.children('[data-mode="'+a+'"]').click()},isMode:function(a){return a===
this.getMode()}})})(jQuery,MPSL);
(function(d,c){c.LayerStylePreview=can.Control.extend({},{preview:{},bgToggle:{},bgToggleState:!1,stylesWrapper:{},init:function(a,b){c.Scope.layerStylePreview=this;this.preview=a.children(".mpsl-style-editor-preview");this.bgToggle=a.children(".mpsl-style-editor-bg-toggle");this.stylesWrapper=d("#mpsl-preset-styles-wrapper");c.Functions.disableSelection(this.bgToggle);can.trigger(this.bgToggle,"click",this.bgToggleState)},"> .mpsl-style-editor-bg-toggle click":function(a,b,c){(this.bgToggleState=
"undefined"===typeof c?!this.bgToggleState:c)?(this.element.css("background-color","black"),a.css("background-color","white")):(this.element.css("background-color","white"),a.css("background-color","black"))},update:function(a,b,e,f){a="undefined"===typeof a?[]:a;var g;b=a.style.custom_styles;e=a.hover.custom_styles;f={};var k={},l={};delete a.style.allow_style;delete a.style.custom_styles;delete a.hover.allow_style;delete a.hover.custom_styles;d.each(["style","hover"],function(b,e){d.each(a[e],function(b,
f){c.Vars.preset.options[b].isChild?delete a[e][b]:"string"!==typeof f||""===f?delete a[e][b]:(g=c.Vars.preset.options[b].unit,d.isNumeric(f)&&g?a[e][b]=d.trim(f)+g:a[e][b]=d.trim(f),"hover"===e&&-1<d.inArray(b,c.Vars.layout.style_options)&&(a[e][b]+=" !important"))})});d.extend(f,a.style);d.extend(f,this.parseCSS(b));d.extend(l,f);this.stringifyCSS(f);d.extend(k,a.hover);d.extend(k,this.parseCSS(e));"hover"===c.StyleEditorModeSwitcher.mode&&d.extend(l,k);this.stringifyCSS(k);d.each(l,function(a,
b){l[a]=b.replace("!important","").trim()});this.preview.attr("style","");this.preview.css(l);b=this.preview.attr("style");this.preview.attr("style",b)},parseCSS:function(a){a="string"===typeof a?a:"";var b={};a=a.replace(/\/\*.+?\*\//g,"");if(a=d.trim(a))a=a.split(";"),d.each(a,function(c,f){if(f&&(a[c]=f.split(":"),2===a[c].length)){var g=d.trim(a[c][0]),k=d.trim(a[c][1]);g&&k&&(b[g]=k)}});return b},stringifyCSS:function(a){a="object"===typeof a?a:{};var b="";d.each(a,function(a,c){b+=a+":"+c+";"});
return b},reset:function(){this.preview.attr("style","")},removeStyles:function(a){a=d("#"+a);a.length&&a.remove()}})})(jQuery,MPSL);
(function(d,c){var a=c.Vars.layout["default"];c.Layout=can.Control.extend({layouts:c.Vars.layout.list,getLayout:function(){return a},setLayout:function(b){a=b}},{init:function(a){c.Scope.Layout=this},change:function(){this.switchLayout(this.element.val())},switchLayout:function(a){this.constructor.setLayout(a);a=this.getWidth();var d=this.getHeight();c.Scope.workground.resizeWorkground(a,d);c.Core.SliderManager.updateGrid(a,d,this.constructor.getLayout());c.Scope.workground.repaintLayers();c.Scope.layerSettingsForm.reinit()},
getWidth:function(){return c.Vars.layout.list[this.constructor.getLayout()].width},getHeight:function(){return c.Vars.layout.list[this.constructor.getLayout()].height}})})(jQuery,MPSL);jQuery(function(d){window.slidePageController=new MPSL.SlidePageController(d(".mpsl-wrapper"))});
