!function(){"use strict";var e={};(function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);var t=window.wp.element,n=window.lodash,r=window.nisje.core,a=window.nisje.settings,o=window.nisje.router,i=window.nisje.components;function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=window.nisje.views,s=window.nisje.data,u=window.nisje.icons,d=function(e){var n,r,a=e.match.params.id,o=(n=(0,s.useApiFetch)("/wp/v2/nisje-alert/".concat(a)),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,a,o=[],_n=!0,i=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);_n=!0);}catch(e){i=!0,a=e}finally{try{_n||null==n.return||n.return()}finally{if(i)throw a}}return o}}(n,r)||function(e,t){if(e){if("string"==typeof e)return l(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)?l(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=o[0],m=o[1];return d?m?(0,t.createElement)(c.Message,{icon:u.warning},m.data.status,": ",m.message):(0,t.createElement)(i.EntryContainer,null,(0,t.createElement)(i.EntryHeader,null,d.title.rendered),(0,t.createElement)(i.EntryContent,null,d.content.rendered)):(0,t.createElement)(i.PostLoader,null)},m=(0,a.getOption)("alerts");(0,a.registerPlugin)("alerts",{render:function(){return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(o.PluginRoutes,null,(0,t.createElement)(o.Route,{path:"/alerts/:id",component:d,exact:!0})),!(0,n.isEmpty)(m)&&(0,t.createElement)(r.BeforeFrontpageControls,null,m.map((function(e){return(0,t.createElement)("div",{key:e.id,className:"frontpage-alert is-color-".concat(e.color)},(0,t.createElement)(i.TextDeprecated,{as:"h2",variant:"title-large",mb:1},(0,t.createElement)(o.Link,{to:"/alerts/".concat(e.id,"/")},e.title)),(0,t.createElement)(i.TextDeprecated,{className:"frontpage-alert__excerpt"},e.excerpt))}))))}}),(window.nisje=window.nisje||{}).pluginAlerts=e}();