!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.i18n,n=window.wp.blocks,r=window.wp.element,o=window.wp.primitives,i=(0,r.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(o.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"}));function a(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 l=window.React,c=window.wp.htmlEntities,s=window.wp.blockEditor,u=window.wp.data,d=window.nisje.components,v=window.nisje.icons,w=window.nisje.fullSiteEditing,m="dekode-event";(0,n.registerBlockType)("nisje/card-event",{title:(0,t.__)("Event"),icon:i,edit:function(e){var n,o,i=e.attributes,p=e.setAttributes,f=i.postId,y=(n=(0,l.useState)(!1),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(_n=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==a.return||a.return()}finally{if(r)throw o}}return n}}(n,o)||function(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}(n,o)||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.")}()),h=y[0],b=y[1],E=(0,s.useBlockProps)({className:"editor-event-post"}),S=(0,u.useSelect)((function(e){if(0===f)return(0,t.__)("Currently showing latest event");var n=e("core").getEntityRecord("postType",m,f);return(null==n?void 0:n.title.rendered)||"..."}),[f]),g=0!==f;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(w.PostSelectorPanel,{hasSelected:g,onOpen:function(){return b(!0)},onRemove:function(){return p({postId:0})}}),(0,r.createElement)(d.BaseCard,E,(0,r.createElement)("div",null,(0,r.createElement)(v.Icon,{icon:v.calendar,size:40}),(0,r.createElement)(d.TextDeprecated,{as:"h2",variant:"title-medium"},(0,t.__)("Event")),(0,r.createElement)(d.TextDeprecated,{as:"p"},(0,c.decodeEntities)(S)))),h&&(0,r.createElement)(w.PostSelector,{onRequestClose:function(){return b(!1)},onSelect:function(e){return p({postId:e})},postType:m}))}}),(window.nisje=window.nisje||{}).pluginEventsAdmin=e}();