"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8083],{88083:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var a=r(23892),l=r(85848),s=r(96110),n=r(14250),o=r(32446),i=r(62318);let c=(0,r(49431).default)(()=>Promise.all([r.e(2382),r.e(8822)]).then(r.bind(r,18822)),{loadableGenerated:{webpack:()=>[18822]},ssr:!1,loading:()=>(0,a.jsx)("div",{className:"w-full h-full min-h-[300px] flex items-center justify-center bg-background text-muted-foreground",children:(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("div",{className:"animate-pulse",children:"Loading chart..."})})})}),d=l.memo(function(e){let{data:t}=e,r=(0,s.jL)(),[d,u]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),x=(0,s.GV)(e=>e.ui.histogramBreakdownColumn),f=(0,s.GV)(e=>e.ui.histogramColumn);(0,l.useEffect)(()=>{u(!0)},[]);let g=(0,n.u2)(),b=(0,l.useMemo)(()=>{if(!t||!Array.isArray(t))return[];try{return t.map(e=>({x:e.x||[],y:e.y||[],name:e.name,type:"bar",customdata:e.customdata,hovertemplate:"<b>Count</b>: %{y}<br>"+(x?"<b>".concat(x,"</b>: %{fullData.name}<br>"):"")+"<b>".concat(f,"</b>: %{x}<br>")+"<extra></extra>",marker:{line:{color:g.foreground,width:1}}}))}catch(e){return console.error("Error preparing histogram plot data:",e),h(e instanceof Error?e.message:"Unknown error"),[]}},[t,g,x,f]),p=(0,n.kf)({xTitle:f||"Value",yTitle:"Count",barmode:"stack"}),j=(0,n.Iw)(),v=(0,l.useMemo)(()=>({...j,modeBarButtonsToRemove:["autoScale2d","resetScale2d","zoomIn2d","zoomOut2d","toImage"]}),[j]),k=(0,l.useCallback)(e=>{try{if(e.points&&e.points.length>0){var t;let a=null==(t=e.points[0].customdata)?void 0:t.condExpr;a&&(r((0,o.lR)(a)),r((0,i.SR)(!0)))}}catch(e){console.error("Error handling histogram click:",e)}},[r]);return d?m?(0,a.jsxs)("div",{className:"w-full h-full min-h-[300px] flex items-center justify-center bg-background text-destructive flex-col gap-2",children:[(0,a.jsx)("div",{className:"text-lg font-medium",children:"Error loading chart"}),(0,a.jsx)("div",{className:"text-sm opacity-70",children:m})]}):t&&0!==t.length?(0,a.jsx)("div",{className:"w-full h-full min-h-[300px]",children:(0,a.jsx)(c,{data:b,layout:p,config:v,style:{width:"100%",height:"100%"},useResizeHandler:!0,onClick:k,onError:e=>{console.error("Plotly histogram error:",e),h(e.message||"Unknown plotting error")}})}):(0,a.jsx)("div",{className:"w-full h-full min-h-[300px] flex items-center justify-center bg-background text-muted-foreground",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg font-medium mb-2",children:"No data to display"}),(0,a.jsx)("div",{className:"text-sm",children:"Select histogram and breakdown columns to generate chart"})]})}):(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-background text-muted-foreground",children:(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("div",{className:"animate-pulse",children:"Loading chart..."})})})})}}]);