(()=>{var e={6097:(e,t,s)=>{const i=s(85724),a=s(65718),o=s(96295),r=s(17232);e.exports=i.base_view.extend({template:TVE_Dash.tpl("t-item"),className:"tcb-admin-c-item-card tcb-masonry-item",events:{"click .tcb-admin-edit-template-name":"editTitle","click .tcb-admin-icon-move-symbol":"moveCategory","click .tcb-admin-delete-template-item":"deleteTemplate"},initialize(e){this.index=e.index},render(){return this.$el.html(this.template({model:this.model})),this.$templateTitle=this.$(".tvd-card-title"),this.index>5&&this.$el.addClass("tcb-admin-show-hide-tpl hidden"),this},deleteTemplate(){this.modal(r,{model:this.model,text:TVE_Admin.t.delete_template_txt.replace("%s",this.model.get("name")),extra_setting:0,"max-width":"60%",width:"750px",in_duration:200,title:"Delete template",out_duration:300})},moveCategory(){this.modal(o,{model:this.model,"max-width":"60%",width:"750px",in_duration:200,out_duration:300})},editTitle(){const e=this,t=this.$(".tcb-admin-edit-template-name"),s=new Backbone.Model({value:this.model.get("name"),label:"",required:!0});t.hide();const i=new a({model:s,tagName:"div"});this.$templateTitle.hide().after(i.render().$el),s.on("change:value",function(){e.saveName.apply(e,arguments),i.remove(),e.$templateTitle.show(),t.show()}),s.on("tcb_admin_no_change",function(){e.$templateTitle.html(e.model.get("name")).show(),i.remove(),t.show()}),i.focus()},saveName(e,t){const s=this;this.model.set("name",t),this.model.save(null,{success(e,i){s.$templateTitle.html(t),TVE_Dash.success(i.text)},error(e,t){TVE_Dash.err(t.responseText)}})}})},7784:(e,t,s)=>{const i=s(85724),a=s(6097),o=s(65718),r=s(17232),n=s(44875);e.exports=i.base_view.extend({template:TVE_Dash.tpl("c-item"),className:"tcb-admin-c-item-row",events:{"click .tcb-admin-edit-category-name":"editCategoryTitle","click .tcb-admin-delete-category-item":"deleteCategory","click .tcb-admin-show-more-less-btn":"showMoreShowLess"},index:0,initialize(){this.collection=new n(this.model.get("tpl")),this.listenTo(this.collection,"remove",function(){window.TVE_Admin.router.templatesAndSymbols()}),this.listenTo(this.model,"destroy",function(){window.TVE_Admin.router.templatesAndSymbols()})},render(){return this.$el.html(this.template({model:this.model,collection_length:this.collection.length})),this.$categoryTitle=this.$(".tvd-card-title"),this.collection.each(this.renderOneTemplateItem,this),this.index>5&&this.$(".tcb-admin-show-more-less").removeClass("hidden"),this},renderOneTemplateItem(e){this.index++;const t=new a({model:e,index:this.index});return this.$(".tcb-admin-template-t-item").append(t.render().$el),this},showMoreShowLess(){const e=this.$(".tcb-admin-show-hide-tpl"),t=this.$(".tcb-admin-show-more-less-btn");e.is(":visible")?(e.addClass("hidden"),t.html(TVE_Admin.t.show_more)):(e.removeClass("hidden"),t.html(TVE_Admin.t.show_less))},deleteCategory(){this.modal(r,{model:this.model,title:"Delete category",text:TVE_Admin.t.delete_category_txt.replace("%s",this.model.get("name")),extra_setting:1,"max-width":"60%",width:"750px",in_duration:200,out_duration:300})},editCategoryTitle(){const e=this,t=this.$(".tcb-admin-edit-category-name"),s=new Backbone.Model({value:this.model.get("name"),label:"",required:!0}),i=new o({model:s,tagName:"div"});t.hide(),this.$categoryTitle.hide().after(i.render().$el),s.on("change:value",function(){e.saveCategoryName.apply(e,arguments),i.remove(),e.$categoryTitle.show(),t.show()}),s.on("tcb_admin_no_change",function(){e.$categoryTitle.html(e.model.get("name")).show(),i.remove(),t.show()}),i.focus()},saveCategoryName(e,t){const s=this;this.model.set("name",t),this.model.save(null,{success(e,i){s.$categoryTitle.html(t),TVE_Dash.success(i.text)},error(e,t){TVE_Dash.err(t.responseText)}})}})},8330:(e,t,s)=>{const i=s(85724);e.exports=i.base_view.extend({template:TVE_Dash.tpl("item"),render(){return this.$el.html(this.template({model:this.model})),TVE_Dash.hideLoader(),this}})},12541:(e,t,s)=>{var i,a=s(85724),o=s(79445),r=s(42114),n=s(50170),l=s(26838),c=c||{};c.views=c.views||{},i=jQuery,c.views.ModalCreate=a.modal_view.extend({className:"tvd-modal tvd-modal-headers-footers",template:TVE_Dash.tpl("modals/section-create"),events:{keypress:"keyAction","click .tcb-modal-close":"close"},afterRender(){const e=new c.views.ModalList({type:this.type,collection:this.collection,cloud_collection:this.cloud_collection,modalView:this});this.$(".sections-create-container").append(e.$el)}}),c.views.ModalList=a.base_view.extend({className:"items-list",template:TVE_Dash.tpl("modals/section-create-step-1"),events:{"click .tcb-modal-tab-elem":"select_item","click .tcb-hf-right":"choose_item","keyup input.search-sections":"search_items","click .tcb-hf-icon":"slide_templates"},initialize(e){this.collection=e.collection,this.cloud_collection=e.cloud_collection,this.type=e.type.slice(0,-1),this.modalView=e.modalView,this.render()},render(){return this.$el.html(this.template({section_name:this.type})),this.after_render(),this},after_render(){this.set_elements(),this.render_items(this.collection,this.$saved_templates),this.render_items(this.cloud_collection,this.$cloud_templates)},set_elements(){this.$saved_templates=this.$(".saved-templates"),this.$cloud_templates=this.$(".our-templates"),this.$save=this.$(".tcb-hf-right").hide()},render_items(e,t){t.empty(),e.length||this.no_items(t),e.each(function(e){const s=new c.views.ModalItem({item:e});t.append(s.$el)})},slide_templates(e){i(e.currentTarget).parent().next().slideToggle()},no_items(e){const t=new c.views.MessageView({listView:this,parentContainer:e});e.append(t.render().$el)},select_item(e){const t=e.currentTarget.dataset.id,s=parseInt(e.currentTarget.dataset.cloud)?this.$cloud_templates:this.$saved_templates;this.$(".tcb-modal-tab-elem").each(function(){this.classList.remove("active"),this.dataset.id===t&&i(this).parents("."+s.attr("class")).length&&this.classList.add("active")}),this.$save.prop("disabled",!1).show()},choose_item(){const e=this.$(".active");this.show_create_step(e)},search_items(e){const t=e.currentTarget.value;27===e.keyCode&&this.modalView.close();const s=new n(this.filter_sections(t,this.collection)),i=new l(this.filter_sections(t,this.cloud_collection));return this.render_items(s,this.$saved_templates),this.render_items(i,this.$cloud_templates),!1},filter_sections:(e,t)=>t.filter(function(t){return-1!==(t.get("title")?t.get("title").rendered:t.get("post_title")).toLowerCase().indexOf(e.toLowerCase())}),show_create_step(e){const t=parseInt(e.data("cloud")),s=e.attr("data-id");t?this.show_cloud_symbol(s):this.render_create_view(this.collection.findWhere({id:parseInt(s)}))},show_cloud_symbol(e){const t={type:this.type},s=new r({id:e}),a=this.cloud_collection.findWhere({id:e});s.fetch({data:i.param(t),success:_.bind(this.fetchItemSuccess,this,a)})},fetchItemSuccess(e,t){const s=t;s.set({thumb:e.get("thumb"),tve_custom_css:s.get("head_css"),status:"publish",tve_updated_post:s.get("content")}),this.render_create_view(s)},render_create_view(e){const t=new c.views.ModalCreateItem({item:e,type:this.type,listView:this});this.$el.html(t.$el),t.$input_name.trigger("focus")}}),c.views.ModalCreateItem=a.base_view.extend({className:"create-item-container",template:TVE_Dash.tpl("modals/section-create-step-2"),events:{"click .tcb-hf-back":"go_back","click .tcb-hf-right":"submit","click .tcb-notification-icon-error":"hide_error_container","keyup #dashboard-create-section":"key_press_handler"},initialize(e){this.item=e.item,this.type=e.type,this.listView=e.listView,this.render()},render(){const e=new c.views.ModalItem({item:this.item});return this.$el.html(this.template({type:this.type})),this.$(".item-create").html(e.$el),this.after_render(),this},after_render(){this.$input_name=this.$(".item-title"),this.$error_container=this.$(".error-container")},key_press_handler(e){13===e.keyCode&&this.submit()},go_back(){this.listView.render()},submit(){if(!this.validate_input())return!1;const e=this.item.clone();return this.save_item({content:e.get("content"),status:e.get("status"),tcb_symbols_tax:this.listView.modalView.mainView.tax_id,title:this.$input_name.val(),tve_custom_css:this.item.get("tve_custom_css"),tve_updated_post:e.get("tve_updated_post"),thumb:e.get("thumb"),thumb_id:e.get("id")}),!1},save_item(e){const t=this,s=new o(e);i("#tve-page-loader").addClass("tve-open"),s.save(null,{success(e){t.render_new_item(e),TVE_Dash.success(TVE_Admin.t[t.type+"_save"]),t.listView.modalView.close(),window.location.href=e.get("edit_url")},error:_.bind(this.on_error,this)})},on_error(e,t,s){let a="";if(t.responseJSON)a=t.responseJSON.message;else if(t.responseText)try{a="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}a||(a=(t.statusText||s)+(t.status?" ("+t.status+")":"")),this.$error_container.fadeIn(200).html(TVE_Dash.tpl("symbols/save-templates-error")({error_message:a})),i("#tve-page-loader").removeClass("tve-open")},render_new_item(e){const t=new this.listView.modalView.mainlistItemView({type:this.type,item:e});this.listView.modalView.mainView.$(".sections-list-items").append(t.$el)},hide_error_container(){this.$error_container.fadeOut(200)},validate_input(){return!_.isEmpty(this.$input_name.val().trim())||(this.$error_container.fadeIn(200).html(TVE_Dash.tpl("symbols/save-templates-error")({error_message:TVE_Admin.t[this.type+"_name_required"]})),!1)}}),c.views.ModalItem=a.base_view.extend({className:"item-container",template:TVE_Dash.tpl("modals/section-create-item"),initialize(e){this.item=e.item,this.render()},render(){return this.$el.html(this.template({item:this.item})),this}}),c.views.MessageView=a.base_view.extend({className:"text-no-sections",template:TVE_Dash.tpl("modals/section-message"),initialize(e){this.listView=e.listView,this.parentContainer=e.parentContainer},render(){const e=this.get_message(),t=this.parentContainer.hasClass("our-templates");return this.$el.html(this.template({message:e,type:this.listView.type+"s"})),t?this.$(".no-sections-on-site").hide():this.$(".no-sections-on-cloud").hide(),""!==e&&(this.$(".no-sections-on-cloud").hide(),this.$(".no-sections-on-site").hide(),this.$(".no-search-results").show()),this},get_message(){return this.listView.$("#search-sections").val()}}),e.exports={create:c.views.ModalCreate}},13254:(e,t,s)=>{const i=s(85724),a=s(50170),o=s(26838),r=s(79445),n=s(13983),l=s(12541),c=s(65718),d=s(67057),m={};var h;m.views=m.views||{},m.objects=m.objects||{},h=jQuery,m.views.Base=i.base_view.extend({template:TVE_Dash.tpl("symbols/sections-container"),className:"tcb-dash-symbols-wrapper",initialize(e){this.dashboard_view=e.dashboard_view,this.type=e.type,this.render(),this.fetchItems()},render(){this.$el.html(this.template())},fetchItems(e){const t={tcb_symbols_tax:this.get_category_id(),per_page:100,optimole_skip_processing:1},s=jQuery.extend({},t,e);TVE_Dash.showLoader(),this.$collection=new a,this.$collection.fetch({data:h.param(s),success:_.bind(this.fetchSuccess,this)})},fetchSuccess(e){this.render_items(e)},render_items(e){this.itemsList=new m.views.List({type:this.type,collection:e,tax_id:this.get_category_id()}),this.$(".sections-container").html("").append(this.itemsList.$el)},search_items(e){this.render_items(this.filter_sections(e))},filter_sections(e){return new a(this.$collection.filter(t=>-1!==t.get("title").rendered.toLowerCase().indexOf(e.toLowerCase())))},get_category_id(){return _.find(TVE_Admin.sections_tax_terms,e=>e.slug===this.type).term_id}}),m.views.List=i.base_view.extend({template:TVE_Dash.tpl("symbols/sections-list"),className:"sections-list-container",events:{"click .create-section":"create_item"},initialize(e){this.collection=e.collection,this.type=e.type,this.tax_id=e.tax_id,this.render()},render(){this.$el.html(this.template({type:this.type})),this.render_items()},render_items(){const e=this.$(".sections-list-items").html(""),t=this.type.charAt(0)+this.type.slice(1,-1),s=this;this.no_items(),this.collection.each(function(i){const a=new m.views.Item({type:t,item:i,all_items:s.collection});e.append(a.$el)})},no_items(){const e=this.$(".no-items");if(e.toggle(!this.collection.length),!this.collection.length){const t=TVE_Admin.t.empty_list.replace(/%s/g,this.type);e.html(t),this.$(".create-section").html("")}},create_item(e){return e.currentTarget.disabled=!0,this.fetch_cloud_items({},e),!1},fetch_cloud_items(e,t){if(this.cloud_symbols)return this.open_create_modal(),t.currentTarget.disabled=!1,!1;const s=jQuery.extend({},{type:this.type.slice(0,this.type.length-1)},e),i=this;return this.cloud_symbols=new o,this.cloud_symbols.fetch({data:h.param(s),success(){i.open_create_modal(),t.currentTarget.disabled=!1}}),!1},open_create_modal(){return this.modal(l.create,{mainlistItemView:m.views.Item,mainView:this,collection:this.collection,cloud_collection:this.cloud_symbols,type:this.type,title:TVE_Admin.t["create_"+this.type],description:TVE_Admin.t.description_category,save_text:TVE_Admin.t.save_category_text,placeholder:TVE_Admin.t.placeholder_category,"max-width":"unset",width:"70%",in_duration:200,is_symbol:0,out_duration:300}),!1}}),m.views.Item=i.base_view.extend({template:TVE_Dash.tpl("symbols/section-item"),className:"section-item-container tcb-masonry-item",events:{"click .sym-pen":"edit_section_name","click .sym-delete":"delete_symbol","click .sym-duplicate":"duplicate_symbol","click .edit-symbol":"edit_symbol"},initialize(e){this.item=e.item,this.type=e.type,this.all_items=e.all_items,this.render()},render(){this.$el.html(this.template({type:this.type,item:this.item}));const e=this.$el.find(".sym-image");return d.getSize(e),this.$symbol_name=this.$(".symbol-title-text"),this},edit_section_name(e){const t=this,s=h(e.currentTarget),i=new Backbone.Model({value:this.item.get("title").rendered,label:"",required:!0}),a=new c({model:i,tagName:"div"});s.hide(),this.$symbol_name.hide().after(a.render().$el),i.on("change:value",function(e,i){t.save_symbol({title:i}),a.remove(),t.$symbol_name.show(),s.show()}),i.on("tcb_admin_no_change",function(){t.$symbol_name.html(t.model.get("title").rendered).show(),a.remove(),s.show()}),a.focus()},delete_symbol(){this.modal(n,{model:this.item,model_view:this,is_term:!1,title:"Delete "+this.type,text:TVE_Admin.t["delete_"+this.type+"_txt"].replace("%s",this.item.get("title").rendered),text_deleted:TVE_Admin.t[this.type+"_deleted"],text_not_deleted:TVE_Admin.t[this.type+"_not_deleted"],"max-width":"60%",width:"750px",in_duration:200,out_duration:300,className:"delete-symbol tvd-modal"})},duplicate_symbol(){const e=this,t=this.item.clone(),s=t.get("tcb_symbols_tax"),i=_.isEmpty(s)?s:s[0].term_id,a={content:t.get("content"),status:t.get("status"),tcb_symbols_tax:i,title:t.get("title").rendered,tve_custom_css:t.get("tve_custom_css"),tve_updated_post:t.get("tve_updated_post")};new r(a).save({old_id:t.get("id")},{success(t){const s=new m.views.Item({type:e.type,item:t,all_items:e.all_items});e.all_items.add(t),e.$el.after(s.render().$el),TVE_Dash.success(TVE_Admin.t["duplicate_"+e.type+"_success"])},error(){TVE_Dash.err(TVE_Admin.t["cannot_duplicate_"+this.type])}})},edit_symbol(){window.open(this.item.get("edit_url"),"_blank")},save_symbol(e){const t=this;this.item.set(e),this.item.unset("tcb_symbols_tax"),this.item.unset("old_id"),this.item.unset("thumb"),this.item.save(null,{success(e){t.$symbol_name.html(e.get("title").rendered),TVE_Dash.success(TVE_Admin.t[this.type+"_save"])},error(e,t,s){let i="";if(t.responseJSON)i=t.responseJSON.message;else if(t.responseText)try{i="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}i||(i=(t.statusText||s)+(t.status?" ("+t.status+")":"")),TVE_Dash.err(i)}})}}),e.exports={base:m.views.Base}},13983:(e,t,s)=>{const i=s(85724);e.exports=i.modal_view.extend({template:TVE_Dash.tpl("modals/tve-delete-confirmation"),events:{"click .tvd-modal-submit":"yes"},yes(e){const t=jQuery(e.currentTarget),s=this;this.btnLoading(t),TVE_Dash.showLoader(),this.model.destroy({data:{force:this.is_term},processData:!0,wait:!0,success(e,t){s.is_term&&(s.model_view.remove_deleted_category(t),window.TVE_Admin.router.templatesAndSymbols({tab_selected:"symbol"})),s.model_view.remove(),TVE_Dash.success(s.text_deleted)},error(e,t){TVE_Dash.err(t.responseJSON&&t.responseJSON.message||TVE_Admin.t.text_not_deleted)},complete(){s.close(),TVE_Dash.hideLoader()}})}})},15719:e=>{e.exports=Backbone.Model.extend({idAttribute:"term_id",sync(e,t,s){let i;const a=this.get("rest_nonce")?this.get("rest_nonce"):TVE_Admin.nonce;return(s=s||{}).cache=!1,!t.has("term_id")||"delete"!==e&&"update"!==e||(s.url=this.url()+"/"+t.get("term_id")),_.isUndefined(a)||_.isNull(a)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",a),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},url(){return this.get("rest_symbol_terms")||TVE_Admin.rest_routes.symbols_terms},parse:e=>(0===e.parent&&delete e.parent,e)})},17232:(e,t,s)=>{const i=s(85724);e.exports=i.modal_view.extend({template:TVE_Dash.tpl("modals/tve-delete-confirmation"),events:{"click .tvd-modal-submit":"yes"},afterInitialize(e){this.text=e.text,this.extra_setting=e.extra_setting&&1===e.extra_setting?1:0},afterRender(){this.$el.addClass("content-templates-delete-class"),this.extra_setting&&this.$(".tcb-admin-extra-setting-row").removeClass("hidden")},yes(e){const t=jQuery(e.currentTarget),s=this;this.btnLoading(t),TVE_Dash.showLoader(),this.model.destroy({data:{extra_setting_check:s.$("#tcb-admin-extra-setting-check").is(":checked")?1:0},processData:!0,wait:!0,success(e,t){window.TVE_Admin.router.templatesAndSymbols({tab_selected:"ct"}),TVE_Dash.success(t.text)},error(e,t){TVE_Dash.err(t.responseText)},complete(){s.close(),TVE_Dash.hideLoader()}})}})},17747:(e,t,s)=>{const i=s(85724);e.exports=i.modal_view.extend({template:TVE_Dash.tpl("modals/move-symbol"),events:{"click .tvd-modal-submit":"save"},afterRender(){this.$el.addClass("sym-move-tocat")},save(){const e=this,t=this.$("#tcb-admin-t-categ-combo").val();TVE_Dash.showLoader(),this.model.set("move_symbol",t),this.model.unset("tcb_symbols_tax"),this.model.save(null,{wait:!0,success(){TVE_Dash.success(TVE_Admin.t.symbol_moved_success),window.TVE_Admin.router.templatesAndSymbols({tab_selected:"symbol"})},error(){TVE_Dash.err(TVE_Admin.t.symbol_moved_error)},complete(){TVE_Dash.hideLoader(),e.close()}})}})},17755:(e,t,s)=>{const i=s(85724),a=s(28790),o=s(43297),r=s(40019),n=s(15719),l=s(99321).category;e.exports=i.base_view.extend({className:"create-search-container",initialize(e){this.searchView=new d(e),this.createView=new c(e)},render(e){return this.$el.append(this.createView.render(e).$el),this.$el.append(this.searchView.render(e).$el),this}});const c=i.base_view.extend({template:TVE_Dash.tpl("symbols/create"),className:"create-container",events:{"click span.new-cat":"create_category","click span.new-symbol":"create_symbol","click .create-category":"create_template_category"},initialize(e){this.symbolsView=e.symbolsView,this.footersView=e.footersView,this.headersView=e.headersView},render(e){this.tab_selected=e.tab_selected;const t=this.get_create_text(e);return this.$el.html(this.template({create_text:t,ct_selected:"symbol"===e.tab_selected})),this},get_create_text(e){let t="";switch(e.tab_selected){case"symbol":t=TVE_Admin.t.create_new;break;case"templates":case"ct":t=TVE_Admin.t.create_category;break;case"headers":case"footers":t=TVE_Admin.t["create_"+e.tab_selected.slice(0,-1)]}return t},create_template_category(e){const t="templates"===this.tab_selected?"ct":this.tab_selected;return"function"==typeof this[`create_${t}`]&&this[`create_${t}`](e),!1},create_ct(){this.modal(a,{model:new o({})})},create_headers(e){return this.headersView.itemsList.create_item(e),!1},create_footers(e){this.footersView.itemsList.create_item(e)},create_category(){this.modal(r,{title:TVE_Admin.t.create_category,description:TVE_Admin.t.description_category,save_text:TVE_Admin.t.save_category_text,placeholder:TVE_Admin.t.placeholder_category,in_duration:200,is_symbol:0,out_duration:300,save_category:_.bind(this.save_category,this)})},create_symbol(){this.modal(r,{title:TVE_Admin.t.create_symbol,description:TVE_Admin.t.description_symbol,save_text:TVE_Admin.t.save_symbol_text,placeholder:TVE_Admin.t.placeholder_symbol,is_symbol:1,in_duration:200,out_duration:300,show_category:1,categories:this.symbolsView.$categories,save_category:_.bind(this.save_category,this)})},save_category(e){return e.rest_symbol_terms=TVE_Admin.rest_routes.symbols_terms,new n(e).save(null,{success:e=>{const t=new l({category:e,collection:this.symbolsView.$collection}),s=e.toJSON();s.term_id=s.id,s.term_taxonomy_id=s.id,TVE_Admin.symbols_tax_terms.unshift(s),e.set("term_id",s.id),this.symbolsView.$el.find(".symbols-container").prepend(t.$el),this.symbolsView.$categories.unshift(e),TVE_Dash.success(TVE_Admin.t.category_created)},error(e,t,s){let i="";if(t.responseJSON)i=t.responseJSON.message;else if(t.responseText)try{i="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}i||(i=(t.statusText||s)+(t.status?" ("+t.status+")":"")),TVE_Dash.err(i)}})}}),d=i.base_view.extend({template:TVE_Dash.tpl("symbols/search"),className:"search-container",events:{"keyup input.search-symbols":"search_items"},initialize(e){this.symbolsView=e.symbolsView,this.templatesView=e.templatesView,this.headersView=e.headersView,this.footersView=e.footersView},render(e){return this.tab_selected=e.tab_selected,this.$el.html(this.template({input_title:TVE_Admin.t["search_"+e.tab_selected],input_placeholder:TVE_Admin.t[e.tab_selected+"_name"]})),this},search_items(e){const t={search:e.currentTarget.value};switch(this.tab_selected){case"symbol":this.symbolsView.fetchSymbols(t);break;case"ct":this.templatesView.renderTemplates(t);break;case"headers":this.headersView.search_items(e.currentTarget.value);break;case"footers":this.footersView.search_items(e.currentTarget.value)}}})},18830:(e,t,s)=>{const i=s(85724);e.exports=i.base_view.extend({el:jQuery("#tcb-admin-breadcrumbs-wrapper")[0],template:TVE_Dash.tpl("breadcrumbs"),initialize(){this.$title=jQuery("head > title"),this.original_title=this.$title.html(),this.listenTo(this.collection,"change",this.render),this.listenTo(this.collection,"add",this.render)},render(){this.$el.empty().html(this.template({links:this.collection}))}})},26838:(e,t,s)=>{const i=s(85724),a=s(42114);e.exports=i.base_collection.extend({model:a,sync(e,t,s){let i;return(s=s||{}).cache=!1,s.url=this.url(),_.isUndefined(TVE_Admin.nonce)||_.isNull(TVE_Admin.nonce)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",TVE_Admin.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},url:()=>TVE_Admin.rest_routes.symbols+"/cloud"})},28790:(e,t,s)=>{const i=s(85724);e.exports=i.modal_view.extend({template:TVE_Dash.tpl("modals/new-category"),className:"tvd-modal",events:{"click #tcb-add-new-category-input":"addNewCategoryInput","click .tcb-admin-delete-text-element":"deleteTextElement","click .tvd-modal-submit":"save"},afterInitialize(){},afterRender(){this.addNewCategoryInput(),this.$el.addClass("add-new-cat-modal")},addNewCategoryInput(){const e=this.$("#tcb-categ-input-template").clone();this.$("#tcb-categ-input").append(e.html())},deleteTextElement(e){jQuery(e.target).closest(".tcb-admin-text-element-wrapper")[0].remove()},save(){const e=[],t=this;this.$(".tcb-category-input-item").each(function(t,s){s.value&&e.push(s.value)}),e.length>0?(TVE_Dash.showLoader(),this.model.set("category",e),this.model.save(null,{wait:!0,success(e,t){TVE_Dash.success(t.text),window.TVE_Admin.router.templatesAndSymbols({tab_selected:"ct"})},error(e,t){TVE_Dash.err(t.responseText)},complete(){TVE_Dash.hideLoader(),t.close()}})):TVE_Dash.err(TVE_Admin.t.no_categories)}})},29199:(e,t,s)=>{const i=s(85724);e.exports=i.base_view.extend({el:jQuery("#tcb-admin-header-wrapper"),template:TVE_Dash.tpl("header"),initialize(e){this.render({admin_logo_url:e.url,class:void 0!==e.class?e.class:""})},render(e){this.$el.html(this.template({header:e}))}})},39608:(e,t,s)=>{const i=s(85724);e.exports=i.base_model.extend({defaults:{id:"",hash:"",label:"",full_link:!1},initialize(e){this.get("id")||this.set("id",e.label.replace(/ /g,"").toLowerCase()),this.set("full_link",e.hash.match(/^http/))},get_url(){return this.get("full_link")?this.get("hash"):"#"+this.get("hash")}})},40019:(e,t,s)=>{var i=s(85724),a=s(79445),o=o||{};o.views=o.views||{},e.exports=i.modal_view.extend({className:"tvd-modal tvd-modal-fixed-footer",template:TVE_Dash.tpl("modals/create"),events:{"click .tvd-modal-save":"save","click #add_category":"toggle_category_selection","keypress input.content-title":"input_key_pressed"},afterRender(){this.$el.attr("id","tcb-modal-save-elements"),this.$el.attr("class","tvd-modal tcb-sym-modal-save-elements"),this.$name=this.$(".content-title"),this.$autocomplete=this.$("#tcb-save-template-categ-suggest")},toggle_category_selection(){this.$(".category_selection").toggle(),this.prepare_symbol_category()},prepare_symbol_category(){const e=[];this.categories.each(function(t){e.push({id:t.get("term_id"),text:t.get("name"),value:t.get("name")})}),this.bind_autocomplete(this.$autocomplete,{data:e})},input_key_pressed(e){13===e.keyCode&&this.save(e)},save(e){let t,s;if(!this.validate_input())return!1;this.is_symbol?(t={title:this.$name.val(),status:"publish"},s=this.get_category_for_symbol(),s&&0!==parseInt(s)&&(t.tcb_symbols_tax=s),this.save_symbol(t,e)):(t={name:this.$name.val()},this.save_category(t),e.preventDefault(),this.close())},get_category_for_symbol(){if(void 0!==this.category_id&&0!==parseInt(this.category_id))return this.category_id;const e=this.$autocomplete.val();return e?e[Object.keys(e)[0]]:0},validate_input(){if(_.isEmpty(this.$name.val().trim())){const e=this.is_symbol?TVE_Admin.t.symbol_name_required:TVE_Admin.t.category_name_required;return TVE_Dash.err(e),!1}return!0},bind_autocomplete(e,t){const s=this,i=this.get_autocomplete_options(t);e.select2(i).on("select2:selecting",function(e){e.params.args.data.isNew&&(e.params.args.data.text=e.params.args.data.value)}).on("select2:select",function(e){const t=jQuery(this);e.params.data.isNew?s.save_category({name:e.params.data.value}).then(function(i){const a=i.id;s.$("#tcb-template-category-id").val(a),t.find('[value="'+e.params.data.id+'"]').replaceWith('"),t.val(a).trigger("change")}):s.$("#tcb-template-category-id").val(s.$autocomplete.val())}).on("select2:unselect",function(e){s.$("#tcb-template-category-id").val(""),e.params.originalEvent&&e.params.originalEvent.stopPropagation()})},get_autocomplete_options(e){const t={tags:!0,multiple:!0,placeholder:TVE_Admin.t.select_category,minimumResultsForSearch:0,maximumSelectionLength:1,data:{},createTag:e=>({id:e.term,text:'"'+e.term+'" '+TVE_Admin.t.add_as_category+"",value:e.term,isNew:!0}),escapeMarkup:e=>e};return void 0===e&&(e={}),jQuery.extend({},t,e)},save_symbol(e,t){const s=new a(e),i=this;s.save(null,{async:!1,success(e){i.close(),i.$el.find("a.tvd-modal-save").attr("href",e.get("edit_url")),TVE_Dash.success(TVE_Admin.t.symbol_created),window.TVE_Admin.router.templatesAndSymbols({tab_selected:"symbol"})},error(e,s,i){let a="";if(s.responseJSON)a=s.responseJSON.message;else if(s.responseText)try{a="parsererror"===i?"Could not parse response: "+s.responseText:JSON.parse(s.responseText).message}catch(e){console.warn(e)}a||(a=(s.statusText||i)+(s.status?" ("+s.status+")":"")),TVE_Dash.err(a),t.preventDefault()}})}})},42114:(e,t,s)=>{const i=s(85724);e.exports=i.base_model.extend({idAttribute:"id",sync(e,t,s){let i;return(s=s||{}).cache=!1,!t.has("id")||"delete"!==e&&"update"!==e||(s.url=this.url()+"/"+t.get("id")),_.isUndefined(TVE_Admin.nonce)||_.isNull(TVE_Admin.nonce)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",TVE_Admin.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},url(){return TVE_Admin.rest_routes.symbols+"/cloud/"+this.get("id")}})},43297:(e,t,s)=>{const i=s(85724),a=s(67057);e.exports=i.base_model.extend({defaults:{id:"",category:[]},url:()=>a.ajaxurl("action=tcb_admin_ajax_controller&route=template_category")})},44875:(e,t,s)=>{const i=s(85724),a=s(98064);e.exports=i.base_collection.extend({model:a})},50170:(e,t,s)=>{const i=s(85724),a=s(79445);e.exports=i.base_collection.extend({model:a,sync(e,t,s){let i;return(s=s||{}).cache=!1,s.url=this.url(),_.isUndefined(TVE_Admin.nonce)||_.isNull(TVE_Admin.nonce)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",TVE_Admin.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},url:()=>TVE_Admin.rest_routes.symbols})},53370:(e,t,s)=>{const i=s(85724),a=s(28790),o=s(7784),r=s(67057),n=s(43297);jQuery,e.exports=i.base_view.extend({template:TVE_Dash.tpl("list"),events:{"click #tcb-add-new-category":"addNewCategory"},render(){this.$el.html(this.template({})),this.collection.each(this.renderOne,this);const e=this.$el.find(".sym-image");return r.getSize(e),TVE_Dash.hideLoader(),this},renderOne(e){const t=new o({model:e});return this.$el.append(t.render().$el),this},addNewCategory(){this.modal(a,{model:new n({})})}})},54015:(e,t,s)=>{const i=s(85724),a=s(15719);e.exports=i.base_collection.extend({model:a,default_category:{count:0,description:TVE_Admin.t.uncategorized_symbols,filter:"raw",name:TVE_Admin.t.uncategorized_symbols,slug:"uncategorized-symbols",taxonomy:TVE_Admin.symbols_tax,parent:null,term_group:0,term_id:0,term_taxonomy_id:0},sync(e,t,s){let i;return(s=s||{}).cache=!1,!t.has("id")||"delete"!==e&&"update"!==e||(s.url=this.url()+"/"+t.get("id")),_.isUndefined(TVE_Admin.nonce)||_.isNull(TVE_Admin.nonce)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",TVE_Admin.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},initialize(e,t){return e.push(this.default_category),this.constructor.__super__.initialize.apply(this,arguments)},url:()=>TVE_Admin.rest_routes.symbols_terms})},65718:(e,t,s)=>{e.exports=s(85724).base_view.extend({className:"tvd-input-field",template:TVE_Dash.tpl("text-edit"),events:{"keyup input"(e){27===e.which&&this.model.trigger("tcb_admin_no_change")},"change input"(){const e=this.$input.val().trim();return e?this.model.set("value",e):this.$input.addClass("tvd-invalid"),!1},"blur input"(){this.model.trigger("tcb_admin_no_change")}},render(){return this.$el.html(this.template({item:this.model})),this.$input=this.$("input"),this},focus(){this.$input.focus().select()}})},67057:e=>{const t={};var s;s=jQuery,t.ajaxurl=function(e){const t=-1!==ajaxurl.indexOf("?")?"&":"?";return e&&e.length?(e=e.replace(/^(\?|&)/,""),e+="&_nonce="+TVE_Admin.admin_nonce,ajaxurl+t+e):ajaxurl+t+"_nonce="+TVE_Admin.admin_nonce},t.getSize=function(e){e.each(function(e,t){s(this).css("height",s(t).data("height")),s(this).css("width",s(t).data("width"))})},e.exports=t},70852:(e,t,s)=>{const i=s(85724),a=s(81531),o=s(67057);e.exports=i.base_collection.extend({model:a,url:()=>o.ajaxurl("action=tcb_admin_ajax_controller&route=templates_fetch")})},79445:(e,t,s)=>{const i=s(54015);e.exports=s(85724).base_model.extend({idAttribute:"id",sync(e,t,s){let i;return(s=s||{}).cache=!1,!t.has("id")||"delete"!==e&&"update"!==e||(s.url=this.url()+"/"+t.get("id")),_.isUndefined(TVE_Admin.nonce)||_.isNull(TVE_Admin.nonce)||(i=s.beforeSend,s.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",TVE_Admin.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,s)},url:()=>TVE_Admin.rest_routes.symbols,get_terms(){const e=[],t=this.get(TVE_Admin.symbols_tax);return _.isEmpty(t)&&e.push(0),_.forEach(this.get(TVE_Admin.symbols_tax),function(t){e.push(t.term_id)}),e},getCurrentCategory(){const e=this.get_terms(),t=TVE_Admin.symbols_tax_terms;for(let s=0;s{const i=s(85724),a=s(67057);e.exports=i.base_model.extend({defaults:{id:"",name:"",tpl:[]},url(){let e=a.ajaxurl("action=tcb_admin_ajax_controller&route=template_category_model");return _.isNumber(this.get("id"))&&(e+="&id="+this.get("id")),e}})},85724:e=>{let t,s,i,a;t=Backbone.View.extend({render(){return this},modal:(e,t)=>TVE_Dash.modal(e,t)}),s=TVE_Dash.views.Modal.extend({}),Backbone.emulateHTTP=!0,i=Backbone.Model.extend({idAttribute:"id"}),a=Backbone.Collection.extend({last(){return this.at(this.size()-1)}}),e.exports={base_view:t,modal_view:s,base_model:i,base_collection:a}},94437:(e,t,s)=>{const i=s(85724),a=s(39608);e.exports=i.base_collection.extend({model:i.base_collection.extend({defaults:{hash:"",label:""}}),addPage(e,t){const s=new a({hash:e,label:t});return this.add(s)}})},95528:(e,t,s)=>{const i=s(99321),a=s(13254),o=s(17755);var r;r=jQuery,e.exports=s(85724).base_view.extend({template:TVE_Dash.tpl("dashboard"),className:"templates-symbols-tabs",initialize(e){this.main_view=e.main_view,this.tab_selected=e.tab_selected},events:{"click .tab-item":"tabClick","click .activate-notification-template":"changeNotificationTemplate"},render(){return this.$el.html(this.template()),this.renderTemplates(),this.renderSymbols(),this.renderNotifications(),this.renderSection("headers"),this.renderSection("footers"),this.renderCreateAndSearch(),this.after_render(),this},after_render(){const e=new URLSearchParams(window.location.search).get("tab_selected");this.$tabs=this.$(".tab-item"),this.$content=this.$(".tcb-tab-content"),this.$tabs.filter(`[data-content="${e||this.tab_selected}"]`).trigger("click")},tabClick(e){const t=e.currentTarget.dataset.content,s=this.$content.filter(`[data-content="${t}"]`),i="notifications"===t;this.$tabs.removeClass("active"),e.currentTarget.classList.add("active"),this.$content.removeClass("active"),s.addClass("active"),i&&this.setActiveNotificationTemplate(),this.tab_selected=t,this.createSearchView.render({tab_selected:t}),this.createSearchView.$el.toggle(!i)},setActiveNotificationTemplate(){const e=this.$(`.notifications-content .notifications-previews-wrapper[data-id="${TVE_Admin.notifications.notifications_template}"]`),t=this.$(".active-template .notifications-previews-wrapper");e.attr("data-id")!==t.attr("data-id")&&(this.$(".inactive-templates .templates-wrapper").empty().append(t),this.$(".active-template .templates-wrapper").empty().append(e))},changeNotificationTemplate(e){const t=jQuery(e.currentTarget).parents(".notifications-previews-wrapper"),s=this.$(".active-template .notifications-previews-wrapper"),i=t.attr("data-id");this.$(".inactive-templates .templates-wrapper").empty().append(s),this.$(".active-template .templates-wrapper").empty().append(t),r.ajax({url:ajaxurl,type:"post",data:{action:"notification_update_template",post_id:i}})},renderTemplates(e){const t=s(53370),i=jQuery.extend({},{},e);this.templatesView&&this.templatesView.remove(),TVE_Admin.globals.templates.fetch({data:r.param(i),update:!0,success:()=>{this.templatesView=new t({collection:TVE_Admin.globals.templates}),this.$(".ct-content").html(this.templatesView.render().$el)},error(e,t,s){TVE_Dash.err(t.responseText)}})},renderCreateAndSearch(){this.createSearchView=new o({symbolsView:this.symbolsView,templatesView:this,headersView:this.headersView,footersView:this.footersView}),this.createSearchView.render({tab_selected:this.tab_selected}).$el.insertAfter(this.$(".tcb-header-tabs")),this.createSearchView.$el.toggle("notifications"!==this.tab_selected)},renderSymbols(){this.symbolsView=new i.base({dashboard_view:this}),this.$(".symbols-content").append(this.symbolsView.$el).addClass("symbols-dashboard-wrapper")},renderNotifications(){this.$(".notifications-content").html(TVE_Dash.tpl("notifications")({editLink:TVE_Admin.notifications.notifications_edit_url}))},renderSection(e){const t=e+"View";this[t]=new a.base({dashboard_view:this,type:e}),this.$("."+e+"-content").append(this[t].$el).addClass("symbols-dashboard-wrapper")}})},96295:(e,t,s)=>{const i=s(85724);e.exports=i.modal_view.extend({template:TVE_Dash.tpl("modals/move-category"),events:{"click .tvd-modal-submit":"save"},afterRender(){this.$el.addClass("template-move-tocat")},save(){const e=this;TVE_Dash.showLoader(),this.model.set("id_category",this.$("#tcb-admin-t-categ-combo").val()),this.model.save(null,{wait:!0,success(e,t){TVE_Dash.success(t.text),window.TVE_Admin.router.templatesAndSymbols()},error(e,t){TVE_Dash.err(t.responseText)},complete(){TVE_Dash.hideLoader(),e.close()}})}})},98064:(e,t,s)=>{const i=s(85724),a=s(67057);e.exports=i.base_model.extend({defaults:{id:""},url(){let e=a.ajaxurl("action=tcb_admin_ajax_controller&route=template");const t=this.get("id");return t&&(t.length||_.isNumber(this.get("id")))&&(e+="&id="+this.get("id")),e}})},99321:(e,t,s)=>{const i=s(85724),a=s(50170),o=s(54015),r=s(15719),n=s(79445),l=s(65718),c=s(13983),d=s(40019),m=s(17747),h=s(67057);var p,u=u||{};u.views=u.views||{},u.objects=u.objects||{},p=jQuery,u.views.Base=i.base_view.extend({template:TVE_Dash.tpl("symbols/container"),className:"tcb-dash-symbols-wrapper",initialize(e){this.dashboard_view=e.dashboard_view,this.render(),this.fetchSymbols()},initCategories(){this.$categories=new o(TVE_Admin.symbols_tax_terms.slice(0),{parse:!0})},render(){this.$el.html(this.template())},fetchSymbols(e){const t={tcb_symbols_tax_exclude:TVE_Admin.default_terms,per_page:100,optimole_skip_processing:1},s=jQuery.extend({},t,e);this.initCategories(),TVE_Dash.showLoader(),this.$collection=new a,this.$collection.fetch({data:p.param(s),success:_.bind(this.fetch_success,this)})},fetch_success(e){this.render_categories(e)},render_categories(e){const t=this.$(".symbols-container").html("");this.$categories.each(function(s){const i=new u.views.Category({category:s,collection:e});t.append(i.$el)})},set_categories_from_symbols(e){const t=this;e.each(function(e){const s=e.get(TVE_Admin.symbols_tax);_.isEmpty(s)?t.$categories[0]=t.default_category:_.forEach(s,function(e){t.$categories[e.term_id]||(t.$categories[e.term_id]=e)})})}}),u.views.Category=u.views.Base.extend({template:TVE_Dash.tpl("symbols/category"),className:"category-view-wrapper",events:{"click .edit-category-name":"edit_category_name","click .delete-category":"delete_category"},initialize(e){this.$category_item=e.category,this.$collection=e.collection,this.render()},render(){return this.$el.empty(),this.$el.html(this.template({category:this.$category_item})),this.list_items(),this.$category_name=this.$(".cat-name"),this},list_items(){const e=this.get_collection_for_category();return this.$list=new u.views.List({collection:e,category_item:this.$category_item}),this.$el.append(this.$list.$el),this},get_collection_for_category(){const e=this,t=this.$collection.clone(),s=[];return t.each(function(t){-1===t.get_terms().indexOf(parseInt(e.$category_item.get("term_id")))&&s.push(t)}),t.remove(s),t},edit_category_name(e){const t=this,s=p(e.currentTarget),i=new Backbone.Model({value:this.$category_item.get("name"),label:"",required:!0}),a=new l({model:i,tagName:"div"});s.hide(),this.$category_name.hide().after(a.render().$el),i.on("change:value",function(e,i){t.save_category({name:i}),a.remove(),t.$category_name.show(),s.show()}),i.on("tcb_admin_no_change",function(){t.$category_name.html(t.$category_item.get("name")).show(),a.remove(),s.show()}),a.focus()},delete_category(){this.modal(c,{model:this.$category_item,model_view:this,is_term:!0,title:"Delete category",text:TVE_Admin.t.delete_category_txt.replace("%s",this.$category_item.get("name")),text_deleted:TVE_Admin.category_deleted,text_not_deleted:TVE_Admin.t.category_not_deleted,"max-width":"60%",width:"750px",in_duration:200,out_duration:300,className:"delete-symbol tvd-modal"})},remove_deleted_category(e){let t;e.deleted&&_.forEach(TVE_Admin.symbols_tax_terms,function(s,i){s.term_id===e.previous.id&&(t=i)}),"undefined"!=typeof deleted_index&&TVE_Admin.symbols_tax_terms.splice(t,1)},save_category(e){const t=this;this.$category_item.set(e),this.$category_item.save(null,{success(e){t.$category_name.html(e.get("name")),TVE_Dash.success(TVE_Admin.t.category_save)},error(e,t,s){let i="";if(t.responseJSON)i=t.responseJSON.message;else if(t.responseText)try{i="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}i||(i=(t.statusText||s)+(t.status?" ("+t.status+")":"")),TVE_Dash.err(i)}})},change_category(e){const t=e.currentTarget.getAttribute("data-term-id");this.$el.find(".term-item").each(function(){this.getAttribute("data-term-id")===t?this.classList.add("active"):this.classList.remove("active")}),this.set_active_category(t)},set_active_category(e){const t=this;if(!this.$categories)return!1;e||(e=Object.keys(this.$categories)[0]),_.forEach(this.$categories,function(s,i){t.$categories[i].active=i===e})}}),u.views.Search=u.views.Base.extend({template:TVE_Dash.tpl("symbols/search"),className:"search-container",events:{"click span.new-cat":"create_category","click span.new-symbol":"create_symbol","keyup input.search-symbols":"search_symbols"},initialize(e){this.categories_collection=e.categories,this.symbols_collection=e.collection,this.base_view=e.base_view,this.render()},render(){return this.$el.html(this.template()),this},create_category(){this.modal(d,{title:TVE_Admin.t.create_category,description:TVE_Admin.t.description_category,save_text:TVE_Admin.t.save_category_text,placeholder:TVE_Admin.t.placeholder_category,in_duration:200,is_symbol:0,out_duration:300,save_category:_.bind(this.save_category,this)})},create_symbol(){this.modal(d,{title:TVE_Admin.t.create_symbol,description:TVE_Admin.t.description_symbol,save_text:TVE_Admin.t.save_symbol_text,placeholder:TVE_Admin.t.placeholder_symbol,is_symbol:1,in_duration:200,out_duration:300,show_category:1,categories:this.categories_collection,save_category:_.bind(this.save_category,this)})},save_category(e){e.rest_symbol_terms=TVE_Admin.rest_routes.symbols_terms;const t=this;return new r(e).save(null,{success(e){const s=e.toJSON();s.term_id=s.id,s.term_taxonomy_id=s.id,TVE_Admin.symbols_tax_terms.unshift(s),e.set("term_id",s.id);const i=new u.views.Category({category:e,collection:t.symbols_collection});t.base_view.$el.find(".symbols-container").prepend(i.$el),t.categories_collection.unshift(e),TVE_Dash.success(TVE_Admin.t.category_created)},error(e,t,s){let i="";if(t.responseJSON)i=t.responseJSON.message;else if(t.responseText)try{i="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}i||(i=(t.statusText||s)+(t.status?" ("+t.status+")":"")),TVE_Dash.err(i)}})},search_symbols(e){const t={search:e.currentTarget.value};_.isEmpty(e.currentTarget.value)?this.base_view.fetchSymbols():this.base_view.fetchSymbols(t)}}),u.views.List=u.views.Base.extend({template:TVE_Dash.tpl("symbols/list"),className:"symbols-items tcb-masonry-grid fill-content",events:{"click .open-create-modal":"new_symbol_modal"},initialize(e){this.$collection=e.collection,this.$category_item=e.category_item,this.render()},render(){this.$el.html(this.template({length:this.$collection.length})),this.$collection.each(this.renderOne,this);const e=this.$el.find(".sym-image");return h.getSize(e),TVE_Dash.hideLoader(),this},renderOne(e){const t=new u.views.Item({model:e});return this.$el.prepend(t.render().$el),this},new_symbol_modal(){this.modal(d,{title:TVE_Admin.t.create_symbol,description:TVE_Admin.t.description_symbol,save_text:TVE_Admin.t.save_symbol_text,placeholder:TVE_Admin.t.placeholder_symbol,is_symbol:1,in_duration:200,out_duration:300,show_category:0,category_id:this.$category_item.get("term_id")})}}),u.views.Item=u.views.Base.extend({template:TVE_Dash.tpl("symbols/item"),className:"symbol-item-container tcb-masonry-item",events:{"click .sym-pen":"edit_symbol_name","click .sym-delete":"delete_symbol","click .sym-duplicate":"duplicate_symbol","click .sym-move":"move_symbol","click .edit-symbol":"edit_symbol"},initialize(e){this.model=e.model},render(){return this.$el.html(this.template({item:this.model})),this.$symbol_name=this.$(".symbol-title-text"),this},delete_symbol(){this.modal(c,{model:this.model,model_view:this,is_term:!1,title:"Delete symbol",text:TVE_Admin.t.delete_symbol_txt.replace("%s",this.model.get("title").rendered),text_deleted:TVE_Admin.t.symbol_deleted,text_not_deleted:TVE_Admin.t.symbol_not_deleted,"max-width":"60%",width:"750px",in_duration:200,out_duration:300,className:"delete-symbol tvd-modal"})},edit_symbol_name(e){const t=this,s=p(e.currentTarget),i=new Backbone.Model({value:this.model.get("title").rendered,label:"",required:!0}),a=new l({model:i,tagName:"div"});s.hide(),this.$symbol_name.hide().after(a.render().$el),i.on("change:value",function(e,i){t.save_symbol({title:i}),a.remove(),t.$symbol_name.show(),s.show()}),i.on("tcb_admin_no_change",function(){t.$symbol_name.html(t.model.get("title").rendered).show(),a.remove(),s.show()}),a.focus()},save_symbol(e){this.model.set(e),this.model.unset("tcb_symbols_tax"),this.model.unset("thumb"),this.model.save(null,{success:e=>{this.$symbol_name.html(e.get("title").rendered),TVE_Dash.success(TVE_Admin.t.symbol_save)},error(e,t,s){let i="";if(t.responseJSON)i=t.responseJSON.message;else if(t.responseText)try{i="parsererror"===s?"Could not parse response: "+t.responseText:JSON.parse(t.responseText).message}catch(e){}i||(i=(t.statusText||s)+(t.status?" ("+t.status+")":"")),TVE_Dash.err(i)}})},duplicate_symbol(){const e=this.model.clone(),t=e.get("tcb_symbols_tax"),s=_.isEmpty(t)?t:t[0].term_id,i={content:e.get("content"),status:e.get("status"),tcb_symbols_tax:s,title:e.get("title").rendered,tve_custom_css:e.get("tve_custom_css"),tve_updated_post:e.get("tve_updated_post")},a=new n(i);a.save({old_id:e.get("id")},{success:e=>{const t=new u.views.Item({model:e});this.$el.after(t.render().$el),TVE_Dash.success(TVE_Admin.t.duplicate_symbol_success),a.unset("old_id")},error:()=>TVE_Dash.err(TVE_Admin.t.cannot_duplicate_symbol)})},move_symbol(){this.modal(m,{model:this.model,categories:new o(TVE_Admin.symbols_tax_terms.slice(0),{parse:!0}),current_category:this.model.getCurrentCategory(),"max-width":"60%",width:"750px",in_duration:200,out_duration:300})},edit_symbol(){window.open(this.model.get("edit_url"),"_blank")}}),e.exports={base:u.views.Base,category:u.views.Category}}},t={};function s(i){var a=t[i];if(void 0!==a)return a.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,s),o.exports}_.templateSettings={evaluate:/<#([\s\S]+?)#>/g,interpolate:/<#=([\s\S]+?)#>/g,escape:/<#-([\s\S]+?)#>/g},function(e){const t=window.TVE_Admin=window.TVE_Admin||{};t.globals=t.globals||{},e(function(){const i=s(99321),a=s(95528),o=Backbone.Router.extend({view:null,$el:e("#tcb-admin-dashboard-wrapper"),routes:{"template/:id":"templatePreview",symbols:"symbols",templatessymbols:"templatesAndSymbols"},breadcrumbs:{col:null,view:null},initBreadcrumbs(){const e=s(18830),t=s(94437);this.breadcrumbs.col=new t,this.breadcrumbs.view=new e({collection:this.breadcrumbs.col})},initHeader(e){new(s(29199))(e)},setPage(s,i,a){this.breadcrumbs.col.reset(),a=a||{},this.breadcrumbs.col.addPage(t.dash_url,t.t.dashboard,!0),_.each(a,_.bind(function(e){this.breadcrumbs.col.addPage(e.route,e.label)},this)),this.breadcrumbs.col.addPage("",i);const o=e("head > title");this.original_title||(this.original_title=o.html()),o.html(i+" ‹ "+this.original_title)},templatePreview(e){if(this.view&&this.view.remove(),TVE_Dash.opened_modal_view&&TVE_Dash.opened_modal_view.close(),isNaN(parseInt(e)))return void t.router.navigate("#templatessymbols",{trigger:!0});const i=new(s(98064))({id:parseInt(e)});TVE_Dash.showLoader(),i.fetch({cache:!1,success:(e,t,i)=>{const a=s(8330);this.view=new a({model:e}),this.$el.html(this.view.render().$el),this.setPage("template/"+e.get("id"),e.get("name"),[{route:"templatessymbols",label:"Templates & Symbols"},{route:"template/"+e.get("id"),label:e.get("name")}])}}).error(function(e){TVE_Dash.err(e.responseText),TVE_Dash.hideLoader(),t.router.navigate("#templatessymbols",{trigger:!0})})},symbols(){this.initHeader({url:t.symbols_logo,class:"tcb-sym-header"}),this.setPage("symbols",t.t.templates_symbols),this.view&&this.view.remove(),this.view=new i.base,this.$el.append(this.view.$el).addClass("symbols-dashboard-wrapper")},templatesAndSymbols(e){const s=e&&e.tab_selected?e.tab_selected:"ct";this.initHeader({url:t.symbols_logo,class:"tcb-sym-header"}),this.setPage("symbols",t.t.global_elements),this.view&&this.view.remove(),this.view=new a({main_view:this,tab_selected:s}),this.$el.append(this.view.render().$el)}}),r=s(70852);t.globals.templates=new r({}),t.router=new o,t.router.initBreadcrumbs(),Backbone.history.stop(),Backbone.history.start({hashchange:!0}),Backbone.history.fragment||t.router.navigate("#templatessymbols",{trigger:!0})})}(jQuery)})();