(()=>{"use strict";var e,t;e=jQuery,t={cacheElements:function(){var t=this;t.cache={},t.cache.$gutenberg=e("#editor"),t.cache.$switchMode=e(e("#templately-gutenberg-button-switch-mode").html()),t.cache.$switchGutenbergButton=t.cache.$switchMode.find("#templately-gutenberg-button"),t.cache.$templateSaveButton=t.cache.$switchMode.find("#templately-cloud-push"),t.bindEvents(),wp.data.subscribe((function(){setTimeout((function(){t.buildPanel()}),1)}))},buildPanel:function(){var e=this;e.cache.$gutenberg.find("#templately-gutenberg-buttons").length||e.cache.$switchMode.insertAfter(e.cache.$gutenberg.find(".edit-post-header-toolbar__left"))},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(){this.cacheElements()}},e(document).ready((function(){t.init()}))})();