PATH:
home
/
fengshp
/
www
/
wp-content
/
plugins
/
themify-builder-pro
/
admin
/
js
((t,e,s,i,l,n,o,a,r)=>{"use strict";let p,c,_=!1;const d=new URL(t.currentScript.src,e.location.origin),u=d.searchParams.get("ver"),h=d.href.split("?")[0].replace("tbp-admin.js","").slice(0,-1).trim(),b=h.substring(0,h.lastIndexOf("/")+1),f=new a,m=new a,y=new a,w=new a,g=(t="",e,i)=>{""===t&&(t="div");const l=s.createElement(t,e);return i!==o&&(l.textContent=i),l},x=()=>t.createDocumentFragment(),v=class{constructor(t){t&&(this.mode=t,m.set(t,this))}getOptions(){const{opt_labels:t,template_types:e}=r,{single:s,archive:i}=t,{single_tax:l,archive_tax:o}=r.options,a={header(e,s){const i=this.single(e,s,!0),l=this.page(e,s);return i.optgroup.unshift({id:"page",label:t.page,options:l}),{general:{label:t.general},archive:{label:t.archives,options:this.archive(e,s,!0)},single:{label:t.singlular,options:i}}},footer(t,e){return this.header(t,e)},single(i,l,o){const a={all:{label:s.all},is_attachment:{label:t.is_attachment,has_query:!0},optgroup:[{label:t.p,id:"post",options:{post:t.post,category:s.category,post_tag:s.post_tag}}]};if(i&&n.keys(i).length>0){!0!==o&&e.product_single&&(delete i.product,a.optgroup[0].selected="post");for(let t in i)a.optgroup.push(i[t])}return a},archive(s,l,o){const a={all:{label:i.all},is_date:{label:t.is_date},is_front:{label:t.home_latest},is_author:{label:t.is_author,has_query:!0},is_search:{label:t.is_search},optgroup:[{label:t.post,id:"post",options:{all_post:t.all_post,category:i.category,post_tag:i.post_tag}}]};if("posts"!==r.show_on_front&&delete a.is_front,l&&n.keys(l).length>0){!0!==o&&e.product_single&&(delete l.product,a.optgroup[0].selected="all_post");for(let t in l)a.optgroup.push(l[t])}return a},page(){const e={page:{label:t.page,has_query:!0},is_front:{label:t.is_front,has_query:!1},is_404:{label:t.is_404,has_query:!1},child_of:{label:t.child_of,has_query:!0}};return"page"!==r.show_on_front&&delete e.is_front,e},product_single:()=>({product:{label:t.product,has_query:!0},product_cat:{label:s.product_cat,has_query:!0},product_tag:{label:s.product_tag,has_query:!0}}),product_archive(){const e={all_product:{label:t.all_product},shop:{label:t.shop}},s=r.product_tax;if(s)for(let t=0;t<s.length;++t)e[s[t].slug]={label:s[t].label,has_query:!0};return e},cart:()=>({full:{label:t.cart_f},empty:{label:t.cart_e}}),checkout:()=>({all:{label:t.checkout}})},p=[];for(let t in e)p[t]=a[t](l,o);return[{id:"post_title",label:t.name,type:"text"},{id:"post_parent",label:t.theme_name,help:t.theme_help,type:"select",options:r.themes,default:r.active_theme},{id:"post_mime_type",label:t.type,type:"tbp_type",options:e},{id:"post_excerpt",label:t.condition,type:"condition",options:p},{id:"menu_order",label:t.order,type:"number",min:0,help:t.orderh}]}run(l){if(this.options=this.getOptions(),c={},w.clear(),p)p.tfClass("lightbox")[0].replaceChildren();else{const l=t.tfId("tpl-tbp_builder_lightbox");l.ownerDocument!==e.top.document&&e.top.document.body.appendChild(l);const n=l.firstElementChild,o=l.ownerDocument.tfId("tf_base-css").sheet.cssRules,a=l.ownerDocument.tfId("tbp_top_admin-css"),c=t.tfId("tf_svg").cloneNode(!0),d=x(),h=s.click;let f="";for(let t=0;t<o.length;++t)f+=o[t].cssText;if(a)for(let t=a.sheet.cssRules,e=0;e<t.length;++e)t[e].selectorText.includes("tb_busy")&&(f+=t[e].cssText);d.append(c.cloneNode(!0),g("style",{id:"tf_base"},f)),n&&(l.attachShadow({mode:n.getAttribute("shadowrootmode")}).appendChild(n.content),n.remove()),l.shadowRoot.prepend(d),p=l.shadowRoot.querySelector(".lightbox_parent"),a||s.loadCss(b+"css/components/top-admin","tbp_top_admin-css",u,p),p.tfClass("close")[0].tfOn(h,(t=>{t.stopPropagation(),this.close()}),{passive:!0}),p.tfClass("back")[0].tfOn(h,(t=>{t.stopPropagation(),p.classList.remove("step2"),p.classList.add("step1")}),{passive:!0});for(let t=p.querySelectorAll(".save_btn,.draft_btn"),l=t.length-1;l>-1;--l)t[l].tfOn(h,(async t=>{if(t.stopPropagation(),p.classList.contains("step2")||v.id){p.classList.add("tb_busy");try{const[l,n]=await i.all([this.save(t.currentTarget.classList.contains("draft_btn")),this.importNotification()]);await TF_Notification.showHide("done",r.done,800),_=!0;const o=l.data;if(!l.success)throw o;"tbp_theme"===r.type?(this.close(),e.location.reload()):o.redirect&&!s.is_builder_active&&(e.location.href=o.redirect)}catch(t){await this.importNotification(),await TF_Notification.showHide("error",t.messsage?t.message:t,3e3)}p.classList.remove("tb_busy")}else this.next()}),{passive:!0})}const n=p.classList;if(n.remove("step2"),n.add("step1"),n.toggle("new",!l),n.toggle("edit",!!l),"tbp_theme"===r.type){const t=p.tfClass("save_btn")[0];t.tfClass("edit_text")[0].textContent=l&&l==r.active?t.dataset.normal:t.dataset.active}return p.tfClass("lb_title")[0].textContent=l?r.edit_template:r.add_template,this.edit(l).then((t=>{this.render(this.options,t),p.getRootNode().host.classList.remove("tf_hide"),this.importModulePredesing(),this.importModuleImport(),s.loadJs(s.url+"js/admin/import/import-images",!!e.TF_ImportImages)}))}edit(t){this.showLoader(!0),v.id=t;const e=[s.loadCss(b+"css/tbp-admin","tbp-admin-css",u,p)];return t&&e.push(s.fetch({id:t,action:r.type+"_get_item",nonce:r.nonce})),i.all(e).then((t=>t?.[1]??o)).finally((()=>{this.showLoader()}))}close(){p.getRootNode().host.classList.add("tf_hide"),!0!==_||s.is_builder_active||e.location.reload()}showLoader(t){e.top.document.body.classList.toggle("tb_busy",t)}saveStep1(){const t=p.tfClass("field"),e={};for(let s=t.length-1;s>-1;--s)if(t[s].classList.contains("condition")){let i=t[s].tfClass("condition_wrap")[0],l=i.tfClass("repeat"),a=[];for(let t=0;t<l.length;++t){a[t]={};let e=l[t].tfClass("repeat_inner")[0].children;for(let s=e.length-1;s>-1;--s){let i=e[s].classList;if(i.contains("box")){if(!0!==e[s].tfClass("pagination_all")[0].checked){let e=l[t].dataset.index;if(c[e]!==o){let s=l[t].querySelector(".query_type select")||l[t].querySelector(".general select");null!==s&&c[e][s.value]&&n.keys(c[e][s.value]).length>0&&(a[t].detail=c[e][s.value])}}}else if(i.contains("include")||i.contains("selectwrapper")){let i=e[s].tfTag("select")[0];"in"!==i.value&&(a[t][i.dataset.id]=i.value)}}}e[i.id]=a}else{let i=t[s].querySelectorAll("input,select,textarea");for(let t=i.length-1;t>-1;--t){let s=i[t].value.trim();s&&(e[i[t].id]=s)}}return e}importModuleImport(){return s.loadJs(s.url+"js/admin/import/import",!!e.TF_Import)}importModulePredesing(){return s.loadJs(b+"js/components/predesigned",!!e.TBP_Predesigned,u)}importModuleFile(){return s.loadJs(s.url+"js/admin/jszip.min",!!e.JSZip,"3.10.1"),s.loadJs(b+"js/components/import-file",!!e.TBP_ImportFromFile,u)}importTemplate(t,e,s){const i=this.convertToV7(e.posts||e);if(t)for(let e=i.length-1;e>-1;--e)i[e].post_parent=t;return s??="templates",this.import(s,i)}async importNotification(){await s.loadJs(s.url+"js/admin/notification",!!e.TF_Notification),await TF_Notification.init()}convertToV7(t){for(let e=t.length-1;e>-1;--e){let s=t[e],i=s.tbp_template_options||s,n=s.builder_data||s.template_builder_content||s.settings;i.tbp_template_name&&(!s.post_title||s.post_title.length<2)&&(s.post_title=i.tbp_template_name),i.title&&(!i.post_title||s.post_title.length<2)&&(s.post_title=i.title),!i.tbp_associated_theme||s.post_parent&&"0"!==s.post_parent||(s.post_parent=i.tbp_associated_theme),i.tbp_template_type&&(!s.post_mime_type||s.post_mime_type.length<2)&&(s.post_mime_type="/"+i.tbp_template_type),"/"!==s.post_mime_type[0]&&(s.post_mime_type="/"+s.post_mime_type),i.tbp_template_conditions&&(!s.post_excerpt||s.post_excerpt.length<2)?s.post_excerpt=l.stringify(i.tbp_template_conditions):s.post_excerpt&&"string"!=typeof s.post_excerpt&&(s.post_excerpt=l.stringify(s.post_excerpt)),!n||s.meta_input&&!s.meta_input._themify_builder_settings_json||(s.meta_input??={},s.meta_input._themify_builder_settings_json="string"==typeof n?l.parse(n):n),s.ID??=s.id||Date.now()+e,delete s.settings,delete s.id,delete s.title,delete s.builder_data,delete s.template_builder_content,delete s.tbp_template_conditions,delete s.tbp_associated_theme,delete s.tbp_template_name,delete s.tbp_template_type,delete s.tbp_template_options}return t}next(){const t=this.saveStep1().post_mime_type||"theme",e=[s.loadCss(b+"css/components/predesigned","tbp-predesigned-css",u,p),this.importModulePredesing()],l=p.querySelector(".lightbox.step2"),n=new i(((s,i)=>{e[1].then((()=>{TBP_Predesigned["theme"===t?"getThemes":"getTemplates"](t).then(s).catch(i)})).catch(i)}));return l.tfClass("predesigned_"+t)[0]===o&&p.classList.add("tb_busy"),e.push(n),i.all(e).then((e=>(p.classList.contains("tb_busy")&&l.replaceChildren(TBP_Predesigned.getHtml(e[2],t,r)),e))).finally((()=>{p.classList.add("step2"),p.classList.remove("step1","tb_busy")}))}async save(t){try{const e=[],n=r.type,o={id:v.id||"",is_draft:t?1:0,action:n+"_saving",data:this.saveStep1(),nonce:r.nonce},a="tbp_theme"===n?s.fetch(o):"";if(e.push(a),!v.id&&p){const t=p.querySelector(".predesigned .selected");if(t){const s=t.dataset.slug;if("blank"!==s){const l=new i((async(e,l)=>{await this.importModulePredesing();const o=[TBP_Predesigned["tbp_theme"===n?"getTheme":"getTemplate"](s)];t.querySelector(".import_demo input:checked")&&o.push(TBP_Predesigned.getThemeDemo(s)),i.all(o).then(e).catch(l)}));e.push(l)}}}let[c,_]=await i.all(e);if("tbp_theme"!==n){if(_){let t=_[0][0].template_builder_content||_[0][0].builder_content||"";t&&("string"==typeof t&&(t=l.parse(t)),o.data.builder=t)}c=await s.fetch(o),_=null}if(!c.data?.id)throw c.data||"error";if(v.id=c.data.id,_){const[t,e]=_;t&&(await this.importTemplate(v.id,t),e&&await this.importDemo(v.id,e))}return c}catch(t){throw t}}getIcon(e){const s="http://www.w3.org/2000/svg",i=t.createElementNS(s,"use"),l=t.createElementNS(s,"svg");return e="tf-"+e.trim().replace(" ","-"),l.setAttribute("class","tf_fa "+e),i.setAttributeNS(null,"href","#"+e),l.appendChild(i),l}render(e,l){l??={};const n=s.click,a=this,_={text:{render(t,e){const s=g("input",{type:t.type||"text",id:t.id,name:t.id});return t.class&&(s.className=t.class),e&&(s.value=e),s}},number:{render(t,e){t.type="number";const s=_.text.render(t,e);return t.min!==o&&(s.min=t.min),t.max!==o&&(s.max=t.max),s}},select:{render(t,e){const s=g("select","tf_scrollbar tf_w"),i=g("","selectwrapper tf_overflow tf_rel"),l=x(),n=e||t.default;for(let e in t.options){let s=g("option",{value:e},t.options[e]);n==e&&(s.selected=!0),l.appendChild(s)}return s.appendChild(l),t.id&&(s.id=s.name=t.id),t.wrap_class&&(i.className+=" "+t.wrap_class),i.appendChild(s),i}},description:{render:t=>g("small","tf_block",t)},image:{render(t,e){const i=g("","upload_wrap tf_rel"),a=g("","img_preview"),p=g("input",{type:"hidden",id:t.id}),c=g("input",{type:"hidden",id:t.id+"_id"}),d=g("button",{type:"button",class:"upload_btn plus flex tf_rel"},r.upload_image),u=g("button",{type:"button",class:"tf_close delete_img tf_hide"}),h=()=>{p.value=c.value="",u.previousElementSibling?.remove()},b=t=>{if(t){const e=50,s=new Image(e,e),i=new Image(e,e);i.decoding="async",i.src="https://placehold.co/"+e+"x"+e+".webp",a.classList.add("tb_busy"),s.src=t,s.decoding="async",s.decode().finally((()=>{i.replaceWith(s),a.classList.remove("tb_busy")})),a.prepend(i)}};return e!==o&&(p.value=e,l[c.id]&&(c.value=l[c.id])),a.appendChild(u),i.append(p,c,d,a),t.description&&i.appendChild(_.description.render(t.description)),u.tfOn(n,(t=>{t.stopPropagation(),h()}),{passive:!0}),d.tfOn(n,(t=>{let e;t.stopPropagation(),e=wp.media.frames.file_frame=wp.media({title:r.upload_image,library:{type:"image"},button:{text:r.upload_image},multiple:!1}),e.off("select").on("select",(()=>{h();const t=e.state().get("selection").first().toJSON();p.value=t.url,s.triggerEvent(p,"change");p.getRootNode().querySelector("#"+p.id+"_id")&&(c.value=t.id)})),e.open(),e.content.mode("browse")}),{passive:!0}),p.tfOn("change",(t=>{b(t.currentTarget.value.trim())}),{passive:!0}),b(e),i}},tbp_type:{render(t,s){const i=_.select.render(t,s),l=i.tfTag("select")[0];return a.type=s||l.value,l.tfOn("change",(t=>{let s;t.stopPropagation(),w.set(a.type,a.saveStep1()),a.type=t.currentTarget.value;for(let t=e.length-1;t>-1;--t)if("condition"===e[t].type){s=e[t];break}const i=s.id,l=p.querySelector("#"+i),n=w.get(a.type)||{};l.replaceWith(_.condition.render(s,n[i]))}),{passive:!0}),i}},condition:{options:{},render(t,e){const s=g("",{id:t.id,class:"condition_wrap"}),i=x();e&&0!==e.length||(e=[{}]),this.options=t.options;for(let t=0;t<e.length;++t)i.appendChild(this.renderRepeat(this.options[a.type],t,e[t]));return i.appendChild(g("button",{type:"button",class:"add plus tf_textl tf_rel"},r.add_conition)),s.tfOn(n,(t=>{const e=t.target?.closest(".add,.delete");if(e)if(t.stopPropagation(),e.classList.contains("delete")){const t=e.closest(".repeat"),s=t.dataset.index;c[s]!==o&&delete c[s],t.remove()}else e.before(this.renderRepeat(this.options[a.type],null,{}))}),{passive:!0}).appendChild(i),s},renderRepeat(t,e,s){e??=this.setIndex();const i=g("",{class:"repeat flex","data-index":e}),l=g("","repeat_inner");return l.append(this.includeRender(s),this.renderGeneral(t,s,e)),i.append(l,g("button",{type:"button",class:"tf_close delete"})),i},includeRender(t){const e=_.select.render({wrap_class:"include flex",options:{in:r.include,ex:r.exclude}},t.include);return e.classList.remove("selectwrapper","tf_overflow"),e.tfTag("select")[0].dataset.id="include",e},renderGeneral(t,e,s){let i=e.query,l=e.detail;const n="general",r=this.renderSelect(t,e[n],n,n),p=r.tfTag("select")[0],c=x(),_=(t,e)=>{t.tfOn("change",(t=>{t.stopPropagation(),d(t.currentTarget)}),{passive:!0}).dataset.id=e},d=t=>{const e=t.value,n=this.options[a.type][e],r=t.closest(".selectwrapper"),p=t.options[t.selectedIndex],c=r.nextSibling;let u=1==~~p.dataset.hasQuery;if(c?.nextSibling?.remove(),c?.remove(),n!==o){if(n.options!==o){const t=this.renderSelect(n.options,i,"query_type"),e=t.tfTag("select")[0];_(e,"query"),r.after(t),i&&d(e)}}else if(!1===u&&!p.hasAttribute("data-has-query")){const t=p.parentNode,s="OPTGROUP"===t.nodeName&&t.dataset.id;u=s&&"all_"+s!==e}!0===u&&r.after(this.renderSinlgeItems(l,e,s))};return c.appendChild(r),_(p,n),d(p),i=l=o,c},renderSelect(t,e,s){const i=x(),l=_.select.render({wrap_class:s}),n=(t,s,i,l)=>{const n=g("option",{value:t},s);return(t===e||l===t&&null===v.id)&&(n.selected=!0),i!==o&&(n.dataset.hasQuery=i?1:0),n};for(let e in t)if("optgroup"===e)for(let s=0;s<t[e].length;++s){let l=t[e][s],o=g("optgroup",{label:l.label,"data-id":l.id}),a=x();for(let t in l.options){let e=l.options[t];a.appendChild(n(t,e.label??e,e.has_query,l.selected))}o.appendChild(a),i.appendChild(o)}else i.appendChild(n(e,t[e].label,t[e].has_query,t[e].selected));return l.tfTag("select")[0].appendChild(i),l},renderSinlgeItems(e,s,i){let l;const a=g("",{class:"box selectwrapper tf_rel",tabindex:-1});a.appendChild(t.tfId("tmpl-tbp_box").content.cloneNode(!0));const r=a.tfClass("pagination_all")[0],p=a.tfClass("select_all")[0],_=a.tfClass("pagination_all")[0],d="tbp_"+Math.random().toString(36).substr(2,7),u=t=>{p.textContent=t.checked?p.dataset.all:p.dataset.select};if(r.tfOn("change",(t=>{t.stopPropagation(),this.loadData(a).then((()=>{this.setSelected(a)})),u(t.currentTarget)}),{passive:!0}),s!==o&&e){r.checked=!1;const t=a.closest(".repeat");null!==t&&(i=t.dataset.index),c[i]??={},c[i][s]??={},c[i][s]=e,p.tfOn("pointerdown",(t=>{t.stopPropagation(),this.loadData(a).then((()=>{this.setSelected(a)}))}),{passive:!0,once:!0}),u(r)}return _.id=d,_.previousElementSibling.setAttribute("for",d),a.tfClass("search")[0].tfOn("input",(t=>{t.stopPropagation(),clearTimeout(l);const e=t.currentTarget.value;l=setTimeout((()=>{this.loadData(a,1,e)}),10)}),{passive:!0}),a.tfClass("result_wrap")[0].tfOn("change",(t=>{this.saveCheckboxes(t.currentTarget),this.setSelected(t.currentTarget)}),{passive:!0}),a.tfClass("selected_wrap")[0].tfOn(n,(t=>{const e=t.target?.closest(".delete_sel");if(e){t.stopPropagation();const s=e.closest("[data-id]").dataset.id,i=e.closest(".search_wrap"),l=i.querySelector('input[value="'+s+'"][type="checkbox"]'),n=this.getCheckedItems(i);l&&(l.checked=!1),delete n[s],this.setSelected(t.currentTarget),i.closest("[tabindex]").focus()}}),{passive:!0}),a},setSelected(t){const e=x(),i=t.closest(".repeat"),l=i.tfClass("selected_wrap")[0],n=i.tfClass("result")[0].tfTag("input"),a=[],p=this.getCheckedItems(i);let c=i.querySelector(".query_type select")||i.querySelector(".general select");c=c.value;for(let t=n.length-1;t>-1;--t){let e=n[t].name+n[t].value;y.has(e)||y.set(e,n[t].parentNode.title)}for(let t in p){let s=g("li",{"data-id":t}),i=g("","sel_text tf_overflow"),l=y.get(c+t);i.innerHTML=i.title=l||t,s.append(i,g("button",{type:"button",class:"delete_sel tf_close"})),e.appendChild(s),l===o&&a.push(t)}a.length>0&&(l.classList.add("tb_busy"),s.fetch({action:"tbp_get_titles",data:a,type:c,nonce:r.nonce}).then((e=>{if(e.success){const{exist:s,deleted:i}=e.data;for(let t in s)y.set(c+t,s[t]);if(i)for(let t=i.length-1;t>-1;--t)delete p[i[t]];this.setSelected(t)}})).finally((()=>{l.classList.remove("tb_busy")}))),l.replaceChildren(e)},loadData(t,e,a){return new i(((p,c)=>{let _=t;while(null!==_)if(_=_.previousElementSibling,_.classList.contains("selectwrapper")&&null!==_.offsetParent)break;if(null!==_){e=~~e||1;const d=t.tfClass("result_wrap")[0],u=_.tfTag("select")[0].value,h=u+a+e,b=f.get(h);let m=i.resolve(b);this.xhr?.abort(),this.saveCheckboxes(t),b||(this.xhr=new AbortController,d.classList.add("tb_busy"),m=s.fetch({action:"tbp_load_data",p:e,s:a||"",type:u,nonce:r.nonce},"json",{signal:this.xhr.signal}).then((t=>(f.set(h,t=t.data),t))).finally((()=>{d.classList.remove("tb_busy")}))),m.then((s=>{const i=g("","result tf_scrollbar"),r=x(),{data:c,count:_,limit:h}=s,b=this.getCheckedItems(t);for(let t in c){let e=g("label"),s=g("span"),i=g("input",{type:"checkbox",value:t,name:u});b[t]!==o&&(i.checked=!0),s.innerHTML=e.title=c[t],e.append(i,s),r.appendChild(e)}if(i.appendChild(r),d.replaceChildren(i),_>h){const s=g("","pagination flex"),i=x();for(let t=1,s=Math.ceil(_/h);t<=s;++t){let s=g("button",{type:"button",class:"page","data-number":t},t);e===t&&(s.className+=" current"),i.appendChild(s)}s.tfOn(n,(e=>{e.stopPropagation();const s=e.target.dataset.number;s&&this.loadData(t,s,a)}),{passive:!0}).appendChild(i),d.appendChild(s)}a===o&&t.closest(".box").focus(),p([l,d,e])})).catch((t=>{"AbortError"===t.name?p():c(t)}))}else c()}))},saveCheckboxes(t){let e=t.tfTag("input"),s=t.closest(".repeat"),i=s.dataset.index,l=s.querySelector(".query_type select")||s.querySelector(".general select");l=l.value,c[i]??={},c[i][l]??={};for(let t=e.length-1;t>-1;--t){let s=e[t].value;!0===e[t].checked?c[i][l][s]=!0:c[i][l][s]!==o&&delete c[i][l][s]}},getCheckedItems(t){let e=t.closest(".repeat"),s=e.dataset.index,i=e.querySelector(".query_type select")||e.querySelector(".general select");return c[s][i.value]||{}},setIndex(){const t=p.tfClass("repeat");let e=~~t[0]?.dataset.index;for(let s=t.length-1;s>0;--s){let i=~~t[s].dataset.index;e<i&&(e=i)}return++e}}},d=x();if(v.id||r.active||"tbp_theme"===r.type)for(let t=0;t<e.length;++t){let s=e[t],i=g("","field "+s.type),n=g("label",{class:"flex",for:s.id},s.label);if(s.help){let t=g("span",{class:"help tf_rel"}),e=g("button",{type:"button",class:"help_icon"}),i=g("span","help_text tf_box tf_hide");i.innerHTML=s.help,e.appendChild(this.getIcon("ti-help")),t.append(e,i),n.appendChild(t)}i.append(n,_[s.type].render(s,l[s.id])),d.appendChild(i)}else{p.classList.add("no_active");const t=g("","no_theme flex");t.innerHTML=r.no_active,t.prepend(this.getIcon("ti-alert")),d.appendChild(t)}p.tfClass("lightbox")[0].appendChild(d)}async export(t){this.showLoader(!0),await i.all([s.loadJs(b+"js/components/export",!!e.TBP_ExportFile,u),this.importNotification()]);try{await TBP_ExportFile.init(t,r.type,r),TF_Notification.showHide("done",r.done)}catch(t){throw TF_Notification.showHide("error",t,3e3),t}finally{this.showLoader()}}importFile(){const t=g("input",{type:"file",accept:".zip,.txt"}),s=this;t.tfOn("change",(async function(t){this.remove();const l=this.files[0];s.showLoader(!0);try{await i.all([s.importModuleFile(),s.importNotification(),s.importModuleImport()]);const t=await TBP_ImportFromFile.init(l,s,r);await TF_Notification.showHide("done",r.done,1500),t?.redirect&&"tbp_theme"===r.type&&confirm(r.theme_imported.replaceAll("%post%",t.title))?e.location.href=t.redirect:e.location.reload()}catch(t){await TF_Notification.showHide("error",t,5e3)}s.showLoader()}),{passive:!0,once:!0}).click()}async import(t,e){await i.all([this.importModuleImport(),this.importNotification()]);const n=r.memory;if(r.images_chunk=n>=255?6:n>=120?5:n>60?3:2,"menu"!==t){r.loading=r["import_"+t],r.custom_params={type:t},"templates"!==t&&"file_templates"!==t&&(e="menu_items"===t?TF_Import.sort(e,"meta_input","_menu_item_menu_item_parent"):"terms"===t?TF_Import.sort(e,"parent"):TF_Import.sort(e,"post_parent"));const s=await TF_Import.init(e,"tbp_ajax_import",r.nonce,r,"tbp","tbp_ajax_import");return delete r.custom_params,s}{await TF_Notification.show("info",r.import_menu);const i={id:"tbp",nonce:r.nonce,action:"tbp_ajax_import",data:e,type:t};try{if(!(await s.fetch(i)).success)throw"error"}catch(t){try{i.data=new Blob([l.stringify(i.data)],{type:"application/json"});if(!(await s.fetch(i)).success)throw"error"}catch(t){throw t}}}}},T=()=>{const e=t.tfClass("page-title-action")[0];e&&r.import_btn&&e.after(g("button",{type:"button",class:"tbp_admin_import add-new-h2"},r.import_btn)),t.tfOn([s.click,"tbp_edit"],(e=>{let i=e.detail instanceof HTMLElement?e.detail:e.target;if(i=i?.closest(".tbp_lightbox_edit,.page-title-action,.tbp_admin_import,.tbp_export,#doaction"),i){let l="doaction"===i.id;if(l){const t=i.closest("form").querySelector('select[name="action"]');if(!t||"bulk-export"!==t.value)return}e.preventDefault(),e.stopPropagation(),s.trigger("tbp_layout_loaded",[v]);const n=r.type.split("_")[1],o=m.get(n)||new v;if(o.importNotification(),o.importModuleImport(),l||i.classList.contains("tbp_export")){let s={};if("theme"!==n)if(l){const e=t.tfId("the-list").querySelectorAll('input[name="post[]"]:checked');if(0===e.length)return;for(let t=e.length-1;t>-1;--t)s[e[t].value]=e[t].closest("tr").querySelector(".row-title").textContent}else s[e.target.dataset.postId]=i.closest("tr").querySelector(".row-title").textContent;else s=[e.target.dataset.postId];o.export(s)}else i.classList.contains("tbp_admin_import")?o.importFile():o.run(i.dataset.postId)}})),s.trigger("tbp_ready",[v])};"complete"===t.readyState?T():e.tfOn("load",T,{once:!0,passive:!0})})(document,window,Themify,Promise,JSON,Object,void 0,Map,tbp_admin);
[+]
..
[+]
components
[-] tbp-admin.js
[edit]
[-] tbp-admin.js.gz
[edit]
[-] tbp-theme.js
[edit]
[-] tbp-theme.js.gz
[edit]