!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DeleteModal:function(){return w},Message:function(){return p}});var n=window.wp.element,o=window.lodash,i=window.React,s=window.wp.i18n,l=window.wp.components,c=window.wp.data,r=window.wp.apiFetch,a=e.n(r),u=window.nisje.components,d=window.nisje.router,w=function({button:e,message:t,onRequestClose:r,onSuccess:w=o.noop,redirect:m=!1,restPath:p,successMessage:f,title:j}){const E=(0,d.useHistory)(),[_,h]=(0,i.useState)(!1),[v,y]=(0,i.useState)(!1),{createInfoNotice:g}=(0,c.useDispatch)("nisje/notices");return(0,n.createElement)(l.Modal,{className:"views-delete-modal",closeButtonLabel:(0,s.__)("Cancel","nisje"),onRequestClose:r,title:j||(0,s.__)("Delete post?","nisje")},(0,n.createElement)("p",null,t||(0,s.__)("This will delete the post permanently","nisje")),v&&(0,n.createElement)(u.Notice,{status:"error"},v),(0,n.createElement)("div",{className:"views-delete-modal__actions"},(0,n.createElement)(u.Flex,{justify:"flex-end"},(0,n.createElement)(u.FlexItem,null,(0,n.createElement)(u.ExperimentalButton,{isSecondary:!0,onClick:r},(0,s.__)("Cancel","nisje"))),(0,n.createElement)(u.FlexItem,null,(0,n.createElement)(u.ExperimentalButton,{className:"delete-button",isDestructive:!0,isBusy:_,onClick:function(){h(!0),a()({path:p,method:"DELETE"}).then((()=>{g(f||(0,s.__)("Successfully deleted the post","nisje")),w(),r(),m&&E.replace(m)})).catch((e=>{y(e.message),h(!1)}))}},e||(0,s.__)("Delete","nisje"))))))},m=window.nisje.icons,p=(0,window.nisje.viewport.withViewportMatch)({isHuge:"huge"})((function({isHuge:e,icon:t,children:o}){return(0,n.createElement)("div",{className:"views-message"},(0,n.createElement)("div",null,t&&(0,n.createElement)(m.Icon,{icon:t,size:e?80:60}),(0,n.createElement)("p",null,o)))}));(window.nisje=window.nisje||{}).views=t}();