"use strict";(self.webpackChunk_flanksource_flanksource_ui=self.webpackChunk_flanksource_flanksource_ui||[]).push([[636],{9636:function(t,e,a){a.r(e),a.d(e,{CanaryStatusChart:function(){return M}});var r=a(1413),n=a(885),c=a(4925),i=a(7892),s=a.n(i),o=a(601),l=a(311),u=a(2891),d=a(466),m=a(2839),f=a(5667),x=a(7257),h=a(1048),k=a(2791),g=a(3219),j=a(3964),v=a(184),y=["check"],p=["tickFormatter"],b=["tickFormatter"],S=function(t){return"".concat(t,"ms")},D=function(t){return t.status?"#2cbd27":"#df1a1a"};function M(t){var e=t.check,a=(0,c.Z)(t,y),i=(0,k.useState)([]),p=(0,n.Z)(i,2),b=p[0],M=p[1];if((0,k.useMemo)((function(){(0,g.Hg)({check:e.id,start:"1d",count:300}).then((function(t){M(t.data.status)}))}),[e]),0===b.length)return(0,v.jsx)(j.g,{});var N=0;b.length>0&&(N=(new Date(b[0].time)-new Date(b[b.length-1].time))/1e3/60);var C=function(t){return s()(t).format("HH:mm")};return N>43200?C=function(t){return s()(t).format("MMM DD")}:N>1440&&(C=function(t){return s()(t).format("MMM DD HH:mm")}),(0,v.jsx)(o.h,(0,r.Z)((0,r.Z)({width:"100%",height:"100%"},a),{},{children:(0,v.jsxs)(l.G,{margin:{top:12,right:0,bottom:0,left:-20},data:b,children:[(0,v.jsx)(u.B,{tickSize:0,tick:(0,v.jsx)(F,{tickFormatter:S}),stroke:"rgba(200, 200, 200, 1)",tickMargin:4,tickFormatter:S,fontSize:12,padding:{},dataKey:"duration",name:"Latency"}),(0,v.jsx)(d.K,{tickSize:0,tick:(0,v.jsx)(z,{tickFormatter:C}),stroke:"rgba(200, 200, 200, 1)",tickMargin:4,tickFormatter:C,fontSize:12,reversed:!0,allowDuplicatedCategory:!1,dataKey:"time",name:"Time"}),(0,v.jsx)(m.q,{stroke:"rgba(230, 230, 230, 1)",strokeWidth:1,strokeDasharray:"8 8"}),(0,v.jsx)(f.u,{animationDuration:0,cursor:{stroke:"rgba(0, 0, 0, 0.12)"},content:(0,v.jsx)(w,{})}),(0,v.jsx)(x.b,{name:"Check Statuses",data:b,fill:"rgba(0, 255, 0, 1)",children:b.map((function(t){return(0,v.jsx)(h.b,{fill:D(t)},"cell-".concat(t.time))}))})]})}))}function z(t){var e=t.tickFormatter,a=void 0===e?function(t){return t}:e,r=(0,c.Z)(t,p),n=r.x,i=r.y,s=r.payload,o=r.fontSize,l=void 0===o?12:o;return(0,v.jsx)("g",{transform:"translate(".concat(n,",").concat(i,")"),children:(0,v.jsx)("text",{x:0,y:0,dy:16,textAnchor:"middle",fill:"#666",fontSize:l,children:a(s.value)})})}function F(t){var e=t.tickFormatter,a=void 0===e?function(t){return t}:e,r=(0,c.Z)(t,b),n=r.x,i=r.y,s=r.payload,o=r.fontSize,l=void 0===o?12:o;return(0,v.jsx)("g",{transform:"translate(".concat(n,",").concat(i,")"),children:(0,v.jsx)("text",{x:-36,y:0,dy:3,textAnchor:"start",fill:"#666",fontSize:l,children:a(s.value)})})}var w=function(t){var e=t.active,a=t.payload;return e&&a&&a.length?(0,v.jsxs)("div",{className:"flex flex-col bg-white p-3 border rounded-sm text-xs",children:[(0,v.jsxs)("p",{className:"",children:[(0,v.jsxs)("span",{className:"text-gray-500",children:[a[0].name,": "]}),(0,v.jsx)("span",{className:"ml-1 text-gray-700",children:a[0].value})]}),(0,v.jsxs)("p",{className:"",children:[(0,v.jsxs)("span",{className:"text-gray-500",children:[a[1].name,": "]}),(0,v.jsx)("span",{className:"ml-1 text-gray-700",children:S(a[1].value)})]})]}):null}}}]);
//# sourceMappingURL=636.659a3c99.chunk.js.map