!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,l=window.wp.i18n,s=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:E}){const _=(0,d.useHistory)(),[h,v]=(0,i.useState)(!1),[y,g]=(0,i.useState)(!1),{createInfoNotice:j}=(0,c.useDispatch)("nisje/notices");return(0,n.createElement)(s.Modal,{className:"views-delete-modal",closeButtonLabel:(0,l.__)("Cancel"),onRequestClose:r,title:E||(0,l.__)("Delete post?")},(0,n.createElement)("p",null,t||(0,l.__)("This will delete the post permanently")),y&&(0,n.createElement)(u.Notice,{status:"error"},y),(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,l.__)("Cancel"))),(0,n.createElement)(u.FlexItem,null,(0,n.createElement)(u.ExperimentalButton,{className:"delete-button",isDestructive:!0,isBusy:h,onClick:function(){v(!0),a()({path:p,method:"DELETE"}).then((()=>{j(f||(0,l.__)("Successfully deleted the post")),w(),r(),m&&_.replace(m)})).catch((e=>{g(e.message),v(!1)}))}},e||(0,l.__)("Delete"))))))},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}();