File: //opt/netdata/usr/local/share/netdata/web/v3/6003.257010f19e5b84883157.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]="fb7ec361-1c51-4963-ab3a-9cfc1fb771ab",e._sentryDebugIdIdentifier="sentry-dbid-fb7ec361-1c51-4963-ab3a-9cfc1fb771ab")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"5ded98bed5f4589e490b1beae30dccf288de26e3"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[6003],{4719:(e,t,n)=>{n.d(t,{BV:()=>d,Dv:()=>g,Qb:()=>m,aV:()=>h,b:()=>u,tu:()=>l,yy:()=>c});var o=n(83488),r=n.n(o),i=n(66814),s=n(27250),a=n(74848);const l=(0,i.q6)({}),d=e=>{let{menuById:t,children:n}=e;return(0,a.jsx)(l.Provider,{value:t,children:n})},c=e=>(0,s.A)(l,e),u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r();return c((n=>t(n?.[e]||{})))},h=(e,t)=>n=>{let{id:o,...r}=n;const i=u(o,t);return(0,a.jsx)(e,{_id:o,...i,...r})},f=(0,i.q6)([]),g=e=>{let{ids:t,children:n}=e;return(0,a.jsx)(f.Provider,{value:t,children:n})},m=e=>t=>{const n=(0,s.A)(f,o);var o;return(0,a.jsx)(e,{menuIds:n,...t})}},14512:(e,t,n)=>{n.d(t,{A:()=>w,g:()=>p});var o=n(96540),r=n(33185),i=n(92415),s=n(45087),a=n(24013),l=n(87083),d=n(19186),c=n(24609),u=n(24200),h=n(64463),f=n(74891),g=n(3319),m=n(74848);const y=(0,r.default)(i.IconComponents.LoaderIcon).withConfig({displayName:"anomalyRates__StyledLoaderIcon",componentId:"sc-1b01y04-0"})(["flex:0 0 auto;height:16px;width:16px;"]),b=(0,f.A)(i.Flex),v=()=>(0,m.jsxs)(b,{height:"20px",alignItems:"center",gap:1,tooltip:"Loading weights. This might take some time.",children:[(0,m.jsx)(y,{}),(0,m.jsx)(i.TextSmall,{children:"Loading..."})]}),x=(0,f.A)(i.Button),p=()=>{const e=(0,a.nl)(),t=(0,l.w7)();return e?[e]:t},w=()=>{const[e,t]=(0,o.useState)(),n=(0,c.vt)(),r=(0,d.ID)(),a=p(),{pause:l}=(0,h.A)(),{sendLog:f}=(0,g.A)(),[y,b,,w]=(0,u.f_)(n,r,a),A=(0,o.useCallback)((()=>{l(),y(),f({feature:"AnomalyRates-TOC",label:"Anomaly%",isStart:!0},!0)}),[l,y,f]),I=(0,o.useCallback)((e=>{let{target:n}=e;const o=n.checked;t(o),o?A():w()}),[t,A,w]);return(0,m.jsx)(i.Flex,{alignItems:"center",justifyContent:"between",width:"100%",margin:[2,0,0,0],padding:[2,0,0,0],children:b?(0,m.jsx)(v,{}):(0,m.jsxs)(i.Flex,{alignItems:"center",justifyContent:"between",width:"100%",children:[(0,m.jsx)(s.A,{content:"Overlay the maximum chart anomaly rate on each menu section.",align:"bottom",activateOn:"hover",isBasic:!0,children:(0,m.jsx)(i.Box,{children:(0,m.jsx)(i.Toggle,{colored:!0,disabled:b,checked:e,labelRight:"Anomaly Rate %",onChange:I,toggleProps:{uncheckedColor:["neutral","grey130"],checkedColor:"primary"}})})}),e?(0,m.jsx)(x,{flavour:"borderless",icon:"refresh",iconColor:"text",onClick:A,tooltip:"Refresh weights"}):null]})})}},24200:(e,t,n)=>{n.d(t,{Ay:()=>f,yD:()=>u,f_:()=>h});n(98992),n(54520),n(81454);var o=n(96540),r=n(42790),i=n(77611);const s=function(e){let{after:t,before:n}=e,{offset:o,limit:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{offset:6e4,limit:Date.now()};const i=((e,t)=>{let{offset:n,limit:o}=t;const r=n/2;return e+r<=o?r:o<e?0:o-e})(n,{offset:o,limit:r});return[t-(o-i),n+i]};var a=n(3319),l=n(81691);const d=(e,t)=>e||t?s({after:parseInt(e),before:parseInt(t)},(e=>{const t=Date.now();return{limit:t,offset:t-e<6e4?3e4:15e3}})(t)):c,c=[null,null],u=()=>{const{after:e,before:t,highlight:n}=(0,r.rW)();if(!n.after||!n.before)return c;if(e<0){const t=Date.now();if(n.before<t+e)return c;if(n.after>t)return c}else{if(n.before<e)return c;if(n.after>t)return c}return[n.after,n.before]},h=(e,t,n)=>{const[s,c]=(0,o.useState)(),[h,f]=(0,o.useState)(!1),{sendLog:g}=(0,a.A)();let[m,y]=(()=>{const e=u();return(0,o.useMemo)((()=>d(...e)),[...e])})();const{after:b,before:v}=(0,r.rW)(),[x,p]=(0,i.er)({nodeIds:n,flavour:"rhs"},e,t);return[async()=>{const e=((e,t)=>{if(e<0){const n=Date.now();e=1e3*Math.floor(n/1e3+e),t=1e3*Math.floor(n/1e3)}return{after:e,before:t}})(b,v);f(!0);try{await x({flavour:"rhs",highlightAfter:m||e.after,highlightBefore:y||e.before,baselineAfter:m?e.after:null,baselineBefore:y?e.before:null,method:"anomaly-rate",aggregation:"avg",group:"average",nodeIds:n,options:["raw","null2zero"],groupBy:["context"]}),f(!1),g({action:l.o1.elementViewed,feature:"AnomalyRates-TOC",isSuccess:!0},!0)}catch(t){if(t.isCancel)return;c(t),f(!1),g({action:l.o1.elementViewed,feature:"AnomalyRates-TOC",isFailure:!0},!0)}},h,s,p]},f=(e,t,n)=>{const[s,l]=(()=>{const[e,t]=(0,o.useState)(0);return[e,(0,o.useCallback)((()=>t((e=>e+1))),[])]})(),[d,c]=(0,o.useState)(),[h,f]=u(),{after:g,before:m}=(0,r.rW)(),{contexts:y,metadata:b,getWeights:v,loading:x}=(0,i.Yy)({nodeIds:n,flavour:"anomaly"},e,t),{sendLog:p,isReady:w}=(0,a.A)();(0,o.useEffect)((()=>{if(h&&f&&f&&h)try{p({feature:"AnomalyAdvisor",isStart:!0}),v({highlightAfter:h,highlightBefore:f,baselineAfter:g,baselineBefore:m,method:"anomaly-rate",aggregation:"avg",group:"average",nodeIds:n,options:["null2zero","raw"],groupBy:["dimension","instance","context"]})}catch(e){if(p({feature:"AnomalyAdvisor",isFailure:!0}),e.isCancel)return;c(e)}}),[n.length,f,h,s,w]);return[(0,o.useMemo)((()=>y.filter((e=>(b[e]?.weight||0)>0)).sort(((e,t)=>{const n=b[e].weight||0,o=b[t].weight||0;return n!==o?n>o?-1:1:0})).map((e=>{const t=e.split(",");return t.length>1?`${t[2]}::${t[1]}::${t[0]}`:e}))),[y,b]),y,b,x,d,l]}},27250:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(96540),r=n(83488),i=n.n(r),s=n(2404),a=n.n(s),l=n(66814);const d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i();const n=(0,o.useRef)();return(0,l.i7)(e,(e=>{const o=t(e);return a()(n.current,o)||(n.current=o),n.current}))}},33962:(e,t,n)=>{n.d(t,{Js:()=>h,Ny:()=>d,Ud:()=>c,W2:()=>u});var o=n(96540),r=n(66814),i=n(27250),s=n(74848);const a=(0,r.q6)(""),l=(0,r.q6)(""),d=e=>{let{menuId:t="",children:n}=e;const[r,i]=(0,o.useState)(t);return(0,s.jsx)(a.Provider,{value:i,children:(0,s.jsx)(l.Provider,{value:r,children:n})})},c=()=>(0,i.A)(a),u=e=>(0,i.A)(l,e),h=e=>u((t=>e===t))},50239:(e,t,n)=>{n.d(t,{Cs:()=>a,Gr:()=>d,UH:()=>l});var o=n(96540),r=n(74848);const i=(0,o.createContext)(),s=(0,o.createContext)(),a=e=>{let{children:t}=e;const[n,a]=(0,o.useState)();return(0,r.jsx)(i.Provider,{value:n,children:(0,r.jsx)(s.Provider,{value:a,children:t})})},l=()=>(0,o.useContext)(i),d=()=>(0,o.useContext)(s)},53749:(e,t,n)=>{n.d(t,{Zr:()=>h,b0:()=>I,YP:()=>A,Uo:()=>p,Bu:()=>B,yO:()=>j,bD:()=>D,OL:()=>v,aZ:()=>x,rx:()=>m,bo:()=>g,_0:()=>f,R7:()=>C,jI:()=>y,w1:()=>k,DQ:()=>b});n(98992),n(8872),n(37550),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215);var o=n(96540),r=n(52035),i=n(34843),s=n(84929),a=n(30569);const l={loaded:!1,fullyLoaded:!1,loading:!1,id:"",name:"",chartType:"",context:"",family:"",firstEntry:0,lastEntry:0,module:"",plugin:"",priority:0,updateEvery:0,visible:!1,filteredOut:!1,hidden:!1,domain:"room"};var d=n(19186),c=n(57377);const u={ids:(0,s.Iz)((()=>(0,r.eU)([]))),updatedAt:(0,s.Iz)((()=>(0,r.eU)(""))),loaded:(0,s.Iz)((()=>(0,r.eU)(!1))),error:(0,s.Iz)((()=>(0,r.eU)(null))),versions:(0,s.Iz)((()=>(0,r.eU)({}))),fetchedFor:(0,s.Iz)((()=>(0,r.eU)([])))},h=(0,s.Iz)((e=>{let{id:t,key:n}=e;return(0,r.eU)((e=>e(u[n](t))),((e,o,r)=>o(u[n](t),r)))}),c.Ay),f=e=>!!(0,i.md)(h({id:e,key:"loaded"})),g=e=>(0,i.md)(h({id:e,key:"fetchedFor"})),m=e=>(0,i.md)(h({id:e,key:"error"})),y=e=>(0,i.md)(h({id:e,key:"versions"})),b=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,i.Xr)(h({id:e,key:"versions"}));return(0,o.useCallback)((e=>n((n=>(e="function"===typeof e?e(n):e,t?e:(0,c.Ay)(n,e,{omit:["contextsSoftHash"]})?n:n.contextsHardHash&&"invalidating"!==n.contextsHardHash?e:n)))),[])},v=e=>(0,i.md)(h({id:e,key:"ids"})),x=(e,t)=>(0,i.md)(h({id:e,key:t})),p=(0,s.Iz)((e=>{let{roomId:t,merge:n=!0}=e;return(0,r.eU)((e=>e(u.ids(t))),((e,o,r)=>{o(u.ids(t),(e=>{const t=n?[...new Set([...r(e),...e])]:r(e);return n&&(0,c.Ay)(t,e)?e:t}))}))}),c.Ay),w=(0,s.Iz)((()=>(0,r.eU)({}))),A=(0,s.Iz)((e=>{let{id:t,key:n}=e;return(0,r.eU)((e=>{const o=e(w(t))||l;return n?o[n]:o}),((e,o,r)=>{"function"!==typeof r?Object.keys(r).length<1||o(w(t),(e=>({...e,[n]:r}))):o(w(t),(e=>({...e,[n]:r(e[n])})))}))}),((e,t)=>e.key===t.key&&e.id===t.id)),I=(0,s.Iz)((function(){let{id:e,merge:t=!0,nodeIds:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.eU)(null,((o,r,i)=>{let{values:s,merge:a}=i;r(h({id:e,key:"fetchedFor"}),n),r(w(e),(e=>{const n=Object.keys(s).reduce(((n,o)=>{const{id:r}=s[o];return n[r]={...l,...(t||a)&&e[r],...s[o],loaded:!0},n}),t?{...e}:{});return t&&(0,c.Ay)(n,e,{omit:["lastEntry","firstEntry","family"]})?e:n}))}))}),c.Ay),C=(e,t)=>(0,i.md)(A({id:e,key:t})),k=e=>(0,a.yF)((0,o.useCallback)(((t,n,o)=>{n(w(e),o)}),[e])),j=(e,t)=>(0,a.yF)((0,o.useCallback)(((n,o,r)=>({...n(w(e))[r],...t?.[r]||{}})),[e,t])),B=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=(0,d.ID)(),n=(0,i.md)(w(t));return e.some((e=>n[e]?.visible&&!n[e]?.filteredOut&&!n[e]?.hidden))},D=()=>{const e=(0,d.ID)(),t=(0,i.md)(w(e));return(0,o.useCallback)((function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>t[e]?.visible&&!t[e]?.filteredOut&&!t[e]?.hidden))}),[e,t])},O=(0,s.Iz)((()=>(0,r.eU)({}))),U=(0,s.Iz)((e=>{let{id:t,context:n}=e;return(0,r.eU)((e=>{const o=e(O(t));return n?o[n]:o}),((e,o,r)=>{"function"!==typeof r?Object.keys(r).length<1||o(O(t),(e=>({...e,[n]:r}))):o(O(t),(e=>({...e,[n]:r(e[n])})))}))}),c.Ay);(0,s.Iz)((e=>(0,r.eU)(null,((t,n,o)=>{n(O(e),(e=>({...e,...o})))})))),(0,s.Iz)((e=>{let{id:t,contexts:n=[]}=e;return(0,r.eU)((e=>{const o=e(U({id:t}));return n.reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{})}))}),c.Ay)},61710:(e,t,n)=>{n.d(t,{Oq:()=>l,sd:()=>i,tr:()=>c,zA:()=>d});var o=n(78659),r=n.n(o);const i=e=>Math.round(10*e)/10,s=e=>{const{gutter:t,containerWidth:n,gridTracks:o}=e;return(n-t*(o-1))/o};function a(e,t,n){return Number.isFinite(e)?i(t*e+Math.max(0,e-1)*n):e}function l(e,t,n,o,r,l){const{gutter:d,rowHeight:c}=e,u=s(e),h={};return l?(h.width=a(l.width,u,d),h.height=a(l.height,c,d),h.top=i((c+d)*l.top),h.left=i((u+d)*l.left)):(h.width=a(o,u,d),h.height=a(r,c,d),h.top=i((c+d)*n),h.left=i((u+d)*t)),h}function d(e,t,n,o){const{gutter:a,gridTracks:l,rowHeight:d,maxRows:c}=e,u=s(e);let h=i((n-a)/(u+a)),f=i((t-a)/(d+a));return h=r()(h,0,l-o.width),f=r()(f,0,c-o.height),{left:h,top:f}}const c=(e,t,n,o)=>{const{gutter:a,maxRows:l,gridTracks:d,rowHeight:c}=e,u=s(e);let h=i((t+a)/(u+a)),f=i((n+a)/(c+a));return h=r()(r()(h,o.minWidth||3,d-o.left),0,d),f=r()(r()(f,o.minHeight||2,l-o.top),0,l),{width:h,height:f}}},69457:(e,t,n)=>{n.d(t,{BK:()=>A,NF:()=>v,Tg:()=>p,Vt:()=>I,aA:()=>y,dd:()=>b,i8:()=>u,qR:()=>x,uy:()=>w,vN:()=>g});n(98992),n(81454);var o=n(96540),r=n(83488),i=n.n(r),s=n(66814),a=n(27250),l=n(74848);const d=o.createContext({}),c=(0,s.q6)({}),u=(0,s.q6)({}),h=(0,s.q6)([]),f=(0,s.q6)({}),g=e=>{let{container:t,menuItemAttributesById:n,getObject:r,allElements:i,stickyIds:s,children:a}=e;return(0,l.jsx)(d.Provider,{value:t,children:(0,l.jsx)(c.Provider,{value:(0,o.useCallback)((e=>({...r(e),...n[e]})),[n,r]),children:(0,l.jsx)(u.Provider,{value:n,children:(0,l.jsx)(h.Provider,{value:i,children:(0,l.jsx)(f.Provider,{value:s,children:a})})})})})},m={},y=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i();return(0,a.A)(u,(n=>t(n[e]||m)))},b=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i();return(0,a.A)(u,(n=>Array.isArray(e)?e.map(((e,o)=>t(n[e]||m,e,o))):[]))},v=()=>o.useContext(d),x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();return(0,a.A)(h,e)},p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();return(0,a.A)(f,e)},w=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:i())(I()(e))},A=e=>t=>{let{id:n,...o}=t;const r=y(n),{chartId:i,contextScope:s}=r,a=w(i||n||s?.[0]);return(0,l.jsx)(e,{id:n,chart:a,menuChartAttributes:r,...o})},I=()=>(0,a.A)(c)},74518:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(96540),r=n(92415),i=n(41395),s=n(45087),a=n(74848);const l=e=>{let{text:t,TextComponent:n=r.Text,ellipsisEnd:l,...d}=e;const[c,u]=(0,o.useState)(""),[h,f]=(0,o.useState)(),g=l?i.RR:i.P3;return(0,o.useEffect)((()=>{if(!h)return;const e=h.offsetWidth;let n=0;for(;h.scrollWidth>e;)h.textContent=g(h.textContent,n),n+=1;h.textContent!==t&&u(t)}),[t,h]),(0,a.jsx)(s.A,{content:c?t:"",align:"bottom",isBasic:!0,children:(0,a.jsx)(n,{truncate:!0,ref:f,...d,children:t})})}},77611:(e,t,n)=>{n.d(t,{UG:()=>I,Ip:()=>A,er:()=>p,Yy:()=>C,G9:()=>w});n(98992),n(3949),n(8872);var o=n(96540),r=n(34843),i=n(30569),s=n(84929),a=n(42790),l=n(16015),d=n(57377);const c={byContext:{},loaded:!1,loading:!1,method:null,options:null,group:"average",totalDimensionsCount:0},u=(0,s.Iz)((()=>(0,s.tx)(c)),d.Ay),h={ci:"context",ni:"node",ii:"instance",di:"dimension"},f=(e,t)=>n=>({[h[e.name]]:t[e.dictionary][n]}),g={ni:f,ii:(e,t)=>(n,o,r)=>({[h[e.name]]:t[e.dictionary][n]?`${t[e.dictionary][n]}@${t.nodes[o[r.ni]]}`:null}),ci:f,di:f,row_type:e=>t=>({type:e.value[t]}),weight:()=>e=>({weight:e}),timeframe:e=>t=>({highlight:e.labels.reduce(((e,n,o)=>({...e,[n]:t[o]})),{})}),"baseline timeframe":e=>t=>({baseline:e.labels.reduce(((e,n,o)=>({...e,[n]:t[o]})),{})})},m={contexts:"ci",nodes:"ni",instances:"ii",dimensions:"di"},y={contexts:"id",nodes:"nodeId",instances:"id",dimensions:"id"},b=(e,t)=>null===e||e>t?t:e,v=(e,t)=>null===e||e<t?t:e,x=e=>{let{data:t,aggregation:n,options:o}=e,r={},i=0;if(t.v_schema){const e=t.v_schema?.items||[];r=t.result.reduce(((t,o)=>{let{id:r,v:i}=o;return t[r]=e.reduce(((e,t,o)=>{let{name:r,labels:s}=t;const a=s.indexOf(n);return e[r]=i[o][a],e}),{}),t}),{})}else{const e=(e=>{const t=Object.keys(e.dictionaries).reduce(((t,n)=>{t[n]||(t[n]={});const o=y[n];return e.dictionaries[n].forEach((e=>t[n][e[m[n]]]="nodeId"===o?e.nd||e.mg:e[o])),t}),{}),n={},o=e.schema.items.reduce(((e,o,r)=>{const i=(g[o.name]||g.default)(o,t);return e.push(i),n[o.name]=r,e}),[]);return e=>e.reduce(((t,r,i)=>({...t,...o[i](r,e,n)})),{})})(t);r=t.result.reduce(((t,n)=>{const{dimension:r,node:s,context:a,instance:l,type:d,weight:c,highlight:u,baseline:h}=e(n);if("node"===d)return t;const f=(g=t,m=a,function(e,t,n,o,r){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:b;n&&(n&&"undefined"===typeof g[m][t][n]&&(g[m][t][n]={}),"undefined"===typeof g[m][t][n][e]&&(g[m][t][n][e]=null),o&&(g[m][t][n][e]=i(g[m][t][n][e],r)))});var g,m;t[a]||(t[a]={dimensions:{},instances:{},nodes:{},weight:null});const y=!!o&&o.includes("anomaly-bit");f("weight","dimensions",r,"dimension"===d,c,y?v:b),f("weight","instances",l,"instance"===d,c,y?v:b),f("weight","nodes",s,"node"===d,c,y?v:b);const x=u?100*u.anomaly_count/u.count:0;f("arHighlight","dimensions",r,"dimension"===d,x,v),f("arHighlight","instances",l,"instance"===d,x,v),f("arHighlight","nodes",s,"node"===d,x,v);const p=h?100*(h.anomaly_count-u.anomaly_count)/(h.count-u.count)===0?1:h.count-u.count:0;f("arBaseline","dimensions",r,"dimension"===d,p,v),f("arBaseline","instances",l,"instance"===d,p,v),f("arBaseline","nodes",s,"node"===d,p,v);const w=p?x/p:0;return f("score","dimensions",r,"dimension"===d,w,v),f("score","instances",l,"instance"===d,w,v),f("score","nodes",s,"node"===d,w,v),"context"===d?t[a].weight=null===t[a].weight||t[a].weight>c?c:t[a].weight:"dimension"===d&&(i+=1),t}),{})}return{byContext:r,totalDimensionsCount:i}},p=(e,t,n)=>{const r=(0,o.useRef)();return[(0,i.yF)((0,o.useCallback)(((o,i,s)=>{let{flavour:a,highlightAfter:d,highlightBefore:h,baselineAfter:f,baselineBefore:g,method:m,options:y,group:b,context:v,nodeIds:p,aggregation:w,groupBy:A}=s;return i(u(e),{...c,loading:!0}),r.current&&r.current.cancel(),r.current=(0,l.e0)(t,n,{highlightAfter:d,highlightBefore:h,baselineAfter:f,baselineBefore:g,method:m,options:y,group:b,context:v,nodeIds:p,aggregation:w,groupBy:A}),r.current.then((t=>{let{data:n}=t;const{byContext:o,totalDimensionsCount:r}=x({flavour:a,data:n,aggregation:w,options:y});i(u(e),{loading:!1,loaded:!0,byContext:o,options:y,totalDimensionsCount:r,method:m,group:b,groupBy:A,error:null})})).catch((t=>{if(!t.isCancel)throw i(u(e),{...c,error:t?.response?.data||t}),t}))}),[e])),(0,i.yF)((0,o.useCallback)(((t,n)=>{r.current&&r.current.cancel(),n(u(e),s.Ut)}),[e]))]},w=e=>(0,r.md)(u(e)),A=e=>(0,i.AY)(u(e)),I=.01,C=(e,t,n)=>{const[r,i]=p(e,t,n),{loaded:s,loading:l,byContext:d,totalDimensionsCount:c,options:u,groupBy:h}=w(e),f=(()=>{const e=(0,a.rW)("threshold");return e?Number.parseFloat(e):I})(),[g,m,y]=(0,o.useMemo)((()=>{let e=0;const t=u?.includes("raw"),n=(h||[]).length?d:Object.keys(d).reduce(((n,o)=>{const r=Object.keys(d[o].dimensions).reduce(((e,n)=>(!t&&d[o].dimensions[n].weight>f||(e[n]=d[o].dimensions[n]),e)),{}),i=Object.keys(r).length;return e+=i,i?(n[o]={...d[o],dimensions:r},n):n}),{});return[n,Object.keys(n),e]}),[s,f]);return{threshold:f,metadata:g,contexts:m,dimensionsCount:y,totalDimensionsCount:c,loaded:s,loading:l,getWeights:r,resetWeights:i}}}}]);