milanuptech

backend.min.js

Apr 16th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function vc_toTitleCase(str) {
  2.     return str.replace(/\w\S*/g, function(txt) {
  3.         return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
  4.     })
  5. }
  6.  
  7. function vc_convert_column_size(width) {
  8.     var numbers = width ? width.split("/") : [1, 1],
  9.         range = _.range(1, 13),
  10.         num = !_.isUndefined(numbers[0]) && 0 <= _.indexOf(range, parseInt(numbers[0], 10)) && parseInt(numbers[0], 10),
  11.         dev = !_.isUndefined(numbers[1]) && 0 <= _.indexOf(range, parseInt(numbers[1], 10)) && parseInt(numbers[1], 10);
  12.     return !1 !== num && !1 !== dev ? "vc_col-sm-" + 12 * num / dev : "vc_col-sm-12"
  13. }
  14.  
  15. function vc_convert_column_span_size(width) {
  16.     return width = width.replace(/^vc_/, ""), "span12" === width ? "1/1" : "span11" === width ? "11/12" : "span10" === width ? "5/6" : "span9" === width ? "3/4" : "span8" === width ? "2/3" : "span7" === width ? "7/12" : "span6" === width ? "1/2" : "span5" === width ? "5/12" : "span4" === width ? "1/3" : "span3" === width ? "1/4" : "span2" === width ? "1/6" : "span1" === width && "1/12"
  17. }
  18.  
  19. function vc_get_column_mask(cells) {
  20.     var i, columns = cells.split("_"),
  21.         columns_count = columns.length,
  22.         numbers_sum = 0;
  23.     for (i in columns)
  24.         if (!isNaN(parseFloat(columns[i])) && isFinite(columns[i])) {
  25.             var sp = columns[i].match(/(\d{1,2})(\d{1,2})/);
  26.             numbers_sum = _.reduce(sp.slice(1), function(memo, num) {
  27.                 return memo + parseInt(num, 10)
  28.             }, numbers_sum)
  29.         }
  30.     return columns_count + "" + numbers_sum
  31. }
  32.  
  33. function vc_guid() {
  34.     return VCS4() + VCS4() + "-" + VCS4()
  35. }
  36.  
  37. function VCS4() {
  38.     return (65536 * (1 + Math.random()) | 0).toString(16).substring(1)
  39. }
  40.  
  41. function vc_button_param_target_callback() {
  42.     var $ = jQuery,
  43.         $link_target = this.$content.find("[name=target]").parents('[data-vc-ui-element="panel-shortcode-param"]:first'),
  44.         $link_field = $(".wpb-edit-form [name=href]"),
  45.         key_up_callback = _.debounce(function() {
  46.             var val = $(this).val();
  47.             0 < val.length && "http://" !== val && "https://" !== val ? $link_target.show() : $link_target.hide()
  48.         }, 300);
  49.     $link_field.keyup(key_up_callback).trigger("keyup")
  50. }
  51.  
  52. function vc_cta_button_param_target_callback() {
  53.     var $ = jQuery,
  54.         $link_target = this.$content.find("[name=target]").parents('[data-vc-ui-element="panel-shortcode-param"]:first'),
  55.         $link_field = $(".wpb-edit-form [name=href]"),
  56.         key_up_callback = _.debounce(function() {
  57.             var val = $(this).val();
  58.             0 < val.length && "http://" !== val && "https://" !== val ? $link_target.show() : $link_target.hide()
  59.         }, 300);
  60.     $link_field.keyup(key_up_callback).trigger("keyup")
  61. }
  62.  
  63. function vc_grid_exclude_dependency_callback() {
  64.     var $ = jQuery,
  65.         exclude_el = $(".wpb_vc_param_value[name=exclude]", this.$content),
  66.         exclude_obj = exclude_el.data("vc-param-object");
  67.     if (void 0 === exclude_obj) return !1;
  68.     var post_type_object = $('select.wpb_vc_param_value[name="post_type"]', this.$content),
  69.         val = post_type_object.val();
  70.     exclude_obj.source_data = function(request, response) {
  71.         return {
  72.             query: {
  73.                 query: val,
  74.                 term: request.term
  75.             }
  76.         }
  77.     }, exclude_obj.source_data_val = val, post_type_object.change(function() {
  78.         val = $(this).val(), exclude_obj.source_data_val != val && (exclude_obj.source_data = function(request, response) {
  79.             return {
  80.                 query: {
  81.                     query: val,
  82.                     term: request.term
  83.                 }
  84.             }
  85.         }, exclude_obj.$el.data("uiAutocomplete").destroy(), exclude_obj.$sortable_wrapper.find(".vc_data").remove(), exclude_obj.render(), exclude_obj.source_data_val = val)
  86.     })
  87. }
  88.  
  89. function vcGridFilterExcludeCallBack() {
  90.     var $filterBy, $exclude, autocomplete, defaultValue, $ = jQuery;
  91.     if ($filterBy = $(".wpb_vc_param_value[name=filter_source]", this.$content), defaultValue = $filterBy.val(), $exclude = $(".wpb_vc_param_value[name=exclude_filter]", this.$content), void 0 === (autocomplete = $exclude.data("vc-param-object"))) return !1;
  92.     $filterBy.change(function() {
  93.         var $this = $(this);
  94.         defaultValue !== $this.val() && autocomplete.clearValue(), autocomplete.source_data = function() {
  95.             return {
  96.                 vc_filter_by: $this.val()
  97.             }
  98.         }
  99.     }).trigger("change")
  100. }
  101.  
  102. function vcChartCustomColorDependency() {
  103.     var $, $masterEl, $content;
  104.     $ = jQuery, $masterEl = $(".wpb_vc_param_value[name=style]", this.$content), $content = this.$content, $masterEl.on("change", function() {
  105.         var masterValue;
  106.         masterValue = $(this).val(), $content.toggleClass("vc_chart-edit-form-custom-color", "custom" === masterValue)
  107.     }), $masterEl.trigger("change")
  108. }
  109.  
  110. function vc_wpnop(content) {
  111.     if (!content) return "";
  112.     var blocklist1, blocklist2, preserve_linebreaks = !1,
  113.         preserve_br = !1;
  114.     return -1 == content.indexOf("<pre") && -1 == content.indexOf("<script") || (preserve_linebreaks = !0, content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
  115.         return a = a.replace(/<br ?\/?>(\r\n|\n)?/g, "<wp-temp-lb>"), a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, "<wp-temp-lb>")
  116.     })), -1 != content.indexOf("[caption") && (preserve_br = !0, content = content.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
  117.         return a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>").replace(/[\r\n\t]+/, "")
  118.     })), blocklist1 = "blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset", content = content.replace(new RegExp("\\s*</(" + blocklist1 + ")>\\s*", "g"), "</$1>\n"), content = content.replace(new RegExp("\\s*<((?:" + blocklist1 + ")(?: [^>]*)?)>", "g"), "\n<$1>"), content = content.replace(/(<p [^>]+>.*?)<\/p>/g, "$1</p#>"), content = content.replace(/<div( [^>]*)?>\s*<p>/gi, "<div$1>\n\n"), content = content.replace(/\s*<p>/gi, ""), content = content.replace(/\s*<\/p>\s*/gi, "\n\n"), content = content.replace(/\n[\s\u00a0]+\n/g, "\n\n"), content = content.replace(/\s*<br ?\/?>\s*/gi, "\n"), content = content.replace(/\s*<div/g, "\n<div"), content = content.replace(/<\/div>\s*/g, "</div>\n"), content = content.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, "\n\n[caption$1[/caption]\n\n"), content = content.replace(/caption\]\n\n+\[caption/g, "caption]\n\n[caption"), blocklist2 = "blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset", content = content.replace(new RegExp("\\s*<((?:" + blocklist2 + ")(?: [^>]*)?)\\s*>", "g"), "\n<$1>"), content = content.replace(new RegExp("\\s*</(" + blocklist2 + ")>\\s*", "g"), "</$1>\n"), content = content.replace(/<li([^>]*)>/g, "\t<li$1>"), -1 != content.indexOf("<hr") && (content = content.replace(/\s*<hr( [^>]*)?>\s*/g, "\n\n<hr$1>\n\n")), -1 != content.indexOf("<object") && (content = content.replace(/<object[\s\S]+?<\/object>/g, function(a) {
  119.         return a.replace(/[\r\n]+/g, "")
  120.     })), content = content.replace(/<\/p#>/g, "</p>\n"), content = content.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, "\n$1"), content = content.replace(/^\s+/, ""), content = content.replace(/[\s\u00a0]+$/, ""), preserve_linebreaks && (content = content.replace(/<wp-temp-lb>/g, "\n")), preserve_br && (content = content.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), content
  121. }
  122.  
  123. function vc_wpautop(pee) {
  124.     var preserve_linebreaks = !1,
  125.         preserve_br = !1,
  126.         blocklist = "table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|noscript|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";
  127.     return -1 != pee.indexOf("<object") && (pee = pee.replace(/<object[\s\S]+?<\/object>/g, function(a) {
  128.         return a.replace(/[\r\n]+/g, "")
  129.     })), pee = pee.replace(/<[^<>]+>/g, function(a) {
  130.         return a.replace(/[\r\n]+/g, " ")
  131.     }), -1 == pee.indexOf("<pre") && -1 == pee.indexOf("<script") || (preserve_linebreaks = !0, pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
  132.         return a.replace(/(\r\n|\n)/g, "<wp-temp-lb>")
  133.     })), -1 != pee.indexOf("[caption") && (preserve_br = !0, pee = pee.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
  134.         return a = a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>"), a = a.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(b) {
  135.             return b.replace(/[\r\n\t]+/, " ")
  136.         }), a.replace(/\s*\n\s*/g, "<wp-temp-br />")
  137.     })), pee += "\n\n", pee = pee.replace(/<br \/>\s*<br \/>/gi, "\n\n"), pee = pee.replace(new RegExp("(<(?:" + blocklist + ")(?: [^>]*)?>)", "gi"), "\n$1"), pee = pee.replace(new RegExp("(</(?:" + blocklist + ")>)", "gi"), "$1\n\n"), pee = pee.replace(/<hr( [^>]*)?>/gi, "<hr$1>\n\n"), pee = pee.replace(/\r\n|\r/g, "\n"), pee = pee.replace(/\n\s*\n+/g, "\n\n"), pee = pee.replace(/([\s\S]+?)\n\n/g, "<p>$1</p>\n"), pee = pee.replace(/<p>\s*?<\/p>/gi, ""), pee = pee.replace(new RegExp("<p>\\s*(</?(?:" + blocklist + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1"), pee = pee.replace(/<p>(<li.+?)<\/p>/gi, "$1"), pee = pee.replace(/<p>\s*<blockquote([^>]*)>/gi, "<blockquote$1><p>"), pee = pee.replace(/<\/blockquote>\s*<\/p>/gi, "</p></blockquote>"), pee = pee.replace(new RegExp("<p>\\s*(</?(?:" + blocklist + ")(?: [^>]*)?>)", "gi"), "$1"), pee = pee.replace(new RegExp("(</?(?:" + blocklist + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1"), pee = pee.replace(/\s*\n/gi, "<br />\n"), pee = pee.replace(new RegExp("(</?(?:" + blocklist + ")[^>]*>)\\s*<br />", "gi"), "$1"), pee = pee.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, "$1"), pee = pee.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, "[caption$1[/caption]"), pee = pee.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(a, b, c) {
  138.         return c.match(/<p( [^>]*)?>/) ? a : b + "<p>" + c + "</p>"
  139.     }), preserve_linebreaks && (pee = pee.replace(/<wp-temp-lb>/g, "\n")), preserve_br && (pee = pee.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), pee
  140. }
  141.  
  142. function vcAddShortcodeDefaultParams(model) {
  143.     var params = model.get("params"),
  144.         preset = model.get("preset");
  145.     params = _.extend({}, vc.getDefaults(model.get("shortcode")), params), preset && vc_all_presets[preset] && (params = vc_all_presets[preset], void 0 !== vc.frame_window && vc_all_presets[preset].css && vc.frame_window.vc_iframe.setCustomShortcodeCss(vc_all_presets[preset].css)), model.set({
  146.         params: params
  147.     }, {
  148.         silent: !0
  149.     })
  150. }
  151.  
  152. function vc_globalHashCode(obj) {
  153.     return "string" != typeof obj && (obj = JSON.stringify(obj)), obj.length ? obj.split("").reduce(function(a, b) {
  154.         return (a = (a << 5) - a + b.charCodeAt(0)) & a
  155.     }, 0) : 0
  156. }
  157.  
  158. function vcChartParamAfterAddCallback($elem, action) {
  159.     if ("new" !== action && "clone" !== action || $elem.find(".vc_control.column_toggle").click(), "new" === action) {
  160.         var i, $select, $options, random, exclude, colors;
  161.         for (exclude = ["white", "black"], $select = $elem.find("[name=values_color]"), $options = $select.find("option"), i = 0;;) {
  162.             if (100 < i++) break;
  163.             if (random = Math.floor(Math.random() * $options.length), -1 === jQuery.inArray($options.eq(random).val(), exclude)) {
  164.                 $options.eq(random).prop("selected", !0), $select.change();
  165.                 break
  166.             }
  167.         }
  168.         colors = ["#5472d2", "#00c1cf", "#fe6c61", "#8d6dc4", "#4cadc9", "#cec2ab", "#50485b", "#75d69c", "#f7be68", "#5aa1e3", "#6dab3c", "#f4524d", "#f79468", "#b97ebb", "#ebebeb", "#f7f7f7", "#0088cc", "#58b9da", "#6ab165", "#ff9900", "#ff675b", "#555555"], random = Math.floor(Math.random() * colors.length), $elem.find("[name=values_custom_color]").val(colors[random]).change()
  169.     }
  170. }
  171.  
  172. function vcEscapeHtml(text) {
  173.     var map = {
  174.         "&": "&amp;",
  175.         "<": "&lt;",
  176.         ">": "&gt;",
  177.         '"': "&quot;",
  178.         "'": "&#039;"
  179.     };
  180.     return null === text || void 0 === text ? "" : text.replace(/[&<>"']/g, function(m) {
  181.         return map[m]
  182.     })
  183. }
  184.  
  185. function vc_slugify(text) {
  186.     return text.toLowerCase().replace(/[^\w ]+/g, "").replace(/ +/g, "-")
  187. }
  188. if (!window.vc) var vc = {};
  189. ! function() {
  190.     vc.templateOptions = {
  191.         default: {
  192.             evaluate: /<%([\s\S]+?)%>/g,
  193.             interpolate: /<%=([\s\S]+?)%>/g,
  194.             escape: /<%-([\s\S]+?)%>/g
  195.         },
  196.         custom: {
  197.             evaluate: /<#([\s\S]+?)#>/g,
  198.             interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
  199.             escape: /\{\{([^\}]+?)\}\}(?!\})/g
  200.         }
  201.     };
  202.     var noMatch = /(.)^/,
  203.         escapes = {
  204.             "'": "'",
  205.             "\\": "\\",
  206.             "\r": "r",
  207.             "\n": "n",
  208.             "\u2028": "u2028",
  209.             "\u2029": "u2029"
  210.         },
  211.         escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g,
  212.         escapeChar = function(match) {
  213.             return "\\" + escapes[match]
  214.         };
  215.     vc.template = function(text, settings) {
  216.         settings = _.defaults({}, settings, vc.templateOptions.default);
  217.         var matcher = RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join("|") + "|$", "g"),
  218.             index = 0,
  219.             source = "__p+='";
  220.         text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
  221.             return source += text.slice(index, offset).replace(escapeRegExp, escapeChar), index = offset + match.length, escape ? source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'" : interpolate ? source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'" : evaluate && (source += "';\n" + evaluate + "\n__p+='"), match
  222.         }), source += "';\n", settings.variable || (source = "with(obj||{}){\n" + source + "}\n"), source = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n";
  223.         var render;
  224.         try {
  225.             render = new Function(settings.variable || "obj", "_", source)
  226.         } catch (e) {
  227.             throw e.source = source, e
  228.         }
  229.         var template = function(data) {
  230.             return render.call(this, data, _)
  231.         };
  232.         return template.source = "function(" + (settings.variable || "obj") + "){\n" + source + "}", template
  233.     }
  234. }(),
  235. function($) {
  236.     "use strict";
  237.     _.isUndefined(window.vc) && (window.vc = {}), window.Vc_postSettingsEditor = Backbone.View.extend({
  238.         $editor: !1,
  239.         sel: "wpb_csseditor",
  240.         ace_enabled: !1,
  241.         initialize: function(sel) {
  242.             sel && 0 < sel.length && (this.sel = sel), this.ace_enabled = !0
  243.         },
  244.         aceEnabled: function() {
  245.             return this.ace_enabled && window.ace && window.ace.edit
  246.         },
  247.         setEditor: function(value) {
  248.             return this.aceEnabled() ? this.setEditorAce(value) : this.setEditorTextarea(value), this.$editor
  249.         },
  250.         focus: function() {
  251.             if (this.aceEnabled()) {
  252.                 this.$editor.focus();
  253.                 var count = this.$editor.session.getLength();
  254.                 this.$editor.gotoLine(count, this.$editor.session.getLine(count - 1).length)
  255.             } else this.$editor.focus()
  256.         },
  257.         setEditorAce: function(value) {
  258.             this.$editor || (this.$editor = ace.edit(this.sel), this.$editor.getSession().setMode("ace/mode/css"), this.$editor.setTheme("ace/theme/chrome")), this.$editor.setValue(value), this.$editor.clearSelection(), this.$editor.focus();
  259.             var count = this.$editor.getSession().getLength();
  260.             return this.$editor.gotoLine(count, this.$editor.getSession().getLine(count - 1).length), this.$editor
  261.         },
  262.         setEditorTextarea: function(value) {
  263.             return this.$editor || (this.$editor = $("<textarea></textarea>").css({
  264.                 width: "100%",
  265.                 height: "100%",
  266.                 minHeight: "300px"
  267.             }), $("#" + this.sel).empty().append(this.$editor).css({
  268.                 overflowLeft: "hidden",
  269.                 width: "100%",
  270.                 height: "100%"
  271.             })), this.$editor.val(value), this.$editor.focus(), this.$editor.parent().css({
  272.                 overflow: "auto"
  273.             }), this.$editor
  274.         },
  275.         setSize: function() {
  276.             var height = $(window).height() - 380;
  277.             this.aceEnabled() ? $("#" + this.sel).css({
  278.                 height: height,
  279.                 minHeight: height
  280.             }) : (this.$editor.parent().css({
  281.                 height: height,
  282.                 minHeight: height
  283.             }), this.$editor.css({
  284.                 height: "98%",
  285.                 width: "98%"
  286.             }))
  287.         },
  288.         setSizeResizable: function() {
  289.             var height, editorPositionTop, footerPositionTop, $editor = $("#" + this.sel);
  290.             editorPositionTop = $editor.offset().top, footerPositionTop = vc.active_panel.$el.find('[data-vc-ui-element="panel-footer"]').offset().top, height = footerPositionTop - editorPositionTop - 70, this.aceEnabled() ? $editor.css({
  291.                 height: height,
  292.                 minHeight: height
  293.             }) : (this.$editor.parent().css({
  294.                 height: height,
  295.                 minHeight: height
  296.             }), this.$editor.css({
  297.                 height: "98%",
  298.                 width: "98%"
  299.             }))
  300.         },
  301.         getEditor: function() {
  302.             return this.$editor
  303.         },
  304.         getValue: function() {
  305.             return this.aceEnabled() ? this.$editor.getValue() : this.$editor.val()
  306.         }
  307.     })
  308. }(window.jQuery),
  309. function(_, Backbone, vc) {
  310.     "use strict";
  311.  
  312.     function ExtendUI(object) {
  313.         var newObject = this.extend(object);
  314.         return newObject.prototype._vcUIEventsHooks || (newObject.prototype._vcUIEventsHooks = []), object.uiEvents && newObject.prototype._vcUIEventsHooks.push(object.uiEvents), newObject
  315.     }
  316.     Backbone.View.vcExtendUI = ExtendUI, vc.View = Backbone.View.extend({
  317.         delegateEvents: function() {
  318.             vc.View.__super__.delegateEvents.call(this), this._vcUIEventsHooks && this._vcUIEventsHooks.length && _.each(this._vcUIEventsHooks, function(events) {
  319.                 _.isObject(events) && _.each(events, function(methods, e) {
  320.                     _.isString(methods) && _.each(methods.split(/\s+/), function(method) {
  321.                         this.on(e, this[method], this)
  322.                     }, this)
  323.                 }, this)
  324.             }, this)
  325.         }
  326.     })
  327. }(_, Backbone, vc),
  328. function($) {
  329.     "use strict";
  330.     _.isUndefined(window.vc) && (window.vc = {}), vc.showSpinner = function() {
  331.         $("#vc_logo").addClass("vc_ui-wp-spinner")
  332.     }, vc.hideSpinner = function() {
  333.         $("#vc_logo").removeClass("vc_ui-wp-spinner")
  334.     }, $(document).ajaxSend(function(e, xhr, req) {
  335.         req && req.data && "string" == typeof req.data && req.data.match(/vc_inline=true/) && vc.showSpinner()
  336.     }).ajaxStop(function() {
  337.         vc.hideSpinner()
  338.     }), vc.active_panel = !1, vc.closeActivePanel = function(model) {
  339.         if (!this.active_panel) return !1;
  340.         model && vc.active_panel.model && vc.active_panel.model.get("id") === model.get("id") ? (vc.active_panel.model = null, this.active_panel.hide()) : model || (vc.active_panel.model = null, this.active_panel.hide())
  341.     }, vc.activePanelName = function() {
  342.         return this.active_panel && this.active_panel.panelName ? this.active_panel.panelName : null
  343.     }, vc.updateSettingsBadge = function() {
  344.         var value = vc.$custom_css.val();
  345.         value && "" !== value.trim() ? $("#vc_post-css-badge").show() : $("#vc_post-css-badge").hide()
  346.     }, vc.ModalView = Backbone.View.extend({
  347.         message_box_timeout: !1,
  348.         events: {
  349.             "hidden.bs.modal": "hide",
  350.             "shown.bs.modal": "shown"
  351.         },
  352.         initialize: function() {
  353.             _.bindAll(this, "setSize", "hide")
  354.         },
  355.         setSize: function() {
  356.             var height = $(window).height() - 150;
  357.             this.$content.css("maxHeight", height), this.trigger("setSize")
  358.         },
  359.         render: function() {
  360.             return $(window).bind("resize.ModalView", this.setSize), this.setSize(), vc.closeActivePanel(), this.$el.modal("show"), this
  361.         },
  362.         showMessage: function(text, type) {
  363.             this.message_box_timeout && this.$el.find(".vc_message").remove() && window.clearTimeout(this.message_box_timeout), this.message_box_timeout = !1;
  364.             var $message_box = $('<div class="vc_message type-' + type + '"></div>');
  365.             this.$el.find(".vc_modal-body").prepend($message_box), $message_box.text(text).fadeIn(), this.message_box_timeout = window.setTimeout(function() {
  366.                 $message_box.remove()
  367.             }, 6e3)
  368.         },
  369.         hide: function() {
  370.             $(window).unbind("resize.ModalView")
  371.         },
  372.         shown: function() {}
  373.     }), vc.element_start_index = 0, vc.AddElementBlockView = vc.ModalView.extend({
  374.         el: $("#vc_add-element-dialog"),
  375.         prepend: !1,
  376.         builder: "",
  377.         events: {
  378.             "click .vc_shortcode-link": "createElement",
  379.             "keyup #vc_elements_name_filter": "filterElements",
  380.             "hidden.bs.modal": "hide",
  381.             "show.bs.modal": "buildFiltering",
  382.             "click .wpb-content-layouts-container [data-filter]": "filterElements",
  383.             "shown.bs.modal": "shown"
  384.         },
  385.         buildFiltering: function() {
  386.             this.do_render = !1;
  387.             var item_selector, tag, not_in;
  388.             item_selector = '[data-vc-ui-element="add-element-button"]', tag = this.model ? this.model.get("shortcode") : "vc_column", not_in = this._getNotIn(tag), $("#vc_elements_name_filter").val(""), this.$content.addClass("vc_filter-all"), this.$content.attr("data-vc-ui-filter", "*");
  389.             var mapped = vc.getMapped(tag),
  390.                 as_parent = !(!tag || _.isUndefined(mapped.as_parent)) && mapped.as_parent;
  391.             if (_.isObject(as_parent)) {
  392.                 var parent_selector = [];
  393.                 _.isString(as_parent.only) && parent_selector.push(_.reduce(as_parent.only.replace(/\s/, "").split(","), function(memo, val) {
  394.                     return memo + (_.isEmpty(memo) ? "" : ",") + '[data-element="' + val.trim() + '"]'
  395.                 }, "")), _.isString(as_parent.except) && parent_selector.push(_.reduce(as_parent.except.replace(/\s/, "").split(","), function(memo, val) {
  396.                     return memo + ':not([data-element="' + val.trim() + '"])'
  397.                 }, "")), item_selector += parent_selector.join(",")
  398.             } else not_in && (item_selector = not_in);
  399.             tag && !_.isUndefined(mapped.allowed_container_element) && (mapped.allowed_container_element ? _.isString(mapped.allowed_container_element) && (item_selector += ":not([data-is-container=true]), [data-element=" + mapped.allowed_container_element + "]") : item_selector += ":not([data-is-container=true])"), this.$buttons.removeClass("vc_visible").addClass("vc_inappropriate"), $(item_selector, this.$content).removeClass("vc_inappropriate").addClass("vc_visible"), this.hideEmptyFilters()
  400.         },
  401.         hideEmptyFilters: function() {
  402.             this.$el.find(".vc_filter-content-elements .active").removeClass("active"), this.$el.find(".vc_filter-content-elements > :first").addClass("active");
  403.             var self = this;
  404.             this.$el.find("[data-filter]").each(function() {
  405.                 $($(this).data("filter") + ".vc_visible:not(.vc_inappropriate)", self.$content).length ? $(this).parent().show() : $(this).parent().hide()
  406.             })
  407.         },
  408.         render: function(model, prepend) {
  409.             return this.builder = new vc.ShortcodesBuilder, this.prepend = !!_.isBoolean(prepend) && prepend, this.place_after_id = !!_.isString(prepend) && prepend, this.model = !!_.isObject(model) && model, this.$content = this.$el.find('[data-vc-ui-element="panel-add-element-list"]'), this.$buttons = $('[data-vc-ui-element="add-element-button"]', this.$content), this.preventDoubleExecution = !1, vc.AddElementBlockView.__super__.render.call(this)
  410.         },
  411.         hide: function() {
  412.             this.do_render && (this.show_settings && this.showEditForm(), this.exit())
  413.         },
  414.         showEditForm: function() {
  415.             vc.edit_element_block_view.render(this.builder.last())
  416.         },
  417.         exit: function() {
  418.             this.builder.render()
  419.         },
  420.         createElement: function(e) {
  421.             var $control, tag, row_params, column_params, row_inner_params, _this, i;
  422.             if (!this.preventDoubleExecution) {
  423.                 this.preventDoubleExecution = !0, this.do_render = !0, e.preventDefault(), $control = $(e.currentTarget), tag = $control.data("tag"), row_params = {}, row_inner_params = {}, column_params = {
  424.                     width: "1/1"
  425.                 }, !1 === this.model && "vc_row" !== tag ? (this.builder.create({
  426.                     shortcode: "vc_row",
  427.                     params: row_params
  428.                 }).create({
  429.                     shortcode: "vc_column",
  430.                     parent_id: this.builder.lastID(),
  431.                     params: column_params
  432.                 }), this.model = this.builder.last()) : !1 !== this.model && "vc_row" === tag && (tag += "_inner");
  433.                 var params = {
  434.                     shortcode: tag,
  435.                     parent_id: !!this.model && this.model.get("id"),
  436.                     params: "vc_row_inner" === tag ? row_inner_params : {}
  437.                 };
  438.                 if (this.prepend) {
  439.                     params.order = 0;
  440.                     var shortcodeFirst = vc.shortcodes.findWhere({
  441.                         parent_id: this.model.get("id")
  442.                     });
  443.                     shortcodeFirst && (params.order = shortcodeFirst.get("order") - 1), vc.activity = "prepend"
  444.                 } else this.place_after_id && (params.place_after_id = this.place_after_id);
  445.                 for (this.builder.create(params), i = this.builder.models.length - 1; i >= 0; i--) this.builder.models[i].get("shortcode");
  446.                 "vc_row" === tag ? this.builder.create({
  447.                     shortcode: "vc_column",
  448.                     parent_id: this.builder.lastID(),
  449.                     params: column_params
  450.                 }) : "vc_row_inner" === tag && (column_params = {
  451.                     width: "1/1"
  452.                 }, this.builder.create({
  453.                     shortcode: "vc_column_inner",
  454.                     parent_id: this.builder.lastID(),
  455.                     params: column_params
  456.                 }));
  457.                 var mapped = vc.getMapped(tag);
  458.                 if (_.isString(mapped.default_content) && mapped.default_content.length) {
  459.                     var newData = this.builder.parse({}, mapped.default_content, this.builder.last().toJSON());
  460.                     _.each(newData, function(object) {
  461.                         object.default_content = !0, this.builder.create(object)
  462.                     }, this)
  463.                 }
  464.                 this.show_settings = !(_.isBoolean(mapped.show_settings_on_create) && !1 === mapped.show_settings_on_create), _this = this, this.$el.one("hidden.bs.modal", function() {
  465.                     _this.preventDoubleExecution = !1
  466.                 }).modal("hide")
  467.             }
  468.         },
  469.         _getNotIn: _.memoize(function(tag) {
  470.             return '[data-vc-ui-element="add-element-button"]:not(' + _.reduce(vc.map, function(memo, shortcode) {
  471.                 var separator = _.isEmpty(memo) ? "" : ",";
  472.                 return _.isObject(shortcode.as_child) ? (_.isString(shortcode.as_child.only) && (_.contains(shortcode.as_child.only.replace(/\s/, "").split(","), tag) || (memo += separator + "[data-element=" + shortcode.base + "]")), _.isString(shortcode.as_child.except) && _.contains(shortcode.as_child.except.replace(/\s/, "").split(","), tag) && (memo += separator + "[data-element=" + shortcode.base + "]")) : !1 === shortcode.as_child && (memo += separator + "[data-element=" + shortcode.base + "]"), memo
  473.             }, "") + ")"
  474.         }),
  475.         filterElements: function(e) {
  476.             e.stopPropagation(), e.preventDefault();
  477.             var $control = $(e.currentTarget),
  478.                 filter = '[data-vc-ui-element="add-element-button"]',
  479.                 name_filter = $("#vc_elements_name_filter").val();
  480.             if (this.$content.removeClass("vc_filter-all"), $control.is("[data-filter]")) {
  481.                 $(".wpb-content-layouts-container .isotope-filter .active", this.$content).removeClass("active"), $control.parent().addClass("active");
  482.                 var filter_value = $control.data("filter");
  483.                 filter += filter_value, "*" === filter_value ? this.$content.addClass("vc_filter-all") : this.$content.removeClass("vc_filter-all"), this.$content.attr("data-vc-ui-filter", filter_value.replace(".js-category-", "")), $("#vc_elements_name_filter").val("")
  484.             } else 0 < name_filter.length ? (filter += ":containsi('" + name_filter + "'):not('.vc_element-deprecated')", $(".wpb-content-layouts-container .isotope-filter .active", this.$content).removeClass("active"), this.$content.attr("data-vc-ui-filter", "name:" + name_filter)) : name_filter.length || ($('.wpb-content-layouts-container .isotope-filter [data-filter="*"]').parent().addClass("active"), this.$content.attr("data-vc-ui-filter", "*"), this.$content.addClass("vc_filter-all"));
  485.             $(".vc_visible", this.$content).removeClass("vc_visible"), $(filter, this.$content).addClass("vc_visible")
  486.         },
  487.         shown: function() {
  488.             vc.is_mobile || $("#vc_elements_name_filter").focus()
  489.         }
  490.     }), vc.AddElementBlockViewBackendEditor = vc.AddElementBlockView.extend({
  491.         render: function(model, prepend) {
  492.             return this.prepend = !!_.isBoolean(prepend) && prepend, this.place_after_id = !!_.isString(prepend) && prepend, this.model = !!_.isObject(model) && model, this.$content = this.$el.find('[data-vc-ui-element="panel-add-element-list"]'), this.$buttons = $('[data-vc-ui-element="add-element-button"]', this.$content), vc.AddElementBlockView.__super__.render.call(this)
  493.         },
  494.         createElement: function(e) {
  495.             var that, row_params, column_params, row_inner_params, column_inner_params;
  496.             if (!this.preventDoubleExecution) {
  497.                 this.preventDoubleExecution = !0;
  498.                 var model, column, row;
  499.                 _.isObject(e) && e.preventDefault(), this.do_render = !0;
  500.                 var tag = $(e.currentTarget).data("tag");
  501.                 row_params = {}, column_params = {
  502.                     width: "1/1"
  503.                 }, !1 === this.model ? (row = vc.shortcodes.create({
  504.                     shortcode: "vc_row",
  505.                     params: row_params
  506.                 }), column = vc.shortcodes.create({
  507.                     shortcode: "vc_column",
  508.                     params: column_params,
  509.                     parent_id: row.id,
  510.                     root_id: row.id
  511.                 }), model = "vc_row" !== tag ? vc.shortcodes.create({
  512.                     shortcode: tag,
  513.                     parent_id: column.id,
  514.                     root_id: row.id
  515.                 }) : row) : "vc_row" === tag ? (row_inner_params = {}, column_inner_params = {
  516.                     width: "1/1"
  517.                 }, row = vc.shortcodes.create({
  518.                     shortcode: "vc_row_inner",
  519.                     params: row_inner_params,
  520.                     parent_id: this.model.id,
  521.                     order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.getNextOrder()
  522.                 }), model = vc.shortcodes.create({
  523.                     shortcode: "vc_column_inner",
  524.                     params: column_inner_params,
  525.                     parent_id: row.id,
  526.                     root_id: row.id
  527.                 })) : model = vc.shortcodes.create({
  528.                     shortcode: tag,
  529.                     parent_id: this.model.id,
  530.                     order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.getNextOrder(),
  531.                     root_id: this.model.get("root_id")
  532.                 }), this.show_settings = !(_.isBoolean(vc.getMapped(tag).show_settings_on_create) && !1 === vc.getMapped(tag).show_settings_on_create), this.model = model, this.model.get("shortcode"), that = this, this.$el.one("hidden.bs.modal", function() {
  533.                     that.preventDoubleExecution = !1
  534.                 }).modal("hide")
  535.             }
  536.         },
  537.         showEditForm: function() {
  538.             vc.edit_element_block_view.render(this.model)
  539.         },
  540.         exit: function() {},
  541.         getFirstPositionIndex: function() {
  542.             return vc.element_start_index -= 1, vc.element_start_index
  543.         }
  544.     }), vc.PanelView = vc.View.extend({
  545.         mediaSizeClassPrefix: "vc_media-",
  546.         customMediaQuery: !0,
  547.         panelName: "panel",
  548.         draggable: !1,
  549.         $body: !1,
  550.         $tabs: !1,
  551.         $content: !1,
  552.         events: {
  553.             "click [data-dismiss=panel]": "hide",
  554.             "mouseover [data-transparent=panel]": "addOpacity",
  555.             "click [data-transparent=panel]": "toggleOpacity",
  556.             "mouseout [data-transparent=panel]": "removeOpacity",
  557.             "click .vc_panel-tabs-link": "changeTab"
  558.         },
  559.         _vcUIEventsHooks: [{
  560.             resize: "setResize"
  561.         }],
  562.         options: {
  563.             startTab: 0
  564.         },
  565.         clicked: !1,
  566.         showMessageDisabled: !0,
  567.         initialize: function() {
  568.             this.clicked = !1, this.$el.removeClass("vc_panel-opacity"), this.$body = $("body"), this.$content = this.$el.find(".vc_panel-body"), _.bindAll(this, "setSize", "fixElContainment", "changeTab", "setTabsSize"), this.on("show", this.setSize, this), this.on("setSize", this.setResize, this), this.on("render", this.resetMinimize, this)
  569.         },
  570.         toggleOpacity: function() {
  571.             this.clicked = !this.clicked
  572.         },
  573.         addOpacity: function() {
  574.             !this.clicked && this.$el.addClass("vc_panel-opacity")
  575.         },
  576.         removeOpacity: function() {
  577.             !this.clicked && this.$el.removeClass("vc_panel-opacity")
  578.         },
  579.         message_box_timeout: !1,
  580.         init: function() {},
  581.         render: function() {
  582.             return this.trigger("render"), this.trigger("afterRender"), this
  583.         },
  584.         show: function() {
  585.             if (!this.$el.hasClass("vc_active")) {
  586.                 vc.closeActivePanel(), this.init(), vc.active_panel = this, this.clicked = !1, this.$el.removeClass("vc_panel-opacity");
  587.                 var $tabs = this.$el.find(".vc_panel-tabs");
  588.                 $tabs.length && (this.$tabs = $tabs, this.setTabs()), this.$el.addClass("vc_active"), this.draggable ? this.initDraggable() : $(window).trigger("resize"), this.fixElContainment(), this.trigger("show")
  589.             }
  590.         },
  591.         hide: function(e) {
  592.             e && e.preventDefault(), this.model && (this.model = null), vc.active_panel = !1, this.$el.removeClass("vc_active")
  593.         },
  594.         content: function() {
  595.             return this.$el.find(".panel-body")
  596.         },
  597.         setResize: function() {
  598.             this.customMediaQuery && this.setMediaSizeClass()
  599.         },
  600.         setMediaSizeClass: function() {
  601.             var modalWidth, classes;
  602.             modalWidth = this.$el.width(), classes = {
  603.                 xs: !0,
  604.                 sm: !1,
  605.                 md: !1,
  606.                 lg: !1
  607.             }, 525 <= modalWidth && (classes.sm = !0), 745 <= modalWidth && (classes.md = !0), 945 <= modalWidth && (classes.lg = !0), _.each(classes, function(value, key) {
  608.                 value ? this.$el.addClass(this.mediaSizeClassPrefix + key) : this.$el.removeClass(this.mediaSizeClassPrefix + key)
  609.             }, this)
  610.         },
  611.         fixElContainment: function() {
  612.             this.$body || (this.$body = $("body"));
  613.             var el_w = this.$el.width(),
  614.                 container_w = this.$body.width(),
  615.                 container_h = this.$body.height(),
  616.                 containment = [20 - el_w, 0, container_w - 20, container_h - 30],
  617.                 positions = this.$el.position(),
  618.                 new_positions = {};
  619.             positions.left < containment[0] && (new_positions.left = containment[0]), 0 > positions.top && (new_positions.top = 0), positions.left > containment[2] && (new_positions.left = containment[2]), positions.top > containment[3] && (new_positions.top = containment[3]), this.$el.css(new_positions), this.trigger("fixElContainment"), this.setSize()
  620.         },
  621.         initDraggable: function() {
  622.             this.$el.draggable({
  623.                 iframeFix: !0,
  624.                 handle: ".vc_panel-heading",
  625.                 start: this.fixElContainment,
  626.                 stop: this.fixElContainment
  627.             }), this.draggable = !0
  628.         },
  629.         setSize: function() {
  630.             this.trigger("setSize")
  631.         },
  632.         setTabs: function() {
  633.             this.$tabs.length && (this.$tabs.find(".vc_panel-tabs-control").removeClass("vc_active").eq(this.options.startTab).addClass("vc_active"), this.$tabs.find(".vc_panel-tab").removeClass("vc_active").eq(this.options.startTab).addClass("vc_active"), window.setTimeout(this.setTabsSize, 100))
  634.         },
  635.         setTabsSize: function() {
  636.             this.$tabs && this.$tabs.parents(".vc_with-tabs.vc_panel-body").css("margin-top", this.$tabs.find(".vc_panel-tabs-menu").outerHeight())
  637.         },
  638.         changeTab: function(e) {
  639.             if (e && e.preventDefault && e.preventDefault(), e.target && this.$tabs) {
  640.                 var $tab = $(e.target);
  641.                 this.$tabs.find(".vc_active").removeClass("vc_active"), $tab.parent().addClass("vc_active"), this.$el.find($tab.data("target")).addClass("vc_active"), window.setTimeout(this.setTabsSize, 100)
  642.             }
  643.         },
  644.         showMessage: function(text, type) {
  645.             if (this.showMessageDisabled) return !1;
  646.             this.message_box_timeout && this.$el.find(".vc_panel-message").remove() && window.clearTimeout(this.message_box_timeout), this.message_box_timeout = !1;
  647.             var $message_box = $('<div class="vc_panel-message type-' + type + '"></div>').appendTo(this.$el.find(".vc_ui-panel-content-container"));
  648.             $message_box.text(text).fadeIn(), this.message_box_timeout = window.setTimeout(function() {
  649.                 $message_box.remove()
  650.             }, 6e3)
  651.         },
  652.         isVisible: function() {
  653.             return this.$el.is(":visible")
  654.         },
  655.         resetMinimize: function() {
  656.             this.$el.removeClass("vc_panel-opacity")
  657.         }
  658.     }), vc.PostSettingsPanelView = vc.PanelView.extend({
  659.         events: {
  660.             "click [data-save=true]": "save",
  661.             "click [data-dismiss=panel]": "hide",
  662.             "click [data-transparent=panel]": "toggleOpacity",
  663.             "mouseover [data-transparent=panel]": "addOpacity",
  664.             "mouseout [data-transparent=panel]": "removeOpacity"
  665.         },
  666.         saved_css_data: "",
  667.         saved_title: "",
  668.         $title: !1,
  669.         editor: !1,
  670.         post_settings_editor: !1,
  671.         initialize: function() {
  672.             vc.$custom_css = $("#vc_post-custom-css"), this.saved_css_data = vc.$custom_css.val(), this.saved_title = vc.title, this.initEditor(), this.$body = $("body"), _.bindAll(this, "setSize", "fixElContainment"), this.on("show", this.setSize, this), this.on("setSize", this.setResize, this), this.on("render", this.resetMinimize, this)
  673.         },
  674.         initEditor: function() {
  675.             this.editor = new Vc_postSettingsEditor
  676.         },
  677.         render: function() {
  678.             return this.trigger("render"), this.$title = this.$el.find("#vc_page-title-field"), this.$title.val(vc.title), this.setEditor(), this.trigger("afterRender"), this
  679.         },
  680.         setEditor: function() {
  681.             this.editor.setEditor(vc.$custom_css.val())
  682.         },
  683.         setSize: function() {
  684.             this.editor.setSize(), this.trigger("setSize")
  685.         },
  686.         save: function() {
  687.             if (this.$title) {
  688.                 var title = this.$title.val();
  689.                 title != vc.title && vc.frame.setTitle(title)
  690.             }
  691.             this.setAlertOnDataChange(), vc.$custom_css.val(this.editor.getValue()), vc.frame_window && vc.frame_window.vc_iframe.loadCustomCss(vc.$custom_css.val()), vc.updateSettingsBadge(), this.showMessage(window.i18nLocale.css_updated, "success"), this.trigger("save")
  692.         },
  693.         setAlertOnDataChange: function() {
  694.             this.saved_css_data !== this.editor.getValue() ? vc.setDataChanged() : this.$title && this.saved_title !== this.$title.val() && vc.setDataChanged()
  695.         }
  696.     }), vc.PostSettingsPanelViewBackendEditor = vc.PostSettingsPanelView.extend({
  697.         render: function() {
  698.             return this.trigger("render"), this.setEditor(), this.trigger("afterRender"), this
  699.         },
  700.         setAlertOnDataChange: function() {
  701.             vc.saved_custom_css !== this.editor.getValue() && window.tinymce && (window.switchEditors.go("content", "tmce"), window.setTimeout(function() {
  702.                 window.tinymce.get("content").isNotDirty = !1
  703.             }, 1e3))
  704.         },
  705.         save: function() {
  706.             vc.PostSettingsPanelViewBackendEditor.__super__.save.call(this), this.hide()
  707.         }
  708.     }), vc.TemplatesEditorPanelView = vc.PanelView.extend({
  709.         events: {
  710.             "click [data-dismiss=panel]": "hide",
  711.             "click [data-transparent=panel]": "toggleOpacity",
  712.             "mouseover [data-transparent=panel]": "addOpacity",
  713.             "mouseout [data-transparent=panel]": "removeOpacity",
  714.             "click .wpb_remove_template": "removeTemplate",
  715.             "click [data-template_id]": "loadTemplate",
  716.             "click [data-template_name]": "loadDefaultTemplate",
  717.             "click #vc_template-save": "saveTemplate"
  718.         },
  719.         render: function() {
  720.             this.trigger("render"),
  721.                 this.$name = $("#vc_template-name"), this.$list = $("#vc_template-list");
  722.             var $tabs = $("#vc_tabs-templates");
  723.             return $tabs.find(".vc_edit-form-tab-control").removeClass("vc_active").eq(0).addClass("vc_active"), $tabs.find('[data-vc-ui-element="panel-edit-element-tab"]').removeClass("vc_active").eq(0).addClass("vc_active"), $tabs.find(".vc_edit-form-link").click(function(e) {
  724.                 e.preventDefault();
  725.                 var $this = $(this);
  726.                 $tabs.find(".vc_active").removeClass("vc_active"), $this.parent().addClass("vc_active"), $($this.attr("href")).addClass("vc_active")
  727.             }), this.trigger("afterRender"), this
  728.         },
  729.         removeTemplate: function(e) {
  730.             e && e.preventDefault();
  731.             var $button = $(e.currentTarget),
  732.                 template_name = $button.closest('[data-vc-ui-element="template-title"]').text();
  733.             confirm(window.i18nLocale.confirm_deleting_template.replace("{template_name}", template_name)) && ($button.closest('[data-vc-ui-element="template"]').remove(), this.$list.html(window.i18nLocale.loading), $.ajax({
  734.                 type: "POST",
  735.                 url: window.ajaxurl,
  736.                 data: {
  737.                     action: "wpb_delete_template",
  738.                     template_id: $button.attr("rel"),
  739.                     vc_inline: !0,
  740.                     _vcnonce: window.vcAdminNonce
  741.                 },
  742.                 context: this
  743.             }).done(function(html) {
  744.                 this.$list.html(html)
  745.             }))
  746.         },
  747.         loadTemplate: function(e) {
  748.             e && e.preventDefault();
  749.             var $button = $(e.currentTarget);
  750.             $.ajax({
  751.                 type: "POST",
  752.                 url: vc.frame_window.location.href,
  753.                 data: {
  754.                     action: "vc_frontend_template",
  755.                     template_id: $button.data("template_id"),
  756.                     vc_inline: !0,
  757.                     _vcnonce: window.vcAdminNonce
  758.                 },
  759.                 context: this
  760.             }).done(function(html) {
  761.                 var template, data;
  762.                 _.each($(html), function(element) {
  763.                     if ("vc_template-data" === element.id) try {
  764.                         data = JSON.parse(element.innerHTML)
  765.                     } catch (e) {
  766.                         vcConsoleLog(e, "catching template data error")
  767.                     }
  768.                     "vc_template-html" === element.id && (template = element.innerHTML)
  769.                 }), template && data && vc.builder.buildFromTemplate(template, data), this.showMessage(window.i18nLocale.template_added, "success"), vc.closeActivePanel()
  770.             })
  771.         },
  772.         ajaxData: function($button) {
  773.             return {
  774.                 action: "vc_frontend_default_template",
  775.                 template_name: $button.data("template_name"),
  776.                 vc_inline: !0,
  777.                 _vcnonce: window.vcAdminNonce
  778.             }
  779.         },
  780.         loadDefaultTemplate: function(e) {
  781.             e && e.preventDefault();
  782.             var $button = $(e.currentTarget);
  783.             $.ajax({
  784.                 type: "POST",
  785.                 url: vc.frame_window.location.href,
  786.                 data: this.ajaxData($button),
  787.                 context: this
  788.             }).done(function(html) {
  789.                 var template, data;
  790.                 _.each($(html), function(element) {
  791.                     if ("vc_template-data" === element.id) try {
  792.                         data = JSON.parse(element.innerHTML)
  793.                     } catch (e) {
  794.                         vcConsoleLog(e, "catching template data error")
  795.                     }
  796.                     "vc_template-html" === element.id && (template = element.innerHTML)
  797.                 }), template && data && vc.builder.buildFromTemplate(template, data), this.showMessage(window.i18nLocale.template_added, "success")
  798.             })
  799.         },
  800.         saveTemplate: function(e) {
  801.             e.preventDefault();
  802.             var data, shortcodes, name = this.$name.val();
  803.             if (_.isString(name) && name.length) {
  804.                 if (shortcodes = this.getPostContent(), !shortcodes.trim().length) return this.showMessage(window.i18nLocale.template_is_empty, "error"), !1;
  805.                 data = {
  806.                     action: "wpb_save_template",
  807.                     template: shortcodes,
  808.                     template_name: name,
  809.                     frontend: !0,
  810.                     vc_inline: !0,
  811.                     _vcnonce: window.vcAdminNonce
  812.                 }, this.$name.val(""), this.showMessage(window.i18nLocale.template_save, "success"), this.reloadTemplateList(data)
  813.             } else this.showMessage(window.i18nLocale.please_enter_templates_name, "error")
  814.         },
  815.         reloadTemplateList: function(data) {
  816.             this.$list.html(window.i18nLocale.loading).load(window.ajaxurl, data)
  817.         },
  818.         getPostContent: function() {
  819.             return vc.builder.getContent()
  820.         }
  821.     }), vc.TemplatesEditorPanelViewBackendEditor = vc.TemplatesEditorPanelView.extend({
  822.         ajaxData: function($button) {
  823.             return {
  824.                 action: "vc_backend_template",
  825.                 template_id: $button.attr("data-template_id"),
  826.                 vc_inline: !0,
  827.                 _vcnonce: window.vcAdminNonce
  828.             }
  829.         },
  830.         loadTemplate: function(e) {
  831.             e.preventDefault();
  832.             var $button = $(e.currentTarget);
  833.             $.ajax({
  834.                 type: "POST",
  835.                 url: window.ajaxurl,
  836.                 data: this.ajaxData($button),
  837.                 context: this
  838.             }).done(function(shortcodes) {
  839.                 _.each(vc.filters.templates, function(callback) {
  840.                     shortcodes = callback(shortcodes)
  841.                 }), vc.storage.append(shortcodes), vc.shortcodes.fetch({
  842.                     reset: !0
  843.                 }), vc.closeActivePanel()
  844.             })
  845.         },
  846.         loadDefaultTemplate: function(e) {
  847.             e.preventDefault();
  848.             var $button = $(e.currentTarget);
  849.             $.ajax({
  850.                 type: "POST",
  851.                 url: window.ajaxurl,
  852.                 data: {
  853.                     action: "vc_backend_default_template",
  854.                     template_name: $button.attr("data-template_name"),
  855.                     vc_inline: !0,
  856.                     _vcnonce: window.vcAdminNonce
  857.                 },
  858.                 context: this
  859.             }).done(function(shortcodes) {
  860.                 _.each(vc.filters.templates, function(callback) {
  861.                     shortcodes = callback(shortcodes)
  862.                 }), vc.storage.append(shortcodes), vc.shortcodes.fetch({
  863.                     reset: !0
  864.                 })
  865.             })
  866.         },
  867.         getPostContent: function() {
  868.             return vc.storage.getContent()
  869.         }
  870.     }), vc.TemplatesPanelViewBackend = vc.PanelView.extend({
  871.         $name: !1,
  872.         $list: !1,
  873.         template_load_action: "vc_backend_load_template",
  874.         templateLoadPreviewAction: "vc_load_template_preview",
  875.         save_template_action: "vc_save_template",
  876.         delete_template_action: "vc_delete_template",
  877.         appendedTemplateType: "my_templates",
  878.         appendedTemplateCategory: "my_templates",
  879.         appendedCategory: "my_templates",
  880.         appendedClass: "my_templates",
  881.         loadUrl: window.ajaxurl,
  882.         events: $.extend(vc.PanelView.prototype.events, {
  883.             "click .vc_template-save-btn": "saveTemplate",
  884.             "click [data-template_id] [data-template-handler]": "loadTemplate",
  885.             "click .vc_template-delete-icon": "removeTemplate"
  886.         }),
  887.         initialize: function() {
  888.             _.bindAll(this, "checkInput", "saveTemplate"), vc.TemplatesPanelViewBackend.__super__.initialize.call(this)
  889.         },
  890.         render: function() {
  891.             return this.$el.css("left", ($(window).width() - this.$el.width()) / 2), this.$name = this.$el.find('[data-js-element="vc-templates-input"]'), this.$name.off("keypress").on("keypress", this.checkInput), this.$list = this.$el.find(".vc_templates-list-my_templates"), vc.TemplatesPanelViewBackend.__super__.render.call(this)
  892.         },
  893.         saveTemplate: function(e) {
  894.             e && e.preventDefault && e.preventDefault();
  895.             var data, shortcodes, name = this.$name.val(),
  896.                 _this = this;
  897.             return _.isString(name) && name.length ? (shortcodes = this.getPostContent(), shortcodes.trim().length ? (data = {
  898.                 action: this.save_template_action,
  899.                 template: shortcodes,
  900.                 template_name: name,
  901.                 vc_inline: !0,
  902.                 _vcnonce: window.vcAdminNonce
  903.             }, void this.setButtonMessage(void 0, void 0, !0).reloadTemplateList(data, function() {
  904.                 _this.$name.val("").change()
  905.             }, function() {
  906.                 _this.showMessage(window.i18nLocale.template_save_error, "error"), _this.clearButtonMessage()
  907.             })) : (this.showMessage(window.i18nLocale.template_is_empty, "error"), !1)) : (this.showMessage(window.i18nLocale.please_enter_templates_name, "error"), !1)
  908.         },
  909.         checkInput: function(e) {
  910.             if (13 === e.which) return this.saveTemplate(), !1
  911.         },
  912.         removeTemplate: function(e) {
  913.             e && e.preventDefault(), e.stopPropagation();
  914.             var $button = $(e.target),
  915.                 $template = $button.closest("[data-template_id]"),
  916.                 template_name = $template.find('[data-vc-ui-element="template-title"]').text();
  917.             if (confirm(window.i18nLocale.confirm_deleting_template.replace("{template_name}", template_name))) {
  918.                 var template_id = $template.data("template_id"),
  919.                     template_type = $template.data("template_type"),
  920.                     template_action = $template.data("template_action");
  921.                 $template.remove(), $.ajax({
  922.                     type: "POST",
  923.                     url: window.ajaxurl,
  924.                     data: {
  925.                         action: template_action || this.delete_template_action,
  926.                         template_id: template_id,
  927.                         template_type: template_type,
  928.                         vc_inline: !0,
  929.                         _vcnonce: window.vcAdminNonce
  930.                     },
  931.                     context: this
  932.                 }).done(function() {
  933.                     this.showMessage(window.i18nLocale.template_removed, "success"), vc.events.trigger("templates:delete", {
  934.                         id: template_id,
  935.                         type: template_type
  936.                     })
  937.                 })
  938.             }
  939.         },
  940.         reloadTemplateList: function(data, successCallback, errorCallback) {
  941.             var _this = this;
  942.             $.ajax({
  943.                 type: "POST",
  944.                 url: window.ajaxurl,
  945.                 data: data,
  946.                 context: this
  947.             }).done(function(html) {
  948.                 _this.filter = !1, _this.$list || (_this.$list = _this.$el.find(".vc_templates-list-my_templates")), _this.$list.prepend($(html)), "function" == typeof successCallback && successCallback(html)
  949.             }).error("function" == typeof errorCallback ? errorCallback : function() {})
  950.         },
  951.         getPostContent: function() {
  952.             return vc.shortcodes.stringify("template")
  953.         },
  954.         loadTemplate: function(e) {
  955.             e.preventDefault(), e.stopPropagation();
  956.             var $template = $(e.target).closest("[data-template_id][data-template_type]");
  957.             $.ajax({
  958.                 type: "POST",
  959.                 url: this.loadUrl,
  960.                 data: {
  961.                     action: this.template_load_action,
  962.                     template_unique_id: $template.data("template_id"),
  963.                     template_type: $template.data("template_type"),
  964.                     vc_inline: !0,
  965.                     _vcnonce: window.vcAdminNonce
  966.                 },
  967.                 context: this
  968.             }).done(this.renderTemplate)
  969.         },
  970.         renderTemplate: function(html) {
  971.             var models;
  972.             _.each(vc.filters.templates, function(callback) {
  973.                 html = callback(html)
  974.             }), models = vc.storage.parseContent({}, html), _.each(models, function(model) {
  975.                 vc.shortcodes.create(model)
  976.             }), vc.closeActivePanel()
  977.         },
  978.         buildTemplatePreview: function(e) {
  979.             e && e.preventDefault && e.preventDefault();
  980.             try {
  981.                 var url, $el = $(e.currentTarget),
  982.                     $wrapper = $el.closest("[data-template_id]");
  983.                 if ($wrapper.hasClass("vc_active") || $wrapper.hasClass("vc_loading")) $el.vcAccordion("collapseTemplate");
  984.                 else {
  985.                     var $localContent = $wrapper.find("[data-js-content]"),
  986.                         localContentChilds = $localContent.children().length > 0;
  987.                     if (this.$content = $localContent, this.$content.find("iframe").length) return $el.vcAccordion("collapseTemplate"), !0;
  988.                     var _this = this;
  989.                     $el.vcAccordion("collapseTemplate", function() {
  990.                         var templateId = $wrapper.data("template_id"),
  991.                             templateType = $wrapper.data("template_type");
  992.                         if (templateId && !localContentChilds) {
  993.                             var question = "?";
  994.                             window.ajaxurl.indexOf("?") > -1 && (question = "&"), url = window.ajaxurl + question + $.param({
  995.                                 action: _this.templateLoadPreviewAction,
  996.                                 template_unique_id: templateId,
  997.                                 template_type: templateType,
  998.                                 vc_inline: !0,
  999.                                 post_id: $("#post_ID").val(),
  1000.                                 _vcnonce: window.vcAdminNonce
  1001.                             }), $el.find("i").addClass("vc_ui-wp-spinner"), _this.$content.html('<iframe style="width: 100%;" data-vc-template-preview-frame="' + templateId + '"></iframe>');
  1002.                             var $frame = _this.$content.find("[data-vc-template-preview-frame]");
  1003.                             $frame.attr("src", url), $wrapper.addClass("vc_loading"), $frame.load(function() {
  1004.                                 $wrapper.removeClass("vc_loading"), $el.find("i").removeClass("vc_ui-wp-spinner")
  1005.                             })
  1006.                         }
  1007.                     })
  1008.                 }
  1009.             } catch (e) {
  1010.                 window.console && window.console.error && window.console.error(e), this.showMessage("Failed to build preview", "error")
  1011.             }
  1012.         },
  1013.         setTemplatePreviewSize: function(height) {
  1014.             var iframe = this.$content.find("iframe");
  1015.             iframe.length > 0 && (iframe = iframe[0], void 0 === height && (iframe.height = iframe.contentWindow.document.body.offsetHeight, height = iframe.contentWindow.document.body.scrollHeight), iframe.height = height + "px")
  1016.         }
  1017.     }), vc.TemplatesPanelViewFrontend = vc.TemplatesPanelViewBackend.extend({
  1018.         template_load_action: "vc_frontend_load_template",
  1019.         loadUrl: !1,
  1020.         initialize: function() {
  1021.             this.loadUrl = vc.$frame.attr("src"), vc.TemplatesPanelViewFrontend.__super__.initialize.call(this)
  1022.         },
  1023.         render: function() {
  1024.             return vc.TemplatesPanelViewFrontend.__super__.render.call(this)
  1025.         },
  1026.         renderTemplate: function(html) {
  1027.             var template, data;
  1028.             _.each($(html), function(element) {
  1029.                 if ("vc_template-data" === element.id) try {
  1030.                     data = JSON.parse(element.innerHTML)
  1031.                 } catch (e) {
  1032.                     vcConsoleLog(e)
  1033.                 }
  1034.                 "vc_template-html" === element.id && (template = element.innerHTML)
  1035.             }), template && data && vc.builder.buildFromTemplate(template, data) ? this.showMessage(window.i18nLocale.template_added_with_id, "error") : this.showMessage(window.i18nLocale.template_added, "success"), vc.closeActivePanel()
  1036.         }
  1037.     }), vc.RowLayoutEditorPanelView = vc.PanelView.extend({
  1038.         events: {
  1039.             "click [data-dismiss=panel]": "hide",
  1040.             "click [data-transparent=panel]": "toggleOpacity",
  1041.             "mouseover [data-transparent=panel]": "addOpacity",
  1042.             "mouseout [data-transparent=panel]": "removeOpacity",
  1043.             "click .vc_layout-btn": "setLayout",
  1044.             "click #vc_row-layout-update": "updateFromInput"
  1045.         },
  1046.         _builder: !1,
  1047.         render: function(model) {
  1048.             return this.$input = $("#vc_row-layout"), model && (this.model = model), this.addCurrentLayout(), this.resetMinimize(), vc.column_trig_changes = !0, this
  1049.         },
  1050.         builder: function() {
  1051.             return this._builder || (this._builder = new vc.ShortcodesBuilder), this._builder
  1052.         },
  1053.         addCurrentLayout: function() {
  1054.             vc.shortcodes.sort();
  1055.             var string = _.map(vc.shortcodes.where({
  1056.                 parent_id: this.model.get("id")
  1057.             }), function(model) {
  1058.                 var width = model.getParam("width");
  1059.                 return width || "1/1"
  1060.             }, "", this).join(" + ");
  1061.             this.$input.val(string)
  1062.         },
  1063.         isBuildComplete: function() {
  1064.             return this.builder().isBuildComplete()
  1065.         },
  1066.         setLayout: function(e) {
  1067.             if (e && e.preventDefault(), !this.isBuildComplete()) return !1;
  1068.             var $control = $(e.currentTarget),
  1069.                 layout = $control.attr("data-cells"),
  1070.                 columns = this.model.view.convertRowColumns(layout, this.builder());
  1071.             this.$input.val(columns.join(" + "))
  1072.         },
  1073.         updateFromInput: function(e) {
  1074.             if (e && e.preventDefault(), !this.isBuildComplete()) return !1;
  1075.             var layout, cells = this.$input.val();
  1076.             !1 !== (layout = this.validateCellsList(cells)) ? this.model.view.convertRowColumns(layout, this.builder()) : window.alert(window.i18nLocale.wrong_cells_layout)
  1077.         },
  1078.         validateCellsList: function(cells) {
  1079.             var b, num, denom, return_cells = [],
  1080.                 split = cells.replace(/\s/g, "").split("+");
  1081.             return !(1e3 <= _.reduce(_.map(split, function(c) {
  1082.                 if (c.match(/^[vc\_]{0,1}span\d{1,2}$/)) {
  1083.                     var converted_c = vc_convert_column_span_size(c);
  1084.                     return !1 === converted_c ? 1e3 : (b = converted_c.split(/\//), return_cells.push(b[0] + "" + b[1]), 12 * parseInt(b[0], 10) / parseInt(b[1], 10))
  1085.                 }
  1086.                 return c.match(/^[1-9]|1[0-2]\/[1-9]|1[0-2]$/) ? (b = c.split(/\//), num = parseInt(b[0], 10), 0 != 12 % (denom = parseInt(b[1], 10)) || num > denom ? 1e3 : (return_cells.push(num + "" + b[1]), 12 * num / denom)) : 1e3
  1087.             }), function(num, memo) {
  1088.                 return memo += num
  1089.             }, 0)) && return_cells.join("_")
  1090.         }
  1091.     }), vc.RowLayoutEditorPanelViewBackend = vc.RowLayoutEditorPanelView.extend({
  1092.         builder: function() {
  1093.             return this.builder || (this.builder = vc.storage), this.builder
  1094.         },
  1095.         isBuildComplete: function() {
  1096.             return !0
  1097.         },
  1098.         setLayout: function(e) {
  1099.             e && e.preventDefault();
  1100.             var $control = $(e.currentTarget),
  1101.                 layout = $control.attr("data-cells"),
  1102.                 columns = this.model.view.convertRowColumns(layout);
  1103.             this.$input.val(columns.join(" + "))
  1104.         }
  1105.     }), $(window).on("orientationchange", function() {
  1106.         vc.active_panel && vc.active_panel.$el.css({
  1107.             top: "",
  1108.             left: "auto",
  1109.             height: "auto",
  1110.             width: "auto"
  1111.         })
  1112.     }), $(window).bind("resize.fixElContainment", function() {
  1113.         vc.active_panel && vc.active_panel.fixElContainment && vc.active_panel.fixElContainment()
  1114.     }), $("body").on("keyup change input", "[data-vc-disable-empty]", function() {
  1115.         var _this = $(this),
  1116.             $target = $(_this.data("vcDisableEmpty"));
  1117.         _this.val().length ? $target.removeProp("disabled") : $target.prop("disabled", !0)
  1118.     })
  1119. }(window.jQuery),
  1120. function($) {
  1121.     "use strict";
  1122.     var TabsLine, Plugin, old;
  1123.     TabsLine = function(element, options) {
  1124.         var _this = this;
  1125.         this.options = options, this.$element = $(element), this.$dropdownContainer = this.$element.find(this.options.dropdownContainerSelector), this.$dropdown = this.$dropdownContainer.find(this.options.dropdownSelector), this.options.delayInit ? (_this.$element.addClass(this.options.initializingClass), setTimeout(function() {
  1126.             _this.options.autoRefresh || _this.refresh(), _this.moveTabs(), _this.$element.removeClass(_this.options.initializingClass)
  1127.         }, _this.options.delayInitTime)) : (this.options.autoRefresh || this.refresh(), this.moveTabs()), $(window).on("resize", $.proxy(this.moveTabs, this)), this.$dropdownContainer.on("click.vc.tabsLine", $.proxy(this.checkDropdownContainerActive, this))
  1128.     }, TabsLine.DEFAULTS = {
  1129.         initializingClass: "vc_initializing",
  1130.         delayInit: !1,
  1131.         delayInitTime: 1e3,
  1132.         activeClass: "vc_active",
  1133.         visibleClass: "vc_visible",
  1134.         dropdownContainerSelector: '[data-vc-ui-element="panel-tabs-line-toggle"]',
  1135.         dropdownSelector: '[data-vc-ui-element="panel-tabs-line-dropdown"]',
  1136.         tabSelector: '>li:not([data-vc-ui-element="panel-tabs-line-toggle"])',
  1137.         dropdownTabSelector: "li",
  1138.         freeSpaceOffset: 5,
  1139.         autoRefresh: !1,
  1140.         showDevInfo: !1
  1141.     }, TabsLine.prototype.refresh = function() {
  1142.         var addClick, _this = this;
  1143.         return _this.tabs = [], _this.dropdownTabs = [], _this.$element.find(_this.options.tabSelector).each(function() {
  1144.             _this.tabs.push({
  1145.                 $tab: $(this),
  1146.                 width: $(this).outerWidth()
  1147.             })
  1148.         }), _this.$dropdown.find(_this.options.dropdownTabSelector).each(function() {
  1149.             var $tempElement = $(this).clone().css({
  1150.                 visibility: "hidden",
  1151.                 position: "fixed"
  1152.             });
  1153.             $tempElement.appendTo(_this.$element), _this.dropdownTabs.push({
  1154.                 $tab: $(this),
  1155.                 width: $tempElement.outerWidth()
  1156.             }), $tempElement.remove(), $(this).on("click", _this.options.onTabClick)
  1157.         }), "function" == typeof this.options.onTabClick && (addClick = function(el) {
  1158.             void 0 === el.$tab.data("tabClickSet") && (el.$tab.on("click", $.proxy(_this.options.onTabClick, el.$tab)), el.$tab.data("tabClickSet", !0))
  1159.         }, _this.tabs.map(addClick), _this.dropdownTabs.map(addClick)), this
  1160.     }, TabsLine.prototype.moveLastToDropdown = function() {
  1161.         var $element;
  1162.         return this.tabs.length && ($element = this.tabs.pop(), $element.$tab.prependTo(this.$dropdown), this.dropdownTabs.unshift($element)), this.checkDropdownContainer(), this
  1163.     }, TabsLine.prototype.moveFirstToContainer = function() {
  1164.         var $element;
  1165.         return this.dropdownTabs.length && ($element = this.dropdownTabs.shift(), $element.$tab.appendTo(this.$element), this.tabs.push($element)), this.checkDropdownContainer(), this
  1166.     }, TabsLine.prototype.getTabsWidth = function() {
  1167.         var tabsWidth = 0;
  1168.         return this.tabs.forEach(function(entry) {
  1169.             tabsWidth += entry.width
  1170.         }), tabsWidth
  1171.     }, TabsLine.prototype.isDropdownContainerVisible = function() {
  1172.         return this.$dropdownContainer.hasClass(this.options.visibleClass)
  1173.     }, TabsLine.prototype.getFreeSpace = function() {
  1174.         var freeSpace = this.$element.width() - this.getTabsWidth() - this.options.freeSpaceOffset;
  1175.         return this.isDropdownContainerVisible() && (freeSpace -= this.$dropdownContainer.outerWidth(), 1 === this.dropdownTabs.length && 0 <= freeSpace - this.dropdownTabs[0].width + this.$dropdownContainer.outerWidth() && (freeSpace += this.$dropdownContainer.outerWidth())), freeSpace
  1176.     }, TabsLine.prototype.moveTabsToDropdown = function() {
  1177.         for (var tabsCount = this.tabs.length, i = tabsCount - 1; 0 <= i; i--) {
  1178.             if (!(0 > this.getFreeSpace())) return this;
  1179.             this.moveLastToDropdown()
  1180.         }
  1181.         return this
  1182.     }, TabsLine.prototype.moveDropdownToTabs = function() {
  1183.         for (var dropdownTabsCount = this.dropdownTabs.length, i = 0; i < dropdownTabsCount; i++) {
  1184.             if (!(0 <= this.getFreeSpace() - this.dropdownTabs[0].width)) return this;
  1185.             this.moveFirstToContainer()
  1186.         }
  1187.         return this
  1188.     }, TabsLine.prototype.showDropdownContainer = function() {
  1189.         return this.$dropdownContainer.addClass(this.options.visibleClass), this
  1190.     }, TabsLine.prototype.hideDropdownContainer = function() {
  1191.         return this.$dropdownContainer.removeClass(this.options.visibleClass), this
  1192.     }, TabsLine.prototype.activateDropdownContainer = function() {
  1193.         return this.$dropdownContainer.addClass(this.options.activeClass), this
  1194.     }, TabsLine.prototype.deactivateDropdownContainer = function() {
  1195.         return this.$dropdownContainer.removeClass(this.options.activeClass), this
  1196.     }, TabsLine.prototype.checkDropdownContainerActive = function() {
  1197.         return this.$dropdown.find("." + this.options.activeClass + ":first").length ? this.activateDropdownContainer() : this.deactivateDropdownContainer(), this
  1198.     }, TabsLine.prototype.checkDropdownContainer = function() {
  1199.         return this.dropdownTabs.length ? this.showDropdownContainer() : this.hideDropdownContainer(), this.checkDropdownContainerActive(), this
  1200.     }, TabsLine.prototype.moveTabs = function() {
  1201.         return this.options.autoRefresh && this.refresh(), this.checkDropdownContainer(), this.moveTabsToDropdown(), this.moveDropdownToTabs(), this.options.showDevInfo && this.showDevInfo(), this
  1202.     }, TabsLine.prototype.showDevInfo = function() {
  1203.         var $devInfoBlock = $("#vc-ui-tabs-line-dev-info");
  1204.         $devInfoBlock.length && (this.$devBlock = $devInfoBlock), void 0 === this.$devBlock && (this.$devBlock = $('<div id="vc-ui-tabs-line-dev-info" />').css({
  1205.             position: "fixed",
  1206.             right: "40px",
  1207.             top: "40px",
  1208.             padding: "7px 12px",
  1209.             border: "1px solid rgba(0, 0, 0, .2)",
  1210.             background: "rgba(0, 0, 0, .7)",
  1211.             color: "#0a0",
  1212.             "border-radius": "5px",
  1213.             "font-family": "tahoma",
  1214.             "font-size": "12px",
  1215.             "z-index": 1100
  1216.         }), this.$devBlock.appendTo("body")), void 0 === this.$devInfo && (this.$devInfo = $("<div />").css({
  1217.             "margin-bottom": "7px",
  1218.             "padding-bottom": "7px",
  1219.             "border-bottom": "1px dashed rgba(0, 200, 0, .35)"
  1220.         }), this.$devInfo.appendTo(this.$devBlock)), this.$devInfo.empty(), this.$devInfo.append($("<div />").text("Tabs count: " + this.tabs.length)), this.$devInfo.append($("<div />").text("Dropdown count: " + this.dropdownTabs.length)), this.$devInfo.append($("<div />").text("El width: " + this.$element.width())), this.$devInfo.append($("<div />").text("Tabs width: " + this.getTabsWidth())), this.$devInfo.append($("<div />").text("Tabs width with dots: " + (this.getTabsWidth() + this.$dropdownContainer.outerWidth()))), this.$devInfo.append($("<div />").text("Free space: " + this.getFreeSpace())), this.tabs.length && this.$devInfo.append($("<div />").text("Last tab width: " + this.tabs[this.tabs.length - 1].width)), this.dropdownTabs.length && this.$devInfo.append($("<div />").text("First dropdown tab width: " + this.dropdownTabs[0].width))
  1221.     }, Plugin = function(option) {
  1222.         return this.each(function() {
  1223.             var $this = $(this),
  1224.                 optionsData = $this.data("vcUiTabsLine"),
  1225.                 data = $this.data("vc.tabsLine"),
  1226.                 options = $.extend(!0, {}, TabsLine.DEFAULTS, $this.data(), optionsData, "object" == typeof option && option),
  1227.                 action = "string" == typeof option ? option : options.action;
  1228.             data || $this.data("vc.tabsLine", data = new TabsLine(this, options)), action && data[action]()
  1229.         })
  1230.     }, old = $.fn.vcTabsLine, $.fn.vcTabsLine = Plugin, $.fn.vcTabsLine.Constructor = TabsLine, $.fn.vcTabsLine.noConflict = function() {
  1231.         return $.fn.vcTabsLine = old, this
  1232.     }, $(window).on("load", function() {
  1233.         $("[data-vc-ui-tabs-line]").each(function() {
  1234.             var $vcTabsLine = $(this);
  1235.             Plugin.call($vcTabsLine, $vcTabsLine.data())
  1236.         })
  1237.     })
  1238. }(window.jQuery),
  1239. function($) {
  1240.     "use strict";
  1241.     vc.HelperAjax = {
  1242.         ajax: !1,
  1243.         checkAjax: function() {
  1244.             this.ajax && this.ajax.abort()
  1245.         },
  1246.         resetAjax: function() {
  1247.             this.ajax = !1
  1248.         }
  1249.     }
  1250. }(window.jQuery),
  1251. function($) {
  1252.     "use strict";
  1253.     vc.HelperPrompts = {
  1254.         uiEvents: {
  1255.             render: "removeAllPrompts"
  1256.         },
  1257.         removeAllPrompts: function() {
  1258.             this.$el.find(".vc_ui-panel-content-container").removeClass("vc_ui-content-hidden"), this.$el.find(".vc_ui-prompt").remove()
  1259.         }
  1260.     }
  1261. }(window.jQuery),
  1262. function($) {
  1263.     "use strict";
  1264.     vc.HelperPanelViewDraggable = {
  1265.         draggable: !0,
  1266.         draggableOptions: {
  1267.             iframeFix: !0,
  1268.             handle: '[data-vc-ui-element="panel-heading"]'
  1269.         },
  1270.         uiEvents: {
  1271.             show: "initDraggable"
  1272.         },
  1273.         initDraggable: function() {
  1274.             this.$el.draggable(_.extend({}, this.draggableOptions, {
  1275.                 start: this.fixElContainment,
  1276.                 stop: this.fixElContainment
  1277.             }))
  1278.         }
  1279.     }
  1280. }(window.jQuery),
  1281. function($) {
  1282.     "use strict";
  1283.     vc.HelperPanelViewResizable = {
  1284.         sizeInitialized: !1,
  1285.         uiEvents: {
  1286.             show: "setSavedSize initResize",
  1287.             tabChange: "setDefaultHeightSettings",
  1288.             afterMinimize: "setupOnMinimize",
  1289.             afterUnminimize: "initResize",
  1290.             fixElContainment: "saveUIPanelSizes"
  1291.         },
  1292.         setDefaultHeightSettings: function() {
  1293.             this.$el.css("height", "auto"), this.$el.css("maxHeight", "75vh")
  1294.         },
  1295.         initResize: function() {
  1296.             var _this = this;
  1297.             this.$el.data("uiResizable") && this.$el.resizable("destroy"), this.$el.resizable({
  1298.                 minHeight: 240,
  1299.                 minWidth: 380,
  1300.                 resize: function() {
  1301.                     _this.trigger("resize")
  1302.                 },
  1303.                 handles: "n, e, s, w, ne, se, sw, nw",
  1304.                 start: function(e, ui) {
  1305.                     _this.trigger("beforeResizeStart"), _this.$el.css("maxHeight", "none"), _this.$el.css("height", ui.size.height), $("iframe").css("pointerEvents", "none"), _this.trigger("afterResizeStart")
  1306.                 },
  1307.                 stop: function() {
  1308.                     _this.trigger("beforeResizeStop"), $("iframe").css("pointerEvents", ""), _this.saveUIPanelSizes(), _this.trigger("afterResizeStop")
  1309.                 }
  1310.             }), this.content().addClass("vc_properties-list-init"), this.trigger("resize")
  1311.         },
  1312.         setSavedSize: function() {
  1313.             if (this.setDefaultHeightSettings(), vc.is_mobile) return !1;
  1314.             var sizes = {
  1315.                 width: getUserSetting(this.panelName + "_vcUIPanelWidth"),
  1316.                 left: getUserSetting(this.panelName + "_vcUIPanelLeft").replace("minus", "-"),
  1317.                 top: getUserSetting(this.panelName + "_vcUIPanelTop").replace("minus", "-")
  1318.             };
  1319.             _.isEmpty(sizes.width) || this.$el.width(sizes.width), _.isEmpty(sizes.left) || this.$el.css("left", sizes.left), _.isEmpty(sizes.top) || this.$el.css("top", sizes.top), this.sizeInitialized = !0
  1320.         },
  1321.         saveUIPanelSizes: function() {
  1322.             if (!1 === this.sizeInitialized) return !1;
  1323.             var sizes = {
  1324.                 width: this.$el.width(),
  1325.                 left: parseInt(this.$el.css("left"), 10),
  1326.                 top: parseInt(this.$el.css("top"), 10)
  1327.             };
  1328.             setUserSetting(this.panelName + "_vcUIPanelWidth", sizes.width), setUserSetting(this.panelName + "_vcUIPanelLeft", sizes.left.toString().replace("-", "minus") + "px"), setUserSetting(this.panelName + "_vcUIPanelTop", sizes.top.toString().replace("-", "minus") + "px")
  1329.         },
  1330.         setupOnMinimize: function() {
  1331.             this.$el.data("uiResizable") && this.$el.resizable("destroy"), this.$el.resizable({
  1332.                 minWidth: 380,
  1333.                 handles: "w, e",
  1334.                 start: function(e) {
  1335.                     $("iframe").css("pointerEvents", "none")
  1336.                 },
  1337.                 stop: function() {
  1338.                     $("iframe").css("pointerEvents", "")
  1339.                 }
  1340.             })
  1341.         }
  1342.     }
  1343. }(window.jQuery),
  1344. function($) {
  1345.     "use strict";
  1346.     vc.HelperTemplatesPanelViewSearch = {
  1347.         searchSelector: "[data-vc-templates-name-filter]",
  1348.         events: {
  1349.             "keyup [data-vc-templates-name-filter]": "searchTemplate",
  1350.             "search [data-vc-templates-name-filter]": "searchTemplate"
  1351.         },
  1352.         uiEvents: {
  1353.             show: "focusToSearch"
  1354.         },
  1355.         focusToSearch: function() {
  1356.             vc.is_mobile || $(this.searchSelector, this.$el).focus()
  1357.         },
  1358.         searchTemplate: function(e) {
  1359.             var $el = $(e.currentTarget);
  1360.             $el.val().length ? this.searchByName($el.val()) : this.clearSearch()
  1361.         },
  1362.         clearSearch: function() {
  1363.             this.$el.find("[data-vc-templates-name-filter]").val(""), this.$el.find("[data-template_name]").css("display", "block"), this.$el.removeAttr("data-vc-template-search"), this.$el.find(".vc-search-result-empty").removeClass("vc-search-result-empty");
  1364.             var ev = new jQuery.Event("click");
  1365.             ev.isClearSearch = !0, this.$el.find('.vc_panel-tabs-control:first [data-vc-ui-element="panel-tab-control"]').trigger(ev)
  1366.         },
  1367.         searchByName: function(name) {
  1368.             this.$el.find(".vc_panel-tabs-control.vc_active").removeClass("vc_active"), this.$el.attr("data-vc-template-search", "true"), this.$el.find("[data-template_name]").css("display", "none"), this.$el.find('[data-template_name*="' + vc_slugify(name) + '"]').css("display", "block"), this.$el.find('[data-vc-ui-element="panel-edit-element-tab"]').each(function() {
  1369.                 var $el = $(this);
  1370.                 $el.removeClass("vc-search-result-empty"), $el.find("[data-template_name]:visible").length || $el.addClass("vc-search-result-empty")
  1371.             })
  1372.         }
  1373.     }
  1374. }(window.jQuery),
  1375. function($) {
  1376.     "use strict";
  1377.     vc.HelperPanelViewHeaderFooter = {
  1378.         buttonMessageTimeout: !1,
  1379.         events: {
  1380.             'click [data-vc-ui-element="button-save"]': "save",
  1381.             'click [data-vc-ui-element="button-close"]': "hide",
  1382.             'click [data-vc-ui-element="button-minimize"]': "toggleOpacity"
  1383.         },
  1384.         uiEvents: {
  1385.             save: "setButtonMessage",
  1386.             render: "clearButtonMessage"
  1387.         },
  1388.         resetMinimize: function() {
  1389.             this.$el.removeClass("vc_panel-opacity"), this.$el.removeClass("vc_minimized")
  1390.         },
  1391.         toggleOpacity: function(e) {
  1392.             e.preventDefault();
  1393.             var _this = this,
  1394.                 $target = this.$el,
  1395.                 $panel = $target.find($target.data("vcPanel")),
  1396.                 $panelContainer = $panel.closest($panel.data("vcPanelContainer")),
  1397.                 $trigger = $(e.currentTarget);
  1398.             void 0 === $target.data("vcHasHeight") && $target.data("vcHasHeight", function($element, property) {
  1399.                 var styles = $element.attr("style"),
  1400.                     hasStyle = !1;
  1401.                 return styles && styles.split(";").forEach(function(e) {
  1402.                     var style = e.split(":");
  1403.                     "height" === $.trim(style[0]) && (hasStyle = !0)
  1404.                 }), hasStyle
  1405.             }($target)), $target.hasClass("vc_minimized") ? (void 0 === $target.data("vcMinimizeHeight") && $target.data("vcMinimizeHeight", $(window).height() - .2 * $(window).height()), $target.animate({
  1406.                 height: $target.data("vcMinimizeHeight")
  1407.             }, {
  1408.                 duration: 400,
  1409.                 start: function() {
  1410.                     $trigger.prop("disabled", !0), $target.addClass("vc_animating"), _this.tabsMenu && _this.tabsMenu() && _this.tabsMenu().vcTabsLine("moveTabs")
  1411.                 },
  1412.                 complete: function() {
  1413.                     $target.removeClass("vc_minimized"), $target.removeClass("vc_animating"), $target.data("vcHasHeight") || $target.css({
  1414.                         height: ""
  1415.                     }), _this.trigger("afterUnminimize"), $trigger.prop("disabled", !1)
  1416.                 }
  1417.             })) : ($target.data("vcMinimizeHeight", $target.height()), $target.animate({
  1418.                 height: $panel.outerHeight() + $panelContainer.outerHeight() - $panelContainer.height()
  1419.             }, {
  1420.                 duration: 400,
  1421.                 start: function() {
  1422.                     $trigger.prop("disabled", !0), $target.addClass("vc_animating")
  1423.                 },
  1424.                 complete: function() {
  1425.                     $target.addClass("vc_minimized"), $target.removeClass("vc_animating"), $target.css({
  1426.                         height: ""
  1427.                     }), _this.trigger("afterMinimize"), $trigger.prop("disabled", !1)
  1428.                 }
  1429.             }))
  1430.         },
  1431.         setButtonMessage: function(message, type, showInBackend) {
  1432.             var currentTextHtml, $saveBtn;
  1433.             return void 0 === showInBackend && (showInBackend = !1), this.clearButtonMessage = _.bind(this.clearButtonMessage, this), !showInBackend && !vc.frame_window || this.buttonMessageTimeout ? this : (void 0 === message && (message = window.i18nLocale.ui_saved), void 0 === type && (type = "success"), $saveBtn = this.$el.find('[data-vc-ui-element="button-save"]'), currentTextHtml = $saveBtn.html(), $saveBtn.addClass("vc_ui-button-" + type + " vc_ui-button-undisabled").removeClass("vc_ui-button-action").data("vcCurrentTextHtml", currentTextHtml).data("vcCurrentTextType", type).html(message), _.delay(this.clearButtonMessage, 5e3), this.buttonMessageTimeout = !0, this)
  1434.         },
  1435.         clearButtonMessage: function() {
  1436.             var type, currentTextHtml, $saveBtn;
  1437.             this.buttonMessageTimeout && (window.clearTimeout(this.buttonMessageTimeout), $saveBtn = this.$el.find('[data-vc-ui-element="button-save"]'), currentTextHtml = $saveBtn.data("vcCurrentTextHtml") || "Save", type = $saveBtn.data("vcCurrentTextType"), $saveBtn.html(currentTextHtml).removeClass("vc_ui-button-" + type + " vc_ui-button-undisabled").addClass("vc_ui-button-action"), this.buttonMessageTimeout = !1)
  1438.         }
  1439.     }
  1440. }(window.jQuery),
  1441. function($) {
  1442.     "use strict";
  1443.     vc.TemplateWindowUIPanelBackendEditor = vc.TemplatesPanelViewBackend.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperTemplatesPanelViewSearch).extend({
  1444.         panelName: "template_window",
  1445.         showMessageDisabled: !1,
  1446.         initialize: function() {
  1447.             vc.TemplateWindowUIPanelBackendEditor.__super__.initialize.call(this), this.trigger("show", this.initTemplatesTabs, this)
  1448.         },
  1449.         show: function() {
  1450.             this.clearSearch(), vc.TemplateWindowUIPanelBackendEditor.__super__.show.call(this)
  1451.         },
  1452.         initTemplatesTabs: function() {
  1453.             this.$el.find('[data-vc-ui-element="panel-tabs-controls"]').vcTabsLine("moveTabs")
  1454.         },
  1455.         showMessage: function(text, type) {
  1456.             var wrapperCssClasses;
  1457.             if (this.showMessageDisabled) return !1;
  1458.             wrapperCssClasses = "vc_col-xs-12 wpb_element_wrapper", this.message_box_timeout && this.$el.find("[data-vc-panel-message]").remove() && window.clearTimeout(this.message_box_timeout), this.message_box_timeout = !1;
  1459.             var $messageBox, messageBoxTemplate = vc.template('<div class="vc_message_box vc_message_box-standard vc_message_box-rounded vc_color-<%- color %>"><div class="vc_message_box-icon"><i class="fa fa fa-<%- icon %>"></i></div><p><%- text %></p></div>');
  1460.             switch (type) {
  1461.                 case "error":
  1462.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1463.                         color: "danger",
  1464.                         icon: "times",
  1465.                         text: text
  1466.                     }));
  1467.                     break;
  1468.                 case "warning":
  1469.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1470.                         color: "warning",
  1471.                         icon: "exclamation-triangle",
  1472.                         text: text
  1473.                     }));
  1474.                     break;
  1475.                 case "success":
  1476.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1477.                         color: "success",
  1478.                         icon: "check",
  1479.                         text: text
  1480.                     }))
  1481.             }
  1482.             $messageBox.prependTo(this.$el.find('[data-vc-ui-element="panel-edit-element-tab"].vc_row.vc_active')), $messageBox.fadeIn(), this.message_box_timeout = window.setTimeout(function() {
  1483.                 $messageBox.remove()
  1484.             }, 6e3)
  1485.         },
  1486.         changeTab: function(e) {
  1487.             e.preventDefault(), e && !e.isClearSearch && this.clearSearch();
  1488.             var $tab = $(e.currentTarget);
  1489.             $tab.parent().hasClass("vc_active") || (this.$el.find('[data-vc-ui-element="panel-tabs-controls"] .vc_active:not([data-vc-ui-element="panel-tabs-line-dropdown"])').removeClass("vc_active"), $tab.parent().addClass("vc_active"), this.$el.find('[data-vc-ui-element="panel-edit-element-tab"].vc_active').removeClass("vc_active"), this.$el.find($tab.data("vcUiElementTarget")).addClass("vc_active"), this.$tabsMenu && this.$tabsMenu.vcTabsLine("checkDropdownContainerActive"))
  1490.         },
  1491.         setPreviewFrameHeight: function(templateID, height) {
  1492.             parseInt(height) < 100 && (height = 100), $('data-vc-template-preview-frame="' + templateID + '"').height(height)
  1493.         }
  1494.     }), vc.TemplateWindowUIPanelBackendEditor.prototype.events = $.extend(!0, vc.TemplateWindowUIPanelBackendEditor.prototype.events, {
  1495.         'click [data-vc-ui-element="button-save"]': "save",
  1496.         'click [data-vc-ui-element="button-close"]': "hide",
  1497.         'click [data-vc-ui-element="button-minimize"]': "toggleOpacity",
  1498.         "keyup [data-vc-templates-name-filter]": "searchTemplate",
  1499.         "search [data-vc-templates-name-filter]": "searchTemplate",
  1500.         "click .vc_template-save-btn": "saveTemplate",
  1501.         "click [data-template_id] [data-template-handler]": "loadTemplate",
  1502.         'click [data-vc-container=".vc_ui-list-bar"][data-vc-preview-handler]': "buildTemplatePreview",
  1503.         'click [data-vc-ui-delete="template-title"]': "removeTemplate",
  1504.         'click [data-vc-ui-element="panel-tab-control"]': "changeTab"
  1505.     }), vc.TemplateWindowUIPanelFrontendEditor = vc.TemplatesPanelViewFrontend.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperTemplatesPanelViewSearch).extend({
  1506.         panelName: "template_window",
  1507.         showMessageDisabled: !1,
  1508.         show: function() {
  1509.             this.clearSearch(), vc.TemplateWindowUIPanelFrontendEditor.__super__.show.call(this)
  1510.         },
  1511.         showMessage: function(text, type) {
  1512.             if (this.showMessageDisabled) return !1;
  1513.             this.message_box_timeout && this.$el.find("[data-vc-panel-message]").remove() && window.clearTimeout(this.message_box_timeout), this.message_box_timeout = !1;
  1514.             var $messageBox, wrapperCssClasses, messageBoxTemplate = vc.template('<div class="vc_message_box vc_message_box-standard vc_message_box-rounded vc_color-<%- color %>"><div class="vc_message_box-icon"><i class="fa fa fa-<%- icon %>"></i></div><p><%- text %></p></div>');
  1515.             switch (wrapperCssClasses = "vc_col-xs-12 wpb_element_wrapper", type) {
  1516.                 case "error":
  1517.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1518.                         color: "danger",
  1519.                         icon: "times",
  1520.                         text: text
  1521.                     }));
  1522.                     break;
  1523.                 case "warning":
  1524.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1525.                         color: "warning",
  1526.                         icon: "exclamation-triangle",
  1527.                         text: text
  1528.                     }));
  1529.                     break;
  1530.                 case "success":
  1531.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  1532.                         color: "success",
  1533.                         icon: "check",
  1534.                         text: text
  1535.                     }))
  1536.             }
  1537.             $messageBox.prependTo(this.$el.find('[data-vc-ui-element="panel-edit-element-tab"].vc_row.vc_active')), $messageBox.fadeIn(), this.message_box_timeout = window.setTimeout(function() {
  1538.                 $messageBox.remove()
  1539.             }, 6e3)
  1540.         },
  1541.         changeTab: function(e) {
  1542.             e.preventDefault(), e && !e.isClearSearch && this.clearSearch();
  1543.             var $tab = $(e.currentTarget);
  1544.             $tab.parent().hasClass("vc_active") || (this.$el.find('[data-vc-ui-element="panel-tabs-controls"] .vc_active:not([data-vc-ui-element="panel-tabs-line-dropdown"])').removeClass("vc_active"), $tab.parent().addClass("vc_active"), this.$el.find('[data-vc-ui-element="panel-edit-element-tab"].vc_active').removeClass("vc_active"), this.$el.find($tab.data("vcUiElementTarget")).addClass("vc_active"), this.$tabsMenu && this.$tabsMenu.vcTabsLine("checkDropdownContainerActive"))
  1545.         }
  1546.     }), $.fn.vcAccordion.Constructor.prototype.collapseTemplate = function(showCallback) {
  1547.         var $allTriggers, $activeTriggers, $this, $triggers;
  1548.         $this = this.$element;
  1549.         var i;
  1550.         if (i = 0, $allTriggers = this.getContainer().find("[data-vc-preview-handler]").each(function() {
  1551.                 var accordion, $this;
  1552.                 $this = $(this), accordion = $this.data("vc.accordion"), void 0 === accordion && ($this.vcAccordion(), accordion = $this.data("vc.accordion")), accordion && accordion.setIndex && accordion.setIndex(i++)
  1553.             }), $activeTriggers = $allTriggers.filter(function() {
  1554.                 var $this, accordion;
  1555.                 return $this = $(this), accordion = $this.data("vc.accordion"), accordion.getTarget().hasClass(accordion.activeClass)
  1556.             }), $triggers = $activeTriggers.filter(function() {
  1557.                 return $this[0] !== this
  1558.             }), $triggers.length && $.fn.vcAccordion.call($triggers, "hide"), this.isActive()) $.fn.vcAccordion.call($this, "hide");
  1559.         else {
  1560.             $.fn.vcAccordion.call($this, "show");
  1561.             var $triggerPanel = $this.closest(".vc_ui-list-bar-item"),
  1562.                 $wrapper = $this.closest("[data-template_id]"),
  1563.                 $panel = $wrapper.closest("[data-vc-ui-element=panel-content]").parent();
  1564.             setTimeout(function() {
  1565.                 if (Math.round($wrapper.offset().top - $panel.offset().top) < 0) {
  1566.                     var posit = Math.round($wrapper.offset().top - $panel.offset().top + $panel.scrollTop() - $triggerPanel.height());
  1567.                     $panel.animate({
  1568.                         scrollTop: posit
  1569.                     }, 400)
  1570.                 }
  1571.                 "function" == typeof showCallback && showCallback($wrapper, $panel)
  1572.             }, 400)
  1573.         }
  1574.     }
  1575. }(window.jQuery),
  1576. function($) {
  1577.     "use strict";
  1578.     vc.element_start_index = 0, vc.AddElementUIPanelBackendEditor = vc.PanelView.vcExtendUI(vc.HelperPanelViewHeaderFooter).extend({
  1579.         el: "#vc_ui-panel-add-element",
  1580.         searchSelector: "#vc_elements_name_filter",
  1581.         prepend: !1,
  1582.         builder: "",
  1583.         events: {
  1584.             'click [data-vc-ui-element="button-close"]': "hide",
  1585.             'click [data-vc-ui-element="panel-tab-control"]': "filterElements",
  1586.             "click .vc_shortcode-link": "createElement",
  1587.             "keyup #vc_elements_name_filter": "filterElements",
  1588.             "search #vc_elements_name_filter": "filterElements",
  1589.             "click [data-vc-manage-elements]": "openPresetWindow"
  1590.         },
  1591.         initialize: function() {
  1592.             vc.AddElementUIPanelBackendEditor.__super__.initialize.call(this), vc.events.on("shortcodes:add", this.addCustomCssStyleTag.bind(this)), vc.events.on("vc:savePreset", this.updateAddElementPopUp.bind(this)), vc.events.on("vc:deletePreset", this.removePresetFromAddElementPopUp.bind(this))
  1593.         },
  1594.         render: function(model, prepend) {
  1595.             return _.isUndefined(vc.ShortcodesBuilder) || (this.builder = new vc.ShortcodesBuilder), this.$el.is(":hidden") && vc.closeActivePanel(), vc.active_panel = this, this.prepend = !!_.isBoolean(prepend) && prepend, this.place_after_id = !!_.isString(prepend) && prepend, this.model = !!_.isObject(model) && model, this.$content = this.$el.find('[data-vc-ui-element="panel-add-element-list"]'), this.$buttons = $('[data-vc-ui-element="add-element-button"]', this.$content), this.buildFiltering(), this.$el.find('[data-vc-ui-element="panel-tab-control"]').eq(0).click(), this.show(), this.$el.find('[data-vc-ui-element="panel-tabs-controls"]').vcTabsLine("moveTabs"), vc.is_mobile || $(this.searchSelector).focus(), vc.AddElementUIPanelBackendEditor.__super__.render.call(this)
  1596.         },
  1597.         buildFiltering: function() {
  1598.             var itemSelector, tag, notIn, asParent, parentSelector;
  1599.             itemSelector = '[data-vc-ui-element="add-element-button"]', notIn = this._getNotIn(this.model ? this.model.get("shortcode") : ""), $(this.searchSelector).val(""), this.$content.addClass("vc_filter-all"), this.$content.attr("data-vc-ui-filter", "*"), tag = this.model ? this.model.get("shortcode") : "vc_column", asParent = !(!tag || _.isUndefined(vc.getMapped(tag).as_parent)) && vc.getMapped(tag).as_parent, _.isObject(asParent) ? (parentSelector = [], _.isString(asParent.only) && parentSelector.push(_.reduce(asParent.only.replace(/\s/, "").split(","), function(memo, val) {
  1600.                 return memo + (_.isEmpty(memo) ? "" : ",") + '[data-element="' + val.trim() + '"]'
  1601.             }, "")), _.isString(asParent.except) && parentSelector.push(_.reduce(asParent.except.replace(/\s/, "").split(","), function(memo, val) {
  1602.                 return memo + ':not([data-element="' + val.trim() + '"])'
  1603.             }, "")), itemSelector += parentSelector.join(",")) : notIn && (itemSelector = notIn), !1 === tag || _.isUndefined(vc.getMapped(tag).allowed_container_element) || (!1 === vc.getMapped(tag).allowed_container_element ? itemSelector += ":not([data-is-container=true])" : _.isString(vc.getMapped(tag).allowed_container_element) && (itemSelector += ":not([data-is-container=true]), [data-element=" + vc.getMapped(tag).allowed_container_element + "]")), this.$buttons.removeClass("vc_visible").addClass("vc_inappropriate"), $(itemSelector, this.$content).removeClass("vc_inappropriate").addClass("vc_visible"), this.hideEmptyFilters()
  1604.         },
  1605.         hideEmptyFilters: function() {
  1606.             var _this = this;
  1607.             this.$el.find('[data-vc-ui-element="panel-add-element-tab"].vc_active').removeClass("vc_active"), this.$el.find('[data-vc-ui-element="panel-add-element-tab"]:first').addClass("vc_active"), this.$el.find("[data-filter]").each(function() {
  1608.                 $($(this).data("filter") + ".vc_visible:not(.vc_inappropriate)", _this.$content).length ? $(this).parent().show() : $(this).parent().hide()
  1609.             })
  1610.         },
  1611.         _getNotIn: _.memoize(function(tag) {
  1612.             return '[data-vc-ui-element="add-element-button"]:not(' + _.reduce(vc.map, function(memo, shortcode) {
  1613.                 var separator;
  1614.                 return separator = _.isEmpty(memo) ? "" : ",", _.isObject(shortcode.as_child) ? (_.isString(shortcode.as_child.only) && (_.contains(shortcode.as_child.only.replace(/\s/, "").split(","), tag) || (memo += separator + "[data-element=" + shortcode.base + "]")), _.isString(shortcode.as_child.except) && _.contains(shortcode.as_child.except.replace(/\s/, "").split(","), tag) && (memo += separator + "[data-element=" + shortcode.base + "]")) : !1 === shortcode.as_child && (memo += separator + "[data-element=" + shortcode.base + "]"), memo
  1615.             }, "") + ")"
  1616.         }),
  1617.         filterElements: function(e) {
  1618.             _.isObject(e) ? e.preventDefault() && e.stopPropagation() : e = window.event;
  1619.             var filterValue, $visibleElements, $control = $(e.currentTarget),
  1620.                 filter = '[data-vc-ui-element="add-element-button"]',
  1621.                 nameFilter = $(this.searchSelector).val();
  1622.             this.$content.removeClass("vc_filter-all"), $('[data-vc-ui-element="panel-add-element-tab"].vc_active').removeClass("vc_active"), $control.is("[data-filter]") ? ($control.parent().addClass("vc_active"), filterValue = $control.data("filter"), filter += filterValue, "*" === filterValue ? this.$content.addClass("vc_filter-all") : this.$content.removeClass("vc_filter-all"), this.$content.attr("data-vc-ui-filter", filterValue.replace(".js-category-", "")), $(this.searchSelector).val("")) : nameFilter.length ? (filter += ":containsi('" + nameFilter + "'):not('.vc_element-deprecated')", this.$content.attr("data-vc-ui-filter", "name:" + nameFilter)) : nameFilter.length || ($('[data-vc-ui-element="panel-tab-control"][data-filter="*"]').parent().addClass("vc_active"), this.$content.attr("data-vc-ui-filter", "*").addClass("vc_filter-all")), $(".vc_visible", this.$content).removeClass("vc_visible"), $(filter, this.$content).addClass("vc_visible"), nameFilter.length && 13 === (e.keyCode || e.which) && ($visibleElements = $(".vc_visible:not(.vc_inappropriate)", this.$content), 1 === $visibleElements.length && $visibleElements.find("[data-vc-clickable]").click())
  1623.         },
  1624.         createElement: function(e) {
  1625.             e && e.preventDefault && e.preventDefault();
  1626.             var model, column, row, showSettings, row_params, inner_row_params, column_params, inner_column_params, tag, $control, preset, presetType, closestPreset;
  1627.             if ($control = $(e.currentTarget), tag = $control.data("tag"), row_params = {}, column_params = {
  1628.                     width: "1/1"
  1629.                 }, closestPreset = $control.closest("[data-preset]"), closestPreset && (preset = closestPreset.data("preset"), presetType = closestPreset.data("element")), !1 === this.model)
  1630.                 if (vc.storage.lock(), "vc_section" === tag) {
  1631.                     var modelOptions = {
  1632.                         shortcode: tag
  1633.                     };
  1634.                     preset && "vc_section" === presetType && (modelOptions.preset = preset), model = vc.shortcodes.create(modelOptions)
  1635.                 } else {
  1636.                     var rowOptions = {
  1637.                         shortcode: "vc_row",
  1638.                         params: row_params
  1639.                     };
  1640.                     preset && presetType === tag && (rowOptions.preset = preset), row = vc.shortcodes.create(rowOptions);
  1641.                     var columnOptions = {
  1642.                         shortcode: "vc_column",
  1643.                         params: column_params,
  1644.                         parent_id: row.id,
  1645.                         root_id: row.id
  1646.                     };
  1647.                     if (preset && "vc_column" === presetType && (columnOptions.preset = preset), column = vc.shortcodes.create(columnOptions), model = row, "vc_row" !== tag) {
  1648.                         var options = {
  1649.                             shortcode: tag,
  1650.                             parent_id: column.id,
  1651.                             root_id: row.id
  1652.                         };
  1653.                         preset && presetType === tag && (options.preset = preset), model = vc.shortcodes.create(options)
  1654.                     }
  1655.                 } else if ("vc_row" === tag) "vc_section" === this.model.get("shortcode") ? (vc.storage.lock(), row = vc.shortcodes.create({
  1656.                 shortcode: "vc_row",
  1657.                 params: row_params,
  1658.                 parent_id: this.model.id,
  1659.                 order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.getNextOrder()
  1660.             }), column = vc.shortcodes.create({
  1661.                 shortcode: "vc_column",
  1662.                 params: column_params,
  1663.                 parent_id: row.id,
  1664.                 root_id: row.id
  1665.             }), model = row) : (inner_row_params = {}, inner_column_params = {
  1666.                 width: "1/1"
  1667.             }, vc.storage.lock(), row = vc.shortcodes.create({
  1668.                 shortcode: "vc_row_inner",
  1669.                 params: inner_row_params,
  1670.                 parent_id: this.model.id,
  1671.                 order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.getNextOrder()
  1672.             }), column = vc.shortcodes.create({
  1673.                 shortcode: "vc_column_inner",
  1674.                 params: inner_column_params,
  1675.                 parent_id: row.id,
  1676.                 root_id: row.id
  1677.             }), model = row);
  1678.             else {
  1679.                 var options = {
  1680.                     shortcode: tag,
  1681.                     parent_id: this.model.id,
  1682.                     order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.getNextOrder(),
  1683.                     root_id: this.model.get("root_id")
  1684.                 };
  1685.                 preset && presetType === tag && (options.preset = preset), model = vc.shortcodes.create(options)
  1686.             }
  1687.             this.model = model, showSettings = !(_.isBoolean(vc.getMapped(tag).show_settings_on_create) && !1 === vc.getMapped(tag).show_settings_on_create), this.model.get("shortcode"), this.hide(), showSettings && this.showEditForm()
  1688.         },
  1689.         getFirstPositionIndex: function() {
  1690.             return vc.element_start_index -= 1, vc.element_start_index
  1691.         },
  1692.         show: function() {
  1693.             this.$el.addClass("vc_active"), this.trigger("show")
  1694.         },
  1695.         hide: function() {
  1696.             this.$el.removeClass("vc_active"), vc.active_panel = !1, this.trigger("hide")
  1697.         },
  1698.         showEditForm: function() {
  1699.             vc.edit_element_block_view.render(this.model)
  1700.         },
  1701.         addCustomCssStyleTag: function(model) {
  1702.             if (model && model.getParam) {
  1703.                 var customCss;
  1704.                 customCss = model.getParam("css"), customCss && vc.frame_window && vc.frame_window.vc_iframe.setCustomShortcodeCss(customCss)
  1705.             }
  1706.         },
  1707.         updateAddElementPopUp: function(id, shortcode, title, data) {
  1708.             var $presetShortcode = this.$el.find('[data-element="' + shortcode + '"]:first'),
  1709.                 $newPreset = $presetShortcode.clone(!0);
  1710.             vc_all_presets[id] = data, $newPreset.find("[data-vc-shortcode-name]").text(title), $newPreset.find(".vc_element-description").text(""), $newPreset.attr("data-preset", id), $newPreset.addClass("js-category-_my_elements_"), $newPreset.insertAfter(this.$el.find('[data-element="' + shortcode + '"]:last')), this.$el.find('[data-filter="js-category-_my_elements_"]').show();
  1711.             var $samplePreset = this.$body.find('[data-vc-ui-element="panel-preset"] [data-vc-presets-list-content] .vc_ui-template:first'),
  1712.                 $newPreset = $samplePreset.clone(!0);
  1713.             $newPreset.find('[data-vc-ui-element="template-title"]').attr("title", title).text(title), $newPreset.find('[data-vc-ui-delete="preset-title"]').attr("data-preset", id).attr("data-preset-parent", shortcode), $newPreset.find("[data-vc-ui-add-preset]").attr("data-preset", id).attr("id", shortcode).attr("data-tag", shortcode), $newPreset.show(), $newPreset.insertAfter(this.$body.find('[data-vc-ui-element="panel-preset"] [data-vc-presets-list-content] .vc_ui-template:last'))
  1714.         },
  1715.         removePresetFromAddElementPopUp: function(id) {
  1716.             this.$el.find('[data-preset="' + id + '"]').remove()
  1717.         },
  1718.         openPresetWindow: function(e) {
  1719.             e && e.preventDefault && e.preventDefault(), vc.preset_panel_view.render().show()
  1720.         }
  1721.     }), vc.AddElementUIPanelFrontendEditor = vc.AddElementUIPanelBackendEditor.vcExtendUI(vc.HelperPanelViewHeaderFooter).extend({
  1722.         events: {
  1723.             'click [data-vc-ui-element="button-close"]': "hide",
  1724.             'click [data-vc-ui-element="panel-tab-control"]': "filterElements",
  1725.             "click .vc_shortcode-link": "createElement",
  1726.             "keyup #vc_elements_name_filter": "filterElements"
  1727.         },
  1728.         createElement: function(e) {
  1729.             e && e.preventDefault && e.preventDefault();
  1730.             var showSettings, newData, i, column_params, row_params, inner_row_params, inner_column_params, $control, tag, preset, presetType, closestPreset;
  1731.             if ($control = $(e.currentTarget), tag = $control.data("tag"), row_params = {}, column_params = {
  1732.                     width: "1/1"
  1733.                 }, closestPreset = $control.closest("[data-preset]"), closestPreset && (preset = closestPreset.data("preset"), presetType = closestPreset.data("element")), this.prepend && (vc.activity = "prepend"), 0 == this.model)
  1734.                 if ("vc_section" === tag) {
  1735.                     var modelOptions = {
  1736.                         shortcode: tag
  1737.                     };
  1738.                     preset && "vc_section" === presetType && (modelOptions.preset = preset), this.builder.create(modelOptions), this.model = this.builder.last()
  1739.                 } else {
  1740.                     var rowOptions = {
  1741.                         shortcode: "vc_row",
  1742.                         params: row_params
  1743.                     };
  1744.                     preset && "vc_row" === presetType && (rowOptions.preset = preset), this.builder.create(rowOptions);
  1745.                     var columnOptions = {
  1746.                         shortcode: "vc_column",
  1747.                         parent_id: this.builder.lastID(),
  1748.                         params: column_params
  1749.                     };
  1750.                     if (preset && "vc_column" === presetType && (columnOptions.preset = preset), this.builder.create(columnOptions), "vc_row" !== tag) {
  1751.                         var options = {
  1752.                             shortcode: tag,
  1753.                             parent_id: this.builder.lastID()
  1754.                         };
  1755.                         preset && presetType === tag && (options.preset = preset), this.builder.create(options)
  1756.                     }
  1757.                     this.model = this.builder.last()
  1758.                 } else if ("vc_row" === tag) "vc_section" === this.model.get("shortcode") ? (this.builder.create({
  1759.                 shortcode: "vc_row",
  1760.                 params: row_params,
  1761.                 parent_id: this.model.id,
  1762.                 order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.nextOrder()
  1763.             }).create({
  1764.                 shortcode: "vc_column",
  1765.                 params: column_params,
  1766.                 parent_id: this.builder.lastID()
  1767.             }), this.model = this.builder.last()) : (inner_row_params = {}, inner_column_params = {
  1768.                 width: "1/1"
  1769.             }, this.builder.create({
  1770.                 shortcode: "vc_row_inner",
  1771.                 params: inner_row_params,
  1772.                 parent_id: this.model.id,
  1773.                 order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.nextOrder()
  1774.             }).create({
  1775.                 shortcode: "vc_column_inner",
  1776.                 params: inner_column_params,
  1777.                 parent_id: this.builder.lastID()
  1778.             }), this.model = this.builder.last());
  1779.             else {
  1780.                 var options = {
  1781.                     shortcode: tag,
  1782.                     parent_id: this.model.id,
  1783.                     order: this.prepend ? this.getFirstPositionIndex() : vc.shortcodes.nextOrder()
  1784.                 };
  1785.                 preset && presetType === tag && (options.preset = preset), this.builder.create(options), this.model = this.builder.last()
  1786.             }
  1787.             for (i = this.builder.models.length - 1; i >= 0; i--) this.builder.models[i].get("shortcode");
  1788.             _.isString(vc.getMapped(tag).default_content) && vc.getMapped(tag).default_content.length && (newData = this.builder.parse({}, vc.getMapped(tag).default_content, this.builder.last().toJSON()), _.each(newData, function(object) {
  1789.                 object.default_content = !0, this.builder.create(object)
  1790.             }, this)), this.model = this.builder.last(), showSettings = !(_.isBoolean(vc.getMapped(tag).show_settings_on_create) && !1 === vc.getMapped(tag).show_settings_on_create), this.hide(), showSettings && this.showEditForm(), this.builder.render()
  1791.         }
  1792.     })
  1793. }(window.jQuery),
  1794. function($) {
  1795.     "use strict";
  1796.     vc.ExtendPresets = {
  1797.         settingsMenuSelector: '[data-vc-ui-element="settings-dropdown-list"]',
  1798.         settingsButtonSelector: '[data-vc-ui-element="settings-dropdown-button"]',
  1799.         settingsDropdownSelector: '[data-vc-ui-element="settings-dropdown"]',
  1800.         settingsPresetId: null,
  1801.         uiEvents: {
  1802.             init: "addEvents",
  1803.             render: "hideDropdown",
  1804.             afterRender: "afterRenderActions"
  1805.         },
  1806.         afterRenderActions: function() {
  1807.             this.untaintSettingsPresetData(), this.showDropdown()
  1808.         },
  1809.         hideDropdown: function() {
  1810.             this.$el.find('[data-vc-ui-element="settings-dropdown"]').hide()
  1811.         },
  1812.         showDropdown: function() {
  1813.             var tag = this.model.get("shortcode");
  1814.             window.vc_settings_show && "vc_column" !== tag && this.$el.find('[data-vc-ui-element="settings-dropdown"]').show()
  1815.         },
  1816.         showDropdownMenu: function() {
  1817.             var tag = this.model.get("shortcode"),
  1818.                 $this = $(this);
  1819.             $this.data("vcSettingsMenuLoaded") && tag === $this.data("vcShortcodeName") || this.reloadSettingsMenuContent()
  1820.         },
  1821.         addEvents: function() {
  1822.             var $tab = this.$el.find(".vc_edit-form-tab.vc_active"),
  1823.                 tag = this.model.get("shortcode"),
  1824.                 _this = this;
  1825.             $(document).off("beforeMinimize.vc.paramWindow", this.minimizeButtonSelector).on("beforeMinimize.vc.paramWindow", this.minimizeButtonSelector, function() {
  1826.                 $tab.find(".vc_ui-prompt-presets .vc_ui-prompt-close").trigger("click")
  1827.             }), $(document).off("close.vc.paramWindow", this.closeButtonSelector).on("beforeClose.vc.paramWindow", this.closeButtonSelector, function() {
  1828.                 $tab.find(".vc_ui-prompt-presets .vc_ui-prompt-close").trigger("click")
  1829.             }), $(document).off("show.vc.accordion", this.settingsButtonSelector).on("show.vc.accordion", this.settingsButtonSelector, function() {
  1830.                 var $this = $(this);
  1831.                 $this.data("vcSettingsMenuLoaded") && tag === $this.data("vcShortcodeName") || _this.reloadSettingsMenuContent()
  1832.             })
  1833.         },
  1834.         saveSettingsAjaxData: function(shortcode_name, title, is_default, data) {
  1835.             return {
  1836.                 action: "vc_action_save_settings_preset",
  1837.                 shortcode_name: shortcode_name,
  1838.                 is_default: is_default ? 1 : 0,
  1839.                 vc_inline: !0,
  1840.                 title: title,
  1841.                 data: data,
  1842.                 _vcnonce: window.vcAdminNonce
  1843.             }
  1844.         },
  1845.         saveSettings: function(title, is_default) {
  1846.             var shortcode_name = this.model.get("shortcode"),
  1847.                 data = JSON.stringify(this.getParamsForSettingsPreset());
  1848.             if (void 0 !== title && title.length) return void 0 === is_default && (is_default = !1), this.checkAjax(), this.ajax = $.ajax({
  1849.                 type: "POST",
  1850.                 dataType: "json",
  1851.                 url: window.ajaxurl,
  1852.                 data: this.saveSettingsAjaxData(shortcode_name, title, is_default, data),
  1853.                 context: this
  1854.             }).done(function(response) {
  1855.                 response.success && (this.setSettingsMenuContent(response.html), this.settingsPresetId = response.id, this.untaintSettingsPresetData())
  1856.             }).always(this.resetAjax), this.ajax
  1857.         },
  1858.         fetchSaveSettingsDialogAjaxData: function() {
  1859.             return {
  1860.                 action: "vc_action_render_settings_preset_title_prompt",
  1861.                 vc_inline: !0,
  1862.                 _vcnonce: window.vcAdminNonce
  1863.             }
  1864.         },
  1865.         fetchSaveSettingsDialog: function(callback) {
  1866.             var $contentContainer = this.$el.find(".vc_ui-panel-content-container");
  1867.             if ($contentContainer.find(".vc_ui-prompt-presets").length) return void(void 0 !== callback && callback(!1));
  1868.             this.checkAjax(), this.ajax = $.ajax({
  1869.                 type: "POST",
  1870.                 dataType: "json",
  1871.                 url: window.ajaxurl,
  1872.                 data: this.fetchSaveSettingsDialogAjaxData()
  1873.             }).done(function(response) {
  1874.                 response.success && ($contentContainer.prepend(response.html), void 0 !== callback && callback(!0))
  1875.             }).fail(function() {
  1876.                 void 0 !== callback && callback(!1)
  1877.             }).always(this.resetAjax)
  1878.         },
  1879.         showSaveSettingsDialog: function(is_default) {
  1880.             var _this = this;
  1881.             this.isSettingsPresetDefault = !!is_default, this.fetchSaveSettingsDialog(function(created) {
  1882.                 var $contentContainer = _this.$el.find(".vc_ui-panel-content-container"),
  1883.                     $prompt = $contentContainer.find(".vc_ui-prompt-presets"),
  1884.                     $title = $prompt.find(".textfield");
  1885.                 $contentContainer.find(".vc_ui-prompt.vc_visible").removeClass("vc_visible");
  1886.                 var $viewPresetsButton = $prompt.find("[data-vc-view-settings-preset]");
  1887.                 if ("undefined" !== window.vc_vendor_settings_presets[_this.model.get("shortcode")] ? $viewPresetsButton.removeAttr("disabled") : $viewPresetsButton.attr("disabled", "disabled"), $prompt.addClass("vc_visible"), $title.focus(), $contentContainer.addClass("vc_ui-content-hidden"), created) {
  1888.                     var $btn = $prompt.find("#vc_ui-save-preset-btn"),
  1889.                         delay = 0;
  1890.                     $prompt.on("submit", function() {
  1891.                         var title = $title.val();
  1892.                         return !!title.length && (_this.saveSettings(title, _this.isSettingsPresetDefault).done(function(e) {
  1893.                             var data = this.getParamsForSettingsPreset();
  1894.                             $title.val(""), _this.setCustomButtonMessage($btn, void 0, void 0, !0), vc.events.trigger("vc:savePreset", e.id, _this.model.get("shortcode"), title, data), delay = _.delay(function() {
  1895.                                 $prompt.removeClass("vc_visible"), $contentContainer.removeClass("vc_ui-content-hidden")
  1896.                             }, 5e3)
  1897.                         }).fail(function() {
  1898.                             _this.setCustomButtonMessage($btn, window.i18nLocale.ui_danger, "danger", !0)
  1899.                         }), !1)
  1900.                     }), $prompt.on("click", ".vc_ui-prompt-close", function() {
  1901.                         return _this.checkAjax(), $prompt.removeClass("vc_visible"), $contentContainer.removeClass("vc_ui-content-hidden"), _this.clearCustomButtonMessage.call(this, $btn), delay && (window.clearTimeout(delay), delay = 0), !1
  1902.                     })
  1903.                 }
  1904.             })
  1905.         },
  1906.         loadSettingsAjaxData: function(id) {
  1907.             return {
  1908.                 action: "vc_action_get_settings_preset",
  1909.                 vc_inline: !0,
  1910.                 id: id,
  1911.                 _vcnonce: window.vcAdminNonce
  1912.             }
  1913.         },
  1914.         loadSettings: function(id) {
  1915.             return this.panelInit = !1, this.checkAjax(), this.ajax = $.ajax({
  1916.                 type: "POST",
  1917.                 dataType: "json",
  1918.                 url: window.ajaxurl,
  1919.                 data: this.loadSettingsAjaxData(id),
  1920.                 context: this
  1921.             }).done(function(response) {
  1922.                 response.success && (this.settingsPresetId = id, this.applySettingsPreset(response.data))
  1923.             }).always(this.resetAjax), this.ajax
  1924.         },
  1925.         saveAsDefaultSettingsAjaxData: function(shortcode_name, id) {
  1926.             return {
  1927.                 action: "vc_action_set_as_default_settings_preset",
  1928.                 shortcode_name: shortcode_name,
  1929.                 id: id,
  1930.                 vc_inline: !0,
  1931.                 _vcnonce: window.vcAdminNonce
  1932.             }
  1933.         },
  1934.         saveAsDefaultSettings: function(id, doneCallback) {
  1935.             var shortcode_name = this.model.get("shortcode"),
  1936.                 presetId = id || this.settingsPresetId;
  1937.             presetId ? (this.checkAjax(), this.ajax = $.ajax({
  1938.                 type: "POST",
  1939.                 dataType: "json",
  1940.                 url: window.ajaxurl,
  1941.                 data: this.saveAsDefaultSettingsAjaxData(shortcode_name, presetId),
  1942.                 context: this
  1943.             }).done(function(response) {
  1944.                 response.success && (this.setSettingsMenuContent(response.html), this.untaintSettingsPresetData(), doneCallback && doneCallback())
  1945.             }).always(this.resetAjax)) : this.showSaveSettingsDialog(!0)
  1946.         },
  1947.         restoreDefaultSettingsAjaxData: function(shortcode_name) {
  1948.             return {
  1949.                 action: "vc_action_restore_default_settings_preset",
  1950.                 shortcode_name: shortcode_name,
  1951.                 vc_inline: !0,
  1952.                 _vcnonce: window.vcAdminNonce
  1953.             }
  1954.         },
  1955.         restoreDefaultSettings: function() {
  1956.             var shortcode_name = this.model.get("shortcode");
  1957.             this.checkAjax(), this.ajax = $.ajax({
  1958.                 type: "POST",
  1959.                 dataType: "json",
  1960.                 url: window.ajaxurl,
  1961.                 data: this.restoreDefaultSettingsAjaxData(shortcode_name),
  1962.                 context: this
  1963.             }).done(function(response) {
  1964.                 response.success && this.setSettingsMenuContent(response.html)
  1965.             }).always(this.resetAjax)
  1966.         },
  1967.         setSettingsMenuContent: function(html) {
  1968.             var $button = this.$el.find(this.settingsButtonSelector),
  1969.                 $menu = this.$el.find(this.settingsMenuSelector),
  1970.                 shortcode_name = this.model.get("shortcode"),
  1971.                 _this = this;
  1972.             $button.data("vcShortcodeName", shortcode_name), $menu.html(html), window.vc_presets_data && window.vc_presets_data.presetsCount > 0 ? $menu.find("[data-vc-view-settings-preset]").removeAttr("disabled") : $menu.find("[data-vc-view-settings-preset]").attr("disabled", "disabled"), $menu.find("[data-vc-view-settings-preset]").on("click", function() {
  1973.                 _this.showViewSettingsList(), _this.closeSettings()
  1974.             }), $menu.find("[data-vc-save-settings-preset]").on("click", function() {
  1975.                 _this.showSaveSettingsDialog(), _this.closeSettings()
  1976.             }), $menu.find("[data-vc-save-template]").on("click", function() {
  1977.                 _this.showSaveTemplateDialog(), _this.closeSettings()
  1978.             }), $menu.find("[data-vc-save-default-settings-preset]").on("click", function() {
  1979.                 _this.saveAsDefaultSettings(), _this.closeSettings()
  1980.             }), $menu.find("[data-vc-restore-default-settings-preset]").on("click", function() {
  1981.                 _this.restoreDefaultSettings(), _this.closeSettings()
  1982.             })
  1983.         },
  1984.         reloadSettingsMenuContentAjaxData: function(shortcode_name) {
  1985.             return {
  1986.                 action: "vc_action_render_settings_preset_popup",
  1987.                 shortcode_name: shortcode_name,
  1988.                 vc_inline: !0,
  1989.                 _vcnonce: window.vcAdminNonce
  1990.             }
  1991.         },
  1992.         showViewSettingsList: function() {
  1993.             var $contentContainer = this.$el.find(".vc_ui-panel-content-container");
  1994.             if ($contentContainer.find(".vc_ui-prompt-view-presets:not(.vc_visible)").remove(), !$contentContainer.find(".vc_ui-prompt-view-presets").length) {
  1995.                 $contentContainer.find(".vc_ui-prompt.vc_visible").removeClass("vc_visible");
  1996.                 var _this = this,
  1997.                     $prompt = jQuery('<form class="vc_ui-prompt vc_ui-prompt-view-presets"><div class="vc_ui-prompt-controls"><button type="button" class="vc_general vc_ui-control-button vc_ui-prompt-close"><i class="vc-composer-icon vc-c-icon-close"></i></button></div><div class="vc_ui-prompt-title"><label for="prompt_title" class="wpb_element_label">Elements</label></div><div class="vc_ui-prompt-content"><div class="vc_ui-prompt-column"><div class="vc_ui-template-list vc_ui-list-bar" data-vc-action="collapseAll" style="margin-top: 20px;" data-vc-presets-list-content></div></div></div>');
  1998.                 this.buildsettingsListContent($prompt), $prompt.appendTo($contentContainer), $prompt.addClass("vc_visible"), $contentContainer.addClass("vc_ui-content-hidden");
  1999.                 var closePrompt = function() {
  2000.                     return $prompt.remove(), $contentContainer.removeClass("vc_ui-content-hidden"), !1
  2001.                 };
  2002.                 $prompt.off("click.vc1").on("click.vc1", "[data-vc-load-settings-preset]", function(e) {
  2003.                     _this.loadSettings($(e.currentTarget).data("vcLoadSettingsPreset")), closePrompt()
  2004.                 }), $prompt.off("click.vc4").on("click.vc4", "[data-vc-set-default-settings-preset]", function() {
  2005.                     _this.saveAsDefaultSettings($(this).data("vcSetDefaultSettingsPreset"), function() {
  2006.                         _this.buildsettingsListContent($prompt)
  2007.                     })
  2008.                 }), $prompt.off("click.vc3").on("click.vc3", ".vc_ui-prompt-close", function() {
  2009.                     closePrompt(), _this.checkAjax()
  2010.                 })
  2011.             }
  2012.         },
  2013.         buildsettingsListContent: function($prompt) {
  2014.             var itemsTemplate = vc.template('<div class="vc_ui-template"><div class="vc_ui-list-bar-item"><button class="vc_ui-list-bar-item-trigger" title="Apply Element" type="button" data-vc-load-settings-preset="<%- id %>"><%- title %></button><div class="vc_ui-list-bar-item-actions"><button class="vc_general vc_ui-control-button" title="Apply Element" type="button" data-vc-load-settings-preset="<%- id %>"><i class="vc-composer-icon vc-c-icon-add"></i></button><button class="vc_general vc_ui-control-button" title="Delete Element" type="button" data-vc-delete-settings-preset="<%- id %>"><i class="vc-composer-icon vc-c-icon-delete_empty"></i></button></div></div></div>'),
  2015.                 $content = $prompt.find("[data-vc-presets-list-content]");
  2016.             $content.empty(), _.each(window.vc_presets_data.presets[0], function(item, id) {
  2017.                 var title = item;
  2018.                 window.vc_presets_data.defaultId > 0 && parseInt(id) === window.vc_presets_data.defaultId && (title = item + " (default)"), $content.append(itemsTemplate({
  2019.                     title: title,
  2020.                     id: id
  2021.                 }))
  2022.             }), _.each(window.vc_presets_data.presets[1], function(item, id) {
  2023.                 var title = item;
  2024.                 window.vc_presets_data.defaultId > 0 && parseInt(id) === window.vc_presets_data.defaultId && (title = item + " (default)"), $content.append(itemsTemplate({
  2025.                     title: title,
  2026.                     id: id
  2027.                 }))
  2028.             })
  2029.         },
  2030.         reloadSettingsMenuContent: function() {
  2031.             var shortcode_name = this.model.get("shortcode"),
  2032.                 $button = this.$el.find(this.settingsButtonSelector),
  2033.                 success = !1;
  2034.             return this.setSettingsMenuContent(""), this.checkAjax(), this.ajax = $.ajax({
  2035.                 type: "POST",
  2036.                 dataType: "json",
  2037.                 url: window.ajaxurl,
  2038.                 data: this.reloadSettingsMenuContentAjaxData(shortcode_name),
  2039.                 context: this
  2040.             }).done(function(response) {
  2041.                 response.success && (success = !0, this.setSettingsMenuContent(response.html), $button.data("vcSettingsMenuLoaded", !0))
  2042.             }).always(function() {
  2043.                 success || this.closeSettings(), this.resetAjax()
  2044.             }), this.ajax
  2045.         },
  2046.         closeSettings: function(destroy) {
  2047.             void 0 === destroy && (destroy = !1);
  2048.             var $menu = this.$el.find(this.settingsMenuSelector),
  2049.                 $button = this.$el.find(this.settingsButtonSelector);
  2050.             destroy && ($button.data("vcSettingsMenuLoaded", !1), $menu.html("")), $button.vcAccordion("hide")
  2051.         },
  2052.         isSettingsPresetDataTainted: function() {
  2053.             var params = JSON.stringify(this.getParamsForSettingsPreset());
  2054.             return params = params.replace(/vc_custom_\d+/, ""), this.$el.data("vcSettingsPresetHash") !== vc_globalHashCode(params)
  2055.         },
  2056.         untaintSettingsPresetData: function() {
  2057.             var params = JSON.stringify(this.getParamsForSettingsPreset());
  2058.             params = params.replace(/vc_custom_\d+/, ""), this.$el.data("vcSettingsPresetHash", vc_globalHashCode(params))
  2059.         },
  2060.         applySettingsPresetAjaxData: function(params) {
  2061.             var parent_id;
  2062.             return parent_id = this.model.get("parent_id"), {
  2063.                 action: "vc_edit_form",
  2064.                 tag: this.model.get("shortcode"),
  2065.                 parent_tag: parent_id ? vc.shortcodes.get(parent_id).get("shortcode") : null,
  2066.                 post_id: $("#post_ID").val(),
  2067.                 params: params,
  2068.                 _vcnonce: window.vcAdminNonce
  2069.             }
  2070.         },
  2071.         applySettingsPreset: function(params) {
  2072.             return this.currentModelParams = params, vc.events.trigger("presets:apply", this.model, params), this._killEditor(), this.trigger("render"), this.show(), this.checkAjax(), this.ajax = $.ajax({
  2073.                 type: "POST",
  2074.                 url: window.ajaxurl,
  2075.                 data: this.applySettingsPresetAjaxData(params),
  2076.                 context: this
  2077.             }).done(this.buildParamsContent).always(this.resetAjax), this
  2078.         },
  2079.         getParamsForSettingsPreset: function() {
  2080.             var shortcode = this.model.get("shortcode"),
  2081.                 params = this.getParams();
  2082.             return "vc_column" !== shortcode && "vc_column_inner" !== shortcode || (delete params.width, delete params.offset), params
  2083.         }
  2084.     }, vc.events.on("presets.apply", function(model, params) {
  2085.         return "vc_tta_section" === model.get("shortcode") && void 0 !== params.tab_id && (params.tab_id = vc_guid() + "-cl"), params
  2086.     })
  2087. }(window.jQuery),
  2088. function($) {
  2089.     "use strict";
  2090.     vc.ExtendTemplates = {
  2091.         fetchSaveTemplateDialogAjaxData: function() {
  2092.             return {
  2093.                 action: "vc_action_render_settings_templates_prompt",
  2094.                 vc_inline: !0,
  2095.                 _vcnonce: window.vcAdminNonce
  2096.             }
  2097.         },
  2098.         fetchSaveTemplateDialog: function(callback) {
  2099.             var $tab = this.$el.find(".vc_ui-panel-content-container");
  2100.             return $tab.find(".vc_ui-prompt-templates").length ? void(void 0 !== callback && callback(!1)) : (this.checkAjax(), this.ajax = $.ajax({
  2101.                 type: "POST",
  2102.                 dataType: "json",
  2103.                 url: window.ajaxurl,
  2104.                 data: this.fetchSaveTemplateDialogAjaxData()
  2105.             }).done(function(response) {
  2106.                 response.success && ($tab.prepend(response.html), void 0 !== callback && callback(!0))
  2107.             }).always(this.resetAjax), this.ajax)
  2108.         },
  2109.         showSaveTemplateDialog: function() {
  2110.             var _this = this;
  2111.             this.fetchSaveTemplateDialog(function(created) {
  2112.                 var $tab = _this.$el.find(".vc_ui-panel-content-container"),
  2113.                     $prompt = $tab.find(".vc_ui-prompt-templates"),
  2114.                     $title = $prompt.find(".textfield");
  2115.                 if ($tab.find(".vc_ui-prompt.vc_visible").removeClass("vc_visible"), $prompt.addClass("vc_visible"), $title.focus(), $tab.addClass("vc_ui-content-hidden"), created) {
  2116.                     var delay = 0,
  2117.                         $btn = $prompt.find("#vc_ui-save-templates-btn");
  2118.                     $prompt.on("submit", function() {
  2119.                         var title = $title.val();
  2120.                         _this.$el.find(_this.settingsButtonSelector);
  2121.                         if (!title.length) return !1;
  2122.                         var data = {
  2123.                             action: vc.templates_panel_view.save_template_action,
  2124.                             template: vc.shortcodes.singleStringify(_this.model.get("id"), "template"),
  2125.                             template_name: title,
  2126.                             vc_inline: !0,
  2127.                             _vcnonce: window.vcAdminNonce
  2128.                         };
  2129.                         return vc.templates_panel_view.reloadTemplateList(data, function() {
  2130.                             $title.val(""), _this.setCustomButtonMessage($btn, void 0, void 0, !0), delay = _.delay(function() {
  2131.                                 $prompt.removeClass("vc_visible"), $tab.removeClass("vc_ui-content-hidden")
  2132.                             }, 5e3)
  2133.                         }, function() {
  2134.                             _this.setCustomButtonMessage($btn, window.i18nLocale.ui_danger, "danger")
  2135.                         }), !1
  2136.                     }), $prompt.on("click", ".vc_ui-prompt-close", function() {
  2137.                         return _this.checkAjax(), $prompt.removeClass("vc_visible"), $tab.removeClass("vc_ui-content-hidden"), _this.clearCustomButtonMessage.call(this, $btn), delay && (window.clearTimeout(delay), delay = 0), !1
  2138.                     })
  2139.                 }
  2140.             })
  2141.         }
  2142.     }
  2143. }(window.jQuery),
  2144. function($) {
  2145.     "use strict";
  2146.     vc.EditElementPanelView = vc.PanelView.vcExtendUI(vc.HelperAjax).vcExtendUI(vc.ExtendPresets).vcExtendUI(vc.ExtendTemplates).vcExtendUI(vc.HelperPrompts).extend({
  2147.         panelName: "edit_element",
  2148.         el: "#vc_properties-panel",
  2149.         contentSelector: ".vc_ui-panel-content.vc_properties-list",
  2150.         minimizeButtonSelector: '[data-vc-ui-element="button-minimize"]',
  2151.         closeButtonSelector: '[data-vc-ui-element="button-close"]',
  2152.         titleSelector: ".vc_panel-title",
  2153.         tabsInit: !1,
  2154.         doCheckTabs: !0,
  2155.         $tabsMenu: !1,
  2156.         dependent_elements: {},
  2157.         mapped_params: {},
  2158.         draggable: !1,
  2159.         panelInit: !1,
  2160.         $spinner: !1,
  2161.         active_tab_index: 0,
  2162.         buttonMessageTimeout: !1,
  2163.         notRequestTemplate: !1,
  2164.         requiredParamsInitialized: !1,
  2165.         currentModelParams: !1,
  2166.         customButtonMessageTimeout: !1,
  2167.         events: {
  2168.             "click [data-save=true]": "save",
  2169.             "click [data-dismiss=panel]": "hide",
  2170.             "mouseover [data-transparent=panel]": "addOpacity",
  2171.             "click [data-transparent=panel]": "toggleOpacity",
  2172.             "mouseout [data-transparent=panel]": "removeOpacity"
  2173.         },
  2174.         initialize: function() {
  2175.             _.bindAll(this, "setSize", "setTabsSize", "fixElContainment", "hookDependent", "resetAjax", "removeAllPrompts"), this.on("setSize", this.setResize, this), this.on("render", this.resetMinimize, this), this.on("render", this.setTitle, this), this.on("render", this.prepareContentBlock, this)
  2176.         },
  2177.         setCustomButtonMessage: function($btn, message, type, showInBackend) {
  2178.             var currentTextHtml;
  2179.             return void 0 === $btn && ($btn = this.$el.find('[data-vc-ui-element="button-save"]')),
  2180.                 void 0 === showInBackend && (showInBackend = !1), this.clearCustomButtonMessage = _.bind(this.clearCustomButtonMessage, this), !showInBackend && !vc.frame_window || this.customButtonMessageTimeout ? this : (void 0 === message && (message = window.i18nLocale.ui_saved), void 0 === type && (type = "success"), currentTextHtml = $btn.html(), $btn.addClass("vc_ui-button-" + type + " vc_ui-button-undisabled").removeClass("vc_ui-button-action").data("vcCurrentTextHtml", currentTextHtml).data("vcCurrentTextType", type).html(message), _.delay(this.clearCustomButtonMessage.bind(this, $btn), 5e3), this.customButtonMessageTimeout = !0, this)
  2181.         },
  2182.         clearCustomButtonMessage: function($btn) {
  2183.             var type, currentTextHtml;
  2184.             this.customButtonMessageTimeout && (window.clearTimeout(this.customButtonMessageTimeout), currentTextHtml = $btn.data("vcCurrentTextHtml") || "Save", type = $btn.data("vcCurrentTextType"), $btn.html(currentTextHtml).removeClass("vc_ui-button-" + type + " vc_ui-button-undisabled").addClass("vc_ui-button-action"), this.customButtonMessageTimeout = !1)
  2185.         },
  2186.         render: function(model, not_request_template) {
  2187.             var params;
  2188.             return this.$el.is(":hidden") && vc.closeActivePanel(), not_request_template && (this.notRequestTemplate = !0), this.model = model, this.currentModelParams = this.model.get("params"), vc.active_panel = this, this.resetMinimize(), this.clicked = !1, this.$el.css("height", "auto"), this.$el.css("maxHeight", "75vh"), params = this.model.setting("params") || [], this.$el.attr("data-vc-shortcode", this.model.get("shortcode")), this.tabsInit = !1, this.panelInit = !1, this.active_tab_index = 0, this.requiredParamsInitialized = !1, this.mapped_params = {}, this.dependent_elements = {}, _.each(params, function(param) {
  2189.                 this.mapped_params[param.param_name] = param
  2190.             }, this), this.trigger("render"), this.show(), this.checkAjax(), this.ajax = $.ajax({
  2191.                 type: "POST",
  2192.                 url: window.ajaxurl,
  2193.                 data: this.ajaxData(),
  2194.                 context: this
  2195.             }).done(this.buildParamsContent).always(this.resetAjax), this
  2196.         },
  2197.         prepareContentBlock: function() {
  2198.             this.$content = this.notRequestTemplate ? this.$el : this.$el.find(this.contentSelector).removeClass("vc_with-tabs"), this.$content.empty(), this.$spinner = $('<span class="vc_ui-wp-spinner vc_ui-wp-spinner-lg"></span>'), this.$content.prepend(this.$spinner)
  2199.         },
  2200.         buildParamsContent: function(data) {
  2201.             var $data, $tabs, $panelHeader;
  2202.             $data = $(data), $tabs = $data.find('[data-vc-ui-element="panel-tabs-controls"]'), $tabs.find(".vc_edit-form-tab-control:first-child").addClass("vc_active"), $panelHeader = this.$el.find('[data-vc-ui-element="panel-header-content"]'), $tabs.prependTo($panelHeader), this.$content.html($data), this.$content.removeAttr("data-vc-param-initialized"), this.active_tab_index = 0, this.tabsInit = !1, this.panelInit = !1, this.dependent_elements = {}, this.requiredParamsInitialized = !1, this.$content.find("[data-vc-param-initialized]").removeAttr("data-vc-param-initialized"), this.init(), this.$content.parent().scrollTop(1).scrollTop(0), this.$content.removeClass("vc_properties-list-init"), this.$el.trigger("vcPanel.shown"), this.trigger("afterRender")
  2203.         },
  2204.         resetMinimize: function() {
  2205.             this.$el.removeClass("vc_panel-opacity")
  2206.         },
  2207.         ajaxData: function() {
  2208.             var parent_tag, parent_id, params, mergedParams;
  2209.             return parent_id = this.model.get("parent_id"), parent_tag = parent_id ? this.model.collection.get(parent_id).get("shortcode") : null, params = this.model.get("params"), mergedParams = vc.getMergedParams(this.model.get("shortcode"), _.extend({}, vc.getDefaults(this.model.get("shortcode")), params)), _.isUndefined(params.content) || (mergedParams.content = params.content), {
  2210.                 action: "vc_edit_form",
  2211.                 tag: this.model.get("shortcode"),
  2212.                 parent_tag: parent_tag,
  2213.                 post_id: $("#post_ID").val(),
  2214.                 params: mergedParams,
  2215.                 _vcnonce: window.vcAdminNonce
  2216.             }
  2217.         },
  2218.         init: function() {
  2219.             vc.EditElementPanelView.__super__.init.call(this), this.initParams(), this.initDependency();
  2220.             $(".wpb_edit_form_elements .textarea_html").each(function() {
  2221.                 window.init_textarea_html($(this))
  2222.             }), this.trigger("init"), this.panelInit = !0
  2223.         },
  2224.         initParams: function() {
  2225.             var _this = this,
  2226.                 $content = this.content().find('#vc_edit-form-tabs [data-vc-ui-element="panel-edit-element-tab"]:eq(' + this.active_tab_index + ")");
  2227.             $content.length || ($content = this.content()), $content.attr("data-vc-param-initialized") || ($('[data-vc-ui-element="panel-shortcode-param"]', $content).each(function() {
  2228.                 var $field, param;
  2229.                 $field = $(this), $field.data("vcInitParam") || (param = $field.data("param_settings"), vc.atts.init.call(_this, param, $field), $field.data("vcInitParam", !0))
  2230.             }), $content.attr("data-vc-param-initialized", !0)), this.requiredParamsInitialized || _.isUndefined(vc.required_params_to_init) || ($('[data-vc-ui-element="panel-shortcode-param"]', this.content()).each(function() {
  2231.                 var $field, param;
  2232.                 $field = $(this), !$field.data("vcInitParam") && _.indexOf(vc.required_params_to_init, $field.data("param_type")) > -1 && (param = $field.data("param_settings"), vc.atts.init.call(_this, param, $field), $field.data("vcInitParam", !0))
  2233.             }), this.requiredParamsInitialized = !0)
  2234.         },
  2235.         initDependency: function() {
  2236.             var callDependencies = {};
  2237.             _.each(this.mapped_params, function(param) {
  2238.                 if (_.isObject(param) && _.isObject(param.dependency)) {
  2239.                     var rules = param.dependency;
  2240.                     if (_.isString(param.dependency.element)) {
  2241.                         var $masters, $slave;
  2242.                         $masters = $("[name=" + param.dependency.element + "].wpb_vc_param_value", this.$content), $slave = $("[name= " + param.param_name + "].wpb_vc_param_value", this.$content), _.each($masters, function(master) {
  2243.                             var $master, name;
  2244.                             $master = $(master), name = $master.attr("name"), _.isArray(this.dependent_elements[$master.attr("name")]) || (this.dependent_elements[$master.attr("name")] = []), this.dependent_elements[$master.attr("name")].push($slave), !$master.data("dependentSet") && $master.attr("data-dependent-set", "true") && $master.bind("keyup change", this.hookDependent), callDependencies[name] || (callDependencies[name] = $master)
  2245.                         }, this)
  2246.                     }
  2247.                     _.isString(rules.callback) && window[rules.callback].call(this)
  2248.                 }
  2249.             }, this), this.doCheckTabs = !1, _.each(callDependencies, function(obj) {
  2250.                 this.hookDependent({
  2251.                     currentTarget: obj
  2252.                 })
  2253.             }, this), this.doCheckTabs = !0, this.checkTabs(), callDependencies = null
  2254.         },
  2255.         hookDependent: function(e) {
  2256.             var $master, $master_container, is_empty, dependent_elements, master_value, checkTabs;
  2257.             return $master = $(e.currentTarget), $master_container = $master.closest(".vc_column"), dependent_elements = this.dependent_elements[$master.attr("name")], master_value = $master.is(":checkbox") ? _.map(this.$content.find("[name=" + $(e.currentTarget).attr("name") + "].wpb_vc_param_value:checked"), function(element) {
  2258.                 return $(element).val()
  2259.             }) : $master.val(), checkTabs = this.doCheckTabs, this.doCheckTabs = !1, is_empty = $master.is(":checkbox") ? !this.$content.find("[name=" + $master.attr("name") + "].wpb_vc_param_value:checked").length : !master_value.length, $master_container.hasClass("vc_dependent-hidden") ? _.each(dependent_elements, function($element) {
  2260.                 var event = jQuery.Event("change");
  2261.                 event.extra_type = "vcHookDepended", $element.closest(".vc_column").addClass("vc_dependent-hidden"), $element.trigger(event)
  2262.             }) : _.each(dependent_elements, function($element) {
  2263.                 var param_name = $element.attr("name"),
  2264.                     rules = _.isObject(this.mapped_params[param_name]) && _.isObject(this.mapped_params[param_name].dependency) ? this.mapped_params[param_name].dependency : {},
  2265.                     $param_block = $element.closest(".vc_column");
  2266.                 _.isBoolean(rules.not_empty) && !0 === rules.not_empty && !is_empty ? $param_block.removeClass("vc_dependent-hidden") : _.isBoolean(rules.is_empty) && !0 === rules.is_empty && is_empty ? $param_block.removeClass("vc_dependent-hidden") : rules.value && _.intersection(_.isArray(rules.value) ? rules.value : [rules.value], _.isArray(master_value) ? master_value : [master_value]).length ? $param_block.removeClass("vc_dependent-hidden") : rules.value_not_equal_to && !_.intersection(_.isArray(rules.value_not_equal_to) ? rules.value_not_equal_to : [rules.value_not_equal_to], _.isArray(master_value) ? master_value : [master_value]).length ? $param_block.removeClass("vc_dependent-hidden") : $param_block.addClass("vc_dependent-hidden");
  2267.                 var event = jQuery.Event("change");
  2268.                 event.extra_type = "vcHookDepended", $element.trigger(event)
  2269.             }, this), checkTabs && (this.checkTabs(), this.doCheckTabs = !0), this
  2270.         },
  2271.         checkTabs: function() {
  2272.             var that = this;
  2273.             !1 === this.tabsInit && (this.tabsInit = !0, this.$content.hasClass("vc_with-tabs") && (this.$tabsMenu = this.$content.find(".vc_edit-form-tabs-menu"))), this.$tabsMenu && (this.$content.find('[data-vc-ui-element="panel-edit-element-tab"]').each(function(index) {
  2274.                 var $tabControl = that.$tabsMenu.find('> [data-tab-index="' + index + '"]');
  2275.                 $(this).find('[data-vc-ui-element="panel-shortcode-param"]:not(".vc_dependent-hidden")').length ? $tabControl.hasClass("vc_dependent-hidden") && ($tabControl.removeClass("vc_dependent-hidden").removeClass("vc_tab-color-animated").addClass("vc_tab-color-animated"), window.setTimeout(function() {
  2276.                     $tabControl.removeClass("vc_tab-color-animated")
  2277.                 }, 200)) : $tabControl.addClass("vc_dependent-hidden")
  2278.             }), window.setTimeout(this.setTabsSize, 100))
  2279.         },
  2280.         setTabsSize: function() {
  2281.             this.$tabsMenu.parents(".vc_with-tabs.vc_panel-body").css("margin-top", this.$tabsMenu.outerHeight())
  2282.         },
  2283.         setActive: function() {
  2284.             this.$el.prev().addClass("active")
  2285.         },
  2286.         window: function() {
  2287.             return window
  2288.         },
  2289.         getParams: function() {
  2290.             var paramsSettings;
  2291.             return paramsSettings = this.mapped_params, this.params = _.extend({}, this.model.get("params")), _.each(paramsSettings, function(param) {
  2292.                 var value;
  2293.                 value = vc.atts.parseFrame.call(this, param), this.params[param.param_name] = value
  2294.             }, this), _.each(vc.edit_form_callbacks, function(callback) {
  2295.                 callback.call(this)
  2296.             }, this), this.params
  2297.         },
  2298.         content: function() {
  2299.             return this.$content
  2300.         },
  2301.         save: function() {
  2302.             if (this.panelInit) {
  2303.                 var shortcode = this.model.get("shortcode"),
  2304.                     params = this.getParams(),
  2305.                     mergedParams = _.extend({}, vc.getDefaults(shortcode), vc.getMergedParams(shortcode, params));
  2306.                 _.isUndefined(params.content) || (mergedParams.content = params.content), this.model.save({
  2307.                     params: mergedParams
  2308.                 }), this.showMessage(window.sprintf(window.i18nLocale.inline_element_saved, vc.getMapped(shortcode).name), "success"), !vc.frame_window && this.hide(), this.trigger("save")
  2309.             }
  2310.         },
  2311.         show: function() {
  2312.             this.$el.hasClass("vc_active") || (this.$el.addClass("vc_active"), this.draggable || this.initDraggable(), this.fixElContainment(), this.trigger("show"))
  2313.         },
  2314.         hide: function(e) {
  2315.             e && e.preventDefault(), this.checkAjax(), this.ajax = !1, this.model && (this.model = null), vc.active_panel = !1, this.currentModelParams = !1, this._killEditor(), this.$el.removeClass("vc_active"), this.$el.find(".vc_properties-list").removeClass("vc_with-tabs").css("margin-top", "auto"), this.$content.empty(), this.trigger("hide")
  2316.         },
  2317.         setTitle: function() {
  2318.             return this.$el.find(this.titleSelector).text(vc.getMapped(this.model.get("shortcode")).name + " " + window.i18nLocale.settings), this
  2319.         },
  2320.         _killEditor: function() {
  2321.             _.isUndefined(window.tinyMCE) || $("textarea.textarea_html", this.$el).each(function() {
  2322.                 var id = $(this).attr("id");
  2323.                 "4" === tinymce.majorVersion ? window.tinyMCE.execCommand("mceRemoveEditor", !0, id) : window.tinyMCE.execCommand("mceRemoveControl", !0, id)
  2324.             }), jQuery("body").off("click.wpcolorpicker")
  2325.         }
  2326.     }), vc.EditElementUIPanel = vc.EditElementPanelView.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperPanelViewResizable).vcExtendUI(vc.HelperPanelViewDraggable).extend({
  2327.         el: "#vc_ui-panel-edit-element",
  2328.         events: {
  2329.             'click [data-vc-ui-element="button-save"]': "save",
  2330.             'click [data-vc-ui-element="button-close"]': "hide",
  2331.             'click [data-vc-ui-element="button-minimize"]': "toggleOpacity",
  2332.             'click [data-vc-ui-element="panel-tab-control"]': "changeTab"
  2333.         },
  2334.         titleSelector: '[data-vc-ui-element="panel-title"]',
  2335.         initialize: function() {
  2336.             vc.EditElementUIPanel.__super__.initialize.call(this), this.on("afterResizeStart", function() {
  2337.                 this.$el.css("maxHeight", "none")
  2338.             })
  2339.         },
  2340.         show: function() {
  2341.             vc.EditElementUIPanel.__super__.show.call(this), $('[data-vc-ui-element="panel-tabs-controls"]', this.$el).remove(), this.$el.css("maxHeight", "75vh")
  2342.         },
  2343.         tabsMenu: function() {
  2344.             if (!1 === this.tabsInit) {
  2345.                 this.tabsInit = !0;
  2346.                 var $tabsMenu = this.$el.find('[data-vc-ui-element="panel-tabs-controls"]');
  2347.                 $tabsMenu.length && (this.$tabsMenu = $tabsMenu)
  2348.             }
  2349.             return this.$tabsMenu
  2350.         },
  2351.         buildTabs: function() {
  2352.             this.content().find('[data-vc-ui-element="panel-tabs-controls"]').prependTo('[data-vc-ui-element="panel-header-content"]')
  2353.         },
  2354.         changeTab: function(e) {
  2355.             e.preventDefault();
  2356.             var $tab = $(e.currentTarget);
  2357.             $tab.parent().hasClass("vc_active") || (this.$el.find('[data-vc-ui-element="panel-tabs-controls"] .vc_active:not([data-vc-ui-element="panel-tabs-line-dropdown"])').removeClass("vc_active"), $tab.parent().addClass("vc_active"), this.$el.find('[data-vc-ui-element="panel-edit-element-tab"].vc_active').removeClass("vc_active"), this.active_tab_index = this.$el.find($tab.data("vcUiElementTarget")).addClass("vc_active").index(), this.initParams(), this.$tabsMenu && this.$tabsMenu.vcTabsLine("checkDropdownContainerActive"), this.$content.parent().scrollTop(1).scrollTop(0), this.trigger("tabChange"))
  2358.         },
  2359.         checkTabs: function() {
  2360.             var _this = this;
  2361.             !1 === this.tabsInit && (this.tabsInit = !0, this.$tabsMenu = this.$el.find('[data-vc-ui-element="panel-tabs-controls"]')), this.tabsMenu() && (this.content().find('[data-vc-ui-element="panel-edit-element-tab"]').each(function(index) {
  2362.                 var $tabControl = _this.$tabsMenu.find('> [data-tab-index="' + index + '"]');
  2363.                 $(this).find('[data-vc-ui-element="panel-shortcode-param"]:not(".vc_dependent-hidden")').length ? $tabControl.hasClass("vc_dependent-hidden") && ($tabControl.removeClass("vc_dependent-hidden"), window.setTimeout(function() {
  2364.                     $tabControl.removeClass("vc_tab-color-animated")
  2365.                 }, 200)) : $tabControl.addClass("vc_dependent-hidden")
  2366.             }), this.$tabsMenu.vcTabsLine("refresh"), this.$tabsMenu.vcTabsLine("moveTabs"))
  2367.         }
  2368.     })
  2369. }(window.jQuery),
  2370. function($) {
  2371.     "use strict";
  2372.     vc.TemplateLibraryView = vc.PanelView.vcExtendUI(vc.HelperAjax).extend({
  2373.         myTemplates: [],
  2374.         $mainPopup: !1,
  2375.         $loadingPage: !1,
  2376.         $gridContainer: !1,
  2377.         $myTemplateContainer: !1,
  2378.         $popupItems: !1,
  2379.         $previewImage: !1,
  2380.         $previewTitle: !1,
  2381.         $previewUpdate: !1,
  2382.         $previewDownload: !1,
  2383.         $previewUpdateBtn: !1,
  2384.         $previewDownloadBtn: !1,
  2385.         $templatePreview: !1,
  2386.         $templatePage: !1,
  2387.         $downloadPage: !1,
  2388.         $updatePage: !1,
  2389.         $content: !1,
  2390.         $filter: !1,
  2391.         compiledGridTemplate: !1,
  2392.         compiledTemplate: !1,
  2393.         loaded: !1,
  2394.         data: !1,
  2395.         events: {
  2396.             "click [data-dismiss=panel]": "hide",
  2397.             "click .vc_ui-panel-close-button": "closePopupButton",
  2398.             "click .vc_ui-access-library-btn": "accessLibrary",
  2399.             "click #vc_template-library-template-grid .vc_ui-panel-template-preview-button": "previewButton",
  2400.             "click .vc_ui-panel-back-button": "backToTemplates",
  2401.             "click .vc_ui-panel-template-download-button, #vc_template-library-download-btn": "downloadButton",
  2402.             "click .vc_ui-panel-template-update-button, #vc_template-library-update-btn": "updateButton",
  2403.             "keyup #vc_template_lib_name_filter": "filterTemplates",
  2404.             "search #vc_template_lib_name_filter": "filterTemplates"
  2405.         },
  2406.         initialize: function() {
  2407.             _.bindAll(this, "loadLibrary", "addTemplateStatus", "loadMyTemplates", "deleteTemplate"), this.$mainPopup = this.$el.find(".vc_ui-panel-popup"), this.$loadingPage = this.$el.find(".vc_ui-panel-loading"), this.$gridContainer = this.$el.find("#vc_template-library-template-grid"), this.$myTemplateContainer = this.$el.find("#vc_template-library-shared_templates"), this.$popupItems = this.$el.find(".vc_ui-panel-popup-item"), this.$previewImage = this.$el.find(".vc_ui-panel-preview-image"), this.$previewTitle = this.$el.find(".vc_ui-panel-template-preview .vc_ui-panel-title"), this.$previewUpdate = this.$el.find("#vc_template-library-update"), this.$previewDownload = this.$el.find("#vc_template-library-download"), this.$previewUpdateBtn = this.$previewUpdate.find("#vc_template-library-update-btn"), this.$previewDownloadBtn = this.$previewUpdate.find("#vc_template-library-download-btn"), this.$templatePreview = this.$el.find(".vc_ui-panel-template-preview"), this.$templatePage = this.$el.find(".vc_ui-panel-template-content"), this.$downloadPage = this.$el.find(".vc_ui-panel-download"), this.$updatePage = this.$el.find(".vc_ui-panel-update"), this.$filter = this.$el.find("#vc_template_lib_name_filter"), this.$content = this.$el.find(".vc_ui-templates-content");
  2408.             var gridTemplateHtml = $("#vc_template-grid-item").html();
  2409.             this.compiledGridTemplate = vc.template(gridTemplateHtml);
  2410.             var myTemplateHtml = $("#vc_template-item").html();
  2411.             this.compiledTemplate = vc.template(myTemplateHtml), vc.events.on("templates:delete", this.deleteTemplate)
  2412.         },
  2413.         getLibrary: function() {
  2414.             if (this.loaded) return void this.showLibrary();
  2415.             this.checkAjax();
  2416.             var data = this.getStorage("templates"),
  2417.                 _this = this;
  2418.             data && "object" == typeof data && !_.isEmpty(data) ? (this.loaded = !0, this.loadLibrary(data), this.showLibrary()) : this.ajax = $.getJSON("//vc-cc-templates.wpbakery.com/templates.json").done(function(data) {
  2419.                 _this.setStorage("templates", data), _this.loaded = !0, _this.loadLibrary(data), _this.showLibrary()
  2420.             }).always(this.resetAjax)
  2421.         },
  2422.         removeStorage: function(name) {
  2423.             try {
  2424.                 localStorage.removeItem("vc4-" + name), localStorage.removeItem("vc4-" + name + "_expiresIn")
  2425.             } catch (e) {
  2426.                 return !1
  2427.             }
  2428.             return !0
  2429.         },
  2430.         getStorage: function(key) {
  2431.             var now = Date.now(),
  2432.                 expiresIn = localStorage.getItem("vc4-" + key + "_expiresIn");
  2433.             if (void 0 !== expiresIn && null !== expiresIn || (expiresIn = 0), expiresIn < now) return this.removeStorage(key), null;
  2434.             try {
  2435.                 return JSON.parse(localStorage.getItem("vc4-" + key))
  2436.             } catch (e) {
  2437.                 return null
  2438.             }
  2439.         },
  2440.         setStorage: function(key, value, expires) {
  2441.             expires = void 0 === expires || null === expires ? 86400 : Math.abs(expires);
  2442.             var now = Date.now(),
  2443.                 schedule = now + 1e3 * expires;
  2444.             try {
  2445.                 localStorage.setItem("vc4-" + key, JSON.stringify(value)), localStorage.setItem("vc4-" + key + "_expiresIn", schedule)
  2446.             } catch (e) {
  2447.                 return !1
  2448.             }
  2449.             return !0
  2450.         },
  2451.         loadLibrary: function(data) {
  2452.             if (data) {
  2453.                 var renderedOutput = "",
  2454.                     _this = this;
  2455.                 this.loaded = !0, this.data = data, this.$filter.val(""), data.forEach(function(item) {
  2456.                     item = _this.addTemplateStatus(item), renderedOutput += _this.compiledGridTemplate({
  2457.                         id: item.id,
  2458.                         title: item.title,
  2459.                         thumbnailUrl: item.thumbnailUrl,
  2460.                         previewUrl: item.previewUrl,
  2461.                         status: item.status,
  2462.                         downloaded: _.find(_this.myTemplates, {
  2463.                             id: item.id
  2464.                         }),
  2465.                         version: item.version
  2466.                     })
  2467.                 }), this.$gridContainer.html(renderedOutput)
  2468.             }
  2469.         },
  2470.         showLibrary: function() {
  2471.             this.$loadingPage.addClass("vc_ui-hidden"), this.$mainPopup.removeClass("vc_ui-hidden"), this.$templatePage.removeClass("vc_ui-hidden")
  2472.         },
  2473.         addTemplateStatus: function(template) {
  2474.             var statusHtml = "",
  2475.                 myTemplate = _.find(this.myTemplates, {
  2476.                     id: template.id
  2477.                 });
  2478.             if (myTemplate) {
  2479.                 var status = window.i18nLocale.ui_template_downloaded;
  2480.                 template.version > myTemplate.version && (status = window.i18nLocale.ui_template_fupdate), statusHtml = '<span class="vc_ui-panel-template-item-info"><span>' + status + "</span></span>"
  2481.             }
  2482.             return template.status = statusHtml, template
  2483.         },
  2484.         loadMyTemplates: function() {
  2485.             var renderedOutput = "",
  2486.                 _this = this;
  2487.             this.myTemplates.forEach(function(item) {
  2488.                 renderedOutput += _this.compiledTemplate({
  2489.                     post_id: item.post_id,
  2490.                     title: item.title
  2491.                 })
  2492.             }), this.$myTemplateContainer.html(renderedOutput)
  2493.         },
  2494.         closePopupButton: function(e) {
  2495.             e && e.preventDefault && e.preventDefault(), this.$mainPopup.toggleClass("vc_ui-hidden"), this.$popupItems.addClass("vc_ui-hidden"), this.$content.removeClass("vc_ui-hidden")
  2496.         },
  2497.         accessLibrary: function() {
  2498.             this.$loadingPage.removeClass("vc_ui-hidden"), this.$content.addClass("vc_ui-hidden"), this.getLibrary()
  2499.         },
  2500.         previewButton: function(e) {
  2501.             var $template = $(e.currentTarget),
  2502.                 imgUrl = $template.data("preview-url"),
  2503.                 title = $template.data("title"),
  2504.                 templateId = $template.data("template-id"),
  2505.                 templateVersion = $template.data("template-version");
  2506.             this.$previewImage.attr("src", imgUrl), this.$previewTitle.text(title);
  2507.             var myTemplate = _.find(this.myTemplates, {
  2508.                 id: templateId
  2509.             });
  2510.             this.$previewUpdate.toggleClass("vc_ui-hidden", !(myTemplate && myTemplate.version < templateVersion)), this.$previewDownload.toggleClass("vc_ui-hidden", !!myTemplate), this.$previewUpdateBtn.data("template-id", templateId), this.$previewDownloadBtn.data("template-id", templateId), this.$popupItems.addClass("vc_ui-hidden"), this.$templatePreview.removeClass("vc_ui-hidden"), this.$templatePreview.attr("data-template-id", templateId)
  2511.         },
  2512.         backToTemplates: function() {
  2513.             this.$popupItems.addClass("vc_ui-hidden"), this.$templatePage.removeClass("vc_ui-hidden")
  2514.         },
  2515.         deleteTemplate: function(data) {
  2516.             if ("shared_templates" === data.type) {
  2517.                 var index = _.findIndex(this.myTemplates, {
  2518.                     post_id: data.id
  2519.                 }); - 1 !== index && (this.myTemplates.splice(index, 1), this.loaded && this.loadLibrary(this.data))
  2520.             }
  2521.         },
  2522.         downloadButton: function(e) {
  2523.             e && e.preventDefault && e.preventDefault();
  2524.             var id = jQuery(e.currentTarget).closest("[data-template-id]").data("templateId");
  2525.             id && (this.showDownloadOverlay(), this.downloadTemplate(id))
  2526.         },
  2527.         updateButton: function(e) {
  2528.             e && e.preventDefault && e.preventDefault(), jQuery(e.currentTarget).closest("[data-template-id]").data("templateId") && this.showUpdateOverlay()
  2529.         },
  2530.         showDownloadOverlay: function() {
  2531.             this.$popupItems.addClass("vc_ui-hidden"), this.$downloadPage.removeClass("vc_ui-hidden")
  2532.         },
  2533.         hideDownloadOverlay: function(message) {
  2534.             message && alert(message), this.$downloadPage.addClass("vc_ui-hidden"), this.$templatePage.removeClass("vc_ui-hidden")
  2535.         },
  2536.         showUpdateOverlay: function() {
  2537.             this.$popupItems.addClass("vc_ui-hidden"), this.$updatePage.removeClass("vc_ui-hidden")
  2538.         },
  2539.         hideUpdateOverlay: function(message) {
  2540.             this.$updatePage.addClass("vc_ui-hidden"), this.$templatePage.removeClass("vc_ui-hidden")
  2541.         },
  2542.         downloadTemplate: function(id) {
  2543.             this.checkAjax();
  2544.             var fail = !0;
  2545.             this.ajax = $.ajax({
  2546.                 type: "POST",
  2547.                 url: window.ajaxurl,
  2548.                 data: {
  2549.                     action: "vc_shared_templates_download",
  2550.                     id: id,
  2551.                     _vcnonce: window.vcAdminNonce
  2552.                 },
  2553.                 dataType: "json",
  2554.                 context: this
  2555.             }).done(function(response) {
  2556.                 if (response && response.success) {
  2557.                     var template = _.find(this.data, {
  2558.                         id: id
  2559.                     });
  2560.                     template && (fail = !1, template.post_id = response.data.post_id, this.myTemplates.unshift(template), this.loadMyTemplates(), this.loadLibrary(this.data), this.showLibrary())
  2561.                 }
  2562.             }).always(function(response, status) {
  2563.                 var message = "";
  2564.                 ("success" !== status || fail) && (message = window.i18nLocale.ui_templates_failed_to_download), this.hideDownloadOverlay(message), this.resetAjax()
  2565.             })
  2566.         },
  2567.         filterTemplates: function() {
  2568.             var inputValue = this.$filter.val(),
  2569.                 filter = ".vc_ui-panel-template-item .vc_ui-panel-template-item-name:containsi('" + inputValue + "')";
  2570.             $(".vc_ui-panel-template-item.vc_ui-visible", this.$gridContainer).removeClass("vc_ui-visible"), $(filter, this.$gridContainer).closest(".vc_ui-panel-template-item").addClass("vc_ui-visible")
  2571.         }
  2572.     }), $(function() {
  2573.         window.vcTemplatesLibraryData && (vc.templatesLibrary = new vc.TemplateLibraryView({
  2574.             el: '[data-vc-ui-element="panel-edit-element-tab"][data-tab="shared_templates"]'
  2575.         }), vc.templatesLibrary.myTemplates = window.vcTemplatesLibraryData.templates || [], vc.templatesLibrary.loadMyTemplates())
  2576.     })
  2577. }(window.jQuery),
  2578. function($) {
  2579.     "use strict";
  2580.     vc.PostSettingsUIPanelFrontendEditor = vc.PostSettingsPanelView.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperPanelViewResizable).vcExtendUI(vc.HelperPanelViewDraggable).vcExtendUI({
  2581.         panelName: "post_settings",
  2582.         uiEvents: {
  2583.             setSize: "setEditorSize",
  2584.             show: "setEditorSize"
  2585.         },
  2586.         setSize: function() {
  2587.             this.trigger("setSize")
  2588.         },
  2589.         setDefaultHeightSettings: function() {
  2590.             this.$el.css("height", "75vh")
  2591.         },
  2592.         setEditorSize: function() {
  2593.             this.editor.setSizeResizable()
  2594.         }
  2595.     }), vc.PostSettingsUIPanelBackendEditor = vc.PostSettingsPanelViewBackendEditor.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperPanelViewResizable).vcExtendUI(vc.HelperPanelViewDraggable).vcExtendUI({
  2596.         uiEvents: {
  2597.             setSize: "setEditorSize",
  2598.             show: "setEditorSize",
  2599.             render: "removeChangeTitleField"
  2600.         },
  2601.         setSize: function() {
  2602.             this.trigger("setSize")
  2603.         },
  2604.         setEditorSize: function() {
  2605.             this.editor.setSizeResizable()
  2606.         },
  2607.         setDefaultHeightSettings: function() {
  2608.             this.$el.css("height", "75vh")
  2609.         },
  2610.         removeChangeTitleField: function() {
  2611.             $("#vc_settings-title-container").remove()
  2612.         }
  2613.     })
  2614. }(window.jQuery),
  2615. function($) {
  2616.     "use strict";
  2617.     var events = {
  2618.         'click [data-vc-ui-element="button-save"]': "save",
  2619.         'click [data-vc-ui-element="button-close"]': "hide",
  2620.         'click [data-vc-ui-element="button-minimize"]': "toggleOpacity",
  2621.         'click [data-vc-ui-element="button-layout"]': "setLayout",
  2622.         'click [data-vc-ui-element="button-update-layout"]': "updateFromInput"
  2623.     };
  2624.     vc.RowLayoutUIPanelFrontendEditor = vc.RowLayoutEditorPanelView.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperPanelViewDraggable).extend({
  2625.         panelName: "rowLayouts",
  2626.         events: events
  2627.     }), vc.RowLayoutUIPanelBackendEditor = vc.RowLayoutEditorPanelViewBackend.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperPanelViewDraggable).extend({
  2628.         panelName: "rowLayouts",
  2629.         events: events
  2630.     })
  2631. }(window.jQuery),
  2632. function($) {
  2633.     "use strict";
  2634.     vc.PresetSettingsUIPanelFrontendEditor = vc.PanelView.vcExtendUI(vc.HelperPanelViewHeaderFooter).vcExtendUI(vc.HelperAjax).vcExtendUI({
  2635.         panelName: "preset_settings",
  2636.         showMessageDisabled: !1,
  2637.         events: {
  2638.             'click [data-vc-ui-delete="preset-title"]': "removePreset",
  2639.             'click [data-vc-ui-element="button-close"]': "hide",
  2640.             'click [data-vc-ui-element="button-minimize"]': "toggleOpacity",
  2641.             "click [data-vc-ui-add-preset]": "createPreset"
  2642.         },
  2643.         initialize: function(options) {
  2644.             this.frontEnd = options && options.frontEnd
  2645.         },
  2646.         createPreset: function(e) {
  2647.             var $control, preset, tag, row, column, model, row_params, column_params, rowOptions, showSettings;
  2648.             if (_.isUndefined(vc.ShortcodesBuilder) || (this.builder = new vc.ShortcodesBuilder), $control = $(e.currentTarget), preset = $control.data("preset"), tag = $control.data("tag"), row_params = {}, column_params = {
  2649.                     width: "1/1"
  2650.                 }, rowOptions = {
  2651.                     shortcode: "vc_row",
  2652.                     params: row_params
  2653.                 }, !0 === this.frontEnd) {
  2654.                 this.builder.create(rowOptions);
  2655.                 var columnOptions = {
  2656.                     shortcode: "vc_column",
  2657.                     params: column_params,
  2658.                     parent_id: this.builder.lastID()
  2659.                 };
  2660.                 this.builder.create(columnOptions);
  2661.                 var options = {
  2662.                     shortcode: tag,
  2663.                     parent_id: this.builder.lastID()
  2664.                 };
  2665.                 preset && (options.preset = preset), vc.closeActivePanel(), this.builder.create(options), this.model = this.builder.last(), this.builder.render()
  2666.             } else {
  2667.                 row = vc.shortcodes.create(rowOptions);
  2668.                 var columnOptions = {
  2669.                     shortcode: "vc_column",
  2670.                     params: column_params,
  2671.                     parent_id: row.id,
  2672.                     root_id: row.id
  2673.                 };
  2674.                 column = vc.shortcodes.create(columnOptions), model = row;
  2675.                 var options = {
  2676.                     shortcode: tag,
  2677.                     parent_id: column.id,
  2678.                     root_id: row.id
  2679.                 };
  2680.                 preset && (options.preset = preset), model = vc.shortcodes.create(options), vc.closeActivePanel(), this.model = model
  2681.             }(showSettings = !(_.isBoolean(vc.getMapped(tag).show_settings_on_create) && !1 === vc.getMapped(tag).show_settings_on_create)) && this.showEditForm()
  2682.         },
  2683.         showEditForm: function() {
  2684.             vc.edit_element_block_view.render(this.model)
  2685.         },
  2686.         render: function() {
  2687.             return this.$el.css("left", ($(window).width() - this.$el.width()) / 2), this
  2688.         },
  2689.         removePreset: function(e) {
  2690.             e && e.preventDefault();
  2691.             var closestPreset = jQuery(e.currentTarget).closest('[data-vc-ui-delete="preset-title"]'),
  2692.                 presetId = closestPreset.data("preset"),
  2693.                 presetParent = closestPreset.data("preset-parent");
  2694.             this.deleteSettings(presetId, presetParent, e)
  2695.         },
  2696.         deleteSettings: function(id, shortcode_name) {
  2697.             var _this = this;
  2698.             return !!confirm(window.i18nLocale.delete_preset_confirmation) && (this.checkAjax(), this.ajax = $.ajax({
  2699.                 type: "POST",
  2700.                 dataType: "json",
  2701.                 url: window.ajaxurl,
  2702.                 data: this.deleteSettingsAjaxData(shortcode_name, id),
  2703.                 context: this
  2704.             }).done(function(response) {
  2705.                 response && response.success && (this.showMessage(window.i18nLocale.preset_removed, "success"), _this.$el.find('[data-preset="' + id + '"]').closest(".vc_ui-template").remove(), vc.events.trigger("vc:deletePreset", id))
  2706.             }).always(this.resetAjax), this.ajax)
  2707.         },
  2708.         deleteSettingsAjaxData: function(shortcode_name, id) {
  2709.             return {
  2710.                 action: "vc_action_delete_settings_preset",
  2711.                 shortcode_name: shortcode_name,
  2712.                 vc_inline: !0,
  2713.                 id: id,
  2714.                 _vcnonce: window.vcAdminNonce
  2715.             }
  2716.         },
  2717.         showMessage: function(text, type) {
  2718.             var wrapperCssClasses;
  2719.             if (this.showMessageDisabled) return !1;
  2720.             wrapperCssClasses = "vc_col-xs-12 wpb_element_wrapper", this.message_box_timeout && this.$el.find("[data-vc-panel-message]").remove() && window.clearTimeout(this.message_box_timeout), this.message_box_timeout = !1;
  2721.             var $messageBox, messageBoxTemplate = vc.template('<div class="vc_message_box vc_message_box-standard vc_message_box-rounded vc_color-<%- color %>"><div class="vc_message_box-icon"><i class="fa fa fa-<%- icon %>"></i></div><p><%- text %></p></div>');
  2722.             switch (type) {
  2723.                 case "error":
  2724.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  2725.                         color: "danger",
  2726.                         icon: "times",
  2727.                         text: text
  2728.                     }));
  2729.                     break;
  2730.                 case "warning":
  2731.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  2732.                         color: "warning",
  2733.                         icon: "exclamation-triangle",
  2734.                         text: text
  2735.                     }));
  2736.                     break;
  2737.                 case "success":
  2738.                     $messageBox = $('<div class="' + wrapperCssClasses + '" data-vc-panel-message>').html(messageBoxTemplate({
  2739.                         color: "success",
  2740.                         icon: "check",
  2741.                         text: text
  2742.                     }))
  2743.             }
  2744.             $messageBox.prependTo(this.$el.find(".vc_properties-list")), $messageBox.fadeIn(), this.message_box_timeout = window.setTimeout(function() {
  2745.                 $messageBox.remove()
  2746.             }, 6e3)
  2747.         }
  2748.     })
  2749. }(window.jQuery), _.isUndefined(window.vc) && (window.vc = {}), void 0 === window.setCookie && (window.setCookie = function(c_name, value, exdays) {
  2750.         var exdate = new Date;
  2751.         exdate.setDate(exdate.getDate() + exdays);
  2752.         var c_value = encodeURIComponent(value) + (null === exdays ? "" : "; expires=" + exdate.toUTCString());
  2753.         document.cookie = c_name + "=" + c_value
  2754.     }), void 0 === window.getCookie && (window.getCookie = function(c_name) {
  2755.         var i, x, y, ARRcookies = document.cookie.split(";");
  2756.         for (i = 0; i < ARRcookies.length; i++)
  2757.             if (x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")), y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1), (x = x.replace(/^\s+|\s+$/g, "")) == c_name) return decodeURIComponent(y)
  2758.     }),
  2759.     function($) {
  2760.         $.expr[":"].containsi = function(a, i, m) {
  2761.             return 0 <= jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())
  2762.         }
  2763.     }(window.jQuery);
  2764. var vc_regexp_shortcode = _.memoize(function() {
  2765.     return RegExp("\\[(\\[?)([\\w|-]+\\b)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)")
  2766. });
  2767. if (vc.memoizeWrapper = function(func, resolver) {
  2768.         var cache = {};
  2769.         return function() {
  2770.             var key = resolver ? resolver.apply(this, arguments) : arguments[0];
  2771.             return _.hasOwnProperty.call(cache, key) || (cache[key] = func.apply(this, arguments)), _.isObject(cache[key]) ? jQuery.fn.extend(!0, {}, cache[key]) : cache[key]
  2772.         }
  2773.     }, vc.events.on("shortcodes:vc_row:add:param:name:parallax shortcodes:vc_row:update:param:name:parallax", function(model, value) {
  2774.         if (value) {
  2775.             var params = model.get("params");
  2776.             params && params.css && (params.css = params.css.replace(/(background(\-position)?\s*\:\s*[\S]+(\s*[^\!\s]+)?)[\s*\!important]*/g, "$1"), model.set("params", params, {
  2777.                 silent: !0
  2778.             }))
  2779.         }
  2780.     }), vc.events.on("shortcodes:vc_single_image:sync shortcodes:vc_single_image:add", function(model) {
  2781.         var params = model.get("params");
  2782.         params.link && !params.onclick && (params.onclick = "custom_link", model.save({
  2783.             params: params
  2784.         }))
  2785.     }), window.vcConsoleLog = function() {
  2786.         vcConsoleLog.history = vcConsoleLog.history || [], vcConsoleLog.history.push(arguments), this.console && console.log(Array.prototype.slice.call(arguments))
  2787.     }, _.isUndefined(window.vc)) var vc = {};
  2788. window.vc.filters = {
  2789.         templates: []
  2790.     }, window.vc.addTemplateFilter = function(callback) {
  2791.         _.isFunction(callback) && this.filters.templates.push(callback)
  2792.     },
  2793.     function($) {
  2794.         function fixedEncodeURIComponent(str) {
  2795.             return encodeURIComponent(str).replace(/[!'()*]/g, escape)
  2796.         }
  2797.  
  2798.         function Suggester(element, options) {
  2799.             this.el = element, this.$el = $(this.el), this.$el_wrap = "", this.$block = "", this.suggester = "", this.selected_items = [], this.options = _.isObject(options) ? options : {}, _.defaults(this.options, {
  2800.                 css_class: "vc_suggester",
  2801.                 limit: !1,
  2802.                 source: {},
  2803.                 predefined: [],
  2804.                 locked: !1,
  2805.                 select_callback: function(label, data) {},
  2806.                 remove_callback: function(label, data) {},
  2807.                 update_callback: function(label, data) {},
  2808.                 check_locked_callback: function(el, data) {
  2809.                     return !1
  2810.                 }
  2811.             }), this.init()
  2812.         }
  2813.  
  2814.         function VcSortedList(element, settings) {
  2815.             this.el = element, this.$el = $(this.el), this.$data_field = this.$el.find(".wpb_vc_param_value"), this.$toolbar = this.$el.find(".vc_sorted-list-toolbar"), this.$current_control = this.$el.find(".vc_sorted-list-container"), _.defaults(this.options, {}), this.init()
  2816.         }
  2817.         var vc_activeMce;
  2818.         window.init_textarea_html = function($element) {
  2819.             var $wp_link, textfield_id, $form_line, $content_holder;
  2820.             $wp_link = $("#wp-link"), $wp_link.parent().hasClass("wp-dialog") && $wp_link.wpdialog("destroy"), textfield_id = $element.attr("id"), $form_line = $element.closest(".edit_form_line"), $content_holder = $form_line.find(".vc_textarea_html_content");
  2821.             try {
  2822.                 _.isUndefined(tinyMCEPreInit.qtInit[textfield_id]) && (window.tinyMCEPreInit.qtInit[textfield_id] = _.extend({}, window.tinyMCEPreInit.qtInit[window.wpActiveEditor], {
  2823.                         id: textfield_id
  2824.                     })), window.tinyMCEPreInit && window.tinyMCEPreInit.mceInit[window.wpActiveEditor] && (window.tinyMCEPreInit.mceInit[textfield_id] = _.extend({}, window.tinyMCEPreInit.mceInit[window.wpActiveEditor], {
  2825.                         resize: "vertical",
  2826.                         height: 200,
  2827.                         id: textfield_id,
  2828.                         setup: function(ed) {
  2829.                             void 0 !== ed.on ? ed.on("init", function(ed) {
  2830.                                 window.wpActiveEditor = textfield_id
  2831.                             }) : ed.onInit.add(function(ed) {
  2832.                                 window.wpActiveEditor = textfield_id
  2833.                             })
  2834.                         }
  2835.                     }), window.tinyMCEPreInit.mceInit[textfield_id].plugins = window.tinyMCEPreInit.mceInit[textfield_id].plugins.replace(/,?wpfullscreen/, ""), window.tinyMCEPreInit.mceInit[textfield_id].wp_autoresize_on = !1),
  2836.                     vc.edit_element_block_view && vc.edit_element_block_view.currentModelParams ? $element.val(vc_wpautop(vc.edit_element_block_view.currentModelParams[$content_holder.attr("name")] || "")) : $element.val($content_holder.val()), quicktags(window.tinyMCEPreInit.qtInit[textfield_id]), QTags._buttonsInit(), window.tinymce && (window.switchEditors && window.switchEditors.go(textfield_id, "tmce"), "4" === tinymce.majorVersion && tinymce.execCommand("mceAddEditor", !0, textfield_id)), vc_activeMce = textfield_id, window.wpActiveEditor = textfield_id
  2837.             } catch (e) {
  2838.                 $element.data("vcTinyMceDisabled", !0).appendTo($form_line), $("#wp-" + textfield_id + "-wrap").remove(), console && console.error && (console.error("VC: Tinymce error! Compatibility problem with other plugins."), console.error(e))
  2839.             }
  2840.         }, Color.prototype.toString = function() {
  2841.             if (1 > this._alpha) return this.toCSS("rgba", this._alpha).replace(/\s+/g, "");
  2842.             var hex = parseInt(this._color, 10).toString(16);
  2843.             if (this.error) return "";
  2844.             if (6 > hex.length)
  2845.                 for (var i = 6 - hex.length - 1; 0 <= i; i--) hex = "0" + hex;
  2846.             return "#" + hex
  2847.         }, vc.loop_partial = function(template_name, key, loop, settings) {
  2848.             var data = _.isObject(loop) && !_.isUndefined(loop[key]) ? loop[key] : "";
  2849.             return vc.template($("#_vcl-" + template_name).html(), vc.templateOptions.custom)({
  2850.                 name: key,
  2851.                 data: data,
  2852.                 settings: settings
  2853.             })
  2854.         }, vc.loop_field_not_hidden = function(key, loop) {
  2855.             return !(_.isObject(loop[key]) && _.isBoolean(loop[key].hidden) && !0 === loop[key].hidden)
  2856.         }, vc.is_locked = function(data) {
  2857.             return _.isObject(data) && _.isBoolean(data.locked) && !0 === data.locked
  2858.         }, Suggester.prototype = {
  2859.             constructor: Suggester,
  2860.             init: function() {
  2861.                 _.bindAll(this, "buildSource", "itemSelected", "labelClick", "setFocus", "resize"), this.$el.wrap('<ul class="' + this.options.css_class + '"><li class="input"/></ul>'), this.$el_wrap = this.$el.parent(), this.$block = this.$el_wrap.closest("ul").append($('<li class="clear"/>')), this.$el.focus(this.resize).blur(function() {
  2862.                     $(this).parent().width(170), $(this).val("")
  2863.                 }), this.$block.click(this.setFocus), this.suggester = this.$el.data("suggest"), this.$el.autocomplete({
  2864.                     source: this.buildSource,
  2865.                     select: this.itemSelected,
  2866.                     minLength: 2,
  2867.                     focus: function(event, ui) {
  2868.                         return !1
  2869.                     }
  2870.                 }).data("ui-autocomplete")._renderItem = function(ul, item) {
  2871.                     return $('<li data-value="' + item.value + '">').append("<a>" + item.name + "</a>").appendTo(ul)
  2872.                 }, this.$el.autocomplete("widget").addClass("vc_ui-front"), _.isArray(this.options.predefined) && _.each(this.options.predefined, function(item) {
  2873.                     this.create(item)
  2874.                 }, this)
  2875.             },
  2876.             resize: function() {
  2877.                 var position = this.$el_wrap.position(),
  2878.                     block_position = this.$block.position();
  2879.                 this.$el_wrap.width(parseFloat(this.$block.width()) - (parseFloat(position.left) - parseFloat(block_position.left) + 4))
  2880.             },
  2881.             setFocus: function(e) {
  2882.                 e.preventDefault(), $(e.target).hasClass(this.options.css_class) && this.$el.trigger("focus")
  2883.             },
  2884.             itemSelected: function(event, ui) {
  2885.                 return this.$el.blur(), this.create(ui.item), this.$el.focus(), !1
  2886.             },
  2887.             create: function(item) {
  2888.                 var $label, exclude_css, index = this.selected_items.push(item) - 1,
  2889.                     remove = !0 === this.options.check_locked_callback(this.$el, item) ? "" : ' <a class="remove">&times;</a>';
  2890.                 _.isUndefined(this.selected_items[index].action) && (this.selected_items[index].action = "+"), exclude_css = "-" === this.selected_items[index].action ? " exclude" : " include", $label = $('<li class="vc_suggest-label' + exclude_css + '" data-index="' + index + '" data-value="' + item.value + '"><span class="label">' + item.name + "</span>" + remove + "</li>"), $label.insertBefore(this.$el_wrap), _.isEmpty(remove) || $label.click(this.labelClick), this.options.select_callback($label, this.selected_items)
  2891.             },
  2892.             labelClick: function(e) {
  2893.                 e.preventDefault();
  2894.                 var $label = $(e.currentTarget),
  2895.                     index = parseInt($label.data("index"), 10);
  2896.                 if ($(e.target).is(".remove")) return this.selected_items.splice(index, 1), this.options.remove_callback($label, this.selected_items), $label.remove(), !1;
  2897.                 this.selected_items[index].action = "+" === this.selected_items[index].action ? "-" : "+", "+" === this.selected_items[index].action ? $label.removeClass("exclude").addClass("include") : $label.removeClass("include").addClass("exclude"), this.options.update_callback($label, this.selected_items)
  2898.             },
  2899.             buildSource: function(request, response) {
  2900.                 this.ajax && (this.ajax.abort(), response([]), this.ajax = !1);
  2901.                 var exclude = _.filter(_.map(this.selected_items, function(item) {
  2902.                     return item ? item.value : void 0
  2903.                 })).join(",");
  2904.                 this.ajax = $.ajax({
  2905.                     type: "POST",
  2906.                     dataType: "json",
  2907.                     url: window.ajaxurl,
  2908.                     data: {
  2909.                         action: "wpb_get_loop_suggestion",
  2910.                         field: this.suggester,
  2911.                         exclude: exclude,
  2912.                         query: request.term,
  2913.                         _vcnonce: window.vcAdminNonce
  2914.                     }
  2915.                 }).done(function(data) {
  2916.                     response(data)
  2917.                 })
  2918.             }
  2919.         }, $.fn.suggester = function(option) {
  2920.             return this.each(function() {
  2921.                 var $this = $(this),
  2922.                     data = $this.data("suggester");
  2923.                 data || $this.data("suggester", data = new Suggester(this, option)), "string" == typeof option && data[option]()
  2924.             })
  2925.         };
  2926.         var VcLoopEditorView = Backbone.View.extend({
  2927.                 className: "loop_params_holder",
  2928.                 events: {
  2929.                     "click input, select": "save",
  2930.                     "change input, select": "save",
  2931.                     "change :checkbox[data-input]": "updateCheckbox"
  2932.                 },
  2933.                 query_options: {},
  2934.                 return_array: {},
  2935.                 controller: "",
  2936.                 initialize: function() {
  2937.                     _.bindAll(this, "save", "updateSuggestion", "suggestionLocked")
  2938.                 },
  2939.                 render: function(controller) {
  2940.                     var template = vc.template($("#vcl-loop-frame").html(), _.extend({}, vc.templateOptions.custom, {
  2941.                         variable: "loop"
  2942.                     }));
  2943.                     return this.controller = controller, this.$el.html(template(this.model)), this.controller.$el.append(this.$el), _.each($("[data-suggest]"), function(object) {
  2944.                         var $field = $(object),
  2945.                             current_value = window.decodeURIComponent($("[data-suggest-prefill=" + $field.data("suggest") + "]").val());
  2946.                         $field.suggester({
  2947.                             predefined: $.parseJSON(current_value),
  2948.                             select_callback: this.updateSuggestion,
  2949.                             update_callback: this.updateSuggestion,
  2950.                             remove_callback: this.updateSuggestion,
  2951.                             check_locked_callback: this.suggestionLocked
  2952.                         })
  2953.                     }, this), this
  2954.                 },
  2955.                 show: function() {
  2956.                     this.$el.slideDown()
  2957.                 },
  2958.                 save: function(e) {
  2959.                     this.return_array = {}, _.each(this.model, function(value, key) {
  2960.                         var value = this.getValue(key, value);
  2961.                         _.isString(value) && !_.isEmpty(value) && (this.return_array[key] = value)
  2962.                     }, this), this.controller.setInputValue(this.return_array)
  2963.                 },
  2964.                 getValue: function(key) {
  2965.                     return $("[name=" + key + "]", this.$el).val()
  2966.                 },
  2967.                 hide: function() {
  2968.                     this.$el.slideUp()
  2969.                 },
  2970.                 toggle: function() {
  2971.                     this.$el.is(":animated") || this.$el.slideToggle()
  2972.                 },
  2973.                 updateCheckbox: function(e) {
  2974.                     var $checkbox = $(e.currentTarget),
  2975.                         input_name = $checkbox.data("input"),
  2976.                         $input = $("[data-name=" + input_name + "]", this.$el),
  2977.                         value = [];
  2978.                     $("[data-input=" + input_name + "]:checked").each(function() {
  2979.                         value.push($(this).val())
  2980.                     }), $input.val(value), this.save()
  2981.                 },
  2982.                 updateSuggestion: function($elem, data) {
  2983.                     var value, $suggestion_block = $elem.closest("[data-block=suggestion]");
  2984.                     value = _.reduce(data, function(memo, label) {
  2985.                         return _.isEmpty(label) ? "" : memo + (_.isEmpty(memo) ? "" : ",") + ("-" === label.action ? "-" : "") + label.value
  2986.                     }, "").trim(), $suggestion_block.find("[data-suggest-value]").val(value).trigger("change")
  2987.                 },
  2988.                 suggestionLocked: function($elem, data) {
  2989.                     var value = data.value,
  2990.                         field = $elem.closest("[data-block=suggestion]").find("[data-suggest-value]").data("suggest-value");
  2991.                     return this.controller.settings && this.controller.settings[field] && _.isBoolean(this.controller.settings[field].locked) && 1 == this.controller.settings[field].locked && _.isString(this.controller.settings[field].value) && 0 <= _.indexOf(this.controller.settings[field].value.replace("-", "").split(/\,/), "" + value)
  2992.                 }
  2993.             }),
  2994.             VcLoop = Backbone.View.extend({
  2995.                 events: {
  2996.                     "click .vc_loop-build": "showEditor"
  2997.                 },
  2998.                 initialize: function() {
  2999.                     _.bindAll(this, "createEditor"), this.$input = $(".wpb_vc_param_value", this.$el), this.$button = this.$el.find(".vc_loop-build"), this.data = this.$input.val(), this.settings = $.parseJSON(window.decodeURIComponent(this.$button.data("settings")))
  3000.                 },
  3001.                 render: function() {
  3002.                     return this
  3003.                 },
  3004.                 showEditor: function(e) {
  3005.                     if (e.preventDefault(), _.isObject(this.loop_editor_view)) return this.loop_editor_view.toggle(), !1;
  3006.                     $.ajax({
  3007.                         type: "POST",
  3008.                         dataType: "json",
  3009.                         url: window.ajaxurl,
  3010.                         data: {
  3011.                             action: "wpb_get_loop_settings",
  3012.                             value: this.data,
  3013.                             settings: this.settings,
  3014.                             post_id: vc.post_id,
  3015.                             _vcnonce: window.vcAdminNonce
  3016.                         }
  3017.                     }).done(this.createEditor)
  3018.                 },
  3019.                 createEditor: function(data) {
  3020.                     this.loop_editor_view = new VcLoopEditorView({
  3021.                         model: _.isEmpty(data) ? {} : data
  3022.                     }), this.loop_editor_view.render(this).show()
  3023.                 },
  3024.                 setInputValue: function(value) {
  3025.                     this.$input.val(_.map(value, function(value, key) {
  3026.                         return key + ":" + value
  3027.                     }).join("|"))
  3028.                 }
  3029.             }),
  3030.             VcOptionsField = Backbone.View.extend({
  3031.                 events: {
  3032.                     "click .vc_options-edit": "showEditor",
  3033.                     "click .vc_close-button": "showEditor",
  3034.                     "click input, select": "save",
  3035.                     "change input, select": "save",
  3036.                     "keyup input": "save"
  3037.                 },
  3038.                 data: {},
  3039.                 fields: {},
  3040.                 initialize: function() {
  3041.                     this.$button = this.$el.find(".vc_options-edit"), this.$form = this.$el.find(".vc_options-fields"), this.$input = this.$el.find(".wpb_vc_param_value"), this.settings = this.$form.data("settings"), this.parseData(), this.render()
  3042.                 },
  3043.                 render: function() {
  3044.                     var html = "";
  3045.                     return _.each(this.settings, function(field) {
  3046.                         _.isUndefined(this.data[field.name]) ? _.isUndefined(field.value) || (field.value = field.value.toString().split(","), this.data[field.name] = field.value) : field.value = this.data[field.name], this.fields[field.name] = field;
  3047.                         var $field = $("#vcl-options-field-" + field.type);
  3048.                         if ($field.is("script")) {
  3049.                             var template = vc.template($field.html(), vc.templateOptions.custom);
  3050.                             html += template(_.extend({}, {
  3051.                                 name: "",
  3052.                                 label: "",
  3053.                                 value: [],
  3054.                                 options: "",
  3055.                                 description: ""
  3056.                             }, field))
  3057.                         }
  3058.                     }, this), this.$form.html(html + this.$form.html()), this
  3059.                 },
  3060.                 parseData: function() {
  3061.                     _.each(this.$input.val().split("|"), function(data) {
  3062.                         if (data.match(/\:/)) {
  3063.                             var split = data.split(":"),
  3064.                                 name = split[0],
  3065.                                 value = split[1];
  3066.                             this.data[name] = _.map(value.split(","), function(v) {
  3067.                                 return window.decodeURIComponent(v)
  3068.                             })
  3069.                         }
  3070.                     }, this)
  3071.                 },
  3072.                 saveData: function() {
  3073.                     var data_string = _.map(this.data, function(value, key) {
  3074.                         return key + ":" + _.map(value, function(v) {
  3075.                             return window.encodeURIComponent(v)
  3076.                         }).join(",")
  3077.                     }).join("|");
  3078.                     this.$input.val(data_string)
  3079.                 },
  3080.                 showEditor: function() {
  3081.                     this.$form.slideToggle()
  3082.                 },
  3083.                 save: function(e) {
  3084.                     var $field = $(e.currentTarget);
  3085.                     if ($field.is(":checkbox")) {
  3086.                         var value = [];
  3087.                         this.$el.find("input[name=" + $field.attr("name") + "]").each(function() {
  3088.                             this.checked && value.push($(this).val())
  3089.                         }), this.data[$field.attr("name")] = value
  3090.                     } else this.data[$field.attr("name")] = [$field.val()];
  3091.                     this.saveData()
  3092.                 }
  3093.             });
  3094.         VcSortedList.prototype = {
  3095.             constructor: VcSortedList,
  3096.             init: function() {
  3097.                 _.bindAll(this, "controlEvent", "save"), this.$toolbar.on("change", "input", this.controlEvent);
  3098.                 var selected_data = this.$data_field.val().split(",");
  3099.                 for (var i in selected_data) {
  3100.                     var control_settings = selected_data[i].split("|"),
  3101.                         $control = !!control_settings.length && this.$toolbar.find("[data-element=" + decodeURIComponent(control_settings[0]) + "]");
  3102.                     !1 !== $control && $control.is("input") && ($control.prop("checked", !0), this.createControl({
  3103.                         value: $control.val(),
  3104.                         label: $control.parent().text(),
  3105.                         sub: $control.data("subcontrol"),
  3106.                         sub_value: _.map(control_settings.slice(1), function(item) {
  3107.                             return window.decodeURIComponent(item)
  3108.                         })
  3109.                     }))
  3110.                 }
  3111.                 this.$current_control.sortable({
  3112.                     stop: this.save
  3113.                 }).on("change", "select", this.save)
  3114.             },
  3115.             createControl: function(data) {
  3116.                 var sub_control = "",
  3117.                     selected_sub_value = _.isUndefined(data.sub_value) ? [] : data.sub_value;
  3118.                 _.isArray(data.sub) && _.each(data.sub, function(sub, index) {
  3119.                     sub_control += " <select>", _.each(sub, function(item) {
  3120.                         sub_control += '<option value="' + item[0] + '"' + (_.isString(selected_sub_value[index]) && selected_sub_value[index] === item[0] ? ' selected="true"' : "") + ">" + item[1] + "</option>"
  3121.                     }), sub_control += "</select>"
  3122.                 }, this), this.$current_control.append('<li class="vc_control-' + data.value + '" data-name="' + data.value + '">' + data.label + sub_control + "</li>")
  3123.             },
  3124.             controlEvent: function(e) {
  3125.                 var $control = $(e.currentTarget);
  3126.                 $control[0].checked ? this.createControl({
  3127.                     value: $control.val(),
  3128.                     label: $control.parent().text(),
  3129.                     sub: $control.data("subcontrol")
  3130.                 }) : this.$current_control.find(".vc_control-" + $control.val()).remove(), this.save()
  3131.             },
  3132.             save: function() {
  3133.                 var value = _.map(this.$current_control.find("[data-name]"), function(element) {
  3134.                     var return_string = encodeURIComponent($(element).data("name"));
  3135.                     return $(element).find("select").each(function() {
  3136.                         var $sub_control = $(this);
  3137.                         $sub_control.is("select") && "" !== $sub_control.val() && (return_string += "|" + encodeURIComponent($sub_control.val()))
  3138.                     }), return_string
  3139.                 }).join(",");
  3140.                 this.$data_field.val(value)
  3141.             }
  3142.         }, $.fn.VcSortedList = function(option) {
  3143.             return this.each(function() {
  3144.                 var $this = $(this),
  3145.                     data = $this.data("vc_sorted_list");
  3146.                 _.isObject(option);
  3147.                 data || $this.data("vc_sorted_list", data = new VcSortedList(this, option)), "string" == typeof option && data[option]()
  3148.             })
  3149.         };
  3150.         var GoogleFonts = Backbone.View.extend({
  3151.                 preview_el: ".vc_google_fonts_form_field-preview-container > span",
  3152.                 font_family_dropdown_el: ".vc_google_fonts_form_field-font_family-container > select",
  3153.                 font_style_dropdown_el: ".vc_google_fonts_form_field-font_style-container > select",
  3154.                 font_style_dropdown_el_container: ".vc_google_fonts_form_field-font_style-container",
  3155.                 status_el: ".vc_google_fonts_form_field-status-container > span",
  3156.                 events: {
  3157.                     "change .vc_google_fonts_form_field-font_family-container > select": "fontFamilyDropdownChange",
  3158.                     "change .vc_google_fonts_form_field-font_style-container > select": "fontStyleDropdownChange"
  3159.                 },
  3160.                 initialize: function(attr) {
  3161.                     _.bindAll(this, "previewElementInactive", "previewElementActive", "previewElementLoading"), this.$preview_el = $(this.preview_el, this.$el), this.$font_family_dropdown_el = $(this.font_family_dropdown_el, this.$el), this.$font_style_dropdown_el = $(this.font_style_dropdown_el, this.$el), this.$font_style_dropdown_el_container = $(this.font_style_dropdown_el_container, this.$el), this.$status_el = $(this.status_el, this.$el), this.fontFamilyDropdownRender()
  3162.                 },
  3163.                 render: function() {
  3164.                     return this
  3165.                 },
  3166.                 previewElementRender: function() {
  3167.                     return this.$preview_el.css({
  3168.                         "font-family": this.font_family,
  3169.                         "font-style": this.font_style,
  3170.                         "font-weight": this.font_weight
  3171.                     }), this
  3172.                 },
  3173.                 previewElementInactive: function() {
  3174.                     this.$status_el.text(window.i18nLocale.gfonts_loading_google_font_failed || "Loading google font failed.").css("color", "#FF0000")
  3175.                 },
  3176.                 previewElementActive: function() {
  3177.                     this.$preview_el.text("Grumpy wizards make toxic brew for the evil Queen and Jack.").css("color", "inherit"), this.fontStyleDropdownRender()
  3178.                 },
  3179.                 previewElementLoading: function() {
  3180.                     this.$preview_el.text(window.i18nLocale.gfonts_loading_google_font || "Loading Font...")
  3181.                 },
  3182.                 fontFamilyDropdownRender: function() {
  3183.                     return this.fontFamilyDropdownChange(), this
  3184.                 },
  3185.                 fontFamilyDropdownChange: function() {
  3186.                     var $font_family_selected = this.$font_family_dropdown_el.find(":selected");
  3187.                     return this.font_family_url = $font_family_selected.val(), this.font_family = $font_family_selected.attr("data[font_family]"), this.font_types = $font_family_selected.attr("data[font_types]"), this.$font_style_dropdown_el_container.parent().hide(), this.font_family_url && 0 < this.font_family_url.length && WebFont.load({
  3188.                         google: {
  3189.                             families: [this.font_family_url]
  3190.                         },
  3191.                         inactive: this.previewElementInactive,
  3192.                         active: this.previewElementActive,
  3193.                         loading: this.previewElementLoading
  3194.                     }), this
  3195.                 },
  3196.                 fontStyleDropdownRender: function() {
  3197.                     var str = this.font_types,
  3198.                         str_arr = str.split(","),
  3199.                         oel = "",
  3200.                         default_f_style = this.$font_family_dropdown_el.attr("default[font_style]");
  3201.                     for (var str_inner in str_arr) {
  3202.                         var str_arr_inner = str_arr[str_inner].split(":"),
  3203.                             sel = "";
  3204.                         _.isString(default_f_style) && 0 < default_f_style.length && str_arr[str_inner] == default_f_style && (sel = "selected"), oel = oel + "<option " + sel + ' value="' + str_arr[str_inner] + '" data[font_weight]="' + str_arr_inner[1] + '" data[font_style]="' + str_arr_inner[2] + '" class="' + str_arr_inner[2] + "_" + str_arr_inner[1] + '" >' + str_arr_inner[0] + "</option>"
  3205.                     }
  3206.                     return this.$font_style_dropdown_el.html(oel), this.$font_style_dropdown_el_container.parent().show(), this.fontStyleDropdownChange(), this
  3207.                 },
  3208.                 fontStyleDropdownChange: function() {
  3209.                     var $font_style_selected = this.$font_style_dropdown_el.find(":selected");
  3210.                     return this.font_weight = $font_style_selected.attr("data[font_weight]"), this.font_style = $font_style_selected.attr("data[font_style]"), this.previewElementRender(), this
  3211.                 }
  3212.             }),
  3213.             VC_AutoComplete = Backbone.View.extend({
  3214.                 min_length: 2,
  3215.                 delay: 500,
  3216.                 auto_focus: !0,
  3217.                 ajax_url: window.ajaxurl,
  3218.                 source_data: function() {
  3219.                     return {}
  3220.                 },
  3221.                 replace_values_on_select: !1,
  3222.                 initialize: function(params) {
  3223.                     _.bindAll(this, "sortableChange", "resize", "labelRemoveHook", "updateItems", "sortableCreate", "sortableUpdate", "source", "select", "labelRemoveClick", "createBox", "focus", "response", "change", "close", "open", "create", "search", "_renderItem", "_renderMenu", "_renderItemData", "_resizeMenu"), params = $.extend({
  3224.                         min_length: this.min_length,
  3225.                         delay: this.delay,
  3226.                         auto_focus: this.auto_focus,
  3227.                         replace_values_on_select: this.replace_values_on_select
  3228.                     }, params), this.options = params, this.param_name = this.options.param_name, this.$el = this.options.$el, this.$el_wrap = this.$el.parent(), this.$sortable_wrapper = this.$el_wrap.parent(), this.$input_param = this.options.$param_input, this.selected_items = [], this.isMultiple = !1, this.render()
  3229.                 },
  3230.                 resize: function() {
  3231.                     var position = this.$el_wrap.position(),
  3232.                         block_position = this.$block.position();
  3233.                     this.$el.autocomplete("widget").width(parseFloat(this.$block.width()) - (parseFloat(position.left) - parseFloat(block_position.left) + 4) + 11)
  3234.                 },
  3235.                 enableMultiple: function() {
  3236.                     this.isMultiple = !0, this.$el.show(), this.$el.focus()
  3237.                 },
  3238.                 enableSortable: function() {
  3239.                     this.sortable = this.$sortable_wrapper.sortable({
  3240.                         items: ".vc_data",
  3241.                         axis: "y",
  3242.                         change: this.sortableChange,
  3243.                         create: this.sortableCreate,
  3244.                         update: this.sortableUpdate
  3245.                     })
  3246.                 },
  3247.                 updateItems: function() {
  3248.                     this.selected_items.length ? this.$input_param.val(this.getSelectedItems().join(", ")) : this.$input_param.val("")
  3249.                 },
  3250.                 sortableChange: function(event, ui) {},
  3251.                 itemsCreate: function() {
  3252.                     var sel_items = [];
  3253.                     this.$block.find(".vc_data").each(function(key, item) {
  3254.                         sel_items.push({
  3255.                             label: item.dataset.label,
  3256.                             value: item.dataset.value
  3257.                         })
  3258.                     }), this.selected_items = sel_items
  3259.                 },
  3260.                 sortableCreate: function(event, ui) {},
  3261.                 sortableUpdate: function(event, ui) {
  3262.                     var elems = this.$sortable_wrapper.sortable("toArray", {
  3263.                             attribute: "data-index"
  3264.                         }),
  3265.                         items = [];
  3266.                     _.each(elems, function(index) {
  3267.                         items.push(this.selected_items[index])
  3268.                     }, this);
  3269.                     var index = 0;
  3270.                     $("li.vc_data", this.$sortable_wrapper).each(function() {
  3271.                         $(this).attr("data-index", index++)
  3272.                     }), this.selected_items = items, this.updateItems()
  3273.                 },
  3274.                 getWidget: function() {
  3275.                     return this.$el.autocomplete("widget")
  3276.                 },
  3277.                 render: function() {
  3278.                     if (this.$el.focus(this.resize), this.data = this.$el.autocomplete({
  3279.                             source: this.source,
  3280.                             minLength: this.options.min_length,
  3281.                             delay: this.options.delay,
  3282.                             autoFocus: this.options.auto_focus,
  3283.                             select: this.select,
  3284.                             focus: this.focus,
  3285.                             response: this.response,
  3286.                             change: this.change,
  3287.                             close: this.close,
  3288.                             open: this.open,
  3289.                             create: this.create,
  3290.                             search: this.search
  3291.                         }), this.data.data("ui-autocomplete")._renderItem = this._renderItem, this.data.data("ui-autocomplete")._renderMenu = this._renderMenu, this.data.data("ui-autocomplete")._resizeMenu = this._resizeMenu, 0 < this.$input_param.val().length) {
  3292.                         this.isMultiple ? this.$el.focus() : this.$el.hide();
  3293.                         var that = this;
  3294.                         $(".vc_autocomplete-label.vc_data", this.$sortable_wrapper).each(function() {
  3295.                             that.labelRemoveHook($(this))
  3296.                         })
  3297.                     }
  3298.                     return this.getWidget().addClass("vc_ui-front").addClass("vc_ui-auotocomplete"), this.$block = this.$el_wrap.closest("ul").append($('<li class="clear"/>')), this.itemsCreate(), this
  3299.                 },
  3300.                 close: function(event, ui) {
  3301.                     this.selected && this.options.no_hide && (this.getWidget().show(), 2 < ++this.selected && (this.selected = void 0))
  3302.                 },
  3303.                 open: function(event, ui) {
  3304.                     var widget = this.getWidget().menu(),
  3305.                         widget_position = widget.position();
  3306.                     widget.css("left", widget_position.left - 6), widget.css("top", widget_position.top + 2)
  3307.                 },
  3308.                 focus: function(event, ui) {
  3309.                     if (!this.options.replace_values_on_select) return event.preventDefault(), !1
  3310.                 },
  3311.                 create: function(event, ui) {},
  3312.                 change: function(event, ui) {},
  3313.                 response: function(event, ui) {},
  3314.                 search: function(event, ui) {},
  3315.                 select: function(event, ui) {
  3316.                     if (this.selected = 1, ui.item) {
  3317.                         if (this.options.unique_values) {
  3318.                             var $li_el = this.getWidget().data("uiMenu").active;
  3319.                             if (this.options.groups) {
  3320.                                 var $prev_el = $li_el.prev(),
  3321.                                     $next_el = $li_el.next();
  3322.                                 $prev_el.hasClass("vc_autocomplete-group") && !$next_el.hasClass("vc_autocomplete-item") && $prev_el.remove()
  3323.                             }
  3324.                             $li_el.remove();
  3325.                             var that = this;
  3326.                             $("li.ui-menu-item", this.getWidget()).length || (that.selected = void 0)
  3327.                         }
  3328.                         this.createBox(ui.item), this.isMultiple ? this.$el.focus() : this.$el.hide()
  3329.                     }
  3330.                     return !1
  3331.                 },
  3332.                 createBox: function(item) {
  3333.                     var $label, index = this.selected_items.push(item) - 1;
  3334.                     this.updateItems(), $label = $('<li class="vc_autocomplete-label vc_data" data-index="' + index + '" data-value="' + item.value + '" data-label="' + item.label + '"><span class="vc_autocomplete-label"><a>' + item.label + '</a></span><a class="vc_autocomplete-remove">&times;</a></li>'), $label.insertBefore(this.$el_wrap), this.labelRemoveHook($label)
  3335.                 },
  3336.                 labelRemoveHook: function($label) {
  3337.                     this.$el.blur(), this.$el.val(""), $label.click(this.labelRemoveClick)
  3338.                 },
  3339.                 labelRemoveClick: function(e, ui) {
  3340.                     e.preventDefault();
  3341.                     var $label = $(e.currentTarget);
  3342.                     if ($(e.target).is(".vc_autocomplete-remove")) return this.selected_items.splice($label.index(), 1), $label.remove(), this.updateItems(), this.$el.show(), !1
  3343.                 },
  3344.                 getSelectedItems: function() {
  3345.                     if (this.selected_items.length) {
  3346.                         var results = [];
  3347.                         return _.each(this.selected_items, function(item) {
  3348.                             results.push(item.value)
  3349.                         }), results
  3350.                     }
  3351.                     return !1
  3352.                 },
  3353.                 _renderMenu: function(ul, items) {
  3354.                     var that = this,
  3355.                         group = null;
  3356.                     this.options.groups && items.sort(function(a, b) {
  3357.                         return a.group > b.group
  3358.                     }), $.each(items, function(index, item) {
  3359.                         that.options.groups && item.group != group && (group = item.group, ul.append("<li class='ui-autocomplete-group vc_autocomplete-group' aria-label='" + group + "'>" + group + "</li>")), that._renderItemData(ul, item)
  3360.                     })
  3361.                 },
  3362.                 _renderItem: function(ul, item) {
  3363.                     return $('<li data-value="' + item.value + '" class="vc_autocomplete-item">').append("<a>" + item.label + "</a>").appendTo(ul)
  3364.                 },
  3365.                 _renderItemData: function(ul, item) {
  3366.                     return this._renderItem(ul, item).data("ui-autocomplete-item", item)
  3367.                 },
  3368.                 _resizeMenu: function() {},
  3369.                 clearValue: function() {
  3370.                     this.selected_items = [], this.updateItems(), $(".vc_autocomplete-label.vc_data", this.$sortable_wrapper).remove()
  3371.                 },
  3372.                 source: function(request, response) {
  3373.                     var that = this;
  3374.                     this.options.values && 0 < this.options.values.length ? response(this.options.unique_values ? $.ui.autocomplete.filter(_.difference(this.options.values, this.selected_items), request.term) : $.ui.autocomplete.filter(this.options.values, request.term)) : $.ajax({
  3375.                         type: "POST",
  3376.                         dataType: "json",
  3377.                         url: this.ajax_url,
  3378.                         data: $.extend({
  3379.                             action: "vc_get_autocomplete_suggestion",
  3380.                             shortcode: vc.active_panel.model.get("shortcode"),
  3381.                             param: this.param_name,
  3382.                             query: request.term,
  3383.                             _vcnonce: window.vcAdminNonce
  3384.                         }, this.source_data(request, response))
  3385.                     }).done(function(data) {
  3386.                         response(that.options.unique_values ? _.filter(data, function(obj) {
  3387.                             return !_.findWhere(that.selected_items, obj)
  3388.                         }) : data)
  3389.                     })
  3390.                 }
  3391.             }),
  3392.             Vc_ParamInitializer = Backbone.View.extend({
  3393.                 $content: {},
  3394.                 initialize: function() {
  3395.                     _.bindAll(this, "content"), this.$content = this.$el, this.model = vc.active_panel.model
  3396.                 },
  3397.                 setContent: function($el) {
  3398.                     this.$content = $el
  3399.                 },
  3400.                 content: function() {
  3401.                     return this.$content
  3402.                 },
  3403.                 render: function() {
  3404.                     var self;
  3405.                     return self = this, $('[data-vc-ui-element="panel-shortcode-param"]', this.content()).each(function() {
  3406.                         var _this = $(this),
  3407.                             param = _this.data("param_settings");
  3408.                         vc.atts.init.call(self, param, _this), _this.data("vcInitParam", !0)
  3409.                     }), this
  3410.                 }
  3411.             }),
  3412.             VC_ParamGroup = Backbone.View.extend({
  3413.                 options: {
  3414.                     max_items: 0,
  3415.                     sortable: !0,
  3416.                     deletable: !0,
  3417.                     collapsible: !0
  3418.                 },
  3419.                 items: 0,
  3420.                 $ul: !1,
  3421.                 initializer: {},
  3422.                 mappedParams: {},
  3423.                 adminLabelParams: [],
  3424.                 groupParamName: "",
  3425.                 events: {
  3426.                     "click > .edit_form_line > .vc_param_group-list > .vc_param_group-add_content": "addNew"
  3427.                 },
  3428.                 initialize: function(data) {
  3429.                     var $elParam, settings, self;
  3430.                     this.$ul = this.$el.find("> .edit_form_line > .vc_param_group-list"), $elParam = $("> .wpb_vc_row", this.$ul), this.initializer = new Vc_ParamInitializer({
  3431.                         el: this.$el
  3432.                     }), this.model = vc.active_panel.model, settings = this.$ul.data("settings"), this.mappedParams = {}, this.adminLabelParams = [], this.options = _.defaults({}, _.isObject(data.settings) ? data.settings : {}, settings, this.options), this.groupParamName = this.options.param.param_name, _.isObject(this.options.param) && _.isArray(this.options.param.params) && _.each(this.options.param.params, function(param) {
  3433.                         var elemName;
  3434.                         elemName = this.groupParamName + "_" + param.param_name, this.mappedParams[elemName] = param, _.isObject(param) && !0 === param.admin_label && this.adminLabelParams.push(elemName)
  3435.                     }, this), this.items = 0, self = this, $elParam.length && $elParam.each(function() {
  3436.                         $elParam.data("vc-param-group-param", new VC_ParamGroup_Param({
  3437.                             el: $(this),
  3438.                             parent: self
  3439.                         })), self.items++, self.afterAdd($(this), "init")
  3440.                     }), this.options.sortable && this.$ul.sortable({
  3441.                         handle: ".vc_control.column_move",
  3442.                         items: "> .wpb_vc_row:not(vc_param_group-add_content-wrapper)",
  3443.                         placeholder: "vc_placeholder"
  3444.                     })
  3445.                 },
  3446.                 addNew: function(ev) {
  3447.                     if (ev.preventDefault(), this.addAllowed()) {
  3448.                         var $newEl, fn;
  3449.                         if (void 0 !== this.options.param.callbacks && void 0 !== this.options.param.callbacks.before_add && "function" == typeof(fn = window[this.options.param.callbacks.before_add]) && !fn()) return;
  3450.                         $newEl = $(JSON.parse(this.$ul.next(".vc_param_group-template").html())), $newEl.removeClass("vc_param_group-add_content-wrapper"), $newEl.insertBefore(ev.currentTarget), $newEl.show(), this.initializer.setContent($newEl.find("> .wpb_element_wrapper")), this.initializer.render(), this.items++, $newEl.data("vc-param-group-param", new VC_ParamGroup_Param({
  3451.                             el: $newEl,
  3452.                             parent: this
  3453.                         })), this.afterAdd($newEl, "new"), vc.events.trigger("vc-param-group-add-new", ev, $newEl, this)
  3454.                     }
  3455.                 },
  3456.                 addAllowed: function() {
  3457.                     return 0 < this.options.max_items && this.items + 1 <= this.options.max_items || 0 >= this.options.max_items
  3458.                 },
  3459.                 afterAdd: function($newEl, action) {
  3460.                     var fn;
  3461.                     this.addAllowed() || (this.$ul.find("> .wpb_vc_row > .vc_param_group-controls > .vc_row_edit_clone_delete > .vc_control.column_clone").hide(), this.$ul.find("> .vc_param_group-add_content").hide()), this.options.sortable || this.$ul.find("> .wpb_vc_row > .vc_param_group-controls > .vc_control.column_move").hide(), this.options.deletable || this.$ul.find("> .wpb_vc_row > .vc_param_group-controls > .vc_row_edit_clone_delete > .vc_control.column_delete").hide(), this.options.collapsible || this.$ul.find("> .wpb_vc_row > .vc_param_group-controls > .vc_row_edit_clone_delete > .vc_control.column_toggle").hide(), void 0 !== this.options.param.callbacks && void 0 !== this.options.param.callbacks.after_add && "function" == typeof(fn = window[this.options.param.callbacks.after_add]) && fn($newEl, action)
  3462.                 },
  3463.                 afterDelete: function() {
  3464.                     var fn;
  3465.                     this.addAllowed() && (this.$ul.find("> .wpb_vc_row > .vc_param_group-controls > .vc_row_edit_clone_delete > .vc_control.column_clone").show(), this.$ul.find("> .vc_param_group-add_content").show()), void 0 !== this.options.param.callbacks && void 0 !== this.options.param.callbacks.after_delete && "function" == typeof(fn = window[this.options.param.callbacks.after_delete]) && fn()
  3466.                 }
  3467.             }),
  3468.             VC_ParamGroup_Param = Backbone.View.extend({
  3469.                 dependentElements: !1,
  3470.                 mappedParams: !1,
  3471.                 groupParamName: "",
  3472.                 adminLabelParams: [],
  3473.                 events: {
  3474.                     "click > .vc_controls > .vc_row_edit_clone_delete > .vc_control.column_toggle": "toggle",
  3475.                     "click > .vc_controls > .vc_row_edit_clone_delete > .vc_control.column_delete": "deleteParam",
  3476.                     "click > .vc_controls > .vc_row_edit_clone_delete > .vc_control.column_clone": "clone"
  3477.                 },
  3478.                 initialize: function(options) {
  3479.                     this.options = options, this.$content = this.options.parent.$ul, this.model = vc.active_panel.model, this.mappedParams = this.options.parent.mappedParams, this.groupParamName = this.options.parent.groupParamName, this.adminLabelParams = this.options.parent.adminLabelParams, this.dependentElements = {}, _.bindAll(this, "hookDependent"), this.initializeDependency(), _.bindAll(this, "hookAdminLabel"), this.initializeAdminLabels()
  3480.                 },
  3481.                 initializeAdminLabels: function() {
  3482.                     var i, $fields, callback;
  3483.                     for (callback = this.hookAdminLabel, i = 0; i < this.adminLabelParams.length; i++) $fields = $("[name=" + this.adminLabelParams[i] + "].wpb_vc_param_value", this.$el), $fields.each(function() {
  3484.                         var $field = $(this);
  3485.                         $field.data("vc_admin_labels") || ($field.data("vc_admin_labels", !0), $field.bind("keyup change", callback), callback({
  3486.                             currentTarget: this
  3487.                         }))
  3488.                     })
  3489.                 },
  3490.                 hookAdminLabel: function(e) {
  3491.                     var i, $wrapperLabel, elemName, paramSettings, labelName, labelValue, labels, $field, $parent;
  3492.                     for (labelName = "", labelValue = "", labels = [], $field = $(e.currentTarget), $parent = $field.closest(".vc_param_group-wrapper"), $wrapperLabel = $field.closest(".vc_param").find(".vc_param-group-admin-labels"), i = 0; i < this.adminLabelParams.length; i++) {
  3493.                         var $paramWrapper;
  3494.                         elemName = this.adminLabelParams[i], $field = $parent.find("[name=" + elemName + "]"), $paramWrapper = $field.closest('[data-vc-ui-element="panel-shortcode-param"]'), void 0 !== this.mappedParams[elemName] && (labelName = this.mappedParams[elemName].heading), labelValue = $field.is("select") ? $field.find("option:selected").text() : $field.is("input:checkbox") ? $field[0].checked ? $field.val() : "" : $field.val(), paramSettings = {
  3495.                             type: $paramWrapper.data("param_type"),
  3496.                             param_name: $paramWrapper.data("param_name")
  3497.                         }, _.isObject(vc.atts[paramSettings.type]) && _.isFunction(vc.atts[paramSettings.type].render) && (labelValue = vc.atts[paramSettings.type].render.call(this, paramSettings, labelValue)), "" !== labelValue && labels.push("<label>" + labelName + "</label>: " + labelValue)
  3498.                     }
  3499.                     $wrapperLabel.html(labels.join(", ")).toggleClass("vc_hidden-label", !labels.length)
  3500.                 },
  3501.                 initializeDependency: function() {
  3502.                     var callDependencies;
  3503.                     callDependencies = {}, _.each(this.mappedParams, function(param, name) {
  3504.                         if (_.isObject(param) && _.isObject(param.dependency) && _.isString(param.dependency.element)) {
  3505.                             var $masters, $slave;
  3506.                             $masters = $("[name=" + this.groupParamName + "_" + param.dependency.element + "].wpb_vc_param_value", this.$el), $slave = $("[name=" + name + "].wpb_vc_param_value", this.$el), $slave.length && _.each($masters, function(master) {
  3507.                                 var $master;
  3508.                                 $master = $(master);
  3509.                                 var masterName, rules;
  3510.                                 masterName = $master.attr("name"), rules = param.dependency, _.isArray(this.dependentElements[masterName]) || (this.dependentElements[masterName] = []), this.dependentElements[masterName].push($slave), $master.data("dependentSet") || ($master.attr("data-dependent-set", "true"), $master.bind("keyup change", this.hookDependent)), callDependencies[masterName] || (callDependencies[masterName] = $master), _.isString(rules.callback) && window[rules.callback].call(this)
  3511.                             }, this)
  3512.                         }
  3513.                     }, this), _.each(callDependencies, function(obj) {
  3514.                         this.hookDependent({
  3515.                             currentTarget: obj
  3516.                         })
  3517.                     }, this)
  3518.                 },
  3519.                 hookDependent: function(e) {
  3520.                     var $master, $masterContainer, isMasterEmpty, dependentElements, masterValue;
  3521.                     return $master = $(e.currentTarget), $masterContainer = $master.closest(".vc_column"), dependentElements = this.dependentElements[$master.attr("name")], masterValue = $master.is(":checkbox") ? _.map(this.$el.find("[name=" + $master.attr("name") + "].wpb_vc_param_value:checked"), function(element) {
  3522.                         return $(element).val()
  3523.                     }) : $master.val(), isMasterEmpty = $master.is(":checkbox") ? !this.$el.find("[name=" + $master.attr("name") + "].wpb_vc_param_value:checked").length : !masterValue.length, $masterContainer.hasClass("vc_dependent-hidden") ? _.each(dependentElements, function($element) {
  3524.                         var event = $.Event("change");
  3525.                         event.extra_type = "vcHookDependedParamGroup", $element.closest(".vc_column").addClass("vc_dependent-hidden"), $element.trigger(event)
  3526.                     }) : _.each(dependentElements, function($element) {
  3527.                         var event, paramName, rules, $paramBlock;
  3528.                         paramName = $element.attr("name"), rules = _.isObject(this.mappedParams[paramName]) && _.isObject(this.mappedParams[paramName].dependency) ? this.mappedParams[paramName].dependency : {}, $paramBlock = $element.closest(".vc_column"), _.isBoolean(rules.not_empty) && !0 === rules.not_empty && !isMasterEmpty ? $paramBlock.removeClass("vc_dependent-hidden") : _.isBoolean(rules.is_empty) && !0 === rules.is_empty && isMasterEmpty ? $paramBlock.removeClass("vc_dependent-hidden") : rules.value && _.intersection(_.isArray(rules.value) ? rules.value : [rules.value], _.isArray(masterValue) ? masterValue : [masterValue]).length ? $paramBlock.removeClass("vc_dependent-hidden") : rules.value_not_equal_to && !_.intersection(_.isArray(rules.value_not_equal_to) ? rules.value_not_equal_to : [rules.value_not_equal_to], _.isArray(masterValue) ? masterValue : [masterValue]).length ? $paramBlock.removeClass("vc_dependent-hidden") : $paramBlock.addClass("vc_dependent-hidden"), event = $.Event("change"), event.extra_type = "vcHookDependedParamGroup", $element.trigger(event)
  3529.                     }, this), this
  3530.                 },
  3531.                 deleteParam: function(ev) {
  3532.                     _.isObject(ev) && ev.preventDefault && ev.preventDefault(), !0 === confirm(window.i18nLocale.press_ok_to_delete_section) && (this.options.parent.items--, this.options.parent.afterDelete(), this.$el.remove(), this.unbind(), this.remove())
  3533.                 },
  3534.                 content: function() {
  3535.                     return this.$content
  3536.                 },
  3537.                 clone: function(ev) {
  3538.                     if (ev.preventDefault(), this.options.parent.addAllowed()) {
  3539.                         var param = this.options.parent.$ul.data("settings"),
  3540.                             $content = this.$content;
  3541.                         this.$content = this.$el;
  3542.                         var value = vc.atts.param_group.parseOne.call(this, param);
  3543.                         $.ajax({
  3544.                             type: "POST",
  3545.                             url: window.ajaxurl,
  3546.                             data: {
  3547.                                 action: "vc_param_group_clone",
  3548.                                 param: fixedEncodeURIComponent(JSON.stringify(param)),
  3549.                                 shortcode: vc.active_panel.model.get("shortcode"),
  3550.                                 value: value,
  3551.                                 vc_inline: !0,
  3552.                                 _vcnonce: window.vcAdminNonce
  3553.                             },
  3554.                             dataType: "html",
  3555.                             context: this
  3556.                         }).done(function(html) {
  3557.                             var $newEl;
  3558.                             $newEl = $(html), $newEl.insertAfter(this.$el), this.$content = $content, this.options.parent.initializer.$content = $("> .wpb_element_wrapper", $newEl), this.options.parent.initializer.render(), $newEl.data("vc-param-group-param", new VC_ParamGroup_Param({
  3559.                                 el: $newEl,
  3560.                                 parent: this.options.parent
  3561.                             })), this.options.parent.items++, this.options.parent.afterAdd($newEl, "clone")
  3562.                         })
  3563.                     }
  3564.                 },
  3565.                 toggle: function(ev) {
  3566.                     ev.preventDefault();
  3567.                     var $parent = this.$el;
  3568.                     $parent.find("> .wpb_element_wrapper").slideToggle(), $parent.toggleClass("vc_param_group-collapsed").siblings(":not(.vc_param_group-collapsed)").addClass("vc_param_group-collapsed").find("> .wpb_element_wrapper").slideUp()
  3569.                 }
  3570.             });
  3571.         window.i18nLocale;
  3572.         vc.edit_form_callbacks = [], vc.atts = {
  3573.             parse: function(param) {
  3574.                 var value, params, $param, $field;
  3575.                 if ($field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"), $param = $field.closest('[data-vc-ui-element="panel-shortcode-param"]'), _.isUndefined(vc.atts[param.type]) || _.isUndefined(vc.atts[param.type].parse) ? value = $field.length ? $field.val() : null : $param.data("vcInitParam") ? value = vc.atts[param.type].parse.call(this, param) : (params = this.model.get("params"), value = _.isUndefined(params[param.param_name]) ? $field.length ? $field.val() : null : params[param.param_name]), void 0 !== $field.data("js-function") && void 0 !== window[$field.data("js-function")]) {
  3576.                     (0, window[$field.data("js-function")])(this.$el, this, param)
  3577.                 }
  3578.                 return value
  3579.             },
  3580.             parseFrame: function(param) {
  3581.                 return vc.atts.parse.call(this, param)
  3582.             },
  3583.             init: function(param, $field) {
  3584.                 _.isUndefined(vc.atts[param.type]) || _.isUndefined(vc.atts[param.type].init) || vc.atts[param.type].init.call(this, param, $field)
  3585.             }
  3586.         }, vc.atts.textarea_html = {
  3587.             parse: function(param) {
  3588.                 var _window = this.window(),
  3589.                     $field = this.content().find(".textarea_html." + param.param_name);
  3590.                 try {
  3591.                     _window.tinyMCE && _.isArray(_window.tinyMCE.editors) && _.each(_window.tinyMCE.editors, function(_editor) {
  3592.                         "wpb_tinymce_content" === _editor.id && _editor.save()
  3593.                     })
  3594.                 } catch (e) {
  3595.                     console && console.error && console.error(e)
  3596.                 }
  3597.                 return $field.val()
  3598.             },
  3599.             render: function(param, value) {
  3600.                 return _.isUndefined(value) ? value : vc_wpautop(value)
  3601.             }
  3602.         }, vc.atts.textarea_safe = {
  3603.             parse: function(param) {
  3604.                 var $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3605.                     new_value = $field.val();
  3606.                 return new_value.match(/"|(http)/) ? "#E-8_" + base64_encode(rawurlencode(new_value)) : new_value
  3607.             },
  3608.             render: function(param, value) {
  3609.                 return value && value.match(/^#E\-8_/) ? $("<div/>").text(rawurldecode(base64_decode(value.replace(/^#E\-8_/, "")))).html() : value
  3610.             }
  3611.         }, vc.atts.checkbox = {
  3612.             parse: function(param) {
  3613.                 var arr, newValue;
  3614.                 return arr = [], newValue = "", $("input[name=" + param.param_name + "]", this.content()).each(function() {
  3615.                     var self;
  3616.                     self = $(this), this.checked && arr.push(self.attr("value"))
  3617.                 }), 0 < arr.length && (newValue = arr.join(",")), newValue
  3618.             },
  3619.             defaults: function(param) {
  3620.                 return ""
  3621.             }
  3622.         }, vc.atts.el_id = {
  3623.             clone: function(clonedModel, paramValue, paramSettings) {
  3624.                 var shortcodeParams;
  3625.                 shortcodeParams = clonedModel.get("params"), _.isUndefined(paramSettings) || _.isUndefined(paramSettings.settings) || _.isUndefined(paramSettings.settings.auto_generate) || !0 !== paramSettings.settings.auto_generate ? shortcodeParams[paramSettings.param_name] = "" : shortcodeParams[paramSettings.param_name] = Date.now() + "-" + vc_guid(), clonedModel.set({
  3626.                     params: shortcodeParams
  3627.                 }, {
  3628.                     silent: !0
  3629.                 })
  3630.             },
  3631.             create: function(shortcodeModel, paramValue, paramSettings) {
  3632.                 if (shortcodeModel.get("cloned")) return vc.atts.el_id.clone(shortcodeModel, paramValue, paramSettings);
  3633.                 if (_.isEmpty(paramValue) && !_.isUndefined(paramSettings) && !_.isUndefined(paramSettings.settings) && !_.isUndefined(paramSettings.settings.auto_generate) && 1 == paramSettings.settings.auto_generate) {
  3634.                     var shortcodeParams;
  3635.                     shortcodeParams = shortcodeModel.get("params"), shortcodeParams[paramSettings.param_name] = Date.now() + "-" + vc_guid(), shortcodeModel.set({
  3636.                         params: shortcodeParams
  3637.                     }, {
  3638.                         silent: !0
  3639.                     })
  3640.                 }
  3641.             }
  3642.         }, vc.events.on("shortcodes:add:param:type:el_id", vc.atts.el_id.create), vc.atts.posttypes = {
  3643.             parse: function(param) {
  3644.                 var posstypes_arr = [],
  3645.                     new_value = "";
  3646.                 return $("input[name=" + param.param_name + "]", this.content()).each(function() {
  3647.                     var self = $(this);
  3648.                     this.checked && posstypes_arr.push(self.attr("value"))
  3649.                 }), 0 < posstypes_arr.length && (new_value = posstypes_arr.join(",")), new_value
  3650.             }
  3651.         }, vc.atts.taxonomies = {
  3652.             parse: function(param) {
  3653.                 var posstypes_arr = [],
  3654.                     new_value = "";
  3655.                 return $("input[name=" + param.param_name + "]", this.content()).each(function() {
  3656.                     var self = $(this);
  3657.                     this.checked && posstypes_arr.push(self.attr("value"))
  3658.                 }), 0 < posstypes_arr.length && (new_value = posstypes_arr.join(",")), new_value
  3659.             }
  3660.         }, vc.atts.exploded_textarea = {
  3661.             parse: function(param) {
  3662.                 return this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]").val().replace(/\n/g, ",")
  3663.             }
  3664.         }, vc.atts.exploded_textarea_safe = {
  3665.             parse: function(param) {
  3666.                 var $field, new_value;
  3667.                 return $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"), new_value = $field.val(), new_value = new_value.replace(/\n/g, ","), new_value.match(/"|(http)/) ? "#E-8_" + base64_encode(rawurlencode(new_value)) : new_value
  3668.             },
  3669.             render: function(param, value) {
  3670.                 return value && value.match(/^#E\-8_/) ? $("<div/>").text(rawurldecode(base64_decode(value.replace(/^#E\-8_/, "")))).html() : value
  3671.             }
  3672.         }, vc.atts.textarea_raw_html = {
  3673.             parse: function(param) {
  3674.                 var $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3675.                     new_value = $field.val();
  3676.                 return base64_encode(rawurlencode(new_value))
  3677.             },
  3678.             render: function(param, value) {
  3679.                 return value ? $("<div/>").text(rawurldecode(base64_decode(value.trim()))).html() : ""
  3680.             }
  3681.         }, vc.atts.dropdown = {
  3682.             render: function(param, value) {
  3683.                 return value
  3684.             },
  3685.             init: function(param, $field) {
  3686.                 $(".wpb_vc_param_value.dropdown", $field).change(function() {
  3687.                     var $this = $(this),
  3688.                         $options = $this.find(":selected"),
  3689.                         prev_option_class = $this.data("option"),
  3690.                         option_class = $options.length ? $options.attr("class").replace(/\s/g, "_") : "";
  3691.                     option_class = option_class.replace("#", "hash-"), void 0 !== prev_option_class && $this.removeClass(prev_option_class), void 0 !== option_class && $this.data("option", option_class) && $this.addClass(option_class)
  3692.                 })
  3693.             },
  3694.             defaults: function(param) {
  3695.                 var values;
  3696.                 return _.isArray(param.value) || _.isString(param.value) ? _.isArray(param.value) ? (values = param.value[0], _.isArray(values) && values.length ? values[0] : values) : "" : (values = _.values(param.value)[0], values.label ? values.value : values)
  3697.             }
  3698.         }, vc.atts.attach_images = {
  3699.             parse: function(param) {
  3700.                 var $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3701.                     thumbnails_html = "";
  3702.                 return $field.parent().find("li.added").each(function() {
  3703.                     thumbnails_html += '<li><img src="' + $(this).find("img").attr("src") + '" alt=""></li>'
  3704.                 }), $("[data-model-id=" + this.model.id + "]").data("field-" + param.param_name + "-attach-images", thumbnails_html), $field.length ? $field.val() : null
  3705.             },
  3706.             render: function(param, value) {
  3707.                 var $thumbnails = this.$el.find(".attachment-thumbnails[data-name=" + param.param_name + "]");
  3708.                 return "external_link" === this.model.getParam("source") && (value = this.model.getParam("custom_srcs")), _.isEmpty(value) ? (this.$el.removeData("field-" + param.param_name + "-attach-images"), vc.atts.attach_images.updateImages($thumbnails, "")) : $.ajax({
  3709.                     type: "POST",
  3710.                     url: window.ajaxurl,
  3711.                     data: {
  3712.                         action: "wpb_gallery_html",
  3713.                         content: value,
  3714.                         _vcnonce: window.vcAdminNonce
  3715.                     },
  3716.                     dataType: "html",
  3717.                     context: this
  3718.                 }).done(function(html) {
  3719.                     vc.atts.attach_images.updateImages($thumbnails, html)
  3720.                 }), value
  3721.             },
  3722.             updateImages: function($thumbnails, thumbnails_html) {
  3723.                 $thumbnails.html(thumbnails_html), thumbnails_html.length ? $thumbnails.removeClass("image-exists").next().addClass("image-exists") : $thumbnails.addClass("image-exists").next().removeClass("image-exists")
  3724.             }
  3725.         }, vc.atts.href = {
  3726.             parse: function(param) {
  3727.                 var $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3728.                     val = "";
  3729.                 return $field.length && "http://" !== $field.val() && (val = $field.val()), val
  3730.             }
  3731.         }, vc.atts.attach_image = {
  3732.             parse: function(param) {
  3733.                 var $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3734.                     image_src = "";
  3735.                 return $field.parent().find("li.added").length && (image_src = $field.parent().find("li.added img").attr("src")), $("[data-model-id=" + this.model.id + "]").data("field-" + param.param_name + "-attach-image", image_src), $field.length ? $field.val() : null
  3736.             },
  3737.             render: function(param, value) {
  3738.                 var $model = $("[data-model-id=" + this.model.id + "]"),
  3739.                     image_src = $model.data("field-" + param.param_name + "-attach-image"),
  3740.                     $thumbnail = this.$el.find(".attachment-thumbnail[data-name=" + param.param_name + "]"),
  3741.                     $post_id = $("#post_ID"),
  3742.                     post_id = $post_id.length ? $post_id.val() : 0;
  3743.                 if ("image" === param.param_name) switch (this.model.getParam("source")) {
  3744.                     case "external_link":
  3745.                         vc.atts.attach_image.updateImage($thumbnail, this.model.getParam("custom_src"));
  3746.                         break;
  3747.                     default:
  3748.                         _.isEmpty(value) && "featured_image" !== this.model.getParam("source") ? _.isUndefined(image_src) || ($model.removeData("field-" + param.param_name + "-attach-image"), vc.atts.attach_image.updateImage($thumbnail, image_src)) : $.ajax({
  3749.                             type: "POST",
  3750.                             url: window.ajaxurl,
  3751.                             data: {
  3752.                                 action: "wpb_single_image_src",
  3753.                                 content: value,
  3754.                                 params: this.model.get("params"),
  3755.                                 post_id: post_id,
  3756.                                 _vcnonce: window.vcAdminNonce
  3757.                             },
  3758.                             dataType: "html",
  3759.                             context: this
  3760.                         }).done(function(image_src) {
  3761.                             var image_exists = image_src.length || "featured_image" === this.model.getParam("source");
  3762.                             vc.atts.attach_image.updateImage($thumbnail, image_src, image_exists)
  3763.                         })
  3764.                 }
  3765.                 return value
  3766.             },
  3767.             updateImage: function($thumbnail, image_src, image_exists) {
  3768.                 $thumbnail.length && (void 0 === image_exists && (image_exists = !1), image_exists || !_.isEmpty(image_src) ? ($thumbnail.attr("src", image_src), _.isEmpty(image_src) ? ($thumbnail.hide(), $thumbnail.next().removeClass("image-exists").next().addClass("image-exists")) : ($thumbnail.show(), $thumbnail.next().addClass("image-exists").next().addClass("image-exists"))) : $thumbnail.attr("src", "").hide().next().removeClass("image-exists").next().removeClass("image-exists"))
  3769.             }
  3770.         }, vc.atts.google_fonts = {
  3771.             parse: function(param) {
  3772.                 var string_pieces, $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3773.                     $block = $field.parent(),
  3774.                     options = {};
  3775.                 return options.font_family = $block.find(".vc_google_fonts_form_field-font_family-select > option:selected").val(), options.font_style = $block.find(".vc_google_fonts_form_field-font_style-select > option:selected").val(), string_pieces = _.map(options, function(value, key) {
  3776.                     if (_.isString(value) && 0 < value.length) return key + ":" + encodeURIComponent(value)
  3777.                 }), $.grep(string_pieces, function(value) {
  3778.                     return _.isString(value) && 0 < value.length
  3779.                 }).join("|")
  3780.             },
  3781.             init: function(param, $field) {
  3782.                 var $g_fonts = $field;
  3783.                 $g_fonts.length && ("undefined" != typeof WebFont ? $field.data("vc-param-object", new GoogleFonts({
  3784.                     el: $g_fonts
  3785.                 })) : $g_fonts.find("> .edit_form_line").html(window.i18nLocale.gfonts_unable_to_load_google_fonts || "Unable to load Google Fonts"))
  3786.             }
  3787.         }, vc.atts.font_container = {
  3788.             parse: function(param) {
  3789.                 var string_pieces, $field = this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]"),
  3790.                     $block = $field.parent(),
  3791.                     options = {};
  3792.                 return options.tag = $block.find(".vc_font_container_form_field-tag-select > option:selected").val(), options.font_size = $block.find(".vc_font_container_form_field-font_size-input").val(), options.text_align = $block.find(".vc_font_container_form_field-text_align-select > option:selected").val(), options.font_family = $block.find(".vc_font_container_form_field-font_family-select > option:selected").val(), options.color = $block.find(".vc_font_container_form_field-color-input").val(), options.line_height = $block.find(".vc_font_container_form_field-line_height-input").val(), options.font_style_italic = $block.find(".vc_font_container_form_field-font_style-checkbox.italic").prop("checked") ? "1" : "", options.font_style_bold = $block.find(".vc_font_container_form_field-font_style-checkbox.bold").prop("checked") ? "1" : "", string_pieces = _.map(options, function(value, key) {
  3793.                     if (_.isString(value) && 0 < value.length) return key + ":" + encodeURIComponent(value)
  3794.                 }), $.grep(string_pieces, function(value) {
  3795.                     return _.isString(value) && 0 < value.length
  3796.                 }).join("|")
  3797.             },
  3798.             init: function(param, $field) {
  3799.                 vc.atts.colorpicker.init.call(this, param, $field)
  3800.             }
  3801.         }, vc.atts.param_group = {
  3802.             parse: function(param) {
  3803.                 var data, $content, $block, $list;
  3804.                 return $content = this.content(), $block = $content.find('.wpb_el_type_param_group[data-vc-ui-element="panel-shortcode-param"][data-vc-shortcode-param-name="' + param.param_name + '"]'), $list = $block.find("> .edit_form_line > .vc_param_group-list"), data = vc.atts.param_group.extractValues.call(this, param, $('>.wpb_vc_row:not(".vc_param_group-add_content-wrapper")', $list)), this.$content = $content, encodeURIComponent(JSON.stringify(data))
  3805.             },
  3806.             extractValues: function(param, $el) {
  3807.                 var data, self;
  3808.                 return data = [], self = this, $el.each(function() {
  3809.                     var innerData;
  3810.                     innerData = {}, self.$content = $(this), _.each(param.params, function(par) {
  3811.                         var innerParam, innerParamName, value;
  3812.                         innerParam = $.extend({}, par), innerParamName = innerParam.param_name, innerParam.param_name = param.param_name + "_" + innerParamName, value = vc.atts.parse.call(self, innerParam), (value.length || innerParam.save_always) && (innerData[innerParamName] = value)
  3813.                     }), data.push(innerData)
  3814.                 }), data
  3815.             },
  3816.             parseOne: function(param) {
  3817.                 var $content, data;
  3818.                 return $content = this.content(), data = vc.atts.param_group.extractValues.call(this, param, $content), this.$content = $content, fixedEncodeURIComponent(JSON.stringify(data))
  3819.             },
  3820.             init: function(param, $field) {
  3821.                 $field.data("vc-param-object", new VC_ParamGroup({
  3822.                     el: $field,
  3823.                     settings: {
  3824.                         param: param
  3825.                     }
  3826.                 }))
  3827.             }
  3828.         }, vc.atts.colorpicker = {
  3829.             init: function(param, $field) {
  3830.                 $(".vc_color-control", $field).each(function() {
  3831.                     var $alpha, $alpha_output, $pickerContainer, $control = $(this),
  3832.                         value = $control.val().replace(/\s+/g, ""),
  3833.                         alpha_val = 100;
  3834.                     value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/) && (alpha_val = 100 * parseFloat(value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1])), $control.wpColorPicker({
  3835.                         clear: function(event, ui) {
  3836.                             $alpha.val(100), $alpha_output.val("100%")
  3837.                         },
  3838.                         change: _.debounce(function() {
  3839.                             $(this).trigger("change")
  3840.                         }, 500)
  3841.                     }), $pickerContainer = $control.closest(".wp-picker-container"), $('<div class="vc_alpha-container"><label>Alpha: <output class="rangevalue">' + alpha_val + '%</output></label><input type="range" min="1" max="100" value="' + alpha_val + '" name="alpha" class="vc_alpha-field"></div>').appendTo($pickerContainer.addClass("vc_color-picker").find(".iris-picker")), $alpha = $pickerContainer.find(".vc_alpha-field"), $alpha_output = $pickerContainer.find(".vc_alpha-container output"), $alpha.bind("change keyup", function() {
  3842.                         var alpha_val = parseFloat($alpha.val()),
  3843.                             iris = $control.data("a8c-iris"),
  3844.                             color_picker = $control.data("wp-wpColorPicker");
  3845.                         $alpha_output.val($alpha.val() + "%"), iris._color._alpha = alpha_val / 100, $control.val(iris._color.toString()), color_picker.toggler.css({
  3846.                             backgroundColor: $control.val()
  3847.                         })
  3848.                     }).val(alpha_val).trigger("change")
  3849.                 })
  3850.             }
  3851.         }, vc.atts.autocomplete = {
  3852.             init: function(param, $field) {
  3853.                 var $el_type_autocomplete = $field;
  3854.                 $el_type_autocomplete.length && $el_type_autocomplete.each(function() {
  3855.                     var options, ac, $param = $(".wpb_vc_param_value", this),
  3856.                         param_name = $param.attr("name"),
  3857.                         $el = $(".vc_auto_complete_param", this);
  3858.                     options = $.extend({
  3859.                         $param_input: $param,
  3860.                         param_name: param_name,
  3861.                         $el: $el
  3862.                     }, $param.data("settings")), ac = new VC_AutoComplete(options), options.multiple && ac.enableMultiple(), options.sortable && ac.enableSortable(), $param.data("vc-param-object", ac)
  3863.                 })
  3864.             }
  3865.         }, vc.atts.loop = {
  3866.             init: function(param, $field) {
  3867.                 $field.data("vc-param-object", new VcLoop({
  3868.                     el: $field
  3869.                 }))
  3870.             }
  3871.         }, vc.atts.vc_link = {
  3872.             init: function(param, $field) {
  3873.                 $(".vc_link-build", $field).click(function(e) {
  3874.                     var $block, $input, $url_label, $title_label, value_object, $link_submit, $vc_link_submit, $vc_link_nofollow, dialog;
  3875.                     e.preventDefault(), $block = $(this).closest(".vc_link"), $input = $block.find(".wpb_vc_param_value"), $url_label = $block.find(".url-label"), $title_label = $block.find(".title-label"), value_object = $input.data("json"), $link_submit = $("#wp-link-submit"), $vc_link_submit = $('<input type="submit" name="vc_link-submit" id="vc_link-submit" class="button-primary" value="Set Link">'), $link_submit.hide(), $("#vc_link-submit").remove(), $vc_link_submit.insertBefore($link_submit), $vc_link_nofollow = $('<div class="link-target vc-link-nofollow"><label><span></span> <input type="checkbox" id="vc-link-nofollow"> Add nofollow option to link</label></div>'), $("#link-options .vc-link-nofollow").remove(), $vc_link_nofollow.insertAfter($("#link-options .link-target")), setTimeout(function() {
  3876.                         var currentHeight = $("#most-recent-results").css("top");
  3877.                         $("#most-recent-results").css("top", parseInt(currentHeight) + $vc_link_nofollow.height())
  3878.                     }, 200), dialog = !window.wpLink && $.fn.wpdialog && $("#wp-link").length ? {
  3879.                         $link: !1,
  3880.                         open: function() {
  3881.                             this.$link = $("#wp-link").wpdialog({
  3882.                                 title: wpLinkL10n.title,
  3883.                                 width: 480,
  3884.                                 height: "auto",
  3885.                                 modal: !0,
  3886.                                 dialogClass: "wp-dialog",
  3887.                                 zIndex: 3e5
  3888.                             }), this.$link.addClass("vc-link-wrapper")
  3889.                         },
  3890.                         close: function() {
  3891.                             this.$link && (this.$link.wpdialog("close"), this.$link.removeClass("vc-link-wrapper"))
  3892.                         }
  3893.                     } : window.wpLink;
  3894.                     var onOpen = function(e, wrap) {
  3895.                             jQuery(wrap).addClass("vc-link-wrapper")
  3896.                         },
  3897.                         onClose = function(e, wrap) {
  3898.                             jQuery(wrap).removeClass("vc-link-wrapper"), jQuery(document).off("wplink-open", onOpen), jQuery(document).off("wplink-close", onClose)
  3899.                         };
  3900.                     jQuery(document).off("wplink-open", onOpen).on("wplink-open", onOpen), jQuery(document).off("wplink-close", onClose).on("wplink-close", onClose), dialog.open("content"), _.isString(value_object.url) && ($("#wp-link-url").length ? $("#wp-link-url").val(value_object.url) : $("#url-field").val(value_object.url)), _.isString(value_object.title) && ($("#wp-link-text").length ? $("#wp-link-text").val(value_object.title) : $("#link-title-field").val(value_object.title)), $("#wp-link-target").length ? $("#wp-link-target").prop("checked", !_.isEmpty(value_object.target)) : $("#link-target-checkbox").prop("checked", !_.isEmpty(value_object.target)), $("#vc-link-nofollow").length && $("#vc-link-nofollow").prop("checked", !_.isEmpty(value_object.rel)), $vc_link_submit.unbind("click.vcLink").bind("click.vcLink", function(e) {
  3901.                         e.preventDefault(), e.stopImmediatePropagation();
  3902.                         var string, options = {};
  3903.                         options.url = $("#wp-link-url").length ? $("#wp-link-url").val() : $("#url-field").val(), options.title = $("#wp-link-text").length ? $("#wp-link-text").val() : $("#link-title-field").val();
  3904.                         var $checkbox = $($("#wp-link-target").length ? "#wp-link-target" : "#link-target-checkbox");
  3905.                         return options.target = $checkbox[0].checked ? " _blank" : "", options.rel = $("#vc-link-nofollow")[0].checked ? "nofollow" : "", string = _.map(options, function(value, key) {
  3906.                             if (_.isString(value) && 0 < value.length) return key + ":" + encodeURIComponent(value)
  3907.                         }).join("|"), $input.val(string), $input.data("json", options), $url_label.html(options.url + options.target), $title_label.html(options.title), dialog.close(), $link_submit.show(), $vc_link_submit.unbind("click.vcLink"), $vc_link_submit.remove(), $("#wp-link-cancel").unbind("click.vcLink"), window.wpLink.textarea = "", $checkbox.attr("checked", !1), $("#most-recent-results").css("top", ""), $("#vc-link-nofollow").attr("checked", !1), !1
  3908.                     }), $("#wp-link-cancel").unbind("click.vcLink").bind("click.vcLink", function(e) {
  3909.                         e.preventDefault(), dialog.close(), $vc_link_submit.unbind("click.vcLink"), $vc_link_submit.remove(), $("#wp-link-cancel").unbind("click.vcLink"), window.wpLink.textarea = ""
  3910.                     })
  3911.                 })
  3912.             }
  3913.         }, vc.atts.sorted_list = {
  3914.             init: function(param, $field) {
  3915.                 $(".vc_sorted-list", $field).VcSortedList()
  3916.             }
  3917.         }, vc.atts.options = {
  3918.             init: function(param, $field) {
  3919.                 $field.data("vc-param-object", new VcOptionsField({
  3920.                     el: $field
  3921.                 }))
  3922.             }
  3923.         }, vc.atts.iconpicker = {
  3924.             change: function(param, $field) {
  3925.                 var $select = $field.find(".vc-iconpicker");
  3926.                 $select.val(this.value), $select.data("vc-no-check", !0), $select.find('[value="' + this.value + '"]').attr("selected", "selected"), $select.data("vcFontIconPicker").loadIcons()
  3927.             },
  3928.             parse: function(param) {
  3929.                 return this.content().find(".wpb_vc_param_value[name=" + param.param_name + "]").parent().find(".vc-iconpicker").val()
  3930.             },
  3931.             init: function(param, $field) {
  3932.                 var $el = $field.find(".wpb_vc_param_value"),
  3933.                     settings = $.extend({
  3934.                         iconsPerPage: 100,
  3935.                         iconDownClass: "fip-fa fa fa-arrow-down",
  3936.                         iconUpClass: "fip-fa fa fa-arrow-up",
  3937.                         iconLeftClass: "fip-fa fa fa-arrow-left",
  3938.                         iconRightClass: "fip-fa fa fa-arrow-right",
  3939.                         iconSearchClass: "fip-fa fa fa-search",
  3940.                         iconCancelClass: "fip-fa fa fa-remove",
  3941.                         iconBlockClass: "fip-fa"
  3942.                     }, $el.data("settings"));
  3943.                 $field.find(".vc-iconpicker").vcFontIconPicker(settings).on("change", function(e) {
  3944.                     var $select = $(this);
  3945.                     $select.data("vc-no-check") || $el.data("vc-no-check", !0).val(this.value).trigger("change"), $select.data("vc-no-check", !1)
  3946.                 }), $el.on("change", function(e) {
  3947.                     $el.data("vc-no-check") || vc.atts.iconpicker.change.call(this, param, $field), $el.data("vc-no-check", !1)
  3948.                 })
  3949.             }
  3950.         }, vc.atts.animation_style = {
  3951.             init: function(param, $field) {
  3952.                 function animation_style_test(el, x) {
  3953.                     $(el).removeClass().addClass(x + " animated").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
  3954.                         $(this).removeClass().addClass("vc_param-animation-style-preview")
  3955.                     })
  3956.                 }
  3957.                 var content = $field,
  3958.                     $field_input = $(".wpb_vc_param_value[name=" + param.param_name + "]", content);
  3959.                 $('option[value="' + $field_input.val() + '"]', content).attr("selected", !0), $(".vc_param-animation-style-trigger", content).click(function(e) {
  3960.                     e.preventDefault();
  3961.                     var animation = $(".vc_param-animation-style", content).val();
  3962.                     "none" !== animation && animation_style_test(this.parentNode, "vc_param-animation-style-preview " + animation)
  3963.                 }), $(".vc_param-animation-style", content).change(function() {
  3964.                     var animation = $(this).val();
  3965.                     if ($field_input.val(animation), "none" !== animation) {
  3966.                         animation_style_test($(".vc_param-animation-style-preview", content), "vc_param-animation-style-preview " + animation)
  3967.                     }
  3968.                 })
  3969.             }
  3970.         }, vc.atts.vc_grid_id = {
  3971.             parse: function() {
  3972.                 return "vc_gid:" + Date.now() + "-" + this.model.get("id") + "-" + Math.floor(11 * Math.random())
  3973.             }
  3974.         }, vc.atts.addShortcodeIdParam = function(model) {
  3975.             var params, settings, _changed = !1;
  3976.             params = model.get("params"), settings = vc.map[model.get("shortcode")], _.isArray(settings.params) && _.each(settings.params, function(p) {
  3977.                 p && !_.isUndefined(p.type) && ("tab_id" === p.type && _.isEmpty(params[p.param_name]) ? (_changed = !0, params[p.param_name] = vc_guid() + "-" + Math.floor(11 * Math.random())) : "vc_grid_id" === p.type && (_changed = !0, params[p.param_name] = vc.atts.vc_grid_id.parse.call({
  3978.                     model: model
  3979.                 })))
  3980.             }), _changed && model.save("params", params, {
  3981.                 silent: !0
  3982.             })
  3983.         }, vc.getMapped = vc.memoizeWrapper(function(tag) {
  3984.             return vc.map[tag] || {}
  3985.         })
  3986.     }(window.jQuery),
  3987.     function($) {
  3988.         vc.debug = !1, vc.map = _.isUndefined(window.vc_mapper) ? {} : window.vc_mapper, vc.roles = _.isUndefined(window.vc_roles) ? {} : window.vc_roles, vc.Storage = function() {
  3989.             this.data = {}
  3990.         }, vc.Storage.prototype = {
  3991.             url: window.ajaxurl,
  3992.             checksum: !1,
  3993.             locked: !1,
  3994.             create: function(model) {
  3995.                 return model.id || (model.id = model.attributes.id = vc_guid()), this.data[model.id] = model.toJSON(), this.setModelRoot(model.id), this.save(), model
  3996.             },
  3997.             lock: function() {
  3998.                 this.locked = !0
  3999.             },
  4000.             unlock: function() {
  4001.                 this.locked = !1
  4002.             },
  4003.             setModelRoot: function(id) {
  4004.                 var data = this.data[id];
  4005.                 _.isString(data.parent_id) && _.isObject(this.data[data.parent_id]) && (data.root_id = this.data[data.parent_id].root_id), _.isObject(this.data[data.root_id]) && (this.data[data.root_id].html = !1)
  4006.             },
  4007.             update: function(model) {
  4008.                 return this.data[model.id] = model.toJSON(), this.setModelRoot(model.id), this.save(), model
  4009.             },
  4010.             destroy: function(model) {
  4011.                 return _.isUndefined(this.data[model.id]) || _.isUndefined(this.data[model.id].root_id) || !_.isObject(this.data[this.data[model.id].root_id]) || (this.data[this.data[model.id].root_id].html = !1), _.isUndefined(this.data[model.id]) || delete this.data[model.id], this.save(), model
  4012.             },
  4013.             find: function(model_id) {
  4014.                 return this.data[model_id]
  4015.             },
  4016.             findAll: function() {
  4017.                 return this.fetch(), _.values(this.data)
  4018.             },
  4019.             findAllRootSorted: function() {
  4020.                 var models = _.filter(_.values(this.data), function(model) {
  4021.                     return !1 === model.parent_id
  4022.                 });
  4023.                 return _.sortBy(models, function(model) {
  4024.                     return model.order
  4025.                 })
  4026.             },
  4027.             escapeParam: function(value) {
  4028.                 return _.isUndefined(value) || _.isNull(value) || !value.toString ? "" : value.toString().replace(/"/g, "``").replace(/\[/g, "`{`").replace(/\]/g, "`}`")
  4029.             },
  4030.             unescapeParam: function(value) {
  4031.                 return value.replace(/\`{\`/g, "[").replace(/\`}\`/g, "]").replace(/(\`{2})/g, '"')
  4032.             },
  4033.             storageCreateShortcodeString: function(model) {
  4034.                 var mapped, data, tag, params, content, paramsForString, mergedParams, isContainer;
  4035.                 return tag = model.get("shortcode"), params = _.extend({}, model.get("params")), paramsForString = {}, mergedParams = vc.getMergedParams(tag, params), _.each(mergedParams, function(value, key) {
  4036.                     paramsForString[key] = this.escapeParam(value)
  4037.                 }, this), mapped = vc.getMapped(tag), isContainer = _.isObject(mapped) && (_.isBoolean(mapped.is_container) && !0 === mapped.is_container || !_.isEmpty(mapped.as_parent)), content = this._storageGetShortcodeContent(model), data = {
  4038.                     tag: tag,
  4039.                     attrs: paramsForString,
  4040.                     content: content,
  4041.                     type: _.isUndefined(vc.getParamSettings(tag, "content")) && !isContainer ? "single" : ""
  4042.                 }, model.trigger("stringify", model, data), wp.shortcode.string(data)
  4043.             },
  4044.             save: function() {
  4045.                 if (this.locked) return this.locked = !1, !1;
  4046.                 var content = _.reduce(this.findAllRootSorted(), function(memo, modelArray) {
  4047.                     var model = vc.shortcodes.get(modelArray);
  4048.                     return memo + this.storageCreateShortcodeString(model)
  4049.                 }, "", this);
  4050.                 return this.setContent(content), this.checksum = vc_globalHashCode(content), this
  4051.             },
  4052.             _storageGetShortcodeContent: function(parent) {
  4053.                 var models, params;
  4054.                 return models = _.sortBy(_.filter(this.data, function(model) {
  4055.                     return model.parent_id === parent.get("id")
  4056.                 }), function(model) {
  4057.                     return model.order
  4058.                 }), models.length ? _.reduce(models, function(memo, modelArray) {
  4059.                     var model = vc.shortcodes.get(modelArray);
  4060.                     return memo + this.storageCreateShortcodeString(model)
  4061.                 }, "", this) : (params = _.extend({}, parent.get("params")), _.isUndefined(params.content) ? "" : params.content)
  4062.             },
  4063.             getContent: function() {
  4064.                 return _.isObject(window.tinymce) && tinymce.editors.content && tinymce.editors.content.save(), window.vc_wpnop($("#content").val() || "")
  4065.             },
  4066.             setContent: function(content) {
  4067.                 var contentTinyMce = window.tinyMCE && window.tinyMCE.get && window.tinyMCE.get("content");
  4068.                 content = vc_wpautop(content), $("#content").val(content), contentTinyMce && contentTinyMce.setContent(content) && contentTinyMce.fire("change")
  4069.             },
  4070.             parseContent: function(data, content, parent) {
  4071.                 var tags = _.keys(vc.map).join("|"),
  4072.                     reg = window.wp.shortcode.regexp(tags),
  4073.                     matches = content.trim().match(reg);
  4074.                 return _.isNull(matches) ? data : (_.each(matches, function(raw) {
  4075.                     var shortcode, map_settings, sub_matches = raw.match(this.regexp(tags)),
  4076.                         sub_content = sub_matches[5],
  4077.                         sub_regexp = new RegExp("^[\\s]*\\[\\[?(" + _.keys(vc.map).join("|") + ")(?![\\w-])"),
  4078.                         id = window.vc_guid(),
  4079.                         atts_raw = window.wp.shortcode.attrs(sub_matches[3]),
  4080.                         atts = {};
  4081.                     _.each(atts_raw.named, function(value, key) {
  4082.                         atts[key] = this.unescapeParam(value)
  4083.                     }, this), shortcode = {
  4084.                         id: id,
  4085.                         shortcode: sub_matches[2],
  4086.                         order: this.order,
  4087.                         params: _.extend({}, atts),
  4088.                         parent_id: !!_.isObject(parent) && parent.id,
  4089.                         root_id: _.isObject(parent) ? parent.root_id : id
  4090.                     }, map_settings = vc.map[shortcode.shortcode], this.order += 1, data[id] = shortcode, id == shortcode.root_id && (data[id].html = raw), _.isString(sub_content) && sub_content.match(sub_regexp) && (_.isBoolean(map_settings.is_container) && !0 === map_settings.is_container || !_.isEmpty(map_settings.as_parent) && !1 !== map_settings.as_parent) ? data = this.parseContent(data, sub_content, data[id]) : _.isString(sub_content) && sub_content.length && "vc_row" === sub_matches[2] ? data = this.parseContent(data, '[vc_column width="1/1"][vc_column_text]' + sub_content + "[/vc_column_text][/vc_column]", data[id]) : _.isString(sub_content) && sub_content.length && "vc_column" === sub_matches[2] ? data = this.parseContent(data, "[vc_column_text]" + sub_content + "[/vc_column_text]", data[id]) : _.isString(sub_content) && (data[id].params.content = sub_content)
  4091.                 }, this), data)
  4092.             },
  4093.             isContentChanged: function() {
  4094.                 return !1 === this.checksum || this.checksum !== vc_globalHashCode(this.getContent())
  4095.             },
  4096.             wrapData: function(content) {
  4097.                 var tags = _.keys(vc.map).join("|"),
  4098.                     reg = this.regexp_split("vc_row"),
  4099.                     starts_with_shortcode = new RegExp("^\\[(\\[?)(" + tags + ")", "g"),
  4100.                     _this = this,
  4101.                     storage = {},
  4102.                     i = 0;
  4103.                 content = wp.shortcode.replace("vc_section", content, function(data) {
  4104.                     var toSave = {
  4105.                         attrs: data.attrs.named,
  4106.                         content: _this.wrapData(data.content)
  4107.                     };
  4108.                     i++;
  4109.                     var hash = "vc_pseudo_section_" + i + "_" + VCS4() + VCS4();
  4110.                     return storage[hash] = {
  4111.                         tag: hash,
  4112.                         data: toSave
  4113.                     }, '[vc_row][vc_pseudo_section id="' + hash + '"][/vc_pseudo_section][/vc_row]'
  4114.                 });
  4115.                 var matches = _.filter(content.trim().split(reg), function(value) {
  4116.                     if (!_.isEmpty(value)) return value
  4117.                 });
  4118.                 return content = _.reduce(matches, function(mem, value) {
  4119.                     -1 !== value.trim().indexOf("vc_pseudo_section_") || value.trim().match(starts_with_shortcode) || (value = "[vc_row][vc_column][vc_column_text]" + value + "[/vc_column_text][/vc_column][/vc_row]");
  4120.                     var matches_local = value.match(vc_regexp_shortcode());
  4121.                     return !_.isArray(matches_local) || _.isUndefined(matches_local[2]) || -1 !== matches_local[2].indexOf("vc_pseudo_section_") || _.isUndefined(vc.map[matches_local[2]]) || !_.isUndefined(vc.map[matches_local[2]].is_container) && vc.map[matches_local[2]].is_container || !_.isEmpty(vc.map[matches_local[2]].as_parent) || (value = "[vc_row][vc_column]" + value + "[/vc_column][/vc_row]"), mem + value
  4122.                 }, ""), Object.keys(storage).length > 0 && (content = content.replace(/\[vc_row\]\[vc_pseudo_section/g, "[vc_pseudo_section"), content = content.replace(/\[\/vc_pseudo_section\]\[\/vc_row\]/g, "[/vc_pseudo_section]"), content = wp.shortcode.replace("vc_pseudo_section", content, function(data) {
  4123.                     var item = storage[data.attrs.named.id];
  4124.                     return wp.shortcode.string({
  4125.                         tag: "vc_section",
  4126.                         attrs: item.data.attrs,
  4127.                         content: item.data.content
  4128.                     })
  4129.                 })), content
  4130.             },
  4131.             fetch: function() {
  4132.                 if (!this.isContentChanged()) return this;
  4133.                 this.order = 0;
  4134.                 var content = this.getContent();
  4135.                 this.checksum = vc_globalHashCode(content), content = this.wrapData(content), this.data = this.parseContent({}, content)
  4136.             },
  4137.             append: function(content) {
  4138.                 this.data = {}, this.order = 0;
  4139.                 try {
  4140.                     var current_content = this.getContent();
  4141.                     this.setContent(current_content + "" + content)
  4142.                 } catch (e) {
  4143.                     window.console && window.console.error && window.console.error(e)
  4144.                 }
  4145.             },
  4146.             regexp_split: _.memoize(function(tags) {
  4147.                 return new RegExp("(\\[(\\[?)[" + tags + "]+(?![\\w-])[^\\]\\/]*[\\/(?!\\])[^\\]\\/]*]?(?:\\/]\\]|\\](?:[^\\[]*(?:\\[(?!\\/" + tags + "\\])[^\\[]*)*\\[\\/" + tags + "\\])?)\\]?)", "g")
  4148.             }),
  4149.             regexp: _.memoize(function(tags) {
  4150.                 return new RegExp("\\[(\\[?)(" + tags + ")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)")
  4151.             })
  4152.         }, vc.storage = new vc.Storage
  4153.     }(window.jQuery),
  4154.     function($) {
  4155.         var store = vc.storage;
  4156.         vc.shortcode = Backbone.Model.extend({
  4157.             settings: !1,
  4158.             defaults: function() {
  4159.                 var id = window.vc_guid();
  4160.                 return {
  4161.                     id: id,
  4162.                     shortcode: "vc_text_block",
  4163.                     order: vc.shortcodes.getNextOrder(),
  4164.                     params: {},
  4165.                     parent_id: !1,
  4166.                     root_id: id,
  4167.                     cloned: !1,
  4168.                     html: !1,
  4169.                     view: !1
  4170.                 }
  4171.             },
  4172.             initialize: function() {
  4173.                 this.bind("remove", this.removeChildren, this), this.bind("remove", this.removeEvents, this)
  4174.             },
  4175.             removeEvents: function(model) {
  4176.                 vc.events.triggerShortcodeEvents("destroy", model)
  4177.             },
  4178.             sync: function(method, model, options) {
  4179.                 if (options && options.silent) return options.success(model);
  4180.                 var response;
  4181.                 switch (method) {
  4182.                     case "read":
  4183.                         response = model.id ? store.find(model) : store.findAll();
  4184.                         break;
  4185.                     case "create":
  4186.                         response = store.create(model);
  4187.                         break;
  4188.                     case "update":
  4189.                         response = store.update(model);
  4190.                         break;
  4191.                     case "delete":
  4192.                         response = store.destroy(model)
  4193.                 }
  4194.                 response ? options.success(response) : options.error("Record not found")
  4195.             },
  4196.             getParam: function(key) {
  4197.                 return _.isObject(this.get("params")) && !_.isUndefined(this.get("params")[key]) ? this.get("params")[key] : ""
  4198.             },
  4199.             removeChildren: function(parent) {
  4200.                 var models = vc.shortcodes.where({
  4201.                     parent_id: parent.id
  4202.                 });
  4203.                 _.each(models, function(model) {
  4204.                     vc.storage.lock(), model.destroy(), this.removeChildren(model)
  4205.                 }, this), models.length && vc.storage.save()
  4206.             },
  4207.             setting: function(name) {
  4208.                 return !1 === this.settings && (this.settings = vc.getMapped(this.get("shortcode")) || {}), this.settings[name]
  4209.             }
  4210.         }), vc.shortcodes_collection = Backbone.Collection.extend({
  4211.             model: vc.shortcode,
  4212.             last_index: 0,
  4213.             getNextOrder: function() {
  4214.                 return this.last_index++
  4215.             },
  4216.             comparator: function(model) {
  4217.                 return model.get("order")
  4218.             },
  4219.             initialize: function() {},
  4220.             createFromString: function(shortcodes_string, parent_model) {
  4221.                 var data;
  4222.                 data = vc.storage.parseContent({}, shortcodes_string, !!_.isObject(parent_model) && parent_model.toJSON()), _.each(_.values(data), function(model) {
  4223.                     vc.shortcodes.create(model)
  4224.                 }, this)
  4225.             },
  4226.             sync: function(method, model, options) {
  4227.                 var response;
  4228.                 switch (method) {
  4229.                     case "read":
  4230.                         response = model.id ? store.find(model) : store.findAll();
  4231.                         break;
  4232.                     case "create":
  4233.                         response = store.create(model);
  4234.                         break;
  4235.                     case "update":
  4236.                         response = store.update(model);
  4237.                         break;
  4238.                     case "delete":
  4239.                         response = store.destroy(model)
  4240.                 }
  4241.                 response ? options.success(response) : options.error("Record not found")
  4242.             },
  4243.             stringify: function(state) {
  4244.                 var models = _.sortBy(vc.shortcodes.where({
  4245.                     parent_id: !1
  4246.                 }), function(model) {
  4247.                     return model.get("order")
  4248.                 });
  4249.                 return this.modelsToString(models, state)
  4250.             },
  4251.             singleStringify: function(id, state) {
  4252.                 return this.modelsToString([vc.shortcodes.get(id)], state)
  4253.             },
  4254.             createShortcodeString: function(model, state) {
  4255.                 var mapped, data, tag, params, content, paramsForString, mergedParams, isContainer;
  4256.                 return tag = model.get("shortcode"), params = _.extend({}, model.get("params")), paramsForString = {}, mergedParams = vc.getMergedParams(tag, params), _.each(mergedParams, function(value, key) {
  4257.                     paramsForString[key] = vc.storage.escapeParam(value)
  4258.                 }, this), mapped = vc.getMapped(tag), isContainer = _.isObject(mapped) && (_.isBoolean(mapped.is_container) && !0 === mapped.is_container || !_.isEmpty(mapped.as_parent)), content = this._getShortcodeContent(model, state), data = {
  4259.                     tag: tag,
  4260.                     attrs: paramsForString,
  4261.                     content: content,
  4262.                     type: _.isUndefined(vc.getParamSettings(tag, "content")) && !isContainer ? "single" : ""
  4263.                 }, _.isUndefined(state) ? model.trigger("stringify", model, data) : model.trigger("stringify:" + state, model, data), data.remove ? "" : wp.shortcode.string(data)
  4264.             },
  4265.             modelsToString: function(models, state) {
  4266.                 return _.reduce(models, function(memo, model) {
  4267.                     return memo + this.createShortcodeString(model, state)
  4268.                 }, "", this)
  4269.             },
  4270.             _getShortcodeContent: function(parent, state) {
  4271.                 var models, params;
  4272.                 return models = _.sortBy(vc.shortcodes.where({
  4273.                     parent_id: parent.get("id")
  4274.                 }), function(model) {
  4275.                     return model.get("order")
  4276.                 }), models.length ? _.reduce(models, function(memo, model) {
  4277.                     return memo + this.createShortcodeString(model, state)
  4278.                 }, "", this) : (params = _.extend({}, parent.get("params")), _.isUndefined(params.content) ? "" : params.content)
  4279.             }
  4280.         }), vc.shortcodes = new vc.shortcodes_collection, vc.getDefaults = vc.memoizeWrapper(function(tag) {
  4281.             var defaults, params;
  4282.             return defaults = {}, params = _.isObject(vc.map[tag]) && _.isArray(vc.map[tag].params) ? vc.map[tag].params : [], _.each(params, function(param) {
  4283.                 _.isObject(param) && (_.isUndefined(param.std) ? vc.atts[param.type] && vc.atts[param.type].defaults ? defaults[param.param_name] = vc.atts[param.type].defaults(param) : _.isUndefined(param.value) || (_.isObject(param.value) ? defaults[param.param_name] = _.values(param.value)[0] : _.isArray(param.value) ? defaults[param.param_name] = param.value[0] : defaults[param.param_name] = param.value) : defaults[param.param_name] = param.std)
  4284.             }), defaults
  4285.         }), vc.getDefaultsAndDependencyMap = vc.memoizeWrapper(function(tag) {
  4286.             var defaults, dependencyMap, params;
  4287.             return dependencyMap = {}, defaults = {}, params = _.isObject(vc.map[tag]) && _.isArray(vc.map[tag].params) ? vc.map[tag].params : [], _.each(params, function(param) {
  4288.                 _.isObject(param) && "content" !== param.param_name && (_.isUndefined(param.std) ? _.isUndefined(param.value) || (vc.atts[param.type] && vc.atts[param.type].defaults ? defaults[param.param_name] = vc.atts[param.type].defaults(param) : _.isObject(param.value) ? defaults[param.param_name] = _.values(param.value)[0] : _.isArray(param.value) ? defaults[param.param_name] = param.value[0] : defaults[param.param_name] = param.value) : defaults[param.param_name] = param.std, _.isUndefined(param.dependency) || _.isUndefined(param.dependency.element) || (dependencyMap[param.param_name] = param.dependency))
  4289.             }), {
  4290.                 defaults: defaults,
  4291.                 dependencyMap: dependencyMap
  4292.             }
  4293.         }), vc.getMergedParams = function(tag, values) {
  4294.             var paramsMap, outputParams, paramsDependencies;
  4295.             return paramsMap = vc.getDefaultsAndDependencyMap(tag), outputParams = {}, values = _.extend({}, paramsMap.defaults, values), paramsDependencies = _.extend({}, paramsMap.dependencyMap), _.each(values, function(value, key) {
  4296.                 if ("content" !== key) {
  4297.                     var paramSettings;
  4298.                     if (!_.isUndefined(paramsDependencies[key])) {
  4299.                         if (!_.isUndefined(paramsDependencies[paramsDependencies[key].element]) && _.isBoolean(paramsDependencies[paramsDependencies[key].element].failed) && !0 === paramsDependencies[paramsDependencies[key].element].failed) return void(paramsDependencies[key].failed = !0);
  4300.                         var rules, isDependedEmpty, dependedElement, dependedValue;
  4301.                         dependedElement = paramsDependencies[key].element, dependedValue = values[dependedElement], isDependedEmpty = _.isEmpty(dependedValue);
  4302.                         var dependedValueSplit = !1;
  4303.                         if ("string" == typeof dependedValue && (dependedValueSplit = values[dependedElement].split(",").map(function(i) {
  4304.                                 return i.trim()
  4305.                             }).filter(function(i) {
  4306.                                 return i
  4307.                             })), rules = _.omit(paramsDependencies[key], "element"), _.isBoolean(rules.not_empty) && !0 === rules.not_empty && isDependedEmpty || _.isBoolean(rules.is_empty) && !0 === rules.is_empty && !isDependedEmpty || rules.value && !_.intersection(_.isArray(rules.value) ? rules.value : [rules.value], _.isArray(dependedValue) ? dependedValue : [dependedValue]).length && dependedValueSplit && rules.value && !_.intersection(_.isArray(rules.value) ? rules.value : [rules.value], _.isArray(dependedValueSplit) ? dependedValueSplit : [dependedValueSplit]).length || rules.value_not_equal_to && _.intersection(_.isArray(rules.value_not_equal_to) ? rules.value_not_equal_to : [rules.value_not_equal_to], _.isArray(dependedValue) ? dependedValue : [dependedValue]).length && dependedValueSplit && rules.value_not_equal_to && _.intersection(_.isArray(rules.value_not_equal_to) ? rules.value_not_equal_to : [rules.value_not_equal_to], _.isArray(dependedValueSplit) ? dependedValueSplit : [dependedValueSplit]).length) return void(paramsDependencies[key].failed = !0)
  4308.                     }
  4309.                     paramSettings = vc.getParamSettings(tag, key), _.isUndefined(paramSettings) ? outputParams[key] = value : (!_.isUndefined(paramsMap.defaults[key]) && paramsMap.defaults[key] !== value || _.isUndefined(paramsMap.defaults[key]) && "" !== value || !_.isUndefined(paramSettings.save_always) && !0 === paramSettings.save_always) && (outputParams[key] = value)
  4310.                 }
  4311.             }), outputParams
  4312.         }, vc.getParamSettings = vc.memoizeWrapper(function(tag, paramName) {
  4313.             var params;
  4314.             return params = _.isObject(vc.map[tag]) && _.isArray(vc.map[tag].params) ? vc.map[tag].params : [], _.find(params, function(settings) {
  4315.                 return _.isObject(settings) && settings.param_name === paramName
  4316.             }, this)
  4317.         }, function() {
  4318.             return arguments[0] + "," + arguments[1]
  4319.         }), vc.getParamSettingsByType = vc.memoizeWrapper(function(tag, paramType) {
  4320.             var params;
  4321.             return params = _.isObject(vc.map[tag]) && _.isArray(vc.map[tag].params) ? vc.map[tag].params : [], _.find(params, function(settings) {
  4322.                 return _.isObject(settings) && settings.type === paramType
  4323.             }, this)
  4324.         }, function() {
  4325.             return arguments[0] + "," + arguments[1]
  4326.         }), vc.shortcodeHasIdParam = vc.memoizeWrapper(function(tag) {
  4327.             return vc.getParamSettingsByType(tag, "el_id")
  4328.         })
  4329.     }(window.jQuery),
  4330.     function($) {
  4331.         vc.clone_index = 1, vc.shortcode_view = Backbone.View.extend({
  4332.             tagName: "div",
  4333.             $content: "",
  4334.             use_default_content: !1,
  4335.             params: {},
  4336.             events: {
  4337.                 "click .column_delete,.vc_control-btn-delete": "deleteShortcode",
  4338.                 "click .column_add,.vc_control-btn-prepend": "addElement",
  4339.                 "click .column_edit,.vc_control-btn-edit, .column_edit_trigger": "editElement",
  4340.                 "click .column_clone,.vc_control-btn-clone": "clone",
  4341.                 mousemove: "checkControlsPosition"
  4342.             },
  4343.             removeView: function() {
  4344.                 vc.closeActivePanel(this.model), this.remove()
  4345.             },
  4346.             checkControlsPosition: function() {
  4347.                 if (this.$controls_buttons) {
  4348.                     var window_top, element_position_top, new_position, element_height = this.$el.height();
  4349.                     element_height > $(window).height() && (window_top = $(window).scrollTop(), element_position_top = this.$el.offset().top, new_position = window_top - element_position_top + $(window).height() / 2, 40 < new_position && new_position < element_height ? this.$controls_buttons.css("top", new_position) : new_position > element_height ? this.$controls_buttons.css("top", element_height - 40) : this.$controls_buttons.css("top", 40))
  4350.                 }
  4351.             },
  4352.             initialize: function() {
  4353.                 this.model.bind("destroy", this.removeView, this), this.model.bind("change:params", this.changeShortcodeParams, this), this.model.bind("change_parent_id", this.changeShortcodeParent, this), this.createParams()
  4354.             },
  4355.             hasUserAccess: function() {
  4356.                 var shortcodeTag;
  4357.                 return shortcodeTag = this.model.get("shortcode"), -1 < _.indexOf(["vc_row", "vc_column", "vc_row_inner", "vc_column_inner"], shortcodeTag) || !!_.every(vc.roles.current_user, function(role) {
  4358.                     return !(!_.isUndefined(vc.roles[role]) && !_.isUndefined(vc.roles[role].shortcodes) && _.isUndefined(vc.roles[role].shortcodes[shortcodeTag]))
  4359.                 })
  4360.             },
  4361.             canCurrentUser: function(action) {
  4362.                 var tag;
  4363.                 return tag = this.model.get("shortcode"), void 0 === action || "all" === action ? vc_user_access().shortcodeAll(tag) : vc_user_access().shortcodeEdit(tag)
  4364.             },
  4365.             createParams: function() {
  4366.                 var tag, settings;
  4367.                 tag = this.model.get("shortcode"), settings = _.isObject(vc.map[tag]) && _.isArray(vc.map[tag].params) ? vc.map[tag].params : [], this.model.get("params"), this.params = {}, _.each(settings, function(param) {
  4368.                     this.params[param.param_name] = param
  4369.                 }, this)
  4370.             },
  4371.             setContent: function() {
  4372.                 this.$content = this.$el.find("> .wpb_element_wrapper > .vc_container_for_children, > .vc_element-wrapper > .vc_container_for_children")
  4373.             },
  4374.             setEmpty: function() {},
  4375.             unsetEmpty: function() {},
  4376.             checkIsEmpty: function() {
  4377.                 this.model.get("parent_id") && vc.app.views[this.model.get("parent_id")].checkIsEmpty()
  4378.             },
  4379.             html2element: function(html) {
  4380.                 var $template, attributes = {},
  4381.                     template = vc.template(html);
  4382.                 $template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
  4383.                     attributes[attr.name] = attr.value
  4384.                 }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
  4385.             },
  4386.             render: function() {
  4387.                 var $shortcode_template_el = $("#vc_shortcode-template-" + this.model.get("shortcode"));
  4388.                 return $shortcode_template_el.is("script") && this.html2element($shortcode_template_el.html()), this.model.view = this, this.$controls_buttons = this.$el.find(".vc_controls > :first"), this
  4389.             },
  4390.             renderContent: function() {
  4391.                 return this.$el.attr("data-model-id", this.model.get("id")), this.$el.data("model", this.model), this
  4392.             },
  4393.             changedContent: function(view) {},
  4394.             _loadDefaults: function() {
  4395.                 var tag, hasChilds;
  4396.                 tag = this.model.get("shortcode"), !(hasChilds = !!vc.shortcodes.where({
  4397.                     parent_id: this.model.get("id")
  4398.                 }).length) && !0 === this.use_default_content && _.isObject(vc.map[tag]) && _.isString(vc.map[tag].default_content) && vc.map[tag].default_content.length && (this.use_default_content = !1, vc.shortcodes.createFromString(vc.map[tag].default_content, this.model))
  4399.             },
  4400.             _callJsCallback: function() {
  4401.                 var tag = this.model.get("shortcode");
  4402.                 if (_.isObject(vc.map[tag]) && _.isObject(vc.map[tag].js_callback) && !_.isUndefined(vc.map[tag].js_callback.init)) {
  4403.                     var fn = vc.map[tag].js_callback.init;
  4404.                     window[fn](this.$el)
  4405.                 }
  4406.             },
  4407.             ready: function(e) {
  4408.                 return this._loadDefaults(), this._callJsCallback(), this.model.get("parent_id") && _.isObject(vc.app.views[this.model.get("parent_id")]) && vc.app.views[this.model.get("parent_id")].changedContent(this), _.defer(_.bind(function() {
  4409.                     vc.events.trigger("shortcodeView:ready", this), vc.events.trigger("shortcodeView:ready:" + this.model.get("shortcode"), this)
  4410.                 }, this)), this
  4411.             },
  4412.             addShortcode: function(view, method) {
  4413.                 var before_shortcode;
  4414.                 before_shortcode = _.last(vc.shortcodes.filter(function(shortcode) {
  4415.                     return shortcode.get("parent_id") === this.get("parent_id") && parseFloat(shortcode.get("order")) < parseFloat(this.get("order"))
  4416.                 }, view.model)), before_shortcode ? view.render().$el.insertAfter("[data-model-id=" + before_shortcode.id + "]") : "append" === method ? this.$content.append(view.render().el) : this.$content.prepend(view.render().el)
  4417.             },
  4418.             changeShortcodeParams: function(model) {
  4419.                 var tag, params, settings, view;
  4420.                 tag = model.get("shortcode"), params = model.get("params"), settings = vc.map[tag], _.defer(function() {
  4421.                     vc.events.trigger("backend.shortcodeViewChangeParams:" + tag)
  4422.                 }), (_.isArray(settings.params) || _.isObject(settings.params)) && _.each(settings.params, function(param_settings) {
  4423.                     var name, value, $wrapper, label_value, $admin_label;
  4424.                     if (name = param_settings.param_name, value = params[name], $wrapper = this.$el.find("> .wpb_element_wrapper, > .vc_element-wrapper"), label_value = value, $admin_label = $wrapper.children(".admin_label_" + name), _.isObject(vc.atts[param_settings.type]) && _.isFunction(vc.atts[param_settings.type].render) && (value = vc.atts[param_settings.type].render.call(this, param_settings, value)), $wrapper.children("." + param_settings.param_name).is("input,textarea,select")) $wrapper.children("[name=" + param_settings.param_name + "]").val(value);
  4425.                     else if ($wrapper.children("." + param_settings.param_name).is("iframe")) $wrapper.children("[name=" + param_settings.param_name + "]").attr("src", value);
  4426.                     else if ($wrapper.children("." + param_settings.param_name).is("img")) {
  4427.                         var $img;
  4428.                         $img = $wrapper.children("[name=" + param_settings.param_name + "]"), value && value.match(/^\d+$/) ? $.ajax({
  4429.                             type: "POST",
  4430.                             url: window.ajaxurl,
  4431.                             data: {
  4432.                                 action: "wpb_single_image_src",
  4433.                                 content: value,
  4434.                                 size: "thumbnail",
  4435.                                 _vcnonce: window.vcAdminNonce
  4436.                             },
  4437.                             dataType: "html",
  4438.                             context: this
  4439.                         }).done(function(url) {
  4440.                             $img.attr("src", url)
  4441.                         }) : value && $img.attr("src", value)
  4442.                     } else $wrapper.children("[name=" + param_settings.param_name + "]").html(value || "");
  4443.                     if ($admin_label.length) {
  4444.                         var inverted_value;
  4445.                         "" === value || _.isUndefined(value) ? $admin_label.hide().addClass("hidden-label") : (_.isObject(param_settings.value) && !_.isArray(param_settings.value) && "checkbox" === param_settings.type ? (inverted_value = _.invert(param_settings.value), label_value = _.map(value.split(/[\s]*\,[\s]*/), function(val) {
  4446.                             return _.isString(inverted_value[val]) ? inverted_value[val] : val
  4447.                         }).join(", ")) : _.isObject(param_settings.value) && !_.isArray(param_settings.value) && (inverted_value = _.invert(param_settings.value), label_value = _.isString(inverted_value[value]) ? inverted_value[value] : value), $admin_label.html("<label>" + $admin_label.find("label").text() + "</label>: " + label_value), $admin_label.show().removeClass("hidden-label"))
  4448.                     }
  4449.                 }, this), view = vc.app.views[model.get("parent_id")], !1 !== model.get("parent_id") && _.isObject(view) && view.checkIsEmpty()
  4450.             },
  4451.             changeShortcodeParent: function(model) {
  4452.                 if (!1 === this.model.get("parent_id")) return model;
  4453.                 var $parent_view = $("[data-model-id=" + this.model.get("parent_id") + "]"),
  4454.                     view = vc.app.views[this.model.get("parent_id")];
  4455.                 this.$el.appendTo($parent_view.find("> .wpb_element_wrapper > .wpb_column_container, > .vc_element-wrapper > .wpb_column_container")), view.checkIsEmpty()
  4456.             },
  4457.             deleteShortcode: function(e) {
  4458.                 _.isObject(e) && e.preventDefault(), !0 === confirm(window.i18nLocale.press_ok_to_delete_section) && this.model.destroy()
  4459.             },
  4460.             addElement: function(e) {
  4461.                 _.isObject(e) && e.preventDefault(), vc.add_element_block_view.render(this.model, !_.isObject(e) || !$(e.currentTarget).closest(".bottom-controls").hasClass("bottom-controls"))
  4462.             },
  4463.             editElement: function(e) {
  4464.                 _.isObject(e) && e.preventDefault(), (!vc.active_panel || !vc.active_panel.model || !this.model || vc.active_panel.model && this.model && vc.active_panel.model.get("id") != this.model.get("id")) && (vc.closeActivePanel(), vc.edit_element_block_view.render(this.model))
  4465.             },
  4466.             clone: function(e) {
  4467.                 return _.isObject(e) && e.preventDefault(), vc.clone_index /= 10, this.cloneModel(this.model, this.model.get("parent_id"))
  4468.             },
  4469.             cloneModel: function(model, parent_id, save_order) {
  4470.                 var new_order, model_clone, params, tag;
  4471.                 return new_order = _.isBoolean(save_order) && !0 === save_order ? model.get("order") : parseFloat(model.get("order")) + vc.clone_index, params = _.extend({}, model.get("params")), tag = model.get("shortcode"), model_clone = vc.shortcodes.create({
  4472.                     shortcode: tag,
  4473.                     id: window.vc_guid(),
  4474.                     parent_id: parent_id,
  4475.                     order: new_order,
  4476.                     cloned: !0,
  4477.                     cloned_from: model.toJSON(),
  4478.                     params: params
  4479.                 }), _.each(vc.shortcodes.where({
  4480.                     parent_id: model.id
  4481.                 }), function(shortcode) {
  4482.                     this.cloneModel(shortcode, model_clone.get("id"), !0)
  4483.                 }, this), model_clone
  4484.             },
  4485.             remove: function() {
  4486.                 this.$content && this.$content.data("uiSortable") && this.$content.sortable("destroy"), this.$content && this.$content.data("uiDroppable") && this.$content.droppable("destroy"), delete vc.app.views[this.model.id], window.vc.shortcode_view.__super__.remove.call(this)
  4487.             }
  4488.         }), vc.shortcodes.on("sync", function(collection) {
  4489.             _.isObject(collection) && !_.isEmpty(collection.models) && _.each(collection.models, function(model) {
  4490.                 vc.events.triggerShortcodeEvents("sync", model)
  4491.             })
  4492.         }), vc.shortcodes.on("add", function(model) {
  4493.             _.isObject(model) && vc.events.triggerShortcodeEvents("add", model)
  4494.         })
  4495.     }(window.jQuery),
  4496.     function($) {
  4497.         vc.saved_custom_css = !1, vc.visualComposerView = Backbone.View.extend({
  4498.             el: $("#wpb_visual_composer"),
  4499.             views: {},
  4500.             disableFixedNav: !1,
  4501.             events: {
  4502.                 "click #wpb-add-new-row": "createRow",
  4503.                 "click #vc_post-settings-button": "editSettings",
  4504.                 'click #vc_add-new-element, [data-vc-element="add-element-action"]': "addElement",
  4505.                 "click #vc_fullscreen-button": "enterFullscreen",
  4506.                 "click #vc_windowed-button": "leaveFullscreen",
  4507.                 'click [data-vc-element="add-text-block-action"]': "addTextBlock",
  4508.                 "click .wpb_switch-to-composer": "switchComposer",
  4509.                 "click #vc_templates-editor-button": "openTemplatesWindow",
  4510.                 "click #vc_templates-more-layouts": "openTemplatesWindow",
  4511.                 "click .vc_template[data-template_id] > .wpb_wrapper": "loadDefaultTemplate",
  4512.                 "click #wpb-save-post": "save",
  4513.                 "click .vc_control-preview": "preview"
  4514.             },
  4515.             initializeAccessPolicy: function() {
  4516.                 this.accessPolicy = {
  4517.                     be_editor: vc_user_access().editor("backend_editor"),
  4518.                     fe_editor: vc_frontend_enabled && vc_user_access().editor("frontend_editor"),
  4519.                     classic_editor: !vc_user_access().check("backend_editor", "disabled_ce_editor", void 0, !0)
  4520.                 }
  4521.             },
  4522.             accessPolicyActions: function() {
  4523.                 var front = "",
  4524.                     back = "";
  4525.                 if (this.accessPolicy.fe_editor && (front = '<a class="wpb_switch-to-front-composer" href="' + $("#wpb-edit-inline").attr("href") + '">' + window.i18nLocale.main_button_title_frontend_editor + "</a>"), this.accessPolicy.classic_editor) this.accessPolicy.be_editor && (back = '<a class="wpb_switch-to-composer" href="#">' + window.i18nLocale.main_button_title_backend_editor + "</a>");
  4526.                 else if ($("#postdivrich").addClass("vc-disable-editor"), this.accessPolicy.be_editor) {
  4527.                     var _this = this;
  4528.                     _.defer(function() {
  4529.                         _this.show(), _this.status = "shown"
  4530.                     })
  4531.                 }(front || back) && (this.$buttonsContainer = $('<div class="composer-switch"><span class="logo-icon"></span>' + back + front + "</div>").insertAfter("div#titlediv"), this.accessPolicy.classic_editor && (this.$switchButton = this.$buttonsContainer.find(".wpb_switch-to-composer"), this.$switchButton.click(this.switchComposer)))
  4532.             },
  4533.             initialize: function() {
  4534.                 var _this = this;
  4535.                 _.bindAll(this, "switchComposer", "dropButton", "processScroll", "updateRowsSorting", "updateElementsSorting"), this.accessPolicy = vc.accessPolicy, this.buildRelevance(), vc.events.on("shortcodes:add", vcAddShortcodeDefaultParams, this), vc.events.on("shortcodes:add", vc.atts.addShortcodeIdParam, this), vc.events.on("shortcodes:sync", vc.atts.addShortcodeIdParam, this), vc.events.on("shortcodes:add", this.addShortcode, this), vc.events.on("shortcodes:destroy", this.checkEmpty, this), vc.shortcodes.on("change:params", this.changeParamsEvents, this), vc.shortcodes.on("reset", this.addAll, this), $(document).on("wp-collapse-menu", function(e, params) {
  4536.                     "open" === params.state && _this.leaveFullscreen()
  4537.                 }), this.render()
  4538.             },
  4539.             changeParamsEvents: function(model) {
  4540.                 vc.events.triggerShortcodeEvents("update", model)
  4541.             },
  4542.             render: function() {
  4543.                 return this.$buttonsContainer = $(".composer-switch"), this.$switchButton = this.$buttonsContainer.find(".wpb_switch-to-composer"), this.$vcStatus = $("#wpb_vc_js_status"), this.$metablock_content = $(".metabox-composer-content"), this.$content = $("#visual_composer_content"), this.$post = $("#postdivrich"), this.$loading_block = $("#vc_logo"), vc.add_element_block_view = new vc.AddElementUIPanelBackendEditor({
  4544.                     el: "#vc_ui-panel-add-element"
  4545.                 }), vc.edit_element_block_view = new vc.EditElementUIPanel({
  4546.                     el: "#vc_ui-panel-edit-element"
  4547.                 }), vc.templates_panel_view = new vc.TemplateWindowUIPanelBackendEditor({
  4548.                     el: "#vc_ui-panel-templates"
  4549.                 }), vc.post_settings_view = new vc.PostSettingsUIPanelBackendEditor({
  4550.                     el: "#vc_ui-panel-post-settings"
  4551.                 }), vc.preset_panel_view = new vc.PresetSettingsUIPanelFrontendEditor({
  4552.                     el: "#vc_ui-panel-preset"
  4553.                 }), this.setSortable(), vc.is_mobile = 0 < $("body.mobile").length, vc.saved_custom_css = $("#wpb_custom_post_css_field").val(), vc.updateSettingsBadge(), _.defer(function() {
  4554.                     vc.events.trigger("app.render")
  4555.                 }), this
  4556.             },
  4557.             addAll: function() {
  4558.                 this.views = {}, this.$content.removeClass("loading").empty(), this.addChild(!1), this.checkEmpty(), this.$loading_block.removeClass("vc_ui-wp-spinner"), this.$metablock_content.removeClass("vc_loading-shortcodes"), _.defer(function() {
  4559.                     vc.events.trigger("app.addAll")
  4560.                 })
  4561.             },
  4562.             addChild: function(parent_id) {
  4563.                 _.each(vc.shortcodes.where({
  4564.                     parent_id: parent_id
  4565.                 }), function(shortcode) {
  4566.                     this.appendShortcode(shortcode), this.addChild(shortcode.get("id"))
  4567.                 }, this), this.setSortable()
  4568.             },
  4569.             getView: function(model) {
  4570.                 var view;
  4571.                 return view = _.isObject(vc.map[model.get("shortcode")]) && _.isString(vc.map[model.get("shortcode")].js_view) && vc.map[model.get("shortcode")].js_view.length && !_.isUndefined(window[window.vc.map[model.get("shortcode")].js_view]) ? new(window[window.vc.map[model.get("shortcode")].js_view])({
  4572.                     model: model
  4573.                 }) : new vc.shortcode_view({
  4574.                     model: model
  4575.                 }), model.set({
  4576.                     view: view
  4577.                 }), view
  4578.             },
  4579.             setDraggable: function() {
  4580.                 $("#wpb-add-new-element, #wpb-add-new-row").draggable({
  4581.                     helper: function() {
  4582.                         return $('<div id="drag_placeholder"></div>').appendTo("body")
  4583.                     },
  4584.                     zIndex: 99999,
  4585.                     cursor: "move",
  4586.                     revert: "invalid",
  4587.                     start: function(event, ui) {
  4588.                         $("#drag_placeholder").addClass("column_placeholder").html(window.i18nLocale.drag_drop_me_in_column)
  4589.                     }
  4590.                 })
  4591.             },
  4592.             setDropable: function() {
  4593.                 this.$content.droppable({
  4594.                     greedy: !0,
  4595.                     accept: ".dropable_el,.dropable_row",
  4596.                     hoverClass: "wpb_ui-state-active",
  4597.                     drop: this.dropButton
  4598.                 })
  4599.             },
  4600.             dropButton: function(event, ui) {
  4601.                 ui.draggable.is("#wpb-add-new-element") ? this.addElement() : ui.draggable.is("#wpb-add-new-row") && this.createRow()
  4602.             },
  4603.             appendShortcode: function(model) {
  4604.                 var view, parentModelView, params;
  4605.                 if (view = this.getView(model), params = _.extend(vc.getDefaults(model.get("shortcode")), model.get("params")), model.set("params", params, {
  4606.                         silent: !0
  4607.                     }), parentModelView = !1 !== model.get("parent_id") && this.views[model.get("parent_id")], this.views[model.id] = view, model.get("parent_id")) {
  4608.                     var parentView;
  4609.                     parentView = this.views[model.get("parent_id")], parentView.unsetEmpty()
  4610.                 }
  4611.                 parentModelView ? parentModelView.addShortcode(view, "append") : this.$content.append(view.render().el), view.ready(), view.changeShortcodeParams(model), view.checkIsEmpty(), this.setNotEmpty()
  4612.             },
  4613.             addShortcode: function(model) {
  4614.                 var view, parentModelView, params;
  4615.                 if (params = _.extend(vc.getDefaults(model.get("shortcode")), model.get("params")), model.set("params", params, {
  4616.                         silent: !0
  4617.                     }), view = this.getView(model), parentModelView = !1 !== model.get("parent_id") && this.views[model.get("parent_id")], view.use_default_content = !0 !== model.get("cloned"), this.views[model.id] = view, parentModelView) {
  4618.                     parentModelView.addShortcode(view), parentModelView.checkIsEmpty();
  4619.                     var _this;
  4620.                     _this = this, _.defer(function() {
  4621.                         view.changeShortcodeParams && view.changeShortcodeParams(model), view.ready(), view.checkIsEmpty(), _this.setSortable(), _this.setNotEmpty()
  4622.                     })
  4623.                 } else this.addRow(view), _.defer(function() {
  4624.                     view.changeShortcodeParams && view.changeShortcodeParams(model), view.ready(), view.checkIsEmpty()
  4625.                 })
  4626.             },
  4627.             addRow: function(view) {
  4628.                 var before_shortcode;
  4629.                 before_shortcode = _.last(vc.shortcodes.filter(function(shortcode) {
  4630.                     return !1 === shortcode.get("parent_id") && parseFloat(shortcode.get("order")) < parseFloat(this.get("order"))
  4631.                 }, view.model)), before_shortcode ? view.render().$el.insertAfter("[data-model-id=" + before_shortcode.id + "]") : this.$content.append(view.render().el)
  4632.             },
  4633.             addTextBlock: function(e) {
  4634.                 var row, column, params, row_params, column_params;
  4635.                 return e.preventDefault(), row_params = {}, row = vc.shortcodes.create({
  4636.                     shortcode: "vc_row",
  4637.                     params: row_params
  4638.                 }), column_params = {
  4639.                     width: "1/1"
  4640.                 }, column = vc.shortcodes.create({
  4641.                     shortcode: "vc_column",
  4642.                     params: column_params,
  4643.                     parent_id: row.id,
  4644.                     root_id: row.id
  4645.                 }), params = vc.getDefaults("vc_column_text"), vc.shortcodes.create({
  4646.                     shortcode: "vc_column_text",
  4647.                     parent_id: column.id,
  4648.                     root_id: row.id,
  4649.                     params: params
  4650.                 })
  4651.             },
  4652.             createRow: function() {
  4653.                 var row, row_params, column_params;
  4654.                 return row_params = {}, row = vc.shortcodes.create({
  4655.                     shortcode: "vc_row",
  4656.                     params: row_params
  4657.                 }), column_params = {
  4658.                     width: "1/1"
  4659.                 }, vc.shortcodes.create({
  4660.                     shortcode: "vc_column",
  4661.                     params: column_params,
  4662.                     parent_id: row.id,
  4663.                     root_id: row.id
  4664.                 }), row
  4665.             },
  4666.             addElement: function(e) {
  4667.                 _.isObject(e) && e.preventDefault(), vc.add_element_block_view.render(!1)
  4668.             },
  4669.             openTemplatesWindow: function(e) {
  4670.                 e && e.preventDefault(), $(e.currentTarget).is("#vc_templates-more-layouts") && vc.templates_panel_view.once("show", function() {
  4671.                     $('[data-vc-ui-element-target="[data-tab=default_templates]"]').click()
  4672.                 }), vc.templates_panel_view.render().show()
  4673.             },
  4674.             loadDefaultTemplate: function(e) {
  4675.                 e && e.preventDefault(), vc.templates_panel_view.loadTemplate(e)
  4676.             },
  4677.             editSettings: function(e) {
  4678.                 e && e.preventDefault(), vc.post_settings_view.render().show()
  4679.             },
  4680.             enterFullscreen: function() {
  4681.                 var $body = $("body");
  4682.                 $body.hasClass("folded") ? ($body.data("vcKeepMenuFolded", !0), $body.addClass("vc_fullscreen")) : $body.addClass("vc_fullscreen folded")
  4683.             },
  4684.             leaveFullscreen: function() {
  4685.                 var $body = $("body");
  4686.                 $body.hasClass("vc_fullscreen") && ($body.data("vcKeepMenuFolded") ? ($body.removeClass("vc_fullscreen"), $body.removeData("vcKeepMenuFolded")) : $body.removeClass("vc_fullscreen folded"))
  4687.             },
  4688.             sortingStarted: function(event, ui) {
  4689.                 $("#visual_composer_content").addClass("vc_sorting-started")
  4690.             },
  4691.             sortingStopped: function(event, ui) {
  4692.                 var tag = ui.item.data("element_type"),
  4693.                     parent_tag = ui.placeholder.closest("[data-element_type]").data("element_type") || "";
  4694.                 vc.check_relevance(parent_tag, tag) && parent_tag != tag || (ui.placeholder.addClass("vc_hidden-placeholder"), $(event.target).sortable("cancel")), $("#visual_composer_content").removeClass("vc_sorting-started")
  4695.             },
  4696.             updateElementsSorting: function(event, ui) {
  4697.                 _.defer(function(app) {
  4698.                     var $current_container = ui.item.parent().closest("[data-model-id]"),
  4699.                         parent = $current_container.data("model"),
  4700.                         model = ui.item.data("model"),
  4701.                         models = app.views[parent.id].$content.find("> [data-model-id]"),
  4702.                         i = 0;
  4703.                     if (!_.isNull(ui.sender)) {
  4704.                         var old_parent_id = model.get("parent_id");
  4705.                         vc.storage.lock(), model.save({
  4706.                             parent_id: parent.id
  4707.                         }), old_parent_id && app.views[old_parent_id].checkIsEmpty(), app.views[parent.id].checkIsEmpty()
  4708.                     }
  4709.                     models.each(function() {
  4710.                         var shortcode = $(this).data("model");
  4711.                         vc.storage.lock(), shortcode.save({
  4712.                             order: i++
  4713.                         })
  4714.                     }), model.save()
  4715.                 }, this)
  4716.             },
  4717.             updateRowsSorting: function(e, ui) {
  4718.                 _.defer(function(app) {
  4719.                     var parentNode = ui.item.parent(),
  4720.                         $currentContainer = parentNode.closest("[data-model-id]"),
  4721.                         newParentId = !!$currentContainer.length && $currentContainer.data("model").get("id"),
  4722.                         model = ui.item.data("model"),
  4723.                         tag = ui.item.data("element_type"),
  4724.                         parent_tag = ui.item.parent().closest("[data-element_type]").data("element_type") || "";
  4725.                     if (!vc.check_relevance(parent_tag, tag) || parent_tag == tag) return void $(e.target).sortable("cancel");
  4726.                     var oldParentId = model.get("parent_id");
  4727.                     parentNode.find(app.rowSortableSelector).each(function() {
  4728.                         var index = $(this).index();
  4729.                         vc.storage.lock(), $(this).data("model").save({
  4730.                             order: index
  4731.                         })
  4732.                     }), model.save({
  4733.                         parent_id: newParentId
  4734.                     }), oldParentId && app.views[oldParentId].checkIsEmpty(), newParentId && app.views[newParentId].checkIsEmpty()
  4735.                 }, this)
  4736.             },
  4737.             renderPlaceholder: function(event, element) {
  4738.                 var tag = $(element).data("element_type"),
  4739.                     is_container = _.isObject(vc.map[tag]) && (_.isBoolean(vc.map[tag].is_container) && !0 === vc.map[tag].is_container || !_.isEmpty(vc.map[tag].as_parent));
  4740.                 return $('<div class="vc_helper vc_helper-' + tag + '"><i class="vc_general vc_element-icon' + (vc.map[tag].icon ? " " + vc.map[tag].icon : "") + '"' + (is_container ? ' data-is-container="true"' : "") + "></i> " + vc.map[tag].name + "</div>").prependTo("body")
  4741.             },
  4742.             rowSortableSelector: "> .wpb_vc_row, > .vc_main-sortable-element",
  4743.             setSortable: function() {
  4744.                 if (vc_user_access().partAccess("dragndrop")) return $(".wpb_main_sortable").sortable({
  4745.                     forcePlaceholderSize: !0,
  4746.                     placeholder: "widgets-placeholder",
  4747.                     cursor: "move",
  4748.                     connectWith: ".vc_section_container",
  4749.                     items: this.rowSortableSelector,
  4750.                     handle: ".vc_column-move",
  4751.                     cancel: ".vc-non-draggable-row",
  4752.                     distance: .5,
  4753.                     start: this.sortingStarted,
  4754.                     stop: this.sortingStopped,
  4755.                     update: this.updateRowsSorting,
  4756.                     tolerance: "intersect",
  4757.                     over: function(event, ui) {
  4758.                         var tag = ui.item.data("element_type"),
  4759.                             parent_tag = ui.placeholder.closest("[data-element_type]").data("element_type") || "";
  4760.                         if (!vc.check_relevance(parent_tag, tag) || parent_tag == tag) return ui.placeholder.addClass("vc_hidden-placeholder"), !1;
  4761.                         ui.placeholder.css({
  4762.                             maxWidth: ui.placeholder.parent().width()
  4763.                         })
  4764.                     },
  4765.                     out: function(event, ui) {
  4766.                         ui.placeholder.removeClass("vc_hidden-placeholder"), ui.placeholder.css({
  4767.                             maxWidth: ui.placeholder.parent().width()
  4768.                         })
  4769.                     }
  4770.                 }), $(".wpb_column_container").sortable({
  4771.                     forcePlaceholderSize: !0,
  4772.                     forceHelperSize: !1,
  4773.                     connectWith: ".wpb_column_container",
  4774.                     placeholder: "vc_placeholder",
  4775.                     items: "> div.wpb_sortable,> div.vc-non-draggable",
  4776.                     helper: this.renderPlaceholder,
  4777.                     distance: 3,
  4778.                     cancel: ".vc-non-draggable",
  4779.                     scroll: !0,
  4780.                     scrollSensitivity: 70,
  4781.                     cursor: "move",
  4782.                     cursorAt: {
  4783.                         top: 20,
  4784.                         left: 16
  4785.                     },
  4786.                     tolerance: "intersect",
  4787.                     start: function() {
  4788.                         $("#visual_composer_content").addClass("vc_sorting-started"), $(".vc_not_inner_content").addClass("dragging_in")
  4789.                     },
  4790.                     stop: function(event, ui) {
  4791.                         $("#visual_composer_content").removeClass("vc_sorting-started"), $(".dragging_in").removeClass("dragging_in");
  4792.                         var tag = ui.item.data("element_type"),
  4793.                             parent_tag = ui.item.parent().closest("[data-element_type]").data("element_type") || "",
  4794.                             allowed_container_element = !!_.isUndefined(vc.map[parent_tag].allowed_container_element) || vc.map[parent_tag].allowed_container_element;
  4795.                         vc.check_relevance(parent_tag, tag) && parent_tag != tag || $(this).sortable("cancel"), _.isObject(vc.map[tag]) && (_.isBoolean(vc.map[tag].is_container) && !0 === vc.map[tag].is_container || !_.isEmpty(vc.map[tag].as_parent)) && !0 !== allowed_container_element && allowed_container_element !== ui.item.data("element_type").replace(/_inner$/, "") && $(this).sortable("cancel"), $(".vc_sorting-empty-container").removeClass("vc_sorting-empty-container")
  4796.                     },
  4797.                     update: this.updateElementsSorting,
  4798.                     over: function(event, ui) {
  4799.                         var tag = ui.item.data("element_type"),
  4800.                             parent_tag = ui.placeholder.closest("[data-element_type]").data("element_type"),
  4801.                             allowed_container_element = !!_.isUndefined(vc.map[parent_tag].allowed_container_element) || vc.map[parent_tag].allowed_container_element;
  4802.                         vc.check_relevance(parent_tag, tag) && parent_tag != tag || ui.placeholder.addClass("vc_hidden-placeholder"), _.isObject(vc.map[tag]) && (_.isBoolean(vc.map[tag].is_container) && !0 === vc.map[tag].is_container || !_.isEmpty(vc.map[tag].as_parent)) && !0 !== allowed_container_element && allowed_container_element !== ui.item.data("element_type").replace(/_inner$/, "") && ui.placeholder.addClass("vc_hidden-placeholder"), _.isNull(ui.sender) || !ui.sender.length || ui.sender.find("> [data-element_type]:not(.ui-sortable-helper):visible").length || ui.sender.addClass("vc_sorting-empty-container"), ui.placeholder.css({
  4803.                             maxWidth: ui.placeholder.parent().width()
  4804.                         })
  4805.                     },
  4806.                     out: function(event, ui) {
  4807.                         ui.placeholder.removeClass("vc_hidden-placeholder"), ui.placeholder.css({
  4808.                             maxWidth: ui.placeholder.parent().width()
  4809.                         })
  4810.                     }
  4811.                 }).disableSelection(), this
  4812.             },
  4813.             setNotEmpty: function() {
  4814.                 $("#vc_no-content-helper").addClass("vc_not-empty")
  4815.             },
  4816.             setIsEmpty: function() {
  4817.                 vc.views = {}, $("#vc_no-content-helper").removeClass("vc_not-empty")
  4818.             },
  4819.             checkEmpty: function(model) {
  4820.                 if (_.isObject(model) && !1 !== model.get("parent_id") && model.get("parent_id") != model.id) {
  4821.                     var parent_view = this.views[model.get("parent_id")];
  4822.                     if (!parent_view) return;
  4823.                     parent_view.checkIsEmpty()
  4824.                 }
  4825.                 0 === vc.shortcodes.length ? this.setIsEmpty() : this.setNotEmpty()
  4826.             },
  4827.             switchComposer: function(e) {
  4828.                 _.isObject(e) && e.preventDefault(), "shown" === this.status ? (this.accessPolicy.can("classic_editor") && (!_.isUndefined(this.$switchButton) && this.$switchButton.text(window.i18nLocale.main_button_title_backend_editor), !_.isUndefined(this.$buttonsContainer) && this.$buttonsContainer.removeClass("vc_backend-status")), this.close(), this.status = "closed") : (this.accessPolicy.can("classic_editor") && (!_.isUndefined(this.$switchButton) && this.$switchButton.text(window.i18nLocale.main_button_title_revert), !_.isUndefined(this.$buttonsContainer) && this.$buttonsContainer.addClass("vc_backend-status")), this.show(), this.status = "shown")
  4829.             },
  4830.             show: function() {
  4831.                 this.$el.show(), this.$post.addClass("vc-disable-editor"), this.$vcStatus.val("true"), this.navOnScroll(), vc.storage.isContentChanged() && (vc.app.setLoading(), vc.app.views = {}, _.defer(function() {
  4832.                     vc.shortcodes.fetch({
  4833.                         reset: !0
  4834.                     }), vc.events.trigger("backendEditor.show")
  4835.                 }))
  4836.             },
  4837.             setLoading: function() {
  4838.                 this.setNotEmpty(), this.$loading_block.addClass("vc_ui-wp-spinner"), this.$metablock_content.addClass("vc_loading-shortcodes")
  4839.             },
  4840.             close: function() {
  4841.                 this.$vcStatus.val("false"), this.$el.hide(), _.isObject(window.editorExpand) && (_.delay(function() {
  4842.                     window.scrollBy(0, -1)
  4843.                 }, 17), _.delay(function() {
  4844.                     window.scrollBy(0, 1)
  4845.                 }, 17)), this.$post.removeClass("vc-disable-editor"), _.defer(function() {
  4846.                     vc.events.trigger("backendEditor.close")
  4847.                 })
  4848.             },
  4849.             checkVcStatus: function() {
  4850.                 !vc.accessPolicy.can("be_editor") || vc.accessPolicy.can("classic_editor") && "true" !== this.$vcStatus.val() || this.switchComposer()
  4851.             },
  4852.             setNavTop: function() {
  4853.                 this.navTop = this.$nav.length && this.$nav.offset().top - 28
  4854.             },
  4855.             save: function() {
  4856.                 $("#wpb-save-post").text(window.i18nLocale.loading), $("#publish").click()
  4857.             },
  4858.             preview: function() {
  4859.                 $("#post-preview").click()
  4860.             },
  4861.             navOnScroll: function() {
  4862.                 this.$nav = $("#vc_navbar"), this.setNavTop(), this.processScroll(), $(window).unbind("scroll.composer").on("scroll.composer", this.processScroll)
  4863.             },
  4864.             processScroll: function(e) {
  4865.                 if (!0 === this.disableFixedNav) return void this.$nav.removeClass("vc_subnav-fixed");
  4866.                 (!this.navTop || 0 > this.navTop) && this.setNavTop(),
  4867.                     this.scrollTop = $(window).scrollTop() + 80, 0 < this.navTop && this.scrollTop >= this.navTop && !this.isFixed ? (this.isFixed = 1, this.$nav.addClass("vc_subnav-fixed")) : this.scrollTop <= this.navTop && this.isFixed && (this.isFixed = 0, this.$nav.removeClass("vc_subnav-fixed"))
  4868.             },
  4869.             buildRelevance: function() {
  4870.                 vc.shortcode_relevance = {}, _.map(vc.map, function(object) {
  4871.                     _.isObject(object.as_parent) && _.isString(object.as_parent.only) && (vc.shortcode_relevance["parent_only_" + object.base] = object.as_parent.only.replace(/\s/, "").split(",")), _.isObject(object.as_parent) && _.isString(object.as_parent.except) && (vc.shortcode_relevance["parent_except_" + object.base] = object.as_parent.except.replace(/\s/, "").split(",")), _.isObject(object.as_child) && _.isString(object.as_child.only) && (vc.shortcode_relevance["child_only_" + object.base] = object.as_child.only.replace(/\s/, "").split(",")), _.isObject(object.as_child) && _.isString(object.as_child.except) && (vc.shortcode_relevance["child_except_" + object.base] = object.as_child.except.replace(/\s/, "").split(","))
  4872.                 }), vc.check_relevance = function(tag, related_tag) {
  4873.                     return !(_.isArray(vc.shortcode_relevance["parent_only_" + tag]) && !_.contains(vc.shortcode_relevance["parent_only_" + tag], related_tag)) && ((!_.isArray(vc.shortcode_relevance["parent_except_" + tag]) || !_.contains(vc.shortcode_relevance["parent_except_" + tag], related_tag)) && (!(_.isArray(vc.shortcode_relevance["child_only_" + related_tag]) && !_.contains(vc.shortcode_relevance["child_only_" + related_tag], tag)) && (!_.isArray(vc.shortcode_relevance["child_except_" + related_tag]) || !_.contains(vc.shortcode_relevance["child_except" + related_tag], tag))))
  4874.                 }
  4875.             }
  4876.         }), $(function() {
  4877.             var $wpbVisualComposer;
  4878.             $wpbVisualComposer = $("#wpb_visual_composer"), $wpbVisualComposer.is("div") && (vc.app = new vc.visualComposerView({
  4879.                 el: $wpbVisualComposer
  4880.             }), vc.accessPolicy.can("be_editor") ? vc.app.checkVcStatus() : vc.app.$el.remove(), vc.events.on("vc:backend_editor:show", function() {
  4881.                 vc.app.show(), vc.app.status = "shown"
  4882.             }), vc.events.on("vc:backend_editor:switch", function() {
  4883.                 vc.app.switchComposer()
  4884.             }))
  4885.         })
  4886.     }(window.jQuery),
  4887.     function($) {
  4888.         var Shortcodes = vc.shortcodes;
  4889.         window.VcRowView = vc.shortcode_view.extend({
  4890.             change_columns_layout: !1,
  4891.             events: {
  4892.                 'click > .vc_controls [data-vc-control="delete"]': "deleteShortcode",
  4893.                 "click > .vc_controls .set_columns": "setColumns",
  4894.                 'click > .vc_controls [data-vc-control="add"]': "addElement",
  4895.                 'click > .vc_controls [data-vc-control="edit"]': "editElement",
  4896.                 'click > .vc_controls [data-vc-control="clone"]': "clone",
  4897.                 'click > .vc_controls [data-vc-control="move"]': "moveElement",
  4898.                 'click > .vc_controls [data-vc-control="toggle"]': "toggleElement",
  4899.                 "click > .wpb_element_wrapper .vc_controls": "openClosedRow"
  4900.             },
  4901.             convertRowColumns: function(layout) {
  4902.                 var layout_split = layout.toString().split(/_/),
  4903.                     columns = Shortcodes.where({
  4904.                         parent_id: this.model.id
  4905.                     }),
  4906.                     new_columns = [],
  4907.                     new_layout = [],
  4908.                     new_width = "";
  4909.                 return _.each(layout_split, function(value, i) {
  4910.                     var new_column_params, new_column, column_data = _.map(value.toString().split(""), function(v, i) {
  4911.                         return parseInt(v, 10)
  4912.                     });
  4913.                     new_width = 3 < column_data.length ? column_data[0] + "" + column_data[1] + "/" + column_data[2] + column_data[3] : 2 < column_data.length ? column_data[0] + "/" + column_data[1] + column_data[2] : column_data[0] + "/" + column_data[1], new_layout.push(new_width), new_column_params = _.extend(_.isUndefined(columns[i]) ? {} : columns[i].get("params"), {
  4914.                         width: new_width
  4915.                     }), vc.storage.lock(), new_column = Shortcodes.create({
  4916.                         shortcode: this.getChildTag(),
  4917.                         params: new_column_params,
  4918.                         parent_id: this.model.id
  4919.                     }), _.isObject(columns[i]) && _.each(Shortcodes.where({
  4920.                         parent_id: columns[i].id
  4921.                     }), function(shortcode) {
  4922.                         vc.storage.lock(), shortcode.save({
  4923.                             parent_id: new_column.id
  4924.                         }), vc.storage.lock(), shortcode.trigger("change_parent_id")
  4925.                     }), new_columns.push(new_column)
  4926.                 }, this), layout_split.length < columns.length && _.each(columns.slice(layout_split.length), function(column) {
  4927.                     _.each(Shortcodes.where({
  4928.                         parent_id: column.id
  4929.                     }), function(shortcode) {
  4930.                         vc.storage.lock(), shortcode.save({
  4931.                             parent_id: _.last(new_columns).id
  4932.                         }), vc.storage.lock(), shortcode.trigger("change_parent_id")
  4933.                     })
  4934.                 }), _.each(columns, function(shortcode) {
  4935.                     vc.storage.lock(), shortcode.destroy()
  4936.                 }, this), this.model.save(), this.setActiveLayoutButton("" + layout), new_layout
  4937.             },
  4938.             changeShortcodeParams: function(model) {
  4939.                 window.VcRowView.__super__.changeShortcodeParams.call(this, model), this.buildDesignHelpers(), this.setRowClasses()
  4940.             },
  4941.             setRowClasses: function() {
  4942.                 var disable = this.model.getParam("disable_element"),
  4943.                     disableClass = "vc_hidden-xs vc_hidden-sm  vc_hidden-md vc_hidden-lg";
  4944.                 this.disable_element_class && this.$el.removeClass(this.disable_element_class), _.isEmpty(disable) || (this.$el.addClass(disableClass), this.disable_element_class = disableClass)
  4945.             },
  4946.             designHelpersSelector: "> .vc_controls .column_toggle",
  4947.             buildDesignHelpers: function() {
  4948.                 var css, $elementToPrepend, image, color, rowId, matches;
  4949.                 css = this.model.getParam("css"), $elementToPrepend = this.$el.find(this.designHelpersSelector), this.$el.find("> .vc_controls .vc_row_color").remove(), this.$el.find("> .vc_controls .vc_row_image").remove(), matches = css.match(/background\-image:\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (image = matches[1]), matches = css.match(/background\-color:\s*([^\s\;]+)\b/), matches && !_.isUndefined(matches[1]) && (color = matches[1]), matches = css.match(/background:\s*([^\s]+)\b\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (color = matches[1], image = matches[2]), rowId = this.model.getParam("el_id"), this.$el.find("> .vc_controls .vc_row-hash-id").remove(), _.isEmpty(rowId) || $('<span class="vc_row-hash-id"></span>').text("#" + rowId).insertAfter($elementToPrepend), image && $('<span class="vc_row_image" style="background-image: url(' + image + ');" title="' + window.i18nLocale.row_background_image + '"></span>').insertAfter($elementToPrepend), color && $('<span class="vc_row_color" style="background-color: ' + color + '" title="' + window.i18nLocale.row_background_color + '"></span>').insertAfter($elementToPrepend)
  4950.             },
  4951.             addElement: function(e) {
  4952.                 e && e.preventDefault(), Shortcodes.create({
  4953.                     shortcode: this.getChildTag(),
  4954.                     params: {},
  4955.                     parent_id: this.model.id
  4956.                 }), this.setActiveLayoutButton(), this.$el.removeClass("vc_collapsed-row")
  4957.             },
  4958.             getChildTag: function() {
  4959.                 return "vc_row_inner" === this.model.get("shortcode") ? "vc_column_inner" : "vc_column"
  4960.             },
  4961.             sortingSelector: "> [data-element_type=vc_column], > [data-element_type=vc_column_inner]",
  4962.             sortingSelectorCancel: ".vc-non-draggable-column",
  4963.             setSorting: function() {
  4964.                 if (vc_user_access().partAccess("dragndrop")) {
  4965.                     var _this = this;
  4966.                     1 < this.$content.find(this.sortingSelector).length ? this.$content.removeClass("wpb-not-sortable").sortable({
  4967.                         forcePlaceholderSize: !0,
  4968.                         placeholder: "widgets-placeholder-column",
  4969.                         tolerance: "pointer",
  4970.                         cursor: "move",
  4971.                         items: this.sortingSelector,
  4972.                         cancel: this.sortingSelectorCancel,
  4973.                         distance: .5,
  4974.                         start: function(event, ui) {
  4975.                             $("#visual_composer_content").addClass("vc_sorting-started"), ui.placeholder.width(ui.item.width())
  4976.                         },
  4977.                         stop: function(event, ui) {
  4978.                             $("#visual_composer_content").removeClass("vc_sorting-started")
  4979.                         },
  4980.                         update: function() {
  4981.                             var $columns = $(_this.sortingSelector, _this.$content);
  4982.                             $columns.each(function() {
  4983.                                 var model = $(this).data("model"),
  4984.                                     index = $(this).index();
  4985.                                 model.set("order", index), $columns.length - 1 > index && vc.storage.lock(), model.save()
  4986.                             })
  4987.                         },
  4988.                         over: function(event, ui) {
  4989.                             ui.placeholder.css({
  4990.                                 maxWidth: ui.placeholder.parent().width()
  4991.                             }), ui.placeholder.removeClass("vc_hidden-placeholder")
  4992.                         },
  4993.                         beforeStop: function(event, ui) {}
  4994.                     }) : (this.$content.hasClass("ui-sortable") && this.$content.sortable("destroy"), this.$content.addClass("wpb-not-sortable"))
  4995.                 }
  4996.             },
  4997.             validateCellsList: function(cells) {
  4998.                 var b, return_cells = [],
  4999.                     split = cells.replace(/\s/g, "").split("+");
  5000.                 return 12 === _.reduce(_.map(split, function(c) {
  5001.                     if (c.match(/^(vc_)?span\d?$/)) {
  5002.                         var converted_c = vc_convert_column_span_size(c);
  5003.                         return !1 === converted_c ? 1e3 : (b = converted_c.split(/\//), return_cells.push(b[0] + "" + b[1]), 12 * parseInt(b[0], 10) / parseInt(b[1], 10))
  5004.                     }
  5005.                     return c.match(/^[1-9]|1[0-2]\/[1-9]|1[0-2]$/) ? (b = c.split(/\//), return_cells.push(b[0] + "" + b[1]), 12 * parseInt(b[0], 10) / parseInt(b[1], 10)) : 1e4
  5006.                 }), function(num, memo) {
  5007.                     return memo += num
  5008.                 }, 0) && return_cells.join("_")
  5009.             },
  5010.             setActiveLayoutButton: function(column_layout) {
  5011.                 column_layout || (column_layout = _.map(vc.shortcodes.where({
  5012.                     parent_id: this.model.get("id")
  5013.                 }), function(model) {
  5014.                     var width = model.getParam("width");
  5015.                     return width ? width.replace(/\//, "") : "11"
  5016.                 }).join("_")), this.$el.find("> .vc_controls .vc_active").removeClass("vc_active");
  5017.                 var $button = this.$el.find('> .vc_ [data-cells-mask="' + vc_get_column_mask(column_layout) + '"] [data-cells="' + column_layout + '"], > .vc_controls [data-cells-mask="' + vc_get_column_mask(column_layout) + '"][data-cells="' + column_layout + '"]');
  5018.                 $button.length ? $button.addClass("vc_active") : this.$el.find("> .vc_controls [data-cells-mask=custom]").addClass("vc_active")
  5019.             },
  5020.             layoutEditor: function() {
  5021.                 return _.isUndefined(vc.row_layout_editor) && (vc.row_layout_editor = new vc.RowLayoutUIPanelBackendEditor({
  5022.                     el: $("#vc_ui-panel-row-layout")
  5023.                 })), vc.row_layout_editor
  5024.             },
  5025.             setColumns: function(e) {
  5026.                 _.isObject(e) && e.preventDefault();
  5027.                 var $button = $(e.currentTarget);
  5028.                 if ("custom" === $button.data("cells")) this.layoutEditor().render(this.model).show();
  5029.                 else {
  5030.                     if (vc.is_mobile) {
  5031.                         var $parent = $button.parent();
  5032.                         $parent.hasClass("vc_visible") || ($parent.addClass("vc_visible"), $(document).off("click.vcRowColumnsControl").on("click.vcRowColumnsControl", function(e) {
  5033.                             $parent.removeClass("vc_visible")
  5034.                         }))
  5035.                     }
  5036.                     $button.is(".vc_active") || (this.change_columns_layout = !0, _.defer(function(view, cells) {
  5037.                         view.convertRowColumns(cells)
  5038.                     }, this, $button.data("cells")))
  5039.                 }
  5040.                 this.$el.removeClass("vc_collapsed-row")
  5041.             },
  5042.             sizeRows: function() {
  5043.                 var max_height = 45;
  5044.                 $("> .wpb_vc_column, > .wpb_vc_column_inner", this.$content).each(function() {
  5045.                     var content_height = $(this).find("> .wpb_element_wrapper > .wpb_column_container").css({
  5046.                         minHeight: 0
  5047.                     }).height();
  5048.                     content_height > max_height && (max_height = content_height)
  5049.                 }).each(function() {
  5050.                     $(this).find("> .wpb_element_wrapper > .wpb_column_container").css({
  5051.                         minHeight: max_height
  5052.                     })
  5053.                 })
  5054.             },
  5055.             ready: function(e) {
  5056.                 return window.VcRowView.__super__.ready.call(this, e), this
  5057.             },
  5058.             checkIsEmpty: function() {
  5059.                 window.VcRowView.__super__.checkIsEmpty.call(this), this.setSorting()
  5060.             },
  5061.             changedContent: function(view) {
  5062.                 if (this.change_columns_layout) return this;
  5063.                 this.setActiveLayoutButton()
  5064.             },
  5065.             moveElement: function(e) {
  5066.                 e.preventDefault()
  5067.             },
  5068.             toggleElement: function(e) {
  5069.                 e && e.preventDefault(), this.$el.toggleClass("vc_collapsed-row")
  5070.             },
  5071.             openClosedRow: function(e) {
  5072.                 this.$el.removeClass("vc_collapsed-row")
  5073.             },
  5074.             remove: function() {
  5075.                 this.$content && this.$content.data("uiSortable") && this.$content.sortable("destroy"), this.$content && this.$content.data("uiDroppable") && this.$content.droppable("destroy"), delete vc.app.views[this.model.id], window.VcRowView.__super__.remove.call(this)
  5076.             }
  5077.         }), window.VcColumnView = vc.shortcode_view.extend({
  5078.             events: {
  5079.                 'click > .vc_controls [data-vc-control="delete"]': "deleteShortcode",
  5080.                 'click > .vc_controls [data-vc-control="add"]': "addElement",
  5081.                 'click > .vc_controls [data-vc-control="edit"]': "editElement",
  5082.                 'click > .vc_controls [data-vc-control="clone"]': "clone",
  5083.                 "click > .wpb_element_wrapper > .vc_empty-container": "addToEmpty"
  5084.             },
  5085.             current_column_width: !1,
  5086.             initialize: function(options) {
  5087.                 window.VcColumnView.__super__.initialize.call(this, options), _.bindAll(this, "setDropable", "dropButton")
  5088.             },
  5089.             ready: function(e) {
  5090.                 return window.VcColumnView.__super__.ready.call(this, e), this
  5091.             },
  5092.             render: function() {
  5093.                 return window.VcColumnView.__super__.render.call(this), this.current_column_width = this.model.get("params").width || "1/1", this.$el.attr("data-width", this.current_column_width), this.setEmpty(), this
  5094.             },
  5095.             changeShortcodeParams: function(model) {
  5096.                 window.VcColumnView.__super__.changeShortcodeParams.call(this, model), this.setColumnClasses(), this.buildDesignHelpers()
  5097.             },
  5098.             designHelpersSelector: "> .vc_controls .column_add",
  5099.             buildDesignHelpers: function() {
  5100.                 var matches, image, color, css = this.model.getParam("css"),
  5101.                     $column_toggle = this.$el.find(this.designHelpersSelector).get(0);
  5102.                 this.$el.find("> .vc_controls .vc_column_color").remove(), this.$el.find("> .vc_controls .vc_column_image").remove(), matches = css.match(/background\-image:\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (image = matches[1]), matches = css.match(/background\-color:\s*([^\s\;]+)\b/), matches && !_.isUndefined(matches[1]) && (color = matches[1]), matches = css.match(/background:\s*([^\s]+)\b\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (color = matches[1], image = matches[2]), image && $('<span class="vc_column_image" style="background-image: url(' + image + ');" title="' + i18nLocale.column_background_image + '"></span>').insertBefore($column_toggle), color && $('<span class="vc_column_color" style="background-color: ' + color + '" title="' + i18nLocale.column_background_color + '"></span>').insertBefore($column_toggle)
  5103.             },
  5104.             setColumnClasses: function() {
  5105.                 var current_css_class_width, offset = this.model.getParam("offset") || "",
  5106.                     width = this.model.getParam("width") || "1/1",
  5107.                     css_class_width = this.convertSize(width);
  5108.                 this.current_offset_class && this.$el.removeClass(this.current_offset_class), this.current_column_width !== width && (current_css_class_width = this.convertSize(this.current_column_width), this.$el.attr("data-width", width).removeClass(current_css_class_width).addClass(css_class_width), this.current_column_width = width), offset.match(/vc_col\-sm\-\d+/) && this.$el.removeClass(css_class_width), _.isEmpty(offset) || this.$el.addClass(offset), this.current_offset_class = offset
  5109.             },
  5110.             addToEmpty: function(e) {
  5111.                 e.preventDefault(), $(e.target).hasClass("vc_empty-container") && this.addElement(e)
  5112.             },
  5113.             setDropable: function() {
  5114.                 return this.$content.droppable({
  5115.                     greedy: !0,
  5116.                     accept: "vc_column_inner" === this.model.get("shortcode") ? ".dropable_el" : ".dropable_el,.dropable_row",
  5117.                     hoverClass: "wpb_ui-state-active",
  5118.                     drop: this.dropButton
  5119.                 }), this
  5120.             },
  5121.             dropButton: function(event, ui) {
  5122.                 ui.draggable.is("#wpb-add-new-element") ? vc.add_element_block_view({
  5123.                     model: {
  5124.                         position_to_add: "end"
  5125.                     }
  5126.                 }).show(this) : ui.draggable.is("#wpb-add-new-row") && this.createRow()
  5127.             },
  5128.             setEmpty: function() {
  5129.                 this.$el.addClass("vc_empty-column"), "edit" !== vc_user_access().getState("shortcodes") && this.$content.addClass("vc_empty-container")
  5130.             },
  5131.             unsetEmpty: function() {
  5132.                 this.$el.removeClass("vc_empty-column"), this.$content.removeClass("vc_empty-container")
  5133.             },
  5134.             checkIsEmpty: function() {
  5135.                 Shortcodes.where({
  5136.                     parent_id: this.model.id
  5137.                 }).length ? this.unsetEmpty() : this.setEmpty(), window.VcColumnView.__super__.checkIsEmpty.call(this)
  5138.             },
  5139.             createRow: function() {
  5140.                 var row_params, column_params, row;
  5141.                 return row_params = {}, column_params = {
  5142.                     width: "1/1"
  5143.                 }, row = Shortcodes.create({
  5144.                     shortcode: "vc_row_inner",
  5145.                     params: row_params,
  5146.                     parent_id: this.model.id
  5147.                 }), Shortcodes.create({
  5148.                     shortcode: "vc_column_inner",
  5149.                     params: column_params,
  5150.                     parent_id: row.id
  5151.                 }), row
  5152.             },
  5153.             convertSize: function(width) {
  5154.                 var numbers = width ? width.split("/") : [1, 1],
  5155.                     range = _.range(1, 13),
  5156.                     num = !_.isUndefined(numbers[0]) && 0 <= _.indexOf(range, parseInt(numbers[0], 10)) && parseInt(numbers[0], 10),
  5157.                     dev = !_.isUndefined(numbers[1]) && 0 <= _.indexOf(range, parseInt(numbers[1], 10)) && parseInt(numbers[1], 10);
  5158.                 return !1 !== num && !1 !== dev ? "vc_col-sm-" + 12 * num / dev : "vc_col-sm-12"
  5159.             },
  5160.             deleteShortcode: function(e) {
  5161.                 var parent, parent_id = this.model.get("parent_id");
  5162.                 if (_.isObject(e) && e.preventDefault(), !0 !== confirm(window.i18nLocale.press_ok_to_delete_section)) return !1;
  5163.                 this.model.destroy(), parent_id && !vc.shortcodes.where({
  5164.                     parent_id: parent_id
  5165.                 }).length ? (parent = vc.shortcodes.get(parent_id), _.contains(["vc_column", "vc_column_inner"], parent.get("shortcode")) || parent.destroy()) : parent_id && (parent = vc.shortcodes.get(parent_id)) && parent.view && parent.view.setActiveLayoutButton && parent.view.setActiveLayoutButton()
  5166.             },
  5167.             remove: function() {
  5168.                 this.$content && this.$content.data("uiSortable") && this.$content.sortable("destroy"), this.$content && this.$content.data("uiDroppable") && this.$content.droppable("destroy"), delete vc.app.views[this.model.id], window.VcColumnView.__super__.remove.call(this)
  5169.             }
  5170.         }), window.VcSectionView = VcColumnView.extend({
  5171.             designHelpersSelector: "> .vc_controls-row .vc_column-edit",
  5172.             setColumnClasses: function() {
  5173.                 var disable = this.model.getParam("disable_element"),
  5174.                     disableClass = "vc_hidden-xs vc_hidden-sm  vc_hidden-md vc_hidden-lg";
  5175.                 this.disable_element_class && this.$el.removeClass(this.disable_element_class), _.isEmpty(disable) || (this.$el.addClass(disableClass), this.disable_element_class = disableClass)
  5176.             },
  5177.             buildDesignHelpers: function() {
  5178.                 var css, $elementToPrepend, image, color, elId, matches;
  5179.                 css = this.model.getParam("css"), $elementToPrepend = this.$el.find(this.designHelpersSelector), this.$el.find("> .vc_controls-row .vc_row_color").remove(), this.$el.find("> .vc_controls-row .vc_row_image").remove(), matches = css.match(/background\-image:\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (image = matches[1]), matches = css.match(/background\-color:\s*([^\s\;]+)\b/), matches && !_.isUndefined(matches[1]) && (color = matches[1]), matches = css.match(/background:\s*([^\s]+)\b\s*url\(([^\)]+)\)/), matches && !_.isUndefined(matches[1]) && (color = matches[1], image = matches[2]), elId = this.model.getParam("el_id"), this.$el.find("> .vc_controls-row .vc_row-hash-id").remove(), _.isEmpty(elId) || $('<span class="vc_row-hash-id"></span>').text("#" + elId).insertAfter($elementToPrepend), image && $('<span class="vc_row_image" style="background-image: url(' + image + ');" title="' + window.i18nLocale.row_background_image + '"></span>').insertAfter($elementToPrepend), color && $('<span class="vc_row_color" style="background-color: ' + color + '" title="' + window.i18nLocale.row_background_color + '"></span>').insertAfter($elementToPrepend)
  5180.             },
  5181.             checkIsEmpty: function() {
  5182.                 window.VcSectionView.__super__.checkIsEmpty.call(this), this.setSorting()
  5183.             },
  5184.             setSorting: function() {
  5185.                 if (vc_user_access().partAccess("dragndrop")) {
  5186.                     var _this = this;
  5187.                     this.$content.sortable({
  5188.                         forcePlaceholderSize: !0,
  5189.                         placeholder: "widgets-placeholder",
  5190.                         connectWith: ".wpb_main_sortable,.wpb_vc_section .vc_section_container",
  5191.                         cursor: "move",
  5192.                         items: "> .wpb_vc_row",
  5193.                         handle: ".vc_column-move",
  5194.                         cancel: ".vc-non-draggable-row",
  5195.                         distance: .5,
  5196.                         scroll: !0,
  5197.                         scrollSensitivity: 70,
  5198.                         tolerance: "intersect",
  5199.                         update: function(event, ui) {
  5200.                             var $elements = $("> div.wpb_sortable,> div.vc-non-draggable", _this.$content);
  5201.                             $elements.each(function() {
  5202.                                 var model = $(this).data("model"),
  5203.                                     index = $(this).index();
  5204.                                 if (model.set("order", index), $elements.length - 1 > index && vc.storage.lock(), !_.isNull(ui.sender)) {
  5205.                                     var $current_container = ui.item.parent().closest("[data-model-id]"),
  5206.                                         parent = $current_container.data("model"),
  5207.                                         old_parent_id = model.get("parent_id");
  5208.                                     vc.storage.lock(), model.save({
  5209.                                         parent_id: parent.id
  5210.                                     }), old_parent_id && vc.app.views[old_parent_id].checkIsEmpty(), vc.app.views[parent.id].checkIsEmpty()
  5211.                                 }
  5212.                                 model.save()
  5213.                             })
  5214.                         },
  5215.                         stop: function(event, ui) {
  5216.                             $("#visual_composer_content").removeClass("vc_sorting-started"), $(".dragging_in").removeClass("dragging_in");
  5217.                             var tag = ui.item.data("element_type"),
  5218.                                 parent_tag = ui.item.parent().closest("[data-element_type]").data("element_type");
  5219.                             vc.check_relevance(parent_tag, tag) && parent_tag != tag || $(this).sortable("cancel"), $(".vc_sorting-empty-container").removeClass("vc_sorting-empty-container")
  5220.                         },
  5221.                         over: function(event, ui) {
  5222.                             var tag = ui.item.data("element_type"),
  5223.                                 parent_tag = ui.placeholder.closest("[data-element_type]").data("element_type") || "",
  5224.                                 allowed_container_element = !!_.isUndefined(vc.map[parent_tag].allowed_container_element) || vc.map[parent_tag].allowed_container_element;
  5225.                             return vc.check_relevance(parent_tag, tag) && parent_tag != tag ? _.isObject(vc.map[tag]) && (_.isBoolean(vc.map[tag].is_container) && !0 === vc.map[tag].is_container || !_.isEmpty(vc.map[tag].as_parent)) && !0 !== allowed_container_element && allowed_container_element !== ui.item.data("element_type").replace(/_inner$/, "") ? (ui.placeholder.addClass("vc_hidden-placeholder"), !1) : (_.isNull(ui.sender) || !ui.sender.length || ui.sender.find("> [data-element_type]:not(.ui-sortable-helper):visible").length || ui.sender.addClass("vc_sorting-empty-container"), void ui.placeholder.css({
  5226.                                 maxWidth: ui.placeholder.parent().width()
  5227.                             })) : (ui.placeholder.addClass("vc_hidden-placeholder"), !1)
  5228.                         },
  5229.                         out: function(event, ui) {
  5230.                             ui.placeholder.removeClass("vc_hidden-placeholder"), ui.placeholder.css({
  5231.                                 maxWidth: ui.placeholder.parent().width()
  5232.                             }), _.isNull(ui.sender) || !ui.sender.length || ui.sender.find("> [data-element_type]:not(.ui-sortable-helper):visible").length || ui.sender.addClass("vc_sorting-empty-container")
  5233.                         }
  5234.                     })
  5235.                 }
  5236.             }
  5237.         }), window.VcAccordionView = vc.shortcode_view.extend({
  5238.             adding_new_tab: !1,
  5239.             events: {
  5240.                 "click .add_tab": "addTab",
  5241.                 "click > .vc_controls .column_delete, > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5242.                 "click > .vc_controls .column_edit, > .vc_controls .vc_control-btn-edit": "editElement",
  5243.                 "click > .vc_controls .column_clone,> .vc_controls .vc_control-btn-clone": "clone"
  5244.             },
  5245.             render: function() {
  5246.                 return window.VcAccordionView.__super__.render.call(this), vc_user_access().shortcodeAll("vc_accordion_tab") ? (vc_user_access().partAccess("dragndrop") && this.$content.sortable({
  5247.                     axis: "y",
  5248.                     handle: "h3",
  5249.                     stop: function(event, ui) {
  5250.                         ui.item.prev().triggerHandler("focusout"), $(this).find("> .wpb_sortable").each(function() {
  5251.                             $(this).data("model").save({
  5252.                                 order: $(this).index()
  5253.                             })
  5254.                         })
  5255.                     }
  5256.                 }), this) : (this.$el.find(".tab_controls").hide(), this)
  5257.             },
  5258.             changeShortcodeParams: function(model) {
  5259.                 var params, collapsible;
  5260.                 window.VcAccordionView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), collapsible = !(!_.isString(params.collapsible) || "yes" !== params.collapsible), this.$content.hasClass("ui-accordion") && this.$content.accordion("option", "collapsible", collapsible)
  5261.             },
  5262.             changedContent: function(view) {
  5263.                 this.$content.hasClass("ui-accordion") && this.$content.accordion("destroy");
  5264.                 var collapsible = !(!_.isString(this.model.get("params").collapsible) || "yes" !== this.model.get("params").collapsible);
  5265.                 this.$content.accordion({
  5266.                     header: "h3",
  5267.                     navigation: !1,
  5268.                     autoHeight: !0,
  5269.                     heightStyle: "content",
  5270.                     collapsible: collapsible,
  5271.                     active: !1 === this.adding_new_tab && !0 !== view.model.get("cloned") ? 0 : view.$el.index()
  5272.                 }), this.adding_new_tab = !1
  5273.             },
  5274.             addTab: function(e) {
  5275.                 if (e.preventDefault(), !vc_user_access().shortcodeAll("vc_accordion_tab")) return !1;
  5276.                 this.adding_new_tab = !0, vc.shortcodes.create({
  5277.                     shortcode: "vc_accordion_tab",
  5278.                     params: {
  5279.                         title: window.i18nLocale.section
  5280.                     },
  5281.                     parent_id: this.model.id
  5282.                 })
  5283.             },
  5284.             _loadDefaults: function() {
  5285.                 window.VcAccordionView.__super__._loadDefaults.call(this)
  5286.             }
  5287.         }), window.VcAccordionTabView = window.VcColumnView.extend({
  5288.             events: {
  5289.                 "click > [data-element_type] > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5290.                 "click > [data-element_type] >  .vc_controls .vc_control-btn-prepend": "addElement",
  5291.                 "click > [data-element_type] >  .vc_controls .vc_control-btn-edit": "editElement",
  5292.                 "click > [data-element_type] > .vc_controls .vc_control-btn-clone": "clone",
  5293.                 "click > [data-element_type] > .wpb_element_wrapper > .vc_empty-container": "addToEmpty"
  5294.             },
  5295.             setContent: function() {
  5296.                 this.$content = this.$el.find("> [data-element_type] > .wpb_element_wrapper > .vc_container_for_children")
  5297.             },
  5298.             changeShortcodeParams: function(model) {
  5299.                 var params;
  5300.                 window.VcAccordionTabView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params) && _.isString(params.title) && this.$el.find("> h3 .tab-label").text(params.title)
  5301.             },
  5302.             setEmpty: function() {
  5303.                 $("> [data-element_type]", this.$el).addClass("vc_empty-column"), "edit" !== vc_user_access().getState("shortcodes") && this.$content.addClass("vc_empty-container")
  5304.             },
  5305.             unsetEmpty: function() {
  5306.                 $("> [data-element_type]", this.$el).removeClass("vc_empty-column"), this.$content.removeClass("vc_empty-container")
  5307.             }
  5308.         }), window.VcMessageView = vc.shortcode_view.extend({
  5309.             changeShortcodeParams: function(model) {
  5310.                 var params, $wrapper;
  5311.                 window.VcMessageView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), $wrapper = this.$el.find("> .wpb_element_wrapper").removeClass(_.values(this.params.color.value).join(" ")), _.isObject(params) && _.isString(params.color) && $wrapper.addClass(params.color)
  5312.             }
  5313.         }), window.VcMessageView_Backend = vc.shortcode_view.extend({
  5314.             changeShortcodeParams: function(model) {
  5315.                 var params, $wrapper, classes, iconClass, color;
  5316.                 switch (window.VcMessageView_Backend.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), $wrapper = this.$el.find("> .wpb_element_wrapper"), classes = ["vc_message_box"], _.isUndefined(params.message_box_style) && (params.message_box_style = "classic"), _.isUndefined(params.message_box_color) && (params.message_box_color = "alert-info"), params.style ? "3d" === params.style ? (params.message_box_style = "3d", params.style = "rounded") : "outlined" === params.style ? (params.message_box_style = "outline", params.style = "rounded") : "square_outlined" === params.style && (params.message_box_style = "outline", params.style = "square") : params.style = "rounded", classes.push("vc_message_box-" + params.style), params.message_box_style && classes.push("vc_message_box-" + params.message_box_style), $wrapper.attr("class", "wpb_element_wrapper"), $wrapper.find(".vc_message_box-icon").remove(), iconClass = _.isUndefined(params["icon_" + params.icon_type]) ? "fa fa-info-circle" : params["icon_" + params.icon_type], color = params.color, params.color) {
  5317.                     case "info":
  5318.                         iconClass = "fa fa-info-circle";
  5319.                         break;
  5320.                     case "alert-info":
  5321.                         iconClass = "vc_pixel_icon vc_pixel_icon-info";
  5322.                         break;
  5323.                     case "success":
  5324.                         iconClass = "fa fa-check";
  5325.                         break;
  5326.                     case "alert-success":
  5327.                         iconClass = "vc_pixel_icon vc_pixel_icon-tick";
  5328.                         break;
  5329.                     case "warning":
  5330.                         iconClass = "fa fa-exclamation-triangle";
  5331.                         break;
  5332.                     case "alert-warning":
  5333.                         iconClass = "vc_pixel_icon vc_pixel_icon-alert";
  5334.                         break;
  5335.                     case "danger":
  5336.                         iconClass = "fa fa-times";
  5337.                         break;
  5338.                     case "alert-danger":
  5339.                         iconClass = "vc_pixel_icon vc_pixel_icon-explanation";
  5340.                         break;
  5341.                     case "alert-custom":
  5342.                     default:
  5343.                         color = params.message_box_color
  5344.                 }
  5345.                 classes.push("vc_color-" + color), $wrapper.addClass(classes.join(" ")), $wrapper.prepend($('<div class="vc_message_box-icon"><i class="' + iconClass + '"></i></div>'))
  5346.             }
  5347.         }), window.VcTextSeparatorView = vc.shortcode_view.extend({
  5348.             changeShortcodeParams: function(model) {
  5349.                 var params, icon;
  5350.                 window.VcTextSeparatorView.__super__.changeShortcodeParams.call(this, model), params = model.get("params");
  5351.                 var $find = this.$el.find("> .wpb_element_wrapper");
  5352.                 _.isObject(params) && _.isString(params.title_align) && $find.removeClass(_.values(this.params.title_align.value).join(" ")).addClass(params.title_align), _.isObject(params) && _.isString(params.add_icon) && "true" === params.add_icon && (icon = $('<i class="' + params["i_icon_" + params.i_type] + '" ></i>'), icon.prependTo($find.find("[name=title]")), icon.after(" "))
  5353.             }
  5354.         }), window.VcCallToActionView = vc.shortcode_view.extend({
  5355.             changeShortcodeParams: function(model) {
  5356.                 var params;
  5357.                 window.VcCallToActionView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params) && _.isString(params.position) && this.$el.find("> .wpb_element_wrapper").removeClass(_.values(this.params.position.value).join(" ")).addClass(params.position)
  5358.             }
  5359.         }), window.VcCallToActionView3 = vc.shortcode_view.extend({
  5360.             changeShortcodeParams: function(model) {
  5361.                 var params, value, $adminLabel;
  5362.                 window.VcCallToActionView3.__super__.changeShortcodeParams.call(this, model), params = _.extend({
  5363.                     add_icon: "",
  5364.                     i_type: ""
  5365.                 }, model.get("params")), $adminLabel = this.$el.find(".vc_admin_label.admin_label_i_type"), _.isEmpty(params.add_icon) ? $adminLabel.addClass("hidden-label").hide() : _.isEmpty(params.i_type) || _.isEmpty(params["i_icon_" + params.i_type]) || (value = vc_toTitleCase(params.i_type) + ' - <i class="' + params["i_icon_" + params.i_type] + '"></i>', $adminLabel.html("<label>" + $adminLabel.find("label").text() + "</label>: " + value), $adminLabel.show().removeClass("hidden-label"))
  5366.             }
  5367.         }), window.VcToggleView = vc.shortcode_view.extend({
  5368.             events: function() {
  5369.                 return _.extend({
  5370.                     "click .vc_toggle_title": "toggle",
  5371.                     "click .toggle_title": "toggle"
  5372.                 }, window.VcToggleView.__super__.events)
  5373.             },
  5374.             toggle: function(e) {
  5375.                 e && e.preventDefault(), $(e.currentTarget).toggleClass("vc_toggle_title_active"), $(".vc_toggle_content", this.$el).slideToggle(500)
  5376.             },
  5377.             changeShortcodeParams: function(model) {
  5378.                 var params;
  5379.                 window.VcToggleView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params) && _.isString(params.open) && "true" === params.open && $(".vc_toggle_title", this.$el).addClass("vc_toggle_title_active").next().show()
  5380.             }
  5381.         }), window.VcButtonView = vc.shortcode_view.extend({
  5382.             events: function() {
  5383.                 return _.extend({
  5384.                     "click button": "buttonClick"
  5385.                 }, window.VcToggleView.__super__.events)
  5386.             },
  5387.             buttonClick: function(e) {
  5388.                 e.preventDefault()
  5389.             },
  5390.             changeShortcodeParams: function(model) {
  5391.                 var params;
  5392.                 if (window.VcButtonView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params)) {
  5393.                     var el_class;
  5394.                     el_class = params.color + " " + params.size + " " + params.icon, this.$el.find(".wpb_element_wrapper").removeClass(el_class), this.$el.find("button.title").attr({
  5395.                         class: "title textfield wpb_button " + el_class
  5396.                     }), "none" !== params.icon && 0 === this.$el.find("button i.icon").length ? this.$el.find("button.title").append('<i class="icon"></i>') : this.$el.find("button.title i.icon").remove()
  5397.                 }
  5398.             }
  5399.         }), window.VcButton2View = vc.shortcode_view.extend({
  5400.             events: function() {
  5401.                 return _.extend({
  5402.                     "click button": "buttonClick"
  5403.                 }, window.VcToggleView.__super__.events)
  5404.             },
  5405.             buttonClick: function(e) {
  5406.                 e.preventDefault()
  5407.             },
  5408.             changeShortcodeParams: function(model) {
  5409.                 var params;
  5410.                 if (window.VcButton2View.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params)) {
  5411.                     var el_class;
  5412.                     el_class = (params.color ? "vc_btn_" + params.color : "") + " " + (params.color ? "vc_btn-" + params.color : "") + " " + (params.size ? "vc_btn-" + params.size : "") + " " + (params.size ? "vc_btn_" + params.size : "") + " " + (params.style ? "vc_btn_" + params.style : ""), this.$el.find(".wpb_element_wrapper").removeClass(el_class), this.$el.find("button.title").attr({
  5413.                         class: "title textfield vc_btn  " + el_class
  5414.                     })
  5415.                 }
  5416.             }
  5417.         }), window.VcButton3View = vc.shortcode_view.extend({
  5418.             buttonTemplate: !1,
  5419.             buttonTemplateCompiled: !1,
  5420.             $wrapper: !1,
  5421.             events: function() {
  5422.                 return _.extend({
  5423.                     "click .vc_btn3": "buttonClick"
  5424.                 }, window.VcToggleView.__super__.events)
  5425.             },
  5426.             buttonClick: function(e) {
  5427.                 e.preventDefault()
  5428.             },
  5429.             changeShortcodeParams: function(model) {
  5430.                 var params;
  5431.                 if (window.VcButton3View.__super__.changeShortcodeParams.call(this, model), params = _.extend({}, model.get("params")), this.buttonTemplate || (this.buttonTemplate = this.$el.find(".vc_btn3-container").html(), this.buttonTemplateCompiled = vc.template(this.buttonTemplate, vc.templateOptions.custom)), this.$wrapper || (this.$wrapper = this.$el.find(".wpb_element_wrapper")), _.isObject(params)) {
  5432.                     params.title && _.isEmpty(params.title.trim()) && (params.title = '<span class="vc_btn3-placeholder">&nbsp;</span>'), "custom" === params.style ? (params.color = void 0, _.isEmpty(params.custom_background) && _.isEmpty(params.custom_text) && (params.color = "grey")) : "outline-custom" === params.style && (params.color = void 0, _.isEmpty(params.outline_custom_color) && _.isEmpty(params.outline_custom_hover_background) && _.isEmpty(params.outline_custom_hover_text) && (params.style = "outline", params.color = "grey"));
  5433.                     var $element = $(this.buttonTemplateCompiled({
  5434.                         params: params
  5435.                     }));
  5436.                     "custom" === params.style ? ("undefined" !== params.custom_background && $element.css("background-color", params.custom_background), "undefined" !== params.custom_text && $element.css("color", params.custom_text)) : "outline-custom" === params.style && $element.css({
  5437.                         "background-color": "transparent",
  5438.                         "border-color": params.outline_custom_color,
  5439.                         color: params.outline_custom_color
  5440.                     }).hover(function() {
  5441.                         $(this).css({
  5442.                             "background-color": params.outline_custom_hover_background,
  5443.                             "border-color": params.outline_custom_hover_background,
  5444.                             color: params.outline_custom_hover_text
  5445.                         })
  5446.                     }, function() {
  5447.                         $(this).css({
  5448.                             "background-color": "transparent",
  5449.                             "border-color": params.outline_custom_color,
  5450.                             color: params.outline_custom_color
  5451.                         })
  5452.                     }), this.$wrapper.find(".vc_btn3-container").html($element)
  5453.                 }
  5454.             }
  5455.         }), window.VcTabsView = vc.shortcode_view.extend({
  5456.             new_tab_adding: !1,
  5457.             events: {
  5458.                 "click .add_tab": "addTab",
  5459.                 "click > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5460.                 "click > .vc_controls .vc_control-btn-edit": "editElement",
  5461.                 "click > .vc_controls .vc_control-btn-clone": "clone"
  5462.             },
  5463.             initialize: function(params) {
  5464.                 window.VcTabsView.__super__.initialize.call(this, params), _.bindAll(this, "stopSorting")
  5465.             },
  5466.             render: function() {
  5467.                 return window.VcTabsView.__super__.render.call(this), this.$tabs = this.$el.find(".wpb_tabs_holder"), this.createAddTabButton(), this
  5468.             },
  5469.             ready: function(e) {
  5470.                 window.VcTabsView.__super__.ready.call(this, e)
  5471.             },
  5472.             createAddTabButton: function() {
  5473.                 var new_tab_button_id = Date.now() + "-" + Math.floor(11 * Math.random());
  5474.                 this.$tabs.append('<div id="new-tab-' + new_tab_button_id + '" class="new_element_button"></div>'), this.$add_button = $('<li class="add_tab_block"><a href="#new-tab-' + new_tab_button_id + '" class="add_tab" title="' + window.i18nLocale.add_tab + '"></a></li>').appendTo(this.$tabs.find(".tabs_controls")), vc_user_access().shortcodeAll("vc_tab") || this.$add_button.hide()
  5475.             },
  5476.             addTab: function(e) {
  5477.                 if (e.preventDefault(), !vc_user_access().shortcodeAll("vc_tab")) return !1;
  5478.                 this.new_tab_adding = !0;
  5479.                 var tab_title = window.i18nLocale.tab,
  5480.                     tabs_count = this.$tabs.find("[data-element_type=vc_tab]").length,
  5481.                     tab_id = Date.now() + "-" + tabs_count + "-" + Math.floor(11 * Math.random());
  5482.                 return vc.shortcodes.create({
  5483.                     shortcode: "vc_tab",
  5484.                     params: {
  5485.                         title: tab_title,
  5486.                         tab_id: tab_id
  5487.                     },
  5488.                     parent_id: this.model.id
  5489.                 }), !1
  5490.             },
  5491.             stopSorting: function(event, ui) {
  5492.                 var shortcode;
  5493.                 this.$tabs.find("ul.tabs_controls li:not(.add_tab_block)").each(function(index) {
  5494.                     $(this).find("a").attr("href").replace("#", "");
  5495.                     shortcode = vc.shortcodes.get($("[id=" + $(this).attr("aria-controls") + "]").data("model-id")), vc.storage.lock(), shortcode.save({
  5496.                         order: $(this).index()
  5497.                     })
  5498.                 }), shortcode && shortcode.save()
  5499.             },
  5500.             changedContent: function(view) {
  5501.                 var params = view.model.get("params");
  5502.                 if (this.$tabs.hasClass("ui-tabs") || (this.$tabs.tabs({
  5503.                         select: function(event, ui) {
  5504.                             return !$(ui.tab).hasClass("add_tab")
  5505.                         }
  5506.                     }), this.$tabs.find(".ui-tabs-nav").prependTo(this.$tabs), vc_user_access().shortcodeAll("vc_tab") && this.$tabs.find(".ui-tabs-nav").sortable({
  5507.                         axis: "vc_tour" === this.$tabs.closest("[data-element_type]").data("element_type") ? "y" : "x",
  5508.                         update: this.stopSorting,
  5509.                         items: "> li:not(.add_tab_block)"
  5510.                     })), !0 === view.model.get("cloned")) {
  5511.                     var $tab_controls = (view.model.get("cloned_from"), $(".tabs_controls > .add_tab_block", this.$content)),
  5512.                         $new_tab = $("<li><a href='#tab-" + params.tab_id + "'>" + params.title + "</a></li>").insertBefore($tab_controls);
  5513.                     this.$tabs.tabs("refresh"), this.$tabs.tabs("option", "active", $new_tab.index())
  5514.                 } else $("<li><a href='#tab-" + params.tab_id + "'>" + params.title + "</a></li>").insertBefore(this.$add_button), this.$tabs.tabs("refresh"), this.$tabs.tabs("option", "active", this.new_tab_adding ? $(".ui-tabs-nav li", this.$content).length - 2 : 0);
  5515.                 this.new_tab_adding = !1
  5516.             },
  5517.             cloneModel: function(model, parent_id, save_order) {
  5518.                 var new_order, model_clone, params, tag;
  5519.                 return new_order = _.isBoolean(save_order) && !0 === save_order ? model.get("order") : parseFloat(model.get("order")) + vc.clone_index, params = _.extend({}, model.get("params")), tag = model.get("shortcode"), "vc_tab" === tag && _.extend(params, {
  5520.                     tab_id: Date.now() + "-" + this.$tabs.find("[data-element-type=vc_tab]").length + "-" + Math.floor(11 * Math.random())
  5521.                 }), model_clone = Shortcodes.create({
  5522.                     shortcode: tag,
  5523.                     id: vc_guid(),
  5524.                     parent_id: parent_id,
  5525.                     order: new_order,
  5526.                     cloned: "vc_tab" !== tag,
  5527.                     cloned_from: model.toJSON(),
  5528.                     params: params
  5529.                 }), _.each(Shortcodes.where({
  5530.                     parent_id: model.id
  5531.                 }), function(shortcode) {
  5532.                     this.cloneModel(shortcode, model_clone.get("id"), !0)
  5533.                 }, this), model_clone
  5534.             }
  5535.         }), window.VcTabView = window.VcColumnView.extend({
  5536.             events: {
  5537.                 "click > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5538.                 "click > .vc_controls .vc_control-btn-prepend": "addElement",
  5539.                 "click > .vc_controls .vc_control-btn-edit": "editElement",
  5540.                 "click > .vc_controls .vc_control-btn-clone": "clone",
  5541.                 "click > .wpb_element_wrapper > .vc_empty-container": "addToEmpty"
  5542.             },
  5543.             render: function() {
  5544.                 var params = this.model.get("params");
  5545.                 return window.VcTabView.__super__.render.call(this), params.tab_id || (params.tab_id = Date.now() + "-" + Math.floor(11 * Math.random()), this.model.save("params", params)), this.id = "tab-" + params.tab_id, this.$el.attr("id", this.id), this
  5546.             },
  5547.             ready: function(e) {
  5548.                 window.VcTabView.__super__.ready.call(this, e), this.$tabs = this.$el.closest(".wpb_tabs_holder");
  5549.                 this.model.get("params");
  5550.                 return this
  5551.             },
  5552.             changeShortcodeParams: function(model) {
  5553.                 var params;
  5554.                 window.VcTabView.__super__.changeShortcodeParams.call(this, model), params = model.get("params"), _.isObject(params) && _.isString(params.title) && _.isString(params.tab_id) && $('.ui-tabs-nav [href="#tab-' + params.tab_id + '"]').text(params.title)
  5555.             },
  5556.             deleteShortcode: function(e) {
  5557.                 _.isObject(e) && e.preventDefault();
  5558.                 var answer = confirm(window.i18nLocale.press_ok_to_delete_section),
  5559.                     parent_id = this.model.get("parent_id");
  5560.                 if (!0 !== answer) return !1;
  5561.                 if (this.model.destroy(), !vc.shortcodes.where({
  5562.                         parent_id: parent_id
  5563.                     }).length) {
  5564.                     return vc.shortcodes.get(parent_id).destroy(), !1
  5565.                 }
  5566.                 var params = this.model.get("params"),
  5567.                     current_tab_index = $('[href="#tab-' + params.tab_id + '"]', this.$tabs).parent().index();
  5568.                 $('[href="#tab-' + params.tab_id + '"]').parent().remove();
  5569.                 var tab_length = this.$tabs.find(".ui-tabs-nav li:not(.add_tab_block)").length;
  5570.                 0 < tab_length && this.$tabs.tabs("refresh"), current_tab_index < tab_length ? this.$tabs.tabs("option", "active", current_tab_index) : 0 < tab_length && this.$tabs.tabs("option", "active", tab_length - 1)
  5571.             },
  5572.             cloneModel: function(model, parent_id, save_order) {
  5573.                 var new_order, model_clone, params, tag;
  5574.                 return new_order = _.isBoolean(save_order) && !0 === save_order ? model.get("order") : parseFloat(model.get("order")) + vc.clone_index, params = _.extend({}, model.get("params")), tag = model.get("shortcode"), "vc_tab" === tag && _.extend(params, {
  5575.                     tab_id: Date.now() + "-" + this.$tabs.find("[data-element_type=vc_tab]").length + "-" + Math.floor(11 * Math.random())
  5576.                 }), model_clone = Shortcodes.create({
  5577.                     shortcode: tag,
  5578.                     parent_id: parent_id,
  5579.                     order: new_order,
  5580.                     cloned: !0,
  5581.                     cloned_from: model.toJSON(),
  5582.                     params: params
  5583.                 }), _.each(Shortcodes.where({
  5584.                     parent_id: model.id
  5585.                 }), function(shortcode) {
  5586.                     this.cloneModel(shortcode, model_clone.get("id"), !0)
  5587.                 }, this), model_clone
  5588.             }
  5589.         }), window.VcIconElementView_Backend = vc.shortcode_view.extend({
  5590.             changeShortcodeParams: function(model) {
  5591.                 var tag, params, settings, view;
  5592.                 tag = model.get("shortcode"), params = model.get("params"), settings = vc.map[tag], _.isArray(settings.params) && _.each(settings.params, function(param_settings) {
  5593.                     if (!_.isUndefined(param_settings.admin_label) && param_settings.admin_label) {
  5594.                         var name, value, $wrapper, $admin_label;
  5595.                         name = param_settings.param_name, value = params[name], $wrapper = this.$el.find("> .wpb_element_wrapper"), $admin_label = $wrapper.children(".admin_label_" + name), $admin_label.length && ("" === value || _.isUndefined(value) ? $admin_label.hide().addClass("hidden-label") : ("type" === name && (_.isUndefined(params["icon_" + value]) || (value = vc_toTitleCase(value) + " - <i class='" + params["icon_" + value] + "'></i>")), $admin_label.html("<label>" + $admin_label.find("label").text() + "</label>: " + value), $admin_label.show().removeClass("hidden-label")))
  5596.                     }
  5597.                 }, this), view = vc.app.views[this.model.get("parent_id")], !1 !== model.get("parent_id") && _.isObject(view) && view.checkIsEmpty()
  5598.             }
  5599.         }), window.VcBackendTtaViewInterface = vc.shortcode_view.extend({
  5600.             sortableSelector: !1,
  5601.             $sortable: !1,
  5602.             $navigation: !1,
  5603.             defaultSectionTitle: window.i18nLocale.tab,
  5604.             sortableUpdateModelIdSelector: "data-vc-target-model-id",
  5605.             activeClass: "vc_active",
  5606.             sortingPlaceholder: "vc_placeholder",
  5607.             events: {
  5608.                 "click > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5609.                 "click > .vc_controls .vc_control-btn-edit": "editElement",
  5610.                 "click > .vc_controls .vc_control-btn-clone": "clone",
  5611.                 "click > .vc_controls .vc_control-btn-prepend": "clickPrependSection",
  5612.                 "click .vc_tta-section-append": "clickAppendSection"
  5613.             },
  5614.             initialize: function(params) {
  5615.                 window.VcBackendTtaViewInterface.__super__.initialize.call(this, params), _.bindAll(this, "updateSorting")
  5616.             },
  5617.             render: function() {
  5618.                 return window.VcBackendTtaViewInterface.__super__.render.call(this), this.$el.addClass("vc_tta-container vc_tta-o-non-responsive"), this
  5619.             },
  5620.             setContent: function() {
  5621.                 this.$content = this.$el.find("> .wpb_element_wrapper .vc_tta-panels")
  5622.             },
  5623.             clickAppendSection: function(e) {
  5624.                 e.preventDefault(), this.addSection()
  5625.             },
  5626.             clickPrependSection: function(e) {
  5627.                 e.preventDefault(), this.addSection(!0)
  5628.             },
  5629.             addSection: function(prepend) {
  5630.                 var newTabTitle, params;
  5631.                 return newTabTitle = this.defaultSectionTitle, params = {
  5632.                     shortcode: "vc_tta_section",
  5633.                     params: {
  5634.                         title: newTabTitle
  5635.                     },
  5636.                     parent_id: this.model.get("id"),
  5637.                     order: _.isBoolean(prepend) && prepend ? vc.add_element_block_view.getFirstPositionIndex() : vc.shortcodes.getNextOrder(),
  5638.                     prepend: prepend
  5639.                 }, vc.shortcodes.create(params)
  5640.             },
  5641.             findSection: function(modelId) {
  5642.                 return this.$content.children('[data-model-id="' + modelId + '"]')
  5643.             },
  5644.             getIndex: function($element) {
  5645.                 return $element.index()
  5646.             },
  5647.             buildSortable: function($element) {
  5648.                 return !("edit" === vc_user_access().getState("shortcodes") || !vc_user_access().shortcodeAll("vc_tta_section")) && $element.sortable({
  5649.                     forcePlaceholderSize: !0,
  5650.                     placeholder: this.sortingPlaceholder,
  5651.                     helper: this.renderSortingPlaceholder,
  5652.                     scroll: !0,
  5653.                     cursor: "move",
  5654.                     cursorAt: {
  5655.                         top: 20,
  5656.                         left: 16
  5657.                     },
  5658.                     start: function(event, ui) {},
  5659.                     over: function(event, ui) {},
  5660.                     stop: function(event, ui) {
  5661.                         ui.item.attr("style", "")
  5662.                     },
  5663.                     update: this.updateSorting,
  5664.                     items: this.sortableSelector
  5665.                 })
  5666.             },
  5667.             updateSorting: function(event, ui) {
  5668.                 var self;
  5669.                 if (!vc_user_access().shortcodeAll("vc_tta_section")) return !1;
  5670.                 self = this, this.$sortable.find(this.sortableSelector).each(function() {
  5671.                     var shortcode, modelId, $this;
  5672.                     $this = $(this), modelId = $this.attr(self.sortableUpdateModelIdSelector), shortcode = vc.shortcodes.get(modelId), vc.storage.lock(), shortcode.save({
  5673.                         order: self.getIndex($this)
  5674.                     })
  5675.                 }), vc.storage.unlock(), vc.storage.save()
  5676.             },
  5677.             makeFirstSectionActive: function() {
  5678.                 this.$content.children(":first-child").addClass(this.activeClass)
  5679.             },
  5680.             checkForActiveSection: function() {
  5681.                 var $currentActive;
  5682.                 $currentActive = this.$content.children("." + this.activeClass), $currentActive.length || this.makeFirstSectionActive()
  5683.             },
  5684.             changeActiveSection: function(modelId) {
  5685.                 this.$content.children(".vc_tta-panel." + this.activeClass).removeClass(this.activeClass), this.findSection(modelId).addClass(this.activeClass)
  5686.             },
  5687.             changedContent: function(view) {
  5688.                 var changedContent;
  5689.                 return changedContent = window.VcBackendTtaViewInterface.__super__.changedContent.call(this, view), this.checkForActiveSection(), this.buildSortable(this.$sortable), changedContent
  5690.             },
  5691.             notifySectionChanged: function(model) {
  5692.                 var view, title;
  5693.                 view = model.get("view"), _.isObject(view) && (title = model.getParam("title"), _.isString(title) && title.length || (title = this.defaultSectionTitle), view.$el.find(".vc_tta-panel-title a .vc_tta-title-text").text(title))
  5694.             },
  5695.             notifySectionRendered: function(model) {},
  5696.             getNextTab: function($viewTab) {
  5697.                 var lastIndex, viewTabIndex, $navigationSections;
  5698.                 return $navigationSections = this.$navigation.children(), lastIndex = $navigationSections.length - 2, viewTabIndex = $viewTab.index(), viewTabIndex !== lastIndex ? $navigationSections.eq(viewTabIndex + 1) : $navigationSections.eq(viewTabIndex - 1)
  5699.             },
  5700.             renderSortingPlaceholder: function(event, element) {
  5701.                 return vc.app.renderPlaceholder(event, element)
  5702.             }
  5703.         }), window.VcBackendTtaTabsView = window.VcBackendTtaViewInterface.extend({
  5704.             sortableSelector: "> [data-vc-tab]",
  5705.             sortableSelectorCancel: ".vc-non-draggable-container",
  5706.             sortablePlaceholderClass: "vc_placeholder-tta-tab",
  5707.             navigationSectionTemplate: null,
  5708.             navigationSectionTemplateParsed: null,
  5709.             $navigationSectionAdd: null,
  5710.             sortingPlaceholder: "vc_placeholder-tab vc_tta-tab",
  5711.             render: function() {
  5712.                 return window.VcBackendTtaTabsView.__super__.render.call(this), this.$navigation = this.$el.find("> .wpb_element_wrapper .vc_tta-tabs-list"), this.$sortable = this.$navigation, this.$navigationSectionAdd = this.$navigation.children(".vc_tta-tab:first-child"), this.setNavigationSectionTemplate(this.$navigationSectionAdd.prop("outerHTML")), vc_user_access().shortcodeAll("vc_tta_section") ? this.$navigationSectionAdd.addClass("vc_tta-section-append").removeAttr("data-vc-target-model-id").removeAttr("data-vc-tab").find("[data-vc-target]").html('<i class="vc_tta-controls-icon vc_tta-controls-icon-plus"></i>').removeAttr("data-vc-tabs").removeAttr("data-vc-target").removeAttr("data-vc-target-model-id").removeAttr("data-vc-toggle") : this.$navigationSectionAdd.hide(), this
  5713.             },
  5714.             setNavigationSectionTemplate: function(html) {
  5715.                 this.navigationSectionTemplate = html, this.navigationSectionTemplateParsed = vc.template(this.navigationSectionTemplate, vc.templateOptions.custom)
  5716.             },
  5717.             getNavigationSectionTemplate: function() {
  5718.                 return this.navigationSectionTemplate
  5719.             },
  5720.             getParsedNavigationSectionTemplate: function(data) {
  5721.                 return this.navigationSectionTemplateParsed(data)
  5722.             },
  5723.             changeNavigationSectionTitle: function(modelId, title) {
  5724.                 this.findNavigationTab(modelId).find("[data-vc-target]").text(title)
  5725.             },
  5726.             changeActiveSection: function(modelId) {
  5727.                 window.VcBackendTtaTabsView.__super__.changeActiveSection.call(this, modelId), this.$navigation.children("." + this.activeClass).removeClass(this.activeClass), this.findNavigationTab(modelId).addClass(this.activeClass)
  5728.             },
  5729.             notifySectionRendered: function(model) {
  5730.                 var $element, title, $insertAfter, clonedFrom;
  5731.                 window.VcBackendTtaTabsView.__super__.notifySectionRendered.call(this, model), title = model.getParam("title"), $element = $(this.getParsedNavigationSectionTemplate({
  5732.                     model_id: model.get("id"),
  5733.                     section_title: _.isString(title) && 0 < title.length ? title : this.defaultSectionTitle
  5734.                 })), model.get("cloned") ? (clonedFrom = model.get("cloned_from"), _.isObject(clonedFrom) && ($insertAfter = this.$navigation.children('[data-vc-target-model-id="' + clonedFrom.id + '"]'), $insertAfter.length ? $element.insertAfter($insertAfter) : $element.insertBefore(this.$navigation.children(".vc_tta-section-append")))) : model.get("prepend") ? $element.insertBefore(this.$navigation.children(":first-child")) : $element.insertBefore(this.$navigation.children(":last-child"))
  5735.             },
  5736.             notifySectionChanged: function(model) {
  5737.                 var title;
  5738.                 window.VcBackendTtaTabsView.__super__.notifySectionChanged.call(this, model), title = model.getParam("title"), _.isString(title) && title.length || (title = this.defaultSectionTitle), this.changeNavigationSectionTitle(model.get("id"), title), model.view.$el.find("> .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_element-name").removeClass("vc_element-move"), model.view.$el.find("> .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_element-name .vc-c-icon-dragndrop").hide()
  5739.             },
  5740.             makeFirstSectionActive: function() {
  5741.                 var $tab;
  5742.                 $tab = this.$navigation.children(":first-child:not(.vc_tta-section-append)").addClass(this.activeClass), $tab.length && this.findSection($tab.data("vc-target-model-id")).addClass(this.activeClass)
  5743.             },
  5744.             findNavigationTab: function(modelId) {
  5745.                 return this.$navigation.children('[data-vc-target-model-id="' + modelId + '"]')
  5746.             },
  5747.             removeSection: function(model) {
  5748.                 var $viewTab, $nextTab, tabIsActive;
  5749.                 $viewTab = this.findNavigationTab(model.get("id")), tabIsActive = $viewTab.hasClass(this.activeClass), tabIsActive && ($nextTab = this.getNextTab($viewTab), $nextTab.addClass(this.activeClass), this.changeActiveSection($nextTab.data("vc-target-model-id"))), $viewTab.remove()
  5750.             },
  5751.             renderSortingPlaceholder: function(event, currentItem) {
  5752.                 var helper, currentItemWidth, currentItemHeight;
  5753.                 return helper = currentItem, currentItemWidth = currentItem.width() + 1, currentItemHeight = currentItem.height(), helper.width(currentItemWidth), helper.height(currentItemHeight), helper
  5754.             }
  5755.         }), window.VcBackendTtaAccordionView = VcBackendTtaViewInterface.extend({
  5756.             sortableSelector: "> .vc_tta-panel:not(.vc_tta-section-append)",
  5757.             sortableSelectorCancel: ".vc-non-draggable",
  5758.             sortableUpdateModelIdSelector: "data-model-id",
  5759.             defaultSectionTitle: window.i18nLocale.section,
  5760.             render: function() {
  5761.                 return window.VcBackendTtaTabsView.__super__.render.call(this), this.$navigation = this.$content, this.$sortable = this.$content, vc_user_access().shortcodeAll("vc_tta_section") || this.$content.find(".vc_tta-section-append").hide(), this
  5762.             },
  5763.             removeSection: function(model) {
  5764.                 var $viewTab, $nextTab, tabIsActive;
  5765.                 $viewTab = this.findSection(model.get("id")), (tabIsActive = $viewTab.hasClass(this.activeClass)) && ($nextTab = this.getNextTab($viewTab), $nextTab.addClass(this.activeClass))
  5766.             },
  5767.             addShortcode: function(view) {
  5768.                 var beforeShortcode;
  5769.                 beforeShortcode = _.last(vc.shortcodes.filter(function(shortcode) {
  5770.                     return shortcode.get("parent_id") === this.get("parent_id") && parseFloat(shortcode.get("order")) < parseFloat(this.get("order"))
  5771.                 }, view.model)), beforeShortcode ? view.render().$el.insertAfter("[data-model-id=" + beforeShortcode.id + "]") : this.$content.prepend(view.render().el)
  5772.             }
  5773.         }), window.VcBackendTtaTourView = window.VcBackendTtaTabsView.extend({
  5774.             defaultSectionTitle: window.i18nLocale.section
  5775.         }), window.VcBackendTtaPageableView = window.VcBackendTtaTabsView.extend({
  5776.             defaultSectionTitle: window.i18nLocale.section
  5777.         }), window.VcBackendTtaSectionView = window.VcColumnView.extend({
  5778.             parentObj: null,
  5779.             events: {
  5780.                 "click > .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_control-btn-delete": "deleteShortcode",
  5781.                 "click > .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_control-btn-prepend": "addElement",
  5782.                 "click > .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_control-btn-edit": "editElement",
  5783.                 "click > .wpb_element_wrapper > .vc_tta-panel-body > .vc_controls .vc_control-btn-clone": "clone",
  5784.                 "click > .wpb_element_wrapper > .vc_tta-panel-body > .vc_empty-container": "addToEmpty"
  5785.             },
  5786.             setContent: function() {
  5787.                 this.$content = this.$el.find("> .wpb_element_wrapper > .vc_tta-panel-body > .vc_container_for_children")
  5788.             },
  5789.             render: function() {
  5790.                 var parentObj;
  5791.                 return window.VcBackendTtaSectionView.__super__.render.call(this), parentObj = vc.shortcodes.get(this.model.get("parent_id")), _.isObject(parentObj) && !_.isUndefined(parentObj.view) && (this.parentObj = parentObj), this.$el.addClass("vc_tta-panel"), this.$el.attr("style", ""), this.$el.attr("data-vc-toggle", "tab"), this.replaceTemplateVars(), this
  5792.             },
  5793.             replaceTemplateVars: function() {
  5794.                 var title, $panelHeading;
  5795.                 title = this.model.getParam("title"), _.isEmpty(title) && (title = this.parentObj && this.parentObj.defaultSectionTitle && this.parentObj.defaultSectionTitle.length ? this.parentObj.defaultSectionTitle : window.i18nLocale.section), $panelHeading = this.$el.find(".vc_tta-panel-heading");
  5796.                 var template = vc.template($panelHeading.html(), vc.templateOptions.custom);
  5797.                 $panelHeading.html(template({
  5798.                     model_id: this.model.get("id"),
  5799.                     section_title: title
  5800.                 }))
  5801.             },
  5802.             getIndex: function() {
  5803.                 return this.$el.index()
  5804.             },
  5805.             ready: function() {
  5806.                 this.updateParentNavigation(), window.VcBackendTtaSectionView.__super__.ready.call(this)
  5807.             },
  5808.             updateParentNavigation: function() {
  5809.                 _.isObject(this.parentObj) && this.parentObj.view && this.parentObj.view.notifySectionRendered && this.parentObj.view.notifySectionRendered(this.model)
  5810.             },
  5811.             deleteShortcode: function(e) {
  5812.                 return _.isObject(e) && e.preventDefault(), !0 === confirm(window.i18nLocale.press_ok_to_delete_section) && (1 === vc.shortcodes.where({
  5813.                     parent_id: this.model.get("parent_id")
  5814.                 }).length ? (this.model.destroy(), this.parentObj && this.parentObj.destroy()) : (this.parentObj && this.parentObj.view && this.parentObj.view.removeSection && this.parentObj.view.removeSection(this.model), this.model.destroy()), !0)
  5815.             },
  5816.             changeShortcodeParams: function(model) {
  5817.                 window.VcBackendTtaSectionView.__super__.changeShortcodeParams.call(this, model), _.isObject(this.parentObj) && this.parentObj.view && this.parentObj.view.notifySectionChanged && this.parentObj.view.notifySectionChanged(model)
  5818.             }
  5819.         }), vc.addTemplateFilter(function(string) {
  5820.             var random_id = VCS4() + "-" + VCS4();
  5821.             return string.replace(/tab\_id\=\"([^\"]+)\"/g, 'tab_id="$1' + random_id + '"')
  5822.         })
  5823.     }(window.jQuery),
  5824.     function($, _) {
  5825.         "use strict";
  5826.  
  5827.         function processImages(attachments, callback) {
  5828.             var ids = attachments.models ? attachments.pluck("id") : attachments;
  5829.             $.ajax({
  5830.                 dataType: "json",
  5831.                 type: "POST",
  5832.                 url: window.ajaxurl,
  5833.                 data: {
  5834.                     action: "vc_media_editor_add_image",
  5835.                     filters: window.vc_selectedFilters,
  5836.                     ids: ids,
  5837.                     vc_inline: !0,
  5838.                     _vcnonce: window.vcAdminNonce
  5839.                 }
  5840.             }).done(function(response) {
  5841.                 var models, attachment, promises, i;
  5842.                 if ("function" == typeof callback) {
  5843.                     for (models = [], promises = [], i = 0; i < response.data.ids.length; i++) attachment = attachments[response.data.ids[i]], attachment || (attachment = media.model.Attachment.get(response.data.ids[i]), promises.push(attachment.fetch())), models.push(attachment);
  5844.                     $.when.apply($, promises).done(function() {
  5845.                         callback(models)
  5846.                     })
  5847.                 }
  5848.             }).fail(function(response) {
  5849.                 $(".media-modal-close").click(), attachCb = [], window.vc && window.vc.active_panel && window.i18nLocale && window.i18nLocale.error_while_saving_image_filtered && vc.active_panel.showMessage(window.i18nLocale.error_while_saving_image_filtered, "error"), window.console && window.console.error && window.console.error(response)
  5850.             }).always(function() {
  5851.                 $(".media-modal").removeClass("processing-media")
  5852.             })
  5853.         }
  5854.  
  5855.         function previewFilter(attachmentId) {
  5856.             var $previewContainer, $preview, $filter;
  5857.             if ($filter = $(".media-frame:visible [data-vc-preview-image-filter=" + attachmentId + "]"), $filter.length) {
  5858.                 if ($previewContainer = $(".media-frame:visible .attachment-info .thumbnail-image").eq(-1), $preview = $previewContainer.find("img"), $previewContainer.addClass("loading"), $preview.data("original-src") || $preview.data("original-src", $preview.attr("src")), !$filter.val().length) return $preview.attr("src", $preview.data("original-src")), void $previewContainer.removeClass("loading");
  5859.                 $.ajax({
  5860.                     type: "POST",
  5861.                     dataType: "json",
  5862.                     url: window.ajaxurl,
  5863.                     data: {
  5864.                         action: "vc_media_editor_preview_image",
  5865.                         filter: $filter.val(),
  5866.                         attachment_id: attachmentId,
  5867.                         preferred_size: window.getUserSetting("imgsize", "medium"),
  5868.                         _vcnonce: window.vcAdminNonce
  5869.                     }
  5870.                 }).done(function(response) {
  5871.                     response.success && response.data.src.length && $preview.attr("src", response.data.src)
  5872.                 }).fail(function(jqXHR, textStatus, errorThrown) {
  5873.                     window.console && window.console.error && window.console.error("Filter preview failed:", textStatus, errorThrown)
  5874.                 }).always(function() {
  5875.                     $previewContainer.removeClass("loading")
  5876.                 })
  5877.             }
  5878.         }
  5879.         var attachmentCompatRender, attachCb = [],
  5880.             media = wp.media,
  5881.             origFeaturedImageSet = media.featuredImage.set,
  5882.             origEditorSendAttachment = media.editor.send.attachment,
  5883.             l10n = i18nLocale,
  5884.             workflows = {};
  5885.         attachmentCompatRender = _.extend(media.view.AttachmentCompat.prototype.render), media.view.AttachmentCompat.prototype.render = function() {
  5886.             var attachmentId, that = this;
  5887.             return attachmentId = this.model.get("id"), attachmentCompatRender.call(this), _.defer(function() {
  5888.                 var $container, html, $filter, label, $input;
  5889.                 $container = that.controller.$el.find(".attachment-info"), $input = that.controller.$el.find("[data-vc-preview-image-filter]"), $container.length && $input.length && (label = $input.parent().find(".vc-filter-label").text(), html = '<label class="setting vc-image-filter-setting">', html += '<span class="name">' + label + "</span>", html += $input[0].outerHTML, html += "</label>", $container.before(html), $input.parents("tr").remove()), void 0 !== window.vc_selectedFilters && void 0 !== window.vc_selectedFilters[attachmentId] && ($filter = $(".media-frame:visible [data-vc-preview-image-filter=" + attachmentId + "]"), $filter.length && $filter.val(window.vc_selectedFilters[attachmentId]).change()), previewFilter(attachmentId)
  5890.             }), this
  5891.         }, media.editor.send.attachment = function(props, attachment) {
  5892.             function finishImageProcessing(newAttachment) {
  5893.                 var attachment = newAttachment.slice(0).pop().attributes;
  5894.                 origEditorSendAttachment(props, attachment).done(function(html) {
  5895.                     origEditorSendAttachmentCallback(html, attachment.id)
  5896.                 })
  5897.             }
  5898.  
  5899.             function origEditorSendAttachmentCallback(html, id) {
  5900.                 attachCb && attachCb[0] !== id ? setTimeout(function() {
  5901.                     origEditorSendAttachmentCallback(html, id)
  5902.                 }, 50) : (attachCb.shift(), media.editor.insert(html))
  5903.             }
  5904.             attachCb.push(attachment.id), processImages([attachment.id], finishImageProcessing)
  5905.         }, media.featuredImage.set = function(id) {
  5906.             var ids = [id]; - 1 !== id ? $.ajax({
  5907.                 type: "POST",
  5908.                 url: window.ajaxurl,
  5909.                 data: {
  5910.                     action: "vc_media_editor_add_image",
  5911.                     filters: window.vc_selectedFilters,
  5912.                     ids: ids,
  5913.                     _vcnonce: window.vcAdminNonce
  5914.                 }
  5915.             }).done(function(response) {
  5916.                 var newId;
  5917.                 !0 === response.success && response.data.ids.length ? (newId = response.data.ids.pop(), origFeaturedImageSet(newId)) : origFeaturedImageSet(id)
  5918.             }).fail(function() {
  5919.                 origFeaturedImageSet(id)
  5920.             }) : origFeaturedImageSet(id)
  5921.         }, media.controller.VcSingleImage = media.controller.FeaturedImage.extend({
  5922.             defaults: _.defaults({
  5923.                 id: "vc_single-image",
  5924.                 filterable: "uploaded",
  5925.                 multiple: !1,
  5926.                 toolbar: "vc_single-image",
  5927.                 title: l10n.set_image,
  5928.                 priority: 60,
  5929.                 syncSelection: !1
  5930.             }, media.controller.Library.prototype.defaults),
  5931.             updateSelection: function() {
  5932.                 var attachments, selection = this.get("selection"),
  5933.                     ids = media.vc_editor.getData();
  5934.                 this.get("library");
  5935.                 void 0 !== ids && "" !== ids && -1 !== ids && (attachments = _.map(ids.toString().split(/,/), function(id) {
  5936.                     var attachment = media.model.Attachment.get(id);
  5937.                     return attachment.fetch(), attachment
  5938.                 })), selection.reset(attachments)
  5939.             }
  5940.         }), media.controller.VcGallery = media.controller.VcSingleImage.extend({
  5941.             defaults: _.defaults({
  5942.                 id: "vc_gallery",
  5943.                 title: l10n.add_images,
  5944.                 toolbar: "main-insert",
  5945.                 filterable: "uploaded",
  5946.                 library: media.query({
  5947.                     type: "image"
  5948.                 }),
  5949.                 multiple: "add",
  5950.                 editable: !0,
  5951.                 priority: 60,
  5952.                 syncSelection: !1
  5953.             }, media.controller.Library.prototype.defaults)
  5954.         }), media.VcSingleImage = {
  5955.             getData: function() {
  5956.                 return this.$hidden_ids.val()
  5957.             },
  5958.             set: function(selection) {
  5959.                 var template = vc.template($("#vc_settings-image-block").html(), vc.templateOptions.custom);
  5960.                 return this.$img_ul.html(template(selection)), this.$clear_button.show(), this.$hidden_ids.val(selection.id).trigger("change"), !1
  5961.             },
  5962.             frame: function(element) {
  5963.                 return window.vc_selectedFilters = {}, this.element = element, this.$button = $(this.element), this.$block = this.$button.closest(".edit_form_line"), this.$hidden_ids = this.$block.find(".gallery_widget_attached_images_ids"), this.$img_ul = this.$block.find(".gallery_widget_attached_images_list"), this.$clear_button = this.$img_ul.next(), this._frame ? this._frame : (this._frame = media({
  5964.                     state: "vc_single-image",
  5965.                     states: [new media.controller.VcSingleImage]
  5966.                 }), this._frame.on("toolbar:create:vc_single-image", function(toolbar) {
  5967.                     this.createSelectToolbar(toolbar, {
  5968.                         text: l10n.set_image,
  5969.                         close: !1
  5970.                     })
  5971.                 }, this._frame), this._frame.state("vc_single-image").on("select", this.select), this._frame)
  5972.             },
  5973.             select: function() {
  5974.                 var selection = this.get("selection");
  5975.                 vc.events.trigger("click:media_editor:add_image", selection, "single")
  5976.             }
  5977.         }, media.view.MediaFrame.VcGallery = media.view.MediaFrame.Post.extend({
  5978.             createStates: function() {
  5979.                 this.states.add([new media.controller.VcGallery])
  5980.             },
  5981.             bindHandlers: function() {
  5982.                 media.view.MediaFrame.Select.prototype.bindHandlers.apply(this, arguments), this.on("toolbar:create:main-insert", this.createToolbar, this);
  5983.                 var handlers = {
  5984.                     content: {
  5985.                         embed: "embedContent",
  5986.                         "edit-selection": "editSelectionContent"
  5987.                     },
  5988.                     toolbar: {
  5989.                         "main-insert": "mainInsertToolbar"
  5990.                     }
  5991.                 };
  5992.                 _.each(handlers, function(regionHandlers, region) {
  5993.                     _.each(regionHandlers, function(callback, handler) {
  5994.                         this.on(region + ":render:" + handler, this[callback], this)
  5995.                     }, this)
  5996.                 }, this)
  5997.             },
  5998.             mainInsertToolbar: function(view) {
  5999.                 var controller = this;
  6000.                 this.selectionStatusToolbar(view), view.set("insert", {
  6001.                     style: "primary",
  6002.                     priority: 80,
  6003.                     text: l10n.add_images,
  6004.                     requires: {
  6005.                         selection: !0
  6006.                     },
  6007.                     click: function() {
  6008.                         var state = controller.state(),
  6009.                             selection = state.get("selection");
  6010.                         vc.events.trigger("click:media_editor:add_image", selection, "gallery"), state.trigger("insert", selection).reset()
  6011.                     }
  6012.                 })
  6013.             }
  6014.         }), media.vc_editor = _.clone(media.editor), _.extend(media.vc_editor, {
  6015.             $vc_editor_element: null,
  6016.             getData: function() {
  6017.                 return media.vc_editor.$vc_editor_element.closest(".edit_form_line").find(".gallery_widget_attached_images_ids").val()
  6018.             },
  6019.             insert: function(images) {
  6020.                 var $button = media.vc_editor.$vc_editor_element,
  6021.                     $block = $button.closest(".edit_form_line"),
  6022.                     $hidden_ids = $block.find(".gallery_widget_attached_images_ids"),
  6023.                     $img_ul = $block.find(".gallery_widget_attached_images_list"),
  6024.                     $thumbnails_string = "",
  6025.                     template = vc.template($("#vc_settings-image-block").html(), vc.templateOptions.custom);
  6026.                 _.each(images, function(image) {
  6027.                     $thumbnails_string += template(image)
  6028.                 }), $hidden_ids.val(_.map(images, function(image) {
  6029.                     return image.id
  6030.                 }).join(",")).trigger("change"), $img_ul.html($thumbnails_string)
  6031.             },
  6032.             open: function(id) {
  6033.                 var workflow;
  6034.                 return id = this.id(id), workflow = this.get(id), workflow || (workflow = this.add(id)), window.vc_selectedFilters = {}, workflow.open()
  6035.             },
  6036.             add: function(id, options) {
  6037.                 var workflow = this.get(id);
  6038.                 return workflow || (workflows[id] ? workflows[id] : workflow = workflows[id] = new media.view.MediaFrame.VcGallery(_.defaults(options || {}, {
  6039.                     state: "vc_gallery",
  6040.                     title: l10n.add_images,
  6041.                     library: {
  6042.                         type: "image"
  6043.                     },
  6044.                     multiple: !0
  6045.                 })))
  6046.             },
  6047.             init: function() {
  6048.                 $("body").unbind("click.vcGalleryWidget").on("click.vcGalleryWidget", ".gallery_widget_add_images", function(event) {
  6049.                     event.preventDefault();
  6050.                     var $this = $(this);
  6051.                     if (media.vc_editor.$vc_editor_element = $(this), "true" === $this.attr("use-single")) return void media.VcSingleImage.frame(this).open("vc_editor");
  6052.                     $this.blur(), media.vc_editor.open("visual-composer")
  6053.                 })
  6054.             }
  6055.         }), _.bindAll(media.vc_editor, "open"), $(document).ready(function() {
  6056.             media.vc_editor.init()
  6057.         }), vc.events.on("click:media_editor:add_image", function(selection, type) {
  6058.             function finishImageProcessing(newAttachments) {
  6059.                 var attachments, objects;
  6060.                 switch (attachments = _.map(newAttachments, function(newAttachment) {
  6061.                     return newAttachment.attributes
  6062.                 }), selection.reset(attachments), objects = _.map(selection.models, function(model) {
  6063.                     return model.attributes
  6064.                 }), void 0 === type && (type = ""), type) {
  6065.                     case "gallery":
  6066.                         media.vc_editor.insert(objects);
  6067.                         break;
  6068.                     case "single":
  6069.                         media.VcSingleImage.set(objects[0])
  6070.                 }
  6071.                 $(".media-modal").removeClass("processing-media"), $(".media-modal-close").click()
  6072.             }
  6073.             $(".media-modal").addClass("processing-media"), processImages(_.extend({}, selection), finishImageProcessing)
  6074.         }), $("body").on("change", "[data-vc-preview-image-filter]", function() {
  6075.             var id;
  6076.             id = $(this).data("vcPreviewImageFilter"), void 0 === window.vc_selectedFilters && (window.vc_selectedFilters = {}), window.vc_selectedFilters[id] = $(this).val(), previewFilter(id)
  6077.         })
  6078.     }(window.jQuery, window._);
  6079. var vcPointerMessage;
  6080. ! function($) {
  6081.     "use strict";
  6082.     vcPointerMessage = function(target, pointerOptions, texts) {
  6083.         this.target = target, this.$pointer = null, this.texts = texts, this.pointerOptions = pointerOptions, this.init()
  6084.     }, vcPointerMessage.prototype = {
  6085.         init: function() {
  6086.             _.bindAll(this, "openedEvent", "reposition")
  6087.         },
  6088.         show: function() {
  6089.             this.$pointer = $(this.target), this.$pointer.data("vcPointerMessage", this), this.pointerOptions.opened = this.openedEvent, this.$pointer.addClass("vc-with-vc-pointer").pointer(this.pointerOptions).pointer("open"), $(window).on("resize.vcPointer", this.reposition)
  6090.         },
  6091.         domButtonsWrapper: function() {
  6092.             return $('<div class="vc_wp-pointer-controls" />')
  6093.         },
  6094.         domCloseBtn: function() {
  6095.             return $('<a class="vc_pointer-close close">' + this.texts.finish + "</a>")
  6096.         },
  6097.         domNextBtn: function() {
  6098.             return $('<button class="button button-primary button-large vc_wp-pointers-next">' + this.texts.next + '<i class="vc_pointer-icon"></i></button>')
  6099.         },
  6100.         domPrevBtn: function() {
  6101.             return $('<button class="button button-primary button-large vc_wp-pointers-prev"><i class="vc_pointer-icon"></i>' + this.texts.prev + "</button> ")
  6102.         },
  6103.         openedEvent: function(a, b) {
  6104.             var offset = b.pointer.offset();
  6105.             offset && offset.top && $("body").scrollTop(80 < offset.top ? offset.top - 80 : 0)
  6106.         },
  6107.         reposition: function() {
  6108.             this.$pointer.pointer("reposition")
  6109.         },
  6110.         close: function() {
  6111.             this.$pointer && this.$pointer.removeClass("vc-with-vc-pointer").pointer("close"), $(window).off("resize.vcPointer")
  6112.         }
  6113.     }
  6114. }(window.jQuery);
  6115. var vcPointersController;
  6116. ! function($) {
  6117.     "use strict";
  6118.     vcPointersController = function(Pointer, texts) {
  6119.         this.pointers = Pointer && Pointer.messages || [], this._texts = texts, this.pointerId = Pointer && Pointer.pointer_id ? Pointer.pointer_id : "", this.pointerData = {}, this._index = 0, this.messagesDismissed = !1, this.init()
  6120.     }, vcPointersController.prototype = {
  6121.         init: function() {
  6122.             _.bindAll(this, "show", "clickEventClose", "clickEventNext", "clickEventPrev", "buttonsEvent"), this.build()
  6123.         },
  6124.         getPointer: function(index) {
  6125.             return this.pointerData = this.pointers[index] && this.pointers[index].target ? this.pointers[index] : null, this.pointerData && this.pointerData.options ? new vcPointerMessage(this.pointerData.target, this.buildOptions(this.pointerData.options), this._texts) : null
  6126.         },
  6127.         buildOptions: function(data) {
  6128.             return data.buttonsEvent && _.isFunction(window[data.buttonsEvent]) ? data.buttons = _.bind(window[data.buttonsEvent], this) : data.buttons = this.buttonsEvent, data.vcPointerController = this, data
  6129.         },
  6130.         build: function() {
  6131.             if (this.pointer = this.getPointer(this._index), vc.events.once("backendEditor.close", this.close, this), !this.pointer) return !1;
  6132.             this.setShowEventHandler()
  6133.         },
  6134.         show: function() {
  6135.             this.pointer.show(), this.setCloseEventHandler(), vc.events.trigger("vcPointer:show")
  6136.         },
  6137.         setShowEventHandler: function() {
  6138.             var showEvent;
  6139.             this.pointerData.showCallback && window[this.pointerData.showCallback] ? window[this.pointerData.showCallback].call(this) : this.pointerData.showEvent ? this.pointerData.showEvent.match(/\s/) ? (showEvent = this.pointerData.closeEvent.split(/\s+(.+)?/), 1 < showEvent.length && $(showEvent[1]).one(showEvent[0], this.show)) : vc.events.once(this.pointerData.showEvent, this.show) : this.show()
  6140.         },
  6141.         setCloseEventHandler: function() {
  6142.             var closeEvent;
  6143.             this.pointerData.closeCallback && window[this.pointerData.closeCallback] ? window[this.pointerData.closeCallback].call(this) : this.pointerData.closeEvent ? this.pointerData.closeEvent.match(/\s/) ? (closeEvent = this.pointerData.closeEvent.split(/\s+(.+)?/), $(closeEvent[1] || this.$pointer).one(closeEvent[1] && closeEvent[0] ? closeEvent[0] : "click", this.clickEventNext)) : vc.events.once(this.pointerData.closeEvent, this.nextOnEvent, this) : this.pointer.$pointer && 0 < this.pointer.$pointer.length && $(this.pointer.$pointer).one("click", this.clickEventNext)
  6144.         },
  6145.         nextOnEvent: function() {
  6146.             this.close(), this.next()
  6147.         },
  6148.         next: function() {
  6149.             this._index++, this.build()
  6150.         },
  6151.         prev: function() {
  6152.             this._index--, this.build()
  6153.         },
  6154.         close: function() {
  6155.             this.pointer && (this.pointer.close(), this.pointerData = null, this.pointer = null, vc.events.trigger("vcPointer:close", this))
  6156.         },
  6157.         buttonsEvent: function() {
  6158.             var $closeBtn, $nextBtn, $prevBtn, $buttons;
  6159.             return $closeBtn = this.pointer.domCloseBtn(), $nextBtn = this.pointer.domNextBtn(), $prevBtn = this.pointer.domPrevBtn(), $closeBtn.bind("click.vcPointer", this.clickEventClose), $buttons = this.pointer.domButtonsWrapper().append($closeBtn), 0 < this._index && ($prevBtn.bind("click.vcPointer", this.clickEventPrev), $buttons.addClass("vc_wp-pointer-controls-prev").append($prevBtn)), this._index + 1 < this.pointers.length && ($nextBtn.bind("click.vcPointer", this.clickEventNext), $buttons.addClass("vc_wp-pointer-controls-next").append($nextBtn)), $buttons
  6160.         },
  6161.         clickEventClose: function() {
  6162.             this.close(), this.dismissMessages()
  6163.         },
  6164.         clickEventNext: function() {
  6165.             this.close(), this.next()
  6166.         },
  6167.         clickEventPrev: function() {
  6168.             this.close(), this.prev()
  6169.         },
  6170.         dismissMessages: function() {
  6171.             if (this.messagesDismissed) return !1;
  6172.             $.post(window.ajaxurl, {
  6173.                 pointer: this.pointerId,
  6174.                 action: "dismiss-wp-pointer"
  6175.             }), this.messagesDismissed = !0
  6176.         }
  6177.     }
  6178. }(window.jQuery),
  6179. function($) {
  6180.     "use strict";
  6181.     vc.events.on("app.render", function() {
  6182.         window.vcPointer && window.vcPointer.pointers && window.vcPointer.pointers.length && _.each(vcPointer.pointers, function(pointer) {
  6183.             new vcPointersController(pointer, vcPointer.texts)
  6184.         }, this)
  6185.     }), vc.events.on("vcPointer:show", function() {
  6186.         vc.app.disableFixedNav = !0
  6187.     }), vc.events.on("vcPointer:close", function() {
  6188.         vc.app.disableFixedNav = !1
  6189.     }), window.vcPointersEditorsTourEvents = function() {
  6190.         var $closeBtn;
  6191.         return $closeBtn = this.pointer.domCloseBtn(), $closeBtn.bind("click.vcPointer", this.clickEventClose), this.dismissMessages(), $closeBtn
  6192.     }, window.vcPointersShowOnContentElementControls = function() {
  6193.         this.pointer && $(this.pointer.target).length ? ($(this.pointer.target).parent().addClass("vc-with-vc-pointer-controls"), this.show(), $("#wpb_visual_composer").one("click", function() {
  6194.             $(".vc-with-vc-pointer-controls").removeClass("vc-with-vc-pointer-controls")
  6195.         })) : vc.events.once("shortcodes:add", vcPointersShowOnContentElementControls, this)
  6196.     }, window.vcPointersSetInIFrame = function() {
  6197.         this.pointerData && vc.frame_window.jQuery(this.pointerData.target).length ? (this.pointer = new vc.frame_window.vcPointerMessage(this.pointerData.target, this.buildOptions(this.pointerData.options), this._texts), this.show(), this.pointer.$pointer.closest(".vc_controls").addClass("vc-with-vc-pointer-controls")) : vc.events.once("shortcodeView:ready", vcPointersSetInIFrame, this)
  6198.     }, window.vcPointersCloseInIFrame = function() {
  6199.         var controller, _$;
  6200.         controller = this, _$ = vc.frame_window.jQuery, _$("body").one("click", function() {
  6201.             _$(".vc-with-vc-pointer-controls").removeClass("vc-with-vc-pointer-controls"), controller.nextOnEvent()
  6202.         })
  6203.     }
  6204. }(window.jQuery);
Add Comment
Please, Sign In to add comment