"use strict";(globalThis.wpRiseJsonp=globalThis.wpRiseJsonp||[]).push([["node_modules_pnpm_react-chartjs-2_5_3_1_chart_js_4_5_1_react_19_2_7_node_modules_react-chartj-7f4f2b1"],{97808(G,h,i){i.r(h),i.d(h,{getDatasetAtEvent:()=>j,getElementAtEvent:()=>B,getElementsAtEvent:()=>O});var b=i(34158),s=i(82920),o=i(30467);const m="label";function p(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 A(t,e){t.labels=e}function _(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 A(r,t.labels),_(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: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}),p(e,n.current))},v=()=>{p(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&&A(n.current.config.data,l.labels)},[a,l.labels]),(0,s.useEffect)(()=>{!a&&n.current&&l.datasets&&_(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)(T);function c(t,e){return o.Chart.register(e),(0,s.forwardRef)((r,f)=>(0,b.jsx)(R,{...r,ref:f,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);i.d(h,["Bar",0,L,"Bubble",0,F,"Chart",0,R,"Doughnut",0,I,"Line",0,y,"Pie",0,S,"PolarArea",0,K,"Radar",0,w,"Scatter",0,U])}}]);
