"use strict";var L=Object.create;var n=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var O=Object.getPrototypeOf;var P=Object.prototype.hasOwnProperty;var b=(t,s)=>n(t,"name",{value:s,configurable:true});var E=(t,s)=>{for(var i in s)n(t,i,{get:s[i],enumerable:true})};var N=(t,s,i,a)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let r of q(s))if(!P.call(t,r)&&r!==i)n(t,r,{get:()=>s[r],enumerable:!(a=M(s,r))||a.enumerable})}return t};var c=(t,s,i)=>(i=t!=null?L(O(t)):{},N(s||!t||!t.__esModule?n(i,"default",{value:t,enumerable:true}):i,t));var j=t=>N(n({},"__esModule",{value:true}),t);var I=(t,s,i,a)=>{var r=a>1?void 0:a?M(s,i):s;for(var m=t.length-1,g;m>=0;m--)if(g=t[m])r=(a?g(s,i,r):g(r))||r;if(a&&r)n(s,i,r);return r};var H={};E(H,{default:()=>B});module.exports=j(H);var e=require("react/jsx-runtime");var F=require("mobx-react");var R=require("react");var u=require("react-intl");var S=require("react-router-dom");var _=c(require("../../ui/FAB"));var f=c(require("../../ui/Infobox"));var k=c(require("../../ui/SearchInput"));var h=c(require("../../ui/effects/Appear"));var T=require("../../ui/headline");var x=c(require("../../ui/loader"));var A=c(require("./ServiceItem"));const d=(0,u.defineMessages)({headline:{id:"settings.services.headline",defaultMessage:"Your services"},searchService:{id:"settings.searchService",defaultMessage:"Search service"},noServicesAdded:{id:"settings.services.noServicesAdded",defaultMessage:"Start by adding a service."},noServiceFound:{id:"settings.services.nothingFound",defaultMessage:"Sorry, but no service matched your search term."},discoverServices:{id:"settings.services.discoverServices",defaultMessage:"Discover services"},servicesRequestFailed:{id:"settings.services.servicesRequestFailed",defaultMessage:"Could not load your services"},tryReloadServices:{id:"settings.account.tryReloadServices",defaultMessage:"Try again"},updatedInfo:{id:"settings.services.updatedInfo",defaultMessage:"Your changes have been saved"},deletedInfo:{id:"settings.services.deletedInfo",defaultMessage:"Service has been deleted"}});let l=class extends R.Component{render(){const{services:s,isLoading:i,filterServices:a,resetFilter:r,goTo:m,servicesRequestFailed:g,retryServicesRequest:C,status:p,searchNeedle:y="",intl:o}=this.props;return(0,e.jsxs)("div",{className:"settings__main",children:[(0,e.jsx)("div",{className:"settings__header",children:(0,e.jsx)(T.H1,{children:o.formatMessage(d.headline)})}),(0,e.jsxs)("div",{className:"settings__body",children:[(s.length>0||y)&&!i&&(0,e.jsx)(k.default,{placeholder:o.formatMessage(d.searchService),onChange:v=>a({needle:v}),onReset:()=>r(),autoFocus:true}),!i&&g&&(0,e.jsx)(f.default,{icon:"alert",type:"danger",ctaLabel:o.formatMessage(d.tryReloadServices),ctaLoading:i,ctaOnClick:C,children:o.formatMessage(d.servicesRequestFailed)}),p.length>0&&p.includes("updated")&&(0,e.jsx)(h.default,{children:(0,e.jsx)(f.default,{type:"success",icon:"checkbox-marked-circle-outline",dismissible:true,children:o.formatMessage(d.updatedInfo)})}),p.length>0&&p.includes("service-deleted")&&(0,e.jsx)(h.default,{children:(0,e.jsx)(f.default,{type:"success",icon:"checkbox-marked-circle-outline",dismissible:true,children:o.formatMessage(d.deletedInfo)})}),!i&&s.length===0&&!y&&(0,e.jsxs)("div",{className:"align-middle settings__empty-state",children:[(0,e.jsxs)("p",{className:"settings__empty-text",children:[(0,e.jsx)("span",{className:"emoji",children:(0,e.jsx)("img",{src:"./assets/images/emoji/star.png",alt:""})}),o.formatMessage(d.noServicesAdded)]}),(0,e.jsx)(S.Link,{to:"/settings/recipes",className:"button",children:o.formatMessage(d.discoverServices)})]}),!i&&s.length===0&&y&&(0,e.jsx)("div",{className:"align-middle settings__empty-state",children:(0,e.jsxs)("p",{className:"settings__empty-text",children:[(0,e.jsx)("span",{className:"emoji",children:(0,e.jsx)("img",{src:"./assets/images/emoji/dontknow.png",alt:""})}),o.formatMessage(d.noServiceFound)]})}),i?(0,e.jsx)(x.default,{}):(0,e.jsx)("table",{className:"service-table",role:"grid",children:(0,e.jsx)("tbody",{children:s.map(v=>(0,e.jsx)(A.default,{service:v,goToServiceForm:()=>m(`/settings/services/edit/${v.id}`)},v.id))})}),(0,e.jsx)(_.default,{className:"FAB-class",children:(0,e.jsx)(S.Link,{to:"/settings/recipes",children:"+"})})]})]})}};b(l,"ServicesDashboard");l=I([F.observer],l);var B=(0,u.injectIntl)(l);
