(()=>{"use strict";const e=window.wp.hooks;var t,n;window.wp.data,window.wp.editor,t=jQuery,n={cacheElements:function(){var e=this;e.cache={},e.cache.$gutenberg=t("#editor"),e.cache.$switchMode=t(t("#templately-gutenberg-button-switch-mode").html()),e.cache.$switchGutenbergButton=e.cache.$switchMode.find("#templately-gutenberg-button"),e.cache.$templateSaveButton=e.cache.$switchMode.find("#templately-cloud-push"),e.bindEvents(),wp.data.subscribe((function(){setTimeout((function(){e.buildPanel()}),1)}))},buildPanel:function(){var e=this;if(!e.cache.$gutenberg.find("#templately-gutenberg-buttons").length){var t=e.cache.$gutenberg.find(".edit-post-header-toolbar").children().eq(0);e.cache.$switchMode.insertAfter(t)}},bindEvents:function(){this.cache.$switchGutenbergButton.on("click",(function(e){window.TemplatelyAppManager.open(null,"templately-gutenberg","gutenberg")})),this.cache.$templateSaveButton.on("click",(function(e){window.TemplatelyAppManager.open({route:"clouds/save-template"},"templately-gutenberg","gutenberg")}))},init:function(){if(this.cacheElements(),"templately_library"===templately.post_type){var t=new Set(["core/post-content","core/template-part"]);(0,e.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",(function(e,n){return t.has(n.name)||e}),100)}}},t(document).ready((function(){n.init()}))})();