(()=>{function e(o){return e="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},e(o)}"undefined"!=typeof wp&&void 0!==wp.domReady&&wp.domReady((function(){var o=!1,t=!1;"undefined"!==advgb_blocks_vars.blocks.active_blocks&&0!==advgb_blocks_vars.blocks.active_blocks.length||(o=!0),"undefined"!==advgb_blocks_vars.user_block_features&&advgb_blocks_vars.user_block_features&&(t=advgb_blocks_vars.user_block_features);var n=null;void 0!==window._wpLoadBlockEditor&&(n=window._wpLoadBlockEditor),null!==n&&n.then((function(){if(t){var n=document.createElement("style"),i="";void 0!==t.disable_block_adding&&t.disable_block_adding&&(setTimeout((function(){wp.data.dispatch("core/editor").setIsInserterOpened(!1),wp.data.dispatch("core/editor").removeEditorPanel("inserter"),wp.data.dispatch("core/editor").updateEditorSettings({hasInserter:!1,allowedBlockTypes:!1})}),3e3),o=!1,i+='\n                            .editor-document-tools__left button.components-toolbar-button editor-document-tools__inserter-toggle,\n                            .editor-document-tools__left button[aria-label="Block Inserter"],\n                            .edit-post-header-toolbar__inserter-toggle,\n                            .block-editor-inserter,\n                            .block-editor-block-list__insertion-point-inserter,\n                            .block-editor-default-block-appender {\n                                display: none !important;\n                            }\n                        '),void 0!==t.disable_pattern_directory&&t.disable_pattern_directory&&(i+='\n                            .editor-inserter-sidebar button[id*="-patterns-view"],\n                            .editor-inserter-sidebar button[aria-controls*="-patterns-view"],\n                            .block-editor-inserter__block-patterns-tabs-container,\n                            .block-editor-tabbed-sidebar__tabpanel[id*="-patterns-view"],\n                            .block-editor-tabbed-sidebar__tab[id*="-patterns-view"],\n                            .block-editor-block-patterns-list,\n                            .block-editor-tabbed-sidebar__tabpanel[aria-labelledby*="-patterns"],\n                            .block-editor-tabbed-sidebar__tab[aria-labelledby*="-patterns"] {\n                                display: none !important;\n                            }\n                        '),void 0!==t.disable_openverse&&t.disable_openverse&&(i+='\n                            .block-editor-inserter__media-tabs-container button[id*="-openverse"],\n                            .block-editor-inserter__media-tabs-container button[aria-controls*="-openverse-view"] {\n                                display: none !important;\n                            }\n                        '),i&&(n.innerHTML=i,document.head.appendChild(n))}!0!==advgb_blocks_vars.original_settings.allowedBlockTypes&&(o=!1);var r=[],a=[],c=!1,s=wp.blocks.getBlockTypes(),l={active_blocks:Object.values(advgb_blocks_vars.blocks.active_blocks),inactive_blocks:Object.values(advgb_blocks_vars.blocks.inactive_blocks)};for(var d in s){var b="",p={name:s[d].name,icon:s[d].icon.src,title:s[d].title,category:s[d].category,parent:s[d].parent},_=s[d].icon.src?s[d].icon.src:s[d].icon;void 0!==s[d].icon.foreground&&(p.iconColor=s[d].icon.foreground),"function"==typeof _?void 0!==_.prototype?(p.icon=wp.element.renderToString(wp.element.createElement(_)),p.icon=p.icon.replace(/stopcolor/g,"stop-color"),p.icon=p.icon.replace(/stopopacity/g,"stop-opacity")):(b=wp.element.createElement(wp.components.Dashicon,{icon:"block-default"}),p.icon=wp.element.renderToString(b)):"object"===e(_)?(p.icon=wp.element.renderToString(_),p.icon=p.icon.replace(/stopcolor/g,"stop-color"),p.icon=p.icon.replace(/stopopacity/g,"stop-opacity")):"string"==typeof _&&(b=wp.element.createElement(wp.components.Dashicon,{icon:_}),p.icon=wp.element.renderToString(b)),r.push(p),l.active_blocks.indexOf(s[d].name)>=0?a.push(s[d].name):l.inactive_blocks.indexOf(s[d].name)>=0||(a.push(s[d].name),c=!0)}if(c){void 0!==console&&void 0!==console.error&&console.log("Reloading editor by PublishPress Blocks plugin"),o&&setTimeout((function(){wp.data.dispatch("core/editor").updateEditorSettings({allowedBlockTypes:a})}),3e3);var u=wp.blocks.getCategories();try{jQuery.ajax({url:advgb_blocks_vars.ajaxurl,method:"POST",data:{action:"advgb_update_blocks_list",blocksList:JSON.stringify(r),categoriesList:JSON.stringify(u),nonce:advgb_blocks_vars.nonce},success:function(e){}})}catch(e){}}}))}))})();
//# sourceMappingURL=editor.js.map