(()=>{"use strict";function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,o=Array(n);t<n;t++)o[t]=e[t];return o}!function(n,t,o){function r(){var e;document.getElementById("gvnews-deprecated-popup")&&(null===(e=document.getElementById("gvnews-popup-close"))||void 0===e||e.addEventListener("click",(function(){document.body.classList.remove("gvnews-deprecated-popup","gvnews-deprecated-options","gvnews-deprecated-blocks")})))}function c(){var e=(window.GVNwsDeprecated||{}).apiNonce,t=void 0===e?"":e;n.apiFetch({path:"/gvnews-client/v1/dismissNotice",method:"POST",data:{notice:"deprecated_gutenverse_news",nonce:t}})}function i(n){var t=[];return n.forEach((function(n){var o;t.push(n),n.innerBlocks&&n.innerBlocks.length>0&&t.push.apply(t,function(n){if(Array.isArray(n))return e(n)}(o=i(n.innerBlocks))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(n,t){if(n){if("string"==typeof n)return e(n,t);var o={}.toString.call(n).slice(8,-1);return"Object"===o&&n.constructor&&(o=n.constructor.name),"Map"===o||"Set"===o?Array.from(n):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(n,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})),t}if(void 0!==n&&(null===(t=n.data)||void 0===t?void 0:t.select("core/editor"))&&(null===(o=n.data)||void 0===o?void 0:o.select("core/block-editor"))){var d=(window.GVNwsDeprecated||{}).dismissed,s=void 0===d?"":d;r(),"dismissed"!==s&&n.domReady((function(){var e=n.data,t=e.subscribe,o=e.select,r=!1,d=t((function(){var e,t;if(((null===(e=(t=o("core/editor")).__experimentalIsEditorReady)||void 0===e?void 0:e.call(t))||o("core/block-editor").getBlocks().length>0)&&!r){r=!0,d();var s=i(o("core/block-editor").getBlocks()).map((function(e){return e.name})),a=["gutenverse/news-post-title","gutenverse/news-post-tag","gutenverse/news-post-comment","gutenverse/news-archive-title"];s.some((function(e){return a.includes(e)}))&&n.data.dispatch("core/notices").createNotice("warning","One or more Gutenverse News blocks in this page are deprecated and will be removed in the next plugin update. Please replace them to ensure your layout remains functional",{isDismissible:!0,actions:[{label:"Learn More",onClick:function(){document.body.classList.add("gvnews-deprecated-popup","gvnews-deprecated-blocks")}}],onDismiss:function(){c()}})}}))}))}else document.addEventListener("DOMContentLoaded",(function(){var e,n,t;r(),(e=document.querySelectorAll(".gvnews-deprecated-block")).length>0&&e.forEach((function(e){e.querySelectorAll("a").forEach((function(e){e.addEventListener("click",(function(){document.body.classList.add("gvnews-deprecated-popup","gvnews-deprecated-blocks")}))}))})),document.getElementById("gvnews-deprecated-notice")&&(null===(n=document.getElementById("gvnews-notice-close"))||void 0===n||n.addEventListener("click",(function(){document.body.classList.remove("gvnews-deprecated-notice"),c()})),null===(t=document.getElementById("gvnews-notice-learn-more"))||void 0===t||t.addEventListener("click",(function(){document.body.classList.add("gvnews-deprecated-popup","gvnews-deprecated-blocks")})))}))}(window.wp)})();
//# sourceMappingURL=deprecated-block.js.map