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