File: //opt/netdata/usr/local/share/netdata/web/v3/180.c0346e16940bb2d8297d.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c83c851c-50e3-4ac1-9d87-f6927309ca28",e._sentryDebugIdIdentifier="sentry-dbid-c83c851c-50e3-4ac1-9d87-f6927309ca28")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"80efa4e79295d5662a1431f45bf656cf5a858580"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[180],{97799:(e,t,r)=>{r.d(t,{A:()=>ce});var n=r(96540),i=r(33185),o=r(63766),d=r(57068),a=r(15524),s=r(64156),c=r(20871),l=(r(98992),r(54520),r(72577),r(81454),r(8872),r(67012)),g=r(57377),u=r(40961),h=r(43375),p=r(43627),m=r(43305),f=r(71123),x=r(61710),b=r(74979),y=r(45427),I=r(74848);const C=e=>(0,p.uU)({...e,wasDragging:!0}),v=e=>{let{id:t,items:r,containerWidth:n,rowHeight:i,gutter:o,Component:d,isSortingContainer:a,onRemove:s,onItemRemove:c,Item:l,gridTracks:g,transforming:u,containerDndProps:h,itemProps:m,dragOverlay:x,rootId:v,...w}=e;const{active:j,attributes:k,isDragging:S,listeners:T,over:A,setNodeRef:D,transition:E,transform:R}=(0,p.gl)({id:x?`dragOverlay-${t}`:t,disabled:x,data:{rootId:v,isContainer:!0,items:r,containerId:t,dropArea:!0,...h},animateLayoutChanges:C}),P=!!A&&(t===A.id&&"container"!==j?.data.current?.type||r.includes(A.id)),O=(0,f.Hp)(r),_=O*i+(O-1)*o+"px";return(0,I.jsx)(d,{ref:D,style:x?{width:n,height:_}:{transition:E,transform:b.Ks.Translate.toString(R),opacity:S?.5:void 0,width:n,height:_},hover:P,onRemove:s,attributes:k,listeners:T,...w,itemProps:m,id:t,dragOverlay:x,children:r.map(((e,d)=>(0,I.jsx)(y.A,{disabled:a,...e,index:d,containerId:t,Item:l,onRemove:c,draggable:!0,containerWidth:n,rowHeight:i,gridTracks:g,gutter:o,transformed:u?r[d]:null,itemProps:m,containerDragOverlay:x,rootId:v,containerDndProps:h,draggableProps:e},e.id)))})},w=e=>{let{containers:t,Container:r,containerWidth:n,isSortingContainer:i,items:o,Item:d,transforming:a,onContainerRemove:s,onRemove:c,rowHeight:l,gridTracks:g,gutter:u,containerDndProps:h,itemProps:p,rootId:m}=e;return t.map((e=>(0,I.jsx)(v,{id:e,items:o[e],onRemove:()=>s(e),containerWidth:n,rowHeight:l,gridTracks:g,gutter:u,Component:r,Item:d,isSortingContainer:i,transforming:a,onItemRemove:c,containerDndProps:h,itemProps:p,rootId:m},e)))},j={sideEffects(e){let{active:t}=e;t.node.animate([{opacity:0},{opacity:1}],{easing:"ease-in",duration:250})}},k="TRASH_ID",S="PLACEHOLDER_ID",T=e=>{let{id:t}=e;const{setNodeRef:r,isOver:n}=(0,h.zM)({id:t,data:{dropArea:!0,isTrash:!0}});return(0,I.jsx)("div",{ref:r,style:{display:"flex",alignItems:"center",justifyContent:"center",position:"fixed",left:"50%",marginLeft:-150,bottom:20,width:300,height:60,borderRadius:5,border:"1px solid",borderColor:n?"red":"#DDD"},children:"Drop here to delete"})},A=e=>{let{rootId:t,items:r,containers:i,trashable:o=!0,onRemove:d,Item:a,containerWidth:s=800,rowHeight:c=40,gridTracks:b=12,gutter:C=4,allowOverlap:A=!1,compactType:D="vertical",maxRows:E=3e5,Container:R=m.A,onDragEnd:P,containerDndProps:O,itemProps:_,updateOnNewProps:B=!1,rearrangeable:H=!0}=e;const{active:N}=(0,h.fF)(),F=(0,n.useRef)(null),[L,W]=(0,n.useState)((()=>(i||Object.keys(r)).reduce(((e,t)=>(e[t]=(0,f.oE)((0,f.Su)(r[t]),D,b),e)),{})),{}),[$,z]=(0,n.useState)((()=>i||Object.keys(L)));(0,l.A)((()=>{W((i||Object.keys(r)).reduce(((e,t)=>(e[t]=(0,f.oE)((0,f.Su)(r[t]),D,b),e)),{}))}),[b]),(0,l.A)((()=>{B&&((0,g.Ay)(r,L)||(W((i||Object.keys(r)).reduce(((e,t)=>(e[t]=(0,f.oE)((0,f.Su)(r[t]),D,b),e)),{})),z(i)))}),[i,r]);const M=N?.isContainer,[V,G]=(0,n.useState)(null),[U,q]=(0,n.useState)(null),J=(0,n.useRef)(null),Y=e=>e in L?e:null,Z=()=>{V&&W(V),G(null),q(null),J.current=null},K=()=>{const e=Object.keys(L),t=e[e.length-1];return String.fromCharCode(t.charCodeAt(0)+1)},Q=e=>{let{active:t}=e;const{isContainer:r}=t.data.current||{};G(L),r||q(L)};return(0,n.useLayoutEffect)((()=>{if(N)return Q({active:N}),Z}),[]),(0,h.E5)({onDragStart:Q,onDragMove:e=>{let{active:t,over:r,collisions:n}=e;const{isResizer:i,isContainer:o,itemId:d,itemContainerId:a}=t.data.current||{};if(o||!U)return;const{initial:l,translated:g}=t.rect.current;let u=(0,f.Su)(U[a]);const h=!U[a],p=(0,f.GN)(h?U:u,d,h)||(0,f.lc)(t.data.current);if(!p||!p.width)return;const m=r?.id;if(i){if(!m)return;const e=r.rect.width+(g.right-l.right),t=r.rect.height+(g.bottom-l.bottom);let{width:i,height:o}=(0,x.tr)({gutter:C,maxRows:E,gridTracks:b,rowHeight:c,containerWidth:s},e,t,p);if(p.width===i&&p.height===o)return;if(!n)return;return u=u.map((e=>e.id===p.id?{...p,width:i,height:o}:e)),n=n.filter((e=>e.id!==p.id)),u=(0,f.oE)(u,D,b),J.current={...p,itemContainerId:a},void q((e=>({...e,[a]:[...u]})))}if(m===k)return void q(V);if(!H)return;const y=Y(a),I=Y(m)||r&&Y(r.data.current.itemContainerId)||y;if(!I)return;if(I&&I===y||(u=[...U[I],p]),!n)return;const v=n.find((e=>e.id===I));if(!v)return;let{left:w,top:j}=(0,x.zA)({gutter:C,maxRows:E,gridTracks:b,rowHeight:c,containerWidth:s},g.top-v.data.droppableContainer.rect.current.top,g.left-v.data.droppableContainer.rect.current.left,p);if(p.top===j&&p.left===w&&y===I)return;u=(0,f.Pe)(u,p,w,j,!0,!1,D,b,A),u=(0,f.oE)(u,D,b);const S=I!==y;S&&(F.current=t.itemContainerId),J.current={...p,itemContainerId:I},q((e=>({...e,[I]:u.filter((e=>!!e)),...S&&!!e[a]&&{[a]:(0,f.oE)(e[a].filter((e=>e.id!==p.id)),D,b)}})))},onDragEnd:e=>{let{active:t,over:r}=e;if(!U)return;const{isResizer:n,isItem:i}=t.data.current||{},o=r?.id;if(null===o)return void q(null);if(o===k)return W((e=>({...e,[t.containerId]:(0,f.oE)(e[t.containerId].filter((e=>{let{id:r}=e;return r!==t.itemId})),D,b)}))),void q(null);if(i||n)return U&&W(U),q(null),void P(U,J.current,$);t.id in L&&r?.id&&z((e=>{const n=e.indexOf(t.id),i=e.indexOf(r.id),o=(0,p.be)(e,n,i);return P(U,J.current,o),o}));const d=Y(t.id);if(d)if(o!==S)U&&W(U),q(null),P(U,J.current,$);else{const e=K();(0,u.unstable_batchedUpdates)((()=>{z((t=>[...t,e])),W((r=>({...r,[d]:r[d].filter((e=>e!==t.itemId)),[e]:[t.id]})))}))}},onDragCancel:Z}),U||L?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(p.gB,{items:[...$,S],strategy:p._G,children:(0,I.jsx)(w,{rootId:t,containers:$,Container:R,containerWidth:s,isSortingContainer:M,items:U||L,transforming:null!==U,Item:a,onContainerRemove:e=>{z((t=>t.filter((t=>t!==e))))},onRemove:d,rowHeight:c,gridTracks:b,gutter:C,itemProps:_,containerDndProps:O})}),(0,u.createPortal)((0,I.jsx)(h.Hd,{adjustScale:!1,dropAnimation:j,children:N&&N.data.current?.rootId===t?N.data.current.isContainer?(X=N.data.current,(0,I.jsx)(v,{rootId:t,id:X,items:U||L,containerWidth:s,rowHeight:c,gutter:C,Component:R,Item:a,gridTracks:b,containerDndProps:O,itemProps:_,dragOverlay:!0})):N.data.current.isItem?(e=>{const r=(U||L)[e.itemContainerId];if(!r)return null;const n=r.find((t=>t.id===e.itemId));return n?(0,I.jsx)(y.A,{rootId:t,...n,containerId:e.itemContainerId,Item:a,onRemove:d,draggable:!0,containerWidth:s,rowHeight:c,gridTracks:b,gutter:C,dragOverlay:!0,itemProps:_}):null})(N.data.current):null:null}),document.body),o&&N&&(N.isContainer||N.isItem)?(0,I.jsx)(T,{id:k}):null]}):null;var X},D=i.default.div.withConfig({displayName:"gridLayout__Div",componentId:"sc-jna1fu-0"})(["position:relative;"]),E=e=>{let{id:t,onRemove:r,children:n,attributes:i,listeners:a,itemProps:s={},itemProps:{dashboardId:c},style:l,dragOverlay:g,ref:u,...h}=e;(0,d.QZ)(c,t);return(0,I.jsx)(o.Flex,{...h,ref:u,column:!0,flex:!0,round:!0,background:"mainBackground",padding:[3],gap:2,children:(0,I.jsx)(D,{style:l,children:n})})},R=e=>{let{id:t,Component:r,containerWidth:i,onActiveMenuId:l,...g}=e;const[u,h]=(0,d.B1)(t),[p,m]=(0,d.Ix)(t),f=(0,s.A)("(max-width: 767px)"),x=(0,a.A)(),b=(0,n.useRef)(),y=(0,n.useMemo)((()=>(b.current&&b.current.cancel(),b.current=(0,c.A)(),()=>{})),[u,l]);return(0,I.jsx)(o.Flex,{ref:x,column:!0,overflow:{vertical:"auto"},flex:"1","data-testid":"dashboardGrid",height:"100%",onScroll:y,children:(0,I.jsx)(A,{rootId:t,Container:E,onDragEnd:(e,t,r)=>{h(e),m(r)},containers:p,items:u,containerWidth:i-(f?16:26),...g,Item:r,gridTracks:12,itemProps:{dashboardId:t},containerDndProps:{droppable:!0},updateOnNewProps:!0},t)})};var P=r(4844),O=r(6393),_=r(28973),B=r(19371);const H=(0,i.default)(o.Flex).attrs((e=>({height:"100%",background:"mainChartBg",round:!0,...e}))).withConfig({displayName:"container__Card",componentId:"sc-esi601-0"})(["",""],(e=>{let{dragging:t,theme:r}=e;return t&&`\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: ${(0,o.getRgbColor)("primary",.2)({theme:r})};\n z-index: 10;\n backdrop-filter: blur(3px);\n }\n\n `}));var N=r(92726),F=r(93536),L=r(28657);const W={},$=(0,n.memo)((e=>{let{dashboardId:t,id:r,handleProps:i,listeners:o,attributes:d,style:a,dragging:s,dragOverlay:c,isOnTV:g,...u}=e;const h=(0,B.eg)(),{nodesScope:p,contextScope:m,...f}=(0,O.bE)(t,r)||W,x=(0,O.v_)(t,r),b=(0,N.fz)(t,"respectNodesScope"),y=(0,n.useMemo)((()=>{const e=(0,P.My)(h,t);let n=e.getNode({id:c?`dragOverlay-${r}`:r});if(n)return n;const[a]=m||[];return a?(n=h.makeChart({attributes:{...(0,F.L)(a),id:c?`dragOverlay-${r}`:r,cardId:r,dashboardId:t,contextScope:m,...b?{nodesScope:p}:{},...f,toolboxProps:{drag:{...i,...o,...d},isOnTV:g}},makeTrack:P.qh}),e.appendChild(n),n):null}),[t,r]);(0,l.A)((()=>{y&&(y.updateAttributes({height:a.height,width:a.width}),y.trigger("resize"))}),[y,a.height,a.width]),(0,l.A)((()=>{y&&y.updateAttributes({toolboxProps:{drag:{...i,...o,...d,dragging:s},isOnTV:g}})}),[s]),(0,n.useLayoutEffect)((()=>{if(y)return(0,_.unregister)(y.onAttributesChange(["aggregationMethod","groupBy","groupByLabel","postAggregationMethod","postGroupBy","postGroupByLabel","groupingMethod","groupingTime","chartType","chartLibrary","selectedDimensions","selectedLabels","selectedNodes","selectedInstances","sparkline","selectedLegendDimensions","showingInfo","dimensionsSortBy","instancesSortBy","nodesSortBy","groupBySortBy","labelsSortBy","dimensionsSort","nodesExpanded","groupByExpanded","labelsExpanded","expanded","staticZones","title","description","showPostAggregations","selectedNodeLabelsFilter","staticValueRange","enabledYAxis","enabledXAxis","legend","desiredUnits","staticFractionDigits"],((e,t,r)=>{x((t=>({...t,[r]:e})))})))}),[y,x]),(0,l.A)((()=>{y&&y.updateAttributes(f)}),[f]),(0,l.A)((()=>{if(!y||!b)return;y.updateAttribute("nodesScope",p);y.getAttribute("active")&&"chart"===y.type&&y.fetch()}),[b,p]);const{onRemove:C,...v}=u;return y?(0,I.jsx)(H,{"data-testid":`chartCard-${(f.contextScope||[]).join(",")}`,height:a.height,width:"100%",...v,dragging:s,children:(0,I.jsx)(L.A,{chart:y,"data-chartid":c?`dragOverlay-${r}`:r,"data-track":y.track("container"),height:a.height,width:"100%"})}):null})),z=$;var M=r(99728),V=r(64981),G=r(5907);const U="text",q="customDashboard",J=e=>{let{dashboardId:t,id:r,onClick:n}=e;const i=(0,O.bE)(t,r,"editing"),o=(0,O.v_)(t,r,"editing");return(0,I.jsx)(V.t,{icon:"pencilSolid",onClick:()=>{n(),o(!0)},"data-ga":`${U}-reset::${q}`,"data-testid":"textCard-edit",disabled:i,children:"Edit"})},Y=e=>{let{dashboardId:t,id:r}=e;const n=(0,G.c6)(t,r);return(0,I.jsx)(V.t,{icon:"trashcan",onClick:n,"data-ga":`${U}-reset::${q}`,"data-testid":"textCard-remove",children:"Remove"})},Z=e=>{let{dashboardId:t,id:r,children:n,...i}=e;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(V.A,{category:U,context:q,testId:"chartTextDropdown",...i,children:e=>{let{close:n}=e;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(J,{dashboardId:t,id:r,onClick:n}),(0,I.jsx)(Y,{dashboardId:t,id:r})]})}}),n]})},K=(0,i.default)(o.Flex).attrs({as:"form",column:!0,flex:!0,gap:2,height:"100%",padding:[0,0,2],onMouseDown:e=>e.stopPropagation()}).withConfig({displayName:"form__CardContent",componentId:"sc-3tcqxu-0"})(["cursor:auto;"]),Q=(0,i.default)(o.Box).attrs((e=>({as:"textarea",background:"inputBg",height:"100%",round:!0,border:!0,padding:[2],...e}))).withConfig({displayName:"form__Textarea",componentId:"sc-3tcqxu-1"})(["resize:none;font-size:12px;color:",";"],(0,o.getColor)("text")),X=(0,n.memo)((e=>{let{dashboardId:t,id:r}=e;const i=(0,O.bE)(t,r,"text"),d=(0,O.v_)(t,r,"editing"),a=(0,O.v_)(t,r,"text"),[s,c]=(0,n.useState)(i);return(0,I.jsxs)(K,{"data-testid":"textCardForm",children:[(0,I.jsx)(Q,{placeholder:"Add some text",value:s.replace(/<\/?[^>]+(>|$)/g,""),onChange:e=>c(e.target.value)}),(0,I.jsxs)(o.Flex,{position:"absolute",right:"24px",bottom:0,gap:1,children:[(0,I.jsx)(o.IconButton,{icon:"check",small:!0,padding:[0],onClick:()=>{a(s),d(!1)},"data-testid":"textCardForm-cancel",neutral:!1,flavour:"default"}),(0,I.jsx)(o.IconButton,{icon:"x",small:!0,padding:[0],onClick:()=>d(!1),"data-testid":"textCardForm-done",flavour:"default"})]})]})})),ee={h1:o.H2,h2:o.H4,text:o.Text,micro:o.TextNano},te=e=>{let{dashboardId:t,id:r}=e;const n=(0,O.bE)(t,r,"text")||"",i=(0,O.bE)(t,r,"textType"),d=ee[i]||ee.text;return(0,I.jsx)(o.Box,{"data-testid":"textCardContent",children:(0,I.jsx)(d,{whiteSpace:"pre-wrap",children:n.replace(/<\/?[^>]+(>|$)/g,"")})})},re=(0,i.default)(o.Flex).attrs({column:!0}).withConfig({displayName:"text__StyledOptions",componentId:"sc-1f67m9f-0"})([""]),ne=(0,n.forwardRef)(((e,t)=>{let{dragging:r,...n}=e;const i=(0,M.JT)("dashboard:Update");return(0,I.jsx)(o.IconButton,{ref:t,position:"absolute",top:0,right:0,padding:[0],width:"12px",height:"12px",icon:"rearrange",title:"Drag & drop","data-testid":"text-drag",disabled:!i,cursor:r?"grabbing":"grab",...n})})),ie=["h1","h2","text","micro"],oe=e=>{let{id:t,dashboardId:r}=e;const n=(0,M.JT)("dashboard:Update"),i=(0,O.bE)(r,t,"textType")||"text",d=(0,O.v_)(r,t,"textType");return(0,I.jsx)(o.IconButton,{padding:[0],width:"12px",height:"12px",icon:"text_add",title:"Change text component","data-testid":"text-component",disabled:!n,onClick:()=>{const e=ie.findIndex((e=>e===i)),t=ie[e>ie.length-2?0:e+1];d(t)}})},de=(0,i.default)(H).withConfig({displayName:"text__StyledCard",componentId:"sc-1f67m9f-1"})(["","{opacity:0;}&:hover{border:1px solid ",";}&:hover ","{opacity:1;}"],re,(0,o.getColor)("border"),re),ae={chart:z,text:(0,n.memo)((e=>{let{dashboardId:t,id:r,listeners:n,handleProps:i,dragging:o,isOnTV:d}=e;const a=(0,O.bE)(t,r,"editing");return(0,I.jsxs)(de,{"data-testid":"textCard",alignItems:"start",overflow:"hidden",dragging:o,children:[!d&&(0,I.jsxs)(re,{children:[(0,I.jsx)(Z,{dashboardId:t,id:r}),(0,I.jsx)(oe,{dashboardId:t,id:r})]}),a&&!d&&(0,I.jsx)(X,{dashboardId:t,id:r}),!a&&(0,I.jsx)(te,{dashboardId:t,id:r}),!d&&(0,I.jsx)(ne,{...n,...i,dragging:o})]})})),placeholder:(0,n.memo)((()=>(0,I.jsx)(H,{column:!0,"data-testid":"placeholderCard",background:"secondaryHighlight",width:"100%"})))},se=e=>{let{dashboardId:t,id:r,attributes:n,style:i,resizeHandle:o,ref:d,isOnTV:a,...s}=e;const c=(0,O.bE)(t,r,"type")||"placeholder",l=ae[c]||ae.chart;return(0,I.jsxs)("div",{ref:d,...n,style:i,children:[(0,I.jsx)(l,{dashboardId:t,id:r,style:i,isOnTV:a,...s}),!a&&o]})},ce=(0,n.memo)((e=>{let{id:t,...r}=e;return(0,P.Ay)(t),(0,I.jsx)(R,{id:t,Component:se,...r})}))}}]);