!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=12)}([function(e,t,n){var r,a;!function(){"use strict";function n(){for(var e=[],t=0;t1&&void 0!==arguments[1]?arguments[1]:0,n=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!Object(a.a)(n))throw TypeError("Stringified UUID is invalid");return n}for(var a=n(3),o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));t.a=r},function(e,t,n){"use strict";function r(e){return"string"===typeof e&&a.a.test(e)}var a=n(23);t.a=r},function(e,t,n){"use strict";var r=(n(22),n(24),n(26));n.d(t,"a",function(){return r.a});n(27),n(29),n(30),n(3),n(2),n(7)},function(e,t,n){"use strict";function r(){if(!a&&!(a="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return a(o)}t.a=r;var a,o=new Uint8Array(16)},function(e,t,n){"use strict";function r(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}var a=n(3);t.a=r},function(e,t,n){"use strict";function r(e){var t=[];return e.map(function(e,n){var a=e.name,o=e.attributes,i=e.innerBlocks;i.length>0&&(i=r(i)),t=t.concat([wp.blocks.createBlock(a,o,i)])}),t}function a(e){if(!e||!e.name||!e.attributes)return e;if(Array.isArray(e)){var t=[];return e.map(function(e,n){var a=e.name,o=e.attributes,i=e.innerBlocks;i&&i.length>0&&(i=r(i)),t=t.concat([wp.blocks.createBlock(a,o,i)])}),t}var n=e.name,a=e.attributes,o=e.innerBlocks;return o&&o.length>0&&(o=r(o)),wp.blocks.createBlock(n,a,o)}function o(e,t,n){void 0===e[t]&&(e[t]=[]),void 0===e[t][n]?e[t][n]=1:e[t][n]++,void 0===e[t].all?e[t].all=1:e[t].all++}function i(e,t,n){void 0===e[t]&&(e[t]=[]),void 0===e[t][n]?e[t][n]=1:e[t][n]++,void 0===e[t]["all-pro"]?e[t]["all-pro"]=1:e[t]["all-pro"]++}function s(e,t,n){void 0===e[t]&&(e[t]=[]),void 0===e[t][n]?e[t][n]=1:e[t][n]++,void 0===e[t]["all-free"]?e[t]["all-free"]=1:e[t]["all-free"]++}function l(e){var t={"gutentor/icon-box":__("Icon Widget","gutentor"),"gutentor/image-box":__("Image Widget","gutentor"),"gutentor/content-box":__("Content Widget","gutentor"),"gutentor/team":__("Team Widget","gutentor"),"gutentor/accordion":__("Accordion Widget","gutentor"),"gutentor/opening-hours":__("Opening Hours Widget","gutentor"),"gutentor/timeline":__("Timeline Widget","gutentor"),"gutentor/counter-box":__("Counter Widget","gutentor"),"gutentor/tabs":__("Tabs Widget","gutentor"),"gutentor/about-block":__("About Widget","gutentor"),"gutentor/featured-block":__("Featured Widget","gutentor"),"gutentor/testimonial":__("Testimonial Widget","gutentor"),"gutentor/restaurant-menu":__("Restaurant Menu Widget","gutentor"),"gutentor/pricing":__("Pricing Widget","gutentor"),"gutentor/gallery":__("Gallery Widget","gutentor"),"gutentor/social":__("Social Links Widget","gutentor"),"gutentor/divider":__("Divider","gutentor"),"gutentor/video-popup":__("Video Popup Widget","gutentor"),"gutentor/progress-bar":__("Progress Bar Widget","gutentor"),"gutentor/image-slider":__("Image Slider Widget","gutentor"),"gutentor/author-profile":__("Author Widget","gutentor"),"gutentor/call-to-action":__("Call To Action Widget","gutentor"),"gutentor/count-down":__("Countdown Widget","gutentor"),"gutentor/google-map":__("Google Map Widget","gutentor"),"gutentor/blog-post":__("Post Widget","gutentor"),"gutentor/list":__("Advanced List Widget","gutentor"),"gutentor/show-more":__("Show More Widget","gutentor"),"gutentor/notification":__("Notification Widget","gutentor"),"gutentor/advanced-import":__("Template Library","gutentor"),"gutentor/advanced-columns":__("Advanced Columns (Old Version)","gutentor"),"gutentor/single-column":__("Single Column (Old Version)","gutentor"),"gutentor/button":__("Button (Old version)","gutentor"),"gutentor/e0":__("Simple Text","gutentor"),"gutentor/e1":__("Advanced Text","gutentor"),"gutentor/e2":__("Button","gutentor"),"gutentor/e3":__("Counter","gutentor"),"gutentor/e4":__("Google Map","gutentor"),"gutentor/e5":__("Icon","gutentor"),"gutentor/e6":__("Image","gutentor"),"gutentor/e7":__("Advanced List","gutentor"),"gutentor/e8":__("Pricing","gutentor"),"gutentor/e9":__("Progress Bar","gutentor"),"gutentor/e10":__("Rating","gutentor"),"gutentor/e11":__("Video Popup","gutentor"),"gutentor/e12":__("Pagination","gutentor"),"gutentor/e13":__("Navigation","gutentor"),"gutentor/e14":__("Term Filter","gutentor"),"gutentor/e15":__("Single Column","gutentor"),"gutentor/e16":__("Post Module Header","gutentor"),"gutentor/e17":__("Post Module Footer","gutentor"),"gutentor/e20":__("Filter Module Header","gutentor"),"gutentor/e18":__("Filter Item","gutentor"),"gutentor/e19":__("Filter Items","gutentor"),"gutentor/e21":__("Search","gutentor"),"gutentor/m0":__("Carousel","gutentor"),"gutentor/m0-col":__("Carousel Single Column","gutentor"),"gutentor/m1":__("Button Group","gutentor"),"gutentor/m2":__("Dynamic Columns","gutentor"),"gutentor/m2-col":__("Dynamic Single Column","gutentor"),"gutentor/m3":__("Container/Cover","gutentor"),"gutentor/m4":__("Advanced Columns","gutentor"),"gutentor/m4-col":__("Single Column","gutentor"),"gutentor/m5":__("Slider","gutentor"),"gutentor/m5-col":__("Single Slide","gutentor"),"gutentor/m6-item":__("Single Accordion Item","gutentor"),"gutentor/m6":__("Accordion","gutentor"),"gutentor/m7":__("Tabs","gutentor"),"gutentor/m7-tab":__("Single Tab Item","gutentor"),"gutentor/m8":__("Icon Group","gutentor"),"gutentor/m9":__("Form Wrapper","gutentor"),"gutentor/m10":__("Gallery","gutentor"),"gutentor/m10-col":__("Single Column","gutentor"),"gutentor/m11":__("Filter","gutentor"),"gutentor/m12":__("Quote","gutentor"),"gutentor/m13":__("Table of Contents","gutentor"),"gutentor/p1":__("Post (Type)","gutentor"),"gutentor/p2":__("Post (Type) Feature","gutentor"),"gutentor/p3":__("Post (Type) Carousel","gutentor"),"gutentor/p4":__("Advanced Post (Type)","gutentor"),"gutentor/p5":__("Post (Type) News Ticker","gutentor"),"gutentor/p6":__("Duplex Post (Type)","gutentor"),"gutentor/t1":__("Term (Category)","gutentor"),"gutentor/t2":__("Term (Category) Feature","gutentor"),"gutentor/t3":__("Term Category Carousel","gutentor"),"gutentor/m14":__("Advance Show More","gutentor"),"gutentor/m15":__("PopOver","gutentor"),"gutentor/m16":__("Wrapper","gutentor")};return t[e]?t[e]:e}t.a=a,t.c=o,t.e=i,t.d=s,t.b=l;var __=wp.i18n.__},function(e,t,n){"use strict";function r(e){var t=o(e);return wp.element.createElement(a,{blocks:t,__experimentalOnReady:function(e){e.scale,e.previewContainerRef,e.position}})}t.a=r;var a=wp.blockEditor.BlockPreview,o=wp.blocks.parse},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(0),s=n.n(i),l=function(){function e(e,t){for(var n=0;n',o+='',o+=""+__("Templateberg","templateberg"),o+="",r.innerHTML=o,t.insertBefore(r,t.childNodes[0]),document.getElementById("tb-advanced-import-button").addEventListener("click",a);case 20:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),__=wp.i18n.__,d=wp.blocks.registerBlockType,f=wp.components,g=f.Tooltip,b=f.Button,h=f.Dashicon,v={blockID:{type:"string"},isImportOpen:{type:"boolean",default:!1}};d("templateberg/a1",{title:__("Templateberg","templateberg"),description:__("Advanced Import - Import Blocks and Templates Library","templateberg"),icon:wp.element.createElement("img",{src:templateberg.templateLibrarySvg}),category:"templateberg-modules",keywords:[__("Advanced Import Template Block Widget Section Patterns Reusable Library Tools","templateberg")],attributes:wp.hooks.applyFilters("templateberg_add_attributes",v),edit:function(e){var t=e.attributes,n=e.className,r=e.setAttributes,a=e.clientId,o=t.blockID,i=t.isImportOpen;o!==a&&r({blockID:a});var s=function(){r({isImportOpen:!1})};return wp.element.createElement("section",{id:"section-"+o,className:l()("tb-section","tb-advanced-import",n)},wp.element.createElement(g,{text:__("Open Templateberg Library","templateberg")},wp.element.createElement(b,{isPrimary:!0,isLarge:!0,className:"tb-template-library",onClick:function(){return r({isImportOpen:!0})}},wp.element.createElement(h,{icon:"category"}),__("Templateberg","templateberg")),i&&wp.element.createElement(c.a,{clientId:a,close:s})))},save:function(e){return null}});var y=function(){var e=r(i.a.mark(function e(){var t,n,r,a,o;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=window.location.href.includes("wp-admin/site-editor.php")){e.next=3;break}return e.abrupt("return",!1);case 3:if(n=wp.data.select("core/editor"),r=n.getCurrentPostId(),"page"!==(a=n.getCurrentPostType())||!r){e.next=18;break}return e.prev=7,e.next=10,wp.apiFetch({path:"/wp/v2/settings"});case 10:return o=e.sent,e.abrupt("return",o.page_on_front===r);case 14:return e.prev=14,e.t0=e.catch(7),console.error("Error fetching settings:",e.t0),e.abrupt("return",!1);case 18:return e.abrupt("return",!1);case 19:case"end":return e.stop()}},e,u,[[7,14]])}));return function(){return e.apply(this,arguments)}}(),w=void 0;p(),function(e){var t=e.pushState;e.pushState=function(n){return"function"==typeof e.onpushstate&&e.onpushstate({state:n}),p(),t.apply(e,arguments)}}(window.history)},function(e,t,n){var r=function(){return this}()||Function("return this")(),a=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=a&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(20),a)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof a?t:a,i=Object.create(o.prototype),s=new d(r||[]);return i._invoke=c(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function a(){}function o(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,a,o,i){var s=r(e[n],e,a);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"===typeof c&&v.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,i)},function(e){t("throw",e,o,i)}):Promise.resolve(c).then(function(e){l.value=e,o(l)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,a){t(e,n,r,a)})}return a=a?a.then(r,r):r()}var a;this._invoke=n}function c(e,t,n){var a=S;return function(o,i){if(a===T)throw new Error("Generator is already running");if(a===x){if("throw"===o)throw i;return g()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var l=u(s,n);if(l){if(l===I)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===S)throw a=x,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=T;var c=r(e,t,n);if("normal"===c.type){if(a=n.done?x:N,c.arg===I)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=x,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===b){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=b,u(e,t),"throw"===t.method))return I;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return I}var a=r(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,I;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=b),t.delegate=null,I):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,I)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function f(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var i=v.call(a,"catchLoc"),s=v.call(a,"finallyLoc");if(i&&s){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),I}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;m(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:f(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=b),I}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]&&arguments[0],B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return c.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(y.a)();case 2:return t=e.sent,n="templateberg/v1/get_templates?paged="+B,j&&(n="templateberg/v1/get_templates?reset=true&paged="+B),e.next=7,x({path:n});case 7:r=e.sent,r?"object"===("undefined"===typeof r?"undefined":w(r))?(a=[],o=[],i=[],s=[],l=[],u=[],p=[],m=[],d=[],f=[],b=[],h=[],v=[],k=[],E=[],_=r.templates,C=r.found_posts,S=r.max_pages,T=r.purchased_items,_?(_.map(function(e){var n=e.type;"widget"===n||"blocks"===n?n="block":"templates"===n?n="template":"my-purchase"===n?n="my-purchase":"template-kits"===n&&(n="template-kit"),void 0===E[n]&&(E[n]=[]),E[n].push(e),N(t)&&(t.includes(e.id)||t.includes(parseInt(e.id)))&&(void 0===E.favourites&&(E.favourites=[]),E.favourites.push(e)),e.categories&&("template-kit"===n?(e.categories.map(function(t){e.is_pro?(d.push(t),Object(g.e)(v,n,t)):(m.push(t),Object(g.d)(h,n,t)),p.push(t),Object(g.c)(b,n,t)}),e.templates&&(k[e.id]=e.templates.length)):"template"===n?e.categories.map(function(t){e.is_pro?(u.push(t),Object(g.e)(v,n,t)):(l.push(t),Object(g.d)(h,n,t)),s.push(t),Object(g.c)(b,n,t)}):"block"===n?e.categories.map(function(t){e.is_pro?(i.push(t),Object(g.e)(v,n,t)):(o.push(t),Object(g.d)(h,n,t)),a.push(t),Object(g.c)(b,n,t)}):"pattern"===n&&e.categories.map(function(e){f.push(e),Object(g.c)(b,n,e)}))}),a=a.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),o=o.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),i=i.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),s=s.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),l=l.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),u=u.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),p=p.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),m=m.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),d=d.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),f=f.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),I=this.fixTab(E),P=this.purchasedTemplates(T),O=this.purchasedTemplateKits(T),this.setState({bCats:a,bFreeCats:o,bProCats:i,tCats:s,tFreeCats:l,tProCats:u,tkCats:p,tkFreeCats:m,tkProCats:d,pCats:f,data:E,isLoaded:!0,isRefresh:!1,countItems:b,countFreeItems:h,countProItems:v,tkCount:k,hasAccount:!0,tab:I,found_posts:C,max_pages:S,purchased_templates:P,purchased_template_kits:O,gutentorInfo:!!r.gutentor&&r.gutentor})):this.setState({isLoaded:!0,isRefresh:!1,isError:!0,hasAccount:!0})):this.setState({isLoaded:!0,isRefresh:!1,isError:!0,hasAccount:!0}):this.setState({hasAccount:!1});case 9:case"end":return e.stop()}},e,this)}));return e}()},{key:"refreshTemplateLibrary",value:function(){var e=this;e.setState({bCats:[],bFreeCats:[],bProCats:[],tCats:[],tFreeCats:[],tProCats:[],tkCats:[],tkFreeCats:[],tkProCats:[],pCats:[],data:[],isLoaded:!1,isRefresh:!0}),e.templateFetch(!0)}},{key:"uploadImport",value:function(e){var t=this;this.setState({missingBlocks:[]});var n=e.current.files[0],r=new FileReader;r.onload=function(){var e=JSON.parse(r.result);t.validateBlocks(e)?t.setState({isMissing:!0}):t.props.import(e)},r.readAsText(n)}},{key:"componentDidMount",value:function(){this.templateFetch()}},{key:"componentWillUnmount",value:function(){this.clearInterval()}},{key:"changeTab",value:function(e){this.setState({tab:e,selectedCategory:"all",search:""})}},{key:"fixTab",value:function(e){var t=this.state.tab;return e[t]?t:e["template-kit"]?"template-kit":e.block?"block":e.template?"template":t}},{key:"purchasedTemplates",value:function(e){var t=[];if(e)for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];return c.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({isLoaded:!1,missingBlocks:[]}),n="",l&&(n+="ignore_plugins=true&");for(r in t)"price_with_symbol"!==r&&t.hasOwnProperty(r)&&(n+="plugins"===r?r+"="+encodeURIComponent(JSON.stringify(t[r]))+"&":r+"="+t[r]+"&");return e.next=6,x({path:"templateberg/v1/get_template_data?"+n});case 6:a=e.sent,o="undefined"===typeof a?"undefined":w(a),this.noticeSetup(a),"object"===o?a.missing_plugins?(i="",a.missing_plugins.forEach(function(e,t){e.name&&(i+=" "+e.name,t0)t=!0;else if(this.state.purchased_templates)for(var n=0;n0?wp.element.createElement(P,{isPrimary:!0,isLarge:!0,className:"g-goto-tk",onClick:function(){t.gotoTemplateKit(e)},tabindex:"0",showTooltip:!0,label:__("View Templates and Import","templateberg")},__("Details","templateberg")):wp.element.createElement("a",{className:"g-tk-buynow",href:e.permalink,target:"_blank"},__("Buy Now","templateberg")):"reusable"===this.state.tab||"pattern"===this.state.tab||this.isTemplateAvailable(e)?wp.element.createElement(P,{isPrimary:!0,isLarge:!0,className:"tb-list__item-import",onClick:function(){return"reusable"===t.state.tab||"pattern"===t.state.tab?t.importReusableBlock(e.post_content):t.importTemplate(e)},tabindex:"0"},__("Insert","templateberg")):wp.element.createElement("a",{className:"tb-list__item-buy-link",href:e.permalink?e.permalink:"https://www.templateberg.com/pricing/",target:"_blank"},__("Buy Now","templateberg"))}},{key:"importReusableBlock",value:function(e){this.props.import(M(e))}},{key:"setInterval",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){var e=this;if(this.state.justOnce)return!1;var t=this;q=setInterval(a(c.a.mark(function n(){return c.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.templateFetch();case 1:case"end":return e.stop()}},n,e)})),2e3),this.setState({justOnce:!0})})},{key:"templatebergOnlyTabs",value:function(e){return!!["block","template","template-kit"].includes(e)}},{key:"clearInterval",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){q&&clearInterval(q)})},{key:"renderLoading",value:function(){return wp.element.createElement("div",{className:"tb-advanced-import-content"},wp.element.createElement(L,{text:__("Close","templateberg")},wp.element.createElement(P,{className:"tb-advanced-import-modal-tabs-button","aria-label":__("Close settings","templateberg"),onClick:this.props.close},wp.element.createElement(j,{icon:"no-alt"}))),wp.element.createElement("div",{className:"tb-advanced-import-loader"},wp.element.createElement(R,null)))}},{key:"installGutentor",value:function(){if(templateberg.gutentor.active||this.state.gutentorMsg)return!1;var e=this;jQuery.ajax({type:"POST",url:ajaxurl,data:{action:"templateberg_gutentor",security:templateberg.nonce},success:function(t){e.setState({gutentorMsg:!0})},error:function(e,t,n){console.log(n)}})}},{key:"isFavouritesSelected",value:function(e){var t=this.state.data,n=t.favourites,r=!1;if(n)for(var a=0;a1&&wp.element.createElement(v.a,{paged:this.state.paged,max_num_pages:this.state.max_pages,setPage:function(t){e.state.paged!==t&&(e.setState({paged:t}),e.templateFetch(!1,t))}}))):wp.element.createElement("div",{className:"tb-advanced-import-content"},wp.element.createElement(L,{text:__("Close","templateberg")},wp.element.createElement(P,{className:"tb-advanced-import-modal-tabs-button","aria-label":__("Close settings","templateberg"),onClick:this.props.close},wp.element.createElement(j,{icon:"no-alt"}))),wp.element.createElement("div",{className:"tb-advanced-import-loader"},wp.element.createElement(R,null),this.state.isRefresh?__("Refreshing","templateberg"):__("Importing","templateberg")))),"file"===this.state.tab&&wp.element.createElement(G,null,this.state.isMissing&&this.renderMissingError(),wp.element.createElement(O,{label:__("Import Blocks from JSON","templateberg"),icon:"upload"},wp.element.createElement("span",null,wp.element.createElement("input",{type:"file",accept:"text/json",ref:this.uploadInput,className:"tb-advanced-import-inputfile",name:"file",id:"file"}),wp.element.createElement("label",{htmlFor:"file"},__("Choose File","templateberg"))),wp.element.createElement(P,{isPrimary:!0,onClick:function(){return e.uploadImport(e.uploadInput)}},__("Upload","templateberg")))),this.clearInterval()))}},{key:"render",value:function(){var e=this;return wp.element.createElement(A,{className:p()("tb-advanced-import-modal",{"tb-advanced-import-missing-modal":this.state.isMissing},{"tb-file-tab":"file"===this.state.tab},{"g-tk-tab":"tkSelected"===this.state.tab},{"tb-purchase-tab":"my-purchase"===this.state.tab},{"tb-notice-modal":!this.state.hasAccount&&null!==this.state.hasAccount}),onRequestClose:this.props.close,isDismissable:!1,shouldCloseOnClickOutside:!1},this.state.tBergNotice.notice&&wp.element.createElement(f.a,{data:this.state.tBergNotice,close:function(t){var n={tBergNotice:t};t.item&&(n.isLoaded=!0),e.setState(n)},import:function(t){e.importTemplate(t.item,!0)}}),null===this.state.hasAccount&&this.renderLoading(),this.state.hasAccount&&this.renderTemplateImport(),!this.state.hasAccount&&null!==this.state.hasAccount&&this.renderConnectAccount())}}]),t}(V);t.a=W(D(function(e,t){var n=t.clientId,r=e("core/block-editor"),a=r.getBlock,o=e("core/blocks"),i=o.getBlockTypes;return{block:a(n),availableBlocks:i()}}),K(function(e,t){var n=t.block;return{import:function(t){return e("core/block-editor").replaceBlocks(n.clientId,Object(g.a)(t))}}}))(J)},function(e,t,n){"use strict";n(5),n(2)},function(e,t,n){"use strict";t.a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},function(e,t,n){"use strict";var r=n(6),a=n(25);Object(r.a)("v3",48,a.a)},function(e,t,n){"use strict";function r(e){if("string"===typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n>5]>>>a%32&255,i=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);t.push(i)}return t}function o(e){return 14+(e+64>>>9<<4)+1}function i(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>16)+(t>>16)+(n>>16)<<16|65535&n}function c(e,t){return e<>>32-t}function u(e,t,n,r,a,o){return l(c(l(l(t,e),l(r,o)),a),n)}function p(e,t,n,r,a,o,i){return u(t&n|~t&r,e,t,a,o,i)}function m(e,t,n,r,a,o,i){return u(t&r|n&~r,e,t,a,o,i)}function d(e,t,n,r,a,o,i){return u(t^n^r,e,t,a,o,i)}function f(e,t,n,r,a,o,i){return u(n^(t|~r),e,t,a,o,i)}t.a=r},function(e,t,n){"use strict";function r(e,t,n){e=e||{};var r=e.random||(e.rng||a.a)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return Object(o.a)(r)}var a=n(5),o=n(2);t.a=r},function(e,t,n){"use strict";var r=n(6),a=n(28);Object(r.a)("v5",80,a.a)},function(e,t,n){"use strict";function r(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function a(e,t){return e<>>32-t}function o(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"===typeof e){var o=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;k=w,w=y,y=a(v,30)>>>0,v=h,h=C}n[0]=n[0]+h>>>0,n[1]=n[1]+v>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+w>>>0,n[4]=n[4]+k>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}t.a=o},function(e,t,n){"use strict"},function(e,t,n){"use strict";n(3)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(a,o){try{var i=t[a](o),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=n(1),l=n.n(s),c=n(0),u=n.n(c),p=n(4),m=n(8),d=n(9),f=n(10),g="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t="templateberg/v1/purchase_templates",m&&(t="templateberg/v1/purchase_templates?reset=true"),e.next=4,v({path:t});case 4:n=e.sent,n?Array.isArray(n)&&n.length?(r=function(e,t){void 0===c[e]&&(c[e]=[]),void 0===c[e][t]?c[e][t]=1:c[e][t]++,void 0===c[e].all?c[e].all=1:c[e].all++},a=[],o=[],i=[],s=[],c=[],u=[],p=[],n.map(function(e){var t=e.type;"widget"===t||"blocks"===t?t="block":"templates"===t?t="template":"template-kits"===t&&(t="template-kit"),void 0===p[t]&&(p[t]=[]),p[t].push(e),e.categories&&("block"===t?e.categories.map(function(e){a.push(e),r(t,e)}):"template"===t?e.categories.map(function(e){o.push(e),r(t,e)}):"template-kit"===t&&(e.categories.map(function(e){i.push(e),r(t,e)}),e.templates&&(u[e.id]=e.templates.length)))}),a=a.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),o=o.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),i=i.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),s=s.filter(function(e,t,n){return n.indexOf(e)===t}).sort(),this.setState({bCats:a,tCats:o,tkCats:i,pCats:s,data:p,isLoaded:!0,isRefresh:!1,countItems:c,tkCount:u,hasPurchased:!0,isApiResultError:!1,isError:!1})):this.setState({isLoaded:!0,isRefresh:!1,isError:!0,isApiResultError:!0,hasPurchased:!1}):this.setState({isLoaded:!0,isRefresh:!1,isError:!1,isApiResultError:!1,hasPurchased:!1});case 6:case"end":return e.stop()}},e,this)}));return e}()},{key:"refreshTemplateLibrary",value:function(){function e(){return t.apply(this,arguments)}var t=r(l.a.mark(function e(){var t;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this,t.setState({bCats:[],tCats:[],tkCats:[],pCats:[],data:[],isRefresh:!0,isLoaded:!1}),e.next=4,t.templateFetch(!0);case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"componentDidMount",value:function(){this.templateFetch()}},{key:"componentWillUnmount",value:function(){this.clearInterval()}},{key:"changeTab",value:function(e){this.setState({tab:e})}},{key:"removeError",value:function(){this.setState({isError:!1})}},{key:"changeClientId",value:function(e){var t=this;return Array.isArray(e)?e.map(function(e){return t.changeClientId(e)}):"object"===("undefined"===typeof e?"undefined":g(e))&&Object.keys(e).map(function(n){"clientId"===n&&(e[n]=Object(p.a)()),"innerBlocks"===n&&e[n].map(function(e){t.changeClientId(e)})}),e}},{key:"validateBlocks",value:function(e){var t=this,n=!1,r=[];return Array.isArray(e)?e.map(function(e){return t.validateBlocks(e)}):"object"===("undefined"===typeof e?"undefined":g(e))&&Object.keys(e).some(function(a){if("name"===a){void 0===t.props.availableBlocks.find(function(t){return t.name===e.name})&&(r.push(e.name),n=!0)}"innerBlocks"===a&&e[a].map(function(e){return t.validateBlocks(e)})}),r=this.state.missingBlocks.concat(r).filter(function(e,t,n){return n.indexOf(e)===t}),this.setState({missingBlocks:r}),!(r.length<1)}},{key:"noticeSetup",value:function(e){var t=this.state.tBergNotice;e.code&&!e.import?t.notice=!0:t.notice=!1,e.item?t.item=e.item:t.item=!1,t.msg=e.msg,t.code=e.code,t.upgrade=e.upgrade,this.setState({tBergNotice:t})}},{key:"importTemplate",value:function(){function e(e){return t.apply(this,arguments)}var t=r(l.a.mark(function e(t){var n,r,a,o,i,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.setState({isLoaded:!1,missingBlocks:[]}),n="",s&&(n+="ignore_plugins=true&");for(r in t)"price_with_symbol"!==r&&t.hasOwnProperty(r)&&(n+="plugins"===r?r+"="+encodeURIComponent(JSON.stringify(t[r]))+"&":r+"="+t[r]+"&");return e.next=6,v({path:"templateberg/v1/get_template_data?"+n});case 6:a=e.sent,o="undefined"===typeof a?"undefined":g(a),this.noticeSetup(a),"object"===o?a.missing_plugins?(i="",a.missing_plugins.forEach(function(e,t){e.name&&(i+=" "+e.name,t=3?[t-1,t,t+1]:[1,2,3];n>1&&(i.includes(1)||o.push(wp.element.createElement("li",{className:"tb-pagination-item"},wp.element.createElement("a",{className:"tb-pagination-link",href:"#","data-gpage":"1",onClick:function(){a(1)}}," ",__("1","templateberg")))),t>3&&o.push(wp.element.createElement("li",{className:"tb-pagination-item tb-pagination-dots"},wp.element.createElement("a",{className:"tb-pagination-link",href:"#"},"..."))),i.map(function(e){if(n>=e){var r=t===e?" tb-pagination-active":"";o.push(wp.element.createElement("li",{className:"tb-pagination-item "+r},wp.element.createElement("a",{className:"tb-pagination-link",href:"#","data-gpage":e,onClick:function(){a(e)}},__(e,"templateberg"))))}}),n>t+1&&(n>3&&o.push(wp.element.createElement("li",{className:"tb-pagination-item tb-pagination-dots"},wp.element.createElement("a",{className:"tb-pagination-link",href:"#"},"..."))),n>3&&o.push(wp.element.createElement("li",{className:"tb-pagination-item"},wp.element.createElement("a",{className:"tb-pagination-link",href:"#","data-gpage":n,onClick:function(){a(n)}},__(n,"templateberg"))))));var l=t===n?"tb-pagination-disabled ":"",c=t<2?"tb-pagination-disabled ":"",u=t-1<1?1:t-1,m=t+1>n?n:t+1;return wp.element.createElement(p,null,wp.element.createElement("ul",{className:"tb-pagination"},wp.element.createElement("li",{className:s()("tb-pagination-item tb-pagination-prev",c)},wp.element.createElement("a",{className:"tb-pagination-link",href:"#",onClick:function(){a(u)}},"<<")),o,wp.element.createElement("li",{className:s()("tb-pagination-item tb-pagination-next",l)},wp.element.createElement("a",{className:"tb-pagination-link",href:"#","data-gpage":t+1,onClick:function(){a(m)}},">>"))))}}]),t}(u);t.a=m},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(a,o){try{var i=t[a](o),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}n.d(t,"a",function(){return f}),n.d(t,"b",function(){return g});var a=n(1),o=n.n(a),i=this,s=wp,l=s.apiFetch,c=wp.url.addQueryArgs,u=lodash,p=u.uniq,m=u.isArray,d=u.isEmpty,f=function(){var e=r(o.a.mark(function e(){var t,n;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t="wp/v2/users/"+templateberg.user.id,n=[],e.prev=1,e.next=4,l({path:t,method:"GET"});case 4:n=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),console.log("fetchFavourites Errors:",e.t0);case 10:return n&&n.meta&&n.meta["templateberg-fav-gt"]&&(n=n.meta["templateberg-fav-gt"]),m(n)||(n=[]),e.abrupt("return",p(n));case 13:case"end":return e.stop()}},e,i,[[1,7]])}));return function(){return e.apply(this,arguments)}}(),g=function(){var e=r(o.a.mark(function e(t){var n,r,a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="wp/v2/users/"+templateberg.user.id,e.next=3,f();case 3:return r=e.sent,m(r)||(r=[]),r&&(r.includes(t)||r.includes(parseInt(t)))?r=r.filter(function(e){return e!=t}):r.push(t),r=p(r),a={meta:{"templateberg-fav-gt":d(r)?null:r}},n=c(n,a),e.prev=9,e.next=12,l({path:n,method:"POST"});case 12:r=e.sent,e.next=18;break;case 15:e.prev=15,e.t0=e.catch(9),console.log("updateFavourites Errors:",e.t0);case 18:return r&&r.meta&&r.meta["templateberg-fav-gt"]&&(r=r.meta["templateberg-fav-gt"]),m(r)||(r=[]),e.abrupt("return",p(r));case 21:case"end":return e.stop()}},e,i,[[9,15]])}));return function(_x){return e.apply(this,arguments)}}()},function(e,t,n){"use strict";var r=n(36);window.templatebergSettings={};var a=wp.plugins,o=a.registerPlugin,i=a.unregisterPlugin;o("templateberg",{render:function(){return wp.element.createElement(r.a,null)}}),templateberg.gutentor.active&&i("templateberg")},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(11),s=function(){function e(e,t){for(var n=0;n