text: /*! This minified app bundle contains open source software from several third party developers. Please review CREDITS.md in the root directory or LICENSE.md in the current directory for complete licensing, copyright and patent information. This file and the included code may not be redistributed without the attributions listed in LICENSE.md, including associate copyright notices and licensing information. */!function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=484)}({38:function(e,t,i){"use strict";(function(e){t.a=function(t,i){var o=e(window),n=e("#wpadminbar"),a=o.height(),s=t.outerHeight(),l=n.outerHeight(),_=0-s/2+l/2;s>a-l?t.css({top:l+15,bottom:15,marginTop:0,minHeight:0}):t.css({top:"50%",marginTop:_}),t.addClass("et_pb_auto_centerize_modal")}}).call(this,i(5))},484:function(e,t,i){"use strict";i.r(t),function(e,t){var o=i(38),n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=a||{};window.ET_PageBuilder=a,window.wp=window.wp||{},window.et_builder_version="4.6.0",window.et_builder_product_name="Divi";var s=window.et_error_modal_shown,l=!1,d=!1,r=0,p=0,c=0,b="et_pb_templates_",u={},g={},h=[],f={s:!1,r:!1,c:!1};function m(e,t){if(_.isUndefined(t))return e;return e.replace(/<!-- (\d+) -->/g,function(e,i){return t[i]})}function v(){return new Promise(function(t,i){e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_get_layouts_data",postId:et_pb_options.postId,nonce:et_pb_options.library_get_layouts_data_nonce}}).then(function(e){t(C(e,"data",""))})})}var w=v();function y(){var e,t=et_pb_options.product_version;(e=localStorage.getItem("et_forced_localstorage_clear"))||(e=wpCookies.get("et_forced_localstorage_clear")),e!==t&&(localStorage.clear(),wpCookies.set("et_forced_localstorage_clear",t),localStorage.setItem("et_forced_localstorage_clear",t),setTimeout(function(){window.location.reload()},100))}function k(t){var i,o=0,n=new Date,a=n.getYear()+"_"+n.getMonth()+"_"+n.getDate(),r=(et_pb_options.et_builder_module_parent_shortcodes+"|"+et_pb_options.et_builder_module_child_shortcodes).split("|"),u=et_pb_options.product_version,g=et_pb_options.active_plugins.join("|"),h="",f=0,v={missing_modules_array:[]};if((t=!_.isUndefined(t)&&t)||(e('script[src="'+et_pb_options.builder_js_src+'"]').length||e(".et-pb-cache-update").show(),e("body").on("click",".et_builder_increase_memory",function(){var t=e(this);return e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_increase_memory_limit",et_admin_load_nonce:et_pb_options.et_admin_load_nonce},success:function(e){_.isUndefined(e.success)?t.addClass("et_builder_modal_action_button_fail").prop("disabled",!0).text(et_pb_options.memory_limit_not_increased):t.addClass("et_builder_modal_action_button_success").text(et_pb_options.memory_limit_increased)}}),!1}),e("body").on("click",".et_pb_reload_builder",function(){return location.reload(),!1})),function(){if(!$())return!1;if(!_.isUndefined(et_pb_options.force_cache_purge)&&"true"===et_pb_options.force_cache_purge)return!1;var e=localStorage.getItem(b+"settings_date"),t=localStorage.getItem(b+"settings_product_version"),i=localStorage.getItem(b+"settings_active_plugins");if(_.isUndefined(e)||_.isNull(e))return!1;if(_.isUndefined(t)||_.isNull(t))return!1;if(i!==g)return!1;if(a!=e||u!=t)return function(){if(!$())return!1;_.forEach(_.keys(localStorage),function(e){x(e,"et_pb_templates_")&&localStorage.removeItem(e)})}(),!1;return!0}()){if(d)return;for(var w in r){var C=r[w],S=b+C,j=LZString.decompressFromUTF16(localStorage.getItem(S));f++,_.isUndefined(j)||_.isNull(j)||""===j?v.missing_modules_array.push(C):h+=LZString.decompressFromUTF16(localStorage.getItem(S)),!l&&(v.missing_modules_array.length===parseInt(et_pb_options.et_builder_templates_amount)||v.missing_modules_array.length&&r.length===f)&&(l=!0,e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_get_backbone_template",et_post_type:et_pb_options.post_type,et_modules_slugs:JSON.stringify(v),et_admin_load_nonce:et_pb_options.et_admin_load_nonce},success:function(t){var i;l=!1,!_.isUndefined(t.templates)&&t.templates.length&&_.each(t.templates,function(o){i=m(o.template,t.unique);try{localStorage.setItem(b+o.slug,LZString.compressToUTF16(i))}catch(e){y()}e("body").append(i)})}}),v.missing_modules_array=[])}e("body").append(h)}else i=setInterval(function(){if(o===Math.ceil(et_pb_options.et_builder_modules_count/et_pb_options.et_builder_templates_amount))return clearInterval(i),!1;var t;d=!0,p++,t=o*et_pb_options.et_builder_templates_amount,e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_get_backbone_templates",et_post_type:et_pb_options.post_type,et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_templates_start_from:t},error:function(){var t=e("#et-builder-failure-notice-template");s||t.length&&(e(".et_pb_failure_notification_modal").length||($()&&(localStorage.removeItem(b+"settings_date"),localStorage.removeItem(b+"settings_product_version"),localStorage.removeItem(b+"settings_active_plugins")),e("body").addClass("et_pb_stop_scroll").append(t.html())))},success:function(t){var i;for(var o in t.templates){if(i=m(t.templates[o],t.unique),$())try{localStorage.setItem("et_pb_templates_"+o,LZString.compressToUTF16(i))}catch(e){y()}e("body").append(i)}c++,p>0&&p===c&&(d=!1,k())}}),o++},800),function(){if(!$())return!1;try{localStorage.setItem(b+"settings_date",a),localStorage.setItem(b+"settings_product_version",u),localStorage.setItem(b+"settings_active_plugins",g)}catch(e){}}();function $(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}}function C(e,t,i){if(!_.isObject(e))return i;var o=_.reduce(t.split("."),function(e,t){return e?e[t]:void 0},e);return _.isUndefined(o)?i:o}function S(e,t){if(!t)return!0;var i=t.split("."),o=_.first(i);return _.has(e,o)&&S(e[o],_.rest(i).join("."))}function x(e,t){return e.substr(0,t.length)===t}k(),a.isDynamicContent=function(e){if("string"!=typeof e)return!1;var t=new RegExp(/^<p>(.*)<\/p>$/,"i"),i=/^\s+|\s+$/,o=e.replace(i,"");o=(o=o.replace(t,"$1")).replace(i,"");try{if(/^@ET-DC@(.*?)@$/.test(o))return!0;var n=JSON.parse(o);if(void 0!==n.dynamic&&!0===n.dynamic)return!0}catch(e){}return!1},e(document).ready(function(){function i(){e("#et-builder-right-click-controls").remove(),e("#et_pb_layout_right_click_overlay").remove()}function s(t){t.click(function(t){var i=e(this);t.preventDefault(),(m=wp.media.frames.et_pb_file_frame=new wp.media.view.MediaFrame.ETSelect({title:i.data("choose"),library:{type:i.data("type")},button:{text:i.data("update")},multiple:!1})).on("select",function(){var e=m.state().props.get("url"),t=i.siblings(".et-pb-upload-field");t.val(e),t.trigger("change"),c(i)}),m.on("insert",function(){var e=m.state().get("selection").models[0];if(!_.isUndefined(e)){var t=i.siblings(".et-pb-upload-field");t.val(e.get("url")),t.trigger("change"),c(i)}}),m.open()}),t.siblings(".et-pb-upload-field").on("input",function(){c(e(this).siblings(".et-pb-upload-button"))}),t.siblings(".et-pb-upload-field").each(function(){c(e(this).siblings(".et-pb-upload-button"))})}function l(t){t.click(function(i){e(this);var o=t.next(".et-pb-gallery"),n=t.closest(".et-pb-options-tab").find("#et_pb_gallery_orderby");if(i.preventDefault(),"undefined"!=typeof wp&&wp.media&&wp.media.gallery){var a=o.val().length?' ids="'+o.val()+'"':"",s="[gallery"+a+(n.val().length?' orderby="'+n.val()+'"':"")+"]";m=wp.media.frames.et_pb_file_frame=wp.media.gallery.edit(s),a||m.setState("gallery-library"),l(m.$el),m.on("content:render:browse",function(e){l(e.$el)}),m.state("gallery-edit").on("update",function(e){var t=wp.media.gallery.shortcode(e).attrs.named;t.ids&&o.val(t.ids),t.orderby?n.val(t.orderby):n.val("")})}function l(t){setTimeout(function(){t.find(".gallery-settings").find("label.setting").each(function(){e(this).find(".link-to, .columns, .size").length?e(this).remove():e(this).has("input[type=checkbox]").length&&e(this).children("input[type=checkbox]").css("margin","11px 5px")})},10)}})}function d(e){return e.siblings("input").attr("id").replace("et_pb_","").replace("_list","")}function p(t){t.click(function(t){var i=e(this),o=e("#et_pb_src.et-pb-upload-field").val().trim();t.preventDefault(),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_video_get_oembed_thumbnail",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_video_url:o},success:function(t){t.length?e("#et_pb_image_src").val(t).trigger("input"):(i.after('<div class="et-pb-error">'+et_pb_options.video_module_image_error+"</div>"),i.siblings(".et-pb-error").delay(5e3).fadeOut(800))}})})}function c(t){if(!(t.length<1)){var i=t.siblings(".et-pb-upload-field"),o=i.siblings(".et-pb-upload-preview"),n=i.closest(".et-pb-option").find(".et-pb-option-preview"),a=n.length,s=i.val().trim(),l=t.data("type"),d=t.closest(".et_pb_module_settings").attr("data-module_type"),r=t.closest(".et-pb-options-tabs").find("#et_pb_featured_image").val(),p=t.closest(".et-pb-options-tabs").find("#et_pb_featured_placement").val(),c=e("#postimagediv img").attr("src"),b=_.contains(et_pb_options.et_builder_modules_featured_image_background,d)&&"on"===r&&"background"===p,u=i.closest(".et-pb-option-container-inner").attr("data-base_name"),g="background"===u?"":u+"_";if(b?(s=c,n.addClass("et-pb-featured-image-background")):n.removeClass("et-pb-featured-image-background"),"image"===l||"video"===l&&a){if(""===s)return a?void n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove():void(o.length&&o.remove());if(a){n.find(".et-pb-preview-content").remove();var h=t.closest(".et-pb-option-container--background"),f=h.find("input, select"),m=h.attr("data-column-index"),v=["url("+s+")"],w=ke(h.find(".et_pb_background-tab--gradient"),u),y={},k="",C=!1,S=!1;if(w&&(C=!0,v.push(w)),f.each(function(){if(void 0!==e(this).attr("id")){var t=e(this).attr("id").replace("et_pb_",""),i=e(this).val(),o=void 0!==e(this).attr("data-default")?e(this).attr("data-default"):"",n=""!==i&&void 0!==i;void 0!==m&&(t=t.replace("_"+m,"")),y[t]=n?i:o}}),"image"===l){var x={position:"absolute",top:0,right:0,bottom:0,left:0};"on"===y[g+"parallax"]?(x.backgroundImage="url("+s+")",x.backgroundRepeat="no-repeat",x.backgroundSize="cover",x.backgroundPosition="center"):(void 0===y[u+"_position"]&&(y[u+"_position"]=""),"on"===y[u+"_color_gradient_overlays_image"]&&v.reverse(),S=!0,x.backgroundImage=v.join(", "),x.backgroundSize=y[u+"_size"],x.backgroundPosition=y[u+"_position"].replace("_"," "),x.backgroundRepeat=y[u+"_repeat"],x.backgroundBlendMode=y[u+"_blend"],x.backgroundColor=C&&S?"initial":y[u+"_color"]),k=e("<div />",{class:"et-pb-preview-content"}).css(x)}else"video"===l&&(k=e("<video />",{class:"et-pb-preview-content",src:s,loop:!0,controls:!0,height:190}));n.removeClass("et-pb-option-preview--empty").prepend(k)}else o.length||(t.siblings(".description").before('<div class="et-pb-upload-preview"><strong class="et-pb-upload-preview-title">'+et_pb_options.preview_image+'</strong><img src="" width="408" /></div>'),o=i.siblings(".et-pb-upload-preview"));o.find("img").attr("src",s)}}}function b(e){var t=e.closest(".et-pb-option-container"),i=parseInt(t.find(".iris-square-value.ui-draggable").width()),o=parseInt(t.find(".iris-square-value.ui-draggable").css("left"))+i/2,n=parseInt(t.width());""!==e&&o>n-50?t.addClass("on-right-corner"):t.removeClass("on-right-corner")}_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},a.Helpers={},a.Helpers.getSettingValue=function(t){var i,o,n=[],a=t.is("#et_pb_content_main")?"et_pb_content":t.attr("id");if(t.is(":checkbox"))a=t.attr("name"),t.closest(".et-pb-option-container").find('[name="'+a+'"]:checked').each(function(){n.push(e(this).val())}),i=n.join(",");else if(t.is("#et_pb_content_main"))i=(i=t.html()).replace(/\^\^/g,"%22");else if(t.closest(".et-pb-custom-css-option").length)i=""!==(o=t.val())?o.replace(/(?:\r\n|\r|\n)/g,"||").replace(/\\/g,"%92"):"";else if(t.hasClass("et-pb-range-input"))i=fe(t),t.hasClass("et-pb-validate-unit")&&(i=Se(i.toString(),!1,"no_default_unit"));else if(t.hasClass("et-pb-range")){var s=t.siblings(".et-pb-range-input");i=fe(s),s.hasClass("et-pb-validate-unit")&&(i=Se(i.toString(),!1,"no_default_unit"))}else t.hasClass("et-pb-validate-unit")?i=Se(t.val(),!1,""):t.hasClass("et-pb-text-align-select")?t.closest(".et-pb-option-container").find(".et_text_align_active").length&&(i=t.val()):t.is(":checkbox")||(i=t.is("textarea.wp-editor-area")?ee(a):t.val(),t.hasClass("et-pb-range-input")&&"px"===i&&(i=""));return _.isNull(i)&&(i=""),i},a.Helpers.hasValue=function(e){return!_.isUndefined(e)&&""!==e},a.Helpers.isOn=function(e){return!_.isUndefined(e)&&"on"===e},a.Helpers.moduleHasBackground=function(e,t){var i=this,o=_.isUndefined(t)?["color","gradient","image","video"]:t,n=!1;return _.forEach(o,function(t){var o=!1;switch(t){case"color":o=i.hasValue(e.et_pb_background_color);break;case"gradient":o=i.isOn(e.et_pb_use_background_color_gradient);break;case"image":o=i.hasValue(e.et_pb_background_image);break;case"video":var a=i.hasValue(e.et_pb_background_video_mp4),s=i.hasValue(e.et_pb_background_video_webm);o=a||s}o&&(n=!0)}),n},a.Module=Backbone.Model.extend({defaults:{type:"element",_builder_version:et_pb_options.product_version}}),a.SavedTemplate=Backbone.Model.extend({defaults:{title:"template",ID:0,shortcode:"",is_global:"false",layout_type:"",module_type:"",categories:[],unsynced_options:[]}}),a.History=Backbone.Model.extend({defaults:{timestamp:_.now(),shortcode:"",current_active_history:!1,verb:"did",noun:"something"},max_history_limit:100,validate:function(e,t){t.collection.length;var i=t.collection.findWhere({current_active_history:!0}),o=e.shortcode,n=_.isUndefined(i)?t.collection.at(t.collection.length-1):i;if(o===(!_.isUndefined(n)&&n.get("shortcode")))return"duplicate";T.enable_history=!1;var a=t.collection.models.length-(this.max_history_limit-1);if(a>0)for(var s=1;s<=a;s++)t.collection.shift()}}),a.Layout=Backbone.Model.extend({defaults:{moduleNumber:0,forceRemove:!1,modules:e.parseJSON(et_pb_options.et_builder_modules),views:[]},initialize:function(){_.each(this.get("modules"),function(e){e.title=e.title.replace(/%%/g,'"'),e.title=e.title.replace(/\|\|/g,"'")})},addView:function(e,t){var i=this.get("views");i[e]=t,this.set({views:i})},getView:function(e){return this.get("views")[e]},getChildViews:function(e){var t=this.get("views"),i={};return _.each(t,function(t,o){void 0!==t&&t.model.attributes.parent===e&&(i[o]=t)}),i},getChildrenViews:function(e){var t,i=this,o=i.get("views"),n={};return _.each(o,function(o,a){void 0!==o&&o.model.attributes.parent===e&&(t=i.getChildrenViews(o.model.attributes.cid),_.isEmpty(t)||_.extend(n,t),n[a]=o)}),n},getParentViews:function(e){for(var t=this.getView(e),i={};!_.isUndefined(t);)i[t.model.attributes.cid]=t,t=this.getView(t.model.attributes.parent);return i},getSectionView:function(e){var t,i=this.getParentViews(e);return t=_.filter(i,function(e){return"section"===e.model.attributes.type}),!_.isUndefined(t[0])&&t[0]},setNewParentID:function(e,t){var i=this.get("views");i[e].model.attributes.parent=t,this.set({views:i})},removeView:function(e){var t=this.get("views"),i={};_.each(t,function(t,o){o!=e&&(i[o]=t)}),this.set({views:i})},generateNewId:function(){var e=this.get("moduleNumber")+1;return this.set({moduleNumber:e}),e},generateTemplateName:function(t){return-1!==e.inArray(t,["row","row_inner","section","column","column_inner"])&&(t="et_pb_"+t),"#et-builder-"+t+"-module-template"},getModuleOptionsNames:function(e){var t=this.get("modules");return this.addAdminLabel(_.findWhere(t,{label:e}).options)},getNumberOf:function(e,t){var i=this.get("views"),o=0;return _.each(i,function(i){if(void 0!==i){var n=i.model.attributes.type;i.model.attributes.parent!==t||n!==e&&n!==e+"_inner"||o++}}),o},getNumberOfModules:function(e){var t=this.get("views"),i=0;return _.each(t,function(t){void 0!==t&&t.model.attributes.type===e&&i++}),i},getTitleByShortcodeTag:function(e){var t=this.get("modules"),i=_.findWhere(t,{label:e});return _.isUndefined(i)?e:i.title},getDefaultAdminLabel:function(t){return e.inArray(t,["section","row","column","row_inner","column_inner"])>-1?void 0!==et_pb_options.noun[t]?et_pb_options.noun[t]:t:this.getTitleByShortcodeTag(t)},isModuleFullwidth:function(e){var t=this.get("modules");return"on"===_.findWhere(t,{label:e}).fullwidth_only},isChildrenLocked:function(e){var t=this.getChildrenViews(e),i=!1;return _.each(t,function(e){"on"!==e.model.get("et_pb_locked")&&"on"!==e.model.get("et_pb_parent_locked")||(i=!0)}),i},addAdminLabel:function(e){return _.union(e,["admin_label"])},removeGlobalAttributes:function(e,t){var i=this,o=(t=!_.isUndefined(t)&&t,_.isUndefined(e.model.attributes.global_parent_cid)?e.model.attributes.cid:e.model.attributes.global_parent_cid),n=this.getView(o),a=this.getChildrenViews(o);this.is_global(n.model)&&(t&&n.model.set("et_pb_temp_global_module",n.model.get("et_pb_global_module")),n.model.unset("et_pb_global_module")),_.each(a,function(e){i.is_global_children(e.model)&&(t&&e.model.set("et_pb_temp_global_parent",e.model.get("et_pb_global_parent")),e.model.unset("et_pb_global_parent")),i.has_global_parent_cid(e.model)&&(t&&e.model.set("et_pb_temp_global_parent_cid",e.model.get("global_parent_cid")),e.model.unset("global_parent_cid"))})},removeTemporaryGlobalAttributes:function(e,t){var i=this,o=(t=!_.isUndefined(t)&&t,(_.isUndefined(e.model.attributes.et_pb_temp_global_module)?$.findWhere({et_pb_temp_global_module:e.model.attributes.et_pb_temp_global_parent}):e.model).attributes.cid),n=j.getView(o),a=j.getChildrenViews(o);this.is_temp_global(n.model)&&(t&&n.model.set("et_pb_global_module",n.model.get("et_pb_temp_global_module")),n.model.unset("et_pb_temp_global_module")),_.each(a,function(e){i.is_temp_global_children(e.model)&&(t&&e.model.set("et_pb_global_parent",e.model.get("et_pb_temp_global_parent")),e.model.unset("et_pb_temp_global_parent")),i.has_temp_global_parent_cid(e.model)&&(t&&e.model.set("global_parent_cid",e.model.get("et_pb_temp_global_parent_cid")),e.model.unset("et_pb_temp_global_parent_cid"))}),t&&Ie(o)},is_app:function(e){return"app"===e.attributes.type},is_global:function(e){return!this.is_app(e)&&!(!e.has("et_pb_global_module")||""===e.get("et_pb_global_module"))},is_global_children:function(e){return!this.is_app(e)&&!(!e.has("et_pb_global_parent")||""===e.get("et_pb_global_parent"))},has_global_parent_cid:function(e){return!(!e.has("global_parent_cid")||""===e.get("global_parent_cid"))},is_temp_global:function(e){return!(!e.has("et_pb_temp_global_module")||""===e.get("et_pb_temp_global_module"))},is_temp_global_children:function(e){return!(!e.has("et_pb_temp_global_parent")||""===e.get("et_pb_temp_global_parent"))},has_temp_global_parent_cid:function(e){return!(!e.has("et_pb_temp_global_parent_cid")||""===e.get("et_pb_temp_global_parent_cid"))},changeColumnStructure:function(t,i,o,n){var a=i.layout.split(","),s=i.specialty_columns,l=i.layout_specialty,d=_.size(a),r=t.options.view,p=Pe(t);if(i.is_structure_change){var c=j.getChildViews(t.model.get("cid")),b=[],u=0;_.each(c,function(e){b[u]=e.model.get("cid"),u+=1})}if(_.each(a,function(e,i){var o=d==i+1?"true":"false",n={type:"column",cid:j.generateNewId(),parent:t.model.get("cid"),layout:e,view:r};void 0!==t.model.get("et_pb_global_parent")&&""!==t.model.get("et_pb_global_parent")&&(n.et_pb_global_parent=t.model.get("et_pb_global_parent"),n.global_parent_cid=t.model.get("global_parent_cid")),void 0!==l[i]&&"1"===l[i]&&(n.layout_specialty=l[i],n.specialty_columns=parseInt(s)),void 0!==t.model.get("specialty_row")&&(t.model.set("module_type","row_inner",{silent:!0}),t.model.set("type","row_inner",{silent:!0})),t.collection.add([n],{update_shortcodes:o})}),i.is_structure_change){var g=[];c=j.getChildViews(t.model.get("cid")),u=0,_.each(c,function(e){g[u]=e.model.get("cid"),u+=1}),g.splice(0,b.length);for(var h=0;h<b.length;h++){var f,m=b.length>g.length&&h>g.length-1,v=b[h],w=m?g[g.length-1]:g[h],k=j.getView(v).$el.html(),C=j.getChildViews(v),S="";j.getView(v).model.destroy(),j.getView(v).remove(),j.removeView(v),f=e('.et-pb-column[data-cid="'+w+'"]'),m?(f.find(".et-pb-insert-module").remove(),S=f.html(),f.html(S+k)):f.html(k),_.each(C,function(e){e.model.set("parent",w,{silent:!0})})}T.allowHistorySaving("edited","column")}(void 0!==t.model.get("template_type")&&"section"===t.model.get("template_type")&&"on"===t.model.get("et_pb_specialty")||!o)&&Ue(),void 0!==t.model.get("et_pb_template_type")&&"row"===t.model.get("et_pb_template_type")&&De("_et_pb_row_layout",i.layout),void 0!==p&&""!==p&&Ie(p),n||T.allowHistorySaving("added","column"),y.trigger("et-add:columns")}}),a.Modules=Backbone.Collection.extend({model:a.Module}),a.SavedTemplates=Backbone.Collection.extend({model:a.SavedTemplate}),a.Histories=Backbone.Collection.extend({model:a.History}),a.TemplatesView=window.wp.Backbone.View.extend({className:"et_pb_saved_layouts_list",tagName:"ul",render:function(){var t="",i=void 0===this.options.category?"all":this.options.category;return this.collection.each(function(o){if("all"===i||-1!==e.inArray(i,o.get("categories"))){var n=new a.SingleTemplateView({model:o});this.$el.append(n.el),t=void 0!==n.model.get("is_global")&&"global"===n.model.get("is_global")?"global":""}},this),"global"===t&&this.$el.addClass("et_pb_global"),this}}),a.SingleTemplateView=window.wp.Backbone.View.extend({tagName:"li",template:_.template(e("#et-builder-saved-entry").html()),events:{click:"insertSection"},initialize:function(){this.render()},render:function(){this.$el.html(this.template(this.model.toJSON())),void 0!==this.model.get("module_type")&&""!==this.model.get("module_type")&&"module"===this.model.get("layout_type")&&this.$el.addClass(this.model.get("module_type"))},insertSection:function(t){var i=e(t.target),o=void 0!==i.closest(".et_pb_modal_settings").data("parent_cid")?i.closest(".et_pb_modal_settings").data("parent_cid"):"",n=void 0!==e(".et-pb-settings-heading").data("current_row")?e(".et-pb-settings-heading").data("current_row"):"",a="global"===this.model.get("is_global")?this.model.get("ID"):"",s=void 0!==e(".et-pb-saved-modules-switcher").data("specialty_columns")?"on":"off",l=this.model.get("shortcode"),_=this.model.get("unsynced_options"),d=!1,r="row"===this.model.get("layout_type")?n:o,p=j.getView(r),c="row_inner"===this.options.model.get("layout_type")?"saved_row":"saved_"+this.options.model.get("layout_type"),b=i.closest(".et_pb_modal_settings_container"),u=Pe(p);"on"===s&&(r=p.model.get("parent"),p=j.getView(r)),"section"!==this.model.get("layout_type")&&""!==u&&(d=!0,a=""),T.allowHistorySaving("added",c),t.preventDefault(),l=T.codeModuleContentPrep(l),void 0!==window.switchEditors&&(l=qe(window.switchEditors.wpautop(l))),l=T.codeModuleContentUnPrep(l),T.createLayoutFromContent(l,o,"",{ignore_template_tag:"ignore_template",current_row_cid:n,global_id:a,after_section:o,is_reinit:"reinit",unsynced_options:_}),Ue(),!0===d&&Ie(u),b.length&&b.find(".et-pb-modal-close").click()}}),a.TemplatesModal=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-load_layout-template").html()),events:{"click .et-pb-options-tabs-links li a":"switchTab"},render:function(){return this.$el.html(this.template({display_switcher:"off"})),this.$el.addClass("et_pb_modal_no_tabs"),this},switchTab:function(t){var i=e(t.currentTarget).parent();t.preventDefault(),Ee(i,"section","")}}),a.SectionView=window.wp.Backbone.View.extend({className:"et_pb_section",template:_.template(e("#et-builder-section-template").html()),events:{"click .et-pb-settings-section":"showSettings","click .et-pb-clone-section":"cloneSection","click .et-pb-remove-section":"removeSection","click .et-pb-section-add-main":"addSection","click .et-pb-section-add-fullwidth":"addFullwidthSection","click .et-pb-section-add-specialty":"addSpecialtySection","click .et-pb-section-add-saved":"addSavedSection","click .et-pb-expand":"expandSection","click .et-pb-insert-row":"addFirstRow","contextmenu .et-pb-section-add":"showRightClickOptions","click.et_pb_section > .et-pb-controls .et-pb-unlock":"unlockSection","contextmenu.et_pb_section > .et-pb-controls":"showRightClickOptions","contextmenu.et_pb_row > .et-pb-right-click-trigger-overlay":"showRightClickOptions","click.et_pb_section > .et-pb-controls":"hideRightClickOptions","click.et_pb_row > .et-pb-right-click-trigger-overlay":"hideRightClickOptions","click > .et-pb-locked-overlay":"showRightClickOptions","contextmenu > .et-pb-locked-overlay":"showRightClickOptions",click:"setABTesting"},initialize:function(){this.child_views=[],this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass)},render:function(){return this.$el.html(this.template(this.model.toJSON())),"on"===this.model.get("et_pb_specialty")&&(this.$el.addClass("et_pb_section_specialty"),"true"===this.model.get("et_pb_specialty_placeholder")&&this.$el.addClass("et_pb_section_placeholder")),"on"!==this.model.get("et_pb_specialty")&&"on"!==this.model.get("et_pb_fullwidth")||this.$el.find(".et-pb-insert-row").remove(),(void 0!==this.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"section"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")&&this.$el.addClass("et_pb_disabled"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&this.$el.addClass("et_pb_locked"),void 0!==this.model.get("et_pb_collapsed")&&"on"===this.model.get("et_pb_collapsed")&&this.$el.addClass("et_pb_collapsed"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),_.isUndefined(this.model.get("et_pb_temp_global_module"))||this.$el.addClass("et_pb_global_temp"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"section")||this.$el.addClass("et_pb_ab_no_permission")),this.makeRowsSortable(),this},showSettings:function(t){var i,o,n=this,s=void 0!==t?e(t.currentTarget):"",l={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),!this.isSectionLocked()&&!T.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"section")){if(""!==s&&s.closest(".et_pb_section_specialty").length){var _=s.closest(".et_pb_section_specialty").find(".et-pb-section-content > .et-pb-column"),d="";_.length&&_.each(function(){d+=""===d?"1_1":",1_1"}),l.model.attributes.columns_layout=d}if(!1===(o=(i=new a.ModalView(l)).render()))return k(!0),setTimeout(function(){n.showSettings()},500),void y.trigger("et-pb-loading:started");y.trigger("et-pb-loading:ended"),e("body").append(o.el),(void 0!==i.model.get("et_pb_global_module")&&""!==i.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"section"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal"),void 0!==this.model.get("et_pb_specialty")&&"on"===this.model.get("et_pb_specialty")&&e(".et_pb_modal_settings_container").addClass("et_pb_specialty_section_settings"),Re()}else J.alert("has_no_permission")},addSection:function(e){var t=j.generateNewId();e.preventDefault(),i(),T.isLoading||J.is_selecting()||(T.allowHistorySaving("added","section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"off",et_pb_specialty:"off",cid:t,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addFullwidthSection:function(e){var t=j.generateNewId();e.preventDefault(),i(),T.isLoading||J.is_selecting()||(T.allowHistorySaving("added","fullwidth_section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"on",et_pb_specialty:"off",cid:t,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addSpecialtySection:function(t){var o=j.generateNewId(),n=e(t.target),a=void 0!==n&&void 0!==n.data("is_template")?"section":"";t.preventDefault(),i(),T.isLoading||J.is_selecting()||(T.allowHistorySaving("added","specialty_section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"off",et_pb_specialty:"on",cid:o,template_type:a,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addSavedSection:function(t){var o={attributes:{"data-open_view":"saved_templates","data-parent_cid":this.model.get("cid")},view:this},n=new a.ModalView(o);i(),T.isLoading||J.is_selecting()||(e("body").append(n.render().el),Ae("include_global","","section",e(".et-pb-saved-modules-tab"),"regular",0,"all"),t.preventDefault())},expandSection:function(e){e.preventDefault(),this.$el.closest(".et_pb_section").removeClass("et_pb_collapsed"),this.options.model.attributes.et_pb_collapsed="off",J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(this.model.get("cid")),T.allowHistorySaving("expanded","section"),T.saveAsShortcode()},unlockSection:function(e){if(e.preventDefault(),!T.isLoading&&!J.is_selecting()){var t,i=this,o=i.$el.closest(".et_pb_section");Ne().done(function(e){!0===e?(o.removeClass("et_pb_locked"),i.options.model.attributes.et_pb_locked="off",t=j.getChildrenViews(i.model.get("cid")),_.each(t,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})}),T.allowHistorySaving("unlocked","section"),T.saveAsShortcode()):alert(et_pb_options.locked_section_permission_alert)})}},addFirstRow:function(){if(!T.isLoading){var e=j.generateNewId(),t=void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module")?this.model.get("et_pb_global_module"):"",i=""!==t?this.model.get("cid"):"";this.collection.add([{type:"row",module_type:"row",cid:e,parent:this.model.get("cid"),view:this,et_pb_global_parent:t,global_parent_cid:i,admin_label:et_pb_options.noun.row}]),j.getView(e).displayColumnsOptions()}},addRow:function(e){if(!T.isLoading){var t=j.generateNewId(),i=void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module")?this.model.get("et_pb_global_module"):"",o=""!==i?this.model.get("cid"):"";this.collection.add([{type:"row",module_type:"row",cid:t,parent:this.model.get("cid"),view:this,appendAfter:e,et_pb_global_parent:i,global_parent_cid:o,admin_label:et_pb_options.noun.row}]),j.getView(t).displayColumnsOptions()}},cloneSection:function(e){if(e.preventDefault(),!this.isSectionLocked()&&!T.isLoading&&!J.is_selecting()){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"section"))return void J.alert("has_no_permission");if(J.has_goal(this.model)&&!J.is_subject(this.model))return void J.alert("cannot_clone_section_has_goal")}this.$el.clone();var t,i={model:this.model,view:this.$el,view_event:e};t=new a.RightClickOptionsView(i,!0),T.allowHistorySaving("cloned","section"),t.copy(e),t.pasteAfter(e)}},makeRowsSortable:function(){var t=this,o="on"!==t.model.get("et_pb_fullwidth")?".et-pb-section-content":".et_pb_fullwidth_sortable_area",n=":not(.et_pb_locked) > "+o;"on"!==t.model.get("et_pb_specialty")&&(J.is_active()&&!J.is_user_has_permission(this.model.get("cid"),"section")||t.$el.find(o).sortable({connectWith:n,delay:100,cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-row-add, .et-pb-insert-module, .et-pb-insert-column, .et-pb-insert-row, .et_pb_locked, .et-pb-disable-sort",update:function(i,n){var a=t.$el.find(o);if(T.isLoading)a.sortable("cancel");else{if(J.is_active()){if(!J.is_user_has_permission(e(n.item).children(".et-pb-row-content").attr("data-cid"),"row"))return J.alert("has_no_permission"),a.sortable("cancel"),void Ue();var s=e(n.item),l=_.isEmpty(e(n.sender))?e(i.target).parents(".et_pb_section"):e(n.sender).parents(".et_pb_section"),d=_.isEmpty(e(n.sender))?e(i.toElement).parents(".et_pb_section"):e(i.target).parents(".et_pb_section"),r=s.hasClass("et_pb_ab_subject"),p=s.hasClass("et_pb_ab_goal"),c=s.find(".et_pb_ab_subject").length,b=s.find(".et_pb_ab_goal").length,u=l.closest(".et_pb_ab_subject").length,g=d.closest(".et_pb_ab_subject").length,h=d.closest(".et_pb_ab_goal").length;if(p&&!r&&g)return J.alert("cannot_move_goal_into_subject"),a.sortable("cancel"),void Ue();if(b&&g)return J.alert("cannot_move_goal_into_subject"),a.sortable("cancel"),void Ue();if(r&&!p&&h)return J.alert("cannot_move_subject_into_goal"),a.sortable("cancel"),void Ue();if(c&&h)return J.alert("cannot_move_subject_into_goal"),a.sortable("cancel"),void Ue();p&&u&&(J.alert("cannot_move_row_goal_out_from_subject"),a.sortable("cancel"),Ue())}if(!e(n.item).closest(i.target).length)return e(i.target).find(".et_pb_row").length||(e(this).sortable("cancel"),alert(et_pb_options.section_only_row_dragged_away)),void(e(n.item).closest(".et-pb-disable-sort").length&&e(i.target).sortable("cancel"));var f=e(n.item).find(".et-pb-row-content").data("cid"),m=t.collection.find(function(e){return e.get("cid")==f});if(e(n.item).closest(".et_pb_section.et_pb_global").length&&e(n.item).hasClass("et_pb_global"))e(n.sender).sortable("cancel"),alert(et_pb_options.global_row_alert);else if((e(n.item).closest(".et_pb_section.et_pb_global").length||e(n.sender).closest(".et_pb_section.et_pb_global").length)&&""===et_pb_options.template_post_id){var v,w,k;if((w=e(n.sender).closest(".et_pb_section.et_pb_global"))===(k=e(n.item).closest(".et_pb_section.et_pb_global")))Ie(v=m.get("global_parent_cid")),Ue();else{var C=w;0!==k.length||(_.isUndefined(m.get("et_pb_global_parent"))||""===m.get("et_pb_global_parent"))&&_.isUndefined(m.get("global_parent_cid"))||(m.unset("et_pb_global_parent"),m.unset("global_parent_cid"),j.removeGlobalAttributes(j.getView(m.get("cid"))));for(var S=1;S<=2;S++)void 0!==(v=C.find(".et-pb-section-content").data("cid"))&&""!==v&&(Ie(v),Ue()),C=k}}j.setNewParentID(n.item.find(".et-pb-row-content").data("cid"),t.model.attributes.cid),T.allowHistorySaving("moved","row"),y.trigger("et-sortable:update");var x=parseInt(e(this).attr("data-cid")),V=0;e(this).find(".et-pb-row-content").each(function(){V++;var t=parseInt(e(this).data("cid")),i=x+V;$.findWhere({cid:t}).set({layout_index:i})}),$.comparator="layout_index",$.sort()}},start:function(t,o){if(i(),t.altKey){var n=j.getView(e(o.item).children(".et-pb-row-content").data("cid")),s={model:n.model,view:n.$el,view_event:t},l=new a.RightClickOptionsView(s,!0);l.copy(t,!0),l.pasteAfter(t,void 0,void 0,void 0,!0,!0),T.allowHistorySaving("cloned","row")}}}))},addChildView:function(e){this.child_views.push(e)},removeChildViews:function(){var e=j.getChildViews(this.model.attributes.cid);_.each(e,function(e){void 0!==e.model&&e.model.destroy(),e.remove()})},removeSection:function(e,t){var i,o=!1;if(e&&e.preventDefault(),!this.isSectionLocked()&&!j.isChildrenLocked(this.model.get("cid"))&&(!T.isLoading||!_.isUndefined(t)||j.get("forceRemove"))&&(!J.is_selecting()||!_.isUndefined(t)||j.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"section"))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return;if(J.has_goal(this.model)&&!J.is_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return void J.alert("cannot_remove_section_has_goal");if(J.has_unremovable_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return void J.alert("cannot_remove_section_has_unremovable_subject")}"on"===this.model.get("et_pb_fullwidth")?this.removeChildViews():(i=j.getChildViews(this.model.get("cid")),_.each(i,function(e){"column"===e.model.get("type")?e.removeColumn():e.removeRow(!1,!0)})),j.get("forceRemove")||"on"!==this.model.get("et_pb_specialty")&&"on"!==this.model.get("et_pb_fullwidth")||1!==j.getNumberOfModules("section")||(o=!0),(j.get("forceRemove")||o||j.getNumberOfModules("section")>1)&&(this.model.destroy(),j.removeView(this.model.get("cid")),this.remove()),o?T.removeAllSections(!0):(_.isUndefined(t)?T.allowHistorySaving("removed","section"):T.allowHistorySaving("cleared","layout"),e&&y.trigger("et-module:removed"),J.update())}},isSectionLocked:function(){return"on"===this.model.get("et_pb_locked")},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},renameModule:function(){this.$(".et-pb-section-title").html(this.model.get("admin_label"))},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.RowView=window.wp.Backbone.View.extend({className:"et_pb_row",template:_.template(e("#et-builder-row-template").html()),events:{"click .et-pb-settings-row":"showSettings","click .et-pb-insert-column":"displayColumnsOptions","click .et-pb-clone-row":"cloneRow","click .et-pb-row-add":"addNewRow","click .et-pb-remove-row":"removeRow","click .et-pb-change-structure":"changeStructure","click .et-pb-expand":"expandRow","contextmenu .et-pb-row-add":"showRightClickOptions","click.et_pb_row > .et-pb-controls .et-pb-unlock":"unlockRow","contextmenu.et_pb_row > .et-pb-controls":"showRightClickOptions","contextmenu.et_pb_row > .et-pb-right-click-trigger-overlay":"showRightClickOptions","contextmenu .et-pb-column":"showRightClickOptions","click.et_pb_row > .et-pb-controls":"hideRightClickOptions","click.et_pb_row > .et-pb-right-click-trigger-overlay":"hideRightClickOptions","click > .et-pb-locked-overlay":"showRightClickOptions","contextmenu > .et-pb-locked-overlay":"showRightClickOptions",click:"setABTesting"},initialize:function(){this.listenTo(y,"et-add:columns",this.toggleInsertColumnButton),this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass)},render:function(){var e=j.getParentViews(this.model.get("parent"));return void 0!==this.model.get("view")&&void 0!==this.model.get("view").model.get("layout_specialty")&&this.model.set("specialty_row","1",{silent:!0}),this.$el.html(this.template(this.model.toJSON())),(void 0!==this.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"row"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")&&this.$el.addClass("et_pb_disabled"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&(this.$el.addClass("et_pb_locked"),_.each(e,function(e){e.$el.addClass("et_pb_children_locked")})),void 0!==this.model.get("et_pb_parent_locked")&&"on"===this.model.get("et_pb_parent_locked")&&this.$el.addClass("et_pb_parent_locked"),void 0!==this.model.get("et_pb_collapsed")&&"on"===this.model.get("et_pb_collapsed")&&this.$el.addClass("et_pb_collapsed"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),j.is_temp_global(this.model)&&this.$el.addClass("et_pb_global_temp"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"row")||this.$el.addClass("et_pb_ab_no_permission")),this},showSettings:function(t){var i,o,n=this,s={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),!this.isRowLocked()&&!T.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"row")){if(!1===(o=(i=new a.ModalView(s)).render()))return k(!0),setTimeout(function(){n.showSettings()},500),void y.trigger("et-pb-loading:started");y.trigger("et-pb-loading:ended"),e("body").append(o.el),(void 0!==i.model.get("et_pb_global_module")&&""!==i.model.get("et_pb_global_module")||j.getView(i.model.get("cid")).$el.closest(".et_pb_global").length||void 0!==this.model.get("et_pb_template_type")&&"row"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal")}else J.alert("has_no_permission")},displayColumnsOptions:function(t){if(t&&t.preventDefault(),!this.isRowLocked()&&!T.isLoading&&!J.is_selecting()){var i;this.model.set("open_view","column_settings",{silent:!0}),i=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"column_settings"},view:this}),e("body").append(i.render().el),this.toggleInsertColumnButton()}},changeStructure:function(t){t.preventDefault();var i;this.isRowLocked()||T.isLoading||J.is_selecting()||(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"row")?(this.model.set("change_structure","true",{silent:!0}),this.model.set("open_view","column_settings",{silent:!0}),a.Events=y,i=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"column_settings"},view:this}),e("body").append(i.render().el)):J.alert("has_no_permission"))},expandRow:function(e){e.preventDefault(),this.$el.closest(".et_pb_row").removeClass("et_pb_collapsed"),this.options.model.attributes.et_pb_collapsed="off",J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(this.model.get("cid")),T.allowHistorySaving("expanded","row"),T.saveAsShortcode()},unlockRow:function(e){if(e.preventDefault(),!T.isLoading&&!J.is_selecting()){var t,i,o=this,n=o.$el.closest(".et_pb_row");Ne().done(function(e){!0===e?(n.removeClass("et_pb_locked"),o.options.model.attributes.et_pb_locked="off",t=j.getChildrenViews(o.model.get("cid")),_.each(t,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})}),i=j.getParentViews(o.model.get("parent")),_.each(i,function(e,t){j.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")}),T.allowHistorySaving("unlocked","row"),T.saveAsShortcode()):alert(et_pb_options.locked_row_permission_alert)})}},toggleInsertColumnButton:function(){if(void 0!==this.model){var e,t=this.model.get("cid");e=this.collection.find(function(e){return("column"===e.get("type")||"column_inner"===e.get("type"))&&e.get("parent")===t}),_.isUndefined(e)||(this.$(".et-pb-insert-column").hide(),this.$(".et-pb-change-structure").show())}},addNewRow:function(t){var o=this.$el.closest(".et-pb-section-content"),n=e(t.currentTarget),a=n.closest(".et-pb-column-specialty").length?n.closest(".et-pb-column-specialty").data("cid"):o.data("cid"),s=j.getView(a),l="";t.preventDefault(),T.isLoading||(i(),"on"!==this.model.get("et_pb_parent_locked")&&(this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===s.model.get("et_pb_template_type")&&(l=Pe(this)),!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"add_row")?(T.allowHistorySaving("added","row"),s.addRow(this.$el),""!==l&&Ie(l)):J.alert("has_no_permission")))},cloneRow:function(e){var t,i="",o=j.getView(this.model.get("parent")),n={model:this.model,view:this.$el,view_event:e};if(e.preventDefault(),!this.isRowLocked()&&!T.isLoading&&!J.is_selecting()){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid")))return void J.alert("has_no_permission");if(J.has_goal(this.model)&&!J.is_subject(this.model))return void J.alert("cannot_clone_row_has_goal")}this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===o.model.get("et_pb_template_type")&&(i=Pe(this)),t=new a.RightClickOptionsView(n,!0),T.allowHistorySaving("cloned","row"),t.copy(e),t.pasteAfter(e),""!==i&&Ie(i)}},removeRow:function(e,t){var i,o="",n=j.getView(this.model.get("parent"));if(!this.isRowLocked()&&!j.isChildrenLocked(this.model.get("cid"))&&!T.isLoading&&(!J.is_selecting()||!_.isUndefined(t)||j.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid")))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return;if(J.has_goal(this.model)&&!J.is_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return void J.alert("cannot_remove_row_has_goal");if(J.has_unremovable_subject(this.model)&&_.isUndefined(t)&&!j.get("forceRemove"))return void J.alert("cannot_remove_row_has_unremovable_subject")}e&&(e.preventDefault(),this.$el.closest(".et-pb-column-specialty").length&&e.stopPropagation(),this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===n.model.get("et_pb_template_type")&&(o=Pe(this))),i=j.getChildViews(this.model.get("cid")),_.each(i,function(e){e.removeColumn()}),j.get("forceRemove")||j.getNumberOf("row",this.model.get("parent"))>1?(this.model.destroy(),j.removeView(this.model.get("cid")),this.remove()):(this.$(".et-pb-insert-column").show(),this.$(".et-pb-change-structure").hide(),Ue()),T.allowHistorySaving("removed","row"),e&&y.trigger("et-module:removed"),""!==o&&Ie(o),J.update()}},isRowLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},showRightClickOptions:function(t){t.preventDefault();var i,o=e(t.target);o.closest(".et-pb-insert-module").length||o.closest(".et-pb-insert-row").length||o.hasClass("et_pb_module_block")||o.closest(".et_pb_module_block").length||(i={model:this.model,view:this.$el,view_event:t},new a.RightClickOptionsView(i))},hideRightClickOptions:function(e){e.preventDefault(),i()},renameModule:function(){this.$(".et-pb-row-title").html(this.model.get("admin_label"))},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.ModalView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings_container",template:_.template(e("#et-builder-modal-template").html()),events:{"click .et-pb-modal-save":"saveSettings","click .et-pb-modal-preview-template":"preview","click .et-pb-preview-mobile":"resizePreviewScreen","click .et-pb-preview-tablet":"resizePreviewScreen","click .et-pb-preview-desktop":"resizePreviewScreen","click .et-pb-modal-close":"closeModal","click .et-pb-modal-save-template":"saveTemplate","change #et_pb_select_category":"applyFilter"},initialize:function(e){this.listenTo(y,"et-add:columns",this.removeView),this.listenTo(y,"et-new_module:show_settings",this.removeView),this.listenTo(y,"et-saved_layout:loaded",this.removeView),this.options=e},render:function(){var t,i={model:this.model,collection:this.collection,view:this.options.view},o=!1;if(this.$el.attr("tabindex",0),void 0===this.model||void 0===this.model.get("view")||"row_inner"!==this.model.get("module_type")&&"row"!==this.model.get("module_type")||this.model.get("parent")===this.model.get("view").$el.data("cid")||this.model.set("view",j.getView(this.model.get("parent")),{silent:!0}),"all_modules"===this.attributes["data-open_view"]&&"section"===this.model.get("module_type")&&"on"===this.model.get("et_pb_fullwidth")&&(this.model.set("type","column",{silent:!0}),o=!0),void 0!==this.model){var s=j.getView(this.model.get("parent"));"column_specialty_settings"===this.attributes["data-open_view"]&&this.model.set("open_view","column_specialty_settings",{silent:!0}),this.$el.html(this.template(this.model.toJSON())),"column_specialty_settings"===this.attributes["data-open_view"]&&this.model.unset("open_view","column_specialty_settings",{silent:!0})}else this.$el.html(this.template());if(o&&this.model.set("type","section",{silent:!0}),this.container=this.$(".et-pb-modal-container"),"column_settings"===this.attributes["data-open_view"])t=new a.ColumnSettingsView(i);else if("all_modules"===this.attributes["data-open_view"])i.attributes={"data-parent_cid":this.model.get("cid")},t=new a.ModulesView(i);else if("module_settings"===this.attributes["data-open_view"]){var l=this.model.get("module_type");"row"!==l||_.isUndefined(s)||"column"!==s.model.get("type")||(l="row_inner"),i.attributes={"data-module_type":l},i.view=this,t=new a.ModuleSettingsView(i)}else"save_layout"===this.attributes["data-open_view"]?t=new a.SaveLayoutSettingsView(i):"column_specialty_settings"===this.attributes["data-open_view"]?t=new a.ColumnSettingsView(i):"saved_templates"===this.attributes["data-open_view"]?t=new a.TemplatesModal({attributes:{"data-parent_cid":this.attributes["data-parent_cid"]}}):"help"===this.attributes["data-open_view"]&&(t=new a.HelpView);if(void 0!==t.attributes&&"no_template"===t.attributes["data-no_template"])return!1;if(this.container.append(t.render().el),"column_settings"===this.attributes["data-open_view"]&&this.model.unset("open_view",{silent:!0}),"all_modules"===this.attributes["data-open_view"]){var d=e(t.render().el);d.find("li.et_pb_post_content, li.et_pb_fullwidth_post_content").remove(),"section"===this.model.get("module_type")&&n("undefined"!==this.model.get("et_pb_fullwidth"))&&"on"===this.model.get("et_pb_fullwidth")?d.find(".et-pb-all-modules li:not(.et_pb_fullwidth_only_module)").remove():d.find("li.et_pb_fullwidth_only_module").remove()}if(e(".et_pb_modal_overlay").length&&(e(".et_pb_modal_overlay").remove(),e("body").removeClass("et_pb_stop_scroll")),e("body").hasClass("et_pb_modal_fade_in")?e("body").append('<div class="et_pb_modal_overlay et_pb_no_animation"></div>'):e("body").append('<div class="et_pb_modal_overlay"></div>'),e("body").addClass("et_pb_stop_scroll"),this.isABTestingModule()){var r=e(t.render().el).closest(".et_pb_modal_settings_container");r.addClass("has_ab_testing_module"),r.find(".et-pb-modal-save-template").remove()}return this},closeModal:function(t){t.preventDefault(),e(".et_modal_on_top").length?e(".et_modal_on_top").remove():(void 0!==this.model&&"module"===this.model.get("type")&&this.$(".wp-editor-area").length&&(se("et_pb_content"),se("et_pb_description"),se("et_pb_footer_content")),Ve(this),X(this,"trigger_event"))},removeView:function(){if(void 0===this.model||"row"===this.model.get("type")||"column"===this.model.get("type")||"row_inner"===this.model.get("type")||"column_inner"===this.model.get("type")||"section"===this.model.get("type")&&("on"===this.model.get("et_pb_fullwidth")||"on"===this.model.get("et_pb_specialty")))if(void 0!==this.model&&void 0!==this.model.get("type")&&("column"===this.model.get("type")||"column_inner"===this.model.get("type")||"section"===this.model.get("type")&&"on"===this.model.get("et_pb_fullwidth"))){e(this.el).find(".et-pb-main-settings.active-container").hasClass("et-pb-saved-modules-tab")?X(this):(this.remove(),e("body").addClass("et_pb_modal_fade_in"),e(".et_pb_modal_overlay").addClass("et_pb_no_animation"),setTimeout(function(){e(".et_pb_modal_settings_container").addClass("et_pb_no_animation"),e("body").removeClass("et_pb_modal_fade_in")},500))}else X(this);else this.removeOverlay()},saveSettings:function(t,i){var o="",n=j.getView(this.model.get("cid")),a=(_.isUndefined(this.model.get("parent"))||j.getView(this.model.get("parent")),n),s=(i=!!_.isUndefined(i)||i,"not-allowed"===e(t.target).css("cursor"));if(_.isUndefined(a.model.get("et_pb_global_module")))for(;!_.isUndefined(a.model.get("parent"))&&""===o;)a=j.getView(a.model.get("parent")),o=""!==o||_.isUndefined(a.model.get("et_pb_global_module"))?o:a.model.get("cid");else o=a.model.get("cid");t.preventDefault(),s||(e("#publish").addClass("disabled"),T.disable_publish=!0,(void 0!==a.model.get("global_parent_cid")&&""!==a.model.get("global_parent_cid")||void 0!==a.model.get("et_pb_global_module")&&""!==a.model.get("et_pb_global_module"))&&(o=void 0!==a.model.get("global_parent_cid")?a.model.get("global_parent_cid"):a.model.get("cid")),this.performSaving(),""!==o&&Ie(o),T.allowHistorySaving("edited",this.model.get("type"),this.model.get("admin_label")),i&&(se("et_pb_content"),se("et_pb_description"),se("et_pb_footer_content"),Ve(this),X(this,"trigger_event"),J.is_active()&&J.set_subject_rank_coloring(n)))},preview:function(t){var i,o,n,a=this.model.get("cid"),s=e(t.target).is("a")?e(t.target):e(t.target).parent("a"),l=e(t.target).parents(".et-pb-modal-container"),d=document.documentMode;if(t.preventDefault(),_.isUndefined(this.options.triggered_by_right_click)?this.saveSettings(t,!1):delete this.options.triggered_by_right_click,_.isUndefined(this.options.do_preview)||delete this.options.do_preview,"1"===et_pb_options.is_divi_library&&e.inArray(et_pb_options.layout_type,["row","module"])>-1?a=void 0:"section"!==this.model.get("type")&&(n=j.getSectionView(this.model.get("parent")),_.isUndefined(n)||(a=n.model.attributes.cid)),i=T.generateCompleteShortcode(a),o={et_pb_preview_nonce:et_pb_options.et_pb_preview_nonce,shortcode:i,post_title:e("#title").val(),post_id:et_pb_options.postId},s.toggleClass("active"),l.toggleClass("et-pb-item-previewing"),s.hasClass("active")){var r=e("<iframe />",{id:"et-pb-preview-screen",src:et_pb_options.preview_url+"&et_pb_preview_nonce="+et_pb_options.et_pb_preview_nonce}),p=!1;e(".et-pb-preview-tab").html(r),e("#et-pb-preview-screen").load(function(){if(!p){var e=document.getElementById("et-pb-preview-screen");!_.isUndefined(d)&&d<10&&(o=JSON.stringify(o)),e.contentWindow.postMessage(o,et_pb_options.preview_url),p=!0}})}else e(".et-pb-preview-tab").empty(),e(".et-pb-preview-screensize-switcher a").removeClass("active"),e(".et-pb-preview-desktop").addClass("active")},resizePreviewScreen:function(t){t.preventDefault();var i=e(t.target),o=_.isUndefined(i.data("width"))?"100%":i.data("width");e(".et-pb-preview-screensize-switcher a").removeClass("active"),i.addClass("active"),e("#et-pb-preview-screen").animate({width:o})},getAttr:function(e,t){return _.isUndefined(e[t])?"":e[t]},performSaving:function(t){var i,o={},s=[],l={},d=void 0!==t&&""!==t?t:"input, select, textarea, #et_pb_content_main",r=this.model.get("module_type"),p=this.model.get("_address");if(r=-1===r.indexOf("et_pb_")?"et_pb_"+r:r,(i=e(this)[0].$el.find("form.validate")).length){var c=i.validate();if(!c.form())return Te("failed form validation"),Te("failed elements: "),Te(c.errorList),void c.focusInvalid();Te("passed form validation")}var b="global"===et_pb_options.is_global_template?et_pb_options.template_post_id:this.model.get("et_pb_global_module");if(e(".et_pb_global_sync_switcher").length>0&&void 0!==b&&""!==b){var u=[];e(".et_pb_global_unsynced").length>0&&e(".et_pb_global_unsynced").each(function(){var t=e(this),i=t.data("option_name");i=_.includes(["content","raw_content"],i)?"et_pb_content_field":i,u.push(i),_.isUndefined(t.data("additional_options"))||"mobile"!==t.data("additional_options")||(u.push(i+"_tablet"),u.push(i+"_phone"))}),g[b]=u,"global"===et_pb_options.is_global_template&&0!==e("#et_pb_unsynced_global_attrs").length&&e("#et_pb_unsynced_global_attrs").val(JSON.stringify(u))}a.Events.trigger("et-modal-settings:save",this);var h=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations,f=!_.isUndefined(h.name_changes)&&h.name_changes;f&&!_.isUndefined(f[p])&&(_.forEach(f[p],function(e,t){s.push("et_pb_"+t)}),delete et_pb_options.et_pb_module_settings_migrations.name_changes[p]),this.$(d).each(function(){var t=e(this),i=ve(t)||"",n=t.is("#et_pb_content_main")?"et_pb_content":t.attr("id");if(t.is(":checkbox")&&(n=t.attr("name")),void 0===n||-1!==n.indexOf("qt_")&&"button"===t.attr("type"))return!0;if(t.hasClass("et-pb-helper-field"))return!0;if(t.is(":checkbox")&&void 0!==o[n])return!0;var d=n.indexOf("divider_color")>-1;t.hasClass("et-pb-color-picker-hex")&&new Color(t.val()).error&&!t.hasClass("et-pb-is-cleared")&&!d&&t.val(t.data("selected-value")),""!==(i+="")&&(l[n]=i);var r,p,c=a.Helpers.getSettingValue(t);r=c,p=i,(t.hasClass("et-pb-range-input")?_.isEqual(parseFloat(r),parseFloat(p)):_.isEqual(r,p))?s.push(n):o[n]=c}),o.module_defaults=l;var m=this.model.attributes,v=this.model._previousAttributes,w=m.type,y=_.isUndefined(o.et_pb_custom_padding_last_edited)?[]:o.et_pb_custom_padding_last_edited.split("|"),k="object"===(void 0===y?"undefined":n(y))&&"on"===y[0],C=this.getAttr(o,"et_pb_custom_padding")!==this.getAttr(v,"et_pb_custom_padding"),S=k&&this.getAttr(o,"et_pb_custom_padding_tablet")!==this.getAttr(v,"et_pb_custom_padding_tablet"),x=k&&this.getAttr(o,"et_pb_custom_padding_phone")!==this.getAttr(v,"et_pb_custom_padding_phone"),j=C||S||x;if("section"===w&&(k||j)&&(o.et_pb_padding_mobile=""),"row"===w||"row_inner"===w){(k||j)&&(o.et_pb_padding_mobile="");for(var $=void 0===m.columns_layout?0:m.columns_layout.split(",").length,V=1;V<=$;V++){var T=o["et_pb_padding_"+V+"_last_edited"],U=void 0===T?[]:T.split("|"),O="object"===(void 0===U?"undefined":n(U))&&"on"===U[0],A=this.getAttr(o,"et_pb_padding_top_"+V)!==this.getAttr(v,"et_pb_padding_top_"+V),M=this.getAttr(o,"et_pb_padding_right_"+V)!==this.getAttr(v,"et_pb_padding_right_"+V),L=this.getAttr(o,"et_pb_padding_bottom_"+V)!==this.getAttr(v,"et_pb_padding_bottom_"+V),E=this.getAttr(o,"et_pb_padding_left_"+V)!==this.getAttr(v,"et_pb_padding_left_"+V),D=A||M||L||E,I=O&&this.getAttr(o,"et_pb_padding_"+V+"_tablet")!==this.getAttr(v,"et_pb_padding_"+V+"_tablet"),P=O&&this.getAttr(o,"et_pb_padding_"+V+"_phone")!==this.getAttr(v,"et_pb_padding_"+V+"_phone");if(O||(D||I||P)){o.et_pb_column_padding_mobile="";break}}}this.model.set(o),s.map(this.model.unset.bind(this.model))},isABTestingModule:function(){var e=this.model;return J.is_active()&&(J.is_subject(e)||J.has_subject(e)||J.is_goal(e)||J.has_goal(e))},saveTemplate:function(t){var i=-1!==this.model.get("module_type").indexOf("fullwidth")?"fullwidth":"regular",o=void 0!==this.model.get("columns_layout")?this.model.get("columns_layout"):"0",n="not-allowed"===e(t.target).css("cursor")||this.isABTestingModule();t.preventDefault(),n||G("save_template",this,i,o)},removeOverlay:function(){var t=e(".et_pb_modal_overlay");if(t.length&&(t.addClass("et_pb_overlay_closing"),setTimeout(function(){t.remove(),e("body").removeClass("et_pb_stop_scroll")},600)),!_.isUndefined(T.disable_publish))setTimeout(function(){_.isUndefined(T.disable_publish)||(e("#publish").removeClass("disabled"),delete T.disable_publish)},3e3)},applyFilter:function(t){var i=e(t.target),o=i.data("attr"),n=i.val();o.append_to.html(""),Ae(o.include_global,"",o.layout_type,o.append_to,o.module_width,o.specialty_cols,n)}}),a.ColumnView=window.wp.Backbone.View.extend({template:_.template(e("#et-builder-column-template").html()),templateAddRow:_.template(e("#et-builder-specialty-column-template").html()),events:{"click .et-pb-insert-module":"addModule","click .et-pb-insert-row":"addModule","contextmenu > .et-pb-insert-module":"showRightClickOptions",click:"hideRightClickOptions"},initialize:function(){this.$el.attr("data-cid",this.model.get("cid"))},render:function(){var t=this,o="section"===this.model.get("module_type")&&"on"===this.model.get("et_pb_fullwidth"),n=o?".et_pb_fullwidth_sortable_area":".et-pb-column:not(.et-pb-column-specialty, .et_pb_parent_locked)";return this.$el.html(this.template(this.model.toJSON())),void 0!==this.model.attributes.specialty_columns&&this.$el.html(this.templateAddRow(this.model.toJSON())),o&&this.$el.addClass("et_pb_fullwidth_sortable_area"),"1"===this.model.get("layout_specialty")&&(n=".et-pb-column-specialty:not(.et_pb_parent_locked)"),"manually"!==this.model.get("created")||_.isUndefined(this.model.get("et_pb_specialty_columns"))||this.$el.addClass("et-pb-column-specialty"),this.isColumnParentLocked(this.model.get("parent"))&&(this.$el.addClass("et_pb_parent_locked"),this.model.set("et_pb_parent_locked","on",{silent:!0})),J.is_active()&&!J.is_user_has_permission(this.model.get("cid"),"column")?this:(this.$el.sortable({cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-insert-module, .et-pb-insert-column, .et-pb-insert-row, .et_pb_locked, .et-pb-disable-sort",connectWith:n,delay:100,items:"1"!==this.model.get("layout_specialty")?".et_pb_module_block":".et_pb_row",receive:function(t,i){var o,n,a=e(this),s=!1;a.hasClass("et-pb-column-specialty")&&(!e(i.sender).find(".et_pb_row").length||e(i.item).is(".et_pb_module_block")?(alert(et_pb_options.section_only_row_dragged_away),s=!0):(o=e(i.item).find(".et-pb-row-container > .et-pb-column").length,((n="2_3"===j.getView(a.data("cid")).model.get("layout"))&&3===o||!n&&4===o)&&(alert(et_pb_options.stop_dropping_3_col_row),s=!0))),e(i.item).closest(".et-pb-disable-sort").length&&(s=!0),(e(i.item).closest(".et_pb_section.et_pb_global").length||e(i.item).closest(".et_pb_row.et_pb_global").length)&&e(i.item).hasClass("et_pb_global")&&(alert(et_pb_options.global_module_alert),s=!0),s&&(e(i.sender).sortable("cancel"),Ue()),a.is(".et-pb-column-specialty")&&a.find(".et_pb_row").length<=1&&a.find(".et-pb-insert-row").length&&a.find(".et-pb-insert-row").remove()},update:function(i,o){if(T.isLoading)t.$el.sortable("cancel");else{if(J.is_active()){var n=e(o.item).hasClass("et_pb_row")?e(o.item).children(".et-pb-row-content").attr("data-cid"):e(o.item).attr("data-cid");if(!J.is_user_has_permission(n))return J.alert("has_no_permission"),t.$el.sortable("cancel"),void Ue();var a=e(o.item),s=_.isEmpty(e(o.sender))?e(i.target):e(o.sender),l=_.isEmpty(e(o.sender))?e(i.toElement).parent():e(i.target),d=a.hasClass("et_pb_ab_subject"),r=a.hasClass("et_pb_ab_goal"),p=s.closest(".et_pb_ab_subject").length,c=l.closest(".et_pb_ab_subject").length,b=l.closest(".et_pb_ab_goal").length;if(r&&!d&&p)return J.alert("cannot_move_module_goal_out_from_subject"),e(t.$el).sortable("cancel"),void Ue();if(r&&!d&&!p&&c)return J.alert("cannot_move_goal_into_subject"),e(t.$el).sortable("cancel"),void Ue();if(d&&!r&&b)return J.alert("cannot_move_subject_into_goal"),e(t.$el).sortable("cancel"),void Ue()}var u,g,h=o.item.data("cid");g=e(o.item),void 0===h&&e(i.target).is(".et-pb-column-specialty")&&(g=e(o.item).closest(".et_pb_row").find(".et-pb-row-content"),h=g.data("cid")),!e(i.target).is(".et-pb-column-specialty")&&e(o.item).closest(i.target).length&&1===e(i.target).find(".et_pb_module_block").length&&(e(i.target).find(".et-pb-insert-module").length?g.insertBefore(e(i.target).find(".et-pb-insert-module")):e(i.target).append(g)),u=t.collection.find(function(e){return e.get("cid")==h}),T.allowHistorySaving("moved","module",u.get("admin_label")),u.get("parent")===t.model.attributes.cid&&e(o.item).closest(i.target).length?y.trigger("et-model-changed-position-within-column"):u.set("parent",t.model.attributes.cid);var f=parseInt(e(this).attr("data-cid")),m=0;if(e(this).find(".et_pb_module_block").each(function(){m++;var t=parseInt(e(this).data("cid")),i=f+m;$.findWhere({cid:t}).set({layout_index:i})}),$.comparator="layout_index",$.sort(),(e(o.item).closest(".et_pb_section.et_pb_global").length||e(o.item).closest(".et_pb_row.et_pb_global").length||e(o.sender).closest(".et_pb_row.et_pb_global").length||e(o.sender).closest(".et_pb_section.et_pb_global").length)&&""===et_pb_options.template_post_id){h=o.item.data("cid");var v,w,k=e(o.sender).closest(".et_pb_row.et_pb_global"),C=e(o.item).closest(".et_pb_row.et_pb_global");if((v=k.length>0?k:e(o.sender).closest(".et_pb_section.et_pb_global"))===(w=C.length>0?C:e(o.item).closest(".et_pb_section.et_pb_global"))){var S;Ie(S=k.length>0?e(o.sender).closest(".et-pb-row-content").data("cid"):e(o.sender).closest(".et-pb-section-content").data("cid")),Ue()}else{var x=v;0!==w.length||(_.isUndefined(u.get("et_pb_global_parent"))||""===u.get("et_pb_global_parent"))&&_.isUndefined(u.get("global_parent_cid"))||(u.unset("et_pb_global_parent"),u.unset("global_parent_cid"),j.removeGlobalAttributes(j.getView(u.get("cid"))));for(var V=1;V<=2;V++)void 0!==(S=void 0!==x.find(".et-pb-section-content").data("cid")?x.find(".et-pb-section-content").data("cid"):x.find(".et-pb-row-content").data("cid"))&&""!==S&&(Ie(S),Ue()),x=w}}}},start:function(t,o){if(i(),t.altKey){var n=e(o.item).hasClass("et_pb_row")?e(o.item).children(".et-pb-row-content").attr("data-cid"):e(o.item).attr("data-cid"),s=j.getView(n),l={model:s.model,view:s.$el,view_event:t},_=new a.RightClickOptionsView(l,!0);_.copy(t,!0),_.pasteAfter(t,void 0,void 0,void 0,!0,!0),T.allowHistorySaving("cloned","module",s.model.get("admin_label"))}}}),this)},addModule:function(t){var o,n=e(t.target),s=n.is("span")?n.parent(".et-pb-insert-module"):n;(t.preventDefault(),t.stopPropagation(),this.isColumnLocked())||(T.isLoading||J.is_selecting()||(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"add_module")?s.parent().is(t.delegateTarget)&&(i(),e(t.target).is(".et-pb-insert-row")?this.addRow():(o=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"all_modules"},view:this}),e("body").append(o.render().el))):J.alert("has_no_permission")))},addRow:function(e){var t=j.generateNewId(),i=void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")?this.model.get("et_pb_global_parent"):"",o=""!==i?this.model.get("global_parent_cid"):"";T.isLoading||this.isColumnLocked()||(this.collection.add([{type:"row",module_type:"row",cid:t,parent:this.model.get("cid"),view:this,appendAfter:e,et_pb_global_parent:i,global_parent_cid:o,admin_label:et_pb_options.noun.row}]),j.getView(t).displayColumnsOptions())},removeColumn:function(){var e;e=j.getChildViews(this.model.get("cid")),_.each(e,function(e){"row"===e.model.get("type")||"row_inner"===e.model.get("type")?e.removeRow():e.removeModule()}),j.removeView(this.model.get("cid")),this.model.destroy(),this.remove()},isColumnLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},isColumnParentLocked:function(e){var t=j.getView(e);return!(_.isUndefined(t)||"on"!==t.model.get("et_pb_locked")&&"on"!==t.model.get("et_pb_parent_locked"))},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};t.model.attributes.is_insert_module=!0,new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()}}),a.ColumnSettingsView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-column-settings-template").html()),events:{"click .et-pb-column-layouts li":"addColumns","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(e){this.listenTo(y,"et-add:columns",this.removeView),this.listenTo(y,"et-modal-view-removed",this.removeViewAndEmptySection),this.options=e},render:function(){return this.$el.html(this.template(this.model.toJSON())),j.getView(this.model.get("cid")).$el.closest(".et_pb_global").length&&this.$el.addClass("et_pb_no_global"),(void 0!==this.model.get("et_pb_specialty")&&"on"===this.model.get("et_pb_specialty")||void 0!==this.model.get("change_structure")&&"true"===this.model.get("change_structure"))&&this.$el.addClass("et_pb_modal_no_tabs"),this},addColumns:function(t){t.preventDefault();var i=e(t.target).is("li")?e(t.target):e(t.target).closest("li"),o={layout:i.data("layout"),layout_specialty:"section"===this.model.get("type")&&"on"===this.model.get("et_pb_specialty")?i.data("specialty").split(","):"",is_structure_change:void 0!==this.model.get("change_structure")&&"true"===this.model.get("change_structure"),specialty_columns:i.data("specialty_columns")};j.changeColumnStructure(this,o)},removeView:function(){var e=this;setTimeout(function(){e.remove()},300)},switchTab:function(t){var i=e(t.currentTarget).parent();t.preventDefault(),Ee(i,"row","")},removeViewAndEmptySection:function(){"on"===this.model.get("et_pb_specialty")&&(this.options.view.model.destroy(),j.removeView(this.options.view.model.get("cid")),this.options.view.remove()),this.remove()}}),a.SaveLayoutSettingsView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-load_layout-template").html()),events:{"click .et_pb_layout_button_load":"legacyLoadLayout","click .et_pb_layout_button_delete":"deleteLayout","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(t){this.options=t,this.layoutIsLoading=!1,this.library_url=et_pb_options.divi_library_url,this.back_button_template=_.template(e("#et-builder-library-back-button-template").html()),this.current_page={},this.account_status_error=!1,this.account_status_error_template=_.template(e("#et-builder-library-account-status-error-template").html()),this.listenTo(y,"et-modal-view-removed",this.remove),this.listenTo(y,"et-pb-loading:ended",this.onLoadingEnded),this.listenTo(this,"after-render",this.afterRender)},render:function(){this.$el.html(this.template({display_switcher:"on"}));var t=e("#post_type").val();return"layout"===t&&(this.isCategoryBuilder=!0,Le("predefined","et-pb-all-modules-tab",this.$el,t),Le("not_predefined","et-pb-saved-modules-tab",this.$el,t)),setTimeout(_.bind(function(){this.trigger("after-render")},this),150),this},remove:function(){this.library&&this.library.destroy(),e(document).off("scroll.et_fb_library",this.onScrollWindow),window.wp.Backbone.View.prototype.remove.apply(this)},afterRender:function(){this.$modal=this.$el.parents(".et_pb_modal_settings_container"),this.isCategoryBuilder||(this.$modal.addClass("et_pb_library_modal"),this.emitLoadingStarted(),Promise.all([this.loadLibrary(),w]).then(_.bind(function(t){this.library=t[0],this.$library=e(this.library.frame),this.local_layouts=t[1].layouts_data,this.custom_layouts=t[1].custom_layouts_data,this.setIFrameSize(),e(window).on("resize",this.setIFrameSize.bind(this)),this.$library.on("mouseenter",this.onMouseEnterIFrame),this.$library.on("mouseleave",this.onMouseLeaveIFrame),e(document).on("scroll.et_fb_library",this.onScrollWindow),this.library.on("current_page_changed",this.onPageChanged.bind(this)),this.library.on("use_layout",this.onUseLayout.bind(this)),this.library.on("download_progress",this.onDownloadProgress.bind(this)),this.library.on("account_status_error",this.onAccountStatusError.bind(this)),this.library.on("authentication_complete",this.onAuthenticationComplete.bind(this)),this.library.call("setAccount",{username:et_pb_options.et_account.et_username,api_key:et_pb_options.et_account.et_api_key}),this.library.call("setShowLoadOptions",!this.isCurrentLayoutEmpty()),this.emitLoadingEnded()},this)),this.$modal.find(".et_pb_modal_settings").on("click",".et-pb-library-back-button",this.onClickBackButton.bind(this)),e("<ul><li><span>").addClass("et-pb-load-layouts").hide(0).find("span").addClass("et_pb_layout_button_load").on("click",_.bind(function(t){this.onUseLayout(e(t.target).parent().data("layout_id"))},this)).parents("ul").appendTo(this.$modal.find(".et-pb-all-modules-tab")))},emitLoadingStarted:function(){this.layoutIsLoading=!0,y.trigger("et-pb-loading:started")},emitLoadingEnded:function(){this.layoutIsLoading=!1,y.trigger("et-pb-loading:ended")},deleteLayout:function(t){t.preventDefault();var i=e(t.currentTarget).closest("li");i.hasClass("et_pb_deleting_layout")||(i.addClass("et_pb_deleting_layout"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_delete_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_id:i.data("layout_id")},beforeSend:function(){y.trigger("et-pb-loading:started"),i.css("opacity","0.5")},complete:function(){y.trigger("et-pb-loading:ended")},success:function(e){1==i.closest("ul").find("> li").length&&i.closest("ul").prev("h3").hide(),i.remove()}}))},getLibraryURL:function(){var e=[];return _.forEach({iframe:1,animation:!0,is_bb:1},function(t,i){e.push("et_"+i+"="+t)}),e=e.join("&"),this.library_url+"?"+e},getLayout:function(t){return new Promise(function(i,o){e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_get_layout",nonce:et_pb_options.library_get_layout_nonce,id:t,is_BB:!0}}).then(function(e){i({content:C(e,"data.savedShortcode",""),migrations:C(e,"data.migrations","")})})})},importLayout:function(t){var i=window.etCore.portability,o=i.importFB.bind(i),n=e(window);return new Promise(function(i,a){(t=new Blob([t],{type:"application/json"})).lastModified=Date.now(),t.name="layout.json",n.on("et_fb_layout_import_finished.et_bb",function(){i({content:C(window.et_fb_import_layout_response,"data.postContent",""),migrations:C(window.et_fb_import_layout_response,"data.migrations","")}),n.off("et_fb_layout_import_finished.et_bb")}),o(t,e("#post_ID").val())})},isCurrentLayoutEmpty:function(){return _.isEmpty(T.collection.findWhere({type:"module"}))},legacyLoadLayout:function(t){if(t.preventDefault(),!this.layoutIsLoading){this.layoutIsLoading=!0,this.$el.find(".et-pb-main-settings").css({opacity:"0.5"});var i=e(t.currentTarget).closest("li"),o=i.closest(".et-pb-main-settings").find("#et_pb_load_layout_replace").is(":checked"),n=ee("content");e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_load_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_id:i.data("layout_id"),et_replace_content:o?"on":"off"},beforeSend:function(){y.trigger("et-pb-loading:started")},complete:function(){y.trigger("et-pb-loading:ended"),y.trigger("et-saved_layout:loaded")},success:function(e){n=o?e:e+n,T.removeAllSections(),""!==n&&T.allowHistorySaving("loaded","layout"),T.createNewLayout(n,"load_layout")}})}},loadLibrary:function(){return Postmate.debug=!1,new Postmate({container:this.$(".active-container")[0],url:this.getLibraryURL()})},onAccountStatusError:function(t){this.account_status_error=!0;var i={expired:"expired"===t};this.$library.hide(),e(this.account_status_error_template(i)).insertBefore(this.$library).on("click",".button",this.onClickAccountSubmitButton.bind(this))},onAuthenticationComplete:function(t){this.account_status_error&&(this.emitLoadingEnded(),t.authenticated?(this.account_status_error=!1,this.onClickBackButton(),this.library.call("retryUseLayout"),et_pb_options.et_account.et_username=this.account.et_username,et_pb_options.et_account.et_api_key=this.account.et_api_key,e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_update_account",nonce:et_pb_options.library_update_account_nonce,et_username:this.account.et_username,et_api_key:this.account.et_api_key,status:t.status}})):this.$el.find("et-pb-library-account-status-error").addClass("et-pb-library-account-status-error--auth-failed"))},onClickAccountSubmitButton:function(e){this.account={et_username:this.$el.find("#et_username").val(),et_api_key:this.$el.find("#et_api_key").val()},this.emitLoadingStarted(),this.library.call("authenticate",this.account)},onClickBackButton:function(){if(this.account_status_error)this.account_status_error=!1,this.$el.find(".et-pb-library-account-status-error").remove(),this.$library.fadeIn();else{if(_.isUndefined(this.current_page.previous_url))return;this.library.call("goTo",this.current_page.previous_url)}},onDownloadProgress:function(e,t){this.layoutIsLoading||(this.layoutIsLoading=!0,this.$el.find(".et-pb-main-settings").css({opacity:"0.5"}),this.emitLoadingStarted())},onLoadingEnded:function(){!this.isCategoryBuilder&&this.layoutIsLoading&&y.trigger("et-pb-loading:started")},onMouseEnterIFrame:function(e){this.inside_iframe=!0,this.windowX=window.scrollX,this.windowY=window.scrollY},onMouseLeaveIFrame:function(e){this.inside_iframe=!1},onPageChanged:function(e){var t=this.current_page.previous_url;this.current_page=e,this.current_page.previous_url||(this.current_page.previous_url=t),this.current_page.is_layout?this.showBackButton():this.removeBackButton()},onScrollWindow:function(e){this.inside_iframe&&window.scrollTo(this.windowX,this.windowY)},onUseLayout:function(e){var t,i=!0;_.isObject(e)?(t=e.layout,i="on"===e.replace_content):t=e;var o=_.isString(t)?this.importLayout:this.getLayout,n=this;this.emitLoadingStarted(),o(t).then(_.bind(function(e){var t=e.content;i||(t=ee("content")+t),_.isUndefined(e.migrations)||(et_pb_options.et_pb_module_settings_migrations=e.migrations),T.removeAllSections(),t&&T.allowHistorySaving("loaded","layout"),T.createNewLayout(t,"load_layout"),this.emitLoadingEnded(),y.trigger("et-saved_layout:loaded"),n.layoutIsLoading=!1},this)).catch(_.bind(function(e){this.emitLoadingEnded(),y.trigger("et-saved_layout:loaded"),console.error(e),n.layoutIsLoading=!1},this))},removeBackButton:function(){this.$modal.find(".et_pb_modal_settings").find(".et-pb-library-back-button").remove(),this.isBackButtonShown=!1},setIFrameSize:function(){var e=this.$modal.width(),t=this.$modal.height();e>1200&&(e=1200),this.$modal.css("left","calc((100vw - "+e+"px) / 2)"),this.$library.height(t).width(e)},showBackButton:function(){this.isBackButtonShown||(this.isBackButtonShown=!0,this.$modal.find(".et_pb_modal_settings").prepend(this.back_button_template()))},switchTab:function(t){t.preventDefault();var i=e(t.currentTarget).parent(),o=i.data("open_tab"),n={},a=this.$modal.find(".active-container");if(this.isCategoryBuilder)Ee(i,"layout","");else if(o!==this.current_tab){if(this.account_status_error&&(this.account_status_error=!1,this.$el.find(".et-pb-library-account-status-error").remove(),this.$library.fadeIn()),this.removeBackButton(),x(o,"et-pb-")){if(!this.library)return;if(i.addClass("et-pb-options-tabs-links-active").siblings().removeClass("et-pb-options-tabs-links-active"),"et-pb-all-modules-tab"!==o){var s=i.data("custom_tab_id"),l=_.isUndefined(s)||""===s?this.local_layouts:this.custom_layouts[s];n=e.extend(l,{filters:{type:"layout"},load_options:{show:!this.isCurrentLayoutEmpty()}})}a.hasClass("et-pb-all-modules-tab")||(a.removeClass("active-container").fadeOut(),a.siblings(".et-pb-all-modules-tab").addClass("active-container").css("opacity","").fadeIn()),o!==this.current_tab&&this.library.call("toggleLocalLayouts",n)}else Ee(i,"layout","");this.current_tab=o}}}),a.ModulesView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-modules-template").html()),events:{"click .et-pb-all-modules li":"addModule","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(e){this.options=e,this.listenTo(y,"et-modal-view-removed",this.remove)},render:function(){var e=void 0!==j.getView(this.model.get("parent"))?j.getView(this.model.get("parent")):this;return this.$el.html(this.template(j.toJSON())),(j.getView(this.model.get("cid")).$el.closest(".et_pb_global").length||void 0!==e.model.get("et_pb_template_type")&&"module"===e.model.get("et_pb_template_type"))&&this.$el.addClass("et_pb_no_global"),this},addModule:function(t){var i=e(t.currentTarget),o=i.find(".et_module_title").text(),n=i.attr("class").replace(" et_pb_fullwidth_only_module",""),a="",s=j.getView(this.model.get("parent")),l=void 0!==s?s:this;t.preventDefault(),void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")&&(a=this.model.get("global_parent_cid")),T.allowHistorySaving("added","module",o),this.collection.add([{type:"module",cid:j.generateNewId(),module_type:n,admin_label:o,parent:this.attributes["data-parent_cid"],view:this.options.view,global_parent_cid:a}]),this.remove(),""!==a&&Ie(a),void 0!==l.model.get("et_pb_template_type")&&"module"===l.model.get("et_pb_template_type")&&De("_et_pb_module_type",n),Re()},switchTab:function(t){var i=e(t.currentTarget).parent(),o=n(this.model.get("et_pb_fullwidth"))&&"on"===this.model.get("et_pb_fullwidth")?"fullwidth":"regular";t.preventDefault(),Ee(i,"module",o)}}),a.ModuleSettingsView=window.wp.Backbone.View.extend({className:"et_pb_module_settings",initialize:function(){var t=C(e.parseJSON(et_pb_options.et_builder_modules_with_children),this.attributes["data-module_type"],!1),i=!!t&&"#et-builder-advanced-setting-"+t+"-title",o=j.generateTemplateName(this.attributes["data-module_type"]);e(o).length<1||i&&e(i).length<1?this.attributes["data-no_template"]="no_template":(this.template=_.template(e(j.generateTemplateName(this.attributes["data-module_type"])).html()),this.listenTo(y,"et-modal-view-removed",this.removeModule),this.listenTo(y,"et-advanced-module:saved",this.renderMap))},events:{},render:function(){var t,i,o,n,r,c,u,g,h,f,m,v,w,k,C,S,x,$,V,T,U,A,M,L,E=this,D=this.$el,I=[],P=this.model.attributes.cid,R=!1,N=["et_pb_font_icon","et_pb_button_one_icon","et_pb_button_two_icon","et_pb_button_icon"];(E.model.set("et_pb__builder_version",et_pb_options.product_version),_.each(this.model.attributes,function(t,i,o){if("string"==typeof t&&"et_pb_content"!==i&&-1===e.inArray(i,N)&&!/^\%\%\d+\%\%$/.test(e.trim(t)))return o[i]=t.replace(/%22/g,'"')}),this.$el.html(this.template(this.model.attributes)),t=this.$el.find("#et_pb_content, .et_pb_tiny_mce_field"),r=this.$el.find(".et-pb-color-picker-hex"),c=this.$el.find(".et-builder-color-picker-alpha"),g=this.$el.find(".et-pb-upload-button"),S=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview"),x=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--add"),$=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--edit"),V=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--delete"),h=this.$el.find(".et-pb-video-image-button"),f=this.$el.find(".et-pb-gallery-button"),u=this.$el.find(".et-pb-date-time-picker"),m=this.$el.find(".et_font_icon"),v=D.find(".et-validate-number"),k=D.find("form.validate"),w=D.find(".et-pb-option--warning"),C=D.find(".et_pb_email_add_account"),k.length&&(Te("validation enabled"),k.validate({debug:!0})),r.length)&&r.each(function(){var t=e(this),i=function(){setTimeout(function(){t.attr("data-color-type",t.attr("value").match(/^rgba?/i)?"rgb":"hex")},1)};i(),t.on("keypress",i),t.wpColorPicker({defaultColor:t.data("default-color"),palettes:""!==et_pb_options.page_color_palette?et_pb_options.page_color_palette.split("|"):et_pb_options.default_color_palette.split("|"),change:function(t,o){var n,a=e(this),s=a.closest(".et-pb-option-container"),l=s.find(".et-pb-reset-setting"),d=a.closest(".et-pb-custom-color-container"),r=s.find(".et-pb-option-preview"),p=a.hasClass("et-pb-color-picker-hex-has-preview"),c=a.closest(".et_pb_background-tab--gradient").length>0,u=o.color.toString().toLowerCase();d.length&&(d.find(".et-pb-custom-color-picker").val(o.color.toString()),s.hasClass("et-pb-option-container--font")&&d.find(".et-pb-custom-color-picker").trigger("change")),n=ve(a).toLowerCase(),s.hasClass("et-pb-option-container--font")||(u!==n?l.length&&l.addClass("et-pb-reset-icon-visible"):(l.length&&l.removeClass("et-pb-reset-icon-visible"),p&&r.addClass("et-pb-option-preview--empty")),p&&""!==u&&r.removeClass("et-pb-option-preview--empty")),p&&r.css({backgroundColor:u}),c&&ye(a),_.has(t,"originalEvent")&&_.has(t.originalEvent,"type")&&"square"===t.originalEvent.type&&(s.find(".button-confirm").css("backgroundColor",u+" !important"),s.hasClass("is-dragging")||s.addClass("is-dragging"),clearTimeout(T),T=setTimeout(function(){b(a),s.find(".button-confirm").css("backgroundColor",""),s.removeClass("is-dragging")},300)),clearTimeout(U),U=setTimeout(function(){a.focus()},300),a.hasClass("et-pb-is-cleared")&&a.removeClass("et-pb-is-cleared"),a.trigger("et_pb_setting:color_picker:change",[u]),i()},clear:function(){e(this).val(et_pb_options.invalid_color),e(this).closest(".et-pb-option-container").find(".et-pb-main-setting").val(""),e(this).siblings(".et-pb-color-picker-hex").trigger("et_pb_setting:color_picker:change",[""])},width:t.closest(".et-pb-option--background").length?660:300,height:190,diviColorpicker:!!t.closest(".et-pb-option--background").length});var o=t.data("default-color")||"",n=t.closest(".et-pb-option-container").find(".et-pb-reset-setting");if(t.hasClass("et-pb-color-picker-hex-has-preview")){var a=t.closest(".et-pb-option-container");a.find(".et-pb-option-preview-button--add, .et-pb-option-preview-button--edit, .et-pb-option-preview").click(function(e){e.stopPropagation(),t.wpColorPicker("open")}),a.find(".et-pb-option-preview-button--delete").click(function(e){e.stopPropagation();var i=ve(t).toLowerCase();t.wpColorPicker("color",i).val(i).addClass("et-pb-is-cleared"),""===i&&a.find(".et-pb-option-preview").removeAttr("style").addClass("et-pb-option-preview--empty")})}if(!n.length)return!0;var s=t.val()+"";o.toLowerCase()!==s.toLowerCase()&&n.addClass("et-pb-reset-icon-visible")});if(c.length&&c.each(function(){var t=e(this),i=t.data("value").split("|"),o=i[0]||"#444444",n=i[2]||1;t.attr("data-opacity",n),t.val(o),t.minicolors({control:"hue",defaultValue:e(this).data("default-color")||"",opacity:!0,changeDelay:200,show:function(){t.minicolors("opacity",t.data("opacity"))},change:function(i,o){if(i){var n,a=t.minicolors("rgbObject"),s=e(t.data("field")),l=[];l.push(i),l.push(a.r+", "+a.g+", "+a.b),l.push(o),n=l.join("|"),s.length&&s.val(n)}},theme:"bootstrap"})}),g.length&&s(g),x.length||$.length||S){var H=function(t){t.preventDefault(),t.stopPropagation(),e(this).hasClass("et-pb-option-preview")&&!e(this).hasClass("et-pb-option-preview--empty")&&"video"===e(this).siblings(".button").attr("data-type")||Ge(e(this))||e(this).closest(".et-pb-option").find(".et-pb-upload-button").trigger("click")};S.click(H),x.click(H),$.click(H)}if(V.length&&V.click(function(t){if(t.preventDefault(),t.stopPropagation(),!Ge(e(this))){var i=e(this).closest(".et-pb-option"),o=i.find(".et-pb-upload-field"),n=i.find(".et-pb-option-preview");o.val(""),n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove()}}),h.length&&p(h),f.length&&l(f),C.length&&(A=C,M=this,L=window.et_pb_module_field_dependencies.et_pb_signup,A.each(function(){var t=e(this),i=t.siblings("select"),o=t.siblings(".et_pb_email_force_fetch_lists"),n=t.siblings(".et_pb_email_remove_account"),a=e(this).siblings("input"),s=a.closest(".et-pb-option").data("option_name"),l=_.keys(L[s].affects);l=_.map(l,function(e){return"#et_pb_"+e}).join(", "),e(this).closest(".et-pb-options-tab").find(l).one("et-pb-option-field-shown",function(){var t=e(this).siblings("button");!function(t,i,o){t.on("click",function(){e(this).hasClass("et_pb_email_submit")?(y.trigger("et-pb-loading:started"),function(t,i){var o=d(t),n=t.closest(".et-pb-option--select_with_option_groups").parent().find('[class*="et_pb_email_'+o+'"]:visible'),a={};function s(e){t.val(t.data("previous_value")).trigger("change"),n.val(""),y.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}n.each(function(){var t,i,o=e(this).attr("id").replace("pb_","");i="_list",(t=o).substr(t.length-i.length,t.length)!==i&&(a[o]=e(this).val())}),a.action="et_builder_email_add_account",a.et_builder_email_add_account_nonce=et_pb_options.et_builder_email_add_account_nonce,a.et_bb=!0,a.et_provider=o,e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:a}).done(function(e,o,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(i)(i.model.attributes)),s(e)}).fail(s)}(i,o)):i.val(i.data("previous_value")).trigger("change")}),t.appendTo(t.parent())}(t,i,M)}),o.data("original_text",o.text()),n.data("original_text",n.text()),i.on("change",function(){var a=e(this).val();if("add_new_account"!==a||i.parent().hasClass("new_account_in_progress"))if("fetch_lists"!==a||i.parent().hasClass("fetch_lists_in_progress"))if("remove_account"!==a||i.parent().hasClass("remove_account_in_progress")){i.parent().removeClass("new_account_in_progress remove_account_in_progress fetch_lists_in_progress");var s=M.$el.prev().find(".et-pb-modal-save, .et-pb-modal-save-template");s.css("cursor",""),"none"===a?i.parent().addClass("no_account_selected"):i.parent().removeClass("no_account_selected"),t.show(),n.text(n.data("original_text")),o.text(o.data("original_text")),a&&"none"!==a?(n.show(),o.show()):(n.hide(),o.hide()),t.siblings("span").remove(),t.siblings("p").show(),i.show()}else{i.parent().addClass("remove_account_in_progress"),t.hide().siblings("p").hide(),n.text(n.data("confirm_text")),o.text(o.data("cancel_text"));var l=i.data("confirm_remove_text")+" "+i.data("selected_account");e("<span>").text(l).insertAfter(i).addClass("et_pb_email_account_message"),i.hide()}else i.parent().addClass("fetch_lists_in_progress"),y.trigger("et-pb-loading:started"),function(t,i,o){var n=d(t),a=t.data("selected_account");function s(e){t.val(t.data("previous_value")).trigger("change"),i.removeClass("fetch_lists_in_progress"),y.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_builder_email_get_lists",et_builder_email_fetch_lists_nonce:et_pb_options.et_builder_email_fetch_lists_nonce,et_provider:n,et_account:a,et_bb:!0}}).done(function(e,i,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(o)(o.model.attributes)),s(e)}).fail(s)}(i,t,M);else i.parent().addClass("new_account_in_progress"),e("<span>").text(i.data("adding_new_account_text")).insertAfter(i).addClass("et_pb_email_account_message"),t.hide().siblings().not("span").hide(),i.siblings("#et_pb_aweber_list").length>0&&window.open("https://auth.aweber.com/1.0/oauth/authorize_app/b17f3351")}),t.click(function(){var e=M.$el.prev().find(".et-pb-modal-save, .et-pb-modal-save-template");e.css("cursor","not-allowed"),i.data("previous_value",i.val()).val("add_new_account").trigger("change")}),o.click(function(){if(i.parent().hasClass("remove_account_in_progress"))i.val(i.data("previous_value")).trigger("change");else{var e=i.find(":selected").parent().attr("label");i.data("selected_account",e),i.data("previous_value",i.val()).val("fetch_lists").trigger("change")}}),n.click(function(){if(i.parent().hasClass("remove_account_in_progress"))return y.trigger("et-pb-loading:started"),void function(t,i){var o=d(t),n=t.data("selected_account");function a(e){t.val("none").trigger("change"),y.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_builder_email_remove_account",et_builder_email_remove_account_nonce:et_pb_options.et_builder_email_remove_account_nonce,et_provider:o,et_account:n,et_bb:!0}}).done(function(e,o,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(i)(i.model.attributes)),a(e)}).fail(a)}(i,M);var t=i.find(":selected").parent().attr("label");t&&(i.data("selected_account",t),i.data("previous_value",i.val()).val("remove_account").trigger("change"))}),setTimeout(function(){i.trigger("change")},200)})),u.length&&u.datetimepicker({dateFormat:"yy-mm-dd",beforeShow:function(){var t=e("#ui-datepicker-div");t.closest(".et-fb-option--date-picker").length<1&&t.wrap('<span class="et-fb-option--date-picker"></span>')}}),v.length&&v.keyup(function(){var t=e(this);(t.val()<0||!e.isNumeric(t.val())&&""!==t.val())&&t.val(0),t.val()>100&&t.val(100),""!==t.val()&&t.val(Math.round(t.val()))}),m.length){var B=this;m.each(function(){var t,i,o,n=e(this),a=n.siblings(".et-pb-font-icon"),s=e.trim(a.val()),l=n.find("li"),_="et_active";function d(){""!==s&&(-1!==(s=(s=s.replace("[","%91")).replace("]","%93")).search(/^%%/)?(o=parseInt(s.replace(/%/g,"")),t=n.find("li").eq(o)):t='"'===s?n.find("li").eq(0):n.find('li[data-icon="'+s+'"]'),t.addClass(_),n.is(":visible")&&setTimeout(function(){(i=t.offset().top-n.offset().top)>0&&n.animate({scrollTop:i},0)},110))}d(),B.$el.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",d),l.click(function(){var t=e(this),i=t.index();if(t.hasClass(_))return!1;t.siblings("."+_).removeClass(_).end().addClass(_),i="%%"+i+"%%",a.val(i)})})}return t.length&&t.each(function(){var t=e(this),s=t.attr("id");if((o=t.closest(".et-pb-option")).hasClass("et-pb-option-advanced-module")&&(R=!0),R){var l=j.generateNewId();E.view_cid=l,o.hide(),t.attr("id","et_pb_content_main"),n=new a.AdvancedModuleSettingsView({model:E,el:E.$el.find(".et-pb-option-advanced-module-settings"),attributes:{cid:l,value_changes:E.model.get("value_changes")}}),j.addView(l,n),o.before(n.render()),""!==t.html()&&(n.generateAdvancedSortableItems(t.html(),E.$el.find(".et-pb-option-advanced-module-settings").data("module_type")),y.trigger("et-advanced-module:updated_order",E.$el))}else i=t.closest(".et-pb-option-container"),I[s]=t.html(),t.remove(),i.prepend(O.find("#"+s+"_editor").html()),setTimeout(function(){void 0!==window.switchEditors&&window.switchEditors.go(s,ie());var e="et_pb_content"!==s?"load_secondary_editor":"";ae(s,I[s],e),window.wpActiveEditor=s},100)}),w.length&&w.each(function(){var t=e(this),i=t.find(".et-pb-option-warning"),o=i.attr("data-display_if"),n=i.attr("data-name");et_pb_options[n]===o&&t.addClass("et-pb-option--warning-active")}),this.renderMap(),ce(this.$el,P),R||setTimeout(function(){D.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),this},removeModule:function(){this.remove()},is_latlng:function(e){var t=e.split(","),i=!_.isUndefined(t[0])&&parseFloat(t[0]),o=!_.isUndefined(t[1])&&parseFloat(t[1]);return!("undefined"==typeof google||!i||_.isNaN(i)||!o||_.isNaN(o))&&new google.maps.LatLng(i,o)},renderMap:function(){var e=this,t=this.$el.find(".et-pb-map");if("undefined"!=typeof google&&t.length){var i=this.view_cid,o=this.$el.find(".et_pb_address"),n=this.$el.find(".et_pb_address_lat"),a=this.$el.find(".et_pb_address_lng"),s=this.$el.find(".et_pb_find_address"),l=this.$el.find(".et_pb_zoom_level"),d=new google.maps.Geocoder,r={},p=isNaN(parseInt(l.val()))?18:parseInt(l.val()),c=function(e){t.map.setCenter(e)},b=function(){t.map.setZoom(p)};o.on("blur",function(){var t=o.val();t.length<=0||d.geocode({address:t},function(i,s){if(s==google.maps.GeocoderStatus.OK){var l=i[0],_=l.geometry.location,d=e.is_latlng(t);d&&(_=d),isNaN(_.lat())||isNaN(_.lng())?alert(et_pb_options.map_pin_address_invalid):(o.val(l.formatted_address),n.val(_.lat()),a.val(_.lng()),c(_))}else alert(et_pb_options.geocode_error+": "+s)})}),s.on("click",function(e){e.preventDefault()}),l.on("blur",b),setTimeout(function(){t.map=new google.maps.Map(t[0],{zoom:p,mapTypeId:google.maps.MapTypeId.ROADMAP}),""!==n.val()&&""!==a.val()&&c(new google.maps.LatLng(n.val(),a.val())),""!==l&&b(),setTimeout(function(){var e=j.getChildViews(i);_.size(e)&&_.each(e,function(e,i){_.isUndefined(e.model.get("et_pb_pin_address_lat"))||_.isUndefined(e.model.get("et_pb_pin_address_lng"))||(r[i]=new google.maps.Marker({map:t.map,position:new google.maps.LatLng(parseFloat(e.model.get("et_pb_pin_address_lat")),parseFloat(e.model.get("et_pb_pin_address_lng"))),title:e.model.get("et_pb_title"),icon:{url:et_pb_options.images_uri+"/marker.png",size:new google.maps.Size(46,43),anchor:new google.maps.Point(16,43)},shape:{coord:[1,1,46,43],type:"rect"}}))})},500),google.maps.event.addListener(t.map,"center_changed",function(){var e=t.map.getCenter();n.val(e.lat()),a.val(e.lng())}),google.maps.event.addListener(t.map,"zoom_changed",function(){var e=t.map.getZoom();l.val(e)})},200)}}}),a.AdvancedModuleSettingsView=window.wp.Backbone.View.extend({initialize:function(){this.listenTo(y,"et-advanced-module:updated",this.generateContent),this.listenTo(y,"et-modal-view-removed",this.removeModule),this.module_type=this.$el.data("module_type"),a.Events=y,this.child_views=[],this.$el.attr("data-cid",this.attributes.cid),this.$sortable_options=this.$el.find(".et-pb-sortable-options"),this.$content_textarea=this.$el.siblings(".et-pb-option-main-content").find("#et_pb_content_main"),_.includes(["et_pb_column","et_pb_column_inner"],this.module_type)?this.$sortable_options.addClass("et-pb-sortable-options--disabled"):this.$sortable_options.sortable({axis:"y",cancel:".et-pb-advanced-setting-remove, .et-pb-advanced-setting-options",update:function(e,t){y.trigger("et-advanced-module:updated"),y.trigger("et-advanced-module:updated_order")}}),this.$add_sortable_item=this.$el.find(".et-pb-add-sortable-option").addClass("et-pb-add-sortable-initial")},events:{"click .et-pb-add-sortable-option":"addModule","click .et-pb-advanced-setting-clone":"cloneModule"},render:function(){return this},addModule:function(e){e.preventDefault(),this.model.collection.add([{type:"module",module_type:this.module_type,cid:j.generateNewId(),view:this,created:"manually",mode:"advanced",parent:this.attributes.cid,parent_cid:this.model.model.attributes.cid}],{update_shortcodes:"false"}),this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"),y.trigger("et-advanced-module:updated_order")},cloneModule:function(t){t.preventDefault();var i=e(t.target).closest("li").data("cid"),o=T.collection.find(function(e){return e.get("cid")==i}),n=_.clone(o.attributes);n.created="manually",n.cloned_cid=i,n.cid=j.generateNewId(),this.model.collection.add(n),y.trigger("et-advanced-module:updated"),y.trigger("et-advanced-module:saved"),y.trigger("et-advanced-module:updated_order")},generateContent:function(){var t="";this.$sortable_options.find("li").each(function(){var i=e(this);t+=T.generateModuleShortcode(i,!1)}),t=t.replace(/%22/g,"^^"),this.$content_textarea.html(t),this.$sortable_options.find("li").length?this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"):this.$add_sortable_item.addClass("et-pb-add-sortable-initial")},generateAdvancedSortableItems:function(t,i){var o=this,n=T.getShortCodeChildTags(),a=window.wp.shortcode.regexp(n),s=T.wp_regexp_not_global(n),l=t.match(a);""!==t&&this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"),_.each(l,function(t,n){var l,d=t.match(s),r=d[2],p=""!==d[3]?window.wp.shortcode.attrs(d[3]+" "+n):"",c=d[5],b=j.generateNewId(),u={},g=void 0!==c&&""!==c&&c.match(a),h=et_pb_options.et_pb_module_settings_migrations.name_changes,f=_.includes(["et_pb_column","et_pb_column_inner"],r);l={type:"module",module_type:i,cid:b,view:o,created:"auto",mode:"advanced",parent:o.attributes.cid,parent_cid:o.model.model.attributes.cid};var m=j.getView(o.model.model.attributes.cid);if(f){var v=e(m.$el).find(".et-pb-column");_.isUndefined(v[n])||(l.column_cid=e(v[n]).data("cid"))}if(_.isObject(p.named)){for(var w in p.named){var y,k="admin_label"!==w?"et_pb_"+w:w;f&&"et_pb_type"===k&&(k="layout"),y=(y=p.named[w]).replace(/\^\^/g,'"'),u[k]=y}l.et_pb_content=c,l=_.extend(l,u)}g||(l.et_pb_content=c),_.isEmpty(h)||_.isEmpty(h[o.module_type])||_.forEach(h[o.module_type],function(e,t){_.isUndefined(l["et_pb_"+t])||(l["et_pb_"+e]=l["et_pb_"+t],delete l["et_pb_"+t])}),_.isUndefined(o.attributes.value_changes)||_.isUndefined(o.attributes.value_changes[n])||_.forEach(o.attributes.value_changes[n],function(e,t){l["et_pb_"+t]=e}),o.model.collection.add([l],{update_shortcodes:"false"})})},removeModule:function(){_.each(this.child_views,function(e){e.removeView()}),this.remove()}}),a.AdvancedModuleSettingView=window.wp.Backbone.View.extend({tagName:"li",initialize:function(){this.template=_.template(e("#et-builder-advanced-setting").html())},events:{"click .et-pb-advanced-setting-options":"showSettings","click .et-pb-advanced-setting-remove":"removeView"},render:function(){var e;return this.$el.html(this.template(this.model.attributes)),e=new a.AdvancedModuleSettingTitleView({model:this.model,view:this}),this.$el.prepend(e.render().el),this.child_view=e,void 0!==this.model.get("cloned_cid")&&""!==this.model.get("cloned_cid")||this.showSettings(),this},showSettings:function(t){var i;t&&t.preventDefault(),i=new a.AdvancedModuleSettingEditViewContainer({view:this,attributes:{show_settings_clicked:!!t,"data-module_type":this.model.get("module_type")}}),e(".et_pb_modal_settings_container").after(i.render().el),Re()},removeView:function(e){e&&e.preventDefault(),_.isUndefined(this.child_view)||this.child_view.remove(),this.remove(),this.model.destroy(),y.trigger("et-advanced-module:updated"),y.trigger("et-advanced-module:updated_order")}}),a.AdvancedModuleSettingTitleView=window.wp.Backbone.View.extend({tagName:"span",className:"et-sortable-title",initialize:function(){var t="#et-builder-advanced-setting-"+("et_pb_column_inner"===this.model.get("module_type")?"et_pb_column":this.model.get("module_type"))+"-title";this.template=_.template(e(t).html()),this.listenTo(y,"et-advanced-module:updated",this.render)},render:function(){return _.isUndefined(this.model.attributes.et_pb_admin_title)||""!==this.model.attributes.et_pb_admin_title||delete this.model.attributes.et_pb_admin_title,this.$el.html(this.template(this.model.attributes)),this}}),a.AdvancedModuleSettingEditViewContainer=window.wp.Backbone.View.extend({className:"et_pb_modal_settings_container",initialize:function(){this.template=_.template(e("#et-builder-advanced-setting-edit").html()),this.model=this.options.view.model,this.listenTo(y,"et-modal-view-removed",this.removeView)},events:{"click .et-pb-modal-save":"saveSettings","click .et-pb-modal-close":"removeView"},is_latlng:function(e){var t=e.split(","),i=!_.isUndefined(t[0])&&parseFloat(t[0]),o=!_.isUndefined(t[1])&&parseFloat(t[1]);return!(!i||_.isNaN(i)||!o||_.isNaN(o))&&new google.maps.LatLng(i,o)},render:function(){var t,i,o,n,d,r,c,u,g,h,f,m,v,w,y,k=this.model.attributes.cid,S=this;(this.$el.html(this.template()),this.$el.addClass("et_pb_modal_settings_container_step2"),this.$el.attr("data-parent-cid",k),("auto"!==this.model.get("created")||this.attributes.show_settings_clicked)&&(t=new a.AdvancedModuleSettingEditView({view:this}),this.$el.append(t.render().el),this.child_view=t),this.model.set("et_pb__builder_version",et_pb_options.product_version),a.Events.trigger("et-advanced-module-settings:render",this),i=this.$el.find(".et-pb-color-picker-hex"),g=this.$el.find(".et-builder-color-picker-alpha"),i.length)&&i.each(function(){var t=e(this);if(t.wpColorPicker({defaultColor:t.data("default-color"),palettes:""!==et_pb_options.page_color_palette?et_pb_options.page_color_palette.split("|"):et_pb_options.default_color_palette.split("|"),change:function(t,i){var o=e(this),n=o.closest(".et-pb-option-container"),a=n.find(".et-pb-reset-setting"),s=o.closest(".et-pb-custom-color-container"),l=n.find(".et-pb-option-preview"),d=o.hasClass("et-pb-color-picker-hex-has-preview"),r=o.closest(".et_pb_background-tab--gradient").length>0,p=i.color.toString().toLowerCase();s.length&&s.find(".et-pb-custom-color-picker").val(i.color.toString()),(a.length||d||r)&&(p!==ve(o).toLowerCase()?a.addClass("et-pb-reset-icon-visible"):(a.removeClass("et-pb-reset-icon-visible"),d&&l.addClass("et-pb-option-preview--empty")),d&&""!==p&&l.removeClass("et-pb-option-preview--empty"),d&&l.css({backgroundColor:p}),r&&ye(o),(d||r)&&(_.has(t,"originalEvent")&&_.has(t.originalEvent,"type")&&"square"===t.originalEvent.type&&(n.find(".button-confirm").css("backgroundColor",p+" !important"),n.hasClass("is-dragging")||n.addClass("is-dragging"),clearTimeout(w),w=setTimeout(function(){b(o),n.find(".button-confirm").css("backgroundColor",""),n.removeClass("is-dragging")},300)),clearTimeout(y),y=setTimeout(function(){o.focus()},300)),o.hasClass("et-pb-is-cleared")&&o.removeClass("et-pb-is-cleared"),o.trigger("et_pb_setting:color_picker:change",[p]))},width:t.closest(".et-pb-option--background").length?660:300,height:190,diviColorpicker:!!t.closest(".et-pb-option--background").length}),t.hasClass("et-pb-color-picker-hex-has-preview")){var i=t.closest(".et-pb-option-container");i.find(".et-pb-option-preview-button--add, .et-pb-option-preview-button--edit, .et-pb-option-preview").click(function(e){e.stopPropagation(),t.wpColorPicker("open")}),i.find(".et-pb-option-preview-button--delete").click(function(e){e.stopPropagation();var o=ve(t).toLowerCase();t.wpColorPicker("color",o).val(o).addClass("et-pb-is-cleared"),""===o&&i.find(".et-pb-option-preview").removeAttr("style").addClass("et-pb-option-preview--empty")})}});if(g.length&&g.each(function(){var t=e(this),i=t.data("value").split("|"),o=i[0]||"#444444",n=i[2]||1;t.attr("data-opacity",n),t.val(o),t.minicolors({control:"hue",defaultValue:e(this).data("default-color")||"",opacity:!0,changeDelay:200,show:function(){t.minicolors("opacity",t.data("opacity"))},change:function(i,o){if(i){var n,a=t.minicolors("rgbObject"),s=e(t.data("field")),l=[];l.push(i),l.push(a.r+", "+a.g+", "+a.b),l.push(o),n=l.join("|"),s.length&&s.val(n)}},theme:"bootstrap"})}),o=this.$el.find(".et-pb-upload-button"),u=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview"),f=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--add"),m=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--edit"),v=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--delete"),o.length&&s(o),f.length||m.length||u.length){var x=function(t){t.preventDefault(),t.stopPropagation(),e(this).hasClass("et-pb-option-preview")&&!e(this).hasClass("et-pb-option-preview--empty")||e(this).closest(".et-pb-option").find(".et-pb-upload-button").trigger("click")};u.click(x),f.click(x),m.click(x)}if(v.length&&v.click(function(t){t.preventDefault(),t.stopPropagation();var i=e(this).closest(".et-pb-option"),o=i.find(".et-pb-upload-field"),n=i.find(".et-pb-option-preview");o.val(""),n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove()}),(n=this.$el.find(".et-pb-video-image-button")).length&&p(n),d=this.$el.find(".et-pb-map"),"undefined"!=typeof google&&d.length){var j,V,T=this.$el.find(".et_pb_pin_address"),U=this.$el.find(".et_pb_pin_address_lat"),O=this.$el.find(".et_pb_pin_address_lng"),A=this.$el.find(".et_pb_find_address"),M=this.$el.find(".et_pb_zoom_level"),L=new google.maps.Geocoder,E=function(e){V.setPosition(e),j.setCenter(e)};T.on("change",function(){var e=T.val().trim();e.length<=0||L.geocode({address:e},function(t,i){if(i==google.maps.GeocoderStatus.OK){var o=t[0],n=o.geometry.location,a=S.is_latlng(e);a&&(n=a),isNaN(n.lat())||isNaN(n.lng())?alert(et_pb_options.map_pin_address_invalid):(T.val(o.formatted_address),U.val(n.lat()),O.val(n.lng()),E(n))}else alert(et_pb_options.geocode_error+": "+i)})}),A.on("click",function(e){e.preventDefault()}),setTimeout(function(){j=new google.maps.Map(d[0],{zoom:parseInt(M.val()),mapTypeId:google.maps.MapTypeId.ROADMAP}),V=new google.maps.Marker({map:j,draggable:!0,icon:{url:et_pb_options.images_uri+"/marker.png",size:new google.maps.Size(46,43),anchor:new google.maps.Point(16,43)},shape:{coord:[1,1,46,43],type:"rect"}}),google.maps.event.addListener(V,"dragend",function(){var e=V.getPosition();U.val(e.lat()),O.val(e.lng()),E(e);var t=new google.maps.LatLng(e.lat(),e.lng());L.geocode({latLng:t},function(e,t){t==google.maps.GeocoderStatus.OK?e[0]?T.val(e[0].formatted_address):alert(et_pb_options.no_results):alert(et_pb_options.geocode_error_2+": "+t)})}),""!=U.val()&&""!=O.val()&&E(new google.maps.LatLng(U.val(),O.val()))},200)}if((h=this.$el.find(".et-pb-gallery-button")).length&&l(h),(r=this.$el.find(".et-pb-social-network")).length){var D=this.$el.find(".reset-default-color"),I=this.$el.find("#et_pb_background_color");D.length&&D.click(function(){var e=D.parents(".et-pb-main-settings");r=e.find(".et-pb-social-network"),(I=e.find("#et_pb_background_color")).length&&(I.wpColorPicker("color",r.find("option:selected").data("color")),D.css("display","none"))}),r.change(function(){var e=r.parents(".et-pb-main-settings");if(!r.data("is_rendering_setting_view")&&r.val().length){var t=e.find("#et_pb_content"),i=e.find("#et_pb_background_color");if(t.length&&t.val(r.find("option:selected").text()),i.length){var o=r.find("option:selected").data("color");i.val(o).wpColorPicker("color",o),i.closest(".et-pb-option-container").find(".et-pb-option-preview").css({backgroundColor:o})}}}),I.val()!==r.find("option:selected").data("color")&&D.css("display","inline")}if((c=this.$el.find(".et_font_icon")).length){var P=this;c.each(function(){var t,i,o,n=e(this),a=n.siblings(".et-pb-font-icon"),s=e.trim(a.val()),l=n.find("li"),_="et_active";function d(){""!==s&&(-1!==s.search(/^%%/)?(o=parseInt(s.replace(/%/g,"")),t=n.find("li").eq(o)):t=n.find('li[data-icon="'+s+'"]'),t.addClass(_),n.is(":visible")&&setTimeout(function(){(i=t.offset().top-n.offset().top)>0&&n.animate({scrollTop:i},0)},110))}d(),P.$el.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",d),l.click(function(){var t=e(this),i=t.index();if(t.hasClass(_))return!1;t.siblings("."+_).removeClass(_).end().addClass(_),i="%%"+i+"%%",a.val(i)})})}return function(t,i){var o=t.find(".et-pb-options-tab-advanced"),n=o.find(".et-pb-main-setting"),a=(e(".et_pb_modal_settings_container:not(.et_pb_modal_settings_container_step2)").find(".et-pb-options-tab-advanced"),$.findWhere({cid:i})),s=_.includes(["et_pb_column","et_pb_column_inner"],C(a,"attributes.module_type",""));if(s)return;o.length&&n.each(function(){var t=e(this),i=t.attr("id"),o="",n="";if(t.hasClass("et-pb-range")){var s=t.siblings(".et-pb-range-input");n=s.data(o)||"",s.each(function(){var t,i,s,l=e(this),d=l.attr("id"),r=void 0!==l.data("device")?l.data("device"):"all",p=e("#"+d);if(p.length&&(i=me(e(t=l)),s=e(t).data(i),!_.isArray(s)||!_.isObject(s[1]))){if(a.attributes.module_defaults=a.attributes.module_defaults||[],a.attributes.module_defaults[d]=p.val(),"all"!==r){var c=l.siblings(".et-pb-main-setting.et_pb_setting_mobile_"+r);c.data("default_inherited",p.val()),c.data("default",p.val())}o=me(p),n=p.data(o)||"",l.data("default_inherited",n),l.data("default",p.val())}})}else if(t.closest(".et-presets").length);else{var l=e("#"+i);if(l.length){var d=l.val();a.attributes.module_defaults=a.attributes.module_defaults||[],a.attributes.module_defaults[i]=d,o=me(l),n=l.data(o)||"",t.data("default_inherited",n),t.data(o,d)}}})}(this.$el,k),ce(this.$el,k),this},removeView:function(e){e&&e.preventDefault(),this.$el.find("#et_pb_content")&&e&&se("et_pb_content"),Ve(this),this.child_view&&this.child_view.remove(),this.remove()},saveSettings:function(t){var i=this,o={},n=this.model.get("module_defaults")||"";if(t.preventDefault(),this.$("input, select, textarea").each(function(){var t,a=e(this),s=a.attr("id"),l=[];if(a.is(":checkbox")&&(s=a.attr("name")),void 0===s||-1!==s.indexOf("qt_")&&"button"===a.attr("type"))return!0;if(a.is(":checkbox")||(s=a.attr("id").replace("data.","")),a.is(":checkbox")&&void 0!==o[s])return!0;if(t=a.is("#et_pb_content")?ee("et_pb_content"):a.val(),a.is(".et-pb-text-align-select")&&!a.parent().find(".et_text_align_active").length)return!0;if(_.isEmpty(a.data("check_attr_default"))||"yes"!==a.data("check_attr_default")){if(""!==n&&void 0!==n[s]&&n[s]===t){if(!a.hasClass("yes_no_button"))return i.model.unset(s),!0;delete n[s],i.model.set("module_defaults",n)}}else if(we(a))return i.model.unset(s),!0;a.is(":checkbox")&&void 0===o[s]&&(a.closest(".et-pb-option-container").find('[name="'+s+'"]:checked').each(function(){l.push(e(this).val())}),t=l.join(",")),a.closest(".et-pb-custom-css-option").length&&(t=""!==t?t.replace(/(?:\r\n|\r|\n)/g,"||"):""),o[s]=t}),_.isUndefined(o.et_pb_pin_address)||_.isUndefined(o.et_pb_pin_address_lat)||_.isUndefined(o.et_pb_pin_address_lng)||""!==o.et_pb_pin_address&&""!==o.et_pb_pin_address_lat&&""!==o.et_pb_pin_address_lng){var a=j.getView(i.model.attributes.view.model.model.attributes.cid);if(_.isUndefined(a.model.get("value_changes"))||a.model.unset("value_changes"),!_.isUndefined(i.model.attributes.column_cid))j.getView(i.model.attributes.column_cid).model.set(o,{silent:!0});this.model.set(o,{silent:!0}),y.trigger("et-advanced-module:updated"),y.trigger("et-advanced-module:saved"),se("et_pb_content"),this.removeView()}else alert(et_pb_options.map_pin_address_error)}}),a.AdvancedModuleSettingEditView=window.wp.Backbone.View.extend({className:"et_pb_module_settings",initialize:function(){this.model=this.options.view.options.view.model;var t="et_pb_column_inner"===this.model.get("module_type")?"et_pb_column":this.model.get("module_type");this.template=_.template(e("#et-builder-advanced-setting-"+t).html())},events:{},render:function(){var e,t,i=this.$el;if(this.$el.html(this.template({data:this.model.toJSON()})),this.$el.find(".et-pb-main-settings").addClass("et-pb-main-settings-advanced"),(e=this.$el.find("div#et_pb_content")).length){t=e.closest(".et-pb-option-container");var o=e.html();e.remove(),t.prepend(O.find("#et_pb_content_editor").html()),setTimeout(function(){void 0!==window.switchEditors&&window.switchEditors.go("et_pb_content",ie()),ae("et_pb_content",o),window.wpActiveEditor="et_pb_content"},300)}return setTimeout(function(){i.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),this}}),a.BlockModuleView=window.wp.Backbone.View.extend({className:function(){var e="et_pb_module_block";return void 0!==this.model.attributes.className&&(e+=this.model.attributes.className),e},template:_.template(e("#et-builder-block-module-template").html()),initialize:function(){this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass),this.listenTo(this.model,"change:et_pb_global_module",this.removeGlobal)},events:{"click .et-pb-settings":"showSettings","click .et-pb-clone-module":"cloneModule","click .et-pb-remove-module":"removeModule","click .et-pb-unlock":"unlockModule",contextmenu:"showRightClickOptions","click.et-pb-right-click":"hideRightClickOptions","click.et-ab-testing":"setABTesting"},render:function(){var e=j.getParentViews(this.model.get("parent"));return this.$el.html(this.template(this.model.attributes)),(void 0!==this.model.attributes.et_pb_global_module||void 0!==this.model.attributes.et_pb_template_type&&"module"===this.model.attributes.et_pb_template_type&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&_.each(e,function(e){e.$el.addClass("et_pb_children_locked")}),void 0!==this.model.get("et_pb_parent_locked")&&"on"===this.model.get("et_pb_parent_locked")&&this.$el.addClass("et_pb_parent_locked"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"module",this.model)||this.$el.addClass("et_pb_ab_no_permission")),"removed"===this.model.get("component_status")?this:(j.isModuleFullwidth(this.model.get("module_type"))&&this.$el.addClass("et_pb_fullwidth_module"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),this)},cloneModule:function(e){var t,i="",o={model:this.model,view:this.$el,view_event:e};e.preventDefault(),T.isLoading||J.is_selecting()||this.isModuleLocked()||(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"module")?((this.$el.closest(".et_pb_section.et_pb_global").length||this.$el.closest(".et_pb_row.et_pb_global").length)&&""===et_pb_options.template_post_id&&(i=Pe(this)),t=new a.RightClickOptionsView(o,!0),T.allowHistorySaving("cloned","module",this.model.get("admin_label")),t.copy(e),t.pasteAfter(e),""!==i&&Ie(i)):J.alert("has_no_permission"))},renameModule:function(){this.$(".et-pb-module-title").html(this.model.get("admin_label"))},removeGlobal:function(){this.isModuleLocked()||void 0===this.model.get("et_pb_global_module")&&this.$el.removeClass("et_pb_global")},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},showSettings:function(t){var o=this,n={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),i(),!this.isModuleLocked()&&!T.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"module")){if(void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module"))!function(t){var i,o=t.model.get("et_pb_global_module"),n="html"===ie()?"skip":"apply";e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_global_module",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_global_id:o,et_global_autop:n},beforeSend:function(){y.trigger("et-pb-loading:started")},complete:function(){y.trigger("et-pb-loading:ended")},success:function(n){if(!n||n.error)j.removeGlobalAttributes(t);else{var s=T.getShortCodeParentTags(),l=window.wp.shortcode.regexp(s),d=T.wp_regexp_not_global(s),r=qe(n.shortcode).match(l),p=n.sync_status,c="updated"===p?JSON.parse(n.excluded_options):[];"updated"===p?g[o]=0<c.length?c:[]:h[o]=[],_.each(r,function(i,n){var a=i.match(d),s=a[2],r=""!==a[3]?window.wp.shortcode.attrs(a[3]):"",c=a[5],b=(void 0!==c&&""!==c&&c.match(l),r.named.saved_tabs||t.model.get("et_pb_saved_tabs")),u="updated"!==p&&"all"!==b&&-1===b.indexOf("general"),f="updated"===p?-1===g[o].indexOf("et_pb_content_field"):""!==b&&(-1!==b.indexOf("general")||"all"===b);if("all"===b&&"updated"!==p&&(g[o]=[],p="updated"),_.isObject(r.named))for(var m in r.named)if("template_type"!==m&&("admin_label"!==m||"admin_label"===m&&!u)){if("updated"===p&&-1!==g[o].indexOf(m))continue;var v="admin_label"!==m?"et_pb_"+m:m;""!==m&&t.model.set(v,r.named[m],{silent:!0}),"updated"!==p&&h[o].push(m)}if(f){var w="et_pb_content",y=T.getShortCodeRawContentTags();e.inArray(s,y)>-1&&(w="et_pb_raw_content",c=(c=c).replace(/<!-- \[et_pb_line_break_holder\] -->/g,"\n")),t.model.set(w,c,{silent:!0}),"updated"!==p&&h[o].push("et_pb_content_field")}"updated"!==p&&t.model.set("legacy_synced_options",h[o],{silent:!0})})}i=new a.ModalView(t),e("body").append(i.render().el),!0===t.triggered_by_right_click&&!0===t.do_preview&&e(".et-pb-modal-preview-template").trigger("click"),n&&!n.error&&(e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal et_pb_modal_selective_sync"),Je(e(".et_pb_modal_settings_container"),o))}})}(n),this.triggered_by_right_click=void 0,this.do_preview=void 0;else{var s=new a.ModalView(n).render();if(!1===s)return k(!0),setTimeout(function(){o.showSettings()},500),void y.trigger("et-pb-loading:started");y.trigger("et-pb-loading:ended"),e("body").append(s.el)}Re(),(void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")||j.getView(this.model.get("cid")).$el.closest(".et_pb_global").length)&&(e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal"),"module"===et_pb_options.global_module_type&&(Je(e(".et_pb_modal_settings_container"),et_pb_options.template_post_id),e(".et_pb_modal_settings_container").addClass("et_pb_modal_selective_sync")))}else J.alert("has_no_permission")},removeModule:function(e){var t="";if(!this.isModuleLocked()&&!T.isLoading&&(!J.is_selecting()||j.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"module"))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&!j.get("forceRemove"))return}e&&(e.preventDefault(),(this.$el.closest(".et_pb_section.et_pb_global").length||this.$el.closest(".et_pb_row.et_pb_global").length)&&""===et_pb_options.template_post_id&&(t=Pe(this))),this.model.destroy(),T.allowHistorySaving("removed","module",this.model.get("admin_label")),j.removeView(this.model.get("cid")),this.remove(),e&&y.trigger("et-module:removed"),""!==t&&Ie(t),J.update()}},unlockModule:function(e){if(e.preventDefault(),!T.isLoading&&!J.is_selecting()){var t,i=this,o=i.$el.closest(".et_pb_module_block");Ne().done(function(e){!0===e?(o.removeClass("et_pb_locked"),i.options.model.attributes.et_pb_locked="off",t=j.getParentViews(i.model.get("parent")),_.each(t,function(e,t){j.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")}),T.allowHistorySaving("unlocked","module",i.options.model.get("admin_label")),T.saveAsShortcode()):alert(et_pb_options.locked_module_permission_alert)})}},isModuleLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.HelpView=window.wp.Backbone.View.extend({tagName:"div",id:"et-builder-help",className:"et_pb_modal_settings",template:_.template(e("#et-builder-help-template").html()),isOSX:-1!=navigator.userAgent.indexOf("Mac OS X"),renderKbd:function(t){var i=t;return"super"===i&&(i=this.isOSX?"cmd":"ctrl"),e("<kbd />",{class:"key-"+i}).html(i)},render:function(){var t=this,o=this.$el;i(),o.html(this.template());var n=o.find(".et-pb-shortcuts-tab");return _.each(et_pb_help_options.shortcuts,function(i){_.each(i,function(i){if(_.isUndefined(i.title)){var o=e("<p />",{class:"et-pb-shortcut-item"}),a=e("<span />",{class:"et-pb-shortcut-keys"});_.each(i.kbd,function(i,o){o>0&&a.append(" + "),_.isArray(i)?_.each(i,function(t,i){i>0&&a.append(" / "),a.append(e("<kbd />").html(t))}):a.append(t.renderKbd(i))}),o.append(a),o.append(e("<span />",{class:"et-pb-shortcut-desc"}).html(i.desc)),n.append(o)}else n.append(e("<h2 />",{class:"et-pb-shortcut-subtitle"}).html(i.title))})}),this}}),a.RightClickOptionsView=window.wp.Backbone.View.extend({tagName:"div",id:"et-builder-right-click-controls",template:_.template(e("#et-builder-right-click-controls-template").html()),events:{"click .et-pb-right-click-rename":"rename","click .et-pb-right-click-start-ab-testing":"startABTesting","click .et-pb-right-click-end-ab-testing":"endABTesting","click .et-pb-right-click-save-to-library":"saveToLibrary","click .et-pb-right-click-undo":"undo","click .et-pb-right-click-redo":"redo","click .et-pb-right-click-disable":"disable","click .et_pb_disable_on_option":"disable_device","click .et-pb-right-click-lock":"lock","click .et-pb-right-click-collapse":"collapse","click .et-pb-right-click-copy":"copy","click .et-pb-right-click-paste-after":"pasteAfter","click .et-pb-right-click-paste-app":"pasteApp","click .et-pb-right-click-paste-column":"pasteColumn","click .et-pb-right-click-preview":"preview","click .et-pb-right-click-disable-global":"disableGlobal"},initialize:function(t,i){var o;i=!_.isUndefined(i)&&i;if(this.type=this.options.model.attributes.type,this.et_pb_has_storage_support=He(),this.has_compatible_clipboard_content=Ye.get(this.getClipboardType()),this.history_noun="row_inner"===this.type?"row":this.type,!T.isLoading&&!J.is_selecting()){if("1"===et_pb_options.is_divi_library&&!1!==this.has_compatible_clipboard_content){switch(et_pb_options.layout_type){case"module":o=[];break;case"row":o=["module"];break;case"section":o=["module","row"];break;default:o=["module","row","section"]}-1==e.inArray(this.type,o)&&(this.has_compatible_clipboard_content=!1)}!1===i&&this.render()}},render:function(){var t=e(this.options.view),i=this.$el.html(this.template()),o=this.options.view.offset(),n=this.options.view_event.pageX-o.left-100,a=this.options.view_event.pageY-o.top;this.closeAllRightClickOptions(),e(this.options.view_event.toElement).is("#et-builder-right-click-controls a")||i.find("li").length<1||(t.append(i),i.find(".options").css({top:a,left:n,"margin-top":0-i.find(".options").height()-40}).animate({"margin-top":0-i.find(".options").height()-10,opacity:1},300),e("#et_pb_layout").prepend('<div id="et_pb_layout_right_click_overlay" />'))},closeAllRightClickOptions:function(){return i(),!1},rename:function(e){e.preventDefault();this.$el.parent();G("rename_admin_label",this.options.model.attributes.cid),this.closeAllRightClickOptions()},startABTesting:function(t){this.closeAllRightClickOptions(),J.toggle_status(!0),T.disable_publish=!0,e("#publish").addClass("disabled"),J.check_create_db(),T.is_selecting_ab_testing_subject=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_subject")},endABTesting:function(e){this.closeAllRightClickOptions(),J.toggle_status(!1),T.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing")},disableGlobal:function(e){e.preventDefault(),this.closeAllRightClickOptions(),j.removeGlobalAttributes(this),Ue()},saveToLibrary:function(t){t.preventDefault();var i=this.options.model,o=i.attributes.type,n={model:i,collection:$,attributes:{"data-open_view":"module_settings"}};if(this.closeAllRightClickOptions(),!J.is_active()||!J.is_ab_testing_item(i)&&"app"!==o)if("app"===this.type)G("save_layout");else{var s=new a.ModalView(n);e("body").append(s.render().el),Re(),s.saveTemplate(t)}else J.alert("cannot_save_"+o+"_layout_has_ab_testing")},undo:function(e){e.preventDefault(),T.undo(e),this.closeAllRightClickOptions()},redo:function(e){e.preventDefault(),T.redo(e),this.closeAllRightClickOptions()},disable:function(t){t.preventDefault();var i,o,n,a=e(t.target).hasClass("et-pb-right-click-disable")?e(t.target):e(t.target).closest("a"),s=a.closest("li").find("span.et_pb_disable_on_options"),l=s.find("span.et_pb_disable_on_option"),_=void 0!==this.options.model.attributes.et_pb_disabled&&"on"===this.options.model.attributes.et_pb_disabled,d=void 0!==this.options.model.attributes.et_pb_disabled_on?this.options.model.attributes.et_pb_disabled_on:"";return a.addClass("et_pb_right_click_hidden"),s.addClass("et_pb_right_click_visible"),_?l.addClass("et_pb_disable_on_active"):""!==d&&(i=d.split("|"),o=0,n="phone",l.each(function(){var t=e(this);t.hasClass("et_pb_disable_on_"+n)&&"on"===i[o]&&t.addClass("et_pb_disable_on_active"),n=1===++o?"tablet":"desktop"})),!1},disable_device:function(t){var i,o,n,a,s=e(t.target),l=(e(this),s.hasClass("et_pb_disable_on_active")?"off":"on"),_=void 0!==this.options.model.attributes.et_pb_disabled_on?this.options.model.attributes.et_pb_disabled_on:"",d=this.$el.parent();return s.hasClass("et_pb_disable_on_phone")?(n=0,a="phone"):s.hasClass("et_pb_disable_on_tablet")?(n=1,a="tablet"):(n=2,a="desktop"),(o=""!==_?_.split("|"):["","",""])[n]=l,this.options.model.attributes.et_pb_disabled_on=o[0]+"|"+o[1]+"|"+o[2],"on"===o[0]&&"on"===o[1]&&"on"===o[2]?(d.addClass("et_pb_disabled"),this.options.model.attributes.et_pb_disabled="on",i="disabled"):(d.removeClass("et_pb_disabled"),this.options.model.attributes.et_pb_disabled="off",i="off"===l?"enabled":"disabled"),s.toggleClass("et_pb_disable_on_active"),this.updateGlobalModule(),T.allowHistorySaving(i,this.history_noun,void 0,a),T.saveAsShortcode(),!1},lock:function(e){e.preventDefault(),this.$el.parent().hasClass("et_pb_locked")?(this.unlockItem(),T.allowHistorySaving("unlocked",this.history_noun)):(this.lockItem(),T.allowHistorySaving("locked",this.history_noun)),this.closeAllRightClickOptions(),T.saveAsShortcode()},unlockItem:function(){var e,t,i=this,o=i.$el.parent();Ne().done(function(n){!0===n?(o.removeClass("et_pb_locked"),i.options.model.attributes.et_pb_locked="off","module"!==i.options.model.get("type")&&(e=j.getChildrenViews(i.model.get("cid")),_.each(e,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})})),"section"!==i.options.model.get("type")&&(t=j.getParentViews(i.model.get("parent")),_.each(t,function(e,t){j.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")})),T.allowHistorySaving("unlocked",i.history_noun),T.saveAsShortcode(),i.updateGlobalModule()):alert(et_pb_options.locked_item_permission_alert)})},lockItem:function(){var e,t,i=this,o=i.$el.parent();Ne().done(function(n){!0===n?(o.addClass("et_pb_locked"),i.options.model.attributes.et_pb_locked="on","module"!==i.options.model.get("type")&&(e=j.getChildrenViews(i.model.get("cid")),_.each(e,function(e,t){e.$el.addClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","on",{silent:!0})})),"section"!==i.options.model.get("type")&&(t=j.getParentViews(i.model.get("parent")),_.each(t,function(e,t){e.$el.addClass("et_pb_children_locked")})),T.allowHistorySaving("locked",i.history_noun),T.saveAsShortcode(),i.updateGlobalModule()):alert(et_pb_options.locked_item_permission_alert)})},collapse:function(e){e.preventDefault();var t,i=this.$el.parent(),o=this.options.model.attributes.cid;i.toggleClass("et_pb_collapsed"),i.hasClass("et_pb_collapsed")?(this.options.model.attributes.et_pb_collapsed="on",t="collapsed"):(this.options.model.attributes.et_pb_collapsed="off",t="expanded"),J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(o),this.updateGlobalModule(),this.closeAllRightClickOptions(),T.allowHistorySaving(t,this.history_noun),T.saveAsShortcode()},copy:function(e,t){t||e.preventDefault();var i,o=_.clone(this.model.attributes),n=o.type;"row_inner"===n&&(n="row"),_.isUndefined(o.view)||delete o.view,_.isUndefined(o.appendAfter)||delete o.appendAfter,"row"!==n&&"section"!==n||(o.childviews=this.getChildViews(o.cid)),delete o.className,delete o.et_pb_locked,i=JSON.stringify(o),Ye.set(this.getClipboardType(),i),this.closeAllRightClickOptions()},pasteAfter:function(e,t,i,o,n,a){if(n||e.preventDefault(),Fe(this.model)){t=_.isUndefined(t)?this.model.get("parent"):t,i=_.isUndefined(i)?this.getClipboardType():i,o=!!_.isUndefined(o)||o;var s,l=j.getView(t);s=Ye.get(i),s=JSON.parse(s),_.isUndefined(s.et_pb_ab_subject)&&"on"!==s.et_pb_ab_subject||(s.et_pb_ab_subject_id=J.get_subject_id()),o&&(s.cloned_cid=this.model.get("cid")),this.setPasteViews(s,t,"main_parent"),!J.is_active()||"row"!==s.type&&"row_inner"!==s.type&&"section"!==s.type||"on"!==s.et_pb_ab_subject||J.subject_carousel(s.cid),y.trigger("et-advanced-module:updated"),y.trigger("et-advanced-module:saved"),_.isUndefined(l)||!j.is_global(l.model)&&!j.is_global_children(l.model)||this.updateGlobalModule(),this.closeAllRightClickOptions(),"did"!==U.verb||a||T.allowHistorySaving("copied",this.history_noun),n||T.saveAsShortcode()}},pasteApp:function(e){e.preventDefault();var t=$.where({type:"section"}),i=_.last(t);this.model=i,this.options.model=i,this.pasteAfter(e,void 0,"et_pb_clipboard_section",!1)},pasteColumn:function(e){e.preventDefault();var t=this.model.get("cid"),i="section"===this.model.get("type")?"et_pb_clipboard_module_fullwidth":"et_pb_clipboard_module";this.pasteAfter(e,t,i,!1)},getClipboardType:function(){var e="et_pb_clipboard_"+this.model.attributes.type;return"et_pb_fullwidth"===(_.isUndefined(this.model.attributes.module_type)?this.model.attributes.type:this.model.attributes.module_type).substr(0,"et_pb_fullwidth".length)&&(e+="_fullwidth"),e},getChildViews:function(e){var t,i=this,o=$.models,n=[];return _.each(o,function(o,a){o.attributes.parent===e&&(t=o.attributes,_.isUndefined(t.view)||delete t.view,_.isUndefined(t.appendAfter)||delete t.appendAfter,t.created="manually",t.childviews=i.getChildViews(o.attributes.cid),n.push(t))}),n},setPasteViews:function(e,t,i){var o=this,n=j.generateNewId(),a=this.model.collection.indexOf(this.model),s=!(_.isUndefined(e.childviews)||!_.isArray(e.childviews))&&e.childviews;e.cid=n,e.parent=t,e.created="manually",e.pasted_module=void 0!==i&&"main_parent"===i,_.isUndefined(e.et_pb_global_parent)||""===e.et_pb_global_parent||(e.et_pb_global_parent=Pe(j.getView(t))),!_.isUndefined(e.et_pb_global_module)&&_.isUndefined(e.global_parent_cid)&&_.isUndefined(this.set_global_parent_cid)&&(this.global_parent_cid=n,this.set_global_parent_cid=!0),_.isUndefined(e.global_parent_cid)||(e.global_parent_cid=this.global_parent_cid),_.each(["et_pb_global_parent","global_parent_cid"],function(t){!_.isUndefined(o.options.model.get(t))&&_.isUndefined(e[t])&&(e[t]=o.options.model.get(t))}),_.isUndefined(e.et_pb_template_type)||delete e.et_pb_template_type,_.isUndefined(e.et_pb_ab_subject)&&"on"!==e.et_pb_ab_subject||(e.et_pb_ab_subject_id=J.get_subject_id()),delete e.childviews,_.isUndefined(e.admin_label)&&(e.admin_label=_.isUndefined(e.module_type)?"":j.getDefaultAdminLabel(e.module_type)),this.model.collection.add(e,{at:a}),s&&_.each(s,function(e){o.setPasteViews(e,n)})},updateGlobalModule:function(){var e;j.is_global(this.model)?e=this.options.model.get("cid"):j.is_global_children(this.model)&&(e=this.options.model.get("global_parent_cid")),_.isUndefined(e)||Ie(e)},hasOption:function(e){var t="function"==typeof this.model.get&&this.model.get("cid"),i=!1,o=this.options.model.attributes.type,n=J.is_active(),a=!!n&&J.is_goal(this.model),s=!!n&&J.is_goal_children(this.model),l=!!n&&J.has_goal(this.model),d=!!n&&J.is_subject(this.model),r=!!n&&J.is_subject_children(this.model),p=!n||J.is_user_has_permission(t,"right_click_change"),c=!n||J.is_user_has_permission(t,"copy"),b=!n||J.is_user_has_permission(t,"paste");switch(e){case"rename":this.hasOptionSupport(["module","section","row_inner","row"])&&"on"!==this.options.model.attributes.et_pb_locked&&p&&(i=!0);break;case"save-to-library":!this.hasOptionSupport(["app","section","row_inner","row","module"])||j.is_global(this.options.model)||j.is_global_children(this.options.model)||"on"===this.options.model.attributes.et_pb_locked||J.is_active()&&(J.is_ab_testing_item(this.options.model)||"app"===o)||"1"===et_pb_options.is_divi_library||(i=!0);break;case"start-ab-testing":this.hasOptionSupport(["section","row_inner","row","module"])&&!n&&(i=!0);break;case"end-ab-testing":this.hasOptionSupport(["section","row_inner","row","module"])&&(d||a||r||s)&&n&&(i=!0);break;case"disable-global":this.hasOptionSupport(["section","row_inner","row","module"])&&(j.is_global(this.options.model)||j.is_global_children(this.options.model))&&(i=!0);break;case"undo":this.hasOptionSupport(["app","section","row_inner","row","column","column_inner","module"])&&this.hasUndo()&&(i=!0);break;case"redo":this.hasOptionSupport(["app","section","row_inner","row","column","column_inner","module"])&&this.hasRedo()&&(i=!0);break;case"disable":this.hasOptionSupport(["section","row_inner","row","module"])&&"on"!==this.options.model.attributes.et_pb_locked&&!1===this.hasDisabledParent()&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&p&&(i=!0);break;case"lock":this.hasOptionSupport(["section","row_inner","row","module"])&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&p&&(i=!0);break;case"collapse":this.hasOptionSupport(["section","row_inner","row"])&&"on"!==this.options.model.attributes.et_pb_locked&&(!J.is_active()||"on"!==this.options.model.get("et_pb_ab_subject")||"off"!==this.options.model.get("et_pb_collapsed")&&!_.isUndefined(this.options.model.get("et_pb_collapsed")))&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&(i=!0);break;case"copy":this.hasOptionSupport(["section","row_inner","row","module"])&&this.et_pb_has_storage_support&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&c&&!a&&!l&&(i=!0);break;case"paste-after":this.hasOptionSupport(["section","row_inner","row","module"])&&this.et_pb_has_storage_support&&this.has_compatible_clipboard_content&&b&&Fe(this.options.model)&&(i=!0);break;case"paste-app":this.hasOptionSupport(["app"])&&this.et_pb_has_storage_support&&Ye.get("et_pb_clipboard_section")&&(i=!0);break;case"paste-column":!_.isUndefined(this.model.attributes.is_insert_module)&&(("column"===this.type||"column_inner"==this.type)&&Ye.get("et_pb_clipboard_module")||"section"===this.type&&Ye.get("et_pb_clipboard_module_fullwidth"))&&this.et_pb_has_storage_support&&(i=!0);break;case"preview":this.hasOptionSupport(["section","row_inner","row","module"])&&"on"!==this.options.model.attributes.et_pb_locked&&(i=!0)}return i},hasOptionSupport:function(e){return!_.isUndefined(_.findWhere(e,this.type))},hasUndo:function(){return T.hasUndo()},hasRedo:function(){return T.hasRedo()},hasDisabledParent:function(){for(var e=j.getView(this.model.attributes.parent),t={},i=!1;!_.isUndefined(e);)_.isUndefined(e.model.attributes.et_pb_disabled)||"on"!==e.model.attributes.et_pb_disabled||(i=!0),t[e.model.attributes.cid]=e,e=j.getView(e.model.attributes.parent);return i},preview:function(t){t.preventDefault();var i=j.getView(this.model.get("cid"));this.closeAllRightClickOptions(),i.triggered_by_right_click=!0,i.do_preview=!0,i.showSettings(t),e(".et-pb-modal-preview-template").trigger("click")}}),a.visualizeHistoriesView=window.wp.Backbone.View.extend({el:"#et-pb-histories-visualizer",template:_.template(e("#et-builder-histories-visualizer-item-template").html()),events:{"click li":"rollback"},verb:"did",noun:"module",noun_alias:void 0,addition:"",getItemID:function(e){return"#et-pb-history-"+e.get("timestamp")},getVerb:function(){var e=this.verb;return _.isUndefined(et_pb_options.verb[e])||(e=et_pb_options.verb[e]),e},getNoun:function(){var e=this.noun;return _.isUndefined(this.noun_alias)?_.isUndefined(et_pb_options.noun[e])||(e=et_pb_options.noun[e]):e=this.noun_alias,e},getAddition:function(){var e=this.addition;return _.isUndefined(et_pb_options.addition[e])||(e=et_pb_options.addition[e]),e},addItem:function(e){this.options=e,this.$el.prepend(this.template()),this.setHistoriesHeight()},changeItem:function(t){var i=this.getItemID(t),o=e(i),n=t.collection.findWhere({current_active_history:!0}),a=t.collection.indexOf(n),s=t.collection.indexOf(t);this.options=t,this.$el.find("li").removeClass("undo redo active"),a===s?(o.addClass("active"),this.$el.find("li:lt("+o.index()+")").addClass("redo"),this.$el.find("li:gt("+o.index()+")").addClass("undo")):this.$el.find("li:not( .active, .redo )").addClass("undo"),this.setHistoriesHeight()},removeItem:function(e){var t=this.getItemID(e);this.$el.find(t).remove(),this.setHistoriesHeight()},setHistoryMeta:function(e,t,i,o){_.isUndefined(e)||(this.verb=e),_.isUndefined(t)||(this.noun=t),_.isUndefined(i)?this.noun_alias=void 0:this.noun_alias=i,_.isUndefined(o)||(this.addition=o)},setHistoriesHeight:function(){var t=this;setTimeout(function(){var i=e("#et_pb_layout"),o=i.find(".hndle"),n=e("#et_pb_layout_controls"),a=i.outerHeight()-o.outerHeight()-n.outerHeight();t.$el.css({"max-height":a})},200)},rollback:function(t){t.preventDefault();var i=e(t.target),o=(i.is("li")?i:i.parent("li")).data("timestamp"),n=this.options.collection.findWhere({timestamp:o}),a=n.get("shortcode");T.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),y.trigger("et-pb-loading:started"),ae("content",a,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),i=t.innerHeight();t.css({height:i}),T.removeAllSections(),T.$el.find(".et_pb_section").remove(),T.enable_history=!1,T.createLayoutFromContent(Oe(a),"","",{is_reinit:"reinit"}),J.is_active_based_on_models()?(J.toggle_status(!0),Ue()):J.toggle_status(!1),t.css({height:"auto"}),y.trigger("et-pb-loading:ended"),T.updateHistoriesButtonState()},600)}}),a.AppView=window.wp.Backbone.View.extend({el:e("#et_pb_main_container"),template:_.template(e("#et-builder-app-template").html()),template_button:_.template(e("#et-builder-add-specialty-section-button").html()),events:{"click .et-pb-layout-buttons-save":"saveLayout","click .et-pb-layout-buttons-load":"loadLayout","click .et-pb-layout-buttons-clear":"clearLayout","click .et-pb-layout-buttons-history":"toggleHistory","click #et-pb-histories-visualizer-overlay":"closeHistory","contextmenu #et-pb-histories-visualizer-overlay":"closeHistory","click .et-pb-layout-buttons-redo":"redo","click .et-pb-layout-buttons-undo":"undo","click .et-pb-layout-buttons-view-ab-stats":"viewABStats","click .et-pb-layout-buttons-settings":"settings","contextmenu .et-pb-layout-buttons-save":"showRightClickOptions","contextmenu .et-pb-layout-buttons-load":"showRightClickOptions","contextmenu .et-pb-layout-buttons-clear":"showRightClickOptions","contextmenu .et-pb-layout-buttons-redo":"showRightClickOptions","contextmenu .et-pb-layout-buttons-undo":"showRightClickOptions","contextmenu #et_pb_main_container_right_click_overlay":"showRightClickOptions","click #et_pb_main_container_right_click_overlay":"hideRightClickOptions"},initialize:function(){this.listenTo(this.collection,"add",this.addModule),this.listenTo(V,"add",this.addVisualizeHistoryItem),this.listenTo(V,"change",this.changeVisualizeHistoryItem),this.listenTo(V,"remove",this.removeVisualizeHistoryItem),this.listenTo(y,"et-sortable:update",_.debounce(this.saveAsShortcode,128)),this.listenTo(y,"et-model-changed-position-within-column",_.debounce(this.saveAsShortcode,128)),this.listenTo(y,"et-module:removed",_.debounce(this.saveAsShortcode,128)),this.listenTo(y,"et-pb-loading:started",this.startLoadingAnimation),this.listenTo(y,"et-pb-loading:ended",this.endLoadingAnimation),this.listenTo(y,"et-pb-content-updated",this.recalculateModulesOrder),this.listenTo(y,"et-advanced-module:updated_order",this.updateAdvancedModulesOrder),this.listenTo(y,"et-pb-content-updated",_.debounce(this.updateYoastContent,500)),this.$builder_toggle_button=e("body").find("#et_pb_toggle_builder"),this.$builder_toggle_button_wrapper=e("body").find(".et_pb_toggle_builder_wrapper"),this.render(),this.maybeGenerateInitialLayout(),e("#et_builder_version").val("BB|"+window.et_builder_product_name+"|"+window.et_builder_version)},render:function(){return this.$el.html(this.template()),this.makeSectionsSortable(),this.addLoadingAnimation(),e("#et_pb_main_container_right_click_overlay").remove(),this.$el.prepend('<div id="et_pb_main_container_right_click_overlay" />'),this.updateHistoriesButtonState(),this},addLoadingAnimation:function(){e("body").append('<div id="et_pb_loading_animation"></div>'),this.$loading_animation=e("#et_pb_loading_animation").hide()},startLoadingAnimation:function(){this.pageBuilderIsActive()&&(this.$loading_animation.next().length&&(e("body").append(this.$loading_animation),this.$loading_animation=e("#et_pb_loading_animation")),this.$loading_animation.show(),this.isLoading=!0)},endLoadingAnimation:function(){this.$loading_animation.hide(),this.isLoading=!1;try{var e=window.localStorage.getItem("et_page_loading");e&&(console.log("Builder load : %c%f","color: red",parseInt((Date.now()-parseInt(e,10))/10,10)/100),window.localStorage.removeItem("et_page_loading"))}catch(e){}},pageBuilderIsActive:function(){return this.$builder_toggle_button.hasClass("et_pb_builder_is_used")||this.$builder_toggle_button_wrapper.hasClass("et_pb_builder_is_used")},saveLayout:function(e){e.preventDefault(),J.is_active()?J.alert("cannot_save_app_layout_has_ab_testing"):(i(),G("save_layout"))},loadLayout:function(t){var o;t.preventDefault(),i(),J.is_active()?J.alert("cannot_load_layout_has_ab_testing"):(o=new a.ModalView({attributes:{"data-open_view":"save_layout"},view:this}),e("body").append(o.render().el))},clearLayout:function(e){e.preventDefault(),i(),J.is_active()?J.alert("cannot_clear_layout_has_ab_testing"):G("clear_layout")},getHistoriesCount:function(){return this.options.history.length},getHistoriesIndex:function(){var e=this.options.history.findWhere({current_active_history:!0});return _.isUndefined(e)?this.options.history.models.length-1:this.options.history.indexOf(e)},isDoingCombination:function(){return!_.isUndefined(this.is_doing_combination)&&this.is_doing_combination},enableHistory:function(){return!_.isUndefined(this.enable_history)&&this.enable_history},allowHistorySaving:function(e,t,i,o){this.enable_history=!0,U.setHistoryMeta(e,t,i,o)},codeModuleContentPrepCB:function(e,t){var i=t;return i=(i=(i=(i=i.replace(/<br[\s]?[\/]?>/g,"<!\u2013- [et_pb_br_holder] -\u2013>")).replace(/<p /g,"<pee ")).replace(/<p>/g,"<pee>")).replace(/<\/p>/g,"</pee>"),e.replace(t,i)},codeModuleContentPrep:function(e){return e=(e=e.replace(/\[et_pb_code.*?\]([^]*)\[\/et_pb_code\]/g,this.codeModuleContentPrepCB)).replace(/\[et_pb_fullwidth_code.*?\]([^]*)\[\/et_pb_fullwidth_code\]/g,this.codeModuleContentPrepCB)},codeModuleContentUnPrepCB:function(e,t){var i=t;return i=(i=(i=(i=(i=(i=i.replace(/\n/g,"")).replace(/<p>/g,"")).replace(/<\/p>/g,"")).replace(/<!\u2013- \[et_pb_br_holder\] -\u2013>/g,"<br />")).replace(/<pee/g,"<p")).replace(/<\/pee>/g,"</p>"),e.replace(t,i)},codeModuleContentUnPrep:function(e){return e=(e=e.replace(/\[et_pb_code.*?\]([^]*)\[\/et_pb_code\]/g,this.codeModuleContentUnPrepCB)).replace(/\[et_pb_fullwidth_code.*?\]([^]*)\[\/et_pb_fullwidth_code\]/g,this.codeModuleContentUnPrepCB)},reviseHistories:function(){var e,t=this;if(this.hasRedo()){var i=_.range(this.getHistoriesIndex()+1,this.getHistoriesCount()).reverse();_.each(i,function(i){e=t.options.history.at(i),t.options.history.remove(e)})}this.updateHistoriesButtonState()},resetCurrentActiveHistoryMarker:function(){var e=this.options.history.where({current_active_history:!0});_.isEmpty(e)||_.each(e,function(e){e.set({current_active_history:!1})})},hasUndo:function(){return this.getHistoriesIndex()>0},hasRedo:function(){return this.getHistoriesCount()-this.getHistoriesIndex()>1},hasOverlayRendered:function(){return!!e(".et_pb_modal_overlay").length},updateHistoriesButtonState:function(){this.hasUndo()?e(".et-pb-layout-buttons-undo").removeClass("disabled"):e(".et-pb-layout-buttons-undo").addClass("disabled"),this.hasRedo()?e(".et-pb-layout-buttons-redo").removeClass("disabled"):e(".et-pb-layout-buttons-redo").addClass("disabled"),this.hasUndo()||this.hasRedo()?e(".et-pb-layout-buttons-history").removeClass("disabled"):e(".et-pb-layout-buttons-history").addClass("disabled")},getUndoModel:function(){var e=this.options.history.at(this.getHistoriesIndex()-1);return!_.isUndefined(e)&&e},undo:function(t){t.preventDefault();var i,o=this,n=this.getUndoModel();this.hasUndo()&&(_.isUndefined(n)||this.hasOverlayRendered()||(i=n.get("shortcode"),this.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),y.trigger("et-pb-loading:started"),ae("content",i,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),n=t.innerHeight();t.css({height:n}),T.removeAllSections(),T.$el.find(".et_pb_section").remove(),o.enable_history=!1,T.createLayoutFromContent(Oe(i),"","",{is_reinit:"reinit"}),t.css({height:"auto"}),y.trigger("et-pb-loading:ended"),o.updateHistoriesButtonState()},600)))},viewABStats:function(e){e.preventDefault(),"1"!==et_pb_options.is_divi_library&&G("view_ab_stats")},settings:function(e){e.preventDefault(),"1"!==et_pb_options.is_divi_library&&G("open_settings")},getRedoModel:function(){var e=this.options.history.at(this.getHistoriesIndex()+1);return!_.isUndefined(e)&&e},toggleHistory:function(t){t.preventDefault();var i=e("#et-pb-histories-visualizer");i.hasClass("active")&&(i.addClass("fadeout"),setTimeout(function(){i.removeClass("fadeout")},500)),e(".et-pb-layout-buttons-history, #et-pb-histories-visualizer, #et-pb-histories-visualizer-overlay").toggleClass("active")},closeHistory:function(e){e.preventDefault(),this.toggleHistory(e)},redo:function(t){t.preventDefault();var i,o=this,n=this.getRedoModel();this.hasRedo()&&!_.isUndefined(n)&&n&&(this.hasOverlayRendered()||(this.options.history.indexOf(n),i=n.get("shortcode"),this.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),y.trigger("et-pb-loading:started"),ae("content",i,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),n=t.innerHeight();t.css({height:n}),T.removeAllSections(),T.$el.find(".et_pb_section").remove(),o.enable_history=!1,T.createLayoutFromContent(Oe(i),"","",{is_reinit:"reinit"}),t.css({height:"auto"}),y.trigger("et-pb-loading:ended"),o.updateHistoriesButtonState()},600)))},addHistory:function(e){if(this.enableHistory()&&!this.isDoingCombination()){var t=new Date,i=t.getHours()>12?t.getHours()-12:t.getHours(),o=t.getMinutes(),n=t.getHours()>12?"PM":"AM";this.hasRedo()&&this.reviseHistories(),this.resetCurrentActiveHistoryMarker(),this.options.history.add({timestamp:_.now(),datetime:("0"+i).slice(-2)+":"+("0"+o).slice(-2)+" "+n,shortcode:e,current_active_history:!0,verb:U.verb,noun:U.noun},{validate:!0}),U.setHistoryMeta("did","something")}this.updateHistoriesButtonState()},addVisualizeHistoryItem:function(e){U.addItem(e)},changeVisualizeHistoryItem:function(e){U.changeItem(e)},removeVisualizeHistoryItem:function(e){U.removeItem(e)},maybeGenerateInitialLayout:function(){j.generateNewId();var t=this;y.trigger("et-pb-loading:started"),setTimeout(function(){var i="";if(void 0===window.tinyMCE||!window.tinyMCE.get("content")||window.tinyMCE.get("content").isHidden()||e("iframe#content_ifr").length)""!==(i=ee("content",!0))&&t.allowHistorySaving("loaded","page"),t.addHistory(i),t.pageBuilderIsActive()?-1!==i.indexOf("[et_pb_")||"1"===et_pb_options.is_divi_library&&"module"===et_pb_options.layout_type?-1!==i.indexOf("specialty_placeholder")?(t.createLayoutFromContent(Oe(i)),e(".et_pb_section_specialty").append(t.template_button())):t.createLayoutFromContent(Oe(i)):T.reInitialize():t.createLayoutFromContent(i),function(t,i){if(void 0===window.switchEditors)return;var o=tinyMCEPreInit.mceInit.et_pb_content.tadv_noautop;if(void 0!==o&&!0===o)return;_.each(T.collection.models,function(o){var n=e.parseJSON(et_pb_options.et_builder_modules_with_children);if(!_.includes(_.keys(n),o.get("module_type"))){var a=o.get("et_pb_content");if(void 0!==a){if("tinymce"===t)a=window.switchEditors.wpautop(a.replace(/<p>\xa0<\/p>/g,"<p>&nbsp;</p>"));else{if(!_.isUndefined(i)&&"initial_load"===i)return;a=window.switchEditors.pre_wpautop(a)}o.set("et_pb_content",a,{silent:!0})}}})}(ie(),"initial_load"),y.trigger("et-pb-content-updated"),y.trigger("et-pb-loading:ended"),e("#et_pb_main_container").addClass("et_pb_loading_animation"),setTimeout(function(){e("#et_pb_main_container").removeClass("et_pb_loading_animation")},500),t.listenTo(t.collection,"change reset add",_.debounce(t.saveAsShortcode,128)),J.update();else{if(30<++r){var o=e("#et-builder-failure-notice-template");return y.trigger("et-pb-loading:ended"),e("#et_pb_main_container").removeClass("et_pb_loading_animation"),void e("body").addClass("et_pb_stop_scroll").append(o.html())}t.maybeGenerateInitialLayout()}},500)},wp_regexp_not_global:_.memoize(function(e){return new RegExp("\\[(\\[?)("+e+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)")}),getShortCodeParentTags:function(e){var t="et_pb_section|et_pb_row|et_pb_column|et_pb_column_inner|et_pb_row_inner".split("|");if(t=t.concat(et_pb_options.et_builder_module_parent_shortcodes.split("|")),!_.isUndefined(e)&&""!==e){var i=e.split("|"),o=_.difference(i,t);_.isEmpty(o)||(t=_.union(t,o))}return t=t.join("|")},getShortCodeChildTags:function(){return et_pb_options.et_builder_module_child_shortcodes},getShortCodeRawContentTags:function(){return et_pb_options.et_builder_module_raw_content_shortcodes.split("|")},createLayoutFromContent:function(t,i,o,n,a){var s=this,l=_.isUndefined(t)||""===t?"":t.match(/\[([^\W\/\[\]\x00-\x20=]+)/g),d=l&&_.isArray(l)?l.join("|").replace(/\[/g,""):"",r=this.getShortCodeParentTags().split("|"),p=void 0===o||""===o?this.getShortCodeParentTags(d):this.getShortCodeChildTags(),c=window.wp.shortcode.regexp(p),b=this.wp_regexp_not_global(p),u=t.match(c),f=this.getShortCodeRawContentTags(),m=void 0===n?{}:n;_.each(u,function(t,o){var n,l=t.match(b),d=l[2],p=l[2],u=""!==l[3]?window.wp.shortcode.attrs(l[3]):"",v=l[5],w=j.generateNewId(),y={},k=e.inArray(p,["et_pb_section","et_pb_row","et_pb_column","et_pb_row_inner","et_pb_column_inner"])>-1,C=k&&void 0!==v&&""!==v&&v.match(c),S="",x=!k&&-1===_.indexOf(r,p);if(k&&(p=p.replace("et_pb_","")),n={type:p,cid:w,created:"manually",module_type:p,component_status:""},void 0!==m.current_row_cid&&""!==m.current_row_cid&&(n.current_row=m.current_row_cid),void 0!==m.global_parent&&""!==m.global_parent&&(n.et_pb_global_parent=m.global_parent,n.global_parent_cid=m.global_parent_cid),"section"===p&&void 0!==m.after_section&&""!==m.after_section&&(n.after_section=m.after_section),"section"!==p&&(n.parent=i),-1!==p.indexOf("et_pb_")&&(n.type="module"),d===n.type&&(n.type="module"),n.admin_label=x?p:j.getDefaultAdminLabel(p),n._address=_.isUndefined(m.predefined_address)?o.toString():m.predefined_address,_.isUndefined(a)||(n._address=a+"."+n._address),_.isObject(u.named)){var $=!1;for(var V in"global"!==et_pb_options.is_global_template||k||void 0===u.named.template_type||"module"!==u.named.template_type||("updated"===et_pb_options.selective_sync_status?g[et_pb_options.template_post_id]=et_pb_options.excluded_global_options:($=!0,h[et_pb_options.template_post_id]=[])),S=void 0!==u.named.global_module&&""===S?u.named.global_module:S,"reinit"===m.is_reinit&&("migrate"!==m.migrate_global_modules||""===S&&""===m.global_parent)||(u=function(e,t,i,o){var n=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations,a=!_.isUndefined(n.name_changes)&&n.name_changes,s=!_.isUndefined(n.value_changes)&&n.value_changes;a&&!_.isUndefined(a[i])&&_.forEach(a[i],function(t,i){!_.isUndefined(e.named[i])&&_.isUndefined(e.named[t])&&(e.named[t]=e.named[i])});s&&!_.isUndefined(s[t])&&_.forEach(s[t],function(t,i){e.named[i]=t});if(_.includes(["module","row"],o)){var l={},d=t.length;_.forEach(s,function(e,i){t+"."===String(i).substr(0,d+1)&&(l[i.substr(t.length+1)]=e)}),_.isEmpty(l)||(e.named.value_changes=l)}return e}(u,n._address,n.type,p)),u.named)if(void 0===m.ignore_template_tag||""===m.ignore_template_tag||"ignore_template"===m.ignore_template_tag&&"template_type"!==V){var U="admin_label"!==V&&"specialty_columns"!==V&&"value_changes"!==V?"et_pb_"+V:V,O=!1;"et_pb_signup"===p&&-1!==e.inArray(V,["description","footer_content"])&&(u.named[V]=u.named[V].replace(/%91/g,"[").replace(/%93/g,"]"),u.named[V]=u.named[V].replace(/%22/g,'"')),$&&h[et_pb_options.template_post_id].push(V),"column"!==p&&"column_inner"!==p||"et_pb_type"!==U||(U="layout"),_.isEmpty(m.unsynced_options)||-1===_.indexOf(m.unsynced_options,V)||(O=!0),O||(y[U]=u.named[V],"value_changes"===V&&delete u.named[V])}n=_.extend(n,y)}if("section"===p&&"on"===n.et_pb_specialty&&(v=v.replace(/(\[et_pb_(row |row_inner) [\s\S]*?\][\s\S]*\[\/et_pb_(row |row_inner)\])/im,te)),void 0!==n.specialty_columns&&(n.layout_specialty="1",n.specialty_columns=parseInt(n.specialty_columns)),C||!_.isUndefined(m.unsynced_options)&&!_.isEmpty(m.unsynced_options)&&-1!==_.indexOf(m.unsynced_options,"et_pb_content_field")||(e.inArray(p,f)>-1?(n.et_pb_raw_content=n.et_pb_raw_content||v||"",n.et_pb_raw_content=n.et_pb_raw_content.replace(/<!-- \[et_pb_line_break_holder\] -->/g,"\n")):n.et_pb_content=v),_.includes(["row","row_inner"],p)&&(n.et_pb_content=v),"et_pb_contact_form"===p&&void 0!==n.et_pb_custom_message&&(n.et_pb_custom_message=_.unescape(n.et_pb_custom_message.replace(/\|\|et_pb_line_break_holder\|\|/g,"\r\n"))),"undefined"!==!n.et_pb_disabled&&"on"===n.et_pb_disabled&&(n.className=" et_pb_disabled"),"undefined"!==!n.et_pb_locked&&"on"===n.et_pb_locked&&(n.className=" et_pb_locked"),void 0!==m.global_id&&""!==m.global_id&&(n.et_pb_global_module=m.global_id),!k&&-1===_.indexOf(r,p))return n.title=p,n.component_status="removed",void s.collection.add([n]);if(s.collection.add([n]),"reinit"===m.is_reinit||""===S||""!==S&&"row"!==p&&"row_inner"!==p&&"section"!==p){if(C){var A=void 0===m.global_parent||""===m.global_parent?S:m.global_parent,M=void 0===m.global_parent_cid||""===m.global_parent_cid?void 0!==S&&""!==S?w:"":m.global_parent_cid,L=k?"":C;s.createLayoutFromContent(v,w,L,{is_reinit:m.is_reinit,global_parent:A,global_parent_cid:M,migrate_global_modules:m.migrate_global_modules},n._address)}}else B++,function(t,i,o,n){e("body").find(".et_pb_global_loading_overlay").length||e("body").append('<div class="et_pb_global_loading_overlay"></div>');var a="html"===ie()?"skip":"apply";e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_global_module",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_global_id:t,et_global_autop:a},success:function(a){var s=!1;if(!a||a.error){var l=j.getView(i);if(!l)return void e("body").find(".et_pb_global_loading_overlay").remove();var d=l.$el.find("[data-cid]");l.model.unset("et_pb_global_module"),d.length&&d.each(function(){var t=e(this),i=t.data("cid");if(void 0!==i&&""!==i){var o=j.getView(i);void 0!==o&&o.model.unset("et_pb_global_parent")}})}else{var r=o.replace(/ global_parent="\S+"/g,""),p=qe(a.shortcode.replace(/template_type="\S+"/,'global_module="'+t+'"'));p=(p=p.replace(/]\s?\n\s?\n\s?/g,"] ").replace(/\s?\n\s?\n\s?\[/g," [")).replace(/]\s+/g,"]").replace(/\s+\[/g,"["),r=r.replace(/]\s+/g,"]").replace(/\s+\[/g,"["),oe("content")&&(p=p.replace(/\r?\n|\r/g,"")),_.unescape(p)!==_.unescape(r)&&(s=!0,T.createLayoutFromContent(a.shortcode,"","",{ignore_template_tag:"ignore_template",current_row_cid:i,global_id:t,is_reinit:"reinit",predefined_address:n}))}if(B===++z){var c=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations;(s||!1!==c)&&Ue(!0,"migrate"),setTimeout(function(){e("body").find(".et_pb_global_loading_overlay").remove()},650)}}})}(S,w,t,n._address),s.createLayoutFromContent(v,w,"",{is_reinit:"reinit"},n._address)})},addModule:function(t){var i,o,n,s={model:t,collection:$},l=void 0!==t.get("cloned_cid")&&t.get("cloned_cid");switch(t.get("type")){case"section":if(i=new a.SectionView(s),j.addView(t.get("cid"),i),_.isUndefined(t.get("view"))?void 0!==t.get("after_section")&&""!==t.get("after_section")?j.getView(t.get("after_section")).$el.after(i.render().el):void 0!==t.get("current_row")?this.replaceElement(t.get("current_row"),i):l?this.$el.find('div[data-cid="'+l+'"]').closest(".et_pb_section").after(i.render().el):this.$el.append(i.render().el):t.get("view").$el.after(i.render().el),"on"===t.get("et_pb_fullwidth")){e(i.render().el).addClass("et_pb_section_fullwidth");var d=new a.ColumnView(s);i.addChildView(d),e(i.render().el).find(".et-pb-section-content").append(d.render().el)}var r;if("on"===t.get("et_pb_specialty")&&"auto"===t.get("created")&&!t.get("pasted_module"))e(i.render().el).addClass("et_pb_section_specialty"),r=new a.ModalView({model:s.model,collection:s.collection,attributes:{"data-open_view":"column_specialty_settings"},et_view:i,view:i}),e("body").append(r.render().el);t.get("pasted_module")||"manually"===t.get("created")||"on"===t.get("et_pb_fullwidth")||"on"===t.get("et_pb_specialty")||i.addRow();break;case"row":case"row_inner":i=new a.RowView(s),""!==t.get("parent")&&j.getView(t.get("parent")).$el.find(".et-pb-insert-row").hide(),j.addView(t.get("cid"),i),_.isUndefined(t.get("current_row"))?_.isUndefined(t.get("appendAfter"))?l?j.getView(t.get("parent")).$el.find('div[data-cid="'+l+'"]').parent().after(i.render().el):j.getView(t.get("parent")).$el.find(".et-pb-section-content").length?j.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el):j.getView(t.get("parent")).$el.find("> .et-pb-insert-module, > .et-pb-insert-row").hide().end().append(i.render().el):t.get("appendAfter").after(i.render().el):this.replaceElement(t.get("current_row"),i),t.unset("columns_layout"),"manually"===t.get("created")&&"row_inner"===t.get("module_type")&&t.set("view",j.getView(t.get("parent")),{silent:!0});break;case"column":case"column_inner":s.className="et-pb-column et-pb-column-"+t.get("layout"),_.isUndefined(t.get("layout_specialty"))||"1"!==t.get("layout_specialty")||(s.className+=" et-pb-column-specialty"),i=new a.ColumnView(s),j.addView(t.get("cid"),i),_.isUndefined(t.get("layout_specialty"))?(n=void 0!==(o=j.getView(t.get("parent"))).model.get("columns_layout")?o.model.get("columns_layout")+","+t.get("layout"):t.get("layout"),o.model.set("columns_layout",n),"on"!==j.getView(t.get("parent")).model.get("et_pb_specialty")?(j.getView(t.get("parent")).$el.find(".et-pb-row-container").append(i.render().el),j.getView(t.get("parent")).toggleInsertColumnButton()):j.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el)):(j.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el),"1"===t.get("layout_specialty")&&("manually"!==t.get("created")&&this.collection.add([{type:"row",module_type:"row",cid:j.generateNewId(),parent:t.get("cid"),view:i,admin_label:et_pb_options.noun.row}]),j.getView(t.get("parent")).model.set("specialty_columns",parseInt(t.get("specialty_columns")))));break;case"module":if(s.attributes={"data-cid":t.get("cid")},"advanced"!==t.get("mode")&&"manually"===t.get("created")&&"column_inner"===j.getView(t.get("parent")).model.get("module_type")){var p=j.getView(t.get("parent")).model.get("parent");j.getView(p).$el.find(".et-pb-insert-column").hide()}if(void 0!==t.get("mode")&&"advanced"===t.get("mode"))i=new a.AdvancedModuleSettingView(s),t.attributes.view.child_views.push(i),void 0!==t.get("cloned_cid")&&""!==t.get("cloned_cid")?j.getView(t.get("cloned_cid")).$el.after(i.render().el):j.getView(t.get("parent")).$el.find(".et-pb-sortable-options").append(i.render().el),j.addView(t.get("cid"),i);else{var c="";if(y.trigger("et-new_module:show_settings"),i=new a.BlockModuleView(s),void 0!==t.attributes.view&&"on"===t.attributes.view.model.get("et_pb_fullwidth")?(j.getView(t.get("parent")).addChildView(i),c=j.getView(t.get("parent")).model.get("et_pb_template_type")):void 0!==t.attributes.view&&(c=j.getView(j.getView(t.get("parent")).model.get("parent")).model.get("et_pb_template_type")),l)j.getView(t.get("parent")).$el.find('div[data-cid="'+l+'"]').after(i.render().el);else if(j.getView(t.get("parent")).$el.find(".et-pb-insert-module").length)j.getView(t.get("parent")).$el.find(".et-pb-insert-module").before(i.render().el);else{var b=j.getView(t.get("parent"));void 0!==b.model.get("et_pb_fullwidth")&&"on"===b.model.get("et_pb_fullwidth")?b.$el.find(".et_pb_fullwidth_sortable_area").append(i.render().el):b.$el.append(i.render().el)}j.addView(t.get("cid"),i),void 0!==c&&"module"===c&&t.set("template_type","module",{silent:!0}),"manually"!==t.get("created")&&(s.attributes={"data-open_view":"module_settings"},this.openModuleSettings(s))}}t.unset("cloned_cid")},openModuleSettings:function(t){var i=this,o=new a.ModalView(t).render();if(!1===o)return setTimeout(function(){i.openModuleSettings(t)},500),void y.trigger("et-pb-loading:started");y.trigger("et-pb-loading:ended"),e("body").append(o.el)},saveAsShortcode:function(e,t,i){var o=arguments.length>0&&"object"===n(arguments[0])&&arguments[0].et_action||"";if(ne(),!i||"false"!==i.update_shortcodes){var a=this.generateCompleteShortcode();this.addHistory(a),J.update(),ae("content",a,o||""),y.trigger("et-pb-content-updated")}},getDefaultSectionBackgroundColor:function(){var t=e("#_et_pb_section_background_color").val();return""!==t&&t||(t="#ffffff"),t},getSectionsBackgroundColor:function(){var t=this,i=[];return this.$el.find(".et_pb_section").each(function(){var o=e(this).find(".et-pb-data-cid").data("cid"),n=C($.find(function(e){return e.get("cid")==o}),"attributes.et_pb_background_color","");""!==n&&n||(n=t.getDefaultSectionBackgroundColor()),i.push(n)}),i},generateCompleteShortcode:function(t,i,o,n,a){var s="",l=this,_=void 0===t;i=void 0===i?"":i;return this.$el.find(".et_pb_section").each(function(){var d=e(this).find(".et-pb-section-content"),r=!1,p=void 0!==d.data("skip")&&d.data("skip");(!1===_&&t===d.data("cid")||!0===_)&&!0!==p&&(s+=l.generateModuleShortcode(e(this),!0,i,o),r=!0),d.closest(".et_pb_section").hasClass("et_pb_section_fullwidth")?d.find(".et_pb_module_block").each(function(){var a=e(this).data("cid");(!1!==_||t!==a&&!0!==r)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n))}):!d.closest(".et_pb_section").hasClass("et_pb_section_specialty")||!0!==r&&!0!==_&&"module"!==i&&"row"!==i||!0===p?d.find(".et_pb_row").each(function(){var d=e(this),p=d.find(".et-pb-row-content"),c=p.data("cid"),b=!1,u=void 0!==p.data("skip")&&p.data("skip");(!1!==_||t!==c&&!0!==r)&&!0!==_||!0===u||(s+=l.generateModuleShortcode(e(this),!0,i,o),b=!0),d.find(".et-pb-column").each(function(){var d=e(this),p=d.data("cid");$.findWhere({cid:p});(!1!==_||!0!==r&&!0!==b)&&!0!==_||!0===u||(s+=l.generateModuleShortcode(e(this),!0,i,o,"column")),d.find(".et_pb_module_block").each(function(){var d=e(this).data("cid");(!1!==_||t!==d&&!0!==r&&!0!==b)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n,a))}),(!1!==_||!0!==r&&!0!==b)&&!0!==_||!0===u||(s+="[/et_pb_column]")}),(!1!==_||t!==c&&!0!==r)&&!0!==_||!0===u||(s+="[/et_pb_row]")}):d.find("> .et-pb-column").each(function(){var d=e(this),p=d.data("cid"),c=$.findWhere({cid:p}),b="1"===c.get("layout_specialty")?' specialty_columns="'+c.get("specialty_columns")+'"':"",u=c.get("layout");!0!==r&&!0!==_||(s+='[et_pb_column type="'+u+'"'+b+"]"),d.hasClass("et-pb-column-specialty")?d.find(".et_pb_row").each(function(){var a=e(this),d=a.find(".et-pb-row-content").data("cid"),p=($.findWhere({cid:d}),!1);(!0===r||!0===_||"row"===i&&d===t)&&(p=!0,s+=l.generateModuleShortcode(e(this),!0,i,o,"row_inner")),a.find(".et-pb-column").each(function(){var a=e(this),d=a.data("cid");$.findWhere({cid:d});!0===p&&(s+=l.generateModuleShortcode(e(this),!0,i,o,"column_inner",!1,!1,u)),a.find(".et_pb_module_block").each(function(){var a=e(this).data("cid");(!1!==_||t!==a&&!0!==r&&!0!==p)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n))}),!0===p&&(s+="[/et_pb_column_inner]")}),(!0===r||!0===_||"row"===i&&d===t)&&(s+="[/et_pb_row_inner]")}):d.find(".et_pb_module_block").each(function(){var d=e(this).data("cid");(!1!==_||t!==d&&!0!==r)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n,a))}),!0!==r&&!0!==_||(s+="[/et_pb_column]")}),(!1===_&&t===d.data("cid")||!0===_)&&!0!==p&&(s+="[/et_pb_section]")}),s},generateModuleShortcode:function(t,i,o,n,s,l,d,r){var p,c,b,u,h="",f="",m=t,v=!(m.is(".et_pb_section")||m.is(".et_pb_row")||m.is(".et_pb_row_inner")||m.is(".et_pb_column")||m.is(".et_pb_column_inner")),w=m.is(".et_pb_section")||m.is(".et_pb_row")||m.is(".et_pb_row_inner")?"et_pb_":"",y=void 0===m.data("cid")?m.find(".et-pb-data-cid").data("cid"):m.data("cid"),k=$.find(function(e){return e.get("cid")==y}),C=void 0!==k?k.get("module_type"):"undefined",S=[];if(void 0!==s&&""!==s&&(C=s),void 0!==k){if("section"===(c=k.attributes).type){var x=parseInt(k.attributes._address),V=x-1,T=x+1,U=this.getSectionsBackgroundColor(),O=_.isUndefined(c.et_pb_background_color)?this.getDefaultSectionBackgroundColor():c.et_pb_background_color,A=_.isUndefined(U[V])?"":U[V],M=_.isUndefined(U[T])?"":U[T],L=a.Helpers.moduleHasBackground(c,["gradient","image","video"]);A!==O||L||(A="#000000"),c.et_pb_prev_background_color=A,M!==O||L||(M="#000000"),c.et_pb_next_background_color=M}for(var E in p="module"===et_pb_options.layout_type&&"global"===et_pb_options.is_global_template||d&&v&&!_.isUndefined(c.et_pb_global_module),d&&v&&void 0!==c.et_pb_global_module&&(S=_.isEmpty(g[c.et_pb_global_module])?[]:g[c.et_pb_global_module]),c){if(!_.isEmpty(S)){var D=-1!==e.inArray(E,["et_pb_content","et_pb_raw_content"])?"et_pb_content_field":E.replace("et_pb_","");if(-1!==e.inArray(D,S))continue}if((void 0===n||"ignore_global"!==n||void 0!==n&&"ignore_global"===n&&"et_pb_global_module"!==E&&"et_pb_global_parent"!==E)&&(void 0===l||"ignore_global_tabs"!==l||void 0!==l&&"ignore_global_tabs"===l&&"et_pb_saved_tabs"!==E)){var I,P=E;if(_.includes(["et_pb_fb_built","et_pb_bb_built","_address"],P))continue;if(-1===P.indexOf("et_pb_")&&"admin_label"!==P)continue;if(I=void 0!==k.get(P)?k.get(P):"","et_pb_content"===P||"et_pb_raw_content"===P){f=I,"et_pb_raw_content"===P&&(f=f.replace(/\r?\n|\r/g,"\x3c!-- [et_pb_line_break_holder] --\x3e")),f=e.trim(f);var R=e.parseJSON(et_pb_options.et_builder_modules_with_children);_.includes(_.keys(R),k.get("module_type"))||""===f||"et_pb_content"!==P||(f="\n\n"+f+"\n\n")}else if(""!==I||p){if(void 0!==c.module_defaults&&void 0!==c.module_defaults[P])if(c.module_defaults[P]===I+""&&!p){delete k.attributes[P];continue}P=P.replace("et_pb_",""),"string"==typeof I&&(I=(I=I.replace(/\"/g,"%22").replace(/\\/g,"%92")).replace(/\[/g,"%91").replace(/\]/g,"%93")),"et_pb_contact_form"===C&&"custom_message"===P&&(I=_.escape(I.replace(/\r?\n|\r/g,"||et_pb_line_break_holder||")));/^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/.test(I)&&(I=_.escape(_.unescape(I))),"admin_label"===P?I!==j.getDefaultAdminLabel(c.module_type)&&(h=" "+P+'="'+I+'"'+h):h+=" "+P+'="'+I+'"'}}}return u="section"!==C&&"row"!==C?"module":C,u="row_inner"===C?"row":u,void 0!==o&&o===u&&(h+=' template_type="'+o+'"'),void 0!==c.template_type&&(h+=' template_type="'+c.template_type+'"'),"section"===C&&(h=' bb_built="1"'+h),_.includes(["column","column_inner"],C)&&(h=' type="'+k.get("layout")+'"'+h,w="et_pb_","column_inner"===C&&(h+=' saved_specialty_column_type="'+r+'"')),b="["+w+C+h,""===f&&void 0!==c.type&&"module"===c.type?(i=!0,b+=" /]"):b+="]",i||(b+=f+"[/"+w+C+"]"),b}},makeSectionsSortable:function(){var t=this;this.$el.sortable({items:"> *:not(#et_pb_layout_controls, #et_pb_main_container_right_click_overlay, #et-pb-histories-visualizer, #et-pb-histories-visualizer-overlay)",cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-section-add, .et-pb-row-add, .et-pb-insert-module, .et-pb-insert-column, .et_pb_locked, .et-pb-disable-sort",delay:100,update:function(i,o){if(T.isLoading)t.$el.sortable("cancel");else{if(J.is_active()){var n=e(o.item).children(".et-pb-section-content").attr("data-cid");if(!J.is_user_has_permission(n,"section"))return J.alert("has_no_permission"),t.$el.sortable("cancel"),void Ue()}t.allowHistorySaving("moved","section"),y.trigger("et-sortable:update")}},start:function(t,o){if(i(),t.altKey){var n=j.getView(e(o.item).children(".et-pb-section-content").data("cid")),s={model:n.model,view:n.$el,view_event:t},l=new a.RightClickOptionsView(s,!0);l.copy(t,!0),l.pasteAfter(t,void 0,void 0,void 0,!0,!0),T.allowHistorySaving("cloned","section")}}})},reInitialize:function(){var e=ee("content"),t=""==e,i=et_pb_options.default_initial_column_type,o=et_pb_options.default_initial_text_module;y.trigger("et-pb-loading:started"),this.removeAllSections(),-1===e.indexOf("[et_pb_section")&&(t||(e='[et_pb_column type="'+i+'"]['+o+"]"+e+"[/"+o+"][/et_pb_column]"),e="[et_pb_section][et_pb_row]"+e+"[/et_pb_row][/et_pb_section]"),this.createNewLayout(e),y.trigger("et-pb-loading:ended")},removeAllSections:function(t){j.set("forceRemove",!0),this.$el.find(".et-pb-section-content").each(function(){var t=e(this),i=j.getView(t.data("cid"));void 0!==i&&i.removeSection(!1,!0)}),j.set("forceRemove",!1),t&&("[et_pb_section][et_pb_row][/et_pb_row][/et_pb_section]",this.createNewLayout("[et_pb_section][et_pb_row][/et_pb_row][/et_pb_section]"))},createNewLayout:function(e,t){t=t||"";this.stopListening(this.collection,"change reset add",this.saveAsShortcode),e=T.codeModuleContentPrep(e),"load_layout"===t&&void 0!==window.switchEditors&&(e=qe(window.switchEditors.wpautop(e))),e=T.codeModuleContentUnPrep(e),this.createLayoutFromContent(e),this.saveAsShortcode({et_action:t}),this.listenTo(this.collection,"change reset add",_.debounce(this.saveAsShortcode,128))},replaceElement:function(e,t){var i=j.getView(e);i.$el.after(t.render().el),i.model.destroy(),j.removeView(e),i.remove()},showRightClickOptions:function(e){e.preventDefault();var t={model:{attributes:{type:"app",module_type:"app"}},view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},recalculateModulesOrder:function(){this.collection;this.order_modules_array=[],this.order_modules_array.children_count=[],this.$el.find(".et_pb_section").each(function(t){var i=e(this).find(".et-pb-section-content"),o=i.data("cid");T.setModuleOrder(o),T.setModuleAddresses(o,t),i.closest(".et_pb_section").hasClass("et_pb_section_fullwidth")?i.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");T.setModuleOrder(t)}):i.closest(".et_pb_section").hasClass("et_pb_section_specialty")?i.find("> .et-pb-column").each(function(){var t=e(this),i=t.data("cid");T.setModuleOrder(i),t.hasClass("et-pb-column-specialty")?t.find(".et_pb_row").each(function(){var t=e(this),i=t.find(".et-pb-row-content").data("cid");T.setModuleOrder(i),t.find(".et-pb-column").each(function(){var t=e(this),i=t.data("cid");T.setModuleOrder(i),t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");T.setModuleOrder(t)})})}):t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");T.setModuleOrder(t,"specialty")})}):i.find(".et_pb_row").each(function(){var t=e(this),i=t.find(".et-pb-row-content").data("cid");T.setModuleOrder(i),t.find(".et-pb-column").each(function(){var t=e(this),i=t.data("cid");T.setModuleOrder(i),t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");T.setModuleOrder(t)})})})})},parseShortcode:function(i,o,n){var a=document.documentMode,s="et-fb-preview-"+Date.now()+"-"+Math.floor(1e3*Math.random()+1),l=et_pb_options.preview_url+"&et_pb_preview=true&et_pb_preview_nonce="+et_pb_options.et_pb_preview_nonce+"&iframe_id="+s;setTimeout(function(){var d=e('*[data-shortcode-id="'+n+'"]'),r=d.length?d.width()+"px":"100%",p=t("<iframe />",{id:s,src:l,style:"position: absolute; bottom: 0; left: 0; opacity: 0; pointer-events: none; width:"+r+"; height: 100%;"}),c=!1,b={et_pb_preview_nonce:et_pb_options.et_pb_preview_nonce,shortcode:i,post_title:e("#title").val(),post_id:et_pb_options.postId};e("body").append(p),p.load(function(){if(!c){var e=document.getElementById(s);!_.isUndefined(a)&&a<10&&(b=JSON.stringify(b)),e.contentWindow.postMessage(b,l),c=!0;var t=window.addEventListener?"addEventListener":"attachEvent";(0,window[t])("attachEvent"==t?"onmessage":"message",function(e){e.data.iframe_id===s&&_.isString(e.data.html)&&(o(e.data),p.remove())},!1)}})},0)},updateYoastContent:function(){if(Be()){var t=ee("content",!0),i=e("#yoast-readability-analysis-collapsible-metabox");e(".et-pb-yoast-loading").remove(),i.find("svg").first().after('<svg class="yoast-svg-icon et-pb-yoast-loading yoast-svg-icon-loading-spinner SvgIcon__StyledSvg-jBzRth mPAyu" aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 66" fill="#64a60a" style="position: absolute; background: #fff; border-radius: 5px; max-width: 18px;"><circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg>'),this.parseShortcode(t,function(e){var t=_.isUndefined(e.html)?"":e.html;F=t,YoastSEO.app.pluginReloaded("ET_PB_Yoast_Content")},"yoast_preview_content")}},setModuleOrder:function(t,i){var o,n,a,s,l,_,d=e.parseJSON(et_pb_options.et_builder_modules_with_children);if(void 0!==(o=$.findWhere({cid:t}))){if("column"!==(s=void 0!==o.attributes.module_type?o.attributes.module_type:o.attributes.type)&&"column_inner"!==s&&"specialty"!==i||(a=$.findWhere({cid:o.attributes.parent}),"column"===s&&"row_inner"===a.attributes.module_type&&(s="column_inner")),n=void 0!==this.order_modules_array[s]?this.order_modules_array[s]:0,o.attributes.module_order=n,"row"!==s&&"row_inner"!==s&&"section"!==s||void 0===o.attributes.columns_order||(o.attributes.columns_order=[]),"column"!==s&&"column_inner"!==s&&"specialty"!==i||(void 0!==a.attributes.columns_order?a.attributes.columns_order.push(n):a.attributes.columns_order=[n]),void 0!==d[s]){if(_=d[s],l=void 0!==this.order_modules_array.children_count[_]?this.order_modules_array.children_count[_]:0,o.attributes.child_start_from=l,void 0!==o.attributes.et_pb_content&&""!==o.attributes.et_pb_content){var r=T.getShortCodeChildTags(),p=window.wp.shortcode.regexp(r),c=o.attributes.et_pb_content.match(p);l+=null!==c?c.length:0}this.order_modules_array.children_count[_]=l}this.order_modules_array[s]=n+1}},setModuleAddresses:function(e,t,i){var o=$.findWhere({cid:e}),n=$.where({parent:e});if(!_.isUndefined(o)){var a=_.isUndefined(o.attributes.module_type)?o.attributes.type:o.attributes.module_type,s=o.get("_address"),l="section"===a?t.toString():i+"."+t.toString(),d=!_.isUndefined(s)&&"et_pb_module_settings_migrations.value_changes."+s,r=!!d&&S(et_pb_options,d),p=S(et_pb_options,"et_pb_module_settings_migrations.name_changes")&&!_.isUndefined(et_pb_options.et_pb_module_settings_migrations.name_changes[s]);l!==s&&(r&&(et_pb_options.et_pb_module_settings_migrations.value_changes[l]=_.clone(et_pb_options.et_pb_module_settings_migrations.value_changes[s]),delete et_pb_options.et_pb_module_settings_migrations.value_changes[s]),p&&(et_pb_options.et_pb_module_settings_migrations.name_changes[l]=_.clone(et_pb_options.et_pb_module_settings_migrations.name_changes[s]),delete et_pb_options.et_pb_module_settings_migrations.name_changes[s])),o.set({_address:l}),!_.isUndefined(n)&&n.length>0&&_.forEach(n,function(e,t){T.setModuleAddresses(e.attributes.cid,t,l)})}},updateAdvancedModulesOrder:function(t){var i,o=void 0!==t?t.find(".et-pb-option-advanced-module-settings"):e(".et-pb-option-advanced-module-settings"),n=0;o.length&&(i=o.find(".et-pb-sortable-options > li")).length&&i.each(function(){var t,i,o,a=e(this).data("cid");t=$.findWhere({cid:a}),o=void 0!==(i=$.findWhere({cid:t.attributes.parent_cid})).attributes.child_start_from?i.attributes.child_start_from:0,t.attributes.module_order=n+o,n++})}}),a.Controls={},a.Controls.BorderRadiusControl=function(e){this.initialize(e)},e.extend(a.Controls.BorderRadiusControl.prototype,{initialize:function(e){if(this._container=e,this._setting_field=e.siblings(".et-pb-main-setting"),!this._setting_field.length)return!1;this._link_button=e.find(".et-pb-border-radius-wrap-link-button > a"),this._radius_fields=e.find(".et-pb-border-radius-option-input"),this._radius_preview=e.find(".et-pb-border-radius-preview"),this._defalut_value=_.isUndefined(this._setting_field.data("default_inherited"))?this._setting_field.data("default"):this._setting_field.data("default_inherited");var t=this._setting_field.val();if(_.isEmpty(t)){t=this._defalut_value,this._setting_field.val(this._defalut_value);var i=this._setting_field;setTimeout(function(){i.trigger("et_pb_setting:change")},100)}var o=t;this._values=this._splitValue(o),this._lastValue="",this._setting_field.change(this._onSettingChange.bind(this)),this._radius_fields.change(this._onFieldChange.bind(this)),this._link_button.click(this._onClickLink.bind(this)),this._render()},_onClickLink:function(e){if(e.preventDefault(),e.stopPropagation(),this._getSettingValue("border-link")){var t=this._getValues();t["border-link"]=!1,this._onChange(this._combineValues(t))}else{""===this._lastValue&&(this._lastValue=this._getSettingValue("top-left"));var i=this._spreadValue(this._lastValue);this._onChange(this._combineValues(i))}},_onSettingChange:function(e){var t=_.isUndefined(e.target.value)||""===e.target.value?this._getDefaultValue():e.target.value;this._values=this._splitValue(t),this._render()},_onChange:function(t){var i=_.isUndefined(t)?this._getDefaultValue():t;e(this._setting_field).val(i),this._values=this._splitValue(i),e(this._setting_field).trigger("et_pb_setting:change"),this._render()},_isOn:function(e){return"on"===e},_isLinkedMode:function(){return this._getSettingValue("border-link")},_spreadValue:function(e){return{"border-link":!0,"top-left":e,"top-right":e,"bottom-right":e,"bottom-left":e}},_onFieldChange:function(e){var t,i=Se(e.target.value,!1);if(this._lastValue=i,this._isLinkedMode())t=this._spreadValue(i);else{var o=e.target.getAttribute("data-corner");(t=this._getValues())[o]=i}this._onChange(this._combineValues(t))},_getDefaultValue:function(){return _.isUndefined(this._defalut_value)||""===this._defalut_value?"on||||":this._setting_field.val()},_getValues:function(){return this._values},_getSettingValue:function(e){return this._getValues()[e]},_splitValue:function(e){var t=e.split("|");return{"border-link":!!_.isUndefined(t[0])||this._isOn(t[0]),"top-left":_.isUndefined(t[1])||""===t[1]?"0px":t[1],"top-right":_.isUndefined(t[2])||""===t[2]?"0px":t[2],"bottom-right":_.isUndefined(t[3])||""===t[3]?"0px":t[3],"bottom-left":_.isUndefined(t[4])||""===t[4]?"0px":t[4]}},_combineValues:function(e){return(e["border-link"]?"on":"off")+"|"+e["top-left"]+"|"+e["top-right"]+"|"+e["bottom-right"]+"|"+e["bottom-left"]},_render:function(){_.each(this._radius_fields,function(t){e(t).val(this._getSettingValue(e(t).data("corner")))},this),e(this._link_button).toggleClass("active",this._getSettingValue("border-link")),e(this._radius_preview).css("border-top-left-radius",this._getSettingValue("top-left")),e(this._radius_preview).css("border-top-right-radius",this._getSettingValue("top-right")),e(this._radius_preview).css("border-bottom-right-radius",this._getSettingValue("bottom-right")),e(this._radius_preview).css("border-bottom-left-radius",this._getSettingValue("bottom-left"))}}),a.Controls.BorderRadius=function(t){var i=t.find(".et-pb-border-radius-wrap");i.length&&i.each(function(){new a.Controls.BorderRadiusControl(e(this))})},a.Controls.TabbedControl=function(e){this.initialize(e)},e.extend(a.Controls.TabbedControl.prototype,{_getByPath:function(e,t){return _.reduce(t.split("."),function(e,t){return e?e[t]:void 0},e)},initialize:function(t){var i=t.find(".et-pb-settings-tab"),o=t.find(".et-pb-settings-tab-content");if(!i.length||!o.length)return!1;var n=this;this._$container=t,this._suffix=t.data("attr-suffix"),this._tabs={},this._tab_content={},this._first_tab=null,this._active_tab=null,this._tab_settings_map=null,this._outside_preview=t.find(".et-pb-outside-preview-container"),this._reset_button=t.closest(".et-pb-composite-tabbed-wrapper").siblings(".et-pb-composite-tabbed-reset-setting"),this._is_child_settings_container=t.parents(".et_pb_modal_settings_container").hasClass("et_pb_modal_settings_container_step2"),i.each(function(){var t=e(this).find(".et-pb-settings-tab-title");n._tabs[e(t).data("tab")]=t,t.length&&t.click(n._onClickTab.bind(n))}),o.each(function(t,i){var o=e(i).data("tab");n._tab_content[o]={content:this,"preview-area":e(i).find(".et-pb-tab-preview-container")},0===t&&(n._first_tab=o,n._active_tab=o)}),setTimeout(function(){n._buildTabSettingsMap(),e(o).on("et_pb_setting:change et_pb_setting:color_picker:change",n._onChangeHandler.bind(n)),e(o).on("change","select",n._onChangeHandler.bind(n)),e(n._reset_button).on("click",n._onClickReset.bind(n)),n._render()},100)},_buildTabSettingsMap:function(){var t={};_.map(this._tab_content,function(i,o){t[o]={};var n=!1;e(i.content).find(".et-pb-main-setting").each(function(i,s){var l=ve(e(s)),_=e(s).parents(".et-pb-composite-tabbed-option").data("control-index");t[o][_]={},t[o][_].default=l,t[o][_].value=a.Helpers.getSettingValue(e(s)),n=n||!we(e(s))}),_.contains(["top_divider","bottom_divider"],o)?t[o].modified=t[o][o+"_style"].value!==t[o][o+"_style"].default:t[o].modified=n}),this._tab_settings_map=t},_isAnySettingModified:function(){var e=!1;return _.map(this._tab_settings_map,function(t){this._getByPath(t,"modified")&&(e=!0)},this),e},_onChangeHandler:function(e){setTimeout(this._onSettingChange.bind(this),100)},_onSettingChange:function(){this._buildTabSettingsMap(),this._render()},_onClickTab:function(e){e.preventDefault();var t=e.target.getAttribute("data-tab");this._makeTabActive(t),this._render()},_onClickReset:function(){var e=this;_.map(this._tab_settings_map,function(t){_.map(t,function(t,i){e._$container.find('[data-control-index="'+i+'"]').find(".et-pb-reset-setting").trigger("click")},this)}),this._active_tab=this._first_tab},_makeTabActive:function(e){this._active_tab=e},_showTab:function(t){e(this._tabs[t]).closest(".et-pb-settings-tab").addClass("active"),e(this._tab_content[t].content).show()},_hideTab:function(t){e(this._tabs[t]).closest(".et-pb-settings-tab").removeClass("active"),e(this._tab_content[t].content).hide()},_renderOutsidePreviewArea:function(e){return!1},_renderTabPreviewArea:function(e,t){return!1},_render:function(){this._renderOutsidePreviewArea(this._outside_preview),this._renderTabPreviewArea(this._active_tab,this._tab_content[this._active_tab]["preview-area"]),_.map(this._tabs,function(t,i){i===this._active_tab?this._showTab(i):this._hideTab(i),this._tab_settings_map[i].modified?e(this._tabs[i]).closest(".et-pb-settings-tab").addClass("modified"):e(this._tabs[i]).closest(".et-pb-settings-tab").removeClass("modified")},this),this._isAnySettingModified()?e(this._reset_button).addClass("et-pb-reset-icon-visible"):e(this._reset_button).removeClass("et-pb-reset-icon-visible")}}),a.Controls.Tabbed=function(t){var i=t.find(".et-pb-composite-tabbed");i.length&&i.each(function(){new a.Controls.TabbedControl(e(this))})},a.Controls.BorderStylesControl=function(e){this._setting_values=null,this._had_previously_resetted=!1,this.initialize(e)},e.extend(a.Controls.BorderStylesControl.prototype,a.Controls.TabbedControl.prototype,{_processWidth:function(e){var t=parseInt(e);return t>50&&(t=50),Se(t.toString(),!1,"px")},_setControlInitials:function(e){var t=e.parents(".et-pb-composite-tabbed-option").data("control-index");this._setting_values[t]={};var i=e.data("saved_value"),o=me(e),n="",a="",s="";if(e.hasClass("et-pb-range")){var l=e.siblings(".et-pb-range-input");a=l.data(o),s=l.data("default_inherited"),n=l.val(),l.data("check_attr_default","yes")}else n=e.val(),a=e.data(o),s=e.data("default_inherited"),e.data("check_attr_default","yes");var d=_.isUndefined(a)?"":a,r="",p=(r=_.isUndefined(i)?n:_.isEmpty(i)?n===a?a:"":i)!==d;_.isEmpty(s)||(_.isEmpty(r)||r===s)&&(p=!1),_.isEmpty(s)||a===s||p||this._updateControl(e,a,!1),this._setting_values[t].saved_value=p?r:"",this._setting_values[t].default_value=a,this._setting_values[t].default_inherited=s,this._setting_values[t].control=e;var c=t.replace(this._suffix,"").lastIndexOf("_"),b=t.substr(c).replace(this._suffix,"");this._setting_values[t].tab="border"+b;var u=this._tab_settings_map["border"+b].modified;this._tab_settings_map["border"+b].modified=u||p},_recalculateEdgeSettings:function(e){if(-1!==e.indexOf("all")){var t=e.replace(this._suffix,"").lastIndexOf("_"),i=e.substr(0,t),o=this;_.map(this._setting_values,function(t,n){if(-1!==n.indexOf(i)&&-1===n.indexOf("all")){var a=t.control,s=_.isEmpty(o._setting_values[e].saved_value)?o._setting_values[e].default_value:o._setting_values[e].saved_value;if(_.isEmpty(t.default_inherited))t.default_value=s,_.isEmpty(t.saved_value)?o._updateControl(a,s,s):o._updateControl(a,!1,s);else{s=o._setting_values[e].saved_value;var l=o._setting_values[e].default_value;if(_.isEmpty(t.saved_value))if(_.isEmpty(s))if(_.isEmpty(t.saved_default))t.default_value===t.default_inherited?(t.default_value=l,o._updateControl(a,l,l)):o._updateControl(a,t.default_value,!1);else{var d=t.saved_default;t.default_value=d,o._updateControl(a,d,d),t.saved_default=""}else _.isEmpty(t.saved_default)&&(t.saved_default=t.default_value),t.default_value=s,o._updateControl(a,s,s);else{var r=_.isEmpty(s)?l:s;t.default_value=r,o._updateControl(a,t.saved_value,r)}}}})}},_onSettingChange:function(e,t,i){var o=i?"":a.Helpers.getSettingValue(e);this._updateSetting(t,o),this._recalculateEdgeSettings(t)},_onChangeHandler:function(t,i){if(_.isUndefined(i)||"et_pb_from_all_tab"!==i){var o=e(t.target),n=o.parents(".et-pb-composite-tabbed-option").data("control-index"),a=!_.isUndefined(i)&&"et_pb_reset_setting"===i;this._had_previously_resetted?this._had_previously_resetted=!1:(a&&(this._had_previously_resetted=!0),"et_pb_setting:color_picker:change"===t.type?(this._updateSetting(n,i),this._recalculateEdgeSettings(n)):-1===n.indexOf("color")&&this._onSettingChange(o,n,a),this._render())}},_updateSetting:function(e,t){var i=this,o=this._setting_values[e],n=t!==o.default_value;o.saved_value=n?t:"";var a=o.tab,s=!1;_.map(this._tab_settings_map[a],function(e,t){if("modified"!==t){var o=i._setting_values[t].saved_value,a=i._setting_values[t].default_value;n=!_.isEmpty(o)&&o!==a,s=s||n}}),this._tab_settings_map[a].modified=s},_updateControl:function(e,t,i){var o=me(e),n=e.hasClass("et-pb-range"),a=null;n&&(a=e.siblings(".et-pb-range-input")),i&&(n?(a.data(o,i),e.data(o,parseFloat(i)||0)):e.data(o,i)),t&&(n&&(e.val(parseFloat(t)||0),e=a),e.val(t).trigger("change",["et_pb_from_all_tab"]))},_resetAllTab:function(){var e=this;_.map(this._setting_values,function(t,i){-1!==i.indexOf("all")&&(t.saved_value="",e._updateControl(t.control,t.default_value,!1),e._recalculateEdgeSettings(i))})},_resetEdgeTabs:function(){_.map(this._setting_values,function(e,t){-1===t.indexOf("all")&&(_.isEmpty(e.default_inherited)?e.default_value="":_.isEmpty(e.saved_default)||(e.default_value=e.saved_default,e.saved_default=""),e.saved_value="")})},_onClickReset:function(){this._is_child_settings_container?(this._resetAllTab(),this._resetEdgeTabs()):(this._resetEdgeTabs(),this._resetAllTab()),this._active_tab=this._first_tab,this._render()},_buildTabSettingsMap:function(){var t=this,i={};_.map(this._tab_content,function(t,o){i[o]={},e(t.content).find(".et-pb-main-setting").each(function(t,n){var a=e(n).parents(".et-pb-composite-tabbed-option").data("control-index");i[o][a]={}}),i[o].modified=!1}),this._tab_settings_map=i,null===this._setting_values&&(this._setting_values={},_.map(this._tab_content,function(i,o){"border_all"!==o&&e(i.content).find(".et-pb-main-setting").each(function(i,o){t._setControlInitials(e(o))})}),e(this._tab_content.border_all.content).find(".et-pb-main-setting").each(function(i,o){t._setControlInitials(e(o));var n=e(o).parents(".et-pb-composite-tabbed-option").data("control-index");t._recalculateEdgeSettings(n)}))},_renderTabPreviewArea:function(e,t){var i=["width","style","color"],o={};_.forEach(["top","right","bottom","left"],function(e){var t="";_.forEach(i,function(i){var o="border_"+i+"_"+e+this._suffix,n=_.isEmpty(this._setting_values[o].saved_value)?this._setting_values[o].default_value:this._setting_values[o].saved_value;"width"==i&&(n=this._processWidth(n)),t+=" "+n},this),o["border-"+e]=t},this),_.map(o,function(e,i){t.find(".et-pb-tab-preview-container-preview").css(i,e)},this)}}),a.Controls.BorderStyles=function(t){var i=t.find(".et-pb-composite-tabbed-border-style");i.length&&i.each(function(){new a.Controls.BorderStylesControl(e(this))})},e("body").on("click contextmenu","#et_pb_layout_right_click_overlay",function(e){e.preventDefault(),i()});var m,y=_.extend({},Backbone.Events),j=new a.Layout,$=new a.Modules,V=new a.Histories,T=new a.AppView({model:a.Module,collection:$,history:V}),U=new a.visualizeHistoriesView,O=e("#et_pb_hidden_editor"),A=(O.html(),e("#et_pb_toggle_builder")),M=e(".et_pb_toggle_builder_wrapper"),L=e("#et_pb_layout"),E=e("#et_pb_old_content"),D=e("#formatdiv"),I=e("#et_pb_use_builder"),P=e("#et_pb_main_editor_wrap"),R=e(".et_pb_page_setting"),N=e(".et_pb_page_layout_settings"),H=[],B=0,z=0,F=!1,W={};a.Events=y;var J={is_active:function(){return!(!e("#et_pb_use_ab_testing").length||"on"!==e("#et_pb_use_ab_testing").val())},toggle_status:function(t){var i=e("#et_pb_use_ab_testing"),o=i.val();t=!_.isUndefined(t)&&t;("on"===o&&!t||("off"===o||""===o)&&t)&&i.addClass("et_pb_value_updated"),ne(),t?(i.val("on"),this.toggle_portability(!1)):i.val("off")},toggle_portability:function(t){var i=e(".et-pb-app-portability-button"),o=i.hasClass("et-core-disabled");_.isUndefined(t)&&(t=!!o),t?i.removeClass("et-core-disabled"):i.addClass("et-core-disabled")},get_stats_refresh_interval:function(){return e("#et_pb_ab_stats_refresh_interval").length?e("#et_pb_ab_stats_refresh_interval").val():"hourly"},get_shortcode_tracking_status:function(){return e("#_et_pb_enable_shortcode_tracking").length&&""!==e("#_et_pb_enable_shortcode_tracking").val()?e("#_et_pb_enable_shortcode_tracking").val():"off"},is_active_based_on_models:function(){var e=$.where({et_pb_ab_subject:"on"}),t=$.where({et_pb_ab_goal:"on"});return e.length>1&&t.length>0},has_permission:function(){return"1"===et_pb_ab_js_options.has_permission},check_create_db:function(){return"exists"!==et_pb_options.ab_db_status&&e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_create_ab_tables",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce},success:function(e){if(!e.length||"success"!==e)return!1;et_pb_options.ab_db_status="exists"}}),!0},is_selecting_subject:function(){return!_.isUndefined(T.is_selecting_ab_testing_subject)&&!0===T.is_selecting_ab_testing_subject},is_selecting_goal:function(){return!_.isUndefined(T.is_selecting_ab_testing_goal)&&!0===T.is_selecting_ab_testing_goal},is_selecting_winner:function(){return!_.isUndefined(T.is_selecting_ab_testing_winner)&&!0===T.is_selecting_ab_testing_winner},is_selecting:function(){return!!(this.is_selecting_subject()||this.is_selecting_goal()||this.is_selecting_winner())},is_subject:function(e){return!(!this.is_active()||j.is_app(e)||!e.has("et_pb_ab_subject")||"on"!==e.get("et_pb_ab_subject"))},is_subject_children:function(e){var t=j.getParentViews(e.attributes.parent),i=!1;return _.isEmpty(t)||_.each(t,function(e){_.isUndefined(e.model.get("et_pb_ab_subject"))||"on"!==e.model.get("et_pb_ab_subject")||(i=!0)}),i},is_unremovable_subject:function(e){return!!(this.is_active()&&this.is_subject(e)&&this.subjects().length<3)},is_goal:function(e){return!(!this.is_active()||j.is_app(e)||!e.has("et_pb_ab_goal")||"on"!==e.get("et_pb_ab_goal"))},is_goal_children:function(e){var t=j.getParentViews(e.attributes.parent),i=!1;return _.isEmpty(t)||_.each(t,function(t){!j.is_app(e)&&t.model.has("et_pb_ab_goal")&&"on"===t.model.get("et_pb_ab_goal")&&(i=!0)}),i},is_user_has_permission:function(e,t,i){if(!e)return!1;var o,n=j.getView(e),a=(i=_.isUndefined(i)?n.model:i,J.has_permission()),s=J.is_subject(i),l=J.is_subject_children(i),d=J.has_subject(i),r=J.is_goal(i),p=J.is_goal_children(i),c=J.has_goal(i);return o="section"===t?s||d||r||c:"module"===t?s||l||r||p:"add_module"===t?s||l||r||p:"add_row"===t?l||p:"paste"===t?l||p:"copy"===t?s||d||r||c:s||l||d||r||p||c,!(!a&&o)},is_ab_testing_item:function(e){return!!(this.is_subject(e)||this.is_subject_children(e)||this.has_subject(e)||this.is_goal(e)||this.is_goal_children(e)||this.has_goal(e))},filter_goals:function(e){return _.filter(e,function(e){return!(!e.has("et_pb_ab_goal")||"on"!==e.get("et_pb_ab_goal"))})},filter_subjects:function(e){return _.filter(e,function(e){return!(!e.has("et_pb_ab_subject")||"on"!==e.get("et_pb_ab_subject"))})},filter_models_by_cids:function(t,i){return i=_.isUndefined(i)?$.models:i,_.filter(i,function(i){return-1!==e.inArray(i.get("parent"),t)})},pluck_cids_from_models:function(e){var t=[];return _.each(e,function(e){t.push(e.get("cid"))}),t},has_goal:function(e){var t="function"==typeof e.get&&e.get("cid"),i=!1;return this.is_active()&&!1!==t&&_.each(j.getChildrenViews(t),function(e){"on"===e.model.get("et_pb_ab_goal")&&(i=!0)}),i},has_subject:function(e){var t="function"==typeof e.get&&e.get("cid"),i=!1;return this.is_active()&&_.each(j.getChildrenViews(t),function(e){"on"===e.model.get("et_pb_ab_subject")&&(i=!0)}),i},has_unremovable_subject:function(e){var t,i,o,n,a,s,l=e.get("cid"),d=e.get("type"),r=[],p=[];if(this.is_active()){if("section"===d){if(t=$.where({parent:l}),i=this.filter_subjects(t),this.count_subjects()-i.length<2)return!0;if(r=this.pluck_cids_from_models(t),!_.isUndefined(e.get("et_pb_specialty"))&&"on"===e.get("et_pb_specialty")){o=this.filter_models_by_cids(r);var c=this.filter_subjects(o);if(this.count_subjects()-c.length<2)return!0;r=this.pluck_cids_from_models(o)}}if("row"!==d&&"row_inner"!==d||(r=[l]),("section"===d||"row_inner"===d||"row"===d)&&(n=this.filter_models_by_cids(r),p=this.pluck_cids_from_models(n),a=this.filter_models_by_cids(p),s=this.filter_subjects(a),this.count_subjects()-s.length<2))return!0}return!1},subjects:function(){var e=$.where({et_pb_ab_subject:"on"});return e},subject_ids:function(){var e=this.subjects(),t=[];return e.length>0&&_.each(e,function(e){e.has("et_pb_ab_subject_id")&&t.push(e.get("et_pb_ab_subject_id"))}),t},count_subjects:function(){return this.subjects().length},get_subject_id:function(){if(0===this.count_subjects())return 0;var e=this.subjects(),t=[];return _.each(e,function(e){e.has("et_pb_ab_subject_id")?t.push(parseInt(e.get("et_pb_ab_subject_id"))):t.push(0)}),(Math.max.apply(Math,t)+1).toString()},set_subject:function(t,i){var o=this;if("removed"!==t.model.get("component_status")){if("exists"!==et_pb_options.ab_db_status)return setTimeout(function(){o.set_subject(t,"waiting")},500),void y.trigger("et-pb-loading:started");void 0!==i&&"waiting"===i&&y.trigger("et-pb-loading:ended"),t.model.set("et_pb_ab_subject","on"),t.model.set("et_pb_ab_subject_id",o.get_subject_id()),t.$el.addClass("et_pb_ab_subject"),T.is_selecting_ab_testing_subject=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_subject"),J.count_subjects()<2&&(T.is_selecting_ab_testing_goal=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_goal"),J.alert("select_ab_testing_goal")),T.saveAsShortcode()}},set_subject_rank_coloring:function(t){var i=et_pb_ab_js_options.subjects_rank,o=!!t.model.has("et_pb_ab_subject_id")&&"subject_"+t.model.get("et_pb_ab_subject_id"),n=t.model.get("type"),a=".et-pb-module-title";switch(n){case"section":a=".et-pb-section-title";break;case"row_inner":case"row":a=".et-pb-row-title"}!o||_.isUndefined(i[o])||_.isUndefined(i[o].rank)||_.isUndefined(i[o].percentage)||(t.$el.addClass("rank-"+i[o].rank),t.$el.find(a).append(" ("+i[o].percentage+")")),t.model.has("et_pb_ab_subject_id")&&("module"===n?(t.$el.find(".et-pb-ab-subject-id").remove(),t.$el.find(".et-pb-remove").after(e("<span />",{class:"et-pb-ab-subject-id"}).text(t.model.get("et_pb_ab_subject_id")))):(t.$el.find(".et-pb-ab-subject-id").remove(),t.$el.find(a).append(e("<span />",{class:"et-pb-ab-subject-id"}).text(t.model.get("et_pb_ab_subject_id")))))},set:function(t,i){if(this.is_selecting_subject())return _.isUndefined(t.model.get("et_pb_global_parent"))?((j.is_global(t.model)||j.is_global_children(t.model))&&j.removeGlobalAttributes(t,!0),this.set_subject(t),void setTimeout(function(){T.disable_publish=!0,e("#publish").addClass("disabled")},750)):void J.alert("cannot_select_global_children_as_subject");if(this.is_selecting_goal()){if(!_.isUndefined(t.model.get("et_pb_global_parent")))return void J.alert("cannot_select_global_children_as_goal");if("removed"===t.model.get("component_status"))return;if(this.has_subject(t.model))return void this.alert("cannot_select_subject_parent_as_goal");T.is_doing_combination=!0,(j.is_global(t.model)||j.is_global_children(t.model))&&j.removeGlobalAttributes(t,!0),t.model.set("et_pb_ab_goal","on"),t.$el.addClass("et_pb_ab_goal"),T.is_selecting_ab_testing_goal=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_goal"),e("#et_pb_ab_goal_module").val(t.options.model.attributes.module_type);var o=$.findWhere({et_pb_ab_subject:"on"}),n=!_.isUndefined(o.cid)&&j.getView(o.get("cid"));if(n){var s,l={model:n.model,view:n.$el,view_event:i};(s=new a.RightClickOptionsView(l,!0)).copy(i),s.pasteAfter(i),J.alert("configure_ab_testing_alternative"),this.update()}return Ue(),void setTimeout(function(){T.is_doing_combination=!1,T.allowHistorySaving("turnon","abtesting"),e("#et_pb_layout .et-pb-app-view-ab-stats-button").addClass("active"),delete T.disable_publish,e("#publish").removeClass("disabled")},650)}if(this.is_selecting_winner()){if(t.options.model.has("et_pb_ab_subject")&&"on"===t.options.model.get("et_pb_ab_subject")){var d,r=$.where({et_pb_ab_subject:"on"});return T.is_doing_combination=!0,T.is_selecting_ab_testing_winner=!1,_.each(r,function(e){t.model.attributes.cid!==e.attributes.cid&&(n=j.getView(e.attributes.cid),"section"===(d=n.model.get("type"))?n.removeSection():"row"===d||"row_inner"===d?n.removeRow():"module"===d&&n.removeModule())}),t.model.unset("et_pb_ab_subject"),t.model.unset("et_pb_ab_subject_id"),t.model.has("et_pb_collapsed")&&"on"===t.model.get("et_pb_collapsed")&&t.model.unset("et_pb_collapsed"),j.is_temp_global(t.model)||j.is_temp_global_children(t.model)?void G("set_global_subject_winner",void 0,void 0,void 0,{view:t}):void this.turn_off_ab_testing_sequence()}J.alert("select_ab_testing_winner_first")}else;},turn_off_ab_testing_sequence:function(){et_pb_ab_js_options.subjects_rank={},Ue(),setTimeout(function(){T.is_doing_combination=!1,T.allowHistorySaving("turnoff","abtesting"),delete T.disable_publish,e("#publish").removeClass("disabled")},650),e("#et_pb_layout").removeClass("et_pb_select_ab_testing_winner"),e("#et_pb_layout .et-pb-app-view-ab-stats-button").removeClass("active"),this.toggle_portability(!0),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_clear_stats",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_test_id:et_pb_ab_js_options.test_id},success:function(e){et_pb_ab_js_options.has_report=!1,T.ab_stats={}}})},update_saved_subject_ids:function(){var t=this.subject_ids().join();e("#et_pb_ab_subjects").val()!==t&&e("#et_pb_ab_subjects").val(t).addClass("et_pb_value_updated"),ne()},update_layout:function(){if(this.is_active()){setTimeout(function(){var t=e("#et_pb_layout");J.count_subjects()<3?t.addClass("et_pb_ab_disable_subject_removal"):t.removeClass("et_pb_ab_disable_subject_removal")},100),e(".et_pb_section.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et_pb_section").each(function(){var t=e(this);t.find(".et_pb_section.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_section.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_section.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),e(".et_pb_row.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et_pb_section").each(function(){var t=e(this);t.find(".et_pb_row.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_row.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_row.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),(e(".et_pb_row.et_pb_ab_subject.et_pb_ab_no_permission").length||e(".et_pb_row.et_pb_ab_goal.et_pb_ab_no_permission").length)&&e(".et_pb_row.et_pb_ab_subject.et_pb_ab_no_permission, .et_pb_row.et_pb_ab_goal.et_pb_ab_no_permission").each(function(){e(this).closest(".et_pb_section").addClass("et_pb_ab_no_permission_parent")}),e(".et_pb_module_block.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et-pb-column").each(function(){var t=e(this);t.find(".et_pb_module_block.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_module_block.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_module_block.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),(e(".et_pb_module_block.et_pb_ab_subject.et_pb_ab_no_permission").length||e(".et_pb_module_block.et_pb_ab_goal.et_pb_ab_no_permission").length)&&e(".et_pb_module_block.et_pb_ab_subject.et_pb_ab_no_permission, .et_pb_module_block.et_pb_ab_goal.et_pb_ab_no_permission").each(function(){var t=e(this);t.closest(".et_pb_row").addClass("et_pb_ab_no_permission_parent"),t.closest(".et_pb_section").addClass("et_pb_ab_no_permission_parent")});var t,i,o,n=!0;_.each(this.subjects(),function(e){e.has("et_pb_collapsed")&&"off"!==e.get("et_pb_collapsed")||(n=!1)}),n&&(i=(t=e(".et_pb_ab_subject:first")).children(".et-pb-data-cid").attr("data-cid"),o=j.getView(i),t.length&&!_.isUndefined(o)&&(t.removeClass("et_pb_collapsed"),o.model.set("et_pb_collapsed","off")))}},update:function(){this.update_saved_subject_ids(),this.update_layout()},is_alert_valid:function(e){return!(!_.isUndefined(T.ab_last_visible_alert)&&T.ab_last_visible_alert===e)&&(T.ab_last_visible_alert=e,!0)},alert:function(e){this.is_alert_valid(e)&&G("ab_testing_alert",void 0,void 0,void 0,{id:e})},alert_yes_no:function(e){this.is_alert_valid(e)&&G("ab_testing_alert_yes_no",void 0,void 0,void 0,{id:e})},get_all_subjects_stats_settings:function(t){var i,o=e('.view-stats-tab[data-analysis="'+t+'"]'),n=o.find(".et-pb-ab-view-stats-subjects-filter"),a=o.find(".et-pb-ab-view-stats-time-filter"),s=(o.find(".et-pb-options-tabs-links"),["first","second","third","fourth","fifth"]),l={subject_statuses:[],subject_ids:[],table:{thead:[],tbody:{},tfoot:[]}};a.find(".active").length||a.find('a[data-duration="'+et_pb_ab_js_options.refresh_interval_duration+'"]').addClass("active"),i=T.ab_stats[a.find(".active").attr("data-duration")],n.find("a").each(function(){var t=e(this),i=!t.hasClass("inactive"),o=!t.parent("li").hasClass("et-pb-no-data"),n=t.attr("data-subject-id");o&&l.subject_statuses.push(i),i&&o&&l.subject_ids.push(parseInt(n))});for(var d=0;d<5;d++)l.table.thead[s[d]]=et_pb_ab_js_options.view_stats_thead_titles[t][d];return _.isUndefined(i)||(_.each(i.subjects_id,function(o){var n="subject_"+o,a=$.findWhere({et_pb_ab_subject_id:o}),s=!(_.isUndefined(a)||!a.has("admin_label"))&&a.get("admin_label");s&&-1!==e.inArray(parseInt(o),l.subject_ids)&&(l.table.tbody[n]={first:o,second:s,third:i.subjects_totals[n][et_pb_ab_js_options.analysis_formula[t].denominator],fourth:i.subjects_totals[n][et_pb_ab_js_options.analysis_formula[t].numerator],fifth:i.subjects_totals[n][t]+"%"})}),l.table.tfoot={first:et_pb_ab_js_options.total_title,second:null,third:i.events_totals[et_pb_ab_js_options.analysis_formula[t].denominator],fourth:i.events_totals[et_pb_ab_js_options.analysis_formula[t].numerator],fifth:i.events_totals[t]+"%"}),l},switch_view_stats_tab:function(){var t=e(".et-pb-options-tabs-links"),i=e(".et-pb-ab-view-stats-content.has-data"),o=t.find("li.et-pb-options-tabs-links-active").attr("data-analysis");i.find(".view-stats-tab").removeClass("active"),i.find('.view-stats-tab[data-analysis="'+o+'"]').addClass("active")},display_stats_tabs:function(t){var i=this,o=_.template("<tr><th><%= first %></th><th><%= second %></th><th><%= third %></th><th><%= fourth %></th><th><%= fifth %></th></tr>"),n=_.template("<tr><td><%= first %></td><td><%= second %></td><td><%= third %></td><td><%= fourth %></td><td><%= fifth %></td></tr>"),a=_.template("<tr><td colspan='2'><%= first %></td></td><td><%= third %></td><td><%= fourth %></td><td><%= fifth %></td></tr>"),s=e(".et_pb_prompt_modal.et_pb_ab_view_stats"),l=$.findWhere({et_pb_ab_goal:"on"}).get("module_type"),d=e("#et_pb_ab_subjects").val().split(",");if(_.isEmpty(t.subjects_totals)&&!et_pb_ab_js_options.has_report)return s.find(".et-pb-ab-view-stats-content.has-data, .et-pb-options-tabs-links").hide(),void s.find(".et-pb-ab-view-stats-content.no-data").css({opacity:1,display:"block"});-1===e.inArray(l,et_pb_ab_js_options.have_conversions)?(e(".et_pb_options_tab_ab_stat_conversion, .view-stats-tab.tab-conversions").remove(),e(".et_pb_options_tab_ab_stat_clicks").addClass("et-pb-options-tabs-links-active")):"et_pb_shop"===l&&e(".et_pb_options_tab_ab_stat_conversion a").text(et_pb_ab_js_options.sales_title),"on"!==J.get_shortcode_tracking_status()&&e(".et_pb_options_tab_ab_stat_shortcode_conversions").remove(),s.find(".view-stats-tab").each(function(){var s,l,r,p,c=e(this),b=c.attr("data-analysis"),u=e("#ab-testing-stats-"+b),g=e("#ab-testing-stats-pie-"+b),h=e("#view-stats-table-"+b),f=h.find("thead"),m=h.find("tbody"),v=h.find("tfoot"),w=c.find(".et-pb-ab-view-stats-subjects-filter"),k=c.find(".et-pb-ab-view-stats-time-filter"),C=c.find(".ab-testing-stats-pie-legends"),S=e(".et_pb_ab_view_stats .et-pb-options-tabs-links");t.dates;if(_.each(d,function(t){var i=$.findWhere({et_pb_ab_subject_id:t}),o=!(_.isUndefined(i)||!i.has("admin_label"))&&i.get("admin_label");if(o){var n=e("<li />").append(e("<a />",{href:"#","data-subject-id":t}).text(o)),a=e("<li />",{"data-subject-id":t}).append(e("<a />",{href:"#"}).text(o)).prepend(e("<span />"));w.append(n),C.append(a)}}),_.isEmpty(t)||_.isUndefined(t)||!t){k.find('a[data-duration="'+et_pb_ab_js_options.refresh_interval_duration+'"]').addClass("active"),c.addClass("no-tab-data")}else{var x=i.draw_graphs(b,t,s,r,u,g,h,f,m,v,o,n,a,!0);s=x.line_chart,r=x.pie_chart,x.line_chart_data,x.pie_chart_data,l=x.line_chart_datasets,p=x.pie_chart_segments}w.on("click","a",function(t){t.preventDefault();var _=e(this).attr("data-subject-id");e(this).toggleClass("inactive"),C.find('li[data-subject-id="'+_+'"]').toggleClass("inactive");var d=i.filter_stats_subject(b,s,r,l,p,h,f,m,v,o,n,a);s=d.line_chart,r=d.pie_chart}),C.on("click","a",function(t){t.preventDefault();var i=e(this).parent("li").attr("data-subject-id");w.find('a[data-subject-id="'+i+'"]').trigger("click")}),S.on("click","a",function(t){t.preventDefault(),e(this).hasClass("et-pb-ab-refresh-stats")||(S.find("li").removeClass("et-pb-options-tabs-links-active"),e(this).parent("li").addClass("et-pb-options-tabs-links-active"),i.switch_view_stats_tab())}),k.on("click","a",function(d){d.preventDefault();var w=e(this),C=w.attr("data-duration");e(".et_pb_prompt_modal.et_pb_ab_view_stats");if(k.find("a").removeClass("active"),w.addClass("active"),_.isUndefined(T.ab_stats[C])||!T.ab_stats[C])y.trigger("et-pb-loading:started"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_builder_data",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_ab_test_id:et_pb_ab_js_options.test_id,et_pb_ab_duration:C},success:function(t){if(c.removeClass("no-tab-data"),y.trigger("et-pb-loading:ended"),"false"!==t){t=e.parseJSON(t),T.ab_stats[C]=t;var _=i.draw_graphs(b,t,s,r,u,g,h,f,m,v,o,n,a);s=_.line_chart,r=_.pie_chart,_.line_chart_data,_.pie_chart_data,l=_.line_chart_datasets,p=_.pie_chart_segments}else c.addClass("no-tab-data")}});else{c.removeClass("no-tab-data"),t=T.ab_stats[C];var S=i.draw_graphs(b,t,s,r,u,g,h,f,m,v,o,n,a);s=S.line_chart,r=S.pie_chart,S.line_chart_data,S.pie_chart_data,l=S.line_chart_datasets,p=S.pie_chart_segments}})}),s.on("click",".et-pb-ab-refresh-stats",function(){y.trigger("et-pb-loading:started"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_clear_cache",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_test_id:et_pb_ab_js_options.test_id},success:function(t){T.ab_stats={},e(".et-pb-ab-view-stats-time-filter").find("a.active").click()}})}),s.addClass("et-pb-loaded").find(".et-pb-ab-view-stats-content.has-data, .et-pb-options-tabs-links").css({opacity:1}),i.switch_view_stats_tab()},draw_graphs:function(t,i,o,n,a,s,l,d,r,p,c,b,u,g){var h={labels:i.dates,datasets:[]},f=[],m=a.closest(".view-stats-tab"),v=m.find(".et-pb-ab-view-stats-subjects-filter"),w=m.find(".ab-testing-stats-pie-legends");_.each(i.subjects_id,function(e){var o="subject_"+e,n=$.findWhere({et_pb_ab_subject_id:e}),a=!_.isUndefined(n)&&!_.isUndefined(n.attributes.admin_label)&&n.attributes.admin_label,s=v.find('a[data-subject-id="'+e+'"]'),l=w.find('li[data-subject-id="'+e+'"] span');a&&(_.isUndefined(s.attr("style"))&&s.css({backgroundColor:i.subjects_totals[o].color}),_.isUndefined(l.attr("style"))&&l.css({backgroundColor:i.subjects_totals[o].color}),h.datasets.push({subject_id:e,label:a,fillColor:"transparent",strokeColor:i.subjects_totals[o].color,pointColor:i.subjects_totals[o].color,pointStrokeColor:"#fff",data:_.values(i.subjects_analysis[o][t])}),f.push({value:i.subjects_totals[o][t],color:i.subjects_totals[o].color,label:"#"+e+": "+a}))}),v.find("li").removeClass("et-pb-no-data"),w.find("li").removeClass("et-pb-no-data"),_.each(e("#et_pb_ab_subjects").val().split(","),function(t){-1===e.inArray(t,i.subjects_id)&&(v.find('a[data-subject-id="'+t+'"]').parent("li").addClass("et-pb-no-data"),w.find('li[data-subject-id="'+t+'"]').addClass("et-pb-no-data"))});var y=this.get_all_subjects_stats_settings(t);if(d.empty().html(e(c(y.table.thead))),r.empty(),_.each(y.table.tbody,function(t){r.append(e(b(t)))}),p.empty().html(e(u(y.table.tfoot))),_.size(y.table.tbody)>1){l.tablesorter();var k=l.find("thead th:first");k.hasClass(".headerSortDown")||setTimeout(function(){k.trigger("click")},500)}_.isUndefined(o)||o.destroy(),a.closest(".view-stats-tab").addClass("et_pb_ab_visible_tab");var C,S=(o=new Chart(a.get(0).getContext("2d")).Line(h,{scaleFontSize:13,scaleFontColor:"#a1a9b1",scaleLabel:"<%=value%>%",scaleGridLineWidth:2,scaleLineWidth:2,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>%",multiTooltipTemplate:"<%= value %>%",datasetStrokeWidth:4,pointDotStrokeWidth:2,pointDotRadius:7})).datasets;if(_.isUndefined(n)||n.destroy(),s.is(":visible")&&(C=(n=new Chart(s.get(0).getContext("2d")).Pie(f,{animationEasing:"easeInCubic",animationSteps:50,tooltipTemplate:"<%if (label){%><%=label%><%}%>"})).segments),_.isUndefined(g)){var x=this.filter_stats_subject(t,o,n,S,C,l,d,r,p,c,b,u);o=x.line_chart,n=x.pie_chart}return a.closest(".view-stats-tab").removeClass("et_pb_ab_visible_tab"),{line_chart:o,pie_chart:n,line_chart_data:h,pie_chart_data:f,line_chart_datasets:S,pie_chart_segments:C}},filter_stats_subject:function(t,i,o,n,a,s,l,d,r,p,c,b){var u,g=this.get_all_subjects_stats_settings(t),h=_.compact(_.map(n,function(e,t){return!!g.subject_statuses[t]&&e})),f=_.compact(_.map(a,function(e,t){return!!g.subject_statuses[t]&&e}));if(i.datasets=h,i.update(),l.empty(),d.empty(),r.empty(),l.html(e(p(g.table.thead))),_.each(g.table.tbody,function(t){d.append(e(c(t)))}),(u=_.size(g.table.tbody))>1){s.tablesorter();var m=s.find("thead th:first");m.hasClass(".headerSortDown")||setTimeout(function(){m.trigger("click")},500)}if(u>0){var v=_.pluck(g.table.tbody,"third"),w=_.pluck(g.table.tbody,"fourth"),y=_.map(_.pluck(g.table.tbody,"fifth"),function(e){return parseFloat(e)}),k=_.reduce(v,function(e,t){return e+t},0),C=_.reduce(w,function(e,t){return e+t},0),S=(_.reduce(y,function(e,t){return e+t},0)/_.size(y)).toFixed(2)+"%";r.html(e(b({first:et_pb_ab_js_options.total_title,second:null,third:k,fourth:C,fifth:S})))}return o.segments=f,o.update(),{line_chart:i,pie_chart:o}},delete_post_meta:function(){this.toggle_status(!1),e("#et_pb_ab_subjects").val(""),ne()},subject_carousel:function(e){var t=j.getView(e),i=$.where({et_pb_ab_subject:"on"}),o=t.model.get("et_pb_collapsed"),n="on"===o?"off":"on";_.each(i,function(e){var i=j.getView(e.attributes.cid);i.model.get("cid")===t.model.get("cid")?"on"===o&&i.model.set("et_pb_collapsed","off"):"on"===o?i.model.set("et_pb_collapsed","on"):i.model.set("et_pb_collapsed",n),"on"===i.model.get("et_pb_collapsed")?i.$el.addClass("et_pb_collapsed"):i.$el.removeClass("et_pb_collapsed")})}};function K(){var t,i=e("body");e("#et_pb_fb_cta").removeClass("et_pb_ready"),ae("content",E.val()),window.wpActiveEditor="content","html"!==et_pb_options.wp_default_editor&&e("#content-tmce").click(),I.val("off"),L.hide(),A.text(A.data("builder")).toggleClass("et_pb_builder_is_used"),P.toggleClass("et_pb_post_body_hidden"),function(){var t=N.closest("#et_settings_meta_box").find(".et_pb_page_layout_settings");if(N.show().closest("#et_settings_meta_box").show(),N.closest("#et_settings_meta_box").find(".et_pb_side_nav_settings").hide(),N.closest("#et_settings_meta_box").find(".et_pb_single_title").hide(),D.length){D.show();var i=D.find('input[type="radio"]:checked').val();e(".et_divi_format_setting.et_divi_"+i+"_settings").show()}if(t.length>0){var o=t.find("#et_pb_page_layout").val(),n=t.find('option[value="et_full_width_page"]');n.length>0&&n.hide(),"et_full_width_page"===o&&t.find("#et_pb_page_layout").val("et_no_sidebar")}"project"===et_pb_options.post_type&&N.closest("#et_settings_meta_box").find(".et_pb_project_nav").hide()}(),t=i.scrollTop(),i.scrollTop(t+1),y.trigger("et-deactivate-builder"),J.is_active()&&J.delete_post_meta(),e("form#post").append('<input type="hidden" name="et_pb_show_page_creation" value="off" />'),e(window).trigger("resize")}function G(t,n,a,s,l){var d,r=-1!==e.inArray(t,["save_template","reset_advanced_settings"])?" et_modal_on_top":"",p=e('<div class="et_pb_modal_overlay'+r+("reset_advanced_settings"===t?" et_modal_on_top_both_actions":"")+'" data-action="'+t+'"></div>'),c=e("#et-builder-prompt-modal-"+t).length?e("#et-builder-prompt-modal-"+t).html():e("#et-builder-prompt-modal").html(),b=_.template(e("#et-builder-prompt-modal-"+t+"-text").html()),u=!0,g={};if(i(),e("body").addClass("et_pb_stop_scroll"),"save_template"===t){var h=void 0!==(C=j.getView(n.model.get("cid"))).model.get("parent")?j.getView(C.model.get("parent")):"",f=C.$el.find(".et_pb_global"),m=C.$el.is(".et_pb_global"),k=f.length?"has_global":"no_globals";g.is_global=void 0!==C.model.get("et_pb_global_module")&&""!==C.model.get("et_pb_global_module")?"global":"regular",g.is_global_child=""!==h&&(void 0!==h.model.get("et_pb_global_module")&&""!==h.model.get("et_pb_global_module")||void 0!==h.model.get("global_parent_cid")&&""!==h.model.get("global_parent_cid"))?"global":"regular",g.module_type=C.model.get("type")}if("delete_font"===t&&(g.font_name=n),_.isUndefined(l)||e.extend(g,l),p.append(c),p.find(".et_pb_prompt_modal").prepend(b(g)),"upload_font"===t&&(p.find('.et-core-portability-import-form input[type="file"]').on("change",function(t){var i=e(this).get(0).files,o="",n=et_pb_options.supported_font_formats;_.isEmpty(i)||_.each(i,function(e){var t=_.isUndefined(e.name)?"":e.name.toLowerCase();_.each(n,function(e){t.match(e+"$")&&(o+='<div class="et-fb-font-files-list-item" data-file_format="'+e+'" data-file_name="'+t+'"><span class="et-fb-font-files-list-item-remove"></span>'+t+"</div>")})}),""!==o&&(e(".et-font-uploader-selected-fonts").html(""),e(".et-font-uploader-selected-fonts").removeClass("et-font-uploader-hidden-field").append(o))}),p.find(".et-core-portability-import-form button").click(function(t){t.preventDefault(),e(this).closest(".et-core-portability-import-form").find('input[type="file"]').trigger("click")}),p.on("click",".et-fb-font-files-list-item-remove",function(t){e(t.target).closest(".et-fb-font-files-list-item").remove()}),p.find(".et-font-uploader-all-weights").on("change",function(t){var i=e(this).prop("checked"),o=p.find(".et-font-uploader-weight-values");i?o.addClass("et-font-uploader-hidden-section"):o.removeClass("et-font-uploader-hidden-section")})),"open_settings"===t&&(p.addClass("et_pb_builder_settings"),d='[et_pb_split_track id="'+et_pb_ab_js_options.test_id+'" /]',setTimeout(function(){e("#et_pb_ab_current_shortcode").val(d)},100),p.find(".et_pb_prompt_field_list").each(function(){var t=e(this),i=t.attr("data-id"),o=t.attr("data-type"),n=(t.attr("data-autoload"),{et_pb_enable_ab_testing:"et_pb_use_ab_testing"}),a=e(void 0!==n[i]?"#"+n[i]:"#_"+i).val();switch(o){case"yes_no_button":var s=t.find(".et_pb_yes_no_button_wrapper"),l=s.find(".et_pb_yes_no_button"),d=s.find("select");d.val(a),d.trigger("change"),l.click(function(){var t=e(this);t.hasClass("et_pb_off_state")?(t.removeClass("et_pb_off_state").addClass("et_pb_on_state"),d.val("on")):(t.removeClass("et_pb_on_state").addClass("et_pb_off_state"),d.val("off")),d.trigger("change")}),d.change(function(){var i=e(this).val();if("on"===i?l.removeClass("et_pb_off_state").addClass("et_pb_on_state"):l.removeClass("et_pb_on_state").addClass("et_pb_off_state"),""!==t.data("affects")){var o=t.attr("data-affects").split("|");_.each(o,function(e){var o=p.find('.et_pb_prompt_field_list[data-id="'+e+'"]'),n=o.attr("data-visibility-dependency");if(i===n&&t.hasClass("et-pb-visible"))o.addClass("et-pb-visible"),o.find("select").trigger("change");else if(o.removeClass("et-pb-visible"),""!==o.data("affects")){var a=o.data("affects").split("|");_.each(a,function(e){p.find('.et_pb_prompt_field_list[data-id="'+e+'"]').removeClass("et-pb-visible")})}})}}),d.trigger("change");break;case"color-alpha":t.find(".input-colorpicker").val(a).wpColorPicker({width:313});break;case"colorpalette":var r=e(this),c=r.find(".input-colorpalette-colorpicker"),b=0,u=a.split("|");c.each(function(){var t=e(this),i=u[b];t.val(i).wpColorPicker({hide:!1,default:e(this).data("default-color"),width:313,palettes:!1,change:function(t,i){var o=e(this),n=o.attr("data-index"),a=p.find(".colorpalette-item-"+n),s=i.color.toString();o.val(s),a.css({backgroundColor:s}),ne()}}),t.trigger("change"),t.siblings(".wp-picker-clear").on("click",function(e){e.preventDefault(),t.wpColorPicker("color",i)}),t.closest(".wp-picker-container").find(".wp-color-result").attr("title",et_pb_options.select_text),t.closest(".wp-picker-container").on("click",".wp-color-result",function(e){r.find(".colorpalette-colorpicker").removeClass("active")}),b++}),r.on("click",".colorpalette-item",function(t){t.preventDefault();var i=e(this).attr("data-index");r.find(".colorpalette-colorpicker").removeClass("active"),r.find('.colorpalette-colorpicker[data-index="'+i+'"]').addClass("active")});break;case"range":var g,h=t.find('input[type="range"]'),f=h.val(),m=h.attr("min"),v=h.attr("max"),w=h.parent("div"),y=e("<input />",{type:"number",step:1,class:"et-pb-range-input",min:m,max:v,value:f});h.val(a),w.append(y),g=w.find(".et-pb-range-input"),h.on("change input",function(){var t=e(this).val();g.val(t)}),g.on("change keydown",function(){var t=e(this).val();h.val(t)}),h.trigger("change");break;case"select":e(this).find("select").val(a);break;case"codemirror":case"textarea":e(this).find("textarea").val(a)}})),"view_ab_stats"===t){if(e(".et-pb-ab-view-stats-content").length)return;y.trigger("et-pb-loading:started"),_.isUndefined(T.ab_stats)&&(T.ab_stats={}),_.isUndefined(T.ab_stats[et_pb_ab_js_options.refresh_interval_duration])?e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_builder_data",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_ab_test_id:et_pb_ab_js_options.test_id,et_pb_ab_duration:et_pb_ab_js_options.refresh_interval_duration},success:function(t){y.trigger("et-pb-loading:ended"),t=e.parseJSON(t),T.ab_stats[et_pb_ab_js_options.refresh_interval_duration]=t,J.display_stats_tabs(t)}}):setTimeout(function(){y.trigger("et-pb-loading:ended"),J.display_stats_tabs(T.ab_stats[et_pb_ab_js_options.refresh_interval_duration])},500)}if("ab_testing_alert_yes_no"!==t||_.isUndefined(l.id)||p.attr({"data-action":t+"_"+l.id}),e("body").append(p),"auto"===e(".et_pb_prompt_modal").css("bottom")&&Object(o.a)(p.find(".et_pb_prompt_modal"),".et_pb_prompt_buttons"),setTimeout(function(){p.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),"rename_admin_label"===t){var C,S=p.find("input#et_pb_new_admin_label"),x=(C=j.getView(n)).model.get("admin_label").trim();""!==x&&S.val(x)}e(".et_pb_modal_overlay .et_pb_prompt_proceed").click(function(t){t.preventDefault();var i=e(this).closest(".et_pb_modal_overlay");switch(i.data("action").trim()){case"deactivate_builder":K();break;case"clear_layout":T.removeAllSections(!0);break;case"rename_admin_label":var o=i.find("#et_pb_new_admin_label").val().trim(),d=j.getView(n);if(""==o)return void i.find("#et_pb_new_admin_label").focus();d.model.set("admin_label",o,{silent:!0}),d.renameModule(),T.allowHistorySaving("renamed","module",o),Ue();break;case"reset_advanced_settings":n.each(function(){Ce(e(this))});break;case"save_layout":var r=i.find("#et_pb_new_layout_name").val().trim();if(""==r)return void i.find("#et_pb_new_layout_name").focus();e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_save_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_name:r,et_layout_content:ee("content"),et_layout_type:"layout",et_post_type:et_pb_options.post_type},success:function(e){"layout"!==et_pb_options.post_type?w=v():Le("not_predefined","","",et_pb_options.post_type,!0)}});break;case"save_template":var c=i.find("#et_pb_new_template_name").val().trim(),b=i.find(e("#et_pb_template_global")).is(":checked")?"global":"not_global",g=e(".et_pb_module_settings").data("module_type"),h="section"===g||"row"===g?g:"module",y=void 0!==a?a:"regular",C=n.model.get("cid"),S="",x="",V=i.find("#et_pb_new_cat_name").val(),U=m||void 0!==k&&"has_global"===k&&"global"===b?"ignore_global":"include_global",O="ignore_global"===U?"ignore_global_tabs":"",A=e(".et_pb_modal_settings_container"),M=e(".et_pb_modal_overlay");if(h="row_inner"===g?"row":h,""==c)return void i.find("#et_pb_new_template_name").focus();e(".layout_cats_container input").is(":checked")&&e(".layout_cats_container input").each(function(){var t=e(this);t.is(":checked")&&(x+=""!==x?","+t.val():t.val())}),"module"===h&&n.model.set("et_pb_saved_tabs","all",{silent:!0}),n.performSaving(),S=T.generateCompleteShortcode(C,h,U,O),"row_inner"===g&&(S=(S=S.replace(/et_pb_row_inner/g,"et_pb_row")).replace(/et_pb_column_inner/g,"et_pb_column")),A.addClass("et_pb_modal_closing"),M.addClass("et_pb_overlay_closing"),setTimeout(function(){"module"===h&&se("et_pb_content"),A.remove(),M.remove(),e("body").removeClass("et_pb_stop_scroll")},600),e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_save_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_name:c,et_layout_content:S,et_layout_scope:b,et_layout_type:h,et_module_width:y,et_columns_layout:s,et_selected_tabs:"all",et_module_type:g,et_layout_cats:x,et_layout_new_cat:V,et_post_type:et_pb_options.post_type},beforeSend:function(t){"global"===b&&(e("body").find(".et_pb_global_loading_overlay").length||e("body").append('<div class="et_pb_global_loading_overlay"></div>'))},success:function(t){"global"===b&&(T.collection.find(function(e){return e.get("cid")==C}).set("et_pb_global_module",t.post_id),"ignore_global"===U&&f.length&&f.each(function(){var t=e(this).data("cid");if(void 0!==t&&""!==t){var i=T.collection.find(function(e){return e.get("cid")==t});i.unset("et_pb_global_module"),i.unset("et_pb_saved_tabs")}}),Ue(),setTimeout(function(){e("body").find(".et_pb_global_loading_overlay").remove()},650));H={}}});break;case"open_settings":var L=p.find("#et_pb_enable_ab_testing"),E=p.find("#et_pb_ab_stats_refresh_interval").val(),D="on"===L.val(),I=p.find("#et_pb_enable_shortcode_tracking").val(),P=e("#_et_pb_ab_stats_refresh_interval"),R=e("#et_pb_enable_shortcode_tracking");p.find(".et_pb_prompt_field_list").each(function(){var t=e(this),i=t.attr("data-id"),o="1"===t.attr("data-autoload"),n=e("#_"+i),a=[],s=n.val();o&&(t.hasClass("colorpalette")?(t.find(".input-colorpalette-colorpicker").each(function(){a.push(e(this).val())}),n.val(a.join("|")),s!==a.join("|")&&(n.addClass("et_pb_value_updated"),ne()),et_pb_options.page_color_palette=a.join("|")):(n.val(t.find("#"+i).val()),s!==t.find("#"+i).val()&&(n.addClass("et_pb_value_updated"),ne()),"et_pb_section_background_color"===n.attr("id")&&(et_pb_options.page_section_bg_color=t.find("#"+i).val()),"et_pb_page_gutter_width"===n.attr("id")&&(et_pb_options.page_gutter_width=t.find("#"+i).val())))}),J.toggle_status(D),P.val(E),R.val(I),et_pb_ab_js_options.refresh_interval_duration=_.isUndefined(et_pb_ab_js_options.refresh_interval_durations[E])?"day":et_pb_ab_js_options.refresh_interval_durations[E],J.is_active()?J.count_subjects()<2&&(T.disable_publish=!0,e("#publish").addClass("disabled"),J.check_create_db(),J.alert_yes_no("select_ab_testing_subject"),T.is_selecting_ab_testing_subject=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_subject")):(T.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing")),T.saveAsShortcode();break;case"turn_off_ab_testing":var N,B=$.where({et_pb_ab_goal:"on"});_.each(B,function(e){delete e.attributes.et_pb_ab_goal,_.isUndefined(e.attributes.et_pb_temp_global_module)&&_.isUndefined(e.attributes.et_pb_temp_global_parent)||(N=j.getView(e.attributes.cid),j.removeTemporaryGlobalAttributes(N,!0))}),T.disable_publish=!0,e("#publish").addClass("disabled"),T.is_selecting_ab_testing_winner=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_winner");break;case"set_global_subject_winner":j.removeTemporaryGlobalAttributes(l.view),J.turn_off_ab_testing_sequence();break;case"ab_testing_alert":_.isUndefined(T.ab_last_visible_alert)||delete T.ab_last_visible_alert;break;case"view_ab_stats":J.toggle_status(!1),T.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing");break;case"delete_font":u=!1,e(this).hasClass("et-font-uploader-disabled")||q("remove",{font_name:n},i,e(this));break;case"upload_font":var z=p.find("#et-font-uploader-name").val(),F=p.find('.et-core-portability-import-form input[type="file"]').get(0).files,W=p.find(".et-font-uploader-all-weights").prop("checked")?"all":"",Y={},X="";if(p.find(".et-font-uploader-error").html(""),u=!1,"all"!==W){var Q=p.find(".et-font-uploader-weight-values input"),te=["100","200","300","400","500","600","700","800","900"],ie=[];e.each(Q,function(t,i){e(i).prop("checked")&&ie.push(te[t])}),W=ie.join(",")}""===z&&(X+=et_pb_options.font_name_error+"\n"),_.isUndefined(F)&&(X+=et_pb_options.font_file_error+"\n"),""===W&&(X+=et_pb_options.font_weight_error+"\n"),""!==X?p.find(".et-font-uploader-error").html(X):(Y={font_name:z,font_weight:W,generic_family:"sans-serif",font_files:F},e(this).hasClass("et-font-uploader-disabled")||q("add",Y,i,e(this),n))}u&&Z(e(this))}),e(".et_pb_modal_overlay .et_pb_prompt_proceed_alternative").click(function(t){switch(t.preventDefault(),e(this).closest(".et_pb_modal_overlay").data("action").trim()){case"set_global_subject_winner":j.removeTemporaryGlobalAttributes(l.view,!0),J.turn_off_ab_testing_sequence();break;case"ab_testing_alert_yes_no_select_ab_testing_subject":J.toggle_status(!1),J.toggle_portability(!0),T.disable_publish=!1,e("#publish").removeClass("disabled"),T.is_selecting_ab_testing_subject=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_subject"),delete T.ab_last_visible_alert}Z(e(this))}),e(".et_pb_modal_overlay .et_pb_prompt_dont_proceed").click(function(t){switch(t.preventDefault(),e(this).closest(".et_pb_modal_overlay").data("action").trim()){case"ab_testing_alert":_.isUndefined(T.ab_last_visible_alert)||delete T.ab_last_visible_alert;break;case"turn_off_ab_testing":J.toggle_status(!0)}Z(e(this))})}function q(t,i,o,n,a){var s={};"add"===t&&(s=JSON.stringify({font_weights:i.font_weight,generic_family:i.generic_family}));var l=new FormData,d={action:"et_pb_process_custom_font",et_pb_font_action:t,et_fb_upload_font_nonce:et_pb_options.upload_font_nonce,et_pb_font_name:i.font_name,et_pb_font_settings:s};_.each(i.font_files,function(t,i){var o=e(".et-font-uploader-selected-fonts").find("[data-file_name='"+t.name.toLowerCase()+"']");if(o.length>0){var n=o.data("file_format");d["et_pb_font_file_"+n]=t}}),_.each(d,function(e,t){l.append(t,e)}),e.ajax({type:"POST",url:et_pb_options.ajaxurl,contentType:!1,processData:!1,data:l,beforeSend:function(){o.append('<div id="et_pb_loading_animation"></div>'),n.addClass("et-font-uploader-disabled")},complete:function(){o.find("#et_pb_loading_animation").remove()},success:function(s){var l=e.parseJSON(s);if(_.isEmpty(l.error)){if("remove"===t&&!_.isUndefined(et_pb_options.user_fonts[i.font_name])){delete et_pb_options.user_fonts[i.font_name];var d=".select-option-item-"+i.font_name.replace(/ /g,"_");e(d).length>0&&e(d).each(function(){var t=e(this),o=t.hasClass("et_pb_selected_menu_item"),n=o?t.closest(".et-pb-option-container--font"):"";t.remove(),o&&($e(i.font_name,"remove"),ue(n,"default"),je(n,!1))})}if("add"===t&&!_.isEmpty(l.updated_fonts)){et_pb_options.user_fonts=l.updated_fonts;var r=l.uploaded_font;if(!_.isUndefined(r)){var p=r.replace(/ /g,"_"),c=e(".et-pb-option-subgroup-uploaded .et-pb-option-subgroup-container"),b='<li class="select-option-item select-option-item-custom-font select-option-item-'+p+'" data-value="'+r+'">'+r+'<span class="et-pb-user-font-marker"></span></li>';c.length>0&&c.append(b);var u=_.isUndefined(a)?"":e('[data-option_name="'+a+'"]').find('.select-option-item-custom-font[data-value="'+r+'"]');""!==u&&u.length>0&&u.click()}}Z(o)}else n.removeClass("et-font-uploader-disabled"),o.find(".et-font-uploader-error").html(l.error)}})}function Y(e){e.addClass("et_pb_animate_clone"),setTimeout(function(){e.length&&e.removeClass("et_pb_animate_clone")},500)}function Z(t){var i=t.closest(".et_pb_modal_overlay"),o=e("body");o.removeClass("et_pb_stop_scroll"),o.removeClass("et_pb_advanced_menu_opened"),i.addClass("et_pb_modal_closing"),setTimeout(function(){i.remove()},600)}function X(t,i){t.removeOverlay(),e(".et_pb_modal_settings_container").addClass("et_pb_modal_closing"),setTimeout(function(){t.remove(),"trigger_event"===i&&y.trigger("et-modal-view-removed")},600)}function Q(){var t=N.closest("#et_settings_meta_box").find(".et_pb_page_layout_settings");if(R.filter(":visible").length>1?(t.hide(),N.find(".et_pb_side_nav_settings").show()):("post"!==et_pb_options.post_type&&"no"===et_pb_options.is_third_party_post_type&&t.hide(),N.closest("#et_settings_meta_box").find(".et_pb_side_nav_settings").show(),N.closest("#et_settings_meta_box").find(".et_pb_single_title").show()),t.length>0){t.find("#et_pb_page_layout").val();var i=t.find('option[value="et_full_width_page"]');i.length>0&&i.show()}if(D.length){D.hide();var o=D.find('input[type="radio"]:checked').val();e(".et_divi_format_setting.et_divi_"+o+"_settings").hide()}"project"===et_pb_options.post_type&&N.closest("#et_settings_meta_box").find(".et_pb_project_nav").show()}function ee(t,i){var o;i=void 0!==i&&i;return o=void 0!==window.tinyMCE&&window.tinyMCE.get(t)&&!window.tinyMCE.get(t).isHidden()?window.tinyMCE.get(t).getContent():e("#"+t).val(),i&&void 0!==window.tinyMCE&&(o=(o=o.replace(/<p>\[/g,"[")).replace(/\]<\/p>/g,"]")),o.trim()}function te(e){var t=e.replace(/et_pb_row /g,"et_pb_row_inner ").replace(/et_pb_row\]/g,"et_pb_row_inner]");return t=t.replace(/et_pb_column /g,"et_pb_column_inner ").replace(/et_pb_column\]/g,"et_pb_column_inner]")}function ie(){var e="tinymce";return"html"===getUserSetting("editor")&&(e="html"),e}function oe(e){return!(void 0===window.tinyMCE||!window.tinyMCE.get(e)||window.tinyMCE.get(e).isHidden())}function ne(){var t=e("#post_ID").val(),i="https:"===window.location.protocol;wpCookies.set("et-editor-available-post-"+t+"-bb","bb",1800,et_pb_options.cookie_path,!1,i),wpCookies.set("et-editing-post-"+t+"-bb","bb",300,et_pb_options.cookie_path,!1,i),wpCookies.remove("et-saving-post-"+t+"-bb",et_pb_options.cookie_path,!1,i),wpCookies.remove("et-saved-post-"+t+"-bb",et_pb_options.cookie_path,!1,i)}function ae(t,i,o){o=o||"",oe("content");var n=oe(t),a=e.trim(i);if("load_secondary_editor"===o&&(a=_.unescape(a)),void 0!==window.tinyMCE&&window.tinyMCE.get(t)&&n){var s=window.tinyMCE.get(t);"load_secondary_editor"===o&&(a=window.switchEditors.wpautop(a)),s.setContent(a,{format:"html"})}e("#"+t).length&&e("#"+t).val(a),W[t]||"content"===t||(void 0!==tinyMCEPreInit.mceInit[t]?quicktags({id:t}):quicktags(tinyMCEPreInit.qtInit[t]),QTags._buttonsInit(),W[t]=!0),wp.heartbeat&&wp.heartbeat.hasConnectionError()||(e("#publish").removeClass("disabled"),delete T.disable_publish)}function se(e){void 0!==window.tinyMCE&&(window.tinyMCE.execCommand("mceRemoveEditor",!1,e),void 0!==window.tinyMCE.get(e)&&window.tinyMCE.remove("#"+e),W[e]=!1)}function le(t){t.length&&t.each(function(){e(this).trigger("change")})}function _e(t){if(0!==t.length){var i=t.closest(".et-pb-options-toggle-container");if(0!==i.length){var o=!1;i.find(".et-pb-option").length>0&&i.find(".et-pb-option").each(function(){"none"!==e(this).css("display")&&(o=!0)}),o?i.removeClass("et-pb-options-toggle-empty"):i.addClass("et-pb-options-toggle-empty")}}}function de(e,t){var i=void 0===e.data("device")?"all":e.data("device");if("all"!==i&&"phone"!==i){var o,n,a=void 0!==t?t:e.val(),s=e.hasClass("et-pb-range-input")||e.hasClass("et-pb-range"),l=e.hasClass("et_custom_margin_main"),d=s?".et-pb-range-input":".et-pb-main-setting",r=e.siblings(d+".et_pb_setting_mobile_tablet"),p=e.siblings(d+".et_pb_setting_mobile_phone"),c=void 0===r.data("default")?"":r.data("default"),b=void 0===p.data("default")?"":p.data("default"),u=_.isNaN(parseFloat(a))?0:parseFloat(a),g=!1;s?(o=e.siblings(".et-pb-range.et_pb_setting_mobile_tablet"),n=e.siblings(".et-pb-range.et_pb_setting_mobile_phone")):e.hasClass("et_custom_margin_main")||(a=Se(a,!1,"")),"desktop"===i?("no"===r.data("has_saved_value")&&r.val()===c&&(r.val(a).change(),g=!0,s&&o.val(u)),r.data("default",a),s&&o.data("default",u),l&&xe(r)):g=!0,g&&("no"===p.data("has_saved_value")&&p.val()===b&&(p.val(a).change(),s&&n.val(u),l&&xe(p)),p.data("default",a),s&&n.data("default",u))}}function re(e){var t=e.find(".et-pb-main-setting.et_pb_setting_mobile_active"),i=t.val()+"",o=t.hasClass("et-pb-range"),n=void 0===t.data("default")?"":t.data("default")+"",a=e.find(".et-pb-reset-setting");i!==(o&&""!==n?parseFloat(n)+"":n)?a.addClass("et-pb-reset-icon-visible"):a.removeClass("et-pb-reset-icon-visible")}function pe(e,t){e.find(".et_pb_setting_mobile").removeClass("et_pb_setting_mobile_active"),e.find(".et_pb_setting_mobile_"+t).addClass("et_pb_setting_mobile_active"),e.find(".et_pb_mobile_settings_tab").removeClass("et_pb_mobile_settings_active_tab"),e.find('.et_pb_mobile_settings_tab[data-settings_tab="'+t+'"]').addClass("et_pb_mobile_settings_active_tab"),re(e)}function ce(t,i){$.findWhere({cid:i});var o=t.find(".et-pb-options-tabs-links"),n=t.find(".et-pb-options-tab"),s=t.find(".et-pb-affects"),l=t.find(".et-pb-responsive-affects"),d=t.find(".et_custom_margin_main"),r=t.find(".et_custom_margin"),p=t.find(".et-pb-option--font"),b=t.find(".et_builder_font_style"),u=t.find(".et_builder_font_weight, .et_pb_font_line_style_select, .et-pb-font-line-color-value"),g=t.find(".et_pb_select_placeholder"),h=t.find("select.et-pb-text-align-select"),f=t.find(".et_builder_text_align"),m=t.find(".et_pb_multiple_buttons_wrapper input"),v=t.find(".et_builder_multiple_buttons_button"),w=t.find(".et-pb-range"),y=t.find(".et-pb-range-input"),k=t.find(".et-pb-options-tab-advanced").find(".et-pb-main-setting"),C=t.find(".et-pb-custom-color-picker"),x=t.find(".et-pb-choose-custom-color-button"),j=t.find(".et-pb-option-container--select_with_option_groups select"),V=t.find(".et_pb_yes_no_button_wrapper"),T=t.find(".et_pb_yes_no_button"),U=t.find(".et_pb_yes_no_button_wrapper select"),O=t.find(".et-pb-validate-unit"),A=t.find(".et_options_list:not(.et_conditional_logic)"),M=t.find(".et_conditional_logic"),L=t.find(".et_select_animation"),E=t.find(".et-preset-container"),D=t.find(".et-pb-option--background, .et-pb-option--background-field"),I=t.find("input.regular-text.et_pb_setting_mobile"),P=t.find(".et-pb-options-tab-custom_css .et-pb-option"),R=t.find(".et-pb-mobile-settings-toggle"),N=t.find(".et_pb_mobile_settings_tabs"),H=t.find(".et_pb_checkboxes_wrapper"),B=H.find('input[type="checkbox"]'),z="section"===t.data("module_type")?t.find("#et_pb_background_color"):"",F=t.find("#et_pb_gutter_width"),W=t.find("#et_pb_google_api_key"),J=t.find(".et_pb_update_google_key"),K=t.find("#et_pb_field_id"),q=t.find(".et_pb_contains_tabbed_subtoggle");function Y(e,t,i){var o=".et_options_list_row";t&&(o=".et_options_list_row:last");var n=e.parents(o);t&&(n=e.parent().find(o));var a=n.clone();a.find(".et_options_list_checked").removeClass("et_options_list_checked"),i&&a.find("input[type=text]").val(""),a.insertAfter(n),a.find("input[type=text]").focus()}function Z(t,i){var o=[];i.val(""),t.find("input[type=text]").each(function(){var t=e(this),i=t.prev(".et_options_list_checked").length>0,n={value:t.val(),checked:0};""!==n.value&&(i&&(n.checked=1),o.push(n))}),i.val(JSON.stringify(o))}function X(t,i,o,n){var a=null;switch(t){case"checkbox":case"radio":case"select":var s;switch(t){case"checkbox":s=o.et_pb_checkbox_options;break;case"radio":s=o.et_pb_radio_options;break;case"select":s=o.et_pb_select_options}var l=function(e){""===e&&(e="[]");var t;return t=(t=(t=(t=e.replace(/%22/g,'"')).replace(/%91/g,"[")).replace(/%92/g,"\\")).replace(/%93/g,"]"),JSON.parse(t)}(s);a=e("<select></select>"),e.each(l,function(t,o){var n=e('<option value="'+o.value+'">'+o.value+"</option>");a.append(n),""!==i&&a.val(i)});break;default:a=e('<input type="text" value="'+i+'" />')}return a.addClass("et_conditional_logic_value"),a}function Q(t){var i=t.find("textarea"),o=[];t.find(".et_options_list_row").each(function(){var t=e(this),i=t.find(".et_conditional_logic_field").val(),n=t.find(".et_conditional_logic_condition").val(),a=t.find(".et_conditional_logic_value"),s=a.val(),l=t.find(".et_conditional_logic_field").find("option:selected").data("type"),d=!_.includes(["radio","select","checkbox"],l)&&s,r={field:i,condition:n,value:s};!1!==d&&t.attr("data-selected-value",d),o.push(r),a.prop("disabled",!1),_.includes(["is empty","is not empty"],n)&&a.prop("disabled",!0)}),i.val(JSON.stringify(o))}W.length&&(J.attr("href",et_pb_options.options_page_url),""===et_pb_options.google_api_key?(W.addClass("et_pb_hidden_field"),J.text(J.data("empty_text")).addClass("et_pb_no_field_visible")):W.val(et_pb_options.google_api_key)),""!==z&&""!==et_pb_options.page_section_bg_color&&(""===z.val()&&(z.val(et_pb_options.page_section_bg_color),z.change()),z.data("default",et_pb_options.page_section_bg_color)),F&&""!==et_pb_options.page_gutter_width&&(F.siblings(".et-pb-main-setting").data("default",et_pb_options.page_gutter_width),F.data("default",et_pb_options.page_gutter_width)),q.length&&q.each(function(){var t=e(this),i=t.find(".subtoggle_tabs_nav");if(!(i.length<1||i.find(".subtoggle_tabs_nav_item").length<1)){var o=100/i.find(".subtoggle_tabs_nav_item").length+"%";i.find(".subtoggle_tabs_nav_item").css({width:o}),e(i.find(".subtoggle_tabs_nav_item a")[0]).addClass("et-bb-active-sub-tab"),e(t.find(".et_pb_tabbed_subtoggle")[0]).addClass("et-bb-active-subtoggle"),i.find(".subtoggle_tabs_nav_item a").click(function(i){i.preventDefault();var o=e(this),n=o.data("tab_id");t.find(".subtoggle_tabs_nav_item a").removeClass("et-bb-active-sub-tab"),o.addClass("et-bb-active-sub-tab"),t.find(".et_pb_tabbed_subtoggle").removeClass("et-bb-active-subtoggle"),t.find("[data-tab_id='"+n+"']").addClass("et-bb-active-subtoggle")})}}),N.length&&N.each(function(){var t=e(this).closest(".et-pb-option"),i=t.find(".et_pb_mobile_last_edited_field").val(),o=t.find(".et_pb_setting_mobile");if(o.length&&o.each(function(){var t=e(this),i=t.data("device"),o="desktop"!==i&&void 0!==t.data("has_saved_value")?t.data("has_saved_value"):"no",n=t.attr("type"),a="tablet"===i?t.siblings('input[type="'+n+'"].et_pb_setting_mobile_desktop').val():t.siblings('input[type="'+n+'"].et_pb_setting_mobile_tablet').val();"desktop"!==i&&("no"===o&&t.val(a),t.data("default",a))}),void 0!==i&&""!==i){var n=i.split("|");if(void 0===n[0]||"on"!==n[0])return;t.find(".et-pb-mobile-settings-toggle").addClass("et-pb-mobile-icon-visible et-pb-mobile-settings-active"),t.toggleClass("et_pb_has_mobile_settings"),void 0!==n[1]&&""!==n[1]&&pe(t,n[1])}}),R.click(function(){var t=e(this),i=t.closest(".et-pb-option"),o=i.find(".et_pb_mobile_last_edited_field"),n=o.val(),a=""!==n?n.split("|"):[],s=void 0!==a[1]&&""!==a[1]?a[1]:"desktop",l=i.find(".et-pb-reset-setting");return t.toggleClass("et-pb-mobile-settings-active"),i.toggleClass("et_pb_has_mobile_settings"),pe(i,s),i.addClass("et_pb_animate_options"),setTimeout(function(){i.removeClass("et_pb_animate_options")},500),i.hasClass("et_pb_has_mobile_settings")?(l.data("device",s),a[0]="on"):(l.data("device","all"),a[0]="off",pe(i,"desktop")),a[1]=void 0!==a[1]?a[1]:"",o.val(a[0]+"|"+a[1]).trigger("et_pb_setting:change"),!1}),N.find("a").click(function(){var t=e(this),i=t.closest(".et-pb-option-container"),o=t.data("settings_tab"),n=i.find(".et_pb_mobile_last_edited_field");return t.closest(".et_pb_mobile_settings_tabs").find("a").removeClass("et_pb_mobile_settings_active_tab"),t.addClass("et_pb_mobile_settings_active_tab"),i.find(".et_pb_setting_mobile").removeClass("et_pb_setting_mobile_active"),i.find(".et_pb_setting_mobile_"+o).addClass("et_pb_setting_mobile_active"),i.find(".et-pb-reset-setting").data("device",o),n.val("on|"+o),re(i),!1}),H.length&&H.each(function(){var t,i,o=e(this),n=o.find("input.et-pb-main-setting").val(),a=o.find('input[type="checkbox"]');""!==n&&(t=n.split("|"),i=0,a.each(function(){"on"===t[i]&&e(this).prop("checked",!0);i++}))}),B.click(function(){var t,i,o=e(this),n=e(this).attr("class"),a=o.closest(".et_pb_checkboxes_wrapper"),s=a.find(".et_pb_disabled_option"),l=a.find('input[type="checkbox"]'),_=a.find("input.et-pb-main-setting"),d=!0===o.prop("checked")?"on":"off",r=0,p=[];l.each(function(){e(this).hasClass(n)&&(t=r),r++,p.push("")}),(i=""!==_.val()?_.val().split("|"):p)[t]=d,_.val(i.join("|")),s.length&&("on"===i[0]&&"on"===i[1]&&"on"===i[2]?s.val("on"):s.val("off"))}),I.on("input change",function(){de(e(this))}),C.each(function(){var t=e(this),i=t.val(),o=t.closest(".et-pb-custom-color-container"),n=t.closest(".et-pb-options-tab"),a=o.siblings(".et-pb-choose-custom-color-button"),s=void 0!==t.data("old-option-ref")&&""!==t.data("old-option-ref")?t.data("old-option-ref"):"",l=""!==s?n.find(".et-pb-option-"+s):"",_=""!==l&&l.length?l.find("input"):"",d=o.find(".et-pb-color-picker-hex"),r=ve(d).toLowerCase();if(""!==_&&(""===i&&""!==_.val()&&(i=_.val()),_.val("")),""===i||i===r)return!0;o.removeClass("et_pb_hidden"),a.addClass("et_pb_hidden"),d.wpColorPicker("color",i)}),x.click(function(){var t=e(this),i=t.siblings(".et-pb-custom-color-container"),o=i.find(".et-pb-color-picker-hex"),n=i.find(".et-pb-custom-color-picker");return t.addClass("et_pb_hidden"),i.removeClass("et_pb_hidden"),i.find(".wp-color-result").click(),n.val(o.wpColorPicker("color")),!1}),j.each(function(){var t=e(this).siblings("input.et-pb-main-setting"),i=t.val().split("|"),o=i.length>1?i[0]:"",n=i.length>1?i[1]:i[0];""===o&&(o=e(this).find(":selected").parent().attr("label"),t.val(o+"|"+n).trigger("change")),e(this).val(n),e(this).change(function(){var i=e(this).find(":selected").parent().attr("label")||"";t.val(i+"|"+e(this).val()).trigger("change")})}),V.each(function(){var t=e(this),i=t.find(".et_pb_yes_no_button");"on"===t.find("select").val()?(i.removeClass("et_pb_off_state"),i.addClass("et_pb_on_state")):(i.removeClass("et_pb_on_state"),i.addClass("et_pb_off_state"))}),A.each(function(){var t,i=e(this),o=i.find("textarea"),n=o.val();if(i.on("keydown","input[type=text]",function(e){"Enter"===e.key&&e.stopPropagation()}),i.on("keyup","input[type=text]",function(n){clearTimeout(t),"Enter"===n.key&&Y(e(this),!1,!0),t=setTimeout(function(){Z(i,o)},500)}),i.on("click",".et-pb-add-sortable-option",function(t){t.preventDefault(),Y(e(this),!0,!0)}),i.on("click",".et_options_list_copy",function(t){t.preventDefault(),Y(e(this))}),i.on("click",".et_options_list_remove",function(t){if(t.preventDefault(),1===i.find(".et_options_list_row").length)return i.find(".et_options_list_row:first input[type=text]").val(""),void Z(i,o);e(this).parents(".et_options_list_row").remove(),Z(i,o)}),i.on("click",".et_options_list_check",function(t){t.preventDefault();var n=e(this);n.parent().hasClass("et_options_list_row_radio")&&i.find(".et_options_list_check").not(n).removeClass("et_options_list_checked"),n.toggleClass("et_options_list_checked"),Z(i,o)}),!n){var a=parseInt(i.parents("[data-parent-cid]").attr("data-parent-cid")),s=$.findWhere({cid:a}),l=!_.isUndefined(s.attributes.et_pb_checkbox_checked)&&"on"===s.attributes.et_pb_checkbox_checked,d=_.isUndefined(s.attributes.et_pb_field_title)?"":s.attributes.et_pb_field_title;n=JSON.stringify([{value:d,checked:!0===l?1:0}]),o.val(n),"checkbox"===s.attributes.et_pb_field_type&&i.find(".et_options_list_row_checkbox").length>0&&setTimeout(function(){e("#et_pb_field_title").val("")},0)}!function(t,i,o){if(""===o||_.isUndefined(o))return;var n=t.find(".et_options_list_row:first"),a=e("<div>").addClass("et_options_rows");try{o=JSON.parse(o)}catch(e){o=o.replace(/\{("value":")(.*?)(",)("checked":.,?.*?)\}/gi,function(e,t,i,o,n){var a=i.replace(/(.)?(")/gi,function(e,t,i){return"\\"!==t?t+"\\"+i:e});return"{"+t+a+o+n+"}"}),o=JSON.parse(o)}for(var s=0;s<o.length;s++){var l=o[s],d=1===l.checked,r=n.clone();r.find("input[type=text]").val(l.value),r.find(".et_options_list_check").toggleClass("et_options_list_checked",d),r.appendTo(a)}a.insertAfter(n),n.remove()}(i,0,n),i.children(".et_options_rows").sortable({axis:"y",containment:"parent",update:function(){Z(i,o),setTimeout(function(){e(".et_options_rows").children().css({position:"",top:"",left:""})},700)}})}),M.each(function(){var t=e(this),i=t.find("textarea").val();i=""!==i?i:"[]",i=JSON.parse(i);var o=e(this).find(".et_options_list_row");if(1<i.length)for(var n=1;n<i.length;n++){var a=o.clone();t.find(".et_options_list_row:last").after(a)}setTimeout(function(){var o={},n=t.parents(".et_pb_modal_settings_container_step2"),a=n.data("parent-cid"),s=n.prev(".et_pb_modal_settings_container").find('ul.et-pb-sortable-options li:not([data-cid="'+a+'"])'),l=t.find(".et_conditional_logic_field");s.each(function(){var t=e(this).data("cid"),i=$.findWhere({cid:t}).attributes,n=i.et_pb_field_id;if(""!==n){n=n.toLowerCase();var a=_.isUndefined(i.et_pb_field_type)?"input":i.et_pb_field_type,s=_.isUndefined(i.et_pb_field_title)?n:i.et_pb_field_title;s=""!==s.trim()?s:n;var d=e('<option data-type="'+a+'" value="'+n+'">'+s+"</option>");l.append(d),o[n]=i}});var d="";for(var r in o)if(o.hasOwnProperty(r)){d=r;break}var p=o[d].et_pb_field_id.toLowerCase();0===i.length&&0!==o.length&&i.push({field:p,condition:"is",value:""});for(var c=0;c<i.length;c++){var b=i[c],u=t.find(".et_options_list_row").eq(c),g=(l=u.find(".et_conditional_logic_field")).next(".et_conditional_logic_condition"),h=o[p],f="input",m="",v=_.isUndefined(b.field)||_.isUndefined(o[b.field])?p:b.field,w=_.isUndefined(b.condition)?"is":b.condition;_.isUndefined(o[b.field])||(h=o[b.field],m=b.value,f=_.isUndefined(h.et_pb_field_type)?"input":h.et_pb_field_type),u.find(".et_conditional_logic_value").remove(),X(f,m,h,t).insertAfter(g),l.val(v),g.val(w)}Q(t),t.on("change",".et_conditional_logic_field",function(){var i=e(this),n=i.val(),a=i.next(".et_conditional_logic_condition"),s=i.parents(".et_options_list_row"),l=o[n],d="",r=_.isUndefined(l.et_pb_field_type)?"input":l.et_pb_field_type,p=s.attr("data-selected-value");p&&!_.includes(["radio","select","checkbox"],r)&&(d=p),s.find(".et_conditional_logic_value").remove(),X(r,d,l,t).insertAfter(a),Q(t)}),t.on("change",".et_conditional_logic_condition, .et_conditional_logic_value",function(){Q(t)}),t.on("click",".et-pb-add-sortable-option",function(t){t.preventDefault(),function(e,t){if(0===t.length)return;var i=e.parents(".et_conditional_logic"),o=i.find(".et_options_list_row:last"),n=o.clone(),a=n.find(".et_conditional_logic_condition"),s="";for(var l in t)if(t.hasOwnProperty(l)){s=l;break}var d=t[s],r=_.isUndefined(d.et_pb_field_type)?"input":d.et_pb_field_type;n.find(".et_conditional_logic_value").remove(),X(r,"",d,i).insertAfter(a),a.val("is"),n.insertAfter(o),Q(i)}(e(this),o)}),t.on("click",".et_options_list_remove",function(t){t.preventDefault(),function(e){var t=e.parent(".et_options_list_row"),i=t.parent(".et_conditional_logic");if(1===i.find(".et_options_list_row").length)return;t.remove(),Q(i)}(e(this))})},0)}),K.on("focusout",function(){var t=e(this).val().replace(/\s+/g,"_"),i=K.parents(".et_pb_modal_settings_container_step2"),o=i.prev(".et_pb_modal_settings_container"),n=i.data("parent-cid"),a=o.find('ul.et-pb-sortable-options li:not([data-cid="'+n+'"])'),s=[];if(a.each(function(){var t=e(this).data("cid"),i=$.findWhere({cid:t}).attributes;s.push(i)}),""===t){var l=$.findWhere({cid:n});t="Field_"+(parseInt(l.attributes.module_order)+1)}for(;;){for(var _=!1,d=0;d<s.length;d++){if(s[d].et_pb_field_id.toLowerCase()===t.toLowerCase()){t+="_2",_=!0;break}}if(!1===_)break}e(this).val(t)}),L.each(function(){var t=e(this),i=t.find('input[type="hidden"]'),o=i.val();t.find('.et_animation_button_title[data-value="'+o+'"]').parent().addClass("et_active_animation"),t.on("click",".et_animation_button a",function(o){o.preventDefault();var n=e(this);if(!n.hasClass("et_active_animation")){var a=n.find(".et_animation_button_title").attr("data-value");a=a.trim(),t.find(".et_animation_button a").removeClass("et_active_animation"),n.addClass("et_active_animation"),i.val(a).trigger("change")}})}),E.each(function(){var t=e(this),i=t.find('input[type="hidden"]'),o=function(e,i){var o=t.closest(".et-pb-options-toggle-container").find("#et_pb_"+e);o.val(i),o.trigger("change")},n=function(){t.find(".et-preset").removeClass("et-preset-active"),t.find('.et-preset[data-value="'+i.val()+'"]').addClass("et-preset-active")};t.on("click",".et-preset",function(n){var a=e(this),s=a.attr("data-value").trim(),l={};if(n.preventDefault(),!a.hasClass("et-preset-active")){t.find(".et-preset").removeClass("et-preset-active"),a.addClass("et-preset-active"),i.val(s).trigger("change");try{l=JSON.parse(a.attr("data-fields"))}catch(e){l=[]}e.each(l,o)}}),i.on("change",n),n()}),T.click(function(){var t=e(this),i=t.closest(".et_pb_yes_no_button_wrapper").find("select");t.hasClass("et_pb_off_state")?(t.removeClass("et_pb_off_state"),t.addClass("et_pb_on_state"),i.val("on")):(t.removeClass("et_pb_on_state"),t.addClass("et_pb_off_state"),i.val("off")),i.trigger("change")}),U.change(function(){var t=e(this),i=t.closest(".et_pb_yes_no_button_wrapper").find(".et_pb_yes_no_button");"on"===t.val()?(i.removeClass("et_pb_off_state"),i.addClass("et_pb_on_state")):(i.removeClass("et_pb_on_state"),i.addClass("et_pb_off_state"))}),D.length&&D.each(function(){var t=e(this),i=t.is(".et-pb-option--background"),o=i?".et-pb-option--background":".et-pb-option--background-field",n=t.find(".et-pb-option-container-inner").data("base_name"),a=i?"":n+"_",s=t.find(".et_pb_background-tab-navs li").size();t.find(".et_pb_background-tab:first").show(),t.find(".et_pb_background-tab-navs li:first a").addClass("active"),4!==s&&t.find(".et_pb_background-tab-navs li").css({width:100/s+"%"}),t.find(".et_pb_background-tab-navs").on("click","a",function(t){t.preventDefault();var i=e(this),n=i.attr("data-tab"),a=i.closest(o);a.find(".et_pb_background-tab-navs a").removeClass("active"),i.addClass("active"),a.find(".et_pb_background-tab:visible").hide(),a.find('.et_pb_background-tab[data-tab="'+n+'"]').fadeIn(),a.find('.et_pb_background-tab[data-tab="'+n+'"]').find(".et-pb-affects").trigger("change"),v(i.closest(o),!1)});var l=t.find(".et_pb_background-tab--gradient"),d=l.find(".et-pb-option-preview"),r=d.find(".et-pb-option-preview-button--add"),p=d.find(".et-pb-option-preview-button--swap"),b=d.find(".et-pb-option-preview-button--delete"),u=i?"use_background_color_gradient":n+"_use_color_gradient",g=l.find(".et_pb_background-option--"+u+" .et_pb_yes_no_button"),h=l.find(".et_pb_background-option--"+u+" select"),f=l.find(".et_pb_background-option--"+n+"_color_gradient_start .wp-color-picker"),m=ke(l,n);function v(t,i){t.find(".et_pb_background-tab").each(function(){var o=e(this),a=!1,s=o.attr("data-tab"),l=t.find('.et_pb_background-tab-nav[data-tab="'+s+'"]');switch(s){case"color":var d=o.find(".et_pb_background-option--use_background_color"),r=o.find(".et_pb_background-option--"+n+"_color");d.length&&r.length?a="on"===d.find("select option:selected").val()&&""!==r.find(".et-pb-color-picker-hex").val():!d.length&&r.length&&(a=""!==r.find(".et-pb-color-picker-hex").val());break;case"gradient":"on"===o.find(".et_pb_background-option--"+u+" select option:selected").val()&&(a=!0);break;case"image":var p=o.find(".et_pb_background-option--"+n+"_image .et-pb-upload-field").val()||o.find(".et_pb_background-option--background_url .et-pb-upload-field").val();_.isUndefined(p)||""===p||(a=!0);break;case"video":var c=o.find(".et_pb_background-option--"+n+"_video_mp4 .et-pb-upload-field").val(),b=o.find(".et_pb_background-option--"+n+"_video_webm .et-pb-upload-field").val();(!_.isUndefined(c)&&""!==c||!_.isUndefined(b)&&""!==b)&&(a=!0)}a?(l.addClass("et-pb-filled"),i&&(t.find(".et_pb_background-tab").removeAttr("style"),l.trigger("click"))):l.removeClass("et-pb-filled")})}m&&(d.css({backgroundImage:m}),d.removeClass("et-pb-option-preview--empty")),d.click(function(e){e.preventDefault(),e.stopPropagation(),d.hasClass("et-pb-option-preview--empty")?(g.removeClass("et_pb_off_state").addClass("et_pb_on_state"),h.val("on").trigger("change"),d.removeClass("et-pb-option-preview--empty")):f.wpColorPicker("open",!0)}),r.click(function(e){e.stopPropagation(),g.removeClass("et_pb_off_state").addClass("et_pb_on_state"),h.val("on").trigger("change"),d.removeClass("et-pb-option-preview--empty")}),b.click(function(e){e.stopPropagation(),g.removeClass("et_pb_on_state").addClass("et_pb_off_state"),h.val("off").trigger("change"),d.addClass("et-pb-option-preview--empty")}),p.click(function(t){t.preventDefault(),t.stopPropagation();var i=e(this).closest(o),a=i.find(".et_pb_background-option--"+n+"_color_gradient_start .et-pb-color-picker-hex"),s=i.find(".et_pb_background-option--"+n+"_color_gradient_end .et-pb-color-picker-hex"),l=a.val(),_=s.val();a.val(_).trigger("change"),s.val(l).trigger("change")}),l.on("change input keyup",'select, input[type="text"], input[type="range"]',function(){ye(e(this))}),v(t,!0);var w=t.find(".et-pb-option-container--background").attr("data-column-index"),y=void 0===w?"":"_"+w,k=["#et_pb_"+n+"_color"+y,"#et_pb_use_background_color","#et_pb_"+n+"_color_gradient_start"+y,"#et_pb_"+n+"_color_gradient_end"+y,"#et_pb_"+u+y,"#et_pb_"+n+"_color_gradient_type"+y,"#et_pb_"+n+"_color_gradient_direction"+y,"#et_pb_"+n+"_color_gradient_direction_radial"+y,"#et_pb_"+n+"_color_gradient_start_position"+y,"#et_pb_"+n+"_color_gradient_end_position"+y,void 0===w?"#et_pb_bg_img"+y:"#et_pb_background_image","#et_pb_background_url","#et_pb_"+a+"parallax"+y,"#et_pb_"+a+"parallax_method"+y,"#et_pb_"+n+"_size"+y,"#et_pb_"+n+"_position"+y,"#et_pb_"+n+"_repeat"+y,"#et_pb_"+n+"_blend"+y,".et-pb-range"];t.find(k.join(", ")).change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))}),setTimeout(function(){e("#et_pb_featured_placement").length&&e("#et_pb_featured_placement").change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))}),e("#et_pb_featured_image").length&&e("#et_pb_featured_image").change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))})},700)}),o.find("li a").click(function(){var t=e(this),i=t.closest("li").index(),n=t.closest("ul"),a=n.siblings(".et-pb-options-tabs"),s=n.find(".et-pb-options-tabs-links-active"),l=s.index(),_=a.find(".et-pb-options-tab").eq(l),d=a.find(".et-pb-options-tab").eq(i);return l!==i&&(d.css({display:"none",opacity:0}),_.css({display:"block",opacity:1}).stop(!0,!0).animate({opacity:0},300,function(){e(this).css("display","none"),d.css({display:"block",opacity:0}).stop(!0,!0).animate({opacity:1},300,function(){var t=e(this);t.find(".et-pb-option:visible").length||d.hasClass("et-pb-options-tab-view_stats")?e(".et-pb-all-options-hidden").remove():t.append('<p class="et-pb-all-options-hidden">'+et_pb_options.all_tab_options_hidden+"<p>"),o.trigger("et_pb_main_tab:changed")})}),s.removeClass("et-pb-options-tabs-links-active"),n.find("li").eq(i).addClass("et-pb-options-tabs-links-active"),e(".et-pb-options-tabs").animate({scrollTop:0},400,"swing")),!1}),n.each(function(){var t=e(this).find(".et-pb-options-toggle-enabled"),i="et-pb-option-toggle-content-open";t.find("h3").click(function(){var o=e(this),n=o.siblings(".et-pb-option-toggle-content"),a=o.closest(".et-pb-options-toggle-container"),l=t.filter("."+i),_=l.find(".et-pb-option-toggle-content");a.hasClass(i)||(l.removeClass(i).addClass("et-pb-option-toggle-content-closed"),_.slideToggle(300),a.removeClass("et-pb-option-toggle-content-closed").addClass(i),n.slideToggle(300,function(){le(s)}))})}),d.length&&(d.each(function(){xe(e(this))}),d.on("et_main_custom_margin:change",function(){xe(e(this))})),r.change(function(){var t=e(this),i=void 0!==t.data("device")?t.data("device"):"all",o=t.closest(".et_margin_padding"),n=o.closest(".et-pb-option-container").find(".et-pb-mobile-settings-toggle"),a="all"===i?o.find(".et_custom_margin_main"):o.find(".et_custom_margin_main.et_pb_setting_mobile_"+i),s="all"===i?".et_custom_margin":".et_custom_margin.et_pb_setting_mobile_"+i,l="",_=t.closest(".et-pb-option").data("option_name"),d={custom_padding:"padding",custom_margin:"margin"};o.find(s).each(function(){l+=e.trim(Se(e(this).val(),e(this).hasClass("auto_important"),void 0,d[_]))+"|"}),"|||"===(l=l.slice(0,-1))?l="":n.addClass("et-pb-mobile-icon-visible"),a.val(l).trigger("et_pb_setting:change"),de(a)}),b.click(function(){var t=e(this),i=t.closest(".et_builder_font_styles"),o=t.data("button_name");t.closest(".et-pb-option-container--font");return t.toggleClass("et_font_style_active"),_.forEach([["uppercase","capitalize"],["underline","line_through"]],function(e){-1!==_.indexOf(e,o)&&_.forEach(e,function(e){e!==o&&i.find(".et_builder_"+e+"_font").removeClass("et_font_style_active")})}),ue(t.closest(".et-pb-option-container--font")),je(t.closest(".et-pb-option--font")),!1}),u.change(function(){ue(e(this).closest(".et-pb-option-container--font"))}),p.on("click",".et-pb-settings-option-select li",function(t){var i=e(this),o=i.closest(".et-pb-option--font"),n=o.find(".et-pb-settings-option-select-advanced"),a=i.data("value");if(!_.isUndefined(a)){if(e(t.target).closest(".et-pb-user-font-marker").length>0)return void G("delete_font",a);ue(o,a),ge(n),"default"!==a&&$e(a),je(o,!1)}}),p.on("click",".et-pb-font-upload-button",function(t){G("upload_font",e(t.target).closest(".et-pb-option--font").data("option_name"))}),p.on("input",".et-pb-menu-filter",function(){var t=e(this).val(),i=e(this).closest(".et-pb-settings-option-select-advanced"),o=i.find(".select-option-item");""!==t?i.addClass("et_pb_menu_search_active"):i.removeClass("et_pb_menu_search_active"),o.removeClass("et_pb_hidden_item");var n=_.filter(o,function(i){return-1===e(i).text().toLowerCase().search(t.toLowerCase())});e(n).addClass("et_pb_hidden_item")}),p.each(function(){je(e(this),!1,!0)}),g.click(function(){var t=e(this),i=t.closest(".et-pb-select-font-outer"),o=i.find(".et-pb-settings-option-select-advanced"),n=o.find(".select-option-item"),a=i.find(".et-pb-menu-filter");o.addClass("et_pb_menu_active"),o.removeClass("et_pb_menu_search_active"),n.removeClass("et_pb_hidden_item"),a.val(""),o.animate({scrollTop:0},0);var s=t.offset(),l=e(window).height(),_=e(window).scrollTop(),d=500>l?l-50:500,r=s.top-_-20,p=l-r;p<d?r-=d-p+50:d=p-50,o.css({top:r,maxHeight:d}),e("body").addClass("et_pb_advanced_menu_opened")}),h.each(function(){var t=e(this),i=t.data("saved_value"),o=t.data("default"),n=""!==i?t.val():o,a=t.closest(".et-pb-option-container"),s=(a.find("select.et-pb-text-align-select"),""!==n&&a.find(".et_builder_"+n+"_text_align"));s&&s.addClass("et_text_align_active")}),h.change(function(){var t=e(this),i=t.closest(".et-pb-option-container").find(".et_builder_text_align.et_text_align_active"),o=!!i.length&&i.data("value"),n=t.attr("data-default")===o?"":o;o&&(t.data("saved_value",n),t.val(o).trigger("et_pb_setting:change"))}),f.click(function(){var t=e(this),i=t.closest(".et-pb-option-container"),o=t.hasClass("et_text_align_active"),n=i.find(".et-pb-text-align-select"),a=n.attr("data-default");return i.find(".et_builder_text_align").removeClass("et_text_align_active"),o?_.isUndefined(a)||""===a||i.find(".et_builder_"+a+"_text_align").addClass("et_text_align_active"):t.addClass("et_text_align_active"),n.trigger("change"),!1}),m.each(function(){be(e(this))}),m.on("change",function(){be(e(this))}),v.click(function(){var t=e(this),i=t.closest(".et-pb-option-container").find("input"),o=i.data("default"),n=i.val(),a=_.isUndefined(n)||""===n?[]:n.split("|"),s=t.data("value"),l=n,d="yes"===i.data("multi");return"yes"===i.data("toggleable")&&t.hasClass("et_builder_multiple_buttons_button_active")?l=d?_.without(a,s).join("|"):o:(d&&a.push(s),l=d?a.join("|"):s),i.val(l).trigger("change"),!1}),w.on("input change",function(){var t,i,o=e(this),n=void 0===o.data("device")?"all":o.data("device"),a=o.val(),s="all"===n?o.siblings(".et-pb-range-input"):o.siblings(".et-pb-range-input.et_pb_setting_mobile_"+n),l=s.data("initial_value_set")||!1,_=s.data("unit")||"no_default_unit",d=Se(e.trim(s.val()),!1,_);if(isNaN(parseFloat(d))&&!l)return o.val(0),void s.data("initial_value_set",!0);t=parseFloat(d),d+="",""!==(i=e.trim(d.replace(t,"")))&&(a+=i),s.val(a).trigger("et_pb_setting:change"),de(o,a)}),w.length&&w.each(function(){var t=e(this),i=void 0===t.data("device")?"all":t.data("device"),o=void 0!==t.data("default_inherited")?e.trim(t.data("default_inherited")):e.trim(t.data("default")),n="all"===i?t.siblings(".et-pb-range-input"):t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+i),a=e.trim(n.val());if(""===a&&(""!==o&&(n.val(o),o=parseFloat(o)||0),t.val(o),a=o),"tablet"===i){var s=t.siblings(".et-pb-range-input.et_pb_setting_mobile_desktop").val();t.data("default",parseFloat(s)),n.data("default",s)}else if("phone"===i){var l=t.siblings(".et-pb-range-input.et_pb_setting_mobile_tablet").val();t.data("default",parseFloat(l)),n.data("default",l)}he(t,a,!0)}),y.on("keyup change",_.debounce(function(t){var i,o=e(this),n=void 0===o.data("device")?"all":o.data("device"),a=Se(fe(o,!0),!1,o.data("unit")||"no_default_unit"),s="all"===n?o.siblings(".et-pb-range"):o.siblings(".et-pb-range.et_pb_setting_mobile_"+n),l=!1;i=parseFloat(a)||0,_.isUndefined(t.type)||"keyup"!==t.type||(l=!0),he(s,i,l),o.val(a),s.val(i).trigger("et_pb_setting:change"),de(o)},700)),O.length&&O.each(function(){var t=e(this),i=Se(e.trim(t.val()));t.val(i)}),k.length&&(k.on("change et_pb_setting:change et_main_custom_margin:change",function(){var t=e(this),i=void 0===t.data("device")?"all":t.data("device"),o=t.closest(".et-pb-option-container"),n=o.find(".et-pb-reset-setting"),a=t.hasClass("et-pb-range"),s=t.hasClass("et-pb-font-select"),l=t.hasClass("et-presets")||t.hasClass("et_select_animation"),_=a&&"all"===i?t.siblings(".et-pb-range-input"):t;l&&(_=t.children("input"));var d=ve(_=a&&"all"!==i?t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+i):_).toLowerCase(),r=_.val()+"";r=r.toLowerCase();var p=o.find(".et-pb-mobile-settings-toggle");if(s){var c=r.split("|"),b=d.split("|");n.each(function(){var t=e(this),i=0;t.hasClass("et_pb_reset_weight")&&(i=1),""!==c[i]&&b[i]!==c[i]?t.addClass("et-pb-reset-icon-visible"):t.removeClass("et-pb-reset-icon-visible")})}else!_.hasClass("et_pb_setting_mobile")||_.hasClass("et_pb_setting_mobile_active")?we(_)?(n.removeClass("et-pb-reset-icon-visible"),p.hasClass("et-pb-mobile-settings-active")||p.removeClass("et-pb-mobile-icon-visible")):(setTimeout(function(){n.addClass("et-pb-reset-icon-visible")},50),p.addClass("et-pb-mobile-icon-visible")):(r!==d&&!a||a&&r!==d+"px"&&r!==d)&&p.addClass("et-pb-mobile-icon-visible")}),k.trigger("change"),t.find(".et-pb-main-settings .et_pb_options_tab_advanced a").append('<span class="et-pb-reset-settings"></span>'),t.find(".et-pb-reset-settings").on("click",function(){G("reset_advanced_settings",k)})),t.find(".et-pb-reset-setting").not(".et-pb-reset-skip").on("click",function(){Ce(e(this))});var ee=t.data("module_type"),te=e();if("section"===ee&&(ee="et_pb_section"),"row"===ee&&(ee="et_pb_row"),S(window.et_pb_module_field_dependencies,ee)){var ie=function e(i){var o=[],n=oe[i].affects,a=t.find("#et_pb_"+i),s=a.closest(".et-pb-option"),l=function(e){var t=[];return oe[e].show_if&&(t=_.keys(oe[e].show_if)),oe[e].show_if_not&&(t=_.union(t,_.keys(oe[e].show_if_not))),t}(i);_.forEach(l,function(e){var n=t.find("#et_pb_"+e).val(),a=oe[e].affects[i].show_if,s=oe[e].affects[i].show_if_not;o.push(function(e,t,i){var o=!1;return t&&i?(t=_.isArray(t)?_.includes(t,e):e===t,i=_.isArray(i)?!_.includes(i,e):e!==i,o=t&&i):t?o=_.isArray(t)?_.includes(t,e):e===t:i&&(o=_.isArray(i)?!_.includes(i,e):e!==i),o}(n,a,s))}),o=!_.includes(o,!1),s.toggle(o).addClass("et_pb_animate_affected");var d=o?"et-pb-option-field-shown":"et-pb-option-field-hidden";a.trigger(d),setTimeout(function(){s.removeClass("et_pb_animate_affected"),_e(a)},500),_.isUndefined(n)||_.forEach(n,function(t,i){e(i)})},oe=window.et_pb_module_field_dependencies[ee];_.forEach(oe,function(e,i){if(!_.isUndefined(e.affects)){var o=t.find("#et_pb_"+i);te=te.add(o),o.on("change",function(){_.forEach(e.affects,function(e,t){ie(t)})})}})}s.length&&s.change(function(){var i=e(this),o=i.closest(".et-pb-option"),n=i.val(),a=(parseInt(n),_.map(i.data("affects").split(", "),function(e){return-1!==e.indexOf("#et_pb_")?e:"#et_pb_"+e}).join(", ")),s=t.find(a),l=i.closest(".et-pb-options-tab").index(),d=[];s.each(function(){!function t(a,s){s=!0===s;var r=e(a),p=r.closest(".et-pb-option"),c=p.hasClass("et-pb-new-depends"),b="text"===i.attr("type"),u=p.data("depends_show_if")||"on",g=b?"":p.data("depends_show_if_not"),h=!s&&(u===n||void 0!==g&&!_.contains(g.split(","),n)),f=r.closest(".et-pb-options-tab").index(),m=p.find(".et-pb-affects"),v=i.closest(".et_pb_background-template--use_color_gradient").length;if(!(r.hasClass("et_pb_field_processed")||b&&!i.is(":visible")||c)){l!==f||!h||"none"!==o.css("display")||i.is('[type="hidden"]')||v||(h=!1),p.toggle(h).addClass("et_pb_animate_affected");var w=r.is(":visible")?"et-pb-option-field-shown":"et-pb-option-field-hidden";if(r.trigger(w),setTimeout(function(){p.removeClass("et_pb_animate_affected"),_e(r)},500),m.length){var y=_.map(m.data("affects").split(", "),function(e){return-1!==e.indexOf("#et_pb_")?e:"#et_pb_"+e}).join(", "),k=e(y);h?d.push(r):k.each(function(){t(this,!0),_e(e(this))}).removeClass("et_pb_field_processed")}r.addClass("et_pb_field_processed")}}(this)}).removeClass("et_pb_field_processed"),_.forEach(d,function(e){e.trigger("change")}),e(".et_options_list:not(.et_conditional_logic)").each(function(){var t=e(this);if(0===t.find(".et_options_rows").length){var i=t.find("textarea");t.find(".et_options_list_row").wrapAll('<div class="et_options_rows" />'),t.find(".et_options_rows").sortable({axis:"y",containment:"parent",update:function(){Z(t,i),setTimeout(function(){e(".et_options_rows").children().css({position:"",top:"",left:""})},700)}})}})}),setTimeout(function(){n.css({display:"block"}),(s=s.add(te)).data("is_rendering_setting_view",!0),le(s),s.data("is_rendering_setting_view",!1),n.css({display:"none"}),Re()},100),setTimeout(function(){e(".et-pb-option-toggle-content").length>0&&e(".et-pb-option-toggle-content").each(function(){""===e.trim(e(this).text())&&e(this).closest(".et-pb-options-toggle-container").addClass("et-pb-options-toggle-empty")})},100),l.length&&(l.on("et_pb_setting:change",function(){var t=e(this),i=t.parent(),o=(i.children(".et-pb-responsive-affects"),t.data("responsive-desktop-name")),n=t.data("responsive-affects").split(","),a={desktop:i.find("#"+o).val(),tablet:i.find("#"+o+"_tablet").val(),phone:i.find("#"+o+"_phone").val()},s=(t.closest(".et_pb_modal_settings_container_step2").length?i.find('input[id="data.'+o+'_last_edited"]'):i.find("#"+o+"_last_edited")).val(),l="string"==typeof s&&"on"===s.split("|")[0];_.forEach(n,function(t){var i=e("#et_pb_"+t).closest(".et-pb-option:not(.et_pb_background-option)"),o=_.isUndefined(i.data("depends_show_if_not"))?[]:i.data("depends_show_if_not").split(","),n=!0;n=l?!_.contains(o,a.desktop)||!_.contains(o,a.tablet)||!_.contains(o,a.phone):!_.contains(o,a.desktop),i.toggle(n),i.siblings().length<1&&i.closest(".et-pb-options-toggle-container").toggle(n)})}),setTimeout(function(){l.each(function(){e(this).trigger("et_pb_setting:change")})})),t.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",function(){var t,o,n=e(".et-pb-options-tabs-links").find(".et_pb_options_tab_custom_css"),a=e(".et-pb-options-tab-custom_css").find(".et_pb_module_order_placeholder");n.hasClass("et-pb-options-tabs-links-active")&&(t=void 0!==(o=$.findWhere({cid:i})).attributes.module_order?o.attributes.module_order:"",a.length&&a.replaceWith(t))}),P.length&&P.focusin(function(){var t=e(this).closest(".et-pb-option"),i=t.find("label > span"),o=t.siblings().find("label > span");i.length&&(i.removeClass("et_pb_hidden_css_selector"),i.css({display:"inline-block"}),i.addClass("et_pb_visible_css_selector")),o.length&&(o.removeClass("et_pb_visible_css_selector"),o.addClass("et_pb_hidden_css_selector"),setTimeout(function(){o.css({display:"none"}),o.removeClass("et_pb_hidden_css_selector")},200))}),t.on("click",".et_pb_global_sync_switcher",function(){var t=e(this);t.hasClass("et_pb_global_unsynced")?t.removeClass("et_pb_global_unsynced"):t.addClass("et_pb_global_unsynced")}),new a.Controls.BorderRadius(t),new a.Controls.BorderStyles(t),new a.Controls.TabbedControl(t.find("#et_pb_divider_settings").parent()),t.on("click",".et-pb-option-container .description a",function(e){var t=e.target.href;_.isUndefined(t)||(e.preventDefault(),window.open(t,"_blank").focus())})}function be(e){e.data("default");var t=e.val(),i=e.closest(".et-pb-option-container"),o=""===t?[]:t.split("|");i.find(".et_builder_multiple_buttons_button").removeClass("et_builder_multiple_buttons_button_active"),o.length>0&&(_.forEach(o,function(e){var t=i.find(".et_builder_"+e+"_button");t.length>0&&t.addClass("et_builder_multiple_buttons_button_active")}),e.trigger("et_pb_setting:change"))}function ue(t,i){var o=t.find("input.et-pb-font-select"),n=o.val().split("|"),a=t.find(".et_builder_font_weight").val(),s=t.find(".et_builder_font_styles"),l=t.find(".et-pb-font-line-color-value"),d=t.find(".et_pb_font_line_style_select"),r=s.find(".et_builder_italic_font"),p=s.find(".et_builder_uppercase_font"),c=s.find(".et_builder_underline_font"),b=s.find(".et_builder_capitalize_font"),u=s.find(".et_builder_line_through_font"),g=_.isUndefined(i)?n[0]:i,h="";h+="default"!==g?e.trim(g):"",h+="|","400"!==a&&(h+=a),h+="|",r.hasClass("et_font_style_active")&&(h+="on"),h+="|",p.hasClass("et_font_style_active")&&(h+="on"),h+="|",c.hasClass("et_font_style_active")&&(h+="on"),h+="|",b.hasClass("et_font_style_active")&&(h+="on"),h+="|",u.hasClass("et_font_style_active")&&(h+="on"),h+="|",""!==l.val()&&(h+=l.val()),h+="|","solid"!==d.val()&&(h+=d.val()),o.val(h).trigger("change")}function ge(t){t.closest(".et-pb-option--font").find(".et_pb_select_placeholder");t.removeClass("et_pb_menu_active"),e("body").removeClass("et_pb_advanced_menu_opened")}function he(e,t,i){var o=parseFloat(e.attr("max")),n=parseFloat(e.attr("min"));e.hasClass("et-pb-fixed-range")||((t=""!==t?parseFloat(t):0)>o&&(e.attr("max",t),e.val(t)),t<n&&(e.attr("min",t),e.val(t)),i&&"0.1"!==e.attr("step")&&t%1>0&&(e.attr("step","0.1"),e.val(t)))}function fe(e,t){var i,o=e.parent().find(".et-pb-range"),n=e.val(),a="string"==typeof n?n.trim():n,s=parseFloat(a),l=a.toString().replace(s,""),_=o.data("default");if(isNaN(s)&&(s=""),o.hasClass("et-pb-fixed-range")){var d=parseFloat(o.attr("max")),r=parseFloat(o.attr("min")),p=s<r;s>d?s=d:p&&(s=r)}return i=s.toString()+l||_,t&&i!==n&&e.val(i),i}function me(t){return e(t).hasClass("et-pb-color-picker-hex")?"default-color":"default"}function ve(e){var t,i=me(e);if(t=void 0!==e.data(i)?e.data(i):"",_.isArray(t)&&t.length>0){var o=e.closest(".et-pb-options-toggle-container").find("#et_pb_"+t[0]);t=(t[1]||{})[""+o.val()]}return t+=""}function we(e){var t=ve(e).toLowerCase(),i=_.isUndefined(a.Helpers.getSettingValue(e))?"":a.Helpers.getSettingValue(e).toString().toLowerCase(),o=e.hasClass("et-pb-range");return void 0===i||""===String(i)||(!(!e.is("select")||""!==t||0!==e.prop("selectedIndex"))||!(!_.isNull(i)&&i!==t&&!o||o&&i!==t+"px"&&i!==t))}function ye(e){var t=e.closest(".et_pb_background-tab--gradient"),i=t.closest(".et-pb-option-container-inner").attr("data-base_name"),o=ke(t,i),n=t.find(".et-pb-option-preview");o?n.css({backgroundImage:o}):n.removeAttr("style")}function ke(e,t){var i="background"===(t=t||"background")?"use_background_color_gradient":t+"_use_color_gradient",o=e.find(".et_pb_background-option--"+i+" select"),n=e.find(".et_pb_background-option--"+t+"_color_gradient_start .et-pb-color-picker-hex"),a=e.find(".et_pb_background-option--"+t+"_color_gradient_end .et-pb-color-picker-hex"),s=e.find(".et_pb_background-option--"+t+"_color_gradient_type select"),l=e.find(".et_pb_background-option--"+t+"_color_gradient_direction .et-pb-range-input"),d=e.find(".et_pb_background-option--"+t+"_color_gradient_direction_radial select"),r=e.find(".et_pb_background-option--"+t+"_color_gradient_start_position .et-pb-range-input"),p=e.find(".et_pb_background-option--"+t+"_color_gradient_end_position .et-pb-range-input");if("on"!==o.val())return!1;var c={type:"linear",direction:"180deg",radialDirection:"center",colorStart:"#2b87da",colorEnd:"#29c4a9",startPosition:"0%",endPosition:"100%"};_.each({type:s.val(),direction:l.val(),radialDirection:d.val(),colorStart:n.val(),colorEnd:a.val(),startPosition:r.val(),endPosition:p.val()},function(e,t){""===e||_.isUndefined(e)||(c[t]=e)});var b="linear"===c.type?c.direction:"circle at "+c.radialDirection,u=Se(c.startPosition,void 0,"%"),g=Se(c.endPosition,void 0,"%");return c.type+"-gradient( "+b+", "+c.colorStart+" "+u+", "+c.colorEnd+" "+g+" )"}function Ce(e){var t=e,i=t.closest(".et-pb-option-container"),o=i.closest(".et-pb-option"),n=void 0!==t.data("device")&&o.hasClass("et_pb_has_mobile_settings")?t.data("device"):"all",a="all"===n?i.find(".et-pb-main-setting"):i.find(".et-pb-main-setting.et_pb_setting_mobile_"+n),s=ve(a);if(a.is(".et-pb-text-align-select"))return s?i.find(".et_builder_"+s+"_text_align").addClass("et_text_align_active").siblings().removeClass("et_text_align_active"):i.find(".et_text_align_active").removeClass("et_text_align_active"),a.val(s).trigger("change").trigger("et_pb_setting:change"),t.hasClass("et-pb-reset-setting")||(t=i.find(".et-pb-reset-setting")),void t.removeClass("et-pb-reset-icon-visible");if(a.is("select")&&""===s)a.prop("selectedIndex",0).trigger("change");else if(a.hasClass("et-pb-custom-color-picker"))!function(e){var t=e.closest(".et-pb-custom-color-container"),i=t.siblings(".et-pb-choose-custom-color-button"),o=t.find(".et-pb-custom-color-picker");i.removeClass("et_pb_hidden"),t.addClass("et_pb_hidden"),o.val("")}(t);else{if(a.hasClass("et-pb-color-picker-hex"))return a.wpColorPicker("color",s),""===s&&i.find(".wp-picker-clear").trigger("click"),t.hasClass("et-pb-reset-setting")||(t=i.find(".et-pb-reset-setting")),void t.removeClass("et-pb-reset-icon-visible");if(a.hasClass("et-pb-font-select"))je(i,t.hasClass("et_pb_reset_weight")?"weight":"font");else a.hasClass("et-pb-range")&&(s=ve(a="all"===n?t.siblings(".et-pb-range-input"):t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+n))),a.val(s).trigger("et_pb_setting:change",["et_pb_reset_setting"]),a.data("has_saved_value","no"),a.hasClass("et_custom_margin_main")?a.trigger("et_main_custom_margin:change"):a.trigger("change"),a.hasClass("et_select_animation")&&(a.find(".et_animation_button > a.et_active_animation").removeClass("et_active_animation"),a.find(".et_animation_button:first > a").addClass("et_active_animation")),a.hasClass("et-presets")&&a.find(".et-preset").removeClass("et-preset-active").first().addClass("et-preset-active")}}function Se(t,i,o,n){var a,s="!important".length,l=!1,d=(t=void 0===t?"":t).length;i=!_.isUndefined(i)&&i;if(""===t)return"";if("!important"===t.substr(0-s,s)&&(l=!0,d-=s,t=t.substr(0,d).trim()),!_.isUndefined(n)&&function(e,t){var i=et_pb_options.acceptable_css_string_values;return!_.isUndefined(i[e])&&_.contains(i[e],t)}(n,t))return r=t,l&&!i&&(r+=" !important"),r;if(-1!==e.inArray(t.substr(-3,3),["deg","rem"])){var r=parseFloat(t)+t.substr(-3,3);return l&&!i&&(r+=" !important"),r}if(-1!==e.inArray(t.substr(-2,2),["em","px","cm","mm","in","pt","pc","ex","vh","vw","ms"])){r=parseFloat(t)+t.substr(-2,2);return l&&!i&&(r+=" !important"),r}return-1!==e.inArray(t.substr(-1,1),["%","x"])?(r=parseFloat(t)+t.substr(-1,1),l&&!i&&(r+=" !important"),r):isNaN(parseFloat(t))?t:(a=parseFloat(t),(_.isUndefined(o)||"no_default_unit"!==o)&&(a+=o||"px"),a)}function xe(t){var i,o=t,n=void 0!==o.data("device")?o.data("device"):"all",a=o.val(),s=o.closest(".et_margin_padding"),l=s.closest(".et-pb-option-container").find(".et-pb-mobile-settings-toggle"),_="all"===n?s.find(".et_custom_margin"):s.find(".et_custom_margin.et_pb_setting_mobile_"+n),d=!1;de(t),""!==a?(i=a.split("|"),_.length>i.length&&(i.splice(1,0,""),i.push("")),_.each(function(){var t=e(this),o=_.index(t),n=t.hasClass("auto_important"),a=t.closest(".et-pb-option").data("option_name"),s=Se(i[o],n,void 0,{custom_padding:"padding",custom_margin:"margin"}[a]);t.val(s).trigger("et_pb_setting:change"),""!==s&&(d=!0)}),d&&l.addClass("et-pb-mobile-icon-visible")):_.each(function(){e(this).val("")})}function je(t,i,o){var n,a=t.closest(".et-pb-options-tab"),s=t.find(".et-pb-select-font-outer"),l=t.find("input.et-pb-font-select"),d=t.find(".et-pb-settings-option-select-advanced"),r=t.find(".et_builder_font_styles"),p=t.find(".et_pb_select_placeholder"),c=t.find(".et_builder_font_weight"),b=t.find(".et_pb_font_line_color"),u=t.find(".et_pb_font_line_style_select"),g=t.find(".et_pb_font_style_container"),h=r.find(".et_builder_italic_font"),f=r.find(".et_builder_uppercase_font"),m=r.find(".et_builder_underline_font"),v=r.find(".et_builder_capitalize_font"),w=r.find(".et_builder_line_through_font"),y="et_font_style_active",k=e.trim(l.val()),C=_.isUndefined(l.data("default"))?"||||||||":l.data("default"),S=void 0!==l.data("old-option-ref")&&""!==l.data("old-option-ref")?l.data("old-option-ref"):"",x=""!==S?a.find(".et-pb-option-"+S):"",j=""!==x&&x.length?x.find("input"):"",$="default",V=function(e){var t=wpCookies.get("et-pb-recent-items-font_family");if(t=_.isUndefined(t)||_.isNull(t)?[]:t.split("|"),_.isEmpty(t))return[];var i=[];return _.each(t,function(t){e.find(".select-option-item-"+t.replace(/ /g,"_")).length>0&&i.push(t)}),i}(d),T="400",U=!1,O=!1;if(i){var A=C.split("|");n=""===k.replace(/\|/g,"")?A:k.split("|"),"weight"===i?n[1]=A[1]:n[0]=A[0],k=n.join("|")}if(o){var M=t.find(".et_pb_font_weight_container"),L=g.find("label"),E=M.find("label"),D=s.data("group_label");""===k.replace(/\|/g,"")&&(k=C),L.html(D+" "+L.html()),E.html(D+" "+E.html());var I=t.find(".et-pb-reset-setting"),P=I.clone();s.append(I.addClass("et_pb_reset_font")),M.append(P.addClass("et_pb_reset_weight"))}if(""!==k?($=""!==(n=k.split("|"))[0]?n[0]:"default",p.html(_.escape($)),""!==n[1]&&(T="on"===n[1]?"700":n[1]),"on"===n[2]?h.addClass(y):h.removeClass(y),"on"===n[3]?f.addClass(y):f.removeClass(y),"on"===n[4]?(m.addClass(y),U=!0):m.removeClass(y),_.isUndefined(n[5])||"on"!==n[5]?v.removeClass(y):v.addClass(y),_.isUndefined(n[6])||"on"!==n[6]?w.removeClass(y):(w.addClass(y),O=!0),_.isUndefined(n[7])||""===n[7]||(b.find(".et-pb-custom-color-container").removeClass("et_pb_hidden"),b.find(".et-pb-custom-color-button").addClass("et_pb_hidden"),b.find(".et-pb-color-picker-hex-alpha").wpColorPicker("color",n[7])),_.isUndefined(n[8])||""===n[8]||u.val(n[8])):(p.html(_.escape($)),h.removeClass(y),f.removeClass(y),m.removeClass(y),v.removeClass(y),w.removeClass(y)),U||O){var R=s.data("group_label");t.find(".et_pb_font_line_settings .et_pb_font_line_color > label").each(function(){var t=e(this),i=U?t.data("underline_label"):t.data("strikethrough_label");t.html(R+" "+i)}),t.find(".et_pb_font_line_settings").removeClass("et_pb_hidden"),t.find(".et-pb-option-container").addClass("et_pb_fonts_long")}else t.find(".et_pb_font_line_settings").addClass("et_pb_hidden"),t.find(".et-pb-option-container").removeClass("et_pb_fonts_long");var N=function(e){var t=et_pb_options.google_fonts,i=et_pb_options.user_fonts,o=!_.isUndefined(i[e])&&i[e],n=_.keys(et_pb_options.supported_font_weights);if("default"===e.toLowerCase())return["300","400","600","700","800"];o||(o=!_.isUndefined(t[e])&&t[e]);if(!o||_.isUndefined(o.styles))return n;return _.intersection(_.union(["400","700"],o.styles.split(",")),n)}($);c.find("option").removeClass("et_pb_unsupported_option"),c.find("option").each(function(){var t=e(this);-1===_.indexOf(N,t.val())&&(t.addClass("et_pb_unsupported_option"),T===t.val()&&(T="400"))}),c.find('option[value="'+T+'"]').prop("selected",!0);var H=d.find(".select-option-item-"+$.replace(/ /g,"_"));d.find(".et_pb_selected_menu_item").removeClass("et_pb_selected_menu_item"),H.addClass("et_pb_selected_menu_item"),d.find(".et_pb_selected_item_container").html(_.escape(H.text())),_.isEmpty(V)?d.find(".et-pb-recent-fonts").addClass("et_pb_hidden_subgroup"):(d.find(".et-pb-recent-fonts").removeClass("et_pb_hidden_subgroup"),d.find(".et-pb-recent-fonts ul").html(""),_.each(V,function(e){var t='<li class="select-option-item select-option-item-recent-font select-option-item-'+e.replace(/ /g,"_")+'" data-value="'+e+'">'+e+"</li>";d.find(".et-pb-recent-fonts ul").append(t)})),j.length&&""!==j.val()&&("on"!==n[3]&&"on"===j.val()&&(f.addClass(y),n[3]="on",l.val(n.join("|")).trigger("change")),j.val("")),i&&l.val(n.join("|")).trigger("et_pb_setting:change")}function $e(e,t){if("default"!==e){var i=wpCookies.get("et-pb-recent-items-font_family");if(i=_.isUndefined(i)||_.isNull(i)?[]:i.split("|"),"remove"===t){if(-1===_.indexOf(i,e))return;delete i[e]}else{if(-1!==_.indexOf(i,e))return;i.length>=3&&(i=i.slice(0,2)),i=_.union([e],i)}var o="https:"===window.location.protocol;wpCookies.set("et-pb-recent-items-font_family",i.join("|"),31536e6,et_pb_options.cookie_path,!1,o)}}function Ve(t){t.$(".et-pb-color-picker-hex:visible").each(function(){e(this).closest(".wp-picker-container").find(".wp-color-result").trigger("click")})}function Te(){et_pb_options.debug&&window.console&&(2===arguments.length?console.log(arguments[0],arguments[1]):console.log(arguments[0]))}function Ue(t,i){T.saveAsShortcode(),setTimeout(function(){var o=e("#et_pb_layout"),n=o.innerHeight();o.css({height:n});var a=ee("content",!0);if(T.removeAllSections(),T.$el.find(".et_pb_section").remove(),T.createLayoutFromContent(Oe(a),"","",{is_reinit:"reinit",migrate_global_modules:i}),o.css({height:"auto"}),J.update(),t){var s=_.filter($.models,function(e){return"module"!==e.attributes.type&&void 0!==e.attributes.et_pb_global_module&&""!==e.attributes.et_pb_global_module});0!==s.length&&_.each(s,function(e){Ie(e.attributes.cid)})}},600)}function Oe(e){if(-1!==e.indexOf("[et_pb_")||"1"===et_pb_options.is_divi_library&&"module"===et_pb_options.layout_type)if(-1===e.indexOf("et_pb_row")&&-1===e.indexOf("et_pb_section")){var t=-1===e.indexOf("et_pb_fullwidth")?"regular":"fullwidth";-1===e.indexOf("et_pb_fullwidth_module_placeholder")&&-1===e.indexOf("et_pb_module_placeholder")||(e=""),e="regular"===t?'[et_pb_section template_type="module" skip_module="true"][et_pb_row template_type="module" skip_module="true"][et_pb_column type="4_4"]'+e+"[/et_pb_column][/et_pb_row][/et_pb_section]":'[et_pb_section fullwidth="on" template_type="module" skip_module="true"]'+e+"[/et_pb_section]"}else-1===e.indexOf("et_pb_section")&&(e='[et_pb_section template_type="row" skip_module="true"]'+e+"[/et_pb_section]");return e}function Ae(t,i,o,n,s,l,_,d){if(void 0!==H[o+"_"+(i=""===i?"not_global":i)+"_"+s+"_"+l]){var r=new a.SavedTemplates(H[o+"_"+i+"_"+s+"_"+l]),p=new a.TemplatesView({collection:r,category:_});n.append(p.render().el),"include_global"===t&&"not_global"===i?Ae("include_global","global",o,n,s,l,_):(y.trigger("et-pb-loading:ended"),n.prepend(Me(_)),e("#et_pb_select_category").data("attr",{include_global:t,is_global:"",layout_type:o,append_to:n,module_width:s,specialty_cols:l}))}else e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_saved_templates",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_is_global:i,et_post_type:et_pb_options.post_type,et_layout_type:o,et_module_width:s,et_specialty_columns:l},beforeSend:function(){y.trigger("et-pb-loading:started")},complete:function(){("include_global"!==t||"include_global"===t&&"global"===i)&&(y.trigger("et-pb-loading:ended"),n.prepend(Me(_)),e("#et_pb_select_category").data("attr",{include_global:t,is_global:"",layout_type:o,append_to:n,module_width:s,specialty_cols:l}))},success:function(e){var r="";if(void 0!==e.error)("include_global"===t&&"global"===i&&"success"!==d||"include_global"!==t)&&(n.append("<ul><li>"+e.error+"</li></ul>"),r="fail");else{var p=new a.SavedTemplates(e),c=new a.TemplatesView({collection:p});H[o+"_"+i+"_"+s+"_"+l]=e,n.append(c.render().el),r="success"}"include_global"===t&&"not_global"===i&&Ae("include_global","global",o,n,s,l,_,r)}})}function Me(t){var i=e.parseJSON(et_pb_options.layout_categories),o='<select id="et_pb_select_category">',n="all"===t||""===t?" selected":"";return o+='<option value="all"'+n+">"+et_pb_options.all_cat_text+"</option>",e.isEmptyObject(i)||e.each(i,function(i,a){e.isEmptyObject(a)||(n=t===a.slug?" selected":"",o+='<option value="'+a.slug+'"'+n+">"+a.name+"</option>")}),o+="</select>"}function Le(t,i,o,n,a){void 0===H[t+"_layouts"]||a?e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_show_all_layouts",et_layouts_built_for_post_type:n,et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_load_layouts_type:t},beforeSend:function(){a||y.trigger("et-pb-loading:started")},complete:function(){a||y.trigger("et-pb-loading:ended")},success:function(e){a||o.find(".et-pb-main-settings."+i).append(e),H[t+"_layouts"]=e}}):o.find(".et-pb-main-settings."+i).append(H[t+"_layouts"])}function Ee(t,i,o){if(!t.hasClass("et-pb-options-tabs-links-active")){var n=void 0!==t.closest(".et-pb-options-tabs-links").data("specialty_columns")?t.closest(".et-pb-options-tabs-links").data("specialty_columns"):0;e(".et-pb-options-tabs-links li").removeClass("et-pb-options-tabs-links-active"),t.addClass("et-pb-options-tabs-links-active"),e(".et-pb-main-settings.active-container").css({display:"block",opacity:1}).stop(!0,!0).animate({opacity:0},300,function(){e(this).css("display","none"),e(this).removeClass("active-container"),e("."+t.data("open_tab")).addClass("active-container").css({display:"block",opacity:0}).stop(!0,!0).animate({opacity:1},300)}),void 0!==t.data("content_loaded")||t.hasClass("et-pb-new-module")||"layout"===i||(Ae("include_global","",i,e("."+t.data("open_tab")),o,n,"all"),t.data("content_loaded","true"))}}function De(t,i){var o=et_pb_options.template_post_id;e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_add_template_meta",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_meta_value:i,et_custom_field:t,et_post_id:o}})}function Ie(t){var i=j.getView(t),o=i.model.get("et_pb_global_module"),n=i.model.get("type"),a="row_inner"===n?"row":n,s=T.generateCompleteShortcode(t,a,"ignore_global",!1,!0),l=_.isEmpty(g[o])?[]:g[o];void 0!==o&&""!==o&&("row_inner"===n&&(s=(s=s.replace(/et_pb_row_inner/g,"et_pb_row")).replace(/et_pb_column_inner/g,"et_pb_column")),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_update_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_content:s,et_template_post_id:o,et_layout_type:n,et_unsynced_options:JSON.stringify(l)}}))}function Pe(e){for(var t=e,i="";!_.isUndefined(t.model.get("parent"))&&""===i;)t=j.getView(t.model.get("parent")),i=""!==i||_.isUndefined(t.model.get("et_pb_global_module"))?i:t.model.get("cid");return i}function Re(){var t=e(".et_pb_modal_settings_container");t.find(".et-pb-options-tabs .et-pb-options-tab:first-child").css({display:"block",opacity:1}),e(".et_pb_modal_settings_container").hasClass("et_pb_hide_general_tab")?(t.find(".et-pb-options-tabs-links li").removeClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab").css({display:"none",opacity:0}),t.hasClass("et_pb_hide_advanced_tab")?(t.find(".et-pb-options-tabs-links li.et_pb_options_tab_custom_css").addClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-custom_css").css({display:"block",opacity:1})):(t.find(".et-pb-options-tabs-links li.et_pb_options_tab_advanced").addClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-advanced").css({display:"block",opacity:1}))):t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-general").css({display:"block",opacity:1}),function(t){t.find(".et-pb-options-tab:visible").each(function(){var t=e(this);t.find(".et-pb-option:visible").length||t.append('<p class="et-pb-all-options-hidden">'+et_pb_options.all_tab_options_hidden+"<p>")})}(t)}function Ne(){return e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_current_user_can_lock",et_admin_load_nonce:et_pb_options.et_admin_load_nonce},beforeSend:function(){y.trigger("et-pb-loading:started")},complete:function(){y.trigger("et-pb-loading:ended")}})}function He(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}function Be(){return"object"===("undefined"==typeof YoastSEO?"undefined":n(YoastSEO))&&YoastSEO.hasOwnProperty("app")}function ze(){return 0<e(".et_pb_modal_overlay, .et-core-modal-overlay.et-core-active").length}function Fe(e){var t=!j.is_global_children(e),i=!!et_pb_options.et_builder_edit_global_library;return t||i}function We(e){if(_.isEmpty(e)||ze())return!1;var t={model:e.model,view:e.$el,view_event:event};return new a.RightClickOptionsView(t,!0)}function Je(t,i){if(0!==t.length){var o=t.find(".et-pb-option");if(t.find(".et-pb-option-advanced-module-settings").length>0){var n=Ke("et_pb_content_field",i)?" et_pb_global_unsynced":"";t.find(".et-pb-option-advanced-module-settings").append('<span class="et_pb_global_sync_switcher'+n+'" data-option_name="et_pb_content_field" data-additional_options="none"></span>')}0!==o.length&&_.each(o,function(t){var o=_.includes(["content","raw_content"],e(t).data("option_name"))?"et_pb_content_field":e(t).data("option_name"),n=Ke(o,i)?" et_pb_global_unsynced":"",a=0!==e(t).find(".et_pb_mobile_settings_tabs").length?"mobile":"none";e(t).append('<span class="et_pb_global_sync_switcher'+n+'" data-option_name="'+o+'" data-additional_options="'+a+'"></span>')})}}function Ke(e,t){return"legacy"===(_.isUndefined(g[t])?"legacy":"updated")?-1===h[t].indexOf(e):-1!==g[t].indexOf(e)}function Ge(e){var t=e.closest(".et-pb-option-container--background"),i=e.closest(".et_pb_background-option").attr("data-option_name"),o=e.closest(".et_pb_module_settings").attr("data-module_type"),n=t.closest(".et-pb-options-tabs").find("#et_pb_featured_placement").val();return _.contains(et_pb_options.et_builder_modules_featured_image_background,o)&&"background_image"===i&&"background"===n}function qe(e){return e=(e=(e=(e=e.replace(/<p>\[/g,"[")).replace(/\]<\/p>/g,"]")).replace(/\]<br \/>/g,"]")).replace(/<br \/>\n\[/g,"[")}O.remove(),M.hasClass("et_pb_builder_is_used")&&(L.show(),Q()),A.click(function(t){t.preventDefault();var i,o=e(this),n=o.hasClass("et_pb_builder_is_used"),a=e("#et_pb_fb_cta");if(n)G("deactivate_builder");else{i=ee("content"),E.val(i);var s=getUserSetting("editor");"html"!==s&&(e("#content-html").click(),setUserSetting("editor",s)),T.reInitialize(),I.val("on"),L.show(),o.text(o.data("editor")),P.toggleClass("et_pb_post_body_hidden"),o.toggleClass("et_pb_builder_is_used"),y.trigger("et-activate-builder"),Q(),a.addClass("et_pb_ready"),e("form#post").append('<input type="hidden" name="et_pb_show_page_creation" value="on" />')}}),e("#et_pb_fb_cta").click(function(t){t.preventDefault(),e("html").fadeOut(),e("form#post").append('<input type="hidden" name="et-fb-builder-redirect" value="'+e(this).attr("href")+'" />'),A.hasClass("et_pb_builder_is_used")||(E.val(ee("content")),T.reInitialize(),I.val("on")),e(window).off("beforeunload").delay(500).queue(function(){var t=e("#save-action #save-post");0===t.length&&(t=e("#publishing-action #publish")),t.trigger("click")})}).contextmenu(function(){e.ajax({type:"POST",url:e("#post").attr("action"),data:e("#post").serializeArray()})}),function(){var t,i,o,a,s,l,d,r,p,c,b,u=e("#et_pb_last_post_modified"),g=u.val(),h=e("#post_ID").val(),f=void 0!==window.autosaveL10n&&window.autosaveL10n.blog_id,m=!1,v=!0,w=!1,k="https:"===window.location.protocol,C=wpCookies.get("wp-saving-post"),S=!1;!function(){var e=Math.random().toString(),t=!1;try{window.sessionStorage.setItem("wp-test",e),t=window.sessionStorage.getItem("wp-test")===e,window.sessionStorage.removeItem("wp-test")}catch(e){}c=t}();var x=function(e,t){var i=function(e){var t=!1;return e=e||"wp",c&&f&&(t=(t=sessionStorage.getItem(e+"-autosave-"+f))?JSON.parse(t):{}),t}(t);if(!i||!h)return!1;if(e)i["post_"+h]=e;else{if(!i.hasOwnProperty("post_"+h))return!1;delete i["post_"+h]}return function(e,t){var i;return t=t||"wp",!(!c||!f)&&(i=t+"-autosave-"+f,sessionStorage.setItem(i,JSON.stringify(e)),null!==sessionStorage.getItem(i))}(i,t)};function j(){wpCookies.get("et-saved-post-"+h+"-fb")&&(x(!1,"wp"),wpCookies.get("et-editing-post-"+h+"-fb")||wpCookies.remove("et-saved-post-"+h+"-fb",et_pb_options.cookie_path,!1,k))}C===h+"-saved"&&(wpCookies.set("et-saved-post-"+h+"-bb","bb",300,et_pb_options.cookie_path,!1,k),wpCookies.set("et-recommend-sync-post-"+h+"-bb","bb",30,et_pb_options.cookie_path,!1,k)),wpCookies.set("et-editor-available-post-"+h+"-bb","bb",1800,et_pb_options.cookie_path,!1,k),j(),i=function(){return"on"===e("#et_pb_use_builder").val()},b=function(e){e?(wpCookies.remove("et-saved-post-"+h+"-bb",et_pb_options.cookie_path,!1,k),wpCookies.set("et-saving-post-"+h+"-bb","bb",300,et_pb_options.cookie_path,!1,k)):(wpCookies.remove("et-saving-post-"+h+"-bb",et_pb_options.cookie_path,!1,k),wpCookies.set("et-saved-post-"+h+"-bb","bb",300,et_pb_options.cookie_path,!1,k))};var $,V=_.isUndefined(wp.autosave)?"":wp.autosave.getCompareString();l=function(){if(i()&&(v=!1,wpCookies.get("et-editing-post-"+h+"-bb"))){if(!function(){if(_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave))return!1;var e=wp.autosave.getPostData("local"),t=wp.autosave.getCompareString(e);return void 0===$&&($=V),t!==$&&($=t,!0)}())return!1;setTimeout(function(){S||(w=!0,b(!0),_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave)||wp.autosave.server.triggerSave())},0)}},d=function(){if(!i())return!1;var t=e("#post_ID").val(),o="https:"===window.location.protocol;if(v=!0,!wpCookies.get("et-editing-post-"+t+"-fb"))return!1;if(_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave))return!1;var n=0;if(!function e(){var i=wpCookies.get("et-syncing-post-"+t+"-fb"),o=wpCookies.get("et-syncing-post-"+t+"-bb");return n>=5||!i&&!o?(y.trigger("et-pb-loading:ended"),!1):(y.trigger("et-pb-loading:started"),n++,setTimeout(e,1e3),!0)}()){wpCookies.set("et-syncing-post-"+t+"-bb","bb",30,et_pb_options.cookie_path,!1,o),Te("external editor was in use!"),Te("trigger preloader"),y.trigger("et-pb-loading:started"),wp.autosave.server.tempBlockSave();var a=0;!function e(){var i=!1;if(wpCookies.get("et-saved-post-"+t+"-fb")&&(i=!0),a>30&&(i=!0),a++,!_.isUndefined(wp.heartbeat)&&!_.isUndefined(wp.autosave)){if(wp.autosave.server.tempBlockSave(),y.trigger("et-pb-loading:started"),i)return Te("calling wp.heartbeat.connectNow()"),m=!0,j(),setTimeout(function(){wp.heartbeat.connectNow()},500),wpCookies.remove("et-saving-post-"+t+"-fb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-saved-post-"+t+"-fb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-syncing-post-"+t+"-bb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-editing-post-"+t+"-fb",et_pb_options.cookie_path,!1,o),!0;setTimeout(e,500)}}()}},p=function(){v&&!document.hasFocus()?l():!v&&document.hasFocus()&&d()},void 0!==document.hidden?(o="hidden",s="visibilitychange",a="visibilityState"):void 0!==document.msHidden?(o="msHidden",s="msvisibilitychange",a="msVisibilityState"):void 0!==document.webkitHidden&&(o="webkitHidden",s="webkitvisibilitychange",a="webkitVisibilityState"),window.addEventListener("beforeunload",function(e){S=!0,wpCookies.remove("et-editing-post-"+h+"-bb",et_pb_options.cookie_path,!1,k),wpCookies.remove("et-syncing-post-"+h+"-bb",et_pb_options.cookie_path,!1,k),wpCookies.remove("et-saving-post-"+h+"-bb",et_pb_options.cookie_path,!1,k),wpCookies.remove("et-editor-available-post-"+h+"-bb",et_pb_options.cookie_path,!1,k)}),o&&e(document).on(s+".fb-heartbeat",function(e){i()&&("hidden"===document[a]?(l(),window.clearInterval(r)):(d(),document.hasFocus&&(r=window.setInterval(p,1e3))))}),document.hasFocus&&(r=window.setInterval(p,1e3)),d(),setInterval(function(){var e=wpCookies.get("et-recommend-sync-post-"+h+"-fb"),t=wpCookies.get("et-saved-post-"+h+"-fb");e&&t&&(_.isUndefined(wp.heartbeat)||wp.heartbeat.connectNow(),wpCookies.remove("et-recommend-sync-post-"+h+"-fb",et_pb_options.cookie_path,!1,k))},3e3),e(document).on("heartbeat-send.bb-heartbeat",function(t,o){i()&&(o.et={last_post_modified:g,built_by:"bb",post_id:h,force_check:m,force_autosave:!m&&w},m=!1,w&&void 0===o.wp_autosave&&(o.wp_autosave=wp.autosave.getPostData(),o.wp_autosave.content=ee("content"),o.wp_autosave._wpnonce=e("#_wpnonce").val()||""),"object"===n(o.wp_autosave)&&(o.wp_autosave.builder_settings=_.mapObject(_.indexBy(e(".et_pb_page_settings input.et_pb_value_updated").serializeArray(),"name"),function(e,t){return e.value}),o.wp_autosave.et_fb_autosave_nonce=et_pb_options.et_fb_autosave_nonce,e(".et_pb_page_settings input.et_pb_value_updated").removeClass("et_pb_value_updated")),w&&void 0!==o.wp_autosave&&(w=!1))}),e(document).on("heartbeat-tick.bb-heartbeat",function(o,n){if(i()){if(!_.isEmpty(n.et)&&!_.isEmpty(n.et.builder_settings_autosave)){var a=e(".et_pb_modal_overlay.et_pb_builder_settings").length;_.each(n.et.builder_settings_autosave,function(t,i){if(e("#_"+i).val(t),"et_pb_section_background_color"===i&&(et_pb_options.page_section_bg_color=t),"et_pb_page_gutter_width"===i&&(et_pb_options.page_gutter_width=t),"et_pb_color_palette"===i&&(et_pb_options.page_color_palette=t),a){var o=e('.et_pb_modal_overlay.et_pb_builder_settings div[data-id="'+i+'"]');switch(o.attr("data-type")){case"range":o.find(".range, .et-pb-range-input").val(t);break;case"color-alpha":o.find(".input-colorpicker").wpColorPicker("color",t);break;case"textarea":o.find("textarea").val(t);break;case"colorpalette":var n=t.split("|");o.find(".input-colorpalette-colorpicker").each(function(t,i){if(!_.isUndefined(n[t])){var a=n[t];e(i).val(a).wpColorPicker("color",a),o.find(".colorpalette-item-"+(t+1)).css({backgroundColor:a})}});break;case"yes_no_button":o.find(".et_pb_yes_no_button_wrapper");var s=o.find(".et_pb_yes_no_button");o.find("select").find('option[value="'+t+'"]').prop("selected",!0),"on"===t?s.removeClass("et_pb_off_state").addClass("et_pb_on_state"):s.removeClass("et_pb_on_state").addClass("et_pb_off_state");break;default:o.find("input").val(t)}}})}if(n.wp_autosave&&b(!1),void 0===n.et)return!1;if(void 0!==n.et.post_modified&&(g=n.et.post_modified),void 0!==n.et.post_content){Te("ext changes occured"),t=n.et.post_content;var s=e(".et_pb_modal_settings_container");s.length&&"module_settings"===s.attr("data-open_view")&&s.find(".et-pb-modal-close").trigger("click"),U()}else y.trigger("et-pb-loading:ended")}});var U=function(){if(u.val(g),i()&&""!=t){y.trigger("et-pb-loading:started");var o=t;ae("content",o,"updating_to_latest_fb_content"),setTimeout(function(){var t=e("#et_pb_layout"),i=t.innerHeight();t.css({height:i}),T.removeAllSections(),T.$el.find(".et_pb_section").remove(),T.enable_history=!1,T.createLayoutFromContent(Oe(o),"","",{is_reinit:"reinit"}),J.is_active_based_on_models()?(J.toggle_status(!0),Ue()):J.toggle_status(!1),t.css({height:"auto"}),y.trigger("et-pb-loading:ended"),setTimeout(function(){wpCookies.remove("et-editing-post-"+h+"-bb",et_pb_options.cookie_path,!1,k)},500)},500)}}}(),e(document).on("tinymce-editor-init.autosave",function(t,i){"content"===i.id&&e(document).off("tinymce-editor-init.autosave")});var Ye={key:"et_pb_clipboard_",set:function(e,t){He()?(localStorage.setItem(this.key+"type",LZString.compressToUTF16(e)),localStorage.setItem(this.key+"content",LZString.compressToUTF16(t))):alert(et_pb_options.localstorage_unavailability_alert)},get:function(e){if(He()){var t=LZString.decompressFromUTF16(localStorage.getItem(this.key+"type")),i=LZString.decompressFromUTF16(localStorage.getItem(this.key+"content"));return(void 0===e||e===t)&&i}alert(et_pb_options.localstorage_unavailability_alert)}},Ze=_.debounce(Ue,2e3);if(e(window).keydown(function(i){if("on"===e("#et_pb_use_builder").val()){if(ze()||e(".et_pb_prompt_modal").is(":visible")){var o=e(".et-pb-modal-save"),n=e(".et_pb_prompt_proceed"),s=e("#et_pb_main_container a, #et_pb_toggle_builder");switch(i.which){case 13:if(e(".et-pb-option-container textarea, #et_pb_address, #et_pb_pin_address, .et-pb-color-picker-hex-has-preview").is(":focus"))return void e(".et-pb-color-picker-hex-has-preview:focus").wpColorPicker("close");s.blur(),(o.length||n.length)&&(n.length?n.click():void 0!==o[1]?o[1].click():o.click());break;case 27:I()}}if(83===i.keyCode&&i.metaKey&&i.shiftKey&&!i.altKey||83===i.keyCode&&i.ctrlKey&&i.shiftKey&&!i.altKey)return i.preventDefault(),I(),void e("#save-post").trigger("click");if(83===i.keyCode&&i.metaKey&&!i.altKey||83===i.keyCode&&i.ctrlKey&&!i.altKey)return i.preventDefault(),I(),void t("#publish").trigger("click");var l=e(i.target);if(_.isUndefined(l)||!(l.is("input, textarea")||l.attr("contenteditable")||l.hasClass("et_disable_single_key_shortcuts"))){if(90===i.keyCode&&i.metaKey&&i.shiftKey&&!i.altKey||90===i.keyCode&&i.ctrlKey&&i.shiftKey&&!i.altKey)return i.preventDefault(),T.redo(i),!1;if(90===i.keyCode&&i.metaKey&&!i.altKey||90===i.keyCode&&i.ctrlKey&&!i.altKey)return i.preventDefault(),T.undo(i),!1;if(79===i.keyCode){if(ze())return;i.preventDefault(),e(".et_pb_builder_settings").length||e("#et_pb_layout .et-pb-app-settings-button").trigger("click")}else if(80===i.keyCode){if(i.preventDefault(),i.metaKey||i.ctrlKey)return e(".et-pb-modal-preview-template").length&&e(".et-pb-modal-preview-template").trigger("click"),!1;if(ze())return;e("div[data-et-core-portability]").hasClass("et-core-active")||e("#et_pb_layout .et-pb-app-portability-button").trigger("click")}else if(72===i.keyCode){if(ze())return;i.preventDefault(),e("#et_pb_layout .et-pb-layout-buttons-history").trigger("click")}else if(9===i.keyCode&&i.shiftKey){if(e(".et-pb-options-tabs-links").length||e(".et-pb-preview-screensize-switcher").length){var d=!(!e(".et-pb-modal-preview-template").length||!e(".et-pb-modal-preview-template").hasClass("active")),r=e(d?".et-pb-preview-screensize-switcher":".et-pb-options-tabs-links").find("li"),p=r.length,c=r[0];r.each(function(t){var i=d?e(this).find("a"):e(this),o=d?"active":"et-pb-options-tabs-links-active";i.hasClass(o)&&t!==p-1&&(c=r[t+1])}),e(c).length&&e(c).find("a").trigger("click")}}else if(67===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;h.copy(i)}}else if(86===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u))(E=u.$el).hasClass("et-pb-column")||E.hasClass("et_pb_section_fullwidth")&&!Ye.get("et_pb_clipboard_section")&&!E.find(".et_pb_module_block").length?h.pasteColumn(i):h.pasteAfter(i)}else if(88===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;h.copy(i);var b=u.$el.hasClass("et_pb_module_block")?u.$el.find(".et-pb-remove"):u.$el.find("> .et-pb-controls .et-pb-remove");b.length&&(b.trigger("click"),u={},Ue())}}else if(68===i.keyCode){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;var g="disabled";void 0===h.model.attributes.et_pb_disabled||"on"!==h.model.attributes.et_pb_disabled?(h.model.attributes.et_pb_disabled="on",u.$el.addClass("et_pb_disabled")):(h.model.attributes.et_pb_disabled="off",u.$el.removeClass("et_pb_disabled"),g="enabled"),h.updateGlobalModule(),T.allowHistorySaving(g,h.history_noun),T.saveAsShortcode()}}else if(76===i.keyCode){var h;if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;void 0===h.model.attributes.et_pb_locked||"on"!==h.model.attributes.et_pb_locked?h.lock(i):h.unlockItem(i),Ue()}}else if(83===i.keyCode)i.preventDefault(),_.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.s=!0);else if(49!==i.keyCode&&50!==i.keyCode&&51!==i.keyCode||!f.s)if(82===i.keyCode)_.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.r=!0);else if(67!==i.keyCode||i.metaKey||i.ctrlKey)if(49!==i.keyCode&&50!==i.keyCode&&51!==i.keyCode&&52!==i.keyCode&&53!==i.keyCode&&54!==i.keyCode&&55!==i.keyCode&&56!==i.keyCode&&57!==i.keyCode&&48!==i.keyCode&&189!==i.keyCode||!f.r&&!f.c){if(49===i.keyCode||50===i.keyCode||51===i.keyCode||52===i.keyCode||53===i.keyCode||54===i.keyCode||55===i.keyCode||56===i.keyCode||57===i.keyCode||48===i.keyCode||189===i.keyCode){if(!e("ul.et-pb-column-layouts").length)return;var m=e("ul.et-pb-column-layouts li");k=0;switch(i.keyCode){case 49:k=0;break;case 50:k=1;break;case 51:k=2;break;case 52:k=3;break;case 53:k=4;break;case 54:k=5;break;case 55:k=6;break;case 56:k=7;break;case 57:k=8;break;case 48:k=9;break;case 189:k=10}m.length&&m[k]&&e(m[k]).trigger("click")}else if("?"===i.key||191===i.keyCode){var v="help"===e(".et_pb_modal_settings_container").attr("data-open_view");if(e(".et-pb-modal-close").length&&e(".et-pb-modal-close").click(),v)return;I();var w=new a.ModalView({attributes:{"data-open_view":"help"},view:this});e("body").append(w.render().el)}}else{var y=(E=u.$el).closest(".et_pb_row");if(y.length){var k="4_4";switch(i.keyCode){case 49:k="4_4";break;case 50:k="1_2,1_2";break;case 51:k="1_3,1_3,1_3";break;case 52:k="1_4,1_4,1_4,1_4";break;case 53:k="2_3,1_3";break;case 54:k="1_3,2_3";break;case 55:k="1_4,3_4";break;case 56:k="3_4,1_4";break;case 57:k="1_2,1_4,1_4";break;case 48:k="1_4,1_4,1_2";break;case 189:k="1_4,1_2,1_4"}var C=j.getView(y.find(".et-pb-row-content").data("cid"));if(void 0!==C){var S=!1,x=!1,$=j.getView(C.model.attributes.parent);if(void 0!==$&&"column"===$.model.attributes.type){var V=3===$.model.attributes.specialty_columns?[49,50,51]:[49,50];if(-1===e.inArray(i.keyCode,V))return}var U={};if(f.r){if("on"===C.model.get("et_pb_parent_locked"))return;if(J.is_active()&&!J.is_user_has_permission(C.model.get("cid"),"add_row"))return void J.alert("has_no_permission");T.allowHistorySaving("added","row"),x=!0;var O=j.generateNewId(),A=void 0!==C.model.get("et_pb_global_module")&&""!==C.model.get("et_pb_global_module")?C.model.get("et_pb_global_module"):"",M=""!==A?C.model.get("cid"):"";$.collection.add([{type:"row",module_type:"row",cid:O,parent:$.model.get("cid"),view:C,appendAfter:C.$el,et_pb_global_parent:A,global_parent_cid:M,admin_label:et_pb_options.noun.row}]),U=j.getView(O)}else{if(void 0!==C.model.attributes.et_pb_global_module&&""!==C.model.attributes.et_pb_global_module||"row"===et_pb_options.layout_type&&"global"===et_pb_options.is_global_template)return;U=C,S=!0}var L={layout:k,is_structure_change:S,layout_specialty:""};j.changeColumnStructure(U,L,!0,x)}}}else _.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.c=!0);else{if(e(".et_pb_modal_overlay").length)return;var E,D=(E=u.$el).closest(".et_pb_section");if(D.length)switch(i.keyCode){case 49:D.find(".et-pb-section-add-main").trigger("click");break;case 50:D.find(".et-pb-section-add-specialty").trigger("click");break;case 51:D.find(".et-pb-section-add-fullwidth").trigger("click")}}}}function I(){var t=e(".et-pb-modal-close"),i=e(".et-core-modal-close");t.length&&(void 0!==t[1]?t[1].click():t.click()),i.length&&i.click(),e("body").removeClass("et-core-nbfc")}}),e(window).keyup(function(e){83===e.keyCode?f.s=!1:82===e.keyCode?f.r=!1:67===e.keyCode&&f.c&&(f.c=!1,Ze())}),e("body").on("mouseover",".et-pb-right-click-trigger-overlay, .et-pb-controls, .et_pb_module_block, .et-pb-insert-module, .et-pb-row-add",function(t){var i=e(t.target),o=i.closest(".et_pb_module_block");if(!o.length)if(i.closest(".et-pb-insert-module").length||i.closest(".et-pb-row-add").length)o=i.closest("div"),i.closest(".et-pb-row-add").length&&(o=o.find(".et-pb-row-content"));else{var n=i.closest(".et-pb-right-click-trigger-overlay").length?i.closest(".et-pb-right-click-trigger-overlay"):i.closest(".et-pb-controls");if(!n.length)return void(u={});var a=n.closest(".et_pb_row");if(a.length)o=a.find(".et-pb-row-content");else o=n.closest(".et_pb_section").find(".et-pb-section-content")}if(o.length){var s=j.getView(o.data("cid"));u=s}}),e("body").on("dblclick",".et-pb-right-click-trigger-overlay, .et-pb-controls, .et_pb_module_block",function(t){var i=e(t.target);if(!i.closest("a").length){var o=i.closest(".et_pb_module_block");if(o.length)o.find(".et-pb-settings").trigger("click");else{i.closest(".et-pb-controls").length&&i.closest(".et-pb-controls").find(".et-pb-settings").trigger("click");var n=i.closest(".et-pb-right-click-trigger-overlay");if(n.length){var a=n.closest(".et_pb_row");if(a.length)a.find("> .et-pb-controls .et-pb-settings").trigger("click");else n.closest(".et_pb_section").find("> .et-pb-controls .et-pb-settings").trigger("click")}}}}),"0"===et_pb_options.is_divi_library){var Xe=e("#et-builder-app-settings-button-template").html();e("#et_pb_layout").prepend(Xe),e("#et_pb_layout").on("click",".et-pb-app-view-ab-stats-button",function(t){t.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):e("#et_pb_layout_controls .et-pb-layout-buttons-view-ab-stats").trigger("click")}),e("#et_pb_layout").on("click",".et-pb-app-portability-button.et-core-disabled",function(e){e.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):J.is_active()&&J.alert("cannot_import_export_layout_has_ab_testing")}),e("#et_pb_layout").on("click",".et-pb-app-settings-button",function(t){t.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):e("#et_pb_layout_controls .et-pb-layout-buttons-settings").trigger("click")})}else e("#toplevel_page_et_divi_options, #toplevel_page_et_divi_options > a").addClass("wp-has-current-submenu wp-menu-open").removeClass("wp-not-current-submenu");if(Be()){var Qe=function(){YoastSEO.app.registerPlugin("ET_PB_Yoast_Content",{status:"ready"}),YoastSEO.app.registerModification("content",this.et_pb_update_content,"ET_PB_Yoast_Content",5)};Qe.prototype.et_pb_update_content=function(t){var i=F||et_pb_options.yoast_content;return e(".et-pb-yoast-loading").remove(),i},new Qe}e(window).resize(function(){var t=e(".et_pb_prompt_modal.et_pb_auto_centerize_modal");t.length&&(t.removeAttr("style"),Object(o.a)(t,".et_pb_prompt_buttons"))}),e(window).on("load",function(){setTimeout(function(){var t=e("#et_pb_toggle_builder"),i=e("#et_pb_fb_cta");t.addClass("et_pb_ready"),t.hasClass("et_pb_builder_is_used")&&i.addClass("et_pb_ready")},250)}),e(window).on("mousedown",function(t){var i=e(".et-pb-settings-option-select-advanced.et_pb_menu_active");e(t.target).closest(".et-pb-settings-option-select-advanced").length<1&&i.length>0&&ge(i)})}),window.et_builder=window.et_builder||{},void 0!==window.YoastShortcodePlugin&&(window.YoastShortcodePlugin.prototype.bindElementEvents=function(){var e=document.getElementById("content")||!1,t=this;e&&(e.addEventListener("keydown",this.loadShortcodes.bind(this,this.declareReloaded.bind(this))),e.addEventListener("change",this.loadShortcodes.bind(this,this.declareReloaded.bind(this)))),"undefined"!=typeof tinyMCE&&"function"==typeof tinyMCE.on&&tinyMCE.on("addEditor",function(e){e.editor.on("change",function(){t.loadShortcodes.bind(t,t.declareReloaded.bind(t))()})})}),e(document).ready(function(){var t,i={tabs:{},padding:{},yes_no_button:{},multiple_buttons:{},font_buttons:{},text_align_buttons:{},select:{},font_line_styles:{},animation_buttons:{},user_fonts:et_pb_options.user_fonts,font_weights:et_pb_options.supported_font_weights,options_icons:et_pb_options.all_svg_icons,background_tabs_nav:{},background_gradient_buttons:{},option_preview_buttons:{}};function o(){var t=e(".et_pb_modal_settings_container");t.find("div.mce-fullscreen").length&&setTimeout(function(){var e=t.innerHeight(),i=t.find(".mce-toolbar-grp").innerHeight();t.find("iframe").height(e-i)},100)}window.et_builder_template_options=i,a.Events.on("et-advanced-module-settings:render",function(t){var i=t.$el.find("#et_pb_category_id"),o=t.$el.find("#et_pb_category_name"),n=void 0;i.length&&o.length&&(n=i.find("option:selected").text().trim(),o.val(n),i.on("change",function(){n=e(this).find("option:selected").text().trim(),o.val(n)}))}),t={fonts_template:function(t){return _.template(e("#et-builder-google-fonts-options-items").html())(window.et_builder_template_options.user_fonts)},fonts_weight_template:function(t){return _.template(e("#et-builder-font-weight-items").html())(window.et_builder_template_options.font_weights)},font_icon_list_template:function(){return e("#et-builder-font-icon-list-items").html()},font_down_icon_list_template:function(){return e("#et-builder-font-down-icon-list-items").html()},preview_tabs_output:function(){return e("#et-builder-preview-icons-template").html()},settings_tabs_output:function(t){var i=_.template(e("#et-builder-options-tabs-links-template").html());return window.et_builder_template_options.tabs.options=e.extend({},t),i(window.et_builder_template_options.tabs)},mobile_tabs_output:function(){return e("#et-builder-mobile-options-tabs-template").html()},options_template_output:function(t,i,o){var n=_.template(e("#et-builder-"+t+"-option-template").html());return window.et_builder_template_options[t].options=e.extend({},i),_.isUndefined(o)||(window.et_builder_template_options[t].data=e.extend({},o)),n(window.et_builder_template_options[t])},options_text_align_buttons_output:function(t,i){var o=_.template(e("#et-builder-text-align-buttons-option-template").html());return window.et_builder_template_options.text_align_buttons.options=e.extend({},t),window.et_builder_template_options.text_align_buttons.type=i,o(window.et_builder_template_options.text_align_buttons)}},e.extend(window.et_builder,t),e("body").on("click",".et_pb_module_settings .mce-i-fullscreen",function(){o()}),e(window).resize(function(){o()}),e("body.wp-admin").on("click",'.et-pb-modal-container .mce-widget.mce-btn[aria-label="Fullscreen"] button',function(){setTimeout(function(){e(window).trigger("resize")},50)}),e(document).on("click",".et-pb-dynamic-content-fb-switch",function(t){t.preventDefault(),e("#et_pb_fb_cta").click()})})}.call(this,i(5),i(5))},5:function(e,t){e.exports=jQuery}});
  //# sourceMappingURL=builder.js.map