!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,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,r.createElement)(o.Path,{d:"M9 0C4.03 0 0 4.03 0 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zM1.11 9.68h2.51c.04.91.167 1.814.38 2.7H1.84c-.403-.85-.65-1.764-.73-2.7zm8.57-5.4V1.19c.964.366 1.756 1.08 2.22 2 .205.347.386.708.54 1.08l-2.76.01zm3.22 1.35c.232.883.37 1.788.41 2.7H9.68v-2.7h3.22zM8.32 1.19v3.09H5.56c.154-.372.335-.733.54-1.08.462-.924 1.255-1.64 2.22-2.01zm0 4.44v2.7H4.7c.04-.912.178-1.817.41-2.7h3.21zm-4.7 2.69H1.11c.08-.936.327-1.85.73-2.7H4c-.213.886-.34 1.79-.38 2.7zM4.7 9.68h3.62v2.7H5.11c-.232-.883-.37-1.788-.41-2.7zm3.63 4v3.09c-.964-.366-1.756-1.08-2.22-2-.205-.347-.386-.708-.54-1.08l2.76-.01zm1.35 3.09v-3.04h2.76c-.154.372-.335.733-.54 1.08-.464.92-1.256 1.634-2.22 2v-.04zm0-4.44v-2.7h3.62c-.04.912-.178 1.817-.41 2.7H9.68zm4.71-2.7h2.51c-.08.936-.327 1.85-.73 2.7H14c.21-.87.337-1.757.38-2.65l.01-.05zm0-1.35c-.046-.894-.176-1.78-.39-2.65h2.16c.403.85.65 1.764.73 2.7l-2.5-.05zm1-4H13.6c-.324-.91-.793-1.76-1.39-2.52 1.244.56 2.325 1.426 3.14 2.52h.04zm-9.6-2.52c-.597.76-1.066 1.61-1.39 2.52H2.65c.815-1.094 1.896-1.96 3.14-2.52zm-3.15 12H4.4c.324.91.793 1.76 1.39 2.52-1.248-.567-2.33-1.445-3.14-2.55l-.01.03zm9.56 2.52c.597-.76 1.066-1.61 1.39-2.52h1.76c-.82 1.08-1.9 1.933-3.14 2.48l-.01.04z"}));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}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],_n=!0,l=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);_n=!0);}catch(e){l=!0,o=e}finally{try{_n||null==n.return||n.return()}finally{if(l)throw o}}return i}}(e,t)||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}}(e,t)||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.")}()}var a=window.React,s=window.wp.blockEditor,u=window.wp.data,d=window.nisje.components,m=window.nisje.format,w=window.nisje.icons,p=window.nisje.fullSiteEditing,f="dekode-wiki";(0,n.registerBlockType)("nisje/card-wiki",{title:(0,t.__)("Wiki post"),icon:i,edit:function(e){var n=e.attributes,o=e.setAttributes,i=n.postId,l=(0,p.useGridSize)(),v=l.GridSizeToolbar,y=l.sizeClassNames,h=c((0,p.useDarkClassname)(),2),b=h[0],g=h[1],z=c((0,a.useState)(!1),2),S=z[0],E=z[1],k=(0,s.useBlockProps)({style:g,className:(0,m.classnames)("editor-wiki-post",y,b)}),j=(0,s.__experimentalUseColors)([{name:"backgroundColor"}]),C=j.BackgroundColor,H=j.InspectorControlsColorPanel,_=(0,u.useSelect)((function(e){if(0===i)return(0,t.__)("Currently showing latest post");var n=e("core").getEntityRecord("postType",f,i);return(null==n?void 0:n.title.rendered)||"..."}),[i]),T=0!==i;return(0,r.createElement)(r.Fragment,null,v,(0,r.createElement)(p.PostSelectorPanel,{hasSelected:T,onOpen:function(){return E(!0)},onRemove:function(){return o({postId:0})}}),H,(0,r.createElement)(C,null,(0,r.createElement)(d.BaseCard,k,(0,r.createElement)("div",null,(0,r.createElement)(w.Icon,{icon:w.globe,size:40}),(0,r.createElement)(d.TextDeprecated,{as:"h2",variant:"title-medium"},(0,t.__)("Wiki post")),(0,r.createElement)(d.TextDeprecated,{as:"p"},_)))),S&&(0,r.createElement)(p.PostSelector,{onRequestClose:function(){return E(!1)},onSelect:function(e){return o({postId:e})},postType:f}))}}),(window.nisje=window.nisje||{}).pluginWikiAdmin=e}();