'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(m,H,z){if(m==Array.prototype||m==Object.prototype)return m;m[H]=z.value;return m};
$jscomp.getGlobal=function(m){m=["object"==typeof globalThis&&globalThis,m,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var H=0;H<m.length;++H){var z=m[H];if(z&&z.Math==Math)return z}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};
$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(m,H){var z=$jscomp.propertyToPolyfillSymbol[H];if(null==z)return m[H];z=m[z];return void 0!==z?z:m[H]};$jscomp.polyfill=function(m,H,z,I){H&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(m,H,z,I):$jscomp.polyfillUnisolated(m,H,z,I))};
$jscomp.polyfillUnisolated=function(m,H,z,I){z=$jscomp.global;m=m.split(".");for(I=0;I<m.length-1;I++){var x=m[I];if(!(x in z))return;z=z[x]}m=m[m.length-1];I=z[m];H=H(I);H!=I&&null!=H&&$jscomp.defineProperty(z,m,{configurable:!0,writable:!0,value:H})};
$jscomp.polyfillIsolated=function(m,H,z,I){var x=m.split(".");m=1===x.length;I=x[0];I=!m&&I in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var u=0;u<x.length-1;u++){var t=x[u];if(!(t in I))return;I=I[t]}x=x[x.length-1];z=$jscomp.IS_SYMBOL_NATIVE&&"es6"===z?I[x]:null;H=H(z);null!=H&&(m?$jscomp.defineProperty($jscomp.polyfills,x,{configurable:!0,writable:!0,value:H}):H!==z&&(void 0===$jscomp.propertyToPolyfillSymbol[x]&&(z=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[x]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(x):$jscomp.POLYFILL_PREFIX+z+"$"+x),$jscomp.defineProperty(I,$jscomp.propertyToPolyfillSymbol[x],{configurable:!0,writable:!0,value:H})))};$jscomp.arrayIteratorImpl=function(m){var H=0;return function(){return H<m.length?{done:!1,value:m[H++]}:{done:!0}}};$jscomp.arrayIterator=function(m){return{next:$jscomp.arrayIteratorImpl(m)}};$jscomp.makeIterator=function(m){var H="undefined"!=typeof Symbol&&Symbol.iterator&&m[Symbol.iterator];return H?H.call(m):$jscomp.arrayIterator(m)};
$jscomp.polyfill("Promise.allSettled",function(m){function H(I){return{status:"fulfilled",value:I}}function z(I){return{status:"rejected",reason:I}}return m?m:function(I){var x=this;I=Array.from(I,function(u){return x.resolve(u).then(H,z)});return x.all(I)}},"es_2020","es3");
$jscomp.polyfill("String.prototype.replaceAll",function(m){return m?m:function(H,z){if(H instanceof RegExp&&!H.global)throw new TypeError("String.prototype.replaceAll called with a non-global RegExp argument.");return H instanceof RegExp?this.replace(H,z):this.replace(new RegExp(String(H).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08"),"g"),z)}},"es_next","es3");var tb_app;
(function(m,H,z,I,x,u,t){const ba="undefined"!==typeof themifyScript&&themifyScript.is_fullSection;void 0===m.fn.themifySerializeObject&&(m.fn.themifySerializeObject=function(){for(var a={},b=this.length-1;-1<b;--b){var d=this[b].type;if(this[b].classList.contains("wp-editor-area")&&"undefined"!==typeof tinyMCE){var f=tinyMCE.get(this[b].id);f&&(this[b].value=f.getContent())}if(""!==this[b].value&&("text"===d||"number"===d||"radio"===d||"checkbox"===d||"textarea"===d||"select-one"===d||"hidden"===
d||"email"===d||"select"===d||"select-multiple"===d)&&(this[b].name||this[b].id)){f=this[b].name?this[b].name:this[b].id;var e=this[b].value;"radio"===d||"checkbox"===d?e=this[b].checked&&e:"select-multiple"===d&&(e=m(this[b]).val());void 0!==a[f]&&"radio"!==d?(!a[f].push&&(a[f]=[a[f]]),e&&a[f].push(e)):e&&(a[f]=e)}}return a});const c=tb_app={activeModel:null,Models:{},Collections:{},Mixins:{},Views:{Modules:{},Rows:{},SubRows:{},Columns:{}},Forms:{},Constructor:{},Utils:{},Instances:{Builder:{}}};
let Y={},S=null;c.builderIndex=0;c.mode="default";c.autoSaveCid=null;c.hasChanged=null;c.editing=!1;c.scrollTo=!1;c.eventName=!1;c.beforeEvent=!1;c.saving=!1;c.activeBreakPoint="desktop";c.zoomMeta={isActive:!1,size:100};c.isPreview=!1;c.clearOnModeChange=null;c.Models.Module=H.Model.extend({defaults:{element_id:null,elType:"module",mod_name:"",mod_settings:{}},initialize(){c.Models.Registry.register(this.cid,this);let a=this.get("element_id");a&&1!==Y[a]||(a=c.Utils.generateUniqueID(),this.set({element_id:a},
{silent:!0}));Y[a]=1},toRenderData(){const a=this.get("mod_name");return{icon:c.Utils.getIcon("ti-"+themifyBuilder.modules[a].icon).outerHTML,name:themifyBuilder.modules[a].name,slug:a,element_id:this.get("element_id"),excerpt:this.getExcerpt()}},getExcerpt(a){a=a||this.get("mod_settings");return this.limitString(a.content_text||a.content_box||a.plain_text||"",100)},limitString(a,b){let d="";""!==a&&(a=this.stripHtml(a).toString(),d=a.length>b?a.substr(0,b):a);return d},stripHtml(a){const b=u.createElement("div");
b.innerHTML=a;return b.textContent||b.innerText||""},setData(a){c.Utils.clearElementId([a]);a=c.Views.init_module(a);a.model.trigger("custom:change",a)},backendLivePreview(){m(".tb_element_cid_"+this.cid).find(".module_excerpt").text(this.getExcerpt())},getPreviewSettings(){return Object.assign({cid:this.cid},themifyBuilder.modules[this.get("mod_name")].defaults)},getIDattr(){let a=this.get("element_id");a||(a=c.Utils.generateUniqueID());return a}});c.Models.SubRow=H.Model.extend({defaults:{element_id:null,
elType:"subrow",gutter:"gutter-default",column_alignment:ba?"col_align_middle":"col_align_top",column_h:"",desktop_dir:"ltr",tablet_dir:"ltr",tablet_landscape_dir:"ltr",mobile_dir:"ltr",col_mobile:"-auto",col_tablet_landscape:"-auto",col_tablet:"-auto",cols:{},styling:{}},initialize(){c.Models.Registry.register(this.cid,this);let a=this.get("element_id");a&&1!==Y[a]||(a=c.Utils.generateUniqueID(),this.set({element_id:a},{silent:!0}));Y[a]=1},setData(a){c.Utils.clearElementId([a]);a=c.Views.init_subrow(a);
a.model.trigger("custom:change",a)}});c.Models.Column=H.Model.extend({defaults:{element_id:null,elType:"column",grid_class:"",component_name:"column",modules:{},styling:{}},initialize(){c.Models.Registry.register(this.cid,this);let a=this.get("element_id");a&&1!==Y[a]||(a=c.Utils.generateUniqueID(),this.set({element_id:a},{silent:!0}));Y[a]=1},setData(a){c.Utils.clearElementId([a]);a=c.Views.init_column(a);a.model.trigger("custom:change",a)}});c.Models.Row=H.Model.extend({defaults:{element_id:null,
elType:"row",gutter:"gutter-default",column_alignment:ba?"col_align_middle":"col_align_top",column_h:"",desktop_dir:"ltr",tablet_dir:"ltr",tablet_landscape_dir:"ltr",mobile_dir:"ltr",col_mobile:"-auto",col_tablet_landscape:"-auto",col_tablet:"-auto",cols:{},styling:{}},initialize(){c.Models.Registry.register(this.cid,this);let a=this.get("element_id");a&&1!==Y[a]||(a=c.Utils.generateUniqueID(),this.set({element_id:a},{silent:!0}));Y[a]=1},setData(a){c.Utils.clearElementId([a]);a=c.Views.init_row(a);
a.model.trigger("custom:change",a)}});c.Collections.Rows=H.Collection.extend({model:c.Models.Row});c.Models.Registry={items:{},register(a,b){this.items[a]=b},lookup(a){return this.items[a]||null},remove(a){this.items[a]=null;delete this.items[a]},destroy(){for(let a in this.items)this.items[a].destroy();this.items={}}};c.vent=Object.assign({},H.Events);c.Views.register_module=function(a){"default"!==c.mode&&(this.Modules[c.mode]=this.Modules.default.extend(a))};c.Views.init_module=function(a,b){if(void 0===
themifyBuilder.modules[a.mod_name])return!1;!0===b&&void 0===a.mod_settings&&void 0!==themifyBuilder.modules[a.mod_name].defaults&&(a.mod_settings=Object.assign({},themifyBuilder.modules[a.mod_name].defaults));a=a instanceof c.Models.Module?a:new c.Models.Module(a);b=new (this.get_module())({model:a,type:c.mode});return{model:a,view:b}};c.Views.get_module=function(){return this.Modules[c.mode]};c.Views.unregister_module=function(){"default"!==c.mode&&(this.Modules[c.mode]=null,delete this.Modules[c.mode])};
c.Views.module_exists=function(){return this.Modules.hasOwnProperty(c.mode)};c.Views.register_column=function(a){"default"!==c.mode&&(this.Columns[c.mode]=this.Columns.default.extend(a))};c.Views.init_column=function(a){a=a instanceof c.Models.Column?a:new c.Models.Column(a);const b=new (this.get_column())({model:a,type:c.mode});return{model:a,view:b}};c.Views.get_column=function(){return this.Columns[c.mode]};c.Views.unregister_column=function(){"default"!==c.mode&&(this.Columns[c.mode]=null,delete this.Columns[c.mode])};
c.Views.column_exists=function(){return this.Columns.hasOwnProperty(c.mode)};c.Views.register_subrow=function(a){"default"!==c.mode&&(this.SubRows[c.mode]=this.SubRows.default.extend(a))};c.Views.init_subrow=function(a){a=a instanceof c.Models.SubRow?a:new c.Models.SubRow(a);const b=new (this.get_subrow())({model:a,type:c.mode});return{model:a,view:b}};c.Views.get_subrow=function(){return this.SubRows[c.mode]};c.Views.unregister_subrow=function(){"default"!==c.mode&&(this.SubRows[c.mode]=null,delete this.SubRows[c.mode])};
c.Views.subrow_exists=function(){return this.SubRows.hasOwnProperty(c.mode)};c.Views.register_row=function(a){"default"!==c.mode&&(this.Rows[c.mode]=this.Rows.default.extend(a))};c.Views.init_row=function(a){var b=a.attributes;return void 0===b||void 0!==b.cols&&(0<Object.keys(b.cols).length||0<b.cols.length)||void 0!==b.styling&&0<Object.keys(b.styling).length?(a=a instanceof c.Models.Row?a:new c.Models.Row(a),b=new (this.get_row())({model:a,type:c.mode}),{model:a,view:b}):!1};c.Views.get_row=function(){return this.Rows[c.mode]};
c.Views.unregister_row=function(){"default"!==c.mode&&(this.Rows[c.mode]=null,delete this.Rows[c.mode])};c.Views.row_exists=function(){return this.Rows.hasOwnProperty(c.mode)};c.Views.BaseElement=H.View.extend({type:"default",initialize(){this.listenTo(this.model,"custom:change",this.modelChange);this.listenTo(this.model,"destroy",this.remove);this.listenTo(this.model,"edit",this.edit);this.listenTo(this.model,"duplicate",this.duplicate);this.listenTo(this.model,"save",this.save);this.listenTo(this.model,
"importExport",this.importExport);this.listenTo(this.model,"delete",this.delete);this.listenTo(this.model,"copy",this.copy);this.listenTo(this.model,"visibility",this.visibility);this.listenTo(this.model,"paste",this.paste);this.listenTo(this.model,"change:view",this.setView)},setView(a){this.setElement(a)},modelChange(){this.$el.attr(Object.assign({},_.result(this,"attributes")));let a=this.render(),b=c.beforeEvent.data("cid"),d=u.getElementsByClassName("tb_element_cid_"+b)[0];d.parentNode.replaceChild(a.el,
d);"visual"===c.mode?this.model.trigger("visual:change"):("row"===c.eventName&&(b=this.$el.data("cid")),c.undoManager.push(b,c.beforeEvent,this.$el,c.eventName),c.Utils.runJs(this.$el))},remove(){this.$el.remove()},visibility(a,b){a="module"===this.model.get("elType")?"mod_settings":"styling";const d=this.model.get(a),f=b.name;!0===b.checked?delete d[f]:d[f]=b.value;b={};b[a]=d;this.model.set(b,{silent:!0})},copy(a,b){b=this.$el;var d=this.model;a=d.get("elType");"column"===a&&(a=d.get("component_name"));
null!==c.activeModel&&ThemifyConstructor.saveComponent();b=this.getData(b,a);Object.keys(c.GS.styles).length&&(d=c.GS.findUsedItems(b),!1!==d&&d.length&&(b.attached_gs=d));c.Utils.clearElementId([b]);"sub-column"===a&&(a="column");t.Clipboard.set(a,b)},paste(a,b,d){a=this.$el;var f=this.model,e=f.get("elType");let h=null;"column"===e?e=f.get("component_name"):"module"===e&&(h=f.get("mod_name"));"sub-column"===e&&(e="column");const g="style"===b||null!==b&&void 0!==b&&b.classList.contains("tb_paste_style");
b=t.Clipboard.get(e);!1===g&&!1===b&&"column"===e&&(b=t.Clipboard.get("module"),e="module",h=b.mod_name);if(!1===b||!0===g&&"module"===e&&h!==b.mod_name)!0!==d&&t.alertWrongPaste();else{c.eventName="row";if(!0===g){const n=ThemifyStyles.getStyleOptions("module"===e?h:e);d="module"===e?"mod_settings":"styling";const l=this.getData(a,"column"===e?f.get("component_name"):e),r=function(p){if(-1!==p.indexOf("breakpoint_")||-1!==p.indexOf("_apply_all"))return!0;let q=-1!==p.indexOf("_color")?"color":-1!==
p.indexOf("_style")?"style":!1;if(!1!==q){if(q=p.replace("_"+q,"_width"),void 0!==n[q]&&"border"===n[q].type)return!0}else if(-1!==p.indexOf("_unit")){if(q=p.replace(/_unit$/ig,"",""),void 0!==n[q])return!0}else if(-1!==p.indexOf("_w")){if(q=p.replace(/_w$/ig,"",""),void 0!==n[q]&&"font_select"===n[q].type)return!0}else if(void 0!==n[p]&&"radio"===n[p].type)return!0;return!1};void 0===l[d]&&(l[d]={});for(var k in b[d])void 0!==n[k]||r(k)?(l[d][k]=b[d][k],void 0!==n[k]&&(!0===n[k].isFontColor&&void 0!==
b[d][n[k].g+"-gradient"]?l[d][n[k].g+"-gradient"]=b[d][n[k].g+"-gradient"]:(void 0!==n[k].posId&&void 0!==b[d][n[k].posId]&&(l[d][n[k].posId]=b[d][n[k].posId]),void 0!==n[k].repeatId&&void 0!==b[d][n[k].repeatId]&&(l[d][n[k].repeatId]=b[d][n[k].repeatId])))):delete b[d][k];void 0!==b.used_gs&&(l.used_gs=b.used_gs);b=l;delete b.element_id}if("column"===e){b.grid_class=c.Utils.filterClass(a.prop("class"));if(a.hasClass("first")||a.hasClass("last"))b.grid_class+=a.hasClass("first")?" first":" last";
k=a[0].style.width;b.grid_width=k?k.replace("%",""):null;b.component_name=f.get("component_name")}!1===g&&c.Utils.clearElementId([b]);c.hasChanged=!0;!1===g&&"module"===e&&"column"===f.get("elType")&&(f=c.Views.init_module({mod_name:h},!0),e=f.view.render().$el,a[0].getElementsByClassName("tb_holder")[0].appendChild(e[0]),f=f.model,a=e);c.beforeEvent=t.clone(a);f.setData(b);null!==c.activeModel&&t.Lightbox.close()}},importExport(a,b){const d=b.classList.contains("tb_import")?"import":"export",f=this,
e=this.$el,h=this.model;let g=h.get("elType");g="column"===g?h.get("component_name"):g;b=g.charAt(0).toUpperCase()+g.slice(1);const k="subrow"===g?"Sub-Row":"sub-column"===g?"Sub-Column":b;b={contructor:!0,loadMethod:"html",data:{component_form:{name:ThemifyConstructor.label[d+"_tab"].replace("%s",b),options:[{id:"tb_data_field",type:"textarea",label:ThemifyConstructor.label.import_label.replace("%s",k),help:ThemifyConstructor.label[d+"_data"].replace("%s",b),"class":"fullwidth",rows:13}]}}};"import"===
d&&(b.save={});t.Lightbox.$lightbox[0].style.display="none";t.Lightbox.open(b,function(){x.document.body.classList.add("tb_standalone_lightbox")},function(){const n=this.$lightbox;n.addClass("tb_import_export_lightbox");this.setStandAlone(a.clientX,a.clientY);if("import"===d)n.find(".builder_save_button").on("click.tb_import",function(l){l.preventDefault();l.stopPropagation();l=JSON.parse(n.find("#tb_data_field").val());if("column"===g&&"sub-column"===l.component_name||"sub-column"===g&&"column"===
l.component_name)l.component_name=g;if(l.component_name&&l.component_name===g){if("column"===g||"sub-column"===g){var r=e[0].closest(".module_column");const p=r.style.width,q=r.classList;l.grid_class=c.Utils.filterClass(r.className);if(q.contains("first")||q.contains("last"))l.grid_class+=q.contains("first")?" first":" last";l.grid_width=p?p.replace("%",""):null}c.eventName="row";c.hasChanged=!0;c.beforeEvent=t.clone(e);r=function(p){p=c.Utils.clear(p);h.setData(p);t.Lightbox.close()};void 0!==l.used_gs?
c.GS.setImport(l.used_gs,r,l):r(l)}else t.alertWrongPaste()});else{let l=f.getData(e,g);l.component_name=g;const r=c.GS.findUsedItems(l);if(!1!==r){const p={};for(let q=r.length-1;-1<q;--q){let v=c.GS.styles[r[q]],w=m.extend(!0,{},v.data[0]);"row"===v.type||"subrow"===v.type?w=w.styling:void 0!==w.cols?(w=w.cols[0])&&(w="column"===v.type?w.styling:void 0!==w.modules?w.modules[0].mod_settings:void 0):w=void 0;void 0!==w&&0<Object.keys(w).length&&(p[r[q]]={title:v.title,type:v.type,data:c.Utils.clear(w,
!1)})}Object.keys(p).length&&(l.used_gs=p)}l=JSON.stringify(l);n.find("#tb_data_field").val(l).on("click",function(){m(this).trigger("focus").trigger("select")})}z.body.one("themify_builder_lightbox_close",function(){n.removeClass("tb_import_export_lightbox");x.document.body.classList.remove("tb_standalone_lightbox");"import"===d&&n.find(".builder_save_button").off("click.tb_import")})})},getData(a,b){var d={};switch(b){case "row":case "subrow":d=c.Utils._getRowSettings(a.closest("."+("row"===b?"module_row":
"active_subrow"))[0],b);break;case "module":d=c.Models.Registry.lookup(a.closest(".active_module").data("cid")).attributes;break;case "column":case "sub-column":a=a.closest(".module_column"),d=a.closest("column"===b?".module_row":".active_subrow"),d=c.Utils._getRowSettings(d[0],"column"===b?"row":"subrow").cols[a.index()]}return c.Utils.clear(d)},duplicate(a,b){a=this.$el;b=t.clone(a);null!==c.activeModel&&t.Lightbox.$lightbox.is(":visible")&&ThemifyConstructor.saveComponent();a.removeClass("tb_element_cid_"+
this.model.cid);b.hide().insertAfter(a);const d=this.getData(b,this.model.get("elType"));c.eventName="duplicate";c.beforeEvent=b;c.hasChanged=!0;this.model.setData(d);a.addClass("tb_element_cid_"+this.model.cid)},edit(a,b){if(c.isPreview)return!0;"breadcrumb"!==a?c.ActionBar.breadCrumbsPath.lightbox=null:a=null;let d=c.hasChanged=!1,f=t.Lightbox.$lightbox,e=this.model.get("elType"),h=!1,g="module"===e?this.model.get("mod_name"):e,k=!1;if(null!==a){const n=b?b.classList:a.target,l=n.contains("tb_dragger");
if(!0===l&&(!b.hasAttribute("data-v")||""===b.getAttribute("data-v")))return;"dblclick"===a.type&&this.model.cid!==c.autoSaveCid&&c.ActionBar.clear();k=l||n.contains("tb_styling");if(!0===k)this.model.set({styleClicked:!0},{silent:!0}),!0===l&&(h=function(r){var p=n.contains("tb_dragger_padding")?"p":"m";p=ThemifyConstructor.label[p];const q=r.getElementsByClassName("tb_style_toggle");for(let v=q.length-1;-1<v;--v)if(q[v].textContent===p){q[v].classList.contains("tb_closed")&&q[v].click();setTimeout(function(){q[v].closest(".tf_scrollbar").scrollTop=
q[v].offsetTop},10);break}});else if(n.contains("tb_visibility_component"))d=!0,this.model.set({visibileClicked:!0},{silent:!0});else if(!0===(n.contains("tb_swap")?!1:"layout-part"===g?!0:z.body.triggerHandler("tb_edit_"+g,[a,this.el,this.model]))&&"visual"===c.mode&&!c.Forms.LayoutPart.id&&("dblclick"===a.type||n.contains("tb_edit"))){c.activeModel=this.model;c.Forms.LayoutPart.edit(this.el);return}}null!==c.activeModel&&null!==c.autoSaveCid&&this.model.cid!==c.autoSaveCid&&ThemifyConstructor.saveComponent(!0);
c.activeModel=this.model;if(c.autoSaveCid===this.model.cid){a=null;if(!0===k)a=f.find('a[href="#tb_options_styling"]'),this.model.unset("styleClicked",{silent:!0});else if(!0===d)a=f.find('a[href="#tb_options_visibility"]'),this.model.unset("visibileClicked",{silent:!0});else if("module"===e||"row"===e)a=f.find('a[href="#tb_options_setting"]');null!==a&&0<a.length&&(a[0].click(),!1!==h&&!0===k&&h(t.Lightbox.$lightbox[0].querySelector("#tb_lightbox_container")))}else t.Lightbox.open({loadMethod:"inline",
templateID:g},!1,h),!1===c.GS.isGSPage&&(c.ActionBar.hideContextMenu(),("row"!==g||"row"===g&&null!==c.ActionBar.breadCrumbsPath.lightbox)&&t.Lightbox.$lightbox[0].getElementsByClassName("tb_action_breadcrumb")[0].appendChild(c.ActionBar.getBreadCrumbs(c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_cid_"+this.model.cid)[0])))},delete(a,b,d){let f=this.$el,e=this.model;b=a=e.cid;let h=e.get("elType");if(!0===d||confirm(themifyBuilder.i18n[h+"DeleteConfirm"])){d=f.closest(".module_row");
var g="row",k="",n,l={};"row"===h?(l.pos_cid=d.next(".module_row"),l.pos="before",0===l.pos_cid.length&&(l.pos="after",l.pos_cid=d.prev(".module_row")),g="delete_row",l.pos_cid=l.pos_cid.data("cid")):a=d.data("cid");d=t.clone(d);"row"!==h&&(n=f.closest(".active_subrow"));e.destroy();n&&0<n.length&&0===n.find(".active_module").length&&n.addClass("tb_row_empty");"row"!==h&&(k=m(".tb_element_cid_"+a),n=k.closest(".module_row"),0===n.find(".active_module").length&&n.addClass("tb_row_empty"));c.hasChanged=
!0;c.undoManager.push(a,d,k,g,l);c.toolbar.pageBreakModule.countModules();c.activeModel&&c.activeModel.cid===b&&t.Lightbox.$lightbox.find(".tb_close_lightbox")[0].click()}},save(a){c.activeModel&&null!==c.autoSaveCid&&ThemifyConstructor.saveComponent(!0);const b=this.model.get("elType"),d={contructor:!0,loadMethod:"html",save:{done:"save"},data:{}},f=this.model.cid;d.data["s"+b]={options:[{id:"item_title_field",type:"text",label:ThemifyConstructor.label.title},{id:"item_layout_save",type:"checkbox",
label:"",options:[{name:"layout_part",value:ThemifyConstructor.label.slayout_part}],new_line:!1,after:"",help:'Any changes made to a Layout Part are saved and reflected everywhere else they are being used (<a href="https://themify.me/docs/builder#layout-parts" target="_blank">learn more</a>)'}]};t.Lightbox.$lightbox[0].style.display="none";t.Lightbox.open(d,function(){x.document.body.classList.add("tb_standalone_lightbox")},function(e){const h=this.$lightbox,g=function(k){if("keypress"!==k.type||
13===k.keyCode){k.preventDefault();k.stopPropagation();t.showLoader("show");k=c.Models.Registry.lookup(f);switch(b){case "row":var n=b;var l=c.Utils._getRowSettings(m(".tb_element_cid_"+f)[0]);c.Utils.clearElementId([l],!0);break;case "module":n=k.get("mod_name"),l={mod_name:n,element_id:c.Utils.generateUniqueID(),mod_settings:k.get("mod_settings")}}l=c.Utils.clear(l);var r=ThemifyStyles.builder_id;k=m.extend(c.Forms.serialize(e),{action:"tb_save_custom_item",item:JSON.stringify(l),tb_load_nonce:themifyBuilder.tb_load_nonce,
postid:r,type:b});var p=k.item_layout_save;n=c.GS.findUsedItems(l);!1!==n&&(k.usedGS=n);m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:k,success(q){if("success"===q.status){const v=function(w){m("#tb_module_panel",x.document).find(".tb_module_panel_search_text").val("");if(p){c.hasChanged=!0;var y={mod_name:"layout-part",mod_settings:{selected_layout_part:w.post_name}};delete w.status;0<ThemifyConstructor.layoutPart.data.length&&ThemifyConstructor.layoutPart.data.push(w);var B=
m(".tb_element_cid_"+f);let A,E,C=t.clone(B);"row"===b?(E=c.Views.init_row({cols:[{grid_class:"col-full first last",element_id:c.Utils.generateUniqueID(),modules:[y]}]}).view.render(),y=c.Models.Registry.lookup(E.$el.find(".active_module").data("cid"))):(y=c.Views.init_module(y),E=y.view.render(),y=y.model);B.replaceWith(E.el);if("visual"===c.mode){const G=function(O,N,J){-1!==J.data.indexOf("tb_load_module_partial",3)&&(m(this).off("ajaxComplete",G),A=c.liveStylingInstance.$liveStyledElmt,"row"===
b&&(A=A.closest(".module_row")),c.undoManager.push(E.$el.data("cid"),C,A,"row"))};m(u).ajaxComplete(G);y.trigger("custom:preview:refresh",y.get("mod_settings"))}else A=E.el,c.undoManager.push(E.$el.data("cid"),C,A,"row")}if(!0===c.toolbar.libraryItems.is_init){B=m(".tb_library_item_list");w=c.toolbar.libraryItems.template([w]);"visual"===c.mode&&(B=B.add(c.toolbar.$el.find(".tb_library_item_list")));B=B.get();for(let A=0,E=B.length;A<E;++A)B[A].insertAdjacentHTML("afterbegin",w),B[A].previousElementSibling.getElementsByClassName("current")[0].click()}t.showLoader("hide");
t.Lightbox.close()};p?(ThemifyStyles.builder_id=q.id,c.Utils.saveCss([l],"",q.id).done(function(){ThemifyStyles.builder_id=r;v(q)})):v(q)}else alert(q.msg)}})}};h.addClass("tb_save_module_lightbox");this.setStandAlone(a.clientX,a.clientY);h.on("click.saveLayout",".builder_save_button",g).on("keypress.saveLayout","input",g);z.body.one("themify_builder_lightbox_close",function(){h.removeClass("tb_save_module_lightbox").off(".saveLayout");x.document.body.classList.remove("tb_standalone_lightbox")})})}});
c.Views.BaseElement.extend=function(a){const b=this,d=H.View.extend.apply(this,arguments);d.prototype.events=Object.assign({},this.prototype.events,a.events);d.prototype.initialize=function(){"function"===typeof b.prototype.initialize&&b.prototype.initialize.apply(this,arguments);"function"===typeof a.initialize&&a.initialize.apply(this,arguments)};return d};c.Views.Modules["default"]=c.Views.BaseElement.extend({tagName:"div",attributes(){const a={"class":"active_module tb_element_cid_"+this.model.cid,
"data-cid":this.model.cid,draggable:!0},b=this.model.get("mod_settings");if("visual"===c.mode){if("hide_all"===b.visibility_all||"hide"===b.visibility_desktop||"hide"===b.visibility_tablet||"hide"===b.visibility_tablet_landscape||"hide"===b.visibility_mobile)a["class"]+=" tb_visibility_hidden";a["class"]+=" tb_module_front"}void 0!==b.custom_css_id&&""!==b.custom_css_id&&(a.id=b.custom_css_id);return a},template:"visual"===c.mode?null:wp.template("builder_module_item"),initialize(){this.listenTo(this.model,
"dom:module:unsaved",this.removeUnsaved)},removeUnsaved(){this.model.destroy()},render(){"visual"!==c.mode&&(this.el.innerHTML=this.template(this.model.toRenderData()),c.Utils.visibilityLabel(this.el,this.model));return this}});c.Views.Columns["default"]=c.Views.BaseElement.extend({tagName:"div",attributes(){const a={"class":"module_column tb_element_cid_"+this.model.cid+" tb_"+this.model.get("element_id")+" tf_box "+this.model.get("grid_class"),"data-cid":this.model.cid};this.model.get("grid_width")&&
(a.style="width:"+this.model.get("grid_width")+"%");a["class"]+="column"!==this.model.get("component_name")?" sub_column":" tb-column";return a},render(){const a=this.model.get("modules");this.el.innerHTML=t.templateCache.get("tmpl-builder_column_item");if(a){const d=this.el.getElementsByClassName("tb_holder")[0];for(let f in a)if(void 0!==a[f]&&null!==a[f]){var b=a[f];(b=void 0===b.cols?c.Views.init_module(b):c.Views.init_subrow(b))&&d.appendChild(b.view.render().el)}"sub-column"===this.model.get("component_name")&&
d.classList.add("tb_subrow_holder")}return this}});c.Views.SubRows["default"]=c.Views.BaseElement.extend({tagName:"div",attributes(){return{"class":"active_module active_subrow tb_element_cid_"+this.model.cid,"data-cid":this.model.cid,draggable:!0}},template:wp.template("builder_subrow_item"),render(){const a=this.model.get("cols"),b=Object.keys(a).length;this.el.innerHTML=this.template({element_id:this.model.get("element_id")});if(0<b){const d=this.el.getElementsByClassName("subrow_inner")[0];let f=
!1;for(let e=0;e<=b;++e)void 0!==a[e]&&null!==a[e]&&(a[e].component_name="sub-column",d.appendChild(c.Views.init_column(a[e]).view.render().el),!1===f&&void 0!==a[e].modules&&0<a[e].modules.length&&(f=!0));!1===f&&this.el.classList.add("tb_row_empty")}c.Utils.selectedGridMenu(this.el,"subrow");c.Utils.visibilityLabel(this.el,this.model);return this}});c.Views.Rows["default"]=c.Views.BaseElement.extend({tagName:"div",attributes(){const a=this.model.get("styling"),b={"class":"module_row themify_builder_row tb_element_cid_"+
this.model.cid+" tf_clearfix tf_box tb_"+this.model.get("element_id"),"data-cid":this.model.cid,draggable:!0};null!==a&&(void 0!==a.custom_css_row&&""!==a.custom_css_row&&(b["class"]+=" "+a.custom_css_row),void 0!==a.custom_css_id&&""!==a.custom_css_id&&(b.id=a.custom_css_id),"fullwidth-content"===a.row_width&&(b["class"]+=" fullwidth"));return b},render(){const a=this.model.get("cols"),b=Object.keys(a).length;let d=!1;this.el.innerHTML=t.templateCache.get("tmpl-builder_row_item");const f=this.el.getElementsByClassName("row_inner")[0];
if(0<b)for(let e=0;e<=b;++e)void 0!==a[e]&&null!==a[e]&&(a[e].component_name="column",f.appendChild(c.Views.init_column(a[e]).view.render().el),!1===d&&void 0!==a[e].modules&&(0<a[e].modules.length||"object"===typeof a[e].modules&&0<Object.keys(a[e].modules).length)&&(d=!0));else c.Utils._addNewColumn({newclass:"col-full",component:"column"},f);!1===d&&this.el.classList.add("tb_row_empty");c.Utils.selectedGridMenu(this.el,"row");c.Utils.visibilityLabel(this.el,this.model);return this}});c.Views.Builder=
H.View.extend({type:"default",lastRow:null,events:{"click .tb_import_layout_button":"importLayoutButton"},initialize(){this.$el.off("tb_init tb_new_row").on("tb_init",this.init.bind(this)).on("tb_init",this.newRowAvailable.bind(this))},init(a){"visual"===c.mode&&setTimeout(function(){c.Utils._onResize(!0)},1500);const b=this;setTimeout(function(){c.ActionBar.init();c.Utils.setCompactMode(b.el.getElementsByClassName("module_column"));b.insertLayoutButton();"visual"!==c.mode&&c.GS.init()},1E3);Y={}},
render(){const a=this.collection;c.Utils.clearLastEmptyRow(a.models);for(let b=0,d=a.models.length;b<d;++b){let f=c.Views.init_row(a.models[b]);!1!==f&&this.el.appendChild(f.view.render().el)}return this},insertLayoutButton(){this.removeLayoutButton();this.lastRowAddBtn();var a=this.el.getElementsByClassName("module_row");void 0!==a[0]&&2>a.length&&a[0].classList.contains("tb_row_empty")&&(a=u.createElement("a"),a.className="tb_import_layout_button",a.href="#",a.textContent=themifyBuilder.i18n.text_import_layout_button,
this.el.appendChild(a))},removeLayoutButton(){const a=this.el.getElementsByClassName("tb_import_layout_button");for(let b=a.length-1;-1<b;--b)a[b].parentNode.removeChild(a[b])},importLayoutButton(a){c.Views.Toolbar.prototype.loadLayout(a)},newRowAvailable(a,b){const d=this.el.children,f=d.length;let e=!0;if(0!==f&&!0!==b)for(b=f-1;-1<b;--b)if(d[b].classList.contains("module_row")){e=!1;break}if(!0===e)return a=c.Views.init_row(c.Utils.grid(a||1)[0]).view.render().$el,a[0].className+=" tb_new_row",
this.el.insertBefore(a[0],this.lastRow),c.Utils.setCompactMode(a[0].getElementsByClassName("module_column")),c.Utils.runJs(a,"row"),c.Utils.calculateHeight(),a},lastRowShowHide(a){this.lastRow&&(a?this.lastRow.classList.remove("hide"):(this.lastRow.classList.remove("expanded"),this.lastRow.classList.add("hide")))},lastRowAddBtn(){if(!0!==c.GS.isGSPage){var a=u.getElementById("tb_add_container"),b=u.createElement("div");null!==a&&a.parentNode.removeChild(a);this.lastRow=u.createElement("div");var d=
null;this.lastRow.id="tb_add_container";b.className="tb_last_add_btn";b.textContent="+";this.lastRow.addEventListener("click",function(f){f.preventDefault();const e=f.target,h=e.closest(".tb_row_grid");null!==h?(this.classList.remove("expanded"),c.Mixins.Builder.rowDrop(c.Utils.grid(h.dataset.col),m("<div>").insertBefore(this),!0,!0)):e.classList.contains("tb_add_blocks")?(this.classList.remove("expanded"),c.toolbar.common.show(f,m(this).find(".tb_last_add_btn")),c.toolbar.common.clicked=this.previousElementSibling?
m(this.previousElementSibling):null,c.toolbar.common.btn[0].querySelector('[data-target="tb_module_panel_rows_wrap"]').click()):e.classList.contains("tb_last_add_btn")&&(null===d&&(d=!0,this.appendChild(u.getElementById("tmpl-last_row_add_btn").content.cloneNode(!0))),this.classList.add("expanded"))});this.lastRow.appendChild(b);this.el.appendChild(this.lastRow)}}});c.Mixins.Builder={before:null,zindex:null,r:null,w:null,h:null,type:null,isFullWidth:null,columnDrag(a,b,d,f){if(b)if(b instanceof jQuery&&
(b=b.get()),a=b.length,d&&f)for(d=parseFloat((("gutter-narrow"===d?1.6:"gutter-none"===d?0:3.2)-("gutter-narrow"===f?1.6:"gutter-none"===f?0:3.2))*(a-1)/a),f=a-1;-1<f;--f)(a=b[f].style.width)&&(b[f].style.width=parseFloat(a)+d+"%");else{for(d=a-1;-1<d;--d)b[d].style.width="";c.Utils.setCompactMode(b)}else{a.stopPropagation();c.ActionBar.clear();c.ActionBar.disable=!0;c.ActionBar.hoverCid=null;var e,h=!1,g=z.body[0].classList,k=a.target,n=c.Utils.getMouseEvents(),l=k.parentNode,r=k.classList.contains("tb_drag_right")?
"w":"e",p=a.clientX,q=u.createElement("div"),v=u.createElement("div"),w=t.clone(l.closest(".module_row")),y=l.parentNode;b=y.classList.contains("direction-rtl");var B=y.offsetWidth;q.className=v.className="tb_grid_drag_tooltip";k.classList.add("tb_drag_grid_current");l.classList.add("tb_element_clicked");g.add("tb_start_animate","tb_drag_grid_start");if("w"===r){q.className+=" tb_grid_drag_right_tooltip";v.className+=" tb_grid_drag_left_tooltip";var A=b?l.previousElementSibling:l.nextElementSibling;
var E=l.offsetWidth;var C=E+k.offsetWidth}else q.className+=" tb_grid_drag_left_tooltip",v.className+=" tb_grid_drag_right_tooltip",A=b?l.nextElementSibling:l.previousElementSibling,E=C=l.offsetWidth;l.style.willChange=A.style.willChange="width";var G=function(N){N.stopImmediatePropagation();e&&cancelAnimationFrame(e);e=requestAnimationFrame(function(){h=!0;var J=parseInt(N.clientX)-p;J=C+("e"===r?-J:J);const K=parseFloat(100*J/B).toFixed(2);if(5<=K&&100>K){let M=O;M+="w"===r?-(J-E):E-J;const R=parseFloat(100*
M/B).toFixed(2);5<R&&100>R&&(A.style.width=M+"px",l.style.width=J+"px",q.textContent=K+"%",v.textContent=R+"%")}})};u.addEventListener(n.mouseup,function(N){N.stopImmediatePropagation();this.removeEventListener(n.mousemove,G,{passive:!0});e&&cancelAnimationFrame(e);l.style.willChange=A.style.willChange="";requestAnimationFrame(function(){h&&(l.style.width=parseFloat(q.textContent).toFixed(2)+"%");q.remove();v.remove();l.classList.remove("tb_element_clicked");k.classList.remove("tb_drag_grid_current");
c.ActionBar.disable=null;c.ActionBar.clear();g.remove("tb_start_animate","tb_drag_grid_start");if(h){var J={default:{"col6-1":14,"col5-1":17.44,"col4-1":22.6,"col4-2":48.4,"col2-1":48.4,"col4-3":74.2,"col3-1":31.2,"col3-2":65.6},narrow:{"col6-1":15.33,"col5-1":18.72,"col4-1":23.8,"col4-2":49.2,"col2-1":49.2,"col4-3":74.539,"col3-1":32.266,"col3-2":66.05},none:{"col6-1":16.666,"col5-1":20,"col4-1":25,"col4-2":50,"col2-1":50,"col4-3":75,"col3-1":33.333,"col3-2":66.666}},K=y.children,M=3.2,R=J["default"];
y.classList.contains("gutter-narrow")?(R=J.narrow,M/=2):y.classList.contains("gutter-none")&&(R=J.none,M=0);J=M*(K.length-1);for(M=K.length-1;-1<M;--M)if(K[M]!==A){var P=K[M].style.width;P?P=parseFloat(P):(P=c.Utils.filterClass(K[M].className),P=R[P]);J+=P}A.style.width=100-J+"%";c.Utils.setCompactMode([l,A]);K=m(l.closest(".module_row"));R=!0===c.hasChanged;c.hasChanged=!0;c.undoManager.push(K.data("cid"),w,K,"row");c.hasChanged=R;z.body.triggerHandler("tb_grid_changed",[K])}h=e=O=A=E=C=null})},
{once:!0,passive:!0});if(A){var O=parseInt(A.offsetWidth)-2;k.appendChild(q);k.appendChild(v);u.addEventListener(n.mousemove,G,{passive:!0})}}},updateModuleSort(a){if(!0!==c.GS.isGSPage){var b=this,d=c.Utils.getMouseEvents(),f;a.addEventListener(d.mousedown,function(e){1!==e.which||e.target.closest(".tb_dragger,.tb_disable_sorting,.tb_editor_on")?f=null:(f=e.target,f.classList.contains("tb_grid_drag")&&b.columnDrag(e))},{passive:!0});a.addEventListener("dragstart",function(e){let h=e.target&&f?e.target.closest("[draggable]"):
null,g=h&&h.classList.contains("module_row");if("visual"===c.mode){if(!e.target||e.target.nodeType===Node.TEXT_NODE||e.target.closest(".tb_editor_on"))return;h&&"desktop"!==c.activeBreakPoint&&h.classList.contains("active_module")&&(h=null)}if(!h||h.classList.contains("tb_grid_drag")||h.classList.contains("tb_dragger")||!f.classList.contains("tb_move")&&f.closest("#"+c.ActionBar.el.id)||!f.classList.contains("tb_move")&&(g||h.classList.contains("active_subrow")))if(!h||!g||!h.classList.contains("tb-page-break"))return f=
null,e.preventDefault(),!1;f=null;e.stopImmediatePropagation();let k=h.classList;g||(g=k.contains("tb_page_break_module")||k.contains("predesigned_row")||k.contains("tb_item_row"));let n,l,r=null,p=g?"row":k.contains("tb_row_grid")?"column":"module",q=p,v=h.closest(".module_row"),w=z.body[0],y=0,B=0,A,E,C,G=null,O=null,N=c.toolbar.$el,J=c.Instances.Builder[c.builderIndex].el,K=u.createElement("div");N=N.add(m("#tb_fixed_bottom_scroll",x.document));const M=g&&k.contains("module_row"),R=function(D){function L(X){if(null===
O&&G){O=!0;let Q;Q=("tb_toolbar"===X||"wpadminbar"===X?"-":"+")+("="+T*V+"px");G.stop().animate({scrollTop:Q},{duration:10,complete(){!0===O&&(O=null,L(X))}})}}let F=m("body",x.document);"visual"===c.mode&&(F=F.add(w));C&&clearInterval(C);N.off(".tb_drag");if(!0===D)"row"===q&&"visual"===c.mode&&c.toolbar.$el.find('.tb_zoom[data-zoom="100"]').click(),F.removeClass("tb_start_animate tb_drag_start tb_drag_"+q),N=O=C=G=null;else{var T=1,V=5;"visual"!==c.mode&&(G=c.toolbar.$el.closest(".interface-interface-skeleton__content"),
G[0]||(G=m(".edit-post-layout__content").first()),G[0]?T/=2:G=null);null===G&&(G="desktop"===c.activeBreakPoint?m("body,html"):m("body,html",x.document));F.addClass("tb_start_animate tb_drag_start tb_drag_"+q);"row"===q&&"visual"===c.mode&&c.toolbar.$el.find('.tb_zoom[data-zoom="50"]').click();if(0<T)N.on("dragenter.tb_drag",function(){C&&clearInterval(C);V=5;C=setInterval(function(){51>V?V+=5:(clearInterval(C),C=null)},1200);A=null;null!==r&&(r.style.display="none");for(let X=J.querySelectorAll("[data-pos]"),
Q=X.length-1;-1<Q;--Q)X[Q].removeAttribute("data-pos");L(this.id)}).on("dragleave.tb_drag",function(){C&&clearInterval(C);V=5;O=C=null;G.stop()})}},P=function(D){D.dataTransfer.dropEffect=D.dataTransfer.effectAllowed="none";A&&A.removeAttribute("data-pos");null!==r&&(r.style.display="none")},Z=function(D){D.preventDefault();D.stopImmediatePropagation();n&&(n.style.top=D.clientY-l+"px");if(!D.target||null!==O||D.target===w||D.target===h||"module"===p&&D.target.classList.contains("module_row"))P(D);
else if(null===r||D.target!==r&&!D.target.classList.contains("tb_sortable_placeholder"))if(D.dataTransfer.effectAllowed="move",0===y||0===B||10<D.clientY-y||10<y-D.clientY||10<D.clientX-B||10<B-D.clientX||D.target!==A){y=D.clientY;B=D.clientX;let F=D.target;var L=F.getBoundingClientRect();L=.5<(y-L.top)/L.height?"bottom":"top";if(F!==N[0]&&F!==N[1]){if(!n){if(F.classList.contains("module_column")){if(F=F.getElementsByClassName("tb_holder")[0],!F){P(D);return}}else F.classList.contains("tb_dragger")&&
(F=F.parentNode);if(F.classList.contains("tb_holder")&&0<F.childElementCount&&(F="top"===L&&F.firstChild!==h?F.firstChild:F.lastChild,F===h)){P(D);return}}if(A&&A!==F){D="top"===L?F.previousSibling:F.nextElementSibling;if(D===A&&(D=D.dataset.pos,"top"===L&&"bottom"===D||"bottom"===L&&"top"===D))return;A.removeAttribute("data-pos")}F.dataset.pos!==L&&(F.setAttribute("data-pos",L),null!==r&&(r.style.display="",F.classList.contains("tb_holder")?F.appendChild(r):"top"===L?F.before(r):F.after(r)));A=F}}},
ca=function(D){D.stopImmediatePropagation();c.ActionBar.clear();c.ActionBar.disable=!0;c.ActionBar.hoverCid=null;c.toolbar.common.hide(!0);this.classList.add("tb_draggable_item");R();n&&(n.style.top=D.clientY+"px")},U=function(D){D.stopImmediatePropagation()},ea=function(D){D.target&&(D.preventDefault(),D.stopImmediatePropagation());E=c.hasChanged=!0;h.classList.remove("tb_draggable_item");var L=!0,F=D.target?D.target:D;F.classList.contains("module_column")?F=F.querySelector("[data-pos]"):F.classList.contains("tb_dragger")&&
(F=F.closest("[draggable]"));if(F===r||F.classList.contains("tb_sortable_placeholder"))F=F.closest(".tb_active_builder").querySelector("[data-pos]"),F.classList.contains("tb_sortable_placeholder")&&(F=F.closest(".tb_holder"));r&&r.remove();if(F&&("module"!==p||!F.classList.contains("module_row"))){D=v?h:h.cloneNode(!0);var T=h.closest(".active_subrow"),V=h.closest(".module_row");M&&(v=m(h).next(".module_row"),0===v.length&&(v=m(h).prev(".module_row"),L=!1),v=v.data("cid"));if(F.classList.contains("tb_holder"))F.appendChild(D);
else{const Q="top"===F.getAttribute("data-pos")?F:F.nextElementSibling;F.parentNode.insertBefore(D,Q)}var X=m(D);if(g)if("visual"===c.mode&&("desktop"===c.activeBreakPoint?m("html,body"):m("body",x.document)).scrollTop(m(h).offset().top),M)T=m(h).next(".module_row"),V=!0,0===T.length&&(T=m(h).prev(".module_row"),L=V=!1),T=T.data("cid"),c.undoManager.push(h.dataset.cid,null,null,"row_sort",{bnext:L,before:v,anext:V,after:T});else{if(k.contains("predesigned_row")||k.contains("tb_page_break_module")||
"row"===h.dataset.type)"row"===h.dataset.type?c.toolbar.libraryItems.get(h.dataset.id,"row",function(Q){if(!Array.isArray(Q)){Q=Array(Q);const da=c.GS.findUsedItems(Q);!1!==da&&da.length&&(Q[0].used_gs=da)}b.rowDrop(Q,X)}):k.contains("tb_page_break_module")?(b.rowDrop(c.toolbar.pageBreakModule.get(),X),c.toolbar.pageBreakModule.countModules()):c.toolbar.preDesignedRows.get(h.dataset.slug,function(Q){b.rowDrop(Q,X)})}else L=F.closest(".module_row"),"module"===p&&((F=F.closest(".tb_row_empty"))&&F.classList.remove("tb_row_empty"),
L.classList.remove("tb_row_empty"),v&&(T&&T.classList.toggle("tb_row_empty",!T.querySelector(".active_module")),V&&V.classList.toggle("tb_row_empty",!V.querySelector(".active_module")))),v?c.undoManager.push(D.dataset.cid,v,L,"sort",{before:v.dataset.cid,after:L.dataset.cid}):b.moduleDrop(m(D),!1,t.clone(L));z.body.triggerHandler("tb_"+p+"_sort",[D])}};K.className="tb_sortable_helper tf_box tf_overflow";v&&(v=t.clone(v)[0]);k.contains("active_subrow")&&(q+=" tb_drag_subrow");if(M){n=K.cloneNode();
K.style.opacity=0;if("visual"!==c.mode){var W=h.getBoundingClientRect();n.style.width=W.width+"px";n.style.left=W.left+"px"}u.body.appendChild(n);l=n.offsetHeight/2}else if("module"===p)if(k.contains("active_subrow"))K.innerHTML="Subrow";else{W=h.getAttribute("data-module-slug");if(!W){var aa=c.Models.Registry.lookup(h.getAttribute("data-cid"));aa&&"module"===aa.get("elType")&&(W=aa.get("mod_name"))}if(W&&themifyBuilder.modules[W]){aa=themifyBuilder.modules[W].icon;const D=u.createElement("span");
D.textContent=themifyBuilder.modules[W].name;D.className="tf_vmiddle";aa&&K.appendChild(c.Utils.getIcon("ti-"+aa));K.appendChild(D)}}else"column"===p?(K.className+=" "+h.className,K.innerHTML='<div class="tb_row_grid_title"></div>'):"row"===p&&(k.contains("tb_page_break_module")||k.contains("predesigned_row"))&&(W=k.contains("tb_page_break_module")?"tb_page_break_title":"tb_predesigned_rows_title",K.textContent=h.getElementsByClassName(W)[0].textContent);if("visual"!==c.mode||g)r=u.createElement("div"),
r.className="tb_sortable_placeholder tf_rel tf_w";u.body.appendChild(K);e.dataTransfer.setDragImage(K,K.offsetWidth/2+2,K.offsetHeight/2);h.addEventListener("dragend",function(D){D.stopImmediatePropagation();z.body[0].removeEventListener("dragover",Z);J.removeEventListener("drop",ea,{once:!0});J.removeEventListener("mousemove",U,{passive:!0});J.removeEventListener("mouseover",U,{passive:!0});J.removeEventListener("mouseout",U,{passive:!0});J.removeEventListener("mouseenter",U,{passive:!0});J.removeEventListener("mouseleave",
U,{passive:!0});this.removeEventListener("drag",ca,{once:!0,passive:!0});E||(D=J.querySelector("[data-pos]"))&&ea(D);K.remove();M&&n.remove();r&&r.remove();D=u.querySelectorAll("[data-pos]");for(let L=D.length-1;-1<L;--L)D[L].removeAttribute("data-pos");this.classList.remove("tb_draggable_item");R(!0);"visual"!==c.mode&&m(".is-drop-target").removeClass("is-drop-target");c.ActionBar.disable=r=E=f=h=k=A=K=n=l=w=J=B=y=q=p=v=null;c.ActionBar.clear()},{once:!0,passive:!0});h.addEventListener("drag",ca,
{once:!0,passive:!0});J.addEventListener("drop",ea,{once:!0});z.body[0].addEventListener("dragover",Z);J.addEventListener("mousemove",U,{passive:!0});J.addEventListener("mouseover",U,{passive:!0});J.addEventListener("mouseout",U,{passive:!0});J.addEventListener("mouseenter",U,{passive:!0});J.addEventListener("mouseleave",U,{passive:!0})})}},subRowDrop(a,b){c.ActionBar.clear();const d=0<b.parent(".themify_builder_content,#tb_row_wrapper").length;if(d||0===b.closest(".sub_column").length){a=c.Utils.grid(a);
let f,e,h;d||(f=t.clone(b.closest(".module_row")),f.find(".tb_row_grid").remove(),e="row");a=(d?c.Views.init_row({cols:a[0].cols}):c.Views.init_subrow({cols:a[0].cols})).view.render().$el;if(d||b[0].parentNode.classList.contains("tb_holder")||b[0].parentNode.parentNode.classList.contains("tb_holder"))b[0].parentNode.replaceChild(a[0],b[0]),a[0].className+=" tb_element_clicked",c.ActionBar.type="subrow";else{let g=b.next(".tb_holder");0<g.length?g.prepend(a):(g=b.prev(".tb_holder"),g.append(a))}d&&
(f=a.next(".module_row"),h=!0,0===f.length&&(h=!1,f=a.prev(".module_row")),f=f.data("cid"),e="grid_sort");c.Utils.setCompactMode(a[0].getElementsByClassName("module_column"));c.Utils.runJs(a);b.remove();c.hasChanged=!0;b=a.closest(".module_row");d||b.removeClass("tb_row_empty");b.find(".tb_row_grid").remove();c.Utils.scrollToDropped(a[0]);c.undoManager.push(b.data("cid"),f,b,e,{next:h})}else b.remove()},rowDrop(a,b,d,f){c.ActionBar.clear();const e=u.createDocumentFragment(),h=[],g=[],k=function(l){for(let r in l)if(l[r].styling&&
0<Object.keys(l[r].styling).length||l[r].modules&&0<Object.keys(l[r].modules).length)return!0;return!1},n=function(){var l=b.prev(".module_row");let r;0===l.length?(r="visual"===c.mode?b.closest(".themify_builder_content").data("postid"):null,l=!1):l=l.data("cid");b[0].innerHTML="";c.ActionBar.type="row";b[0].parentNode.replaceChild(e,b[0]);c.hasChanged=!0;c.Instances.Builder[c.builderIndex].removeLayoutButton();c.undoManager.push("","","","predesign",{prev:l,rows:h,bid:r});for(let p=0,q=h.length;p<
q;++p)l=h[p][0].getElementsByClassName("module_column"),0===p&&h[p][0].classList.add("tb_element_clicked"),c.Utils.setCompactMode(l),c.Utils.runJs(h[p]);c.Utils.scrollToDropped(h[0][0]);t.showLoader("hide");c.Utils.calculateHeight()};f||c.Utils.clearLastEmptyRow(a);for(let l=0,r=a.length;l<r;++l)if(!0===d||a[l].styling&&0<Object.keys(a[l].styling).length||a[l].cols&&k(a[l].cols))if(f=c.Views.init_row(a[l]),!1!==f){f=f.view.render();e.appendChild(f.el);if("visual"===c.mode){let p=f.el.querySelectorAll("[data-cid]");
g[f.el.dataset.cid]=1;for(let q=p.length-1;-1<q;--q)g[p[q].dataset.cid]=1}h.push(f.$el)}"visual"===c.mode?c.bootstrap(g,n):n()},moduleDrop(a,b,d){function f(k){function n(p){g||l.model.set({is_new:1},{silent:!0});p=!0===p?l.model.getPreviewSettings():l.model.get("mod_settings");let q=!1;b?b.hasClass("tb_module_front")?b.after(r.el):b.append(r.el):a.replaceWith(r.el);g?c.activeModel=l.model:l.model.trigger("edit",null);c.hasChanged=!0;if("visual"===c.mode&&"layout-part"!==l.model.get("mod_name")&&
1<=Object.keys(p).length){var v=p.cid;"part"===h||"ajax"===a.data("type")?(q=!0,l.model.trigger("custom:preview:refresh",p)):"module"!==h?l.model.trigger("custom:preview:live",p):c.Utils.runJs(r.$el,"module")}g&&(q&&(p=l.view.$el.find(".tb_preview_component").detach(),l.view.el.prepend(p)),d&&(v=r.$el.closest(".module_row"),v.removeClass("tb_row_empty").find(".tb_module_dragging_helper").remove(),r.$el.closest(".active_subrow").removeClass("tb_row_empty"),p=d[0].getElementsByClassName("tb_library_item"),
p[0]&&p[0].remove(),c.undoManager.push(v.data("cid"),d,v,"row"),v=v.data("cid"),c.Instances.Builder[c.builderIndex].removeLayoutButton(),c.activeModel=null),c.Utils.calculateHeight());c.Utils.scrollToDropped(null,v)}const l=c.Views.init_module(k,!0),r=l.view.render();"visual"===c.mode&&g?(k=[],k[l.model.cid]=1,c.bootstrap(k,n)):n(!0);return r}c.ActionBar.clear();const e={mod_name:a.data("module-slug")},h=a.data("type"),g="part"===h||"module"===h;if(a[0].classList.contains("tb_row_grid"))this.subRowDrop(a.data("slug"),
a);else{if(g)c.toolbar.libraryItems.get(a.data("id"),h,f);else return f(e);"visual"!==c.mode&&m(".themify-wp-editor-holder").addClass("themify-active-holder")}},toJSON(a){const b=[];a=a.children;for(let d=0,f=a.length;d<f;++d)if(a[d].classList.contains("module_row")){let e=c.Utils._getRowSettings(a[d]);0<Object.keys(e).length&&b.push(e)}return b},columnHover(a){var b=a.closest(".sub_column"),d=c.Instances.Builder[c.builderIndex].el,f=d.getElementsByClassName("tb_hover_sub_column"),e=a.closest(".tb_action_wrap");
for(var h=f.length-1;-1<h;--h)f[h].classList.remove("tb_hover_sub_column");f=d.getElementsByClassName("tb_action_overlap");for(h=f.length-1;-1<h;--h)f[h].classList.remove("tb_action_overlap");f=d.getElementsByClassName("active_action_bar");for(d=f.length-1;-1<d;--d)f[d].classList.remove("active_action_bar");null!==e&&(e=e.closest(".active_module"),null!==e&&e.classList.add("active_action_bar"));null!==b&&(h=b.parentNode.closest(".module_column"),h.classList.contains("tb_hover_sub_column")||(h.classList.add("tb_hover_sub_column"),
f=b.getElementsByClassName("tb_column_action")[0],void 0!==f&&(e=f.getBoundingClientRect(),d=!0,h=5>e.left?h.closest(".module_row").getElementsByClassName("tb_row_action")[0]:b.closest(".module_subrow").getElementsByClassName("tb_subrow_action")[0],void 0!==h&&(d=h.getBoundingClientRect(),d=Math.abs(e.left-d.left)<e.width?Math.abs(d.top-e.top)>e.height:!0),f.classList.toggle("tb_action_overlap",!1===d))));!0!==this.isFullWidth&&(b=null!==b?b.parentNode.closest(".module_column"):a.closest(".module_column"),
!1!==this.isFullWidth&&(a=null!==b?b.closest(".module_row"):a.closest(".module_row"),null!==a&&(this.isFullWidth=a.offsetWidth<u.body.clientWidth,u.body.classList.toggle("tb_page_row_fullwidth",!this.isFullWidth))),null!==b&&null!==b.parentNode.parentNode.closest(".fullwidth")&&(a=b.getElementsByClassName("tb_column_action")[0],void 0!==a&&a.getBoundingClientRect().right>=u.body.clientWidth&&a.classList.add("tb_action_outside")))}};c.undoManager={stack:[],is_working:!1,index:-1,btnUndo:null,btnRedo:null,
compactBtn:null,init(){this.btnUndo=c.toolbar.el.getElementsByClassName("tb_undo_btn")[0];this.btnRedo=c.toolbar.el.getElementsByClassName("tb_redo_btn")[0];this.compactBtn=c.toolbar.el.getElementsByClassName("tb_compact_undo")[0];c.toolbar.$el.find(".tb_undo_redo").on("click",this.do_change.bind(this));themifyBuilder.disableShortcuts||(x.document.addEventListener("keydown",this.keypres.bind(this)),"visual"===c.mode&&u.addEventListener("keydown",this.keypres.bind(this)))},push(a,b,d,f,e){c.hasChanged&&
(c.editing=!1,d&&d instanceof HTMLElement&&(d=t.clone(d)),"visual"!==c.mode||"duplicate"!==f&&"sort"!==f||z.trigger("tfsmartresize"),this.stack.splice(this.index+1,this.stack.length-this.index),this.stack.push({cid:a,type:f,data:e,before:b,after:d}),this.index=this.stack.length-1,this.updateUndoBtns(),"visual"===c.mode&&(c.Forms.LayoutPart.isSaved=null,z.body.triggerHandler("builder_dom_changed",[f])))},set(a){let b=a[0].querySelectorAll("[data-cid]");b=Array.prototype.slice.call(b);b.unshift(a[0]);
for(a=b.length-1;-1<a;--a){let d=c.Models.Registry.lookup(b[a].getAttribute("data-cid"));d&&d.trigger("change:view",b[a])}},doScroll(a){return a},keypres(a){if(!0===a.ctrlKey||!0===a.metaKey){const b=u.activeElement.tagName,d=x.document.activeElement.tagName,f=a.which;"INPUT"!==b&&"TEXTAREA"!==b&&"INPUT"!==d&&"TEXTAREA"!==d&&(89===f||90===f&&!0===a.shiftKey?(a.preventDefault(),this.hasRedo()&&this.changes(!1)):90===f&&(a.preventDefault(),this.hasUndo()&&this.changes(!0)))}},changes(a){c.ActionBar.clearClicked();
var b=a?0:1;if(null!==c.activeModel&&("visual"!==c.mode||!u.activeElement.contentEditable&&c.liveStylingInstance.$liveStyledElmt[0].contains(u.activeElement))){if(!0===c.hasChanged){ThemifyConstructor.saveComponent(!1);m(this.btnUndo).triggerHandler("click");return}t.Lightbox.close()}b=this.stack[this.index+b];if(void 0!==b){this.is_working=!0;let n="",l=b.type;var d=m(".tb_element_cid_"+b.cid);let r=!1;c.eventName=l;if("row"===l)a?(n=t.clone(b.before),r=b.cid):(n=t.clone(b.after),r=b.before.data("cid"),
d=m(".tb_element_cid_"+r)),this.doScroll(d),this.set(n),n.toggleClass("tb_row_empty",0===n.find(".active_module").length),d.replaceWith(n);else if("duplicate"===l)a?this.doScroll(m(".tb_element_cid_"+b.after.data("cid"))).remove():(this.doScroll(d),n=t.clone(b.after),r=b.before.data("cid"),this.set(n),d.after(n));else if("delete_row"===l)a?(n=t.clone(b.before),r=b.cid,d=m(".tb_element_cid_"+b.data.pos_cid),this.doScroll(d),this.set(n),"after"===b.data.pos?d.after(n):d.before(n)):this.doScroll(d).remove();
else if("sort"===l){r=b.cid;a?(d=b.data.before,n=t.clone(b.before)):(d=b.data.after,n=t.clone(b.after));this.doScroll(n);this.set(n);var f=m(".tb_element_cid_"+r).closest(".module_row");m(".tb_element_cid_"+r).remove();f.toggleClass("tb_row_empty",0===f.find(".active_module").length);m(".tb_element_cid_"+d).replaceWith(n);d=n.closest(".module_row");d.toggleClass("tb_row_empty",0===d.find(".active_module").length)}else if("row_sort"===l){r=b.cid;d=b.data[a?"bnext":"anext"];f=m(".tb_element_cid_"+b.data[a?
"before":"after"]);var e=m(".tb_element_cid_"+r);n=t.clone(e);e.remove();this.set(n);d?f.before(n):f.after(n);this.doScroll(n)}else if("save"===l){r=b.cid;f=c.Models.Registry.lookup(r);var h="module"===f.get("elType");e=h?"mod_settings":"styling";if(h&&b.data.column)a?(f=m(".tb_element_cid_"+r).closest(".module_row"),r=!1,this.doScroll(d).remove()):(r=b.data.column.data("cid"),n=t.clone(b.data.column),d=m(".tb_element_cid_"+r),this.doScroll(d),this.set(n),d.replaceWith(n),f=n.closest(".module_row")),
f.toggleClass("tb_row_empty",0===f.find(".active_module").length),f=null;else{this.doScroll(d);h={};a?(n=t.clone(b.before),h[e]=b.data.bsettings):(n=t.clone(b.after),h[e]=b.data.asettings);if("visual"===c.mode){const p=m.extend(!0,{},b.data.styles);for(var g in p){var k=ThemifyStyles.getSheet(g);k=k.cssRules?k.cssRules:k.rules;for(let q in p[g])if(k[q])for(let v in p[g][q])k[q].style["backgroundClip"===v||"background-clip"===v?"WebkitBackgroundClip":v]=a?p[g][q][v].b:p[g][q][v].a}g=c.activeModel;
e=void 0!==h[e][c.GS.key]?h[e][c.GS.key].split(" "):[];c.activeModel=f;c.GS.liveInstance=null;c.GS.generateValues(null,e,!0);c.activeModel=g;c.GS.liveInstance=null}f.set(h,{silent:!0});this.set(n);d.replaceWith(n)}}else if("inline"===l)b.data.innerHTML=a?b.before:b.after,z.triggerEvent(b.data,"change");else if("predesign"===l)if(d=b.data.rows,a){this.doScroll(m(".tb_element_cid_"+d[0].data("cid")));for(let p=0,q=d.length;p<q;++p)m(".tb_element_cid_"+d[p].data("cid")).remove()}else{d=u.createDocumentFragment();
f=[];for(let p=0,q=f.length;p<q;++p)e=t.clone(f[p]),d.appendChild(e[0]),f.push(e);!1!==b.data.prev?this.doScroll(m(".tb_element_cid_"+b.data.prev)).after(d):this.doScroll("visual"===c.mode?m("#themify_builder_content-"+b.data.bid):m("#tb_row_wrapper")).prepend(d);for(let p=0,q=f.length;p<q;++p)this.set(f[p]),c.Utils.runJs(f[p])}else if("import"===l){d=m('[data-postid="'+b.data.bid+'"]');f=t.clone(a?b.data.before:b.data.after);const p=this;d.children().remove();d.prepend(f);f.each(function(){p.set(m(this))})}else"grid_sort"===
l&&(a?m(".tb_element_cid_"+b.cid).remove():(d=m(".tb_element_cid_"+b.before),f=t.clone(b.after),r=b.cid,b.data.next?d.before(f):d.after(f),this.set(f)));r&&"inline"!==l&&(c.ActionBar.hoverCid=null,c.Utils.runJs(m(n)));a?--this.index:++this.index;z.trigger("undo",[n,l,a,b]);this.is_working=!1;this.updateUndoBtns();"inline"!==l&&c.toolbar.pageBreakModule.countModules();c.Utils.calculateHeight()}},hasRedo(){return this.index<this.stack.length-1},hasUndo(){return-1!==this.index},disable(){this.btnUndo.classList.add("tb_disabled");
this.btnRedo.classList.add("tb_disabled");this.compactBtn.classList.add("tb_disabled")},updateUndoBtns(){const a=this.hasUndo(),b=this.hasRedo();this.btnUndo.classList.toggle("tb_disabled",!a);this.btnRedo.classList.toggle("tb_disabled",!b);this.compactBtn.classList.toggle("tb_disabled",!(a||b))},reset(){this.stack=[];this.index=-1;this.updateUndoBtns()},do_change(a){a.preventDefault();a.stopPropagation();!1!==this.is_working||a.currentTarget.classList.contains("tb_disabled")||this.changes(a.currentTarget.classList.contains("tb_undo_btn"))}};
c.Views.Toolbar=H.View.extend({events:{"click .tb_import":"import","click .tb_load_layout":"loadLayout","click .tb_save_layout":"saveLayout","click .tb_dup_link":"duplicate","click .tb_toolbar_save":"save","click .tb_toolbar_backend_edit a":"save","click .tb_toolbar_close_btn":"panelClose","click .tb_breakpoint_switcher":"breakpointSwitcher","click .tb_popular_devices li":"deviceSwitcher","change .tb_change_mode input":"modChange","click .tb_float_minimize":"minimize","click .tb_float_close":"closeFloat",
"click .tb_toolbar_add_modules":"openFloat","click .tb_custom_css":"addCustomCSS","click .tb_zoom":"zoom","click .tb_toolbar_zoom_menu_toggle":"zoom","click .tb_toolbar_builder_preview":"previewBuilder","click .js-tb_module_panel_acc":"toggleAccordion"},lightboxStorageKey:"tb_module_panel",render(){const a=this;var b={},d=1;for(var f in themifyBuilder.modules){var e=u.createElement("div"),h=u.createElement("span");let g=u.createElement("span"),k=u.createElement("a"),n=themifyBuilder.modules[f].icon;
e.className="tb_module tb-module-"+f;e.dataset.categories=themifyBuilder.modules[f].category;themifyBuilder.modules[f].favorite&&(e.className+=" favorited");h.className="tb_favorite tb_disable_sorting";g.className="module_name";g.textContent=themifyBuilder.modules[f].name;k.href="#";k.className="tf_plus_icon add_module_btn tb_disable_sorting";k.dataset.type="module";k.title=themifyBuilder.i18n.add_module;e.dataset.moduleSlug=f;e.dataset.index=d++;e.draggable=!0;themifyBuilder.modules[f].type&&(e.dataset.type=
themifyBuilder.modules[f].type);h.appendChild(c.Utils.getIcon("ti-star"));n&&e.appendChild(c.Utils.getIcon("ti-"+n));e.appendChild(h);e.appendChild(g);e.appendChild(k);h=themifyBuilder.modules[f].favorite?["favorite"]:themifyBuilder.modules[f].category;for(let l=0,r=h.length;l<r;++l)void 0===b[h[l]]&&(b[h[l]]=u.createDocumentFragment()),b[h[l]].appendChild(e.cloneNode(!0))}d=this.el.getElementsByClassName("tb_module_category_content");for(f=d.length-1;-1<f;--f)if(e=d[f].getAttribute("data-category"))void 0!==
b[e]?d[f].appendChild(b[e]):d[f].parentNode.style.display="none";"visual"===c.mode&&x.document.body.appendChild(this.el);b=function(){a.Panel.init();c.undoManager.init();a.preDesignedRows.init();a.libraryItems.init();a.common.init();a.darkMode();a.inlineEditorMode();setTimeout(function(){a.setMode();a.help.init();setTimeout(function(){a.Revisions.init();if("visual"===c.mode){const g=u.createElement("div");for(let k=6;1<k;--k){let n=u.createElement("div");n.className+="tb_row_grid tb_row_grid_"+k;
n.innerHTML='<div class="tb_row_grid_title"></div>';g.appendChild(n)}g.className="tf_abs";g.style.visibility="hidden";u.body.appendChild(g);setTimeout(function(){g.remove()},500);a.$el.on("click",".tb_favorite",a.toggleFavoriteModule);a.unload()}z.body.on("click",".tb_favorite",a.toggleFavoriteModule)},2E3);c.Mixins.Builder.updateModuleSort(c.Instances.Builder[c.builderIndex].el);c.Mixins.Builder.updateModuleSort(a.el.getElementsByClassName("tb_module_panel_container")[0]);z.LoadCss(themifyBuilder.meta_url+
"css/themify.minicolors.css");z.LoadCss(themifyBuilder.builder_url+"/css/editor/themify.combobox.css");"visual"===c.mode&&(x.Themify.LoadCss(themifyBuilder.meta_url+"css/themify.minicolors.css"),x.Themify.LoadCss(themifyBuilder.builder_url+"/css/editor/themify.combobox.css"))},800);a.draggable();"true"===localStorage.getItem("tb_panel_closed")?a.closeFloat():a.Panel.setFocus()};if("visual"===c.mode)x.jQuery("body").one("themify_builder_ready",b);else b()},setMode(){localStorage.getItem("tb_mode")?
c.ActionBar.isHoverMode=null:(c.ActionBar.isHoverMode=!0,this.el.getElementsByClassName("tb_change_mode")[0].getElementsByClassName("tb-checkbox")[0].checked=!0);!0===c.ActionBar.isInit&&c.ActionBar.changeMode()},darkMode(){localStorage.getItem("tb_dark_mode")?(c.ActionBar.darkMode=!0,this.el.getElementsByClassName("tb_dark_mode")[0].checked=!0,c.ActionBar.changeDarkMode()):c.ActionBar.darkMode=null},inlineEditorMode(){localStorage.getItem("tb_inline_editor")&&(c.ActionBar.inlineEditor=null,this.el.getElementsByClassName("tb_inline_editor")[0].checked=
!1)},modChange(a){a.stopPropagation();const b=a.currentTarget.classList;a=!0===a.currentTarget.checked;b.contains("tb_mode")?(a?(localStorage.removeItem("tb_mode"),c.ActionBar.isHoverMode=!0):(localStorage.setItem("tb_mode",1),c.ActionBar.isHoverMode=null),c.ActionBar.clear(),c.ActionBar.clearClicked(),c.ActionBar.clearSelected(),c.ActionBar.changeMode()):b.contains("tb_right_click_mode")?(a?localStorage.removeItem("tb_right_click"):localStorage.setItem("tb_right_click",1),c.ActionBar.initRightClick()):
b.contains("tb_padding_dragging_mode")?(a?localStorage.removeItem("tb_disable_padding_dragging"):localStorage.setItem("tb_disable_padding_dragging",1),c.EdgeDrag.init()):b.contains("tb_dark_mode")?(a?(localStorage.setItem("tb_dark_mode",1),c.ActionBar.darkMode=!0):(localStorage.removeItem("tb_dark_mode"),c.ActionBar.darkMode=null),c.ActionBar.changeDarkMode()):b.contains("tb_inline_editor")&&(a?(localStorage.removeItem("tb_inline_editor"),c.ActionBar.inlineEditor=!0):(localStorage.setItem("tb_inline_editor",
1),c.ActionBar.inlineEditor=null),z.trigger("tb_inline_editor_changed"))},getStorage(){const a=localStorage.getItem(this.lightboxStorageKey);return a?JSON.parse(a):null},updateStorage(){const a=this.$el.find("#tb_module_panel"),b=a.position();var d=a.outerHeight();0>=d&&(d=(d=this.getStorage())?d.height:"");localStorage.setItem(this.lightboxStorageKey,JSON.stringify({top:b.top,left:b.left,width:a.outerWidth(),height:d}))},getPanelClass(a){return 195>=a?"tb_float_xsmall":270>=a?"tb_float_small":400>=
a?"tb_float_medium":"tb_float_large"},_setResponsiveTabs(a){const b=c.toolbar.el.getElementsByClassName("tb_module_types");for(let d=b.length-1;-1<d;--d)"tb_float_xsmall"===a?(b[d].classList.add("tb_ui_dropdown_items"),b[d].parentNode.classList.add("tb_compact_tabs")):(b[d].classList.remove("tb_ui_dropdown_items"),b[d].parentNode.classList.remove("tb_compact_tabs"))},resize(){const a=this.el.getElementsByClassName("tb_modules_panel_wrap")[0],b=this,d=c.Utils.getMouseEvents(),f=a.getElementsByClassName("tb_resizable");
for(let e=f.length-1;-1<e;--e)f[e].addEventListener(d.mousedown,function(h){if("touchstart"===h.type||1===h.which){h.stopImmediatePropagation();let g,k;const n=this.ownerDocument,l=.9*n.documentElement.clientHeight,r=parseInt(m(a).css("min-width")),p=parseInt(m(a).css("max-width")),q=this.dataset.axis,v=parseInt(a.offsetHeight,10),w=parseInt(a.offsetWidth,10),y=h.touches?h.touches[0].clientX:h.clientX,B=h.touches?h.touches[0].clientY:h.clientY,A=function(E){E.stopImmediatePropagation();k&&cancelAnimationFrame(k);
k=requestAnimationFrame(function(){var C=E.touches?E.touches[0].clientX:E.clientX;var G=E.touches?E.touches[0].clientY:E.clientY;if("w"===q)C=y+w-C,C>p&&(C=p),C>=r&&C<=p&&(G=a.style.width,a.style.width=C+"px",a.style.left=parseInt(a.style.left)+parseInt(G)-C+"px");else{G="-y"===q||"ne"===q||"nw"===q?B+v-G:v+G-B;C="sw"===q||"nw"===q?y+w-C:w+C-y;C>p&&(C=p);if(("se"===q||"x"===q||"sw"===q||"nw"===q||"ne"===q)&&C>=r&&C<=p){const O=a.style.width;a.style.width=C+"px";if("sw"===q||"nw"===q)a.style.left=
parseInt(a.style.left)+parseInt(O)-C+"px"}if(("se"===q||"y"===q||"-y"===q||"sw"===q||"nw"===q||"ne"===q)&&50<=G&&G<=l){if("-y"===q||"nw"===q||"ne"===q)a.style.top=parseInt(a.style.top)+parseInt(a.style.height)-G+"px";a.style.height=G+"px"}}"y"!==q&&"-y"!==q&&(C=b.getPanelClass(C),g!==C&&(g&&a.classList.remove(g),a.classList.add(C),g=C,b._setResponsiveTabs(C)))})};n.addEventListener(d.mousemove,A,{passive:!0});n.addEventListener(d.mouseup,function(){h.stopImmediatePropagation();this.removeEventListener(d.mousemove,
A,{passive:!0});k&&cancelAnimationFrame(k);k=null;this.body.style.cursor="";this.body.classList.remove("tb_start_animate","tb_move_drag","tb_panel_resize");b.updateStorage()},{passive:!0,once:!0});n.body.classList.add("tb_start_animate","tb_move_drag","tb_panel_resize");n.body.style.cursor=m(this).css("cursor")}},{passive:!0})},setFloat(){const a=this.Panel.el.find("#tb_module_panel")[0];var b=this.getStorage();a.classList.add("tb_panel_floating");b&&(a.style.width=b.width+"px",a.style.height=b.height+
"px");b=this.getPanelClass(a.offsetWidth);a.classList.add(b);this._setResponsiveTabs(b)},removeFloat(){this.Panel.el.find("#tb_module_panel").css({top:"",width:"",height:"",left:"",right:"",bottom:""}).removeClass("tb_panel_floating tb_float_xsmall tb_float_small tb_float_medium tb_float_large tb_is_minimize")},draggable(){const a=this.el.querySelector("#tb_module_panel"),b=c.Utils.getMouseEvents(),d=this;if(!t.Lightbox.dockMode.get()){var f=this.getStorage();if(f){for(let e in f)a.style[e]=f[e]+
"px";f=f.width}else f=a.offsetWidth;f=this.getPanelClass(f);a.classList.add("tb_panel_floating",f);this._setResponsiveTabs(f)}a.getElementsByClassName("tb_drag_handle")[0].addEventListener(b.mousedown,function(e){if("touchstart"===e.type||1===e.which){e.stopImmediatePropagation();let h;const g=this.ownerDocument,k=a.offsetLeft-(e.touches?e.touches[0].clientX:e.clientX),n=a.offsetTop-(e.touches?e.touches[0].clientY:e.clientY),l=function(p){p.stopImmediatePropagation();h&&cancelAnimationFrame(h);h=
requestAnimationFrame(function(){const q=k+(p.touches?p.touches[0].clientX:p.clientX),v=n+(p.touches?p.touches[0].clientY:p.clientY);a.style.left=q+"px";a.style.top=v+"px";"visual"===c.mode&&t.Lightbox.dockMode.drag(p,q)})},r=function(p){g.body.classList.add("tb_start_animate","tb_move_drag","tb_panel_drag");d.setFloat();t.Lightbox.dockMode.get()&&(t.Lightbox.dockMode.close(),setTimeout(function(){c.Utils._onResize(!0)},100))};g.addEventListener(b.mouseup,function(p){p.stopImmediatePropagation();
this.removeEventListener(b.mousemove,r,{passive:!0,once:!0});this.removeEventListener(b.mousemove,l,{passive:!0});l(p);requestAnimationFrame(function(){g.body.classList.remove("tb_start_animate","tb_move_drag","tb_panel_drag");if(t.Lightbox.dockMode.get())d.removeFloat(),d._setResponsiveTabs(!1);else{const q=m(x).height()-30,v=a.offsetTop;if(0>v||v>q)a.style.top=(0>v?0:q)+"px";d.updateStorage()}h=null})},{passive:!0,once:!0});g.addEventListener(b.mousemove,r,{passive:!0,once:!0});g.addEventListener(b.mousemove,
l,{passive:!0})}},{passive:!0});this.resize()},minimize(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget).closest("#tb_module_panel");if(a.hasClass("tb_is_minimize")){a.removeClass("tb_is_minimize");const b=this.getStorage();a.css("height",b?b.height:"")}else a.addClass("tb_is_minimize")},import(a){a.preventDefault();a.stopPropagation();var b=a.currentTarget.getAttribute("data-component");const d=x.document.getElementsByTagName("body")[0];var f={contructor:"file"!==b,dataType:"json",
data:{action:"builder_import",type:b}};if("file"!==b||confirm(themifyBuilder.i18n.importFileConfirm))if("file"===b)a=x.document.getElementById("tb_import_filestb_plupload_browse_button"),null===a?(a=u.createElement("input"),b=u.createElement("div"),f=u.createElement("span"),b.id="tb_import_filestb_plupload_upload_ui",b.style.display="none",a.type="button",a.id="tb_import_filestb_plupload_browse_button",f.className="ajaxnonceplu",f.id=themifyBuilder.import_nonce,b.appendChild(a),b.appendChild(f),d.appendChild(b),
c.Utils.builderPlupload("",a.parentNode)):a.click();else{t.Lightbox.$lightbox[0].style.display="none";const e=m(a.currentTarget.closest("ul")),h=e.offset();let g=h.top+e.height()-40;z.body.off("themify_builder_lightbox_close.import");e.addClass("tb_current_menu_selected");null!==c.Forms.LayoutPart.id&&(g-=I.pageYOffset+60);t.Lightbox.open(f,function(){d.classList.add("tb_standalone_lightbox")},function(){this.$lightbox[0].classList.add("tb_import_post_lightbox");this.setStandAlone(h.left,g,!0);z.body.one("themify_builder_lightbox_close.import",
function(){d.classList.remove("tb_standalone_lightbox");t.Lightbox.$lightbox[0].classList.remove("tb_import_post_lightbox");e.removeClass("tb_current_menu_selected")});m("#tb_submit_import_form",t.Lightbox.$lightbox).one("click",function(k){k.preventDefault();t.LiteLightbox.confirm(themifyBuilder.i18n.dialog_import_page_post,function(n){m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"builder_import_submit",nonce:themifyBuilder.tb_load_nonce,data:c.Forms.serialize("tb_options_import"),
importType:"no"===n?"replace":"append",importTo:themifyBuilder.post_ID},beforeSend(l){t.showLoader("show")},success(l){void 0!==l.builder_data?c.Forms.reLoad(l,themifyBuilder.post_ID):t.showLoader("error");t.Lightbox.close()}})},{buttons:{no:{label:ThemifyConstructor.label.replace_builder},yes:{label:ThemifyConstructor.label.append_builder}}})})})}},unload(){"visual"===c.mode&&u.head.insertAdjacentHTML("afterbegin",'<base target="_parent">');x.onbeforeunload=function(){return c.editing||!c.hasChanged&&
!c.undoManager.hasUndo()?null:"Are you sure"}},panelClose(a){a.preventDefault();x.location.reload(!0)},loadLayout(a){a.preventDefault();a.stopPropagation();var b=this,d=x.document.body,f=m(a.currentTarget.closest("ul"));a=b.layoutsList?{loadMethod:"html",data:b.layoutsList}:{data:{action:"tb_load_layout"}};t.Lightbox.$lightbox[0].style.display="none";f.addClass("tb_current_menu_selected");z.body.off("themify_builder_lightbox_close.loadLayout");t.Lightbox.open(a,function(){d.classList.add("tb_load_layout_active",
"tb_standalone_lightbox")},function(){function e(){g.on("click.loadLayout",".layout_preview img",function(l){l.preventDefault();l.stopPropagation();const r=m(this).closest(".layout_preview");t.LiteLightbox.confirm(themifyBuilder.i18n.confirm_template_selected,function(p){const q=r.closest("ul").data("group"),v=function(w){if("no"!==p){var y="visual"!==c.mode?u.getElementById("tb_row_wrapper"):u.getElementsByClassName("themify_builder_content-"+themifyBuilder.post_ID)[0];y=c.Mixins.Builder.toJSON(y);
const B=[];for(let A in y)B.push(y[A]);for(let A in w)B.push(w[A]);w=B}!0!==b.is_set&&m.ajax({type:"POST",url:themifyBuilder.ajaxurl,data:{action:"set_layout_action",nonce:themifyBuilder.tb_load_nonce,mode:"no"!==p?1:0,id:themifyBuilder.post_ID},success(){b.is_set=!0}});c.Forms.reLoad(w,themifyBuilder.post_ID);t.Lightbox.close()};if("pre-designed"===q){t.showLoader("show");const w=r.data("slug"),y=themifyBuilder.paths.layout_template.replace("{SLUG}",w);if(!c.layouts_selected)c.layouts_selected={};
else if(c.layouts_selected[w]){c.Utils.clearElementId(c.layouts_selected[w]);v(JSON.parse(c.layouts_selected[w]));return}m.get(y,null,null,"text").done(function(B){c.layouts_selected[w]=B;let A=JSON.parse(B);-1!==B.indexOf(c.GS.key)?m.getJSON(themifyBuilder.paths.layout_template.replace("{SLUG}",w+"-gs")).done(function(E){const C={};for(let G in E)void 0!==E[G]["class"]?C[E[G]["class"]]=E[G]:C[G]=E[G];c.GS.setImport(C,function(){v(A)},A)}).fail(function(E,C,G){v(A)}):v(A)}).fail(function(B,A,E){t.LiteLightbox.alert(ThemifyConstructor.label.layout_error.replace("{FILE}",
y))}).always(function(){t.showLoader()})}else m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_set_layout",nonce:themifyBuilder.tb_load_nonce,layout_slug:r.data("slug"),layout_group:q,mode:"no"!==p?1:0},beforeSend(){"visual"===c.mode&&t.showLoader("show")},success(w){w.data?(w.gs&&(c.GS.styles=m.extend(!0,{},w.gs,c.GS.styles)),v(w.data),t.showLoader()):(t.showLoader("error"),alert(w.msg),t.Lightbox.close())}})},{buttons:{no:{label:ThemifyConstructor.label.layout_replace},
yes:{label:ThemifyConstructor.label.layout_append}}})})}function h(){e();const l=k.find(".layout_preview_list");n.show().find("li").on("click",function(r){r.preventDefault();r.stopPropagation();this.classList.contains("current")||(r=l,this.classList.contains("all")||(l.hide(),r=l.filter("[data-category"+(""!==themifyBuilder.paths.layouts_index?"*":"")+'="'+m(this).text()+'"]')),r.show(),m(this).addClass("current").siblings().removeClass("current"),n.parent().find(".tb_ui_dropdown_label").html(m(this).text()));
c.Utils.hideOnClick(n)});n.find(".tb_selected_cat").click();g.find("#tb_layout_search").on("keyup",function(){let r=m.trim(m(this).val());var p=l;""!==r&&(p=n.find("li.all"),p[0].classList.contains("current")||p.click(),l.hide(),p=l.find(".layout_title:contains("+r+")").closest(".layout_preview_list"));p.show()})[0].focus();z.body.one("themify_builder_lightbox_close.loadLayout",function(){g.off("click.loadLayout")[0].classList.remove("tb_predesigned_lightbox");k.find("#tb_layout_search").off("keyup");
d.classList.remove("tb_load_layout_active","tb_standalone_lightbox");f.removeClass("tb_current_menu_selected")})}const g=this.$lightbox,k=g.find("#tb_tabs_pre-designed");if(0===k.length)d.classList.remove("tb_load_layout_active","tb_standalone_lightbox"),f.removeClass("tb_current_menu_selected"),e();else{g[0].classList.add("tb_predesigned_lightbox");this.setStandAlone(x.innerWidth/2,(x.document.documentElement.clientHeight-g.height())/2,!0);var n=k.find(".tb_ui_dropdown_items");b.layoutsList?h():
m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_load_predesigned_layouts",nonce:themifyBuilder.tb_load_nonce,src:themifyBuilder.paths.layouts_index,id:themifyBuilder.post_ID},success(l){const r=JSON.parse(l.data);if(""===themifyBuilder.paths.layouts_index){var p=Object.keys(r);c.layouts_selected={};for(var q=p.length-1;-1<q;--q)c.layouts_selected[r[p[q]].slug]=r[p[q]].data}l=l.selected;p={};q=u.createDocumentFragment();const v=u.createDocumentFragment();for(let A=0,
E=r.length;A<E;++A){var w=u.createElement("li"),y=u.createElement("div");let C=u.createElement("div"),G=u.createElement("img"),O=u.createElement("div");var B=u.createElement("div");w.className="layout_preview_list";w.dataset.category=r[A].category;y.className="layout_preview";y.dataset.id=r[A].id;y.dataset.slug=r[A].slug;C.className="thumbnail";G.src=r[A].thumbnail;G.alt=r[A].title;G.title=r[A].title;O.className="layout_action";B.className="layout_title";B.textContent=r[A].title;O.appendChild(B);
void 0!==r[A].url&&(B=u.createElement("a"),B.className="layout-preview-link",B.href=r[A].url,B.target="_blank",B.title=themifyBuilder.i18n.preview,B.appendChild(c.Utils.getIcon("ti-search")),O.appendChild(B));C.appendChild(G);y.appendChild(C);y.appendChild(O);w.appendChild(y);q.appendChild(w);if(r[A].category){w=String(r[A].category).split(",");for(let N=0,J=w.length;N<J;++N)""!==w[N]&&1!==p[w[N]]&&(y=u.createElement("li"),y.textContent=w[N],v.appendChild(y),p[w[N]]=1,w[N]===l&&(y.className="tb_selected_cat"))}}n[0].appendChild(v);
k[0].getElementsByClassName("tb_layout_lists")[0].appendChild(q);b.layoutsList=g[0].getElementsByClassName("tb_options_tab_wrapper")[0].cloneNode(!0);h()},error(){t.LiteLightbox.alert(m("#tb_load_layout_error",k).show().text())}})}})},saveLayout(a){a.preventDefault();a.stopPropagation();const b={contructor:!0,loadMethod:"html",save:{},data:{save_as_layout:{options:[{id:"layout_title_field",type:"text",label:ThemifyConstructor.label.title},{id:"layout_img_field",type:"image",label:ThemifyConstructor.label.image_preview},
{id:"layout_img_field_id",type:"hidden"},{id:"postid",type:"hidden",value:themifyBuilder.post_ID}]}}},d=m(a.currentTarget.closest("ul"));d.addClass("tb_current_menu_selected");t.Lightbox.$lightbox[0].style.display="none";t.Lightbox.open(b,function(){x.document.body.classList.add("tb_standalone_lightbox")},function(){const f=this.$lightbox;f.find(".builder_save_button").one("click",function(e){e.stopPropagation();e.preventDefault();m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_save_custom_layout",
nonce:themifyBuilder.tb_load_nonce,form_data:c.Forms.serialize(f[0])},beforeSend(){t.showLoader("show")},success(h){"success"===h.status?(t.showLoader(),t.Lightbox.close()):(t.showLoader("error"),alert(h.msg))}})});f.addClass("tb_savead_lightbox");this.setStandAlone(a.clientX,a.clientY);z.body.one("themify_builder_lightbox_close",function(){f.removeClass("tb_savead_lightbox").find(".builder_save_button").off("click");x.document.body.classList.remove("tb_standalone_lightbox");d.removeClass("tb_current_menu_selected")})})},
duplicate(a){a.preventDefault();a.stopPropagation();if(confirm(themifyBuilder.i18n.confirm_on_duplicate_page)){const b=this;c.Utils.saveBuilder(function(){b.Revisions.ajax({action:"tb_duplicate_page",tb_is_admin:"visual"!==c.mode},function(d){d&&(x.location.href=m("<div/>").html(d).text())})})}},addCustomCSS(a){a.preventDefault();a.stopPropagation();null!==c.activeModel&&ThemifyConstructor.saveComponent(!0);null===S&&(S=themifyBuilder.custom_css,delete themifyBuilder.custom_css);S||(S="");const b=
{contructor:!0,loadMethod:"html",save:{},data:{css:{options:[{id:"custom_css",type:"textarea",rows:17,class:"fullwidth"},{id:"custom_css_m",type:"message",label:"",comment:ThemifyConstructor.label.cus_css_m},{id:"postid",type:"hidden",value:themifyBuilder.post_ID}]}}},d=a.currentTarget;d.classList.add("tb_tooltip_active");t.Lightbox.$lightbox[0].style.display="none";x.document.body.classList.add("tb_standalone_lightbox");t.Lightbox.open(b,null,function(){const f=this.$lightbox,e=f[0].querySelector("#custom_css");
e.value=S;"visual"===c.mode&&e.addEventListener("input",function(){let h=u.getElementById("tb_custom_css_tmp");null===h&&(h=u.createElement("style"),h.type="text/css",h.id="tb_custom_css_tmp",u.head.appendChild(h));h.innerHTML=this.value.trim()});f.addClass("tb_custom_css_lightbox").find(".builder_save_button").one("click",function(h){h.stopImmediatePropagation();h.preventDefault();S=e.value.trim();t.Lightbox.close()});this.setStandAlone(a.clientX,a.clientY);z.body.one("themify_builder_lightbox_close",
function(){S||(S="",d.classList.add("tb_tooltip_active"));const h=u.getElementById("tb_custom_css_tmp");h&&(h.innerHTML=S);x.document.body.classList.remove("tb_standalone_lightbox")})})},Revisions:{init(){c.toolbar.$el.find(".tb_toolbar_revision_btn").on("click",this.revision.bind(this))},revision(a){const b=a.target.classList;if(b.contains("tb_toolbar_revision_btn"))null!==c.activeModel&&t.Lightbox.$lightbox.is(":visible")&&ThemifyConstructor.saveComponent();else if(b.contains("tb_save_revision")||
b.contains("tb_load_revision"))a.preventDefault(),a.stopPropagation(),b.contains("tb_save_revision")?this.saveEvent():this.load(a)},load(a){const b=this,d=m("body",x.document),f=m(a.target.closest("ul")),e=f.offset();f.addClass("tb_current_menu_selected");t.Lightbox.$lightbox[0].style.display="none";z.body.off("themify_builder_lightbox_close.revisions");b.ajax({action:"tb_load_revision_lists"},function(h){t.Lightbox.open({contructor:!0,loadMethod:"html",data:{revision:{html:m(h)[0]}}},function(){d.addClass("tb_standalone_lightbox")},
function(){this.$lightbox[0].classList.add("tb_revision_lightbox");this.setStandAlone(e.left,e.top,!0);d.on("click.revision",".js-builder-restore-revision-btn",b.restore.bind(b)).on("click.revision",".js-builder-delete-revision-btn",b.delete.bind(b));z.body.one("themify_builder_lightbox_close.revisions",function(){f.removeClass("tb_current_menu_selected");d.off(".revision").removeClass("tb_standalone_lightbox");t.Lightbox.$lightbox[0].classList.remove("tb_revision_lightbox")})})})},ajax(a,b){a=m.extend({},
a,{tb_load_nonce:themifyBuilder.tb_load_nonce,postid:themifyBuilder.post_ID,sourceEditor:"visual"===c.mode?"frontend":"backend"});return m.ajax({type:"POST",url:themifyBuilder.ajaxurl,data:a,beforeSend(){t.showLoader("show")},complete(){t.showLoader("hide")},success(d){"function"===typeof b&&b.call(this,d)}})},saveEvent(a){const b=this;t.LiteLightbox.prompt(themifyBuilder.i18n.enterRevComment,function(d){null!==d&&b.saveRevision(d,a)})},saveRevision(a,b){const d=c.Utils.saveBuilder(null,!0);this.ajax({action:"tb_save_revision",
rev_comment:a,data:JSON.stringify(c.Utils.clear(d.data)),postid:d.id},b)},restore(a){a.preventDefault();a.stopPropagation();const b=m(a.currentTarget).data("rev-id"),d=this,f=function(){d.ajax({action:"tb_restore_revision_page",revid:b},function(e){e.builder_data?(c.Forms.reLoad(e,themifyBuilder.post_ID),t.Lightbox.close()):(t.showLoader("error"),alert(e.data))})};t.LiteLightbox.confirm(themifyBuilder.i18n.confirmRestoreRev,function(e){"yes"===e?d.saveEvent(f):f()},{buttons:{no:{label:ThemifyConstructor.label.save_no},
yes:{label:ThemifyConstructor.label.save}}})},delete(a){a.preventDefault();a.stopPropagation();if(confirm(themifyBuilder.i18n.confirmDeleteRev)){var b=m(a.currentTarget);a=b.data("rev-id");this.ajax({action:"tb_delete_revision",revid:a},function(d){d.success?b.closest("li").remove():(t.showLoader("error"),alert(d.data))})}}},save(a){a.preventDefault();a.stopPropagation();const b=a.currentTarget.closest(".tb_toolbar_backend_edit")?a.currentTarget.getAttribute("href"):!1;themifyBuilder.is_gutenberg_editor&&
!1!==b?(c.undoManager.reset(),c._backendSwitchFrontend(b)):c.Utils.saveBuilder(function(d){!1!==b&&("visual"===c.mode?(c.editing=!0,sessionStorage.setItem("focusBackendEditor",!0),x.location.href=b):(c.undoManager.reset(),c._backendSwitchFrontend(b)))})},libraryItems:{items:[],is_init:null,init(){m(u).one("tb_panel_tab_tb_module_panel_library_wrap",this.load.bind(this))},load(a,b){const d=this;b=m(b).find(".tb_module_panel_library_wrap");b.addClass("tb_busy");m.ajax({type:"POST",url:themifyBuilder.ajaxurl,
data:{action:"tb_get_library_items",nonce:themifyBuilder.tb_load_nonce,part:"all",pid:themifyBuilder.post_ID},success(f){d.setData(f);b.removeClass("tb_busy");d.is_init=!0},error(){b.removeClass("tb_busy");t.showLoader("error");d.init();c.toolbar.$el.find(".tb_library_item_list").html("<h3>Failed to load Library Items.</h3>")}})},get(a,b,d){if(void 0!==this.items[a])d(this.items[a]);else{const f=this;m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_get_library_item",
nonce:themifyBuilder.tb_load_nonce,type:b,id:a},beforeSend(e){t.showLoader("show")},success(e){e.content.gs&&(c.GS.styles=m.extend(!0,{},e.content.gs,c.GS.styles),delete e.content.gs);t.showLoader("hide");"success"===e.status?(f.items[a]=e.content,d(e.content)):t.showLoader("error")},error(){t.showLoader("error")}})}},template(a){let b="";for(let d=0,f=a.length;d<f;++d){let e="part";-1!==a[d].post_type.indexOf("_rows",5)?e="row":-1!==a[d].post_type.indexOf("_module",5)&&(e="module");b+='<div class="tb_library_item tb_item_'+
e+'" draggable="true" data-type="'+e+'" data-id="'+a[d].id+'">';b+='<div class="tb_library_item_inner"><span>'+a[d].post_title+"</span>";b+='<a href="#" class="remove_item_btn tb_disable_sorting tf_close" title="Delete"></a></div></div>'}return b},setData(a){a='<span class="tb_no_content" style="display:none">No library content found.</span>'+this.template(a);let b=m(".tb_library_item_list");"visual"===c.mode&&(b=b.add(c.toolbar.$el.find(".tb_library_item_list")));b=b.get();for(let d=b.length-1;-1<
d;--d)b[d].insertAdjacentHTML("afterbegin",a),b[d].previousElementSibling.getElementsByClassName("current")[0].click();z.body.on("click",".remove_item_btn",this.delete.bind(this));if("visual"===c.mode)c.toolbar.$el.on("click",".remove_item_btn",this.delete.bind(this))},delete(a){a.preventDefault();a.stopPropagation();let b=m(a.currentTarget).closest(".tb_library_item"),d=b.data("type");if(confirm(themifyBuilder.i18n[d+"LibraryDeleteConfirm"])){const f=b.data("id");m.ajax({type:"POST",url:themifyBuilder.ajaxurl,
data:{action:"tb_remove_library_item",nonce:themifyBuilder.tb_load_nonce,id:f},beforeSend(e){t.showLoader("show")},success(e){t.showLoader("hide");if(e){var h=0<b.closest("#"+c.toolbar.common.btn.prop("id")).length?c.toolbar.$el.find(".tb_item_"+d+'[data-id="'+f+'"]'):c.toolbar.common.btn.find(".tb_item_"+d+'[data-id="'+f+'"]');b=b.add(h);if("part"===d){b=b.add(m(".themify_builder_content-"+f).closest(".active_module"));h=ThemifyConstructor.layoutPart.data;for(let g=h.length-1;-1<g;--g)if(h[g].post_name===
e){ThemifyConstructor.layoutPart.data.splice(g,1);break}}e=b.parent().siblings(".tb_library_types").find(".current");b.remove();e.trigger("click")}else t.showLoader("error")},error(){t.showLoader("error")}})}}},preDesignedRows:{is_init:null,rows:{},items:{},currentCategory:"All",categories:{All:{isLoaded:!1}},loadingItems:!1,init(){setTimeout(function(){var a=x.document.createElement("meta");const b=x.document.head,d=[{href:"//themify.me",rel:"dns-prefetch preconnect"},{href:"//fonts.googleapis.com",
rel:"dns-prefetch preconnect"},{href:"//maps.googleapis.com",rel:"dns-prefetch preconnect"},{href:themifyBuilder.paths.rows_index,rel:"prefetch",as:"fetch"},{href:themifyBuilder.paths.layouts_index,rel:"prefetch",as:"fetch"}];a.content="on";a.setAttribute("http-equiv","x-dns-prefetch-control");b.appendChild(a);for(let f in d)a=x.document.createElement("link"),a.setAttribute("crossorigin",!0),a.rel=d[f].rel,a.href=d[f].href,d[f].as&&a.setAttribute("as",d[f].as),b.appendChild(a)},7E3);m(u).one("tb_panel_tab_tb_module_panel_rows_wrap",
this.load.bind(this))},load(a,b){const d=this;b=m(b).find(".tb_predesigned_rows_list");b.addClass("tb_busy");m.getJSON(themifyBuilder.paths.rows_index).done(function(f){d.setData(f,b)}).fail(function(f,e,h){d.setData({},b);d.is_init=null;t.showLoader("error");c.toolbar.$el.find(".tb_predesigned_rows_container").append("<h3>"+ThemifyConstructor.label.rows_fetch_error+"</h3>");m(u).one("tb_panel_tab_tb_module_panel_rows_wrap",d.load.bind(d))})},masonry(a){const b=a.querySelectorAll('.predesigned_row:not([data-masonry="done"])');
for(let e=0,h=b.length;e<h;e++)a:{var d=b[e],f=parseInt(I.top.getComputedStyle(a).getPropertyValue("grid-row-gap"));const g=parseInt(I.top.getComputedStyle(a).getPropertyValue("grid-auto-rows"));if(isNaN(f)||isNaN(g))break a;const k=d.getElementsByClassName("tb_predesigned_rows_image")[0].getBoundingClientRect().height+d.getElementsByClassName("tb_predesigned_rows_title")[0].getBoundingClientRect().height;f=Math.ceil((k+f)/(g+f));d.style.gridRowEnd="span "+f;5<f&&(d.dataset.masonry="done")}},loadItems(a){this.loadingItems=
!0;const b=this.currentCategory,d=u.createDocumentFragment();if(!0===this.categories.All.isLoaded||!0===this.categories[b].isLoaded)return this.loadingItems=!1,d;let f=0,e=Object.keys(this.items),h=e.length;for(let n=0;n<h&&!(10<=f&&void 0==a);n++){let l=this.items[e[n]];var g=""!==a?new RegExp(a,"i"):!1;if(!g||!g.test(l.title))continue;var k=l.category.split(",");if("All"!==b&&-1===k.indexOf(b))continue;delete this.items[e[n]];g="";for(let w=0,y=k.length;w<y;++w)g+=this.categories[k[w]].hash;k=u.createElement("div");
let r=u.createElement("figure"),p=u.createElement("div"),q=new Image,v=u.createElement("a");k.className="predesigned_row "+g;k.draggable=!0;k.setAttribute("data-slug",l.slug);r.className="tb_predesigned_rows_image";p.className="tb_predesigned_rows_title";p.textContent=q.alt=q.title=l.title;q.src=void 0===l.thumbnail||""===l.thumbnail?"https://placeholdit.imgix.net/~text?txtsize=24&txt="+encodeURI(l.title)+"&w=181&h=77":l.thumbnail;q.width=500;q.height=300;v.href="#";v.className="tf_plus_icon add_module_btn tb_disable_sorting";
v.dataset.type="predesigned";r.appendChild(q);r.appendChild(v);k.appendChild(r);k.appendChild(p);d.appendChild(k);++f}this.categories[b].isLoaded=10>f&&void 0===a;return d},setData(a){this.items=a;var b=[];a=u.createDocumentFragment();const d=this;for(let h=0,g=this.items.length;h<g;++h){var f=this.items[h].category.split(",");for(let k=0,n=f.length;k<n;++k){var e=z.hash(f[k]);-1===b.indexOf(f[k])&&(b.push(f[k]),this.categories[f[k]]={hash:"tb"+e})}}b.sort();for(let h=0,g=b.length;h<g;++h)f=u.createElement("li"),
f.setAttribute("data-slug",z.hash(b[h])),f.textContent=b[h],a.appendChild(f);b=m(".tb_module_panel_container .tb_ui_dropdown .tb_ui_dropdown_items");f=m(".tb_predesigned_rows_container");"visual"===c.mode&&(f=f.add(c.toolbar.$el.find(".tb_predesigned_rows_container")),b=b.add(c.toolbar.$el.find(".tb_module_panel_container .tb_ui_dropdown .tb_ui_dropdown_items")));b=b.get();f=f.get();e=this.loadItems();for(let h=b.length-1;-1<h;--h){b[h].appendChild(a.cloneNode(!0));f[h].appendChild(e.cloneNode(!0));
let g=f[h].getElementsByTagName("img");0<g.length?(g=g[g.length-1],m(g).one("load",function(){d.initCallback(m(this).closest(".tb_predesigned_rows_container")[0],!0)})):d.initCallback(f[h],!0)}z.body.on("click",".tb_module_panel_container .tb_ui_dropdown_items li",this.filter.bind(this));if("visual"===c.mode)m("body",x.document).on("click",".tb_module_panel_container .tb_ui_dropdown_items li",this.filter.bind(this))},initCallback:function(a,b){b&&(a.closest(".tb_module_panel_rows_wrap").addEventListener("scroll",
this.scrollLoadMore.bind(this),{passive:!0}),this.is_init=!0);const d=m(a);b&&d.closest(".tb_predesigned_rows_list").removeClass("tb_busy").closest(".tb_module_panel_tab").find(".tb_ui_dropdown").css("visibility","visible");d.parents("#tb_module_panel_dropdown").length&&this.masonry(a);this.loadingItems=!1},get(a,b){t.showLoader("show");if(void 0!==this.rows[a])"function"===typeof b&&b(this.rows[a]);else{var d=this;m.getJSON(themifyBuilder.paths.row_template.replace("{SLUG}",a)).done(function(f){c.Utils.clearElementId(f);
d.rows[a]=f;-1!==JSON.stringify(f).indexOf(c.GS.key)?m.getJSON(themifyBuilder.paths.row_template.replace("{SLUG}",a+"-gs")).done(function(e){const h={};for(let g in e)void 0!==e[g]["class"]?h[e[g]["class"]]=e[g]:h[g]=e[g];c.GS.setImport(h,b,f)}).fail(function(e,h,g){"function"===typeof b&&b(f)}):"function"===typeof b&&b(f)}).fail(function(f,e,h){t.showLoader("error");alert(ThemifyConstructor.label.row_fetch_error)})}},filter(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget);const b=a.data("slug"),
d=a.closest(".tb_module_panel_tab"),f=d.find(".tb_ui_dropdown_label"),e=d.find(".predesigned_row"),h=a.text(),g=b?"tb"+b:!1;this.currentCategory=h;this.addNewItems();f.text(h);d.find(".tb_module_panel_search_text").val("");f.data("active",g);a.addClass("current").siblings().removeClass("current");e.each(function(){!g||this.classList.contains(g)?m(this).show():m(this).hide()}).filter(":visible").each(function(k){0===(k+1)%4?m(this).addClass("tb_column_break"):m(this).removeClass("tb_column_break")});
c.Utils.hideOnClick(d.find(".tb_ui_dropdown_items"))},addNewItems:function(a){this.currentCategory=void 0!==a?"All":this.currentCategory;if(!this.categories[this.currentCategory].isLoaded){var b=m(".tb_module_panel_container .tb_ui_dropdown .tb_ui_dropdown_items"),d=m(".tb_predesigned_rows_container");"visual"===c.mode&&(d=d.add(c.toolbar.$el.find(".tb_predesigned_rows_container")),b=b.add(c.toolbar.$el.find(".tb_module_panel_container .tb_ui_dropdown .tb_ui_dropdown_items")));b=b.get();d=d.get();
a=this.loadItems(a);var f=this;for(b=b.length-1;-1<b;--b){d[b].appendChild(a.cloneNode(!0));let e=d[b].getElementsByTagName("img");0<e.length?(e=e[e.length-1],m(e).one("load",function(){f.initCallback(m(this).closest(".tb_predesigned_rows_container")[0])})):f.initCallback(d[b])}}},scrollLoadMore:function(a){this.loadingItems||!0===this.categories[this.currentCategory].isLoaded||(a=a.target,a=Math.max(a.scrollHeight-(a.scrollTop+a.offsetHeight),0),0<a&&200>=a&&this.addNewItems())}},pageBreakModule:{countModules(){const a=
"visual"===c.mode,b=a?u.getElementsByClassName("module-page-break"):u.getElementsByClassName("tb-page-break");for(let d=b.length-1;-1<d;--d)!0===a?b[d].getElementsByClassName("page-break-order")[0].textContent=d+1:b[d].getElementsByClassName("page-break-overlay")[0].textContent="PAGE BREAK - "+(d+1)},get(){return[{cols:[{grid_class:"col-full first last",modules:[{mod_name:"page-break"}]}],column_alignment:"col_align_middle",styling:{custom_css_row:"tb-page-break"}}]}},common:{btn:null,is_init:null,
clicked:null,init(){const a=this;let b=u.createElement("div"),d=c.toolbar.$el;b.className="tb_modules_panel_wrap";b.id="tb_module_panel_dropdown";this.btn=m(b);d=d.add(t.Lightbox.$lightbox);"visual"!==c.mode&&null!==u.querySelector(".edit-post-layout__content")?m(".edit-post-layout__content")[0].appendChild(this.btn[0]):z.body[0].appendChild(this.btn[0]);if("visual"===c.mode)c.toolbar.$el.find(".tb_module_types li").on("click",this.tabs.bind(this));z.body.on("click",".tb_module_types li",this.tabs.bind(this)).on("click",
".tb_column_btn_plus",this.show.bind(this));d.on("click",".tb_clear_input",this.clear);c.toolbar.$el.find(".tb_module_panel_search_text").on("keyup",this.search.bind(this));this.btn.on("click",".add_module_btn,.js-tb_module_panel_acc",function(f){f.preventDefault();f.stopPropagation();let e,h=null,g=this.classList,k=this.dataset.type;a.clicked||(a.clicked=c.Instances.Builder[c.builderIndex].newRowAvailable(1,!0),h=!0);if("module"===k)e=a.clicked.hasClass("tb_module_btn_plus")?a.clicked.parent():a.clicked.closest(".module_column").find(".tb_holder").last(),
c.toolbar.Panel.add_module(f,e);else if("row"===k)e=a.clicked.hasClass("tb_module_btn_plus")?a.clicked.parent():a.clicked.closest(".module_column").find(".tb_holder").first(),c.toolbar.Panel.click_add_sub_row(f,e);else if(g.contains("js-tb_module_panel_acc"))c.toolbar.toggleAccordion(f);else if("predesigned"===k||"page_break"===k)e=a.clicked.closest(".module_row"),"page_break"===k?c.toolbar.Panel.click_add_page_break(f,e):c.toolbar.preDesignedRows.get(m(f.currentTarget).closest(".predesigned_row").data("slug"),
function(n){c.Mixins.Builder.rowDrop(n,h?e:m("<div>").insertAfter(e),!0)});g.contains("js-tb_module_panel_acc")||a.hide(!0)}).on("keyup",".tb_module_panel_search_text",this.search.bind(this)).on("click",".tb_clear_input",this.clear)},run(){this.btn[0].insertAdjacentHTML("beforeend",c.toolbar.el.querySelector("#tb_module_panel").innerHTML);this.btn.find(".tb_module").show();const a=this.btn.find(".tb_module_types").closest("div")[0];a.parentNode.parentNode.insertBefore(a,a.parentNode);a.parentNode.removeChild(a.nextElementSibling);
this.btn.find(".tb_compact_tabs").removeClass("tb_compact_tabs").find(".tb_ui_dropdown_items").removeClass("tb_ui_dropdown_items");this.btn.find(".tb_module_panel_search_text").val("");c.Mixins.Builder.updateModuleSort(this.btn[0]);this.is_init=!0},tabs(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget);const b=a.closest("ul");var d=a.data("target");const f=a.closest(".tb_modules_panel_wrap");f.find("."+a.data("hide")).hide();const e=f.find("."+d),h=f.find(".tb_no_content");0<e.length?
(h.hide(),e.show()):h.show();a.closest("li").addClass("current").siblings().removeClass("current");f.find(".tb_module_panel_search_text").val("").focus().trigger("keyup");m(u).triggerHandler("tb_panel_tab_"+d,f);d=b.parent().find(".tb_ui_dropdown_label");0<d.length&&d.text(a.text());c.Utils.hideOnClick(b)},show(a,b){a.preventDefault();a.stopPropagation();!c.activeModel&&x.document.body.classList.contains("tb_standalone_lightbox")&&t.Lightbox.close();null===this.is_init&&this.run();this.clicked&&this.clicked[0].classList.remove("clicked");
this.clicked=b?b:m(a.currentTarget);var d=this.clicked.offset();a="visual"!==c.mode?m(".edit-post-layout__content"):!1;b=z.body;let f=d.left+this.clicked.width()/2;d=d.top;!1!==a&&0<a.length&&(d+=a.scrollTop()-70,f=a.width()/2);f-=this.btn.outerWidth()/2;0>f&&(f=0);this.btn[0].classList.toggle("tb_subrow_open",0<this.clicked.parents(".sub_column").length);this.btn.css({top:d,left:f}).show();this.resize();const e=this.btn[0].getElementsByClassName("tb_predesigned_rows_container")[0];e.closest(".tb_module_panel_rows_wrap").addEventListener("scroll",
c.toolbar.preDesignedRows.scrollLoadMore.bind(c.toolbar.preDesignedRows),{passive:!0});"visual"===c.mode&&(b=b.add(m("body",x.document)),"desktop"!==c.activeBreakPoint&&(m("body",x.document).height(u.body.scrollHeight+this.btn.outerHeight(!0)),z.body.css("padding-bottom",180)));b.addClass("tb_panel_dropdown_openend");this.clicked.addClass("clicked");"desktop"===c.activeBreakPoint&&setTimeout(function(){this.btn.find(".tb_module_panel_search_text").focus()}.bind(this),50);this.hide();c.ActionBar.clear();
null!==c.activeModel&&(a=t.Lightbox.$lightbox[0].getElementsByClassName("builder_save_button")[0],void 0!==a&&a.click());a=e.getElementsByTagName("img");0<a.length?(a=a[a.length-1],m(a).one("load",function(){c.toolbar.preDesignedRows.masonry(e)})):c.toolbar.preDesignedRows.masonry(e);z.trigger("disableInline")},resize(){null!==this.btn&&c.Utils.addViewPortClass(this.btn[0])},hide(a){function b(){if(!0===a||!d.btn.is(":hover")){let f=z.body;null!==d.btn&&(d.btn.hide().css("width",""),d.clicked&&d.clicked[0].classList.remove("clicked"),
d.clicked=null);m(u).off("click",b);m(x.document).off("click",b);"visual"===c.mode&&(f=f.add(m("body",x.document)),"desktop"!==c.activeBreakPoint&&(m("body",x.document).height(u.body.scrollHeight),z.body.css("padding-bottom","")));f.removeClass("tb_panel_dropdown_openend")}}const d=this;if(!0===a)b();else{if("visual"===c.mode)m(x.document).on("click",b);m(u).on("click",b)}},search(a){var b=m(a.currentTarget);a=b.closest(".tb_modules_panel_wrap");const d=a.find(".tb_module_types .current").first().data("target");
b=m.trim(b.val());let f=!1,e=!1,h=!1,g=!1,k=!1;"tb_module_panel_modules_wrap"===d?(f=a.find(".tb_module"),h=!0):"tb_module_panel_rows_wrap"===d&&c.toolbar.preDesignedRows.is_init?(c.toolbar.preDesignedRows.addNewItems(b),e=a.find(".tb_ui_dropdown_label").data("active"),f=a.find(".predesigned_row"),k=!0):"tb_module_panel_library_wrap"===d&&(f=a.find(".tb_library_item"),e=a.find(".tb_library_types .current").data("target"),g=!0);if(!1!==f){const n=""===b,l=n?!1:new RegExp(b,"i");f.each(function(){if(e&&
!this.classList.contains(e))return!0;let r=h?m(this).find(".module_name"):g?m(this).find(".tb_library_item_inner span"):m(this).find(".tb_predesigned_rows_title");n||l.test(r.text())?m(this).show():m(this).hide()});n?a.removeClass("tb_module_panel_searching"):a.addClass("tb_module_panel_searching");h?a.find(".tb_module_category_content").each(function(){this.parentNode.style.display=!1!==n||m(this).find(".tb_module:visible").length?"block":"none"}):k&&c.toolbar.preDesignedRows.masonry(a[0].getElementsByClassName("tb_predesigned_rows_container")[0])}},
clear(a){a.preventDefault();a.stopPropagation();a=m(this).parent().children("input").first();0<a.length&&(a.val(""),a[0].hasAttribute("data-search")?a.trigger("keyup").focus():(a.trigger("change"),z.triggerEvent(a[0],"change")))}},help:{init(){m(".tb_help_btn",c.toolbar.$el).on("click",this.show.bind(this))},show(a){a.preventDefault();a.stopPropagation();const b=this,d=function(e){x.document.body.insertAdjacentHTML("beforeend",e);e=m("#tb_help_lightbox",x.document.body);m(".tb_help_tab_link",e).on("click",
b.mainTabs.bind(b));m(".tb_player_btn",e).on("click",b.play.bind(b));m(".tb_help_menu a",e).on("click",b.tabs.bind(b));m(".tb_close_lightbox",e).on("click",b.close.bind(b));e.slideDown()};let f=!1;t.showLoader("show");x.Themify.LoadCss(themifyBuilder.builder_url+"/css/editor/help-lightbox.css",null,null,null,function(){f||d(f);f=!0});m.ajax({type:"POST",url:themifyBuilder.ajaxurl,data:{tb_load_nonce:themifyBuilder.tb_load_nonce,action:"tb_help"},complete(){t.showLoader("spinhide")},success(e){f?d(e):
f=e}})},play(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget).closest("a");const b=a.prop("href"),d=u.createElement("iframe");d.setAttribute("frameborder","0");d.setAttribute("allow","autoplay; fullscreen");d.setAttribute("src",b+"?rel=0&showinfo=0&autoplay=1&enablejsapi=1&html5=1&version=3");a.replaceWith(d)},tabs(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget);const b=m(".tb_help_video_wrapper",x.document),d=b.find(a.attr("href")),f=d.find(".tb_player_btn");b.find(".tb_player_wrapper").removeClass("current").hide();
d.addClass("current").show();a.closest("li").addClass("current").siblings().removeClass("current");this.stopPlay();0<f.length?f.trigger("click"):this.startPlay()},execute(a,b){a.contentWindow.postMessage('{"event":"command","func":"'+b+'","args":""}',"*")},stopPlay(){const a=this;m(".tb_player_wrapper",x.document).each(function(){if(!this.classList.contains("current")){let b=m(this).find("iframe");0<b.length&&a.execute(b[0],"pauseVideo")}})},startPlay(){const a=m(".tb_player_wrapper.current",x.document).find("iframe");
0<a.length&&this.execute(a[0],"playVideo")},close(a,b){a.preventDefault();a.stopPropagation();m(a.currentTarget).closest("#tb_help_lightbox").slideUp("normal",function(){m(this).next(".tb_overlay").remove();m(this).remove();b&&b()})},mainTabs(a){a.preventDefault();a.stopPropagation();a=m(a.currentTarget);const b=m(".tb_help_lightbox_inner_wrapper",x.document);a.hasClass("tb_help_active_tab")||(b.find(".tb_help_active_tab").removeClass("tb_help_active_tab"),a.addClass("tb_help_active_tab"),b.attr("data-active-tab",
a.data("type")))}},deviceSwitcher(a){const b=a.target,d=b.parentNode.previousElementSibling;d.classList.contains("tb_breakpoint_switcher")&&(a.tb_device=[b.dataset.height,b.dataset.width],a.target=d,a.currentTarget=d,this.breakpointSwitcher(a))},breakpointSwitcher(a){a.preventDefault();a.stopPropagation();let b="desktop",d=m("body",x.document);const f=this;var e=a.currentTarget;const h="visual"===c.mode&&c.iframe[0].classList.contains("tb_resizing_start"),g=c.activeBreakPoint,k=function(){f.responsive_grids(b,
g);const p=function(){c.Utils.setCompactMode(u.getElementsByClassName("module_column"));d.removeClass("tb_start_animate tb_start_change_mode").toggleClass("tb_responsive_mode","desktop"!==b).removeClass("builder-breakpoint-"+g).addClass("builder-breakpoint-"+b);z.body.triggerHandler("themify_builder_change_mode",[g,b]);"visual"===c.mode&&(c.iframe[0].style.willChange="",setTimeout(function(){"desktop"!==c.activeBreakPoint?c.Utils.calculateHeight():x.document.body.style.height="";!h&&c.scrollTo&&(m(I).add(x.document).scrollTop(c.scrollTo.offset().top),
c.scrollTo=!1);z.trigger("tf_isotop_layout")},150));c.ActionBar.disable=c.clearOnModeChange=null};"visual"===c.mode?c.Utils._onResize(!0,function(){f.iframeScroll("desktop"!==b);c.ActionBar.hoverCid=null;c.EdgeDrag.clearEdges();setTimeout(p,h?1:100)}):p()};e.classList.contains("breakpoint-tablet")?b="tablet":e.classList.contains("breakpoint-tablet_landscape")?b="tablet_landscape":e.classList.contains("breakpoint-mobile")&&(b="mobile");if(void 0!==a.tb_device||!z.body[0].classList.contains("builder-breakpoint-"+
b)){var n;e="desktop"!==b?void 0!==a.tb_device&&a.tb_device[1]?a.tb_device[1]:c.Utils.getBPWidth(b)-1:"";if(c.isPreview){var l={tablet_landscape:768,tablet:1024,mobile:667};void 0!==l[b]&&(n=void 0!==a.tb_device&&a.tb_device[0]?a.tb_device[0]:l[b])}if(g===b&&void 0!==a.originalEvent&&(e?e+"px":e)===c.iframe[0].style.width&&(n?n+"px":n)===c.iframe[0].style.height)return d.removeClass("tb_start_animate tb_start_change_mode"),!1;c.ActionBar.disable=!0;var r=[];if("visual"===c.mode){null===c.clearOnModeChange&&
c.ActionBar.clear();if(!h&&!c.isPreview){a=c.Instances.Builder[0].el.children;const p=I.innerHeight;l=function(q){if(null!==q&&void 0!==q){const v=q.getBoundingClientRect();if(0>v.bottom&&0>v.top||v.top>p)q.style.display="none",r.push(q)}};for(let q=a.length-1;-1<q;--q)l(a[q]);l(u.getElementById("headerwrap"));l(u.getElementById("footerwrap"))}d=d.add(z.body)}c.activeBreakPoint=b;d.addClass("tb_start_animate tb_start_change_mode");"visual"===c.mode?(c.iframe[0].style.willChange="width",a=x.document.getElementsByClassName("tb_toolbar_zoom_menu")[0],
a.classList.remove("tb_toolbar_zoom_active"),a.getElementsByClassName("tb_toolbar_zoom_menu_toggle")[0].dataset.zoom=100,"tablet_landscape"===b&&t.Lightbox.dockMode.get()&&(a=m(".tb_workspace_container",x.document).width(),a<e&&(e=a)),c.iframe[0].parentNode.classList.remove("tb_zoom_bg"),h?k():(x.document.body.offsetHeight,c.iframe.one("transitionend",function(){for(let p=r.length-1;-1<p;--p)r[p].style.display="";setTimeout(k,10)}),c.iframe[0].style.width=e?e+"px":"",c.iframe[0].style.height=n?n+
"px":"")):k()}},iframeScroll(a){const b=m(x.document);b.off("scroll.themifybuilderresponsive");if(a)b.on("scroll.themifybuilderresponsive",function(){I.scrollTo(0,m(this).scrollTop())})},responsive_grids(a,b){z.LoadCss(tbLocalScript.css_module_url+"responsive-column.css");const d=u.querySelectorAll(".row_inner,.subrow_inner"),f="desktop"===a,e=f||"desktop"===b;for(let k=d.length-1;-1<k;--k){var h=d[k].getAttribute("data-basecol");if(null!==h){let n=d[k].children;var g=d[k].dataset["col_"+a];let l=
n[0],r=n[n.length-1];if(!f){if("desktop"!==b){d[k].classList.remove("tb_3col");let p=d[k].getAttribute("data-col_"+b);p&&d[k].classList.remove(m.trim(p.replace("tb_3col","").replace("mobile","column").replace("tablet","column")))}if(g&&"-auto"!==g&&g!==a+"-auto"){if(g=d[k].getAttribute("data-col_"+a)){d[k].classList.add("tb_grid_classes","col-count-"+h);g=g.split(" ");for(let p=0,q=g.length;p<q;++p)d[k].classList.add(m.trim(g[p].replace("mobile","column").replace("tablet","column")))}}else d[k].classList.remove("tb_grid_classes",
"col-count-"+h)}if(e)for(let p=0,q=n.length;p<q;++p)h=n[p].dataset.w,void 0!==h&&(n[p].style.width=f?h+"%":"");"rtl"===d[k].getAttribute("data-"+a+"_dir")?(l.classList.remove("first"),l.classList.add("last"),r.classList.remove("last"),r.classList.add("first"),d[k].classList.add("direction-rtl")):(l.classList.remove("last"),l.classList.add("first"),r.classList.remove("first"),r.classList.add("last"),d[k].classList.remove("direction-rtl"))}}},Panel:{el:null,init(){this.el=c.toolbar.$el.find(".tb_toolbar_add_modules_wrap");
this.el.on("click",".add_module_btn",this.initEvents.bind(this));this.compactToolbar();"visual"===c.mode&&t.Lightbox.dockMode.setDoc()},initEvents(a){a.preventDefault();a.stopPropagation();const b=a.currentTarget.dataset.type;"module"===b?this.add_module(a):"row"===b?this.click_add_sub_row(a):"page_break"===b?this.click_add_page_break(a):"predesigned"===b&&c.toolbar.preDesignedRows.get(a.currentTarget.closest(".predesigned_row").dataset.slug,function(d){const f=c.Instances.Builder[c.builderIndex].$el.find(".module_row").last();
c.Mixins.Builder.rowDrop(d,m("<div>").insertAfter(f),!0)})},setFocus(){c.toolbar.el.getElementsByClassName("tb_module_panel_search_text")[0].focus()},add_module(a,b){a.preventDefault();a.stopPropagation();b&&0!==b.length||(b=c.Instances.Builder[c.builderIndex].newRowAvailable(1,!0).find(".tb_holder").first());c.Mixins.Builder.moduleDrop(m(a.currentTarget).closest(".tb_module"),b)},click_add_sub_row(a,b){a.preventDefault();a.stopPropagation();const d=!!b;a=m(a.currentTarget).closest(".tb_row_grid").data("slug");
let f=!1;b=b||c.Instances.Builder[c.builderIndex].$el.find(".module_row").last();0===b.length&&(b=c.Instances.Builder[c.builderIndex].$el.find("#tb_add_container"),f=!0);d?b.hasClass("tb_module_front")?c.Mixins.Builder.subRowDrop(a,m("<div>").insertAfter(b)):c.Mixins.Builder.subRowDrop(a,m("<div>").appendTo(b)):c.Mixins.Builder.rowDrop(c.Utils.grid(a),!1===f?m("<div>").insertAfter(b):m("<div>").insertBefore(b),!0,!0)},click_add_page_break(a,b){a.preventDefault();a.stopPropagation();b=b||c.Instances.Builder[c.builderIndex].$el.find(".module_row").last();
c.Mixins.Builder.rowDrop(c.toolbar.pageBreakModule.get(),m("<div>").insertAfter(b),!0);c.toolbar.pageBreakModule.countModules()},compactToolbar(){function a(){c.toolbar.$el.outerWidth()<b?x.document.body.classList.add("tb_compact_toolbar"):x.document.body.classList.remove("tb_compact_toolbar");c.toolbar.common.resize()}const b="visual"===c.mode?850:750;m(x).on("resize.compact",a);if("visual"===c.mode)x.jQuery("body").one("themify_builder_ready",a);else a()}},toggleFavoriteModule(){var a=m(this),b=
a.closest(".tb_module"),d=a.parent().data("module-slug");m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_module_favorite",module_name:d,module_state:+!b.hasClass("favorited")},beforeSend(f){function e(h,g){function k(){if(h.length){if(g)var n=0<h.closest("#tb_module_panel_dropdown").length?c.toolbar.$el:m("#tb_module_panel_dropdown");h.removeAttr("style");var l=h.data("categories").split(","),r=h.closest(".tb_module_panel_modules_wrap"),p=r.find('.tb_module_category_content[data-category="favorite"]');
if(h.hasClass("favorited")){for(var q=l.length-1;-1<q;--q){var v=r.find('.tb_module_category_content[data-category="'+l[q]+'"]').parent();v.find(".tb_module.tb-module-"+d).css({opacity:0,transform:"scale(0.5)"}).remove();v.find(".tb_module").length||v.css({display:"none"})}p.parent().css({display:"block"});h.clone().css({opacity:0,transform:"scale(0.5)"}).appendTo(p).css({opacity:1,transform:"scale(1)"})}else for(q=l.length-1;-1<q;--q){v=r.find('.tb_module_category_content[data-category="'+l[q]+'"]');
let w=h.clone().css({opacity:0,transform:"scale(0.5)"}),y=null,B=parseInt(w[0].dataset.index);for(;0!==--B&&!(y=v.find('[data-index="'+B+'"]'),0<y.length););y?w.insertAfter(y):v.prepend(w);v.parent().css({display:"block"});w.css({opacity:1,transform:"scale(1)"})}g&&e(n.find(".tb_module.tb-module-"+d),!1);h.remove();p.find(".tb_module").length||p.parent().css({display:"none"})}}if(h.length&&!h.is(":visible"))h.toggleClass("favorited"),k();else h.css({opacity:0,transform:"scale(0.5)"}).one("transitionend",
function(){h.toggleClass("favorited").one("transitionend",k)})}e(b,!0)}})},zoom(a){function b(){c.Utils._onResize(!0)}a.preventDefault();if("desktop"!==c.activeBreakPoint)return!0;var d=m(a.currentTarget);a=d.data("zoom");let f=m(".tb_iframe",x.document),e=d.closest(".tb_toolbar_zoom_menu");d.hasClass("tb_toolbar_zoom_menu_toggle")?(a="100"==a?50:100,d.data("zoom",a),d=d.next("ul").find('[data-zoom="'+a+'"]')):e.find(".tb_toolbar_zoom_menu_toggle").data("zoom",a);f.removeClass("tb_zooming_50 tb_zooming_75");
d.parent().addClass("selected-zoom-size").siblings().removeClass("selected-zoom-size");"50"==a||"75"==a?(d="50"==a?2:1.25,f.addClass("tb_zooming_"+a).one("transitionend",b).parent().addClass("tb_zoom_bg").css("height",Math.max(x.innerHeight*d,600)),e.addClass("tb_toolbar_zoom_active"),c.zoomMeta.isActive=!0,c.zoomMeta.size=a,z.body.addClass("tb_zoom_only")):(f.addClass("tb_zooming_"+a).one("transitionend",b).parent().css("height",""),e.removeClass("tb_toolbar_zoom_active"),c.zoomMeta.isActive=!1,
z.body.removeClass("tb_zoom_only"))},previewBuilder(a){a.preventDefault();m(a.currentTarget).toggleClass("tb_toolbar_preview_active");c.isPreview=!c.isPreview;c.isPreview||(c.iframe[0].style.height="");z.body.toggleClass("tb_preview_only themify_builder_active");m("body",x.document).toggleClass("tb_preview_parent");if(c.isPreview){const d=u.getElementsByClassName("row_inner");for(let f=d.length-1;-1<f;--f)if(d[f].classList.contains("col-count-1")&&0===d[f].getElementsByClassName("active_module").length){var b=
d[f].getElementsByClassName("module_column")[0];if((b=c.Models.Registry.lookup(b.getAttribute("data-cid")))&&0===Object.keys(b.get("styling")).length){b=d[f].closest(".module_row");let e=c.Models.Registry.lookup(b.getAttribute("data-cid"));e&&0===Object.keys(e.get("styling")).length&&b.classList.add("tf_hide")}}}else m(".tf_hide.module_row").removeClass("tf_hide");"visual"===c.mode&&(!x.document.body.classList.contains("tb_panel_minimized")&&t.Lightbox.dockMode.get()&&c.Utils._onResize(!0),c.isPreview||
"desktop"===c.activeBreakPoint||(a.tb_device="mobile"===c.activeBreakPoint?[tbLocalScript.breakpoints[c.activeBreakPoint],""]:tbLocalScript.breakpoints[c.activeBreakPoint],a.currentTarget=a.target=c.toolbar.el.getElementsByClassName("breakpoint-"+c.activeBreakPoint)[0],this.breakpointSwitcher(a)));c.vent.trigger("dom:preview")},toggleAccordion(a){m(a.currentTarget).closest(".tb_module_panel_tab_acc_component").toggleClass("tb_collapsed")},closeFloat(a){a&&(a.preventDefault(),a.stopPropagation(),localStorage.setItem("tb_panel_closed",
!0));x.document.body.classList.add("tb_panel_closed")},openFloat(a){a&&(a.preventDefault(),a.stopPropagation(),localStorage.removeItem("tb_panel_closed"));x.document.body.classList.remove("tb_panel_closed");c.toolbar.common.hide(!0)}});c.Forms={Data:{},Validators:{},parseSettings(a,b){var d=a.classList;b=b?a.getAttribute("data-input-id"):a.getAttribute("id");if(!d.contains("tb_row_js_wrapper")){var f=a.closest(".tb_field");if(null!==f&&!f.classList.contains("_tb_hide_binding")&&("none"!==f.style.display||
-1===f.className.indexOf("tb_group_element_"))&&(f=f.parentNode,f.classList.contains("tb_multi_fields")&&f.parentNode.classList.contains("_tb_hide_binding")))return!1}f="";if(d.contains("tb_lb_wp_editor"))"undefined"!==typeof tinyMCE?(f=a.id,d=tinyMCE.get(f),f=null!==d?!1===d.hidden?d.getContent():switchEditors.wpautop(tinymce.DOM.get(f).value):a.value):f=a.value;else if(d.contains("themify-checkbox")){f=[];a=a.getElementsByClassName("tb-checkbox");d=d.contains("tb_switcher");for(let k=0,n=a.length;k<
n;++k)!0!==d&&!0!==a[k].checked||""===a[k].value||f.push(a[k].value);f=0<f.length?f.join("|"):d?"":!1}else if(d.contains("themify-layout-icon"))f=a.getElementsByClassName("selected")[0],f=void 0!==f?f.id:"";else if(d.contains("tb_search_input")){if(f=a.getAttribute("data-value"),a=a.closest(".tb_input").getElementsByClassName("query_category_multiple")[0])a=void 0===a?"":a.value.trim(),f=""!==a?a+"|"+(-1!==a.indexOf(",")?"multiple":"single"):f+"|single"}else if(d.contains("tb_radio_input_container")){a=
a.getElementsByTagName("input");d=null;for(var e=a.length-1;-1<e;--e)if(!0===a[e].checked){d=a[e];break}null===d||"desktop"!==c.activeBreakPoint&&d.classList.contains("responsive_disable")||(f=d.value)}else if(d.contains("tb_search_container"))f=a.previousElementSibling.dataset.value;else if(d.contains("tb_row_js_wrapper")){f=[];a=a.getElementsByClassName("tb_repeatable_field_content");for(let k=0,n=a.length;k<n;++k){d=a[k].getElementsByClassName("tb_lb_option_child");f[k]={};for(let l=0,r=d.length;l<
r;++l)(e=this.parseSettings(d[l],!0))&&(f[k][e.id]=e.v)}}else if(d.contains("module-widget-form-container"))f=m(a).find(":input").themifySerializeObject();else if(d.contains("tb_widget_select"))f=a.getElementsByClassName("selected")[0],f=void 0!==f?f.dataset.value:"";else if(d.contains("tb_sort_fields_parent")){a=a.children;f=[];for(let k=0,n=a.length;k<n;++k)if(d=a[k].getAttribute("data-type")){e=a[k].getElementsByClassName("tb_sort_field_dropdown")[0];d={type:d,id:a[k].getAttribute("data-id")};
if(void 0!==e){d.val={};e=e.getElementsByClassName("tb_lb_sort_child");for(var h=e.length-1;-1<h;--h){var g=this.parseSettings(e[h],!0);g&&(d.val[g.id]=g.v)}}else e=a[k].getElementsByTagName("input")[0].value,""!==e&&(d.val=JSON.parse(e));f.push(d)}0===f.length&&(f="")}else if(d.contains("tb_accordion_fields")){a=a.children;f={};for(let k=0,n=a.length;k<n;++k)if(d=a[k].getAttribute("data-id"))h=a[k].getElementsByTagName("input")[0],g=a[k].getElementsByClassName("tb_accordion_fields_options")[0],e=
{},void 0!==g?e.val=this.serialize(g,null,!0):(h=h.value,""!==h&&(e.val=JSON.parse(h))),f[d]=e}else if(d.contains("tb_toggleable_fields")){a=a.children;f={};for(let k=0,n=a.length;k<n;++k)if(d=a[k].getAttribute("data-id"))h=a[k].getElementsByTagName("input")[0],g=a[k].getElementsByClassName("tb_toggleable_fields_options")[0],e={on:a[k].getElementsByClassName("tb_switcher")[0].getElementsByClassName("toggle_switch")[0].value},void 0!==g?e.val=this.serialize(g,null,!0):(h=h.value,""!==h&&(e.val=JSON.parse(h))),
f[d]=e}else if(f=a.value,void 0!==I.tbpDynamic&&b===tbpDynamic.field_name){if(""===f)return!1;"string"===typeof f&&(f=JSON.parse(f))}else{if(b===c.GS.key&&"desktop"!==c.activeBreakPoint)return!1;""!==f&&("builder_content"===b?"string"===typeof f&&(f=JSON.parse(f)):(a=a.getAttribute("data-opacity"),null!==a&&""!==a&&1!=a&&"0.99"!=a&&(f+="_"+a)))}if(void 0===f||null===f)f="";return{id:b,v:f}},serialize(a,b,d){const f={};a="object"===typeof a?a:x.document.getElementById(a);d=d||!1;if(null!==a){a=a.getElementsByClassName(d?
"tb_lb_option_child":"tb_lb_option");for(let e=a.length-1;-1<e;--e){let h=this.parseSettings(a[e],d);!1===h||!0!==b&&""===h.v||(f[h.id]=h.v)}}return f},LayoutPart:{cache:[],undo:null,old_id:null,isReload:null,id:null,init:!1,html:null,el:null,options:null,isSaved:null,scrollTo(a,b){c.scrollTo=c.Forms.LayoutPart.el},edit(a){function b(g){c.ActionBar.clear();u.getElementById("themify_builder_content-"+themifyBuilder.post_ID).insertAdjacentHTML("afterbegin",'<div class="tb_overlay"></div>');f.addClass("tb_active_layout_part").closest(".row_inner").find(".active_module").each(function(){this.classList.contains("tb_active_layout_part")||
this.insertAdjacentHTML("afterbegin",'<div class="tb_overlay"></div>')});const k="themify_builder_content-"+d.id,n=[];d.html=f[0].innerHTML;themifyBuilder.post_ID=ThemifyStyles.builder_id=d.id;f[0].insertAdjacentHTML("afterbegin",h.replace("#postID#",d.id));m("."+k).each(function(){m(this).closest(".active_module").find(".themify-builder-generated-css").first().prop("disabled",!0)});c.Instances.Builder[0].el.classList.remove("tb_active_builder");f.removeClass("active_module module").closest(".tb_holder").removeClass("tb_holder").addClass("tb_layout_part_parent").closest(".module_row").addClass("tb_active_layout_part_row");
e.attr("id",k).removeClass("not_editable_builder").addClass("tb_active_builder").empty();d.el=f;c.id=d.id;c.builderIndex=1;c.Instances.Builder[c.builderIndex]=new c.Views.Builder({el:e,collection:new c.Collections.Rows(g),type:c.mode});g=c.Instances.Builder[c.builderIndex].render().el.querySelectorAll("[data-cid]");for(let l=0,r=g.length;l<r;++l)n[g[l].dataset.cid]=1;c.bootstrap(n,function(){f.triggerHandler("tb_layout_part_before_init");c.activeModel=null;c.Utils.runJs(e);c.id=!1;z.body.on("themify_builder_change_mode",
d.scrollTo);c.hasChanged=null;c.Instances.Builder[c.builderIndex].$el.triggerHandler("tb_init");f.find(".tb_toolbar_save").on("click",d.save.bind(d));f.find(".tb_toolbar_close_btn").on("click",d.close.bind(d));f.find(".tb_load_layout").on("click",c.Views.Toolbar.prototype.loadLayout);f.find(".tb_toolbar_import ul a").on("click",c.Views.Toolbar.prototype.import);t.showLoader("hide");d.init=!1;d.undo=c.undoManager.stack;c.undoManager.btnUndo=f[0].getElementsByClassName("tb_undo_btn")[0];c.undoManager.btnRedo=
f[0].getElementsByClassName("tb_redo_btn")[0];c.undoManager.reset();f.find(".tb_undo_redo").on("click",function(l){c.undoManager.do_change(l)});c.ActionBar.disable=c.ActionBar.hoverCid=null;f.triggerHandler("tb_layout_part_after_init")})}c.ActionBar.disable=!0;t.showLoader("show");u.body.classList.add("tb_layout_part_edit");if(null!==c.activeModel){const g=t.Lightbox.$lightbox[0].getElementsByClassName("builder_save_button")[0];void 0!==g&&g.click()}x.document.body.classList.add("tb_layout_part_edit");
const d=this,f=m(a).closest(".active_module"),e=f.find(".themify_builder_content"),h=t.templateCache.get("tmpl-small_toolbar");this.id=e.data("postid");this.old_id=themifyBuilder.post_ID;this.init=!0;this.isSaved=null;void 0!==this.cache[this.id]?b(this.cache[this.id]):m.ajax({type:"POST",dataType:"json",url:themifyBuilder.ajaxurl,data:{action:"tb_layout_part_swap",nonce:themifyBuilder.tb_load_nonce,id:d.id},success(g){g.data&&(d.cache[d.id]=g.data,g.gs&&(c.GS.styles=m.extend(!0,{},g.gs,c.GS.styles)),
b(g.data))}})},close(a){function b(){d.el.removeClass("tb_active_layout_part").addClass("active_module module").closest(".tb_layout_part_parent").addClass("tb_holder").removeClass("tb_layout_part_parent").closest(".module_row").removeClass("tb_active_layout_part_row");m("#tb_small_toolbar",d.el).remove();const e=f[0].querySelectorAll("[data-cid]");for(let h=e.length-1;-1<h;--h){let g=e[h].dataset.cid,k=c.Models.Registry.lookup(g);k&&(k.destroy(),c.Models.Registry.remove(g))}f.removeAttr("id").addClass("not_editable_builder").removeClass("tb_active_builder");
u.body.classList.remove("tb_layout_part_edit");x.document.body.classList.remove("tb_layout_part_edit");m(".tb_overlay").remove();c.undoManager.stack=d.undo;c.undoManager.index=d.undo.length-1;c.undoManager.btnUndo=c.toolbar.el.getElementsByClassName("tb_undo_btn")[0];c.undoManager.btnRedo=c.toolbar.el.getElementsByClassName("tb_redo_btn")[0];themifyBuilder.post_ID=ThemifyStyles.builder_id=d.old_id;d.undo=d.isSaved=d.old_id=d.html=d.id=d.options=d.isReload=d.el=c.Instances.Builder[c.builderIndex]=
null;delete c.Instances.Builder[c.builderIndex];c.builderIndex=0;z.body.off("themify_builder_change_mode",d.scrollTo);c.undoManager.updateUndoBtns();c.ActionBar.hoverCid=null;c.ActionBar.clear();c.Instances.Builder[c.builderIndex].el.classList.add("tb_active_builder");c.Instances.Builder[c.builderIndex].lastRowAddBtn()}a.preventDefault();a.stopPropagation();if(!c.hasChanged&&!c.undoManager.hasUndo()||null!==this.isSaved||confirm(themifyBuilder.i18n.layoutEditConfirm)){null!==c.activeModel&&t.Lightbox.close();
var d=this,f=this.el.find(".themify_builder_content");if(null!==this.options){t.showLoader("show");a=c.Models.Registry.lookup(this.el.data("cid"));this.cache[this.id]=this.options;const e=function(g,k,n){if(-1!==n.data.indexOf("tb_load_module_partial",3))if(m(this).off("ajaxComplete",e),200===k.status){d.el=c.liveStylingInstance.$liveStyledElmt;f=d.el.find(".themify_builder_content");let l=f[0].innerHTML,r="";d.el.find(".themify-builder-generated-css").each(function(){r+=this.outerHTML});m(".themify_builder_content-"+
d.id).each(function(){const p=m(this).closest(".module");p.children("link.themify-builder-generated-css").remove();""!==r&&p[0].insertAdjacentHTML("afterbegin",r);this.innerHTML=l;c.Utils.runJs(m(this))});t.showLoader("hide");b()}else t.showLoader("error")};m(u).ajaxComplete(e);const h=m.extend(!0,{},a.get("mod_settings"));h.unsetKey=!0;a.trigger("custom:preview:refresh",h)}else this.el[0].innerHTML=d.html,b(),m(".themify_builder_content-"+d.id).each(function(){m(this).closest(".active_module").find(".themify-builder-generated-css").removeAttr("disabled")}),
c.Utils.runJs(f)}},save(a,b){a.preventDefault();a.stopPropagation();if(null!==c.activeModel){const d=t.Lightbox.$lightbox[0].getElementsByClassName("builder_save_button")[0];void 0!==d&&d.click()}if(c.undoManager.hasUndo()||null!==this.isReload||b){const d=this;this.old_settings=this.html=null;t.showLoader("show");c.Utils.saveBuilder(function(f){d.options=f.data.builder_data;c.hasChanged=null;d.isSaved=!0;b&&d.close(a)})}else t.showLoader("show"),setTimeout(function(){t.showLoader("hide")},100)}},
reLoad(a,b,d){function f(){"visual"===c.mode&&(c.liveStylingInstance.setCss(c.Mixins.Builder.toJSON(c.Instances.Builder[g].el)),c.Utils.runJs(c.Instances.Builder[g].$el),c.id=!1);c.Instances.Builder[c.builderIndex].$el.triggerHandler("tb_init");t.showLoader("hide");"visual"===c.mode&&"desktop"!==c.activeBreakPoint&&(m("body",x.document).height(u.body.scrollHeight),setTimeout(function(){m("body",x.document).height(u.body.scrollHeight)},2E3));d&&d();c.hasChanged=!0}var e=void 0!==a.builder_data?a.builder_data:
a;const h=null!==c.Forms.LayoutPart.id,g=c.builderIndex;void 0!==a.used_gs&&(c.GS.styles=m.extend(!0,{},a.used_gs,c.GS.styles));let k=null,n="";h||(c.Models.Registry.destroy(),c.Instances.Builder={});"visual"===c.mode?(n="#themify_builder_content-"+b,c.id=b,h||(c.liveStylingInstance.reset(),c.editing=!1,z.body.addClass("sidebar-none full_width"),m("#sidebar,.page-title").remove())):n="#tb_row_wrapper";if(h){b=c.Instances.Builder[g].el.querySelectorAll("[data-cid]");c.Forms.LayoutPart.isReload=!0;
for(let l=0,r=b.length;l<r;++l){let p=b[l].dataset.cid,q=c.Models.Registry.lookup(p);q&&(q.destroy(),c.Models.Registry.remove(p))}c.Instances.Builder[g].$el.empty()}c.Instances.Builder[g]=new c.Views.Builder({el:n,collection:new c.Collections.Rows(e),type:c.mode});c.Instances.Builder[g].render();c.undoManager.reset();if(h){k=[];e=c.Instances.Builder[g].el.querySelectorAll("[data-cid]");for(let l=0,r=e.length;l<r;++l)k[e[l].dataset.cid]=1}"visual"===c.mode?c.bootstrap(k,f,void 0!==a.used_gs?a.used_gs:
null):f()},isValidate(a){const b=a.getElementsByClassName("tb_must_validate");var d=b.length;if(0===d)return!0;var f=!0;for(--d;-1<d;--d){var e=b[d].getElementsByClassName("tb_lb_option")[0],h=b[d].getAttribute("data-validation"),g=e.value;if(c.Forms.get_validator(h)(g))for(e.classList.remove("tb_field_error"),e=b[d].getElementsByClassName("tb_field_error_msg"),h=e.length-1;-1<h;--h)e[h].parentNode.removeChild(e[h]);else e.classList.contains("tb_field_error")||(f=u.createElement("span"),h="SELECT"===
e.tagName?e.parentNode:e,f.className="tb_field_error_msg",f.textContent=b[d].getAttribute("data-error-msg"),e.classList.add("tb_field_error"),h.parentNode.insertBefore(f,h.nextSibling)),f=!1}!1===f&&(a=t.Lightbox.$lightbox.find('[href="#'+a.getAttribute("id")+'"]')[0],a.parentNode.classList.contains("current")||a.click());return f}};c.Utils={onResizeEvents:[],gridClass:"col-full col2-1 col3-1 col4-1 col5-1 col6-1 col4-2 col4-3 col3-2".split(" "),_onResize(a,b){let d=m._data(I,"events"),f;d&&(d=d.resize);
m(x).off("resize.tb_visual").on("resize.tb_visual",function(e){f&&clearTimeout(f);f=setTimeout(function(){z.trigger("tfsmartresize");m(I).triggerHandler("tfsmartresize");if(c.zoomMeta.isActive){let h="50"==c.zoomMeta.size?2:1.25;m(".tb_workspace_container",x.document).css("height",Math.max(x.innerHeight*h,600))}},400)});if(d)for(let e=0,h=d.length;e<h;++e)void 0!==d[e].handler&&this.onResizeEvents.push(d[e].handler);m(I).off("resize");if(a){a=m.Event("resize",{type:"resize",isTrigger:!1});for(let e=
0,h=this.onResizeEvents.length;e<h;++e)try{this.onResizeEvents[e].apply(I,[a,m])}catch(g){}z.trigger("tfsmartresize");m(I).triggerHandler("tfsmartresize");"function"===typeof b&&b()}},_addNewColumn(a,b){a=c.Views.init_column({grid_class:a.newclass,component_name:a.component});b.appendChild(a.view.render().el)},filterClass(a){a=a.split(" ");const b=[];for(let d=a.length-1;-1<d;--d)-1!==this.gridClass.indexOf(a[d])&&b.push(a[d]);return b.join(" ")},_getRowSettings(a,b){b=b||"row";var d={},f=c.Models.Registry.lookup(a.getAttribute("data-cid"));
if(f){a=a.getElementsByClassName(b+"_inner")[0];d=[];for(let g=0,k=a.children,n=k.length;g<n;++g){var e=c.Models.Registry.lookup(k[g].getAttribute("data-cid"));if(e){let l=k[g].getElementsByClassName("tb_holder")[0],r=d.push({element_id:e.get("element_id"),grid_class:this.filterClass(k[g].className)});--r;if(void 0!==l){l=l.children;let p=[];for(let q=0,v=l.length;q<v;++q){var h=c.Models.Registry.lookup(l[q].getAttribute("data-cid"));h&&(b=h.get("mod_settings"),h=p.push({mod_name:h.get("mod_name"),
element_id:h.get("element_id")})-1,b&&0<Object.keys(b).length&&(delete b.cid,p[h].mod_settings=b),l[q].classList.contains("active_subrow")&&(p[h]=this._getRowSettings(l[q],"subrow")))}0<p.length&&(d[r].modules=p)}b=parseFloat(k[g].style.width);0<b&&!isNaN(b)&&(d[r].grid_width=b);(b=e.get("styling"))&&0<Object.keys(b).length&&(delete b.cid,d[r].styling=b)}}d={element_id:f.get("element_id"),cols:d,column_alignment:f.get("column_alignment"),gutter:f.get("gutter"),column_h:f.get("column_h")};b={gutter:"gutter-default",
column_alignment:ba?"col_align_middle":"col_align_top"};e={desktop_dir:"ltr",tablet_dir:"ltr",tablet_landscape_dir:"ltr",mobile_dir:"ltr",col_tablet_landscape:"-auto",col_tablet:"-auto",col_mobile:"-auto"};for(let g in d)""!==d[g]&&null!==d[g]&&d[g]!==b[g]||delete d[g];b=f.get("styling");for(let g in e)f=a.getAttribute("data-"+g),null===f||""===f||f===e[g]||"-auto"===e[g]&&-1!==f.indexOf("-auto")||(d[g]=f.trim());b&&0<Object.keys(b).length&&(delete b.cid,d.styling=b)}return d},selectedGridMenu(a,
b){var d=ThemifyConstructor.breakpointsReverse;const f=c.Models.Registry.lookup(a.getAttribute("data-cid")),e=a.getElementsByClassName(b+"_inner")[0];var h=f.get("gutter");const g=f.get("column_alignment")||"col_align_top",k=f.get("column_h"),n=f.get("desktop_dir"),l="row"===b?f.get("styling"):null;b=[];const r={},p=e.children,q=p.length;for(let v=q-1;-1<v;--v)p[v].className=p[v].className.replace(/first|last/ig,""),1!==q&&(0===v?p[v].className+="rtl"===n?" last":" first":v===q-1&&(p[v].className+=
"rtl"===n?" first":" last"));b.push("col-count-"+q);r["data-basecol"]=q;null!==l&&void 0!==l.row_anchor&&""!==l.row_anchor&&(a.getElementsByClassName("tb_row_anchor")[0].textContent=l.row_anchor);"gutter-default"!==h&&b.push(h);k&&b.push("col_auto_height");b.push(g);"ltr"!==n&&b.push("direction-rtl");for(a=d.length-1;-1<a;--a)h=f.get(d[a]+"_dir"),"ltr"!==h&&""!==h&&(r["data-"+d[a]+"_dir"]=h),"desktop"!==d[a]&&(h=f.get("col_"+d[a]),"-auto"!==h&&""!==h&&void 0!==h&&(r["data-col_"+d[a]]=h));for(d=b.length-
1;-1<d;--d)b[d]&&e.classList.add(b[d]);for(let v in r)e.setAttribute(v,r[v])},clear(a,b){void 0===b&&(b=Array.isArray(a));const d=!0===b?[]:{},f=void 0!==I.tbpDynamic?tbpDynamic.field_name:!1;for(let g in a)if(a.hasOwnProperty(g)&&"null"!==g)if(Array.isArray(a[g])){var e=this.clear(a[g],!0);0<e.length&&(!0===b?d.push(e):d[g]=e)}else if(g===f)if("{}"===a[g]||""===a[g])delete a[g],delete d[g];else{e=a[g];"string"===typeof e&&(e=JSON.parse(e));for(let k in e)"undefined"===typeof e[k].repeatable&&(void 0===
e[k].item?delete e[k]:void 0!==a[k]&&(delete a[k],delete d[k]));a[g]=d[g]=e}else if("object"===typeof a[g]){if("breakpoint_mobile"===g||"breakpoint_tablet"===g||"breakpoint_tablet_landscape"===g){e=a[g];for(let k in e)if(void 0===e[k]||null===e[k]||""===e[k])delete e[k];else if("px"===e[k]&&-1!==k.indexOf("_unit",2)){var h=k.replace("_unit","");if(void 0===e[h]||""===e[h])delete e[k],""===e[h]&&delete e[h]}}else e=this.clear(a[g],!1);e&&0<Object.keys(e).length&&(d[g]=e)}else if(null!==a[g]&&void 0!==
a[g]&&""!==a[g]&&"def"!==a[g]&&""!==g&&"pixels"!==a[g]&&"default"!==a[g]&&"|"!==a[g]&&!("hide_anchor"===g&&!a[g]||"show"===a[g]&&0===g.indexOf("visibility_")||"unstick_when_condition"===g&&"hits"===a[g]||"unstick_when_pos"===g&&"this"===a[g]||"unstick_when_element"===g&&"builder_end"===a[g]||("stick_at_pos_val_unit"===g||"unstick_when_pos_val_unit"===g)&&"px"===a[g]))if("custom_parallax_scroll_speed"!==g||a[g])if("unstick_when_check"!==a[g]&&("unstick_when_check"===g||"unstick_when_check_tl"===g||
"unstick_when_check_t"===g||"unstick_when_check_m"===g)||"builder_end"===a[g]&&("unstick_when_element"===g||"unstick_when_element_tl"===g||"unstick_when_element_t"===g||"unstick_when_element_m"===g)||"stick_at_check"===g&&"stick_at_check"!==a[g]||!("-1"!=a[g]&&a[g]||"stick_at_check_tl"!==g&&"stick_at_check_t"!==g&&"stick_at_check_m"!==g)){e="";if("unstick_when_element_tl"===g||"stick_at_check_tl"===g||"unstick_when_check_tl"===g)e="_ti";else if("unstick_when_element_t"===g||"stick_at_check_t"===g||
"unstick_when_check_t"===g)e="_t";else if("unstick_when_element_m"===g||"stick_at_check_m"===g||"unstick_when_check_m"===g)e="_m";delete d["unstick_when_el_row_id"+e];delete d["unstick_when_el_mod_id"+e];delete d["unstick_when_condition"+e];delete a["unstick_when_el_row_id"+e];delete a["unstick_when_el_mod_id"+e];delete a["unstick_when_condition"+e];delete d["unstick_when_pos"+e];delete d["unstick_when_pos_val"+e];delete d["unstick_when_element"+e];delete d["unstick_when_pos_val_unit"+e];delete a["unstick_when_pos"+
e];delete a["unstick_when_pos_val"+e];delete a["unstick_when_pos_val_unit"+e];delete a["unstick_when_element"+e];if("stick_at_check"===g||"stick_at_check_tl"===g||"stick_at_check_t"===g||"stick_at_check_m"===g){if("stick_at_check"===g||"-1"==a[g])delete a[g],delete d[g];delete a["stick_at_position"+e];delete d["stick_at_position"+e]}}else if(void 0===g||null===g||""===g||!1===g||"stick_at_position"===g&&"top"===a[g]||g===c.GS.key&&""===a[g].trim()||"background_gradient-css"===g||"cover_gradient-css"===
g||"cover_gradient_hover-css"===g||"background_image-type_image"===g||"custom_parallax_scroll_reverse_reverse"===g||"|single"===a[g]||"|multiple"===a[g]||("custom_parallax_scroll_reverse"===g||"custom_parallax_scroll_fade"===g||"visibility_all"===g||"sticky_visibility"===g)&&!a[g])delete a[g],delete d[g];else{if("builder_content"===g)"string"===typeof a[g]&&(a[g]=JSON.parse(a[g])),a[g]=this.clear(a[g],!0);else{e=[];if(0===g.indexOf("checkbox_")&&-1!==g.indexOf("_apply_all",6)){a[g]?d[g]=a[g]:e.push(g);
h=g.replace("_apply_all","").replace("checkbox_","");let k=["top","left","right","bottom"];for(let n=3;-1<n;--n){let l=h+"_"+k[n]+"_unit";"px"===a[l]?e.push(l):void 0!==a[l]&&null!==a[l]&&""!==a[l]&&(d[l]=a[l])}}else-1!==g.indexOf("gradient",3)?("180"==a[g]||"linear"===a[g]||a[g]===m.ThemifyGradient.default||!1===a[g]&&-1!==g.indexOf("-circle-radial",3))&&e.push(g):("px"===a[g]&&-1!==g.indexOf("_unit",2)||"background_zoom"===g&&""===a[g]||"none"===a[g]&&-1!==g.indexOf("frame_layout")||"solid"===a[g]||
!1===a[g]&&(-1!==g.indexOf("_user_role",3)||-1!==g.indexOf("_appearance",3))||!(a[g]&&"false"!==a[g]||"margin-top_opp_top"!==g&&"m_t_h_opp_top"!==g&&0!==g.indexOf("padding_opp_")&&0!==g.indexOf("margin_opp_")))&&e.push(g);if(0<e.length){for(h=e.length-1;-1<h;--h)delete d[e[h]],delete a[e[h]];e.length=0;continue}}!0===b?d.push(a[g]):d[g]=a[g]}else delete d.custom_parallax_scroll_reverse,delete d.custom_parallax_scroll_fade,delete d[g],delete a.custom_parallax_scroll_reverse,delete a.custom_parallax_scroll_fade,
delete a[g];return d},clearElementId(a,b){for(let f in a){!0===b?a[f].element_id=c.Utils.generateUniqueID():delete a[f].element_id;let e=void 0!==a[f].styling?a[f].styling:a[f].mod_settings;if(void 0!==e){if(void 0!==e.custom_css_id&&""!==e.custom_css_id)for(var d=2;;){let h=e.custom_css_id+"-"+d.toString(),g=u.getElementById(h);if(null===g||null===g.closest(".module_row")){e.custom_css_id=h;break}++d}void 0!==e.builder_content&&(d="string"===typeof e.builder_content?JSON.parse(e.builder_content):
e.builder_content,this.clearElementId(d,!0),e.builder_content=d)}void 0!==a[f].cols?this.clearElementId(a[f].cols,b):void 0!==a[f].modules&&this.clearElementId(a[f].modules,b)}},clearLastEmptyRow(a){for(let d=a.length-1;-1<d;--d){var b=void 0!==a[d].attributes?a[d].attributes:a[d];if(void 0===b.styling||null===b.styling||0===Object.keys(b.styling).length){b=b.cols;let f=!0;for(let e in b)if(void 0!==b[e].modules&&(0<b[e].modules.length||0<Object.keys(b[e].modules).length)||void 0!==b[e].styling&&
null!==b[e].styling&&0<Object.keys(b[e].styling).length){f=!1;break}if(!0===f)void 0!==a[d].cid&&(c.Models.Registry.remove(a[d].cid),a[d].destroy()),a.splice(d,1);else break}else break}},builderPlupload(a,b){const d=!!b;b=d?[b]:t.Lightbox.$lightbox[0].getElementsByClassName("tb_plupload_upload_uic");var f=b.length;if(0<f)for(a=d?!1:"new_elemn"===a?".plupload-clone":!1,void 0===this.pconfig&&(this.pconfig=JSON.parse(JSON.stringify(themify_builder_plupload_init)),this.pconfig.multipart_params._ajax_nonce=
themifyBuilder.tb_load_nonce,this.pconfig.multipart_params.topost=themifyBuilder.post_ID),--f;-1<f;--f)if(!b[f].classList.contains("tb_plupload_init")&&(!1===a||b[f].classList.contains(a))){let h=b[f];var e=h.getAttribute("id").replace("tb_plupload_upload_ui","");let g=m.extend(!0,{},this.pconfig),k=h.getAttribute("data-extensions"),n=["browse_button","container","drop_element","file_data_name"];g.multipart_params.imgid=e;for(let l=n.length-1;-1<l;--l)g[n[l]]=e+this.pconfig[n[l]];g.filters[0].extensions=
null!==k?k:null!==c.activeModel?g.filters[0].extensions.replace(/,zip|,txt/,""):"zip,txt";e=new x.plupload.Uploader(g);h.classList.add("tb_plupload_init");d&&e.bind("init",function(l){m(l.settings.browse_button).click()});e.bind("FilesAdded",function(l,r){l.refresh();l.start();t.showLoader("show")});e.bind("Error",function(l,r){l=m(".prompt-box .show-error");m(".prompt-box .show-login").hide();l.show();0<l.length&&l.html('<p class="prompt-error">'+r.message+"</p>");m(".overlay, .prompt-box").fadeIn(500)});
e.bind("FileUploaded",function(l,r,p){const q=JSON.parse(p.response);l=m("#tb_alert",x.document);p=200!==p.status||q.error?"error":"done";if(q.error)t.showLoader(p),alert(q.error);else if(d){const v=m("#tb_row_wrapper").children().clone(!0);l.promise().done(function(){q.custom_css&&(S=q.custom_css);c.Forms.reLoad(q,themifyBuilder.post_ID);const w=m("#tb_row_wrapper").children().clone(!0);t.Lightbox.close();c.undoManager.push("","","","import",{before:v,after:w,bid:themifyBuilder.post_ID})})}else t.showLoader(p),
l=this.getOption().container.closest(".tb_input"),p=l.getElementsByClassName("tb_uploader_input")[0],l=l.getElementsByClassName("thumb_preview")[0],p.value=q.large_url?q.large_url:q.url,void 0!==l&&ThemifyConstructor.file.setImage(l,q.thumb),z.triggerEvent(p,"change")});e.init();h.classList.remove("plupload-clone")}},grid(a){const b=[];a=parseInt(a);if(1===a)b.push({grid_class:"col-full"});else for(let d=0;d<a;++d)b.push({grid_class:"col"+a+"-1"});return[{cols:b}]},setCompactMode(a){a instanceof jQuery&&
(a=a.get());for(let b=a.length-1;-1<b;--b)185>a[b].clientWidth?a[b].classList.add("compact-mode"):a[b].classList.remove("compact-mode")},initNewEditor(a){if(3<parseInt(tinyMCE.majorVersion)){const b=tinyMCEPreInit.mceInit.tb_lb_hidden_editor;b.elements=a;b.selector="#"+a;a=new tinyMCE.Editor(a,b,tinyMCE.EditorManager);a.render();return a}},initQuickTags(a){"function"===typeof x.QTags&&(x.quicktags({id:a}),x.QTags._buttonsInit())},_getColClass(a){for(let b=0,d=a.length;b<d;++b)if(-1!==this.gridClass.indexOf(a[b]))return a[b].replace("col",
"")},getMouseEvents(){const a={mousedown:"mousedown",mousemove:"mousemove",mouseup:"mouseup"};z.isTouch&&(a.mousedown="touchstart",a.mousemove="touchmove",a.mouseup="touchend");return a},saveBuilder(a,b){if(null!==c.activeModel||0===c.builderIndex&&0<t.Lightbox.$lightbox.length&&t.Lightbox.$lightbox[0].classList.contains("tb_custom_css_lightbox")){var d=t.Lightbox.$lightbox[0].getElementsByClassName("builder_save_button")[0];d&&d.click()}d=c.Instances.Builder[c.builderIndex];const f=this,e=d.$el.data("postid"),
h=c.Mixins.Builder.toJSON(d.el);if(!0===b)return{id:e,data:h};c.GS.setImport(c.GS.styles,null,null,!0);null===S&&(S=themifyBuilder.custom_css,delete themifyBuilder.custom_css);t.showLoader("show");f.saveCss(h,S,e).done(function(){m.ajax({type:"POST",url:themifyBuilder.ajaxurl,cache:!1,data:{action:"tb_save_data",tb_load_nonce:themifyBuilder.tb_load_nonce,id:e,custom_css:S,data:JSON.stringify(c.Utils.clear(h)),sourceEditor:"visual"===c.mode?"frontend":"backend"},complete:function(g,k){"success"!==
k?(t.showLoader("error"),alert(themifyBuilder.i18n.errorSaveBuilder)):(g=g.responseJSON,m.isFunction(a)&&a.call(f,g),t.showLoader("hide"),c.editing=!0,z.body.triggerHandler("themify_builder_save_data",[g]))}})}).fail(function(){t.showLoader("error")})},saveCss(a,b,d){return m.ajax({type:"POST",url:themifyBuilder.ajaxurl,cache:!1,data:{css:JSON.stringify(c.GS.createCss(a,a[0]&&a[0].mod_name||null,!0)),action:"tb_save_css",custom_css:b,tb_load_nonce:themifyBuilder.tb_load_nonce,id:d}})},runJs(a,b){if(!b){var d;
b=null!==c.activeModel?c.activeModel.get("elType"):a?null==(d=c.Models.Registry.lookup(a.data("cid")))?void 0:d.get("elType"):null}"module"===b&&"visual"===c.mode&&z.fontAwesome(a);d=[];if("visual"===c.mode){const f=(a?a[0]:u).querySelectorAll("img[data-w]");for(let e=f.length-1;-1<e;--e){let h=f[e].getAttribute("width"),g=f[e].getAttribute("height");(h||g)&&d.push(c.Utils.resizeImage(f[e],h,g))}}Promise.allSettled(d).finally(f=>{z.reRun(a,b)})},createClearBtn(a){a.siblings(".tb_clear_btn tf_close").click(function(){m(this).hide();
a.val("").trigger("keyup")})},toRGBA(a){return ThemifyStyles.toRGBA(a)},getColor(a){let b=a.value;""!==b&&(null!==a.getAttribute("data-minicolors-initialized")?b=m(a).minicolors("rgbaString"):(a=a.getAttribute("data-opacity"),""!==a&&null!==a&&"1"!=a&&"0.99"!=a&&(b=this.toRGBA(b+"_"+a))));return b},getIcon(a,b){if("undefined"!==typeof themifyBuilder.fontello_prefix&&(new RegExp(themifyBuilder.fontello_use_suffix?themifyBuilder.fontello_prefix+"$":"^"+themifyBuilder.fontello_prefix)).test(a))return b=
u.createElement("i"),b.setAttribute("class",a),b;a="tf-"+a.trim().replace(" ","-");const d=u.createElementNS("http://www.w3.org/2000/svg","use"),f=u.createElementNS("http://www.w3.org/2000/svg","svg");let e="tf_fa "+a;b&&(e+=" "+b);f.setAttribute("class",e);d.setAttributeNS(null,"href","#"+a);f.appendChild(d);return f},getBPWidth(a){a=Array.isArray(themifyBuilder.breakpoints[a])?themifyBuilder.breakpoints[a]:themifyBuilder.breakpoints[a].toString().split("-");return a[a.length-1]},generateUniqueID(){return(Math.random().toString(36).substr(2,
4)+(new Date).getUTCMilliseconds().toString()).substr(0,7)},scrollTo(a){("desktop"===c.activeBreakPoint?m("html,body"):m("body",x.document)).scrollTop(a)},scrollToDropped(a,b){a||(a=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_cid_"+b)[0]);if(a)if("visual"===c.mode)this.scrollTo(m(a).offset().top-120);else if(b=u.getElementsByClassName("edit-post-layout__content")[0],void 0!==b){if(a.classList.contains("module_row"))a=a.offsetTop;else{let d=a.closest(".module_row");null!==
d?(d=m(d),a=d.offset().top+200-d.offsetParent().offset().top):a=a.offsetTop}m(b).scrollTop(a)}},addViewPortClass(a){a.style.transition="none";this.removeViewPortClass(a);let b=this.isInViewport(a);if(!1!==b){b=b.split(" ");for(let d=b.length-1;-1<d;--d)""!==b[d]&&a.classList.add(b[d])}a.style.transition=""},removeViewPortClass(a){const b=["top","left","bottom","right"];for(let d=4;-1<d;--d)a.classList.remove("tb_touch_"+b[d])},isInViewport(a){a=a.getBoundingClientRect();let b="";0>a.left?b="tb_touch_left":
a.right-1>=u.documentElement.clientWidth&&(b="tb_touch_right");if(0>a.top)b+=" tb_touch_top";else if(a.bottom+1>=u.documentElement.clientHeight||I.innerHeight+I.scrollY>=u.body.offsetHeight&&a.bottom+20>=u.documentElement.clientHeight)b+=" tb_touch_bottom";return""===b?!1:b},canvas:null,ctx:null,cache_images:{},resizeImage(a,b,d,f){"0"===b&&(b="");if(!b&&!d)return new Promise((h,g)=>{"string"!==typeof a&&(a.style.visibility=a.style.display="");h([a,b,d,b,d])});null===this.canvas&&(this.canvas=u.createElement("canvas"),
this.ctx=this.canvas.getContext("2d"),this.ctx.imageSmoothingQuality="high",this.ctx.imageSmoothingEnabled=!0);const e=this;return new Promise((h,g)=>{let k=u.createElement("span");const n=function(l){let r=l.getAttribute("data-orig");const p=function(){b?(l.setAttribute("width",b),l.style.width&&(l.style.width=b+"px")):l.removeAttribute("width");d?(l.setAttribute("height",d),l.style.height&&(l.style.height=d+"px")):l.removeAttribute("height")},q=function(){b&&(b=parseInt(b));d&&(d=parseInt(d));var w=
f.naturalWidth,y=f.naturalHeight,B=w/y,A=b,E=d;A||(A=b=parseInt(E*B));E||(E=d=parseInt(A/B));var C=A/w,G=E/y;B=l.currentSrc;C=C>G?C:G;A=A/C+.5>>0;E=E/C+.5>>0;w=(w-A)/2>>0;y=(y-E)/2>>0;C=l.getAttribute("srcset");G=l.getAttribute("data-ext");G||l.hasAttribute("data-ext")||(G=B.slice((B.lastIndexOf(".")-1>>>0)+2),"jpg"===G&&(G="jpeg"),G="image/"+G,l.setAttribute("data-ext",G));e.canvas.width=A;e.canvas.height=E;e.ctx.drawImage(f,w,y,A,E,0,0,A,E);C&&-1!==C.indexOf(B)?l.setAttribute("srcset",C.replaceAll(B,
e.canvas.toDataURL(G,1))):l.setAttribute("src",e.canvas.toDataURL(G,1));p();k&&k.remove();l.style.visibility=l.style.display="";k=r=null;h([l,b,d,A,E])};if(!r){r=l.getAttribute("src").trim();if(0!==r.indexOf(themifyBuilder.upload_url)||l.closest("[data-hasEditor]")){k&&k.remove();l.style.visibility=l.style.display="";p();k=r=null;h([l,b,d,b,d]);return}var v=l.getAttribute("width");const w=l.getAttribute("height");v&&w&&(v="-"+v+"x"+w,-1!==r.indexOf(v)&&(r=r.replace(v,"")));l.dataset.orig=r}if(f)q();
else{const w=z.hash(r+b+d);void 0!==e.cache_images[w]?(f=e.cache_images[w],q(),f=null):(f=new Image,f.src=r,f.crossOrigin="anonymous",f.decode().then(function(){q();e.cache_images[w]=f}).catch(y=>{k&&k.remove();l.style.visibility=l.style.display="";console.log(y);g()}))}};if("string"===typeof a){let l=0;const r=setInterval(function(){++l;8<l&&clearInterval(r);const p=c.Instances.Builder[c.builderIndex].el.querySelector(a);if(null!==p){clearInterval(r);k.className="tf_loader tf_loader_center";const q=
p.closest(".active_module");q?q.prepend(k):p.after(k);n(p)}},8)}else{if(!f){k.className="tf_loader tf_loader_center";const l=a.closest(".active_module");l?l.prepend(k):a.after(k)}n(a)}})},hideOnClick(a){void 0!==a[0]&&(a=a[0]);if(a.classList.contains("tb_ui_dropdown_items")||a.classList.contains("tb_down"))a.classList.add("tb_hide_option"),a.previousElementSibling.blur(),setTimeout(function(){a.classList.remove("tb_hide_option");a=null},500)},calculateHeight(){"visual"===c.mode&&"desktop"!==c.activeBreakPoint&&
(x.document.body.style.height=u.body.scrollHeight+"px")},changeOptions(a,b){const d="INPUT"===a.tagName&&"hide_anchor"!==b?"keyup":"change",f=this;"keyup"===d&&a.setAttribute("data-prev",a.value);f.custom_css_id=function(e,h,g,k){e=u.getElementById(k);return null===e||g[0].getAttribute("id")===k||null===e.closest(".module_row")?(g[0].setAttribute("id",k),!0):!1};f.row_anchor=function(e,h,g,k){"visual"===c.mode&&(g.removeClass(c.liveStylingInstance.getRowAnchorClass(e.getAttribute("data-prev"))),""!==
k&&g.addClass(c.liveStylingInstance.getRowAnchorClass(k)),g.data("anchor",k).attr("data-anchor",k));c.hasChanged=!0;g.find(".tb_row_anchor").first().text(k.replace("#",""));return!0};f.custom_css=function(e,h,g,k){"visual"===c.mode&&g.removeClass(e.getAttribute("data-prev")).addClass(k);return!0};f.layout=function(e,h,g,k){"visual"===c.mode&&c.liveStylingInstance.bindRowWidthHeight(h,k,g);return!0};f.hide_anchor=function(e,h,g,k){"visual"===c.mode&&"1"===k&&g.data("hideAnchor",k).attr("data-hide-anchor",
k);return c.hasChanged=!0};a.addEventListener(d,function(e){let h;var g=null!==c.activeModel&&c.ActionBar.cid===c.activeModel.cid;let k=!t.Lightbox.$lightbox[0].contains(this),n="hide_anchor"!==b?this.id:"hide_anchor",l="custom_css_id"===n,r=!0!==l||!1!==k&&!0!==g?void 0:t.Lightbox.$lightbox[0].getElementsByClassName("builder_save_button")[0],p;p=!0===k&&!1===g?m(".tb_element_cid_"+c.ActionBar.cid):"visual"===c.mode?c.liveStylingInstance.$liveStyledElmt:m(".tb_element_cid_"+c.activeModel.cid);const q=
!1===g&&!0===k?t.clone(p[0]):null;h=this.value;"keyup"===d&&"custom_css"!==b?((h=h.trim())&&(h=h.replace(/[^a-zA-Z0-9\-_]+/gi,"")),this.value=h):"layout"===b?h=e.detail.val:"hide_anchor"===b&&(h=this.checked?"1":"0");if(f[b].call(f,this,n,p,h)){l&&(m(this).next(".tb_field_error_msg").remove(),void 0!==r&&r.classList.remove("tb_disable_save"));if(!0===k){const v=function(){let w=h;"keyup"===d&&(this.removeEventListener("change",v,{passive:!0,once:!0}),this.removeAttribute("data-isInit"),w=this.value.trim());
let y=p.data("cid"),B=c.Models.Registry.lookup(y),A=m.extend(!0,{},B.get("styling"));A||(A={});const E=m.extend(!0,{},A);A[n]=w;B.set({styling:A},{silent:!0});null!==q&&c.undoManager.push(y,q,p,"save",{bsettings:E,asettings:m.extend(!0,{},A)})};"keyup"===d?this.getAttribute("data-isInit")||(this.setAttribute("data-isInit",1),this.addEventListener("change",v,{passive:!0,once:!0})):v()}c.hasChanged=!0}else l&&(e=u.createElement("span"),e.className="tb_field_error_msg",e.textContent=ThemifyConstructor.label.errorId,
this.parentNode.insertBefore(e,this.nextSibling),void 0!==r&&r.classList.add("tb_disable_save"));!0===g&&(g=k?t.Lightbox.$lightbox.find("#"+n):m("#"+c.ActionBar.el.id).find("#"+n),"keyup"===d?g.val(h).attr("data-prev",h):"layout"===b?(g.find(".selected").removeClass("selected"),""!==h?g.find("#"+h).addClass("selected"):g.children().first().addClass("selected")):"hide_anchor"===b&&(g.find("INPUT")[0].checked=this.checked));"keyup"===d&&this.setAttribute("data-prev",h)},{passive:!0})},visibilityLabel(a,
b){var d=b.cid;d=null!==c.activeModel&&d===c.activeModel.cid&&"visibility"===ThemifyConstructor.clicked?c.Forms.serialize("tb_options_visibility"):void 0;void 0===d&&(d="module"!==b.get("elType")?b.get("styling"):b.get("mod_settings"));if(d){b="";a=a.classList.contains("tb_visibility_hint")?a:a.getElementsByClassName("tb_visibility_hint")[0];const e={visibility_desktop:themifyBuilder.i18n.de,visibility_mobile:themifyBuilder.i18n.mo,visibility_tablet:themifyBuilder.i18n.ta,visibility_tablet_landscape:themifyBuilder.i18n.ta_l,
sticky_visibility:themifyBuilder.i18n.s_v};if(void 0!==a){if("hide_all"===d.visibility_all)b=themifyBuilder.i18n.h_a;else{let h;for(var f in e)h=""===b?"":", ",b+="hide"===d[f]?h+e[f]:""}""!==b?(f=a.getElementsByTagName("span")[0],void 0===f&&(f=u.createElement("span"),a.appendChild(f)),f.textContent=b,a.classList.add("tb_has_visiblity")):a.classList.remove("tb_has_visiblity")}}}};c.ActionBar={cid:null,topH:null,type:null,disable:null,prevExpand:null,needClear:!0,el:null,breadCrumbs:null,breadCrumbsPath:{lightbox:null,
rightClick:null},disablePosition:null,isInit:null,isHoverMode:!0,darkMode:null,inlineEditor:!0,hoverCid:null,contextMenu:null,contextMenuAnimate:null,init(){if(null===this.isInit&&!0!==c.GS.isGSPage){this.isInit=!0;this.el=u.createElement("div");this.breadCrumbs=u.createElement("ul");this.el.id="tb_component_bar";this.breadCrumbs.className="tb_action_breadcrumb";this.el.addEventListener("mousedown",this.mouseDown.bind(this));this.topH=c.toolbar.$el.height();"visual"===c.mode?u.body.appendChild(this.el):
c.Instances.Builder[c.builderIndex].el.parentNode.appendChild(this.el);u.addEventListener("click",this.click.bind(this));u.addEventListener("dblclick",this.click.bind(this));c.Instances.Builder[0].el.addEventListener("mouseover",this.enter);"visual"===c.mode&&x.document.addEventListener("click",this.click.bind(this));var a="visual"===c.mode?null:u.getElementById("tb_canvas_block");null===a?(u.addEventListener("keydown",this.actions.bind(this),{passive:!0}),x.document.addEventListener("keydown",this.actions.bind(this),
{passive:!0})):a.addEventListener("keydown",this.actions.bind(this),{passive:!0});this.changeMode();this.initRightClick(!0)}},changeMode(){this.hoverCid=null;const a=u.body.classList;!0===this.isHoverMode?(a.remove("tb_click_mode"),a.add("tb_hover_mode"),this.el.removeEventListener("click",this.actions)):(a.remove("tb_hover_mode"),a.add("tb_click_mode"),this.el.addEventListener("click",this.actions))},changeDarkMode(){var a=u.getElementById("darkmode-ui"),b="visual"===c.mode?x.document.getElementById("darkmode-ui"):
null;!0===this.darkMode?a?(a.disabled=!1,b&&(b.disabled=!1)):(a=x.document.createElement("link"),b=u.getElementById("visual"!==c.mode?"themify-builder-admin-ui-css":"themify-builder-inline-editor-css"),a.rel="stylesheet",a.href=themifyBuilder.builder_url+"/css/editor/darkmode-ui.css",a.id="darkmode-ui",b.parentNode.insertBefore(a,b.nextSibling),"visual"===c.mode&&x.document.head.appendChild(a.cloneNode())):(a.disabled=!0,b&&(b.disabled=!0))},initRightClick(a){localStorage.getItem("tb_right_click")?
!0===a?c.toolbar.el.getElementsByClassName("tb_right_click_mode")[0].checked=!1:(c.Instances.Builder[0].el.removeEventListener("contextmenu",this.rightClick),this.contextMenu=this.contextMenuAnimate=null):(c.Instances.Builder[0].el.addEventListener("contextmenu",this.rightClick),c.ActionBar.el.removeEventListener("contextmenu",this.rightClick),!0!==this.isHoverMode&&c.ActionBar.el.addEventListener("contextmenu",this.rightClick))},enter(a){const b=c.ActionBar;if(null===b.disable&&(c.Mixins.Builder.columnHover(a.target),
!0===b.isHoverMode&&null===b.disablePosition)){"click"===a.type&&a.preventDefault();a.stopPropagation();var d=a.target;let g=null;var f=d.classList;if(null!==b.prevExpand&&void 0!==b.prevExpand)if(b.prevExpand.contains(d)){if(f.contains("tb_inner_action_more")||f.contains("tb_action_more")){var e=d.getElementsByTagName("ul")[0];void 0!==e&&c.Utils.addViewPortClass(e)}e=b.prevExpand.getElementsByClassName("tb_row_settings")[0];if(void 0!==e){var h=u.getElementById(e.getAttribute("data-href"));if(h.contains(d))return;
h.classList.remove("selected");e.classList.remove("selected")}if("module"===b.type||"column"===b.type){"column"===b.type&&(b.hoverCid=d.parentNode.getAttribute("data-cid"));return}}else{e="module"!==b.type;if(!1===e)"visual"!==c.mode?(e=d.closest(".active_module"),e=null!==e?e.getAttribute("data-cid")!==b.hoverCid:!0):(h=d.closest(".tb_dragger_top"),null!==h&&h.classList.contains("tb_dragger_padding")&&c.EdgeDrag.setModulePosition(h));else if(f.contains("tb_clicked"))return;!0===e&&b.clear()}if(null===
d.closest(".tb_dragger_lightbox")){if(f.contains("tb_action_wrap"))g=!f.contains("tb_clicked");else{if("LI"===d.nodeName&&f.contains("tb_row_settings")&&!f.contains("selected")){b.actions(a);return}if(!f.contains("tb_grid_drag")){d=d.closest("[data-cid]");if(!d)return;f=d.getAttribute("data-cid");if(b.hoverCid===f)return;b.hoverCid=f;e=c.Models.Registry.lookup(f);f=e.get("elType");if("module"===f)g=!0;else if("visual"===c.mode){b.clear();c.EdgeDrag.addEdges(f,e,d);return}}}!0===g&&b.click(a)}}},rightClickGS(a,
b,d){this.disable=!0;null!==c.activeModel&&m(".builder_save_button",ThemifyBuilderCommon.Lightbox.$lightbox).click();const f=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_clicked"),e=c.GS.key;b=b.split(" ");for(let g=f.length-1,k=b.length;-1<g;--g){let n=c.Models.Registry.lookup(f[g].getAttribute("data-cid")),l=t.clone(f[g]),r="module"===n.get("elType")?"mod_settings":"styling",p=m.extend(!0,{},n.get(r)),q=m.extend(!0,{},p);c.activeModel=n;if(p[e])if(!0===d)a&&-1!==p[e].indexOf(a)&&
(p[e]=p[e].split(" "),p[e].splice(p[e].indexOf(a),1),p[e]=p[e].join(" "));else for(var h=0;h<k;++h)-1===p[e].indexOf(b[h])&&(p[e]+=" "+b[h]);else{if(0===k)continue;p[e]=b.join(" ")}h={};h[r]=p;n.set(h,{silent:!0});c.GS.generateValues(a,p[e].split(" "),d);c.undoManager.push(n.cid,l,m(f[g]),"save",{bsettings:q,asettings:p})}this.disable=null;c.activeModel=null},rightClick(a,b){a.stopImmediatePropagation();const d=c.ActionBar;if(!(null!==d.contextMenuAnimate||"visual"===c.mode&&u.activeElement.contentEditable&&
c.liveStylingInstance.$liveStyledElmt&&c.liveStylingInstance.$liveStyledElmt[0].contains(u.activeElement))){d.contextMenuAnimate=!0;if(null===d.contextMenu){const l=function(p){p.stopPropagation();"click"===p.type&&null===p.target.closest(".tb_visibility_wrap")&&p.preventDefault();if("LI"===p.target.nodeName||p.target.classList.contains("toggle_switch")){var q="LI"===p.target.nodeName?p.target.getAttribute("data-action"):"visibility";if(q){d.disable=!0;d.hoverCid=null;if("undo"===q||"redo"===q)if(p=
"undo"===q?c.undoManager.btnUndo:c.undoManager.btnRedo,"undo"===q&&c.undoManager.hasUndo()||"redo"===q&&c.undoManager.hasRedo())m(p).triggerHandler("click"),d.disable=null;else{d.disable=null;return}else{var v=this.classList.contains("tb_multiply_selected");let E,C,G,O,N,J,K,M=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_clicked"),R=void 0;"gs_in"!==q&&"move"!==q&&(!0!==v||"delete"!==q&&"paste"!==q||(R=!0),m(".builder_save_button",ThemifyBuilderCommon.Lightbox.$lightbox).click());
if("reset"===q)E=c.activeModel,C=m.extend(!0,{},ThemifyConstructor.values),G=ThemifyConstructor.component,O=ThemifyConstructor.beforeData,N=!0===c.hasChanged,J="visual"===c.mode?c.liveStylingInstance.prefix:null,K="visual"===c.mode?c.liveStylingInstance.$liveStyledElmt:null;else{if("move"===q){d.disable=null;return}if("gs_in"===q){if(!1===v){q=c.Models.Registry.lookup(M[0].dataset.cid);var w=m.extend(!0,{},ThemifyConstructor.values);ThemifyConstructor.values="module"===q.get("elType")?q.get("mod_settings"):
q.get("styling")}if(q=c.GS.globalStylesHTML())p=d.contextMenu.querySelector("#tb_inline_gs"),p.innerHTML="",p.appendChild(q),p.getElementsByClassName("tb_gs_icon")[0].click(),p.querySelector('[data-action="insert"]').click(),p.classList.add("tb_inline_gs_show"),c.Utils.addViewPortClass(d.contextMenu);!1===v&&(ThemifyConstructor.values=w);d.disable=null;return}}for(v=M.length-1;-1<v;--v){w=M[v].getAttribute("data-cid");let P=c.Models.Registry.lookup(w);var y=P.get("elType"),B="module"===y?P.get("mod_settings"):
P.get("styling");if("reset"===q||"gs_r"===q){if("gs_r"===q&&void 0===B[c.GS.key])continue;if(null!==c.activeModel&&c.activeModel.cid===w){var A=ThemifyBuilderCommon.Lightbox.$lightbox.find(".reset-styling")[0];if(void 0!==A){A.click();continue}}A=t.clone(M[v]);let Z;c.activeModel=P;"reset"===q&&(ThemifyConstructor.component=y,ThemifyConstructor.values=B);let ca="module"===y?"mod_setting":"styling";"visual"===c.mode&&(c.liveStylingInstance.$liveStyledElmt?c.liveStylingInstance.prefix=ThemifyStyles.getBaseSelector("module"===
y?c.activeModel.get("mod_name"):y,c.activeModel.get("element_id")):c.liveStylingInstance.init(!0),c.liveStylingInstance.$liveStyledElmt=m(M[v]));y=m.extend(!0,{},B);"reset"===q?(B=ThemifyConstructor.resetStyling(p,null!==E&&E.cid!==w),"visual"===c.mode&&(Z=m.extend(!0,{},B)),B=m.extend(!0,{},ThemifyConstructor.values)):(delete B[c.GS.key],c.GS.generateValues(null,[],!0));let U={};U[ca]=B;P.set(U,{silent:!0});c.hasChanged=!0;c.undoManager.push(w,A,m(M[v]),"save",{bsettings:y,asettings:B,styles:Z});
Z=null}else("delete"!==q&&"visibility"!==q||"column"!==y)&&P.trigger(q,p,p.target,R)}"reset"===q?(c.hasChanged=N,c.activeModel=E,ThemifyConstructor.values=C,ThemifyConstructor.component=G,ThemifyConstructor.beforeData=O,"visual"===c.mode&&(c.liveStylingInstance.$liveStyledElmt=K,c.liveStylingInstance.prefix=J)):"edit"!==q&&(c.activeModel=null);d.disable=null}"visibility"!==q&&d.hideContextMenu()}}},r=function(p){p.stopPropagation();p.target.classList.contains("tb_inner_action_more")&&(p=p.target.getElementsByTagName("ul")[0])&&
c.Utils.addViewPortClass(p)};d.contextMenu=u.getElementById("tb_right_click");null===d.contextMenu&&(d.contextMenu=u.getElementById("tmpl-builder_right_click").content,u.body.appendChild(d.contextMenu),d.contextMenu=u.getElementById("tb_right_click"),d.contextMenu.addEventListener("click",l),d.contextMenu.addEventListener("mouseover",r,{passive:!0}),d.contextMenu.getElementsByClassName("tb_r_name")[0].addEventListener("mousedown",function(p){1===p.which&&!d.contextMenu.classList.contains("tb_multiply_selected")&&
!d.contextMenu.classList.contains("tb_component_column")&&(p.preventDefault(),p.stopPropagation(),p=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_clicked")[0])&&(d.hideContextMenu(),d.cid=p.dataset.cid,d.moveComponent())}))}var f=!0;!0!==d.isHoverMode&&null!==d.cid?b=c.Instances.Builder[c.builderIndex].el.querySelector('[data-cid="'+d.cid+'"]'):b?f=!1:b=m(a.target).closest("[data-cid]")[0];if(void 0===b)d.contextMenuAnimate=null;else{a.preventDefault();d.hideContextMenu(a.target.classList.contains("tb_bread"));
d.disablePosition=!0;u.body.classList.add("tb_right_click_open");d.contextMenu.className="tb_show_context";var e=a.pageX,h=a.pageY,g=c.Models.Registry.lookup(b.dataset.cid),k=g.get("elType"),n=function(l){if("transform"===l.propertyName){var r=c.Instances.Builder[c.builderIndex].el,p=this.getElementsByClassName("tb_r_name")[0],q=this.getElementsByClassName("tb_action_breadcrumb")[0],v=function(y){y.preventDefault();y.stopPropagation();var B=y.target.getAttribute("data-id");B&&(this.removeEventListener("click",
v),d.hideContextMenu(!0),B=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_cid_"+B)[0],void 0!==B&&d.rightClick(y,B))};this.removeEventListener("transitionend",n,{passive:!0});this.className="tb_component_"+k;"module"===k&&(this.className+=" tb_module_"+g.get("mod_name"));q.innerHTML="";if(!0===a.ctrlKey||!0===a.metaKey)b.classList.add("tb_element_clicked");else if(!b.classList.contains("tb_element_clicked")){l=r.getElementsByClassName("tb_element_clicked");for(let y=l.length-
1;-1<y;--y)l[y].classList.remove("tb_element_clicked");b.classList.add("tb_element_clicked")}l=r.getElementsByClassName("tb_element_clicked").length;1<l?(this.className+=" tb_multiply_selected",p.textContent=themifyBuilder.i18n.multiSelected):(d.breadCrumbsPath.rightClick=d.getBreadCrumbPath(c.Instances.Builder[0].el.getElementsByClassName("tb_element_cid_"+(null===d.breadCrumbsPath.rightClick?g.cid:d.breadCrumbsPath.rightClick[d.breadCrumbsPath.rightClick.length-1]))[0],"rightClick"),q.appendChild(d.getBreadCrumbs(b,
"rightClick")),p.textContent="module"===k?themifyBuilder.modules[g.get("mod_name")].name:k);q.addEventListener("click",v);var w=function(y){"transform"===y.propertyName?(this.removeEventListener("transitionend",w,{passive:!0}),c.Utils.addViewPortClass(this),d.contextMenuAnimate=null):(this.style.top=h+"px",!0===f&&(this.style.left=e+"px"))};this.addEventListener("transitionend",w,{passive:!0});c.undoManager.hasUndo()||(this.className+=" tb_undo_disabled");"column"===k&&(this.className+=" tb_visibility_disabled");
c.undoManager.hasRedo()||(this.className+=" tb_redo_disabled");this.className+=" tb_show_context"}};d.contextMenu.addEventListener("transitionend",n,{passive:!0});setTimeout(function(){d.contextMenu.className=""},18)}}},hideContextMenu(a){null!==this.contextMenu&&(this.contextMenu.style.top="",this.contextMenu.querySelector("#tb_inline_gs").classList.remove("tb_inline_gs_show"),u.body.classList.remove("tb_right_click_open"),this.disablePosition=this.hoverCid=null,!0!==a&&(c.ActionBar.breadCrumbsPath.rightClick=
null))},mouseDown(a){1!==a.which||"row"!==this.type&&"subrow"!==this.type||!a.target.classList.contains("tb_move")||(a.preventDefault(),a.stopPropagation(),this.moveComponent())},moveComponent(){var a=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_cid_"+this.cid)[0];if(void 0!==a){let b=a.classList.contains("module_row")?a.getElementsByClassName("tb_row_action")[0]:a;a=m(a).offset();let d;this.clear();"function"===typeof Event?d=new Event("mousedown",{bubbles:!0,cancelable:!1}):
(d=u.createEvent("Event"),d.initEvent("mousedown",!0,!1));d.pageX=a.left;d.pageY=a.top;d.which=1;b.dispatchEvent(d)}},click(a){if(c.isPreview||!0===this.disable)return!0;var b=a.target,d=b.tagName,f=null,e=c.Instances.Builder[c.builderIndex].lastRow,h="visual"===c.mode&&b.ownerDocument===x.document?void 0:m(b).closest("[data-cid]")[0],g=a.type;if("click"===g){var k=t.Lightbox.$lightbox[0];this.hideContextMenu();f=!0===a.ctrlKey||!0===a.metaKey;if(x.document.body.classList.contains("tb_standalone_lightbox")&&
!x.document.body.classList.contains("modal-open")){c.toolbar.el.contains(b)||k.contains(b)||k.classList.contains("tb_predesigned_lightbox")||k.classList.contains("tb_custom_css_lightbox")||t.Lightbox.close();var n=x.document.getElementsByClassName("tb_current_menu_selected")[0];void 0!==n&&n.classList.remove("tb_current_menu_selected")}e&&!e.contains(b)&&e.classList.remove("expanded");if(!k.contains(b)&&(!1===f&&this.clearClicked(),void 0!==h)){if(!0===f&&h.classList.contains("tb_element_clicked")){h.classList.remove("tb_element_clicked");
return}h.classList.add("tb_element_clicked")}}else if("dblclick"===g&&null!==c.Forms.LayoutPart.id&&b.classList.contains("tb_overlay")){c.Forms.LayoutPart.save(a,!0);return}e=("click"===g||"dblclick"===g)&&"visual"===c.mode&&t.Lightbox.dockMode.get();if(void 0===h||h.classList.contains("tb_active_layout_part"))"LI"===d&&b.classList.contains("tb_bread")?(a=c.Models.Registry.lookup(b.getAttribute("data-id")),"setting"!==ThemifyConstructor.clicked&&"module"===ThemifyConstructor.component&&(b=t.Lightbox.$lightbox[0].getElementsByClassName("tb_lightbox_top_bar")[0].querySelector(".current a").getAttribute("href"),
t.Lightbox.$lightbox.off("themify_opened_lightbox.tb_breadCrumbs").on("themify_opened_lightbox.tb_breadCrumbs",function(){"row"===ThemifyConstructor.component?t.Lightbox.$lightbox.off("themify_opened_lightbox.tb_breadCrumbs")[0].getElementsByClassName("tb_lightbox_top_bar")[0].querySelector('a[href="'+this+'"]').click():null===c.activeModel&&t.Lightbox.$lightbox.off("themify_opened_lightbox.tb_breadCrumbs")}.bind(b))),this.breadCrumbsPath.lightbox=this.getBreadCrumbPath(c.Instances.Builder[0].el.getElementsByClassName("tb_element_cid_"+
(null===this.breadCrumbsPath.lightbox?c.activeModel.cid:this.breadCrumbsPath.lightbox[this.breadCrumbsPath.lightbox.length-1]))[0]),a.trigger("edit","breadcrumb")):this.el.contains(b)||"click"===a.type&&b.classList.contains("tb_dragger")||this.clear();else{"visual"!==c.mode||"A"!==d&&null===b.closest("a")||a.preventDefault();var l=h.getAttribute("data-cid");k=c.Models.Registry.lookup(l);n=k.get("elType");const r="row"===n&&h.classList.contains("tb-page-break");if(k){if("dblclick"===g){if((!0===e||
"INPUT"===d||!0===r||b.classList.contains("tb_dragger_lightbox")||null!==b.closest(".tb_clicked"))&&"tb_row_options"!==b.id)return;a.preventDefault();a.stopPropagation();!1===e&&!0!==this.isHoverMode?(h.classList.add("tb_element_clicked"),z.body[0].classList.add("tb_action_active"),"visual"===c.mode&&c.EdgeDrag.addEdges("module"===n?k.get("mod_name"):n,k,h)):h.classList.remove("tb_element_clicked");if(!b.classList.contains("tb_row_settings")){this.hoverCid=null;k.trigger("edit",a,b);return}}else if("click"===
g&&!1===e&&(b.classList.contains("tb_dragger")||null!==b.closest(".tb_dragger_options")))return;d=!0===this.isHoverMode;const p=!0!==d&&null!==this.cid,q="module"!==n?b.classList.contains("tb_action_wrap"):!0===d;this.cid=l;this.type=n;if(!0===r&&"row"===n)this.clear(),b.classList.contains("tb_row_anchor")&&(a.preventDefault(),a.stopPropagation(),k.trigger("delete",a,b));else if((!1===q||"module"===n&&!0===d)&&null!==b.closest(".tb_action_wrap"))"click"===g&&this.actions(a);else if(!0===d&&"click"===
g&&!0===this.needClear)!0===e&&!1===f&&k.trigger("edit",a,b);else if(this.clear(),!0===p&&"click"===g&&!1===f&&!1===e&&!0===this.needClear){z.body[0].classList.add("tb_action_active");const v=this,w=function(){this.removeEventListener("mousemove",w,{passive:!0,once:!0});null===v.cid&&(z.body[0].classList.remove("tb_action_active"),v.clearClicked())};u.addEventListener("mousemove",w,{passive:!0,once:!0})}else{this.cid=l;this.type=n;g=u.getElementById("tmpl-builder_"+n+"_action").content.cloneNode(!0);
if(!0===q){this.prevExpand="module"===n?h.getElementsByClassName("tb_module_action")[0]:b;if(void 0===this.prevExpand){this.clear();return}this.prevExpand.appendChild(g);this.prevExpand.setAttribute("id",this.el.id);this.prevExpand.closest(".tb_action_wrap").classList.add("tb_clicked");!0===d&&"module"===n&&(f=h.getBoundingClientRect(),g=this.prevExpand.classList,70>f.height||200>f.width?(g.add("tb_small_action_bar"),g.remove("tb_small_action_bar_top","tb_small_action_bar_bottom"),l=this.prevExpand.getBoundingClientRect().top,
40>l||40>l-c.Instances.Builder[c.builderIndex].el.getBoundingClientRect().top?g.add("tb_small_action_bar_top"):g.add("tb_small_action_bar_bottom"),g.toggle("tb_small_action_bar_height",70>f.height),g.toggle("tb_small_action_bar_width",200>f.width)):g.remove("tb_small_action_bar"),"visual"===c.mode&&c.EdgeDrag.addEdges(k.get("mod_name"),k,h))}else("row"!==n||"row"===n&&null!==this.breadCrumbsPath.lightbox)&&this.setBreadCrumbs(h),this.el.className="tb_show_toolbar tb_"+n+"_action",f=u.createElement("div"),
f.className="tb_action_label_wrap",f.appendChild(g),"visual"===c.mode&&("module"===n?(g=k.get("mod_name"),this.el.className+=" tb_"+g+"_action",g=themifyBuilder.modules[g].name):(g=n,"row"===n&&(l=k.get("styling").row_anchor,void 0!==l&&(l=l.trim(),""!==l&&(g+=" #"+l)))),l=u.createElement("div"),l.className="tb_data_mod_name",l.textContent=g.charAt(0).toUpperCase()+g.slice(1),f.appendChild(l)),this.el.appendChild(f);!0!==d&&(h.classList.add("tb_element_clicked"),z.body[0].classList.add("tb_action_active"),
"visual"===c.mode&&c.EdgeDrag.addEdges("module"===n?k.get("mod_name"):n,k,h));if(!0===e&&(k.trigger("edit",a,b),!0===d||null!==this.disablePosition&&!1!==q&&!0===d))return;null===this.disablePosition&&(!1===q&&!0!==d?(b=a.pageX,h=a.pageY,"visual"!==c.mode&&(h=c.Instances.Builder[0].el.getBoundingClientRect(),b=a.clientX-h.left,h=a.clientY-h.top+30),this.setPosition(this.el,{left:b,top:h})):c.Utils.addViewPortClass(this.prevExpand))}}else!0!==isHoverMode&&this.clear()}},setBreadCrumbs(a){for(;null!==
this.breadCrumbs.firstChild;)this.breadCrumbs.removeChild(this.breadCrumbs.lastChild);this.breadCrumbs.appendChild(this.getBreadCrumbs(a));null===this.el.firstChild?this.el.appendChild(this.breadCrumbs):this.el.insertBefore(this.breadCrumbs,this.el.firstChild)},getBreadCrumbPath(a,b){b="rightClick"!==b?"lightbox":b;b=null!==this.breadCrumbsPath[b]?this.breadCrumbsPath[b]:[];if(0<b.length)return b;if(void 0!==a){var d=a.getAttribute("data-cid");for(d&&b.push(d);!a.classList.contains("module_row");)a=
a.parentNode,(d=a.getAttribute("data-cid"))&&b.push(d)}return b},getBreadCrumbs(a,b){const d=this.getBreadCrumbPath(a,b),f=u.createDocumentFragment();if(void 0!==a)for(a="rightClick"===b?a.dataset.cid:c.activeModel?c.activeModel.cid:c.ActionBar.cid,b=d.length-1;-1<b;--b){let e=u.createElement("li"),h=c.Models.Registry.lookup(d[b]),g=h.get("elType");e.textContent="column"===g?h.get("component_name"):"module"===g?h.get("mod_name"):g;e.className="tb_bread tb_bread_"+g;a===d[b]&&(e.className+=" tb_active_bc");
e.setAttribute("data-id",d[b]);f.appendChild(e)}return f},actions(a){var b=c.ActionBar,d=a.target,f=d.tagName;if("keydown"===a.type){if("INPUT"!==f&&"TEXTAREA"!==f&&!themifyBuilder.disableShortcuts&&!t.Lightbox.$lightbox[0].contains(d)&&("visual"!==c.mode||!u.activeElement.contentEditable&&c.liveStylingInstance.$liveStyledElmt[0].contains(u.activeElement))){d=a.keyCode;var e=u.getElementsByClassName("tb_element_clicked");f=e.length;if(0<f){"keydown"!==a.type&&(a.preventDefault(),a.stopPropagation());
var h=null,g=null,k=void 0,n=!0===a.ctrlKey||!0===a.metaKey;46===d||8===d?h="delete":!0===n&&(67===d?(h="copy",f=1):68===d?h="duplicate":86===d&&(h="paste",!0===a.shiftKey&&(g="style")));1<f&&("delete"===h||"paste"===h)&&(k=!0,null!==c.activeModel&&t.Lightbox.$lightbox.is(":visible")&&ThemifyConstructor.saveComponent());for(let r=f-1;-1<r;--r){let p=e[r];if(null===h){if(!0===n&&1===f&&(38===d||40===d)){let q=38===a.which?"up":"down";var l="up"===q?p.previousElementSibling:p.nextElementSibling;if(null!==
l){if(p.classList.contains("module_row")){if(!l.classList.contains("module_row"))continue}else if(p.classList.contains("active_module")){if(!l.classList.contains("active_module"))continue;m(p.parentNode.closest(".tb_holder"))}else continue;l&&(l=m(p),"up"===q?l.prev().before(l):l.next().after(l),!0!==b.isHoverMode&&p.classList.add("tb_element_clicked"))}}}else"delete"===h&&p.classList.contains("module_column")||c.Models.Registry.lookup(m(p).closest("[data-cid]")[0].getAttribute("data-cid")).trigger(h,
a,g,k)}"delete"!==h&&!0===b.isHoverMode||b.clear()}}}else if(a.stopPropagation(),"click"===a.type&&null!==d.closest(".switch-wrapper"))d.classList.contains("toggle_switch")&&c.Models.Registry.lookup(m(d).closest("[data-cid]")[0].getAttribute("data-cid")).trigger("visibility",a,d);else if(a.preventDefault(),null===b.cid||"LI"!==f&&"SPAN"!==f&&"A"!==f)d.parentNode.classList.contains("tb_help")&&d.focus();else if(k=(e=d.classList.contains("tb_bread"))?d.getAttribute("data-id"):b.cid,h=c.Models.Registry.lookup(k),
g=d.classList,n=null,h)if(z.body[0].classList.remove("tb_component_menu_active"),!0===e)b.needClear=null,b.disablePosition=!0,u.getElementsByClassName("tb_element_cid_"+k)[0].click(),b.disablePosition=null,"visual"===c.mode&&(a=b.el.getBoundingClientRect(),a.right>=u.body.clientWidth&&b.setPosition(b.el,{left:a.left,top:b.el.offsetTop+55})),b.needClear=!0;else if(e=d.getAttribute("data-href"),!0===b.isHoverMode&&"tb_row_options"===e&&"click"===a.type)h.trigger("edit",a,d);else if(e)for(a=d.parentNode.getElementsByTagName("li"),
d=a.length-1;-1<d;--d)h=(f=a[d].getAttribute("data-href"))?u.getElementById(f):null,g=a[d].classList.contains("selected"),a[d].classList.remove("selected"),null!==h&&h.classList.remove("selected"),f!==e||g||("tb_row_options"===f||"tb_rgrids"===f?b.gridMenu(h):"tb_roptions"===f&&0===h.children.length&&b.setRowOptions(h),h.classList.add("selected"),a[d].classList.add("selected"),c.Utils.addViewPortClass(h),z.body[0].classList.add("tb_component_menu_active"));else{if(g.contains("tb_edit")||g.contains("tb_styling")||
g.contains("tb_visibility_component")||g.contains("tb_swap"))n="edit";else if(g.contains("tb_duplicate"))n="duplicate";else if(g.contains("tb_save_component"))n="save";else if(g.contains("tb_delete"))n="delete";else if(g.contains("tb_import")||g.contains("tb_export"))n="importExport";else if(g.contains("tb_copy_component"))n="copy";else if(g.contains("tb_paste_component")||g.contains("tb_paste_style"))n="paste";else{if("LI"===f||"SPAN"===f||g.contains("tb_action_more")||g.contains("tb_inner_action_more")){a=
d.closest("li");if(null===a)return;h=a.parentNode;e=h.classList;f=e.contains("tb_grid_list")||e.contains("tb_column_alignment")||e.contains("tb_column_gutter")||e.contains("tb_column_direction")||e.contains("tb_column_height")||e.contains("grid_tabs");d=d.classList.contains("selected");h=h.children;if(f&&d)return;for(g=h.length-1;-1<g;--g)if(h[g].classList.remove("selected"),!1===f)for(k=h[g].getElementsByClassName("selected"),n=k.length-1;-1<n;--n)k[n].classList.remove("selected");d||(a.classList.add("selected"),
z.body[0].classList.add("tb_component_menu_active"));if(f)e.contains("tb_column_alignment")?b._columnAlignmentClicked(a):e.contains("tb_column_gutter")?b._gutterChange(a):e.contains("tb_column_direction")?b._columnDirectionClicked(a):e.contains("tb_column_height")?b._columnHeight(a):e.contains("grid_tabs")?b._switchGridTabs(a):e.contains("tb_grid_list")&&b._gridClicked(a);else{h=null!==b.prevExpand?b.prevExpand.children:b.el.getElementsByClassName("tb_action_label_wrap")[0].children;for(e=h.length-
1;-1<e;--e)h[e].classList.remove("selected");d||null!==b.prevExpand&&"column"!==b.type||(b=a.getElementsByTagName("ul")[0],void 0!==b&&c.Utils.addViewPortClass(b))}}return}if(!0!==b.isHoverMode)b.clear();else{let r=d.closest(".tb_action_more");null!==r&&(r=r.getElementsByTagName("ul")[0],r.style.display="none",setTimeout(function(){null!==r&&(r.style.display="")},100))}h.trigger(n,a,d)}},_switchGridTabs(a){c.ActionBar.disable=c.clearOnModeChange=!0;c.ActionBar.hoverCid=null;c.scrollTo=m(".tb_element_cid_"+
this.cid);ThemifyConstructor.lightboxSwitch(a.getAttribute("data-id"));"visual"!==c.mode&&this.gridMenu(a.closest(".tb_toolbar_tabs"))},_gridClicked(a){var b=m(a),d=b.data("grid"),f=this.type;let e;var h=m(".tb_element_cid_"+this.cid).first();let g=!1;var k=c.activeBreakPoint,n="desktop"===k;a=t.clone(h.closest(".module_row"));g="subrow"===f;e=h.find("."+f+"_inner").first();if(n){k=e;let l=b.data("col");k=k.add(m("#tb_rgrids"));void 0===l&&(l=1,b.data("col",l));for(h=6;0<h;--h)k.removeClass("col-count-"+
h);k.addClass("col-count-"+l);e.attr("data-basecol",l);n&&b.closest(".tb_grid_menu").find(".tb_grid_reposnive .tb_grid_list").each(function(){let r=m(this).find(".selected"),p=m(this).data("type"),q=r.data("col");void 0!==q&&(q>l||4===l&&3===q||4<=l&&4<=q&&l!=q)&&(r.removeClass("selected"),e.removeClass("tb_grid_classes col-count-"+e.attr("data-basecol")+" "+e.attr("data-col_"+p)).attr("data-col_"+p,""),m(this).closest(".tb_grid_list").find("."+p+"-auto").addClass("selected"))})}else return"-auto"!==
d[0]?(a="column"+d.join("-"),d=b.data("col"),3===d&&e.attr("data-basecol")>d&&(a+=" tb_3col"),e.removeClass(e.attr("data-col_tablet")+" "+e.attr("data-col_tablet_landscape")+" "+e.attr("data-col_mobile")).addClass(a+" tb_grid_classes col-count-"+e.attr("data-basecol")).attr("data-col_"+k,a)):e.removeClass("tb_grid_classes tb_3col col-count-"+e.attr("data-basecol")+" "+e.attr("data-col_"+k)).attr("data-col_"+k,""),"visual"===c.mode&&(m("body",x.document).height(u.body.scrollHeight),c.Utils.calculateHeight()),
c.Utils.setCompactMode(e.children(".module_column")),!1;b=e.children(".module_column");k=d.length;n="module_column"+(g?" sub_column":"")+" col";for(h=0;h<k;++h)f=b.eq(h),0<f.length?f.removeClass(c.Utils.gridClass.join(" ")).addClass(n+d[h]):c.Utils._addNewColumn({newclass:n+d[h],component:g?"sub-column":"column"},e[0]);k<e.children().length&&e.children(".module_column").eq(k-1).nextAll().each(function(){m(this).find(".tb_holder").first().children().appendTo(m(this).prev().find(".tb_holder").first());
m(this).remove()});d=e.children();d.removeClass("first last");e.hasClass("direction-rtl")?(d.last().addClass("first"),d.first().addClass("last")):(d.first().addClass("first"),d.last().addClass("last"));c.hasChanged=!0;h=e.closest(".module_row");c.Mixins.Builder.columnDrag(null,b);z.body.triggerHandler("tb_grid_changed",[h,e]);c.undoManager.push(h.data("cid"),a,h,"row")},_columnHeight(a){a=m(a).data("value");if(void 0!==a){var b=m(".tb_element_cid_"+this.cid).first(),d=c.Models.Registry.lookup(this.cid),
f=t.clone(b);b=b.find("."+this.type+"_inner").first();""===a?b.removeClass("col_auto_height"):b.addClass("col_auto_height");d.set({column_h:a},{silent:!0});c.undoManager.push(this.cid,f,m(".tb_element_cid_"+this.cid).first(),"row")}},_columnAlignmentClicked(a){a=m(a);if(a=a.data("alignment")){var b=m(".tb_element_cid_"+this.cid).first(),d=c.Models.Registry.lookup(this.cid),f=t.clone(b);b.find("."+this.type+"_inner").first().removeClass(d.get("column_alignment")).addClass(a);d.set({column_alignment:a},
{silent:!0});c.undoManager.push(this.cid,f,m(".tb_element_cid_"+this.cid).first(),"row")}},_columnDirectionClicked(a){a=m(a);if(a=a.data("dir")){var b=m(".tb_element_cid_"+this.cid).first().find("."+this.type+"_inner").first(),d=b.children(".module_column"),f=d.first();d=d.last();var e=c.Models.Registry.lookup(this.cid),h={};h[c.activeBreakPoint+"_dir"]=a;e.set(h,{silent:!0});"rtl"===a?(f.removeClass("first").addClass("last"),d.removeClass("last").addClass("first"),b.addClass("direction-rtl")):(f.removeClass("last").addClass("first"),
d.removeClass("first").addClass("last"),b.removeClass("direction-rtl"));b.attr("data-"+c.activeBreakPoint+"_dir",a)}},_gutterChange(a){if(a=m(a).data("value")){var b=m(".tb_element_cid_"+this.cid).first(),d=c.Models.Registry.lookup(this.cid),f=d.get("gutter"),e=t.clone(b);b=b.find("."+this.type+"_inner").first();c.Mixins.Builder.columnDrag(null,b[0].children,f,a);b.removeClass(f).addClass(a);d.set({gutter:a},{silent:!0});c.undoManager.push(this.cid,e,m(".tb_element_cid_"+this.cid).first(),"row")}},
gridMenu(a){var b=c.activeBreakPoint,d="desktop"===b,f=c.Models.Registry.lookup(this.cid),e=f.get(b+"_dir"),h=f.get("column_alignment");const g=f.get("column_h");f=f.get("gutter");var k=(a.closest(".module_"+this.type)||u.getElementsByClassName("tb_element_cid_"+this.cid)[0]).getElementsByClassName(this.type+"_inner")[0],n=k.children,l=n.length,r=a.getElementsByClassName("tb_grid_"+b)[0];const p="tb_rgrids"===a.id?a:a.querySelector("#tb_rgrids");a=!0===d?void 0:k.getAttribute("data-col_"+b);k=[];
for(let q=0;q<l;++q)k.push(c.Utils._getColClass(n[q].className.split(" ")));for(n=6;-1<n;--n)p.classList.remove("col-count-"+n);p.classList.add("col-count-"+l);k=k.join("-");k="grid-layout-"+("2-1-2-1"===k?"4-2-4-2":k);n=r.getElementsByClassName("tb_grid_list")[0].getElementsByTagName("li");a="-auto"!==a&&a?"grid-layout-"+a.replace(/column|tb_3col/ig,"").trim():!1;!1!==d||!1!==a&&1!==l||(a=b+"-auto");for(b=n.length-1;-1<b;--b)l=!0===d&&n[b].classList.contains(k)||!1===d&&n[b].classList.contains(a),
n[b].classList.toggle("selected",l);if("ltr"!==e)for(n=r.getElementsByClassName("tb_column_direction")[0].getElementsByTagName("li"),b=n.length-1;-1<b;--b)n[b].classList.toggle("selected",n[b].getAttribute("data-dir")===e);if(!0===d){if("col_align_top"!==h||!0===ba)for(d=r.getElementsByClassName("tb_column_alignment")[0].getElementsByTagName("li"),e=d.length-1;-1<e;--e)d[e].classList.toggle("selected",d[e].getAttribute("data-alignment")===h);if("gutter-default"!==f)for(h=r.getElementsByClassName("tb_column_gutter")[0].getElementsByTagName("li"),
d=h.length-1;-1<d;--d)h[d].classList.toggle("selected",h[d].getAttribute("data-value")===f);if(g)for(f=r.getElementsByClassName("tb_column_height")[0].getElementsByTagName("li"),r=f.length-1;-1<r;--r)f[r].classList.toggle("selected",f[r].getAttribute("data-value")==g)}},setRowOptions(a){var b=null;const d=c.activeModel,f=ThemifyConstructor.component,e=c.Models.Registry.lookup(this.cid),h=e.get("styling")||{};null!==d&&(b="module"===c.activeModel.get("elType")?"mod_settings":"styling",b=c.activeModel.get(b));
if(void 0!==a.children[0])for(;a.firstChild;)a.removeChild(a.lastChild);ThemifyConstructor.values=h;ThemifyConstructor.component=this.type;c.activeModel=e;a.appendChild(ThemifyConstructor.create(ThemifyConstructor.data.row.setting.options.slice(0,6)));ThemifyConstructor.values=b;c.activeModel=d;ThemifyConstructor.component=f},clear(){if(null!==this.type){this.cid=this.type=null;for(this.el.classList.remove("tb_show_toolbar");null!==this.el.firstChild;)this.el.removeChild(this.el.lastChild);if(null!==
this.prevExpand&&void 0!==this.prevExpand){for(;null!==this.prevExpand.firstChild;)this.prevExpand.removeChild(this.prevExpand.lastChild);this.prevExpand.removeAttribute("id");"visual"===c.mode&&(this.prevExpand.style.top="");this.prevExpand.closest(".tb_action_wrap").classList.remove("tb_clicked");this.prevExpand=null}this.clearSelected();z.body[0].classList.remove("tb_action_active","tb_component_menu_active")}},clearSelected(){"visual"===c.mode&&c.EdgeDrag.clearEdges()},clearClicked(){const a=
c.Instances.Builder[0].el.getElementsByClassName("tb_element_clicked");for(let b=a.length-1;-1<b;--b)a[b].classList.remove("tb_element_clicked")},setPosition(a,b){a.removeAttribute("data-top");var d=a.getBoundingClientRect();const f=d.width;d=d.height+40;const e="visual"===c.mode?I.pageYOffset:c.toolbar.el.offsetTop+this.topH,h="visual"===c.mode?u.body:c.Instances.Builder[0].el,g=h.clientWidth;b=void 0!==b.nodeType?m(b).offset():b;b.right=b.bottom="";b.left-=parseFloat(f/2);b.top-=d;b.left+f>g?(b.left=
"auto",b.right=10):0>b.left&&(b.left=30);b.top>h.clientHeight?"visual"!==c.mode&&(b.top="auto",b.bottom=50):e>b.top&&(a.dataset.top=!0,b.top+=2*d-25,"visual"!==c.mode&&(b.top-=d/2));for(let k in b)a.style[k]="auto"!==b[k]&&""!==b[k]?b[k]+"px":b[k]}};c.Forms.register_validator=function(a,b){this.Validators[a]=b};c.Forms.get_validator=function(a){return void 0!==this.Validators[a]?this.Validators[a]:this.Validators.not_empty};c.Forms.register_validator("email",function(a){const b=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
a=a.split(",");for(let d=a.length-1;-1<d;--d)if(!b.test(a[d]))return!1;return!0});c.Forms.register_validator("not_empty",function(a){return!(!a||""===a.trim())});c.GS={styles:{},initContent:!1,loadingPosts:!1,allLoaded:!1,el:null,dropdown:null,isShown:null,field:null,isGSPage:u.body.classList.contains("gs_post"),activeGS:null,xhr:null,key:"global_styles",previousModel:null,liveInstance:null,init(){if(!0===this.isGSPage)if(x.document.body.classList.add("gs_post"),"visual"!==c.mode||!0===z.is_builder_loaded)this.openStylingPanel();
else{const a=this;x.Themify.body.one("themify_builder_ready",function(b){a.openStylingPanel()})}else null!==themifyBuilder.globalStyles&&(this.extend(this.styles,themifyBuilder.globalStyles),themifyBuilder.globalStyles=null)},extend(a,b){for(let d in b)void 0!==b[d]&&(a[d]=b[d]);return a},openStylingPanel(){const a=function(){null===ThemifyConstructor.label&&(ThemifyConstructor.label=themifyBuilder.i18n.label);var b=themifyBuilder.globalStyleData.type;switch(b){case "row":case "column":b="module_"+
b;break;case "subrow":b="active_subrow";break;default:b="active_module"}b=c.Models.Registry.lookup(c.Instances.Builder[c.builderIndex].el.getElementsByClassName(b)[0].dataset.cid);b.set("styleClicked",{silent:!0});c.isPreview=!1;b.trigger("edit",null);c.isPreview=!0;z.body.one("themify_builder_save_data",a)};a();c.toolbar.el.getElementsByClassName("tb_toolbar_builder_preview")[0].click()},setCss(a,b,d){"visual"===c.mode&&c.liveStylingInstance.setCss(a,b,d)},createCss(a,b,d){ThemifyStyles.GS={};a=
ThemifyStyles.createCss(a,b,d,this.styles);if(!0===d&&0<Object.keys(this.styles).length&&a.gs){a.gs.used="";for(let f in this.styles)a.gs.used+=""===a.gs.used?"":", ",a.gs.used+=this.styles[f].title}return a},findUsedItems(a){a=JSON.stringify(a);var b=/"global_styles":"(.*?)"/mg;let d,f="";for(;null!==(d=b.exec(a));)f+=" "+d[1].trim();f=f.trim();if(""!==f){f=m.unique(f.split(" "));a=[];for(b=f.length-1;-1<b;--b)void 0!==this.styles[f[b]]&&a.push(f[b]);return a}return!1},globalStylesHTML(){if(!0===
this.isGSPage||null!==this.activeGS)return!1;const a=u.createElement("div");var b=u.createElement("div");const d=u.createElement("span");this.isShown=null;this.field=ThemifyConstructor.hidden.render({id:c.GS.key,is_responsive:!1,value:ThemifyConstructor.values[c.GS.key],control:!1},ThemifyConstructor);a.className="tb_gs_container";if(this.field.value){let f=this.field.value.split(" "),e="";for(let h=f.length-1;-1<h;--h)void 0!==this.styles[f[h]]&&(e+=" "+f[h]);e=e.trim();this.field.value=e}else this.field.value=
"";b.className="tb_gs_icon";b.addEventListener("click",function(f){if(f.target.classList.contains("tb_gs_icon")){const e=this.el;if(e.classList.contains("tb_gs_dropdown_opened"))f.stopPropagation(),e.classList.remove("tb_gs_dropdown_action","tb_gs_dropdown_opened");else{e.classList.add("tb_gs_dropdown_opened","tb_gs_dropdown_action");const h=function(g){null===e||e.contains(g.target)||(u.removeEventListener("click",h,{passive:!0}),"visual"===c.mode&&x.document.removeEventListener("click",h,{passive:!0}),
e.classList.remove("tb_gs_dropdown_action","tb_gs_dropdown_opened"))};u.addEventListener("mousedown",h,{passive:!0});"visual"===c.mode&&x.document.addEventListener("mousedown",h,{passive:!0})}}}.bind(this),{passive:!0});d.className="tb_gs_tooltip";d.textContent=themifyBuilder.i18n.gs;b.appendChild(c.Utils.getIcon("ti-brush-alt"));b.appendChild(d);a.appendChild(this.field);a.appendChild(b);this.el=a;""!==this.field.value&&(b=this.stylingOverlay(),null!==b&&a.appendChild(b));a.addEventListener("click",
this.initClickEvent.bind(this));this.initContent=!1;return this.el},initHTML(){var a=u.createElement("div"),b=this.field.value.trim();if(""!==b){b=b.split(" ");for(let d=0,f=b.length;d<f;++d)void 0!==this.styles[b[d]]&&a.appendChild(this.createSelectedItem(b[d]))}a.className="tb_gs_selected_styles";this.el.appendChild(a);a=this.el.getElementsByClassName("tb_gs_icon")[0];a.parentNode.insertBefore(u.getElementById("tmpl-global_styles").content.cloneNode(!0),a.nextSibling);this.initContent=!0},createSelectedItem(a){const b=
this.styles[a],d=u.createElement("div"),f=u.createElement("span"),e=u.createElement("span"),h=u.createElement("span");d.className="tb_selected_style";d.dataset.styleId=a;h.className="tb_gs_edit";h.appendChild(c.Utils.getIcon("ti-pencil"));d.appendChild(h);f.innerText=b.title;d.appendChild(f);e.className="tb_delete_gs tf_close";d.appendChild(e);return d},saveAs(){const a=this;t.LiteLightbox.prompt(themifyBuilder.i18n.enterGlobalStyleName,function(b){if(null!==b){if(""===b)return alert(themifyBuilder.i18n.enterGlobalStyleName),
a.saveAs(),!1;a.saveAsCallback(b)}})},saveAsCallback(a){ThemifyConstructor.setStylingValues(c.activeBreakPoint);let b=c.activeModel.get("elType");const d=this,f=c.Utils.clear(ThemifyConstructor.values);"module"===b&&(b=c.activeModel.get("mod_name"));delete f[this.key];m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_save_as_new_global_style",tb_load_nonce:themifyBuilder.tb_load_nonce,type:b,styles:f,title:a},beforeSend(){t.showLoader("show")},error(){t.showLoader("error")},
success(e){t.showLoader("hide");"success"===e.status?(e=e.post_data,d.styles[e.class]=e,c.Utils.saveCss(c.Utils.clear(e.data),"",e.id),t.LiteLightbox.confirm(themifyBuilder.i18n.addSavedGS,function(h){if("yes"===h){d.isGSPage=!0;h=d.field.value;t.Lightbox.$lightbox[0].getElementsByClassName("reset-styling")[0].click();d.isGSPage=!1;h=e.class+" "+h;h=h.trim();d.field.value=h;h=h.split(" ");const g=d.el.getElementsByClassName("tb_gs_selected_styles")[0];g.innerHTML="";for(let k=0,n=h.length;k<n;++k)g.appendChild(d.createSelectedItem(h[k]));
c.GS.generateValues(null,h,!0);h=d.stylingOverlay();null!==h&&d.el.appendChild(h)}d.addItemToDropdown([e.class])},{buttons:{no:{label:ThemifyConstructor.label.no},yes:{label:ThemifyConstructor.label.y}}})):alert(e.msg)}})},delete(a){if(null!==this.field){c.hasChanged=!0;var b=this.el.querySelector('.global_style_item[data-style-id="'+a+'"]');const d=this.el.querySelector('.tb_selected_style[data-style-id="'+a+'"]');null!==b&&b.classList.remove("selected");null!==d&&d.parentNode.removeChild(d);b=this.field.value.trim().split(" ");
b.splice(b.indexOf(a),1);this.field.value=b=b.join(" ");null!==c.ActionBar.contextMenu&&c.ActionBar.contextMenu.contains(this.field)?c.ActionBar.rightClickGS(a,b,!0):this.generateValues(a,b.split(" "),!0);return!0}},insert(a){if(null!==this.field){c.hasChanged=!0;null!==this.dropdown&&this.dropdown.querySelector('.global_style_item[data-style-id="'+a+'"]').classList.add("selected");this.el.getElementsByClassName("tb_gs_selected_styles")[0].appendChild(this.createSelectedItem(a));let d=this.field.value+
" "+a;this.field.value=d=d.trim();if(""!==d){var b=this.stylingOverlay();null!==b&&(this.el.classList.add("tb_gs_dropdown_action"),this.el.appendChild(b))}null!==c.ActionBar.contextMenu&&c.ActionBar.contextMenu.contains(this.field)?c.ActionBar.rightClickGS(a,d):this.generateValues(a,d.split(" "))}},search(){const a=this;this.el.querySelector("#global-style-search").addEventListener("input",function(b){const d=b.target.value.toUpperCase(),f=this.el,e=function(){const h=f.getElementsByClassName("tb_gs_list")[0].getElementsByClassName("global_style_item");
for(let g=h.length-1;-1<g;--g){let k=h[g].getElementsByClassName("global_style_title")[0];k&&(h[g].style.display=-1<k.innerHTML.toUpperCase().indexOf(d)?"":"none")}};null!==a.xhr&&(a.xhr.abort(),a.xhr=null);a.allLoaded||setTimeout(function(){a.loadMore(d,e)},100);e()}.bind(this),{passive:!0})},addItemToDropdown(a){if(null!==this.dropdown){var b=u.createDocumentFragment(),d=this.field.value.split(" "),f=this.dropdown.getElementsByClassName("tb_no_gs_item")[0];for(let e=0,h=a.length;e<h;++e){let g=
this.styles[a[e]],k=u.createElement("div"),n=u.createElement("span"),l=u.createElement("span");k.className="global_style_item";k.className+=-1!==d.indexOf(a[e])?" selected":"";k.dataset.styleId=a[e];l.className="global_style_title";l.innerText=g.title;n.className="global_style_type";n.innerText=g.type;k.appendChild(l);k.appendChild(n);b.appendChild(k)}f.parentNode.insertBefore(b,f)}},loadMore(a,b){const d=this,f=[];this.loadingPosts=!0;for(let e in this.styles)void 0!==this.styles[e].id&&f.push(this.styles[e].id);
this.xhr=m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{s:a,action:"tb_get_gs_posts",tb_load_nonce:themifyBuilder.tb_load_nonce,loaded:f},success(e){d.extend(d.styles,e);e=Object.keys(e);a||(d.allLoaded=10>e.length);d.addItemToDropdown(e);d.loadingPosts=!1;b&&b()}})},initDropdown(){this.dropdown=this.el.getElementsByClassName("tb_gs_list")[0];const a=Object.keys(this.styles);this.addItemToDropdown(a);10>a.length&&!1===this.allLoaded&&this.loadMore();!1===this.allLoaded&&this.dropdown.addEventListener("scroll",
this.onScroll.bind(this),{passive:!0});this.search()},initClickEvent(a){!0!==this.initContent&&this.initHTML();const b=a.target,d=b.classList;if("LABEL"===b.nodeName||d.contains("tb_open_gs"))return!0;"insert"===b.dataset.action?(a.preventDefault(),a.stopImmediatePropagation(),this.el.classList.remove("tb_gs_dropdown_action"),void 0===b.dataset.init&&(this.initDropdown(),b.dataset.init=!0)):d.contains("global_style_title")?(a.preventDefault(),a.stopImmediatePropagation(),this.insert(b.parentNode.dataset.styleId)):
d.contains("tb_delete_gs")?(a.preventDefault(),a.stopImmediatePropagation(),this.delete(b.parentNode.getAttribute("data-style-id"))):"save"===b.dataset.action?(a.preventDefault(),a.stopImmediatePropagation(),this.saveAs()):d.contains("tb_gs_edit")&&this.liveEdit(b.parentNode.dataset.styleId)},onScroll(a){!1===this.allLoaded&&!1===this.loadingPosts&&(a=a.target,a=Math.max(a.scrollHeight-(a.scrollTop+a.offsetHeight),0),0<a&&200>=a&&(this.loadingPosts=!0,this.loadMore()))},updated(a,b,d,f){!1===this.isGSPage&&
"visual"===c.mode&&"module"!==c.activeModel.get("elType")&&this.extraStyle(b,d,f)},setImport(a,b,d,f){if(!0!==f)for(let e in a)void 0!==this.styles[e]&&delete a[e];if(0<Object.keys(a).length){this.loadingPosts=!0;const e=this;t.showLoader("show");m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{onlySave:f?1:0,action:"tb_import_gs_posts_ajax",tb_load_nonce:themifyBuilder.tb_load_nonce,data:JSON.stringify(a)},error(){t.showLoader("error")},success(h){e.loadingPosts=!1;if(h)for(let g in h)e.styles[g]=
h[g];b&&b(d);t.showLoader("hide")}})}else b&&b(d)},generateValues(a,b,d){if(!0!==this.isGSPage&&"visual"===c.mode){var f=c.activeModel.get("elType");"module"===f&&(f=c.activeModel.get("mod_name"));var e=c.activeModel.get("element_id");e={styling:ThemifyStyles.generateGSstyles(b,f,this.styles),element_id:e};ThemifyStyles.disableNestedSel=!0;null===this.liveInstance&&(this.liveInstance=c.createStyleInstance(),this.liveInstance.init(!0,!0));f=this.createCss([e],f);var h=this.liveInstance,g=[],k=c.activeBreakPoint,
n=h.prefix,l=new RegExp(n,"g");ThemifyStyles.disableNestedSel=null;if(!0===d){d=ThemifyConstructor.breakpointsReverse;for(var r=d.length-1;-1<r;--r){c.activeBreakPoint=d[r];h.setMode(d[r],!0);var p=h.currentSheet;p=p.cssRules?p.cssRules:p.rules;for(var q=p.length-1;-1<q;--q)if(-1!==p[q].selectorText.indexOf(n)){let w=p[q].selectorText.replace(/,\s+/g,",").replace(l,"").split(","),y=p[q].cssText.split("{")[1].split(";");if(-1!==w[0].indexOf(".tb_text_wrap"))for(var v=w.length-1;0<v;--v)-1!==w[v].indexOf(".tb_text_wrap")&&
w.splice(v,1);for(v=y.length-2;-1<v;--v)h.setLiveStyle(y[v].trim().split(": ")[0].trim(),"",w)}}}delete f.gs;for(let w in f)if("fonts"===w||"cf_fonts"===w)for(let y in f[w])n=y,0<f[w][y].length&&(n+=":"+f[w][y].join(",")),g.push(n);else{c.activeBreakPoint=w;h.setMode(w,!0);for(let y in f[w]){n=y.replace(/,\s+/g,",").replace(l,"").split(",");for(let B=0,A=f[w][y].length;B<A;++B)for(d=f[w][y][B].split(";"),r=d.length-2;-1<r;--r)""!==d[r]&&(p=d[r].split(":")[0],q=d[r].replace(p+":","").trim(),"background-image"===
p&&-1!==d[r].indexOf("svg")&&-1!==d[r].indexOf("data:")&&(q+=";"+d[r+1]),h.setLiveStyle(p,q,n))}}0<g.length&&ThemifyConstructor.font_select.loadGoogleFonts(g.join("|"));c.activeBreakPoint=k;this.updated(a,f,e,b);this.liveInstance=null}},extraStyle(a,b,d){var f=null!==this.liveInstance?this.liveInstance:c.liveStylingInstance,e=f.prefix.length-1,h=0!==f.getComponentBgOverlay(c.activeModel.get("elType")).length;d=f.$liveStyledElmt;var g=h,k={top:!1,bottom:!1,left:!1,right:!1},n=0;a:for(var l in a)if("fonts"!==
l&&"cf_fonts"!==l&&"gs"!==l)for(let p in a[l]){!1===g&&(g=-1!==p.indexOf("builder_row_cover",e));if(-1!==p.indexOf("tb_row_frame",e))for(let q in k)if(!1===k[q]&&-1!==p.indexOf("tb_row_frame_"+q,e)){k[q]=!0;++n;break}if(!0===g&&4===n)break a}!1===h&&!0===g&&f.addOrRemoveComponentOverlay();if(0<n){a=u.createDocumentFragment();for(var r in k)!0===k[r]&&0===d.children(".tb_row_frame_"+r).length&&(l=u.createElement("div"),l.className="tf_abs tb_row_frame tb_row_frame_"+r,a.appendChild(l));d.children(".tb_action_wrap").after(a)}(r=
void 0!==b.styling?b.styling.background_type:"none")||(r="image");"image"===r&&"builder-parallax-scrolling"===b.styling.background_repeat&&b.styling.background_image?(d[0].classList.add("builder-parallax-scrolling"),ThemifyBuilderModuleJs.backgroundScrolling(d)):(d[0].classList.remove("builder-parallax-scrolling"),d[0].style.backgroundPosition="","image"===r&&"builder-zoom-scrolling"===b.styling.background_repeat&&b.styling.background_image?(d[0].classList.add("builder-zoom-scrolling"),ThemifyBuilderModuleJs.backgroundZoom(d)):
(d[0].classList.remove("builder-zoom-scrolling"),d[0].style.backgroundSize=""))},liveEdit(a){let b={styleClicked:!0},d,f=!1;if(null===c.activeModel&&null!==c.ActionBar.contextMenu&&c.ActionBar.contextMenu.contains(this.field)){var e=c.Instances.Builder[c.builderIndex].el.getElementsByClassName("tb_element_clicked")[0];if(void 0===e)return;c.activeModel=c.Models.Registry.lookup(e.getAttribute("data-cid"));b.element_id=c.activeModel.get("element_id");this.previousModel=c.activeModel.cid;f=!0;c.Utils.scrollToDropped(e)}else null!==
c.activeModel&&(this.previousModel=c.activeModel.cid,b.element_id=c.activeModel.get("element_id"),ThemifyConstructor.saveComponent(!0));const h=this.styles[a],g=this,k=ThemifyConstructor.label.done,n="visual"===c.mode?m.extend(!0,{},c.liveStylingInstance):null;e=m.extend(!0,{},h.data[0]);const l=h.type;this.activeGS=a;"row"===l?(delete e.cols,delete e.styling[this.key],d=c.Views.init_row(e)):"subrow"===l?(delete e.cols,delete e.styling[this.key],d=c.Views.init_subrow(e)):(delete e.styling,"column"===
l?(delete e.cols[0].modules,delete e.cols[0].styling[this.key],d=c.Views.init_column(e.cols[0])):(delete e.cols[0].styling,delete e.cols[0].modules[0].mod_settings[this.key],d=c.Views.init_module(e.cols[0].modules[0])));t.Lightbox.$lightbox[0].className+=" gs_post";ThemifyConstructor.label.done=ThemifyConstructor.label.s_s;c.ActionBar.hideContextMenu();t.Lightbox.$lightbox.one("themify_opened_lightbox.tb_gs_edit",function(){this.getElementsByClassName("current")[0].getElementsByClassName("tb_tooltip")[0].textContent=
ThemifyConstructor.label.g_s+" - "+h.title});d.model.set(b,{silent:!0});d.model.trigger("edit",null);const r=function(){z.body.off("themify_builder_lightbox_close.tb_gs_edit themify_builder_save_component.tb_gs_edit");t.Lightbox.$lightbox[0].classList.remove("gs_post");ThemifyConstructor.label.done=k;d.model.destroy();if("visual"===c.mode){if(n.prefix&&(c.liveStylingInstance=n,c.liveStylingInstance.$liveStyledElmt=m(u.querySelector(n.prefix)),null!==g.previousModel&&("row"===l||"column"===l||"subrow"===
l))){const p=c.Models.Registry.lookup(g.previousModel);p&&"module"===p.get("elType")&&(c.liveStylingInstance.getComponentBgOverlay().remove(),c.liveStylingInstance.removeBgSlider(),c.liveStylingInstance.removeBgVideo(),c.liveStylingInstance.$liveStyledElmt.children(".tb_row_frame").remove(),c.liveStylingInstance.$liveStyledElmt[0].classList.remove("builder-zoom-scrolling","builder-zooming"))}g.liveInstance=null}g.activeGS=null};z.body.one("themify_builder_lightbox_close.tb_gs_edit",function(p){r();
f?g.previousModel=null:g.reopenPreviousPanel()}).one("themify_builder_save_component.tb_gs_edit",function(p,q){p=g.activeGS;const v=g.styles[p],w=g.previousModel;delete ThemifyConstructor.values.cid;ThemifyConstructor.setStylingValues(c.activeBreakPoint);var y=ThemifyConstructor.values;const B=c.activeModel;delete y[this.key];"row"===l||"subrow"===l?(v.data[0].styling=y,delete v.data[0].cols):(delete v.data[0].styling,delete v.data[0].cols[0].grid_class,"column"===l?(delete v.data[0].cols[0].modules,
v.data[0].cols[0].styling=y):(delete v.data[0].cols[0].styling,v.data[0].cols[0].modules[0].mod_settings=y));t.showLoader("show");c.Utils.saveCss(v.data,"",v.id);v.data=c.Utils.clear(v.data);g.styles[p].data=v.data;g.activeGS=null;g.previousModel=null;if("visual"===c.mode&&c.hasChanged){y=c.Models.Registry.items;for(let A in y){let E="module"===y[A].get("elType")?y[A].get("mod_settings"):y[A].get("styling");void 0!==E[g.key]&&""!==E[g.key]&&-1!==E[g.key].indexOf(p)&&(c.activeModel=y[A],g.generateValues(p,
E[g.key].split(" "),!0))}g.liveInstance=null}c.activeModel=B;g.previousModel=w;r(!0);c.hasChanged=!1;m.ajax({type:"POST",url:themifyBuilder.ajaxurl,dataType:"json",data:{action:"tb_update_global_style",tb_load_nonce:themifyBuilder.tb_load_nonce,data:v.data,id:v.id},error(){t.showLoader("error")},success(){q||f?g.previousModel=null:g.reopenPreviousPanel();t.showLoader("hide")}})})},reopenPreviousPanel(a){void 0!==a?a.model.trigger("edit",a.e,a.target):null!==this.previousModel&&(a=c.Models.Registry.lookup(this.previousModel),
null!==a&&(a.set({styleClicked:!0},{silent:!0}),a.trigger("edit",null)),this.previousModel=null)},stylingOverlay(){if(null===this.isShown&&null!==c.activeModel&&(null===this.el.parentNode||!this.el.parentNode.classList.contains("tb_inline_gs_show"))){this.isShown=!0;const a=u.createElement("div"),b=u.createElement("p");a.className="tb_gs_options_overlay";b.textContent=themifyBuilder.i18n.has_gs;a.addEventListener("click",function(d){d.preventDefault();d.stopPropagation();this.parentNode.removeChild(this)},
{once:!0});a.appendChild(b);return a}return null}}})(jQuery,Backbone,Themify,window,window.top,document,ThemifyBuilderCommon);
