File: /var/www/zaklada/wp-content/plugins/sitepress-multilingual-cms/dist/js/blockEditorNotices/app.js
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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=1)}([function(e,t,n){"use strict";function i(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||o(e)||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.")}()}function o(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.r(t);var c=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.NOTICE_CLASS_STATUSES={"notice-success":"success",updated:"success","notice-warning":"warning","notice-error":"error",error:"error","notice-info":"info"},this.contentCreated=!1,this.convertOldStyledToOTGSNotices();var n=this.getNotices();n.forEach(function(e){e.innerHTML=e.outerHTML,e.classList.remove("notice"),e.classList.add("otgs-notice-wrap"),e.childNodes[0].classList.remove("notice","info","success","warning","error","notice-info","notice-success","notice-warning","notice-error")}),this.totalNumberOfNotices=n.length,this.addedNumberOfNotices=0,wp.data.subscribe(function(){return t.createBlockEditorNotices()}),wp.data.subscribe(function(){return t.hideCloseButtonOnAddingNotice()}),this.bindEvents()}return function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(e,[{key:"bindEvents",value:function(){var e=this;document.addEventListener("otgs-notice-dismiss",function(t){e.closeNotice(t)})}},{key:"hideCloseButtonOnAddingNotice",value:function(){var e=this,t=this.getAddedOTGSNotices(),n=t.length;n>this.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=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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 s,c=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){a=!0,s=e},f:function(){try{c||null==n.return||n.return()}finally{if(a)throw s}}}}(e.classList);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(this.NOTICE_CLASS_STATUSES.hasOwnProperty(i))return this.NOTICE_CLASS_STATUSES[i]}}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),i=e.getNoticeHTML(t),o=t.classList.contains("is-dismissible");wp.data.dispatch("core/notices").createNotice(n,i,{speak:!1,__unstableHTML:!0,isDismissible:o})})}}},{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 i(document.querySelectorAll(".components-notice .otgs-notice"))}},{key:"getNotices",value:function(){return i(document.querySelectorAll(".otgs-notice"))}},{key:"getOTGSNotices",value:function(){return i(document.querySelectorAll(".otgs-notice-wrap"))}},{key:"getOldStyledAdminNotices",value:function(){return i(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 c})},function(e,t,n){e.exports=n(0)}]);