/home/arranoyd/telegastro/wp-content/themes/dt-the7/inc/admin/assets/js/demo-content.min.js
!function(a){"use strict";a(function(){function b(b,c){var d='<span class="spinner is-active" style="float: none; margin: 0"></span> ',e=a("<p>"+d+b+"</p>");return"undefined"!=typeof c&&c.append(e),e}function c(b){var c=[];return a('input[type="checkbox"]:checked',b).each(function(){c.push(a(this).attr("name"))}),c}function d(a){return a?a.split(",").map(function(a){return a.trim()}).filter(function(a){return!!a}):[]}function e(b){var c=b.find("select.dt-dummy-content-post-type");c.html(""),a.each(D,function(a,b){c.append('<option id="'+a+'"  value="'+a+'">'+a+"</option>")}),g(b)}function f(b,c){var d=c.find("select.dt-dummy-content-posts");d.empty(),a.each(D[b],function(a,b){d.append('<option id="'+a+'"  value="'+a+'">'+b.post_title+"</option>")}),g(c)}function g(a){var b=a.find("select.dt-dummy-content-posts").val(),c=a.find("select.dt-dummy-content-post-type").val(),d=a.find(".dt-dummy-one-post-url");return null==b||null==c?void d.hide():(d.attr("href",D[c][b].url),void d.show())}function h(a){a.empty(),a.hide();var b='<div class="dt-dummy-controls-block" style="padding-bottom: 1em;"><table class="dt-dummy-field dt-dummy-one-post-data"><tr><td>'+dtDummy.import_msg.one_post_importing_choose_posttype+': </td><td><select name="post-type" id="post-type" class="dt-dummy-content-post-type"></select></td></tr><tr><td>'+dtDummy.import_msg.one_post_importing_choose_post+': </td><td><select name="posts" id="posts" class="dt-dummy-content-posts"></select> <a class="the7-tip dt-dummy-one-post-url" href="#" target="_blank">'+dtDummy.import_msg.one_post_importing_url_msg+"</a></td></tr></table></div>",c='<div class="dt-dummy-controls-block dt-dummy-control-buttons"><div class="dt-dummy-button-wrap"><button class="button button-primary dt-dummy-button-import-one-page-submit">'+dtDummy.import_msg.one_post_importing_import+"</button></div></div>";"undefined"!=typeof a&&(a.append(b),a.append(c))}function i(b){return[a(".dt-dummy-content-user",b).first().val()]}function j(b,c,d,e){"undefined"==typeof e&&(e=!0),c=e?"<p>"+c+"</p>":c;var f=a('<div class="dt-dummy-inline-msg hide-if-js inline '+d+'">'+c+"</div>");b.closest(".dt-dummy-control-buttons").before(f),f.fadeIn()}function k(b){b.closest(".dt-dummy-controls").find(".dt-dummy-inline-msg").fadeOut("400",function(){a(this).remove()})}function l(a,b){var c=a.attr("data-dummy-id")||"0";"undefined"==typeof B||c===G&&!b||(B.slideDown(),B.parent().find(".dt-dummy-one-page-importing-interface").remove()),G=c}function m(b){k(b),a.post(ajaxurl,{action:"the7_demo_content_php_status",_wpnonce:dtDummy.status_nonce},function(a){a.success&&a.data&&j(b,a.data,"error",!1)}).fail(function(){j(b,dtDummy.import_msg.msg_import_fail,"error")})}function n(a){k(a),q(a),a.addClass("button--importing").prop("disabled","disabled").text(dtDummy.import_msg.btn_import),o(a)}function o(a){var b=a.siblings(".spinner").first();b.addClass("is-active")}function p(a){var b=a.siblings(".spinner").first();b.removeClass("is-active"),a.removeClass("button--importing"),a.text(C)}function q(a){a.removeClass("button--importing").removeProp("disabled"),p(a)}function r(c,d,e,f){F||E||(F=!0,n(c),d.empty(),d.fadeIn(function(){var g=[],h="",i=a.when();i=i.then(function(){var c=dtDummy.import_msg.one_post_importing_msg+' "'+e.find("select.dt-dummy-content-posts option:selected").text()+'"',i=b(c,d);return a.post(ajaxurl,a.extend({},f,{dummy:"import_one_post",post_to_import:e.find("select.dt-dummy-content-posts").val()})).then(function(b){var c=a.Deferred();return b.success?c.resolve(b):c.reject(b),c.promise()}).done(function(b){return i.replaceWith(a('<p class="the7-updated">'+c+"</p>")),h=b.data.postPermalink,g=b.data.postImportActions,a("body").trigger("the7.demoContent.onePageImported"),b}).fail(function(b){return i.replaceWith(a('<p class="the7-error">'+c+"</p>")),b})}),a("body").one("the7.demoContent.onePageImported",function(){g.forEach(function(c){i=i.then(function(){var e=c;"undefined"!=typeof dtDummy.import_msg[c]&&(e=dtDummy.import_msg[c]);var g=b(e,d);return a.post(ajaxurl,a.extend({},f,{dummy:c})).then(function(b){var c=a.Deferred();return b.success?c.resolve(b):c.reject(b),c.promise()}).done(function(){g.replaceWith(a('<p class="the7-updated">'+e+"</p>"))}).fail(function(){g.replaceWith(a('<p class="the7-error">'+e+"</p>"))})})})}),i.done(function(){var a=dtDummy.import_msg.one_post_importing_success;h&&(a+=' <a href="'+h+'" target="_blank">'+h+"</a>"),j(e.find(".dt-dummy-button-import-one-page-submit"),a,"the7-updated")}),i.fail(function(a){"undefined"!=typeof a.data&&"undefined"!=typeof a.data.error_msg&&a.data.error_msg?j(c,a.data.error_msg,"error"):m(c)}),i.always(function(a){F=!1,q(c),d.delay(1e3).fadeOut()})}))}function s(b,c,d,e){if(!e&&!d)return b;var f=dtDummy.plugins_page_url,g=dtDummy.import_msg.plugins_installation_error;return c.beforePluginsInstallation(a.merge([],d,e)),d.forEach(function(d){b=b.then(function(){var b=d;return"undefined"!=typeof dtDummy.plugins[d]&&(b=dtDummy.plugins[d]),c.onActionStart(dtDummy.import_msg.installing_plugin+" "+b),a.post(f,{action:"tgmpa-bulk-install",just_install:!0,noheader:!0,plugin:d}).then(function(b){var c=a.Deferred();return a(b).find(".update-php div.error p").length>0?c.reject(b):c.resolve(b),c.promise()}).done(function(b){var d=a(b).find(".update-php div.updated p");d.find(".js-update-details-toggle").remove(),c.onActionDone(d.text())}).fail(function(b){var e=a(b).find(".update-php div.error p");c.onActionFail(e.length?e.text():g,d)})})}),b=b.then(function(){return c.onActionStart(dtDummy.import_msg.activating_plugin),a.merge(e,d),a.post(f,{action:"tgmpa-bulk-activate",noheader:!0,plugin:e}).done(function(a){c.onActionDone(dtDummy.import_msg.plugins_activated)}).fail(function(){c.onActionFail(g)})}),b=b.then(function(){return c.onActionStart(dtDummy.import_msg.rid_of_redirects),a.get(f,{noheader:!0}).done(function(){c.onActionDone(dtDummy.import_msg.rid_of_redirects)}).fail(function(){c.onActionFail(g)})})}function t(a){return"https://"+a.replace(/[\?#].*/,"").replace(/\/?$/,"/").replace("https://","")}function u(a){for(var b=null,c=0;c<dtDummy.demo_urls.length;c++){var d=dtDummy.demo_urls[c];a.search(d.url.replace("/","/"))!==-1&&(b=d.id)}return b}function v(a,b,c){for(var d in b)if(!c||d===c)for(var e in b[d])if(b[d][e].url===a)return{postType:d,id:e,url:a,title:b[d][e].post_title};return null}function w(b){var c=a.Deferred();return b.success?c.resolve(b):c.reject(b),c.promise()}function x(a){return"undefined"!=typeof dtDummy.import_msg[a]?dtDummy.import_msg[a]:a}function y(a){return a?'<a href="'+a+'">'+a+"</a>":""}function z(a){return dtDummy.import_msg.action_error+": "+a}function A(b){return a.Deferred().reject({data:{error_msg:b||""}}).promise()}var B,C,D=null,E=!1,F=!1,G=null,H=a('<div class="the7-installation-status"></div>');H.hide(),a(".feature-section").append(H),a(".dt-dummy-control-buttons .dt-dummy-button-import-one-page").on("click",function(k){if(k.preventDefault(),!F&&!E){E=!0;var o=a(this);N.blockTabs(),C=o.text();var p=o.closest(".dt-dummy-content"),t=c(p),u=i(p),v=a.when();n(o),H.empty(),H.fadeIn(),l(p,!1);var w=!1;if(-1!==t.indexOf("install_plugins")){w=!0;var x=d(p.find("input[name=plugins_to_install]").val()),y=d(p.find("input[name=plugins_to_activate]").val());v=s(v,I,x,y)}t=["download_package","get_posts"];var z,A,J={action:"the7_import_demo_content",_wpnonce:dtDummy.import_nonce,imported_authors:["admin"],user_map:u,content_part_id:G};t.forEach(function(c){v=v.then(function(){return A=c,"undefined"!=typeof dtDummy.import_msg[c]&&(A=dtDummy.import_msg[c]),z=b(A,H),a.post(ajaxurl,a.extend({},J,{dummy:c})).then(function(b){var c=a.Deferred();return b.success?c.resolve(b):c.reject(b),c.promise()}).done(function(b){return z.replaceWith(a('<p class="the7-updated">'+A+"</p>")),b}).fail(function(b){return z.replaceWith(a('<p class="the7-error">'+A+"</p>")),b})})}),v.done(function(b){"undefined"!=typeof b.data&&"undefined"!=typeof b.data.response&&"getPostsList"===b.data.response&&(D=b.data.data,B=o.closest(".dt-dummy-controls-block-import-one-page"),B.delay(1100).slideUp(400,function(){var b=a('<div class="dt-dummy-one-page-importing-interface"></div>');B.after(b),h(b),e(b),b.slideDown(),f(b.find("select.dt-dummy-content-post-type").val(),b),b.find("select.dt-dummy-content-post-type").on("change",function(a){f(this.value,b)}),b.find("select.dt-dummy-content-posts").on("change",function(a){g(b)}),b.find("button.dt-dummy-button-import-one-page-submit").on("click",function(a){r(o,H,b,J)}),a("body").trigger("the7.demoContent.demoDownloaded")}))}),v.fail(function(a){"undefined"!=typeof a.data&&"undefined"!=typeof a.data.error_msg&&a.data.error_msg?j(o,a.data.error_msg,"error"):m(o)}),v.always(function(){H.delay(1e3).fadeOut(),q(o),E=!1,N.unblockTabs()})}}),a(".dt-dummy-control-buttons .dt-dummy-button-import").on("click",function(e){if(e.preventDefault(),!F&&!E){E=!0;var f=a(this);N.blockTabs(),C=f.text(),n(f),H.empty(),H.fadeIn();var g=f.closest(".dt-dummy-content"),h=c(g),k=i(g),o=a.when();l(g,!0);var p=!1;if(-1!==h.indexOf("install_plugins")){h=h.filter(function(a){return"install_plugins"!==a}),p=!0;var r=d(g.find("input[name=plugins_to_install]").val()),t=d(g.find("input[name=plugins_to_activate]").val());o=s(o,I,r,t)}return h.length>0&&(h.unshift("download_package"),h.push("cleanup")),h.forEach(function(c){o=o.then(function(){var d=c;"undefined"!=typeof dtDummy.import_msg[c]&&(d=dtDummy.import_msg[c]);var e=b(d,H);return a.post(ajaxurl,{action:"the7_import_demo_content",dummy:c,_wpnonce:dtDummy.import_nonce,imported_authors:["admin"],user_map:k,content_part_id:G}).then(function(b){var c=a.Deferred();return b.success?c.resolve(b):c.reject(b),c.promise()}).done(function(b){e.replaceWith(a('<p class="the7-updated">'+d+"</p>"))}).fail(function(){e.replaceWith(a('<p class="the7-error">'+d+"</p>"))})})}),o.done(function(){j(f,dtDummy.import_msg.msg_import_success,"the7-updated")}),o.fail(function(a){"undefined"!=typeof a.data&&"undefined"!=typeof a.data.error_msg&&a.data.error_msg?j(f,a.data.error_msg,"error"):m(f)}),o.always(function(){H.delay(500).fadeOut(),q(f),E=!1,N.unblockTabs()}),p&&o.then(function(){window.scroll(0,0),window.location.reload()}),!1}}),a("#the7-dashboard input[name=install_plugins]").on("click",function(){var b=a(this),c=[b.closest(".dt-dummy-field").siblings(".dt-dummy-import-settings"),b.closest(".dt-dummy-controls").find(".dt-dummy-control-buttons")];b.is(":checked")?c.map(function(a){a.removeClass("disabled").find(":input").removeAttr("disabled")}):c.map(function(a){a.addClass("disabled").find(":input").attr("disabled","disabled")})});var I={feedback:null,beforePluginsInstallation:function(){},onActionStart:function(a){this.feedback=b(a,H)},onActionDone:function(b){this.feedback.replaceWith(a('<p class="the7-updated">'+b+"</p>"))},onActionFail:function(b){this.feedback.replaceWith(a('<p class="the7-error">'+b+"</p>")),window.location.reload()}},J=a(".dt-dummy-content");a("#dt-dummy-search-input").on("search keyup",function(){var b=a(this).val().toLowerCase();if(1!==b.length){var c=u(t(b));J.each(function(){var d=a(this),e=!1;e=c?d.attr("data-dummy-id")===c:d.find("h3").first().text().toLowerCase().includes(b),e?d.show():d.hide()})}});var K=function(){function b(b,c){this.insertAfterObj=a(c),this.noticeID=b,this.noticeTplObj=a('<div id="'+b+'" class="the7-dashboard-notice the7-notice notice is-dismissible"></div>'),a("body").on("click","#"+b+" .notice-dismiss",function(){a("#"+b).remove()})}return b.prototype.addError=function(b,c){if(!b)return a();a("html, body").animate({scrollTop:0},400);var d='<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>';return this.noticeTplObj.clone().html(b+d).addClass(c).insertAfter(this.insertAfterObj)},b.prototype.removeErrors=function(){a("#"+this.noticeID).remove()},b.prototype.prepareMsg=function(a){return"<p><strong>"+a+"</strong></p>"},b.prototype.addMsg=function(a,b){return this.addError(this.prepareMsg(a),b)},b}(),L=new K("the7-demo-content-error",".wrap > .wp-header-end"),M=a(".the7-import-by-url-page");a("#the7-import-page-submit",M).on("click",{postType:M.attr("data-post-type")},function(b){b.preventDefault();var c,d,e,f=function(a){a&&"undefined"!=typeof a.data&&"undefined"!=typeof a.data.error_msg&&a.data.error_msg&&L.addMsg(a.data.error_msg,"error")},g=function(){h.destroy(),k.show(),q(j),E=!1,N.unblockTabs()},h={init:function(a){this.progressStep=1,this.max=4,this.element=a,this.label=this.element.find(".progress-label"),this.element.progressbar({value:0,max:this.max})},setLabel:function(a){this.label.text(a)},increment:function(a){a&&this.label.text(a),this.element.progressbar("value",this.element.progressbar("value")+this.progressStep)},incrementToMax:function(a){a&&this.label.text(a),this.element.progressbar("value",this.max)},increaseMax:function(a){var b=this.element.progressbar("value");this.max=window.Math.max(this.max,b+a),this.element.progressbar("option","max",this.max)},destroy:function(){this.label.text(""),this.element.progressbar("destroy")}},i={beforePluginsInstallation:function(a){h.increaseMax(a.length+4)},onActionStart:function(a){h.setLabel(a)},onActionDone:function(){h.increment()},onActionFail:function(a){L.addMsg(a,"error")}},j=a(this),k=j.parents(".dt-dummy-button-wrap"),l=[],m=[],o=[],p=t(a("#the7-import-page-url").val()),r=u(p);if(L.removeErrors(),!r)return void L.addMsg(dtDummy.import_msg.invalid_url_error,"error");if(!E){E=!0,C=j.text();var B=a.when();h.init(a("#the7-import-progressbar")),h.setLabel(dtDummy.import_msg.btn_import),n(j),k.hide(),N.blockTabs();var D={action:"the7_import_demo_content",_wpnonce:dtDummy.import_nonce,imported_authors:["admin"],user_map:[0],content_part_id:r,demo_page_url:p};["download_package","get_posts"].forEach(function(b){B=B.then(function(){var c=x(b);return h.setLabel(c),a.post(ajaxurl,a.extend({},D,{dummy:b})).then(w).done(function(){h.increment()}).fail(function(a){L.addMsg(z(c),"error")})})}),B=B.then(function(a){return"undefined"==typeof a.data||"undefined"==typeof a.data.response||"getPostsList"!==a.data.response?A(dtDummy.import_msg.cannot_get_posts_list_error):(c=v(p,a.data.data,typenow||b.data.postType||"post"))?(l=a.data.plugins_to_install,void(m=a.data.plugins_to_activate)):A(dtDummy.import_msg.cannot_found_page_by_url_error.replace("%url%",p))}),B=B.then(function(){B=s(B,i,l,m),B=B.then(function(b){return h.setLabel(dtDummy.import_msg.import_post_types),a.post(ajaxurl,a.extend({},D,{dummy:"import_one_post",post_to_import:c.id})).then(w).done(function(a){d=a.data.postPermalink,o=a.data.postImportActions,e=a.data.postEditLink,h.increment()}).fail(function(a){L.addMsg(z(dtDummy.import_msg.import_post_types),"error")})}),B=B.then(function(b){var c=a.when();return h.increaseMax(o.length),o.forEach(function(b,d){c=c.then(function(){var c=x(b);return h.setLabel(c),a.post(ajaxurl,a.extend({},D,{dummy:b})).then(w).done(function(){d===o.length-1?h.incrementToMax():h.increment()}).fail(function(){L.addMsg(z(c),"error")})})}),c.then(b)}),B.done(function(a){window.location.assign(e),L.addMsg(dtDummy.import_msg.one_post_importing_success+" "+y(d),"updated")}),B.fail(f),B.always(g)}),B.fail(function(a){f(a),g()})}});var N={bootstrap:function(){var b=this;a(".nav-tab-wrapper").show(),this.showOptionsTab(a(".nav-tab-wrapper a.nav-tab-active").attr("id")),a(".tabs-holder").removeClass("hidden"),a(".nav-tab-wrapper a").on("click.the7.tabs",function(a){b.onTabClick(a,this)}),a(window).on("popstate.the7.tabs",this.onPopstate.bind(this))},convertTab2Group:function(a){return a.replace("-tab","-group")},showOptionsTab:function(b){if(b){var c=this.convertTab2Group(b);a(".group").hide().filter("#"+c).fadeIn(),a(".nav-tab-wrapper a").removeClass("nav-tab-active").filter("#"+b).addClass("nav-tab-active").blur()}},onTabClick:function(b,c){b.preventDefault();var d=a(c);if(d.hasClass("blocked"))return!1;var e=d.attr("id");return this.showOptionsTab(e),history.pushState({activeGroupId:"#"+this.convertTab2Group(e)},"",d.attr("href")),!1},onPopstate:function(b){var c={};if(location.search.substr(1).split("&").forEach(function(a){c[a.split("=")[0]]=a.split("=")[1]}),c.tab)var d=c.tab;else var d=a(".nav-tab-wrapper a").first().attr("id");this.showOptionsTab(d)},blockTabs:function(){a(".nav-tab-wrapper a").removeClass("blocked").addClass("blocked")},unblockTabs:function(){a(".nav-tab-wrapper a").removeClass("blocked")}};N.bootstrap()})}(jQuery);