"use strict";(globalThis.wpRiseJsonp=globalThis.wpRiseJsonp||[]).push([["node_modules_pnpm_react-chartjs-2_5_3_1_chart_js_4_5_1_react_19_2_5_node_modules_react-chartj-e30f191"],{23310(z,C,d){d.r(C),d.d(C,{Bar:()=>L,Bubble:()=>F,Chart:()=>R,Doughnut:()=>I,Line:()=>y,Pie:()=>S,PolarArea:()=>K,Radar:()=>w,Scatter:()=>U,getDatasetAtEvent:()=>j,getElementAtEvent:()=>B,getElementsAtEvent:()=>O});var b=d(1463),s=d(9608),o=d(30467);const p="label";function v(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function P(t,e){const r=t.options;r&&e&&Object.assign(r,e)}function m(t,e){t.labels=e}function A(t,e,r=p){const i=[];t.datasets=e.map(a=>{const u=t.datasets.find(E=>E[r]===a[r]);return!u||!a.data||i.includes(u)?{...a}:(i.push(u),Object.assign(u,a),u)})}function M(t,e=p){const r={labels:[],datasets:[]};return m(r,t.labels),A(r,t.datasets,e),r}function j(t,e){return t.getElementsAtEventForMode(e.nativeEvent,"dataset",{intersect:!0},!1)}function B(t,e){return t.getElementsAtEventForMode(e.nativeEvent,"nearest",{intersect:!0},!1)}function O(t,e){return t.getElementsAtEventForMode(e.nativeEvent,"index",{intersect:!0},!1)}function T(t,e){const{height:r=150,width:i=300,redraw:a=!1,datasetIdKey:u,type:E,data:l,options:f,plugins:W=[],fallbackContent:J,updateMode:D,...x}=t,h=(0,s.useRef)(null),n=(0,s.useRef)(null),_=()=>{h.current&&(n.current=new o.Chart(h.current,{type:E,data:M(l,u),options:f&&{...f},plugins:W}),v(e,n.current))},g=()=>{v(e,null),n.current&&(n.current.destroy(),n.current=null)};return(0,s.useEffect)(()=>{!a&&n.current&&f&&P(n.current,f)},[a,f]),(0,s.useEffect)(()=>{!a&&n.current&&m(n.current.config.data,l.labels)},[a,l.labels]),(0,s.useEffect)(()=>{!a&&n.current&&l.datasets&&A(n.current.config.data,l.datasets,u)},[a,l.datasets]),(0,s.useEffect)(()=>{n.current&&(a?(g(),setTimeout(_)):n.current.update(D))},[a,f,l.labels,l.datasets,D]),(0,s.useEffect)(()=>{n.current&&(g(),setTimeout(_))},[E]),(0,s.useEffect)(()=>(_(),()=>g()),[]),(0,b.jsx)("canvas",{ref:h,role:"img",height:r,width:i,...x,children:J})}const R=(0,s.forwardRef)(T);function c(t,e){return o.Chart.register(e),(0,s.forwardRef)((r,i)=>(0,b.jsx)(R,{...r,ref:i,type:t}))}const y=c("line",o.LineController),L=c("bar",o.BarController),w=c("radar",o.RadarController),I=c("doughnut",o.DoughnutController),K=c("polarArea",o.PolarAreaController),F=c("bubble",o.BubbleController),S=c("pie",o.PieController),U=c("scatter",o.ScatterController)}}]);
