!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){var o=n(5),r=n(6),i=n(7),s=n(8);e.exports=function(e){return o(e)||r(e)||i(e)||s()}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);nthis.addedNumberOfNotices&&(this.addedNumberOfNotices=n,t.forEach((function(t){var n=e.getComponentDismiss(t);n&&(n.style.visibility="hidden")})),n===this.totalNumberOfNotices&&document.dispatchEvent(new Event("otgs-notices-added")))}},{key:"getNoticeHTML",value:function(e){var t=[];return Object.values(e.childNodes).map((function(e){e.nodeType!==window.Node.ELEMENT_NODE?e.nodeValue.trim()&&t.push(e.nodeValue):e.classList.contains("notice-dismiss")||t.push(e.outerHTML)})),t.join("")}},{key:"getNoticeStatus",value:function(e){var t,n=u(e.classList);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(this.NOTICE_CLASS_STATUSES.hasOwnProperty(o))return this.NOTICE_CLASS_STATUSES[o]}}catch(e){n.e(e)}finally{n.f()}}},{key:"createBlockEditorNotices",value:function(){var e=this;if(!this.contentCreated&&document.querySelector(".edit-post-layout__content")){this.contentCreated=!0;var t=this.getOTGSNotices().reverse();t.length>0&&t.forEach((function(t){var n=e.getNoticeStatus(t),o=e.getNoticeHTML(t),r=t.classList.contains("is-dismissible");wp.data.dispatch("core/notices").createNotice(n,o,{speak:!1,__unstableHTML:!0,isDismissible:r})}))}}},{key:"closeNotice",value:function(e){if(e.detail){var t=e.detail[0];if(void 0!==t){var n=this.getComponentDismiss(t);n&&(n.style.visibility="visible",n.click())}}}},{key:"getComponentDismiss",value:function(e){return e.closest(".components-notice").querySelector(".components-notice__dismiss")}},{key:"getAddedOTGSNotices",value:function(){return r()(document.querySelectorAll(".components-notice .otgs-notice"))}},{key:"getNotices",value:function(){return r()(document.querySelectorAll(".otgs-notice"))}},{key:"getOTGSNotices",value:function(){return r()(document.querySelectorAll(".otgs-notice-wrap"))}},{key:"getOldStyledAdminNotices",value:function(){return r()(document.querySelectorAll(["#wpbody-content > .icl-admin-message"].join(", ")))}},{key:"convertOldStyledToOTGSNotices",value:function(){this.getOldStyledAdminNotices().forEach((function(e){e.classList.contains("otgs-is-dismissible")&&(e.classList.remove("otgs-is-dismissible"),e.classList.add("is-dismissible")),e.classList.remove("message","updated","icl-admin-message","icl-admin-message-error","icl-admin-message-information","icl-admin-message-warning","update-nag"),e.classList.add("notice","otgs-notice")}))}}]),e}();document.addEventListener("DOMContentLoaded",(function(){new d}))}]);