@wakastellar/ui 3.3.0 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2651,6 +2651,6 @@ LIMIT 10;`,planningTime:.125,executionTime:45.32,totalCost:1250.5,rootNode:{id:`
2651
2651
  animation: feed-item-in 0.35s ease-out forwards;
2652
2652
  animation-delay: var(--stagger-delay, 0ms);
2653
2653
  }
2654
- `})]})}var fN=[{value:`day`,label:`Day`},{value:`week`,label:`Week`},{value:`month`,label:`Month`},{value:`year`,label:`Year`}],pN=`#3b82f6`,mN=`#94a3b8`;function hN(e,t){return!t||t.length===0?e.map(e=>({date:e.date,value:e.value})):e.map((e,n)=>({date:e.date,value:e.value,compareValue:t[n]?.value}))}function gN(e){return e.toLocaleString(`en-US`)}function _N({active:e,payload:t,label:n,formatValue:r}){return!e||!t||t.length===0?null:(0,f.jsxs)(`div`,{className:`rounded-lg border bg-popover px-3 py-2 shadow-md`,children:[(0,f.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e.color}}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.name,`:`]}),(0,f.jsx)(`span`,{className:`font-semibold tabular-nums`,children:r(e.value)})]},e.dataKey))]})}function vN({period:e,onPeriodChange:n}){return(0,f.jsx)(`div`,{className:`mb-4 flex gap-1 rounded-lg bg-muted p-1`,children:fN.map(r=>(0,f.jsx)(`button`,{type:`button`,onClick:()=>n(r.value),className:t.t(`rounded-md px-3 py-1.5 text-xs font-medium transition-colors`,e===r.value?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value))})}function yN({data:e,compareWith:n,period:r=`month`,stacked:i=!1,height:a=300,showLegend:o=!1,showGrid:c=!0,animated:l=!0,color:u=pN,compareColor:d=mN,formatValue:p=gN,onPeriodChange:m,className:h}){let g=s.useMemo(()=>hN(e,n),[e,n]),_=s.useId(),v=s.useId(),y=`usage-gradient-${_.replace(/:/g,``)}`,b=`compare-gradient-${v.replace(/:/g,``)}`,x=n&&n.length>0;return(0,f.jsxs)(`div`,{className:t.t(`w-full`,h),children:[m&&(0,f.jsx)(vN,{period:r,onPeriodChange:m}),(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:a,children:(0,f.jsxs)(K.AreaChart,{data:g,margin:{top:4,right:4,left:0,bottom:0},children:[(0,f.jsxs)(`defs`,{children:[(0,f.jsxs)(`linearGradient`,{id:y,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:u,stopOpacity:.4}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:u,stopOpacity:.05})]}),x&&(0,f.jsxs)(`linearGradient`,{id:b,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:d,stopOpacity:.15}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:d,stopOpacity:.02})]})]}),c&&(0,f.jsx)(K.CartesianGrid,{strokeDasharray:`3 3`,vertical:!1,className:`stroke-border/50`}),(0,f.jsx)(K.XAxis,{dataKey:`date`,axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,dy:8}),(0,f.jsx)(K.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,tickFormatter:e=>p(e),width:60}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(_N,{formatValue:p}),cursor:{stroke:`hsl(var(--border))`,strokeWidth:1}}),o&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,align:`center`,wrapperStyle:{paddingTop:16},iconType:`circle`}),x&&(0,f.jsx)(K.Area,{dataKey:`compareValue`,name:`Previous Period`,type:`monotone`,stroke:d,strokeWidth:1.5,strokeDasharray:`6 3`,fill:`url(#${b})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:l,animationDuration:800,dot:!1,activeDot:{r:3,fill:d,stroke:`white`,strokeWidth:1.5}}),(0,f.jsx)(K.Area,{dataKey:`value`,name:`Current Period`,type:`monotone`,stroke:u,strokeWidth:2,fill:`url(#${y})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:l,animationDuration:800,dot:!1,activeDot:{r:4,fill:u,stroke:`white`,strokeWidth:2}})]})})]})}function bN(e){if(e.length===0)return 0;let t=e.slice(-7);return t.reduce((e,t)=>e+t.value,0)/t.length}function xN(e,t){return t<=0?1/0:Math.floor(e/t)}function SN(e){if(!isFinite(e)||e<=0)return null;let t=new Date;return t.setDate(t.getDate()+e),t}function CN(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function wN(e){return e<7?{stroke:`#ef4444`,text:`text-red-600`,bg:`bg-red-100 dark:bg-red-950`,label:`Critical`}:e<=30?{stroke:`#f59e0b`,text:`text-amber-600`,bg:`bg-amber-100 dark:bg-amber-950`,label:`Warning`}:{stroke:`#22c55e`,text:`text-green-600`,bg:`bg-green-100 dark:bg-green-950`,label:`Healthy`}}function TN({dailyUsage:e,avgBurnRate:n,width:r,height:i,showProjection:a,projectionDays:o,statusColor:c,animated:l}){let[u,d]=s.useState(0),[p,m]=s.useState(!l),h=s.useRef(null),g=r-4,_=i-4,v=e.length+(a?o:0),y=e.map(e=>e.value),b=a?Array.from({length:o},()=>n):[],x=[...y,...b],S=Math.min(...x,0),C=Math.max(...x,1)-S||1,w=e.map((e,t)=>`${2+t/(v-1)*g},${2+_-(e.value-S)/C*_}`),T=[];if(a&&e.length>0){let t=e.length-1,r=2+t/(v-1)*g,i=2+_-(e[t].value-S)/C*_;T.push(`${r},${i}`);for(let t=1;t<=o;t++){let r=2+(e.length-1+t)/(v-1)*g,i=2+_-(n-S)/C*_;T.push(`${r},${i}`)}}return s.useEffect(()=>{h.current&&d(h.current.getTotalLength())},[e]),s.useEffect(()=>{if(l&&u>0){let e=setTimeout(()=>m(!0),50);return()=>clearTimeout(e)}},[l,u]),e.length<2?(0,f.jsx)(`svg`,{width:r,height:i,children:(0,f.jsx)(`text`,{x:r/2,y:i/2,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Not enough data`})}):(0,f.jsxs)(`svg`,{width:r,height:i,className:`overflow-visible`,children:[(0,f.jsx)(`polyline`,{ref:h,points:w.join(` `),fill:`none`,stroke:c,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:l&&u>0?{strokeDasharray:u,strokeDashoffset:p?0:u,transition:`stroke-dashoffset 1s ease-out`}:void 0}),a&&T.length>1&&(0,f.jsx)(`polyline`,{points:T.join(` `),fill:`none`,stroke:c,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeDasharray:`4,3`,opacity:`0.5`,className:t.t(l&&`transition-opacity duration-500`,l&&(p?`opacity-50`:`opacity-0`))}),e.length>0&&(0,f.jsx)(`circle`,{cx:parseFloat(w[w.length-1].split(`,`)[0]),cy:parseFloat(w[w.length-1].split(`,`)[1]),r:`2.5`,fill:c,stroke:`white`,strokeWidth:`1`,className:t.t(l&&`transition-opacity duration-500`,l&&(p?`opacity-100`:`opacity-0`))})]})}function EN({dailyUsage:e,avgBurnRate:n,daysRemaining:r,width:i,height:a,showProjection:o,projectionDays:s,animated:c,className:l}){let u=wN(r);return(0,f.jsxs)(`div`,{className:t.t(`inline-flex items-center gap-2`,l),children:[(0,f.jsx)(TN,{dailyUsage:e,avgBurnRate:n,width:i,height:a,showProjection:o,projectionDays:s,statusColor:u.stroke,animated:c}),(0,f.jsx)(`span`,{className:t.t(`text-xs font-medium tabular-nums`,u.text),children:isFinite(r)?`${r}d`:`--`})]})}function DN({dailyUsage:e,balance:n,avgBurnRate:r,daysRemaining:i,depletionDate:a,width:o,height:s,showProjection:c,projectionDays:u,animated:d,className:p}){let m=wN(i);return(0,f.jsxs)(`div`,{className:t.t(`rounded-lg border bg-card p-4 space-y-4`,p),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(l.TrendingDown,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:`Credit Burn Rate`})]}),(0,f.jsx)(`div`,{className:t.t(`px-2 py-0.5 rounded-full text-xs font-medium`,m.bg,m.text),children:m.label})]}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(TN,{dailyUsage:e,avgBurnRate:r,width:o,height:s,showProjection:c,projectionDays:u,statusColor:m.stroke,animated:d})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Burn Rate`}),(0,f.jsx)(`div`,{className:`text-lg font-bold tabular-nums`,children:r.toFixed(1)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`credits/day`})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:`Days Left`})]}),(0,f.jsx)(`div`,{className:t.t(`text-lg font-bold tabular-nums`,m.text),children:isFinite(i)?i:`--`}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toLocaleString(),` credits`]})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Depleted By`}),(0,f.jsx)(`div`,{className:t.t(`text-sm font-semibold`,m.text),children:a?CN(a):`--`}),i<7&&isFinite(i)&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-red-600`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:`Critical`})]})]})]})]})}function ON({dailyUsage:e,balance:n,showProjection:r=!1,projectionDays:i=7,width:a=120,height:o=32,animated:c=!0,variant:l=`sparkline`,className:u}){let d=s.useMemo(()=>bN(e),[e]),p=s.useMemo(()=>xN(n,d),[n,d]),m=s.useMemo(()=>SN(p),[p]);return!e||e.length===0?(0,f.jsx)(`div`,{className:t.t(`inline-flex items-center gap-2 text-muted-foreground text-sm`,u),children:`No data`}):l===`card`?(0,f.jsx)(DN,{dailyUsage:e,balance:n,avgBurnRate:d,daysRemaining:p,depletionDate:m,width:Math.max(a,200),height:Math.max(o,48),showProjection:r,projectionDays:i,animated:c,className:u}):(0,f.jsx)(EN,{dailyUsage:e,avgBurnRate:d,daysRemaining:p,width:a,height:o,showProjection:r,projectionDays:i,animated:c,className:u})}var kN=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`,`hsl(var(--primary))`,`hsl(var(--info))`,`hsl(var(--warning))`,`hsl(var(--success))`,`hsl(var(--destructive))`];function AN(e){return e.map((e,t)=>({...e,color:e.color||kN[t%kN.length]}))}function jN(e){return e.reduce((e,t)=>e+t.value,0)}function MN(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function NN({active:e,payload:n,total:r,formatter:i}){if(!e||!n||!n.length)return null;let a=n[0],o=r>0?(a.value/r*100).toFixed(1):`0`;return(0,f.jsxs)(`div`,{className:t.t(`px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`pointer-events-none min-w-[140px]`),children:[(0,f.jsxs)(`div`,{className:`font-semibold mb-1 flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:a.payload.color}}),a.name]}),(0,f.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,f.jsx)(`span`,{className:`opacity-70`,children:`Value:`}),(0,f.jsx)(`span`,{className:`font-medium`,children:i(a.value)})]}),(0,f.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,f.jsx)(`span`,{className:`opacity-70`,children:`Share:`}),(0,f.jsxs)(`span`,{children:[o,`%`]})]})]})}function PN({cx:e,cy:t,midAngle:n,innerRadius:r,outerRadius:i,percent:a}){let o=Math.PI/180,s=r+(i-r)*.5+20,c=e+s*Math.cos(-n*o),l=t+s*Math.sin(-n*o);return a<.05?null:(0,f.jsx)(`text`,{x:c,y:l,fill:`currentColor`,textAnchor:c>e?`start`:`end`,dominantBaseline:`central`,className:`text-xs fill-foreground`,children:`${(a*100).toFixed(0)}%`})}function FN({viewBox:e,total:t,formatter:n}){if(!e)return null;let{cx:r,cy:i}=e;return(0,f.jsxs)(`g`,{children:[(0,f.jsx)(`text`,{x:r,y:i-10,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Total`}),(0,f.jsx)(`text`,{x:r,y:i+12,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-base font-bold fill-foreground`,children:n(t)})]})}function IN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.PieChart,{children:[(0,f.jsx)(K.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,outerRadius:n/2-40,isAnimationActive:r,animationDuration:800,label:i?PN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id))}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function LN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){let c=n/2-40;return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.PieChart,{children:[(0,f.jsxs)(K.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,innerRadius:c*.55,outerRadius:c,isAnimationActive:r,animationDuration:800,paddingAngle:2,label:i?PN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:[e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id)),(0,f.jsx)(FN,{total:t,formatter:o})]}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function RN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.BarChart,{data:e.map(e=>({...e,percentage:t>0?(e.value/t*100).toFixed(1):`0`})),layout:`vertical`,barCategoryGap:`20%`,children:[(0,f.jsx)(K.XAxis,{type:`number`,tickFormatter:e=>i?`${t>0?(e/t*100).toFixed(0):0}%`:o(e),axisLine:!1,tickLine:!1,tick:{className:`text-xs fill-muted-foreground`}}),(0,f.jsx)(K.YAxis,{dataKey:`name`,type:`category`,width:100,axisLine:!1,tickLine:!1,tick:{className:`text-sm fill-foreground`}}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})}),(0,f.jsx)(K.Bar,{dataKey:`value`,name:`Credits`,radius:[0,4,4,0],isAnimationActive:r,animationDuration:800,barSize:24,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id))})]})})}function zN({data:e,variant:n=`pie`,showPercentages:r=!1,showLegend:i=!0,height:a=300,animated:o=!0,onSegmentClick:c,formatValue:l,className:u}){let d=s.useMemo(()=>AN(e),[e]),p={data:d,total:s.useMemo(()=>jN(d),[d]),height:a,animated:o,showPercentages:r,showLegend:i,formatter:l||MN,onSegmentClick:c};return(0,f.jsxs)(`div`,{className:t.t(`w-full`,u),children:[n===`pie`&&(0,f.jsx)(IN,{...p}),n===`donut`&&(0,f.jsx)(LN,{...p}),n===`bar`&&(0,f.jsx)(RN,{...p})]})}function BN(e){return new Date(e)}function VN(e){return BN(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function HN(e,t){let n=BN(e);return n.setDate(n.getDate()+t),n.toISOString().split(`T`)[0]}function UN(e){if(e.length<2)return 0;let t=[...e].sort((e,t)=>BN(e.date).getTime()-BN(t.date).getTime()),n=t[0],r=t[t.length-1],i=(BN(r.date).getTime()-BN(n.date).getTime())/(1e3*60*60*24);return i===0?0:(n.value-r.value)/i}function WN(e,t,n,r){let i=[...e].sort((e,t)=>BN(e.date).getTime()-BN(t.date).getTime()),a=UN(i),o=i.map(e=>({date:e.date,historical:e.value})),s=i.length>0?i[i.length-1].date:new Date().toISOString().split(`T`)[0],c=null;i.length>0&&(o[o.length-1].projected=t,r&&(o[o.length-1].upperBound=t,o[o.length-1].lowerBound=t));for(let e=1;e<=n;e++){let i=HN(s,e),l=Math.max(0,t-a*e),u=e/n*.2,d=Math.max(0,t-a*e*(1-u)),f=Math.max(0,t-a*e*(1+u)),p={date:i,projected:l};r&&(p.upperBound=d,p.lowerBound=f),o.push(p),c===null&&l<=0&&(c=i)}return{chartData:o,depletionDate:c}}function GN({active:e,payload:t,label:n}){if(!e||!t||t.length===0||!n)return null;let r=t.find(e=>e.dataKey===`historical`),i=t.find(e=>e.dataKey===`projected`),a=t.find(e=>e.dataKey===`upperBound`),o=t.find(e=>e.dataKey===`lowerBound`);return(0,f.jsxs)(`div`,{className:`rounded-lg border bg-background px-3 py-2 shadow-md`,children:[(0,f.jsx)(`p`,{className:`text-xs font-medium text-foreground mb-1`,children:VN(n)}),r&&r.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-blue-600`,children:[`Balance: `,r.value.toLocaleString()]}),i&&i.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Projected: `,i.value.toLocaleString()]}),a&&o&&a.value!=null&&o.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground/70`,children:[`Range: `,o.value.toLocaleString(),` - `,a.value.toLocaleString()]})]})}function KN({depletionDate:e}){return e?(0,f.jsxs)(`div`,{className:`mt-2 text-sm text-red-600 font-medium text-center`,children:[`Estimated depletion: `,VN(e)]}):null}function qN({historicalData:e,balance:n,projectionDays:r=30,confidenceInterval:i=!1,height:a=300,animated:o=!0,className:c}){let{chartData:l,depletionDate:u}=s.useMemo(()=>WN(e,n,r,i),[e,n,r,i]);return e.length===0?(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg`,c),style:{height:a},children:`No historical data available`}):(0,f.jsxs)(`div`,{className:t.t(`w-full`,c),children:[(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:a,children:(0,f.jsxs)(K.AreaChart,{data:l,margin:{top:10,right:30,left:10,bottom:0},children:[(0,f.jsxs)(`defs`,{children:[(0,f.jsxs)(`linearGradient`,{id:`historicalGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.3}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:.05})]}),(0,f.jsxs)(`linearGradient`,{id:`confidenceGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:`#9ca3af`,stopOpacity:.2}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:`#9ca3af`,stopOpacity:.05})]})]}),(0,f.jsx)(K.CartesianGrid,{strokeDasharray:`3 3`,stroke:`#e5e7eb`,vertical:!1}),(0,f.jsx)(K.XAxis,{dataKey:`date`,tickFormatter:VN,tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`}}),(0,f.jsx)(K.YAxis,{tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`},tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(GN,{})}),(0,f.jsx)(K.ReferenceLine,{y:0,stroke:`#ef4444`,strokeWidth:2}),i&&(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`upperBound`,stroke:`none`,fill:`url(#confidenceGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),i&&(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`lowerBound`,stroke:`none`,fill:`#ffffff`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`historical`,stroke:`#3b82f6`,strokeWidth:2,fill:`url(#historicalGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1}),(0,f.jsx)(K.Line,{type:`monotone`,dataKey:`projected`,stroke:`#6b7280`,strokeWidth:2,strokeDasharray:`6 3`,dot:!1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1})]})}),(0,f.jsx)(KN,{depletionDate:u})]})}function JN(e){return e.toLocaleString(`en-US`)}function YN(e,t){return Number.isInteger(e)?`${e}${t}`:`${e.toFixed(2)}${t}`}function XN(e,t){return`${e.toFixed(4).replace(/0+$/,``).replace(/\.$/,``)}${t}/credit`}function ZN({pack:e,selected:i,onSelect:a,currency:o}){let s=e.currency||o;return(0,f.jsxs)(Y,{className:t.t(`relative flex flex-col transition-all duration-200 cursor-pointer`,i&&[`border-primary shadow-lg shadow-primary/10`,`ring-2 ring-primary/30`],e.highlighted&&!i&&`bg-muted/30`,!i&&!e.highlighted&&`hover:border-muted-foreground/30`),onClick:()=>a(e),children:[e.highlighted&&e.highlightLabel&&(0,f.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,f.jsxs)(n.x,{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 shadow-sm`,children:[(0,f.jsx)(l.Sparkles,{className:`h-3 w-3`}),e.highlightLabel]})}),(0,f.jsx)(X,{className:t.t(`pb-2`,e.highlighted&&`pt-8`),children:(0,f.jsx)(`h3`,{className:`text-lg font-bold text-foreground`,children:e.name})}),(0,f.jsxs)(Q,{className:`flex flex-1 flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Coins,{className:`h-5 w-5 text-primary`}),(0,f.jsx)(`span`,{className:`text-3xl font-bold text-foreground`,children:JN(e.credits)}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`credits`})]}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold text-foreground`,children:YN(e.price,s)}),e.unitPrice!=null&&e.unitPrice>0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:XN(e.unitPrice,s)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`w-fit rounded-full`,children:[`+`,e.bonusPercent,`% bonus`]}),(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsx)(r.r,{type:`button`,variant:i?`default`:`outline`,className:`mt-2 w-full`,onClick:t=>{t.stopPropagation(),a(e)},children:i?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Check,{className:`h-4 w-4`}),`Selected`]}):`Select`})]})]})}function QN({packs:e,selectedId:n,onSelect:r,currency:i=`€`,columns:a=3,className:o}){return(0,f.jsx)(`div`,{className:t.t(`grid gap-6`,{2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`}[a],o),children:e.map(e=>(0,f.jsx)(ZN,{pack:e,selected:e.id===n,onSelect:r,currency:i},e.id))})}var $N=.01,eP=100,tP=5e4;function nP(e,t){if(t.length===0)return e*$N;let n=[...t].sort((e,t)=>e.credits-t.credits);if(e<=n[0].credits){let t=n[0].price/n[0].credits;return Math.round(e*t*100)/100}if(e>=n[n.length-1].credits){let t=n[n.length-1].price/n[n.length-1].credits;return Math.round(e*t*100)/100}for(let t=0;t<n.length-1;t++)if(e>=n[t].credits&&e<=n[t+1].credits){let r=n[t],i=n[t+1],a=(e-r.credits)/(i.credits-r.credits),o=r.price+a*(i.price-r.price);return Math.round(o*100)/100}return e*$N}function rP(e,t){return`${e.toFixed(2)} ${t}`}function iP(e){return e.toLocaleString(`en-US`)}function aP({pack:e,selected:n,currency:r,onSelect:i}){return(0,f.jsxs)(`button`,{type:`button`,onClick:i,className:t.t(`relative flex flex-col items-center gap-2 rounded-lg border p-4 text-left transition-all`,`hover:border-primary/50 hover:shadow-sm`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n?`border-primary bg-primary/5 shadow-sm ring-1 ring-primary`:`border-border bg-card`,e.highlighted&&!n&&`border-primary/30`),children:[e.highlighted&&e.highlightLabel&&(0,f.jsx)(`span`,{className:`absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground whitespace-nowrap`,children:e.highlightLabel}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(l.Coins,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`text-lg font-bold tabular-nums`,children:iP(e.credits)})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:e.name}),(0,f.jsx)(`span`,{className:`text-sm font-semibold`,children:rP(e.price,e.currency??r)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,f.jsxs)(`span`,{className:`rounded-full bg-green-100 dark:bg-green-900/30 px-2 py-0.5 text-[10px] font-semibold text-green-700 dark:text-green-400`,children:[`+`,e.bonusPercent,`% bonus`]}),e.unitPrice!=null&&(0,f.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.unitPrice.toFixed(4),` `,e.currency??r,`/credit`]})]})}function oP({packs:e,currentBalance:n,customAmount:i=!1,minAmount:a=eP,maxAmount:o=tP,currency:c=`EUR`,onPurchase:u,onCancel:d,className:p}){let[m,h]=s.useState(null),[g,_]=s.useState(!1),[v,y]=s.useState(a),b=e.find(e=>e.id===m)??null,x=nP(v,e),S=b!==null||g&&v>=a,C=g?v:b?.credits??0,w=g?x:b?.price??0;function T(e){h(e),_(!1)}function E(){_(!0),h(null)}function D(e){y(Math.max(a,Math.min(o,Math.round(e))))}function O(e){let t=e.target.value;if(t===``){y(a);return}let n=parseInt(t,10);isNaN(n)||D(n)}function k(e){e[0]!=null&&D(e[0])}function A(){S&&(g?u({credits:v,price:x}):b&&u(b))}return(0,f.jsx)(Y,{className:t.t(`w-full`,p),children:(0,f.jsxs)(Q,{className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10`,children:(0,f.jsx)(l.ShoppingCart,{className:`h-5 w-5 text-primary`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Top Up Credits`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a pack or enter a custom amount`})]})]}),(0,f.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:e.map(e=>(0,f.jsx)(aP,{pack:e,selected:m===e.id&&!g,currency:c,onSelect:()=>T(e.id)},e.id))}),i&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(r.t,{}),(0,f.jsx)(`span`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card px-3 text-xs text-muted-foreground font-medium`,children:`Or enter custom amount`})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:g?(0,f.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`label`,{htmlFor:`custom-credits`,className:`text-sm font-medium`,children:`Credits`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:rP(x,c)})]}),(0,f.jsx)(r.n,{id:`custom-credits`,type:`number`,min:a,max:o,step:100,value:v,onChange:O,className:`tabular-nums`}),(0,f.jsx)(pr,{value:[v],onValueChange:k,min:a,max:o,step:100}),(0,f.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground tabular-nums`,children:[(0,f.jsx)(`span`,{children:iP(a)}),(0,f.jsx)(`span`,{children:iP(o)})]})]}):(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:E,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4`}),`Enter custom amount`]})})]}),S&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-muted/50 p-4`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Summary`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Credits`}),(0,f.jsx)(`span`,{className:`font-medium tabular-nums`,children:iP(C)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Price`}),(0,f.jsx)(`span`,{className:`font-medium tabular-nums`,children:rP(w,c)})]}),n!=null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{className:`my-1`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Current balance`}),(0,f.jsx)(`span`,{className:`tabular-nums`,children:iP(n)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-semibold`,children:[(0,f.jsx)(`span`,{children:`New balance`}),(0,f.jsx)(`span`,{className:`tabular-nums text-green-600 dark:text-green-400`,children:iP(n+C)})]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[d&&(0,f.jsx)(r.r,{variant:`outline`,onClick:d,children:`Cancel`}),(0,f.jsxs)(r.r,{onClick:A,disabled:!S,children:[(0,f.jsx)(l.ShoppingCart,{className:`h-4 w-4`}),`Purchase`]})]})]})})}function sP(e){return(typeof e==`string`?new Date(e):e).toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function cP(e){return`${e>=0?`+`:``}${e.toLocaleString(`en-US`)}`}function lP(e){return e.toLocaleString(`en-US`,{style:`currency`,currency:`EUR`})}function uP(e){switch(e){case`credit`:return`default`;case`debit`:return`secondary`;case`refund`:return`destructive`;case`bonus`:return`default`;case`expiry`:return`outline`;default:return`secondary`}}function dP(e){switch(e){case`completed`:return`default`;case`pending`:return`outline`;case`failed`:return`destructive`;case`cancelled`:return`secondary`;default:return`outline`}}function fP(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pP({label:e,children:t}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 print:py-1`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground print:text-gray-500`,children:e}),(0,f.jsx)(`div`,{className:`text-sm font-medium text-right`,children:t})]})}function mP({transaction:e,organization:i,downloadable:a=!1,onDownload:o,className:s}){return(0,f.jsxs)(Y,{className:t.t(`w-full max-w-md print:shadow-none print:border-gray-300`,s),children:[(0,f.jsxs)(X,{className:`pb-4 print:pb-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Receipt,{className:`h-5 w-5 text-muted-foreground print:text-gray-500`}),(0,f.jsx)(Z,{className:`text-lg print:text-base`,children:`Receipt`})]}),(0,f.jsx)(l.CheckCircle,{className:`h-5 w-5 text-green-500 print:text-gray-700`})]}),(0,f.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground mt-1 print:text-gray-400`,children:e.id})]}),(0,f.jsx)(r.t,{className:`print:bg-gray-300`}),(0,f.jsxs)(Q,{className:`pt-4 print:pt-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(pP,{label:`Date`,children:sP(e.timestamp)}),(0,f.jsx)(pP,{label:`Type`,children:(0,f.jsx)(n.x,{variant:uP(e.type),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:fP(e.type)})}),e.credits!==void 0&&(0,f.jsx)(pP,{label:`Credits`,children:(0,f.jsxs)(`span`,{className:t.t(`tabular-nums font-semibold`,e.credits>=0?`text-green-600 dark:text-green-400 print:text-gray-900`:`text-red-600 dark:text-red-400 print:text-gray-900`),children:[cP(e.credits),` credits`]})}),e.price!==void 0&&(0,f.jsx)(pP,{label:`Amount`,children:(0,f.jsx)(`span`,{className:`tabular-nums`,children:lP(e.price)})}),e.paymentMethod&&(0,f.jsx)(pP,{label:`Payment`,children:(0,f.jsx)(`span`,{className:`font-mono text-xs`,children:e.paymentMethod})}),(0,f.jsx)(pP,{label:`Status`,children:(0,f.jsx)(n.x,{variant:dP(e.status),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:fP(e.status)})}),i&&(0,f.jsx)(pP,{label:`Organization`,children:i.name}),e.description&&(0,f.jsx)(pP,{label:`Description`,children:(0,f.jsx)(`span`,{className:`max-w-[200px] truncate inline-block`,children:e.description})})]}),a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{className:`my-4 print:hidden`}),(0,f.jsx)(`div`,{className:`print:hidden`,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`w-full`,onClick:o,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download PDF`]})})]})]})]})}function hP(e,t,n,r,i){let a={};e?i&&e===i&&(a.destination=`Destination must be different from source organization`):a.destination=`Please select a destination organization`;let o=parseFloat(t);return t?isNaN(o)||o<=0?a.amount=`Amount must be greater than 0`:o>r&&(a.amount=`Amount cannot exceed ${r.toLocaleString()} credits`):a.amount=`Amount is required`,n.trim()||(a.reason=`Please provide a reason for the transfer`),a}function gP({message:e}){return e?(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,f.jsx)(l.AlertCircle,{className:`h-3.5 w-3.5 text-destructive flex-shrink-0`}),(0,f.jsx)(`span`,{className:`text-xs text-destructive`,children:e})]}):null}function _P({maxAmount:e,organizations:a,sourceOrganization:o,onTransfer:c,onCancel:u,loading:d=!1,className:p}){let[m,h]=s.useState(``),[g,_]=s.useState(``),[v,y]=s.useState(``),[b,x]=s.useState({}),[S,C]=s.useState({}),w=s.useMemo(()=>o?a.filter(e=>e.id!==o.id):a,[a,o]),T=s.useMemo(()=>a.find(e=>e.id===m),[a,m]);s.useEffect(()=>{if(Object.keys(S).length===0)return;let t=hP(m,g,v,e,o?.id),n={};S.destination&&t.destination&&(n.destination=t.destination),S.amount&&t.amount&&(n.amount=t.amount),S.reason&&t.reason&&(n.reason=t.reason),x(n)},[m,g,v,e,o?.id,S]);let E=e=>{C(t=>({...t,[e]:!0}))},D=t=>{t.preventDefault(),C({destination:!0,amount:!0,reason:!0});let n=hP(m,g,v,e,o?.id);if(Object.keys(n).length>0){x(n);return}c({toOrgId:m,amount:parseFloat(g),reason:v.trim()})},O=parseFloat(g),k=T&&!isNaN(O)&&O>0&&O<=e&&o;return(0,f.jsxs)(Y,{className:t.t(`w-full`,p),children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2 text-lg`,children:[(0,f.jsx)(l.Send,{className:`h-5 w-5`}),`Transfer Credits`]})}),(0,f.jsxs)(`form`,{onSubmit:D,children:[(0,f.jsxs)(Q,{className:`space-y-4`,children:[o&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Source Organization`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-muted/50 px-3 py-2 text-sm`,children:[(0,f.jsx)(l.Building2,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,f.jsx)(`span`,{className:`font-medium`,children:o.name}),o.balance!==void 0&&(0,f.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[o.balance.toLocaleString(),` credits`]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`destination-org`,children:`Destination Organization`}),(0,f.jsxs)(n.d,{value:m,onValueChange:e=>{h(e),C(e=>({...e,destination:!0}))},disabled:d,children:[(0,f.jsx)(n.y,{id:`destination-org`,className:t.t(b.destination&&`border-destructive focus:ring-destructive`),onBlur:()=>E(`destination`),children:(0,f.jsx)(n.b,{placeholder:`Select an organization`})}),(0,f.jsx)(n.f,{children:w.map(e=>(0,f.jsx)(n.m,{value:e.id,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Building2,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,f.jsx)(`span`,{children:e.name}),e.balance!==void 0&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.balance.toLocaleString(),` credits)`]})]})},e.id))})]}),(0,f.jsx)(gP,{message:b.destination})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`transfer-amount`,children:`Amount`}),(0,f.jsx)(`div`,{className:`relative`,children:(0,f.jsx)(r.n,{id:`transfer-amount`,type:`number`,min:1,max:e,step:1,placeholder:`Max: ${e.toLocaleString()} credits`,value:g,onChange:e=>_(e.target.value),onBlur:()=>E(`amount`),disabled:d,className:t.t(b.amount&&`border-destructive focus-visible:ring-destructive`)})}),(0,f.jsx)(gP,{message:b.amount})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`transfer-reason`,children:`Reason`}),(0,f.jsx)(i.n,{id:`transfer-reason`,placeholder:`Describe the reason for this transfer...`,value:v,onChange:e=>y(e.target.value),onBlur:()=>E(`reason`),disabled:d,rows:3,className:t.t(b.reason&&`border-destructive focus-visible:ring-destructive`)}),(0,f.jsx)(gP,{message:b.reason})]}),k&&(0,f.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-2 flex-wrap`,children:[`Transfer`,` `,(0,f.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[O.toLocaleString(),` credits`]}),` `,`from`,` `,(0,f.jsx)(`span`,{className:`font-semibold text-foreground`,children:o.name}),(0,f.jsx)(l.ArrowRight,{className:`h-3.5 w-3.5 flex-shrink-0`}),(0,f.jsx)(`span`,{className:`font-semibold text-foreground`,children:T.name})]})})]}),(0,f.jsxs)(Ce,{className:`gap-2 justify-end`,children:[u&&(0,f.jsx)(r.r,{type:`button`,variant:`outline`,onClick:u,disabled:d,children:`Cancel`}),(0,f.jsx)(r.r,{type:`submit`,disabled:d,children:d?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),`Transferring...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Send,{className:`h-4 w-4`}),`Transfer`]})})]})]})]})}function vP(e){let t=Math.abs(e),n=Math.floor(t/60),r=t%60,i=e<0?`-`:``;return r>0?`${i}${n}h${r.toString().padStart(2,`0`)}`:`${i}${n}h`}function yP(e){return e>600?`text-green-600 dark:text-green-400`:e>300?`text-orange-500 dark:text-orange-400`:`text-red-600 dark:text-red-400 font-bold`}function bP({remainingMinutes:e,totalMinutes:n,className:r}){return(0,f.jsxs)(`span`,{className:t.t(`inline-flex items-center gap-0.5 text-sm tabular-nums`,yP(e),r),"aria-label":`${vP(e)} restantes sur ${vP(n)} total`,children:[(0,f.jsx)(`span`,{children:vP(e)}),(0,f.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`/`}),(0,f.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:vP(n)})]})}var xP=[`CW`,`SW`,`IW`,`LW`,`DW`,`TW`,`AW`,`BW`,`FW`,`EW`];function SP({role:e,name:n,isPrimary:r,className:i}){return(0,f.jsxs)(`span`,{className:t.t(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium`,xP.includes(e)?`bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300`:`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`,i),children:[(0,f.jsx)(`span`,{className:`font-bold`,children:e}),n&&(0,f.jsx)(`span`,{className:`font-normal truncate max-w-[120px]`,children:n}),r&&(0,f.jsx)(`span`,{className:`text-amber-500`,"aria-label":`Principal`,children:`★`})]})}function CP({count:e,recentComments:n,onClick:r,className:i}){let a=e>0,o=(0,f.jsxs)(`button`,{onClick:r,className:t.t(`relative inline-flex items-center justify-center h-8 w-8 rounded-full transition-colors`,a?`bg-blue-100 text-blue-600 hover:bg-blue-200 dark:bg-blue-900/30 dark:text-blue-400`:`bg-muted text-muted-foreground hover:bg-accent`,i),"aria-label":`${e} commentaire${e===1?``:`s`}`,children:[(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`})}),a&&(0,f.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-blue-600 text-[10px] font-bold text-white`,children:e>9?`9+`:e})]});return n?.length?(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:o}),(0,f.jsx)(Cn,{className:`w-72 p-3`,side:`top`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[n.slice(0,3).map((e,t)=>(0,f.jsxs)(`div`,{className:`text-xs`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.author}),(0,f.jsx)(`span`,{children:e.date})]}),(0,f.jsx)(`p`,{className:`line-clamp-2 mt-0.5`,children:e.content})]},t)),e>3&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[`+`,e-3,` autre`,e-3>1?`s`:``]})]})})]}):o}function wP({open:e,onOpenChange:t,comments:n,onAdd:r,onEdit:i,onDelete:a,canEditDelete:o,isLoading:c}){let[l,u]=s.useState(``);return(0,f.jsx)(nr,{open:e,onOpenChange:t,children:(0,f.jsxs)(cr,{className:`flex flex-col w-full sm:max-w-md`,children:[(0,f.jsx)(lr,{children:(0,f.jsxs)(dr,{children:[`Commentaires (`,n.length,`)`]})}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-3 py-4`,children:[n.length===0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Aucun commentaire`}),n.map(e=>(0,f.jsxs)(`div`,{className:`rounded-lg border p-3 space-y-1.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(SP,{role:e.authorRole,name:e.authorName}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.createdAt})]}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.isEdited&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`(modifie)`}),o&&i&&(0,f.jsx)(`button`,{className:`text-xs text-blue-600 hover:underline`,onClick:()=>{let t=prompt(`Modifier le commentaire:`,e.content);t&&t!==e.content&&i(e.id,t)},children:`Modifier`}),o&&a&&(0,f.jsx)(`button`,{className:`text-xs text-red-600 hover:underline`,onClick:()=>{confirm(`Supprimer ce commentaire ?`)&&a(e.id)},children:`Supprimer`})]})]},e.id))]}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l.trim()&&(r(l.trim()),u(``))},className:`border-t pt-3 flex gap-2`,children:[(0,f.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:`Ajouter un commentaire...`,className:`flex-1 min-h-[60px] rounded-md border bg-background px-3 py-2 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-ring`,disabled:c}),(0,f.jsx)(`button`,{type:`submit`,disabled:!l.trim()||c,className:`self-end rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Envoyer`})]})]})})}function TP({open:e,onOpenChange:t,actors:n,onSubmit:r,showBillable:i,isLoading:a}){let[o,c]=s.useState(null),[l,u]=s.useState(0),[d,p]=s.useState(0),[m,h]=s.useState(``),[g,_]=s.useState(!1),v=()=>{c(null),u(0),p(0),h(``),_(!1)};return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-lg`,children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Saisie de temps`})}),(0,f.jsx)(`div`,{className:`space-y-3 max-h-[300px] overflow-y-auto`,children:n.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border p-2.5 cursor-pointer transition-colors ${o===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`}`,onClick:()=>c(e.id),children:[(0,f.jsx)(SP,{role:e.role,name:e.name}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground tabular-nums`,children:vP(e.totalMinutes)})]},e.id))}),o&&(0,f.jsxs)(`div`,{className:`space-y-3 border-t pt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Heures`}),(0,f.jsx)(`input`,{type:`number`,min:0,max:99,value:l,onChange:e=>u(Math.max(0,parseInt(e.target.value)||0)),className:`w-16 rounded-md border bg-background px-2 py-1.5 text-sm text-center`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Minutes`}),(0,f.jsxs)(`select`,{value:d,onChange:e=>p(parseInt(e.target.value)),className:`rounded-md border bg-background px-2 py-1.5 text-sm`,children:[(0,f.jsx)(`option`,{value:0,children:`00`}),(0,f.jsx)(`option`,{value:15,children:`15`}),(0,f.jsx)(`option`,{value:30,children:`30`}),(0,f.jsx)(`option`,{value:45,children:`45`})]})]})]}),(0,f.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Commentaire (optionnel)`,className:`w-full rounded-md border bg-background px-3 py-1.5 text-sm`}),i&&(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`rounded border-input`}),(0,f.jsx)(`span`,{className:`font-medium text-amber-600`,children:`Heures facturables`})]})]}),(0,f.jsx)(Ct,{children:(0,f.jsx)(`button`,{onClick:()=>{if(!o)return;let e=l*60+d;e<15||(r(o,e,m,g),v())},disabled:!o||l*60+d<15||a,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Ajouter`})})]})})}function EP({entries:e,children:t}){let n=e.reduce((e,t)=>e+t.totalMinutes,0);return(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:t}),(0,f.jsx)(Cn,{className:`w-52 p-3`,side:`top`,children:(0,f.jsxs)(`div`,{className:`space-y-1 text-xs`,children:[e.map(e=>(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.role}),(0,f.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:vP(e.totalMinutes)})]},e.role)),(0,f.jsxs)(`div`,{className:`border-t pt-1 flex justify-between font-medium`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsx)(`span`,{className:`tabular-nums`,children:vP(n)})]})]})})]})}var DP=[`text/`,`application/json`,`application/xml`,`application/javascript`],OP=[`image/`];function kP(e){return DP.some(t=>e.startsWith(t))||e.includes(`markdown`)}function AP(e){return OP.some(t=>e.startsWith(t))}function jP(e){return e<1024?`${e} o`:e<1024*1024?`${(e/1024).toFixed(1)} Ko`:`${(e/(1024*1024)).toFixed(1)} Mo`}function MP({open:e,onOpenChange:t,document:n,versions:r,selectedVersion:i,onVersionChange:a,onDownload:o}){return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-4xl max-h-[90vh] flex flex-col`,children:[(0,f.jsx)(St,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,f.jsx)(wt,{className:`truncate`,children:n.name}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[r&&r.length>1&&(0,f.jsx)(`select`,{value:i??r[0]?.id,onChange:e=>a?.(e.target.value),className:`rounded-md border bg-background px-2 py-1 text-xs`,children:r.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.label,` — `,e.date]},e.id))}),(0,f.jsx)(`button`,{onClick:()=>o(i),className:`rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Telecharger`})]})]})}),(0,f.jsx)(`div`,{className:`flex-1 overflow-auto rounded-lg border bg-muted/30 p-4 min-h-[300px]`,children:kP(n.mimeType)&&n.content?(0,f.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm font-mono leading-relaxed`,children:n.content}):AP(n.mimeType)&&n.previewUrl?(0,f.jsx)(`img`,{src:n.previewUrl,alt:n.name,className:`max-w-full h-auto mx-auto rounded`}):(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-muted-foreground py-12`,children:[(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,f.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:`Previsualisation non disponible`}),(0,f.jsxs)(`p`,{className:`text-xs`,children:[n.mimeType,` — `,jP(n.sizeBytes)]})]})}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground border-t pt-2`,children:[(0,f.jsx)(`span`,{children:jP(n.sizeBytes)}),(0,f.jsxs)(`span`,{children:[`Uploade par `,n.uploadedBy,` le `,n.uploadedAt]})]})]})})}function NP({name:e,extension:t,sizeKb:n,lastModified:r,author:i,onClick:a}){return(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:(0,f.jsx)(`button`,{onClick:a,className:`inline-flex items-center justify-center h-7 w-7 rounded-md bg-muted hover:bg-accent transition-colors`,"aria-label":`Document: ${e}`,children:(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,f.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})})}),(0,f.jsxs)(Cn,{className:`w-56 p-3 text-xs`,side:`top`,children:[(0,f.jsxs)(`p`,{className:`font-medium truncate`,children:[e,`.`,t]}),(0,f.jsxs)(`p`,{className:`text-muted-foreground`,children:[n,` Ko — `,r]}),(0,f.jsxs)(`p`,{className:`text-muted-foreground`,children:[`par `,i]})]})]})}function PP({onClick:e,hasExistingDoc:n,disabled:r,className:i}){return(0,f.jsxs)(`button`,{onClick:e,disabled:r,className:t.t(`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors`,`bg-violet-600 text-white hover:bg-violet-700 disabled:opacity-50`,i),"aria-label":n?`Ouvrir document IA`:`Assistant IA`,children:[(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z`}),(0,f.jsx)(`path`,{d:`M5 3v4`}),(0,f.jsx)(`path`,{d:`M19 17v4`}),(0,f.jsx)(`path`,{d:`M3 5h4`}),(0,f.jsx)(`path`,{d:`M17 19h4`})]}),n?`Ouvrir document IA`:`Assistant IA`]})}function FP({roles:e,actions:t,value:n,onChange:r}){return(0,f.jsx)(ti,{children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`border-b`,children:[(0,f.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground sticky left-0 bg-background`,children:`Role`}),t.map(e=>(0,f.jsx)(`th`,{className:`p-2 text-center`,children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(`span`,{className:`font-medium cursor-help`,children:e.key.replace(`_`,` `).slice(0,8)})}),(0,f.jsx)(ii,{children:e.label})]})},e.key))]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30`,children:[(0,f.jsx)(`td`,{className:`p-2 font-medium sticky left-0 bg-background`,children:e}),t.map(t=>(0,f.jsx)(`td`,{className:`p-2 text-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:(n[e]??[]).includes(t.key),onChange:n=>r(e,t.key,n.target.checked),className:`rounded border-input`,"aria-label":`${e} — ${t.label}`})},t.key))]},e))})]})})})}function IP({title:e,actors:n,requiredRoles:r,bgClass:i,side:a,onAdd:o,onRemove:s,onTogglePrimary:c}){let l=new Set(n.map(e=>e.role)),u=r.filter(e=>!l.has(e));return(0,f.jsxs)(`div`,{className:t.t(`flex-1 rounded-lg border p-3 space-y-2`,i),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:e}),(0,f.jsx)(`button`,{onClick:()=>o(a),className:`rounded-md bg-background border px-2 py-1 text-xs hover:bg-accent`,"aria-label":`Ajouter un acteur ${e}`,children:`+ Ajouter`})]}),u.length>0&&(0,f.jsxs)(`div`,{className:`text-xs text-red-600 border border-red-200 rounded p-1.5 bg-red-50 dark:bg-red-900/10`,children:[`Roles obligatoires manquants : `,u.join(`, `)]}),(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-background/80 px-2 py-1.5`,children:[(0,f.jsx)(SP,{role:e.role,name:e.userName,isPrimary:e.isPrimary}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`button`,{onClick:()=>c(e.id),className:`text-xs text-muted-foreground hover:text-foreground`,title:e.isPrimary?`Retirer principal`:`Marquer principal`,children:e.isPrimary?`★`:`☆`}),(0,f.jsx)(`button`,{onClick:()=>s(e.id),className:`text-xs text-red-500 hover:text-red-700 ml-1`,"aria-label":`Retirer ${e.userName}`,children:`×`})]})]},e.id)),n.length===0&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-2`,children:`Aucun acteur`})]})]})}function LP({wakaActors:e,ppActors:t,requiredWakaRoles:n,requiredPpRoles:r,onAdd:i,onRemove:a,onTogglePrimary:o}){return(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsx)(IP,{title:`Acteurs Waka`,actors:e,requiredRoles:n,bgClass:`bg-blue-50/50 dark:bg-blue-950/10`,side:`waka`,onAdd:i,onRemove:a,onTogglePrimary:o}),(0,f.jsx)(IP,{title:`Acteurs PP`,actors:t,requiredRoles:r,bgClass:`bg-emerald-50/50 dark:bg-emerald-950/10`,side:`pp`,onAdd:i,onRemove:a,onTogglePrimary:o})]})}function RP({label:e,value:n,colorClass:r,onClick:i}){return(0,f.jsxs)(`button`,{onClick:i,className:t.t(`inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors`,`hover:bg-accent`,r),children:[(0,f.jsx)(`span`,{children:e}),(0,f.jsx)(`span`,{className:`font-bold tabular-nums`,children:n})]})}function zP({stats:e,onExpand:t}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(RP,{label:`PP`,value:vP(e.ppMinutes),colorClass:`border-emerald-200 text-emerald-700 dark:text-emerald-400`,onClick:()=>t?.(`pp`)}),(0,f.jsx)(RP,{label:`Waka`,value:vP(e.wakaMinutes),colorClass:`border-blue-200 text-blue-700 dark:text-blue-400`,onClick:()=>t?.(`waka`)}),(0,f.jsx)(RP,{label:`Facturables`,value:(0,f.jsx)(bP,{remainingMinutes:e.billableTotalMinutes-e.billableMinutes,totalMinutes:e.billableTotalMinutes,className:`text-xs`}),colorClass:`border-amber-200`,onClick:()=>t?.(`billable`)})]})}function BP({open:e,onOpenChange:t,onSubmit:n,isLoading:r}){let[i,a]=s.useState(25),[o,c]=s.useState(``);return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-md`,children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Ajouter un pack d'heures`})}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(i<1||o.trim().length<10)&&(n(i,o.trim()),a(25),c(``))},className:`space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Nombre d'heures`}),(0,f.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Math.max(1,parseInt(e.target.value)||1)),className:`mt-1 w-full rounded-md border bg-background px-3 py-2 text-sm`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (obligatoire, min 10 chars)`}),(0,f.jsx)(`textarea`,{value:o,onChange:e=>c(e.target.value),placeholder:`Ex: Commande initiale Biped du 30 mars 2026`,className:`mt-1 w-full min-h-[80px] rounded-md border bg-background px-3 py-2 text-sm resize-none`}),o.length>0&&o.length<10&&(0,f.jsxs)(`p`,{className:`text-xs text-red-500 mt-1`,children:[10-o.length,` caracteres restants`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:`rounded-md border px-4 py-2 text-sm hover:bg-accent`,children:`Annuler`}),(0,f.jsx)(`button`,{type:`submit`,disabled:i<1||o.trim().length<10||r,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Ajouter`})]})]})]})})}function VP({consumptions:e,page:t,totalPages:n,onPageChange:r}){return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`border-b text-xs text-muted-foreground`,children:[(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Consultant`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Motif`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Etape`}),(0,f.jsx)(`th`,{className:`text-right p-2`,children:`Duree`})]})}),(0,f.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30`,children:[(0,f.jsx)(`td`,{className:`p-2 text-xs`,children:e.date}),(0,f.jsx)(`td`,{className:`p-2`,children:e.consultant}),(0,f.jsx)(`td`,{className:`p-2 truncate max-w-[200px]`,children:e.reason}),(0,f.jsx)(`td`,{className:`p-2 text-xs text-muted-foreground`,children:e.stepName??`—`}),(0,f.jsx)(`td`,{className:`p-2 text-right tabular-nums font-medium`,children:vP(e.minutes)})]},t)),e.length===0&&(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{colSpan:5,className:`p-4 text-center text-muted-foreground`,children:`Aucune consommation`})})]})]}),n>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,f.jsx)(`button`,{onClick:()=>r(t-1),disabled:t<=1,className:`rounded border px-2 py-1 text-xs disabled:opacity-50 hover:bg-accent`,children:`Precedent`}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t,`/`,n]}),(0,f.jsx)(`button`,{onClick:()=>r(t+1),disabled:t>=n,className:`rounded border px-2 py-1 text-xs disabled:opacity-50 hover:bg-accent`,children:`Suivant`})]})]})}var HP=s.createContext(void 0);function UP({children:e,languages:t,defaultLanguage:n=`fr`,s3Config:r,onLanguageChange:i}){let{i18n:a}=(0,H.useTranslation)(),[o,c]=s.useState(n),[l,u]=s.useState(!0),[d,p]=s.useState(new Set),[m,h]=s.useState(!1),g=s.useCallback(async e=>{if(!r)throw Error(`S3 configuration not provided`);let{baseUrl:t,prefix:n=``,extension:i=`json`,headers:a={}}=r,o=`${t.replace(/\/$/,``)}/${n}${e}.${i}`;console.log(`[LanguageProvider] Loading translations from S3: ${o}`);try{let t=await fetch(o,{headers:{Accept:`application/json`,...a}});if(!t.ok)throw Error(`Failed to load translations: ${t.status} ${t.statusText}`);let n=await t.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${e}`),n}catch(t){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${e}:`,t),t}},[r]);s.useEffect(()=>{m||!a||!r||(async()=>{try{let e=typeof window<`u`?localStorage.getItem(`language`):null,r=e&&t.some(t=>t.code===e)?e:n;console.log(`[LanguageProvider] Initializing with language: ${r}`);let i=await g(r);a.addResourceBundle&&a.addResourceBundle(r,`translation`,i,!0,!0),await a.changeLanguage(r),c(r),p(new Set([r])),h(!0),console.log(`[LanguageProvider] ✓ Initialized with ${r}`)}catch(e){console.error(`[LanguageProvider] Error initializing:`,e),h(!0)}finally{u(!1)}})()},[m,a,r,n,t,g]);let _={currentLanguage:o,languages:t,changeLanguage:s.useCallback(async e=>{if(e!==o){if(!a?.changeLanguage){console.error(`[LanguageProvider] i18next is not initialized`);return}if(!r){console.error(`[LanguageProvider] S3 config not provided`);return}u(!0);try{if(!d.has(e)){console.log(`[LanguageProvider] Loading ${e} from S3...`);let t=await g(e);a.addResourceBundle&&a.addResourceBundle(e,`translation`,t,!0,!0),p(t=>new Set([...t,e]))}await a.changeLanguage(e),c(e),typeof window<`u`&&localStorage.setItem(`language`,e),i?.(e),console.log(`[LanguageProvider] ✓ Language changed to: ${e}`)}catch(e){throw console.error(`[LanguageProvider] ✗ Error changing language:`,e),e}finally{u(!1)}}},[o,d,r,g,a,i]),isLoading:l,loadedLanguages:d};return(0,f.jsx)(HP.Provider,{value:_,children:e})}function WP(){let e=s.useContext(HP);if(!e)throw Error(`useLanguage must be used within a LanguageProvider`);return e}var GP=s.createContext(void 0);function KP({children:e,config:t}){let{defaultTheme:n=`light`,storageKey:r=`waka-ui-theme`,themes:i,enableSystem:a=!0,s3Config:o}=t||{},[c,l]=s.useState(n),[u,d]=s.useState(),[p,m]=s.useState([]),[h,g]=s.useState(!0),[_,v]=s.useState(`fallback`);s.useEffect(()=>{(async()=>{if(g(!0),i&&i.length>0){let e=qP(i);m(e),v(`config`),g(!1),console.log(`[ThemeProvider] Using themes from config:`,e.length);return}if(o?.baseUrl)try{let e=await JP(o.baseUrl);if(e.length>0){m(e),v(`s3`),g(!1),console.log(`[ThemeProvider] Loaded themes from S3:`,e.length);return}}catch(e){console.error(`[ThemeProvider] Failed to load themes from S3:`,e)}m([{id:`light`,label:`Clair`,previewColor:`#3b82f6`},{id:`dark`,label:`Sombre`,previewColor:`#1e293b`}]),v(`fallback`),g(!1),console.log(`[ThemeProvider] Using fallback themes`)})()},[i,o]),s.useEffect(()=>{if(!a)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{d(e.matches?`dark`:`light`)};return d(e.matches?`dark`:`light`),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[a]),s.useEffect(()=>{if(p.length===0)return;let e=localStorage.getItem(r),t=p.map(e=>e.id);e&&t.includes(e)&&l(e)},[r,p]),s.useEffect(()=>{if(p.length===0)return;let e=document.documentElement,t=c===`system`&&u?u:c;p.forEach(t=>e.classList.remove(t.id)),e.classList.add(t),e.setAttribute(`data-theme`,t),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Theme applied: ${t}`)},[c,u,p]);let y=s.useCallback(e=>{let t=p.map(e=>e.id);if(!t.includes(e)&&e!==`system`){console.warn(`[WakaUI] Theme "${e}" is not in the list of available themes:`,t);return}l(e),localStorage.setItem(r,e)},[p,r]),b=s.useMemo(()=>({theme:c,setTheme:y,themes:p,systemTheme:u,isLoadingThemes:h,themesSource:_}),[c,y,p,u,h,_]);return(0,f.jsx)(GP.Provider,{value:b,children:e})}function qP(e){return e.length===0?[]:typeof e[0]==`string`?e.map(e=>({id:e,label:YP(e),previewColor:XP(e)})):e}async function JP(e){try{let e=await fetch(`/api/themes/list`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).themes||[]}catch(e){return console.error(`[ThemeProvider] Failed to fetch themes from S3:`,e),[]}}function YP(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function XP(e){return{light:`#3b82f6`,dark:`#1e293b`,forest:`#10b981`,sunset:`#f59e0b`,twilight:`#8b5cf6`,monochrome:`#6b7280`,perpetuity:`#ec4899`}[e]||`#3b82f6`}function ZP(){let e=s.useContext(GP);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e}function QP({children:e,config:t}){let[n]=s.useState(()=>G.default.createInstance()),[r,i]=s.useState(!1);return s.useEffect(()=>{(async()=>{try{await n.use(H.initReactI18next).init({lng:t.language.defaultLanguage,fallbackLng:t.language.defaultLanguage,supportedLngs:t.language.supportedLanguages,resources:t.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:t.debug}),t.language.s3Config&&await $P(n,t.language.s3Config,t.language.supportedLanguages),i(!0),t.debug&&console.log(`[WakaUI] i18n initialized successfully`)}catch(e){console.error(`[WakaUI] Failed to initialize i18n:`,e),i(!0)}})()},[n,t]),s.useEffect(()=>{if(!r)return;let e=t.language.storageKey||`waka-ui-language`,i=localStorage.getItem(e);i&&t.language.supportedLanguages.includes(i)&&n.changeLanguage(i);let a=n=>{localStorage.setItem(e,n),t.debug&&console.log(`[WakaUI] Language changed to: ${n}`)};return n.on(`languageChanged`,a),()=>{n.off(`languageChanged`,a)}},[r,n,t]),r?(0,f.jsx)(H.I18nextProvider,{i18n:n,children:(0,f.jsx)(UP,{languages:t.language.languages||[],defaultLanguage:t.language.defaultLanguage,s3Config:t.language.s3Config?{baseUrl:t.language.s3Config.bucketUrl,prefix:t.language.s3Config.translationsPath?`${t.language.s3Config.translationsPath}/`:``,extension:`json`}:void 0,children:(0,f.jsx)(Or,{themes:t.theme?.themes||[{id:`default`,label:`Default`}],defaultTheme:t.theme?.defaultTheme||`default`,s3Config:t.theme?.s3Config,enableDarkMode:t.theme?.enableSystem,children:e})})}):(0,f.jsx)(`div`,{style:{padding:`20px`,textAlign:`center`},children:`Loading WakaUI...`})}async function $P(e,t,n){if(!t)return;let{bucketUrl:r,translationsPath:i=`translations`}=t;try{await Promise.all(n.map(async t=>{try{let n=`${r}/${i}/${t}.json`,a=await fetch(n);if(!a.ok){console.warn(`[WakaUI] Failed to load translations for ${t} from S3`);return}let o=await a.json();e.addResourceBundle(t,`translation`,o,!0,!0),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Loaded translations for ${t} from S3`)}catch(e){console.warn(`[WakaUI] Error loading translations for ${t}:`,e)}}))}catch(e){console.error(`[WakaUI] Error loading translations from S3:`,e)}}function eF(){let{i18n:e,t}=(0,H.useTranslation)(),n=WP(),r=Ar();return{currentLanguage:e.language||n.currentLanguage,changeLanguage:async t=>{await n.changeLanguage(t),await e.changeLanguage(t)},languages:n.languages,isLanguageLoading:n.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t}}var tF=s.createContext(void 0);function nF({children:e,initialSelection:t,onSelectionChange:n,persistKey:r=`admincrumb-selection`}){let[i,a]=s.useState(()=>{if(typeof window<`u`&&r){let e=localStorage.getItem(r);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse stored admincrumb selection`,e)}}return t||{}});s.useEffect(()=>{typeof window<`u`&&r&&localStorage.setItem(r,JSON.stringify(i))},[i,r]),s.useEffect(()=>{n?.(i)},[i,n]);let o=s.useCallback(e=>{a({partner:e,network:void 0,customer:void 0})},[]),c=s.useCallback(e=>{a(t=>({...t,network:e,customer:void 0}))},[]),l=s.useCallback(e=>{a(t=>({...t,customer:e}))},[]),u=s.useCallback(()=>{a({})},[]),d=s.useMemo(()=>!!(i.partner||i.network||i.customer),[i]),p=s.useCallback(()=>({...i.partner?.id&&{partnerId:i.partner.id},...i.network?.id&&{networkId:i.network.id},...i.customer?.id&&{customerId:i.customer.id}}),[i]),m=s.useMemo(()=>({selection:i,setPartner:o,setNetwork:c,setCustomer:l,reset:u,isFiltered:d,getFilterQuery:p}),[i,o,c,l,u,d,p]);return(0,f.jsx)(tF.Provider,{value:m,children:e})}function rF(){let e=s.useContext(tF);if(!e)throw Error(`useAdmincrumbContext must be used within AdmincrumbProvider`);return e}function iF(){return s.useContext(tF)}var aF={github:l.Github,twitter:l.Twitter,linkedin:l.Linkedin,email:l.Mail};function oF({columns:e=[],socialLinks:n=[],copyright:i=`© 2024 Tous droits réservés.`,className:a}){return(0,f.jsx)(`footer`,{className:t.t(`bg-muted/40`,a),children:(0,f.jsxs)(`div`,{className:`container mx-auto px-4 py-12`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4`,children:[e.map((e,t)=>(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,f.jsx)(`ul`,{className:`space-y-2`,children:e.links.map((e,t)=>(0,f.jsx)(`li`,{children:(0,f.jsx)(`a`,{href:e.href,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:e.label})},t))})]},t)),n.length>0&&(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Suivez-nous`}),(0,f.jsx)(`div`,{className:`flex space-x-4`,children:n.map((e,t)=>{let n=aF[e.platform];return(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-8 w-8`,children:(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.platform,children:(0,f.jsx)(n,{className:`h-4 w-4`})})},t)})})]})]}),(0,f.jsx)(r.t,{className:`my-8`}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i}),(0,f.jsxs)(`div`,{className:`flex space-x-6`,children:[(0,f.jsx)(`a`,{href:`/privacy`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Politique de confidentialité`}),(0,f.jsx)(`a`,{href:`/terms`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Conditions d'utilisation`})]})]})]})})}function sF({items:e,defaultActiveId:n,variant:r=`default`,size:i=`md`,className:a,onTabChange:o}){let[c,l]=s.useState(n||e[0]?.id||``),u=e=>{l(e),o?.(e)},d={sm:`h-8 px-3 text-sm`,md:`h-10 px-4 text-sm`,lg:`h-12 px-6 text-base`};return(0,f.jsx)(`div`,{className:t.t(`w-full`,a),children:(0,f.jsxs)(Cr,{value:c,onValueChange:u,children:[(0,f.jsx)(wr,{className:t.t(`grid w-full`,r===`pills`&&`grid-cols-auto`,r!==`pills`&&`grid-cols-${e.length}`,{default:`bg-background`,pills:`bg-muted rounded-full`,underline:`bg-transparent border-b-2 border-transparent data-[state=active]:border-primary`}[r]),children:e.map(e=>(0,f.jsx)(Tr,{value:e.id,disabled:e.disabled,className:t.t(d[i],r===`underline`&&`rounded-none border-b-2 border-transparent data-[state=active]:border-primary`,r===`pills`&&`rounded-full`),children:e.label},e.id))}),e.map(e=>(0,f.jsx)(Er,{value:e.id,className:`mt-6`,children:e.content},e.id))]})})}function cF({items:e,separator:n=`/`,className:r}){return(0,f.jsx)(`nav`,{className:t.t(`flex items-center space-x-1 text-sm text-muted-foreground`,r),children:e.map((e,t)=>(0,f.jsxs)(s.Fragment,{children:[t>0&&(0,f.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:n}),e.href?(0,f.jsx)(`a`,{href:e.href,className:`hover:text-foreground transition-colors`,children:e.label}):(0,f.jsx)(`span`,{className:`text-foreground font-medium`,children:e.label})]},t))})}function lF({variant:e=`dropdown`,showFlags:i=!0,className:a}){let{currentLanguage:o,languages:s,changeLanguage:c,isLoading:u}=WP(),d=s.find(e=>e.code===o);return e===`select`?(0,f.jsxs)(n.d,{value:o,onValueChange:c,disabled:u,children:[(0,f.jsx)(n.y,{className:t.t(`w-[180px]`,a),children:(0,f.jsxs)(n.b,{children:[i&&d?.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:d.flagEmoji}),d?.label]})}),(0,f.jsx)(n.f,{children:s.map(e=>(0,f.jsxs)(n.m,{value:e.code,children:[i&&e.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]}):(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:t.t(`gap-2`,a),disabled:u,children:[(0,f.jsx)(l.Globe,{className:`h-4 w-4`}),i&&d?.flagEmoji&&(0,f.jsx)(`span`,{children:d.flagEmoji}),d?.label]})}),(0,f.jsx)(an,{align:`end`,children:s.map(e=>(0,f.jsxs)($,{onClick:()=>c(e.code),className:`cursor-pointer`,children:[i&&e.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]})}function uF({children:e,header:n,sidebar:i,footer:a,collapsible:o=!1,className:c}){let[u,d]=s.useState(!1);return(0,f.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,c),children:[n&&(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`container flex h-14 max-w-screen-2xl items-center`,children:[o&&i&&(0,f.jsxs)(nr,{open:u,onOpenChange:d,children:[(0,f.jsx)(rr,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:`md:hidden`,children:[(0,f.jsx)(l.Menu,{className:`h-5 w-5`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]})}),(0,f.jsx)(cr,{side:`left`,className:`w-72 p-0`,children:(0,f.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,f.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Navigation`}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:()=>d(!1),children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:i})]})})]}),n]})}),(0,f.jsxs)(`div`,{className:`flex`,children:[i&&!o&&(0,f.jsx)(`aside`,{className:`hidden w-64 border-r bg-muted/40 md:block`,children:(0,f.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:i})}),(0,f.jsx)(`main`,{className:`flex-1`,children:(0,f.jsx)(`div`,{className:`container mx-auto p-4`,children:e})})]}),a&&(0,f.jsx)(`footer`,{className:`border-t bg-muted/40`,children:(0,f.jsx)(`div`,{className:`container mx-auto p-4`,children:a})})]})}function dF({config:e,onSubmit:n,onForgotPassword:a,onSignUp:o,onSSOGoogle:c,onSSOMicrosoft:u,onSSOApple:d,onSSOLinkedIn:p,onSSOGithub:m,onSSOFacebook:h,onSSOInstagram:g,onSSOFranceConnect:_,showSocialLogin:v=!1,className:y}){let b=!1;try{b=Ar().isDarkMode}catch{}let x=e?.theme_json?.dark_mode??b,[S,C]=s.useState({email:``,password:``,rememberMe:!1}),[w,T]=s.useState(!1),E=s.useMemo(()=>e?.assets?x?e.assets.theme_logo_dark:e.assets.theme_logo_light:null,[e?.assets,x]),D=s.useMemo(()=>e?.color_json?{"--login-primary":e.color_json.primary,"--login-secondary":e.color_json.secondary,"--login-accent":e.color_json.accent}:{},[e?.color_json]),O=s.useMemo(()=>{let t=[];if(!e?.signup_options)return v&&(m&&t.push({id:`github`,label:`GitHub`,icon:(0,f.jsx)(l.Github,{className:`h-4 w-4`}),onClick:m}),c&&t.push({id:`google`,label:`Google`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:c})),t;let n=e.signup_options;return n.allow_sso_google&&t.push({id:`google`,label:`Google`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:c}),n.allow_sso_microsoft&&t.push({id:`microsoft`,label:`Microsoft`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:u}),n.allow_sso_apple&&t.push({id:`apple`,label:`Apple`,icon:(0,f.jsx)(l.Apple,{className:`h-4 w-4`}),onClick:d}),n.allow_sso_linkedIn&&t.push({id:`linkedin`,label:`LinkedIn`,icon:(0,f.jsx)(l.Linkedin,{className:`h-4 w-4`}),onClick:p}),n.allow_sso_github&&t.push({id:`github`,label:`GitHub`,icon:(0,f.jsx)(l.Github,{className:`h-4 w-4`}),onClick:m}),n.allow_sso_facebook&&t.push({id:`facebook`,label:`Facebook`,icon:(0,f.jsx)(l.Facebook,{className:`h-4 w-4`}),onClick:h}),n.allow_sso_instagram&&t.push({id:`instagram`,label:`Instagram`,icon:(0,f.jsx)(l.Instagram,{className:`h-4 w-4`}),onClick:g}),n.allow_sso_france_connect&&t.push({id:`france-connect`,label:`France Connect`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:_}),t},[e?.signup_options,v,c,u,d,p,m,h,g,_]),k=e?.signup_options?.allow_login!==!1,A=async e=>{e.preventDefault(),T(!0);try{await n?.(S)}finally{T(!1)}},j=e=>t=>{C(n=>({...n,[e]:e===`rememberMe`?t.target.checked:t.target.value}))};return(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center p-4`,y),style:D,children:(0,f.jsxs)(Y,{className:`w-full max-w-md`,children:[(0,f.jsxs)(X,{className:`space-y-1`,children:[E&&(0,f.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,f.jsx)(`img`,{src:E,alt:e?.theme_json?.name||`Logo`,className:`max-h-16 max-w-full object-contain`})}),(0,f.jsx)(Z,{className:`text-2xl text-center`,children:`Connexion`}),(0,f.jsx)(Se,{className:`text-center`,children:`Entrez vos identifiants pour accéder à votre compte`})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[O.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:t.t(`grid gap-4`,O.length===1?`grid-cols-1`:`grid-cols-2`),children:O.map(e=>(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:e.onClick,type:`button`,children:[e.icon,e.label]},e.id))}),k&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,f.jsx)(r.t,{className:`w-full`})}),(0,f.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,f.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:`Ou continuez avec`})})]})]}),k&&(0,f.jsxs)(`form`,{onSubmit:A,className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`email`,children:`Email`}),(0,f.jsx)(r.n,{id:`email`,type:`email`,placeholder:`votre@email.com`,value:S.email,onChange:j(`email`),required:!0})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`password`,children:`Mot de passe`}),(0,f.jsx)(r.n,{id:`password`,type:`password`,placeholder:`••••••••`,value:S.password,onChange:j(`password`),required:!0})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,f.jsx)(`input`,{id:`remember`,type:`checkbox`,checked:S.rememberMe,onChange:j(`rememberMe`),className:`h-4 w-4 rounded border-gray-300`}),(0,f.jsx)(i.o,{htmlFor:`remember`,className:`text-sm`,children:`Se souvenir de moi`})]}),a&&(0,f.jsx)(r.r,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:a,children:`Mot de passe oublié ?`})]}),(0,f.jsx)(r.r,{type:`submit`,className:`w-full`,disabled:w,style:e?.color_json?.primary?{backgroundColor:e.color_json.primary,color:e.color_json.secondary}:void 0,children:w?`Connexion...`:`Se connecter`})]}),o&&(0,f.jsxs)(`div`,{className:`text-center text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Pas encore de compte ? `}),(0,f.jsx)(r.r,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:o,children:`S'inscrire`})]}),e?.waka_powered&&(0,f.jsx)(`div`,{className:`text-center text-xs text-muted-foreground mt-4 pt-4 border-t`,children:`Powered by Waka`})]})]})})}var fF=s.createContext(null);function pF(){let e=s.useContext(fF);if(!e)throw Error(`Sidebar components must be used within WakaSidebar`);return e}function mF({config:e}){let{LinkComponent:t}=pF(),n=e.component?e.component:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.src&&(0,f.jsx)(`img`,{src:e.src,alt:e.alt||`Logo`,className:`h-8 w-auto object-contain`}),e.title&&(0,f.jsx)(`span`,{className:`text-lg font-bold tracking-wide`,children:e.title})]});return e.href?t?(0,f.jsx)(t,{href:e.href,className:`block`,onClick:e.onClick,children:n}):(0,f.jsx)(`a`,{href:e.href,className:`block`,onClick:e.onClick,children:n}):e.onClick?(0,f.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`block text-left`,children:n}):(0,f.jsx)(`div`,{children:n})}function hF({item:e,isChild:n=!1,renderItem:r}){let{activeId:i,setActiveId:a,expandedIds:o,toggleExpanded:s,isMobile:c,closeOnNavigate:u,onClose:d,LinkComponent:p}=pF(),m=e.children&&e.children.length>0,h=o.includes(e.id),g=i===e.id||e.active,_=()=>{e.disabled||(m?s(e.id):(a(e.id),e.onClick?.(),c&&u&&d()))};if(r)return(0,f.jsx)(f.Fragment,{children:r(e,n)});let v=(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200`,`hover:bg-white/10`,g&&!m&&`bg-sidebar-active text-sidebar-active-foreground`,n&&`ml-6 text-[13px]`,e.disabled&&`opacity-50 cursor-not-allowed`),children:[e.icon&&(0,f.jsx)(`span`,{className:t.t(`flex-shrink-0`,n?`h-4 w-4`:`h-5 w-5`),children:e.icon}),(0,f.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge!==void 0&&(0,f.jsx)(`span`,{className:`ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground`,children:e.badge}),m&&(0,f.jsx)(l.ChevronDown,{className:t.t(`h-4 w-4 transition-transform duration-200`,h&&`rotate-180`)})]});if(m)return(0,f.jsxs)(pt,{open:h,onOpenChange:()=>s(e.id),children:[(0,f.jsx)(mt,{asChild:!0,children:(0,f.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,children:v})}),(0,f.jsx)(ht,{className:`space-y-1 pt-1`,children:e.children?.map(e=>(0,f.jsx)(hF,{item:e,isChild:!0,renderItem:r},e.id))})]});if(e.href){let t={href:e.href,className:`block`,onClick:t=>{if(e.disabled){t.preventDefault();return}_()}};return p?(0,f.jsx)(p,{...t,children:v}):(0,f.jsx)(`a`,{...t,children:v})}return(0,f.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,onClick:_,children:v})}function gF({config:e}){let{LinkComponent:n}=pF(),r=e.initials||e.name.split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),i=[{id:`profile`,label:`Profil`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`})},{id:`settings`,label:`Paramètres`,icon:(0,f.jsx)(l.Settings,{className:`h-4 w-4`})},{id:`logout`,label:`Déconnexion`,icon:(0,f.jsx)(l.LogOut,{className:`h-4 w-4`}),variant:`destructive`}],a=e.actions??i;return(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10`,children:[(0,f.jsxs)(ve,{className:`h-10 w-10 border-2 border-sidebar-active`,children:[(0,f.jsx)(ye,{src:e.avatarUrl,alt:e.name}),(0,f.jsx)(be,{className:`bg-sidebar-active text-sidebar-active-foreground text-sm font-medium`,children:r})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.name}),e.email&&(0,f.jsx)(`p`,{className:`text-xs text-sidebar-foreground/70 truncate`,children:e.email})]}),(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4 flex-shrink-0 opacity-70`})]})}),(0,f.jsx)(an,{align:`end`,className:`w-56`,children:a.map((e,r)=>(0,f.jsxs)(s.Fragment,{children:[e.variant===`destructive`&&r>0&&(0,f.jsx)(ln,{}),(0,f.jsx)($,{onClick:e.onClick,className:t.t(e.variant===`destructive`&&`text-destructive focus:text-destructive`),asChild:!!e.href,children:e.href?n?(0,f.jsxs)(n,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,f.jsxs)(`a`,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]})})]},e.id))})]})}function _F({logo:e,menu:t,user:n,userPosition:r=`bottom`,header:i,footer:a,renderItem:o}){return(0,f.jsxs)(`div`,{className:`flex h-full flex-col`,children:[e&&(0,f.jsx)(`div`,{className:`flex-shrink-0 p-4 pb-2`,children:(0,f.jsx)(mF,{config:e})}),i&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2`,children:i}),n&&r===`top`&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-3 py-2 border-b border-white/10`,children:(0,f.jsx)(gF,{config:n})}),(0,f.jsx)(er,{className:`flex-1 px-3 py-4`,children:(0,f.jsx)(`nav`,{className:`space-y-1`,children:t.map(e=>(0,f.jsx)(hF,{item:e,renderItem:o},e.id))})}),a&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2 border-t border-white/10`,children:a}),n&&r===`bottom`&&(0,f.jsx)(`div`,{className:`flex-shrink-0 p-3 border-t border-white/10`,children:(0,f.jsx)(gF,{config:n})})]})}function vF({logo:e,menu:n,user:i,width:a=260,mobileBreakpoint:o=768,open:c,onOpenChange:u,className:d,contentClassName:p,backgroundColor:m,textColor:h,activeColor:g,hoverColor:_,userPosition:v=`bottom`,showHamburger:y=!0,hamburgerPosition:b=`left`,renderItem:x,footer:S,header:C,position:w=`fixed`,LinkComponent:T}){let[E,D]=s.useState(!1),O=c!==void 0,k=O?c:E,A=O?u:D,[j,M]=s.useState(!1);s.useEffect(()=>{let e=()=>{M(window.innerWidth<o)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let[N,P]=s.useState(()=>{let e=t=>{for(let n of t){if(n.active)return n.id;if(n.children){let t=e(n.children);if(t)return t}}return null};return e(n)}),[F,I]=s.useState(()=>{let e=(t,n=[])=>{for(let r of t){if(r.active)return n;if(r.children){let t=e(r.children,[...n,r.id]);if(t.length>n.length)return t}}return[]};return e(n)}),L={activeId:N,setActiveId:P,expandedIds:F,toggleExpanded:s.useCallback(e=>{I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),isMobile:j,closeOnNavigate:!0,onClose:()=>A(!1),LinkComponent:T},R={"--sidebar-bg":m||`hsl(var(--sidebar-background, var(--card)))`,"--sidebar-text":h||`hsl(var(--sidebar-foreground, var(--muted-foreground)))`,"--sidebar-active":g||`hsl(var(--sidebar-primary, var(--primary)))`,"--sidebar-active-foreground":`hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))`,"--sidebar-hover":_||`hsl(var(--sidebar-accent, var(--accent)))`},z=t.t(`bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]`,`[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]`,`[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]`,`[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]`,`[&_.text-sidebar-foreground\\/70]:opacity-70`,`[&_.border-sidebar-active]:border-[var(--sidebar-active)]`,p),B=(0,f.jsx)(fF.Provider,{value:L,children:(0,f.jsx)(`div`,{className:t.t(`h-full`,z),style:R,children:(0,f.jsx)(_F,{logo:e,menu:n,user:i,userPosition:v,header:C,footer:S,renderItem:x})})});return(0,f.jsxs)(f.Fragment,{children:[y&&j&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:t.t(`fixed top-3 z-50`,b===`left`?`left-3`:`right-3`),onClick:()=>A(!0),children:[(0,f.jsx)(l.Menu,{className:`h-6 w-6`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]}),!j&&(0,f.jsx)(`aside`,{className:t.t(w===`fixed`?`fixed left-0 top-0 h-screen z-40`:`relative h-full`,d),style:{width:a},children:B}),j&&(0,f.jsx)(nr,{open:k,onOpenChange:A,children:(0,f.jsxs)(cr,{side:`left`,className:t.t(`w-[280px] p-0 border-0`,d),style:R,"aria-describedby":`sidebar-description`,children:[(0,f.jsx)(dr,{className:`sr-only`,children:`Menu de navigation`}),(0,f.jsx)(fr,{id:`sidebar-description`,className:`sr-only`,children:`Menu principal de l'application`}),B]})})]})}function yF(){let[e,t]=s.useState(!1);return{isOpen:e,setIsOpen:t,open:s.useCallback(()=>t(!0),[]),close:s.useCallback(()=>t(!1),[]),toggle:s.useCallback(()=>t(e=>!e),[])}}function bF({sidebar:e,children:n,sidebarWidth:r=260,className:i,contentClassName:a}){let[o,c]=s.useState(!1),l=e.mobileBreakpoint||768;return s.useEffect(()=>{let e=()=>c(window.innerWidth<l);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]),(0,f.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,i),children:[(0,f.jsx)(vF,{...e,width:r}),(0,f.jsx)(`main`,{className:t.t(`min-h-screen transition-all duration-300`,a),style:{marginLeft:o?0:r},children:n})]})}function xF({title:e,subtitle:i,showSearch:a=!0,searchPlaceholder:o=`Rechercher...`,searchValue:c,onSearchChange:u,onSearchSubmit:d,primaryAction:p,secondaryActions:m,filters:h,notifications:g,unreadCount:_=0,onNotificationsClick:v,userMenu:y,leftContent:b,rightContent:x,filterContent:S,className:C,mainBarClassName:w,filterBarClassName:T,sticky:E=!0}){let[D,O]=s.useState(c||``),k=e=>{let t=e.target.value;O(t),u?.(t)},A=e=>{e.key===`Enter`&&d?.(D)},j=h&&h.length>0||S;return(0,f.jsxs)(`header`,{className:t.t(`w-full bg-background border-b`,E&&`sticky top-0 z-50`,C),children:[(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-4 px-4 py-2 min-h-[56px]`,w),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[p&&(0,f.jsxs)(r.r,{variant:p.variant||`default`,size:`sm`,onClick:p.onClick,className:`gap-2`,children:[p.icon||(0,f.jsx)(l.Plus,{className:`h-4 w-4`}),p.label]}),a&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{type:`search`,placeholder:o,value:D,onChange:k,onKeyDown:A,className:`pl-9 w-[200px] h-9 bg-muted/50`})]}),b]}),(e||i)&&(0,f.jsxs)(`div`,{className:`flex-1 text-center`,children:[e&&(0,f.jsx)(`h1`,{className:`text-lg font-semibold leading-none`,children:e}),i&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:i})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-auto`,children:[m?.map(e=>(0,f.jsxs)(r.r,{variant:e.variant||`ghost`,size:`sm`,onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},e.id)),x,(g||v)&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:`relative`,onClick:g?void 0:v,children:[(0,f.jsx)(l.Bell,{className:`h-5 w-5`}),_>0&&(0,f.jsx)(n.x,{variant:`destructive`,className:`absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs`,children:_>9?`9+`:_})]})}),g&&g.length>0&&(0,f.jsxs)(an,{align:`end`,className:`w-80`,children:[(0,f.jsx)(`div`,{className:`p-2 font-semibold border-b`,children:`Notifications`}),g.slice(0,5).map(e=>(0,f.jsxs)($,{onClick:e.onClick,className:t.t(`flex flex-col items-start gap-1 p-3`,!e.read&&`bg-muted/50`),children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.title}),e.description&&(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.description}),e.time&&(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.time})]},e.id))]})]}),y&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`gap-2`,children:[(0,f.jsxs)(ve,{className:`h-7 w-7`,children:[y.avatar&&(0,f.jsx)(ye,{src:y.avatar,alt:y.name}),(0,f.jsx)(be,{className:`text-xs`,children:y.initials||y.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4`})]})}),(0,f.jsxs)(an,{align:`end`,className:`w-56`,children:[(0,f.jsxs)(`div`,{className:`p-2`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:y.name}),y.email&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.email})]}),(0,f.jsx)(ln,{}),y.items.map((e,t)=>e.separator?(0,f.jsx)(ln,{},t):(0,f.jsxs)($,{onClick:e.onClick,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]},t))]})]})]})]}),j&&(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-2 px-4 py-2 border-t bg-muted/30`,T),children:[h?.map(e=>(0,f.jsxs)(n.d,{value:e.value,onValueChange:e.onChange,children:[(0,f.jsxs)(n.y,{className:`w-auto h-8 gap-2 bg-muted/50 border-0`,children:[e.icon,(0,f.jsx)(n.b,{placeholder:e.placeholder||e.label})]}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]},e.id)),S]})]})}var SF=s.createContext({});function CF(){return s.useContext(SF)}function wF({title:e=`Tableau de bord`,description:n,period:i,onPeriodChange:a,periods:o=[{value:`today`,label:`Aujourd'hui`},{value:`week`,label:`Cette semaine`},{value:`month`,label:`Ce mois`},{value:`year`,label:`Cette année`}],onRefresh:s,loading:c,quickActions:u}){return(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[a&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(l.Calendar,{className:`mr-2 h-4 w-4`}),o.find(e=>e.value===i)?.label||`Période`]})}),(0,f.jsx)(an,{align:`end`,children:o.map(e=>(0,f.jsx)($,{onClick:()=>a(e.value),className:t.t(i===e.value&&`bg-muted`),children:e.label},e.value))})]}),s&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:s,disabled:c,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,c&&`animate-spin`)})}),u?.map(e=>{let{LinkComponent:t}=CF();return(0,f.jsx)(r.r,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,f.jsxs)(t,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},e.id)})]})]})}function TF({stats:e,layout:t=`grid`,columns:n=4,loading:r}){return(0,f.jsx)(Wo,{layout:t,columns:n,gap:`md`,children:e.map(e=>(0,f.jsx)(Uo,{label:e.label,value:e.value,trend:e.trend,trendValue:e.trendValue,trendText:e.trendText,icon:e.icon,color:e.color,variant:`card`,loading:r},e.id))})}function EF({config:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsx)(an,{align:`end`,children:e.actions.map((e,t)=>(0,f.jsx)($,{onClick:e.onClick,children:e.label},t))})]})]}),(0,f.jsx)(Q,{children:e.chart})]})}function DF({config:e}){let{LinkComponent:t}=CF();return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,f.jsx)(`div`,{className:`flex gap-2`,children:e.actions.map((e,n)=>(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,f.jsxs)(t,{href:e.href,children:[e.label,(0,f.jsx)(l.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.label,(0,f.jsx)(l.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):e.label},n))})]}),(0,f.jsx)(Q,{children:e.table})]})}function OF({activities:e}){let n=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<1?`À l'instant`:r<60?`Il y a ${r} min`:i<24?`Il y a ${i}h`:a<7?`Il y a ${a}j`:t.toLocaleDateString(`fr-FR`)},r={info:`bg-blue-500`,success:`bg-green-500`,warning:`bg-yellow-500`,error:`bg-red-500`};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsx)(Z,{className:`text-base`,children:`Activité récente`})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full mt-2 flex-shrink-0`,r[e.type||`info`])}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:n(e.timestamp)})]},e.id))})})]})}function kF({title:e=`Tableau de bord`,description:n,stats:r,charts:i,tables:a,activities:o,quickActions:c,showHeader:l=!0,onRefresh:u,loading:d=!1,period:p=`month`,onPeriodChange:m,periods:h,statsLayout:g=`grid`,statsColumns:_=4,className:v,LinkComponent:y}){let b=s.useMemo(()=>({LinkComponent:y}),[y]);return(0,f.jsx)(SF.Provider,{value:b,children:(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[l&&(0,f.jsx)(wF,{title:e,description:n,period:p,onPeriodChange:m,periods:h,onRefresh:u,loading:d,quickActions:c}),r&&r.length>0&&(0,f.jsx)(TF,{stats:r,layout:g,columns:_,loading:d}),i&&i.length>0&&(0,f.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:i.map(e=>(0,f.jsx)(EF,{config:e},e.id))}),(0,f.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[a&&a.length>0&&(0,f.jsx)(`div`,{className:t.t(`space-y-6`,o?`lg:col-span-2`:`lg:col-span-3`),children:a.map(e=>(0,f.jsx)(DF,{config:e},e.id))}),o&&o.length>0&&(0,f.jsx)(`div`,{className:t.t(!a||a.length===0?`lg:col-span-3`:``),children:(0,f.jsx)(OF,{activities:o})})]})]})})}var AF=[{id:`revenue`,label:`Revenus`,value:`€45,231.89`,trend:`up`,trendValue:`+20.1%`,trendText:`vs mois dernier`,icon:(0,f.jsx)(l.DollarSign,{className:`h-5 w-5`}),color:`success`},{id:`users`,label:`Utilisateurs`,value:`2,350`,trend:`up`,trendValue:`+180`,trendText:`cette semaine`,icon:(0,f.jsx)(l.Users,{className:`h-5 w-5`}),color:`blue`},{id:`orders`,label:`Commandes`,value:`12,234`,trend:`down`,trendValue:`-4.3%`,trendText:`vs mois dernier`,icon:(0,f.jsx)(l.ShoppingCart,{className:`h-5 w-5`}),color:`purple`},{id:`performance`,label:`Performance`,value:`94.2%`,trend:`up`,trendValue:`+2.4%`,icon:(0,f.jsx)(l.Activity,{className:`h-5 w-5`}),color:`primary`}];function jF({field:e,value:t,onChange:a}){let o=e=>{a?.(e)};return e.type===`custom`&&e.customComponent?(0,f.jsx)(`div`,{className:`space-y-2`,children:e.customComponent}):(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(i.o,{htmlFor:e.id,className:`text-sm font-medium`,children:[e.label,e.required&&(0,f.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.type===`switch`&&(0,f.jsx)(mr,{id:e.id,checked:t,onCheckedChange:o,disabled:e.disabled})]}),e.description&&e.type!==`switch`&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`switch`&&e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`text`&&(0,f.jsx)(r.n,{id:e.id,type:`text`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`email`&&(0,f.jsx)(r.n,{id:e.id,type:`email`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`password`&&(0,f.jsx)(r.n,{id:e.id,type:`password`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`textarea`&&(0,f.jsx)(i.n,{id:e.id,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled,rows:3}),e.type===`select`&&e.options&&(0,f.jsxs)(n.d,{value:t,onValueChange:o,disabled:e.disabled,children:[(0,f.jsx)(n.y,{id:e.id,children:(0,f.jsx)(n.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]})}function MF({section:e,values:t,onChange:n}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]})]})}),(0,f.jsx)(Q,{className:`space-y-6`,children:e.fields.map((i,a)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(jF,{field:i,value:t?.[i.id],onChange:e=>n?.(i.id,e)}),a<e.fields.length-1&&(0,f.jsx)(r.t,{className:`my-4`})]},i.id))})]})}function NF({title:e=`Paramètres`,description:n=`Gérez les paramètres de votre compte et de l'application.`,tabs:i,sections:a,useTabs:o=!0,defaultTab:c,values:u={},onChange:d,onSave:p,saving:m=!1,showSaveButton:h=!0,showDeleteAccount:g=!1,onDeleteAccount:_,className:v}){let[y,b]=s.useState(u),[x,S]=s.useState(!1);s.useEffect(()=>{b(u)},[u]);let C=(e,t)=>{b(n=>({...n,[e]:t})),S(!0),d?.(e,t)},w=async()=>{await p?.(y),S(!1)},T=e=>(0,f.jsx)(`div`,{className:`space-y-6`,children:e.map(e=>(0,f.jsx)(MF,{section:e,values:y,onChange:C},e.id))});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),h&&p&&(0,f.jsxs)(r.r,{onClick:w,disabled:m||!x,children:[m?(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,f.jsx)(l.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}),o&&i&&i.length>0?(0,f.jsxs)(Cr,{defaultValue:c||i[0].id,className:`space-y-6`,children:[(0,f.jsx)(wr,{className:`grid w-full grid-cols-2 md:w-auto md:inline-flex`,children:i.map(e=>(0,f.jsxs)(Tr,{value:e.id,className:`gap-2`,children:[e.icon,e.label]},e.id))}),i.map(e=>(0,f.jsx)(Er,{value:e.id,className:`space-y-6`,children:T(e.sections)},e.id))]}):a&&T(a),g&&_&&(0,f.jsxs)(Y,{className:`border-destructive`,children:[(0,f.jsxs)(X,{children:[(0,f.jsxs)(Z,{className:`text-base text-destructive flex items-center gap-2`,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4`}),`Zone dangereuse`]}),(0,f.jsx)(Se,{children:`Actions irréversibles concernant votre compte.`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(ne,{children:[(0,f.jsx)(re,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer mon compte`]})}),(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Êtes-vous sûr ?`}),(0,f.jsx)(ue,{children:`Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées.`})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:_,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer définitivement`})]})]})]})})]})]})}var PF=[{id:`profile`,label:`Profil`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`}),sections:[{id:`personal`,title:`Informations personnelles`,description:`Mettez à jour vos informations personnelles.`,icon:(0,f.jsx)(l.User,{className:`h-5 w-5`}),fields:[{id:`name`,label:`Nom complet`,type:`text`,placeholder:`Jean Dupont`,required:!0},{id:`email`,label:`Adresse email`,type:`email`,placeholder:`jean@exemple.com`,required:!0},{id:`bio`,label:`Bio`,type:`textarea`,placeholder:`Parlez-nous de vous...`}]}]},{id:`notifications`,label:`Notifications`,icon:(0,f.jsx)(l.Bell,{className:`h-4 w-4`}),sections:[{id:`email-notifs`,title:`Notifications par email`,description:`Gérez vos préférences de notification par email.`,icon:(0,f.jsx)(l.Mail,{className:`h-5 w-5`}),fields:[{id:`notif-marketing`,label:`Marketing`,description:`Recevoir des emails marketing et promotionnels.`,type:`switch`},{id:`notif-security`,label:`Sécurité`,description:`Recevoir des alertes de sécurité importantes.`,type:`switch`},{id:`notif-updates`,label:`Mises à jour`,description:`Recevoir les mises à jour de produit.`,type:`switch`}]}]},{id:`security`,label:`Sécurité`,icon:(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),sections:[{id:`password`,title:`Mot de passe`,description:`Changez votre mot de passe.`,icon:(0,f.jsx)(l.Lock,{className:`h-5 w-5`}),fields:[{id:`current-password`,label:`Mot de passe actuel`,type:`password`,placeholder:`••••••••`},{id:`new-password`,label:`Nouveau mot de passe`,type:`password`,placeholder:`••••••••`},{id:`confirm-password`,label:`Confirmer le mot de passe`,type:`password`,placeholder:`••••••••`}]},{id:`two-factor`,title:`Authentification à deux facteurs`,description:`Ajoutez une couche de sécurité supplémentaire.`,icon:(0,f.jsx)(l.Smartphone,{className:`h-5 w-5`}),fields:[{id:`2fa-enabled`,label:`Activer la 2FA`,description:`Utilisez une application d'authentification.`,type:`switch`}]}]},{id:`preferences`,label:`Préférences`,icon:(0,f.jsx)(l.Palette,{className:`h-4 w-4`}),sections:[{id:`appearance`,title:`Apparence`,description:`Personnalisez l'apparence de l'application.`,icon:(0,f.jsx)(l.Palette,{className:`h-5 w-5`}),fields:[{id:`theme`,label:`Thème`,type:`select`,options:[{value:`light`,label:`Clair`},{value:`dark`,label:`Sombre`},{value:`system`,label:`Système`}]},{id:`language`,label:`Langue`,type:`select`,options:[{value:`fr`,label:`Français`},{value:`en`,label:`English`},{value:`es`,label:`Español`}]}]}]}];function FF({url:e,name:n,size:i=`lg`,editable:a,onAvatarChange:o}){let c=s.useRef(null),u={sm:`h-12 w-12`,md:`h-16 w-16`,lg:`h-24 w-24`,xl:`h-32 w-32`},d=n.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(`div`,{className:`relative inline-block`,children:[(0,f.jsxs)(ve,{className:t.t(u[i],`border-4 border-background shadow-lg`),children:[(0,f.jsx)(ye,{src:e,alt:n}),(0,f.jsx)(be,{className:`text-lg font-medium`,children:d})]}),a&&o&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`input`,{ref:c,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&o&&o(t)},className:`hidden`}),(0,f.jsx)(r.r,{size:`icon`,variant:`secondary`,className:`absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md`,onClick:()=>c.current?.click(),children:(0,f.jsx)(l.Camera,{className:`h-4 w-4`})})]})]})}function IF({field:e,value:a,onChange:o,isEditing:s}){if(!s)return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsx)(`span`,{className:t.t(!a&&`text-muted-foreground italic`),children:a||`Non renseigné`})]});let c={id:e.id,value:a||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled};return e.type===`textarea`?(0,f.jsx)(i.n,{...c,rows:3}):e.type===`select`&&e.options?(0,f.jsxs)(n.d,{value:a,onValueChange:o,disabled:e.disabled,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]}):(0,f.jsx)(r.n,{type:e.type||`text`,...c})}function LF({section:e,values:t,onChange:n,isEditing:a}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]})]})}),(0,f.jsx)(Q,{className:`space-y-4`,children:e.fields.map((o,c)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(i.o,{htmlFor:o.id,className:`text-sm font-medium`,children:[o.label,o.required&&(0,f.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,f.jsx)(IF,{field:o,value:t[o.id]||``,onChange:e=>n(o.id,e),isEditing:a})]}),c<e.fields.length-1&&a&&(0,f.jsx)(r.t,{className:`my-4`})]},o.id))})]})}function RF({links:e,isEditing:t}){let n=e=>{switch(e){case`twitter`:return(0,f.jsx)(l.Twitter,{className:`h-4 w-4`});case`github`:return(0,f.jsx)(l.Github,{className:`h-4 w-4`});case`linkedin`:return(0,f.jsx)(l.Linkedin,{className:`h-4 w-4`});case`website`:return(0,f.jsx)(l.Globe,{className:`h-4 w-4`});default:return(0,f.jsx)(l.Link,{className:`h-4 w-4`})}};return t?(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n(e.type),(0,f.jsx)(r.n,{value:e.url,className:`flex-1`,readOnly:!0})]},e.id))}):(0,f.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:e.map(e=>(0,f.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors`,children:[n(e.type),(0,f.jsx)(`span`,{children:e.label||e.type})]},e.id))})}function zF({profile:e,editable:n=!1,isEditing:i,onEditToggle:a,onChange:o,onSave:c,saving:u=!1,onAvatarChange:d,customSections:p,showSocialLinks:m=!0,showStats:h=!1,stats:g,layout:_=`card`,useTabs:v=!1,className:y}){let[b,x]=s.useState(!1),[S,C]=s.useState(e),w=i??b;s.useEffect(()=>{C(e)},[e]);let T=t=>{a?a(t):x(t),t||C(e)},E=(e,t)=>{C(n=>({...n,[e]:t})),o?.(e,t)},D=async()=>{await c?.(S),T(!1)},O=[{id:`personal`,title:`Informations personnelles`,icon:(0,f.jsx)(l.User,{className:`h-5 w-5`}),fields:[{id:`firstName`,label:`Prénom`,value:S.firstName||``,type:`text`,placeholder:`Jean`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`})},{id:`lastName`,label:`Nom`,value:S.lastName||``,type:`text`,placeholder:`Dupont`},{id:`email`,label:`Email`,value:S.email,type:`email`,placeholder:`jean@exemple.com`,required:!0,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`})},{id:`phone`,label:`Téléphone`,value:S.phone||``,type:`tel`,placeholder:`+33 6 12 34 56 78`,icon:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})},{id:`bio`,label:`Bio`,value:S.bio||``,type:`textarea`,placeholder:`Parlez-nous de vous...`}]},{id:`professional`,title:`Informations professionnelles`,icon:(0,f.jsx)(l.Briefcase,{className:`h-5 w-5`}),fields:[{id:`role`,label:`Poste`,value:S.role||``,type:`text`,placeholder:`Développeur Senior`,icon:(0,f.jsx)(l.Briefcase,{className:`h-4 w-4`})},{id:`department`,label:`Département`,value:S.department||``,type:`text`,placeholder:`Engineering`},{id:`company`,label:`Entreprise`,value:S.company||``,type:`text`,placeholder:`Acme Inc.`,icon:(0,f.jsx)(l.Building,{className:`h-4 w-4`})},{id:`location`,label:`Localisation`,value:S.location||``,type:`text`,placeholder:`Paris, France`,icon:(0,f.jsx)(l.MapPin,{className:`h-4 w-4`})},{id:`website`,label:`Site web`,value:S.website||``,type:`url`,placeholder:`https://exemple.com`,icon:(0,f.jsx)(l.Globe,{className:`h-4 w-4`})}]}],k=p||O,A={firstName:S.firstName||``,lastName:S.lastName||``,email:S.email,phone:S.phone||``,bio:S.bio||``,role:S.role||``,department:S.department||``,company:S.company||``,location:S.location||``,website:S.website||``,...S.customFields};if(_===`compact`)return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-4`,y),children:[(0,f.jsx)(FF,{url:S.avatarUrl,name:S.displayName,size:`md`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:S.displayName}),S.role&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.role}),S.email&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]})]});let j=()=>(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 md:flex-row md:text-left`,children:[(0,f.jsx)(FF,{url:S.avatarUrl,name:S.displayName,size:`xl`,editable:n&&w,onAvatarChange:d}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-start md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:S.displayName}),S.role&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:S.role}),S.company&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Building,{className:`h-3 w-3`}),S.company]}),S.location&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MapPin,{className:`h-3 w-3`}),S.location]})]}),n&&(0,f.jsx)(`div`,{className:`flex gap-2`,children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>T(!1),disabled:u,children:[(0,f.jsx)(l.X,{className:`mr-2 h-4 w-4`}),`Annuler`]}),(0,f.jsxs)(r.r,{size:`sm`,onClick:D,disabled:u,children:[u?(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,f.jsx)(l.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}):(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>T(!0),children:[(0,f.jsx)(l.Edit3,{className:`mr-2 h-4 w-4`}),`Modifier`]})})]}),h&&g&&g.length>0&&(0,f.jsx)(`div`,{className:`flex gap-6 mt-4`,children:g.map((e,t)=>(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.label})]},t))}),m&&S.socialLinks&&S.socialLinks.length>0&&(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(RF,{links:S.socialLinks,isEditing:w})}),S.joinedAt&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4 flex items-center gap-1`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3`}),`Membre depuis`,` `,new Date(S.joinedAt).toLocaleDateString(`fr-FR`,{month:`long`,year:`numeric`})]})]})]}),M=()=>(0,f.jsx)(`div`,{className:`space-y-6`,children:k.map(e=>(0,f.jsx)(LF,{section:e,values:A,onChange:E,isEditing:w},e.id))});return _===`card`?(0,f.jsx)(Y,{className:y,children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-6`,children:[j(),(0,f.jsx)(r.t,{}),M()]})})}):(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[j(),v?(0,f.jsxs)(Cr,{defaultValue:k[0]?.id,className:`space-y-6`,children:[(0,f.jsx)(wr,{children:k.map(e=>(0,f.jsxs)(Tr,{value:e.id,className:`gap-2`,children:[e.icon,e.title]},e.id))}),k.map(e=>(0,f.jsx)(Er,{value:e.id,children:(0,f.jsx)(LF,{section:e,values:A,onChange:E,isEditing:w})},e.id))]}):M()]})}var BF={displayName:`Jean Dupont`,firstName:`Jean`,lastName:`Dupont`,email:`jean.dupont@exemple.com`,phone:`+33 6 12 34 56 78`,bio:`Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.`,avatarUrl:``,role:`Lead Developer`,department:`Engineering`,company:`Acme Inc.`,location:`Paris, France`,website:`https://jeandupont.dev`,joinedAt:new Date(`2023-01-15`),socialLinks:[{id:`1`,type:`twitter`,url:`https://twitter.com/jeandupont`,label:`@jeandupont`},{id:`2`,type:`github`,url:`https://github.com/jeandupont`,label:`jeandupont`},{id:`3`,type:`linkedin`,url:`https://linkedin.com/in/jeandupont`,label:`Jean Dupont`}]},VF=[{value:`admin`,label:`Administrateur`,color:`destructive`},{value:`moderator`,label:`Modérateur`,color:`warning`},{value:`user`,label:`Utilisateur`,color:`default`},{value:`guest`,label:`Invité`,color:`secondary`}],HF={active:{label:`Actif`,color:`bg-green-500`,icon:l.CheckCircle},inactive:{label:`Inactif`,color:`bg-gray-500`,icon:l.XCircle},pending:{label:`En attente`,color:`bg-yellow-500`,icon:l.Mail},banned:{label:`Banni`,color:`bg-red-500`,icon:l.Ban}};function UF({user:e,size:t=`sm`}){let n={sm:`h-8 w-8`,md:`h-10 w-10`},r=e.displayName.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(ve,{className:n[t],children:[(0,f.jsx)(ye,{src:e.avatarUrl,alt:e.displayName}),(0,f.jsx)(be,{className:`text-xs`,children:r})]})}function WF({role:e,roles:t=VF}){let r=t.find(t=>t.value===e),i=e===`admin`?l.ShieldAlert:e===`moderator`?l.ShieldCheck:l.Shield;return(0,f.jsxs)(n.x,{variant:r?.color,children:[(0,f.jsx)(i,{className:`h-3 w-3 mr-1`}),r?.label||e]})}function GF({status:e}){let n=HF[e];return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,n.color)}),(0,f.jsx)(`span`,{className:`text-sm`,children:n.label})]})}function KF({open:e,onOpenChange:t,user:a,roles:o,permissions:c,onSubmit:u,loading:d}){let[p,m]=s.useState({email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]});s.useEffect(()=>{m(a?{email:a.email,displayName:a.displayName,firstName:a.firstName||``,lastName:a.lastName||``,role:a.role,status:a.status,permissions:a.permissions||[]}:{email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]})},[a,e]);let h=async e=>{e.preventDefault(),await u(p),t(!1)},g=e=>{m(t=>({...t,permissions:t.permissions?.includes(e)?t.permissions.filter(t=>t!==e):[...t.permissions||[],e]}))};return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsx)(xt,{className:`sm:max-w-[500px]`,children:(0,f.jsxs)(`form`,{onSubmit:h,children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:a?`Modifier l'utilisateur`:`Créer un utilisateur`}),(0,f.jsx)(Tt,{children:a?`Modifiez les informations de l'utilisateur.`:`Remplissez les informations pour créer un nouvel utilisateur.`})]}),(0,f.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`firstName`,children:`Prénom`}),(0,f.jsx)(r.n,{id:`firstName`,value:p.firstName,onChange:e=>m(t=>({...t,firstName:e.target.value})),placeholder:`Jean`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`lastName`,children:`Nom`}),(0,f.jsx)(r.n,{id:`lastName`,value:p.lastName,onChange:e=>m(t=>({...t,lastName:e.target.value})),placeholder:`Dupont`})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`displayName`,children:`Nom d'affichage *`}),(0,f.jsx)(r.n,{id:`displayName`,value:p.displayName,onChange:e=>m(t=>({...t,displayName:e.target.value})),placeholder:`Jean Dupont`,required:!0})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`email`,children:`Email *`}),(0,f.jsx)(r.n,{id:`email`,type:`email`,value:p.email,onChange:e=>m(t=>({...t,email:e.target.value})),placeholder:`jean@exemple.com`,required:!0})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`role`,children:`Rôle`}),(0,f.jsxs)(n.d,{value:p.role,onValueChange:e=>m(t=>({...t,role:e})),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:o.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`status`,children:`Statut`}),(0,f.jsxs)(n.d,{value:p.status,onValueChange:e=>m(t=>({...t,status:e})),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(HF).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t.label},e))})]})]})]}),c&&c.length>0&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Permissions`}),(0,f.jsx)(`div`,{className:`border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto`,children:c.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,f.jsx)(we,{id:e.id,checked:p.permissions?.includes(e.id),onCheckedChange:()=>g(e.id)}),(0,f.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:e.name})]},e.id))})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Annuler`}),(0,f.jsxs)(r.r,{type:`submit`,disabled:d,children:[d&&(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),a?`Enregistrer`:`Créer`]})]})]})})})}function qF({user:e,onEdit:t,onDelete:n,onResetPassword:i,onStatusChange:a,onRoleChange:o,roles:s}){return(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[t&&(0,f.jsxs)($,{onClick:t,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),i&&(0,f.jsxs)($,{onClick:i,children:[(0,f.jsx)(l.Key,{className:`mr-2 h-4 w-4`}),`Réinitialiser le mot de passe`]}),o&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsx)(cn,{children:`Changer le rôle`}),s.map(t=>(0,f.jsx)($,{onClick:()=>o(t.value),disabled:e.role===t.value,children:t.label},t.value))]}),a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsx)(cn,{children:`Changer le statut`}),Object.entries(HF).map(([t,n])=>(0,f.jsx)($,{onClick:()=>a(t),disabled:e.status===t,children:n.label},t))]}),n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:n,className:`text-destructive focus:text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})}function JF({users:e,roles:i=VF,permissions:a,selectedUsers:o=[],onSelectionChange:c,onCreate:u,onEdit:d,onDelete:p,onBulkDelete:m,onRoleChange:h,onStatusChange:g,onResetPassword:_,onExport:v,onRefresh:y,loading:b=!1,actionLoading:x=!1,searchQuery:S=``,onSearchChange:C,roleFilter:w=`all`,onRoleFilterChange:T,statusFilter:E=`all`,onStatusFilterChange:D,showBulkActions:O=!0,showCreateButton:k=!0,title:A=`Gestion des utilisateurs`,description:j=`Gérez les utilisateurs, leurs rôles et permissions.`,className:M}){let[N,P]=s.useState(!1),[F,I]=s.useState(null),[L,R]=s.useState(null),[z,B]=s.useState(!1),V=s.useMemo(()=>e.filter(e=>{if(S){let t=S.toLowerCase();if(!(e.displayName.toLowerCase().includes(t)||e.email.toLowerCase().includes(t)))return!1}return!(w!==`all`&&e.role!==w||E!==`all`&&e.status!==E)}),[e,S,w,E]),H=e=>{e?c?.(V.map(e=>e.id)):c?.([])},U=(e,t)=>{t?c?.([...o,e]):c?.(o.filter(t=>t!==e))},W=async e=>{await u?.(e)},G=async e=>{F&&(await d?.(F.id,e),I(null))},K=async()=>{L&&(await p?.(L.id),R(null))},q=async()=>{await m?.(o),c?.([]),B(!1)},ee=e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,year:`numeric`});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,M),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-6 w-6`}),A]}),j&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:j})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:y,disabled:b,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,b&&`animate-spin`)})}),v&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:v,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Exporter`]}),k&&u&&(0,f.jsxs)(r.r,{size:`sm`,onClick:()=>P(!0),children:[(0,f.jsx)(l.UserPlus,{className:`mr-2 h-4 w-4`}),`Ajouter`]})]})]}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center`,children:[C&&(0,f.jsxs)(`div`,{className:`relative flex-1`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher un utilisateur...`,value:S,onChange:e=>C(e.target.value),className:`pl-9`})]}),T&&(0,f.jsxs)(n.d,{value:w,onValueChange:e=>T(e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`mr-2 h-4 w-4`}),(0,f.jsx)(n.b,{placeholder:`Rôle`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les rôles`}),i.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))]})]}),D&&(0,f.jsxs)(n.d,{value:E,onValueChange:e=>D(e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`mr-2 h-4 w-4`}),(0,f.jsx)(n.b,{placeholder:`Statut`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les statuts`}),Object.entries(HF).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t.label},e))]})]})]}),O&&o.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg`,children:[(0,f.jsxs)(`span`,{className:`text-sm font-medium`,children:[o.length,` utilisateur(s) sélectionné(s)`]}),m&&(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:()=>B(!0),children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>c?.([]),children:`Désélectionner`})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`p-0`,children:(0,f.jsxs)(hr,{children:[(0,f.jsx)(gr,{children:(0,f.jsxs)(yr,{children:[c&&(0,f.jsx)(br,{className:`w-[50px]`,children:(0,f.jsx)(we,{checked:V.length>0&&o.length===V.length,onCheckedChange:H})}),(0,f.jsx)(br,{children:`Utilisateur`}),(0,f.jsx)(br,{children:`Rôle`}),(0,f.jsx)(br,{children:`Statut`}),(0,f.jsx)(br,{children:`Inscrit le`}),(0,f.jsx)(br,{children:`Dernière connexion`}),(0,f.jsx)(br,{className:`w-[50px]`})]})}),(0,f.jsx)(_r,{children:b?(0,f.jsx)(yr,{children:(0,f.jsx)(xr,{colSpan:c?7:6,className:`text-center py-8`,children:(0,f.jsx)(l.Loader2,{className:`h-6 w-6 animate-spin mx-auto`})})}):V.length===0?(0,f.jsx)(yr,{children:(0,f.jsx)(xr,{colSpan:c?7:6,className:`text-center py-8 text-muted-foreground`,children:`Aucun utilisateur trouvé`})}):V.map(e=>(0,f.jsxs)(yr,{children:[c&&(0,f.jsx)(xr,{children:(0,f.jsx)(we,{checked:o.includes(e.id),onCheckedChange:t=>U(e.id,t)})}),(0,f.jsx)(xr,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(UF,{user:e}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.displayName}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email})]})]})}),(0,f.jsx)(xr,{children:(0,f.jsx)(WF,{role:e.role,roles:i})}),(0,f.jsx)(xr,{children:(0,f.jsx)(GF,{status:e.status})}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:ee(e.createdAt)}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:e.lastLogin?ee(e.lastLogin):`-`}),(0,f.jsx)(xr,{children:(0,f.jsx)(qF,{user:e,roles:i,onEdit:d?()=>I(e):void 0,onDelete:p?()=>R(e):void 0,onResetPassword:_?()=>_(e.id):void 0,onRoleChange:h?t=>h(e.id,t):void 0,onStatusChange:g?t=>g(e.id,t):void 0})})]},e.id))})]})})}),(0,f.jsx)(KF,{open:N,onOpenChange:P,roles:i,permissions:a,onSubmit:W,loading:x}),(0,f.jsx)(KF,{open:!!F,onOpenChange:e=>!e&&I(null),user:F||void 0,roles:i,permissions:a,onSubmit:G,loading:x}),(0,f.jsx)(ne,{open:!!L,onOpenChange:e=>!e&&R(null),children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer l'utilisateur ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,L?.displayName,` ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:K,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})}),(0,f.jsx)(ne,{open:z,onOpenChange:B,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer les utilisateurs ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,o.length,` utilisateur(s) ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:q,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})})]})}var YF=[{id:`1`,email:`admin@exemple.com`,displayName:`Admin User`,firstName:`Admin`,lastName:`User`,role:`admin`,status:`active`,createdAt:new Date(`2023-01-01`),lastLogin:new Date(`2024-01-15`)},{id:`2`,email:`moderator@exemple.com`,displayName:`Marie Modérateur`,firstName:`Marie`,lastName:`Modérateur`,role:`moderator`,status:`active`,createdAt:new Date(`2023-03-15`),lastLogin:new Date(`2024-01-14`)},{id:`3`,email:`user@exemple.com`,displayName:`Jean Utilisateur`,firstName:`Jean`,lastName:`Utilisateur`,role:`user`,status:`active`,createdAt:new Date(`2023-06-01`),lastLogin:new Date(`2024-01-10`)},{id:`4`,email:`pending@exemple.com`,displayName:`Paul Pending`,firstName:`Paul`,lastName:`Pending`,role:`user`,status:`pending`,createdAt:new Date(`2024-01-10`)},{id:`5`,email:`banned@exemple.com`,displayName:`Bob Banni`,firstName:`Bob`,lastName:`Banni`,role:`guest`,status:`banned`,createdAt:new Date(`2023-09-01`),lastLogin:new Date(`2023-12-01`)}],XF=[{id:`read`,name:`Lecture`,description:`Accès en lecture`,category:`Base`},{id:`write`,name:`Écriture`,description:`Accès en écriture`,category:`Base`},{id:`delete`,name:`Suppression`,description:`Accès suppression`,category:`Base`},{id:`admin`,name:`Administration`,description:`Accès admin`,category:`Admin`},{id:`users`,name:`Gestion utilisateurs`,description:`Gérer les utilisateurs`,category:`Admin`}],ZF={created:{icon:l.Plus,color:`text-green-500`,label:`créé`},updated:{icon:l.Edit,color:`text-blue-500`,label:`modifié`},deleted:{icon:l.Trash2,color:`text-red-500`,label:`supprimé`},commented:{icon:l.MessageSquare,color:`text-purple-500`,label:`commenté`},uploaded:{icon:l.Upload,color:`text-cyan-500`,label:`uploadé`},downloaded:{icon:l.Download,color:`text-gray-500`,label:`téléchargé`},shared:{icon:l.User,color:`text-orange-500`,label:`partagé`},approved:{icon:l.Check,color:`text-green-500`,label:`approuvé`},rejected:{icon:l.X,color:`text-red-500`,label:`rejeté`},mentioned:{icon:l.Bell,color:`text-yellow-500`,label:`mentionné`},assigned:{icon:l.User,color:`text-indigo-500`,label:`assigné`},completed:{icon:l.Check,color:`text-green-500`,label:`terminé`},custom:{icon:l.AlertCircle,color:`text-gray-500`,label:``}};function QF({user:e,size:t=`sm`}){let n={sm:`h-8 w-8`,md:`h-10 w-10`},r=e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(ve,{className:n[t],children:[(0,f.jsx)(ye,{src:e.avatar,alt:e.name}),(0,f.jsx)(be,{className:`text-xs`,children:r})]})}function $F({type:e,customIcon:n,customColor:r}){let i=ZF[e],a=i.icon;return(0,f.jsx)(`div`,{className:t.t(`flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm`,r||i.color),children:n||(0,f.jsx)(a,{className:`h-4 w-4`})})}function eI({activity:e,showAvatar:t,relativeTime:r,layout:i,isLast:a}){let o=e=>{let t=typeof e==`string`?new Date(e):e;if(r){let e=new Date().getTime()-t.getTime(),n=Math.floor(e/6e4),r=Math.floor(n/60),i=Math.floor(r/24);if(n<1)return`À l'instant`;if(n<60)return`Il y a ${n} min`;if(r<24)return`Il y a ${r}h`;if(i<7)return`Il y a ${i}j`}return t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})},s=ZF[e.type];return i===`compact`?(0,f.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,f.jsx)($F,{type:e.type,customIcon:e.icon,customColor:e.color}),(0,f.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,f.jsxs)(`p`,{className:`text-sm truncate`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]})}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:o(e.timestamp)})]}):i===`feed`?(0,f.jsx)(Y,{className:`mb-4`,children:(0,f.jsx)(Q,{className:`pt-4`,children:(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[t&&(0,f.jsx)(QF,{user:e.user,size:`md`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:s.label||e.type}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e.timestamp)})]}),(0,f.jsx)(`p`,{className:`text-sm`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,f.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment})]})]})})}):(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,f.jsx)($F,{type:e.type,customIcon:e.icon,customColor:e.color}),!a&&(0,f.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-2`})]}),(0,f.jsx)(`div`,{className:`flex-1 pb-8`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t&&(0,f.jsx)(QF,{user:e.user}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,f.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground mt-2 block`,children:o(e.timestamp)})]})]})})]})}function tI({activities:e,title:i=`Activité`,showSearch:a=!0,showFilters:o=!0,filters:c=[],activeFilter:u,onFilterChange:d,showRefresh:p=!0,onRefresh:m,loading:h=!1,groupByDay:g=!0,showLoadMore:_=!1,onLoadMore:v,loadingMore:y=!1,showAvatars:b=!0,relativeTime:x=!0,layout:S=`timeline`,className:C}){let[w,T]=s.useState(``),[E,D]=s.useState(null),O=u??E,k=e=>{d?d(e):D(e)},A=s.useMemo(()=>{let t=e;if(w){let e=w.toLowerCase();t=t.filter(t=>t.title.toLowerCase().includes(e)||t.user.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))}if(O){let e=c.find(e=>e.id===O);e&&(t=t.filter(t=>e.types.includes(t.type)))}return t},[e,w,O,c]),j=s.useMemo(()=>{if(!g)return null;let e={};return A.forEach(t=>{let n=(typeof t.timestamp==`string`?new Date(t.timestamp):t.timestamp).toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});e[n]||(e[n]=[]),e[n].push(t)}),e},[A,g]),M=e=>(0,f.jsx)(`div`,{children:e.map((t,n)=>(0,f.jsx)(eI,{activity:t,showAvatar:b,relativeTime:x,layout:S,isLast:n===e.length-1},t.id))});return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,C),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,f.jsx)(`h2`,{className:`text-xl font-semibold`,children:i}),(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:p&&m&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:m,disabled:h,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,h&&`animate-spin`)})})})]}),(a||o)&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[a&&(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:w,onChange:e=>T(e.target.value),className:`pl-9`})]}),o&&c.length>0&&(0,f.jsxs)(n.d,{value:O||`all`,onValueChange:e=>k(e===`all`?null:e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{placeholder:`Filtrer`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Toutes les activités`}),c.map(e=>(0,f.jsx)(n.m,{value:e.id,children:e.label},e.id))]})]})]}),h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,f.jsx)(l.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):A.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12`,children:[(0,f.jsx)(l.Clock,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune activité`})]}):g&&j?(0,f.jsx)(`div`,{className:`space-y-6`,children:Object.entries(j).map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-4 capitalize`,children:e}),M(t)]},e))}):M(A),_&&v&&(0,f.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,f.jsxs)(r.r,{variant:`outline`,onClick:v,disabled:y,children:[y?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 animate-spin mr-2`}):(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4 mr-2`}),`Charger plus`]})})]})}var nI=[{id:`edits`,label:`Modifications`,types:[`created`,`updated`,`deleted`]},{id:`comments`,label:`Commentaires`,types:[`commented`,`mentioned`]},{id:`files`,label:`Fichiers`,types:[`uploaded`,`downloaded`,`shared`]},{id:`approvals`,label:`Approbations`,types:[`approved`,`rejected`,`completed`]}],rI=[{id:`1`,type:`created`,title:`a créé le document 'Rapport Q4'`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5)},{id:`2`,type:`commented`,title:`a commenté sur 'Projet Alpha'`,user:{id:`2`,name:`Pierre Martin`},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:`Super travail sur cette partie !`}},{id:`3`,type:`uploaded`,title:`a uploadé 3 fichiers`,user:{id:`3`,name:`Sophie Bernard`},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:`4`,type:`approved`,title:`a approuvé la demande de congés`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*60*24)}],iI={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function aI(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function oI(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function sI(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?oI(n,t)||t>=n&&t<=r:oI(n,t)})}function cI({currentDate:e,viewMode:t,onPrevious:i,onNext:a,onToday:o,onViewModeChange:s,onAddClick:c,showViewSelector:u,showAddButton:d,locale:p}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:i,children:(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:a,children:(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,f.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(p,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(p,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(p,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&s&&(0,f.jsxs)(n.d,{value:t,onValueChange:e=>s(e),children:[(0,f.jsx)(n.y,{className:`w-[120px]`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`month`,children:`Mois`}),(0,f.jsx)(n.m,{value:`week`,children:`Semaine`}),(0,f.jsx)(n.m,{value:`day`,children:`Jour`}),(0,f.jsx)(n.m,{value:`agenda`,children:`Agenda`})]})]}),d&&c&&(0,f.jsxs)(r.r,{onClick:c,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function lI({event:e,onClick:n,compact:r=!1}){let i=iI[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,f.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.t(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,f.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function uI({event:e,onEdit:n,onDelete:i}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,s=iI[e.color||`blue`];return(0,f.jsxs)(`div`,{className:`w-72`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full mt-1`,s.bg.replace(`100`,`500`))}),(0,f.jsxs)(`div`,{className:`flex gap-1`,children:[n&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:n,children:(0,f.jsx)(l.Edit,{className:`h-3 w-3`})}),i&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,children:(0,f.jsx)(l.Trash2,{className:`h-3 w-3`})})]})]}),(0,f.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,f.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),e.allDay?(0,f.jsx)(`span`,{children:`Toute la journée`}):(0,f.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,f.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function dI({currentDate:e,events:n,weekStartsOn:r,locale:a,onDayClick:o,onEventClick:s,onEventEdit:c,onEventDelete:l}){let u=e.getFullYear(),d=e.getMonth(),p=aI(u,d),m=new Date,h=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(a,{weekday:`short`})),g=(new Date(u,d,1).getDay()-r+7)%7,_=[];for(let e=0;e<g;e++)_.push(null);for(_.push(...p);_.length%7!=0;)_.push(null);return(0,f.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:h.map(e=>(0,f.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,f.jsx)(`div`,{className:`grid grid-cols-7`,children:_.map((e,r)=>{let a=e?sI(n,e):[],u=e&&oI(e,m);return(0,f.jsx)(`div`,{className:t.t(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===d)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&o?.(e),children:e&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[a.slice(0,3).map(e=>(0,f.jsxs)(i.r,{children:[(0,f.jsx)(i.a,{asChild:!0,children:(0,f.jsx)(`div`,{children:(0,f.jsx)(lI,{event:e,onClick:()=>s?.(e),compact:!0})})}),(0,f.jsx)(i.i,{children:(0,f.jsx)(uI,{event:e,onEdit:()=>c?.(e.id,{}),onDelete:()=>l?.(e.id)})})]},e.id)),a.length>3&&(0,f.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,a.length-3,` autres`]})]})]})},r)})})]})}function fI({currentDate:e,events:n,locale:r,onEventClick:i}){let a=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),o={};return a.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();o[t]||(o[t]=[]),o[t].push(e)}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(o).map(([e,n])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(r,{weekday:`long`,day:`numeric`,month:`long`})}),(0,f.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=iI[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end;return(0,f.jsx)(Y,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i?.(e),children:(0,f.jsxs)(Q,{className:`p-3 flex gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${a.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})} - ${o.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,f.jsx)(l.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(o).length===0&&(0,f.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function pI({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:o,onEventCreate:c,onEventEdit:l,onEventDelete:u,onDayClick:d,showHeader:p=!0,showViewSelector:m=!0,showAddButton:h=!0,weekStartsOn:g=1,locale:_=`fr-FR`,className:v}){let[y,b]=s.useState(new Date),[x,S]=s.useState(`month`),[C,w]=s.useState(!1),T=n??y,E=i??x,D=e=>{r?r(e):b(e)};return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,v),children:[p&&(0,f.jsx)(cI,{currentDate:T,viewMode:E,onPrevious:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}D(e)},onNext:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}D(e)},onToday:()=>{D(new Date)},onViewModeChange:e=>{a?a(e):S(e)},onAddClick:()=>w(!0),showViewSelector:m,showAddButton:h,locale:_}),E===`month`&&(0,f.jsx)(dI,{currentDate:T,events:e,weekStartsOn:g,locale:_,onDayClick:d,onEventClick:o,onEventEdit:l,onEventDelete:u}),E===`agenda`&&(0,f.jsx)(fI,{currentDate:T,events:e,locale:_,onEventClick:o}),(E===`week`||E===`day`)&&(0,f.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,E===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var mI=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}],hI=`waka-chat-widget-position`,gI=e=>{if(typeof window>`u`)return null;try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null},_I=(e,t)=>{if(!(typeof window>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch{}};function vI({defaultPosition:e,position:r,onPositionChange:i,persistPosition:a=!0,positionStorageKey:o=hI,defaultOpen:c=!1,open:u,onOpenChange:d,bubbleSize:p=`md`,bubbleColor:m=`primary`,bubbleIcon:h,bubbleText:g,showUnreadBadge:_=!0,bubbleAnimation:v=`none`,widgetPosition:y=`top-left`,widgetSize:b=`md`,bubbleClassName:x,widgetClassName:S,draggable:C=!0,constrainToViewport:w=!0,edgeOffset:T=16,onWidgetClose:E,onWidgetMinimize:D,zIndex:O=9999,conversations:k=[],...A}){let[j,M]=s.useState(c),[N,P]=s.useState(()=>{if(e)return e;if(a){let e=gI(o);if(e)return e}return{x:typeof window<`u`?window.innerWidth-80:0,y:typeof window<`u`?window.innerHeight-80:0}}),[F,I]=s.useState(!1),[L,R]=s.useState({x:0,y:0}),z=s.useRef(null),B=u===void 0?j:u,V=r===void 0?N:r;s.useEffect(()=>{!(typeof window>`u`)&&!r&&!e&&P((a?gI(o):null)||{x:window.innerWidth-80,y:window.innerHeight-80})},[r,e,a,o]);let H=e=>{u===void 0&&M(e),d?.(e)},U=e=>{r===void 0&&P(e),i?.(e),a&&_I(o,e)},W=e=>{if(!w||typeof window>`u`)return e;let t=z.current?.offsetWidth||60,n=z.current?.offsetHeight||60;return{x:Math.max(T,Math.min(e.x,window.innerWidth-t-T)),y:Math.max(T,Math.min(e.y,window.innerHeight-n-T))}},G=e=>{!C||B||(I(!0),R({x:e.clientX-V.x,y:e.clientY-V.y}))},K=e=>{if(!C||B)return;let t=e.touches[0];I(!0),R({x:t.clientX-V.x,y:t.clientY-V.y})};s.useEffect(()=>{if(!F)return;let e=e=>{U(W({x:e.clientX-L.x,y:e.clientY-L.y}))},t=e=>{let t=e.touches[0];U(W({x:t.clientX-L.x,y:t.clientY-L.y}))},n=()=>{I(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t),document.addEventListener(`touchend`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n)}},[F,L]);let q=()=>{F||H(!B)},ee=k.reduce((e,t)=>e+(t.unreadCount||0),0),J={sm:`h-12 w-12`,md:`h-14 w-14`,lg:`h-16 w-16`},te={sm:`h-5 w-5`,md:`h-6 w-6`,lg:`h-7 w-7`},ne={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/90`,success:`bg-green-500 text-white hover:bg-green-600`,warning:`bg-yellow-500 text-white hover:bg-yellow-600`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`},re={none:``,pulse:`animate-pulse`,bounce:`animate-bounce`},ie={sm:`h-[400px] w-[300px]`,md:`h-[500px] w-[380px]`,lg:`h-[600px] w-[420px]`},ae=()=>{let e=z.current?.offsetWidth||60,t=z.current?.offsetHeight||60,n=ie[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),r=n?parseInt(n[1]):500,i=n?parseInt(n[2]):380,a=V.x,o=V.y;switch(y){case`top-left`:a=V.x-i+e,o=V.y-r-12;break;case`top-right`:o=V.y-r-12;break;case`bottom-left`:a=V.x-i+e,o=V.y+t+12;break;case`bottom-right`:o=V.y+t+12;break}return typeof window<`u`&&(a=Math.max(T,Math.min(a,window.innerWidth-i-T)),o=Math.max(T,Math.min(o,window.innerHeight-r-T))),{position:`fixed`,left:a,top:o,zIndex:O+1}};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`button`,{ref:z,onClick:q,onMouseDown:G,onTouchStart:K,className:t.t(`fixed rounded-full shadow-lg transition-all duration-200`,`flex items-center justify-center gap-2`,J[p],ne[m],re[v],F&&`cursor-grabbing scale-110`,C&&!F&&!B&&`cursor-grab`,B&&`opacity-0 pointer-events-none scale-75`,g&&`px-4 w-auto`,x),style:{left:V.x,top:V.y,zIndex:O,touchAction:`none`},"aria-label":`Ouvrir le chat`,children:[h||(0,f.jsx)(l.MessageCircle,{className:te[p]}),g&&(0,f.jsx)(`span`,{className:`font-medium text-sm`,children:g}),_&&ee>0&&(0,f.jsx)(n.x,{className:t.t(`absolute -top-1 -right-1 h-5 min-w-[20px] px-1.5`,`bg-destructive text-destructive-foreground`,`flex items-center justify-center text-xs font-bold`),children:ee>99?`99+`:ee})]}),B&&(0,f.jsx)(`div`,{className:t.t(`fixed rounded-xl shadow-2xl border bg-background overflow-hidden`,`animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2`,`duration-200`,ie[b],S),style:ae(),children:(0,f.jsx)(OI,{...A,conversations:k,layout:`widget`,onClose:()=>{H(!1),E?.()},onMinimize:()=>{H(!1),D?.()},showCloseButton:!0,className:`h-full`})}),B&&(0,f.jsx)(`div`,{className:`fixed inset-0 bg-black/20 sm:hidden`,style:{zIndex:O-1},onClick:()=>H(!1)})]})}function yI(e={}){let{defaultOpen:t=!1,defaultPosition:n,persistPosition:r=!0,positionStorageKey:i=hI}=e,[a,o]=s.useState(t),[c,l]=s.useState(()=>{if(n)return n;if(typeof window>`u`)return{x:0,y:0};if(r){let e=gI(i);if(e)return e}return{x:window.innerWidth-80,y:window.innerHeight-80}}),u=()=>o(!0),d=()=>o(!1),f=()=>o(e=>!e),p=e=>{l(e),r&&_I(i,e)};return{isOpen:a,position:c,open:u,close:d,toggle:f,setIsOpen:o,updatePosition:p,resetPosition:()=>{typeof window>`u`||p(n||{x:window.innerWidth-80,y:window.innerHeight-80})},widgetProps:{open:a,onOpenChange:o,position:c,onPositionChange:p}}}var bI=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},xI=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},SI=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function CI({date:e}){return(0,f.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,f.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:bI(e)})})}function wI({conversations:e,activeId:i,currentUser:a,onSelect:o,onSearch:c}){let[u,d]=s.useState(``),p=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),m=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:SI(t||{id:``,name:`?`})}},h=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},g=e.filter(e=>u?p(e).toLowerCase().includes(u.toLowerCase()):!0);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,f.jsx)(`div`,{className:`p-3 border-b`,children:(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:u,onChange:e=>{d(e.target.value),c?.(e.target.value)},className:`pl-9`})]})}),(0,f.jsx)(er,{className:`flex-1`,children:g.map(e=>{let r=m(e),s=p(e),c=e.participants.find(e=>e.id!==a.id);return(0,f.jsxs)(`button`,{onClick:()=>o(e),className:t.t(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{children:[(0,f.jsx)(ye,{src:r.url}),(0,f.jsx)(be,{children:r.fallback})]}),c?.status===`online`&&(0,f.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium text-sm truncate`,children:s}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h(e.lastMessage?.timestamp)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,f.jsx)(n.x,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function TI({conversation:e,currentUser:n,title:i,statusText:a,showStatus:o=!0,showCloseButton:s,onAudioCall:c,onVideoCall:u,onClose:d,onCloseConversation:p,onMinimize:m,layout:h}){let g=e?.participants.find(e=>e.id!==n.id),_=i||e?.name||g?.name||`Messages`,v=()=>a||(e?e.isGroup?`${e.participants.length} participants`:g?.status===`online`?`En ligne`:g?.lastSeen?`Vu ${(typeof g.lastSeen==`string`?new Date(g.lastSeen):g.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),y=h===`floating`||h===`widget`;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center justify-between p-3 border-b`,y&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,f.jsxs)(ve,{className:t.t(y&&`border-2 border-primary-foreground/20`),children:[(0,f.jsx)(ye,{src:e.avatar||g?.avatar}),(0,f.jsx)(be,{className:t.t(y&&`bg-primary-foreground/20 text-primary-foreground`),children:SI(g||{id:``,name:_})})]}),!e&&(0,f.jsx)(l.MessageCircle,{className:`h-5 w-5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold text-sm`,children:_}),o&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[g?.status===`online`&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,y?`bg-green-400`:`bg-green-500`)}),g?.status===`offline`&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,y?`bg-gray-400`:`bg-gray-500`)}),(0,f.jsx)(`p`,{className:t.t(`text-xs`,y?`text-primary-foreground/80`:`text-muted-foreground`),children:v()})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&!y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:c,children:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})}),u&&!y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:u,children:(0,f.jsx)(l.Video,{className:`h-4 w-4`})}),s&&p&&(0,f.jsxs)(r.r,{variant:y?`ghost`:`outline`,size:`sm`,onClick:p,className:t.t(y&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),m&&y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:m,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(l.Minimize2,{className:`h-4 w-4`})}),d&&y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:d,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})}),!y&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsx)(an,{align:`end`,children:(0,f.jsxs)($,{children:[(0,f.jsx)(l.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function EI({message:e,isOwn:n,showStatus:i,showTimestamp:a,onDelete:o,onReply:s}){return(0,f.jsxs)(`div`,{className:t.t(`flex gap-2 group`,n?`flex-row-reverse`:`flex-row`),children:[!n&&(0,f.jsxs)(ve,{className:`h-8 w-8`,children:[(0,f.jsx)(ye,{src:e.sender.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:SI(e.sender)})]}),(0,f.jsxs)(`div`,{className:t.t(`max-w-[70%]`,n&&`items-end`),children:[e.replyTo&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,f.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,f.jsxs)(`div`,{className:t.t(`relative rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,f.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,f.jsx)(`div`,{children:e.type===`image`?(0,f.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,f.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,f.jsx)(l.File,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,f.jsxs)(`div`,{className:t.t(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,n?`-left-20`:`-right-20`),children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s?.(e),children:(0,f.jsx)(l.Reply,{className:`h-3 w-3`})}),n&&o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>o(e.id),children:(0,f.jsx)(l.Trash2,{className:`h-3 w-3`})})]})]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,n&&`justify-end`),children:[a&&(0,f.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,f.jsx)(`span`,{children:`(modifié)`}),n&&i&&(()=>{switch(e.status){case`sending`:return(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,f.jsx)(l.Check,{className:`h-3 w-3`});case`delivered`:return(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,f.jsx)(l.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function DI({onSend:e,replyTo:t,onCancelReply:n,showAttachments:a,showEmoji:o,placeholder:c,sending:u,showHint:d=!0,hintText:p=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[m,h]=s.useState(``),g=s.useRef(null),_=()=>{m.trim()&&!u&&(e(m.trim()),h(``))};return s.useEffect(()=>{g.current&&(g.current.style.height=`auto`,g.current.style.height=Math.min(g.current.scrollHeight,120)+`px`)},[m]),(0,f.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Reply,{className:`h-4 w-4 text-primary`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`flex items-end gap-2`,children:[a&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(l.Paperclip,{className:`h-4 w-4`})}),(0,f.jsx)(i.n,{ref:g,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:c,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:u,rows:1}),o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(l.Smile,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{onClick:_,disabled:!m.trim()||u,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,f.jsx)(l.Send,{className:`h-4 w-4`})})]}),d&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:p})]})}function OI({conversations:e=[],activeConversation:r,messages:i,currentUser:a,onSendMessage:o,onConversationSelect:c,onMessageDelete:u,onMessageReply:d,onSearch:p,onAudioCall:m,onVideoCall:h,onClose:g,onCloseConversation:_,onMinimize:v,showConversationList:y=!0,showHeader:b=!0,showMessageStatus:x=!0,showTimestamps:S=!0,showAttachments:C=!0,showEmoji:w=!0,showDateSeparators:T=!0,showInputHint:E=!0,showCloseButton:D=!1,inputPlaceholder:O,inputHintText:k,sending:A=!1,loading:j=!1,layout:M=`full`,headerTitle:N,showHeaderStatus:P=!0,statusText:F,minimized:I=!1,className:L}){let[R,z]=s.useState(null),B=s.useRef(null);s.useEffect(()=>{B.current?.scrollIntoView({behavior:`smooth`})},[i]);let V=(e,t)=>{o?.(e,t),z(null)},H=e=>{z(e),d?.(e)};return(M===`floating`||M===`widget`)&&I?(0,f.jsxs)(`button`,{onClick:v,className:t.t(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,L),children:[(0,f.jsx)(l.MessageCircle,{className:`h-5 w-5`}),(0,f.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,f.jsxs)(`div`,{className:t.t(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[M],L),children:[y&&M!==`widget`&&M!==`floating`&&(0,f.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,f.jsx)(wI,{conversations:e,activeId:r?.id,currentUser:a,onSelect:e=>c?.(e),onSearch:p})}),(0,f.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:r||M===`widget`||M===`floating`?(0,f.jsxs)(f.Fragment,{children:[b&&(0,f.jsx)(TI,{conversation:r,currentUser:a,title:N,statusText:F,showStatus:P,showCloseButton:D,onAudioCall:m,onVideoCall:h,onClose:g,onCloseConversation:_,onMinimize:v,layout:M}),(0,f.jsx)(er,{className:`flex-1 p-4`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[j?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return i.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;T&&(!t||!xI(t,i))&&(e.push((0,f.jsx)(CI,{date:i},`separator-${r}`)),t=i),e.push((0,f.jsx)(EI,{message:n,isOwn:n.sender.id===a.id,showStatus:x,showTimestamp:S,onDelete:u,onReply:H},n.id))}),e})(),(0,f.jsx)(`div`,{ref:B})]})}),(0,f.jsx)(DI,{onSend:V,replyTo:R,onCancelReply:()=>z(null),showAttachments:C,showEmoji:w,placeholder:(()=>{if(O)return O;if(r){let e=r.participants.find(e=>e.id!==a.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:A,showHint:E,hintText:k})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(l.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,f.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var kI={id:`current`,name:`Moi`,status:`online`},AI=[{id:`1`,participants:[kI,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[kI,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:kI,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],jI=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:kI,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}],MI={"no-data":{title:`Aucune donnée`,description:`Il n'y a pas encore de données à afficher.`,icon:l.Inbox,actionLabel:`Ajouter`,actionIcon:l.Plus},"no-results":{title:`Aucun résultat`,description:`Aucun élément ne correspond à votre recherche.`,icon:l.Search,actionLabel:`Effacer les filtres`,actionIcon:l.Filter},"no-messages":{title:`Aucun message`,description:`Votre boîte de réception est vide.`,icon:l.MessageSquare,actionLabel:`Nouveau message`,actionIcon:l.Plus},"no-files":{title:`Aucun fichier`,description:`Vous n'avez pas encore de fichiers.`,icon:l.FolderOpen,actionLabel:`Importer un fichier`,actionIcon:l.Upload},"no-users":{title:`Aucun utilisateur`,description:`Il n'y a pas encore d'utilisateurs.`,icon:l.Users,actionLabel:`Inviter des utilisateurs`,actionIcon:l.Plus},"no-cart":{title:`Panier vide`,description:`Votre panier est vide.`,icon:l.ShoppingCart,actionLabel:`Parcourir les produits`,actionIcon:l.ArrowRight},"no-notifications":{title:`Aucune notification`,description:`Vous êtes à jour !`,icon:l.Bell},"no-events":{title:`Aucun événement`,description:`Aucun événement prévu.`,icon:l.Calendar,actionLabel:`Créer un événement`,actionIcon:l.Plus},"no-images":{title:`Aucune image`,description:`Vous n'avez pas encore d'images.`,icon:l.Image,actionLabel:`Importer des images`,actionIcon:l.Upload},"no-bookmarks":{title:`Aucun favori`,description:`Vous n'avez pas encore de favoris.`,icon:l.Bookmark,actionLabel:`Parcourir`,actionIcon:l.ArrowRight},"no-favorites":{title:`Aucun favori`,description:`Vous n'avez pas encore aimé de contenu.`,icon:l.Heart},error:{title:`Une erreur est survenue`,description:`Impossible de charger les données.`,icon:l.FileQuestion,actionLabel:`Réessayer`,actionIcon:l.RefreshCw},custom:{title:`Aucun élément`,description:`Il n'y a rien à afficher.`,icon:l.Inbox}};function NI({type:e,size:n,className:r}){let i=MI[e].icon,a={sm:{container:`h-24 w-24`,icon:`h-8 w-8`,circles:{outer:`h-20 w-20`,inner:`h-14 w-14`}},md:{container:`h-32 w-32`,icon:`h-10 w-10`,circles:{outer:`h-28 w-28`,inner:`h-20 w-20`}},lg:{container:`h-40 w-40`,icon:`h-12 w-12`,circles:{outer:`h-36 w-36`,inner:`h-28 w-28`}}}[n];return(0,f.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,a.container,r),children:[(0,f.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted/50`,a.circles.outer)}),(0,f.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted`,a.circles.inner)}),(0,f.jsx)(`div`,{className:`relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm`,children:(0,f.jsx)(i,{className:t.t(a.icon,`text-muted-foreground`)})}),(0,f.jsx)(`div`,{className:`absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20`}),(0,f.jsx)(`div`,{className:`absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30`}),(0,f.jsx)(`div`,{className:`absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10`})]})}function PI({type:e=`no-data`,title:n,description:i,icon:a,actions:o,illustration:c,showIllustration:l=!0,size:u=`md`,layout:d=`vertical`,centered:p=!0,children:m,className:h,LinkComponent:g}){let _=MI[e],v=n??_.title,y=i??_.description;_.icon;let b={sm:{container:`py-8 px-4`,title:`text-base`,description:`text-sm`,icon:`h-8 w-8`},md:{container:`py-12 px-6`,title:`text-lg`,description:`text-sm`,icon:`h-10 w-10`},lg:{container:`py-16 px-8`,title:`text-xl`,description:`text-base`,icon:`h-12 w-12`}},x=[];if(_.actionLabel&&!o){let e=_.actionIcon;x.push({label:_.actionLabel,variant:`default`,icon:e?(0,f.jsx)(e,{className:`h-4 w-4`}):void 0})}let S=o||(x.length>0?x:void 0);return d===`horizontal`?(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-6`,b[u].container,p&&`justify-center`,h),children:[l&&(0,f.jsx)(`div`,{className:`flex-shrink-0`,children:c||(a?(0,f.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-4`,children:a}):(0,f.jsx)(NI,{type:e,size:u}))}),(0,f.jsxs)(`div`,{className:`flex flex-col`,children:[(0,f.jsx)(`h3`,{className:t.t(`font-semibold`,b[u].title),children:v}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mt-1`,b[u].description),children:y}),m&&(0,f.jsx)(`div`,{className:`mt-4`,children:m}),S&&S.length>0&&(0,f.jsx)(`div`,{className:`flex gap-3 mt-4`,children:S.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?g?(0,f.jsxs)(g,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})]}):(0,f.jsxs)(`div`,{className:t.t(`flex flex-col items-center`,p&&`text-center`,b[u].container,h),children:[l&&(0,f.jsx)(`div`,{className:`mb-6`,children:c||(a?(0,f.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-6`,children:s.cloneElement(a,{className:t.t(b[u].icon,`text-muted-foreground`)})}):(0,f.jsx)(NI,{type:e,size:u}))}),(0,f.jsx)(`h3`,{className:t.t(`font-semibold`,b[u].title),children:v}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mt-2 max-w-sm`,b[u].description),children:y}),m&&(0,f.jsx)(`div`,{className:`mt-4`,children:m}),S&&S.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-6 justify-center`,children:S.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?g?(0,f.jsxs)(g,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})}function FI(e){return(0,f.jsx)(PI,{type:`no-data`,...e})}function II(e){return(0,f.jsx)(PI,{type:`no-results`,...e})}function LI(e){return(0,f.jsx)(PI,{type:`no-messages`,...e})}function RI(e){return(0,f.jsx)(PI,{type:`no-files`,...e})}function zI(e){return(0,f.jsx)(PI,{type:`no-cart`,...e})}function BI(e){return(0,f.jsx)(PI,{type:`no-notifications`,...e})}function VI(e){return(0,f.jsx)(PI,{type:`error`,...e})}var HI={404:{code:`404`,title:`Page non trouvée`,description:`Désolé, la page que vous recherchez n'existe pas ou a été déplacée.`,icon:l.FileQuestion},500:{code:`500`,title:`Erreur serveur`,description:`Une erreur inattendue s'est produite. Notre équipe a été notifiée.`,icon:l.ServerCrash},403:{code:`403`,title:`Accès refusé`,description:`Vous n'avez pas les permissions nécessaires pour accéder à cette page.`,icon:l.ShieldX},503:{code:`503`,title:`Service indisponible`,description:`Le service est temporairement indisponible. Veuillez réessayer plus tard.`,icon:l.ServerCrash},offline:{code:`Hors ligne`,title:`Vous êtes hors ligne`,description:`Vérifiez votre connexion internet et réessayez.`,icon:l.Wifi},maintenance:{code:`Maintenance`,title:`Maintenance en cours`,description:`Nous effectuons une maintenance. Nous serons bientôt de retour.`,icon:l.Construction},custom:{code:``,title:`Erreur`,description:`Une erreur s'est produite.`,icon:l.FileQuestion}};function UI({type:e,className:n}){let r=HI[e].icon;return(0,f.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,n),children:[(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,f.jsx)(`div`,{className:`h-48 w-48 rounded-full bg-muted/50`})}),(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,f.jsx)(`div`,{className:`h-32 w-32 rounded-full bg-muted`})}),(0,f.jsx)(`div`,{className:`relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg`,children:(0,f.jsx)(r,{className:`h-10 w-10 text-muted-foreground`})}),(0,f.jsx)(`div`,{className:`absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20`}),(0,f.jsx)(`div`,{className:`absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30`}),(0,f.jsx)(`div`,{className:`absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10`})]})}function WI({type:e=`404`,code:n,title:i,description:a,actions:o,illustration:s,showCode:c=!0,showIllustration:u=!0,showBackButton:d=!0,onBack:p,showHomeButton:m=!0,homeUrl:h=`/`,showRefreshButton:g=!1,children:_,layout:v=`centered`,size:y=`md`,className:b,LinkComponent:x}){let S=HI[e],C=n??S.code,w=i??S.title,T=a??S.description,E={sm:{container:`py-12 px-4`,code:`text-6xl`,title:`text-xl`,description:`text-sm`,illustration:`h-32 w-32`},md:{container:`py-16 px-6`,code:`text-8xl`,title:`text-2xl`,description:`text-base`,illustration:`h-48 w-48`},lg:{container:`py-24 px-8`,code:`text-9xl`,title:`text-3xl`,description:`text-lg`,illustration:`h-64 w-64`}},D=[];d&&D.push({label:`Retour`,onClick:p||(()=>window.history.back()),variant:`outline`,icon:(0,f.jsx)(l.ArrowLeft,{className:`h-4 w-4`})}),m&&D.push({label:`Accueil`,href:h,variant:`default`,icon:(0,f.jsx)(l.Home,{className:`h-4 w-4`})}),g&&D.push({label:`Réessayer`,onClick:()=>window.location.reload(),variant:`secondary`,icon:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})});let O=o||D;return v===`split`?(0,f.jsxs)(`div`,{className:t.t(`min-h-screen flex flex-col lg:flex-row`,b),children:[(0,f.jsx)(`div`,{className:`flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16`,children:(0,f.jsx)(`div`,{className:E[y].illustration,children:s||(0,f.jsx)(UI,{type:e})})}),(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8 lg:p-16`,children:(0,f.jsxs)(`div`,{className:`max-w-md`,children:[c&&C&&(0,f.jsx)(`div`,{className:t.t(`font-bold text-primary mb-4`,y===`sm`?`text-4xl`:y===`md`?`text-5xl`:`text-6xl`),children:C}),(0,f.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mb-8`,E[y].description),children:T}),_&&(0,f.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:O.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,f.jsxs)(x,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})]}):(0,f.jsx)(`div`,{className:t.t(`min-h-screen flex items-center justify-center`,E[y].container,b),children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[u&&(0,f.jsx)(`div`,{className:t.t(`mb-8`,E[y].illustration),children:s||(0,f.jsx)(UI,{type:e})}),c&&C&&(0,f.jsx)(`div`,{className:t.t(`font-bold text-muted-foreground/20 mb-4`,E[y].code),children:C}),(0,f.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground max-w-md mb-8`,E[y].description),children:T}),_&&(0,f.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3 justify-center`,children:O.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,f.jsxs)(x,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})}function GI(e){return(0,f.jsx)(WI,{type:`404`,...e})}function KI(e){return(0,f.jsx)(WI,{type:`500`,showRefreshButton:!0,...e})}function qI(e){return(0,f.jsx)(WI,{type:`403`,...e})}function JI(e){return(0,f.jsx)(WI,{type:`maintenance`,showBackButton:!1,showHomeButton:!1,...e})}function YI(e){return(0,f.jsx)(WI,{type:`offline`,showRefreshButton:!0,...e})}function XI({value:e,onChange:t,placeholder:n}){return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{type:`text`,placeholder:n,value:e,onChange:e=>t(e.target.value),className:`pl-10`})]})}function ZI({categories:e,activeCategory:r,onCategoryChange:i,itemCounts:a}){return(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>i(null),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,r===null?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[`Tous`,(0,f.jsx)(n.x,{variant:`secondary`,className:`ml-1`,children:Object.values(a).reduce((e,t)=>e+t,0)})]}),e.map(e=>(0,f.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,r===e.id?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[e.icon,e.name,(0,f.jsx)(n.x,{variant:`secondary`,className:`ml-1`,children:a[e.id]||0})]},e.id))]})}function QI({itemId:e,helpful:n=0,notHelpful:r=0,onFeedback:i}){let[a,o]=s.useState(null),c=t=>{a===null&&(o(t),i(e,t))};return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 pt-4 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Cette réponse vous a-t-elle aidé ?`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!0?`bg-green-100 text-green-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👍 `,n+(a===!0?1:0)]}),(0,f.jsxs)(`button`,{type:`button`,onClick:()=>c(!1),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!1?`bg-red-100 text-red-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👎 `,r+(a===!1?1:0)]})]})]})}function $I({items:e,categories:r=[],title:i=`Questions fréquentes`,description:a,showSearch:o=!0,searchPlaceholder:c=`Rechercher une question...`,showCategoryFilter:u=!0,activeCategory:d,onCategoryChange:p,allowMultiple:m=!1,defaultOpen:h=[],showFeedback:g=!1,onFeedback:_,layout:v=`default`,size:y=`md`,className:b}){let[x,S]=s.useState(``),[C,w]=s.useState(null),T=d??C,E=e=>{p?p(e):w(e)},D=s.useMemo(()=>e.filter(e=>{if(x){let t=x.toLowerCase();if(!(e.question.toLowerCase().includes(t)||typeof e.answer==`string`&&e.answer.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))))return!1}return!(T&&e.category!==T)}),[e,x,T]),O=s.useMemo(()=>{let t={};return e.forEach(e=>{e.category&&(t[e.category]=(t[e.category]||0)+1)}),t},[e]),k=s.useMemo(()=>{if(v!==`grouped`)return null;let e={};return D.forEach(t=>{let n=t.category||`other`;e[n]||(e[n]=[]),e[n].push(t)}),e},[D,v]),A={sm:{title:`text-xl`,question:`text-sm`,answer:`text-sm`},md:{title:`text-2xl`,question:`text-base`,answer:`text-sm`},lg:{title:`text-3xl`,question:`text-lg`,answer:`text-base`}},j=e=>(0,f.jsx)(f.Fragment,{children:e.map(e=>(0,f.jsxs)(ee,{value:e.id,className:t.t(v===`cards`&&`border rounded-lg px-4 bg-card`),children:[(0,f.jsx)(J,{className:t.t(`hover:no-underline`,A[y].question),children:(0,f.jsx)(`span`,{className:`text-left`,children:e.question})}),(0,f.jsxs)(te,{children:[(0,f.jsx)(`div`,{className:t.t(`text-muted-foreground`,A[y].answer),children:typeof e.answer==`string`?(0,f.jsx)(`p`,{children:e.answer}):e.answer}),e.tags&&e.tags.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:e.tags.map(e=>(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e},e))}),g&&_&&(0,f.jsx)(QI,{itemId:e.id,helpful:e.helpful,notHelpful:e.notHelpful,onFeedback:_})]})]},e.id))}),M=e=>m?(0,f.jsx)(q,{type:`multiple`,defaultValue:h,className:`space-y-2`,children:j(e)}):(0,f.jsx)(q,{type:`single`,defaultValue:h[0],collapsible:!0,className:`space-y-2`,children:j(e)});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,b),children:[(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:t.t(`font-bold tracking-tight`,A[y].title),children:i}),a&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-2 max-w-2xl mx-auto`,children:a})]}),o&&(0,f.jsx)(`div`,{className:`max-w-md mx-auto`,children:(0,f.jsx)(XI,{value:x,onChange:S,placeholder:c})}),u&&r.length>0&&(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(ZI,{categories:r,activeCategory:T,onCategoryChange:E,itemCounts:O})}),D.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12`,children:[(0,f.jsx)(l.HelpCircle,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune question ne correspond à votre recherche.`})]}):v===`grouped`&&k?(0,f.jsx)(`div`,{className:`space-y-8`,children:Object.entries(k).map(([e,t])=>{let n=r.find(t=>t.id===e);return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center gap-2`,children:[n?.icon,n?.name||e]}),M(t)]},e)})}):(0,f.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:M(D)})]})}var eL=[{id:`general`,name:`Général`,icon:(0,f.jsx)(l.HelpCircle,{className:`h-4 w-4`})},{id:`billing`,name:`Facturation`,icon:(0,f.jsx)(l.MessageCircle,{className:`h-4 w-4`})},{id:`technical`,name:`Technique`,icon:(0,f.jsx)(l.MessageCircle,{className:`h-4 w-4`})}],tL=[{id:`1`,question:`Comment créer un compte ?`,answer:`Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.`,category:`general`,tags:[`compte`,`inscription`]},{id:`2`,question:`Comment réinitialiser mon mot de passe ?`,answer:`Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.`,category:`general`,tags:[`mot de passe`,`sécurité`]},{id:`3`,question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`,category:`billing`,tags:[`paiement`,`carte`]},{id:`4`,question:`Comment annuler mon abonnement ?`,answer:`Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.`,category:`billing`,tags:[`abonnement`,`annulation`]},{id:`5`,question:`L'API est-elle disponible ?`,answer:`Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.`,category:`technical`,tags:[`API`,`développeur`]}],nL={folder:{icon:l.Folder,color:`text-yellow-500`},document:{icon:l.FileText,color:`text-blue-500`},image:{icon:l.FileImage,color:`text-green-500`},video:{icon:l.FileVideo,color:`text-purple-500`},audio:{icon:l.FileAudio,color:`text-pink-500`},archive:{icon:l.FileArchive,color:`text-orange-500`},code:{icon:l.FileCode,color:`text-cyan-500`},other:{icon:l.File,color:`text-gray-500`}};function rL(e){if(!e)return`-`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(1)} ${t[n]}`}function iL({breadcrumbs:e,viewMode:n,onViewModeChange:i,onNavigate:a,onCreateFolder:o,onUpload:c,onRefresh:u,showSearch:d,onSearch:p,selectedCount:m,onDeleteSelected:h,onDownloadSelected:g}){let[_,v]=s.useState(``);return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:u,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),c&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:c,children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]}),o&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:o,children:[(0,f.jsx)(l.FolderPlus,{className:`h-4 w-4 mr-2`}),`Nouveau dossier`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&p&&(0,f.jsxs)(`div`,{className:`relative w-64`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:_,onChange:e=>{v(e.target.value),p(e.target.value)},className:`pl-9`})]}),(0,f.jsx)(r.r,{variant:n===`grid`?`secondary`:`ghost`,size:`icon`,onClick:()=>i(`grid`),children:(0,f.jsx)(l.Grid,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:n===`list`?`secondary`:`ghost`,size:`icon`,onClick:()=>i(`list`),children:(0,f.jsx)(l.List,{className:`h-4 w-4`})})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,f.jsx)(`button`,{onClick:()=>a(`/`),className:`flex items-center gap-1 hover:text-primary`,children:(0,f.jsx)(l.Home,{className:`h-4 w-4`})}),e.map((n,r)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`button`,{onClick:()=>a(n.path),className:t.t(`hover:text-primary`,r===e.length-1&&`font-medium`),children:n.name})]},n.id))]}),m>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-muted rounded-lg`,children:[(0,f.jsxs)(`span`,{className:`text-sm font-medium`,children:[m,` élément(s) sélectionné(s)`]}),g&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:g,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Télécharger`]}),h&&(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:h,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})}function aL({file:e,viewMode:i,isSelected:a,onSelect:o,onOpen:s,onRename:c,onDelete:u,onDownload:d,onShare:p,onToggleStar:m}){let h=nL[e.type],g=h.icon,_=typeof e.modifiedAt==`string`?new Date(e.modifiedAt):e.modifiedAt,v=()=>{e.type===`folder`&&s()};return i===`grid`?(0,f.jsxs)(`div`,{className:t.t(`relative group p-4 rounded-lg border cursor-pointer transition-colors`,a?`bg-primary/10 border-primary`:`hover:bg-muted`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,f.jsx)(`div`,{className:`absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,f.jsx)(we,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),e.starred&&(0,f.jsx)(l.Star,{className:`absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500`}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[e.thumbnail&&e.type===`image`?(0,f.jsx)(`img`,{src:e.thumbnail,alt:e.name,className:`w-16 h-16 object-cover rounded`}):(0,f.jsx)(g,{className:t.t(`h-12 w-12`,h.color)}),(0,f.jsx)(`span`,{className:`text-sm font-medium text-center line-clamp-2`,children:e.name}),e.type!==`folder`&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:rL(e.size)})]}),(0,f.jsx)(`div`,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:s,children:[(0,f.jsx)(l.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,f.jsxs)($,{onClick:c,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),d&&e.type!==`folder`&&(0,f.jsxs)($,{onClick:d,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),p&&(0,f.jsxs)($,{onClick:p,children:[(0,f.jsx)(l.Share2,{className:`mr-2 h-4 w-4`}),`Partager`]}),m&&(0,f.jsx)($,{onClick:m,children:e.starred?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.StarOff,{className:`mr-2 h-4 w-4`}),`Retirer des favoris`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Star,{className:`mr-2 h-4 w-4`}),`Ajouter aux favoris`]})}),u&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:u,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]}):(0,f.jsxs)(yr,{className:t.t(`cursor-pointer`,a&&`bg-primary/10`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,f.jsx)(xr,{className:`w-12`,children:(0,f.jsx)(we,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),(0,f.jsx)(xr,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(g,{className:t.t(`h-5 w-5`,h.color)}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),e.starred&&(0,f.jsx)(l.Star,{className:`h-4 w-4 text-yellow-500 fill-yellow-500`}),e.shared&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:`Partagé`})]})}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:rL(e.size)}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:_.toLocaleDateString(`fr-FR`)}),(0,f.jsx)(xr,{children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:s,children:[(0,f.jsx)(l.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,f.jsxs)($,{onClick:c,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),d&&e.type!==`folder`&&(0,f.jsxs)($,{onClick:d,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),u&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:u,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]})}function oL({files:e,currentPath:n=`/`,breadcrumbs:i=[],selectedFiles:a=[],onSelectionChange:o,onNavigate:c,onFileOpen:u,onDownload:d,onDelete:p,onRename:m,onCopy:h,onMove:g,onCreateFolder:_,onUpload:v,onShare:y,onToggleStar:b,onRefresh:x,viewMode:S,onViewModeChange:C,showSearch:w=!0,onSearch:T,showHeader:E=!0,showActions:D=!0,loading:O=!1,className:k}){let[A,j]=s.useState(`grid`),[M,N]=s.useState(!1),[P,F]=s.useState(null),[I,L]=s.useState(``),[R,z]=s.useState(!1),[B,V]=s.useState([]),[H,U]=s.useState(!1),[W,G]=s.useState(``),K=S??A,q=e=>{C?C(e):j(e)},ee=(e,t)=>{t?o?.([...a,e]):o?.(a.filter(t=>t!==e))},J=e=>{e.type===`folder`?c?.(e.path,e.id):u?.(e)},te=e=>{F(e),L(e.name),N(!0)},re=()=>{P&&I.trim()&&I!==P.name&&m?.(P.id,I.trim()),N(!1),F(null)},ie=()=>{V(a),z(!0)},ae=()=>{p?.(B),z(!1),V([]),o?.([])},pe=()=>{W.trim()&&(_?.(W.trim(),n),U(!1),G(``))},me=[...e].sort((e,t)=>e.type===`folder`&&t.type!==`folder`?-1:e.type!==`folder`&&t.type===`folder`?1:e.name.localeCompare(t.name));return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,k),children:[E&&(0,f.jsx)(iL,{breadcrumbs:i,viewMode:K,onViewModeChange:q,onNavigate:e=>c?.(e),onCreateFolder:_?()=>U(!0):void 0,onUpload:v?()=>{}:void 0,onRefresh:x,showSearch:w,onSearch:T,selectedCount:a.length,onDeleteSelected:p?ie:void 0,onDownloadSelected:d?()=>d(a):void 0}),O?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,f.jsx)(l.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):me.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,f.jsx)(l.Folder,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{children:`Ce dossier est vide`})]}):K===`grid`?(0,f.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4`,children:me.map(e=>(0,f.jsx)(aL,{file:e,viewMode:`grid`,isSelected:a.includes(e.id),onSelect:t=>ee(e.id,t),onOpen:()=>J(e),onRename:m?()=>te(e):void 0,onDelete:p?()=>{V([e.id]),z(!0)}:void 0,onDownload:d?()=>d([e.id]):void 0,onShare:y?()=>y(e.id):void 0,onToggleStar:b?()=>b(e.id):void 0},e.id))}):(0,f.jsxs)(hr,{children:[(0,f.jsx)(gr,{children:(0,f.jsxs)(yr,{children:[(0,f.jsx)(br,{className:`w-12`,children:(0,f.jsx)(we,{checked:a.length===e.length&&e.length>0,onCheckedChange:t=>{t?o?.(e.map(e=>e.id)):o?.([])}})}),(0,f.jsx)(br,{children:`Nom`}),(0,f.jsx)(br,{children:`Taille`}),(0,f.jsx)(br,{children:`Modifié`}),(0,f.jsx)(br,{className:`w-12`})]})}),(0,f.jsx)(_r,{children:me.map(e=>(0,f.jsx)(aL,{file:e,viewMode:`list`,isSelected:a.includes(e.id),onSelect:t=>ee(e.id,t),onOpen:()=>J(e),onRename:m?()=>te(e):void 0,onDelete:p?()=>{V([e.id]),z(!0)}:void 0,onDownload:d?()=>d([e.id]):void 0,onShare:y?()=>y(e.id):void 0,onToggleStar:b?()=>b(e.id):void 0},e.id))})]}),(0,f.jsx)(gt,{open:M,onOpenChange:N,children:(0,f.jsxs)(xt,{children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Renommer`})}),(0,f.jsx)(r.n,{value:I,onChange:e=>L(e.target.value),placeholder:`Nouveau nom`,onKeyDown:e=>e.key===`Enter`&&re()}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>N(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:re,children:`Renommer`})]})]})}),(0,f.jsx)(ne,{open:R,onOpenChange:z,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,B.length,` élément(s) ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:ae,children:`Supprimer`})]})]})}),(0,f.jsx)(gt,{open:H,onOpenChange:U,children:(0,f.jsxs)(xt,{children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Nouveau dossier`})}),(0,f.jsx)(r.n,{value:W,onChange:e=>G(e.target.value),placeholder:`Nom du dossier`,onKeyDown:e=>e.key===`Enter`&&pe()}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>U(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:pe,children:`Créer`})]})]})})]})}var sL=[{id:`1`,name:`Documents`,type:`folder`,path:`/Documents`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-15`)},{id:`2`,name:`Images`,type:`folder`,path:`/Images`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-10`),starred:!0},{id:`3`,name:`Rapport Q4.pdf`,type:`document`,path:`/Rapport Q4.pdf`,size:2456e3,createdAt:new Date(`2024-01-05`),modifiedAt:new Date(`2024-01-05`)},{id:`4`,name:`Photo vacances.jpg`,type:`image`,path:`/Photo vacances.jpg`,size:567e4,createdAt:new Date(`2024-01-08`),modifiedAt:new Date(`2024-01-08`)},{id:`5`,name:`Présentation.pptx`,type:`document`,path:`/Présentation.pptx`,size:89e5,createdAt:new Date(`2024-01-12`),modifiedAt:new Date(`2024-01-14`),shared:!0}],cL=[{id:`root`,name:`Mes fichiers`,path:`/`}],lL={low:{label:`Basse`,color:`bg-gray-500`,icon:l.Clock},medium:{label:`Moyenne`,color:`bg-blue-500`,icon:l.Clock},high:{label:`Haute`,color:`bg-orange-500`,icon:l.AlertCircle},urgent:{label:`Urgente`,color:`bg-red-500`,icon:l.AlertCircle}};function uL({card:e,columnId:i,showAssignees:a,showLabels:o,showPriority:c,showDueDate:u,draggable:d,onCardClick:p,onCardEdit:m,onCardDelete:h,onDragStart:g}){let _=s.useMemo(()=>e.dueDate?(typeof e.dueDate==`string`?new Date(e.dueDate):e.dueDate)<new Date:!1,[e.dueDate]);return(0,f.jsx)(Y,{className:t.t(`cursor-pointer hover:shadow-md transition-shadow`,d&&`cursor-grab active:cursor-grabbing`),draggable:d,onDragStart:t=>g?.(t,e.id,i),onClick:()=>p?.(e,i),children:(0,f.jsxs)(Q,{className:`p-3 space-y-2`,children:[o&&e.labels&&e.labels.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.labels.map(e=>(0,f.jsx)(`div`,{className:`h-1.5 w-8 rounded-full`,style:{backgroundColor:e.color},title:e.name},e.id))}),(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium leading-tight`,children:e.title}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-6 w-6 flex-shrink-0`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-3 w-3`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:t=>{t.stopPropagation(),p?.(e,i)},children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:t=>{t.stopPropagation(),h?.(e.id,i)},className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&e.priority&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,lL[e.priority].color),title:lL[e.priority].label}),u&&e.dueDate&&(0,f.jsxs)(n.x,{variant:_?`destructive`:`outline`,className:`text-xs px-1.5 py-0`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3 mr-1`}),(e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`}))(e.dueDate)]})]}),a&&e.assignees&&e.assignees.length>0&&(0,f.jsxs)(`div`,{className:`flex -space-x-1`,children:[e.assignees.slice(0,3).map(e=>(0,f.jsxs)(ve,{className:`h-5 w-5 border-2 border-background`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-[8px]`,children:e.name.charAt(0)})]},e.id)),e.assignees.length>3&&(0,f.jsxs)(`div`,{className:`h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background`,children:[`+`,e.assignees.length-3]})]})]})]})})}function dL({column:e,showCardCount:t,showAddCard:a,showAssignees:o,showLabels:c,showPriority:u,showDueDate:d,draggable:p,onCardClick:m,onCardAdd:h,onCardEdit:g,onCardDelete:_,onColumnEdit:v,onColumnDelete:y,onDragStart:b,onDragOver:x,onDrop:S}){let[C,w]=s.useState(!1),[T,E]=s.useState(``),[D,O]=s.useState(!1),[k,A]=s.useState(e.title),j=()=>{T.trim()&&(h?.(e.id,{title:T.trim()}),E(``),w(!1))},M=()=>{k.trim()&&k!==e.title&&v?.(e.id,{title:k.trim()}),O(!1)},N=e.limit&&e.cards.length>=e.limit;return(0,f.jsxs)(`div`,{className:`flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg`,onDragOver:x,onDrop:t=>S?.(t,e.id),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.color&&(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full`,style:{backgroundColor:e.color}}),D?(0,f.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,f.jsx)(r.n,{value:k,onChange:e=>A(e.target.value),className:`h-7 text-sm font-semibold`,autoFocus:!0,onBlur:M,onKeyDown:e=>{e.key===`Enter`&&M(),e.key===`Escape`&&O(!1)}})}):(0,f.jsx)(`h3`,{className:`font-semibold text-sm cursor-pointer`,onClick:()=>O(!0),children:e.title}),t&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.cards.length,e.limit&&`/${e.limit}`]})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>O(!0),children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:()=>y?.(e.id),className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto`,children:[e.cards.map(t=>(0,f.jsx)(uL,{card:t,columnId:e.id,showAssignees:o,showLabels:c,showPriority:u,showDueDate:d,draggable:p,onCardClick:m,onCardEdit:g,onCardDelete:_,onDragStart:b},t.id)),C&&(0,f.jsxs)(Y,{className:`p-2`,children:[(0,f.jsx)(i.n,{placeholder:`Titre de la carte...`,value:T,onChange:e=>E(e.target.value),className:`min-h-[60px] text-sm`,autoFocus:!0}),(0,f.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,f.jsx)(r.r,{size:`sm`,onClick:j,children:`Ajouter`}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>{w(!1),E(``)},children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})]})]}),a&&!C&&!N&&(0,f.jsx)(`div`,{className:`p-2 border-t`,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>w(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une carte`]})}),N&&(0,f.jsx)(`div`,{className:`p-2 border-t text-center text-xs text-muted-foreground`,children:`Limite atteinte`})]})}function fL({columns:e,onColumnsChange:n,onCardClick:i,onCardAdd:a,onCardEdit:o,onCardDelete:c,onCardMove:u,onColumnAdd:d,onColumnEdit:p,onColumnDelete:m,showAddCard:h=!0,showAddColumn:g=!0,showCardCount:_=!0,showAssignees:v=!0,showLabels:y=!0,showPriority:b=!0,showDueDate:x=!0,draggable:S=!0,availableLabels:C=[],availableAssignees:w=[],className:T}){let[E,D]=s.useState(e),[O,k]=s.useState(null),[A,j]=s.useState(!1),[M,N]=s.useState(``);s.useEffect(()=>{D(e)},[e]);let P=(e,t,n)=>{k({cardId:t,columnId:n}),e.dataTransfer.effectAllowed=`move`},F=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},I=(e,t)=>{if(e.preventDefault(),!O)return;let{cardId:r,columnId:i}=O;if(i===t){k(null);return}if(u)u(r,i,t,0);else{let e=E.map(e=>{if(e.id===i)return{...e,cards:e.cards.filter(e=>e.id!==r)};if(e.id===t){let t=E.find(e=>e.id===i)?.cards.find(e=>e.id===r);if(t)return{...e,cards:[...e.cards,t]}}return e});D(e),n?.(e)}k(null)},L=(e,t)=>{if(a)a(e,t);else{let r={id:`card-${Date.now()}`,title:t.title||`Nouvelle carte`,...t},i=E.map(t=>t.id===e?{...t,cards:[...t.cards,r]}:t);D(i),n?.(i)}},R=(e,t)=>{if(c)c(e,t);else{let r=E.map(n=>n.id===t?{...n,cards:n.cards.filter(t=>t.id!==e)}:n);D(r),n?.(r)}},z=e=>{if(m)m(e);else{let t=E.filter(t=>t.id!==e);D(t),n?.(t)}},B=()=>{if(M.trim()){let e={id:`column-${Date.now()}`,title:M.trim(),cards:[]};if(d)d(e);else{let t=[...E,e];D(t),n?.(t)}N(``),j(!1)}};return(0,f.jsx)(`div`,{className:t.t(`overflow-x-auto`,T),children:(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 min-h-[500px]`,children:[E.map(e=>(0,f.jsx)(dL,{column:e,showCardCount:_,showAddCard:h,showAssignees:v,showLabels:y,showPriority:b,showDueDate:x,draggable:S,onCardClick:i,onCardAdd:L,onCardEdit:o,onCardDelete:R,onColumnEdit:p,onColumnDelete:z,onDragStart:P,onDragOver:F,onDrop:I},e.id)),g&&(0,f.jsx)(`div`,{className:`w-72 flex-shrink-0`,children:A?(0,f.jsxs)(Y,{className:`p-3`,children:[(0,f.jsx)(r.n,{placeholder:`Titre de la colonne...`,value:M,onChange:e=>N(e.target.value),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&B(),e.key===`Escape`&&j(!1)}}),(0,f.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,f.jsx)(r.r,{size:`sm`,onClick:B,children:`Ajouter`}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>{j(!1),N(``)},children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})]}):(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full justify-start h-12`,onClick:()=>j(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une colonne`]})})]})})}var pL=[{id:`todo`,title:`À faire`,color:`#6b7280`,cards:[{id:`1`,title:`Implémenter l'authentification`,description:`Ajouter le login/logout avec JWT`,priority:`high`,labels:[{id:`dev`,name:`Dev`,color:`#3b82f6`}],assignees:[{id:`1`,name:`Marie D.`}]},{id:`2`,title:`Créer les maquettes`,priority:`medium`,labels:[{id:`design`,name:`Design`,color:`#8b5cf6`}]}]},{id:`in-progress`,title:`En cours`,color:`#3b82f6`,limit:3,cards:[{id:`3`,title:`Refactoring du dashboard`,priority:`medium`,assignees:[{id:`2`,name:`Pierre M.`}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:`review`,title:`En revue`,color:`#f59e0b`,cards:[]},{id:`done`,title:`Terminé`,color:`#10b981`,cards:[{id:`4`,title:`Setup du projet`,priority:`low`}]}],mL=[{id:`dev`,name:`Dev`,color:`#3b82f6`},{id:`design`,name:`Design`,color:`#8b5cf6`},{id:`bug`,name:`Bug`,color:`#ef4444`},{id:`feature`,name:`Feature`,color:`#10b981`}],hL=s.createContext({});function gL(){return s.useContext(hL)}function _L({logo:e,brandName:n=`Brand`,navItems:i=[],showLoginButton:a=!0,loginButtonText:o=`Se connecter`,onLogin:c,loginHref:u}){let[d,p]=s.useState(!1),{LinkComponent:m}=gL(),h=(e,t,n,r)=>m?(0,f.jsx)(m,{href:e,className:t,onClick:r,children:n}):(0,f.jsx)(`a`,{href:e,className:t,onClick:r,children:n});return(0,f.jsxs)(`nav`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,f.jsxs)(`div`,{className:`container flex h-16 items-center justify-between`,children:[h(`/`,`flex items-center gap-2 font-bold text-xl`,(0,f.jsxs)(f.Fragment,{children:[e,(0,f.jsx)(`span`,{children:n})]})),(0,f.jsx)(`div`,{className:`hidden md:flex items-center gap-6`,children:i.map(e=>h(e.href,t.t(`text-sm font-medium transition-colors hover:text-primary`,e.isActive?`text-primary`:`text-muted-foreground`),e.label))}),(0,f.jsx)(`div`,{className:`hidden md:flex items-center gap-4`,children:a&&(0,f.jsx)(r.r,{variant:`default`,onClick:c,asChild:!!u,children:u?m?(0,f.jsx)(m,{href:u,children:o}):(0,f.jsx)(`a`,{href:u,children:o}):o})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:()=>p(!d),children:d?(0,f.jsx)(l.X,{className:`h-5 w-5`}):(0,f.jsx)(l.Menu,{className:`h-5 w-5`})})]}),d&&(0,f.jsx)(`div`,{className:`md:hidden border-t bg-background p-4`,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i.map(e=>h(e.href,`text-sm font-medium`,e.label,()=>p(!1))),a&&(0,f.jsx)(r.r,{onClick:c,asChild:!!u,children:u?m?(0,f.jsx)(m,{href:u,children:o}):(0,f.jsx)(`a`,{href:u,children:o}):o})]})})]})}function vL({badge:e,title:t,highlightedTitle:i,description:a,primaryButtonText:o=`Commencer`,primaryButtonAction:s,primaryButtonHref:c,secondaryButtonText:u,secondaryButtonAction:d,secondaryButtonHref:p,image:m,stats:h}){let{LinkComponent:g}=gL();return(0,f.jsx)(`section`,{className:`container py-24 md:py-32`,children:(0,f.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-center gap-12`,children:[(0,f.jsxs)(`div`,{className:`flex-1 text-center lg:text-left`,children:[e&&(0,f.jsx)(n.x,{variant:`secondary`,className:`mb-4`,children:e}),(0,f.jsxs)(`h1`,{className:`text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6`,children:[t,` `,i&&(0,f.jsx)(`span`,{className:`text-primary`,children:i})]}),(0,f.jsx)(`p`,{className:`text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none`,children:a}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8`,children:[(0,f.jsx)(r.r,{size:`lg`,onClick:s,asChild:!!c,children:c?g?(0,f.jsxs)(g,{href:c,children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(`a`,{href:c,children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(f.Fragment,{children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]})}),u&&(0,f.jsx)(r.r,{size:`lg`,variant:`outline`,onClick:d,asChild:!!p,children:p?g?(0,f.jsxs)(g,{href:p,children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]}):(0,f.jsxs)(`a`,{href:p,children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]})})]}),h&&h.length>0&&(0,f.jsx)(`div`,{className:`flex gap-8 justify-center lg:justify-start`,children:h.map((e,t)=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-2xl md:text-3xl font-bold`,children:e.value}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label})]},t))})]}),m&&(0,f.jsx)(`div`,{className:`flex-1 w-full lg:w-auto`,children:m})]})})}function yL({title:e=`Fonctionnalités`,description:t,features:n}){return(0,f.jsxs)(`section`,{className:`container py-24 bg-muted/30`,children:[(0,f.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,f.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),t&&(0,f.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:t})]}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,f.jsxs)(Y,{className:`bg-background`,children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4`,children:(0,f.jsx)(`span`,{className:`text-primary`,children:e.icon})}),(0,f.jsx)(Z,{className:`text-xl`,children:e.title})]}),(0,f.jsx)(Q,{children:(0,f.jsx)(Se,{className:`text-base`,children:e.description})})]},e.id))})]})}function bL({title:e=`Ce que disent nos clients`,testimonials:n}){return(0,f.jsxs)(`section`,{className:`container py-24`,children:[(0,f.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight text-center mb-12`,children:e}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[e.rating&&(0,f.jsx)(`div`,{className:`flex gap-1 mb-4`,children:Array.from({length:5}).map((n,r)=>(0,f.jsx)(l.Star,{className:t.t(`h-4 w-4`,r<e.rating?`text-yellow-400 fill-yellow-400`:`text-muted-foreground`)},r))}),(0,f.jsxs)(`p`,{className:`text-muted-foreground mb-6`,children:[`"`,e.content,`"`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.avatar?(0,f.jsx)(`img`,{src:e.avatar,alt:e.author,className:`h-10 w-10 rounded-full object-cover`}):(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,f.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:e.author.charAt(0)})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.author}),(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e.role,e.company&&` @ ${e.company}`]})]})]})]})},e.id))})]})}function xL({title:e,description:n,buttonText:i,buttonAction:a,buttonHref:o,secondaryButtonText:s,secondaryButtonAction:c,variant:u=`default`}){let{LinkComponent:d}=gL();return(0,f.jsx)(`section`,{className:t.t(`py-24`,{default:`bg-muted/50`,gradient:`bg-gradient-to-r from-primary/10 via-primary/5 to-background`,dark:`bg-foreground text-background`}[u]),children:(0,f.jsx)(`div`,{className:`container`,children:(0,f.jsxs)(`div`,{className:`text-center max-w-2xl mx-auto`,children:[(0,f.jsx)(`h2`,{className:t.t(`text-3xl md:text-4xl font-bold tracking-tight mb-4`,u===`dark`&&`text-background`),children:e}),n&&(0,f.jsx)(`p`,{className:t.t(`text-lg mb-8`,u===`dark`?`text-background/80`:`text-muted-foreground`),children:n}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:[(0,f.jsx)(r.r,{size:`lg`,variant:u===`dark`?`secondary`:`default`,onClick:a,asChild:!!o,children:o?d?(0,f.jsxs)(d,{href:o,children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(`a`,{href:o,children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(f.Fragment,{children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]})}),s&&(0,f.jsx)(r.r,{size:`lg`,variant:`outline`,onClick:c,className:u===`dark`?`border-background/20 text-background hover:bg-background/10`:``,children:s})]})]})})})}function SL({logo:e,brandName:n=`Brand`,navItems:r,showLoginButton:i=!0,loginButtonText:a=`Se connecter`,onLogin:o,loginHref:c,hero:l,features:u,featuresTitle:d,featuresDescription:p,testimonials:m,testimonialsTitle:h,cta:g,footer:_,className:v,LinkComponent:y}){let b=s.useMemo(()=>({LinkComponent:y}),[y]);return(0,f.jsx)(hL.Provider,{value:b,children:(0,f.jsxs)(`div`,{className:t.t(`min-h-screen`,v),children:[(0,f.jsx)(_L,{logo:e,brandName:n,navItems:r,showLoginButton:i,loginButtonText:a,onLogin:o,loginHref:c}),l&&(0,f.jsx)(vL,{...l}),u&&u.length>0&&(0,f.jsx)(yL,{title:d,description:p,features:u}),m&&m.length>0&&(0,f.jsx)(bL,{title:h,testimonials:m}),g&&(0,f.jsx)(xL,{...g}),_]})})}var CL=[{label:`Fonctionnalités`,href:`#features`},{label:`Tarifs`,href:`#pricing`},{label:`Témoignages`,href:`#testimonials`},{label:`Contact`,href:`#contact`}],wL=[{id:`1`,icon:(0,f.jsx)(l.Zap,{className:`h-6 w-6`}),title:`Rapide et performant`,description:`Optimisé pour la vitesse avec des temps de chargement minimaux.`},{id:`2`,icon:(0,f.jsx)(l.Shield,{className:`h-6 w-6`}),title:`Sécurisé`,description:`Vos données sont protégées avec un chiffrement de bout en bout.`},{id:`3`,icon:(0,f.jsx)(l.Users,{className:`h-6 w-6`}),title:`Collaboration`,description:`Travaillez en équipe avec des outils de collaboration intégrés.`},{id:`4`,icon:(0,f.jsx)(l.Globe,{className:`h-6 w-6`}),title:`Accessible partout`,description:`Accédez à votre espace depuis n'importe quel appareil.`}],TL=[{id:`1`,content:`Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.`,author:`Marie Dupont`,role:`CEO`,company:`TechCorp`,rating:5},{id:`2`,content:`Interface intuitive et support réactif. Je recommande vivement.`,author:`Pierre Martin`,role:`CTO`,company:`StartupXYZ`,rating:5},{id:`3`,content:`Le meilleur outil que nous ayons utilisé pour gérer nos projets.`,author:`Sophie Bernard`,role:`Product Manager`,company:`InnoLab`,rating:5}],EL={badge:`Nouveau`,title:`La solution pour`,highlightedTitle:`votre entreprise`,description:`Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.`,primaryButtonText:`Essayer gratuitement`,secondaryButtonText:`Voir la démo`,stats:[{value:`10K+`,label:`Utilisateurs`},{value:`99.9%`,label:`Uptime`},{value:`24/7`,label:`Support`}]},DL={title:`Prêt à commencer ?`,description:`Rejoignez des milliers d'entreprises qui nous font confiance.`,buttonText:`Créer un compte gratuit`,secondaryButtonText:`Contacter les ventes`,variant:`gradient`},OL=s.createContext({});function kL(){return s.useContext(OL)}function AL({period:e,onChange:r,yearlyDiscount:a}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mb-8`,children:[(0,f.jsx)(i.o,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors`,e===`monthly`?`text-foreground`:`text-muted-foreground`),children:`Mensuel`}),(0,f.jsx)(mr,{id:`billing-toggle`,checked:e===`yearly`,onCheckedChange:e=>r(e?`yearly`:`monthly`)}),(0,f.jsxs)(i.o,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors flex items-center gap-2`,e===`yearly`?`text-foreground`:`text-muted-foreground`),children:[`Annuel`,a&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[`-`,a]})]})]})}function jL({plan:e,billingPeriod:i}){let{LinkComponent:a}=kL(),o=i===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,s=i===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,c=typeof o==`string`;return(0,f.jsxs)(Y,{className:t.t(`relative flex flex-col`,e.popular&&`border-primary shadow-lg scale-105`),children:[e.popular&&(0,f.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2`,children:(0,f.jsxs)(n.x,{className:`px-3`,children:[(0,f.jsx)(l.Zap,{className:`h-3 w-3 mr-1`}),e.badge||`Populaire`]})}),(0,f.jsxs)(X,{className:`text-center pb-2`,children:[(0,f.jsx)(Z,{className:`text-xl`,children:e.name}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),(0,f.jsxs)(Q,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`text-center mb-6`,children:c?(0,f.jsx)(`div`,{className:`text-3xl font-bold`,children:o}):(0,f.jsxs)(`div`,{className:`flex items-baseline justify-center`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground mr-1`,children:e.currency||`€`}),(0,f.jsx)(`span`,{className:`text-4xl font-bold`,children:o}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground ml-1`,children:s})]})}),(0,f.jsx)(`ul`,{className:`space-y-3`,children:e.features.map((e,n)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.included===!0?(0,f.jsx)(l.Check,{className:`h-5 w-5 text-green-500 flex-shrink-0`}):e.included===`partial`||e.included===`limited`?(0,f.jsx)(l.Check,{className:`h-5 w-5 text-yellow-500 flex-shrink-0`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,f.jsxs)(`span`,{className:t.t(`text-sm`,!e.included&&`text-muted-foreground`),children:[e.name,e.value&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.value,`)`]})]}),e.tooltip&&(0,f.jsx)(ti,{children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(l.HelpCircle,{className:`h-4 w-4 text-muted-foreground cursor-help`})}),(0,f.jsx)(ii,{children:(0,f.jsx)(`p`,{className:`max-w-xs`,children:e.tooltip})})]})})]},n))})]}),(0,f.jsx)(Ce,{children:(0,f.jsx)(r.r,{className:`w-full`,variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,f.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,f.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})})]})}function ML({plans:e,billingPeriod:i}){let{LinkComponent:a}=kL(),o=Array.from(new Set(e.flatMap(e=>e.features.map(e=>e.name))));return(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,f.jsxs)(`thead`,{children:[(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`text-left p-4 border-b bg-muted/50`,children:`Fonctionnalité`}),e.map(e=>(0,f.jsxs)(`th`,{className:t.t(`text-center p-4 border-b min-w-[150px]`,e.popular&&`bg-primary/5`),children:[(0,f.jsx)(`div`,{className:`font-bold`,children:e.name}),e.popular&&(0,f.jsx)(n.x,{className:`mt-1`,variant:`default`,children:`Populaire`})]},e.id))]}),(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{className:`p-4 border-b bg-muted/50 font-medium`,children:`Prix`}),e.map(e=>{let n=i===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,r=i===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,a=typeof n==`string`;return(0,f.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:a?(0,f.jsx)(`span`,{className:`font-bold`,children:n}):(0,f.jsxs)(`span`,{className:`font-bold`,children:[e.currency||`€`,n,(0,f.jsx)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:r})]})},e.id)})]})]}),(0,f.jsxs)(`tbody`,{children:[o.map((n,r)=>(0,f.jsxs)(`tr`,{className:r%2==0?`bg-muted/20`:``,children:[(0,f.jsx)(`td`,{className:`p-4 border-b`,children:n}),e.map(e=>{let r=e.features.find(e=>e.name===n);return(0,f.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:r?r.included===!0?r.value?(0,f.jsx)(`span`,{children:r.value}):(0,f.jsx)(l.Check,{className:`h-5 w-5 text-green-500 mx-auto`}):r.included===`partial`||r.included===`limited`?(0,f.jsx)(`span`,{className:`text-yellow-600`,children:r.value||`Limité`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground mx-auto`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground mx-auto`})},e.id)})]},r)),(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{className:`p-4`}),e.map(e=>(0,f.jsx)(`td`,{className:t.t(`text-center p-4`,e.popular&&`bg-primary/5`),children:(0,f.jsx)(r.r,{variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,f.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,f.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})},e.id))]})]})]})})}function NL({title:e=`Questions fréquentes`,items:t}){return(0,f.jsxs)(`div`,{className:`mt-16`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold text-center mb-8`,children:e}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 gap-6 max-w-4xl mx-auto`,children:t.map((e,t)=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:e.question}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e.answer})]},t))})]})}function PL({title:e=`Tarification`,description:n,plans:r,showBillingToggle:i=!0,billingPeriod:a,onBillingPeriodChange:o,yearlyDiscount:c,faq:l,faqTitle:u,layout:d=`cards`,columns:p=3,showComparison:m=!1,className:h,LinkComponent:g}){let[_,v]=s.useState(`monthly`),y=a??_,b=e=>{o?o(e):v(e)},x={2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`,4:`md:grid-cols-2 lg:grid-cols-4`},S=s.useMemo(()=>({LinkComponent:g}),[g]);return(0,f.jsx)(OL.Provider,{value:S,children:(0,f.jsxs)(`div`,{className:t.t(`container py-16`,h),children:[(0,f.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,f.jsx)(`h1`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:n})]}),i&&(0,f.jsx)(AL,{period:y,onChange:b,yearlyDiscount:c}),d===`cards`&&!m?(0,f.jsx)(`div`,{className:t.t(`grid gap-6 items-stretch`,x[p]),children:r.map(e=>(0,f.jsx)(jL,{plan:e,billingPeriod:y},e.id))}):(0,f.jsx)(ML,{plans:r,billingPeriod:y}),l&&l.length>0&&(0,f.jsx)(NL,{title:u,items:l})]})})}var FL=[{id:`free`,name:`Gratuit`,description:`Pour démarrer`,price:0,priceYearly:0,features:[{name:`1 utilisateur`,included:!0},{name:`5 projets`,included:!0},{name:`1 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!1},{name:`Analytics avancés`,included:!1},{name:`Support prioritaire`,included:!1}],buttonText:`Commencer gratuitement`,buttonVariant:`outline`},{id:`pro`,name:`Pro`,description:`Pour les équipes`,price:29,priceYearly:24,periodYearly:`/mois (facturé annuellement)`,popular:!0,features:[{name:`5 utilisateurs`,included:!0},{name:`Projets illimités`,included:!0},{name:`50 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!1}],buttonText:`Essai gratuit 14 jours`},{id:`enterprise`,name:`Enterprise`,description:`Pour les grandes équipes`,price:`Sur mesure`,features:[{name:`Utilisateurs illimités`,included:!0},{name:`Projets illimités`,included:!0},{name:`Stockage illimité`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!0}],buttonText:`Contacter les ventes`,buttonVariant:`outline`}],IL=[{question:`Puis-je changer de plan à tout moment ?`,answer:`Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement.`},{question:`Y a-t-il une période d'essai ?`,answer:`Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise.`},{question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`},{question:`Puis-je annuler à tout moment ?`,answer:`Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires.`}],LL=s.createContext(null);function RL(){let e=s.useContext(LL);if(!e)throw Error(`useWizard must be used within a WakaWizard`);return e}function zL({steps:e,currentStep:n,stepStatuses:r,showStepNumbers:i,orientation:a,onStepClick:o,allowBackNavigation:c}){let u=(e,t)=>t===`completed`?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):t===`error`?(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4`}):t===`skipped`?(0,f.jsx)(l.X,{className:`h-4 w-4 text-muted-foreground`}):i?(0,f.jsx)(`span`,{className:`text-xs font-medium`,children:e+1}):(0,f.jsx)(l.Circle,{className:`h-3 w-3`}),d=e=>{switch(e){case`completed`:return`bg-primary text-primary-foreground border-primary`;case`current`:return`bg-primary text-primary-foreground border-primary`;case`error`:return`bg-destructive text-destructive-foreground border-destructive`;case`skipped`:return`bg-muted text-muted-foreground border-muted`;default:return`bg-background text-muted-foreground border-border`}};return a===`vertical`?(0,f.jsx)(`div`,{className:`flex flex-col gap-0`,children:e.map((i,a)=>{let s=r[a],l=c&&a<n;return(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,f.jsx)(`button`,{type:`button`,disabled:!l,onClick:()=>l&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,d(s),l&&`cursor-pointer hover:opacity-80`),children:i.icon||u(a,s)}),a<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`w-0.5 flex-1 min-h-[24px]`,r[a]===`completed`?`bg-primary`:`bg-border`)})]}),(0,f.jsxs)(`div`,{className:`pb-8`,children:[(0,f.jsxs)(`div`,{className:t.t(`font-medium`,s===`current`?`text-foreground`:`text-muted-foreground`),children:[i.title,i.optional&&(0,f.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:`(optionnel)`})]}),i.description&&(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-0.5`,children:i.description})]})]},i.id)})}):(0,f.jsx)(`div`,{className:`flex items-center gap-0`,children:e.map((i,a)=>{let l=r[a],p=c&&a<n;return(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,disabled:!p,onClick:()=>p&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,d(l),p&&`cursor-pointer hover:opacity-80`),children:i.icon||u(a,l)}),(0,f.jsx)(`div`,{className:`text-center`,children:(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,l===`current`?`text-foreground`:`text-muted-foreground`),children:i.title})})]}),a<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`flex-1 h-0.5 mx-2 mb-6`,r[a]===`completed`?`bg-primary`:`bg-border`)})]},i.id)})})}function BL({onPrev:e,onNext:t,onSkip:n,onCancel:i,isFirstStep:a,isLastStep:o,isOptional:s,prevButtonText:c,nextButtonText:u,finishButtonText:d,skipButtonText:p,cancelButtonText:m,showCancelButton:h,submitting:g}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`div`,{className:`flex gap-2`,children:h&&i&&(0,f.jsx)(r.r,{type:`button`,variant:`ghost`,onClick:i,disabled:g,children:m})}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[!a&&(0,f.jsxs)(r.r,{type:`button`,variant:`outline`,onClick:e,disabled:g,children:[(0,f.jsx)(l.ArrowLeft,{className:`mr-2 h-4 w-4`}),c]}),s&&n&&!o&&(0,f.jsx)(r.r,{type:`button`,variant:`ghost`,onClick:n,disabled:g,children:p}),(0,f.jsxs)(r.r,{type:`button`,onClick:t,disabled:g,children:[g&&(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),o?d:u,!o&&!g&&(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]})]})]})}function VL({steps:e,currentStep:n,onStepChange:r,onSubmit:i,onCancel:a,title:o,description:c,prevButtonText:l=`Précédent`,nextButtonText:u=`Suivant`,finishButtonText:d=`Terminer`,cancelButtonText:p=`Annuler`,skipButtonText:m=`Passer`,showCancelButton:h=!0,showProgress:g=!0,showStepNumbers:_=!0,showStepper:v=!0,stepperPosition:y=`top`,allowBackNavigation:b=!0,confirmCancel:x=!0,cancelConfirmMessage:S=`Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.`,submitting:C=!1,layout:w=`card`,className:T}){let[E,D]=s.useState(0),[O,k]=s.useState(e.map((e,t)=>t===0?`current`:`pending`)),[A,j]=s.useState(!1),M=n??E,N=M===0,P=M===e.length-1,F=e[M],I=(M+1)/e.length*100,L=(t,n)=>{k(r=>{let i=[...r];if(n===`next`&&M<e.length)i[M]=`completed`;else if(n===`skip`)i[M]=`skipped`;else if(n===`goto`&&t<M)for(let n=t+1;n<e.length;n++)i[n]=`pending`;return i[t]=`current`,i})},R=async t=>{if(t<0||t>=e.length||t>M&&!b)return;F.onLeave&&await F.onLeave(),L(t,`goto`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},z=async()=>{if(F.validate&&!await F.validate()){k(e=>{let t=[...e];return t[M]=`error`,t});return}if(F.onLeave&&await F.onLeave(),P){let t={steps:e.map((e,t)=>({id:e.id,status:t===M?`completed`:O[t]})),completedSteps:e.filter((e,t)=>O[t]===`completed`||t===M).map(e=>e.id),skippedSteps:e.filter((e,t)=>O[t]===`skipped`).map(e=>e.id)};await i?.(t)}else{let t=M+1;L(t,`next`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()}},B=async()=>{if(N)return;F.onLeave&&await F.onLeave();let t=M-1;L(t,`prev`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},V=async()=>{if(!F.optional||P)return;F.onLeave&&await F.onLeave();let t=M+1;L(t,`skip`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},H=()=>{x?j(!0):a?.()},U={currentStep:M,totalSteps:e.length,stepStatuses:O,goToStep:R,nextStep:z,prevStep:B,skipStep:V,isFirstStep:N,isLastStep:P},W=v&&(0,f.jsx)(zL,{steps:e,currentStep:M,stepStatuses:O,showStepNumbers:_,orientation:y===`left`?`vertical`:`horizontal`,onStepClick:R,allowBackNavigation:b}),G=(0,f.jsx)(BL,{onPrev:B,onNext:z,onSkip:F.optional?V:void 0,onCancel:a?H:void 0,isFirstStep:N,isLastStep:P,isOptional:F.optional||!1,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:m,cancelButtonText:p,showCancelButton:h,submitting:C}),K=(0,f.jsxs)(LL.Provider,{value:U,children:[y===`left`?(0,f.jsxs)(`div`,{className:`flex gap-8`,children:[(0,f.jsx)(`div`,{className:`w-64 flex-shrink-0`,children:W}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[g&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,f.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,f.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,f.jsx)(Zn,{value:I})]}),(0,f.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,f.jsx)(`div`,{className:`mt-8`,children:G})]})]}):(0,f.jsxs)(f.Fragment,{children:[W&&(0,f.jsx)(`div`,{className:`mb-8`,children:W}),g&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,f.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,f.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,f.jsx)(Zn,{value:I})]}),(0,f.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,f.jsx)(`div`,{className:`mt-8`,children:G})]}),(0,f.jsx)(ne,{open:A,onOpenChange:j,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Annuler ?`}),(0,f.jsx)(ue,{children:S})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Non, continuer`}),(0,f.jsx)(de,{onClick:()=>{j(!1),a?.()},children:`Oui, annuler`})]})]})})]});return w===`minimal`?(0,f.jsx)(`div`,{className:t.t(`space-y-6`,T),children:K}):w===`page`?(0,f.jsxs)(`div`,{className:t.t(`container py-8 max-w-4xl`,T),children:[(o||c)&&(0,f.jsxs)(`div`,{className:`mb-8`,children:[o&&(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:o}),c&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:c})]}),K]}):(0,f.jsxs)(Y,{className:T,children:[(o||c)&&(0,f.jsxs)(X,{children:[o&&(0,f.jsx)(Z,{children:o}),c&&(0,f.jsx)(Se,{children:c})]}),(0,f.jsx)(Q,{children:K})]})}var HL=[{id:`step-1`,title:`Informations de base`,description:`Renseignez vos informations personnelles`,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 1 - Informations de base`})})},{id:`step-2`,title:`Configuration`,description:`Configurez vos préférences`,optional:!0,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 2 - Configuration (optionnel)`})})},{id:`step-3`,title:`Confirmation`,description:`Vérifiez et confirmez`,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 3 - Confirmation`})})}];function UL(e,t,n){let r=e.translations[n]?.value||``,i=e.translations[t]?.value;return!i||i.trim()===``?`missing`:i===r?`identical`:`valid`}function WL(e,t,n){let r=t.filter(e=>e!==n).map(t=>UL(e,t,n));return r.includes(`missing`)?`missing`:r.includes(`identical`)?`identical`:`valid`}function GL(e,t){let n=new Map;for(let r of e){let e=r.key.split(t),i=e.length>1?e[0]:`__root__`;n.has(i)||n.set(i,[]),n.get(i).push(r)}return n}function KL({status:e}){let{label:r,icon:i,className:a}={valid:{label:`OK`,variant:`default`,icon:l.CheckCircle,className:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300`},missing:{label:`Manquant`,variant:`destructive`,icon:l.XCircle,className:`bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300`},identical:{label:`Identique`,variant:`secondary`,icon:l.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`},warning:{label:`Attention`,variant:`secondary`,icon:l.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`}}[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1 text-xs`,a),children:[(0,f.jsx)(i,{className:`h-3 w-3`}),r]})}function qL({value:e,onChange:n,onBlur:r,placeholder:a,status:o,disabled:c}){let[l,u]=s.useState(e);return s.useEffect(()=>{u(e)},[e]),(0,f.jsx)(i.n,{value:l,onChange:e=>{u(e.target.value),n(e.target.value)},onBlur:r,placeholder:a,disabled:c,className:t.t(`min-h-[60px] resize-none text-sm`,o===`missing`&&`border-red-300 dark:border-red-700`,o===`identical`&&`border-yellow-300 dark:border-yellow-700`)})}function JL({config:e,translations:a,onChange:o,onSave:c,onAddKey:u,onDeleteKey:d,onAddLanguage:p,onExport:m,onImport:h,isLoading:g=!1,isSaving:_=!1,className:v,title:y=`Translation Editor`,description:b=`Gérez vos traductions i18n`}){let[x,S]=s.useState(a),[C,w]=s.useState(``),[T,E]=s.useState(`all`),[D,O]=s.useState(new Set),[k,A]=s.useState(null),[j,M]=s.useState(!1),[N,P]=s.useState(!1),[F,I]=s.useState(!1),[L,R]=s.useState(!1),[z,B]=s.useState(``),[V,H]=s.useState({code:``,label:``,flag:``}),[U,W]=s.useState(null),[G,K]=s.useState(``),[q,ee]=s.useState(`merge`),[J,te]=s.useState(new Map),ne=s.useRef(null),{languages:re,sourceLanguage:ie,keyPathSeparator:ae=`.`,autoSave:oe=!0,saveDebounceMs:se=300,placeholderPatterns:ce=[`{{.*?}}`,`{.*?}`,`%s`,`%d`]}=e,le=re.filter(e=>e.code!==ie);s.useEffect(()=>{S(a)},[a]),s.useEffect(()=>(oe&&J.size>0&&c&&(ne.current&&clearTimeout(ne.current),ne.current=setTimeout(async()=>{await c(x),te(new Map)},se)),()=>{ne.current&&clearTimeout(ne.current)}),[J,oe,se,c,x]);let ue=s.useMemo(()=>{let e=x;if(C){let t=C.toLowerCase();e=e.filter(e=>{if(e.key.toLowerCase().includes(t))return!0;for(let n of Object.keys(e.translations))if(e.translations[n]?.value?.toLowerCase().includes(t))return!0;return!1})}return T!==`all`&&(e=e.filter(e=>{let t=WL(e,re.map(e=>e.code),ie);switch(T){case`missing`:return t===`missing`;case`incomplete`:return t===`missing`||t===`identical`;case`identical`:return t===`identical`;default:return!0}})),e},[x,C,T,re,ie]),de=s.useMemo(()=>GL(ue,ae),[ue,ae]),fe=(e,t,n)=>{S(r=>r.map(r=>r.key===e?{...r,translations:{...r.translations,[t]:{...r.translations[t],value:n,updatedAt:new Date}}}:r)),te(r=>{let i=new Map(r);return i.has(e)||i.set(e,new Map),i.get(e).set(t,n),i}),o?.(e,t,n)},pe=async()=>{z.trim()&&(await u?.(z),B(``),P(!1))},me=async e=>{await d?.(e),S(t=>t.filter(t=>t.key!==e))},he=async()=>{!V.code||!V.label||(await p?.(V),H({code:``,label:``,flag:``}),I(!1))},ge=async()=>{!U||!G||(await h?.(U,G,q),W(null),K(``),R(!1))},_e=e=>{navigator.clipboard.writeText(e)},ve=e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ye=s.useMemo(()=>{let e=x.length,t=0,n=0,r=0;for(let e of x){let i=WL(e,re.map(e=>e.code),ie);i===`missing`?t++:i===`identical`?n++:r++}return{total:e,missing:t,identical:n,valid:r}},[x,re,ie]);return g?(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center py-12`,v),children:(0,f.jsx)(l.Loader2,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,f.jsx)(ti,{children:(0,f.jsxs)(`div`,{className:t.t(`flex flex-col h-full`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,f.jsx)(l.Languages,{className:`h-6 w-6`}),y]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>P(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Ajouter une clé`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>I(!0),children:[(0,f.jsx)(l.Flag,{className:`h-4 w-4 mr-1`}),`Ajouter une langue`]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>m?.(),children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Exporter tout`]}),re.map(e=>(0,f.jsxs)($,{onClick:()=>m?.(e.code),children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Exporter `,e.label]},e.code)),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:()=>R(!0),children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]})]})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}),`Sauvegarde...`]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[ye.total,` clés`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),ye.valid,` traduites`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),ye.missing,` manquantes`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-600 dark:text-yellow-400`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),ye.identical,` identiques`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher une clé ou une traduction...`,value:C,onChange:e=>w(e.target.value),className:`pl-10`}),C&&(0,f.jsx)(`button`,{onClick:()=>w(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(n.d,{value:T,onValueChange:e=>E(e),children:[(0,f.jsx)(n.y,{className:`w-[180px]`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsxs)(n.m,{value:`all`,children:[`Toutes (`,ye.total,`)`]}),(0,f.jsxs)(n.m,{value:`missing`,children:[`Manquantes (`,ye.missing,`)`]}),(0,f.jsxs)(n.m,{value:`incomplete`,children:[`Incomplètes (`,ye.missing+ye.identical,`)`]}),(0,f.jsxs)(n.m,{value:`identical`,children:[`Identiques (`,ye.identical,`)`]})]})]})]})]})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,f.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,f.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur z-10`,children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b w-[280px]`,children:`Clé`}),(0,f.jsxs)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:[re.find(e=>e.code===ie)?.label||ie,` (source)`]}),le.map(e=>(0,f.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.flag&&(0,f.jsx)(`span`,{children:e.flag}),e.label]})},e.code)),(0,f.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[100px]`,children:`État`}),(0,f.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[60px]`,children:`Actions`})]})}),(0,f.jsxs)(`tbody`,{children:[Array.from(de.entries()).map(([e,t])=>(0,f.jsxs)(s.Fragment,{children:[e!==`__root__`&&(0,f.jsx)(`tr`,{className:`bg-muted/30`,children:(0,f.jsx)(`td`,{colSpan:le.length+4,className:`p-2`,children:(0,f.jsxs)(`button`,{onClick:()=>ve(e),className:`flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors`,children:[D.has(e)?(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`}):(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4`}),e,(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:t.length})]})})}),!D.has(e)&&t.map(e=>{let t=WL(e,re.map(e=>e.code),ie);return(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30 transition-colors`,children:[(0,f.jsx)(`td`,{className:`p-3 font-mono text-sm`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`truncate max-w-[200px]`,title:e.key,children:e.key}),(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(`button`,{onClick:()=>_e(e.key),className:`text-muted-foreground hover:text-foreground`,children:(0,f.jsx)(l.Copy,{className:`h-3 w-3`})})}),(0,f.jsx)(ii,{children:`Copier la clé`})]})]})}),(0,f.jsx)(`td`,{className:`p-2`,children:(0,f.jsx)(qL,{value:e.translations[ie]?.value||``,onChange:t=>fe(e.key,ie,t),placeholder:`Texte source...`,status:e.translations[ie]?.value?`valid`:`missing`})}),le.map(t=>{let n=UL(e,t.code,ie);return(0,f.jsx)(`td`,{className:`p-2`,children:(0,f.jsx)(qL,{value:e.translations[t.code]?.value||``,onChange:n=>fe(e.key,t.code,n),placeholder:`Traduction ${t.label}...`,status:n})},t.code)}),(0,f.jsx)(`td`,{className:`p-3 text-center`,children:(0,f.jsx)(KL,{status:t})}),(0,f.jsx)(`td`,{className:`p-3 text-center`,children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>{A(e),M(!0)},children:[(0,f.jsx)(l.Edit3,{className:`h-4 w-4 mr-2`}),`Éditer`]}),(0,f.jsxs)($,{onClick:()=>_e(e.key),children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Copier la clé`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:()=>me(e.key),children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})})]},e.key)})]},e)),ue.length===0&&(0,f.jsx)(`tr`,{children:(0,f.jsxs)(`td`,{colSpan:le.length+4,className:`p-12 text-center`,children:[(0,f.jsx)(l.Languages,{className:`h-12 w-12 mx-auto text-muted-foreground/50 mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:C||T!==`all`?`Aucune traduction ne correspond à vos critères`:`Aucune traduction disponible`})]})})]})]})}),(0,f.jsx)(nr,{open:j,onOpenChange:M,children:(0,f.jsxs)(cr,{className:`w-[500px] sm:max-w-[500px]`,children:[(0,f.jsxs)(lr,{children:[(0,f.jsx)(dr,{children:`Éditer la traduction`}),(0,f.jsx)(fr,{children:k?.key})]}),k&&(0,f.jsxs)(`div`,{className:`py-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`label`,{className:`text-sm font-medium`,children:[re.find(e=>e.code===ie)?.label,` (source)`]}),(0,f.jsx)(i.n,{value:k.translations[ie]?.value||``,onChange:e=>{fe(k.key,ie,e.target.value),A({...k,translations:{...k.translations,[ie]:{...k.translations[ie],value:e.target.value}}})},placeholder:`Texte source...`,className:`min-h-[100px]`})]}),re.filter(e=>e.code!==ie).map(e=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`label`,{className:`text-sm font-medium flex items-center gap-2`,children:[e.flag&&(0,f.jsx)(`span`,{children:e.flag}),e.label]}),(0,f.jsx)(i.n,{value:k.translations[e.code]?.value||``,onChange:t=>{fe(k.key,e.code,t.target.value),A({...k,translations:{...k.translations,[e.code]:{...k.translations[e.code],value:t.target.value}}})},placeholder:`Traduction ${e.label}...`,className:`min-h-[100px]`})]},e.code)),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (optionnel)`}),(0,f.jsx)(i.n,{placeholder:`Contexte ou indication pour la traduction...`,className:`min-h-[80px]`})]})]}),(0,f.jsx)(ur,{children:(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>M(!1),children:`Fermer`})})]})}),(0,f.jsx)(gt,{open:N,onOpenChange:P,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Ajouter une clé de traduction`}),(0,f.jsx)(Tt,{children:`Entrez la clé de traduction (ex: common.buttons.submit)`})]}),(0,f.jsx)(`div`,{className:`py-4`,children:(0,f.jsx)(r.n,{value:z,onChange:e=>B(e.target.value),placeholder:`namespace.key.name`})}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>P(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:pe,children:`Ajouter`})]})]})}),(0,f.jsx)(gt,{open:F,onOpenChange:I,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Ajouter une langue`}),(0,f.jsx)(Tt,{children:`Configurez la nouvelle langue à ajouter`})]}),(0,f.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Code (ex: de, it, pt)`}),(0,f.jsx)(r.n,{value:V.code,onChange:e=>H({...V,code:e.target.value}),placeholder:`de`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Label`}),(0,f.jsx)(r.n,{value:V.label,onChange:e=>H({...V,label:e.target.value}),placeholder:`Allemand`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Emoji drapeau (optionnel)`}),(0,f.jsx)(r.n,{value:V.flag,onChange:e=>H({...V,flag:e.target.value}),placeholder:`🇩🇪`})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>I(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:he,children:`Ajouter`})]})]})}),(0,f.jsx)(gt,{open:L,onOpenChange:R,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Importer des traductions`}),(0,f.jsx)(Tt,{children:`Sélectionnez un fichier JSON à importer`})]}),(0,f.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Fichier JSON`}),(0,f.jsx)(r.n,{type:`file`,accept:`.json`,onChange:e=>W(e.target.files?.[0]||null)})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Langue cible`}),(0,f.jsxs)(n.d,{value:G,onValueChange:K,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Sélectionner une langue`})}),(0,f.jsx)(n.f,{children:re.map(e=>(0,f.jsxs)(n.m,{value:e.code,children:[e.flag&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flag}),e.label]},e.code))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Stratégie`}),(0,f.jsxs)(n.d,{value:q,onValueChange:e=>ee(e),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`merge`,children:`Fusionner (conserver les existantes)`}),(0,f.jsx)(n.m,{value:`overwrite`,children:`Écraser tout`})]})]})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>R(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:ge,disabled:!U||!G,children:`Importer`})]})]})})]})})}var YL={default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`},XL={default:`bg-muted`,blue:`bg-blue-500/10`,green:`bg-green-500/10`,yellow:`bg-yellow-500/10`,red:`bg-red-500/10`,purple:`bg-purple-500/10`};function ZL({data:e,color:n=`blue`}){let r=Math.max(...e),i=Math.min(...e),a=r-i||1;return(0,f.jsx)(`svg`,{className:`w-16 h-8`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,f.jsx)(`polyline`,{points:e.map((t,n)=>`${n/(e.length-1)*100},${100-(t-i)/a*100}`).join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`3`,className:t.t(`opacity-60`,YL[n]||YL.blue)})})}function QL({metric:e}){let n=e.icon,r=e.trend===`up`?`text-green-500`:e.trend===`down`?`text-red-500`:`text-muted-foreground`,i=e.trend===`up`?l.TrendingUp:e.trend===`down`?l.TrendingDown:null;return(0,f.jsxs)(Y,{className:`relative overflow-hidden`,children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsx)(Z,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),n&&(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,XL[e.color||`default`]),children:(0,f.jsx)(`span`,{className:t.t(`h-4 w-4`,YL[e.color||`default`]),children:n})})]}),(0,f.jsxs)(Q,{children:[(0,f.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),e.change!==void 0&&(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-sm`,r),children:[i&&(0,f.jsx)(i,{className:`h-3 w-3`}),(0,f.jsxs)(`span`,{children:[e.change>0?`+`:``,e.change,`%`]}),e.changeLabel&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeLabel})]})]}),e.sparkline&&(0,f.jsx)(ZL,{data:e.sparkline,color:e.color})]}),e.target!==void 0&&e.current!==void 0&&(0,f.jsxs)(`div`,{className:`mt-4`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground mb-1`,children:[(0,f.jsx)(`span`,{children:`Progress`}),(0,f.jsxs)(`span`,{children:[Math.round(e.current/e.target*100),`%`]})]}),(0,f.jsx)(Zn,{value:e.current/e.target*100,className:`h-1.5`})]})]})]})}function $L({goal:e}){let r=e.current/e.target*100,i=r>=100;return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-full flex items-center justify-center`,i?`bg-green-500/10 text-green-500`:`bg-muted text-muted-foreground`),children:(0,f.jsx)(l.Target,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:e.label}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.current,e.unit,` / `,e.target,e.unit]})]}),(0,f.jsx)(Zn,{value:Math.min(r,100),className:`h-2`})]}),i&&(0,f.jsx)(n.x,{variant:`default`,className:`bg-green-500`,children:`Complete`})]})}function eR({title:e=`Dashboard`,description:i,metrics:a,periods:o=[{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`},{value:`90d`,label:`90 days`},{value:`12m`,label:`12 months`}],selectedPeriod:s=`30d`,onPeriodChange:c,onRefresh:u,onExport:d,chart:p,secondaryMetrics:m,goals:h,isLoading:g=!1,lastUpdated:_,className:v}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),i&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:i})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.length>0&&(0,f.jsxs)(n.d,{value:s,onValueChange:c,children:[(0,f.jsxs)(n.y,{className:`w-[140px]`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsx)(n.f,{children:o.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]}),u&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:u,disabled:g,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,g&&`animate-spin`)})}),d&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:d,children:(0,f.jsx)(l.Download,{className:`h-4 w-4`})})]})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[`Last updated: `,typeof _==`string`?_:_.toLocaleString()]})]}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:a.slice(0,4).map(e=>(0,f.jsx)(QL,{metric:e},e.id))}),p&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Overview`}),(0,f.jsx)(Se,{children:`Performance metrics over time`})]}),(0,f.jsx)(Q,{children:p})]}),m&&m.length>0&&(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:m.map(e=>(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,f.jsx)(`p`,{className:`text-xl font-bold`,children:e.value})]}),e.change!==void 0&&(0,f.jsxs)(n.x,{variant:e.trend===`up`?`default`:e.trend===`down`?`destructive`:`secondary`,className:`gap-1`,children:[e.trend===`up`?(0,f.jsx)(l.ArrowUpRight,{className:`h-3 w-3`}):e.trend===`down`?(0,f.jsx)(l.ArrowDownRight,{className:`h-3 w-3`}):null,e.change>0?`+`:``,e.change,`%`]})]})})},e.id))}),h&&h.length>0&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Target,{className:`h-5 w-5`}),`Goals & Targets`]}),(0,f.jsx)(Se,{children:`Track your progress towards key objectives`})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:h.map(e=>(0,f.jsx)($L,{goal:e},e.id))})]})]})}var tR=[{id:`revenue`,label:`Total Revenue`,value:`$45,231.89`,change:20.1,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.DollarSign,{className:`h-4 w-4`}),color:`green`,sparkline:[30,40,35,50,49,60,70,91,125]},{id:`subscriptions`,label:`Subscriptions`,value:`+2,350`,change:180.1,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.Users,{className:`h-4 w-4`}),color:`blue`,sparkline:[10,20,30,40,50,60,70,80,90]},{id:`sales`,label:`Sales`,value:`+12,234`,change:19,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.ShoppingCart,{className:`h-4 w-4`}),color:`purple`,sparkline:[65,59,80,81,56,55,70,80,95]},{id:`active`,label:`Active Now`,value:`+573`,change:-2.5,changeLabel:`from last hour`,trend:`down`,icon:(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),color:`yellow`,sparkline:[100,90,85,88,70,65,60,58,55]}],nR=[{id:`revenue-goal`,label:`Monthly Revenue Target`,current:45231,target:5e4,unit:`$`},{id:`users-goal`,label:`New User Signups`,current:2350,target:2e3,unit:``},{id:`conversion-goal`,label:`Conversion Rate`,current:3.2,target:5,unit:`%`}];function rR({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,f.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):i+1}),(0,f.jsx)(`span`,{className:t.t(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function iR({items:e,currency:t=`$`,discount:n,couponCode:i,setCouponCode:a,onApplyCoupon:o,onRemoveDiscount:s,isApplyingCoupon:c,shippingPrice:u=0,taxRate:d=0}){let p=e.reduce((e,t)=>e+t.price*t.quantity,0),m=n?n.type===`percent`?p*n.amount/100:n.amount:0,h=p-m,g=h*d/100,_=h+g+u;return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,f.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,f.jsx)(r.t,{}),n?(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Percent,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:s,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}):(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`Coupon code`,value:i,onChange:e=>a(e.target.value),className:`flex-1`}),(0,f.jsx)(r.r,{variant:`outline`,onClick:o,disabled:!i||c,children:c?(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,f.jsxs)(`span`,{children:[t,p.toFixed(2)]})]}),m>0&&(0,f.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,f.jsx)(`span`,{children:`Discount`}),(0,f.jsxs)(`span`,{children:[`-`,t,m.toFixed(2)]})]}),u>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,f.jsxs)(`span`,{children:[t,u.toFixed(2)]})]}),g>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,d,`%)`]}),(0,f.jsxs)(`span`,{children:[t,g.toFixed(2)]})]}),(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsxs)(`span`,{children:[t,_.toFixed(2)]})]})]})]})]})}function aR({items:e,shippingMethods:a=oR,paymentMethods:o=sR,onApplyCoupon:c,discount:u,onRemoveDiscount:d,onSubmitOrder:p,currency:m=`$`,taxRate:h=8.5,className:g}){let[_,v]=s.useState(`cart`),[y,b]=s.useState(``),[x,S]=s.useState(!1),[C,w]=s.useState(!1),[T,E]=s.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[D,O]=s.useState(a[0]?.id||``),[k,A]=s.useState(o[0]?.id||``),[j,M]=s.useState(!1),N=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],P=a.find(e=>e.id===D),F=async()=>{!c||!y||(S(!0),await c(y),S(!1))},I=async()=>{if(p){w(!0);try{await p({address:T,shippingMethod:D,paymentMethod:k,saveInfo:j})}finally{w(!1)}}},L=()=>{let e=N.findIndex(e=>e.id===_);e<N.length-1&&v(N[e+1].id)},R=()=>{let e=N.findIndex(e=>e.id===_);e>0&&v(N[e-1].id)};return(0,f.jsxs)(`div`,{className:t.t(`max-w-6xl mx-auto`,g),children:[(0,f.jsx)(rR,{steps:N,currentStep:_}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[_===`cart`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Shopping Cart`}),(0,f.jsxs)(Se,{children:[e.length,` items in your cart`]})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,f.jsx)(n.x,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,f.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,f.jsxs)(`span`,{className:`font-bold`,children:[m,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,f.jsx)(Ce,{children:(0,f.jsxs)(r.r,{className:`w-full`,onClick:L,children:[`Continue to Shipping`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),_===`shipping`&&(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`First Name`}),(0,f.jsx)(r.n,{value:T.firstName,onChange:e=>E({...T,firstName:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Last Name`}),(0,f.jsx)(r.n,{value:T.lastName,onChange:e=>E({...T,lastName:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Email`}),(0,f.jsx)(r.n,{type:`email`,value:T.email,onChange:e=>E({...T,email:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Phone`}),(0,f.jsx)(r.n,{type:`tel`,value:T.phone,onChange:e=>E({...T,phone:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Address`}),(0,f.jsx)(r.n,{value:T.address,onChange:e=>E({...T,address:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Apartment, suite, etc. (optional)`}),(0,f.jsx)(r.n,{value:T.apartment,onChange:e=>E({...T,apartment:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`City`}),(0,f.jsx)(r.n,{value:T.city,onChange:e=>E({...T,city:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`State`}),(0,f.jsx)(r.n,{value:T.state,onChange:e=>E({...T,state:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Postal Code`}),(0,f.jsx)(r.n,{value:T.postalCode,onChange:e=>E({...T,postalCode:e.target.value})})]})]}),(0,f.jsx)(r.t,{className:`my-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,f.jsx)(l.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,f.jsx)(Qn,{value:D,onValueChange:O,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,D===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e.id}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${m}${e.price.toFixed(2)}`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:L,children:[`Continue to Payment`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`payment`&&(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,f.jsxs)(Q,{children:[(0,f.jsx)(Qn,{value:k,onValueChange:A,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,k===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e.id}),e.icon,(0,f.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,f.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`save-info`,checked:j,onCheckedChange:e=>M(e)}),(0,f.jsx)(i.o,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,f.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,f.jsx)(l.Shield,{className:`h-5 w-5 text-green-500`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:L,children:[`Review Order`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`review`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Review Your Order`}),(0,f.jsx)(Se,{children:`Please verify all information before placing your order`})]}),(0,f.jsxs)(Q,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[T.firstName,` `,T.lastName]}),(0,f.jsxs)(`p`,{children:[T.address,T.apartment&&`, ${T.apartment}`]}),(0,f.jsxs)(`p`,{children:[T.city,`, `,T.state,` `,T.postalCode]}),(0,f.jsx)(`p`,{children:T.email}),(0,f.jsx)(`p`,{children:T.phone})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:P?.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:P?.estimatedDays})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,f.jsx)(`p`,{className:`font-medium`,children:o.find(e=>e.id===k)?.label})})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsx)(r.r,{className:`flex-1`,onClick:I,disabled:C,children:C?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,f.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,f.jsx)(iR,{items:e,currency:m,discount:u,couponCode:y,setCouponCode:b,onApplyCoupon:F,onRemoveDiscount:d,isApplyingCoupon:x,shippingPrice:P?.price||0,taxRate:h})})]})]})}var oR=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,f.jsx)(l.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,f.jsx)(l.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,f.jsx)(l.Truck,{className:`h-5 w-5`})}],sR=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,f.jsx)(l.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,f.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],cR=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}],lR={common:`bg-slate-500/20 text-slate-400 border-slate-500/30`,rare:`bg-blue-500/20 text-blue-400 border-blue-500/30`,epic:`bg-purple-500/20 text-purple-400 border-purple-500/30`,legendary:`bg-amber-500/20 text-amber-400 border-amber-500/30`},uR={common:``,rare:`shadow-blue-500/20`,epic:`shadow-purple-500/20`,legendary:`shadow-amber-500/30 shadow-lg`};function dR({current:e,max:t,level:n}){let r=e/t*100;return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold`,children:n}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Level `,n]})]}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` XP`]})]}),(0,f.jsxs)(`div`,{className:`relative h-3 rounded-full bg-muted overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-primary to-primary/80 rounded-full transition-all duration-500`,style:{width:`${r}%`}}),(0,f.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full`,style:{width:`${r}%`}})]})]})}function fR({stat:e}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-muted/50`,children:[e.icon&&(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg bg-background flex items-center justify-center`,{default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`}[e.color||`default`]),children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-2xl font-bold`,children:e.value}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label})]})]})}function pR({achievement:e}){let r=e.unlockedAt||e.progress!==void 0&&e.maxProgress!==void 0&&e.progress>=e.maxProgress;return(0,f.jsx)(`div`,{className:t.t(`p-4 rounded-lg border transition-all`,r?t.t(lR[e.rarity||`common`],uR[e.rarity||`common`]):`bg-muted/30 border-dashed opacity-60`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`h-12 w-12 rounded-lg flex items-center justify-center`,r?`bg-background/50`:`bg-muted`),children:e.icon||(0,f.jsx)(l.Trophy,{className:`h-6 w-6`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-medium truncate`,children:e.name}),e.rarity&&(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs capitalize`,children:e.rarity})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.progress!==void 0&&e.maxProgress!==void 0&&!r&&(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:e.progress/e.maxProgress*100,className:`h-1.5`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.progress,` / `,e.maxProgress]})]}),e.unlockedAt&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`Unlocked `,typeof e.unlockedAt==`string`?e.unlockedAt:e.unlockedAt.toLocaleDateString()]})]})]})})}function mR({match:e}){let r={win:`text-green-500 bg-green-500/10`,loss:`text-red-500 bg-red-500/10`,draw:`text-yellow-500 bg-yellow-500/10`},i={win:(0,f.jsx)(l.Trophy,{className:`h-4 w-4`}),loss:(0,f.jsx)(l.Swords,{className:`h-4 w-4`}),draw:(0,f.jsx)(l.Shield,{className:`h-4 w-4`})};return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-3 rounded-lg bg-muted/50`,children:[(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg flex items-center justify-center`,r[e.result]),children:i[e.result]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium capitalize`,children:e.result}),e.score&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.score})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.opponent&&(0,f.jsxs)(`span`,{children:[`vs `,e.opponent]}),e.mode&&(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e.mode})]})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[e.xpGained&&(0,f.jsxs)(`p`,{className:`text-sm font-medium text-green-500`,children:[`+`,e.xpGained,` XP`]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:typeof e.date==`string`?e.date:e.date.toLocaleDateString()})]})]})}function hR({name:e,avatar:n,title:r,level:i,currentXP:a,maxXP:o,totalXP:s,rank:c,rankIcon:u,stats:d,achievements:p,badges:m,matchHistory:h,streak:g,joinDate:_,playtime:v,friendsCount:y,isOnline:b=!1,className:x}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,x),children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6 items-start`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-24 w-24 border-4 border-primary/20`,children:[(0,f.jsx)(ye,{src:n,alt:e}),(0,f.jsx)(be,{className:`text-2xl`,children:e.slice(0,2).toUpperCase()})]}),b&&(0,f.jsx)(`div`,{className:`absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background`}),(0,f.jsx)(`div`,{className:`absolute -top-2 -right-2 h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold text-sm`,children:i})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold`,children:e}),r&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:r}),c&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[u||(0,f.jsx)(l.Medal,{className:`h-5 w-5 text-yellow-500`}),(0,f.jsx)(`span`,{className:`font-medium`,children:c})]})]})]}),(0,f.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 md:grid-cols-4 gap-4`,children:[g!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-orange-500/10`,children:[(0,f.jsx)(l.Flame,{className:`h-6 w-6 text-orange-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:g}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Day Streak`})]}),s!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-purple-500/10`,children:[(0,f.jsx)(l.Zap,{className:`h-6 w-6 text-purple-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:s.toLocaleString()}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Total XP`})]}),v&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-blue-500/10`,children:[(0,f.jsx)(l.Clock,{className:`h-6 w-6 text-blue-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:v}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Playtime`})]}),y!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-green-500/10`,children:[(0,f.jsx)(l.Users,{className:`h-6 w-6 text-green-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:y}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Friends`})]})]})]}),(0,f.jsx)(`div`,{className:`mt-6`,children:(0,f.jsx)(dR,{current:a,max:o,level:i})}),m&&m.length>0&&(0,f.jsxs)(`div`,{className:`mt-6`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-3`,children:`Badges`}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm`,style:e.color?{backgroundColor:`${e.color}20`,color:e.color}:void 0,children:[e.icon,(0,f.jsx)(`span`,{children:e.name})]},e.id))})]})]})}),(0,f.jsxs)(Cr,{defaultValue:`stats`,className:`w-full`,children:[(0,f.jsxs)(wr,{className:`w-full justify-start`,children:[(0,f.jsx)(Tr,{value:`stats`,children:`Stats`}),(0,f.jsx)(Tr,{value:`achievements`,children:`Achievements`}),(0,f.jsx)(Tr,{value:`history`,children:`Match History`})]}),(0,f.jsx)(Er,{value:`stats`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Player Statistics`}),(0,f.jsx)(Se,{children:`Your performance metrics`})]}),(0,f.jsx)(Q,{children:d&&d.length>0?(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:d.map((e,t)=>(0,f.jsx)(fR,{stat:e},t))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No statistics available`})})]})}),(0,f.jsx)(Er,{value:`achievements`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Achievements`}),(0,f.jsxs)(Se,{children:[p?.filter(e=>e.unlockedAt).length||0,` / `,p?.length||0,` unlocked`]})]}),(0,f.jsx)(Q,{children:p&&p.length>0?(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:p.map(e=>(0,f.jsx)(pR,{achievement:e},e.id))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No achievements yet`})})]})}),(0,f.jsx)(Er,{value:`history`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Match History`}),(0,f.jsx)(Se,{children:`Your recent games`})]}),(0,f.jsx)(Q,{children:h&&h.length>0?(0,f.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,f.jsx)(mR,{match:e},e.id))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No matches played yet`})})]})})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[`Member since `,typeof _==`string`?_:_.toLocaleDateString()]})]})]})}var gR=[{label:`Matches Played`,value:342,icon:(0,f.jsx)(l.Gamepad2,{className:`h-5 w-5`}),color:`blue`},{label:`Wins`,value:189,icon:(0,f.jsx)(l.Trophy,{className:`h-5 w-5`}),color:`green`},{label:`Win Rate`,value:`55.3%`,icon:(0,f.jsx)(l.TrendingUp,{className:`h-5 w-5`}),color:`yellow`},{label:`Best Score`,value:`12,450`,icon:(0,f.jsx)(l.Star,{className:`h-5 w-5`}),color:`purple`},{label:`Kills`,value:`1,234`,icon:(0,f.jsx)(l.Target,{className:`h-5 w-5`}),color:`red`},{label:`Assists`,value:876,icon:(0,f.jsx)(l.Heart,{className:`h-5 w-5`}),color:`default`}],_R=[{id:`first-win`,name:`First Victory`,description:`Win your first match`,rarity:`common`,unlockedAt:new Date(`2024-01-15`),icon:(0,f.jsx)(l.Trophy,{className:`h-6 w-6 text-yellow-500`})},{id:`streak-master`,name:`Streak Master`,description:`Achieve a 10-day login streak`,rarity:`rare`,unlockedAt:new Date(`2024-02-20`),icon:(0,f.jsx)(l.Flame,{className:`h-6 w-6 text-orange-500`})},{id:`legendary-player`,name:`Legendary Player`,description:`Reach level 50`,rarity:`legendary`,progress:42,maxProgress:50,icon:(0,f.jsx)(l.Crown,{className:`h-6 w-6 text-amber-500`})},{id:`social-butterfly`,name:`Social Butterfly`,description:`Add 25 friends`,rarity:`epic`,progress:18,maxProgress:25,icon:(0,f.jsx)(l.Users,{className:`h-6 w-6 text-purple-500`})}],vR=[{id:`beta`,name:`Beta Tester`,icon:(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),color:`#3b82f6`},{id:`premium`,name:`Premium`,icon:(0,f.jsx)(l.Crown,{className:`h-4 w-4`}),color:`#f59e0b`},{id:`verified`,name:`Verified`,icon:(0,f.jsx)(l.Award,{className:`h-4 w-4`}),color:`#10b981`}],yR=[{id:`1`,result:`win`,score:`3-1`,opponent:`xShadowx`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:150},{id:`2`,result:`win`,score:`2-0`,opponent:`ProGamer99`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:175},{id:`3`,result:`loss`,score:`1-3`,opponent:`NightHawk`,mode:`Ranked`,date:new Date(`2024-03-09`),xpGained:50},{id:`4`,result:`draw`,score:`2-2`,opponent:`StormRider`,mode:`Casual`,date:new Date(`2024-03-09`),xpGained:75},{id:`5`,result:`win`,score:`5-2`,opponent:`BlazeMaster`,mode:`Ranked`,date:new Date(`2024-03-08`),xpGained:200}],bR={authenticator:{icon:(0,f.jsx)(l.Smartphone,{className:`h-5 w-5`}),title:`Authenticator App`,description:`Use an app like Google Authenticator or Authy`,recommended:!0},sms:{icon:(0,f.jsx)(l.MessageSquare,{className:`h-5 w-5`}),title:`SMS`,description:`Receive codes via text message`,recommended:!1},email:{icon:(0,f.jsx)(l.Mail,{className:`h-5 w-5`}),title:`Email`,description:`Receive codes via email`,recommended:!1},hardware:{icon:(0,f.jsx)(l.Key,{className:`h-5 w-5`}),title:`Hardware Key`,description:`Use a physical security key (YubiKey, etc.)`,recommended:!0}};function xR({methods:e,selected:r,onSelect:a}){return(0,f.jsx)(Qn,{value:r,onValueChange:e=>a(e),children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let a=bR[e];return(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,r===e?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e}),(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-muted flex items-center justify-center`,children:a.icon}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:a.title}),a.recommended&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:`Recommended`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.description})]})]},e)})})})}function SR({length:e=6,value:t,onChange:n}){let i=s.useRef([]),a=t.padEnd(e,``).split(``).slice(0,e),o=(t,r)=>{if(!/^\d*$/.test(r))return;let o=[...a];o[t]=r.slice(-1),n(o.join(``)),r&&t<e-1&&i.current[t+1]?.focus()},c=(e,t)=>{t.key===`Backspace`&&!a[e]&&e>0&&i.current[e-1]?.focus()},l=t=>{t.preventDefault(),n(t.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,e))};return(0,f.jsx)(`div`,{className:`flex gap-2 justify-center`,children:a.map((e,t)=>(0,f.jsx)(r.n,{ref:e=>{i.current[t]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>o(t,e.target.value),onKeyDown:e=>c(t,e),onPaste:l,className:`w-12 h-14 text-center text-2xl font-mono`},t))})}function CR({codes:e,onRegenerate:n,onDownload:i}){let[a,o]=s.useState(!1),[c,u]=s.useState(!1),d=()=>{let t=e.map(e=>e.code).join(`
2655
- `);navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),2e3)},p=e.filter(e=>!e.used);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Key,{className:`h-5 w-5`}),`Backup Codes`]}),(0,f.jsxs)(Se,{children:[p.length,` of `,e.length,` codes remaining`]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:()=>u(!c),children:c?(0,f.jsx)(l.EyeOff,{className:`h-4 w-4`}):(0,f.jsx)(l.Eye,{className:`h-4 w-4`})})]})}),(0,f.jsxs)(Q,{children:[(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,n)=>(0,f.jsx)(`div`,{className:t.t(`font-mono text-sm p-2 rounded border text-center`,e.used?`bg-muted text-muted-foreground line-through`:`bg-card`),children:c?e.code:`••••••••`},n))}),p.length<3&&(0,f.jsxs)(`div`,{className:`mt-4 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 flex items-center gap-3`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-5 w-5 text-yellow-500`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`You're running low on backup codes. Consider regenerating them.`})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:d,children:[a?(0,f.jsx)(l.Check,{className:`h-4 w-4 mr-2`}):(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),a?`Copied`:`Copy All`]}),i&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download`]}),n&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:n,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2`}),`Regenerate`]})]})]})}function wR({status:e={enabled:!1},availableMethods:a=[`authenticator`,`sms`,`email`],qrCodeUrl:o,secretKey:c,backupCodes:u,onEnable:d,onDisable:p,onRegenerateBackupCodes:m,onSendCode:h,className:g}){let[_,v]=s.useState(`overview`),[y,b]=s.useState(a[0]),[x,S]=s.useState(``),[C,w]=s.useState(!1),[T,E]=s.useState(null),[D,O]=s.useState(!1),[k,A]=s.useState(!1);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6 max-w-2xl`,g),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.enabled?(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-green-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.ShieldCheck,{className:`h-6 w-6 text-green-500`})}):(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-yellow-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.ShieldAlert,{className:`h-6 w-6 text-yellow-500`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Two-Factor Authentication`}),(0,f.jsx)(Se,{children:e.enabled?`Enabled via ${bR[e.method]?.title}`:`Add an extra layer of security to your account`})]})]}),(0,f.jsx)(n.x,{variant:e.enabled?`default`:`secondary`,children:e.enabled?`Enabled`:`Disabled`})]})}),_===`overview`&&(0,f.jsx)(Ce,{children:e.enabled?(0,f.jsxs)(`div`,{className:`flex gap-2 w-full`,children:[(0,f.jsx)(r.r,{variant:`outline`,className:`flex-1`,onClick:()=>v(`setup`),children:`Change Method`}),(0,f.jsx)(r.r,{variant:`destructive`,className:`flex-1`,onClick:()=>v(`disable`),children:`Disable 2FA`})]}):(0,f.jsxs)(r.r,{className:`w-full`,onClick:()=>v(`setup`),children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4 mr-2`}),`Enable Two-Factor Authentication`]})})]}),_===`setup`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Choose Authentication Method`}),(0,f.jsx)(Se,{children:`Select how you want to receive verification codes`})]}),(0,f.jsx)(Q,{children:(0,f.jsx)(xR,{methods:a,selected:y,onSelect:b})}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`overview`),children:`Cancel`}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:()=>v(`verify`),children:[`Continue`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`verify`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:y===`authenticator`?`Set Up Authenticator`:`Verify Your Identity`}),(0,f.jsx)(Se,{children:y===`authenticator`?`Scan the QR code with your authenticator app`:`Enter the code sent to your ${y}`})]}),(0,f.jsxs)(Q,{className:`space-y-6`,children:[y===`authenticator`&&(0,f.jsxs)(f.Fragment,{children:[o&&(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`div`,{className:`p-4 bg-white rounded-lg`,children:(0,f.jsx)(`img`,{src:o,alt:`QR Code`,className:`h-48 w-48`})})}),c&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Or enter this code manually:`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.n,{value:c,readOnly:!0,className:`font-mono`}),(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:()=>{c&&(navigator.clipboard.writeText(c),O(!0),setTimeout(()=>O(!1),2e3))},children:D?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):(0,f.jsx)(l.Copy,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(r.t,{})]}),(y===`sms`||y===`email`)&&!k&&(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`We'll send a verification code to your `,y===`sms`?`phone`:`email`]}),(0,f.jsxs)(r.r,{onClick:async()=>{if(h){w(!0);try{await h(y),A(!0)}finally{w(!1)}}},disabled:C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):y===`sms`?(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-2`}):(0,f.jsx)(l.Mail,{className:`h-4 w-4 mr-2`}),`Send Code`]})]}),(y===`authenticator`||k)&&(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(i.o,{className:`text-center block`,children:`Enter the 6-digit code`}),(0,f.jsx)(SR,{value:x,onChange:S}),T&&(0,f.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:T})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`setup`),children:`Back`}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:async()=>{if(d){w(!0),E(null);try{await d(y,x)?(v(`overview`),S(``)):E(`Invalid verification code. Please try again.`)}finally{w(!1)}}},disabled:x.length!==6||C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,f.jsx)(l.Lock,{className:`h-4 w-4 mr-2`}),`Verify & Enable`]})]})]}),_===`disable`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{className:`text-destructive`,children:`Disable Two-Factor Authentication`}),(0,f.jsx)(Se,{children:`Enter your verification code to confirm. This will make your account less secure.`})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-destructive/10 border border-destructive/20`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-5 w-5 text-destructive mt-0.5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`font-medium text-destructive`,children:`Warning`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Disabling 2FA will remove an important layer of security from your account. Anyone with your password will be able to access your account.`})]})]})}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Enter your verification code`}),(0,f.jsx)(SR,{value:x,onChange:S}),T&&(0,f.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:T})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`overview`),children:`Cancel`}),(0,f.jsxs)(r.r,{variant:`destructive`,className:`flex-1`,onClick:async()=>{if(p){w(!0),E(null);try{await p(x)?(v(`overview`),S(``)):E(`Invalid verification code. Please try again.`)}finally{w(!1)}}},disabled:x.length!==6||C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 mr-2`}),`Disable 2FA`]})]})]}),e.enabled&&u&&u.length>0&&_===`overview`&&(0,f.jsx)(CR,{codes:u,onRegenerate:m,onDownload:()=>{let e=u.map(e=>e.code).join(`
2656
- `),t=new Blob([e],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`backup-codes.txt`,r.click()}}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Fingerprint,{className:`h-5 w-5`}),`Security Tips`]})}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Use an authenticator app for the most secure experience`})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Store your backup codes in a safe place (password manager, safe deposit box)`})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Never share your verification codes with anyone`})]})]})]})]})}var TR=[{code:`ABCD-1234`,used:!1},{code:`EFGH-5678`,used:!1},{code:`IJKL-9012`,used:!0},{code:`MNOP-3456`,used:!1},{code:`QRST-7890`,used:!1},{code:`UVWX-1234`,used:!0},{code:`YZAB-5678`,used:!1},{code:`CDEF-9012`,used:!1}],ER={enabled:!0,method:`authenticator`,lastVerified:new Date(`2024-03-01`)},DR={online:`bg-green-500`,offline:`bg-gray-400`,away:`bg-yellow-500`,busy:`bg-red-500`};function OR({user:e,size:n=`md`}){return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[n],children:[(0,f.jsx)(ye,{src:e.avatar,alt:e.name}),(0,f.jsx)(be,{children:e.name.slice(0,2).toUpperCase()})]}),e.status&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,DR[e.status])})]})}function kR({conversation:e,currentUserId:r,isSelected:i,onClick:a}){let o=e.participants.find(e=>e.id!==r),s=e.isGroup?e.groupName:o?.name,c=e.isGroup?e.groupAvatar:o?.avatar;return(0,f.jsxs)(`button`,{onClick:a,className:t.t(`w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left`,i?`bg-primary/10`:`hover:bg-muted/50`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{children:[(0,f.jsx)(ye,{src:c}),(0,f.jsx)(be,{children:s?.slice(0,2).toUpperCase()})]}),!e.isGroup&&o?.status&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,DR[o.status])})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:s}),e.lastMessage&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.lastMessage.timestamp==`string`?e.lastMessage.timestamp:MR(e.lastMessage.timestamp)})]}),e.lastMessage&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:e.lastMessage.content})]}),e.unreadCount&&e.unreadCount>0&&(0,f.jsx)(n.x,{className:`h-5 w-5 p-0 flex items-center justify-center rounded-full`,children:e.unreadCount}),e.isPinned&&(0,f.jsx)(l.Pin,{className:`h-3 w-3 text-muted-foreground`})]})}function AR({message:e,isOwn:n,sender:r,showAvatar:i}){let a={sending:(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),sent:(0,f.jsx)(l.Check,{className:`h-3 w-3`}),delivered:(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3`}),read:(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3 text-blue-500`})};return(0,f.jsxs)(`div`,{className:t.t(`flex gap-2 max-w-[80%]`,n?`ml-auto flex-row-reverse`:``),children:[i&&r&&!n&&(0,f.jsx)(OR,{user:r,size:`sm`}),!i&&!n&&(0,f.jsx)(`div`,{className:`w-8`}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[!n&&i&&r&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:r.name}),(0,f.jsxs)(`div`,{className:t.t(`rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-br-md`:`bg-muted rounded-bl-md`),children:[e.replyTo&&(0,f.jsxs)(`div`,{className:t.t(`text-xs mb-1 pb-1 border-b`,n?`border-primary-foreground/20`:`border-border`),children:[(0,f.jsx)(l.Reply,{className:`h-3 w-3 inline mr-1`}),`Reply to message`]}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),e.attachments&&e.attachments.length>0&&(0,f.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.attachments.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`image`?(0,f.jsx)(l.Image,{className:`h-4 w-4`}):(0,f.jsx)(l.File,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`text-xs truncate`,children:e.name})]},e.id))})]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-xs text-muted-foreground`,n?`justify-end`:``),children:[(0,f.jsx)(`span`,{children:typeof e.timestamp==`string`?e.timestamp:MR(e.timestamp)}),n&&e.status&&a[e.status]]}),e.reactions&&e.reactions.length>0&&(0,f.jsx)(`div`,{className:`flex gap-1 mt-1`,children:Array.from(new Set(e.reactions.map(e=>e.emoji))).map(t=>(0,f.jsxs)(`span`,{className:`text-xs bg-muted rounded-full px-2 py-0.5`,children:[t,` `,e.reactions.filter(e=>e.emoji===t).length]},t))})]})]})}function jR({users:e}){if(e.length===0)return null;let t=e.map(e=>e.name).join(`, `);return(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`div`,{className:`flex gap-1`,children:[(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`0ms`}}),(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`150ms`}}),(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`300ms`}})]}),(0,f.jsxs)(`span`,{children:[t,` `,e.length===1?`is`:`are`,` typing...`]})]})}function MR(e){return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function NR({currentUser:e,conversations:n=[],selectedConversation:i,messages:a=[],onSendMessage:o,onSelectConversation:c,onTyping:u,typingUsers:d=[],showSidebar:p=!0,className:m}){let[h,g]=s.useState(``),[_,v]=s.useState(``),y=s.useRef(null),b=()=>{y.current?.scrollIntoView({behavior:`smooth`})};s.useEffect(()=>{b()},[a]);let x=()=>{!h.trim()||!o||(o(h.trim()),g(``))},S=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},C=n.filter(t=>{if(!_)return!0;let n=t.participants.find(t=>t.id!==e.id);return(t.isGroup?t.groupName:n?.name)?.toLowerCase().includes(_.toLowerCase())}),w=i?.participants.find(t=>t.id!==e.id),T=i?.isGroup?i.groupName:w?.name,E=a.reduce((e,t,n)=>{let r=a[n-1],i=!r||r.senderId!==t.senderId;return e.push({message:t,showAvatar:i}),e},[]);return(0,f.jsxs)(`div`,{className:t.t(`flex h-[600px] rounded-lg border overflow-hidden`,m),children:[p&&(0,f.jsxs)(`div`,{className:`w-80 border-r flex flex-col bg-card`,children:[(0,f.jsxs)(`div`,{className:`p-4 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Messages`}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search conversations...`,value:_,onChange:e=>v(e.target.value),className:`pl-9`})]})]}),(0,f.jsx)(er,{className:`flex-1`,children:(0,f.jsx)(`div`,{className:`p-2 space-y-1`,children:C.map(t=>(0,f.jsx)(kR,{conversation:t,currentUserId:e.id,isSelected:i?.id===t.id,onClick:()=>c?.(t)},t.id))})})]}),(0,f.jsx)(`div`,{className:`flex-1 flex flex-col`,children:i?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`h-16 border-b flex items-center justify-between px-4 bg-card`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[w&&(0,f.jsx)(OR,{user:w}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:T}),w?.status&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:w.status===`online`?`Online`:`Last seen ${w.lastSeen||`recently`}`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Video,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})]})]}),(0,f.jsxs)(er,{className:`flex-1 p-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-4`,children:[E.map(({message:t,showAvatar:n})=>(0,f.jsx)(AR,{message:t,isOwn:t.senderId===e.id,sender:i.participants.find(e=>e.id===t.senderId),showAvatar:n},t.id)),(0,f.jsx)(`div`,{ref:y})]}),d.length>0&&(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(jR,{users:d})})]}),(0,f.jsx)(`div`,{className:`p-4 border-t bg-card`,children:(0,f.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Paperclip,{className:`h-4 w-4`})}),(0,f.jsx)(`div`,{className:`flex-1`,children:(0,f.jsx)(r.n,{placeholder:`Type a message...`,value:h,onChange:e=>{g(e.target.value),u?.()},onKeyDown:S,className:`rounded-full`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Smile,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{size:`icon`,onClick:x,disabled:!h.trim(),children:(0,f.jsx)(l.Send,{className:`h-4 w-4`})})]})})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4`,children:(0,f.jsx)(l.Send,{className:`h-8 w-8 text-muted-foreground`})}),(0,f.jsx)(`h3`,{className:`font-medium text-lg`,children:`Your Messages`}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Select a conversation to start chatting`})]})})})]})}var PR=[{id:`1`,name:`John Doe`,avatar:``,status:`online`},{id:`2`,name:`Jane Smith`,avatar:``,status:`away`,lastSeen:`2 hours ago`},{id:`3`,name:`Bob Wilson`,avatar:``,status:`offline`,lastSeen:`yesterday`},{id:`4`,name:`Alice Brown`,avatar:``,status:`busy`}],FR=[{id:`conv1`,participants:[PR[0],PR[1]],lastMessage:{id:`m1`,content:`Hey, how's the project going?`,senderId:`2`,timestamp:new Date,status:`read`},unreadCount:2,isPinned:!0},{id:`conv2`,participants:[PR[0],PR[2]],lastMessage:{id:`m2`,content:`See you tomorrow!`,senderId:`1`,timestamp:new Date(Date.now()-36e5),status:`delivered`}},{id:`conv3`,isGroup:!0,groupName:`Project Team`,participants:[PR[0],PR[1],PR[2],PR[3]],lastMessage:{id:`m3`,content:`Meeting at 3pm`,senderId:`4`,timestamp:new Date(Date.now()-72e5),status:`read`},unreadCount:5}],IR=[{id:`msg1`,content:`Hey! How are you doing?`,senderId:`2`,timestamp:new Date(Date.now()-36e5),status:`read`},{id:`msg2`,content:`I'm doing great, thanks for asking! Just finished the new feature.`,senderId:`1`,timestamp:new Date(Date.now()-35e5),status:`read`},{id:`msg3`,content:`That's awesome! Can you show me a demo?`,senderId:`2`,timestamp:new Date(Date.now()-34e5),status:`read`},{id:`msg4`,content:`Sure! Let me schedule a call for tomorrow. Does 2pm work for you?`,senderId:`1`,timestamp:new Date(Date.now()-33e5),status:`delivered`},{id:`msg5`,content:`Perfect, 2pm works great!`,senderId:`2`,timestamp:new Date(Date.now()-32e5),status:`read`}],LR={pending:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),label:`Pending`},building:{color:`text-blue-500 bg-blue-500/10`,icon:(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}),label:`Building`},deploying:{color:`text-purple-500 bg-purple-500/10`,icon:(0,f.jsx)(l.Rocket,{className:`h-4 w-4 animate-pulse`}),label:`Deploying`},success:{color:`text-green-500 bg-green-500/10`,icon:(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),label:`Success`},failed:{color:`text-red-500 bg-red-500/10`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Failed`},cancelled:{color:`text-gray-500 bg-gray-500/10`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Cancelled`},rollback:{color:`text-orange-500 bg-orange-500/10`,icon:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`}),label:`Rollback`}},RR={development:{color:`text-blue-500 border-blue-500/30 bg-blue-500/10`,icon:(0,f.jsx)(l.Terminal,{className:`h-4 w-4`})},staging:{color:`text-yellow-500 border-yellow-500/30 bg-yellow-500/10`,icon:(0,f.jsx)(l.Server,{className:`h-4 w-4`})},production:{color:`text-green-500 border-green-500/30 bg-green-500/10`,icon:(0,f.jsx)(l.Globe,{className:`h-4 w-4`})}};function zR({status:e}){let r=LR[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function BR({environment:e}){let r=RR[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1 capitalize`,r.color),children:[r.icon,e]})}function VR({deployment:e,onRollback:t,onCancel:n,onRetry:i}){let a=e.status===`building`||e.status===`deploying`,o=e.status===`success`&&e.environment===`production`,s=e.status===`failed`,c=a;return(0,f.jsx)(`div`,{className:`p-4 rounded-lg border bg-card hover:bg-muted/50 transition-colors`,children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(ve,{className:`h-10 w-10`,children:[(0,f.jsx)(ye,{src:e.author.avatar}),(0,f.jsx)(be,{children:e.author.name.slice(0,2).toUpperCase()})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(zR,{status:e.status}),(0,f.jsx)(BR,{environment:e.environment})]}),(0,f.jsx)(`p`,{className:`text-sm mt-1 line-clamp-1`,children:e.commitMessage}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3`}),e.branch]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.GitCommit,{className:`h-3 w-3`}),e.commit.slice(0,7)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),typeof e.startedAt==`string`?e.startedAt:WR(e.startedAt)]}),e.duration&&(0,f.jsx)(`span`,{children:e.duration})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.url&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,asChild:!0,children:(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4`})})}),c&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:n,children:(0,f.jsx)(l.Pause,{className:`h-4 w-4`})}),s&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:i,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:t,children:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`})})]})]})})}function HR({pipeline:e}){let n=e.stages.filter(e=>e.status===`success`).length/e.stages.length*100;return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`pb-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(zR,{status:e.status}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.startedAt==`string`?e.startedAt:WR(e.startedAt)})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3`}),e.branch,(0,f.jsx)(`span`,{className:`mx-1`,children:`•`}),`Triggered by `,e.trigger]})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(Zn,{value:n,className:`h-2`}),(0,f.jsx)(`div`,{className:`flex items-center justify-between`,children:e.stages.map((n,r)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center`,LR[n.status].color),children:LR[n.status].icon}),(0,f.jsx)(`span`,{className:`text-xs`,children:n.name}),n.duration&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.duration})]}),r<e.stages.length-1&&(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 text-muted-foreground`})]},n.id))})]})})]})}function UR({env:e}){let n={healthy:`text-green-500`,degraded:`text-yellow-500`,down:`text-red-500`},r={healthy:(0,f.jsx)(l.CheckCircle,{className:`h-5 w-5`}),degraded:(0,f.jsx)(l.AlertCircle,{className:`h-5 w-5`}),down:(0,f.jsx)(l.XCircle,{className:`h-5 w-5`})};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`capitalize flex items-center gap-2`,children:[RR[e.name].icon,e.name]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1`,n[e.status]),children:[r[e.status],(0,f.jsx)(`span`,{className:`text-sm capitalize`,children:e.status})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline truncate`,children:e.url})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[e.uptime&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Uptime`}),(0,f.jsx)(`p`,{className:`font-medium`,children:e.uptime})]}),e.responseTime&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Response Time`}),(0,f.jsx)(`p`,{className:`font-medium`,children:e.responseTime})]})]}),e.lastDeployment&&(0,f.jsxs)(`div`,{className:`pt-2 border-t`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Last Deployment`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(zR,{status:e.lastDeployment.status}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:typeof e.lastDeployment.startedAt==`string`?e.lastDeployment.startedAt:WR(e.lastDeployment.startedAt)})]})]})]})]})}function WR(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function GR({deployments:e=[],pipelines:i=[],environments:a=[],onDeploy:o,onRollback:c,onCancel:u,onRetry:d,branches:p=[`main`,`develop`,`staging`],className:m}){let[h,g]=s.useState(p[0]),[_,v]=s.useState(`staging`),y=e.filter(e=>e.status===`building`||e.status===`deploying`);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Deployments`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage and monitor your deployments`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:h,onValueChange:g,children:[(0,f.jsxs)(n.y,{className:`w-[160px]`,children:[(0,f.jsx)(l.GitBranch,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsx)(n.f,{children:p.map(e=>(0,f.jsx)(n.m,{value:e,children:e},e))})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsxs)(n.y,{className:`w-[160px]`,children:[(0,f.jsx)(l.Server,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`development`,children:`Development`}),(0,f.jsx)(n.m,{value:`staging`,children:`Staging`}),(0,f.jsx)(n.m,{value:`production`,children:`Production`})]})]}),(0,f.jsxs)(r.r,{onClick:()=>o?.(_,h),children:[(0,f.jsx)(l.Rocket,{className:`h-4 w-4 mr-2`}),`Deploy`]})]})]}),y.length>0&&(0,f.jsx)(Y,{className:`border-blue-500/50 bg-blue-500/5`,children:(0,f.jsx)(Q,{className:`py-4`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-blue-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.Rocket,{className:`h-5 w-5 text-blue-500 animate-pulse`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[y.length,` deployment`,y.length>1?`s`:``,` in progress`]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.map(e=>e.environment).join(`, `)})]})]})})}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:a.map(e=>(0,f.jsx)(UR,{env:e},e.name))}),(0,f.jsxs)(Cr,{defaultValue:`deployments`,className:`w-full`,children:[(0,f.jsxs)(wr,{children:[(0,f.jsx)(Tr,{value:`deployments`,children:`Recent Deployments`}),(0,f.jsx)(Tr,{value:`pipelines`,children:`Pipelines`})]}),(0,f.jsx)(Er,{value:`deployments`,className:`mt-4 space-y-3`,children:e.length>0?e.map(e=>(0,f.jsx)(VR,{deployment:e,onRollback:()=>c?.(e.id),onCancel:()=>u?.(e.id),onRetry:()=>d?.(e.id)},e.id)):(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`py-12 text-center`,children:[(0,f.jsx)(l.Rocket,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`No deployments yet`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Deploy your first version to get started`})]})})}),(0,f.jsx)(Er,{value:`pipelines`,className:`mt-4 space-y-4`,children:i.length>0?i.map(e=>(0,f.jsx)(HR,{pipeline:e},e.id)):(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`py-12 text-center`,children:[(0,f.jsx)(l.Activity,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`No active pipelines`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pipelines will appear here when triggered`})]})})})]})]})}var KR=[{id:`d1`,status:`success`,environment:`production`,branch:`main`,commit:`a1b2c3d4e5f6`,commitMessage:`feat: Add new dashboard component`,author:{name:`John Doe`},startedAt:new Date(Date.now()-36e5),finishedAt:new Date(Date.now()-33e5),duration:`5m 12s`,url:`https://app.example.com`},{id:`d2`,status:`building`,environment:`staging`,branch:`develop`,commit:`f6e5d4c3b2a1`,commitMessage:`fix: Resolve login issue`,author:{name:`Jane Smith`},startedAt:new Date(Date.now()-18e4)},{id:`d3`,status:`failed`,environment:`development`,branch:`feature/new-api`,commit:`1a2b3c4d5e6f`,commitMessage:`wip: New API endpoints`,author:{name:`Bob Wilson`},startedAt:new Date(Date.now()-72e5),finishedAt:new Date(Date.now()-7e6),duration:`3m 20s`}],qR=[{id:`p1`,name:`CI/CD Pipeline`,status:`building`,trigger:`push to main`,branch:`main`,startedAt:new Date(Date.now()-3e5),stages:[{id:`s1`,name:`Build`,status:`success`,duration:`1m 30s`},{id:`s2`,name:`Test`,status:`success`,duration:`2m 45s`},{id:`s3`,name:`Deploy`,status:`building`},{id:`s4`,name:`Verify`,status:`pending`}]}],JR=[{name:`production`,status:`healthy`,url:`https://app.example.com`,uptime:`99.9%`,responseTime:`120ms`,lastDeployment:KR[0]},{name:`staging`,status:`degraded`,url:`https://staging.example.com`,uptime:`98.5%`,responseTime:`250ms`},{name:`development`,status:`healthy`,url:`https://dev.example.com`,uptime:`95.0%`,responseTime:`180ms`}],YR={critical:{label:`Critical`,color:`text-red-500`,bgColor:`bg-red-500`},high:{label:`High`,color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{label:`Medium`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{label:`Low`,color:`text-blue-500`,bgColor:`bg-blue-500`}},XR={triggered:{label:`Triggered`,color:`text-red-500`,icon:l.AlertCircle},acknowledged:{label:`Acknowledged`,color:`text-orange-500`,icon:l.Bell},investigating:{label:`Investigating`,color:`text-yellow-500`,icon:l.Search},identified:{label:`Identified`,color:`text-blue-500`,icon:l.Activity},resolved:{label:`Resolved`,color:`text-green-500`,icon:l.CheckCircle2},closed:{label:`Closed`,color:`text-gray-500`,icon:l.XCircle}};function ZR(e,t){let n=(t||new Date).getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return a>0?`${a}d ${i%24}h`:i>0?`${i}h ${r%60}m`:`${r}m`}function QR(e){return e.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}function $R({incident:e,onAcknowledge:i,onResolve:a,onSelect:o}){let s=YR[e.severity],c=XR[e.status],u=c.icon,d=![`resolved`,`closed`].includes(e.status);return(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.severity===`critical`&&d&&`border-red-500/50 bg-red-500/5`,e.severity===`high`&&d&&`border-orange-500/30`),onClick:o,children:(0,f.jsx)(Q,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,`${s.bgColor}/10`),children:(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-5 w-5`,s.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(n.x,{className:t.t(`text-white text-xs`,s.bgColor),children:s.label}),(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs`,c.color),children:[(0,f.jsx)(u,{className:`h-3 w-3 mr-1`}),c.label]}),e.service&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e.service})]}),(0,f.jsx)(`h4`,{className:`font-semibold mt-2 truncate`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.description}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),ZR(e.createdAt,e.resolvedAt)]}),e.affectedUsers!==void 0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Users,{className:`h-3 w-3`}),e.affectedUsers,` affected`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.MessageSquare,{className:`h-3 w-3`}),e.events.length]})]}),e.responders.length>0&&(0,f.jsx)(`div`,{className:`flex items-center gap-2 mt-3`,children:(0,f.jsxs)(`div`,{className:`flex -space-x-2`,children:[e.responders.slice(0,3).map(e=>(0,f.jsxs)(ve,{className:`h-6 w-6 border-2 border-background`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id)),e.responders.length>3&&(0,f.jsxs)(`div`,{className:`h-6 w-6 rounded-full bg-muted flex items-center justify-center text-xs border-2 border-background`,children:[`+`,e.responders.length-3]})]})})]}),d&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[e.status===`triggered`&&i&&(0,f.jsx)(r.r,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:e=>{e.stopPropagation(),i()},children:`Ack`}),e.status!==`triggered`&&e.status!==`resolved`&&a&&(0,f.jsx)(r.r,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-green-500`,onClick:e=>{e.stopPropagation(),a()},children:`Resolve`})]})]})})})}function ez({incidents:e}){let t=e.filter(e=>![`resolved`,`closed`].includes(e.status)),n=t.filter(e=>e.severity===`critical`),r=s.useMemo(()=>{let t=e.filter(e=>e.resolvedAt);if(t.length===0)return 0;let n=t.reduce((e,t)=>e+(t.resolvedAt.getTime()-t.createdAt.getTime()),0);return Math.round(n/t.length/6e4)},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-red-500`,children:t.length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Incidents`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-orange-500`,children:n.length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Critical`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-3xl font-bold`,children:[r,`m`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg MTTR`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-green-500`,children:e.filter(e=>e.status===`resolved`).length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Resolved Today`})]})})]})}function tz({incidents:e,onCreateIncident:i,onAcknowledge:a,onResolve:o,onEscalate:c,onAssign:u,className:d}){let[p,m]=s.useState(``),[h,g]=s.useState(`all`),[_,v]=s.useState(`active`),[y,b]=s.useState(null),x=s.useMemo(()=>e.filter(e=>!(p&&!e.title.toLowerCase().includes(p.toLowerCase())||h!==`all`&&e.severity!==h||_===`active`&&[`resolved`,`closed`].includes(e.status)||_===`resolved`&&![`resolved`,`closed`].includes(e.status))).sort((e,t)=>{let n={critical:0,high:1,medium:2,low:3},r=n[e.severity]-n[t.severity];return r===0?t.createdAt.getTime()-e.createdAt.getTime():r}),[e,p,h,_]);return(0,f.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,d),children:[(0,f.jsx)(ez,{incidents:e}),(0,f.jsxs)(`div`,{className:`flex gap-6`,children:[(0,f.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search incidents...`,value:p,onChange:e=>m(e.target.value),className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Severity`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Severity`}),(0,f.jsx)(n.m,{value:`critical`,children:`Critical`}),(0,f.jsx)(n.m,{value:`high`,children:`High`}),(0,f.jsx)(n.m,{value:`medium`,children:`Medium`}),(0,f.jsx)(n.m,{value:`low`,children:`Low`})]})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`active`,children:`Active`}),(0,f.jsx)(n.m,{value:`resolved`,children:`Resolved`}),(0,f.jsx)(n.m,{value:`all`,children:`All`})]})]}),i&&(0,f.jsxs)(r.r,{onClick:i,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Create Incident`]})]}),(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`space-y-3 pr-4`,children:x.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-12 w-12 mb-4 text-green-500`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No incidents`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`All systems are operational`})]}):x.map(e=>(0,f.jsx)($R,{incident:e,onAcknowledge:a?()=>a(e):void 0,onResolve:o?()=>o(e):void 0,onSelect:()=>b(e)},e.id))})})]}),y&&(0,f.jsxs)(Y,{className:`w-96 shrink-0`,children:[(0,f.jsxs)(X,{className:`pb-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(n.x,{className:t.t(`text-white`,YR[y.severity].bgColor),children:YR[y.severity].label}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>b(null),children:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`})})]}),(0,f.jsx)(Z,{className:`mt-2`,children:y.title}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,f.jsx)(n.x,{variant:`outline`,className:XR[y.status].color,children:XR[y.status].label}),y.service&&(0,f.jsx)(n.x,{variant:`secondary`,children:y.service})]})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[y.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.description}),y.impact&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Impact`}),(0,f.jsx)(`p`,{className:`text-sm`,children:y.impact})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Timeline`}),(0,f.jsx)(`div`,{className:`space-y-2`,children:y.events.slice(0,5).map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:QR(e.timestamp)}),(0,f.jsx)(`span`,{children:e.content})]},e.id))})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Responders`}),(0,f.jsx)(`div`,{className:`space-y-2`,children:y.responders.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(ve,{className:`h-6 w-6`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{className:`text-sm`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs ml-auto`,children:e.role})]},e.id))})]}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t`,children:[y.slackChannel&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-2`}),`Join #`,y.slackChannel]}),y.runbookUrl&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4 mr-2`}),`View Runbook`]}),c&&![`resolved`,`closed`].includes(y.status)&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start text-orange-500`,onClick:()=>c(y),children:[(0,f.jsx)(l.Phone,{className:`h-4 w-4 mr-2`}),`Escalate`]})]})]})]})]})]})}var nz=[{id:`1`,title:`Database connection pool exhausted`,description:`Production database is experiencing connection pool exhaustion, causing request timeouts`,severity:`critical`,status:`investigating`,service:`api-gateway`,createdAt:new Date(Date.now()-45*6e4),acknowledgedAt:new Date(Date.now()-40*6e4),impact:`50% of API requests failing with 504 errors`,affectedUsers:12500,slackChannel:`incident-db-001`,runbookUrl:`https://runbooks.example.com/db-pool`,responders:[{id:`1`,name:`John Doe`,role:`Incident Commander`,status:`engaged`},{id:`2`,name:`Jane Smith`,role:`DBA`,status:`engaged`}],events:[{id:`e1`,type:`status_change`,timestamp:new Date(Date.now()-45*6e4),content:`Incident triggered by alerting system`},{id:`e2`,type:`assignment`,timestamp:new Date(Date.now()-43*6e4),content:`John Doe assigned as IC`,user:`System`},{id:`e3`,type:`status_change`,timestamp:new Date(Date.now()-40*6e4),content:`Incident acknowledged`,user:`John Doe`},{id:`e4`,type:`comment`,timestamp:new Date(Date.now()-35*6e4),content:`Investigating connection pool settings`,user:`Jane Smith`},{id:`e5`,type:`status_change`,timestamp:new Date(Date.now()-30*6e4),content:`Status changed to investigating`,user:`John Doe`}]},{id:`2`,title:`High latency on payment service`,description:`Payment processing latency increased to >2s, above SLA threshold`,severity:`high`,status:`acknowledged`,service:`payment-service`,createdAt:new Date(Date.now()-20*6e4),acknowledgedAt:new Date(Date.now()-15*6e4),affectedUsers:3200,responders:[{id:`3`,name:`Alice Johnson`,role:`On-Call Engineer`,status:`engaged`}],events:[{id:`e6`,type:`status_change`,timestamp:new Date(Date.now()-20*6e4),content:`Incident triggered`},{id:`e7`,type:`status_change`,timestamp:new Date(Date.now()-15*6e4),content:`Acknowledged by Alice Johnson`}]},{id:`3`,title:`Elevated error rate on search API`,severity:`medium`,status:`triggered`,service:`search-service`,createdAt:new Date(Date.now()-5*6e4),responders:[],events:[{id:`e8`,type:`status_change`,timestamp:new Date(Date.now()-5*6e4),content:`Incident triggered by alerting system`}]},{id:`4`,title:`Memory leak in recommendation engine`,description:`Gradual memory increase detected, auto-scaling keeping up but needs investigation`,severity:`low`,status:`resolved`,service:`recommendation-engine`,createdAt:new Date(Date.now()-4*36e5),acknowledgedAt:new Date(Date.now()-3.5*36e5),resolvedAt:new Date(Date.now()-2*36e5),responders:[{id:`4`,name:`Bob Wilson`,role:`Backend Engineer`,status:`available`}],events:[{id:`e9`,type:`status_change`,timestamp:new Date(Date.now()-4*36e5),content:`Incident triggered`},{id:`e10`,type:`status_change`,timestamp:new Date(Date.now()-2*36e5),content:`Resolved - deployed fix v2.3.1`}]}],rz={region:{icon:l.Globe,color:`text-blue-500`,label:`Region`},vpc:{icon:l.Network,color:`text-purple-500`,label:`VPC`},subnet:{icon:l.Layers,color:`text-indigo-500`,label:`Subnet`},server:{icon:l.Server,color:`text-gray-500`,label:`Server`},database:{icon:l.Database,color:`text-green-500`,label:`Database`},loadbalancer:{icon:l.Activity,color:`text-cyan-500`,label:`Load Balancer`},cache:{icon:l.HardDrive,color:`text-red-500`,label:`Cache`},storage:{icon:l.HardDrive,color:`text-orange-500`,label:`Storage`},container:{icon:l.Container,color:`text-blue-400`,label:`Container`},function:{icon:l.Cpu,color:`text-yellow-500`,label:`Function`},cdn:{icon:l.Globe,color:`text-teal-500`,label:`CDN`},firewall:{icon:l.Shield,color:`text-red-400`,label:`Firewall`}},iz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},maintenance:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Maintenance`}},az={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},custom:{label:`Custom`,color:`text-gray-500`}};function oz({resource:e,depth:r=0,onClick:i,isExpanded:a,onToggle:o}){let s=rz[e.type],c=iz[e.status],u=s.icon,d=e.children&&e.children.length>0;return(0,f.jsx)(`div`,{className:t.t(`border-l-2`,r>0&&`ml-6`,c.color.replace(`text-`,`border-`)),children:(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-3 cursor-pointer rounded-r-lg transition-all`,`hover:bg-muted/50`,e.status===`critical`&&`bg-red-500/5`,e.status===`warning`&&`bg-yellow-500/5`),onClick:i,children:[d&&(0,f.jsx)(`button`,{className:`p-1 hover:bg-muted rounded`,onClick:e=>{e.stopPropagation(),o?.()},children:(0,f.jsx)(l.Layers,{className:t.t(`h-4 w-4`,a&&`rotate-90`)})}),(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg bg-muted/50`),children:(0,f.jsx)(u,{className:t.t(`h-5 w-5`,s.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs shrink-0`,children:s.label}),e.provider&&(0,f.jsx)(n.x,{variant:`secondary`,className:t.t(`text-xs shrink-0`,az[e.provider].color),children:az[e.provider].label})]}),e.region&&(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.region})]}),e.metrics&&(0,f.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.metrics.cpu!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[`CPU: `,e.metrics.cpu,`%`]}),e.metrics.memory!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.memory>80&&`text-red-500`),children:[`MEM: `,e.metrics.memory,`%`]}),e.metrics.latency!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.latency>500&&`text-yellow-500`),children:[e.metrics.latency,`ms`]})]}),(0,f.jsx)(ti,{children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{children:(0,f.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full shrink-0`,c.bgColor)})}),(0,f.jsx)(ii,{children:c.label})]})})]})})}function sz({resources:e,depth:n=0,expandedIds:r,onToggle:i,onResourceClick:a}){return(0,f.jsx)(`div`,{className:t.t(n>0&&`ml-4`),children:e.map(e=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(oz,{resource:e,depth:n,onClick:()=>a?.(e),isExpanded:r.has(e.id),onToggle:()=>i(e.id)}),r.has(e.id)&&e.children&&(0,f.jsx)(sz,{resources:e.children,depth:n+1,expandedIds:r,onToggle:i,onResourceClick:a})]},e.id))})}function cz({resources:e,onResourceClick:n}){let r=e=>e.reduce((e,t)=>(e.push(t),t.children&&e.push(...r(t.children)),e),[]);return(0,f.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3`,children:r(e).map(e=>{let r=rz[e.type],i=iz[e.status],a=r.icon;return(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/50`),onClick:()=>n?.(e),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(a,{className:t.t(`h-5 w-5`,r.color)})}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.label})]}),e.metrics&&(0,f.jsx)(`div`,{className:`flex items-center gap-2 mt-2 text-xs`,children:e.metrics.cpu!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[e.metrics.cpu,`%`]})})]})},e.id)})})}function lz({resources:e}){let t=s.useMemo(()=>{let t=0,n=0,r=0,i=0,a=e=>{e.forEach(e=>{t++,e.status===`healthy`&&n++,e.status===`warning`&&r++,e.status===`critical`&&i++,e.children&&a(e.children)})};return a(e),{total:t,healthy:n,warning:r,critical:i}},[e]);return(0,f.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Box,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`font-medium`,children:t.total}),(0,f.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Resources`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500`}),(0,f.jsx)(`span`,{className:`font-medium text-green-500`,children:t.healthy})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),(0,f.jsx)(`span`,{className:`font-medium text-yellow-500`,children:t.warning})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-red-500`}),(0,f.jsx)(`span`,{className:`font-medium text-red-500`,children:t.critical})]})]})}function uz({resources:e,onResourceClick:t,onRefresh:i,showConnections:a=!1,viewMode:o=`tree`,className:c}){let[u,d]=s.useState(o),[p,m]=s.useState(()=>new Set(e.map(e=>e.id))),[h,g]=s.useState(`all`),_=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=()=>{let t=new Set,n=e=>{e.forEach(e=>{t.add(e.id),e.children&&n(e.children)})};n(e),m(t)},y=()=>{m(new Set)},b=s.useMemo(()=>{if(h===`all`)return e;let t=e=>e.filter(e=>{let n=e.children?.some(e=>t([e]).length>0);return e.status===h||n}).map(e=>({...e,children:e.children?t(e.children):void 0}));return t(e)},[e,h]);return(0,f.jsxs)(Y,{className:c,children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Cloud,{className:`h-5 w-5`}),(0,f.jsx)(Z,{children:`Infrastructure Map`})]}),(0,f.jsx)(lz,{resources:e})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:u,onValueChange:e=>d(e),children:[(0,f.jsx)(n.y,{className:`w-28`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`tree`,children:`Tree View`}),(0,f.jsx)(n.m,{value:`grid`,children:`Grid View`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{placeholder:`Status`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`healthy`,children:`Healthy`}),(0,f.jsx)(n.m,{value:`warning`,children:`Warning`}),(0,f.jsx)(n.m,{value:`critical`,children:`Critical`}),(0,f.jsx)(n.m,{value:`maintenance`,children:`Maintenance`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u===`tree`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,f.jsx)(l.Maximize2,{className:`h-4 w-4 mr-1`}),`Expand`]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:y,children:`Collapse`})]}),i&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:i,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(`div`,{className:`min-h-[400px]`,children:b.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-64 text-muted-foreground`,children:[(0,f.jsx)(l.Cloud,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{children:`No resources found`})]}):u===`tree`?(0,f.jsx)(sz,{resources:b,expandedIds:p,onToggle:_,onResourceClick:t}):(0,f.jsx)(cz,{resources:b,onResourceClick:t})})]})]})}var dz=[{id:`region-us-east-1`,name:`us-east-1`,type:`region`,status:`healthy`,provider:`aws`,region:`N. Virginia`,children:[{id:`vpc-prod`,name:`production-vpc`,type:`vpc`,status:`healthy`,provider:`aws`,metadata:{cidr:`10.0.0.0/16`},children:[{id:`subnet-public-1`,name:`public-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.1.0/24`},children:[{id:`alb-1`,name:`api-load-balancer`,type:`loadbalancer`,status:`healthy`,metrics:{requests:15e3,latency:45}},{id:`nat-1`,name:`nat-gateway-1a`,type:`firewall`,status:`healthy`}]},{id:`subnet-private-1`,name:`private-subnet-1a`,type:`subnet`,status:`warning`,metadata:{az:`us-east-1a`,cidr:`10.0.10.0/24`},children:[{id:`ec2-api-1`,name:`api-server-1`,type:`server`,status:`healthy`,metrics:{cpu:45,memory:62}},{id:`ec2-api-2`,name:`api-server-2`,type:`server`,status:`warning`,metrics:{cpu:85,memory:78}},{id:`ec2-api-3`,name:`api-server-3`,type:`server`,status:`healthy`,metrics:{cpu:52,memory:55}}]},{id:`subnet-data-1`,name:`data-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.20.0/24`},children:[{id:`rds-primary`,name:`postgres-primary`,type:`database`,status:`healthy`,metrics:{cpu:35,memory:68}},{id:`redis-1`,name:`redis-cluster`,type:`cache`,status:`healthy`,metrics:{memory:45}}]}]}]},{id:`region-eu-west-1`,name:`eu-west-1`,type:`region`,status:`critical`,provider:`aws`,region:`Ireland`,children:[{id:`vpc-prod-eu`,name:`production-vpc-eu`,type:`vpc`,status:`critical`,children:[{id:`ec2-eu-1`,name:`api-server-eu-1`,type:`server`,status:`critical`,metrics:{cpu:98,memory:95}},{id:`rds-eu`,name:`postgres-replica`,type:`database`,status:`warning`,metrics:{cpu:75,memory:82}}]}]}],fz={build:{icon:l.Box,color:`text-blue-500`,label:`Build`},test:{icon:l.TestTube,color:`text-purple-500`,label:`Test`},deploy:{icon:l.Rocket,color:`text-green-500`,label:`Deploy`},script:{icon:l.Terminal,color:`text-gray-500`,label:`Script`},docker:{icon:l.Container,color:`text-cyan-500`,label:`Docker`},notify:{icon:l.Bell,color:`text-yellow-500`,label:`Notify`},approval:{icon:l.Shield,color:`text-orange-500`,label:`Approval`},artifact:{icon:l.Upload,color:`text-indigo-500`,label:`Artifact`},cache:{icon:l.Database,color:`text-pink-500`,label:`Cache`},parallel:{icon:l.Zap,color:`text-amber-500`,label:`Parallel`}},pz={pending:{color:`text-muted-foreground`,bgColor:`bg-muted`,icon:l.Clock},running:{color:`text-blue-500`,bgColor:`bg-blue-500`,icon:l.Play},success:{color:`text-green-500`,bgColor:`bg-green-500`,icon:l.CheckCircle2},failed:{color:`text-red-500`,bgColor:`bg-red-500`,icon:l.XCircle},skipped:{color:`text-gray-400`,bgColor:`bg-gray-400`,icon:l.ChevronRight},waiting:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,icon:l.Clock}};function mz({step:e,onUpdate:i,onDelete:a,readOnly:o}){let[c,u]=s.useState(!1),d=fz[e.type],p=d.icon,m=e.status?pz[e.status]:null,h=m?.icon;return(0,f.jsxs)(`div`,{className:t.t(`border rounded-lg transition-all`,e.status===`failed`&&`border-red-500/50`,e.status===`running`&&`border-blue-500/50 bg-blue-500/5`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-3 cursor-pointer`,onClick:()=>u(!c),children:[!o&&(0,f.jsx)(l.GripVertical,{className:`h-4 w-4 text-muted-foreground cursor-grab`}),(0,f.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${d.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(p,{className:t.t(`h-4 w-4`,d.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:d.label})]}),e.command&&(0,f.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono truncate block mt-0.5`,children:e.command})]}),h&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs`,m?.color),children:[(0,f.jsx)(h,{className:`h-3 w-3 mr-1`}),e.status]}),!o&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>u(!0),children:[(0,f.jsx)(l.Settings,{className:`h-4 w-4 mr-2`}),`Configure`]}),(0,f.jsxs)($,{children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:a,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsx)(l.ChevronRight,{className:t.t(`h-4 w-4 transition-transform`,c&&`rotate-90`)})]}),c&&(0,f.jsxs)(`div`,{className:`px-3 pb-3 pt-0 space-y-3 border-t mt-2`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Step Name`}),(0,f.jsx)(r.n,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 mt-1`,disabled:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Type`}),(0,f.jsxs)(n.d,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:o,children:[(0,f.jsx)(n.y,{className:`h-8 mt-1`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(fz).map(([e,r])=>(0,f.jsx)(n.m,{value:e,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.icon,{className:t.t(`h-4 w-4`,r.color)}),r.label]})},e))})]})]})]}),(e.type===`script`||e.type===`build`||e.type===`test`)&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,f.jsx)(r.n,{value:e.command||``,onChange:t=>i({...e,command:t.target.value}),placeholder:`npm run build`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]}),e.type===`docker`&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Docker Image`}),(0,f.jsx)(r.n,{value:e.image||``,onChange:t=>i({...e,image:t.target.value}),placeholder:`node:18-alpine`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Timeout (seconds)`}),(0,f.jsx)(r.n,{type:`number`,value:e.timeout||``,onChange:t=>i({...e,timeout:parseInt(t.target.value)||void 0}),placeholder:`300`,className:`h-8 mt-1`,disabled:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Retries`}),(0,f.jsx)(r.n,{type:`number`,value:e.retries||``,onChange:t=>i({...e,retries:parseInt(t.target.value)||void 0}),placeholder:`0`,className:`h-8 mt-1`,disabled:o})]})]}),e.condition!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Condition`}),(0,f.jsx)(r.n,{value:e.condition,onChange:t=>i({...e,condition:t.target.value}),placeholder:`$CI_COMMIT_BRANCH == 'main'`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]})]})]})}function hz({stage:e,onUpdate:i,onDelete:a,onAddStep:o,readOnly:c}){let[u,d]=s.useState(!1),p=e.status?pz[e.status]:null,m=p?.icon,h=(t,n)=>{i({...e,steps:e.steps.map(e=>e.id===t?n:e)})},g=t=>{i({...e,steps:e.steps.filter(e=>e.id!==t)})};return(0,f.jsxs)(Y,{className:t.t(e.status===`failed`&&`border-red-500/30`,e.status===`running`&&`border-blue-500/30`),children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`button`,{onClick:()=>d(!u),children:(0,f.jsx)(l.ChevronDown,{className:t.t(`h-4 w-4 transition-transform`,u&&`-rotate-90`)})}),(0,f.jsx)(r.n,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:c}),m&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs ml-auto`,p?.color),children:[(0,f.jsx)(m,{className:`h-3 w-3 mr-1`}),e.status]}),(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.steps.length,` steps`]}),!c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate Stage`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:a,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete Stage`]})]})]})]})}),!u&&(0,f.jsxs)(Q,{className:`space-y-2`,children:[e.steps.map(e=>(0,f.jsx)(mz,{step:e,onUpdate:t=>h(e.id,t),onDelete:()=>g(e.id),readOnly:c},e.id)),!c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Step`]})}),(0,f.jsx)(an,{className:`w-48`,children:Object.entries(fz).map(([e,n])=>(0,f.jsxs)($,{onClick:()=>o(e),children:[(0,f.jsx)(n.icon,{className:t.t(`h-4 w-4 mr-2`,n.color)}),n.label]},e))})]})]})]})}function gz({pipeline:e,onPipelineChange:i,onRun:a,onSave:o,onExport:c,readOnly:u=!1,className:d}){let[p,m]=s.useState(e),h=e=>{let t={...p,...e};m(t),i?.(t)},g=()=>{let e={id:`stage-${Date.now()}`,name:`Stage ${p.stages.length+1}`,steps:[]};h({stages:[...p.stages,e]})},_=(e,t)=>{h({stages:p.stages.map(n=>n.id===e?t:n)})},v=e=>{h({stages:p.stages.filter(t=>t.id!==e)})},y=(e,t)=>{let n=p.stages.find(t=>t.id===e);if(!n)return;let r={id:`step-${Date.now()}`,name:`${fz[t].label} Step`,type:t};_(e,{...n,steps:[...n.steps,r]})};return(0,f.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,d),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.GitBranch,{className:`h-5 w-5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(r.n,{value:p.name,onChange:e=>h({name:e.target.value}),className:`h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:u}),p.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p.description})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})}),(0,f.jsxs)(an,{children:[(0,f.jsx)($,{onClick:()=>c(`yaml`),children:`Export as YAML`}),(0,f.jsx)($,{onClick:()=>c(`json`),children:`Export as JSON`})]})]}),o&&!u&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:`Save`}),a&&(0,f.jsxs)(r.r,{size:`sm`,onClick:a,children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Run Pipeline`]})]})]})}),p.trigger&&(0,f.jsx)(Q,{className:`pt-0`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Triggers:`}),p.trigger.events?.map(e=>(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e},e)),p.trigger.branches?.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3 mr-1`}),e]},e)),p.trigger.schedule&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3 mr-1`}),p.trigger.schedule]})]})})]}),(0,f.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto pb-2`,children:p.stages.map((e,n)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`w-4 h-4 rounded-full border-2`,e.status===`success`&&`bg-green-500 border-green-500`,e.status===`failed`&&`bg-red-500 border-red-500`,e.status===`running`&&`bg-blue-500 border-blue-500 animate-pulse`,!e.status&&`bg-muted border-muted-foreground`)}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e.name})]}),n<p.stages.length-1&&(0,f.jsx)(l.ArrowRight,{className:`h-4 w-4 text-muted-foreground shrink-0`})]},e.id))}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsxs)(`div`,{className:`space-y-4 pr-4`,children:[p.stages.map(e=>(0,f.jsx)(hz,{stage:e,onUpdate:t=>_(e.id,t),onDelete:()=>v(e.id),onAddStep:t=>y(e.id,t),readOnly:u},e.id)),!u&&(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:g,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Stage`]})]})})]})}var _z={id:`1`,name:`Production Deploy`,description:`Build, test, and deploy to production`,trigger:{branches:[`main`,`release/*`],events:[`push`,`pull_request`]},stages:[{id:`build`,name:`Build`,status:`success`,steps:[{id:`install`,name:`Install Dependencies`,type:`script`,command:`npm ci`,status:`success`},{id:`build`,name:`Build Application`,type:`build`,command:`npm run build`,status:`success`},{id:`artifact`,name:`Upload Build Artifacts`,type:`artifact`,artifacts:[`dist/**`,`build/**`],status:`success`}]},{id:`test`,name:`Test`,status:`running`,steps:[{id:`unit`,name:`Unit Tests`,type:`test`,command:`npm run test:unit`,status:`success`},{id:`integration`,name:`Integration Tests`,type:`test`,command:`npm run test:integration`,status:`running`},{id:`e2e`,name:`E2E Tests`,type:`test`,command:`npm run test:e2e`,status:`pending`}]},{id:`security`,name:`Security`,status:`pending`,steps:[{id:`sast`,name:`SAST Scan`,type:`script`,command:`npm run security:sast`},{id:`deps`,name:`Dependency Check`,type:`script`,command:`npm audit`}]},{id:`deploy`,name:`Deploy`,status:`pending`,steps:[{id:`approval`,name:`Production Approval`,type:`approval`,condition:`$CI_COMMIT_BRANCH == 'main'`},{id:`docker`,name:`Build Docker Image`,type:`docker`,image:`app:$CI_COMMIT_SHA`},{id:`deploy-prod`,name:`Deploy to Production`,type:`deploy`,command:`kubectl apply -f k8s/`},{id:`notify`,name:`Notify Team`,type:`notify`}]}],variables:{NODE_ENV:`production`,REGISTRY:`gcr.io/my-project`}},vz={feature:{icon:l.Sparkles,color:`text-green-500`,bgColor:`bg-green-500/10`,label:`New Feature`},fix:{icon:l.Bug,color:`text-red-500`,bgColor:`bg-red-500/10`,label:`Bug Fix`},improvement:{icon:l.Wrench,color:`text-blue-500`,bgColor:`bg-blue-500/10`,label:`Improvement`},breaking:{icon:l.AlertTriangle,color:`text-orange-500`,bgColor:`bg-orange-500/10`,label:`Breaking Change`},security:{icon:l.ShieldCheck,color:`text-purple-500`,bgColor:`bg-purple-500/10`,label:`Security`},performance:{icon:l.Zap,color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,label:`Performance`},docs:{icon:l.BookOpen,color:`text-cyan-500`,bgColor:`bg-cyan-500/10`,label:`Documentation`},deprecation:{icon:l.AlertTriangle,color:`text-gray-500`,bgColor:`bg-gray-500/10`,label:`Deprecation`}},yz={major:{label:`Major`,color:`text-red-500`},minor:{label:`Minor`,color:`text-blue-500`},patch:{label:`Patch`,color:`text-green-500`},prerelease:{label:`Pre-release`,color:`text-purple-500`}};function bz(e){return e.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`})}function xz({change:e}){let r=vz[e.type],i=r.icon;return(0,f.jsxs)(`div`,{className:t.t(`flex items-start gap-3 p-3 rounded-lg`,r.bgColor),children:[(0,f.jsx)(`div`,{className:`p-1.5 rounded bg-background`,children:(0,f.jsx)(i,{className:t.t(`h-4 w-4`,r.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.title}),e.breaking&&(0,f.jsx)(n.x,{className:`bg-orange-500 text-xs`,children:`Breaking`}),e.pullRequest&&(0,f.jsxs)(`a`,{href:e.pullRequest.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-primary flex items-center gap-1`,children:[(0,f.jsx)(l.GitPullRequest,{className:`h-3 w-3`}),`#`,e.pullRequest.number]})]}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.contributors&&e.contributors.length>0&&(0,f.jsx)(`div`,{className:`flex items-center gap-1 mt-2`,children:e.contributors.map(e=>(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id))})]})]})}function Sz({release:e,onEdit:i,onPublish:a,expanded:o=!1}){let[c,u]=s.useState(o),d=yz[e.releaseType],p=s.useMemo(()=>{let t={breaking:[],security:[],feature:[],improvement:[],performance:[],fix:[],docs:[],deprecation:[]};return e.changes.forEach(e=>{t[e.type].push(e)}),t},[e.changes]);return(0,f.jsxs)(Y,{className:t.t(e.status===`draft`&&`border-dashed`,e.status===`scheduled`&&`border-blue-500/30`),children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Tag,{className:`h-5 w-5`}),(0,f.jsx)(Z,{className:`text-xl`,children:e.version}),e.name&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`- `,e.name]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(n.x,{variant:`outline`,className:d.color,children:d.label}),(0,f.jsxs)(n.x,{variant:e.status===`published`?`default`:`secondary`,className:e.status===`published`?`bg-green-500`:``,children:[e.status===`published`?(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 mr-1`}):e.status===`scheduled`?(0,f.jsx)(l.Clock,{className:`h-3 w-3 mr-1`}):(0,f.jsx)(l.Edit,{className:`h-3 w-3 mr-1`}),e.status]}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3`}),e.publishedAt?bz(e.publishedAt):bz(e.createdAt)]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.compareUrl&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,f.jsxs)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noopener noreferrer`,children:[(0,f.jsx)(l.GitCommit,{className:`h-4 w-4 mr-1`}),`Compare`]})}),i&&e.status===`draft`&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.Edit,{className:`h-4 w-4 mr-1`}),`Edit`]}),a&&e.status===`draft`&&(0,f.jsxs)(r.r,{size:`sm`,onClick:a,children:[(0,f.jsx)(l.Rocket,{className:`h-4 w-4 mr-1`}),`Publish`]})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[e.summary&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:e.summary}),e.upgradeNotes&&(0,f.jsxs)(`div`,{className:`p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-yellow-600 mb-1`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Upgrade Notes`]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.upgradeNotes})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:Object.entries(p).map(([e,n])=>{if(n.length===0)return null;let i=vz[e];return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,f.jsx)(i.icon,{className:t.t(`h-4 w-4`,i.color)}),i.label,`s (`,n.length,`)`]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(c?n:n.slice(0,3)).map(e=>(0,f.jsx)(xz,{change:e},e.id)),!c&&n.length>3&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>u(!0),children:[`Show `,n.length-3,` more...`]})]})]},e)})}),e.contributors.length>0&&(0,f.jsxs)(`div`,{className:`pt-4 border-t`,children:[(0,f.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Contributors (`,e.contributors.length,`)`]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.contributors.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 bg-muted rounded-full`,children:[(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`@`,e.username]})]},e.id))})]}),e.downloadUrl&&(0,f.jsx)(`div`,{className:`pt-4 border-t`,children:(0,f.jsx)(r.r,{variant:`outline`,asChild:!0,children:(0,f.jsxs)(`a`,{href:e.downloadUrl,download:!0,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download Release`]})})})]})]})}function Cz({releases:e,onCreateRelease:i,onEditRelease:a,onPublishRelease:o,onAddChange:c,showEditor:u=!1,className:d}){let[p,m]=s.useState(`all`),[h,g]=s.useState(`all`),_=s.useMemo(()=>e.filter(e=>!(p!==`all`&&e.releaseType!==p||h!==`all`&&e.status!==h)).sort((e,t)=>{let n=e=>e.replace(/^v/,``).split(/[.-]/).map(e=>parseInt(e)||0),r=n(e.version),i=n(t.version);for(let e=0;e<Math.max(r.length,i.length);e++){let t=(i[e]||0)-(r[e]||0);if(t!==0)return t}return 0}),[e,p,h]),v=s.useMemo(()=>({total:e.length,published:e.filter(e=>e.status===`published`).length,draft:e.filter(e=>e.status===`draft`).length,features:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`feature`).length,0),fixes:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`fix`).length,0)}),[e]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,d),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Rocket,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Release Notes`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Track changes and publish releases`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-6 text-sm`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Tag,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`strong`,{children:v.total}),` releases`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Sparkles,{className:`h-4 w-4 text-green-500`}),(0,f.jsx)(`strong`,{children:v.features}),` features`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Bug,{className:`h-4 w-4 text-red-500`}),(0,f.jsx)(`strong`,{children:v.fixes}),` fixes`]})]}),i&&(0,f.jsxs)(r.r,{onClick:i,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`New Release`]})]})]})}),(0,f.jsx)(Q,{className:`pt-0`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(n.d,{value:p,onValueChange:e=>m(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Type`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Types`}),(0,f.jsx)(n.m,{value:`major`,children:`Major`}),(0,f.jsx)(n.m,{value:`minor`,children:`Minor`}),(0,f.jsx)(n.m,{value:`patch`,children:`Patch`}),(0,f.jsx)(n.m,{value:`prerelease`,children:`Pre-release`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`published`,children:`Published`}),(0,f.jsx)(n.m,{value:`draft`,children:`Draft`}),(0,f.jsx)(n.m,{value:`scheduled`,children:`Scheduled`})]})]})]})})]}),(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:_.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Tag,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No releases found`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`Create your first release to get started`})]}):_.map((e,t)=>(0,f.jsx)(Sz,{release:e,expanded:t===0,onEdit:a?()=>a(e):void 0,onPublish:o?()=>o(e):void 0},e.id))})})]})}var wz=[{id:`1`,name:`John Doe`,username:`johndoe`,avatar:``},{id:`2`,name:`Jane Smith`,username:`janesmith`,avatar:``},{id:`3`,name:`Bob Wilson`,username:`bobwilson`,avatar:``}],Tz=[{id:`1`,version:`v2.5.0`,name:`Aurora`,releaseType:`minor`,status:`published`,publishedAt:new Date(Date.now()-48*36e5),createdAt:new Date(Date.now()-120*36e5),summary:`This release introduces new authentication features, performance improvements, and several bug fixes.`,contributors:wz,compareUrl:`https://github.com/example/repo/compare/v2.4.0...v2.5.0`,changes:[{id:`c1`,type:`feature`,title:`Added OAuth 2.0 support for GitHub and Google`,description:`Users can now sign in using their GitHub or Google accounts`,pullRequest:{number:234,url:`#`},contributors:[wz[0]]},{id:`c2`,type:`feature`,title:`New dashboard widgets for analytics`,pullRequest:{number:238,url:`#`},contributors:[wz[1]]},{id:`c3`,type:`improvement`,title:`Redesigned settings page with better UX`,pullRequest:{number:241,url:`#`}},{id:`c4`,type:`performance`,title:`Reduced initial bundle size by 30%`,description:`Implemented code splitting and lazy loading for major routes`,pullRequest:{number:245,url:`#`},contributors:[wz[2]]},{id:`c5`,type:`fix`,title:`Fixed memory leak in WebSocket connection`,pullRequest:{number:250,url:`#`}},{id:`c6`,type:`fix`,title:`Fixed date picker not respecting timezone`,pullRequest:{number:252,url:`#`}},{id:`c7`,type:`security`,title:`Updated dependencies with security vulnerabilities`,description:`Updated axios, lodash, and other packages with known CVEs`,pullRequest:{number:248,url:`#`}}]},{id:`2`,version:`v2.4.1`,releaseType:`patch`,status:`published`,publishedAt:new Date(Date.now()-336*36e5),createdAt:new Date(Date.now()-360*36e5),contributors:[wz[0]],changes:[{id:`c8`,type:`fix`,title:`Fixed critical authentication bypass vulnerability`,breaking:!1,pullRequest:{number:230,url:`#`}},{id:`c9`,type:`fix`,title:`Fixed incorrect pagination in search results`,pullRequest:{number:231,url:`#`}}]},{id:`3`,version:`v3.0.0-beta.1`,name:`Next Generation`,releaseType:`prerelease`,status:`draft`,createdAt:new Date(Date.now()-24*36e5),contributors:wz,upgradeNotes:`This is a major release with breaking changes. Please review the migration guide before upgrading.`,changes:[{id:`c10`,type:`breaking`,title:`Removed deprecated API endpoints`,description:`The v1 API endpoints have been removed. Please migrate to v2 endpoints.`,breaking:!0},{id:`c11`,type:`feature`,title:`New real-time collaboration features`,description:`Multiple users can now edit documents simultaneously with live cursors`},{id:`c12`,type:`feature`,title:`Dark mode support throughout the application`},{id:`c13`,type:`breaking`,title:`Changed authentication token format`,description:`Tokens now use JWT format. Old tokens will be invalidated.`,breaking:!0}]}],Ez={1:{label:`Primary`,color:`text-green-500`,bgColor:`bg-green-500`},2:{label:`Secondary`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},3:{label:`Tertiary`,color:`text-red-500`,bgColor:`bg-red-500`}},Dz={available:{color:`bg-green-500`,label:`Available`},busy:{color:`bg-yellow-500`,label:`Busy`},dnd:{color:`bg-red-500`,label:`Do Not Disturb`},offline:{color:`bg-gray-500`,label:`Offline`}};function Oz(e){let t=new Date;return e.startTime<=t&&e.endTime>t}function kz({shift:e,nextShift:i,onContact:a}){if(!e)return(0,f.jsx)(Y,{className:`border-dashed`,children:(0,f.jsxs)(Q,{className:`p-6 text-center text-muted-foreground`,children:[(0,f.jsx)(l.AlertCircle,{className:`h-8 w-8 mx-auto mb-2`}),(0,f.jsx)(`p`,{children:`No one is currently on call`})]})});let o=Ez[e.level],s=e.user.status?Dz[e.user.status]:null,c=e.endTime.getTime()-Date.now(),u=Math.floor(c/36e5),d=Math.floor(c%36e5/6e4);return(0,f.jsxs)(Y,{className:`border-green-500/30 bg-green-500/5`,children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(n.x,{className:t.t(`text-white`,o.bgColor),children:[o.label,` On-Call`]}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),u,`h `,d,`m remaining`]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-16 w-16`,children:[(0,f.jsx)(ye,{src:e.user.avatar}),(0,f.jsx)(be,{className:`text-xl`,children:e.user.name.slice(0,2).toUpperCase()})]}),s&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 w-4 h-4 rounded-full border-2 border-background`,s.color)})]}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`text-xl font-semibold`,children:e.user.name}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.user.email}),e.user.timezone&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Timezone: `,e.user.timezone]})]}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.user.phone&&(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>a?.(e.user),children:[(0,f.jsx)(l.Phone,{className:`h-4 w-4 mr-1`}),`Call`]}),(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>a?.(e.user),children:[(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-1`}),`Message`]})]})]}),e.overrideReason&&(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground bg-muted/50 p-2 rounded`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Override:`}),` `,e.overrideReason]}),i&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 border-t text-sm`,children:[(0,f.jsx)(l.ArrowRight,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Next:`}),(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:i.user.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:i.user.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{children:i.user.name}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`at `,i.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})]})]})]})]})}function Az({policy:e,currentLevel:r}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),`Escalation Policy`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(i=>{let a=Ez[i],o=i===1?e.level1Timeout:i===2?e.level2Timeout:e.level3Timeout,s=r===i;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,s&&`${a.bgColor}/10 border ${a.bgColor}/30`),children:[(0,f.jsx)(`div`,{className:t.t(`w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold`,a.bgColor),children:i}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:a.label}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Escalates after `,o,` minutes`]})]}),s&&(0,f.jsx)(n.x,{variant:`outline`,className:a.color,children:`Active`})]},i)})})})]})}function jz({shifts:e,weekStart:n,onShiftClick:r}){let i=s.useMemo(()=>{let e=[];for(let t=0;t<7;t++){let r=new Date(n);r.setDate(r.getDate()+t),e.push(r)}return e},[n]),a=t=>e.filter(e=>new Date(e.startTime).toDateString()===t.toDateString()),o=e=>e.toDateString()===new Date().toDateString();return(0,f.jsx)(`div`,{className:`grid grid-cols-7 gap-2`,children:i.map(e=>{let n=a(e),i=o(e);return(0,f.jsxs)(`div`,{className:t.t(`border rounded-lg p-2 min-h-[120px]`,i&&`border-primary bg-primary/5`),children:[(0,f.jsxs)(`div`,{className:t.t(`text-center mb-2`,i&&`font-bold text-primary`),children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.toLocaleDateString(`en-US`,{weekday:`short`})}),(0,f.jsx)(`div`,{className:t.t(`text-lg`,i&&`text-primary`),children:e.getDate()})]}),(0,f.jsx)(`div`,{className:`space-y-1`,children:n.map(e=>{let n=Ez[e.level],i=Oz(e);return(0,f.jsxs)(`button`,{className:t.t(`w-full text-left p-1.5 rounded text-xs transition-colors`,`${n.bgColor}/10 hover:${n.bgColor}/20`,i&&`ring-2 ring-${n.bgColor}`),onClick:()=>r?.(e),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsxs)(ve,{className:`h-4 w-4`,children:[(0,f.jsx)(ye,{src:e.user.avatar}),(0,f.jsx)(be,{className:`text-[8px]`,children:e.user.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{className:`truncate`,children:e.user.name.split(` `)[0]})]}),(0,f.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:e.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})})]},e.id)})})]},e.toISOString())})})}function Mz({users:e,shifts:r}){let i=s.useMemo(()=>e.map(e=>{let t=r.filter(t=>t.user.id===e.id),n=t.reduce((e,t)=>e+(t.endTime.getTime()-t.startTime.getTime())/36e5,0),i=t.some(Oz);return{user:e,totalHours:n,shiftCount:t.length,isOnCall:i}}),[e,r]);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Team Members`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-2`,children:i.map(({user:e,totalHours:r,shiftCount:i,isOnCall:a})=>{let o=e.status?Dz[e.status]:null;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,a&&`bg-green-500/10 border border-green-500/30`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-8 w-8`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),o&&(0,f.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-background`,o.color)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`font-medium truncate flex items-center gap-2`,children:[e.name,a&&(0,f.jsx)(n.x,{className:`bg-green-500 text-xs`,children:`On-Call`})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[i,` shifts • `,Math.round(r),`h total`]})]})]},e.id)})})})]})}function Nz({schedule:e,onEditSchedule:i,onAddOverride:a,onSwapShift:o,onContactOnCall:c,className:u}){let[d,p]=s.useState(0),m=s.useMemo(()=>{let e=new Date,t=e.getDay(),n=new Date(e);return n.setDate(e.getDate()-t+d*7),n.setHours(0,0,0,0),n},[d]),h=e.shifts.find(Oz),g=e.shifts.filter(e=>e.startTime>new Date).sort((e,t)=>e.startTime.getTime()-t.startTime.getTime())[0];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Phone,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:e.name}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsx)(n.x,{variant:`outline`,children:e.team}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[(0,f.jsx)(l.Repeat,{className:`h-3 w-3 mr-1`}),e.rotation]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>a(new Date),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Override`]}),i&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:i,children:[(0,f.jsx)(l.Settings,{className:`h-4 w-4 mr-1`}),`Settings`]})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,f.jsx)(kz,{shift:h,nextShift:g,onContact:c}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4`}),`Schedule`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(e=>e-1),children:(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsxs)(`span`,{className:`text-sm min-w-[120px] text-center`,children:[m.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}),` -`,new Date(m.getTime()+144*36e5).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(e=>e+1),children:(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`})}),d!==0&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(0),children:`Today`})]})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(jz,{shifts:e.shifts,weekStart:m,onShiftClick:o})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(Az,{policy:e.escalationPolicy,currentLevel:h?.level}),(0,f.jsx)(Mz,{users:e.users,shifts:e.shifts})]})]})]})}var Pz=[{id:`1`,name:`John Doe`,email:`john@example.com`,phone:`+1 555-0101`,status:`available`,timezone:`America/New_York`},{id:`2`,name:`Jane Smith`,email:`jane@example.com`,phone:`+1 555-0102`,status:`available`,timezone:`America/Los_Angeles`},{id:`3`,name:`Bob Wilson`,email:`bob@example.com`,phone:`+1 555-0103`,status:`busy`,timezone:`Europe/London`},{id:`4`,name:`Alice Brown`,email:`alice@example.com`,phone:`+1 555-0104`,status:`available`,timezone:`Europe/Paris`}];function Fz(){let e=[],t=new Date,n=new Date(t);n.setDate(t.getDate()-t.getDay()),n.setHours(0,0,0,0);for(let t=-1;t<3;t++)for(let r=0;r<7;r++){let i=new Date(n);i.setDate(n.getDate()+t*7+r),i.setHours(9,0,0,0);let a=new Date(i);a.setDate(a.getDate()+1);let o=(t+1+r)%Pz.length;e.push({id:`shift-${t}-${r}`,user:Pz[o],startTime:i,endTime:a,level:1})}return e}var Iz={id:`1`,name:`Platform Team On-Call`,description:`Primary on-call rotation for the platform engineering team`,team:`Platform Engineering`,rotation:`weekly`,escalationPolicy:{level1Timeout:15,level2Timeout:30,level3Timeout:60},shifts:Fz(),users:Pz},Lz={compute:{icon:l.Cpu,color:`text-blue-500`,label:`Compute`},storage:{icon:l.HardDrive,color:`text-green-500`,label:`Storage`},database:{icon:l.Database,color:`text-purple-500`,label:`Database`},network:{icon:l.Network,color:`text-cyan-500`,label:`Network`},security:{icon:l.Shield,color:`text-red-500`,label:`Security`},other:{icon:l.Cloud,color:`text-gray-500`,label:`Other`}},Rz={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},all:{label:`All Providers`,color:`text-gray-500`}};function zz(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function Bz(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function Vz({title:e,value:r,previousValue:i,icon:a,trend:o,budget:s,forecast:c}){let u=i===void 0?o:(r-i)/i*100,d=s!==void 0&&r>s,p=s===void 0?void 0:r/s*100;return(0,f.jsx)(Y,{className:t.t(d&&`border-red-500/50`),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-muted-foreground`})}),u!==void 0&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(u>0?`text-red-500`:`text-green-500`),children:[u>0?(0,f.jsx)(l.ArrowUpRight,{className:`h-3 w-3 mr-1`}):(0,f.jsx)(l.ArrowDownRight,{className:`h-3 w-3 mr-1`}),Bz(Math.abs(u))]})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:zz(r)}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e})]}),p!==void 0&&(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Budget`}),(0,f.jsxs)(`span`,{className:t.t(d&&`text-red-500`),children:[zz(r),` / `,zz(s)]})]}),(0,f.jsx)(Zn,{value:Math.min(p,100),className:t.t(`h-2`,p>100&&`[&>div]:bg-red-500`,p>80&&p<=100&&`[&>div]:bg-yellow-500`)})]}),c!==void 0&&(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Forecast: `,zz(c)]})]})})}function Hz({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.PieChart,{className:`h-4 w-4`}),`Cost by Category`]})}),(0,f.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=Lz[e],a=i.icon,o=r/n*100;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(a,{className:t.t(`h-4 w-4`,i.color)}),(0,f.jsx)(`span`,{className:`text-sm`,children:i.label})]}),(0,f.jsxs)(`div`,{className:`text-sm font-medium`,children:[zz(r),(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,o.toFixed(0),`%)`]})]})]}),(0,f.jsx)(Zn,{value:o,className:`h-2`})]},e)})})]})}function Uz({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).filter(([e])=>e!==`all`).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Cloud,{className:`h-4 w-4`}),`Cost by Provider`]})}),(0,f.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=Rz[e],a=r/n*100;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsx)(`span`,{className:t.t(`text-sm font-medium`,i.color),children:i.label}),(0,f.jsxs)(`div`,{className:`text-sm font-medium`,children:[zz(r),(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,a.toFixed(0),`%)`]})]})]}),(0,f.jsx)(Zn,{value:a,className:`h-2`})]},e)})})]})}function Wz({items:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.BarChart3,{className:`h-4 w-4`}),`Top Services by Cost`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>{let r=Lz[e.category],i=r.icon,a=Rz[e.provider],o=e.previousCost===void 0?e.trend:(e.cost-e.previousCost)/e.previousCost*100;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors`,children:[(0,f.jsx)(`div`,{className:`text-lg font-bold text-muted-foreground w-6 text-center`,children:n+1}),(0,f.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(i,{className:t.t(`h-4 w-4`,r.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:a.color,children:a.label}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{children:r.label}),e.usage!==void 0&&e.unit&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{children:`•`}),(0,f.jsxs)(`span`,{children:[e.usage,` `,e.unit]})]})]})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:`font-semibold`,children:zz(e.cost)}),o!==void 0&&(0,f.jsxs)(`div`,{className:t.t(`text-xs flex items-center justify-end gap-0.5`,o>0?`text-red-500`:`text-green-500`),children:[o>0?(0,f.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,f.jsx)(l.TrendingDown,{className:`h-3 w-3`}),Bz(Math.abs(o))]})]})]},e.id)})})})})]})}function Gz({anomalies:e,onAcknowledge:r}){let i=e.filter(e=>e.status===`new`);return(0,f.jsxs)(Y,{className:t.t(i.length>0&&`border-yellow-500/50`),children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Cost Anomalies`]}),i.length>0&&(0,f.jsxs)(n.x,{className:`bg-yellow-500`,children:[i.length,` new`]})]})}),(0,f.jsx)(Q,{children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center text-muted-foreground py-4`,children:[(0,f.jsx)(l.Zap,{className:`h-8 w-8 mx-auto mb-2 text-green-500`}),(0,f.jsx)(`p`,{children:`No anomalies detected`})]}):(0,f.jsx)(`div`,{className:`space-y-2`,children:e.slice(0,5).map(e=>(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg`,e.status===`new`&&`bg-yellow-500/10`),children:[(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-4 w-4 shrink-0`,e.deviation>100?`text-red-500`:`text-yellow-500`)}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.service}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expected `,zz(e.expectedCost),` • Actual `,zz(e.actualCost)]})]}),(0,f.jsxs)(n.x,{variant:`outline`,className:`text-red-500 shrink-0`,children:[`+`,e.deviation.toFixed(0),`%`]})]},e.id))})})]})}function Kz({summary:e,items:i,anomalies:a=[],timeRange:o=`month`,onTimeRangeChange:c,onProviderFilter:u,onExport:d,onRefresh:p,className:m}){let[h,g]=s.useState(`all`),_=e=>{g(e),u?.(e)},v=s.useMemo(()=>h===`all`?i:i.filter(e=>e.provider===h),[i,h]);return e.previousTotalCost!==void 0&&(e.totalCost-e.previousTotalCost)/e.previousTotalCost*100,(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.DollarSign,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Cloud Cost Dashboard`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor and optimize your cloud spending`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:o,onValueChange:e=>c?.(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`day`,children:`Today`}),(0,f.jsx)(n.m,{value:`week`,children:`This Week`}),(0,f.jsx)(n.m,{value:`month`,children:`This Month`}),(0,f.jsx)(n.m,{value:`quarter`,children:`This Quarter`}),(0,f.jsx)(n.m,{value:`year`,children:`This Year`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>_(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Cloud,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Providers`}),(0,f.jsx)(n.m,{value:`aws`,children:`AWS`}),(0,f.jsx)(n.m,{value:`gcp`,children:`GCP`}),(0,f.jsx)(n.m,{value:`azure`,children:`Azure`})]})]}),p&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:p,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),d&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:d,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Vz,{title:`Total Cost`,value:e.totalCost,previousValue:e.previousTotalCost,icon:l.DollarSign,budget:e.budget}),(0,f.jsx)(Vz,{title:`Compute`,value:e.byCategory.compute,icon:l.Cpu,trend:-5.2}),(0,f.jsx)(Vz,{title:`Storage`,value:e.byCategory.storage,icon:l.HardDrive,trend:12.3}),(0,f.jsx)(Vz,{title:`Forecast (EOM)`,value:e.forecast||e.totalCost*1.1,icon:l.TrendingUp,budget:e.budget})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsx)(`div`,{className:`col-span-2 space-y-6`,children:(0,f.jsx)(Wz,{items:v.slice(0,10)})}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsx)(Hz,{data:e.byCategory}),(0,f.jsx)(Uz,{data:e.byProvider}),(0,f.jsx)(Gz,{anomalies:a})]})]})]})}var qz={totalCost:45230,previousTotalCost:42100,budget:5e4,forecast:48500,byProvider:{aws:28500,gcp:12300,azure:4430,all:45230},byCategory:{compute:22e3,storage:8500,database:7200,network:4100,security:1800,other:1630},topServices:[]},Jz=[{id:`1`,name:`EC2 Instances`,category:`compute`,provider:`aws`,cost:12500,previousCost:11800,usage:450,unit:`hours`},{id:`2`,name:`RDS PostgreSQL`,category:`database`,provider:`aws`,cost:4200,previousCost:4e3},{id:`3`,name:`S3 Storage`,category:`storage`,provider:`aws`,cost:3800,previousCost:3200,usage:12,unit:`TB`},{id:`4`,name:`GKE Clusters`,category:`compute`,provider:`gcp`,cost:6500,previousCost:6800},{id:`5`,name:`Cloud SQL`,category:`database`,provider:`gcp`,cost:2800,previousCost:2600},{id:`6`,name:`BigQuery`,category:`database`,provider:`gcp`,cost:1800,previousCost:1500,usage:45,unit:`TB scanned`},{id:`7`,name:`Azure VMs`,category:`compute`,provider:`azure`,cost:2400,previousCost:2200},{id:`8`,name:`Blob Storage`,category:`storage`,provider:`azure`,cost:1200,previousCost:1100},{id:`9`,name:`CloudFront CDN`,category:`network`,provider:`aws`,cost:2100,previousCost:1900,usage:85,unit:`TB`},{id:`10`,name:`Lambda Functions`,category:`compute`,provider:`aws`,cost:850,previousCost:720,usage:12e6,unit:`invocations`}],Yz=[{id:`1`,service:`EC2 Spot Instances`,expectedCost:500,actualCost:1250,deviation:150,timestamp:new Date,status:`new`},{id:`2`,service:`Data Transfer`,expectedCost:800,actualCost:1400,deviation:75,timestamp:new Date(Date.now()-36e5),status:`new`},{id:`3`,service:`Lambda`,expectedCost:200,actualCost:320,deviation:60,timestamp:new Date(Date.now()-72e5),status:`acknowledged`}],Xz={synced:{icon:l.CheckCircle2,color:`text-green-500`,bgColor:`bg-green-500`,label:`Synced`},out_of_sync:{icon:l.AlertTriangle,color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Out of Sync`},syncing:{icon:l.Loader2,color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Syncing`},failed:{icon:l.XCircle,color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},unknown:{icon:l.Clock,color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},suspended:{icon:l.Pause,color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Suspended`}},Zz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},degraded:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Degraded`},progressing:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Progressing`},missing:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Missing`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}};function Qz(e){let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function $z(e){return e.slice(0,7)}function eB({status:e}){let r=Xz[e],i=r.icon;return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[(0,f.jsx)(i,{className:t.t(`h-3 w-3`,e===`syncing`&&`animate-spin`)}),r.label]})}function tB({status:e}){let n=Zz[e];return(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,n.bgColor)}),(0,f.jsx)(`span`,{className:t.t(`text-sm`,n.color),children:n.label})]})}function nB({app:e,onSync:i,onSuspend:a,onResume:o,onViewDetails:c}){let u=Xz[e.syncStatus];Zz[e.healthStatus];let d=u.icon,p=s.useMemo(()=>({synced:e.resources.filter(e=>e.syncStatus===`synced`).length,healthy:e.resources.filter(e=>e.healthStatus===`healthy`).length,total:e.resources.length}),[e.resources]);return(0,f.jsx)(Y,{className:t.t(e.syncStatus===`failed`&&`border-red-500/50`,e.syncStatus===`out_of_sync`&&`border-yellow-500/30`,e.healthStatus===`degraded`&&`border-red-500/30`),children:(0,f.jsx)(Q,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`w-12 h-12 rounded-lg flex items-center justify-center shrink-0`,`${u.bgColor}/10`),children:(0,f.jsx)(d,{className:t.t(`h-6 w-6`,u.color,e.syncStatus===`syncing`&&`animate-spin`)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e.project})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Server,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:e.destination.namespace}),(0,f.jsx)(`span`,{children:`@`}),(0,f.jsx)(`span`,{className:`truncate max-w-[200px]`,children:e.destination.server})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsx)(eB,{status:e.syncStatus}),(0,f.jsx)(tB,{status:e.healthStatus})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,f.jsx)(l.GitBranch,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:e.repo.branch})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,f.jsx)(l.Folder,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`truncate max-w-[150px]`,children:e.repo.path})]}),e.lastSyncedRevision&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(l.GitCommit,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`code`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded`,children:$z(e.lastSyncedRevision)}),e.targetRevision&&e.lastSyncedRevision!==e.targetRevision&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ArrowRight,{className:`h-3 w-3 text-muted-foreground`}),(0,f.jsx)(`code`,{className:`text-xs bg-yellow-500/20 text-yellow-600 px-1.5 py-0.5 rounded`,children:$z(e.targetRevision)})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Synced`}),(0,f.jsxs)(`span`,{children:[p.synced,`/`,p.total]})]}),(0,f.jsx)(Zn,{value:p.synced/p.total*100,className:`h-1.5`})]}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Healthy`}),(0,f.jsxs)(`span`,{children:[p.healthy,`/`,p.total]})]}),(0,f.jsx)(Zn,{value:p.healthy/p.total*100,className:t.t(`h-1.5`,p.healthy<p.total&&`[&>div]:bg-yellow-500`)})]})]}),e.message&&(e.syncStatus===`failed`||e.healthStatus===`degraded`)&&(0,f.jsx)(`div`,{className:`text-sm text-red-500 bg-red-500/10 p-2 rounded`,children:e.message}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.lastSyncedAt&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),`Last synced `,Qz(e.lastSyncedAt)]}),e.autoSync&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3 mr-1`}),`Auto-sync`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:c,children:[(0,f.jsx)(l.Eye,{className:`h-4 w-4 mr-1`}),`Details`]}),e.syncStatus===`suspended`&&o?(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Resume`]}):(0,f.jsxs)(f.Fragment,{children:[a&&e.syncStatus!==`suspended`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:a,children:(0,f.jsx)(l.Pause,{className:`h-4 w-4`})}),i&&e.syncStatus!==`syncing`&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-1`}),`Sync`]})]})]})]})]})]})})})}function rB({applications:e}){let t=s.useMemo(()=>({total:e.length,synced:e.filter(e=>e.syncStatus===`synced`).length,outOfSync:e.filter(e=>e.syncStatus===`out_of_sync`).length,failed:e.filter(e=>e.syncStatus===`failed`).length,healthy:e.filter(e=>e.healthStatus===`healthy`).length,degraded:e.filter(e=>e.healthStatus===`degraded`).length}),[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-6 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.total}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Apps`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.synced}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Synced`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-yellow-500`,children:t.outOfSync}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Out of Sync`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.failed}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Failed`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.healthy}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Healthy`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.degraded}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Degraded`})]})})]})}function iB({applications:e,onSync:n,onRefresh:i,onSuspend:a,onResume:o,onViewDetails:c,className:u}){let[d,p]=s.useState(`all`),m=s.useMemo(()=>d===`all`?e:e.filter(e=>e.syncStatus===d),[e,d]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.GitBranch,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`GitOps Sync Status`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor application synchronization with Git`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[[`all`,`synced`,`out_of_sync`,`failed`,`syncing`].map(e=>(0,f.jsx)(r.r,{variant:d===e?`default`:`ghost`,size:`sm`,onClick:()=>p(e),children:e===`all`?`All`:Xz[e].label},e)),i&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:i,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-1`}),`Refresh All`]})]})]})})}),(0,f.jsx)(rB,{applications:e}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:m.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Cloud,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No applications found`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`Adjust your filters or add new applications`})]}):m.map(e=>(0,f.jsx)(nB,{app:e,onSync:n?()=>n(e):void 0,onSuspend:a?()=>a(e):void 0,onResume:o?()=>o(e):void 0,onViewDetails:c?()=>c(e):void 0},e.id))})})]})}var aB=[{id:`1`,name:`api-gateway`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/api-gateway`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`synced`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-5*6e4),lastSyncedRevision:`a1b2c3d4e5f6789`,autoSync:!0,resources:[{kind:`Deployment`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Service`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`ConfigMap`,name:`api-gateway-config`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Ingress`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`2`,name:`user-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/user-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`out_of_sync`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-2*36e5),lastSyncedRevision:`old123456789`,targetRevision:`new987654321`,autoSync:!1,resources:[{kind:`Deployment`,name:`user-service`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`},{kind:`Service`,name:`user-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`user-service-secrets`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`}]},{id:`3`,name:`payment-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/payment-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`failed`,healthStatus:`degraded`,lastSyncedAt:new Date(Date.now()-30*6e4),lastSyncedRevision:`abc123def456`,message:`Failed to apply resource: Deployment/payment-service: ImagePullBackOff`,autoSync:!0,resources:[{kind:`Deployment`,name:`payment-service`,namespace:`production`,syncStatus:`failed`,healthStatus:`degraded`,message:`ImagePullBackOff`},{kind:`Service`,name:`payment-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`payment-service-secrets`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`4`,name:`notification-service`,project:`staging`,repo:{url:`https://github.com/example/infra`,branch:`develop`,path:`apps/notification-service`},destination:{server:`https://staging.k8s.example.com`,namespace:`staging`},syncStatus:`syncing`,healthStatus:`progressing`,lastSyncedAt:new Date(Date.now()-6e4),lastSyncedRevision:`syncing123`,autoSync:!0,resources:[{kind:`Deployment`,name:`notification-service`,namespace:`staging`,syncStatus:`syncing`,healthStatus:`progressing`},{kind:`Service`,name:`notification-service`,namespace:`staging`,syncStatus:`synced`,healthStatus:`healthy`}]}],oB={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}},sB={api:{icon:l.Globe,color:`text-blue-500`},web:{icon:l.Globe,color:`text-purple-500`},worker:{icon:l.Cpu,color:`text-orange-500`},database:{icon:l.Database,color:`text-green-500`},cache:{icon:l.HardDrive,color:`text-red-500`},queue:{icon:l.Activity,color:`text-cyan-500`}};function cB(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function lB(e){return e<1e3?e.toFixed(0):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function uB({current:e,previous:n}){if(n===void 0)return null;let r=(e-n)/n*100,i=r>0;return(0,f.jsxs)(`span`,{className:t.t(`text-xs flex items-center gap-0.5`,i?`text-red-500`:`text-green-500`),children:[i?(0,f.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,f.jsx)(l.TrendingDown,{className:`h-3 w-3`}),Math.abs(r).toFixed(1),`%`]})}function dB({title:e,value:n,unit:r,previousValue:i,status:a,icon:o}){let s=a?oB[a]:null;return(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,f.jsx)(o,{className:`h-4 w-4 text-muted-foreground`})}),s&&(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,s.bgColor)})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,f.jsx)(`span`,{className:`text-2xl font-bold`,children:lB(n)}),r&&(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:r})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e}),(0,f.jsx)(uB,{current:n,previous:i})]})]})]})})}function fB({service:e,onClick:r}){let i=oB[e.status],a=sB[e.type],o=a.icon,{metrics:s,previousMetrics:c}=e;return s.successRate/100*(1-s.p95ResponseTime/3e3),(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/30`),onClick:r,children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${a.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(o,{className:t.t(`h-5 w-5`,a.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold truncate`,children:e.name}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full shrink-0`,i.bgColor)}),e.version&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[`v`,e.version]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-sm`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Zap,{className:`h-3 w-3 text-muted-foreground`}),s.requestsPerSecond,`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3 text-muted-foreground`}),cB(s.avgResponseTime)]}),(0,f.jsxs)(`span`,{className:t.t(`flex items-center gap-1`,s.errorRate>5&&`text-red-500`,s.errorRate>1&&s.errorRate<=5&&`text-yellow-500`),children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),s.errorRate.toFixed(2),`%`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`p50: `,cB(s.p50ResponseTime)]}),(0,f.jsxs)(`span`,{children:[`p95: `,cB(s.p95ResponseTime)]}),(0,f.jsxs)(`span`,{children:[`p99: `,cB(s.p99ResponseTime)]})]}),e.tags&&e.tags.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[e.tags.slice(0,3).map(e=>(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e},e)),e.tags.length>3&&(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,e.tags.length-3]})]})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`text-lg font-bold text-green-500`,children:[s.successRate.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Success`}),e.instances&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.instances,` instances`]})]})]}),(s.cpuUsage!==void 0||s.memoryUsage!==void 0)&&(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-4 pt-3 border-t`,children:[s.cpuUsage!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{className:t.t(s.cpuUsage>80&&`text-red-500`),children:[s.cpuUsage,`%`]})]}),(0,f.jsx)(Zn,{value:s.cpuUsage,className:t.t(`h-1.5`,s.cpuUsage>80&&`[&>div]:bg-red-500`)})]}),s.memoryUsage!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` Memory`]}),(0,f.jsxs)(`span`,{className:t.t(s.memoryUsage>80&&`text-red-500`),children:[s.memoryUsage,`%`]})]}),(0,f.jsx)(Zn,{value:s.memoryUsage,className:t.t(`h-1.5`,s.memoryUsage>80&&`[&>div]:bg-red-500`)})]})]})]})})}function pB({transactions:e,onClick:n}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Transactions`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors`,onClick:()=>n?.(e),children:[e.status===`success`?(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):(0,f.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.service})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>1e3&&`text-yellow-500`,e.duration>3e3&&`text-red-500`),children:cB(e.duration)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.timestamp.toLocaleTimeString()})]})]},e.id))})})})]})}function mB({services:e,recentTransactions:i=[],timeRange:a=`1h`,onTimeRangeChange:o,onServiceClick:c,onTransactionClick:u,onRefresh:d,className:p}){let[m,h]=s.useState(`all`),g=s.useMemo(()=>({totalRequests:e.reduce((e,t)=>e+t.metrics.requestsPerSecond,0),avgResponseTime:e.reduce((e,t)=>e+t.metrics.avgResponseTime,0)/e.length,avgErrorRate:e.reduce((e,t)=>e+t.metrics.errorRate,0)/e.length,healthyCount:e.filter(e=>e.status===`healthy`).length,totalServices:e.length}),[e]),_=s.useMemo(()=>m===`all`?e:e.filter(e=>e.status===m),[e,m]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Activity,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Application Performance`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor service health and performance metrics`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:a,onValueChange:e=>o?.(e),children:[(0,f.jsxs)(n.y,{className:`w-28`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`1h`,children:`Last 1h`}),(0,f.jsx)(n.m,{value:`6h`,children:`Last 6h`}),(0,f.jsx)(n.m,{value:`24h`,children:`Last 24h`}),(0,f.jsx)(n.m,{value:`7d`,children:`Last 7d`}),(0,f.jsx)(n.m,{value:`30d`,children:`Last 30d`})]})]}),d&&(0,f.jsx)(r.r,{variant:`outline`,onClick:d,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(dB,{title:`Total Requests`,value:g.totalRequests,unit:`/s`,icon:l.Zap}),(0,f.jsx)(dB,{title:`Avg Response Time`,value:g.avgResponseTime,unit:`ms`,icon:l.Clock,status:g.avgResponseTime>500?`warning`:`healthy`}),(0,f.jsx)(dB,{title:`Error Rate`,value:g.avgErrorRate,unit:`%`,icon:l.AlertTriangle,status:g.avgErrorRate>5?`critical`:g.avgErrorRate>1?`warning`:`healthy`}),(0,f.jsx)(dB,{title:`Services Healthy`,value:g.healthyCount,unit:`/ ${g.totalServices}`,icon:l.CheckCircle2,status:g.healthyCount===g.totalServices?`healthy`:`warning`})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:`Services`}),(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:[`all`,`healthy`,`warning`,`critical`].map(e=>(0,f.jsx)(r.r,{variant:m===e?`default`:`ghost`,size:`sm`,onClick:()=>h(e),children:e===`all`?`All`:oB[e].label},e))})]}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:_.map(e=>(0,f.jsx)(fB,{service:e,onClick:()=>c?.(e)},e.id))})})]}),(0,f.jsx)(`div`,{children:(0,f.jsx)(pB,{transactions:i,onClick:u})})]})]})}var hB=[{id:`1`,name:`api-gateway`,type:`api`,status:`healthy`,version:`2.4.1`,instances:3,metrics:{requestsPerSecond:1250,avgResponseTime:45,p50ResponseTime:32,p95ResponseTime:120,p99ResponseTime:250,errorRate:.12,successRate:99.88,activeConnections:450,cpuUsage:45,memoryUsage:62},tags:[`production`,`critical`]},{id:`2`,name:`user-service`,type:`api`,status:`healthy`,version:`1.8.0`,instances:2,metrics:{requestsPerSecond:350,avgResponseTime:85,p50ResponseTime:65,p95ResponseTime:180,p99ResponseTime:450,errorRate:.5,successRate:99.5,activeConnections:120,cpuUsage:35,memoryUsage:55},tags:[`production`]},{id:`3`,name:`payment-service`,type:`api`,status:`warning`,version:`3.1.0`,instances:2,metrics:{requestsPerSecond:150,avgResponseTime:520,p50ResponseTime:280,p95ResponseTime:1200,p99ResponseTime:2500,errorRate:2.5,successRate:97.5,activeConnections:85,cpuUsage:78,memoryUsage:82},tags:[`production`,`payment`]},{id:`4`,name:`notification-worker`,type:`worker`,status:`healthy`,instances:5,metrics:{requestsPerSecond:500,avgResponseTime:25,p50ResponseTime:18,p95ResponseTime:55,p99ResponseTime:120,errorRate:.05,successRate:99.95,activeConnections:0,cpuUsage:25,memoryUsage:40}},{id:`5`,name:`postgres-primary`,type:`database`,status:`healthy`,instances:1,metrics:{requestsPerSecond:2500,avgResponseTime:8,p50ResponseTime:5,p95ResponseTime:25,p99ResponseTime:80,errorRate:.01,successRate:99.99,activeConnections:120,cpuUsage:55,memoryUsage:72}},{id:`6`,name:`redis-cache`,type:`cache`,status:`healthy`,instances:3,metrics:{requestsPerSecond:15e3,avgResponseTime:.5,p50ResponseTime:.3,p95ResponseTime:1.2,p99ResponseTime:3,errorRate:.001,successRate:99.999,activeConnections:500,memoryUsage:45}}],gB=[{id:`1`,name:`POST /api/users`,service:`user-service`,duration:85,timestamp:new Date(Date.now()-5e3),status:`success`},{id:`2`,name:`GET /api/products`,service:`api-gateway`,duration:42,timestamp:new Date(Date.now()-12e3),status:`success`},{id:`3`,name:`POST /api/payments`,service:`payment-service`,duration:1250,timestamp:new Date(Date.now()-25e3),status:`error`},{id:`4`,name:`GET /api/orders/:id`,service:`api-gateway`,duration:65,timestamp:new Date(Date.now()-45e3),status:`success`},{id:`5`,name:`POST /api/notifications`,service:`notification-worker`,duration:22,timestamp:new Date(Date.now()-6e4),status:`success`},{id:`6`,name:`GET /api/users/:id`,service:`user-service`,duration:95,timestamp:new Date(Date.now()-9e4),status:`success`},{id:`7`,name:`PUT /api/cart`,service:`api-gateway`,duration:180,timestamp:new Date(Date.now()-12e4),status:`success`},{id:`8`,name:`POST /api/checkout`,service:`payment-service`,duration:3200,timestamp:new Date(Date.now()-18e4),status:`error`}],_B={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Stopped`},paused:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Paused`},restarting:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Restarting`},creating:{color:`text-blue-400`,bgColor:`bg-blue-400`,label:`Creating`},removing:{color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Removing`},exited:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Exited`},dead:{color:`text-red-600`,bgColor:`bg-red-600`,label:`Dead`}},vB={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},updating:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Updating`},scaled:{color:`text-purple-500`,bgColor:`bg-purple-500`,label:`Scaling`},failed:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},pending:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Pending`}};function yB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function bB(e){if(!e)return`N/A`;let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function xB({container:e,onViewLogs:i,onExecShell:a}){let o=_B[e.status],s=e.resources.memory/e.resources.memoryLimit*100;return(0,f.jsx)(`div`,{className:t.t(`border rounded-lg p-3 transition-all hover:bg-muted/30`,e.status===`exited`&&`border-red-500/30 bg-red-500/5`,e.healthCheck===`unhealthy`&&`border-yellow-500/30`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Container,{className:t.t(`h-5 w-5`,o.color)}),e.healthCheck&&e.healthCheck!==`none`&&(0,f.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background`,e.healthCheck===`healthy`&&`bg-green-500`,e.healthCheck===`unhealthy`&&`bg-red-500`,e.healthCheck===`starting`&&`bg-yellow-500`)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs`,o.color),children:o.label})]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 truncate`,children:e.image}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mt-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,f.jsx)(Zn,{value:e.resources.cpu,className:t.t(`h-1`,e.resources.cpu>80&&`[&>div]:bg-red-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` MEM`]}),(0,f.jsxs)(`span`,{children:[e.resources.memory,`MB`]})]}),(0,f.jsx)(Zn,{value:s,className:t.t(`h-1`,s>80&&`[&>div]:bg-red-500`)})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),bB(e.startedAt)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.ArrowDown,{className:`h-3 w-3`}),yB(e.resources.networkRx),`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.ArrowUp,{className:`h-3 w-3`}),yB(e.resources.networkTx),`/s`]}),e.restartCount!==void 0&&e.restartCount>0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-500`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3`}),e.restartCount,` restarts`]})]})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[i&&(0,f.jsxs)($,{onClick:i,children:[(0,f.jsx)(l.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),a&&(0,f.jsxs)($,{onClick:a,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4 mr-2`}),`Shell`]})]})]})]})})}function SB({service:e,onScale:i,onRestart:a,onStop:o,onDelete:c,onViewLogs:u,onExecShell:d}){let[p,m]=s.useState(!1),[h,g]=s.useState(e.replicas.desired),_=vB[e.status],v=e.containers.every(e=>e.status===`running`),y=e.replicas.running/e.replicas.desired*100;return(0,f.jsx)(Y,{className:t.t(e.status===`failed`&&`border-red-500/50`,!v&&`border-yellow-500/30`),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${_.bgColor}/10`),children:(0,f.jsx)(l.Layers,{className:t.t(`h-5 w-5`,_.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.x,{className:t.t(`text-white text-xs`,_.bgColor),children:_.label})]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-1`,children:e.image}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Replicas`}),(0,f.jsxs)(`span`,{className:t.t(e.replicas.running<e.replicas.desired&&`text-yellow-500`),children:[e.replicas.running,`/`,e.replicas.desired,` running`,e.replicas.ready<e.replicas.running&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.replicas.ready,` ready)`]})]})]}),(0,f.jsx)(Zn,{value:y,className:t.t(`h-2`,y<100&&`[&>div]:bg-yellow-500`,e.status===`failed`&&`[&>div]:bg-red-500`)})]}),e.updateStatus&&(0,f.jsxs)(`div`,{className:`mt-3 p-2 bg-muted/50 rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3 animate-spin`}),e.updateStatus.state]}),(0,f.jsxs)(`span`,{children:[e.updateStatus.progress,`%`]})]}),e.updateStatus.message&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.updateStatus.message}),(0,f.jsx)(Zn,{value:e.updateStatus.progress,className:`h-1 mt-2`})]}),e.ports&&e.ports.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.Network,{className:`h-3 w-3`}),e.ports.map((t,n)=>(0,f.jsxs)(`span`,{children:[t.published,`:`,t.target,n<e.ports.length-1&&`,`]},n))]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 border rounded`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=Math.max(0,h-1);g(e),i?.(e)},children:(0,f.jsx)(l.Minus,{className:`h-4 w-4`})}),(0,f.jsx)(r.n,{type:`number`,value:h,onChange:e=>{g(parseInt(e.target.value)||0)},onBlur:()=>i?.(h),className:`w-12 h-8 text-center border-0 p-0`,min:0}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=h+1;g(e),i?.(e)},children:(0,f.jsx)(l.Plus,{className:`h-4 w-4`})})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[a&&(0,f.jsxs)($,{onClick:a,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2`}),`Restart`]}),o&&(0,f.jsxs)($,{onClick:o,children:[(0,f.jsx)(l.Square,{className:`h-4 w-4 mr-2`}),`Stop`]}),(0,f.jsx)(ln,{}),c&&(0,f.jsxs)($,{onClick:c,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>m(!p),children:[(0,f.jsx)(l.Eye,{className:`h-4 w-4 mr-1`}),p?`Hide`:`Show`,` Containers`]})]})]}),p&&(0,f.jsx)(`div`,{className:`mt-4 pt-4 border-t space-y-2`,children:e.containers.length===0?(0,f.jsx)(`div`,{className:`text-center text-muted-foreground py-4`,children:`No containers running`}):e.containers.map(e=>(0,f.jsx)(xB,{container:e,onViewLogs:u?()=>u(e):void 0,onExecShell:d?()=>d(e):void 0},e.id))})]})})}function CB({services:e}){let t=s.useMemo(()=>{let t=e.length,n=e.reduce((e,t)=>e+t.containers.length,0),r=e.reduce((e,t)=>e+t.containers.filter(e=>e.status===`running`).length,0),i=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.cpu,0),0),a=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.memory,0),0);return{totalServices:t,totalContainers:n,runningContainers:r,avgCpu:i/n,totalMemory:a}},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-5 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalServices}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Services`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Containers`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.runningContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Running`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[t.avgCpu.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg CPU`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(t.totalMemory/1024).toFixed(1),`GB`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Memory`})]})})]})}function wB({services:e,onScaleService:i,onRestartService:a,onStopService:o,onDeleteService:c,onViewLogs:u,onExecShell:d,onRefresh:p,className:m}){let[h,g]=s.useState(``),[_,v]=s.useState(`all`),y=s.useMemo(()=>e.filter(e=>!(h&&!e.name.toLowerCase().includes(h.toLowerCase())||_!==`all`&&e.status!==_)),[e,h,_]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Container,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Container Orchestrator`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage and monitor containerized services`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search services...`,value:h,onChange:e=>g(e.target.value),className:`pl-9 w-64`})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`running`,children:`Running`}),(0,f.jsx)(n.m,{value:`updating`,children:`Updating`}),(0,f.jsx)(n.m,{value:`failed`,children:`Failed`}),(0,f.jsx)(n.m,{value:`pending`,children:`Pending`})]})]}),p&&(0,f.jsx)(r.r,{variant:`outline`,onClick:p,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(CB,{services:e}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:y.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Container,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No services found`})]}):y.map(e=>(0,f.jsx)(SB,{service:e,onScale:i?t=>i(e,t):void 0,onRestart:a?()=>a(e):void 0,onStop:o?()=>o(e):void 0,onDelete:c?()=>c(e):void 0,onViewLogs:u,onExecShell:d},e.id))})})]})}function TB(e,t){return Array.from({length:t},(t,n)=>({id:`${e}-${n+1}`,name:`${e}-${n+1}`,image:`myregistry/${e}:latest`,status:`running`,createdAt:new Date(Date.now()-(n+1)*36e5),startedAt:new Date(Date.now()-n*36e5),healthCheck:`healthy`,restartCount:Math.floor(Math.random()*3),node:`node-${Math.floor(Math.random()*3)+1}`,resources:{cpu:Math.random()*50+10,memory:Math.floor(Math.random()*500+200),memoryLimit:1024,networkRx:Math.floor(Math.random()*1e6),networkTx:Math.floor(Math.random()*5e5)}}))}var EB=[{id:`1`,name:`api-gateway`,image:`myregistry/api-gateway:v2.4.1`,status:`running`,replicas:{desired:3,running:3,ready:3},containers:TB(`api-gateway`,3),ports:[{published:80,target:8080},{published:443,target:8443}],createdAt:new Date(Date.now()-168*36e5),updatedAt:new Date(Date.now()-48*36e5)},{id:`2`,name:`user-service`,image:`myregistry/user-service:v1.8.0`,status:`updating`,replicas:{desired:2,running:2,ready:1},containers:TB(`user-service`,2),updateStatus:{state:`updating`,progress:50,message:`Updating replica 1 of 2`},ports:[{published:8081,target:8080}],createdAt:new Date(Date.now()-336*36e5),updatedAt:new Date},{id:`3`,name:`payment-service`,image:`myregistry/payment-service:v3.1.0`,status:`running`,replicas:{desired:2,running:2,ready:2},containers:TB(`payment-service`,2),ports:[{published:8082,target:8080}],createdAt:new Date(Date.now()-720*36e5),updatedAt:new Date(Date.now()-120*36e5)},{id:`4`,name:`notification-worker`,image:`myregistry/notification-worker:v2.0.0`,status:`running`,replicas:{desired:5,running:5,ready:5},containers:TB(`notification-worker`,5),createdAt:new Date(Date.now()-504*36e5),updatedAt:new Date(Date.now()-168*36e5)},{id:`5`,name:`analytics-pipeline`,image:`myregistry/analytics:v1.2.0`,status:`failed`,replicas:{desired:3,running:1,ready:1},containers:[...TB(`analytics-pipeline`,1),{id:`analytics-pipeline-2`,name:`analytics-pipeline-2`,image:`myregistry/analytics:v1.2.0`,status:`exited`,createdAt:new Date(Date.now()-2*36e5),healthCheck:`unhealthy`,restartCount:5,node:`node-2`,resources:{cpu:0,memory:0,memoryLimit:1024,networkRx:0,networkTx:0}}],createdAt:new Date(Date.now()-240*36e5),updatedAt:new Date(Date.now()-24*36e5)}],DB={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},offline:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Offline`}},OB={active:{color:`text-green-500`,label:`Active`},idle:{color:`text-gray-500`,label:`Idle`},idle_in_transaction:{color:`text-yellow-500`,label:`Idle in Transaction`},waiting:{color:`text-orange-500`,label:`Waiting`}};function kB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function AB(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function jB(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(2)}ms`:`${(e/1e3).toFixed(2)}s`}function MB({metrics:e,status:r}){let i=DB[r],a=e.connections.active/e.connections.max*100,o=e.storage.used/e.storage.total*100;return(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.connections.active}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{children:[e.connections.idle,` idle`]}),(0,f.jsxs)(`span`,{children:[`max `,e.connections.max]})]}),(0,f.jsx)(Zn,{value:a,className:t.t(`h-1.5`,a>80&&`[&>div]:bg-red-500`)})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,f.jsx)(l.Zap,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.transactions.perSecond,`/s`]})]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.transactions.committed}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Transactions`}),(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`text-red-500`,children:e.transactions.rolledBack}),` rolled back`]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,f.jsx)(l.Activity,{className:`h-4 w-4 text-muted-foreground`})}),(0,f.jsxs)(`div`,{className:t.t(`text-2xl font-bold`,e.cache.hitRatio<90&&`text-yellow-500`,e.cache.hitRatio<80&&`text-red-500`),children:[e.cache.hitRatio.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Cache Hit Ratio`}),(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Buffer: `,e.cache.bufferHit,` • Disk: `,e.cache.diskRead]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,f.jsx)(l.HardDrive,{className:`h-4 w-4 text-muted-foreground`})}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:kB(e.storage.used)}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Storage Used`}),(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:o,className:t.t(`h-1.5`,o>80&&`[&>div]:bg-red-500`)}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`of `,kB(e.storage.total)]})]})]})})]})}function NB({connections:e,onKill:i}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Active Connections`]}),(0,f.jsx)(n.x,{variant:`secondary`,children:e.length})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let a=OB[e.state];return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg border`,e.state===`idle_in_transaction`&&`border-yellow-500/30`,e.duration>60&&`bg-yellow-500/5`),children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs`,a.color),children:a.label}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`@ `,e.database]})]}),e.query&&(0,f.jsx)(`code`,{className:`text-xs text-muted-foreground block truncate mt-1`,children:e.query})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>60&&`text-yellow-500`,e.duration>300&&`text-red-500`),children:AB(e.duration)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.client})]}),i&&e.state!==`idle`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-red-500`,onClick:()=>i(e),children:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`})})]},e.id)})})})})]})}function PB({backups:e,onRestore:t,onCreate:i}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4`}),`Backups`]}),i&&(0,f.jsxs)(r.r,{size:`sm`,onClick:i,children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-1`}),`Create Backup`]})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[200px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg border`,children:[e.status===`completed`?(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):e.status===`failed`?(0,f.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}):e.status===`running`?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 text-blue-500 animate-spin shrink-0`}):(0,f.jsx)(l.Clock,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e.type})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.startedAt.toLocaleString(),e.duration&&` • ${AB(e.duration)}`]})]}),(0,f.jsx)(`div`,{className:`text-right shrink-0`,children:e.size&&(0,f.jsx)(`div`,{className:`text-sm font-medium`,children:kB(e.size)})}),t&&e.status===`completed`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>t(e),children:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`})})]},e.id))})})})]})}function FB({queries:e}){let[t,n]=s.useState(null),i=e=>{navigator.clipboard.writeText(e.query),n(e.id),setTimeout(()=>n(null),2e3)};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Slow Queries`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`p-2 rounded-lg border bg-muted/30`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsx)(`code`,{className:`text-xs font-mono line-clamp-2 flex-1`,children:e.query}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 shrink-0`,onClick:()=>i(e),children:t===e.id?(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 text-green-500`}):(0,f.jsx)(l.Copy,{className:`h-3 w-3`})})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`Calls: `,(0,f.jsx)(`strong`,{children:e.calls})]}),(0,f.jsxs)(`span`,{children:[`Mean: `,(0,f.jsx)(`strong`,{className:`text-yellow-500`,children:jB(e.meanTime)})]}),(0,f.jsxs)(`span`,{children:[`Max: `,(0,f.jsx)(`strong`,{className:`text-red-500`,children:jB(e.maxTime)})]}),(0,f.jsxs)(`span`,{children:[`Total: `,(0,f.jsx)(`strong`,{children:jB(e.totalTime)})]}),(0,f.jsxs)(`span`,{children:[`Rows: `,(0,f.jsx)(`strong`,{children:e.rows})]})]})]},e.id))})})})]})}function IB({onExecute:e}){let[t,a]=s.useState(``),[o,c]=s.useState([]);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4`}),`Query Editor`]})}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsx)(i.n,{value:t,onChange:e=>a(e.target.value),placeholder:`SELECT * FROM users LIMIT 10;`,className:`font-mono text-sm min-h-[120px]`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:o.length>0&&(0,f.jsxs)(n.d,{onValueChange:e=>a(e),children:[(0,f.jsxs)(n.y,{className:`w-40`,children:[(0,f.jsx)(l.History,{className:`h-4 w-4 mr-2`}),`History`]}),(0,f.jsx)(n.f,{children:o.map((e,t)=>(0,f.jsx)(n.m,{value:e,children:(0,f.jsx)(`span`,{className:`truncate max-w-[300px]`,children:e})},t))})]})}),(0,f.jsxs)(r.r,{onClick:()=>{t.trim()&&(e?.(t),c(e=>[t,...e.slice(0,9)]))},disabled:!t.trim(),children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Execute`]})]})]})]})}function LB({instance:e,onExecuteQuery:i,onCreateBackup:a,onRestoreBackup:o,onKillConnection:s,onRefresh:c,className:u}){let d=DB[e.status];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Database,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Z,{children:e.name}),(0,f.jsx)(n.x,{className:t.t(`text-white`,d.bgColor),children:d.label}),(0,f.jsx)(n.x,{variant:`outline`,children:e.role})]}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.type,` `,e.version,` • `,e.host,`:`,e.port]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.metrics.replication&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(e.metrics.replication.lag>1e3?`text-red-500`:e.metrics.replication.lag>100?`text-yellow-500`:`text-green-500`),children:[`Replication: `,jB(e.metrics.replication.lag),` lag`]}),c&&(0,f.jsx)(r.r,{variant:`outline`,onClick:c,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(MB,{metrics:e.metrics,status:e.status}),(0,f.jsxs)(Cr,{defaultValue:`connections`,children:[(0,f.jsxs)(wr,{children:[(0,f.jsxs)(Tr,{value:`connections`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4 mr-1`}),`Connections`]}),(0,f.jsxs)(Tr,{value:`queries`,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4 mr-1`}),`Query`]}),(0,f.jsxs)(Tr,{value:`slow`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 mr-1`}),`Slow Queries`]}),(0,f.jsxs)(Tr,{value:`backups`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Backups`]})]}),(0,f.jsx)(Er,{value:`connections`,className:`mt-4`,children:(0,f.jsx)(NB,{connections:e.connections,onKill:s})}),(0,f.jsx)(Er,{value:`queries`,className:`mt-4`,children:(0,f.jsx)(IB,{onExecute:i})}),(0,f.jsx)(Er,{value:`slow`,className:`mt-4`,children:(0,f.jsx)(FB,{queries:e.slowQueries})}),(0,f.jsx)(Er,{value:`backups`,className:`mt-4`,children:(0,f.jsx)(PB,{backups:e.backups,onRestore:o,onCreate:a})})]})]})}var RB={id:`1`,name:`production-db`,type:`postgresql`,version:`15.4`,host:`db.example.com`,port:5432,status:`healthy`,role:`primary`,metrics:{connections:{active:45,idle:25,max:100},transactions:{committed:125e3,rolledBack:15,perSecond:250},cache:{hitRatio:98.5,bufferHit:15e3,diskRead:250},storage:{used:85*1024*1024*1024,total:200*1024*1024*1024,tablespace:75*1024*1024*1024,indexes:10*1024*1024*1024},replication:{lag:25,state:`streaming`,replicas:2}},connections:[{id:`1`,user:`api_user`,database:`production`,state:`active`,query:`SELECT * FROM users WHERE id = $1`,duration:.5,client:`192.168.1.10`},{id:`2`,user:`api_user`,database:`production`,state:`active`,query:`UPDATE orders SET status = $1 WHERE id = $2`,duration:1.2,client:`192.168.1.11`},{id:`3`,user:`analytics`,database:`production`,state:`idle_in_transaction`,query:`SELECT COUNT(*) FROM events WHERE...`,duration:125,client:`192.168.1.20`},{id:`4`,user:`admin`,database:`production`,state:`idle`,duration:300,client:`192.168.1.5`},{id:`5`,user:`api_user`,database:`production`,state:`active`,duration:.1,client:`192.168.1.12`}],backups:[{id:`1`,name:`daily-backup-20240110`,type:`full`,status:`completed`,size:45*1024*1024*1024,startedAt:new Date(Date.now()-4*36e5),completedAt:new Date(Date.now()-2*36e5),duration:7200},{id:`2`,name:`hourly-backup-20240110-12`,type:`incremental`,status:`completed`,size:250*1024*1024,startedAt:new Date(Date.now()-1*36e5),completedAt:new Date(Date.now()-50*6e4),duration:600},{id:`3`,name:`hourly-backup-20240110-13`,type:`incremental`,status:`running`,startedAt:new Date(Date.now()-5*6e4)},{id:`4`,name:`daily-backup-20240111`,type:`full`,status:`scheduled`,startedAt:new Date(Date.now()+8*36e5)}],slowQueries:[{id:`1`,query:`SELECT * FROM orders o JOIN order_items oi ON o.id = oi.order_id WHERE o.created_at > $1 AND o.status = $2`,calls:1250,totalTime:45e3,meanTime:36,maxTime:520,rows:15e3},{id:`2`,query:`SELECT u.*, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id ORDER BY order_count DESC LIMIT 100`,calls:500,totalTime:85e3,meanTime:170,maxTime:1200,rows:100},{id:`3`,query:`UPDATE products SET view_count = view_count + 1 WHERE id = $1`,calls:5e4,totalTime:25e3,meanTime:.5,maxTime:15,rows:1},{id:`4`,query:`SELECT * FROM analytics_events WHERE event_type = $1 AND created_at BETWEEN $2 AND $3`,calls:250,totalTime:125e3,meanTime:500,maxTime:3500,rows:5e4}]},zB={healthy:{color:`text-green-500 bg-green-500/10`,icon:(0,f.jsx)(l.ShieldCheck,{className:`h-4 w-4`}),label:`Healthy`},degraded:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4`}),label:`Degraded`},down:{color:`text-red-500 bg-red-500/10`,icon:(0,f.jsx)(l.ShieldX,{className:`h-4 w-4`}),label:`Down`}},BB={clean:{color:`text-green-500`,icon:(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),label:`Clean`,bgColor:`bg-green-500`},infected:{color:`text-red-500`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Infected`,bgColor:`bg-red-500`},error:{color:`text-orange-500`,icon:(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4`}),label:`Error`,bgColor:`bg-orange-500`}},VB={critical:{color:`text-red-500`,bgColor:`bg-red-500`},high:{color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{color:`text-blue-500`,bgColor:`bg-blue-500`}};function HB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function UB(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function WB(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function GB({health:e}){let r=zB[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function KB({result:e}){let r=BB[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function qB({title:e,value:n,icon:r,trend:i,color:a=`text-primary`}){return(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mb-1`,children:e}),(0,f.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,f.jsx)(`p`,{className:t.t(`text-3xl font-bold`,a),children:n}),i&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]})]}),(0,f.jsx)(`div`,{className:t.t(`p-3 rounded-lg`,`${a.replace(`text-`,`bg-`)}/10`),children:r})]})})})}function JB({stats:e}){let t=Math.max(...e.map(e=>Math.max(e.scans,e.threats)),1);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.TrendingUp,{className:`h-4 w-4`}),`Weekly Activity`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{let r=e.scans/t*100,i=e.threats/t*100;return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground min-w-12`,children:e.day}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),e.scans,` scans`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-red-500`}),e.threats,` threats`]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:`h-full bg-blue-500 rounded-full transition-all`,style:{width:`${r}%`}})}),e.threats>0&&(0,f.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:`h-full bg-red-500 rounded-full transition-all`,style:{width:`${i}%`}})})]})]},e.day)})})})]})}function YB({scans:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Scans`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-12 w-12 mx-auto mb-3 opacity-50`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`No scans yet`})]}):e.map(e=>(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-between p-3 rounded-lg border transition-colors`,e.result===`infected`&&`border-red-500/50 bg-red-500/5`),children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,BB[e.result].color.replace(`text-`,`bg-`)+`/10`),children:BB[e.result].icon}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,f.jsx)(KB,{result:e.result})]}),e.threatName&&(0,f.jsxs)(`p`,{className:`text-xs text-red-500 mt-1 flex items-center gap-1`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),e.threatName]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),WB(e.scanDate)]}),(0,f.jsx)(`span`,{children:UB(e.duration)}),(0,f.jsx)(`span`,{children:HB(e.fileSize)})]})]})]})},e.id))})})]})}function XB({threats:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Top Threats`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,f.jsx)(l.ShieldCheck,{className:`h-12 w-12 mx-auto mb-3 text-green-500 opacity-50`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`No threats detected`})]}):e.map((r,i)=>{let a=VB[r.severity];return(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-full bg-muted text-sm font-medium`,children:i+1}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:r.name}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs capitalize`,a.color),children:r.severity})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:t.t(`h-full rounded-full`,a.bgColor),style:{width:`${Math.min(r.count/Math.max(...e.map(e=>e.count))*100,100)}%`}})}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium min-w-12 text-right`,children:[r.count,` `,r.count===1?`time`:`times`]})]})]})]},r.name)})})})]})}function ZB({serviceHealth:e=`healthy`,clamavVersion:n=`1.0.3`,signatureCount:i=8642758,lastSignatureUpdate:a,scansToday:o=0,threatsDetected:s=0,quarantinedFiles:c=0,detectionRate:u=0,recentScans:d=[],weeklyStats:p=[],topThreats:m=[],onStartScan:h,onViewQuarantine:g,className:_}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,_),children:[(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between items-start`,children:[(0,f.jsx)(`div`,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10`,children:(0,f.jsx)(l.Shield,{className:`h-6 w-6 text-primary`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Antivirus ClamAV`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` • `,i.toLocaleString(),` signatures`,a&&(0,f.jsxs)(f.Fragment,{children:[` • Updated `,WB(a)]})]})]})]})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(GB,{health:e}),g&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:g,children:[(0,f.jsx)(l.Archive,{className:`h-4 w-4 mr-2`}),`Quarantine`]}),h&&(0,f.jsxs)(r.r,{onClick:h,children:[(0,f.jsx)(l.PlayCircle,{className:`h-4 w-4 mr-2`}),`Start Scan`]})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(qB,{title:`Scans Today`,value:o.toLocaleString(),icon:(0,f.jsx)(l.Activity,{className:`h-6 w-6`}),color:`text-blue-500`}),(0,f.jsx)(qB,{title:`Threats Detected`,value:s.toLocaleString(),icon:(0,f.jsx)(l.AlertTriangle,{className:`h-6 w-6`}),color:`text-red-500`}),(0,f.jsx)(qB,{title:`Quarantined Files`,value:c.toLocaleString(),icon:(0,f.jsx)(l.Archive,{className:`h-6 w-6`}),color:`text-orange-500`}),(0,f.jsx)(qB,{title:`Detection Rate`,value:`${u.toFixed(1)}%`,icon:(0,f.jsx)(l.ShieldCheck,{className:`h-6 w-6`}),color:`text-green-500`})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,f.jsx)(JB,{stats:p}),(0,f.jsx)(XB,{threats:m})]}),(0,f.jsx)(YB,{scans:d})]})}var QB=[{id:`scan1`,filename:`document.pdf`,result:`clean`,scanDate:new Date(Date.now()-5*6e4),duration:234,fileSize:2048576,userId:`user123`},{id:`scan2`,filename:`malicious_script.js`,result:`infected`,threatName:`Trojan.GenericKD.67890123`,scanDate:new Date(Date.now()-15*6e4),duration:156,fileSize:45678,userId:`user456`},{id:`scan3`,filename:`eicar_test.txt`,result:`infected`,threatName:`Eicar-Test-Signature`,scanDate:new Date(Date.now()-30*6e4),duration:89,fileSize:68,userId:`admin`},{id:`scan4`,filename:`report_2024.xlsx`,result:`clean`,scanDate:new Date(Date.now()-45*6e4),duration:567,fileSize:5242880,userId:`user789`},{id:`scan5`,filename:`suspicious_archive.zip`,result:`infected`,threatName:`Win.Trojan.Genome-9999999`,scanDate:new Date(Date.now()-60*6e4),duration:1234,fileSize:10485760,userId:`user321`}],$B=[{day:`Mon`,scans:145,threats:3},{day:`Tue`,scans:198,threats:5},{day:`Wed`,scans:167,threats:2},{day:`Thu`,scans:223,threats:8},{day:`Fri`,scans:189,threats:4},{day:`Sat`,scans:98,threats:1},{day:`Sun`,scans:76,threats:0}],eV=[{name:`Eicar-Test-Signature`,count:12,severity:`low`},{name:`Trojan.GenericKD.67890123`,count:8,severity:`high`},{name:`Win.Trojan.Genome-9999999`,count:5,severity:`critical`},{name:`JS.Downloader.Nemucod`,count:4,severity:`medium`},{name:`PHP.Webshell.Generic`,count:3,severity:`high`}],tV=e=>{if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**+r*100)/100+` `+n[r]},nV=e=>{switch(e){case`pending`:return(0,f.jsx)(l.Shield,{className:`h-4 w-4 text-muted-foreground`});case`scanning`:return(0,f.jsx)(l.Scan,{className:`h-4 w-4 text-blue-500 animate-pulse`});case`clean`:return(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500`});case`infected`:return(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 text-red-500`});case`error`:return(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4 text-orange-500`})}},rV=e=>{switch(e){case`pending`:return(0,f.jsx)(n.x,{variant:`outline`,children:`En attente`});case`scanning`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:`Scan en cours`});case`clean`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-green-500 text-green-500`,children:`Sain`});case`infected`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Infecté`});case`error`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:`Erreur`})}};function iV({files:e=[],maxFileSize:i=100*1024*1024,acceptedTypes:a=[`*/*`],maxConcurrentScans:o=3,onFilesAdded:c,onScanStart:u,onScanComplete:d,onFileRemove:p,onScanAll:m,className:h}){let[g,_]=(0,s.useState)(!1),v=(0,s.useRef)(null),y=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!0)},[]),b=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1)},[]),x=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1);let t=Array.from(e.dataTransfer.files);c&&c(t)},[c]),S=(0,s.useCallback)(e=>{let t=e.target.files?Array.from(e.target.files):[];c&&c(t)},[c]),C=()=>{v.current?.click()},w=e.filter(e=>e.status===`pending`).length,T=e.filter(e=>e.status===`scanning`).length,E=e.filter(e=>e.status===`clean`).length,D=e.filter(e=>e.status===`infected`).length,O=e.filter(e=>e.status===`error`).length;return(0,f.jsxs)(Y,{className:t.t(`w-full`,h),children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Scan Antivirus (ClamAV)`}),(0,f.jsx)(Se,{children:`Uploadez vos fichiers pour analyse de sécurité`})]}),e.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.length,` fichier`,e.length>1?`s`:``]}),w>0&&(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:m,className:`gap-2`,children:[(0,f.jsx)(l.Scan,{className:`h-4 w-4`}),`Scanner tout`]}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>e.forEach(e=>p?.(e.id)),children:`Tout supprimer`})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{onDragOver:y,onDragLeave:b,onDrop:x,onClick:C,className:t.t(`relative flex min-h-[200px] cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 transition-colors`,g?`border-primary bg-primary/5`:`border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50`),children:[(0,f.jsx)(l.Upload,{className:`h-10 w-10 text-muted-foreground`}),(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:`Glissez vos fichiers ici ou cliquez pour parcourir`}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Taille max: `,tV(i)]})]}),(0,f.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:a.join(`,`),onChange:S,className:`hidden`})]}),e.length>0&&(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-green-500 text-green-500`,children:[(0,f.jsx)(l.CheckCircle2,{className:`mr-1 h-3 w-3`}),E,` sain`,E>1?`s`:``]}),D>0&&(0,f.jsxs)(n.x,{variant:`destructive`,children:[(0,f.jsx)(l.ShieldAlert,{className:`mr-1 h-3 w-3`}),D,` infecté`,D>1?`s`:``]}),T>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:[(0,f.jsx)(l.Scan,{className:`mr-1 h-3 w-3`}),T,` en cours`]}),w>0&&(0,f.jsxs)(n.x,{variant:`outline`,children:[(0,f.jsx)(l.Shield,{className:`mr-1 h-3 w-3`}),w,` en attente`]}),O>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:[(0,f.jsx)(l.AlertCircle,{className:`mr-1 h-3 w-3`}),O,` erreur`,O>1?`s`:``]})]}),e.length>0&&(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsx)(`div`,{className:t.t(`rounded-lg border p-4 transition-colors`,e.status===`infected`&&`border-red-500/50 bg-red-50/50 dark:bg-red-950/20`,e.status===`clean`&&`border-green-500/50 bg-green-50/50 dark:bg-green-950/20`),children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex flex-1 items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`mt-1`,children:nV(e.status)}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium text-sm`,children:e.file.name}),rV(e.status)]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[tV(e.file.size),e.scanDuration&&(0,f.jsxs)(f.Fragment,{children:[` • Scanné en `,e.scanDuration,`ms`]})]}),e.status===`scanning`&&(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:e.progress,className:`h-1.5`}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Scan en cours... `,e.progress,`%`]})]}),e.status===`infected`&&e.threatName&&(0,f.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-red-100 px-2 py-1 dark:bg-red-950/50`,children:[(0,f.jsx)(l.ShieldAlert,{className:`h-3 w-3 text-red-600 dark:text-red-400`}),(0,f.jsxs)(`span`,{className:`text-xs font-medium text-red-600 dark:text-red-400`,children:[`Menace détectée: `,e.threatName]})]}),e.status===`clean`&&e.scannedAt&&(0,f.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 text-green-600 dark:text-green-400`}),(0,f.jsx)(`span`,{className:`text-xs text-green-600 dark:text-green-400`,children:`Fichier sain, aucune menace détectée`})]})]})]}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>p?.(e.id),className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})},e.id))})]})]})}var aV={critical:{label:`Critique`,color:`bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20`},high:{label:`Élevée`,color:`bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20`},medium:{label:`Moyenne`,color:`bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20`},low:{label:`Faible`,color:`bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20`}},oV=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,sV=e=>new Intl.DateTimeFormat(`fr-FR`,{dateStyle:`short`,timeStyle:`short`}).format(e),cV=({files:e=[],totalCount:i=0,onDelete:a,onRestore:o,onRescan:c,onPurgeAll:u,onDownloadReport:d,className:p})=>{let[m,h]=s.useState(``),[g,_]=s.useState(`all`),[v,y]=s.useState(`all`),[b,x]=s.useState(!1),[S,C]=s.useState(!1),[w,T]=s.useState(!1),[E,D]=s.useState(null),O=s.useMemo(()=>{let t=e;if(m){let e=m.toLowerCase();t=t.filter(t=>t.originalName.toLowerCase().includes(e)||t.threatName.toLowerCase().includes(e)||t.originalPath.toLowerCase().includes(e))}if(g!==`all`&&(t=t.filter(e=>e.severity===g)),v!==`all`){let e=new Date,n=new Date;switch(v){case`today`:n.setHours(0,0,0,0);break;case`week`:n.setDate(e.getDate()-7);break;case`month`:n.setMonth(e.getMonth()-1);break}v!==`all`&&(t=t.filter(e=>new Date(e.quarantinedAt)>=n))}return t},[e,m,g,v]),k=s.useMemo(()=>{let t={critical:0,high:0,medium:0,low:0};return e.forEach(e=>{t[e.severity]++}),t},[e]),A=e=>{D(e),x(!0)},j=e=>{D(e),C(!0)};return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight`,children:`Quarantaine`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[i||e.length,` fichier`,(i||e.length)>1?`s`:``,` en quarantaine`]})]}),(0,f.jsxs)(r.r,{variant:`destructive`,onClick:()=>T(!0),disabled:e.length===0,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Vider la quarantaine`]})]}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-4`,children:[`critical`,`high`,`medium`,`low`].map(e=>(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:aV[e].label}),(0,f.jsx)(`p`,{className:`text-2xl font-bold`,children:k[e]})]}),(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-5 w-5`,e===`critical`&&`text-red-500`,e===`high`&&`text-orange-500`,e===`medium`&&`text-yellow-500`,e===`low`&&`text-blue-500`)})]})},e))}),(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher par nom, menace ou chemin...`,value:m,onChange:e=>h(e.target.value),className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:g,onValueChange:e=>_(e),children:[(0,f.jsx)(`option`,{value:`all`,children:`Toutes les sévérités`}),(0,f.jsx)(`option`,{value:`critical`,children:`Critique`}),(0,f.jsx)(`option`,{value:`high`,children:`Élevée`}),(0,f.jsx)(`option`,{value:`medium`,children:`Moyenne`}),(0,f.jsx)(`option`,{value:`low`,children:`Faible`})]}),(0,f.jsxs)(n.d,{value:v,onValueChange:y,children:[(0,f.jsx)(`option`,{value:`all`,children:`Toutes les dates`}),(0,f.jsx)(`option`,{value:`today`,children:`Aujourd'hui`}),(0,f.jsx)(`option`,{value:`week`,children:`7 derniers jours`}),(0,f.jsx)(`option`,{value:`month`,children:`30 derniers jours`})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`p-4`,children:O.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,f.jsx)(l.AlertTriangle,{className:`mb-4 h-12 w-12 text-muted-foreground`}),(0,f.jsx)(`h3`,{className:`mb-1 text-lg font-semibold`,children:`Aucun fichier trouvé`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.length===0?`La quarantaine est vide`:`Aucun fichier ne correspond aux filtres`})]}):(0,f.jsx)(`div`,{className:`space-y-4`,children:O.map(e=>(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-medium`,children:e.originalName}),(0,f.jsx)(n.x,{className:aV[e.severity].color,children:aV[e.severity].label})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.originalPath})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm md:grid-cols-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Menace détectée:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.threatName})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Date quarantaine:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:sV(e.quarantinedAt)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Taille:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:oV(e.fileSize)})]}),e.uploadedBy&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Uploadé par:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.uploadedBy})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Hash:`}),` `,(0,f.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[e.fileHash.substring(0,16),`...`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Moteur:`}),` `,(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.scanEngine,` (`,e.signatureVersion,`)`]})]})]}),(0,f.jsxs)(`div`,{className:`flex gap-2 border-t pt-3`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>c?.(e.id),children:[(0,f.jsx)(l.RefreshCw,{className:`mr-2 h-3 w-3`}),`Re-scanner`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>j(e),children:[(0,f.jsx)(l.RotateCcw,{className:`mr-2 h-3 w-3`}),`Restaurer`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>d?.(e.id),children:[(0,f.jsx)(l.Download,{className:`mr-2 h-3 w-3`}),`Rapport`]}),(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:()=>A(e),children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-3 w-3`}),`Supprimer`]})]})]})},e.id))})})})}),(0,f.jsx)(gt,{open:b,onOpenChange:x,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Supprimer définitivement`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir supprimer définitivement le fichier`,` `,(0,f.jsx)(`span`,{className:`font-medium`,children:E?.originalName}),` ?`,(0,f.jsx)(`br`,{}),`Cette action est irréversible.`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>x(!1),children:`Annuler`}),(0,f.jsx)(r.r,{variant:`destructive`,onClick:()=>{E&&a&&a(E.id),x(!1),D(null)},children:`Supprimer`})]})]})}),(0,f.jsx)(gt,{open:S,onOpenChange:C,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Restaurer le fichier`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir restaurer le fichier`,` `,(0,f.jsx)(`span`,{className:`font-medium`,children:E?.originalName}),` ?`,(0,f.jsx)(`br`,{}),`Le fichier sera replacé à son emplacement d'origine :`,` `,(0,f.jsx)(`span`,{className:`font-mono text-xs`,children:E?.originalPath})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>C(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:()=>{E&&o&&o(E.id),C(!1),D(null)},children:`Restaurer`})]})]})}),(0,f.jsx)(gt,{open:w,onOpenChange:T,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Vider la quarantaine`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir supprimer définitivement tous les fichiers en quarantaine ?`,(0,f.jsx)(`br`,{}),e.length,` fichier`,e.length>1?`s`:``,` ser`,e.length>1?`ont`:`a`,` `,`supprimé`,e.length>1?`s`:``,`. Cette action est irréversible.`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>T(!1),children:`Annuler`}),(0,f.jsx)(r.r,{variant:`destructive`,onClick:()=>{u&&u(),T(!1)},children:`Vider la quarantaine`})]})]})})]})},lV=[];function uV({entries:e=lV,totalEntries:i=e.length,currentPage:a=1,pageSize:o=10,periodFilter:c=`7d`,onPageChange:u,onFilterChange:d,onExport:p,className:m}){let[h,g]=(0,s.useState)(``),[_,v]=(0,s.useState)(`all`),[y,b]=(0,s.useState)(c),[x,S]=(0,s.useState)(`all`),[C,w]=(0,s.useState)(null),T=e.filter(e=>!(h&&!e.filename.toLowerCase().includes(h.toLowerCase())||_!==`all`&&e.result!==_||x!==`all`&&e.userId!==x)),E=T.slice((a-1)*o,a*o),D=Math.ceil(T.length/o),O={total:T.length,clean:T.filter(e=>e.result===`clean`).length,infected:T.filter(e=>e.result===`infected`).length,errors:T.filter(e=>e.result===`error`).length},k=Array.from(new Set(e.map(e=>e.userId))),A=e=>{navigator.clipboard.writeText(e),w(e),setTimeout(()=>w(null),2e3)},j=(e,t)=>{d?.({search:h,result:_,period:y,user:x,[e]:t})},M=e=>{switch(e){case`clean`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Clean`});case`infected`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Infected`});case`error`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Error`})}},N=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`,P=e=>new Intl.DateTimeFormat(`fr-FR`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e),F=e=>`${e.slice(0,8)}...${e.slice(-8)}`;return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Historique des scans`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:[i,` scan`,i>1?`s`:``,` au total`]})]}),(0,f.jsxs)(r.r,{onClick:p,variant:`outline`,children:[(0,f.jsx)(l.Download,{className:`w-4 h-4 mr-2`}),`Exporter le journal`]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Total scans`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1`,children:O.total})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Clean`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-green-600 dark:text-green-500`,children:O.clean})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Infected`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-red-600 dark:text-red-500`,children:O.infected})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Errors`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-orange-600 dark:text-orange-500`,children:O.errors})]})]}),(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher un fichier...`,value:h,onChange:e=>{g(e.target.value),j(`search`,e.target.value)},className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>{v(e),j(`result`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Résultat`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les résultats`}),(0,f.jsx)(n.m,{value:`clean`,children:`Clean`}),(0,f.jsx)(n.m,{value:`infected`,children:`Infected`}),(0,f.jsx)(n.m,{value:`error`,children:`Error`})]})]}),(0,f.jsxs)(n.d,{value:y,onValueChange:e=>{b(e),j(`period`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Période`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`today`,children:`Aujourd'hui`}),(0,f.jsx)(n.m,{value:`7d`,children:`7 derniers jours`}),(0,f.jsx)(n.m,{value:`30d`,children:`30 derniers jours`}),(0,f.jsx)(n.m,{value:`custom`,children:`Personnalisé`})]})]}),(0,f.jsxs)(n.d,{value:x,onValueChange:e=>{S(e),j(`user`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Utilisateur`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les utilisateurs`}),k.map(t=>(0,f.jsx)(n.m,{value:t,children:e.find(e=>e.userId===t)?.userName||t},t))]})]})]})}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`min-w-full`,children:(0,f.jsxs)(`table`,{className:`w-full`,children:[(0,f.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur-sm border-b`,children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Date/Heure`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Fichier`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Taille`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Hash SHA256`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Résultat`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Menace`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Utilisateur`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Durée`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Moteur`})]})}),(0,f.jsx)(`tbody`,{className:`divide-y`,children:E.length===0?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{colSpan:9,className:`px-4 py-8 text-center text-muted-foreground`,children:`Aucun scan trouvé`})}):E.map(e=>(0,f.jsxs)(`tr`,{className:`hover:bg-muted/50 transition-colors`,children:[(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:P(e.scanDate)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm font-medium max-w-xs truncate`,children:e.filename}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:N(e.fileSize)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`code`,{className:`text-xs bg-muted px-2 py-1 rounded`,children:F(e.fileHash)}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>A(e.fileHash),className:`h-6 w-6 p-0`,children:C===e.fileHash?(0,f.jsx)(l.Check,{className:`w-3 h-3 text-green-600`}):(0,f.jsx)(l.Copy,{className:`w-3 h-3`})})]})}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:M(e.result)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:e.threatName?(0,f.jsx)(`code`,{className:`text-xs bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-400 px-2 py-1 rounded`,children:e.threatName}):(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:e.userName}),(0,f.jsxs)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:[e.duration,`ms`]}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:(0,f.jsxs)(`div`,{className:`text-xs`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.engineVersion}),(0,f.jsx)(`div`,{className:`text-muted-foreground`,children:e.signatureVersion})]})})]},e.id))})]})})}),D>1&&(0,f.jsxs)(`div`,{className:`border-t px-4 py-3 flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Page `,a,` sur `,D]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u?.(a-1),disabled:a===1,children:`Précédent`}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u?.(a+1),disabled:a===D,children:`Suivant`})]})]})]})]})}var dV=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},fV=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5),i=Math.floor(t/864e5);return n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`},pV={running:{color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/20`,icon:l.CheckCircle,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/20`,icon:l.Activity,label:`Stopped`},error:{color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/20`,icon:l.AlertTriangle,label:`Error`},restarting:{color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,borderColor:`border-yellow-500/20`,icon:l.Loader2,label:`Restarting`}},mV={running:{color:`text-green-500`,label:`Running`},stopped:{color:`text-gray-500`,label:`Stopped`},error:{color:`text-red-500`,label:`Error`},updating:{color:`text-blue-500`,label:`Updating`}},hV={up:`bg-green-500`,degraded:`bg-yellow-500`,down:`bg-red-500`},gV=({status:e=`running`,version:i=`1.0.3`,uptime:a=259200,metrics:o={cpuUsage:2.5,memoryUsage:512,threads:4,scanQueue:0,activeConnections:3},signatures:s={version:`27456`,count:8764532,lastUpdate:new Date(Date.now()-36e5),freshclamStatus:`running`,nextScheduledUpdate:new Date(Date.now()+36e5)},socketType:c=`tcp`,socketPath:u=`3310`,uptimeHistory:d=[],onRestart:p,onUpdateSignatures:m,onViewLogs:h,className:g})=>{let _=pV[e],v=_.icon;return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,g),children:[(0,f.jsx)(Y,{className:t.t(`p-6 border-2`,_.borderColor,_.bgColor),children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-3 rounded-xl`,_.bgColor),children:(0,f.jsx)(v,{className:t.t(`w-8 h-8`,_.color,e===`restarting`&&`animate-spin`)})}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`text-2xl font-semibold`,children:`ClamAV Daemon`}),(0,f.jsx)(n.x,{variant:e===`error`?`destructive`:`secondary`,className:e===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:_.label})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`Version `,i]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`w-3.5 h-3.5`}),`Uptime: `,dV(a)]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:h,children:[(0,f.jsx)(l.Terminal,{className:`w-4 h-4 mr-2`}),`Logs`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:p,disabled:e===`restarting`,children:[(0,f.jsx)(l.RefreshCw,{className:t.t(`w-4 h-4 mr-2`,e===`restarting`&&`animate-spin`)}),`Restart`]})]})]})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.Activity,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`System Metrics`})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`CPU Usage`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[o.cpuUsage.toFixed(1),`%`]})]}),(0,f.jsx)(Zn,{value:o.cpuUsage,className:t.t(`h-2`,o.cpuUsage>80&&`bg-red-500/20`,o.cpuUsage>50&&o.cpuUsage<=80&&`bg-yellow-500/20`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Memory Usage`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[o.memoryUsage,` MB`]})]}),(0,f.jsx)(Zn,{value:o.memoryUsage/1024*100,className:t.t(`h-2`,o.memoryUsage>800&&`bg-red-500/20`,o.memoryUsage>600&&o.memoryUsage<=800&&`bg-yellow-500/20`)})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 pt-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Threads`}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.threads})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Scan Queue`}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.scanQueue})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Connections`}),(0,f.jsxs)(`div`,{className:`text-2xl font-semibold flex items-center gap-1`,children:[o.activeConnections,(0,f.jsx)(l.Wifi,{className:`w-4 h-4 text-muted-foreground`})]})]})]})]})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Database,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Signature Database`})]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:m,children:[(0,f.jsx)(l.RefreshCw,{className:`w-4 h-4 mr-2`}),`Update`]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Version`}),(0,f.jsx)(`div`,{className:`text-lg font-semibold`,children:s.version})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Signatures`}),(0,f.jsx)(`div`,{className:`text-lg font-semibold`,children:s.count.toLocaleString()})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2 pt-2 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Updated`}),(0,f.jsx)(`span`,{className:`font-medium`,children:fV(s.lastUpdate)})]}),s.nextScheduledUpdate&&(0,f.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Next Update`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[`in `,fV(new Date(Date.now()-(Date.now()-s.nextScheduledUpdate.getTime())))]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Freshclam Status`}),(0,f.jsx)(n.x,{variant:s.freshclamStatus===`error`?`destructive`:s.freshclamStatus===`updating`?`default`:`secondary`,className:s.freshclamStatus===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:(0,f.jsx)(`span`,{className:t.t(mV[s.freshclamStatus].color),children:mV[s.freshclamStatus].label})})]})]})]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.Wifi,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Connection`})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Socket Type`}),(0,f.jsx)(n.x,{variant:`outline`,children:c.toUpperCase()})]}),(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:c===`tcp`?`Port`:`Path`}),(0,f.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:u})]}),(0,f.jsxs)(`div`,{className:`flex justify-between pt-2 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,f.jsx)(`span`,{className:`text-lg font-semibold`,children:o.activeConnections})]})]})]}),(0,f.jsxs)(Y,{className:`p-6 lg:col-span-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.HardDrive,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Uptime History (Last 7 Days)`})]}),d.length>0?(0,f.jsx)(`div`,{className:`flex items-end justify-between gap-1 h-20`,children:d.map((e,n)=>(0,f.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`w-full rounded-t transition-all`,hV[e.status],e.status===`up`&&`h-full`,e.status===`degraded`&&`h-3/4`,e.status===`down`&&`h-1/4`)}),(0,f.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.hour})]},n))}):(0,f.jsx)(`div`,{className:`h-20 flex items-center justify-center text-sm text-muted-foreground`,children:`No uptime history available`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mt-4 pt-4 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-green-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-yellow-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Degraded`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-red-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Down`})]})]})]})]})]})},_V=[{name:`main.cvd`,version:`62`,signatureCount:6647427,size:162.5*1024*1024,lastUpdated:new Date(`2024-12-15T10:30:00`),buildTime:new Date(`2024-12-15T08:00:00`)},{name:`daily.cvd`,version:`27458`,signatureCount:2145789,size:89.3*1024*1024,lastUpdated:new Date(`2025-01-15T14:20:00`),buildTime:new Date(`2025-01-15T12:00:00`)},{name:`bytecode.cvd`,version:`334`,signatureCount:52438,size:2.8*1024*1024,lastUpdated:new Date(`2025-01-10T09:15:00`),buildTime:new Date(`2025-01-10T06:00:00`)}],vV=[{id:`upd-1`,date:new Date(`2025-01-15T14:20:00`),fromVersion:`27457`,toVersion:`27458`,newSignatures:1247,removedSignatures:89,duration:45,status:`success`,source:`daily.cvd`},{id:`upd-2`,date:new Date(`2025-01-14T14:15:00`),fromVersion:`27456`,toVersion:`27457`,newSignatures:2134,removedSignatures:156,duration:52,status:`success`,source:`daily.cvd`},{id:`upd-3`,date:new Date(`2025-01-13T14:10:00`),fromVersion:`27455`,toVersion:`27456`,newSignatures:1876,removedSignatures:203,duration:48,status:`success`,source:`daily.cvd`},{id:`upd-4`,date:new Date(`2025-01-12T14:05:00`),fromVersion:`27454`,toVersion:`27455`,newSignatures:0,removedSignatures:0,duration:12,status:`failed`,source:`daily.cvd`},{id:`upd-5`,date:new Date(`2025-01-11T14:00:00`),fromVersion:`27453`,toVersion:`27454`,newSignatures:3245,removedSignatures:178,duration:67,status:`success`,source:`daily.cvd`}],yV={updateFrequency:24,mirror:`database.clamav.net`,lastCheck:new Date(`2025-01-15T14:20:00`),checksToday:12,proxyEnabled:!1},bV=e=>e<1024?e+` B`:e<1024*1024?(e/1024).toFixed(2)+` KB`:(e/(1024*1024)).toFixed(2)+` MB`,xV=e=>new Intl.DateTimeFormat(`fr-FR`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e),SV=e=>new Intl.NumberFormat(`fr-FR`).format(e),CV=e=>{switch(e){case`success`:return(0,f.jsx)(l.CheckCircle2,{className:`size-4 text-green-600 dark:text-green-400`});case`failed`:return(0,f.jsx)(l.XCircle,{className:`size-4 text-red-600 dark:text-red-400`});case`in_progress`:return(0,f.jsx)(l.Loader2,{className:`size-4 text-blue-600 dark:text-blue-400 animate-spin`});case`scheduled`:return(0,f.jsx)(l.Clock,{className:`size-4 text-amber-600 dark:text-amber-400`})}},wV=e=>{switch(e){case`success`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Réussie`});case`failed`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Échouée`});case`in_progress`:return(0,f.jsx)(n.x,{variant:`default`,children:`En cours`});case`scheduled`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Planifiée`})}};function TV({databases:e=_V,updates:i=vV,freshclamConfig:a=yV,totalSignatures:o=e.reduce((e,t)=>e+t.signatureCount,0),isUpdating:s=!1,onUpdateNow:c,onScheduleUpdate:u,onViewChangelog:d,className:p}){let m=i[0];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Version DB`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:m?.toVersion||`N/A`})]}),(0,f.jsx)(l.Database,{className:`size-8 text-blue-600 dark:text-blue-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Total Signatures`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:SV(o)})]}),(0,f.jsx)(l.FileText,{className:`size-8 text-purple-600 dark:text-purple-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Dernière MAJ`}),(0,f.jsx)(`h3`,{className:`text-sm font-bold`,children:m?xV(m.date):`N/A`})]}),(0,f.jsx)(l.Clock,{className:`size-8 text-green-600 dark:text-green-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Taille Totale`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:bV(e.reduce((e,t)=>e+t.size,0))})]}),(0,f.jsx)(l.HardDrive,{className:`size-8 text-amber-600 dark:text-amber-400`})]})})]}),(0,f.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Bases de données`}),(0,f.jsxs)(n.x,{variant:`outline`,children:[e.length,` bases`]})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 p-4 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Database,{className:`size-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[`v`,e.version]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Signatures`}),(0,f.jsx)(`p`,{className:`font-medium`,children:SV(e.signatureCount)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Taille`}),(0,f.jsx)(`p`,{className:`font-medium`,children:bV(e.size)})]}),(0,f.jsxs)(`div`,{className:`col-span-2`,children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Dernière mise à jour`}),(0,f.jsx)(`p`,{className:`font-medium`,children:xV(e.lastUpdated)})]})]})]},e.name))})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Configuration Freshclam`}),(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>u?.(a.updateFrequency),children:[(0,f.jsx)(l.Calendar,{className:`mr-2 size-4`}),`Planifier`]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Fréquence de MAJ`}),(0,f.jsxs)(`p`,{className:`text-lg font-semibold`,children:[`Toutes les `,a.updateFrequency,`h`]})]}),(0,f.jsx)(l.Clock,{className:`size-6 text-blue-600 dark:text-blue-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mirror utilisé`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:a.mirror})]}),(0,f.jsx)(l.Globe,{className:`size-6 text-purple-600 dark:text-purple-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Dernier check`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:xV(a.lastCheck)})]}),(0,f.jsx)(l.RefreshCw,{className:`size-6 text-green-600 dark:text-green-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checks aujourd'hui`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:a.checksToday})]}),(0,f.jsx)(l.AlertCircle,{className:`size-6 text-amber-600 dark:text-amber-400`})]}),a.proxyEnabled&&(0,f.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50 p-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-amber-800 dark:text-amber-200`,children:[(0,f.jsx)(l.AlertCircle,{className:`size-4`}),(0,f.jsx)(`span`,{children:`Proxy activé`})]})}),(0,f.jsx)(r.r,{className:`w-full`,onClick:c,disabled:s,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Loader2,{className:`mr-2 size-4 animate-spin`}),`Mise à jour en cours...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Download,{className:`mr-2 size-4`}),`Mettre à jour maintenant`]})})]})]})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Historique des mises à jour`}),(0,f.jsxs)(n.x,{variant:`outline`,children:[i.length,` mises à jour`]})]}),(0,f.jsx)(er,{className:`h-[400px]`,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:i.map((e,t)=>(0,f.jsxs)(`div`,{className:`relative rounded-lg border border-border bg-muted/50 p-4`,children:[t<i.length-1&&(0,f.jsx)(`div`,{className:`absolute left-6 top-12 h-full w-px bg-border`}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border border-border bg-background`,children:CV(e.status)}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[e.source,` - v`,e.fromVersion,` → v`,e.toVersion]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:xV(e.date)})]}),wV(e.status)]}),e.status===`success`&&(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Ajoutées`}),(0,f.jsxs)(`p`,{className:`font-medium text-green-600 dark:text-green-400`,children:[`+`,SV(e.newSignatures)]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Supprimées`}),(0,f.jsxs)(`p`,{className:`font-medium text-red-600 dark:text-red-400`,children:[`-`,SV(e.removedSignatures)]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Durée`}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[e.duration,`s`]})]})]}),e.status===`failed`&&(0,f.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/50 p-2`,children:(0,f.jsx)(`p`,{className:`text-sm text-red-800 dark:text-red-200`,children:`Échec de la mise à jour`})}),(0,f.jsxs)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>d?.(e.id),children:[(0,f.jsx)(l.FileText,{className:`mr-2 size-3`}),`Voir le changelog`]})]})]})]},e.id))})})]})]})}var EV={autoScanOnUpload:!0,maxFileSize:100,maxFileSizeUnit:`MB`,scanTimeout:120,maxConcurrentScans:4,scanArchives:!0,maxArchiveDepth:3,excludedExtensions:[`.log`,`.tmp`,`.lock`],excludedPaths:[`/tmp`,`/var/cache`],whitelistedHashes:[],detectionAction:`quarantine`,notifyAdmin:!0,notifyUser:!0,auditLog:!0},DV=[{value:`quarantine`,label:`Quarantaine`},{value:`delete`,label:`Suppression`},{value:`notify_only`,label:`Notification seule`},{value:`block_and_notify`,label:`Bloquer + notifier`}],OV=[{value:`MB`,label:`MB`},{value:`GB`,label:`GB`}];function kV({policy:e=EV,isLoading:a=!1,onSave:o,onCancel:c,onResetDefaults:u,className:d}){let[p,m]=(0,s.useState)(e),[h,g]=(0,s.useState)(``),[_,v]=(0,s.useState)(``),[y,b]=(0,s.useState)(``),x=e=>{m(t=>({...t,...e}))},S=()=>{h.trim()&&!p.excludedExtensions.includes(h.trim())&&(x({excludedExtensions:[...p.excludedExtensions,h.trim()]}),g(``))},C=e=>{x({excludedExtensions:p.excludedExtensions.filter(t=>t!==e)})},w=()=>{_.trim()&&!p.excludedPaths.includes(_.trim())&&(x({excludedPaths:[...p.excludedPaths,_.trim()]}),v(``))},T=e=>{x({excludedPaths:p.excludedPaths.filter(t=>t!==e)})},E=()=>{y.trim()&&!p.whitelistedHashes.includes(y.trim())&&(x({whitelistedHashes:[...p.whitelistedHashes,y.trim()]}),b(``))},D=e=>{x({whitelistedHashes:p.whitelistedHashes.filter(t=>t!==e)})};return(0,f.jsxs)(Y,{className:t.t(`w-full`,d),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-6 border-b border-border/50`,children:[(0,f.jsx)(l.Shield,{className:`w-5 h-5 text-primary`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Configuration des politiques de scan`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Definissez les regles de scan antivirus`})]})]}),(0,f.jsxs)(Cr,{defaultValue:`general`,className:`w-full`,children:[(0,f.jsxs)(wr,{className:`w-full justify-start border-b border-border/50 rounded-none px-6`,children:[(0,f.jsx)(Tr,{value:`general`,children:`Regles generales`}),(0,f.jsx)(Tr,{value:`exclusions`,children:`Exclusions`}),(0,f.jsx)(Tr,{value:`actions`,children:`Actions`}),(0,f.jsx)(Tr,{value:`notifications`,children:`Notifications`})]}),(0,f.jsxs)(Er,{value:`general`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Scan automatique a l'upload`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scanner tous les fichiers lors de l'envoi`})]}),(0,f.jsx)(mr,{checked:p.autoScanOnUpload,onCheckedChange:e=>x({autoScanOnUpload:e}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Taille maximale de fichier`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{type:`number`,value:p.maxFileSize,onChange:e=>x({maxFileSize:parseInt(e.target.value)||0}),disabled:a,className:`flex-1`}),(0,f.jsxs)(n.d,{value:p.maxFileSizeUnit,onValueChange:e=>x({maxFileSizeUnit:e}),disabled:a,children:[(0,f.jsx)(n.y,{className:`w-24`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:OV.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Timeout de scan (secondes)`}),(0,f.jsx)(r.n,{type:`number`,value:p.scanTimeout,onChange:e=>x({scanTimeout:parseInt(e.target.value)||0}),disabled:a})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Nombre maximum de scans concurrents`}),(0,f.jsx)(r.n,{type:`number`,value:p.maxConcurrentScans,onChange:e=>x({maxConcurrentScans:parseInt(e.target.value)||1}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Scanner les archives (zip, tar, 7z)`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Analyser le contenu des fichiers archives`})]}),(0,f.jsx)(mr,{checked:p.scanArchives,onCheckedChange:e=>x({scanArchives:e}),disabled:a})]}),p.scanArchives&&(0,f.jsxs)(`div`,{className:`space-y-2 pl-6`,children:[(0,f.jsx)(i.o,{children:`Profondeur maximale d'archives imbriquees`}),(0,f.jsx)(r.n,{type:`number`,value:p.maxArchiveDepth,onChange:e=>x({maxArchiveDepth:parseInt(e.target.value)||1}),disabled:a})]})]}),(0,f.jsxs)(Er,{value:`exclusions`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Extensions exclues`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`.ext`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>e.key===`Enter`&&S(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:S,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.excludedExtensions.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,f.jsx)(`button`,{onClick:()=>C(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Chemins exclus`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`/path/to/exclude`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:w,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.excludedPaths.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,f.jsx)(`button`,{onClick:()=>T(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Hash exclus (whitelist)`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`SHA256 hash`,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>e.key===`Enter`&&E(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:E,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.whitelistedHashes.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e.substring(0,12),`...`,(0,f.jsx)(`button`,{onClick:()=>D(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]})]}),(0,f.jsxs)(Er,{value:`actions`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Action sur detection`}),(0,f.jsxs)(n.d,{value:p.detectionAction,onValueChange:e=>x({detectionAction:e}),disabled:a,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:DV.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Logger dans l'audit trail`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enregistrer toutes les detections`})]}),(0,f.jsx)(mr,{checked:p.auditLog,onCheckedChange:e=>x({auditLog:e}),disabled:a})]})]}),(0,f.jsxs)(Er,{value:`notifications`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Notifier l'administrateur`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Alerter en cas de menace detectee`})]}),(0,f.jsx)(mr,{checked:p.notifyAdmin,onCheckedChange:e=>x({notifyAdmin:e}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Notifier l'utilisateur`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Informer l'utilisateur de l'action prise`})]}),(0,f.jsx)(mr,{checked:p.notifyUser,onCheckedChange:e=>x({notifyUser:e}),disabled:a})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-t border-border/50`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>{m(EV),u?.()},disabled:a,children:[(0,f.jsx)(l.RotateCcw,{className:`w-4 h-4 mr-2`}),`Restaurer defauts`]}),(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:c,disabled:a,children:`Annuler`}),(0,f.jsx)(r.r,{onClick:()=>{o?.(p)},disabled:a,children:`Sauvegarder`})]})]})]})}var AV={critical:{icon:l.ShieldAlert,bgColor:`bg-red-950/50 border-red-800`,iconColor:`text-red-400`,badgeVariant:`destructive`},high:{icon:l.AlertTriangle,bgColor:`bg-orange-950/50 border-orange-800`,iconColor:`text-orange-400`,badgeVariant:`destructive`},medium:{icon:l.AlertCircle,bgColor:`bg-yellow-950/50 border-yellow-800`,iconColor:`text-yellow-400`,badgeVariant:`secondary`},low:{icon:l.Info,bgColor:`bg-blue-950/50 border-blue-800`,iconColor:`text-blue-400`,badgeVariant:`default`}},jV={quarantined:`Mis en quarantaine`,deleted:`Supprimé`,blocked:`Bloqué`,allowed:`Autorisé`},MV={quarantined:`text-orange-400`,deleted:`text-red-400`,blocked:`text-red-400`,allowed:`text-green-400`},NV=({alerts:e=[],maxVisible:i=3,autoHideAfter:a=0,onDismiss:o,onDismissAll:c,onViewDetails:u,onViewQuarantine:d,className:p})=>{let[m,h]=(0,s.useState)(new Set),g=e.filter(e=>!e.dismissed);if(g.length===0)return null;let _=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=g.slice(0,i),y=g.length-i,b=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5);return n<1?`À l'instant`:n<60?`Il y a ${n}m`:r<24?`Il y a ${r}h`:e.toLocaleDateString(`fr-FR`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})};return(0,f.jsxs)(`div`,{className:t.t(`space-y-2`,p),children:[g.length>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between bg-red-950/30 border border-red-800/50 rounded-lg px-4 py-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 text-red-400`}),(0,f.jsxs)(`span`,{className:`text-sm font-medium text-red-200`,children:[g.length,` alerte`,g.length>1?`s`:``,` active`,g.length>1?`s`:``]})]}),c&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:c,className:`text-red-300 hover:text-red-200`,children:`Tout ignorer`})]}),v.map(e=>{let i=AV[e.severity],a=i.icon,s=m.has(e.id);return(0,f.jsx)(Y,{className:t.t(`border-2 backdrop-blur-sm transition-all duration-200`,i.bgColor,s&&`shadow-lg`),children:(0,f.jsx)(`div`,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`mt-0.5 flex-shrink-0`,i.iconColor),children:(0,f.jsx)(a,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold text-white truncate`,children:e.threatName}),(0,f.jsx)(n.x,{variant:i.badgeVariant,className:`text-xs`,children:e.severity.toUpperCase()})]}),(0,f.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-gray-400`,children:[(0,f.jsx)(`span`,{className:`truncate`,title:e.filePath,children:e.filename}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{className:MV[e.action],children:jV[e.action]}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{children:b(e.detectedAt)})]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>o?.(e.id),className:`flex-shrink-0 h-8 w-8 p-0 text-gray-400 hover:text-white`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),s&&(0,f.jsx)(`div`,{className:`mt-3 pt-3 border-t border-white/10 space-y-2 text-xs text-gray-300`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Chemin complet:`}),(0,f.jsx)(`p`,{className:`font-mono break-all`,children:e.filePath})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Moteur antivirus:`}),(0,f.jsx)(`p`,{className:`font-mono`,children:e.engineVersion})]}),e.userId&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Utilisateur:`}),(0,f.jsx)(`p`,{className:`font-mono`,children:e.userId})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Détecté le:`}),(0,f.jsx)(`p`,{children:e.detectedAt.toLocaleString(`fr-FR`,{dateStyle:`medium`,timeStyle:`short`})})]})]})}),(0,f.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>_(e.id),className:`text-xs`,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ChevronUp,{className:`h-3 w-3 mr-1`}),`Masquer`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ChevronDown,{className:`h-3 w-3 mr-1`}),`Détails`]})}),u&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),className:`text-xs`,children:[(0,f.jsx)(l.Eye,{className:`h-3 w-3 mr-1`}),`Analyse complète`]}),e.action===`quarantined`&&d&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:d,className:`text-xs`,children:[(0,f.jsx)(l.Archive,{className:`h-3 w-3 mr-1`}),`Quarantaine`]})]})]})]})})},e.id)}),y>0&&(0,f.jsx)(`div`,{className:`text-center`,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`text-xs text-gray-400 hover:text-white`,children:[`+ `,y,` autre`,y>1?`s`:``,` alerte`,y>1?`s`:``]})})]})},PV=[{id:`1`,threatName:`Trojan.GenericKD.12345678`,filename:`invoice_2024.pdf.exe`,filePath:`/home/user/Downloads/invoice_2024.pdf.exe`,severity:`critical`,action:`quarantined`,detectedAt:new Date(Date.now()-5*6e4),userId:`user@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`2`,threatName:`Malware.Suspicious.Archive`,filename:`files.zip`,filePath:`/var/www/uploads/files.zip`,severity:`high`,action:`blocked`,detectedAt:new Date(Date.now()-15*6e4),engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`3`,threatName:`PUA.Win.Adware.Generic`,filename:`installer.exe`,filePath:`/tmp/installer.exe`,severity:`medium`,action:`deleted`,detectedAt:new Date(Date.now()-36e5),userId:`admin@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1}],FV={startDate:new Date(Date.now()-720*60*60*1e3),endDate:new Date,format:`pdf`,type:`executive_summary`,includeSections:{generalStats:!0,threatDetails:!0,scannedFiles:!0,actionsTaken:!0,recommendations:!0}},IV={totalScans:1247,totalThreats:34,detectionRate:98.5,quarantinedFiles:28,threatsBySeverity:[{severity:`critical`,count:3},{severity:`high`,count:8},{severity:`medium`,count:15},{severity:`low`,count:8}],complianceChecks:[{name:`Antivirus actif`,passed:!0,details:`ClamAV opérationnel`},{name:`Scans automatisés`,passed:!0,details:`Planification quotidienne`},{name:`Quarantaine sécurisée`,passed:!0,details:`Isolation cryptographique`},{name:`Audit trail`,passed:!0,details:`Logs immutables activés`}],weeklyTrend:[{week:`S1`,scans:280,threats:7},{week:`S2`,scans:295,threats:9},{week:`S3`,scans:340,threats:11},{week:`S4`,scans:332,threats:7}]};function LV({config:e,preview:a,isGenerating:o=!1,generationProgress:c=0,onGenerate:u,onSchedule:d,onSendEmail:p,className:m}){let[h,g]=(0,s.useState)({...FV,...e}),[_]=(0,s.useState)(a||IV),[v,y]=(0,s.useState)(``),[b,x]=(0,s.useState)(`config`),S={pdf:(0,f.jsx)(l.FileText,{className:`h-4 w-4`}),csv:(0,f.jsx)(l.FileSpreadsheet,{className:`h-4 w-4`}),json:(0,f.jsx)(l.FileJson,{className:`h-4 w-4`})},C={executive_summary:`Résumé exécutif`,detailed:`Détail complet`,iso27001_compliance:`Conformité ISO27001`,hds_audit:`Audit HDS`},w={critical:`bg-red-500`,high:`bg-orange-500`,medium:`bg-yellow-500`,low:`bg-blue-500`},T=(e,t)=>{g({...h,includeSections:{...h.includeSections,[e]:t}})},E=Math.max(..._.threatsBySeverity.map(e=>e.count)),D=Math.max(..._.weeklyTrend.map(e=>Math.max(e.scans,e.threats)));return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Générateur de rapports`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Créez des rapports de scan personnalisés pour vos audits de sécurité`})]}),(0,f.jsxs)(n.x,{variant:`outline`,className:`gap-1.5`,children:[(0,f.jsx)(l.Shield,{className:`h-3.5 w-3.5`}),`ISO27001 / HDS`]})]}),(0,f.jsxs)(Cr,{value:b,onValueChange:x,children:[(0,f.jsxs)(wr,{children:[(0,f.jsx)(Tr,{value:`config`,children:`Configuration`}),(0,f.jsx)(Tr,{value:`preview`,children:`Aperçu`})]}),(0,f.jsxs)(Er,{value:`config`,className:`space-y-6`,children:[(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Période du rapport`}),(0,f.jsx)(Se,{children:`Sélectionnez la plage de dates à analyser`})]}),(0,f.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`startDate`,children:`Date de début`}),(0,f.jsx)(r.n,{id:`startDate`,type:`date`,value:h.startDate.toISOString().split(`T`)[0],onChange:e=>g({...h,startDate:new Date(e.target.value)})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`endDate`,children:`Date de fin`}),(0,f.jsx)(r.n,{id:`endDate`,type:`date`,value:h.endDate.toISOString().split(`T`)[0],onChange:e=>g({...h,endDate:new Date(e.target.value)})})]})]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Type et format`}),(0,f.jsx)(Se,{children:`Choisissez le type de rapport et le format de sortie`})]}),(0,f.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`reportType`,children:`Type de rapport`}),(0,f.jsxs)(n.d,{value:h.type,onValueChange:e=>g({...h,type:e}),children:[(0,f.jsx)(n.y,{id:`reportType`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(C).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t},e))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`format`,children:`Format de sortie`}),(0,f.jsxs)(n.d,{value:h.format,onValueChange:e=>g({...h,format:e}),children:[(0,f.jsx)(n.y,{id:`format`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`pdf`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.pdf,`PDF`]})}),(0,f.jsx)(n.m,{value:`csv`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.csv,`CSV`]})}),(0,f.jsx)(n.m,{value:`json`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.json,`JSON`]})})]})]})]})]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Sections à inclure`}),(0,f.jsx)(Se,{children:`Personnalisez le contenu du rapport`})]}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`generalStats`,checked:h.includeSections.generalStats,onCheckedChange:e=>T(`generalStats`,e)}),(0,f.jsx)(i.o,{htmlFor:`generalStats`,className:`cursor-pointer`,children:`Statistiques générales`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`threatDetails`,checked:h.includeSections.threatDetails,onCheckedChange:e=>T(`threatDetails`,e)}),(0,f.jsx)(i.o,{htmlFor:`threatDetails`,className:`cursor-pointer`,children:`Détails des menaces détectées`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`scannedFiles`,checked:h.includeSections.scannedFiles,onCheckedChange:e=>T(`scannedFiles`,e)}),(0,f.jsx)(i.o,{htmlFor:`scannedFiles`,className:`cursor-pointer`,children:`Liste des fichiers scannés`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`actionsTaken`,checked:h.includeSections.actionsTaken,onCheckedChange:e=>T(`actionsTaken`,e)}),(0,f.jsx)(i.o,{htmlFor:`actionsTaken`,className:`cursor-pointer`,children:`Actions prises`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`recommendations`,checked:h.includeSections.recommendations,onCheckedChange:e=>T(`recommendations`,e)}),(0,f.jsx)(i.o,{htmlFor:`recommendations`,className:`cursor-pointer`,children:`Recommandations`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,f.jsxs)(r.r,{className:`flex-1`,onClick:()=>u?.(h),disabled:o,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Générer le rapport`]}),(0,f.jsxs)(r.r,{variant:`outline`,className:`flex-1`,onClick:()=>d?.(h,`weekly`),disabled:o,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),`Planifier génération`]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Envoi par email`}),(0,f.jsx)(Se,{children:`Envoyez le rapport directement par email`})]}),(0,f.jsxs)(Q,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`email@example.com`,type:`email`,value:v,onChange:e=>y(e.target.value),className:`flex-1`}),(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>p?.(h,v),disabled:!v||o,children:[(0,f.jsx)(l.Mail,{className:`h-4 w-4 mr-2`}),`Envoyer`]})]})]}),o&&(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Génération en cours...`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[c,`%`]})]}),(0,f.jsx)(Zn,{value:c})]})})})]}),(0,f.jsxs)(Er,{value:`preview`,className:`space-y-6`,children:[(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center mb-3`,children:(0,f.jsx)(l.Shield,{className:`h-6 w-6 text-white`})}),(0,f.jsx)(`h3`,{className:`text-xl font-bold`,children:`Rapport de scan de sécurité`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:C[h.type]})]}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[h.startDate.toLocaleDateString(),` -`,` `,h.endDate.toLocaleDateString()]})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Généré le `,new Date().toLocaleString()]})]})})}),h.includeSections.generalStats&&(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.BarChart3,{className:`h-4 w-4`}),`Total scans`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.totalScans.toLocaleString()})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Menaces détectées`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.totalThreats})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.TrendingUp,{className:`h-4 w-4`}),`Taux de détection`]}),(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[_.detectionRate,`%`]})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),`Fichiers en quarantaine`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.quarantinedFiles})]})})})]}),h.includeSections.threatDetails&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Menaces par sévérité`}),(0,f.jsx)(Se,{children:`Distribution des menaces détectées`})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:_.threatsBySeverity.map(e=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`capitalize font-medium`,children:e.severity}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.count})]}),(0,f.jsx)(`div`,{className:`h-2 bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:t.t(`h-full rounded-full`,w[e.severity]),style:{width:`${e.count/E*100}%`}})})]},e.severity))})]}),h.includeSections.generalStats&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Tendance hebdomadaire`}),(0,f.jsx)(Se,{children:`Évolution des scans et menaces`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`flex items-end gap-4 h-48`,children:_.weeklyTrend.map(e=>(0,f.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`flex-1 w-full flex items-end gap-1`,children:[(0,f.jsx)(`div`,{className:`flex-1 bg-blue-500 rounded-t`,style:{height:`${e.scans/D*100}%`},title:`Scans: ${e.scans}`}),(0,f.jsx)(`div`,{className:`flex-1 bg-orange-500 rounded-t`,style:{height:`${e.threats/D*100}%`},title:`Menaces: ${e.threats}`})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.week})]},e.week))}),(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-6 text-xs`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-3 w-3 rounded bg-blue-500`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Scans`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-3 w-3 rounded bg-orange-500`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Menaces`})]})]})]})})]}),(h.type===`iso27001_compliance`||h.type===`hds_audit`)&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Vérifications de conformité`}),(0,f.jsx)(Se,{children:h.type===`iso27001_compliance`?`Conformité ISO27001`:`Audit HDS`})]}),(0,f.jsx)(Q,{className:`space-y-3`,children:_.complianceChecks.map((e,t)=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border bg-card`,children:[e.passed?(0,f.jsx)(l.CheckCircle2,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,f.jsx)(l.XCircle,{className:`h-5 w-5 text-red-500 mt-0.5`}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.details})]}),(0,f.jsx)(n.x,{variant:e.passed?`default`:`destructive`,className:e.passed?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:e.passed?`Conforme`:`Non conforme`})]},t))})]}),h.includeSections.recommendations&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Recommandations`}),(0,f.jsx)(Se,{children:`Actions suggérées pour améliorer la sécurité`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`ul`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Augmenter la fréquence des scans pour les répertoires critiques`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Mettre à jour les signatures de virus (dernière mise à jour: il y a 2h)`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Configurer des alertes en temps réel pour les menaces critiques`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Réviser la politique de quarantaine automatique`})]})]})})]})]})]})]})}exports.AD_SIZES=Hj,exports.APMOverview=mB,exports.Accordion=q,exports.AccordionContent=te,exports.AccordionItem=ee,exports.AccordionTrigger=J,exports.ActorBadge=SP,exports.ActorsList=LP,exports.AdmincrumbProvider=nF,exports.AiAssistantButton=PP,exports.Alert=me,exports.AlertDescription=ge,exports.AlertDialog=ne,exports.AlertDialogAction=de,exports.AlertDialogCancel=fe,exports.AlertDialogContent=oe,exports.AlertDialogDescription=ue,exports.AlertDialogFooter=ce,exports.AlertDialogHeader=se,exports.AlertDialogOverlay=ae,exports.AlertDialogPortal=ie,exports.AlertDialogTitle=le,exports.AlertDialogTrigger=re,exports.AlertTitle=he,exports.AntivirusDashboard=ZB,exports.AspectRatio=_e,exports.Auth2FA=wR,exports.Avatar=ve,exports.AvatarFallback=be,exports.AvatarImage=ye,exports.Badge=n.x,exports.BlockEmptyState=PI,exports.BlockLanguageSelector=lF,exports.Blockquote=ui,exports.Button=r.r,exports.CHART_SIZE_MAP=a.t,exports.CICDBuilder=gz,exports.COUNTRIES=cD,exports.Calendar=xe,exports.Card=Y,exports.CardContent=Q,exports.CardDescription=Se,exports.CardFooter=Ce,exports.CardHeader=X,exports.CardTitle=Z,exports.ChatInterface=NR,exports.Checkbox=we,exports.CheckoutFlow=aR,exports.CheckoutNavigation=Jx,exports.CheckoutProgressBar=Yx,exports.ClamAVServiceStatus=gV,exports.CloudCostDashboard=Kz,exports.Code=ft,exports.Collapsible=pt,exports.CollapsibleContent=ht,exports.CollapsibleTrigger=mt,exports.Command=Et,exports.CommandDialog=Dt,exports.CommandEmpty=At,exports.CommandGroup=jt,exports.CommandInput=Ot,exports.CommandItem=Nt,exports.CommandList=kt,exports.CommandSeparator=Mt,exports.CommandShortcut=Pt,exports.ContainerOrchestrator=wB,exports.ContextMenu=Ft,exports.ContextMenuCheckboxItem=Gt,exports.ContextMenuContent=Ut,exports.ContextMenuGroup=Lt,exports.ContextMenuItem=Wt,exports.ContextMenuLabel=qt,exports.ContextMenuPortal=Rt,exports.ContextMenuRadioGroup=Bt,exports.ContextMenuRadioItem=Kt,exports.ContextMenuSeparator=Jt,exports.ContextMenuShortcut=Yt,exports.ContextMenuSub=zt,exports.ContextMenuSubContent=Ht,exports.ContextMenuSubTrigger=Vt,exports.ContextMenuTrigger=It,exports.DEFAULT_CHART_COLORS=a.n,exports.DashboardKPI=eR,exports.DataTable=Oi,exports.DataTableAdvanced=Fi,exports.DataTableColumnResizer=Ii,exports.DataTableContextMenu=Bi,exports.DataTableEditCell=Ei,exports.DataTableFilters=Ti,exports.DataTableGroupTotals=Ri,exports.DataTableGrouping=Li,exports.DataTableGroupingControls=zi,exports.DataTablePagination=wi,exports.DataTableSelection=Vi,exports.DataTableToolbar=Ci,exports.DatabaseAdmin=LB,exports.DeploymentDashboard=GR,exports.Dialog=gt,exports.DialogClose=yt,exports.DialogContent=xt,exports.DialogDescription=Tt,exports.DialogFooter=Ct,exports.DialogHeader=St,exports.DialogOverlay=bt,exports.DialogPortal=vt,exports.DialogTitle=wt,exports.DialogTrigger=_t,exports.DocumentFlyover=NP,exports.DocumentPreviewPopup=MP,exports.DrawerBody=Ra,exports.DrawerClose=Ga,exports.DrawerDescription=Va,exports.DrawerFooter=za,exports.DrawerHeader=La,exports.DrawerTitle=Ba,exports.DrawerTrigger=Wa,exports.DropdownMenu=Xt,exports.DropdownMenuCheckboxItem=on,exports.DropdownMenuContent=an,exports.DropdownMenuGroup=Qt,exports.DropdownMenuItem=$,exports.DropdownMenuLabel=cn,exports.DropdownMenuPortal=$t,exports.DropdownMenuRadioGroup=tn,exports.DropdownMenuRadioItem=sn,exports.DropdownMenuSeparator=ln,exports.DropdownMenuShortcut=un,exports.DropdownMenuSub=en,exports.DropdownMenuSubContent=rn,exports.DropdownMenuSubTrigger=nn,exports.DropdownMenuTrigger=Zt,exports.EmptyCartState=zI,exports.Error403Page=qI,exports.Error404Page=GI,exports.Error500Page=KI,exports.ErrorState=VI,exports.FileScanUploader=iV,exports.Footer=oF,exports.Form=dn,exports.FormControl=vn,exports.FormDescription=yn,exports.FormField=pn,exports.FormItem=gn,exports.FormLabel=_n,exports.FormMessage=bn,exports.GitOpsSyncStatus=iB,exports.Heading=ci,exports.Headtab=sF,exports.HeadtabBreadcrumb=cF,exports.HourBalanceBadge=bP,exports.HourConsumptionTable=VP,exports.HourPackDialog=BP,exports.HoverCard=xn,exports.HoverCardContent=Cn,exports.HoverCardTrigger=Sn,exports.IncidentManager=tz,exports.InfrastructureMap=uz,exports.Input=r.n,exports.InputOTP=wn,exports.KPICard=uE,exports.Kbd=fi,exports.Label=i.o,exports.LanguageProvider=UP,exports.LanguageSelector=Tn,exports.Layout=uF,exports.LegacyThemeProvider=KP,exports.Login=dF,exports.MaintenancePage=JI,exports.Menubar=jn,exports.MenubarCheckboxItem=Ln,exports.MenubarContent=Fn,exports.MenubarGroup=Dn,exports.MenubarItem=In,exports.MenubarLabel=zn,exports.MenubarMenu=En,exports.MenubarPortal=On,exports.MenubarRadioGroup=An,exports.MenubarRadioItem=Rn,exports.MenubarSeparator=Bn,exports.MenubarShortcut=Vn,exports.MenubarSub=kn,exports.MenubarSubContent=Pn,exports.MenubarSubTrigger=Nn,exports.MenubarTrigger=Mn,exports.ModalBody=uo,exports.ModalContent=oo,exports.ModalDescription=lo,exports.ModalFooter=fo,exports.ModalHeader=so,exports.ModalOverlay=ao,exports.ModalTitle=co,exports.NavigationMenu=Hn,exports.NavigationMenuContent=qn,exports.NavigationMenuIndicator=Xn,exports.NavigationMenuItem=Wn,exports.NavigationMenuLink=Jn,exports.NavigationMenuList=Un,exports.NavigationMenuTrigger=Kn,exports.NavigationMenuViewport=Yn,exports.NoDataState=FI,exports.NoFilesState=RI,exports.NoMessagesState=LI,exports.NoNotificationsState=BI,exports.NoResultsState=II,exports.OfflinePage=YI,exports.OnCallScheduleBlock=Nz,exports.POINTS_PRESETS=yy,exports.PlayerProfile=hR,exports.Popover=i.r,exports.PopoverContent=i.i,exports.PopoverTrigger=i.a,exports.Progress=Zn,exports.ProjectStatsHeader=zP,exports.QuarantineManager=cV,exports.RadioGroup=Qn,exports.RadioGroupItem=$n,exports.ReleaseNotes=Cz,exports.ScanHistoryLog=uV,exports.ScanPolicyEditor=kV,exports.ScanReportGenerator=LV,exports.ScrollArea=er,exports.ScrollBar=tr,exports.Select=n.d,exports.SelectContent=n.f,exports.SelectGroup=n.p,exports.SelectItem=n.m,exports.SelectLabel=n.h,exports.SelectScrollDownButton=n.g,exports.SelectScrollUpButton=n._,exports.SelectSeparator=n.v,exports.SelectTrigger=n.y,exports.SelectValue=n.b,exports.Separator=r.t,exports.SessionCard=GS,exports.SessionConfirmDialog=WS,exports.Sheet=nr,exports.SheetClose=ir,exports.SheetContent=cr,exports.SheetDescription=fr,exports.SheetFooter=ur,exports.SheetHeader=lr,exports.SheetOverlay=or,exports.SheetPortal=ar,exports.SheetTitle=dr,exports.SheetTrigger=rr,exports.SidebarLayout=bF,exports.SignatureDatabaseManager=TV,exports.Skeleton=a.m,exports.Slider=pr,exports.StepCommentBubble=CP,exports.StepCommentPanel=wP,exports.StepPermissionMatrix=FP,exports.StepperNavigation=Qo,exports.SuggestionDropdown=ND,exports.Switch=mr,exports.Table=hr,exports.TableBody=_r,exports.TableCaption=Sr,exports.TableCell=xr,exports.TableFooter=vr,exports.TableHead=br,exports.TableHeader=gr,exports.TableRow=yr,exports.Tabs=Cr,exports.TabsContent=Er,exports.TabsList=wr,exports.TabsTrigger=Tr,exports.TagChip=MD,exports.Text=oi,exports.Textarea=i.n,exports.ThemeLoader=it,exports.ThemeProvider=Or,exports.ThemeSelector=jr,exports.ThreatAlertBanner=NV,exports.TimeEntryDialog=TP,exports.TimeTrackingFlyover=EP,exports.Toast=Fr,exports.ToastAction=Ir,exports.ToastClose=Lr,exports.ToastDescription=zr,exports.ToastProvider=Mr,exports.ToastTitle=Rr,exports.ToastViewport=Nr,exports.Toaster=Qr,exports.Toggle=ei,exports.Tooltip=ni,exports.TooltipContent=ii,exports.TooltipProvider=ti,exports.TooltipTrigger=ri,exports.Waka3DPieChart=_l,exports.WakaAchievementBadge=Cd,exports.WakaAchievementGrid=wd,exports.WakaAchievementUnlock=Sd,exports.WakaActivityFeed=Xv,exports.WakaActivityTimeline=tI,exports.WakaAdBanner=Qj,exports.WakaAdFallback=Xj,exports.WakaAdInline=eM,exports.WakaAdInterstitial=tM,exports.WakaAdPlaceholder=Yj,exports.WakaAdProvider=Jj,exports.WakaAdSidebar=$j,exports.WakaAdStickyFooter=nM,exports.WakaAddressAutocomplete=sD,exports.WakaAdmincrumb=Yi,exports.WakaAlertPanel=Bk,exports.WakaAlertStack=jg,exports.WakaAllocationMatrix=Kh,exports.WakaAppDock=yp,exports.WakaApprovalChain=lg,exports.WakaAreaChart=a.c,exports.WakaArtifactList=LA,exports.WakaAsyncButton=vc,exports.WakaAuditLog=gC,exports.WakaAutocomplete=Zi,exports.WakaAutocompleteForm=Qi,exports.WakaBadgeShowcase=p_,exports.WakaBadgeShowcaseCompact=m_,exports.WakaBadgeShowcaseHero=g_,exports.WakaBadgeShowcaseList=h_,exports.WakaBadgeStats=__,exports.WakaBarChart=a.u,exports.WakaBarcode=oa,exports.WakaBiometricPrompt=UC,exports.WakaBottomSheet=ec,exports.WakaBreadcrumb=la,exports.WakaBreadcrumbPath=rl,exports.WakaBudgetBurn=Pu,exports.WakaBuildMatrix=SA,exports.WakaCalendarView=pI,exports.WakaCapacityPlanner=Mh,exports.WakaCarousel=da,exports.WakaCartSummary=Lx,exports.WakaChallengeTimer=ev,exports.WakaChallengeTimerSkeleton=tv,exports.WakaChart=a.d,exports.WakaChat=OI,exports.WakaChatBubble=bw,exports.WakaChatDateSeparator=Sw,exports.WakaChatSystemMessage=Cw,exports.WakaChatTypingIndicator=xw,exports.WakaChatWidget=vI,exports.WakaChecklist=BO,exports.WakaCheckoutStepper=Xx,exports.WakaCohortTable=nE,exports.WakaColorPicker=ya,exports.WakaColorPickerForm=ba,exports.WakaComboCounter=Fd,exports.WakaCombobox=Sa,exports.WakaCommandBar=ep,exports.WakaCompactDailyReward=T_,exports.WakaCompactGoalProgress=wE,exports.WakaCompactLevelProgress=Vd,exports.WakaComparePeriod=yx,exports.WakaConfigComparator=pj,exports.WakaConnectionMatrix=Sg,exports.WakaContainerList=Kk,exports.WakaContentRecommendation=aM,exports.WakaContributionGraph=cu,exports.WakaCostBreakdown=Su,exports.WakaCouponInput=$x,exports.WakaCpuGauge=Dl,exports.WakaCreditActivityFeed=dN,exports.WakaCreditAlert=VM,exports.WakaCreditBalance=gM,exports.WakaCreditBreakdown=zN,exports.WakaCreditBurnRate=ON,exports.WakaCreditCardInput=AD,exports.WakaCreditHistory=iN,exports.WakaCreditMeter=DM,exports.WakaCreditPricingPack=QN,exports.WakaCreditProjection=qN,exports.WakaCreditQuota=LM,exports.WakaCreditReceipt=mP,exports.WakaCreditTopUp=oP,exports.WakaCreditTransaction=KM,exports.WakaCreditTransferForm=_P,exports.WakaCreditUsageChart=yN,exports.WakaDailyReward=w_,exports.WakaDashboard=kF,exports.WakaDatabaseCard=wj,exports.WakaDateRangePicker=Ta,exports.WakaDateTimePicker=ja,exports.WakaDateTimePickerForm=Ma,exports.WakaDependencyTree=ZA,exports.WakaDeploymentLane=$h,exports.WakaDeviceTrust=sw,exports.WakaDocBreadcrumb=n.r,exports.WakaDocCallout=n.u,exports.WakaDocCodeBlock=n.l,exports.WakaDocNav=n.s,exports.WakaDocRenderer=n.t,exports.WakaDocSearch=n.o,exports.WakaDocTable=n.n,exports.WakaDocToc=n.c,exports.WakaDocToolbar=n.i,exports.WakaDocVersion=n.a,exports.WakaDock=_p,exports.WakaDrawer=Ha,exports.WakaEmptyState=qO,exports.WakaEmptyStateError=YO,exports.WakaEmptyStateSearch=JO,exports.WakaEnvVarEditor=ej,exports.WakaErrorPage=WI,exports.WakaErrorShake=ed,exports.WakaFAQ=$I,exports.WakaFeatureAnnouncement=ak,exports.WakaFeatureFlagRow=_j,exports.WakaFileManager=oL,exports.WakaFileUpload=Ja,exports.WakaFloatingDock=vp,exports.WakaFloatingNav=Qc,exports.WakaFlowDiagram=Sp,exports.WakaFormFieldShake=nd,exports.WakaFunnelChart=VT,exports.WakaFunnelChartCompact=UT,exports.WakaFunnelChartSimple=HT,exports.WakaGlowCard=op,exports.WakaGlowCardDanger=up,exports.WakaGlowCardPrimary=sp,exports.WakaGlowCardRainbow=dp,exports.WakaGlowCardSuccess=cp,exports.WakaGlowCardWarning=lp,exports.WakaGlowGrid=fp,exports.WakaGoalCard=TE,exports.WakaGoalProgress=CE,exports.WakaHapticButton=oc,exports.WakaHapticIconButton=sc,exports.WakaHeader=xF,exports.WakaHealthPulse=hm,exports.WakaHeatmap=PE,exports.WakaHotspot=OO,exports.WakaHotspotGroup=AO,exports.WakaI18nEditor=JL,exports.WakaImage=Ya,exports.WakaImageGallery=Xa,exports.WakaIncidentTimeline=Ym,exports.WakaInvoicePreview=DS,exports.WakaKPIDashboard=dE,exports.WakaKanban=eo,exports.WakaKanbanBoard=fL,exports.WakaKubernetesOverview=$k,exports.WakaLanding=SL,exports.WakaLeaderboard=Jd,exports.WakaLevelBadge=zd,exports.WakaLevelProgress=Bd,exports.WakaLineChart=a.l,exports.WakaLiquidButton=Tc,exports.WakaLiquidButtonDestructive=Oc,exports.WakaLiquidButtonGradient=Ac,exports.WakaLiquidButtonNeon=jc,exports.WakaLiquidButtonPrimary=Ec,exports.WakaLiquidButtonSecondary=Dc,exports.WakaLiquidButtonSuccess=kc,exports.WakaLoadingOrbit=ld,exports.WakaLoadingOrbitAtom=pd,exports.WakaLoadingOrbitGalaxy=hd,exports.WakaLoadingOrbitMinimal=md,exports.WakaLoadingOrbitSimple=dd,exports.WakaLoadingOrbitSolar=fd,exports.WakaLogViewer=Ok,exports.WakaLootBox=P_,exports.WakaMagicLink=hp,exports.WakaMagneticButton=zc,exports.WakaMagneticIconButton=Bc,exports.WakaMagneticLink=Vc,exports.WakaMentionInput=ax,exports.WakaMetricSparkline=Cm,exports.WakaMigrationList=jj,exports.WakaMilestoneRoad=cf,exports.WakaMiniChart=a.a,exports.WakaMiniLeaderboard=Yd,exports.WakaMiniStreak=pf,exports.WakaModal=po,exports.WakaModalTrigger=mo,exports.WakaMorphButton=gc,exports.WakaMultiQuotaBar=hh,exports.WakaNetworkGauge=Al,exports.WakaNetworkTopology=um,exports.WakaNotifications=Co,exports.WakaNumberInput=Do,exports.WakaOrbitalMenu=dl,exports.WakaOrbitalMenuCompact=fl,exports.WakaOrderTracker=pS,exports.WakaOutstreamVideo=sM,exports.WakaPagination=Ao,exports.WakaPasswordStrength=IS,exports.WakaPasswordStrengthIndicator=LS,exports.WakaPaymentMethodPicker=Tb,exports.WakaPaymentMethodPickerCards=Ob,exports.WakaPaymentMethodPickerCompact=Ab,exports.WakaPaymentMethodPickerRadio=kb,exports.WakaPermissionMatrix=rC,exports.WakaPhoneInput=_D,exports.WakaPieChart=a.s,exports.WakaPipelineView=Ap,exports.WakaPlayerCard=Iy,exports.WakaPodCard=uA,exports.WakaPodium=Kd,exports.WakaPointsPopup=_y,exports.WakaPowerUp=ly,exports.WakaPowerUpList=dy,exports.WakaPresenceAvatarStack=mb,exports.WakaPresenceCard=fb,exports.WakaPresenceIndicator=sb,exports.WakaPresenceLastSeen=db,exports.WakaPresenceList=pb,exports.WakaPresenceSelector=ub,exports.WakaPresenceStatusBadge=lb,exports.WakaPresenceWithAvatar=cb,exports.WakaPricing=PL,exports.WakaPricingTable=Dx,exports.WakaProductCard=Bb,exports.WakaProductCardSkeleton=Hb,exports.WakaProductGrid=Vb,exports.WakaProfile=zF,exports.WakaProgressOnboarding=uk,exports.WakaProvider=QP,exports.WakaPullToRefresh=qs,exports.WakaQRCode=No,exports.WakaQueryExplain=Bj,exports.WakaQuestCard=Tf,exports.WakaQuestCardSkeleton=Ef,exports.WakaQuestList=Df,exports.WakaQuotaBar=mh,exports.WakaRadarScore=ml,exports.WakaRadarScoreCompare=gl,exports.WakaRadarScoreSimple=hl,exports.WakaRamGauge=Ol,exports.WakaRankBadge=hv,exports.WakaRankBadgeGroup=gv,exports.WakaRatingDisplay=$D,exports.WakaRatingInput=ZD,exports.WakaReactionPicker=TT,exports.WakaRegionMap=Jp,exports.WakaResourceGauge=El,exports.WakaResourceGaugeGroup=jl,exports.WakaResourcePool=oh,exports.WakaResourcePoolComparison=sh,exports.WakaRichTextEditor=i.t,exports.WakaRollbackSlider=Bp,exports.WakaSLATracker=qg,exports.WakaSankeyDiagram=BE,exports.WakaSchedulePicker=gO,exports.WakaScratchCard=Nf,exports.WakaSeasonPass=eb,exports.WakaSecretCard=cj,exports.WakaSecurityScanResult=UA,exports.WakaSecurityScore=MC,exports.WakaSecurityScoreCompact=NC,exports.WakaSegmentedControl=Fo,exports.WakaServerRack=tm,exports.WakaServerRackDemo=nm,exports.WakaServiceGraph=gA,exports.WakaSessionManager=KS,exports.WakaSettings=NF,exports.WakaSidebar=vF,exports.WakaSignaturePad=QE,exports.WakaSkeletonAvatar=Yu,exports.WakaSkeletonCard=Xu,exports.WakaSkeletonGrid=Qu,exports.WakaSkeletonList=Zu,exports.WakaSkeletonText=qu,exports.WakaSkeletonWave=Gu,exports.WakaSkillTree=H_,exports.WakaSliderRange=GD,exports.WakaSparkline=a.o,exports.WakaSpinWheel=Dy,exports.WakaSpinner=Ro,exports.WakaSponsoredBadge=Zj,exports.WakaSponsoredCard=rM,exports.WakaSponsoredFeed=iM,exports.WakaSpotlight=ip,exports.WakaStat=Uo,exports.WakaStatGroup=Wo,exports.WakaStatsHexagon=Vy,exports.WakaStatsHexagonRPG=Uy,exports.WakaStatsHexagonSimple=Hy,exports.WakaStatsHexagonSkills=Wy,exports.WakaStatusMatrix=ql,exports.WakaStepper=Zo,exports.WakaStorageGauge=kl,exports.WakaStreakCounter=ff,exports.WakaSuccessExplosion=Bu,exports.WakaSwipeCard=Rs,exports.WakaSwipeCardActions=Bs,exports.WakaTabPanel=ll,exports.WakaTabsMorph=sl,exports.WakaTagInput=FD,exports.WakaTeamBanner=zv,exports.WakaTeamBannerCompact=Bv,exports.WakaTeamBannerExpanded=Vv,exports.WakaTerminalOutput=Nm,exports.WakaTestReport=kA,exports.WakaThemeCreator=$o,exports.WakaThemeManager=ns,exports.WakaThreadView=lT,exports.WakaTiltCard=pp,exports.WakaTiltShowcaseCard=mp,exports.WakaTimePicker=us,exports.WakaTimeline=hs,exports.WakaTooltipTour=Tk,exports.WakaTourGuide=SO,exports.WakaTournamentBracket=Ov,exports.WakaTraceViewer=Pk,exports.WakaTree=bs,exports.WakaTreemapChart=JE,exports.WakaTwoFactorSetup=Qb,exports.WakaTypewriter=Kc,exports.WakaTypewriterCode=Yc,exports.WakaTypewriterHeading=qc,exports.WakaTypewriterLines=Jc,exports.WakaTypingIndicator=Fw,exports.WakaTypingIndicatorDots=Lw,exports.WakaTypingIndicatorPulse=zw,exports.WakaTypingIndicatorText=Rw,exports.WakaUserManagement=JF,exports.WakaVersusCard=Wf,exports.WakaVideo=Ds,exports.WakaVideoAd=oM,exports.WakaVideoCall=Qw,exports.WakaVideoOverlay=cM,exports.WakaVirtualList=As,exports.WakaVoiceMessage=MT,exports.WakaWelcomeModal=bo,exports.WakaWizard=VL,exports.WakaXPBar=r_,exports.addChildNode=ws,exports.applyTheme=lt,exports.badgeVariants=n.S,exports.blockquoteVariants=li,exports.calculateDuration=ze,exports.cn=t.t,exports.compareRanges=tt,exports.createBookingDateValidator=Ke,exports.createCardExpiryValidator=Ge,exports.createChartColumn=a.r,exports.createCommonPresets=Te,exports.createCustomPreset=Oe,exports.createHighlightRegex=Xf,exports.createLastDaysPresets=Ee,exports.createMaxAgeValidator=Le,exports.createMaxRangeDaysValidator=qe,exports.createMinAgeValidator=Ie,exports.createMonthlyPresets=Ze,exports.createNextDaysPresets=De,exports.createQuarterPresets=Xe,exports.createSafeRegex=Yf,exports.dateToTimestamp=Qe,exports.defaultAPMServices=hB,exports.defaultAPMTransactions=gB,exports.defaultAchievements=_R,exports.defaultActivities=rI,exports.defaultActivityFilters=nI,exports.defaultArtifacts=RA,exports.defaultAuth2FAStatus=ER,exports.defaultBackupCodes=TR,exports.defaultBadges=vR,exports.defaultBuildMatrixColumns=CA,exports.defaultBuildMatrixRows=wA,exports.defaultCalendarEvents=mI,exports.defaultCartItems=cR,exports.defaultCategories=jD,exports.defaultChatConversations=AI,exports.defaultChatInterfaceConversations=FR,exports.defaultChatInterfaceMessages=IR,exports.defaultChatInterfaceUsers=PR,exports.defaultChatMessages=jI,exports.defaultChatUser=kI,exports.defaultCloudCostItems=Jz,exports.defaultCloudCostSummary=qz,exports.defaultConfigEnvironments=mj,exports.defaultConnections=vA,exports.defaultContainers=qk,exports.defaultCostAnomalies=Yz,exports.defaultCoverage=jA,exports.defaultDashboardStats=AF,exports.defaultDatabase=Tj,exports.defaultDatabaseInstance=RB,exports.defaultDatabases=Ej,exports.defaultDependencies=QA,exports.defaultDeployments=KR,exports.defaultEnvVariables=tj,exports.defaultEnvironments=JR,exports.defaultFAQCategories=eL,exports.defaultFAQItems=tL,exports.defaultFeatureFlags=vj,exports.defaultFeatures=Ax,exports.defaultFileManagerBreadcrumbs=cL,exports.defaultFiles=sL,exports.defaultGitOpsApplications=aB,exports.defaultGoals=nR,exports.defaultIncidents=nz,exports.defaultInfraResources=dz,exports.defaultK8sDeployments=nA,exports.defaultK8sNamespaces=iA,exports.defaultK8sNodes=eA,exports.defaultK8sPods=tA,exports.defaultK8sServices=rA,exports.defaultKPIMetrics=tR,exports.defaultKanbanColumns=pL,exports.defaultKanbanLabels=mL,exports.defaultLandingCTA=DL,exports.defaultLandingFeatures=wL,exports.defaultLandingHero=EL,exports.defaultLandingNavItems=CL,exports.defaultLandingTestimonials=TL,exports.defaultLogs=kk,exports.defaultMatchHistory=yR,exports.defaultMigrations=Mj,exports.defaultOnCallSchedule=Iz,exports.defaultOrchestratorServices=EB,exports.defaultPanelAlerts=Vk,exports.defaultPaymentMethods=sR,exports.defaultPermissions=XF,exports.defaultPipeline=_z,exports.defaultPipelines=qR,exports.defaultPlayerStats=gR,exports.defaultPodDetails=dA,exports.defaultPresets=wa,exports.defaultPricingFAQ=IL,exports.defaultPricingPlans=FL,exports.defaultProfileData=BF,exports.defaultQueryPlan=Vj,exports.defaultRecentScans=QB,exports.defaultReleases=Tz,exports.defaultScanPolicy=EV,exports.defaultSecret=lj,exports.defaultServices=_A,exports.defaultSettingsTabs=PF,exports.defaultShippingMethods=oR,exports.defaultTestSuites=AA,exports.defaultThreatAlerts=PV,exports.defaultTiers=kx,exports.defaultTopThreats=eV,exports.defaultTraceSpans=Fk,exports.defaultUsers=YF,exports.defaultVulnerabilities=WA,exports.defaultWeeklyStats=$B,exports.defaultWelcomeSteps=go,exports.defaultWizardSteps=HL,exports.escapeHtml=Zf,exports.escapeRegex=Jf,exports.exportToCSV=mi,exports.exportToJSON=hi,exports.findNodeById=xs,exports.formatCurrency=gS,exports.formatDate=_S,exports.formatDateRange=Be,exports.formatMinutes=vP,exports.formatPhoneNumber=lD,exports.formatSize=jP,exports.getCountryByCode=pD,exports.getCountryByDialCode=mD,exports.getDatesInMonth=He,exports.getFrenchHolidays=Ve,exports.getThemeLoader=st,exports.getWeekdaysInMonth=We,exports.getWeekendsInMonth=Ue,exports.getWorkingDays=Ye,exports.headingVariants=si,exports.initThemeLoader=ot,exports.isDateInRange=Fe,exports.isFutureDate=ke,exports.isHoliday=Pe,exports.isNotExpired=Re,exports.isPastDate=Ae,exports.isSameDay=Je,exports.isToday=je,exports.isWeekday=Me,exports.isWeekend=Ne,exports.kbdVariants=di,exports.loadTableState=vi,exports.loadTheme=ct,exports.mergeRanges=nt,exports.moveNode=Ts,exports.navigationMenuTriggerStyle=Gn,exports.normalizeDate=et,exports.orbitPresets=ud,exports.parseCSV=gi,exports.rangesOverlap=rt,exports.reducer=Kr,exports.removeNode=Cs,exports.safeNavigate=qf,exports.sanitizeUrl=Kf,exports.saveTableState=_i,exports.sparklineTemplate=a.i,exports.textVariants=ai,exports.themeManagerVariants=ts,exports.timestampToDate=$e,exports.toast=Xr,exports.toggleVariants=$r,exports.tweak=t.n,exports.unformatPhoneNumber=uD,exports.updateNode=Ss,exports.useAchievements=Td,exports.useActivityFeed=Zv,exports.useAdConsent=Kj,exports.useAdContext=Wj,exports.useAdSlot=qj,exports.useAdVisibility=Gj,exports.useAddressAutocomplete=nD,exports.useAdmincrumb=Xi,exports.useAdmincrumbContext=rF,exports.useAdmincrumbContextOptional=iF,exports.useAlertStack=Og,exports.useAllocationMatrix=Vh,exports.useAuditLog=_C,exports.useBiometricPrompt=PC,exports.useBottomSheet=tc,exports.useBreadcrumbFromPath=ua,exports.useBreadcrumbPath=il,exports.useBudgetBurn=Fu,exports.useCapacityPlanner=Dh,exports.useCartSummary=Rx,exports.useChallengeTimer=W_,exports.useChartTheme=a.f,exports.useChatWidget=yI,exports.useChecklist=FO,exports.useCheckoutStepper=Bx,exports.useCheckoutStepperContext=Hx,exports.useCohortTable=rE,exports.useComboCounter=Id,exports.useCombobox=Ca,exports.useCommandBar=np,exports.useComparePeriod=bx,exports.useConnectionMatrix=hg,exports.useCostBreakdown=Cu,exports.useCouponInput=Zx,exports.useCreditCardInput=kD,exports.useDailyRewards=E_,exports.useDataTable=bi,exports.useDataTableAdvanced=ki,exports.useDataTableEdit=Si,exports.useDataTableExport=o.n,exports.useDataTableImport=o.t,exports.useDataTableSelection=Hi,exports.useDataTableTheme=Pi,exports.useDataTableVirtualization=Ni,exports.useDateForm=Na,exports.useDateRangePicker=Ea,exports.useDeploymentLane=eg,exports.useDeviceTrust=cw,exports.useDrawer=Ua,exports.useEmptyState=XO,exports.useErrorShake=td,exports.useFeatureAnnouncement=ok,exports.useFloatingNav=$c,exports.useFlowDiagram=Cp,exports.useFormField=mn,exports.useFunnelChart=NT,exports.useGoalProgress=yE,exports.useHeatmap=kE,exports.useHotspot=kO,exports.useInvoice=OS,exports.useKPIDashboard=fE,exports.useKanban=to,exports.useLanguage=WP,exports.useLeaderboard=Xd,exports.useLegacyTheme=ZP,exports.useLevelProgress=Hd,exports.useLoadingOrbit=gd,exports.useLootBox=N_,exports.useMagicLink=gp,exports.useMentionInput=ex,exports.useMilestoneRoad=lf,exports.useModal=ho,exports.useMorphButton=_c,exports.useNotifications=wo,exports.useNumberInput=Oo,exports.useOrbitalMenu=ul,exports.useOrderTracker=nS,exports.usePagination=jo,exports.usePasswordStrength=jS,exports.usePaymentMethodPicker=jb,exports.usePermissionMatrix=QS,exports.usePhoneInput=gD,exports.usePointsPopup=vy,exports.usePointsPopupWithPresets=by,exports.usePowerUp=uy,exports.usePresence=ib,exports.usePricingTable=Ox,exports.useProgressOnboarding=dk,exports.usePullToRefresh=Js,exports.useQRCode=Po,exports.useQuests=Of,exports.useQuota=gh,exports.useRadarScore=pl,exports.useRank=_v,exports.useRatingInput=QD,exports.useReactionPicker=_T,exports.useRechartsLoader=a.p,exports.useResourceGauge=Tl,exports.useResourcePool=ch,exports.useRollbackSlider=zp,exports.useSLATracker=Jg,exports.useSankeyDiagram=IE,exports.useSchedulePicker=uO,exports.useScratchCard=Af,exports.useSeasonPass=tb,exports.useSecurityScore=DC,exports.useSegmentedControl=Io,exports.useSessionManager=qS,exports.useSidebar=yF,exports.useSignaturePad=YE,exports.useSkillTree=U_,exports.useSliderRange=HD,exports.useSparklineData=wm,exports.useSpotlight=ap,exports.useStat=Go,exports.useStatsHexagon=By,exports.useStepperContext=qo,exports.useSuccessExplosion=Vu,exports.useTableLayout=xi,exports.useTabs=cl,exports.useTagInput=ID,exports.useTeamBanner=Nv,exports.useTerminalOutput=Pm,exports.useTheme=Ar,exports.useThemeLoader=ut,exports.useThreadView=uT,exports.useTimePicker=ds,exports.useToast=Zr,exports.useTooltipTour=Sk,exports.useTourGuide=_O,exports.useTournamentBracket=kv,exports.useTranslation=Aa,exports.useTreemapChart=HE,exports.useTwoFactorSetup=Gb,exports.useTypewriter=Wc,exports.useTypingIndicator=Iw,exports.useVersusCard=Gf,exports.useVideo=Os,exports.useVideoCall=$w,exports.useVirtualList=js,exports.useVoiceMessage=OT,exports.useWaka=eF,exports.useWelcomeModal=_o,exports.useWizard=RL,exports.useXPBar=i_;
2654
+ `})]})}var fN=[{value:`day`,label:`Day`},{value:`week`,label:`Week`},{value:`month`,label:`Month`},{value:`year`,label:`Year`}],pN=`#3b82f6`,mN=`#94a3b8`;function hN(e,t){return!t||t.length===0?e.map(e=>({date:e.date,value:e.value})):e.map((e,n)=>({date:e.date,value:e.value,compareValue:t[n]?.value}))}function gN(e){return e.toLocaleString(`en-US`)}function _N({active:e,payload:t,label:n,formatValue:r}){return!e||!t||t.length===0?null:(0,f.jsxs)(`div`,{className:`rounded-lg border bg-popover px-3 py-2 shadow-md`,children:[(0,f.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e.color}}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.name,`:`]}),(0,f.jsx)(`span`,{className:`font-semibold tabular-nums`,children:r(e.value)})]},e.dataKey))]})}function vN({period:e,onPeriodChange:n}){return(0,f.jsx)(`div`,{className:`mb-4 flex gap-1 rounded-lg bg-muted p-1`,children:fN.map(r=>(0,f.jsx)(`button`,{type:`button`,onClick:()=>n(r.value),className:t.t(`rounded-md px-3 py-1.5 text-xs font-medium transition-colors`,e===r.value?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value))})}function yN({data:e,compareWith:n,period:r=`month`,stacked:i=!1,height:a=300,showLegend:o=!1,showGrid:c=!0,animated:l=!0,color:u=pN,compareColor:d=mN,formatValue:p=gN,onPeriodChange:m,className:h}){let g=s.useMemo(()=>hN(e,n),[e,n]),_=s.useId(),v=s.useId(),y=`usage-gradient-${_.replace(/:/g,``)}`,b=`compare-gradient-${v.replace(/:/g,``)}`,x=n&&n.length>0;return(0,f.jsxs)(`div`,{className:t.t(`w-full`,h),children:[m&&(0,f.jsx)(vN,{period:r,onPeriodChange:m}),(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:a,children:(0,f.jsxs)(K.AreaChart,{data:g,margin:{top:4,right:4,left:0,bottom:0},children:[(0,f.jsxs)(`defs`,{children:[(0,f.jsxs)(`linearGradient`,{id:y,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:u,stopOpacity:.4}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:u,stopOpacity:.05})]}),x&&(0,f.jsxs)(`linearGradient`,{id:b,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:d,stopOpacity:.15}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:d,stopOpacity:.02})]})]}),c&&(0,f.jsx)(K.CartesianGrid,{strokeDasharray:`3 3`,vertical:!1,className:`stroke-border/50`}),(0,f.jsx)(K.XAxis,{dataKey:`date`,axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,dy:8}),(0,f.jsx)(K.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,tickFormatter:e=>p(e),width:60}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(_N,{formatValue:p}),cursor:{stroke:`hsl(var(--border))`,strokeWidth:1}}),o&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,align:`center`,wrapperStyle:{paddingTop:16},iconType:`circle`}),x&&(0,f.jsx)(K.Area,{dataKey:`compareValue`,name:`Previous Period`,type:`monotone`,stroke:d,strokeWidth:1.5,strokeDasharray:`6 3`,fill:`url(#${b})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:l,animationDuration:800,dot:!1,activeDot:{r:3,fill:d,stroke:`white`,strokeWidth:1.5}}),(0,f.jsx)(K.Area,{dataKey:`value`,name:`Current Period`,type:`monotone`,stroke:u,strokeWidth:2,fill:`url(#${y})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:l,animationDuration:800,dot:!1,activeDot:{r:4,fill:u,stroke:`white`,strokeWidth:2}})]})})]})}function bN(e){if(e.length===0)return 0;let t=e.slice(-7);return t.reduce((e,t)=>e+t.value,0)/t.length}function xN(e,t){return t<=0?1/0:Math.floor(e/t)}function SN(e){if(!isFinite(e)||e<=0)return null;let t=new Date;return t.setDate(t.getDate()+e),t}function CN(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function wN(e){return e<7?{stroke:`#ef4444`,text:`text-red-600`,bg:`bg-red-100 dark:bg-red-950`,label:`Critical`}:e<=30?{stroke:`#f59e0b`,text:`text-amber-600`,bg:`bg-amber-100 dark:bg-amber-950`,label:`Warning`}:{stroke:`#22c55e`,text:`text-green-600`,bg:`bg-green-100 dark:bg-green-950`,label:`Healthy`}}function TN({dailyUsage:e,avgBurnRate:n,width:r,height:i,showProjection:a,projectionDays:o,statusColor:c,animated:l}){let[u,d]=s.useState(0),[p,m]=s.useState(!l),h=s.useRef(null),g=r-4,_=i-4,v=e.length+(a?o:0),y=e.map(e=>e.value),b=a?Array.from({length:o},()=>n):[],x=[...y,...b],S=Math.min(...x,0),C=Math.max(...x,1)-S||1,w=e.map((e,t)=>`${2+t/(v-1)*g},${2+_-(e.value-S)/C*_}`),T=[];if(a&&e.length>0){let t=e.length-1,r=2+t/(v-1)*g,i=2+_-(e[t].value-S)/C*_;T.push(`${r},${i}`);for(let t=1;t<=o;t++){let r=2+(e.length-1+t)/(v-1)*g,i=2+_-(n-S)/C*_;T.push(`${r},${i}`)}}return s.useEffect(()=>{h.current&&d(h.current.getTotalLength())},[e]),s.useEffect(()=>{if(l&&u>0){let e=setTimeout(()=>m(!0),50);return()=>clearTimeout(e)}},[l,u]),e.length<2?(0,f.jsx)(`svg`,{width:r,height:i,children:(0,f.jsx)(`text`,{x:r/2,y:i/2,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Not enough data`})}):(0,f.jsxs)(`svg`,{width:r,height:i,className:`overflow-visible`,children:[(0,f.jsx)(`polyline`,{ref:h,points:w.join(` `),fill:`none`,stroke:c,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:l&&u>0?{strokeDasharray:u,strokeDashoffset:p?0:u,transition:`stroke-dashoffset 1s ease-out`}:void 0}),a&&T.length>1&&(0,f.jsx)(`polyline`,{points:T.join(` `),fill:`none`,stroke:c,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeDasharray:`4,3`,opacity:`0.5`,className:t.t(l&&`transition-opacity duration-500`,l&&(p?`opacity-50`:`opacity-0`))}),e.length>0&&(0,f.jsx)(`circle`,{cx:parseFloat(w[w.length-1].split(`,`)[0]),cy:parseFloat(w[w.length-1].split(`,`)[1]),r:`2.5`,fill:c,stroke:`white`,strokeWidth:`1`,className:t.t(l&&`transition-opacity duration-500`,l&&(p?`opacity-100`:`opacity-0`))})]})}function EN({dailyUsage:e,avgBurnRate:n,daysRemaining:r,width:i,height:a,showProjection:o,projectionDays:s,animated:c,className:l}){let u=wN(r);return(0,f.jsxs)(`div`,{className:t.t(`inline-flex items-center gap-2`,l),children:[(0,f.jsx)(TN,{dailyUsage:e,avgBurnRate:n,width:i,height:a,showProjection:o,projectionDays:s,statusColor:u.stroke,animated:c}),(0,f.jsx)(`span`,{className:t.t(`text-xs font-medium tabular-nums`,u.text),children:isFinite(r)?`${r}d`:`--`})]})}function DN({dailyUsage:e,balance:n,avgBurnRate:r,daysRemaining:i,depletionDate:a,width:o,height:s,showProjection:c,projectionDays:u,animated:d,className:p}){let m=wN(i);return(0,f.jsxs)(`div`,{className:t.t(`rounded-lg border bg-card p-4 space-y-4`,p),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(l.TrendingDown,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:`Credit Burn Rate`})]}),(0,f.jsx)(`div`,{className:t.t(`px-2 py-0.5 rounded-full text-xs font-medium`,m.bg,m.text),children:m.label})]}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(TN,{dailyUsage:e,avgBurnRate:r,width:o,height:s,showProjection:c,projectionDays:u,statusColor:m.stroke,animated:d})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Burn Rate`}),(0,f.jsx)(`div`,{className:`text-lg font-bold tabular-nums`,children:r.toFixed(1)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`credits/day`})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:`Days Left`})]}),(0,f.jsx)(`div`,{className:t.t(`text-lg font-bold tabular-nums`,m.text),children:isFinite(i)?i:`--`}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toLocaleString(),` credits`]})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Depleted By`}),(0,f.jsx)(`div`,{className:t.t(`text-sm font-semibold`,m.text),children:a?CN(a):`--`}),i<7&&isFinite(i)&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-red-600`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:`Critical`})]})]})]})]})}function ON({dailyUsage:e,balance:n,showProjection:r=!1,projectionDays:i=7,width:a=120,height:o=32,animated:c=!0,variant:l=`sparkline`,className:u}){let d=s.useMemo(()=>bN(e),[e]),p=s.useMemo(()=>xN(n,d),[n,d]),m=s.useMemo(()=>SN(p),[p]);return!e||e.length===0?(0,f.jsx)(`div`,{className:t.t(`inline-flex items-center gap-2 text-muted-foreground text-sm`,u),children:`No data`}):l===`card`?(0,f.jsx)(DN,{dailyUsage:e,balance:n,avgBurnRate:d,daysRemaining:p,depletionDate:m,width:Math.max(a,200),height:Math.max(o,48),showProjection:r,projectionDays:i,animated:c,className:u}):(0,f.jsx)(EN,{dailyUsage:e,avgBurnRate:d,daysRemaining:p,width:a,height:o,showProjection:r,projectionDays:i,animated:c,className:u})}var kN=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`,`hsl(var(--primary))`,`hsl(var(--info))`,`hsl(var(--warning))`,`hsl(var(--success))`,`hsl(var(--destructive))`];function AN(e){return e.map((e,t)=>({...e,color:e.color||kN[t%kN.length]}))}function jN(e){return e.reduce((e,t)=>e+t.value,0)}function MN(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function NN({active:e,payload:n,total:r,formatter:i}){if(!e||!n||!n.length)return null;let a=n[0],o=r>0?(a.value/r*100).toFixed(1):`0`;return(0,f.jsxs)(`div`,{className:t.t(`px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`pointer-events-none min-w-[140px]`),children:[(0,f.jsxs)(`div`,{className:`font-semibold mb-1 flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:a.payload.color}}),a.name]}),(0,f.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,f.jsx)(`span`,{className:`opacity-70`,children:`Value:`}),(0,f.jsx)(`span`,{className:`font-medium`,children:i(a.value)})]}),(0,f.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,f.jsx)(`span`,{className:`opacity-70`,children:`Share:`}),(0,f.jsxs)(`span`,{children:[o,`%`]})]})]})}function PN({cx:e,cy:t,midAngle:n,innerRadius:r,outerRadius:i,percent:a}){let o=Math.PI/180,s=r+(i-r)*.5+20,c=e+s*Math.cos(-n*o),l=t+s*Math.sin(-n*o);return a<.05?null:(0,f.jsx)(`text`,{x:c,y:l,fill:`currentColor`,textAnchor:c>e?`start`:`end`,dominantBaseline:`central`,className:`text-xs fill-foreground`,children:`${(a*100).toFixed(0)}%`})}function FN({viewBox:e,total:t,formatter:n}){if(!e)return null;let{cx:r,cy:i}=e;return(0,f.jsxs)(`g`,{children:[(0,f.jsx)(`text`,{x:r,y:i-10,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Total`}),(0,f.jsx)(`text`,{x:r,y:i+12,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-base font-bold fill-foreground`,children:n(t)})]})}function IN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.PieChart,{children:[(0,f.jsx)(K.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,outerRadius:n/2-40,isAnimationActive:r,animationDuration:800,label:i?PN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id))}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function LN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){let c=n/2-40;return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.PieChart,{children:[(0,f.jsxs)(K.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,innerRadius:c*.55,outerRadius:c,isAnimationActive:r,animationDuration:800,paddingAngle:2,label:i?PN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:[e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id)),(0,f.jsx)(FN,{total:t,formatter:o})]}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function RN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:n,children:(0,f.jsxs)(K.BarChart,{data:e.map(e=>({...e,percentage:t>0?(e.value/t*100).toFixed(1):`0`})),layout:`vertical`,barCategoryGap:`20%`,children:[(0,f.jsx)(K.XAxis,{type:`number`,tickFormatter:e=>i?`${t>0?(e/t*100).toFixed(0):0}%`:o(e),axisLine:!1,tickLine:!1,tick:{className:`text-xs fill-muted-foreground`}}),(0,f.jsx)(K.YAxis,{dataKey:`name`,type:`category`,width:100,axisLine:!1,tickLine:!1,tick:{className:`text-sm fill-foreground`}}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(NN,{total:t,formatter:o})}),a&&(0,f.jsx)(K.Legend,{verticalAlign:`bottom`,formatter:e=>(0,f.jsx)(`span`,{className:`text-sm text-foreground`,children:e})}),(0,f.jsx)(K.Bar,{dataKey:`value`,name:`Credits`,radius:[0,4,4,0],isAnimationActive:r,animationDuration:800,barSize:24,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,f.jsx)(K.Cell,{fill:e.color},e.id))})]})})}function zN({data:e,variant:n=`pie`,showPercentages:r=!1,showLegend:i=!0,height:a=300,animated:o=!0,onSegmentClick:c,formatValue:l,className:u}){let d=s.useMemo(()=>AN(e),[e]),p={data:d,total:s.useMemo(()=>jN(d),[d]),height:a,animated:o,showPercentages:r,showLegend:i,formatter:l||MN,onSegmentClick:c};return(0,f.jsxs)(`div`,{className:t.t(`w-full`,u),children:[n===`pie`&&(0,f.jsx)(IN,{...p}),n===`donut`&&(0,f.jsx)(LN,{...p}),n===`bar`&&(0,f.jsx)(RN,{...p})]})}function BN(e){return new Date(e)}function VN(e){return BN(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function HN(e,t){let n=BN(e);return n.setDate(n.getDate()+t),n.toISOString().split(`T`)[0]}function UN(e){if(e.length<2)return 0;let t=[...e].sort((e,t)=>BN(e.date).getTime()-BN(t.date).getTime()),n=t[0],r=t[t.length-1],i=(BN(r.date).getTime()-BN(n.date).getTime())/(1e3*60*60*24);return i===0?0:(n.value-r.value)/i}function WN(e,t,n,r){let i=[...e].sort((e,t)=>BN(e.date).getTime()-BN(t.date).getTime()),a=UN(i),o=i.map(e=>({date:e.date,historical:e.value})),s=i.length>0?i[i.length-1].date:new Date().toISOString().split(`T`)[0],c=null;i.length>0&&(o[o.length-1].projected=t,r&&(o[o.length-1].upperBound=t,o[o.length-1].lowerBound=t));for(let e=1;e<=n;e++){let i=HN(s,e),l=Math.max(0,t-a*e),u=e/n*.2,d=Math.max(0,t-a*e*(1-u)),f=Math.max(0,t-a*e*(1+u)),p={date:i,projected:l};r&&(p.upperBound=d,p.lowerBound=f),o.push(p),c===null&&l<=0&&(c=i)}return{chartData:o,depletionDate:c}}function GN({active:e,payload:t,label:n}){if(!e||!t||t.length===0||!n)return null;let r=t.find(e=>e.dataKey===`historical`),i=t.find(e=>e.dataKey===`projected`),a=t.find(e=>e.dataKey===`upperBound`),o=t.find(e=>e.dataKey===`lowerBound`);return(0,f.jsxs)(`div`,{className:`rounded-lg border bg-background px-3 py-2 shadow-md`,children:[(0,f.jsx)(`p`,{className:`text-xs font-medium text-foreground mb-1`,children:VN(n)}),r&&r.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-blue-600`,children:[`Balance: `,r.value.toLocaleString()]}),i&&i.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Projected: `,i.value.toLocaleString()]}),a&&o&&a.value!=null&&o.value!=null&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground/70`,children:[`Range: `,o.value.toLocaleString(),` - `,a.value.toLocaleString()]})]})}function KN({depletionDate:e}){return e?(0,f.jsxs)(`div`,{className:`mt-2 text-sm text-red-600 font-medium text-center`,children:[`Estimated depletion: `,VN(e)]}):null}function qN({historicalData:e,balance:n,projectionDays:r=30,confidenceInterval:i=!1,height:a=300,animated:o=!0,className:c}){let{chartData:l,depletionDate:u}=s.useMemo(()=>WN(e,n,r,i),[e,n,r,i]);return e.length===0?(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg`,c),style:{height:a},children:`No historical data available`}):(0,f.jsxs)(`div`,{className:t.t(`w-full`,c),children:[(0,f.jsx)(K.ResponsiveContainer,{width:`100%`,height:a,children:(0,f.jsxs)(K.AreaChart,{data:l,margin:{top:10,right:30,left:10,bottom:0},children:[(0,f.jsxs)(`defs`,{children:[(0,f.jsxs)(`linearGradient`,{id:`historicalGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.3}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:.05})]}),(0,f.jsxs)(`linearGradient`,{id:`confidenceGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`5%`,stopColor:`#9ca3af`,stopOpacity:.2}),(0,f.jsx)(`stop`,{offset:`95%`,stopColor:`#9ca3af`,stopOpacity:.05})]})]}),(0,f.jsx)(K.CartesianGrid,{strokeDasharray:`3 3`,stroke:`#e5e7eb`,vertical:!1}),(0,f.jsx)(K.XAxis,{dataKey:`date`,tickFormatter:VN,tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`}}),(0,f.jsx)(K.YAxis,{tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`},tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,f.jsx)(K.Tooltip,{content:(0,f.jsx)(GN,{})}),(0,f.jsx)(K.ReferenceLine,{y:0,stroke:`#ef4444`,strokeWidth:2}),i&&(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`upperBound`,stroke:`none`,fill:`url(#confidenceGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),i&&(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`lowerBound`,stroke:`none`,fill:`#ffffff`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),(0,f.jsx)(K.Area,{type:`monotone`,dataKey:`historical`,stroke:`#3b82f6`,strokeWidth:2,fill:`url(#historicalGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1}),(0,f.jsx)(K.Line,{type:`monotone`,dataKey:`projected`,stroke:`#6b7280`,strokeWidth:2,strokeDasharray:`6 3`,dot:!1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1})]})}),(0,f.jsx)(KN,{depletionDate:u})]})}function JN(e){return e.toLocaleString(`en-US`)}function YN(e,t){return Number.isInteger(e)?`${e}${t}`:`${e.toFixed(2)}${t}`}function XN(e,t){return`${e.toFixed(4).replace(/0+$/,``).replace(/\.$/,``)}${t}/credit`}function ZN({pack:e,selected:i,onSelect:a,currency:o}){let s=e.currency||o;return(0,f.jsxs)(Y,{className:t.t(`relative flex flex-col transition-all duration-200 cursor-pointer`,i&&[`border-primary shadow-lg shadow-primary/10`,`ring-2 ring-primary/30`],e.highlighted&&!i&&`bg-muted/30`,!i&&!e.highlighted&&`hover:border-muted-foreground/30`),onClick:()=>a(e),children:[e.highlighted&&e.highlightLabel&&(0,f.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,f.jsxs)(n.x,{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 shadow-sm`,children:[(0,f.jsx)(l.Sparkles,{className:`h-3 w-3`}),e.highlightLabel]})}),(0,f.jsx)(X,{className:t.t(`pb-2`,e.highlighted&&`pt-8`),children:(0,f.jsx)(`h3`,{className:`text-lg font-bold text-foreground`,children:e.name})}),(0,f.jsxs)(Q,{className:`flex flex-1 flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Coins,{className:`h-5 w-5 text-primary`}),(0,f.jsx)(`span`,{className:`text-3xl font-bold text-foreground`,children:JN(e.credits)}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`credits`})]}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold text-foreground`,children:YN(e.price,s)}),e.unitPrice!=null&&e.unitPrice>0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:XN(e.unitPrice,s)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`w-fit rounded-full`,children:[`+`,e.bonusPercent,`% bonus`]}),(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsx)(r.r,{type:`button`,variant:i?`default`:`outline`,className:`mt-2 w-full`,onClick:t=>{t.stopPropagation(),a(e)},children:i?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Check,{className:`h-4 w-4`}),`Selected`]}):`Select`})]})]})}function QN({packs:e,selectedId:n,onSelect:r,currency:i=`€`,columns:a=3,className:o}){return(0,f.jsx)(`div`,{className:t.t(`grid gap-6`,{2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`}[a],o),children:e.map(e=>(0,f.jsx)(ZN,{pack:e,selected:e.id===n,onSelect:r,currency:i},e.id))})}var $N=.01,eP=100,tP=5e4;function nP(e,t){if(t.length===0)return e*$N;let n=[...t].sort((e,t)=>e.credits-t.credits);if(e<=n[0].credits){let t=n[0].price/n[0].credits;return Math.round(e*t*100)/100}if(e>=n[n.length-1].credits){let t=n[n.length-1].price/n[n.length-1].credits;return Math.round(e*t*100)/100}for(let t=0;t<n.length-1;t++)if(e>=n[t].credits&&e<=n[t+1].credits){let r=n[t],i=n[t+1],a=(e-r.credits)/(i.credits-r.credits),o=r.price+a*(i.price-r.price);return Math.round(o*100)/100}return e*$N}function rP(e,t){return`${e.toFixed(2)} ${t}`}function iP(e){return e.toLocaleString(`en-US`)}function aP({pack:e,selected:n,currency:r,onSelect:i}){return(0,f.jsxs)(`button`,{type:`button`,onClick:i,className:t.t(`relative flex flex-col items-center gap-2 rounded-lg border p-4 text-left transition-all`,`hover:border-primary/50 hover:shadow-sm`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n?`border-primary bg-primary/5 shadow-sm ring-1 ring-primary`:`border-border bg-card`,e.highlighted&&!n&&`border-primary/30`),children:[e.highlighted&&e.highlightLabel&&(0,f.jsx)(`span`,{className:`absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground whitespace-nowrap`,children:e.highlightLabel}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(l.Coins,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`text-lg font-bold tabular-nums`,children:iP(e.credits)})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:e.name}),(0,f.jsx)(`span`,{className:`text-sm font-semibold`,children:rP(e.price,e.currency??r)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,f.jsxs)(`span`,{className:`rounded-full bg-green-100 dark:bg-green-900/30 px-2 py-0.5 text-[10px] font-semibold text-green-700 dark:text-green-400`,children:[`+`,e.bonusPercent,`% bonus`]}),e.unitPrice!=null&&(0,f.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.unitPrice.toFixed(4),` `,e.currency??r,`/credit`]})]})}function oP({packs:e,currentBalance:n,customAmount:i=!1,minAmount:a=eP,maxAmount:o=tP,currency:c=`EUR`,onPurchase:u,onCancel:d,className:p}){let[m,h]=s.useState(null),[g,_]=s.useState(!1),[v,y]=s.useState(a),b=e.find(e=>e.id===m)??null,x=nP(v,e),S=b!==null||g&&v>=a,C=g?v:b?.credits??0,w=g?x:b?.price??0;function T(e){h(e),_(!1)}function E(){_(!0),h(null)}function D(e){y(Math.max(a,Math.min(o,Math.round(e))))}function O(e){let t=e.target.value;if(t===``){y(a);return}let n=parseInt(t,10);isNaN(n)||D(n)}function k(e){e[0]!=null&&D(e[0])}function A(){S&&(g?u({credits:v,price:x}):b&&u(b))}return(0,f.jsx)(Y,{className:t.t(`w-full`,p),children:(0,f.jsxs)(Q,{className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10`,children:(0,f.jsx)(l.ShoppingCart,{className:`h-5 w-5 text-primary`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Top Up Credits`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a pack or enter a custom amount`})]})]}),(0,f.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:e.map(e=>(0,f.jsx)(aP,{pack:e,selected:m===e.id&&!g,currency:c,onSelect:()=>T(e.id)},e.id))}),i&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(r.t,{}),(0,f.jsx)(`span`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card px-3 text-xs text-muted-foreground font-medium`,children:`Or enter custom amount`})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:g?(0,f.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`label`,{htmlFor:`custom-credits`,className:`text-sm font-medium`,children:`Credits`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:rP(x,c)})]}),(0,f.jsx)(r.n,{id:`custom-credits`,type:`number`,min:a,max:o,step:100,value:v,onChange:O,className:`tabular-nums`}),(0,f.jsx)(pr,{value:[v],onValueChange:k,min:a,max:o,step:100}),(0,f.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground tabular-nums`,children:[(0,f.jsx)(`span`,{children:iP(a)}),(0,f.jsx)(`span`,{children:iP(o)})]})]}):(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:E,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4`}),`Enter custom amount`]})})]}),S&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-muted/50 p-4`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Summary`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Credits`}),(0,f.jsx)(`span`,{className:`font-medium tabular-nums`,children:iP(C)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Price`}),(0,f.jsx)(`span`,{className:`font-medium tabular-nums`,children:rP(w,c)})]}),n!=null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{className:`my-1`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Current balance`}),(0,f.jsx)(`span`,{className:`tabular-nums`,children:iP(n)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-semibold`,children:[(0,f.jsx)(`span`,{children:`New balance`}),(0,f.jsx)(`span`,{className:`tabular-nums text-green-600 dark:text-green-400`,children:iP(n+C)})]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[d&&(0,f.jsx)(r.r,{variant:`outline`,onClick:d,children:`Cancel`}),(0,f.jsxs)(r.r,{onClick:A,disabled:!S,children:[(0,f.jsx)(l.ShoppingCart,{className:`h-4 w-4`}),`Purchase`]})]})]})})}function sP(e){return(typeof e==`string`?new Date(e):e).toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function cP(e){return`${e>=0?`+`:``}${e.toLocaleString(`en-US`)}`}function lP(e){return e.toLocaleString(`en-US`,{style:`currency`,currency:`EUR`})}function uP(e){switch(e){case`credit`:return`default`;case`debit`:return`secondary`;case`refund`:return`destructive`;case`bonus`:return`default`;case`expiry`:return`outline`;default:return`secondary`}}function dP(e){switch(e){case`completed`:return`default`;case`pending`:return`outline`;case`failed`:return`destructive`;case`cancelled`:return`secondary`;default:return`outline`}}function fP(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pP({label:e,children:t}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 print:py-1`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground print:text-gray-500`,children:e}),(0,f.jsx)(`div`,{className:`text-sm font-medium text-right`,children:t})]})}function mP({transaction:e,organization:i,downloadable:a=!1,onDownload:o,className:s}){return(0,f.jsxs)(Y,{className:t.t(`w-full max-w-md print:shadow-none print:border-gray-300`,s),children:[(0,f.jsxs)(X,{className:`pb-4 print:pb-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Receipt,{className:`h-5 w-5 text-muted-foreground print:text-gray-500`}),(0,f.jsx)(Z,{className:`text-lg print:text-base`,children:`Receipt`})]}),(0,f.jsx)(l.CheckCircle,{className:`h-5 w-5 text-green-500 print:text-gray-700`})]}),(0,f.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground mt-1 print:text-gray-400`,children:e.id})]}),(0,f.jsx)(r.t,{className:`print:bg-gray-300`}),(0,f.jsxs)(Q,{className:`pt-4 print:pt-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(pP,{label:`Date`,children:sP(e.timestamp)}),(0,f.jsx)(pP,{label:`Type`,children:(0,f.jsx)(n.x,{variant:uP(e.type),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:fP(e.type)})}),e.credits!==void 0&&(0,f.jsx)(pP,{label:`Credits`,children:(0,f.jsxs)(`span`,{className:t.t(`tabular-nums font-semibold`,e.credits>=0?`text-green-600 dark:text-green-400 print:text-gray-900`:`text-red-600 dark:text-red-400 print:text-gray-900`),children:[cP(e.credits),` credits`]})}),e.price!==void 0&&(0,f.jsx)(pP,{label:`Amount`,children:(0,f.jsx)(`span`,{className:`tabular-nums`,children:lP(e.price)})}),e.paymentMethod&&(0,f.jsx)(pP,{label:`Payment`,children:(0,f.jsx)(`span`,{className:`font-mono text-xs`,children:e.paymentMethod})}),(0,f.jsx)(pP,{label:`Status`,children:(0,f.jsx)(n.x,{variant:dP(e.status),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:fP(e.status)})}),i&&(0,f.jsx)(pP,{label:`Organization`,children:i.name}),e.description&&(0,f.jsx)(pP,{label:`Description`,children:(0,f.jsx)(`span`,{className:`max-w-[200px] truncate inline-block`,children:e.description})})]}),a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.t,{className:`my-4 print:hidden`}),(0,f.jsx)(`div`,{className:`print:hidden`,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`w-full`,onClick:o,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download PDF`]})})]})]})]})}function hP(e,t,n,r,i){let a={};e?i&&e===i&&(a.destination=`Destination must be different from source organization`):a.destination=`Please select a destination organization`;let o=parseFloat(t);return t?isNaN(o)||o<=0?a.amount=`Amount must be greater than 0`:o>r&&(a.amount=`Amount cannot exceed ${r.toLocaleString()} credits`):a.amount=`Amount is required`,n.trim()||(a.reason=`Please provide a reason for the transfer`),a}function gP({message:e}){return e?(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,f.jsx)(l.AlertCircle,{className:`h-3.5 w-3.5 text-destructive flex-shrink-0`}),(0,f.jsx)(`span`,{className:`text-xs text-destructive`,children:e})]}):null}function _P({maxAmount:e,organizations:a,sourceOrganization:o,onTransfer:c,onCancel:u,loading:d=!1,className:p}){let[m,h]=s.useState(``),[g,_]=s.useState(``),[v,y]=s.useState(``),[b,x]=s.useState({}),[S,C]=s.useState({}),w=s.useMemo(()=>o?a.filter(e=>e.id!==o.id):a,[a,o]),T=s.useMemo(()=>a.find(e=>e.id===m),[a,m]);s.useEffect(()=>{if(Object.keys(S).length===0)return;let t=hP(m,g,v,e,o?.id),n={};S.destination&&t.destination&&(n.destination=t.destination),S.amount&&t.amount&&(n.amount=t.amount),S.reason&&t.reason&&(n.reason=t.reason),x(n)},[m,g,v,e,o?.id,S]);let E=e=>{C(t=>({...t,[e]:!0}))},D=t=>{t.preventDefault(),C({destination:!0,amount:!0,reason:!0});let n=hP(m,g,v,e,o?.id);if(Object.keys(n).length>0){x(n);return}c({toOrgId:m,amount:parseFloat(g),reason:v.trim()})},O=parseFloat(g),k=T&&!isNaN(O)&&O>0&&O<=e&&o;return(0,f.jsxs)(Y,{className:t.t(`w-full`,p),children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2 text-lg`,children:[(0,f.jsx)(l.Send,{className:`h-5 w-5`}),`Transfer Credits`]})}),(0,f.jsxs)(`form`,{onSubmit:D,children:[(0,f.jsxs)(Q,{className:`space-y-4`,children:[o&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Source Organization`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-muted/50 px-3 py-2 text-sm`,children:[(0,f.jsx)(l.Building2,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,f.jsx)(`span`,{className:`font-medium`,children:o.name}),o.balance!==void 0&&(0,f.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[o.balance.toLocaleString(),` credits`]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`destination-org`,children:`Destination Organization`}),(0,f.jsxs)(n.d,{value:m,onValueChange:e=>{h(e),C(e=>({...e,destination:!0}))},disabled:d,children:[(0,f.jsx)(n.y,{id:`destination-org`,className:t.t(b.destination&&`border-destructive focus:ring-destructive`),onBlur:()=>E(`destination`),children:(0,f.jsx)(n.b,{placeholder:`Select an organization`})}),(0,f.jsx)(n.f,{children:w.map(e=>(0,f.jsx)(n.m,{value:e.id,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Building2,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,f.jsx)(`span`,{children:e.name}),e.balance!==void 0&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.balance.toLocaleString(),` credits)`]})]})},e.id))})]}),(0,f.jsx)(gP,{message:b.destination})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`transfer-amount`,children:`Amount`}),(0,f.jsx)(`div`,{className:`relative`,children:(0,f.jsx)(r.n,{id:`transfer-amount`,type:`number`,min:1,max:e,step:1,placeholder:`Max: ${e.toLocaleString()} credits`,value:g,onChange:e=>_(e.target.value),onBlur:()=>E(`amount`),disabled:d,className:t.t(b.amount&&`border-destructive focus-visible:ring-destructive`)})}),(0,f.jsx)(gP,{message:b.amount})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`transfer-reason`,children:`Reason`}),(0,f.jsx)(i.n,{id:`transfer-reason`,placeholder:`Describe the reason for this transfer...`,value:v,onChange:e=>y(e.target.value),onBlur:()=>E(`reason`),disabled:d,rows:3,className:t.t(b.reason&&`border-destructive focus-visible:ring-destructive`)}),(0,f.jsx)(gP,{message:b.reason})]}),k&&(0,f.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-2 flex-wrap`,children:[`Transfer`,` `,(0,f.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[O.toLocaleString(),` credits`]}),` `,`from`,` `,(0,f.jsx)(`span`,{className:`font-semibold text-foreground`,children:o.name}),(0,f.jsx)(l.ArrowRight,{className:`h-3.5 w-3.5 flex-shrink-0`}),(0,f.jsx)(`span`,{className:`font-semibold text-foreground`,children:T.name})]})})]}),(0,f.jsxs)(Ce,{className:`gap-2 justify-end`,children:[u&&(0,f.jsx)(r.r,{type:`button`,variant:`outline`,onClick:u,disabled:d,children:`Cancel`}),(0,f.jsx)(r.r,{type:`submit`,disabled:d,children:d?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),`Transferring...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Send,{className:`h-4 w-4`}),`Transfer`]})})]})]})]})}function vP(e){let t=Math.abs(e),n=Math.floor(t/60),r=t%60,i=e<0?`-`:``;return r>0?`${i}${n}h${r.toString().padStart(2,`0`)}`:`${i}${n}h`}function yP(e){return e>600?`text-green-600 dark:text-green-400`:e>300?`text-orange-500 dark:text-orange-400`:`text-red-600 dark:text-red-400 font-bold`}function bP({remainingMinutes:e,totalMinutes:n,className:r}){return(0,f.jsxs)(`span`,{className:t.t(`inline-flex items-center gap-0.5 text-sm tabular-nums`,yP(e),r),"aria-label":`${vP(e)} restantes sur ${vP(n)} total`,children:[(0,f.jsx)(`span`,{children:vP(e)}),(0,f.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`/`}),(0,f.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:vP(n)})]})}var xP=[`CW`,`SW`,`IW`,`LW`,`DW`,`TW`,`AW`,`BW`,`FW`,`EW`];function SP({role:e,name:n,isPrimary:r,className:i}){return(0,f.jsxs)(`span`,{className:t.t(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium`,xP.includes(e)?`bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300`:`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`,i),children:[(0,f.jsx)(`span`,{className:`font-bold`,children:e}),n&&(0,f.jsx)(`span`,{className:`font-normal truncate max-w-[120px]`,children:n}),r&&(0,f.jsx)(`span`,{className:`text-amber-500`,"aria-label":`Principal`,children:`★`})]})}function CP({count:e,recentComments:n,onClick:r,className:i}){let a=e>0,o=(0,f.jsxs)(`button`,{onClick:r,className:t.t(`relative inline-flex items-center justify-center h-8 w-8 rounded-full transition-colors`,a?`bg-blue-100 text-blue-600 hover:bg-blue-200 dark:bg-blue-900/30 dark:text-blue-400`:`bg-muted text-muted-foreground hover:bg-accent`,i),"aria-label":`${e} commentaire${e===1?``:`s`}`,children:[(0,f.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`})}),a&&(0,f.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-blue-600 text-[10px] font-bold text-white`,children:e>9?`9+`:e})]});return n?.length?(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:o}),(0,f.jsx)(Cn,{className:`w-72 p-3`,side:`top`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[n.slice(0,3).map((e,t)=>(0,f.jsxs)(`div`,{className:`text-xs`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.author}),(0,f.jsx)(`span`,{children:e.date})]}),(0,f.jsx)(`p`,{className:`line-clamp-2 mt-0.5`,children:e.content})]},t)),e>3&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[`+`,e-3,` autre`,e-3>1?`s`:``]})]})})]}):o}function wP({open:e,onOpenChange:t,comments:n,onAdd:r,onEdit:i,onDelete:a,canEditDelete:o,isLoading:c}){let[l,u]=s.useState(``);return(0,f.jsx)(nr,{open:e,onOpenChange:t,children:(0,f.jsxs)(cr,{className:`flex flex-col w-full sm:max-w-md`,children:[(0,f.jsx)(lr,{children:(0,f.jsxs)(dr,{children:[`Commentaires (`,n.length,`)`]})}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-3 py-4`,children:[n.length===0&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Aucun commentaire`}),n.map(e=>(0,f.jsxs)(`div`,{className:`rounded-lg border p-3 space-y-1.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(SP,{role:e.authorRole,name:e.authorName}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.createdAt})]}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.isEdited&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`(modifie)`}),o&&i&&(0,f.jsx)(`button`,{className:`text-xs text-blue-600 hover:underline`,onClick:()=>{let t=prompt(`Modifier le commentaire:`,e.content);t&&t!==e.content&&i(e.id,t)},children:`Modifier`}),o&&a&&(0,f.jsx)(`button`,{className:`text-xs text-red-600 hover:underline`,onClick:()=>{confirm(`Supprimer ce commentaire ?`)&&a(e.id)},children:`Supprimer`})]})]},e.id))]}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l.trim()&&(r(l.trim()),u(``))},className:`border-t pt-3 flex gap-2`,children:[(0,f.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:`Ajouter un commentaire...`,className:`flex-1 min-h-[60px] rounded-md border bg-background px-3 py-2 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-ring`,disabled:c}),(0,f.jsx)(`button`,{type:`submit`,disabled:!l.trim()||c,className:`self-end rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Envoyer`})]})]})})}function TP({open:e,onOpenChange:t,actors:n,onSubmit:r,showBillable:i,isLoading:a}){let[o,c]=s.useState(null),[l,u]=s.useState(0),[d,p]=s.useState(0),[m,h]=s.useState(``),[g,_]=s.useState(!1),v=()=>{c(null),u(0),p(0),h(``),_(!1)};return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-lg`,children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Saisie de temps`})}),(0,f.jsx)(`div`,{className:`space-y-3 max-h-[300px] overflow-y-auto`,children:n.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border p-2.5 cursor-pointer transition-colors ${o===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`}`,onClick:()=>c(e.id),children:[(0,f.jsx)(SP,{role:e.role,name:e.name}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground tabular-nums`,children:vP(e.totalMinutes)})]},e.id))}),o&&(0,f.jsxs)(`div`,{className:`space-y-3 border-t pt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Heures`}),(0,f.jsx)(`input`,{type:`number`,min:0,max:99,value:l,onChange:e=>u(Math.max(0,parseInt(e.target.value)||0)),className:`w-16 rounded-md border bg-background px-2 py-1.5 text-sm text-center`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Minutes`}),(0,f.jsxs)(`select`,{value:d,onChange:e=>p(parseInt(e.target.value)),className:`rounded-md border bg-background px-2 py-1.5 text-sm`,children:[(0,f.jsx)(`option`,{value:0,children:`00`}),(0,f.jsx)(`option`,{value:15,children:`15`}),(0,f.jsx)(`option`,{value:30,children:`30`}),(0,f.jsx)(`option`,{value:45,children:`45`})]})]})]}),(0,f.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Commentaire (optionnel)`,className:`w-full rounded-md border bg-background px-3 py-1.5 text-sm`}),i&&(0,f.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`rounded border-input`}),(0,f.jsx)(`span`,{className:`font-medium text-amber-600`,children:`Heures facturables`})]})]}),(0,f.jsx)(Ct,{children:(0,f.jsx)(`button`,{onClick:()=>{if(!o)return;let e=l*60+d;e<15||(r(o,e,m,g),v())},disabled:!o||l*60+d<15||a,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Ajouter`})})]})})}function EP({entries:e,children:t}){let n=e.reduce((e,t)=>e+t.totalMinutes,0);return(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:t}),(0,f.jsx)(Cn,{className:`w-52 p-3`,side:`top`,children:(0,f.jsxs)(`div`,{className:`space-y-1 text-xs`,children:[e.map(e=>(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.role}),(0,f.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:vP(e.totalMinutes)})]},e.role)),(0,f.jsxs)(`div`,{className:`border-t pt-1 flex justify-between font-medium`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsx)(`span`,{className:`tabular-nums`,children:vP(n)})]})]})})]})}var DP=[`text/`,`application/json`,`application/xml`,`application/javascript`],OP=[`image/`];function kP(e){return DP.some(t=>e.startsWith(t))||e.includes(`markdown`)}function AP(e){return OP.some(t=>e.startsWith(t))}function jP(e){return e<1024?`${e} o`:e<1024*1024?`${(e/1024).toFixed(1)} Ko`:`${(e/(1024*1024)).toFixed(1)} Mo`}function MP({open:e,onOpenChange:t,document:n,versions:r,selectedVersion:i,onVersionChange:a,onDownload:o}){return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-4xl max-h-[90vh] flex flex-col`,children:[(0,f.jsx)(St,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,f.jsx)(wt,{className:`truncate`,children:n.name}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[r&&r.length>1&&(0,f.jsx)(`select`,{value:i??r[0]?.id,onChange:e=>a?.(e.target.value),className:`rounded-md border bg-background px-2 py-1 text-xs`,children:r.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.label,` — `,e.date]},e.id))}),(0,f.jsx)(`button`,{onClick:()=>o(i),className:`rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Telecharger`})]})]})}),(0,f.jsx)(`div`,{className:`flex-1 overflow-auto rounded-lg border bg-muted/30 p-4 min-h-[300px]`,children:kP(n.mimeType)&&n.content?(0,f.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm font-mono leading-relaxed`,children:n.content}):AP(n.mimeType)&&n.previewUrl?(0,f.jsx)(`img`,{src:n.previewUrl,alt:n.name,className:`max-w-full h-auto mx-auto rounded`}):(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-muted-foreground py-12`,children:[(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,f.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:`Previsualisation non disponible`}),(0,f.jsxs)(`p`,{className:`text-xs`,children:[n.mimeType,` — `,jP(n.sizeBytes)]})]})}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground border-t pt-2`,children:[(0,f.jsx)(`span`,{children:jP(n.sizeBytes)}),(0,f.jsxs)(`span`,{children:[`Uploade par `,n.uploadedBy,` le `,n.uploadedAt]})]})]})})}function NP({name:e,extension:t,sizeKb:n,lastModified:r,author:i,onClick:a}){return(0,f.jsxs)(xn,{openDelay:200,children:[(0,f.jsx)(Sn,{asChild:!0,children:(0,f.jsx)(`button`,{onClick:a,className:`inline-flex items-center justify-center h-7 w-7 rounded-md bg-muted hover:bg-accent transition-colors`,"aria-label":`Document: ${e}`,children:(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,f.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})})}),(0,f.jsxs)(Cn,{className:`w-56 p-3 text-xs`,side:`top`,children:[(0,f.jsxs)(`p`,{className:`font-medium truncate`,children:[e,`.`,t]}),(0,f.jsxs)(`p`,{className:`text-muted-foreground`,children:[n,` Ko — `,r]}),(0,f.jsxs)(`p`,{className:`text-muted-foreground`,children:[`par `,i]})]})]})}function PP({onClick:e,hasExistingDoc:n,disabled:r,className:i}){return(0,f.jsxs)(`button`,{onClick:e,disabled:r,className:t.t(`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors`,`bg-violet-600 text-white hover:bg-violet-700 disabled:opacity-50`,i),"aria-label":n?`Ouvrir document IA`:`Assistant IA`,children:[(0,f.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z`}),(0,f.jsx)(`path`,{d:`M5 3v4`}),(0,f.jsx)(`path`,{d:`M19 17v4`}),(0,f.jsx)(`path`,{d:`M3 5h4`}),(0,f.jsx)(`path`,{d:`M17 19h4`})]}),n?`Ouvrir document IA`:`Assistant IA`]})}function FP({roles:e,actions:t,value:n,onChange:r}){return(0,f.jsx)(ti,{children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`border-b`,children:[(0,f.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground sticky left-0 bg-background`,children:`Role`}),t.map(e=>(0,f.jsx)(`th`,{className:`p-2 text-center`,children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(`span`,{className:`font-medium cursor-help`,children:e.key.replace(`_`,` `).slice(0,8)})}),(0,f.jsx)(ii,{children:e.label})]})},e.key))]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30`,children:[(0,f.jsx)(`td`,{className:`p-2 font-medium sticky left-0 bg-background`,children:e}),t.map(t=>(0,f.jsx)(`td`,{className:`p-2 text-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:(n[e]??[]).includes(t.key),onChange:n=>r(e,t.key,n.target.checked),className:`rounded border-input`,"aria-label":`${e} — ${t.label}`})},t.key))]},e))})]})})})}function IP({title:e,actors:n,requiredRoles:r,bgClass:i,side:a,onAdd:o,onRemove:s,onTogglePrimary:c}){let l=new Set(n.map(e=>e.role)),u=r.filter(e=>!l.has(e));return(0,f.jsxs)(`div`,{className:t.t(`flex-1 rounded-lg border p-3 space-y-2`,i),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold`,children:e}),(0,f.jsx)(`button`,{onClick:()=>o(a),className:`rounded-md bg-background border px-2 py-1 text-xs hover:bg-accent`,"aria-label":`Ajouter un acteur ${e}`,children:`+ Ajouter`})]}),u.length>0&&(0,f.jsxs)(`div`,{className:`text-xs text-red-600 border border-red-200 rounded p-1.5 bg-red-50 dark:bg-red-900/10`,children:[`Roles obligatoires manquants : `,u.join(`, `)]}),(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[n.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-background/80 px-2 py-1.5`,children:[(0,f.jsx)(SP,{role:e.role,name:e.userName,isPrimary:e.isPrimary}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`button`,{onClick:()=>c(e.id),className:`text-xs text-muted-foreground hover:text-foreground`,title:e.isPrimary?`Retirer principal`:`Marquer principal`,children:e.isPrimary?`★`:`☆`}),(0,f.jsx)(`button`,{onClick:()=>s(e.id),className:`text-xs text-red-500 hover:text-red-700 ml-1`,"aria-label":`Retirer ${e.userName}`,children:`×`})]})]},e.id)),n.length===0&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-2`,children:`Aucun acteur`})]})]})}function LP({wakaActors:e,ppActors:t,requiredWakaRoles:n,requiredPpRoles:r,onAdd:i,onRemove:a,onTogglePrimary:o}){return(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsx)(IP,{title:`Acteurs Waka`,actors:e,requiredRoles:n,bgClass:`bg-blue-50/50 dark:bg-blue-950/10`,side:`waka`,onAdd:i,onRemove:a,onTogglePrimary:o}),(0,f.jsx)(IP,{title:`Acteurs PP`,actors:t,requiredRoles:r,bgClass:`bg-emerald-50/50 dark:bg-emerald-950/10`,side:`pp`,onAdd:i,onRemove:a,onTogglePrimary:o})]})}function RP({label:e,value:n,colorClass:r,onClick:i}){return(0,f.jsxs)(`button`,{onClick:i,className:t.t(`inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors`,`hover:bg-accent`,r),children:[(0,f.jsx)(`span`,{children:e}),(0,f.jsx)(`span`,{className:`font-bold tabular-nums`,children:n})]})}function zP({stats:e,onExpand:t}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(RP,{label:`PP`,value:vP(e.ppMinutes),colorClass:`border-emerald-200 text-emerald-700 dark:text-emerald-400`,onClick:()=>t?.(`pp`)}),(0,f.jsx)(RP,{label:`Waka`,value:vP(e.wakaMinutes),colorClass:`border-blue-200 text-blue-700 dark:text-blue-400`,onClick:()=>t?.(`waka`)}),(0,f.jsx)(RP,{label:`Facturables`,value:(0,f.jsx)(bP,{remainingMinutes:e.billableTotalMinutes-e.billableMinutes,totalMinutes:e.billableTotalMinutes,className:`text-xs`}),colorClass:`border-amber-200`,onClick:()=>t?.(`billable`)})]})}function BP({open:e,onOpenChange:t,onSubmit:n,isLoading:r}){let[i,a]=s.useState(25),[o,c]=s.useState(``);return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsxs)(xt,{className:`sm:max-w-md`,children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Ajouter un pack d'heures`})}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(i<1||o.trim().length<10)&&(n(i,o.trim()),a(25),c(``))},className:`space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Nombre d'heures`}),(0,f.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Math.max(1,parseInt(e.target.value)||1)),className:`mt-1 w-full rounded-md border bg-background px-3 py-2 text-sm`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (obligatoire, min 10 chars)`}),(0,f.jsx)(`textarea`,{value:o,onChange:e=>c(e.target.value),placeholder:`Ex: Commande initiale Biped du 30 mars 2026`,className:`mt-1 w-full min-h-[80px] rounded-md border bg-background px-3 py-2 text-sm resize-none`}),o.length>0&&o.length<10&&(0,f.jsxs)(`p`,{className:`text-xs text-red-500 mt-1`,children:[10-o.length,` caracteres restants`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:`rounded-md border px-4 py-2 text-sm hover:bg-accent`,children:`Annuler`}),(0,f.jsx)(`button`,{type:`submit`,disabled:i<1||o.trim().length<10||r,className:`rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Ajouter`})]})]})]})})}function VP({consumptions:e,page:t,totalPages:n,onPageChange:r}){return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`border-b text-xs text-muted-foreground`,children:[(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Consultant`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Motif`}),(0,f.jsx)(`th`,{className:`text-left p-2`,children:`Etape`}),(0,f.jsx)(`th`,{className:`text-right p-2`,children:`Duree`})]})}),(0,f.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30`,children:[(0,f.jsx)(`td`,{className:`p-2 text-xs`,children:e.date}),(0,f.jsx)(`td`,{className:`p-2`,children:e.consultant}),(0,f.jsx)(`td`,{className:`p-2 truncate max-w-[200px]`,children:e.reason}),(0,f.jsx)(`td`,{className:`p-2 text-xs text-muted-foreground`,children:e.stepName??`—`}),(0,f.jsx)(`td`,{className:`p-2 text-right tabular-nums font-medium`,children:vP(e.minutes)})]},t)),e.length===0&&(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{colSpan:5,className:`p-4 text-center text-muted-foreground`,children:`Aucune consommation`})})]})]}),n>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,f.jsx)(`button`,{onClick:()=>r(t-1),disabled:t<=1,className:`rounded border px-2 py-1 text-xs disabled:opacity-50 hover:bg-accent`,children:`Precedent`}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t,`/`,n]}),(0,f.jsx)(`button`,{onClick:()=>r(t+1),disabled:t>=n,className:`rounded border px-2 py-1 text-xs disabled:opacity-50 hover:bg-accent`,children:`Suivant`})]})]})}var HP=s.createContext(void 0);function UP({children:e,languages:t,defaultLanguage:n=`fr`,s3Config:r,onLanguageChange:i}){let{i18n:a}=(0,H.useTranslation)(),[o,c]=s.useState(n),[l,u]=s.useState(!0),[d,p]=s.useState(new Set),[m,h]=s.useState(!1),g=s.useCallback(async e=>{if(!r)throw Error(`S3 configuration not provided`);let{baseUrl:t,prefix:n=``,extension:i=`json`,headers:a={}}=r,o=`${t.replace(/\/$/,``)}/${n}${e}.${i}`;console.log(`[LanguageProvider] Loading translations from S3: ${o}`);try{let t=await fetch(o,{headers:{Accept:`application/json`,...a}});if(!t.ok)throw Error(`Failed to load translations: ${t.status} ${t.statusText}`);let n=await t.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${e}`),n}catch(t){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${e}:`,t),t}},[r]);s.useEffect(()=>{m||!a||!r||(async()=>{try{let e=typeof window<`u`?localStorage.getItem(`language`):null,r=e&&t.some(t=>t.code===e)?e:n;console.log(`[LanguageProvider] Initializing with language: ${r}`);let i=await g(r);a.addResourceBundle&&a.addResourceBundle(r,`translation`,i,!0,!0),await a.changeLanguage(r),c(r),p(new Set([r])),h(!0),console.log(`[LanguageProvider] ✓ Initialized with ${r}`)}catch(e){console.error(`[LanguageProvider] Error initializing:`,e),h(!0)}finally{u(!1)}})()},[m,a,r,n,t,g]);let _={currentLanguage:o,languages:t,changeLanguage:s.useCallback(async e=>{if(e!==o){if(!a?.changeLanguage){console.error(`[LanguageProvider] i18next is not initialized`);return}if(!r){console.error(`[LanguageProvider] S3 config not provided`);return}u(!0);try{if(!d.has(e)){console.log(`[LanguageProvider] Loading ${e} from S3...`);let t=await g(e);a.addResourceBundle&&a.addResourceBundle(e,`translation`,t,!0,!0),p(t=>new Set([...t,e]))}await a.changeLanguage(e),c(e),typeof window<`u`&&localStorage.setItem(`language`,e),i?.(e),console.log(`[LanguageProvider] ✓ Language changed to: ${e}`)}catch(e){throw console.error(`[LanguageProvider] ✗ Error changing language:`,e),e}finally{u(!1)}}},[o,d,r,g,a,i]),isLoading:l,loadedLanguages:d};return(0,f.jsx)(HP.Provider,{value:_,children:e})}function WP(){let e=s.useContext(HP);if(!e)throw Error(`useLanguage must be used within a LanguageProvider`);return e}var GP=s.createContext(void 0);function KP({children:e,config:t}){let{defaultTheme:n=`light`,storageKey:r=`waka-ui-theme`,themes:i,enableSystem:a=!0,s3Config:o}=t||{},[c,l]=s.useState(n),[u,d]=s.useState(),[p,m]=s.useState([]),[h,g]=s.useState(!0),[_,v]=s.useState(`fallback`);s.useEffect(()=>{(async()=>{if(g(!0),i&&i.length>0){let e=qP(i);m(e),v(`config`),g(!1),console.log(`[ThemeProvider] Using themes from config:`,e.length);return}if(o?.baseUrl)try{let e=await JP(o.baseUrl);if(e.length>0){m(e),v(`s3`),g(!1),console.log(`[ThemeProvider] Loaded themes from S3:`,e.length);return}}catch(e){console.error(`[ThemeProvider] Failed to load themes from S3:`,e)}m([{id:`light`,label:`Clair`,previewColor:`#3b82f6`},{id:`dark`,label:`Sombre`,previewColor:`#1e293b`}]),v(`fallback`),g(!1),console.log(`[ThemeProvider] Using fallback themes`)})()},[i,o]),s.useEffect(()=>{if(!a)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{d(e.matches?`dark`:`light`)};return d(e.matches?`dark`:`light`),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[a]),s.useEffect(()=>{if(p.length===0)return;let e=localStorage.getItem(r),t=p.map(e=>e.id);e&&t.includes(e)&&l(e)},[r,p]),s.useEffect(()=>{if(p.length===0)return;let e=document.documentElement,t=c===`system`&&u?u:c;p.forEach(t=>e.classList.remove(t.id)),e.classList.add(t),e.setAttribute(`data-theme`,t),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Theme applied: ${t}`)},[c,u,p]);let y=s.useCallback(e=>{let t=p.map(e=>e.id);if(!t.includes(e)&&e!==`system`){console.warn(`[WakaUI] Theme "${e}" is not in the list of available themes:`,t);return}l(e),localStorage.setItem(r,e)},[p,r]),b=s.useMemo(()=>({theme:c,setTheme:y,themes:p,systemTheme:u,isLoadingThemes:h,themesSource:_}),[c,y,p,u,h,_]);return(0,f.jsx)(GP.Provider,{value:b,children:e})}function qP(e){return e.length===0?[]:typeof e[0]==`string`?e.map(e=>({id:e,label:YP(e),previewColor:XP(e)})):e}async function JP(e){try{let e=await fetch(`/api/themes/list`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).themes||[]}catch(e){return console.error(`[ThemeProvider] Failed to fetch themes from S3:`,e),[]}}function YP(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function XP(e){return{light:`#3b82f6`,dark:`#1e293b`,forest:`#10b981`,sunset:`#f59e0b`,twilight:`#8b5cf6`,monochrome:`#6b7280`,perpetuity:`#ec4899`}[e]||`#3b82f6`}function ZP(){let e=s.useContext(GP);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e}function QP({children:e,config:t}){let[n]=s.useState(()=>G.default.createInstance()),[r,i]=s.useState(!1);return s.useEffect(()=>{(async()=>{try{await n.use(H.initReactI18next).init({lng:t.language.defaultLanguage,fallbackLng:t.language.defaultLanguage,supportedLngs:t.language.supportedLanguages,resources:t.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:t.debug}),t.language.s3Config&&await $P(n,t.language.s3Config,t.language.supportedLanguages),i(!0),t.debug&&console.log(`[WakaUI] i18n initialized successfully`)}catch(e){console.error(`[WakaUI] Failed to initialize i18n:`,e),i(!0)}})()},[n,t]),s.useEffect(()=>{if(!r)return;let e=t.language.storageKey||`waka-ui-language`,i=localStorage.getItem(e);i&&t.language.supportedLanguages.includes(i)&&n.changeLanguage(i);let a=n=>{localStorage.setItem(e,n),t.debug&&console.log(`[WakaUI] Language changed to: ${n}`)};return n.on(`languageChanged`,a),()=>{n.off(`languageChanged`,a)}},[r,n,t]),r?(0,f.jsx)(H.I18nextProvider,{i18n:n,children:(0,f.jsx)(UP,{languages:t.language.languages||[],defaultLanguage:t.language.defaultLanguage,s3Config:t.language.s3Config?{baseUrl:t.language.s3Config.bucketUrl,prefix:t.language.s3Config.translationsPath?`${t.language.s3Config.translationsPath}/`:``,extension:`json`}:void 0,children:(0,f.jsx)(Or,{themes:t.theme?.themes||[{id:`default`,label:`Default`}],defaultTheme:t.theme?.defaultTheme||`default`,s3Config:t.theme?.s3Config,enableDarkMode:t.theme?.enableSystem,children:e})})}):(0,f.jsx)(`div`,{style:{padding:`20px`,textAlign:`center`},children:`Loading WakaUI...`})}async function $P(e,t,n){if(!t)return;let{bucketUrl:r,translationsPath:i=`translations`}=t;try{await Promise.all(n.map(async t=>{try{let n=`${r}/${i}/${t}.json`,a=await fetch(n);if(!a.ok){console.warn(`[WakaUI] Failed to load translations for ${t} from S3`);return}let o=await a.json();e.addResourceBundle(t,`translation`,o,!0,!0),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Loaded translations for ${t} from S3`)}catch(e){console.warn(`[WakaUI] Error loading translations for ${t}:`,e)}}))}catch(e){console.error(`[WakaUI] Error loading translations from S3:`,e)}}function eF(){let{i18n:e,t}=(0,H.useTranslation)(),n=WP(),r=Ar();return{currentLanguage:e.language||n.currentLanguage,changeLanguage:async t=>{await n.changeLanguage(t),await e.changeLanguage(t)},languages:n.languages,isLanguageLoading:n.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t}}var tF=s.createContext(void 0);function nF({children:e,initialSelection:t,onSelectionChange:n,persistKey:r=`admincrumb-selection`}){let[i,a]=s.useState(()=>{if(typeof window<`u`&&r){let e=localStorage.getItem(r);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse stored admincrumb selection`,e)}}return t||{}});s.useEffect(()=>{typeof window<`u`&&r&&localStorage.setItem(r,JSON.stringify(i))},[i,r]),s.useEffect(()=>{n?.(i)},[i,n]);let o=s.useCallback(e=>{a({partner:e,network:void 0,customer:void 0})},[]),c=s.useCallback(e=>{a(t=>({...t,network:e,customer:void 0}))},[]),l=s.useCallback(e=>{a(t=>({...t,customer:e}))},[]),u=s.useCallback(()=>{a({})},[]),d=s.useMemo(()=>!!(i.partner||i.network||i.customer),[i]),p=s.useCallback(()=>({...i.partner?.id&&{partnerId:i.partner.id},...i.network?.id&&{networkId:i.network.id},...i.customer?.id&&{customerId:i.customer.id}}),[i]),m=s.useMemo(()=>({selection:i,setPartner:o,setNetwork:c,setCustomer:l,reset:u,isFiltered:d,getFilterQuery:p}),[i,o,c,l,u,d,p]);return(0,f.jsx)(tF.Provider,{value:m,children:e})}function rF(){let e=s.useContext(tF);if(!e)throw Error(`useAdmincrumbContext must be used within AdmincrumbProvider`);return e}function iF(){return s.useContext(tF)}var aF={github:e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,f.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]}),twitter:e=>(0,f.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z`})}),linkedin:e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z`}),(0,f.jsx)(`rect`,{width:`4`,height:`12`,x:`2`,y:`9`}),(0,f.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2`})]}),email:l.Mail};function oF({columns:e=[],socialLinks:n=[],copyright:i=`© 2024 Tous droits réservés.`,className:a}){return(0,f.jsx)(`footer`,{className:t.t(`bg-muted/40`,a),children:(0,f.jsxs)(`div`,{className:`container mx-auto px-4 py-12`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4`,children:[e.map((e,t)=>(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,f.jsx)(`ul`,{className:`space-y-2`,children:e.links.map((e,t)=>(0,f.jsx)(`li`,{children:(0,f.jsx)(`a`,{href:e.href,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:e.label})},t))})]},t)),n.length>0&&(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Suivez-nous`}),(0,f.jsx)(`div`,{className:`flex space-x-4`,children:n.map((e,t)=>{let n=aF[e.platform];return(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-8 w-8`,children:(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.platform,children:(0,f.jsx)(n,{className:`h-4 w-4`})})},t)})})]})]}),(0,f.jsx)(r.t,{className:`my-8`}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i}),(0,f.jsxs)(`div`,{className:`flex space-x-6`,children:[(0,f.jsx)(`a`,{href:`/privacy`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Politique de confidentialité`}),(0,f.jsx)(`a`,{href:`/terms`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Conditions d'utilisation`})]})]})]})})}function sF({items:e,defaultActiveId:n,variant:r=`default`,size:i=`md`,className:a,onTabChange:o}){let[c,l]=s.useState(n||e[0]?.id||``),u=e=>{l(e),o?.(e)},d={sm:`h-8 px-3 text-sm`,md:`h-10 px-4 text-sm`,lg:`h-12 px-6 text-base`};return(0,f.jsx)(`div`,{className:t.t(`w-full`,a),children:(0,f.jsxs)(Cr,{value:c,onValueChange:u,children:[(0,f.jsx)(wr,{className:t.t(`grid w-full`,r===`pills`&&`grid-cols-auto`,r!==`pills`&&`grid-cols-${e.length}`,{default:`bg-background`,pills:`bg-muted rounded-full`,underline:`bg-transparent border-b-2 border-transparent data-[state=active]:border-primary`}[r]),children:e.map(e=>(0,f.jsx)(Tr,{value:e.id,disabled:e.disabled,className:t.t(d[i],r===`underline`&&`rounded-none border-b-2 border-transparent data-[state=active]:border-primary`,r===`pills`&&`rounded-full`),children:e.label},e.id))}),e.map(e=>(0,f.jsx)(Er,{value:e.id,className:`mt-6`,children:e.content},e.id))]})})}function cF({items:e,separator:n=`/`,className:r}){return(0,f.jsx)(`nav`,{className:t.t(`flex items-center space-x-1 text-sm text-muted-foreground`,r),children:e.map((e,t)=>(0,f.jsxs)(s.Fragment,{children:[t>0&&(0,f.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:n}),e.href?(0,f.jsx)(`a`,{href:e.href,className:`hover:text-foreground transition-colors`,children:e.label}):(0,f.jsx)(`span`,{className:`text-foreground font-medium`,children:e.label})]},t))})}function lF({variant:e=`dropdown`,showFlags:i=!0,className:a}){let{currentLanguage:o,languages:s,changeLanguage:c,isLoading:u}=WP(),d=s.find(e=>e.code===o);return e===`select`?(0,f.jsxs)(n.d,{value:o,onValueChange:c,disabled:u,children:[(0,f.jsx)(n.y,{className:t.t(`w-[180px]`,a),children:(0,f.jsxs)(n.b,{children:[i&&d?.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:d.flagEmoji}),d?.label]})}),(0,f.jsx)(n.f,{children:s.map(e=>(0,f.jsxs)(n.m,{value:e.code,children:[i&&e.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]}):(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:t.t(`gap-2`,a),disabled:u,children:[(0,f.jsx)(l.Globe,{className:`h-4 w-4`}),i&&d?.flagEmoji&&(0,f.jsx)(`span`,{children:d.flagEmoji}),d?.label]})}),(0,f.jsx)(an,{align:`end`,children:s.map(e=>(0,f.jsxs)($,{onClick:()=>c(e.code),className:`cursor-pointer`,children:[i&&e.flagEmoji&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]})}function uF({children:e,header:n,sidebar:i,footer:a,collapsible:o=!1,className:c}){let[u,d]=s.useState(!1);return(0,f.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,c),children:[n&&(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`container flex h-14 max-w-screen-2xl items-center`,children:[o&&i&&(0,f.jsxs)(nr,{open:u,onOpenChange:d,children:[(0,f.jsx)(rr,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:`md:hidden`,children:[(0,f.jsx)(l.Menu,{className:`h-5 w-5`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]})}),(0,f.jsx)(cr,{side:`left`,className:`w-72 p-0`,children:(0,f.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,f.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Navigation`}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:()=>d(!1),children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:i})]})})]}),n]})}),(0,f.jsxs)(`div`,{className:`flex`,children:[i&&!o&&(0,f.jsx)(`aside`,{className:`hidden w-64 border-r bg-muted/40 md:block`,children:(0,f.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:i})}),(0,f.jsx)(`main`,{className:`flex-1`,children:(0,f.jsx)(`div`,{className:`container mx-auto p-4`,children:e})})]}),a&&(0,f.jsx)(`footer`,{className:`border-t bg-muted/40`,children:(0,f.jsx)(`div`,{className:`container mx-auto p-4`,children:a})})]})}var dF=e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,f.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]}),fF=e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z`}),(0,f.jsx)(`rect`,{width:`4`,height:`12`,x:`2`,y:`9`}),(0,f.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2`})]}),pF=e=>(0,f.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z`})}),mF=e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`rect`,{width:`20`,height:`20`,x:`2`,y:`2`,rx:`5`,ry:`5`}),(0,f.jsx)(`path`,{d:`M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z`}),(0,f.jsx)(`line`,{x1:`17.5`,x2:`17.51`,y1:`6.5`,y2:`6.5`})]});function hF({config:e,onSubmit:n,onForgotPassword:a,onSignUp:o,onSSOGoogle:c,onSSOMicrosoft:u,onSSOApple:d,onSSOLinkedIn:p,onSSOGithub:m,onSSOFacebook:h,onSSOInstagram:g,onSSOFranceConnect:_,showSocialLogin:v=!1,className:y}){let b=!1;try{b=Ar().isDarkMode}catch{}let x=e?.theme_json?.dark_mode??b,[S,C]=s.useState({email:``,password:``,rememberMe:!1}),[w,T]=s.useState(!1),E=s.useMemo(()=>e?.assets?x?e.assets.theme_logo_dark:e.assets.theme_logo_light:null,[e?.assets,x]),D=s.useMemo(()=>e?.color_json?{"--login-primary":e.color_json.primary,"--login-secondary":e.color_json.secondary,"--login-accent":e.color_json.accent}:{},[e?.color_json]),O=s.useMemo(()=>{let t=[];if(!e?.signup_options)return v&&(m&&t.push({id:`github`,label:`GitHub`,icon:(0,f.jsx)(dF,{className:`h-4 w-4`}),onClick:m}),c&&t.push({id:`google`,label:`Google`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:c})),t;let n=e.signup_options;return n.allow_sso_google&&t.push({id:`google`,label:`Google`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:c}),n.allow_sso_microsoft&&t.push({id:`microsoft`,label:`Microsoft`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:u}),n.allow_sso_apple&&t.push({id:`apple`,label:`Apple`,icon:(0,f.jsx)(l.Apple,{className:`h-4 w-4`}),onClick:d}),n.allow_sso_linkedIn&&t.push({id:`linkedin`,label:`LinkedIn`,icon:(0,f.jsx)(fF,{className:`h-4 w-4`}),onClick:p}),n.allow_sso_github&&t.push({id:`github`,label:`GitHub`,icon:(0,f.jsx)(dF,{className:`h-4 w-4`}),onClick:m}),n.allow_sso_facebook&&t.push({id:`facebook`,label:`Facebook`,icon:(0,f.jsx)(pF,{className:`h-4 w-4`}),onClick:h}),n.allow_sso_instagram&&t.push({id:`instagram`,label:`Instagram`,icon:(0,f.jsx)(mF,{className:`h-4 w-4`}),onClick:g}),n.allow_sso_france_connect&&t.push({id:`france-connect`,label:`France Connect`,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`}),onClick:_}),t},[e?.signup_options,v,c,u,d,p,m,h,g,_]),k=e?.signup_options?.allow_login!==!1,A=async e=>{e.preventDefault(),T(!0);try{await n?.(S)}finally{T(!1)}},j=e=>t=>{C(n=>({...n,[e]:e===`rememberMe`?t.target.checked:t.target.value}))};return(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center p-4`,y),style:D,children:(0,f.jsxs)(Y,{className:`w-full max-w-md`,children:[(0,f.jsxs)(X,{className:`space-y-1`,children:[E&&(0,f.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,f.jsx)(`img`,{src:E,alt:e?.theme_json?.name||`Logo`,className:`max-h-16 max-w-full object-contain`})}),(0,f.jsx)(Z,{className:`text-2xl text-center`,children:`Connexion`}),(0,f.jsx)(Se,{className:`text-center`,children:`Entrez vos identifiants pour accéder à votre compte`})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[O.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:t.t(`grid gap-4`,O.length===1?`grid-cols-1`:`grid-cols-2`),children:O.map(e=>(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:e.onClick,type:`button`,children:[e.icon,e.label]},e.id))}),k&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,f.jsx)(r.t,{className:`w-full`})}),(0,f.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,f.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:`Ou continuez avec`})})]})]}),k&&(0,f.jsxs)(`form`,{onSubmit:A,className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`email`,children:`Email`}),(0,f.jsx)(r.n,{id:`email`,type:`email`,placeholder:`votre@email.com`,value:S.email,onChange:j(`email`),required:!0})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`password`,children:`Mot de passe`}),(0,f.jsx)(r.n,{id:`password`,type:`password`,placeholder:`••••••••`,value:S.password,onChange:j(`password`),required:!0})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,f.jsx)(`input`,{id:`remember`,type:`checkbox`,checked:S.rememberMe,onChange:j(`rememberMe`),className:`h-4 w-4 rounded border-gray-300`}),(0,f.jsx)(i.o,{htmlFor:`remember`,className:`text-sm`,children:`Se souvenir de moi`})]}),a&&(0,f.jsx)(r.r,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:a,children:`Mot de passe oublié ?`})]}),(0,f.jsx)(r.r,{type:`submit`,className:`w-full`,disabled:w,style:e?.color_json?.primary?{backgroundColor:e.color_json.primary,color:e.color_json.secondary}:void 0,children:w?`Connexion...`:`Se connecter`})]}),o&&(0,f.jsxs)(`div`,{className:`text-center text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Pas encore de compte ? `}),(0,f.jsx)(r.r,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:o,children:`S'inscrire`})]}),e?.waka_powered&&(0,f.jsx)(`div`,{className:`text-center text-xs text-muted-foreground mt-4 pt-4 border-t`,children:`Powered by Waka`})]})]})})}var gF=s.createContext(null);function _F(){let e=s.useContext(gF);if(!e)throw Error(`Sidebar components must be used within WakaSidebar`);return e}function vF({config:e}){let{LinkComponent:t}=_F(),n=e.component?e.component:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.src&&(0,f.jsx)(`img`,{src:e.src,alt:e.alt||`Logo`,className:`h-8 w-auto object-contain`}),e.title&&(0,f.jsx)(`span`,{className:`text-lg font-bold tracking-wide`,children:e.title})]});return e.href?t?(0,f.jsx)(t,{href:e.href,className:`block`,onClick:e.onClick,children:n}):(0,f.jsx)(`a`,{href:e.href,className:`block`,onClick:e.onClick,children:n}):e.onClick?(0,f.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`block text-left`,children:n}):(0,f.jsx)(`div`,{children:n})}function yF({item:e,isChild:n=!1,renderItem:r}){let{activeId:i,setActiveId:a,expandedIds:o,toggleExpanded:s,isMobile:c,closeOnNavigate:u,onClose:d,LinkComponent:p}=_F(),m=e.children&&e.children.length>0,h=o.includes(e.id),g=i===e.id||e.active,_=()=>{e.disabled||(m?s(e.id):(a(e.id),e.onClick?.(),c&&u&&d()))};if(r)return(0,f.jsx)(f.Fragment,{children:r(e,n)});let v=(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200`,`hover:bg-white/10`,g&&!m&&`bg-sidebar-active text-sidebar-active-foreground`,n&&`ml-6 text-[13px]`,e.disabled&&`opacity-50 cursor-not-allowed`),children:[e.icon&&(0,f.jsx)(`span`,{className:t.t(`flex-shrink-0`,n?`h-4 w-4`:`h-5 w-5`),children:e.icon}),(0,f.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge!==void 0&&(0,f.jsx)(`span`,{className:`ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground`,children:e.badge}),m&&(0,f.jsx)(l.ChevronDown,{className:t.t(`h-4 w-4 transition-transform duration-200`,h&&`rotate-180`)})]});if(m)return(0,f.jsxs)(pt,{open:h,onOpenChange:()=>s(e.id),children:[(0,f.jsx)(mt,{asChild:!0,children:(0,f.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,children:v})}),(0,f.jsx)(ht,{className:`space-y-1 pt-1`,children:e.children?.map(e=>(0,f.jsx)(yF,{item:e,isChild:!0,renderItem:r},e.id))})]});if(e.href){let t={href:e.href,className:`block`,onClick:t=>{if(e.disabled){t.preventDefault();return}_()}};return p?(0,f.jsx)(p,{...t,children:v}):(0,f.jsx)(`a`,{...t,children:v})}return(0,f.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,onClick:_,children:v})}function bF({config:e}){let{LinkComponent:n}=_F(),r=e.initials||e.name.split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),i=[{id:`profile`,label:`Profil`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`})},{id:`settings`,label:`Paramètres`,icon:(0,f.jsx)(l.Settings,{className:`h-4 w-4`})},{id:`logout`,label:`Déconnexion`,icon:(0,f.jsx)(l.LogOut,{className:`h-4 w-4`}),variant:`destructive`}],a=e.actions??i;return(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10`,children:[(0,f.jsxs)(ve,{className:`h-10 w-10 border-2 border-sidebar-active`,children:[(0,f.jsx)(ye,{src:e.avatarUrl,alt:e.name}),(0,f.jsx)(be,{className:`bg-sidebar-active text-sidebar-active-foreground text-sm font-medium`,children:r})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.name}),e.email&&(0,f.jsx)(`p`,{className:`text-xs text-sidebar-foreground/70 truncate`,children:e.email})]}),(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4 flex-shrink-0 opacity-70`})]})}),(0,f.jsx)(an,{align:`end`,className:`w-56`,children:a.map((e,r)=>(0,f.jsxs)(s.Fragment,{children:[e.variant===`destructive`&&r>0&&(0,f.jsx)(ln,{}),(0,f.jsx)($,{onClick:e.onClick,className:t.t(e.variant===`destructive`&&`text-destructive focus:text-destructive`),asChild:!!e.href,children:e.href?n?(0,f.jsxs)(n,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,f.jsxs)(`a`,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]})})]},e.id))})]})}function xF({logo:e,menu:t,user:n,userPosition:r=`bottom`,header:i,footer:a,renderItem:o}){return(0,f.jsxs)(`div`,{className:`flex h-full flex-col`,children:[e&&(0,f.jsx)(`div`,{className:`flex-shrink-0 p-4 pb-2`,children:(0,f.jsx)(vF,{config:e})}),i&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2`,children:i}),n&&r===`top`&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-3 py-2 border-b border-white/10`,children:(0,f.jsx)(bF,{config:n})}),(0,f.jsx)(er,{className:`flex-1 px-3 py-4`,children:(0,f.jsx)(`nav`,{className:`space-y-1`,children:t.map(e=>(0,f.jsx)(yF,{item:e,renderItem:o},e.id))})}),a&&(0,f.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2 border-t border-white/10`,children:a}),n&&r===`bottom`&&(0,f.jsx)(`div`,{className:`flex-shrink-0 p-3 border-t border-white/10`,children:(0,f.jsx)(bF,{config:n})})]})}function SF({logo:e,menu:n,user:i,width:a=260,mobileBreakpoint:o=768,open:c,onOpenChange:u,className:d,contentClassName:p,backgroundColor:m,textColor:h,activeColor:g,hoverColor:_,userPosition:v=`bottom`,showHamburger:y=!0,hamburgerPosition:b=`left`,renderItem:x,footer:S,header:C,position:w=`fixed`,LinkComponent:T}){let[E,D]=s.useState(!1),O=c!==void 0,k=O?c:E,A=O?u:D,[j,M]=s.useState(!1);s.useEffect(()=>{let e=()=>{M(window.innerWidth<o)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let[N,P]=s.useState(()=>{let e=t=>{for(let n of t){if(n.active)return n.id;if(n.children){let t=e(n.children);if(t)return t}}return null};return e(n)}),[F,I]=s.useState(()=>{let e=(t,n=[])=>{for(let r of t){if(r.active)return n;if(r.children){let t=e(r.children,[...n,r.id]);if(t.length>n.length)return t}}return[]};return e(n)}),L={activeId:N,setActiveId:P,expandedIds:F,toggleExpanded:s.useCallback(e=>{I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),isMobile:j,closeOnNavigate:!0,onClose:()=>A(!1),LinkComponent:T},R={"--sidebar-bg":m||`hsl(var(--sidebar-background, var(--card)))`,"--sidebar-text":h||`hsl(var(--sidebar-foreground, var(--muted-foreground)))`,"--sidebar-active":g||`hsl(var(--sidebar-primary, var(--primary)))`,"--sidebar-active-foreground":`hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))`,"--sidebar-hover":_||`hsl(var(--sidebar-accent, var(--accent)))`},z=t.t(`bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]`,`[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]`,`[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]`,`[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]`,`[&_.text-sidebar-foreground\\/70]:opacity-70`,`[&_.border-sidebar-active]:border-[var(--sidebar-active)]`,p),B=(0,f.jsx)(gF.Provider,{value:L,children:(0,f.jsx)(`div`,{className:t.t(`h-full`,z),style:R,children:(0,f.jsx)(xF,{logo:e,menu:n,user:i,userPosition:v,header:C,footer:S,renderItem:x})})});return(0,f.jsxs)(f.Fragment,{children:[y&&j&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:t.t(`fixed top-3 z-50`,b===`left`?`left-3`:`right-3`),onClick:()=>A(!0),children:[(0,f.jsx)(l.Menu,{className:`h-6 w-6`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]}),!j&&(0,f.jsx)(`aside`,{className:t.t(w===`fixed`?`fixed left-0 top-0 h-screen z-40`:`relative h-full`,d),style:{width:a},children:B}),j&&(0,f.jsx)(nr,{open:k,onOpenChange:A,children:(0,f.jsxs)(cr,{side:`left`,className:t.t(`w-[280px] p-0 border-0`,d),style:R,"aria-describedby":`sidebar-description`,children:[(0,f.jsx)(dr,{className:`sr-only`,children:`Menu de navigation`}),(0,f.jsx)(fr,{id:`sidebar-description`,className:`sr-only`,children:`Menu principal de l'application`}),B]})})]})}function CF(){let[e,t]=s.useState(!1);return{isOpen:e,setIsOpen:t,open:s.useCallback(()=>t(!0),[]),close:s.useCallback(()=>t(!1),[]),toggle:s.useCallback(()=>t(e=>!e),[])}}function wF({sidebar:e,children:n,sidebarWidth:r=260,className:i,contentClassName:a}){let[o,c]=s.useState(!1),l=e.mobileBreakpoint||768;return s.useEffect(()=>{let e=()=>c(window.innerWidth<l);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]),(0,f.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,i),children:[(0,f.jsx)(SF,{...e,width:r}),(0,f.jsx)(`main`,{className:t.t(`min-h-screen transition-all duration-300`,a),style:{marginLeft:o?0:r},children:n})]})}function TF({title:e,subtitle:i,showSearch:a=!0,searchPlaceholder:o=`Rechercher...`,searchValue:c,onSearchChange:u,onSearchSubmit:d,primaryAction:p,secondaryActions:m,filters:h,notifications:g,unreadCount:_=0,onNotificationsClick:v,userMenu:y,leftContent:b,rightContent:x,filterContent:S,className:C,mainBarClassName:w,filterBarClassName:T,sticky:E=!0}){let[D,O]=s.useState(c||``),k=e=>{let t=e.target.value;O(t),u?.(t)},A=e=>{e.key===`Enter`&&d?.(D)},j=h&&h.length>0||S;return(0,f.jsxs)(`header`,{className:t.t(`w-full bg-background border-b`,E&&`sticky top-0 z-50`,C),children:[(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-4 px-4 py-2 min-h-[56px]`,w),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[p&&(0,f.jsxs)(r.r,{variant:p.variant||`default`,size:`sm`,onClick:p.onClick,className:`gap-2`,children:[p.icon||(0,f.jsx)(l.Plus,{className:`h-4 w-4`}),p.label]}),a&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{type:`search`,placeholder:o,value:D,onChange:k,onKeyDown:A,className:`pl-9 w-[200px] h-9 bg-muted/50`})]}),b]}),(e||i)&&(0,f.jsxs)(`div`,{className:`flex-1 text-center`,children:[e&&(0,f.jsx)(`h1`,{className:`text-lg font-semibold leading-none`,children:e}),i&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:i})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-auto`,children:[m?.map(e=>(0,f.jsxs)(r.r,{variant:e.variant||`ghost`,size:`sm`,onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},e.id)),x,(g||v)&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`icon`,className:`relative`,onClick:g?void 0:v,children:[(0,f.jsx)(l.Bell,{className:`h-5 w-5`}),_>0&&(0,f.jsx)(n.x,{variant:`destructive`,className:`absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs`,children:_>9?`9+`:_})]})}),g&&g.length>0&&(0,f.jsxs)(an,{align:`end`,className:`w-80`,children:[(0,f.jsx)(`div`,{className:`p-2 font-semibold border-b`,children:`Notifications`}),g.slice(0,5).map(e=>(0,f.jsxs)($,{onClick:e.onClick,className:t.t(`flex flex-col items-start gap-1 p-3`,!e.read&&`bg-muted/50`),children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.title}),e.description&&(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.description}),e.time&&(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.time})]},e.id))]})]}),y&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`gap-2`,children:[(0,f.jsxs)(ve,{className:`h-7 w-7`,children:[y.avatar&&(0,f.jsx)(ye,{src:y.avatar,alt:y.name}),(0,f.jsx)(be,{className:`text-xs`,children:y.initials||y.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4`})]})}),(0,f.jsxs)(an,{align:`end`,className:`w-56`,children:[(0,f.jsxs)(`div`,{className:`p-2`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:y.name}),y.email&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.email})]}),(0,f.jsx)(ln,{}),y.items.map((e,t)=>e.separator?(0,f.jsx)(ln,{},t):(0,f.jsxs)($,{onClick:e.onClick,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]},t))]})]})]})]}),j&&(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-2 px-4 py-2 border-t bg-muted/30`,T),children:[h?.map(e=>(0,f.jsxs)(n.d,{value:e.value,onValueChange:e.onChange,children:[(0,f.jsxs)(n.y,{className:`w-auto h-8 gap-2 bg-muted/50 border-0`,children:[e.icon,(0,f.jsx)(n.b,{placeholder:e.placeholder||e.label})]}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]},e.id)),S]})]})}var EF=s.createContext({});function DF(){return s.useContext(EF)}function OF({title:e=`Tableau de bord`,description:n,period:i,onPeriodChange:a,periods:o=[{value:`today`,label:`Aujourd'hui`},{value:`week`,label:`Cette semaine`},{value:`month`,label:`Ce mois`},{value:`year`,label:`Cette année`}],onRefresh:s,loading:c,quickActions:u}){return(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[a&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(l.Calendar,{className:`mr-2 h-4 w-4`}),o.find(e=>e.value===i)?.label||`Période`]})}),(0,f.jsx)(an,{align:`end`,children:o.map(e=>(0,f.jsx)($,{onClick:()=>a(e.value),className:t.t(i===e.value&&`bg-muted`),children:e.label},e.value))})]}),s&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:s,disabled:c,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,c&&`animate-spin`)})}),u?.map(e=>{let{LinkComponent:t}=DF();return(0,f.jsx)(r.r,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,f.jsxs)(t,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},e.id)})]})]})}function kF({stats:e,layout:t=`grid`,columns:n=4,loading:r}){return(0,f.jsx)(Wo,{layout:t,columns:n,gap:`md`,children:e.map(e=>(0,f.jsx)(Uo,{label:e.label,value:e.value,trend:e.trend,trendValue:e.trendValue,trendText:e.trendText,icon:e.icon,color:e.color,variant:`card`,loading:r},e.id))})}function AF({config:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsx)(an,{align:`end`,children:e.actions.map((e,t)=>(0,f.jsx)($,{onClick:e.onClick,children:e.label},t))})]})]}),(0,f.jsx)(Q,{children:e.chart})]})}function jF({config:e}){let{LinkComponent:t}=DF();return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,f.jsx)(`div`,{className:`flex gap-2`,children:e.actions.map((e,n)=>(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,f.jsxs)(t,{href:e.href,children:[e.label,(0,f.jsx)(l.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.label,(0,f.jsx)(l.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):e.label},n))})]}),(0,f.jsx)(Q,{children:e.table})]})}function MF({activities:e}){let n=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<1?`À l'instant`:r<60?`Il y a ${r} min`:i<24?`Il y a ${i}h`:a<7?`Il y a ${a}j`:t.toLocaleDateString(`fr-FR`)},r={info:`bg-blue-500`,success:`bg-green-500`,warning:`bg-yellow-500`,error:`bg-red-500`};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsx)(Z,{className:`text-base`,children:`Activité récente`})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full mt-2 flex-shrink-0`,r[e.type||`info`])}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:n(e.timestamp)})]},e.id))})})]})}function NF({title:e=`Tableau de bord`,description:n,stats:r,charts:i,tables:a,activities:o,quickActions:c,showHeader:l=!0,onRefresh:u,loading:d=!1,period:p=`month`,onPeriodChange:m,periods:h,statsLayout:g=`grid`,statsColumns:_=4,className:v,LinkComponent:y}){let b=s.useMemo(()=>({LinkComponent:y}),[y]);return(0,f.jsx)(EF.Provider,{value:b,children:(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[l&&(0,f.jsx)(OF,{title:e,description:n,period:p,onPeriodChange:m,periods:h,onRefresh:u,loading:d,quickActions:c}),r&&r.length>0&&(0,f.jsx)(kF,{stats:r,layout:g,columns:_,loading:d}),i&&i.length>0&&(0,f.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:i.map(e=>(0,f.jsx)(AF,{config:e},e.id))}),(0,f.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[a&&a.length>0&&(0,f.jsx)(`div`,{className:t.t(`space-y-6`,o?`lg:col-span-2`:`lg:col-span-3`),children:a.map(e=>(0,f.jsx)(jF,{config:e},e.id))}),o&&o.length>0&&(0,f.jsx)(`div`,{className:t.t(!a||a.length===0?`lg:col-span-3`:``),children:(0,f.jsx)(MF,{activities:o})})]})]})})}var PF=[{id:`revenue`,label:`Revenus`,value:`€45,231.89`,trend:`up`,trendValue:`+20.1%`,trendText:`vs mois dernier`,icon:(0,f.jsx)(l.DollarSign,{className:`h-5 w-5`}),color:`success`},{id:`users`,label:`Utilisateurs`,value:`2,350`,trend:`up`,trendValue:`+180`,trendText:`cette semaine`,icon:(0,f.jsx)(l.Users,{className:`h-5 w-5`}),color:`blue`},{id:`orders`,label:`Commandes`,value:`12,234`,trend:`down`,trendValue:`-4.3%`,trendText:`vs mois dernier`,icon:(0,f.jsx)(l.ShoppingCart,{className:`h-5 w-5`}),color:`purple`},{id:`performance`,label:`Performance`,value:`94.2%`,trend:`up`,trendValue:`+2.4%`,icon:(0,f.jsx)(l.Activity,{className:`h-5 w-5`}),color:`primary`}];function FF({field:e,value:t,onChange:a}){let o=e=>{a?.(e)};return e.type===`custom`&&e.customComponent?(0,f.jsx)(`div`,{className:`space-y-2`,children:e.customComponent}):(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(i.o,{htmlFor:e.id,className:`text-sm font-medium`,children:[e.label,e.required&&(0,f.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.type===`switch`&&(0,f.jsx)(mr,{id:e.id,checked:t,onCheckedChange:o,disabled:e.disabled})]}),e.description&&e.type!==`switch`&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`switch`&&e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`text`&&(0,f.jsx)(r.n,{id:e.id,type:`text`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`email`&&(0,f.jsx)(r.n,{id:e.id,type:`email`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`password`&&(0,f.jsx)(r.n,{id:e.id,type:`password`,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`textarea`&&(0,f.jsx)(i.n,{id:e.id,value:t||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled,rows:3}),e.type===`select`&&e.options&&(0,f.jsxs)(n.d,{value:t,onValueChange:o,disabled:e.disabled,children:[(0,f.jsx)(n.y,{id:e.id,children:(0,f.jsx)(n.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]})}function IF({section:e,values:t,onChange:n}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]})]})}),(0,f.jsx)(Q,{className:`space-y-6`,children:e.fields.map((i,a)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(FF,{field:i,value:t?.[i.id],onChange:e=>n?.(i.id,e)}),a<e.fields.length-1&&(0,f.jsx)(r.t,{className:`my-4`})]},i.id))})]})}function LF({title:e=`Paramètres`,description:n=`Gérez les paramètres de votre compte et de l'application.`,tabs:i,sections:a,useTabs:o=!0,defaultTab:c,values:u={},onChange:d,onSave:p,saving:m=!1,showSaveButton:h=!0,showDeleteAccount:g=!1,onDeleteAccount:_,className:v}){let[y,b]=s.useState(u),[x,S]=s.useState(!1);s.useEffect(()=>{b(u)},[u]);let C=(e,t)=>{b(n=>({...n,[e]:t})),S(!0),d?.(e,t)},w=async()=>{await p?.(y),S(!1)},T=e=>(0,f.jsx)(`div`,{className:`space-y-6`,children:e.map(e=>(0,f.jsx)(IF,{section:e,values:y,onChange:C},e.id))});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),h&&p&&(0,f.jsxs)(r.r,{onClick:w,disabled:m||!x,children:[m?(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,f.jsx)(l.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}),o&&i&&i.length>0?(0,f.jsxs)(Cr,{defaultValue:c||i[0].id,className:`space-y-6`,children:[(0,f.jsx)(wr,{className:`grid w-full grid-cols-2 md:w-auto md:inline-flex`,children:i.map(e=>(0,f.jsxs)(Tr,{value:e.id,className:`gap-2`,children:[e.icon,e.label]},e.id))}),i.map(e=>(0,f.jsx)(Er,{value:e.id,className:`space-y-6`,children:T(e.sections)},e.id))]}):a&&T(a),g&&_&&(0,f.jsxs)(Y,{className:`border-destructive`,children:[(0,f.jsxs)(X,{children:[(0,f.jsxs)(Z,{className:`text-base text-destructive flex items-center gap-2`,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4`}),`Zone dangereuse`]}),(0,f.jsx)(Se,{children:`Actions irréversibles concernant votre compte.`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(ne,{children:[(0,f.jsx)(re,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer mon compte`]})}),(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Êtes-vous sûr ?`}),(0,f.jsx)(ue,{children:`Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées.`})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:_,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer définitivement`})]})]})]})})]})]})}var RF=[{id:`profile`,label:`Profil`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`}),sections:[{id:`personal`,title:`Informations personnelles`,description:`Mettez à jour vos informations personnelles.`,icon:(0,f.jsx)(l.User,{className:`h-5 w-5`}),fields:[{id:`name`,label:`Nom complet`,type:`text`,placeholder:`Jean Dupont`,required:!0},{id:`email`,label:`Adresse email`,type:`email`,placeholder:`jean@exemple.com`,required:!0},{id:`bio`,label:`Bio`,type:`textarea`,placeholder:`Parlez-nous de vous...`}]}]},{id:`notifications`,label:`Notifications`,icon:(0,f.jsx)(l.Bell,{className:`h-4 w-4`}),sections:[{id:`email-notifs`,title:`Notifications par email`,description:`Gérez vos préférences de notification par email.`,icon:(0,f.jsx)(l.Mail,{className:`h-5 w-5`}),fields:[{id:`notif-marketing`,label:`Marketing`,description:`Recevoir des emails marketing et promotionnels.`,type:`switch`},{id:`notif-security`,label:`Sécurité`,description:`Recevoir des alertes de sécurité importantes.`,type:`switch`},{id:`notif-updates`,label:`Mises à jour`,description:`Recevoir les mises à jour de produit.`,type:`switch`}]}]},{id:`security`,label:`Sécurité`,icon:(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),sections:[{id:`password`,title:`Mot de passe`,description:`Changez votre mot de passe.`,icon:(0,f.jsx)(l.Lock,{className:`h-5 w-5`}),fields:[{id:`current-password`,label:`Mot de passe actuel`,type:`password`,placeholder:`••••••••`},{id:`new-password`,label:`Nouveau mot de passe`,type:`password`,placeholder:`••••••••`},{id:`confirm-password`,label:`Confirmer le mot de passe`,type:`password`,placeholder:`••••••••`}]},{id:`two-factor`,title:`Authentification à deux facteurs`,description:`Ajoutez une couche de sécurité supplémentaire.`,icon:(0,f.jsx)(l.Smartphone,{className:`h-5 w-5`}),fields:[{id:`2fa-enabled`,label:`Activer la 2FA`,description:`Utilisez une application d'authentification.`,type:`switch`}]}]},{id:`preferences`,label:`Préférences`,icon:(0,f.jsx)(l.Palette,{className:`h-4 w-4`}),sections:[{id:`appearance`,title:`Apparence`,description:`Personnalisez l'apparence de l'application.`,icon:(0,f.jsx)(l.Palette,{className:`h-5 w-5`}),fields:[{id:`theme`,label:`Thème`,type:`select`,options:[{value:`light`,label:`Clair`},{value:`dark`,label:`Sombre`},{value:`system`,label:`Système`}]},{id:`language`,label:`Langue`,type:`select`,options:[{value:`fr`,label:`Français`},{value:`en`,label:`English`},{value:`es`,label:`Español`}]}]}]}],zF=e=>(0,f.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,f.jsx)(`path`,{d:`M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z`})}),BF=e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,f.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]}),VF=e=>(0,f.jsxs)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`path`,{d:`M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z`}),(0,f.jsx)(`rect`,{width:`4`,height:`12`,x:`2`,y:`9`}),(0,f.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2`})]});function HF({url:e,name:n,size:i=`lg`,editable:a,onAvatarChange:o}){let c=s.useRef(null),u={sm:`h-12 w-12`,md:`h-16 w-16`,lg:`h-24 w-24`,xl:`h-32 w-32`},d=n.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(`div`,{className:`relative inline-block`,children:[(0,f.jsxs)(ve,{className:t.t(u[i],`border-4 border-background shadow-lg`),children:[(0,f.jsx)(ye,{src:e,alt:n}),(0,f.jsx)(be,{className:`text-lg font-medium`,children:d})]}),a&&o&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`input`,{ref:c,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&o&&o(t)},className:`hidden`}),(0,f.jsx)(r.r,{size:`icon`,variant:`secondary`,className:`absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md`,onClick:()=>c.current?.click(),children:(0,f.jsx)(l.Camera,{className:`h-4 w-4`})})]})]})}function UF({field:e,value:a,onChange:o,isEditing:s}){if(!s)return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsx)(`span`,{className:t.t(!a&&`text-muted-foreground italic`),children:a||`Non renseigné`})]});let c={id:e.id,value:a||``,onChange:e=>o(e.target.value),placeholder:e.placeholder,disabled:e.disabled};return e.type===`textarea`?(0,f.jsx)(i.n,{...c,rows:3}):e.type===`select`&&e.options?(0,f.jsxs)(n.d,{value:a,onValueChange:o,disabled:e.disabled,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,f.jsx)(n.f,{children:e.options.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]}):(0,f.jsx)(r.n,{type:e.type||`text`,...c})}function WF({section:e,values:t,onChange:n,isEditing:a}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,f.jsx)(Se,{children:e.description})]})]})}),(0,f.jsx)(Q,{className:`space-y-4`,children:e.fields.map((o,c)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(i.o,{htmlFor:o.id,className:`text-sm font-medium`,children:[o.label,o.required&&(0,f.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,f.jsx)(UF,{field:o,value:t[o.id]||``,onChange:e=>n(o.id,e),isEditing:a})]}),c<e.fields.length-1&&a&&(0,f.jsx)(r.t,{className:`my-4`})]},o.id))})]})}function GF({links:e,isEditing:t}){let n=e=>{switch(e){case`twitter`:return(0,f.jsx)(zF,{className:`h-4 w-4`});case`github`:return(0,f.jsx)(BF,{className:`h-4 w-4`});case`linkedin`:return(0,f.jsx)(VF,{className:`h-4 w-4`});case`website`:return(0,f.jsx)(l.Globe,{className:`h-4 w-4`});default:return(0,f.jsx)(l.Link,{className:`h-4 w-4`})}};return t?(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n(e.type),(0,f.jsx)(r.n,{value:e.url,className:`flex-1`,readOnly:!0})]},e.id))}):(0,f.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:e.map(e=>(0,f.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors`,children:[n(e.type),(0,f.jsx)(`span`,{children:e.label||e.type})]},e.id))})}function KF({profile:e,editable:n=!1,isEditing:i,onEditToggle:a,onChange:o,onSave:c,saving:u=!1,onAvatarChange:d,customSections:p,showSocialLinks:m=!0,showStats:h=!1,stats:g,layout:_=`card`,useTabs:v=!1,className:y}){let[b,x]=s.useState(!1),[S,C]=s.useState(e),w=i??b;s.useEffect(()=>{C(e)},[e]);let T=t=>{a?a(t):x(t),t||C(e)},E=(e,t)=>{C(n=>({...n,[e]:t})),o?.(e,t)},D=async()=>{await c?.(S),T(!1)},O=[{id:`personal`,title:`Informations personnelles`,icon:(0,f.jsx)(l.User,{className:`h-5 w-5`}),fields:[{id:`firstName`,label:`Prénom`,value:S.firstName||``,type:`text`,placeholder:`Jean`,icon:(0,f.jsx)(l.User,{className:`h-4 w-4`})},{id:`lastName`,label:`Nom`,value:S.lastName||``,type:`text`,placeholder:`Dupont`},{id:`email`,label:`Email`,value:S.email,type:`email`,placeholder:`jean@exemple.com`,required:!0,icon:(0,f.jsx)(l.Mail,{className:`h-4 w-4`})},{id:`phone`,label:`Téléphone`,value:S.phone||``,type:`tel`,placeholder:`+33 6 12 34 56 78`,icon:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})},{id:`bio`,label:`Bio`,value:S.bio||``,type:`textarea`,placeholder:`Parlez-nous de vous...`}]},{id:`professional`,title:`Informations professionnelles`,icon:(0,f.jsx)(l.Briefcase,{className:`h-5 w-5`}),fields:[{id:`role`,label:`Poste`,value:S.role||``,type:`text`,placeholder:`Développeur Senior`,icon:(0,f.jsx)(l.Briefcase,{className:`h-4 w-4`})},{id:`department`,label:`Département`,value:S.department||``,type:`text`,placeholder:`Engineering`},{id:`company`,label:`Entreprise`,value:S.company||``,type:`text`,placeholder:`Acme Inc.`,icon:(0,f.jsx)(l.Building,{className:`h-4 w-4`})},{id:`location`,label:`Localisation`,value:S.location||``,type:`text`,placeholder:`Paris, France`,icon:(0,f.jsx)(l.MapPin,{className:`h-4 w-4`})},{id:`website`,label:`Site web`,value:S.website||``,type:`url`,placeholder:`https://exemple.com`,icon:(0,f.jsx)(l.Globe,{className:`h-4 w-4`})}]}],k=p||O,A={firstName:S.firstName||``,lastName:S.lastName||``,email:S.email,phone:S.phone||``,bio:S.bio||``,role:S.role||``,department:S.department||``,company:S.company||``,location:S.location||``,website:S.website||``,...S.customFields};if(_===`compact`)return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-4`,y),children:[(0,f.jsx)(HF,{url:S.avatarUrl,name:S.displayName,size:`md`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:S.displayName}),S.role&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.role}),S.email&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]})]});let j=()=>(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 md:flex-row md:text-left`,children:[(0,f.jsx)(HF,{url:S.avatarUrl,name:S.displayName,size:`xl`,editable:n&&w,onAvatarChange:d}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-start md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:S.displayName}),S.role&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:S.role}),S.company&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Building,{className:`h-3 w-3`}),S.company]}),S.location&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MapPin,{className:`h-3 w-3`}),S.location]})]}),n&&(0,f.jsx)(`div`,{className:`flex gap-2`,children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>T(!1),disabled:u,children:[(0,f.jsx)(l.X,{className:`mr-2 h-4 w-4`}),`Annuler`]}),(0,f.jsxs)(r.r,{size:`sm`,onClick:D,disabled:u,children:[u?(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,f.jsx)(l.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}):(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>T(!0),children:[(0,f.jsx)(l.Edit3,{className:`mr-2 h-4 w-4`}),`Modifier`]})})]}),h&&g&&g.length>0&&(0,f.jsx)(`div`,{className:`flex gap-6 mt-4`,children:g.map((e,t)=>(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.label})]},t))}),m&&S.socialLinks&&S.socialLinks.length>0&&(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(GF,{links:S.socialLinks,isEditing:w})}),S.joinedAt&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4 flex items-center gap-1`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3`}),`Membre depuis`,` `,new Date(S.joinedAt).toLocaleDateString(`fr-FR`,{month:`long`,year:`numeric`})]})]})]}),M=()=>(0,f.jsx)(`div`,{className:`space-y-6`,children:k.map(e=>(0,f.jsx)(WF,{section:e,values:A,onChange:E,isEditing:w},e.id))});return _===`card`?(0,f.jsx)(Y,{className:y,children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-6`,children:[j(),(0,f.jsx)(r.t,{}),M()]})})}):(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[j(),v?(0,f.jsxs)(Cr,{defaultValue:k[0]?.id,className:`space-y-6`,children:[(0,f.jsx)(wr,{children:k.map(e=>(0,f.jsxs)(Tr,{value:e.id,className:`gap-2`,children:[e.icon,e.title]},e.id))}),k.map(e=>(0,f.jsx)(Er,{value:e.id,children:(0,f.jsx)(WF,{section:e,values:A,onChange:E,isEditing:w})},e.id))]}):M()]})}var qF={displayName:`Jean Dupont`,firstName:`Jean`,lastName:`Dupont`,email:`jean.dupont@exemple.com`,phone:`+33 6 12 34 56 78`,bio:`Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.`,avatarUrl:``,role:`Lead Developer`,department:`Engineering`,company:`Acme Inc.`,location:`Paris, France`,website:`https://jeandupont.dev`,joinedAt:new Date(`2023-01-15`),socialLinks:[{id:`1`,type:`twitter`,url:`https://twitter.com/jeandupont`,label:`@jeandupont`},{id:`2`,type:`github`,url:`https://github.com/jeandupont`,label:`jeandupont`},{id:`3`,type:`linkedin`,url:`https://linkedin.com/in/jeandupont`,label:`Jean Dupont`}]},JF=[{value:`admin`,label:`Administrateur`,color:`destructive`},{value:`moderator`,label:`Modérateur`,color:`warning`},{value:`user`,label:`Utilisateur`,color:`default`},{value:`guest`,label:`Invité`,color:`secondary`}],YF={active:{label:`Actif`,color:`bg-green-500`,icon:l.CheckCircle},inactive:{label:`Inactif`,color:`bg-gray-500`,icon:l.XCircle},pending:{label:`En attente`,color:`bg-yellow-500`,icon:l.Mail},banned:{label:`Banni`,color:`bg-red-500`,icon:l.Ban}};function XF({user:e,size:t=`sm`}){let n={sm:`h-8 w-8`,md:`h-10 w-10`},r=e.displayName.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(ve,{className:n[t],children:[(0,f.jsx)(ye,{src:e.avatarUrl,alt:e.displayName}),(0,f.jsx)(be,{className:`text-xs`,children:r})]})}function ZF({role:e,roles:t=JF}){let r=t.find(t=>t.value===e),i=e===`admin`?l.ShieldAlert:e===`moderator`?l.ShieldCheck:l.Shield;return(0,f.jsxs)(n.x,{variant:r?.color,children:[(0,f.jsx)(i,{className:`h-3 w-3 mr-1`}),r?.label||e]})}function QF({status:e}){let n=YF[e];return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,n.color)}),(0,f.jsx)(`span`,{className:`text-sm`,children:n.label})]})}function $F({open:e,onOpenChange:t,user:a,roles:o,permissions:c,onSubmit:u,loading:d}){let[p,m]=s.useState({email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]});s.useEffect(()=>{m(a?{email:a.email,displayName:a.displayName,firstName:a.firstName||``,lastName:a.lastName||``,role:a.role,status:a.status,permissions:a.permissions||[]}:{email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]})},[a,e]);let h=async e=>{e.preventDefault(),await u(p),t(!1)},g=e=>{m(t=>({...t,permissions:t.permissions?.includes(e)?t.permissions.filter(t=>t!==e):[...t.permissions||[],e]}))};return(0,f.jsx)(gt,{open:e,onOpenChange:t,children:(0,f.jsx)(xt,{className:`sm:max-w-[500px]`,children:(0,f.jsxs)(`form`,{onSubmit:h,children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:a?`Modifier l'utilisateur`:`Créer un utilisateur`}),(0,f.jsx)(Tt,{children:a?`Modifiez les informations de l'utilisateur.`:`Remplissez les informations pour créer un nouvel utilisateur.`})]}),(0,f.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`firstName`,children:`Prénom`}),(0,f.jsx)(r.n,{id:`firstName`,value:p.firstName,onChange:e=>m(t=>({...t,firstName:e.target.value})),placeholder:`Jean`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`lastName`,children:`Nom`}),(0,f.jsx)(r.n,{id:`lastName`,value:p.lastName,onChange:e=>m(t=>({...t,lastName:e.target.value})),placeholder:`Dupont`})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`displayName`,children:`Nom d'affichage *`}),(0,f.jsx)(r.n,{id:`displayName`,value:p.displayName,onChange:e=>m(t=>({...t,displayName:e.target.value})),placeholder:`Jean Dupont`,required:!0})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`email`,children:`Email *`}),(0,f.jsx)(r.n,{id:`email`,type:`email`,value:p.email,onChange:e=>m(t=>({...t,email:e.target.value})),placeholder:`jean@exemple.com`,required:!0})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`role`,children:`Rôle`}),(0,f.jsxs)(n.d,{value:p.role,onValueChange:e=>m(t=>({...t,role:e})),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:o.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`status`,children:`Statut`}),(0,f.jsxs)(n.d,{value:p.status,onValueChange:e=>m(t=>({...t,status:e})),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(YF).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t.label},e))})]})]})]}),c&&c.length>0&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Permissions`}),(0,f.jsx)(`div`,{className:`border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto`,children:c.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,f.jsx)(we,{id:e.id,checked:p.permissions?.includes(e.id),onCheckedChange:()=>g(e.id)}),(0,f.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:e.name})]},e.id))})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Annuler`}),(0,f.jsxs)(r.r,{type:`submit`,disabled:d,children:[d&&(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),a?`Enregistrer`:`Créer`]})]})]})})})}function eI({user:e,onEdit:t,onDelete:n,onResetPassword:i,onStatusChange:a,onRoleChange:o,roles:s}){return(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[t&&(0,f.jsxs)($,{onClick:t,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),i&&(0,f.jsxs)($,{onClick:i,children:[(0,f.jsx)(l.Key,{className:`mr-2 h-4 w-4`}),`Réinitialiser le mot de passe`]}),o&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsx)(cn,{children:`Changer le rôle`}),s.map(t=>(0,f.jsx)($,{onClick:()=>o(t.value),disabled:e.role===t.value,children:t.label},t.value))]}),a&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsx)(cn,{children:`Changer le statut`}),Object.entries(YF).map(([t,n])=>(0,f.jsx)($,{onClick:()=>a(t),disabled:e.status===t,children:n.label},t))]}),n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:n,className:`text-destructive focus:text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})}function tI({users:e,roles:i=JF,permissions:a,selectedUsers:o=[],onSelectionChange:c,onCreate:u,onEdit:d,onDelete:p,onBulkDelete:m,onRoleChange:h,onStatusChange:g,onResetPassword:_,onExport:v,onRefresh:y,loading:b=!1,actionLoading:x=!1,searchQuery:S=``,onSearchChange:C,roleFilter:w=`all`,onRoleFilterChange:T,statusFilter:E=`all`,onStatusFilterChange:D,showBulkActions:O=!0,showCreateButton:k=!0,title:A=`Gestion des utilisateurs`,description:j=`Gérez les utilisateurs, leurs rôles et permissions.`,className:M}){let[N,P]=s.useState(!1),[F,I]=s.useState(null),[L,R]=s.useState(null),[z,B]=s.useState(!1),V=s.useMemo(()=>e.filter(e=>{if(S){let t=S.toLowerCase();if(!(e.displayName.toLowerCase().includes(t)||e.email.toLowerCase().includes(t)))return!1}return!(w!==`all`&&e.role!==w||E!==`all`&&e.status!==E)}),[e,S,w,E]),H=e=>{e?c?.(V.map(e=>e.id)):c?.([])},U=(e,t)=>{t?c?.([...o,e]):c?.(o.filter(t=>t!==e))},W=async e=>{await u?.(e)},G=async e=>{F&&(await d?.(F.id,e),I(null))},K=async()=>{L&&(await p?.(L.id),R(null))},q=async()=>{await m?.(o),c?.([]),B(!1)},ee=e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,year:`numeric`});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,M),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-6 w-6`}),A]}),j&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:j})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:y,disabled:b,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,b&&`animate-spin`)})}),v&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:v,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Exporter`]}),k&&u&&(0,f.jsxs)(r.r,{size:`sm`,onClick:()=>P(!0),children:[(0,f.jsx)(l.UserPlus,{className:`mr-2 h-4 w-4`}),`Ajouter`]})]})]}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center`,children:[C&&(0,f.jsxs)(`div`,{className:`relative flex-1`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher un utilisateur...`,value:S,onChange:e=>C(e.target.value),className:`pl-9`})]}),T&&(0,f.jsxs)(n.d,{value:w,onValueChange:e=>T(e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`mr-2 h-4 w-4`}),(0,f.jsx)(n.b,{placeholder:`Rôle`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les rôles`}),i.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))]})]}),D&&(0,f.jsxs)(n.d,{value:E,onValueChange:e=>D(e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`mr-2 h-4 w-4`}),(0,f.jsx)(n.b,{placeholder:`Statut`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les statuts`}),Object.entries(YF).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t.label},e))]})]})]}),O&&o.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg`,children:[(0,f.jsxs)(`span`,{className:`text-sm font-medium`,children:[o.length,` utilisateur(s) sélectionné(s)`]}),m&&(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:()=>B(!0),children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>c?.([]),children:`Désélectionner`})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`p-0`,children:(0,f.jsxs)(hr,{children:[(0,f.jsx)(gr,{children:(0,f.jsxs)(yr,{children:[c&&(0,f.jsx)(br,{className:`w-[50px]`,children:(0,f.jsx)(we,{checked:V.length>0&&o.length===V.length,onCheckedChange:H})}),(0,f.jsx)(br,{children:`Utilisateur`}),(0,f.jsx)(br,{children:`Rôle`}),(0,f.jsx)(br,{children:`Statut`}),(0,f.jsx)(br,{children:`Inscrit le`}),(0,f.jsx)(br,{children:`Dernière connexion`}),(0,f.jsx)(br,{className:`w-[50px]`})]})}),(0,f.jsx)(_r,{children:b?(0,f.jsx)(yr,{children:(0,f.jsx)(xr,{colSpan:c?7:6,className:`text-center py-8`,children:(0,f.jsx)(l.Loader2,{className:`h-6 w-6 animate-spin mx-auto`})})}):V.length===0?(0,f.jsx)(yr,{children:(0,f.jsx)(xr,{colSpan:c?7:6,className:`text-center py-8 text-muted-foreground`,children:`Aucun utilisateur trouvé`})}):V.map(e=>(0,f.jsxs)(yr,{children:[c&&(0,f.jsx)(xr,{children:(0,f.jsx)(we,{checked:o.includes(e.id),onCheckedChange:t=>U(e.id,t)})}),(0,f.jsx)(xr,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(XF,{user:e}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.displayName}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email})]})]})}),(0,f.jsx)(xr,{children:(0,f.jsx)(ZF,{role:e.role,roles:i})}),(0,f.jsx)(xr,{children:(0,f.jsx)(QF,{status:e.status})}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:ee(e.createdAt)}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:e.lastLogin?ee(e.lastLogin):`-`}),(0,f.jsx)(xr,{children:(0,f.jsx)(eI,{user:e,roles:i,onEdit:d?()=>I(e):void 0,onDelete:p?()=>R(e):void 0,onResetPassword:_?()=>_(e.id):void 0,onRoleChange:h?t=>h(e.id,t):void 0,onStatusChange:g?t=>g(e.id,t):void 0})})]},e.id))})]})})}),(0,f.jsx)($F,{open:N,onOpenChange:P,roles:i,permissions:a,onSubmit:W,loading:x}),(0,f.jsx)($F,{open:!!F,onOpenChange:e=>!e&&I(null),user:F||void 0,roles:i,permissions:a,onSubmit:G,loading:x}),(0,f.jsx)(ne,{open:!!L,onOpenChange:e=>!e&&R(null),children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer l'utilisateur ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,L?.displayName,` ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:K,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})}),(0,f.jsx)(ne,{open:z,onOpenChange:B,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer les utilisateurs ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,o.length,` utilisateur(s) ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:q,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})})]})}var nI=[{id:`1`,email:`admin@exemple.com`,displayName:`Admin User`,firstName:`Admin`,lastName:`User`,role:`admin`,status:`active`,createdAt:new Date(`2023-01-01`),lastLogin:new Date(`2024-01-15`)},{id:`2`,email:`moderator@exemple.com`,displayName:`Marie Modérateur`,firstName:`Marie`,lastName:`Modérateur`,role:`moderator`,status:`active`,createdAt:new Date(`2023-03-15`),lastLogin:new Date(`2024-01-14`)},{id:`3`,email:`user@exemple.com`,displayName:`Jean Utilisateur`,firstName:`Jean`,lastName:`Utilisateur`,role:`user`,status:`active`,createdAt:new Date(`2023-06-01`),lastLogin:new Date(`2024-01-10`)},{id:`4`,email:`pending@exemple.com`,displayName:`Paul Pending`,firstName:`Paul`,lastName:`Pending`,role:`user`,status:`pending`,createdAt:new Date(`2024-01-10`)},{id:`5`,email:`banned@exemple.com`,displayName:`Bob Banni`,firstName:`Bob`,lastName:`Banni`,role:`guest`,status:`banned`,createdAt:new Date(`2023-09-01`),lastLogin:new Date(`2023-12-01`)}],rI=[{id:`read`,name:`Lecture`,description:`Accès en lecture`,category:`Base`},{id:`write`,name:`Écriture`,description:`Accès en écriture`,category:`Base`},{id:`delete`,name:`Suppression`,description:`Accès suppression`,category:`Base`},{id:`admin`,name:`Administration`,description:`Accès admin`,category:`Admin`},{id:`users`,name:`Gestion utilisateurs`,description:`Gérer les utilisateurs`,category:`Admin`}],iI={created:{icon:l.Plus,color:`text-green-500`,label:`créé`},updated:{icon:l.Edit,color:`text-blue-500`,label:`modifié`},deleted:{icon:l.Trash2,color:`text-red-500`,label:`supprimé`},commented:{icon:l.MessageSquare,color:`text-purple-500`,label:`commenté`},uploaded:{icon:l.Upload,color:`text-cyan-500`,label:`uploadé`},downloaded:{icon:l.Download,color:`text-gray-500`,label:`téléchargé`},shared:{icon:l.User,color:`text-orange-500`,label:`partagé`},approved:{icon:l.Check,color:`text-green-500`,label:`approuvé`},rejected:{icon:l.X,color:`text-red-500`,label:`rejeté`},mentioned:{icon:l.Bell,color:`text-yellow-500`,label:`mentionné`},assigned:{icon:l.User,color:`text-indigo-500`,label:`assigné`},completed:{icon:l.Check,color:`text-green-500`,label:`terminé`},custom:{icon:l.AlertCircle,color:`text-gray-500`,label:``}};function aI({user:e,size:t=`sm`}){let n={sm:`h-8 w-8`,md:`h-10 w-10`},r=e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,f.jsxs)(ve,{className:n[t],children:[(0,f.jsx)(ye,{src:e.avatar,alt:e.name}),(0,f.jsx)(be,{className:`text-xs`,children:r})]})}function oI({type:e,customIcon:n,customColor:r}){let i=iI[e],a=i.icon;return(0,f.jsx)(`div`,{className:t.t(`flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm`,r||i.color),children:n||(0,f.jsx)(a,{className:`h-4 w-4`})})}function sI({activity:e,showAvatar:t,relativeTime:r,layout:i,isLast:a}){let o=e=>{let t=typeof e==`string`?new Date(e):e;if(r){let e=new Date().getTime()-t.getTime(),n=Math.floor(e/6e4),r=Math.floor(n/60),i=Math.floor(r/24);if(n<1)return`À l'instant`;if(n<60)return`Il y a ${n} min`;if(r<24)return`Il y a ${r}h`;if(i<7)return`Il y a ${i}j`}return t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})},s=iI[e.type];return i===`compact`?(0,f.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,f.jsx)(oI,{type:e.type,customIcon:e.icon,customColor:e.color}),(0,f.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,f.jsxs)(`p`,{className:`text-sm truncate`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]})}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:o(e.timestamp)})]}):i===`feed`?(0,f.jsx)(Y,{className:`mb-4`,children:(0,f.jsx)(Q,{className:`pt-4`,children:(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[t&&(0,f.jsx)(aI,{user:e.user,size:`md`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:s.label||e.type}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e.timestamp)})]}),(0,f.jsx)(`p`,{className:`text-sm`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,f.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment})]})]})})}):(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,f.jsx)(oI,{type:e.type,customIcon:e.icon,customColor:e.color}),!a&&(0,f.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-2`})]}),(0,f.jsx)(`div`,{className:`flex-1 pb-8`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t&&(0,f.jsx)(aI,{user:e.user}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,f.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground mt-2 block`,children:o(e.timestamp)})]})]})})]})}function cI({activities:e,title:i=`Activité`,showSearch:a=!0,showFilters:o=!0,filters:c=[],activeFilter:u,onFilterChange:d,showRefresh:p=!0,onRefresh:m,loading:h=!1,groupByDay:g=!0,showLoadMore:_=!1,onLoadMore:v,loadingMore:y=!1,showAvatars:b=!0,relativeTime:x=!0,layout:S=`timeline`,className:C}){let[w,T]=s.useState(``),[E,D]=s.useState(null),O=u??E,k=e=>{d?d(e):D(e)},A=s.useMemo(()=>{let t=e;if(w){let e=w.toLowerCase();t=t.filter(t=>t.title.toLowerCase().includes(e)||t.user.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))}if(O){let e=c.find(e=>e.id===O);e&&(t=t.filter(t=>e.types.includes(t.type)))}return t},[e,w,O,c]),j=s.useMemo(()=>{if(!g)return null;let e={};return A.forEach(t=>{let n=(typeof t.timestamp==`string`?new Date(t.timestamp):t.timestamp).toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});e[n]||(e[n]=[]),e[n].push(t)}),e},[A,g]),M=e=>(0,f.jsx)(`div`,{children:e.map((t,n)=>(0,f.jsx)(sI,{activity:t,showAvatar:b,relativeTime:x,layout:S,isLast:n===e.length-1},t.id))});return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,C),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,f.jsx)(`h2`,{className:`text-xl font-semibold`,children:i}),(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:p&&m&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:m,disabled:h,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,h&&`animate-spin`)})})})]}),(a||o)&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[a&&(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:w,onChange:e=>T(e.target.value),className:`pl-9`})]}),o&&c.length>0&&(0,f.jsxs)(n.d,{value:O||`all`,onValueChange:e=>k(e===`all`?null:e),children:[(0,f.jsxs)(n.y,{className:`w-[180px]`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{placeholder:`Filtrer`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Toutes les activités`}),c.map(e=>(0,f.jsx)(n.m,{value:e.id,children:e.label},e.id))]})]})]}),h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,f.jsx)(l.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):A.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12`,children:[(0,f.jsx)(l.Clock,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune activité`})]}):g&&j?(0,f.jsx)(`div`,{className:`space-y-6`,children:Object.entries(j).map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-4 capitalize`,children:e}),M(t)]},e))}):M(A),_&&v&&(0,f.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,f.jsxs)(r.r,{variant:`outline`,onClick:v,disabled:y,children:[y?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 animate-spin mr-2`}):(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4 mr-2`}),`Charger plus`]})})]})}var lI=[{id:`edits`,label:`Modifications`,types:[`created`,`updated`,`deleted`]},{id:`comments`,label:`Commentaires`,types:[`commented`,`mentioned`]},{id:`files`,label:`Fichiers`,types:[`uploaded`,`downloaded`,`shared`]},{id:`approvals`,label:`Approbations`,types:[`approved`,`rejected`,`completed`]}],uI=[{id:`1`,type:`created`,title:`a créé le document 'Rapport Q4'`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5)},{id:`2`,type:`commented`,title:`a commenté sur 'Projet Alpha'`,user:{id:`2`,name:`Pierre Martin`},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:`Super travail sur cette partie !`}},{id:`3`,type:`uploaded`,title:`a uploadé 3 fichiers`,user:{id:`3`,name:`Sophie Bernard`},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:`4`,type:`approved`,title:`a approuvé la demande de congés`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*60*24)}],dI={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function fI(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function pI(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function mI(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?pI(n,t)||t>=n&&t<=r:pI(n,t)})}function hI({currentDate:e,viewMode:t,onPrevious:i,onNext:a,onToday:o,onViewModeChange:s,onAddClick:c,showViewSelector:u,showAddButton:d,locale:p}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:i,children:(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:a,children:(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,f.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(p,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(p,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(p,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&s&&(0,f.jsxs)(n.d,{value:t,onValueChange:e=>s(e),children:[(0,f.jsx)(n.y,{className:`w-[120px]`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`month`,children:`Mois`}),(0,f.jsx)(n.m,{value:`week`,children:`Semaine`}),(0,f.jsx)(n.m,{value:`day`,children:`Jour`}),(0,f.jsx)(n.m,{value:`agenda`,children:`Agenda`})]})]}),d&&c&&(0,f.jsxs)(r.r,{onClick:c,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function gI({event:e,onClick:n,compact:r=!1}){let i=dI[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,f.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.t(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,f.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function _I({event:e,onEdit:n,onDelete:i}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,s=dI[e.color||`blue`];return(0,f.jsxs)(`div`,{className:`w-72`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full mt-1`,s.bg.replace(`100`,`500`))}),(0,f.jsxs)(`div`,{className:`flex gap-1`,children:[n&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:n,children:(0,f.jsx)(l.Edit,{className:`h-3 w-3`})}),i&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,children:(0,f.jsx)(l.Trash2,{className:`h-3 w-3`})})]})]}),(0,f.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,f.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),e.allDay?(0,f.jsx)(`span`,{children:`Toute la journée`}):(0,f.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,f.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function vI({currentDate:e,events:n,weekStartsOn:r,locale:a,onDayClick:o,onEventClick:s,onEventEdit:c,onEventDelete:l}){let u=e.getFullYear(),d=e.getMonth(),p=fI(u,d),m=new Date,h=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(a,{weekday:`short`})),g=(new Date(u,d,1).getDay()-r+7)%7,_=[];for(let e=0;e<g;e++)_.push(null);for(_.push(...p);_.length%7!=0;)_.push(null);return(0,f.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:h.map(e=>(0,f.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,f.jsx)(`div`,{className:`grid grid-cols-7`,children:_.map((e,r)=>{let a=e?mI(n,e):[],u=e&&pI(e,m);return(0,f.jsx)(`div`,{className:t.t(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===d)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&o?.(e),children:e&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[a.slice(0,3).map(e=>(0,f.jsxs)(i.r,{children:[(0,f.jsx)(i.a,{asChild:!0,children:(0,f.jsx)(`div`,{children:(0,f.jsx)(gI,{event:e,onClick:()=>s?.(e),compact:!0})})}),(0,f.jsx)(i.i,{children:(0,f.jsx)(_I,{event:e,onEdit:()=>c?.(e.id,{}),onDelete:()=>l?.(e.id)})})]},e.id)),a.length>3&&(0,f.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,a.length-3,` autres`]})]})]})},r)})})]})}function yI({currentDate:e,events:n,locale:r,onEventClick:i}){let a=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),o={};return a.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();o[t]||(o[t]=[]),o[t].push(e)}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(o).map(([e,n])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(r,{weekday:`long`,day:`numeric`,month:`long`})}),(0,f.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=dI[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end;return(0,f.jsx)(Y,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i?.(e),children:(0,f.jsxs)(Q,{className:`p-3 flex gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${a.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})} - ${o.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,f.jsx)(l.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(o).length===0&&(0,f.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function bI({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:o,onEventCreate:c,onEventEdit:l,onEventDelete:u,onDayClick:d,showHeader:p=!0,showViewSelector:m=!0,showAddButton:h=!0,weekStartsOn:g=1,locale:_=`fr-FR`,className:v}){let[y,b]=s.useState(new Date),[x,S]=s.useState(`month`),[C,w]=s.useState(!1),T=n??y,E=i??x,D=e=>{r?r(e):b(e)};return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,v),children:[p&&(0,f.jsx)(hI,{currentDate:T,viewMode:E,onPrevious:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}D(e)},onNext:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}D(e)},onToday:()=>{D(new Date)},onViewModeChange:e=>{a?a(e):S(e)},onAddClick:()=>w(!0),showViewSelector:m,showAddButton:h,locale:_}),E===`month`&&(0,f.jsx)(vI,{currentDate:T,events:e,weekStartsOn:g,locale:_,onDayClick:d,onEventClick:o,onEventEdit:l,onEventDelete:u}),E===`agenda`&&(0,f.jsx)(yI,{currentDate:T,events:e,locale:_,onEventClick:o}),(E===`week`||E===`day`)&&(0,f.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,E===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var xI=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}],SI=`waka-chat-widget-position`,CI=e=>{if(typeof window>`u`)return null;try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null},wI=(e,t)=>{if(!(typeof window>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch{}};function TI({defaultPosition:e,position:r,onPositionChange:i,persistPosition:a=!0,positionStorageKey:o=SI,defaultOpen:c=!1,open:u,onOpenChange:d,bubbleSize:p=`md`,bubbleColor:m=`primary`,bubbleIcon:h,bubbleText:g,showUnreadBadge:_=!0,bubbleAnimation:v=`none`,widgetPosition:y=`top-left`,widgetSize:b=`md`,bubbleClassName:x,widgetClassName:S,draggable:C=!0,constrainToViewport:w=!0,edgeOffset:T=16,onWidgetClose:E,onWidgetMinimize:D,zIndex:O=9999,conversations:k=[],...A}){let[j,M]=s.useState(c),[N,P]=s.useState(()=>{if(e)return e;if(a){let e=CI(o);if(e)return e}return{x:typeof window<`u`?window.innerWidth-80:0,y:typeof window<`u`?window.innerHeight-80:0}}),[F,I]=s.useState(!1),[L,R]=s.useState({x:0,y:0}),z=s.useRef(null),B=u===void 0?j:u,V=r===void 0?N:r;s.useEffect(()=>{!(typeof window>`u`)&&!r&&!e&&P((a?CI(o):null)||{x:window.innerWidth-80,y:window.innerHeight-80})},[r,e,a,o]);let H=e=>{u===void 0&&M(e),d?.(e)},U=e=>{r===void 0&&P(e),i?.(e),a&&wI(o,e)},W=e=>{if(!w||typeof window>`u`)return e;let t=z.current?.offsetWidth||60,n=z.current?.offsetHeight||60;return{x:Math.max(T,Math.min(e.x,window.innerWidth-t-T)),y:Math.max(T,Math.min(e.y,window.innerHeight-n-T))}},G=e=>{!C||B||(I(!0),R({x:e.clientX-V.x,y:e.clientY-V.y}))},K=e=>{if(!C||B)return;let t=e.touches[0];I(!0),R({x:t.clientX-V.x,y:t.clientY-V.y})};s.useEffect(()=>{if(!F)return;let e=e=>{U(W({x:e.clientX-L.x,y:e.clientY-L.y}))},t=e=>{let t=e.touches[0];U(W({x:t.clientX-L.x,y:t.clientY-L.y}))},n=()=>{I(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t),document.addEventListener(`touchend`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n)}},[F,L]);let q=()=>{F||H(!B)},ee=k.reduce((e,t)=>e+(t.unreadCount||0),0),J={sm:`h-12 w-12`,md:`h-14 w-14`,lg:`h-16 w-16`},te={sm:`h-5 w-5`,md:`h-6 w-6`,lg:`h-7 w-7`},ne={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/90`,success:`bg-green-500 text-white hover:bg-green-600`,warning:`bg-yellow-500 text-white hover:bg-yellow-600`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`},re={none:``,pulse:`animate-pulse`,bounce:`animate-bounce`},ie={sm:`h-[400px] w-[300px]`,md:`h-[500px] w-[380px]`,lg:`h-[600px] w-[420px]`},ae=()=>{let e=z.current?.offsetWidth||60,t=z.current?.offsetHeight||60,n=ie[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),r=n?parseInt(n[1]):500,i=n?parseInt(n[2]):380,a=V.x,o=V.y;switch(y){case`top-left`:a=V.x-i+e,o=V.y-r-12;break;case`top-right`:o=V.y-r-12;break;case`bottom-left`:a=V.x-i+e,o=V.y+t+12;break;case`bottom-right`:o=V.y+t+12;break}return typeof window<`u`&&(a=Math.max(T,Math.min(a,window.innerWidth-i-T)),o=Math.max(T,Math.min(o,window.innerHeight-r-T))),{position:`fixed`,left:a,top:o,zIndex:O+1}};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`button`,{ref:z,onClick:q,onMouseDown:G,onTouchStart:K,className:t.t(`fixed rounded-full shadow-lg transition-all duration-200`,`flex items-center justify-center gap-2`,J[p],ne[m],re[v],F&&`cursor-grabbing scale-110`,C&&!F&&!B&&`cursor-grab`,B&&`opacity-0 pointer-events-none scale-75`,g&&`px-4 w-auto`,x),style:{left:V.x,top:V.y,zIndex:O,touchAction:`none`},"aria-label":`Ouvrir le chat`,children:[h||(0,f.jsx)(l.MessageCircle,{className:te[p]}),g&&(0,f.jsx)(`span`,{className:`font-medium text-sm`,children:g}),_&&ee>0&&(0,f.jsx)(n.x,{className:t.t(`absolute -top-1 -right-1 h-5 min-w-[20px] px-1.5`,`bg-destructive text-destructive-foreground`,`flex items-center justify-center text-xs font-bold`),children:ee>99?`99+`:ee})]}),B&&(0,f.jsx)(`div`,{className:t.t(`fixed rounded-xl shadow-2xl border bg-background overflow-hidden`,`animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2`,`duration-200`,ie[b],S),style:ae(),children:(0,f.jsx)(FI,{...A,conversations:k,layout:`widget`,onClose:()=>{H(!1),E?.()},onMinimize:()=>{H(!1),D?.()},showCloseButton:!0,className:`h-full`})}),B&&(0,f.jsx)(`div`,{className:`fixed inset-0 bg-black/20 sm:hidden`,style:{zIndex:O-1},onClick:()=>H(!1)})]})}function EI(e={}){let{defaultOpen:t=!1,defaultPosition:n,persistPosition:r=!0,positionStorageKey:i=SI}=e,[a,o]=s.useState(t),[c,l]=s.useState(()=>{if(n)return n;if(typeof window>`u`)return{x:0,y:0};if(r){let e=CI(i);if(e)return e}return{x:window.innerWidth-80,y:window.innerHeight-80}}),u=()=>o(!0),d=()=>o(!1),f=()=>o(e=>!e),p=e=>{l(e),r&&wI(i,e)};return{isOpen:a,position:c,open:u,close:d,toggle:f,setIsOpen:o,updatePosition:p,resetPosition:()=>{typeof window>`u`||p(n||{x:window.innerWidth-80,y:window.innerHeight-80})},widgetProps:{open:a,onOpenChange:o,position:c,onPositionChange:p}}}var DI=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},OI=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},kI=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function AI({date:e}){return(0,f.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,f.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:DI(e)})})}function jI({conversations:e,activeId:i,currentUser:a,onSelect:o,onSearch:c}){let[u,d]=s.useState(``),p=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),m=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:kI(t||{id:``,name:`?`})}},h=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},g=e.filter(e=>u?p(e).toLowerCase().includes(u.toLowerCase()):!0);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,f.jsx)(`div`,{className:`p-3 border-b`,children:(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:u,onChange:e=>{d(e.target.value),c?.(e.target.value)},className:`pl-9`})]})}),(0,f.jsx)(er,{className:`flex-1`,children:g.map(e=>{let r=m(e),s=p(e),c=e.participants.find(e=>e.id!==a.id);return(0,f.jsxs)(`button`,{onClick:()=>o(e),className:t.t(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{children:[(0,f.jsx)(ye,{src:r.url}),(0,f.jsx)(be,{children:r.fallback})]}),c?.status===`online`&&(0,f.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium text-sm truncate`,children:s}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h(e.lastMessage?.timestamp)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,f.jsx)(n.x,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function MI({conversation:e,currentUser:n,title:i,statusText:a,showStatus:o=!0,showCloseButton:s,onAudioCall:c,onVideoCall:u,onClose:d,onCloseConversation:p,onMinimize:m,layout:h}){let g=e?.participants.find(e=>e.id!==n.id),_=i||e?.name||g?.name||`Messages`,v=()=>a||(e?e.isGroup?`${e.participants.length} participants`:g?.status===`online`?`En ligne`:g?.lastSeen?`Vu ${(typeof g.lastSeen==`string`?new Date(g.lastSeen):g.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),y=h===`floating`||h===`widget`;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center justify-between p-3 border-b`,y&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,f.jsxs)(ve,{className:t.t(y&&`border-2 border-primary-foreground/20`),children:[(0,f.jsx)(ye,{src:e.avatar||g?.avatar}),(0,f.jsx)(be,{className:t.t(y&&`bg-primary-foreground/20 text-primary-foreground`),children:kI(g||{id:``,name:_})})]}),!e&&(0,f.jsx)(l.MessageCircle,{className:`h-5 w-5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold text-sm`,children:_}),o&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[g?.status===`online`&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,y?`bg-green-400`:`bg-green-500`)}),g?.status===`offline`&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,y?`bg-gray-400`:`bg-gray-500`)}),(0,f.jsx)(`p`,{className:t.t(`text-xs`,y?`text-primary-foreground/80`:`text-muted-foreground`),children:v()})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&!y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:c,children:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})}),u&&!y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:u,children:(0,f.jsx)(l.Video,{className:`h-4 w-4`})}),s&&p&&(0,f.jsxs)(r.r,{variant:y?`ghost`:`outline`,size:`sm`,onClick:p,className:t.t(y&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),m&&y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:m,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(l.Minimize2,{className:`h-4 w-4`})}),d&&y&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:d,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})}),!y&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsx)(an,{align:`end`,children:(0,f.jsxs)($,{children:[(0,f.jsx)(l.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function NI({message:e,isOwn:n,showStatus:i,showTimestamp:a,onDelete:o,onReply:s}){return(0,f.jsxs)(`div`,{className:t.t(`flex gap-2 group`,n?`flex-row-reverse`:`flex-row`),children:[!n&&(0,f.jsxs)(ve,{className:`h-8 w-8`,children:[(0,f.jsx)(ye,{src:e.sender.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:kI(e.sender)})]}),(0,f.jsxs)(`div`,{className:t.t(`max-w-[70%]`,n&&`items-end`),children:[e.replyTo&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,f.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,f.jsxs)(`div`,{className:t.t(`relative rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,f.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,f.jsx)(`div`,{children:e.type===`image`?(0,f.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,f.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,f.jsx)(l.File,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,f.jsxs)(`div`,{className:t.t(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,n?`-left-20`:`-right-20`),children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s?.(e),children:(0,f.jsx)(l.Reply,{className:`h-3 w-3`})}),n&&o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>o(e.id),children:(0,f.jsx)(l.Trash2,{className:`h-3 w-3`})})]})]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,n&&`justify-end`),children:[a&&(0,f.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,f.jsx)(`span`,{children:`(modifié)`}),n&&i&&(()=>{switch(e.status){case`sending`:return(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,f.jsx)(l.Check,{className:`h-3 w-3`});case`delivered`:return(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,f.jsx)(l.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function PI({onSend:e,replyTo:t,onCancelReply:n,showAttachments:a,showEmoji:o,placeholder:c,sending:u,showHint:d=!0,hintText:p=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[m,h]=s.useState(``),g=s.useRef(null),_=()=>{m.trim()&&!u&&(e(m.trim()),h(``))};return s.useEffect(()=>{g.current&&(g.current.style.height=`auto`,g.current.style.height=Math.min(g.current.scrollHeight,120)+`px`)},[m]),(0,f.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Reply,{className:`h-4 w-4 text-primary`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`flex items-end gap-2`,children:[a&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(l.Paperclip,{className:`h-4 w-4`})}),(0,f.jsx)(i.n,{ref:g,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:c,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:u,rows:1}),o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(l.Smile,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{onClick:_,disabled:!m.trim()||u,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,f.jsx)(l.Send,{className:`h-4 w-4`})})]}),d&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:p})]})}function FI({conversations:e=[],activeConversation:r,messages:i,currentUser:a,onSendMessage:o,onConversationSelect:c,onMessageDelete:u,onMessageReply:d,onSearch:p,onAudioCall:m,onVideoCall:h,onClose:g,onCloseConversation:_,onMinimize:v,showConversationList:y=!0,showHeader:b=!0,showMessageStatus:x=!0,showTimestamps:S=!0,showAttachments:C=!0,showEmoji:w=!0,showDateSeparators:T=!0,showInputHint:E=!0,showCloseButton:D=!1,inputPlaceholder:O,inputHintText:k,sending:A=!1,loading:j=!1,layout:M=`full`,headerTitle:N,showHeaderStatus:P=!0,statusText:F,minimized:I=!1,className:L}){let[R,z]=s.useState(null),B=s.useRef(null);s.useEffect(()=>{B.current?.scrollIntoView({behavior:`smooth`})},[i]);let V=(e,t)=>{o?.(e,t),z(null)},H=e=>{z(e),d?.(e)};return(M===`floating`||M===`widget`)&&I?(0,f.jsxs)(`button`,{onClick:v,className:t.t(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,L),children:[(0,f.jsx)(l.MessageCircle,{className:`h-5 w-5`}),(0,f.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,f.jsxs)(`div`,{className:t.t(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[M],L),children:[y&&M!==`widget`&&M!==`floating`&&(0,f.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,f.jsx)(jI,{conversations:e,activeId:r?.id,currentUser:a,onSelect:e=>c?.(e),onSearch:p})}),(0,f.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:r||M===`widget`||M===`floating`?(0,f.jsxs)(f.Fragment,{children:[b&&(0,f.jsx)(MI,{conversation:r,currentUser:a,title:N,statusText:F,showStatus:P,showCloseButton:D,onAudioCall:m,onVideoCall:h,onClose:g,onCloseConversation:_,onMinimize:v,layout:M}),(0,f.jsx)(er,{className:`flex-1 p-4`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[j?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return i.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;T&&(!t||!OI(t,i))&&(e.push((0,f.jsx)(AI,{date:i},`separator-${r}`)),t=i),e.push((0,f.jsx)(NI,{message:n,isOwn:n.sender.id===a.id,showStatus:x,showTimestamp:S,onDelete:u,onReply:H},n.id))}),e})(),(0,f.jsx)(`div`,{ref:B})]})}),(0,f.jsx)(PI,{onSend:V,replyTo:R,onCancelReply:()=>z(null),showAttachments:C,showEmoji:w,placeholder:(()=>{if(O)return O;if(r){let e=r.participants.find(e=>e.id!==a.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:A,showHint:E,hintText:k})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(l.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,f.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var II={id:`current`,name:`Moi`,status:`online`},LI=[{id:`1`,participants:[II,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[II,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:II,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],RI=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:II,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}],zI={"no-data":{title:`Aucune donnée`,description:`Il n'y a pas encore de données à afficher.`,icon:l.Inbox,actionLabel:`Ajouter`,actionIcon:l.Plus},"no-results":{title:`Aucun résultat`,description:`Aucun élément ne correspond à votre recherche.`,icon:l.Search,actionLabel:`Effacer les filtres`,actionIcon:l.Filter},"no-messages":{title:`Aucun message`,description:`Votre boîte de réception est vide.`,icon:l.MessageSquare,actionLabel:`Nouveau message`,actionIcon:l.Plus},"no-files":{title:`Aucun fichier`,description:`Vous n'avez pas encore de fichiers.`,icon:l.FolderOpen,actionLabel:`Importer un fichier`,actionIcon:l.Upload},"no-users":{title:`Aucun utilisateur`,description:`Il n'y a pas encore d'utilisateurs.`,icon:l.Users,actionLabel:`Inviter des utilisateurs`,actionIcon:l.Plus},"no-cart":{title:`Panier vide`,description:`Votre panier est vide.`,icon:l.ShoppingCart,actionLabel:`Parcourir les produits`,actionIcon:l.ArrowRight},"no-notifications":{title:`Aucune notification`,description:`Vous êtes à jour !`,icon:l.Bell},"no-events":{title:`Aucun événement`,description:`Aucun événement prévu.`,icon:l.Calendar,actionLabel:`Créer un événement`,actionIcon:l.Plus},"no-images":{title:`Aucune image`,description:`Vous n'avez pas encore d'images.`,icon:l.Image,actionLabel:`Importer des images`,actionIcon:l.Upload},"no-bookmarks":{title:`Aucun favori`,description:`Vous n'avez pas encore de favoris.`,icon:l.Bookmark,actionLabel:`Parcourir`,actionIcon:l.ArrowRight},"no-favorites":{title:`Aucun favori`,description:`Vous n'avez pas encore aimé de contenu.`,icon:l.Heart},error:{title:`Une erreur est survenue`,description:`Impossible de charger les données.`,icon:l.FileQuestion,actionLabel:`Réessayer`,actionIcon:l.RefreshCw},custom:{title:`Aucun élément`,description:`Il n'y a rien à afficher.`,icon:l.Inbox}};function BI({type:e,size:n,className:r}){let i=zI[e].icon,a={sm:{container:`h-24 w-24`,icon:`h-8 w-8`,circles:{outer:`h-20 w-20`,inner:`h-14 w-14`}},md:{container:`h-32 w-32`,icon:`h-10 w-10`,circles:{outer:`h-28 w-28`,inner:`h-20 w-20`}},lg:{container:`h-40 w-40`,icon:`h-12 w-12`,circles:{outer:`h-36 w-36`,inner:`h-28 w-28`}}}[n];return(0,f.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,a.container,r),children:[(0,f.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted/50`,a.circles.outer)}),(0,f.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted`,a.circles.inner)}),(0,f.jsx)(`div`,{className:`relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm`,children:(0,f.jsx)(i,{className:t.t(a.icon,`text-muted-foreground`)})}),(0,f.jsx)(`div`,{className:`absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20`}),(0,f.jsx)(`div`,{className:`absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30`}),(0,f.jsx)(`div`,{className:`absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10`})]})}function VI({type:e=`no-data`,title:n,description:i,icon:a,actions:o,illustration:c,showIllustration:l=!0,size:u=`md`,layout:d=`vertical`,centered:p=!0,children:m,className:h,LinkComponent:g}){let _=zI[e],v=n??_.title,y=i??_.description;_.icon;let b={sm:{container:`py-8 px-4`,title:`text-base`,description:`text-sm`,icon:`h-8 w-8`},md:{container:`py-12 px-6`,title:`text-lg`,description:`text-sm`,icon:`h-10 w-10`},lg:{container:`py-16 px-8`,title:`text-xl`,description:`text-base`,icon:`h-12 w-12`}},x=[];if(_.actionLabel&&!o){let e=_.actionIcon;x.push({label:_.actionLabel,variant:`default`,icon:e?(0,f.jsx)(e,{className:`h-4 w-4`}):void 0})}let S=o||(x.length>0?x:void 0);return d===`horizontal`?(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-6`,b[u].container,p&&`justify-center`,h),children:[l&&(0,f.jsx)(`div`,{className:`flex-shrink-0`,children:c||(a?(0,f.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-4`,children:a}):(0,f.jsx)(BI,{type:e,size:u}))}),(0,f.jsxs)(`div`,{className:`flex flex-col`,children:[(0,f.jsx)(`h3`,{className:t.t(`font-semibold`,b[u].title),children:v}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mt-1`,b[u].description),children:y}),m&&(0,f.jsx)(`div`,{className:`mt-4`,children:m}),S&&S.length>0&&(0,f.jsx)(`div`,{className:`flex gap-3 mt-4`,children:S.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?g?(0,f.jsxs)(g,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})]}):(0,f.jsxs)(`div`,{className:t.t(`flex flex-col items-center`,p&&`text-center`,b[u].container,h),children:[l&&(0,f.jsx)(`div`,{className:`mb-6`,children:c||(a?(0,f.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-6`,children:s.cloneElement(a,{className:t.t(b[u].icon,`text-muted-foreground`)})}):(0,f.jsx)(BI,{type:e,size:u}))}),(0,f.jsx)(`h3`,{className:t.t(`font-semibold`,b[u].title),children:v}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mt-2 max-w-sm`,b[u].description),children:y}),m&&(0,f.jsx)(`div`,{className:`mt-4`,children:m}),S&&S.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-6 justify-center`,children:S.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?g?(0,f.jsxs)(g,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})}function HI(e){return(0,f.jsx)(VI,{type:`no-data`,...e})}function UI(e){return(0,f.jsx)(VI,{type:`no-results`,...e})}function WI(e){return(0,f.jsx)(VI,{type:`no-messages`,...e})}function GI(e){return(0,f.jsx)(VI,{type:`no-files`,...e})}function KI(e){return(0,f.jsx)(VI,{type:`no-cart`,...e})}function qI(e){return(0,f.jsx)(VI,{type:`no-notifications`,...e})}function JI(e){return(0,f.jsx)(VI,{type:`error`,...e})}var YI={404:{code:`404`,title:`Page non trouvée`,description:`Désolé, la page que vous recherchez n'existe pas ou a été déplacée.`,icon:l.FileQuestion},500:{code:`500`,title:`Erreur serveur`,description:`Une erreur inattendue s'est produite. Notre équipe a été notifiée.`,icon:l.ServerCrash},403:{code:`403`,title:`Accès refusé`,description:`Vous n'avez pas les permissions nécessaires pour accéder à cette page.`,icon:l.ShieldX},503:{code:`503`,title:`Service indisponible`,description:`Le service est temporairement indisponible. Veuillez réessayer plus tard.`,icon:l.ServerCrash},offline:{code:`Hors ligne`,title:`Vous êtes hors ligne`,description:`Vérifiez votre connexion internet et réessayez.`,icon:l.Wifi},maintenance:{code:`Maintenance`,title:`Maintenance en cours`,description:`Nous effectuons une maintenance. Nous serons bientôt de retour.`,icon:l.Construction},custom:{code:``,title:`Erreur`,description:`Une erreur s'est produite.`,icon:l.FileQuestion}};function XI({type:e,className:n}){let r=YI[e].icon;return(0,f.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,n),children:[(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,f.jsx)(`div`,{className:`h-48 w-48 rounded-full bg-muted/50`})}),(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,f.jsx)(`div`,{className:`h-32 w-32 rounded-full bg-muted`})}),(0,f.jsx)(`div`,{className:`relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg`,children:(0,f.jsx)(r,{className:`h-10 w-10 text-muted-foreground`})}),(0,f.jsx)(`div`,{className:`absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20`}),(0,f.jsx)(`div`,{className:`absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30`}),(0,f.jsx)(`div`,{className:`absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10`})]})}function ZI({type:e=`404`,code:n,title:i,description:a,actions:o,illustration:s,showCode:c=!0,showIllustration:u=!0,showBackButton:d=!0,onBack:p,showHomeButton:m=!0,homeUrl:h=`/`,showRefreshButton:g=!1,children:_,layout:v=`centered`,size:y=`md`,className:b,LinkComponent:x}){let S=YI[e],C=n??S.code,w=i??S.title,T=a??S.description,E={sm:{container:`py-12 px-4`,code:`text-6xl`,title:`text-xl`,description:`text-sm`,illustration:`h-32 w-32`},md:{container:`py-16 px-6`,code:`text-8xl`,title:`text-2xl`,description:`text-base`,illustration:`h-48 w-48`},lg:{container:`py-24 px-8`,code:`text-9xl`,title:`text-3xl`,description:`text-lg`,illustration:`h-64 w-64`}},D=[];d&&D.push({label:`Retour`,onClick:p||(()=>window.history.back()),variant:`outline`,icon:(0,f.jsx)(l.ArrowLeft,{className:`h-4 w-4`})}),m&&D.push({label:`Accueil`,href:h,variant:`default`,icon:(0,f.jsx)(l.Home,{className:`h-4 w-4`})}),g&&D.push({label:`Réessayer`,onClick:()=>window.location.reload(),variant:`secondary`,icon:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})});let O=o||D;return v===`split`?(0,f.jsxs)(`div`,{className:t.t(`min-h-screen flex flex-col lg:flex-row`,b),children:[(0,f.jsx)(`div`,{className:`flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16`,children:(0,f.jsx)(`div`,{className:E[y].illustration,children:s||(0,f.jsx)(XI,{type:e})})}),(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8 lg:p-16`,children:(0,f.jsxs)(`div`,{className:`max-w-md`,children:[c&&C&&(0,f.jsx)(`div`,{className:t.t(`font-bold text-primary mb-4`,y===`sm`?`text-4xl`:y===`md`?`text-5xl`:`text-6xl`),children:C}),(0,f.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground mb-8`,E[y].description),children:T}),_&&(0,f.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:O.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,f.jsxs)(x,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})]}):(0,f.jsx)(`div`,{className:t.t(`min-h-screen flex items-center justify-center`,E[y].container,b),children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[u&&(0,f.jsx)(`div`,{className:t.t(`mb-8`,E[y].illustration),children:s||(0,f.jsx)(XI,{type:e})}),c&&C&&(0,f.jsx)(`div`,{className:t.t(`font-bold text-muted-foreground/20 mb-4`,E[y].code),children:C}),(0,f.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,f.jsx)(`p`,{className:t.t(`text-muted-foreground max-w-md mb-8`,E[y].description),children:T}),_&&(0,f.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-3 justify-center`,children:O.map((e,t)=>(0,f.jsx)(r.r,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,f.jsxs)(x,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,f.jsxs)(f.Fragment,{children:[e.icon&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})}function QI(e){return(0,f.jsx)(ZI,{type:`404`,...e})}function $I(e){return(0,f.jsx)(ZI,{type:`500`,showRefreshButton:!0,...e})}function eL(e){return(0,f.jsx)(ZI,{type:`403`,...e})}function tL(e){return(0,f.jsx)(ZI,{type:`maintenance`,showBackButton:!1,showHomeButton:!1,...e})}function nL(e){return(0,f.jsx)(ZI,{type:`offline`,showRefreshButton:!0,...e})}function rL({value:e,onChange:t,placeholder:n}){return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{type:`text`,placeholder:n,value:e,onChange:e=>t(e.target.value),className:`pl-10`})]})}function iL({categories:e,activeCategory:r,onCategoryChange:i,itemCounts:a}){return(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>i(null),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,r===null?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[`Tous`,(0,f.jsx)(n.x,{variant:`secondary`,className:`ml-1`,children:Object.values(a).reduce((e,t)=>e+t,0)})]}),e.map(e=>(0,f.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,r===e.id?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[e.icon,e.name,(0,f.jsx)(n.x,{variant:`secondary`,className:`ml-1`,children:a[e.id]||0})]},e.id))]})}function aL({itemId:e,helpful:n=0,notHelpful:r=0,onFeedback:i}){let[a,o]=s.useState(null),c=t=>{a===null&&(o(t),i(e,t))};return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 pt-4 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Cette réponse vous a-t-elle aidé ?`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!0?`bg-green-100 text-green-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👍 `,n+(a===!0?1:0)]}),(0,f.jsxs)(`button`,{type:`button`,onClick:()=>c(!1),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!1?`bg-red-100 text-red-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👎 `,r+(a===!1?1:0)]})]})]})}function oL({items:e,categories:r=[],title:i=`Questions fréquentes`,description:a,showSearch:o=!0,searchPlaceholder:c=`Rechercher une question...`,showCategoryFilter:u=!0,activeCategory:d,onCategoryChange:p,allowMultiple:m=!1,defaultOpen:h=[],showFeedback:g=!1,onFeedback:_,layout:v=`default`,size:y=`md`,className:b}){let[x,S]=s.useState(``),[C,w]=s.useState(null),T=d??C,E=e=>{p?p(e):w(e)},D=s.useMemo(()=>e.filter(e=>{if(x){let t=x.toLowerCase();if(!(e.question.toLowerCase().includes(t)||typeof e.answer==`string`&&e.answer.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))))return!1}return!(T&&e.category!==T)}),[e,x,T]),O=s.useMemo(()=>{let t={};return e.forEach(e=>{e.category&&(t[e.category]=(t[e.category]||0)+1)}),t},[e]),k=s.useMemo(()=>{if(v!==`grouped`)return null;let e={};return D.forEach(t=>{let n=t.category||`other`;e[n]||(e[n]=[]),e[n].push(t)}),e},[D,v]),A={sm:{title:`text-xl`,question:`text-sm`,answer:`text-sm`},md:{title:`text-2xl`,question:`text-base`,answer:`text-sm`},lg:{title:`text-3xl`,question:`text-lg`,answer:`text-base`}},j=e=>(0,f.jsx)(f.Fragment,{children:e.map(e=>(0,f.jsxs)(ee,{value:e.id,className:t.t(v===`cards`&&`border rounded-lg px-4 bg-card`),children:[(0,f.jsx)(J,{className:t.t(`hover:no-underline`,A[y].question),children:(0,f.jsx)(`span`,{className:`text-left`,children:e.question})}),(0,f.jsxs)(te,{children:[(0,f.jsx)(`div`,{className:t.t(`text-muted-foreground`,A[y].answer),children:typeof e.answer==`string`?(0,f.jsx)(`p`,{children:e.answer}):e.answer}),e.tags&&e.tags.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:e.tags.map(e=>(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e},e))}),g&&_&&(0,f.jsx)(aL,{itemId:e.id,helpful:e.helpful,notHelpful:e.notHelpful,onFeedback:_})]})]},e.id))}),M=e=>m?(0,f.jsx)(q,{type:`multiple`,defaultValue:h,className:`space-y-2`,children:j(e)}):(0,f.jsx)(q,{type:`single`,defaultValue:h[0],collapsible:!0,className:`space-y-2`,children:j(e)});return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,b),children:[(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:t.t(`font-bold tracking-tight`,A[y].title),children:i}),a&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-2 max-w-2xl mx-auto`,children:a})]}),o&&(0,f.jsx)(`div`,{className:`max-w-md mx-auto`,children:(0,f.jsx)(rL,{value:x,onChange:S,placeholder:c})}),u&&r.length>0&&(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(iL,{categories:r,activeCategory:T,onCategoryChange:E,itemCounts:O})}),D.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12`,children:[(0,f.jsx)(l.HelpCircle,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune question ne correspond à votre recherche.`})]}):v===`grouped`&&k?(0,f.jsx)(`div`,{className:`space-y-8`,children:Object.entries(k).map(([e,t])=>{let n=r.find(t=>t.id===e);return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center gap-2`,children:[n?.icon,n?.name||e]}),M(t)]},e)})}):(0,f.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:M(D)})]})}var sL=[{id:`general`,name:`Général`,icon:(0,f.jsx)(l.HelpCircle,{className:`h-4 w-4`})},{id:`billing`,name:`Facturation`,icon:(0,f.jsx)(l.MessageCircle,{className:`h-4 w-4`})},{id:`technical`,name:`Technique`,icon:(0,f.jsx)(l.MessageCircle,{className:`h-4 w-4`})}],cL=[{id:`1`,question:`Comment créer un compte ?`,answer:`Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.`,category:`general`,tags:[`compte`,`inscription`]},{id:`2`,question:`Comment réinitialiser mon mot de passe ?`,answer:`Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.`,category:`general`,tags:[`mot de passe`,`sécurité`]},{id:`3`,question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`,category:`billing`,tags:[`paiement`,`carte`]},{id:`4`,question:`Comment annuler mon abonnement ?`,answer:`Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.`,category:`billing`,tags:[`abonnement`,`annulation`]},{id:`5`,question:`L'API est-elle disponible ?`,answer:`Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.`,category:`technical`,tags:[`API`,`développeur`]}],lL={folder:{icon:l.Folder,color:`text-yellow-500`},document:{icon:l.FileText,color:`text-blue-500`},image:{icon:l.FileImage,color:`text-green-500`},video:{icon:l.FileVideo,color:`text-purple-500`},audio:{icon:l.FileAudio,color:`text-pink-500`},archive:{icon:l.FileArchive,color:`text-orange-500`},code:{icon:l.FileCode,color:`text-cyan-500`},other:{icon:l.File,color:`text-gray-500`}};function uL(e){if(!e)return`-`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(1)} ${t[n]}`}function dL({breadcrumbs:e,viewMode:n,onViewModeChange:i,onNavigate:a,onCreateFolder:o,onUpload:c,onRefresh:u,showSearch:d,onSearch:p,selectedCount:m,onDeleteSelected:h,onDownloadSelected:g}){let[_,v]=s.useState(``);return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:u,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),c&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:c,children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]}),o&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:o,children:[(0,f.jsx)(l.FolderPlus,{className:`h-4 w-4 mr-2`}),`Nouveau dossier`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&p&&(0,f.jsxs)(`div`,{className:`relative w-64`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher...`,value:_,onChange:e=>{v(e.target.value),p(e.target.value)},className:`pl-9`})]}),(0,f.jsx)(r.r,{variant:n===`grid`?`secondary`:`ghost`,size:`icon`,onClick:()=>i(`grid`),children:(0,f.jsx)(l.Grid,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:n===`list`?`secondary`:`ghost`,size:`icon`,onClick:()=>i(`list`),children:(0,f.jsx)(l.List,{className:`h-4 w-4`})})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,f.jsx)(`button`,{onClick:()=>a(`/`),className:`flex items-center gap-1 hover:text-primary`,children:(0,f.jsx)(l.Home,{className:`h-4 w-4`})}),e.map((n,r)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`button`,{onClick:()=>a(n.path),className:t.t(`hover:text-primary`,r===e.length-1&&`font-medium`),children:n.name})]},n.id))]}),m>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-muted rounded-lg`,children:[(0,f.jsxs)(`span`,{className:`text-sm font-medium`,children:[m,` élément(s) sélectionné(s)`]}),g&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:g,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Télécharger`]}),h&&(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:h,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})}function fL({file:e,viewMode:i,isSelected:a,onSelect:o,onOpen:s,onRename:c,onDelete:u,onDownload:d,onShare:p,onToggleStar:m}){let h=lL[e.type],g=h.icon,_=typeof e.modifiedAt==`string`?new Date(e.modifiedAt):e.modifiedAt,v=()=>{e.type===`folder`&&s()};return i===`grid`?(0,f.jsxs)(`div`,{className:t.t(`relative group p-4 rounded-lg border cursor-pointer transition-colors`,a?`bg-primary/10 border-primary`:`hover:bg-muted`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,f.jsx)(`div`,{className:`absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,f.jsx)(we,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),e.starred&&(0,f.jsx)(l.Star,{className:`absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500`}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[e.thumbnail&&e.type===`image`?(0,f.jsx)(`img`,{src:e.thumbnail,alt:e.name,className:`w-16 h-16 object-cover rounded`}):(0,f.jsx)(g,{className:t.t(`h-12 w-12`,h.color)}),(0,f.jsx)(`span`,{className:`text-sm font-medium text-center line-clamp-2`,children:e.name}),e.type!==`folder`&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:uL(e.size)})]}),(0,f.jsx)(`div`,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:s,children:[(0,f.jsx)(l.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,f.jsxs)($,{onClick:c,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),d&&e.type!==`folder`&&(0,f.jsxs)($,{onClick:d,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),p&&(0,f.jsxs)($,{onClick:p,children:[(0,f.jsx)(l.Share2,{className:`mr-2 h-4 w-4`}),`Partager`]}),m&&(0,f.jsx)($,{onClick:m,children:e.starred?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.StarOff,{className:`mr-2 h-4 w-4`}),`Retirer des favoris`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Star,{className:`mr-2 h-4 w-4`}),`Ajouter aux favoris`]})}),u&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:u,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]}):(0,f.jsxs)(yr,{className:t.t(`cursor-pointer`,a&&`bg-primary/10`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,f.jsx)(xr,{className:`w-12`,children:(0,f.jsx)(we,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),(0,f.jsx)(xr,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(g,{className:t.t(`h-5 w-5`,h.color)}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),e.starred&&(0,f.jsx)(l.Star,{className:`h-4 w-4 text-yellow-500 fill-yellow-500`}),e.shared&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:`Partagé`})]})}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:uL(e.size)}),(0,f.jsx)(xr,{className:`text-muted-foreground`,children:_.toLocaleDateString(`fr-FR`)}),(0,f.jsx)(xr,{children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:s,children:[(0,f.jsx)(l.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,f.jsxs)($,{onClick:c,children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),d&&e.type!==`folder`&&(0,f.jsxs)($,{onClick:d,children:[(0,f.jsx)(l.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),u&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:u,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]})}function pL({files:e,currentPath:n=`/`,breadcrumbs:i=[],selectedFiles:a=[],onSelectionChange:o,onNavigate:c,onFileOpen:u,onDownload:d,onDelete:p,onRename:m,onCopy:h,onMove:g,onCreateFolder:_,onUpload:v,onShare:y,onToggleStar:b,onRefresh:x,viewMode:S,onViewModeChange:C,showSearch:w=!0,onSearch:T,showHeader:E=!0,showActions:D=!0,loading:O=!1,className:k}){let[A,j]=s.useState(`grid`),[M,N]=s.useState(!1),[P,F]=s.useState(null),[I,L]=s.useState(``),[R,z]=s.useState(!1),[B,V]=s.useState([]),[H,U]=s.useState(!1),[W,G]=s.useState(``),K=S??A,q=e=>{C?C(e):j(e)},ee=(e,t)=>{t?o?.([...a,e]):o?.(a.filter(t=>t!==e))},J=e=>{e.type===`folder`?c?.(e.path,e.id):u?.(e)},te=e=>{F(e),L(e.name),N(!0)},re=()=>{P&&I.trim()&&I!==P.name&&m?.(P.id,I.trim()),N(!1),F(null)},ie=()=>{V(a),z(!0)},ae=()=>{p?.(B),z(!1),V([]),o?.([])},pe=()=>{W.trim()&&(_?.(W.trim(),n),U(!1),G(``))},me=[...e].sort((e,t)=>e.type===`folder`&&t.type!==`folder`?-1:e.type!==`folder`&&t.type===`folder`?1:e.name.localeCompare(t.name));return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,k),children:[E&&(0,f.jsx)(dL,{breadcrumbs:i,viewMode:K,onViewModeChange:q,onNavigate:e=>c?.(e),onCreateFolder:_?()=>U(!0):void 0,onUpload:v?()=>{}:void 0,onRefresh:x,showSearch:w,onSearch:T,selectedCount:a.length,onDeleteSelected:p?ie:void 0,onDownloadSelected:d?()=>d(a):void 0}),O?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,f.jsx)(l.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):me.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,f.jsx)(l.Folder,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{children:`Ce dossier est vide`})]}):K===`grid`?(0,f.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4`,children:me.map(e=>(0,f.jsx)(fL,{file:e,viewMode:`grid`,isSelected:a.includes(e.id),onSelect:t=>ee(e.id,t),onOpen:()=>J(e),onRename:m?()=>te(e):void 0,onDelete:p?()=>{V([e.id]),z(!0)}:void 0,onDownload:d?()=>d([e.id]):void 0,onShare:y?()=>y(e.id):void 0,onToggleStar:b?()=>b(e.id):void 0},e.id))}):(0,f.jsxs)(hr,{children:[(0,f.jsx)(gr,{children:(0,f.jsxs)(yr,{children:[(0,f.jsx)(br,{className:`w-12`,children:(0,f.jsx)(we,{checked:a.length===e.length&&e.length>0,onCheckedChange:t=>{t?o?.(e.map(e=>e.id)):o?.([])}})}),(0,f.jsx)(br,{children:`Nom`}),(0,f.jsx)(br,{children:`Taille`}),(0,f.jsx)(br,{children:`Modifié`}),(0,f.jsx)(br,{className:`w-12`})]})}),(0,f.jsx)(_r,{children:me.map(e=>(0,f.jsx)(fL,{file:e,viewMode:`list`,isSelected:a.includes(e.id),onSelect:t=>ee(e.id,t),onOpen:()=>J(e),onRename:m?()=>te(e):void 0,onDelete:p?()=>{V([e.id]),z(!0)}:void 0,onDownload:d?()=>d([e.id]):void 0,onShare:y?()=>y(e.id):void 0,onToggleStar:b?()=>b(e.id):void 0},e.id))})]}),(0,f.jsx)(gt,{open:M,onOpenChange:N,children:(0,f.jsxs)(xt,{children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Renommer`})}),(0,f.jsx)(r.n,{value:I,onChange:e=>L(e.target.value),placeholder:`Nouveau nom`,onKeyDown:e=>e.key===`Enter`&&re()}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>N(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:re,children:`Renommer`})]})]})}),(0,f.jsx)(ne,{open:R,onOpenChange:z,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Supprimer ?`}),(0,f.jsxs)(ue,{children:[`Êtes-vous sûr de vouloir supprimer `,B.length,` élément(s) ? Cette action est irréversible.`]})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Annuler`}),(0,f.jsx)(de,{onClick:ae,children:`Supprimer`})]})]})}),(0,f.jsx)(gt,{open:H,onOpenChange:U,children:(0,f.jsxs)(xt,{children:[(0,f.jsx)(St,{children:(0,f.jsx)(wt,{children:`Nouveau dossier`})}),(0,f.jsx)(r.n,{value:W,onChange:e=>G(e.target.value),placeholder:`Nom du dossier`,onKeyDown:e=>e.key===`Enter`&&pe()}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>U(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:pe,children:`Créer`})]})]})})]})}var mL=[{id:`1`,name:`Documents`,type:`folder`,path:`/Documents`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-15`)},{id:`2`,name:`Images`,type:`folder`,path:`/Images`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-10`),starred:!0},{id:`3`,name:`Rapport Q4.pdf`,type:`document`,path:`/Rapport Q4.pdf`,size:2456e3,createdAt:new Date(`2024-01-05`),modifiedAt:new Date(`2024-01-05`)},{id:`4`,name:`Photo vacances.jpg`,type:`image`,path:`/Photo vacances.jpg`,size:567e4,createdAt:new Date(`2024-01-08`),modifiedAt:new Date(`2024-01-08`)},{id:`5`,name:`Présentation.pptx`,type:`document`,path:`/Présentation.pptx`,size:89e5,createdAt:new Date(`2024-01-12`),modifiedAt:new Date(`2024-01-14`),shared:!0}],hL=[{id:`root`,name:`Mes fichiers`,path:`/`}],gL={low:{label:`Basse`,color:`bg-gray-500`,icon:l.Clock},medium:{label:`Moyenne`,color:`bg-blue-500`,icon:l.Clock},high:{label:`Haute`,color:`bg-orange-500`,icon:l.AlertCircle},urgent:{label:`Urgente`,color:`bg-red-500`,icon:l.AlertCircle}};function _L({card:e,columnId:i,showAssignees:a,showLabels:o,showPriority:c,showDueDate:u,draggable:d,onCardClick:p,onCardEdit:m,onCardDelete:h,onDragStart:g}){let _=s.useMemo(()=>e.dueDate?(typeof e.dueDate==`string`?new Date(e.dueDate):e.dueDate)<new Date:!1,[e.dueDate]);return(0,f.jsx)(Y,{className:t.t(`cursor-pointer hover:shadow-md transition-shadow`,d&&`cursor-grab active:cursor-grabbing`),draggable:d,onDragStart:t=>g?.(t,e.id,i),onClick:()=>p?.(e,i),children:(0,f.jsxs)(Q,{className:`p-3 space-y-2`,children:[o&&e.labels&&e.labels.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.labels.map(e=>(0,f.jsx)(`div`,{className:`h-1.5 w-8 rounded-full`,style:{backgroundColor:e.color},title:e.name},e.id))}),(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium leading-tight`,children:e.title}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-6 w-6 flex-shrink-0`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-3 w-3`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:t=>{t.stopPropagation(),p?.(e,i)},children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:t=>{t.stopPropagation(),h?.(e.id,i)},className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),e.description&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&e.priority&&(0,f.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,gL[e.priority].color),title:gL[e.priority].label}),u&&e.dueDate&&(0,f.jsxs)(n.x,{variant:_?`destructive`:`outline`,className:`text-xs px-1.5 py-0`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3 mr-1`}),(e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`}))(e.dueDate)]})]}),a&&e.assignees&&e.assignees.length>0&&(0,f.jsxs)(`div`,{className:`flex -space-x-1`,children:[e.assignees.slice(0,3).map(e=>(0,f.jsxs)(ve,{className:`h-5 w-5 border-2 border-background`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-[8px]`,children:e.name.charAt(0)})]},e.id)),e.assignees.length>3&&(0,f.jsxs)(`div`,{className:`h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background`,children:[`+`,e.assignees.length-3]})]})]})]})})}function vL({column:e,showCardCount:t,showAddCard:a,showAssignees:o,showLabels:c,showPriority:u,showDueDate:d,draggable:p,onCardClick:m,onCardAdd:h,onCardEdit:g,onCardDelete:_,onColumnEdit:v,onColumnDelete:y,onDragStart:b,onDragOver:x,onDrop:S}){let[C,w]=s.useState(!1),[T,E]=s.useState(``),[D,O]=s.useState(!1),[k,A]=s.useState(e.title),j=()=>{T.trim()&&(h?.(e.id,{title:T.trim()}),E(``),w(!1))},M=()=>{k.trim()&&k!==e.title&&v?.(e.id,{title:k.trim()}),O(!1)},N=e.limit&&e.cards.length>=e.limit;return(0,f.jsxs)(`div`,{className:`flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg`,onDragOver:x,onDrop:t=>S?.(t,e.id),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.color&&(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full`,style:{backgroundColor:e.color}}),D?(0,f.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,f.jsx)(r.n,{value:k,onChange:e=>A(e.target.value),className:`h-7 text-sm font-semibold`,autoFocus:!0,onBlur:M,onKeyDown:e=>{e.key===`Enter`&&M(),e.key===`Escape`&&O(!1)}})}):(0,f.jsx)(`h3`,{className:`font-semibold text-sm cursor-pointer`,onClick:()=>O(!0),children:e.title}),t&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.cards.length,e.limit&&`/${e.limit}`]})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>O(!0),children:[(0,f.jsx)(l.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:()=>y?.(e.id),className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto`,children:[e.cards.map(t=>(0,f.jsx)(_L,{card:t,columnId:e.id,showAssignees:o,showLabels:c,showPriority:u,showDueDate:d,draggable:p,onCardClick:m,onCardEdit:g,onCardDelete:_,onDragStart:b},t.id)),C&&(0,f.jsxs)(Y,{className:`p-2`,children:[(0,f.jsx)(i.n,{placeholder:`Titre de la carte...`,value:T,onChange:e=>E(e.target.value),className:`min-h-[60px] text-sm`,autoFocus:!0}),(0,f.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,f.jsx)(r.r,{size:`sm`,onClick:j,children:`Ajouter`}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>{w(!1),E(``)},children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})]})]}),a&&!C&&!N&&(0,f.jsx)(`div`,{className:`p-2 border-t`,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>w(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une carte`]})}),N&&(0,f.jsx)(`div`,{className:`p-2 border-t text-center text-xs text-muted-foreground`,children:`Limite atteinte`})]})}function yL({columns:e,onColumnsChange:n,onCardClick:i,onCardAdd:a,onCardEdit:o,onCardDelete:c,onCardMove:u,onColumnAdd:d,onColumnEdit:p,onColumnDelete:m,showAddCard:h=!0,showAddColumn:g=!0,showCardCount:_=!0,showAssignees:v=!0,showLabels:y=!0,showPriority:b=!0,showDueDate:x=!0,draggable:S=!0,availableLabels:C=[],availableAssignees:w=[],className:T}){let[E,D]=s.useState(e),[O,k]=s.useState(null),[A,j]=s.useState(!1),[M,N]=s.useState(``);s.useEffect(()=>{D(e)},[e]);let P=(e,t,n)=>{k({cardId:t,columnId:n}),e.dataTransfer.effectAllowed=`move`},F=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},I=(e,t)=>{if(e.preventDefault(),!O)return;let{cardId:r,columnId:i}=O;if(i===t){k(null);return}if(u)u(r,i,t,0);else{let e=E.map(e=>{if(e.id===i)return{...e,cards:e.cards.filter(e=>e.id!==r)};if(e.id===t){let t=E.find(e=>e.id===i)?.cards.find(e=>e.id===r);if(t)return{...e,cards:[...e.cards,t]}}return e});D(e),n?.(e)}k(null)},L=(e,t)=>{if(a)a(e,t);else{let r={id:`card-${Date.now()}`,title:t.title||`Nouvelle carte`,...t},i=E.map(t=>t.id===e?{...t,cards:[...t.cards,r]}:t);D(i),n?.(i)}},R=(e,t)=>{if(c)c(e,t);else{let r=E.map(n=>n.id===t?{...n,cards:n.cards.filter(t=>t.id!==e)}:n);D(r),n?.(r)}},z=e=>{if(m)m(e);else{let t=E.filter(t=>t.id!==e);D(t),n?.(t)}},B=()=>{if(M.trim()){let e={id:`column-${Date.now()}`,title:M.trim(),cards:[]};if(d)d(e);else{let t=[...E,e];D(t),n?.(t)}N(``),j(!1)}};return(0,f.jsx)(`div`,{className:t.t(`overflow-x-auto`,T),children:(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 min-h-[500px]`,children:[E.map(e=>(0,f.jsx)(vL,{column:e,showCardCount:_,showAddCard:h,showAssignees:v,showLabels:y,showPriority:b,showDueDate:x,draggable:S,onCardClick:i,onCardAdd:L,onCardEdit:o,onCardDelete:R,onColumnEdit:p,onColumnDelete:z,onDragStart:P,onDragOver:F,onDrop:I},e.id)),g&&(0,f.jsx)(`div`,{className:`w-72 flex-shrink-0`,children:A?(0,f.jsxs)(Y,{className:`p-3`,children:[(0,f.jsx)(r.n,{placeholder:`Titre de la colonne...`,value:M,onChange:e=>N(e.target.value),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&B(),e.key===`Escape`&&j(!1)}}),(0,f.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,f.jsx)(r.r,{size:`sm`,onClick:B,children:`Ajouter`}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>{j(!1),N(``)},children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})]}):(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full justify-start h-12`,onClick:()=>j(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une colonne`]})})]})})}var bL=[{id:`todo`,title:`À faire`,color:`#6b7280`,cards:[{id:`1`,title:`Implémenter l'authentification`,description:`Ajouter le login/logout avec JWT`,priority:`high`,labels:[{id:`dev`,name:`Dev`,color:`#3b82f6`}],assignees:[{id:`1`,name:`Marie D.`}]},{id:`2`,title:`Créer les maquettes`,priority:`medium`,labels:[{id:`design`,name:`Design`,color:`#8b5cf6`}]}]},{id:`in-progress`,title:`En cours`,color:`#3b82f6`,limit:3,cards:[{id:`3`,title:`Refactoring du dashboard`,priority:`medium`,assignees:[{id:`2`,name:`Pierre M.`}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:`review`,title:`En revue`,color:`#f59e0b`,cards:[]},{id:`done`,title:`Terminé`,color:`#10b981`,cards:[{id:`4`,title:`Setup du projet`,priority:`low`}]}],xL=[{id:`dev`,name:`Dev`,color:`#3b82f6`},{id:`design`,name:`Design`,color:`#8b5cf6`},{id:`bug`,name:`Bug`,color:`#ef4444`},{id:`feature`,name:`Feature`,color:`#10b981`}],SL=s.createContext({});function CL(){return s.useContext(SL)}function wL({logo:e,brandName:n=`Brand`,navItems:i=[],showLoginButton:a=!0,loginButtonText:o=`Se connecter`,onLogin:c,loginHref:u}){let[d,p]=s.useState(!1),{LinkComponent:m}=CL(),h=(e,t,n,r)=>m?(0,f.jsx)(m,{href:e,className:t,onClick:r,children:n}):(0,f.jsx)(`a`,{href:e,className:t,onClick:r,children:n});return(0,f.jsxs)(`nav`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,f.jsxs)(`div`,{className:`container flex h-16 items-center justify-between`,children:[h(`/`,`flex items-center gap-2 font-bold text-xl`,(0,f.jsxs)(f.Fragment,{children:[e,(0,f.jsx)(`span`,{children:n})]})),(0,f.jsx)(`div`,{className:`hidden md:flex items-center gap-6`,children:i.map(e=>h(e.href,t.t(`text-sm font-medium transition-colors hover:text-primary`,e.isActive?`text-primary`:`text-muted-foreground`),e.label))}),(0,f.jsx)(`div`,{className:`hidden md:flex items-center gap-4`,children:a&&(0,f.jsx)(r.r,{variant:`default`,onClick:c,asChild:!!u,children:u?m?(0,f.jsx)(m,{href:u,children:o}):(0,f.jsx)(`a`,{href:u,children:o}):o})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:()=>p(!d),children:d?(0,f.jsx)(l.X,{className:`h-5 w-5`}):(0,f.jsx)(l.Menu,{className:`h-5 w-5`})})]}),d&&(0,f.jsx)(`div`,{className:`md:hidden border-t bg-background p-4`,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i.map(e=>h(e.href,`text-sm font-medium`,e.label,()=>p(!1))),a&&(0,f.jsx)(r.r,{onClick:c,asChild:!!u,children:u?m?(0,f.jsx)(m,{href:u,children:o}):(0,f.jsx)(`a`,{href:u,children:o}):o})]})})]})}function TL({badge:e,title:t,highlightedTitle:i,description:a,primaryButtonText:o=`Commencer`,primaryButtonAction:s,primaryButtonHref:c,secondaryButtonText:u,secondaryButtonAction:d,secondaryButtonHref:p,image:m,stats:h}){let{LinkComponent:g}=CL();return(0,f.jsx)(`section`,{className:`container py-24 md:py-32`,children:(0,f.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-center gap-12`,children:[(0,f.jsxs)(`div`,{className:`flex-1 text-center lg:text-left`,children:[e&&(0,f.jsx)(n.x,{variant:`secondary`,className:`mb-4`,children:e}),(0,f.jsxs)(`h1`,{className:`text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6`,children:[t,` `,i&&(0,f.jsx)(`span`,{className:`text-primary`,children:i})]}),(0,f.jsx)(`p`,{className:`text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none`,children:a}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8`,children:[(0,f.jsx)(r.r,{size:`lg`,onClick:s,asChild:!!c,children:c?g?(0,f.jsxs)(g,{href:c,children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(`a`,{href:c,children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(f.Fragment,{children:[o,(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]})}),u&&(0,f.jsx)(r.r,{size:`lg`,variant:`outline`,onClick:d,asChild:!!p,children:p?g?(0,f.jsxs)(g,{href:p,children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]}):(0,f.jsxs)(`a`,{href:p,children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Play,{className:`mr-2 h-4 w-4`}),u]})})]}),h&&h.length>0&&(0,f.jsx)(`div`,{className:`flex gap-8 justify-center lg:justify-start`,children:h.map((e,t)=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-2xl md:text-3xl font-bold`,children:e.value}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label})]},t))})]}),m&&(0,f.jsx)(`div`,{className:`flex-1 w-full lg:w-auto`,children:m})]})})}function EL({title:e=`Fonctionnalités`,description:t,features:n}){return(0,f.jsxs)(`section`,{className:`container py-24 bg-muted/30`,children:[(0,f.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,f.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),t&&(0,f.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:t})]}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,f.jsxs)(Y,{className:`bg-background`,children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4`,children:(0,f.jsx)(`span`,{className:`text-primary`,children:e.icon})}),(0,f.jsx)(Z,{className:`text-xl`,children:e.title})]}),(0,f.jsx)(Q,{children:(0,f.jsx)(Se,{className:`text-base`,children:e.description})})]},e.id))})]})}function DL({title:e=`Ce que disent nos clients`,testimonials:n}){return(0,f.jsxs)(`section`,{className:`container py-24`,children:[(0,f.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight text-center mb-12`,children:e}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[e.rating&&(0,f.jsx)(`div`,{className:`flex gap-1 mb-4`,children:Array.from({length:5}).map((n,r)=>(0,f.jsx)(l.Star,{className:t.t(`h-4 w-4`,r<e.rating?`text-yellow-400 fill-yellow-400`:`text-muted-foreground`)},r))}),(0,f.jsxs)(`p`,{className:`text-muted-foreground mb-6`,children:[`"`,e.content,`"`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.avatar?(0,f.jsx)(`img`,{src:e.avatar,alt:e.author,className:`h-10 w-10 rounded-full object-cover`}):(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,f.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:e.author.charAt(0)})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.author}),(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e.role,e.company&&` @ ${e.company}`]})]})]})]})},e.id))})]})}function OL({title:e,description:n,buttonText:i,buttonAction:a,buttonHref:o,secondaryButtonText:s,secondaryButtonAction:c,variant:u=`default`}){let{LinkComponent:d}=CL();return(0,f.jsx)(`section`,{className:t.t(`py-24`,{default:`bg-muted/50`,gradient:`bg-gradient-to-r from-primary/10 via-primary/5 to-background`,dark:`bg-foreground text-background`}[u]),children:(0,f.jsx)(`div`,{className:`container`,children:(0,f.jsxs)(`div`,{className:`text-center max-w-2xl mx-auto`,children:[(0,f.jsx)(`h2`,{className:t.t(`text-3xl md:text-4xl font-bold tracking-tight mb-4`,u===`dark`&&`text-background`),children:e}),n&&(0,f.jsx)(`p`,{className:t.t(`text-lg mb-8`,u===`dark`?`text-background/80`:`text-muted-foreground`),children:n}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:[(0,f.jsx)(r.r,{size:`lg`,variant:u===`dark`?`secondary`:`default`,onClick:a,asChild:!!o,children:o?d?(0,f.jsxs)(d,{href:o,children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(`a`,{href:o,children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,f.jsxs)(f.Fragment,{children:[i,(0,f.jsx)(l.ChevronRight,{className:`ml-2 h-4 w-4`})]})}),s&&(0,f.jsx)(r.r,{size:`lg`,variant:`outline`,onClick:c,className:u===`dark`?`border-background/20 text-background hover:bg-background/10`:``,children:s})]})]})})})}function kL({logo:e,brandName:n=`Brand`,navItems:r,showLoginButton:i=!0,loginButtonText:a=`Se connecter`,onLogin:o,loginHref:c,hero:l,features:u,featuresTitle:d,featuresDescription:p,testimonials:m,testimonialsTitle:h,cta:g,footer:_,className:v,LinkComponent:y}){let b=s.useMemo(()=>({LinkComponent:y}),[y]);return(0,f.jsx)(SL.Provider,{value:b,children:(0,f.jsxs)(`div`,{className:t.t(`min-h-screen`,v),children:[(0,f.jsx)(wL,{logo:e,brandName:n,navItems:r,showLoginButton:i,loginButtonText:a,onLogin:o,loginHref:c}),l&&(0,f.jsx)(TL,{...l}),u&&u.length>0&&(0,f.jsx)(EL,{title:d,description:p,features:u}),m&&m.length>0&&(0,f.jsx)(DL,{title:h,testimonials:m}),g&&(0,f.jsx)(OL,{...g}),_]})})}var AL=[{label:`Fonctionnalités`,href:`#features`},{label:`Tarifs`,href:`#pricing`},{label:`Témoignages`,href:`#testimonials`},{label:`Contact`,href:`#contact`}],jL=[{id:`1`,icon:(0,f.jsx)(l.Zap,{className:`h-6 w-6`}),title:`Rapide et performant`,description:`Optimisé pour la vitesse avec des temps de chargement minimaux.`},{id:`2`,icon:(0,f.jsx)(l.Shield,{className:`h-6 w-6`}),title:`Sécurisé`,description:`Vos données sont protégées avec un chiffrement de bout en bout.`},{id:`3`,icon:(0,f.jsx)(l.Users,{className:`h-6 w-6`}),title:`Collaboration`,description:`Travaillez en équipe avec des outils de collaboration intégrés.`},{id:`4`,icon:(0,f.jsx)(l.Globe,{className:`h-6 w-6`}),title:`Accessible partout`,description:`Accédez à votre espace depuis n'importe quel appareil.`}],ML=[{id:`1`,content:`Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.`,author:`Marie Dupont`,role:`CEO`,company:`TechCorp`,rating:5},{id:`2`,content:`Interface intuitive et support réactif. Je recommande vivement.`,author:`Pierre Martin`,role:`CTO`,company:`StartupXYZ`,rating:5},{id:`3`,content:`Le meilleur outil que nous ayons utilisé pour gérer nos projets.`,author:`Sophie Bernard`,role:`Product Manager`,company:`InnoLab`,rating:5}],NL={badge:`Nouveau`,title:`La solution pour`,highlightedTitle:`votre entreprise`,description:`Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.`,primaryButtonText:`Essayer gratuitement`,secondaryButtonText:`Voir la démo`,stats:[{value:`10K+`,label:`Utilisateurs`},{value:`99.9%`,label:`Uptime`},{value:`24/7`,label:`Support`}]},PL={title:`Prêt à commencer ?`,description:`Rejoignez des milliers d'entreprises qui nous font confiance.`,buttonText:`Créer un compte gratuit`,secondaryButtonText:`Contacter les ventes`,variant:`gradient`},FL=s.createContext({});function IL(){return s.useContext(FL)}function LL({period:e,onChange:r,yearlyDiscount:a}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mb-8`,children:[(0,f.jsx)(i.o,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors`,e===`monthly`?`text-foreground`:`text-muted-foreground`),children:`Mensuel`}),(0,f.jsx)(mr,{id:`billing-toggle`,checked:e===`yearly`,onCheckedChange:e=>r(e?`yearly`:`monthly`)}),(0,f.jsxs)(i.o,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors flex items-center gap-2`,e===`yearly`?`text-foreground`:`text-muted-foreground`),children:[`Annuel`,a&&(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[`-`,a]})]})]})}function RL({plan:e,billingPeriod:i}){let{LinkComponent:a}=IL(),o=i===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,s=i===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,c=typeof o==`string`;return(0,f.jsxs)(Y,{className:t.t(`relative flex flex-col`,e.popular&&`border-primary shadow-lg scale-105`),children:[e.popular&&(0,f.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2`,children:(0,f.jsxs)(n.x,{className:`px-3`,children:[(0,f.jsx)(l.Zap,{className:`h-3 w-3 mr-1`}),e.badge||`Populaire`]})}),(0,f.jsxs)(X,{className:`text-center pb-2`,children:[(0,f.jsx)(Z,{className:`text-xl`,children:e.name}),e.description&&(0,f.jsx)(Se,{children:e.description})]}),(0,f.jsxs)(Q,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`text-center mb-6`,children:c?(0,f.jsx)(`div`,{className:`text-3xl font-bold`,children:o}):(0,f.jsxs)(`div`,{className:`flex items-baseline justify-center`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground mr-1`,children:e.currency||`€`}),(0,f.jsx)(`span`,{className:`text-4xl font-bold`,children:o}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground ml-1`,children:s})]})}),(0,f.jsx)(`ul`,{className:`space-y-3`,children:e.features.map((e,n)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.included===!0?(0,f.jsx)(l.Check,{className:`h-5 w-5 text-green-500 flex-shrink-0`}):e.included===`partial`||e.included===`limited`?(0,f.jsx)(l.Check,{className:`h-5 w-5 text-yellow-500 flex-shrink-0`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,f.jsxs)(`span`,{className:t.t(`text-sm`,!e.included&&`text-muted-foreground`),children:[e.name,e.value&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.value,`)`]})]}),e.tooltip&&(0,f.jsx)(ti,{children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(l.HelpCircle,{className:`h-4 w-4 text-muted-foreground cursor-help`})}),(0,f.jsx)(ii,{children:(0,f.jsx)(`p`,{className:`max-w-xs`,children:e.tooltip})})]})})]},n))})]}),(0,f.jsx)(Ce,{children:(0,f.jsx)(r.r,{className:`w-full`,variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,f.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,f.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})})]})}function zL({plans:e,billingPeriod:i}){let{LinkComponent:a}=IL(),o=Array.from(new Set(e.flatMap(e=>e.features.map(e=>e.name))));return(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,f.jsxs)(`thead`,{children:[(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`text-left p-4 border-b bg-muted/50`,children:`Fonctionnalité`}),e.map(e=>(0,f.jsxs)(`th`,{className:t.t(`text-center p-4 border-b min-w-[150px]`,e.popular&&`bg-primary/5`),children:[(0,f.jsx)(`div`,{className:`font-bold`,children:e.name}),e.popular&&(0,f.jsx)(n.x,{className:`mt-1`,variant:`default`,children:`Populaire`})]},e.id))]}),(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{className:`p-4 border-b bg-muted/50 font-medium`,children:`Prix`}),e.map(e=>{let n=i===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,r=i===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,a=typeof n==`string`;return(0,f.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:a?(0,f.jsx)(`span`,{className:`font-bold`,children:n}):(0,f.jsxs)(`span`,{className:`font-bold`,children:[e.currency||`€`,n,(0,f.jsx)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:r})]})},e.id)})]})]}),(0,f.jsxs)(`tbody`,{children:[o.map((n,r)=>(0,f.jsxs)(`tr`,{className:r%2==0?`bg-muted/20`:``,children:[(0,f.jsx)(`td`,{className:`p-4 border-b`,children:n}),e.map(e=>{let r=e.features.find(e=>e.name===n);return(0,f.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:r?r.included===!0?r.value?(0,f.jsx)(`span`,{children:r.value}):(0,f.jsx)(l.Check,{className:`h-5 w-5 text-green-500 mx-auto`}):r.included===`partial`||r.included===`limited`?(0,f.jsx)(`span`,{className:`text-yellow-600`,children:r.value||`Limité`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground mx-auto`}):(0,f.jsx)(l.X,{className:`h-5 w-5 text-muted-foreground mx-auto`})},e.id)})]},r)),(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{className:`p-4`}),e.map(e=>(0,f.jsx)(`td`,{className:t.t(`text-center p-4`,e.popular&&`bg-primary/5`),children:(0,f.jsx)(r.r,{variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,f.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,f.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})},e.id))]})]})]})})}function BL({title:e=`Questions fréquentes`,items:t}){return(0,f.jsxs)(`div`,{className:`mt-16`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold text-center mb-8`,children:e}),(0,f.jsx)(`div`,{className:`grid md:grid-cols-2 gap-6 max-w-4xl mx-auto`,children:t.map((e,t)=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:e.question}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e.answer})]},t))})]})}function VL({title:e=`Tarification`,description:n,plans:r,showBillingToggle:i=!0,billingPeriod:a,onBillingPeriodChange:o,yearlyDiscount:c,faq:l,faqTitle:u,layout:d=`cards`,columns:p=3,showComparison:m=!1,className:h,LinkComponent:g}){let[_,v]=s.useState(`monthly`),y=a??_,b=e=>{o?o(e):v(e)},x={2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`,4:`md:grid-cols-2 lg:grid-cols-4`},S=s.useMemo(()=>({LinkComponent:g}),[g]);return(0,f.jsx)(FL.Provider,{value:S,children:(0,f.jsxs)(`div`,{className:t.t(`container py-16`,h),children:[(0,f.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,f.jsx)(`h1`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),n&&(0,f.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:n})]}),i&&(0,f.jsx)(LL,{period:y,onChange:b,yearlyDiscount:c}),d===`cards`&&!m?(0,f.jsx)(`div`,{className:t.t(`grid gap-6 items-stretch`,x[p]),children:r.map(e=>(0,f.jsx)(RL,{plan:e,billingPeriod:y},e.id))}):(0,f.jsx)(zL,{plans:r,billingPeriod:y}),l&&l.length>0&&(0,f.jsx)(BL,{title:u,items:l})]})})}var HL=[{id:`free`,name:`Gratuit`,description:`Pour démarrer`,price:0,priceYearly:0,features:[{name:`1 utilisateur`,included:!0},{name:`5 projets`,included:!0},{name:`1 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!1},{name:`Analytics avancés`,included:!1},{name:`Support prioritaire`,included:!1}],buttonText:`Commencer gratuitement`,buttonVariant:`outline`},{id:`pro`,name:`Pro`,description:`Pour les équipes`,price:29,priceYearly:24,periodYearly:`/mois (facturé annuellement)`,popular:!0,features:[{name:`5 utilisateurs`,included:!0},{name:`Projets illimités`,included:!0},{name:`50 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!1}],buttonText:`Essai gratuit 14 jours`},{id:`enterprise`,name:`Enterprise`,description:`Pour les grandes équipes`,price:`Sur mesure`,features:[{name:`Utilisateurs illimités`,included:!0},{name:`Projets illimités`,included:!0},{name:`Stockage illimité`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!0}],buttonText:`Contacter les ventes`,buttonVariant:`outline`}],UL=[{question:`Puis-je changer de plan à tout moment ?`,answer:`Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement.`},{question:`Y a-t-il une période d'essai ?`,answer:`Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise.`},{question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`},{question:`Puis-je annuler à tout moment ?`,answer:`Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires.`}],WL=s.createContext(null);function GL(){let e=s.useContext(WL);if(!e)throw Error(`useWizard must be used within a WakaWizard`);return e}function KL({steps:e,currentStep:n,stepStatuses:r,showStepNumbers:i,orientation:a,onStepClick:o,allowBackNavigation:c}){let u=(e,t)=>t===`completed`?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):t===`error`?(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4`}):t===`skipped`?(0,f.jsx)(l.X,{className:`h-4 w-4 text-muted-foreground`}):i?(0,f.jsx)(`span`,{className:`text-xs font-medium`,children:e+1}):(0,f.jsx)(l.Circle,{className:`h-3 w-3`}),d=e=>{switch(e){case`completed`:return`bg-primary text-primary-foreground border-primary`;case`current`:return`bg-primary text-primary-foreground border-primary`;case`error`:return`bg-destructive text-destructive-foreground border-destructive`;case`skipped`:return`bg-muted text-muted-foreground border-muted`;default:return`bg-background text-muted-foreground border-border`}};return a===`vertical`?(0,f.jsx)(`div`,{className:`flex flex-col gap-0`,children:e.map((i,a)=>{let s=r[a],l=c&&a<n;return(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,f.jsx)(`button`,{type:`button`,disabled:!l,onClick:()=>l&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,d(s),l&&`cursor-pointer hover:opacity-80`),children:i.icon||u(a,s)}),a<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`w-0.5 flex-1 min-h-[24px]`,r[a]===`completed`?`bg-primary`:`bg-border`)})]}),(0,f.jsxs)(`div`,{className:`pb-8`,children:[(0,f.jsxs)(`div`,{className:t.t(`font-medium`,s===`current`?`text-foreground`:`text-muted-foreground`),children:[i.title,i.optional&&(0,f.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:`(optionnel)`})]}),i.description&&(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-0.5`,children:i.description})]})]},i.id)})}):(0,f.jsx)(`div`,{className:`flex items-center gap-0`,children:e.map((i,a)=>{let l=r[a],p=c&&a<n;return(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,disabled:!p,onClick:()=>p&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,d(l),p&&`cursor-pointer hover:opacity-80`),children:i.icon||u(a,l)}),(0,f.jsx)(`div`,{className:`text-center`,children:(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,l===`current`?`text-foreground`:`text-muted-foreground`),children:i.title})})]}),a<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`flex-1 h-0.5 mx-2 mb-6`,r[a]===`completed`?`bg-primary`:`bg-border`)})]},i.id)})})}function qL({onPrev:e,onNext:t,onSkip:n,onCancel:i,isFirstStep:a,isLastStep:o,isOptional:s,prevButtonText:c,nextButtonText:u,finishButtonText:d,skipButtonText:p,cancelButtonText:m,showCancelButton:h,submitting:g}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`div`,{className:`flex gap-2`,children:h&&i&&(0,f.jsx)(r.r,{type:`button`,variant:`ghost`,onClick:i,disabled:g,children:m})}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[!a&&(0,f.jsxs)(r.r,{type:`button`,variant:`outline`,onClick:e,disabled:g,children:[(0,f.jsx)(l.ArrowLeft,{className:`mr-2 h-4 w-4`}),c]}),s&&n&&!o&&(0,f.jsx)(r.r,{type:`button`,variant:`ghost`,onClick:n,disabled:g,children:p}),(0,f.jsxs)(r.r,{type:`button`,onClick:t,disabled:g,children:[g&&(0,f.jsx)(l.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),o?d:u,!o&&!g&&(0,f.jsx)(l.ArrowRight,{className:`ml-2 h-4 w-4`})]})]})]})}function JL({steps:e,currentStep:n,onStepChange:r,onSubmit:i,onCancel:a,title:o,description:c,prevButtonText:l=`Précédent`,nextButtonText:u=`Suivant`,finishButtonText:d=`Terminer`,cancelButtonText:p=`Annuler`,skipButtonText:m=`Passer`,showCancelButton:h=!0,showProgress:g=!0,showStepNumbers:_=!0,showStepper:v=!0,stepperPosition:y=`top`,allowBackNavigation:b=!0,confirmCancel:x=!0,cancelConfirmMessage:S=`Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.`,submitting:C=!1,layout:w=`card`,className:T}){let[E,D]=s.useState(0),[O,k]=s.useState(e.map((e,t)=>t===0?`current`:`pending`)),[A,j]=s.useState(!1),M=n??E,N=M===0,P=M===e.length-1,F=e[M],I=(M+1)/e.length*100,L=(t,n)=>{k(r=>{let i=[...r];if(n===`next`&&M<e.length)i[M]=`completed`;else if(n===`skip`)i[M]=`skipped`;else if(n===`goto`&&t<M)for(let n=t+1;n<e.length;n++)i[n]=`pending`;return i[t]=`current`,i})},R=async t=>{if(t<0||t>=e.length||t>M&&!b)return;F.onLeave&&await F.onLeave(),L(t,`goto`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},z=async()=>{if(F.validate&&!await F.validate()){k(e=>{let t=[...e];return t[M]=`error`,t});return}if(F.onLeave&&await F.onLeave(),P){let t={steps:e.map((e,t)=>({id:e.id,status:t===M?`completed`:O[t]})),completedSteps:e.filter((e,t)=>O[t]===`completed`||t===M).map(e=>e.id),skippedSteps:e.filter((e,t)=>O[t]===`skipped`).map(e=>e.id)};await i?.(t)}else{let t=M+1;L(t,`next`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()}},B=async()=>{if(N)return;F.onLeave&&await F.onLeave();let t=M-1;L(t,`prev`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},V=async()=>{if(!F.optional||P)return;F.onLeave&&await F.onLeave();let t=M+1;L(t,`skip`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},H=()=>{x?j(!0):a?.()},U={currentStep:M,totalSteps:e.length,stepStatuses:O,goToStep:R,nextStep:z,prevStep:B,skipStep:V,isFirstStep:N,isLastStep:P},W=v&&(0,f.jsx)(KL,{steps:e,currentStep:M,stepStatuses:O,showStepNumbers:_,orientation:y===`left`?`vertical`:`horizontal`,onStepClick:R,allowBackNavigation:b}),G=(0,f.jsx)(qL,{onPrev:B,onNext:z,onSkip:F.optional?V:void 0,onCancel:a?H:void 0,isFirstStep:N,isLastStep:P,isOptional:F.optional||!1,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:m,cancelButtonText:p,showCancelButton:h,submitting:C}),K=(0,f.jsxs)(WL.Provider,{value:U,children:[y===`left`?(0,f.jsxs)(`div`,{className:`flex gap-8`,children:[(0,f.jsx)(`div`,{className:`w-64 flex-shrink-0`,children:W}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[g&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,f.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,f.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,f.jsx)(Zn,{value:I})]}),(0,f.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,f.jsx)(`div`,{className:`mt-8`,children:G})]})]}):(0,f.jsxs)(f.Fragment,{children:[W&&(0,f.jsx)(`div`,{className:`mb-8`,children:W}),g&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,f.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,f.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,f.jsx)(Zn,{value:I})]}),(0,f.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,f.jsx)(`div`,{className:`mt-8`,children:G})]}),(0,f.jsx)(ne,{open:A,onOpenChange:j,children:(0,f.jsxs)(oe,{children:[(0,f.jsxs)(se,{children:[(0,f.jsx)(le,{children:`Annuler ?`}),(0,f.jsx)(ue,{children:S})]}),(0,f.jsxs)(ce,{children:[(0,f.jsx)(fe,{children:`Non, continuer`}),(0,f.jsx)(de,{onClick:()=>{j(!1),a?.()},children:`Oui, annuler`})]})]})})]});return w===`minimal`?(0,f.jsx)(`div`,{className:t.t(`space-y-6`,T),children:K}):w===`page`?(0,f.jsxs)(`div`,{className:t.t(`container py-8 max-w-4xl`,T),children:[(o||c)&&(0,f.jsxs)(`div`,{className:`mb-8`,children:[o&&(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:o}),c&&(0,f.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:c})]}),K]}):(0,f.jsxs)(Y,{className:T,children:[(o||c)&&(0,f.jsxs)(X,{children:[o&&(0,f.jsx)(Z,{children:o}),c&&(0,f.jsx)(Se,{children:c})]}),(0,f.jsx)(Q,{children:K})]})}var YL=[{id:`step-1`,title:`Informations de base`,description:`Renseignez vos informations personnelles`,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 1 - Informations de base`})})},{id:`step-2`,title:`Configuration`,description:`Configurez vos préférences`,optional:!0,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 2 - Configuration (optionnel)`})})},{id:`step-3`,title:`Confirmation`,description:`Vérifiez et confirmez`,content:(0,f.jsx)(`div`,{className:`space-y-4`,children:(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 3 - Confirmation`})})}];function XL(e,t,n){let r=e.translations[n]?.value||``,i=e.translations[t]?.value;return!i||i.trim()===``?`missing`:i===r?`identical`:`valid`}function ZL(e,t,n){let r=t.filter(e=>e!==n).map(t=>XL(e,t,n));return r.includes(`missing`)?`missing`:r.includes(`identical`)?`identical`:`valid`}function QL(e,t){let n=new Map;for(let r of e){let e=r.key.split(t),i=e.length>1?e[0]:`__root__`;n.has(i)||n.set(i,[]),n.get(i).push(r)}return n}function $L({status:e}){let{label:r,icon:i,className:a}={valid:{label:`OK`,variant:`default`,icon:l.CheckCircle,className:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300`},missing:{label:`Manquant`,variant:`destructive`,icon:l.XCircle,className:`bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300`},identical:{label:`Identique`,variant:`secondary`,icon:l.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`},warning:{label:`Attention`,variant:`secondary`,icon:l.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`}}[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1 text-xs`,a),children:[(0,f.jsx)(i,{className:`h-3 w-3`}),r]})}function eR({value:e,onChange:n,onBlur:r,placeholder:a,status:o,disabled:c}){let[l,u]=s.useState(e);return s.useEffect(()=>{u(e)},[e]),(0,f.jsx)(i.n,{value:l,onChange:e=>{u(e.target.value),n(e.target.value)},onBlur:r,placeholder:a,disabled:c,className:t.t(`min-h-[60px] resize-none text-sm`,o===`missing`&&`border-red-300 dark:border-red-700`,o===`identical`&&`border-yellow-300 dark:border-yellow-700`)})}function tR({config:e,translations:a,onChange:o,onSave:c,onAddKey:u,onDeleteKey:d,onAddLanguage:p,onExport:m,onImport:h,isLoading:g=!1,isSaving:_=!1,className:v,title:y=`Translation Editor`,description:b=`Gérez vos traductions i18n`}){let[x,S]=s.useState(a),[C,w]=s.useState(``),[T,E]=s.useState(`all`),[D,O]=s.useState(new Set),[k,A]=s.useState(null),[j,M]=s.useState(!1),[N,P]=s.useState(!1),[F,I]=s.useState(!1),[L,R]=s.useState(!1),[z,B]=s.useState(``),[V,H]=s.useState({code:``,label:``,flag:``}),[U,W]=s.useState(null),[G,K]=s.useState(``),[q,ee]=s.useState(`merge`),[J,te]=s.useState(new Map),ne=s.useRef(null),{languages:re,sourceLanguage:ie,keyPathSeparator:ae=`.`,autoSave:oe=!0,saveDebounceMs:se=300,placeholderPatterns:ce=[`{{.*?}}`,`{.*?}`,`%s`,`%d`]}=e,le=re.filter(e=>e.code!==ie);s.useEffect(()=>{S(a)},[a]),s.useEffect(()=>(oe&&J.size>0&&c&&(ne.current&&clearTimeout(ne.current),ne.current=setTimeout(async()=>{await c(x),te(new Map)},se)),()=>{ne.current&&clearTimeout(ne.current)}),[J,oe,se,c,x]);let ue=s.useMemo(()=>{let e=x;if(C){let t=C.toLowerCase();e=e.filter(e=>{if(e.key.toLowerCase().includes(t))return!0;for(let n of Object.keys(e.translations))if(e.translations[n]?.value?.toLowerCase().includes(t))return!0;return!1})}return T!==`all`&&(e=e.filter(e=>{let t=ZL(e,re.map(e=>e.code),ie);switch(T){case`missing`:return t===`missing`;case`incomplete`:return t===`missing`||t===`identical`;case`identical`:return t===`identical`;default:return!0}})),e},[x,C,T,re,ie]),de=s.useMemo(()=>QL(ue,ae),[ue,ae]),fe=(e,t,n)=>{S(r=>r.map(r=>r.key===e?{...r,translations:{...r.translations,[t]:{...r.translations[t],value:n,updatedAt:new Date}}}:r)),te(r=>{let i=new Map(r);return i.has(e)||i.set(e,new Map),i.get(e).set(t,n),i}),o?.(e,t,n)},pe=async()=>{z.trim()&&(await u?.(z),B(``),P(!1))},me=async e=>{await d?.(e),S(t=>t.filter(t=>t.key!==e))},he=async()=>{!V.code||!V.label||(await p?.(V),H({code:``,label:``,flag:``}),I(!1))},ge=async()=>{!U||!G||(await h?.(U,G,q),W(null),K(``),R(!1))},_e=e=>{navigator.clipboard.writeText(e)},ve=e=>{O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ye=s.useMemo(()=>{let e=x.length,t=0,n=0,r=0;for(let e of x){let i=ZL(e,re.map(e=>e.code),ie);i===`missing`?t++:i===`identical`?n++:r++}return{total:e,missing:t,identical:n,valid:r}},[x,re,ie]);return g?(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-center py-12`,v),children:(0,f.jsx)(l.Loader2,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,f.jsx)(ti,{children:(0,f.jsxs)(`div`,{className:t.t(`flex flex-col h-full`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,f.jsx)(l.Languages,{className:`h-6 w-6`}),y]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>P(!0),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Ajouter une clé`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>I(!0),children:[(0,f.jsx)(l.Flag,{className:`h-4 w-4 mr-1`}),`Ajouter une langue`]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>m?.(),children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Exporter tout`]}),re.map(e=>(0,f.jsxs)($,{onClick:()=>m?.(e.code),children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Exporter `,e.label]},e.code)),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{onClick:()=>R(!0),children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]})]})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}),`Sauvegarde...`]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[ye.total,` clés`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),ye.valid,` traduites`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),ye.missing,` manquantes`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-600 dark:text-yellow-400`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),ye.identical,` identiques`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher une clé ou une traduction...`,value:C,onChange:e=>w(e.target.value),className:`pl-10`}),C&&(0,f.jsx)(`button`,{onClick:()=>w(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(n.d,{value:T,onValueChange:e=>E(e),children:[(0,f.jsx)(n.y,{className:`w-[180px]`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsxs)(n.m,{value:`all`,children:[`Toutes (`,ye.total,`)`]}),(0,f.jsxs)(n.m,{value:`missing`,children:[`Manquantes (`,ye.missing,`)`]}),(0,f.jsxs)(n.m,{value:`incomplete`,children:[`Incomplètes (`,ye.missing+ye.identical,`)`]}),(0,f.jsxs)(n.m,{value:`identical`,children:[`Identiques (`,ye.identical,`)`]})]})]})]})]})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,f.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,f.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur z-10`,children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b w-[280px]`,children:`Clé`}),(0,f.jsxs)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:[re.find(e=>e.code===ie)?.label||ie,` (source)`]}),le.map(e=>(0,f.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.flag&&(0,f.jsx)(`span`,{children:e.flag}),e.label]})},e.code)),(0,f.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[100px]`,children:`État`}),(0,f.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[60px]`,children:`Actions`})]})}),(0,f.jsxs)(`tbody`,{children:[Array.from(de.entries()).map(([e,t])=>(0,f.jsxs)(s.Fragment,{children:[e!==`__root__`&&(0,f.jsx)(`tr`,{className:`bg-muted/30`,children:(0,f.jsx)(`td`,{colSpan:le.length+4,className:`p-2`,children:(0,f.jsxs)(`button`,{onClick:()=>ve(e),className:`flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors`,children:[D.has(e)?(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`}):(0,f.jsx)(l.ChevronDown,{className:`h-4 w-4`}),e,(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:t.length})]})})}),!D.has(e)&&t.map(e=>{let t=ZL(e,re.map(e=>e.code),ie);return(0,f.jsxs)(`tr`,{className:`border-b hover:bg-muted/30 transition-colors`,children:[(0,f.jsx)(`td`,{className:`p-3 font-mono text-sm`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`truncate max-w-[200px]`,title:e.key,children:e.key}),(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{asChild:!0,children:(0,f.jsx)(`button`,{onClick:()=>_e(e.key),className:`text-muted-foreground hover:text-foreground`,children:(0,f.jsx)(l.Copy,{className:`h-3 w-3`})})}),(0,f.jsx)(ii,{children:`Copier la clé`})]})]})}),(0,f.jsx)(`td`,{className:`p-2`,children:(0,f.jsx)(eR,{value:e.translations[ie]?.value||``,onChange:t=>fe(e.key,ie,t),placeholder:`Texte source...`,status:e.translations[ie]?.value?`valid`:`missing`})}),le.map(t=>{let n=XL(e,t.code,ie);return(0,f.jsx)(`td`,{className:`p-2`,children:(0,f.jsx)(eR,{value:e.translations[t.code]?.value||``,onChange:n=>fe(e.key,t.code,n),placeholder:`Traduction ${t.label}...`,status:n})},t.code)}),(0,f.jsx)(`td`,{className:`p-3 text-center`,children:(0,f.jsx)($L,{status:t})}),(0,f.jsx)(`td`,{className:`p-3 text-center`,children:(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,children:(0,f.jsx)(l.MoreHorizontal,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>{A(e),M(!0)},children:[(0,f.jsx)(l.Edit3,{className:`h-4 w-4 mr-2`}),`Éditer`]}),(0,f.jsxs)($,{onClick:()=>_e(e.key),children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Copier la clé`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:()=>me(e.key),children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})})]},e.key)})]},e)),ue.length===0&&(0,f.jsx)(`tr`,{children:(0,f.jsxs)(`td`,{colSpan:le.length+4,className:`p-12 text-center`,children:[(0,f.jsx)(l.Languages,{className:`h-12 w-12 mx-auto text-muted-foreground/50 mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:C||T!==`all`?`Aucune traduction ne correspond à vos critères`:`Aucune traduction disponible`})]})})]})]})}),(0,f.jsx)(nr,{open:j,onOpenChange:M,children:(0,f.jsxs)(cr,{className:`w-[500px] sm:max-w-[500px]`,children:[(0,f.jsxs)(lr,{children:[(0,f.jsx)(dr,{children:`Éditer la traduction`}),(0,f.jsx)(fr,{children:k?.key})]}),k&&(0,f.jsxs)(`div`,{className:`py-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`label`,{className:`text-sm font-medium`,children:[re.find(e=>e.code===ie)?.label,` (source)`]}),(0,f.jsx)(i.n,{value:k.translations[ie]?.value||``,onChange:e=>{fe(k.key,ie,e.target.value),A({...k,translations:{...k.translations,[ie]:{...k.translations[ie],value:e.target.value}}})},placeholder:`Texte source...`,className:`min-h-[100px]`})]}),re.filter(e=>e.code!==ie).map(e=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`label`,{className:`text-sm font-medium flex items-center gap-2`,children:[e.flag&&(0,f.jsx)(`span`,{children:e.flag}),e.label]}),(0,f.jsx)(i.n,{value:k.translations[e.code]?.value||``,onChange:t=>{fe(k.key,e.code,t.target.value),A({...k,translations:{...k.translations,[e.code]:{...k.translations[e.code],value:t.target.value}}})},placeholder:`Traduction ${e.label}...`,className:`min-h-[100px]`})]},e.code)),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (optionnel)`}),(0,f.jsx)(i.n,{placeholder:`Contexte ou indication pour la traduction...`,className:`min-h-[80px]`})]})]}),(0,f.jsx)(ur,{children:(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>M(!1),children:`Fermer`})})]})}),(0,f.jsx)(gt,{open:N,onOpenChange:P,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Ajouter une clé de traduction`}),(0,f.jsx)(Tt,{children:`Entrez la clé de traduction (ex: common.buttons.submit)`})]}),(0,f.jsx)(`div`,{className:`py-4`,children:(0,f.jsx)(r.n,{value:z,onChange:e=>B(e.target.value),placeholder:`namespace.key.name`})}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>P(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:pe,children:`Ajouter`})]})]})}),(0,f.jsx)(gt,{open:F,onOpenChange:I,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Ajouter une langue`}),(0,f.jsx)(Tt,{children:`Configurez la nouvelle langue à ajouter`})]}),(0,f.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Code (ex: de, it, pt)`}),(0,f.jsx)(r.n,{value:V.code,onChange:e=>H({...V,code:e.target.value}),placeholder:`de`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Label`}),(0,f.jsx)(r.n,{value:V.label,onChange:e=>H({...V,label:e.target.value}),placeholder:`Allemand`})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Emoji drapeau (optionnel)`}),(0,f.jsx)(r.n,{value:V.flag,onChange:e=>H({...V,flag:e.target.value}),placeholder:`🇩🇪`})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>I(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:he,children:`Ajouter`})]})]})}),(0,f.jsx)(gt,{open:L,onOpenChange:R,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Importer des traductions`}),(0,f.jsx)(Tt,{children:`Sélectionnez un fichier JSON à importer`})]}),(0,f.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Fichier JSON`}),(0,f.jsx)(r.n,{type:`file`,accept:`.json`,onChange:e=>W(e.target.files?.[0]||null)})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Langue cible`}),(0,f.jsxs)(n.d,{value:G,onValueChange:K,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Sélectionner une langue`})}),(0,f.jsx)(n.f,{children:re.map(e=>(0,f.jsxs)(n.m,{value:e.code,children:[e.flag&&(0,f.jsx)(`span`,{className:`mr-2`,children:e.flag}),e.label]},e.code))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`label`,{className:`text-sm font-medium`,children:`Stratégie`}),(0,f.jsxs)(n.d,{value:q,onValueChange:e=>ee(e),children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`merge`,children:`Fusionner (conserver les existantes)`}),(0,f.jsx)(n.m,{value:`overwrite`,children:`Écraser tout`})]})]})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>R(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:ge,disabled:!U||!G,children:`Importer`})]})]})})]})})}var nR={default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`},rR={default:`bg-muted`,blue:`bg-blue-500/10`,green:`bg-green-500/10`,yellow:`bg-yellow-500/10`,red:`bg-red-500/10`,purple:`bg-purple-500/10`};function iR({data:e,color:n=`blue`}){let r=Math.max(...e),i=Math.min(...e),a=r-i||1;return(0,f.jsx)(`svg`,{className:`w-16 h-8`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,f.jsx)(`polyline`,{points:e.map((t,n)=>`${n/(e.length-1)*100},${100-(t-i)/a*100}`).join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`3`,className:t.t(`opacity-60`,nR[n]||nR.blue)})})}function aR({metric:e}){let n=e.icon,r=e.trend===`up`?`text-green-500`:e.trend===`down`?`text-red-500`:`text-muted-foreground`,i=e.trend===`up`?l.TrendingUp:e.trend===`down`?l.TrendingDown:null;return(0,f.jsxs)(Y,{className:`relative overflow-hidden`,children:[(0,f.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,f.jsx)(Z,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),n&&(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,rR[e.color||`default`]),children:(0,f.jsx)(`span`,{className:t.t(`h-4 w-4`,nR[e.color||`default`]),children:n})})]}),(0,f.jsxs)(Q,{children:[(0,f.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),e.change!==void 0&&(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-sm`,r),children:[i&&(0,f.jsx)(i,{className:`h-3 w-3`}),(0,f.jsxs)(`span`,{children:[e.change>0?`+`:``,e.change,`%`]}),e.changeLabel&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeLabel})]})]}),e.sparkline&&(0,f.jsx)(iR,{data:e.sparkline,color:e.color})]}),e.target!==void 0&&e.current!==void 0&&(0,f.jsxs)(`div`,{className:`mt-4`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground mb-1`,children:[(0,f.jsx)(`span`,{children:`Progress`}),(0,f.jsxs)(`span`,{children:[Math.round(e.current/e.target*100),`%`]})]}),(0,f.jsx)(Zn,{value:e.current/e.target*100,className:`h-1.5`})]})]})]})}function oR({goal:e}){let r=e.current/e.target*100,i=r>=100;return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-full flex items-center justify-center`,i?`bg-green-500/10 text-green-500`:`bg-muted text-muted-foreground`),children:(0,f.jsx)(l.Target,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:e.label}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.current,e.unit,` / `,e.target,e.unit]})]}),(0,f.jsx)(Zn,{value:Math.min(r,100),className:`h-2`})]}),i&&(0,f.jsx)(n.x,{variant:`default`,className:`bg-green-500`,children:`Complete`})]})}function sR({title:e=`Dashboard`,description:i,metrics:a,periods:o=[{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`},{value:`90d`,label:`90 days`},{value:`12m`,label:`12 months`}],selectedPeriod:s=`30d`,onPeriodChange:c,onRefresh:u,onExport:d,chart:p,secondaryMetrics:m,goals:h,isLoading:g=!1,lastUpdated:_,className:v}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),i&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:i})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.length>0&&(0,f.jsxs)(n.d,{value:s,onValueChange:c,children:[(0,f.jsxs)(n.y,{className:`w-[140px]`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsx)(n.f,{children:o.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]}),u&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:u,disabled:g,children:(0,f.jsx)(l.RefreshCw,{className:t.t(`h-4 w-4`,g&&`animate-spin`)})}),d&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:d,children:(0,f.jsx)(l.Download,{className:`h-4 w-4`})})]})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[`Last updated: `,typeof _==`string`?_:_.toLocaleString()]})]}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:a.slice(0,4).map(e=>(0,f.jsx)(aR,{metric:e},e.id))}),p&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Overview`}),(0,f.jsx)(Se,{children:`Performance metrics over time`})]}),(0,f.jsx)(Q,{children:p})]}),m&&m.length>0&&(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:m.map(e=>(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,f.jsx)(`p`,{className:`text-xl font-bold`,children:e.value})]}),e.change!==void 0&&(0,f.jsxs)(n.x,{variant:e.trend===`up`?`default`:e.trend===`down`?`destructive`:`secondary`,className:`gap-1`,children:[e.trend===`up`?(0,f.jsx)(l.ArrowUpRight,{className:`h-3 w-3`}):e.trend===`down`?(0,f.jsx)(l.ArrowDownRight,{className:`h-3 w-3`}):null,e.change>0?`+`:``,e.change,`%`]})]})})},e.id))}),h&&h.length>0&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Target,{className:`h-5 w-5`}),`Goals & Targets`]}),(0,f.jsx)(Se,{children:`Track your progress towards key objectives`})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:h.map(e=>(0,f.jsx)(oR,{goal:e},e.id))})]})]})}var cR=[{id:`revenue`,label:`Total Revenue`,value:`$45,231.89`,change:20.1,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.DollarSign,{className:`h-4 w-4`}),color:`green`,sparkline:[30,40,35,50,49,60,70,91,125]},{id:`subscriptions`,label:`Subscriptions`,value:`+2,350`,change:180.1,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.Users,{className:`h-4 w-4`}),color:`blue`,sparkline:[10,20,30,40,50,60,70,80,90]},{id:`sales`,label:`Sales`,value:`+12,234`,change:19,changeLabel:`from last month`,trend:`up`,icon:(0,f.jsx)(l.ShoppingCart,{className:`h-4 w-4`}),color:`purple`,sparkline:[65,59,80,81,56,55,70,80,95]},{id:`active`,label:`Active Now`,value:`+573`,change:-2.5,changeLabel:`from last hour`,trend:`down`,icon:(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),color:`yellow`,sparkline:[100,90,85,88,70,65,60,58,55]}],lR=[{id:`revenue-goal`,label:`Monthly Revenue Target`,current:45231,target:5e4,unit:`$`},{id:`users-goal`,label:`New User Signups`,current:2350,target:2e3,unit:``},{id:`conversion-goal`,label:`Conversion Rate`,current:3.2,target:5,unit:`%`}];function uR({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,f.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):i+1}),(0,f.jsx)(`span`,{className:t.t(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,f.jsx)(`div`,{className:t.t(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function dR({items:e,currency:t=`$`,discount:n,couponCode:i,setCouponCode:a,onApplyCoupon:o,onRemoveDiscount:s,isApplyingCoupon:c,shippingPrice:u=0,taxRate:d=0}){let p=e.reduce((e,t)=>e+t.price*t.quantity,0),m=n?n.type===`percent`?p*n.amount/100:n.amount:0,h=p-m,g=h*d/100,_=h+g+u;return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,f.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,f.jsx)(r.t,{}),n?(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Percent,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:s,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}):(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`Coupon code`,value:i,onChange:e=>a(e.target.value),className:`flex-1`}),(0,f.jsx)(r.r,{variant:`outline`,onClick:o,disabled:!i||c,children:c?(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,f.jsxs)(`span`,{children:[t,p.toFixed(2)]})]}),m>0&&(0,f.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,f.jsx)(`span`,{children:`Discount`}),(0,f.jsxs)(`span`,{children:[`-`,t,m.toFixed(2)]})]}),u>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,f.jsxs)(`span`,{children:[t,u.toFixed(2)]})]}),g>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,d,`%)`]}),(0,f.jsxs)(`span`,{children:[t,g.toFixed(2)]})]}),(0,f.jsx)(r.t,{}),(0,f.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsxs)(`span`,{children:[t,_.toFixed(2)]})]})]})]})]})}function fR({items:e,shippingMethods:a=pR,paymentMethods:o=mR,onApplyCoupon:c,discount:u,onRemoveDiscount:d,onSubmitOrder:p,currency:m=`$`,taxRate:h=8.5,className:g}){let[_,v]=s.useState(`cart`),[y,b]=s.useState(``),[x,S]=s.useState(!1),[C,w]=s.useState(!1),[T,E]=s.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[D,O]=s.useState(a[0]?.id||``),[k,A]=s.useState(o[0]?.id||``),[j,M]=s.useState(!1),N=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],P=a.find(e=>e.id===D),F=async()=>{!c||!y||(S(!0),await c(y),S(!1))},I=async()=>{if(p){w(!0);try{await p({address:T,shippingMethod:D,paymentMethod:k,saveInfo:j})}finally{w(!1)}}},L=()=>{let e=N.findIndex(e=>e.id===_);e<N.length-1&&v(N[e+1].id)},R=()=>{let e=N.findIndex(e=>e.id===_);e>0&&v(N[e-1].id)};return(0,f.jsxs)(`div`,{className:t.t(`max-w-6xl mx-auto`,g),children:[(0,f.jsx)(uR,{steps:N,currentStep:_}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[_===`cart`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Shopping Cart`}),(0,f.jsxs)(Se,{children:[e.length,` items in your cart`]})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,f.jsx)(n.x,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,f.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,f.jsxs)(`span`,{className:`font-bold`,children:[m,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,f.jsx)(Ce,{children:(0,f.jsxs)(r.r,{className:`w-full`,onClick:L,children:[`Continue to Shipping`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),_===`shipping`&&(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`First Name`}),(0,f.jsx)(r.n,{value:T.firstName,onChange:e=>E({...T,firstName:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Last Name`}),(0,f.jsx)(r.n,{value:T.lastName,onChange:e=>E({...T,lastName:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Email`}),(0,f.jsx)(r.n,{type:`email`,value:T.email,onChange:e=>E({...T,email:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Phone`}),(0,f.jsx)(r.n,{type:`tel`,value:T.phone,onChange:e=>E({...T,phone:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Address`}),(0,f.jsx)(r.n,{value:T.address,onChange:e=>E({...T,address:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Apartment, suite, etc. (optional)`}),(0,f.jsx)(r.n,{value:T.apartment,onChange:e=>E({...T,apartment:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`City`}),(0,f.jsx)(r.n,{value:T.city,onChange:e=>E({...T,city:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`State`}),(0,f.jsx)(r.n,{value:T.state,onChange:e=>E({...T,state:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Postal Code`}),(0,f.jsx)(r.n,{value:T.postalCode,onChange:e=>E({...T,postalCode:e.target.value})})]})]}),(0,f.jsx)(r.t,{className:`my-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,f.jsx)(l.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,f.jsx)(Qn,{value:D,onValueChange:O,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,D===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e.id}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${m}${e.price.toFixed(2)}`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:L,children:[`Continue to Payment`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`payment`&&(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,f.jsxs)(Q,{children:[(0,f.jsx)(Qn,{value:k,onValueChange:A,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,k===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e.id}),e.icon,(0,f.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,f.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`save-info`,checked:j,onCheckedChange:e=>M(e)}),(0,f.jsx)(i.o,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,f.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,f.jsx)(l.Shield,{className:`h-5 w-5 text-green-500`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:L,children:[`Review Order`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`review`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Review Your Order`}),(0,f.jsx)(Se,{children:`Please verify all information before placing your order`})]}),(0,f.jsxs)(Q,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[T.firstName,` `,T.lastName]}),(0,f.jsxs)(`p`,{children:[T.address,T.apartment&&`, ${T.apartment}`]}),(0,f.jsxs)(`p`,{children:[T.city,`, `,T.state,` `,T.postalCode]}),(0,f.jsx)(`p`,{children:T.email}),(0,f.jsx)(`p`,{children:T.phone})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:P?.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:P?.estimatedDays})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(l.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,f.jsx)(`p`,{className:`font-medium`,children:o.find(e=>e.id===k)?.label})})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-4`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:R,children:[(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsx)(r.r,{className:`flex-1`,onClick:I,disabled:C,children:C?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,f.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,f.jsx)(dR,{items:e,currency:m,discount:u,couponCode:y,setCouponCode:b,onApplyCoupon:F,onRemoveDiscount:d,isApplyingCoupon:x,shippingPrice:P?.price||0,taxRate:h})})]})]})}var pR=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,f.jsx)(l.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,f.jsx)(l.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,f.jsx)(l.Truck,{className:`h-5 w-5`})}],mR=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,f.jsx)(l.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,f.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],hR=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}],gR={common:`bg-slate-500/20 text-slate-400 border-slate-500/30`,rare:`bg-blue-500/20 text-blue-400 border-blue-500/30`,epic:`bg-purple-500/20 text-purple-400 border-purple-500/30`,legendary:`bg-amber-500/20 text-amber-400 border-amber-500/30`},_R={common:``,rare:`shadow-blue-500/20`,epic:`shadow-purple-500/20`,legendary:`shadow-amber-500/30 shadow-lg`};function vR({current:e,max:t,level:n}){let r=e/t*100;return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold`,children:n}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Level `,n]})]}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` XP`]})]}),(0,f.jsxs)(`div`,{className:`relative h-3 rounded-full bg-muted overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-primary to-primary/80 rounded-full transition-all duration-500`,style:{width:`${r}%`}}),(0,f.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full`,style:{width:`${r}%`}})]})]})}function yR({stat:e}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-muted/50`,children:[e.icon&&(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg bg-background flex items-center justify-center`,{default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`}[e.color||`default`]),children:e.icon}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-2xl font-bold`,children:e.value}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label})]})]})}function bR({achievement:e}){let r=e.unlockedAt||e.progress!==void 0&&e.maxProgress!==void 0&&e.progress>=e.maxProgress;return(0,f.jsx)(`div`,{className:t.t(`p-4 rounded-lg border transition-all`,r?t.t(gR[e.rarity||`common`],_R[e.rarity||`common`]):`bg-muted/30 border-dashed opacity-60`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`h-12 w-12 rounded-lg flex items-center justify-center`,r?`bg-background/50`:`bg-muted`),children:e.icon||(0,f.jsx)(l.Trophy,{className:`h-6 w-6`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-medium truncate`,children:e.name}),e.rarity&&(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs capitalize`,children:e.rarity})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.progress!==void 0&&e.maxProgress!==void 0&&!r&&(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:e.progress/e.maxProgress*100,className:`h-1.5`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.progress,` / `,e.maxProgress]})]}),e.unlockedAt&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`Unlocked `,typeof e.unlockedAt==`string`?e.unlockedAt:e.unlockedAt.toLocaleDateString()]})]})]})})}function xR({match:e}){let r={win:`text-green-500 bg-green-500/10`,loss:`text-red-500 bg-red-500/10`,draw:`text-yellow-500 bg-yellow-500/10`},i={win:(0,f.jsx)(l.Trophy,{className:`h-4 w-4`}),loss:(0,f.jsx)(l.Swords,{className:`h-4 w-4`}),draw:(0,f.jsx)(l.Shield,{className:`h-4 w-4`})};return(0,f.jsxs)(`div`,{className:`flex items-center gap-4 p-3 rounded-lg bg-muted/50`,children:[(0,f.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg flex items-center justify-center`,r[e.result]),children:i[e.result]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium capitalize`,children:e.result}),e.score&&(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.score})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.opponent&&(0,f.jsxs)(`span`,{children:[`vs `,e.opponent]}),e.mode&&(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e.mode})]})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[e.xpGained&&(0,f.jsxs)(`p`,{className:`text-sm font-medium text-green-500`,children:[`+`,e.xpGained,` XP`]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:typeof e.date==`string`?e.date:e.date.toLocaleDateString()})]})]})}function SR({name:e,avatar:n,title:r,level:i,currentXP:a,maxXP:o,totalXP:s,rank:c,rankIcon:u,stats:d,achievements:p,badges:m,matchHistory:h,streak:g,joinDate:_,playtime:v,friendsCount:y,isOnline:b=!1,className:x}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,x),children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`pt-6`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6 items-start`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-24 w-24 border-4 border-primary/20`,children:[(0,f.jsx)(ye,{src:n,alt:e}),(0,f.jsx)(be,{className:`text-2xl`,children:e.slice(0,2).toUpperCase()})]}),b&&(0,f.jsx)(`div`,{className:`absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background`}),(0,f.jsx)(`div`,{className:`absolute -top-2 -right-2 h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold text-sm`,children:i})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold`,children:e}),r&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:r}),c&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[u||(0,f.jsx)(l.Medal,{className:`h-5 w-5 text-yellow-500`}),(0,f.jsx)(`span`,{className:`font-medium`,children:c})]})]})]}),(0,f.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 md:grid-cols-4 gap-4`,children:[g!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-orange-500/10`,children:[(0,f.jsx)(l.Flame,{className:`h-6 w-6 text-orange-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:g}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Day Streak`})]}),s!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-purple-500/10`,children:[(0,f.jsx)(l.Zap,{className:`h-6 w-6 text-purple-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:s.toLocaleString()}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Total XP`})]}),v&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-blue-500/10`,children:[(0,f.jsx)(l.Clock,{className:`h-6 w-6 text-blue-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:v}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Playtime`})]}),y!==void 0&&(0,f.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-green-500/10`,children:[(0,f.jsx)(l.Users,{className:`h-6 w-6 text-green-500 mx-auto`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:y}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Friends`})]})]})]}),(0,f.jsx)(`div`,{className:`mt-6`,children:(0,f.jsx)(vR,{current:a,max:o,level:i})}),m&&m.length>0&&(0,f.jsxs)(`div`,{className:`mt-6`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-3`,children:`Badges`}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm`,style:e.color?{backgroundColor:`${e.color}20`,color:e.color}:void 0,children:[e.icon,(0,f.jsx)(`span`,{children:e.name})]},e.id))})]})]})}),(0,f.jsxs)(Cr,{defaultValue:`stats`,className:`w-full`,children:[(0,f.jsxs)(wr,{className:`w-full justify-start`,children:[(0,f.jsx)(Tr,{value:`stats`,children:`Stats`}),(0,f.jsx)(Tr,{value:`achievements`,children:`Achievements`}),(0,f.jsx)(Tr,{value:`history`,children:`Match History`})]}),(0,f.jsx)(Er,{value:`stats`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Player Statistics`}),(0,f.jsx)(Se,{children:`Your performance metrics`})]}),(0,f.jsx)(Q,{children:d&&d.length>0?(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:d.map((e,t)=>(0,f.jsx)(yR,{stat:e},t))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No statistics available`})})]})}),(0,f.jsx)(Er,{value:`achievements`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Achievements`}),(0,f.jsxs)(Se,{children:[p?.filter(e=>e.unlockedAt).length||0,` / `,p?.length||0,` unlocked`]})]}),(0,f.jsx)(Q,{children:p&&p.length>0?(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:p.map(e=>(0,f.jsx)(bR,{achievement:e},e.id))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No achievements yet`})})]})}),(0,f.jsx)(Er,{value:`history`,className:`mt-4`,children:(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Match History`}),(0,f.jsx)(Se,{children:`Your recent games`})]}),(0,f.jsx)(Q,{children:h&&h.length>0?(0,f.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,f.jsx)(xR,{match:e},e.id))}):(0,f.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No matches played yet`})})]})})]}),_&&(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4`}),(0,f.jsxs)(`span`,{children:[`Member since `,typeof _==`string`?_:_.toLocaleDateString()]})]})]})}var CR=[{label:`Matches Played`,value:342,icon:(0,f.jsx)(l.Gamepad2,{className:`h-5 w-5`}),color:`blue`},{label:`Wins`,value:189,icon:(0,f.jsx)(l.Trophy,{className:`h-5 w-5`}),color:`green`},{label:`Win Rate`,value:`55.3%`,icon:(0,f.jsx)(l.TrendingUp,{className:`h-5 w-5`}),color:`yellow`},{label:`Best Score`,value:`12,450`,icon:(0,f.jsx)(l.Star,{className:`h-5 w-5`}),color:`purple`},{label:`Kills`,value:`1,234`,icon:(0,f.jsx)(l.Target,{className:`h-5 w-5`}),color:`red`},{label:`Assists`,value:876,icon:(0,f.jsx)(l.Heart,{className:`h-5 w-5`}),color:`default`}],wR=[{id:`first-win`,name:`First Victory`,description:`Win your first match`,rarity:`common`,unlockedAt:new Date(`2024-01-15`),icon:(0,f.jsx)(l.Trophy,{className:`h-6 w-6 text-yellow-500`})},{id:`streak-master`,name:`Streak Master`,description:`Achieve a 10-day login streak`,rarity:`rare`,unlockedAt:new Date(`2024-02-20`),icon:(0,f.jsx)(l.Flame,{className:`h-6 w-6 text-orange-500`})},{id:`legendary-player`,name:`Legendary Player`,description:`Reach level 50`,rarity:`legendary`,progress:42,maxProgress:50,icon:(0,f.jsx)(l.Crown,{className:`h-6 w-6 text-amber-500`})},{id:`social-butterfly`,name:`Social Butterfly`,description:`Add 25 friends`,rarity:`epic`,progress:18,maxProgress:25,icon:(0,f.jsx)(l.Users,{className:`h-6 w-6 text-purple-500`})}],TR=[{id:`beta`,name:`Beta Tester`,icon:(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),color:`#3b82f6`},{id:`premium`,name:`Premium`,icon:(0,f.jsx)(l.Crown,{className:`h-4 w-4`}),color:`#f59e0b`},{id:`verified`,name:`Verified`,icon:(0,f.jsx)(l.Award,{className:`h-4 w-4`}),color:`#10b981`}],ER=[{id:`1`,result:`win`,score:`3-1`,opponent:`xShadowx`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:150},{id:`2`,result:`win`,score:`2-0`,opponent:`ProGamer99`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:175},{id:`3`,result:`loss`,score:`1-3`,opponent:`NightHawk`,mode:`Ranked`,date:new Date(`2024-03-09`),xpGained:50},{id:`4`,result:`draw`,score:`2-2`,opponent:`StormRider`,mode:`Casual`,date:new Date(`2024-03-09`),xpGained:75},{id:`5`,result:`win`,score:`5-2`,opponent:`BlazeMaster`,mode:`Ranked`,date:new Date(`2024-03-08`),xpGained:200}],DR={authenticator:{icon:(0,f.jsx)(l.Smartphone,{className:`h-5 w-5`}),title:`Authenticator App`,description:`Use an app like Google Authenticator or Authy`,recommended:!0},sms:{icon:(0,f.jsx)(l.MessageSquare,{className:`h-5 w-5`}),title:`SMS`,description:`Receive codes via text message`,recommended:!1},email:{icon:(0,f.jsx)(l.Mail,{className:`h-5 w-5`}),title:`Email`,description:`Receive codes via email`,recommended:!1},hardware:{icon:(0,f.jsx)(l.Key,{className:`h-5 w-5`}),title:`Hardware Key`,description:`Use a physical security key (YubiKey, etc.)`,recommended:!0}};function OR({methods:e,selected:r,onSelect:a}){return(0,f.jsx)(Qn,{value:r,onValueChange:e=>a(e),children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let a=DR[e];return(0,f.jsxs)(i.o,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,r===e?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)($n,{value:e}),(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-muted flex items-center justify-center`,children:a.icon}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:a.title}),a.recommended&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:`Recommended`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.description})]})]},e)})})})}function kR({length:e=6,value:t,onChange:n}){let i=s.useRef([]),a=t.padEnd(e,``).split(``).slice(0,e),o=(t,r)=>{if(!/^\d*$/.test(r))return;let o=[...a];o[t]=r.slice(-1),n(o.join(``)),r&&t<e-1&&i.current[t+1]?.focus()},c=(e,t)=>{t.key===`Backspace`&&!a[e]&&e>0&&i.current[e-1]?.focus()},l=t=>{t.preventDefault(),n(t.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,e))};return(0,f.jsx)(`div`,{className:`flex gap-2 justify-center`,children:a.map((e,t)=>(0,f.jsx)(r.n,{ref:e=>{i.current[t]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>o(t,e.target.value),onKeyDown:e=>c(t,e),onPaste:l,className:`w-12 h-14 text-center text-2xl font-mono`},t))})}function AR({codes:e,onRegenerate:n,onDownload:i}){let[a,o]=s.useState(!1),[c,u]=s.useState(!1),d=()=>{let t=e.map(e=>e.code).join(`
2655
+ `);navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),2e3)},p=e.filter(e=>!e.used);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Key,{className:`h-5 w-5`}),`Backup Codes`]}),(0,f.jsxs)(Se,{children:[p.length,` of `,e.length,` codes remaining`]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:()=>u(!c),children:c?(0,f.jsx)(l.EyeOff,{className:`h-4 w-4`}):(0,f.jsx)(l.Eye,{className:`h-4 w-4`})})]})}),(0,f.jsxs)(Q,{children:[(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,n)=>(0,f.jsx)(`div`,{className:t.t(`font-mono text-sm p-2 rounded border text-center`,e.used?`bg-muted text-muted-foreground line-through`:`bg-card`),children:c?e.code:`••••••••`},n))}),p.length<3&&(0,f.jsxs)(`div`,{className:`mt-4 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 flex items-center gap-3`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-5 w-5 text-yellow-500`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`You're running low on backup codes. Consider regenerating them.`})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:d,children:[a?(0,f.jsx)(l.Check,{className:`h-4 w-4 mr-2`}):(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),a?`Copied`:`Copy All`]}),i&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download`]}),n&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:n,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2`}),`Regenerate`]})]})]})}function jR({status:e={enabled:!1},availableMethods:a=[`authenticator`,`sms`,`email`],qrCodeUrl:o,secretKey:c,backupCodes:u,onEnable:d,onDisable:p,onRegenerateBackupCodes:m,onSendCode:h,className:g}){let[_,v]=s.useState(`overview`),[y,b]=s.useState(a[0]),[x,S]=s.useState(``),[C,w]=s.useState(!1),[T,E]=s.useState(null),[D,O]=s.useState(!1),[k,A]=s.useState(!1);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6 max-w-2xl`,g),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.enabled?(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-green-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.ShieldCheck,{className:`h-6 w-6 text-green-500`})}):(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-yellow-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.ShieldAlert,{className:`h-6 w-6 text-yellow-500`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Two-Factor Authentication`}),(0,f.jsx)(Se,{children:e.enabled?`Enabled via ${DR[e.method]?.title}`:`Add an extra layer of security to your account`})]})]}),(0,f.jsx)(n.x,{variant:e.enabled?`default`:`secondary`,children:e.enabled?`Enabled`:`Disabled`})]})}),_===`overview`&&(0,f.jsx)(Ce,{children:e.enabled?(0,f.jsxs)(`div`,{className:`flex gap-2 w-full`,children:[(0,f.jsx)(r.r,{variant:`outline`,className:`flex-1`,onClick:()=>v(`setup`),children:`Change Method`}),(0,f.jsx)(r.r,{variant:`destructive`,className:`flex-1`,onClick:()=>v(`disable`),children:`Disable 2FA`})]}):(0,f.jsxs)(r.r,{className:`w-full`,onClick:()=>v(`setup`),children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4 mr-2`}),`Enable Two-Factor Authentication`]})})]}),_===`setup`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Choose Authentication Method`}),(0,f.jsx)(Se,{children:`Select how you want to receive verification codes`})]}),(0,f.jsx)(Q,{children:(0,f.jsx)(OR,{methods:a,selected:y,onSelect:b})}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`overview`),children:`Cancel`}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:()=>v(`verify`),children:[`Continue`,(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),_===`verify`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:y===`authenticator`?`Set Up Authenticator`:`Verify Your Identity`}),(0,f.jsx)(Se,{children:y===`authenticator`?`Scan the QR code with your authenticator app`:`Enter the code sent to your ${y}`})]}),(0,f.jsxs)(Q,{className:`space-y-6`,children:[y===`authenticator`&&(0,f.jsxs)(f.Fragment,{children:[o&&(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`div`,{className:`p-4 bg-white rounded-lg`,children:(0,f.jsx)(`img`,{src:o,alt:`QR Code`,className:`h-48 w-48`})})}),c&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Or enter this code manually:`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.n,{value:c,readOnly:!0,className:`font-mono`}),(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:()=>{c&&(navigator.clipboard.writeText(c),O(!0),setTimeout(()=>O(!1),2e3))},children:D?(0,f.jsx)(l.Check,{className:`h-4 w-4`}):(0,f.jsx)(l.Copy,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(r.t,{})]}),(y===`sms`||y===`email`)&&!k&&(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`We'll send a verification code to your `,y===`sms`?`phone`:`email`]}),(0,f.jsxs)(r.r,{onClick:async()=>{if(h){w(!0);try{await h(y),A(!0)}finally{w(!1)}}},disabled:C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):y===`sms`?(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-2`}):(0,f.jsx)(l.Mail,{className:`h-4 w-4 mr-2`}),`Send Code`]})]}),(y===`authenticator`||k)&&(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(i.o,{className:`text-center block`,children:`Enter the 6-digit code`}),(0,f.jsx)(kR,{value:x,onChange:S}),T&&(0,f.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:T})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`setup`),children:`Back`}),(0,f.jsxs)(r.r,{className:`flex-1`,onClick:async()=>{if(d){w(!0),E(null);try{await d(y,x)?(v(`overview`),S(``)):E(`Invalid verification code. Please try again.`)}finally{w(!1)}}},disabled:x.length!==6||C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,f.jsx)(l.Lock,{className:`h-4 w-4 mr-2`}),`Verify & Enable`]})]})]}),_===`disable`&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{className:`text-destructive`,children:`Disable Two-Factor Authentication`}),(0,f.jsx)(Se,{children:`Enter your verification code to confirm. This will make your account less secure.`})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-destructive/10 border border-destructive/20`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-5 w-5 text-destructive mt-0.5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`font-medium text-destructive`,children:`Warning`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Disabling 2FA will remove an important layer of security from your account. Anyone with your password will be able to access your account.`})]})]})}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Enter your verification code`}),(0,f.jsx)(kR,{value:x,onChange:S}),T&&(0,f.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:T})]})]}),(0,f.jsxs)(Ce,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>v(`overview`),children:`Cancel`}),(0,f.jsxs)(r.r,{variant:`destructive`,className:`flex-1`,onClick:async()=>{if(p){w(!0),E(null);try{await p(x)?(v(`overview`),S(``)):E(`Invalid verification code. Please try again.`)}finally{w(!1)}}},disabled:x.length!==6||C,children:[C?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 mr-2`}),`Disable 2FA`]})]})]}),e.enabled&&u&&u.length>0&&_===`overview`&&(0,f.jsx)(AR,{codes:u,onRegenerate:m,onDownload:()=>{let e=u.map(e=>e.code).join(`
2656
+ `),t=new Blob([e],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`backup-codes.txt`,r.click()}}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Fingerprint,{className:`h-5 w-5`}),`Security Tips`]})}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Use an authenticator app for the most secure experience`})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Store your backup codes in a safe place (password manager, safe deposit box)`})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(l.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Never share your verification codes with anyone`})]})]})]})]})}var MR=[{code:`ABCD-1234`,used:!1},{code:`EFGH-5678`,used:!1},{code:`IJKL-9012`,used:!0},{code:`MNOP-3456`,used:!1},{code:`QRST-7890`,used:!1},{code:`UVWX-1234`,used:!0},{code:`YZAB-5678`,used:!1},{code:`CDEF-9012`,used:!1}],NR={enabled:!0,method:`authenticator`,lastVerified:new Date(`2024-03-01`)},PR={online:`bg-green-500`,offline:`bg-gray-400`,away:`bg-yellow-500`,busy:`bg-red-500`};function FR({user:e,size:n=`md`}){return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[n],children:[(0,f.jsx)(ye,{src:e.avatar,alt:e.name}),(0,f.jsx)(be,{children:e.name.slice(0,2).toUpperCase()})]}),e.status&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,PR[e.status])})]})}function IR({conversation:e,currentUserId:r,isSelected:i,onClick:a}){let o=e.participants.find(e=>e.id!==r),s=e.isGroup?e.groupName:o?.name,c=e.isGroup?e.groupAvatar:o?.avatar;return(0,f.jsxs)(`button`,{onClick:a,className:t.t(`w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left`,i?`bg-primary/10`:`hover:bg-muted/50`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{children:[(0,f.jsx)(ye,{src:c}),(0,f.jsx)(be,{children:s?.slice(0,2).toUpperCase()})]}),!e.isGroup&&o?.status&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,PR[o.status])})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:s}),e.lastMessage&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.lastMessage.timestamp==`string`?e.lastMessage.timestamp:zR(e.lastMessage.timestamp)})]}),e.lastMessage&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:e.lastMessage.content})]}),e.unreadCount&&e.unreadCount>0&&(0,f.jsx)(n.x,{className:`h-5 w-5 p-0 flex items-center justify-center rounded-full`,children:e.unreadCount}),e.isPinned&&(0,f.jsx)(l.Pin,{className:`h-3 w-3 text-muted-foreground`})]})}function LR({message:e,isOwn:n,sender:r,showAvatar:i}){let a={sending:(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),sent:(0,f.jsx)(l.Check,{className:`h-3 w-3`}),delivered:(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3`}),read:(0,f.jsx)(l.CheckCheck,{className:`h-3 w-3 text-blue-500`})};return(0,f.jsxs)(`div`,{className:t.t(`flex gap-2 max-w-[80%]`,n?`ml-auto flex-row-reverse`:``),children:[i&&r&&!n&&(0,f.jsx)(FR,{user:r,size:`sm`}),!i&&!n&&(0,f.jsx)(`div`,{className:`w-8`}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[!n&&i&&r&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:r.name}),(0,f.jsxs)(`div`,{className:t.t(`rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-br-md`:`bg-muted rounded-bl-md`),children:[e.replyTo&&(0,f.jsxs)(`div`,{className:t.t(`text-xs mb-1 pb-1 border-b`,n?`border-primary-foreground/20`:`border-border`),children:[(0,f.jsx)(l.Reply,{className:`h-3 w-3 inline mr-1`}),`Reply to message`]}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),e.attachments&&e.attachments.length>0&&(0,f.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.attachments.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`image`?(0,f.jsx)(l.Image,{className:`h-4 w-4`}):(0,f.jsx)(l.File,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`text-xs truncate`,children:e.name})]},e.id))})]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-xs text-muted-foreground`,n?`justify-end`:``),children:[(0,f.jsx)(`span`,{children:typeof e.timestamp==`string`?e.timestamp:zR(e.timestamp)}),n&&e.status&&a[e.status]]}),e.reactions&&e.reactions.length>0&&(0,f.jsx)(`div`,{className:`flex gap-1 mt-1`,children:Array.from(new Set(e.reactions.map(e=>e.emoji))).map(t=>(0,f.jsxs)(`span`,{className:`text-xs bg-muted rounded-full px-2 py-0.5`,children:[t,` `,e.reactions.filter(e=>e.emoji===t).length]},t))})]})]})}function RR({users:e}){if(e.length===0)return null;let t=e.map(e=>e.name).join(`, `);return(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`div`,{className:`flex gap-1`,children:[(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`0ms`}}),(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`150ms`}}),(0,f.jsx)(l.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`300ms`}})]}),(0,f.jsxs)(`span`,{children:[t,` `,e.length===1?`is`:`are`,` typing...`]})]})}function zR(e){return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function BR({currentUser:e,conversations:n=[],selectedConversation:i,messages:a=[],onSendMessage:o,onSelectConversation:c,onTyping:u,typingUsers:d=[],showSidebar:p=!0,className:m}){let[h,g]=s.useState(``),[_,v]=s.useState(``),y=s.useRef(null),b=()=>{y.current?.scrollIntoView({behavior:`smooth`})};s.useEffect(()=>{b()},[a]);let x=()=>{!h.trim()||!o||(o(h.trim()),g(``))},S=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},C=n.filter(t=>{if(!_)return!0;let n=t.participants.find(t=>t.id!==e.id);return(t.isGroup?t.groupName:n?.name)?.toLowerCase().includes(_.toLowerCase())}),w=i?.participants.find(t=>t.id!==e.id),T=i?.isGroup?i.groupName:w?.name,E=a.reduce((e,t,n)=>{let r=a[n-1],i=!r||r.senderId!==t.senderId;return e.push({message:t,showAvatar:i}),e},[]);return(0,f.jsxs)(`div`,{className:t.t(`flex h-[600px] rounded-lg border overflow-hidden`,m),children:[p&&(0,f.jsxs)(`div`,{className:`w-80 border-r flex flex-col bg-card`,children:[(0,f.jsxs)(`div`,{className:`p-4 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Messages`}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search conversations...`,value:_,onChange:e=>v(e.target.value),className:`pl-9`})]})]}),(0,f.jsx)(er,{className:`flex-1`,children:(0,f.jsx)(`div`,{className:`p-2 space-y-1`,children:C.map(t=>(0,f.jsx)(IR,{conversation:t,currentUserId:e.id,isSelected:i?.id===t.id,onClick:()=>c?.(t)},t.id))})})]}),(0,f.jsx)(`div`,{className:`flex-1 flex flex-col`,children:i?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`h-16 border-b flex items-center justify-between px-4 bg-card`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[w&&(0,f.jsx)(FR,{user:w}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:T}),w?.status&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:w.status===`online`?`Online`:`Last seen ${w.lastSeen||`recently`}`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Phone,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Video,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})]})]}),(0,f.jsxs)(er,{className:`flex-1 p-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-4`,children:[E.map(({message:t,showAvatar:n})=>(0,f.jsx)(LR,{message:t,isOwn:t.senderId===e.id,sender:i.participants.find(e=>e.id===t.senderId),showAvatar:n},t.id)),(0,f.jsx)(`div`,{ref:y})]}),d.length>0&&(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(RR,{users:d})})]}),(0,f.jsx)(`div`,{className:`p-4 border-t bg-card`,children:(0,f.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Paperclip,{className:`h-4 w-4`})}),(0,f.jsx)(`div`,{className:`flex-1`,children:(0,f.jsx)(r.n,{placeholder:`Type a message...`,value:h,onChange:e=>{g(e.target.value),u?.()},onKeyDown:S,className:`rounded-full`})}),(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(l.Smile,{className:`h-4 w-4`})}),(0,f.jsx)(r.r,{size:`icon`,onClick:x,disabled:!h.trim(),children:(0,f.jsx)(l.Send,{className:`h-4 w-4`})})]})})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4`,children:(0,f.jsx)(l.Send,{className:`h-8 w-8 text-muted-foreground`})}),(0,f.jsx)(`h3`,{className:`font-medium text-lg`,children:`Your Messages`}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Select a conversation to start chatting`})]})})})]})}var VR=[{id:`1`,name:`John Doe`,avatar:``,status:`online`},{id:`2`,name:`Jane Smith`,avatar:``,status:`away`,lastSeen:`2 hours ago`},{id:`3`,name:`Bob Wilson`,avatar:``,status:`offline`,lastSeen:`yesterday`},{id:`4`,name:`Alice Brown`,avatar:``,status:`busy`}],HR=[{id:`conv1`,participants:[VR[0],VR[1]],lastMessage:{id:`m1`,content:`Hey, how's the project going?`,senderId:`2`,timestamp:new Date,status:`read`},unreadCount:2,isPinned:!0},{id:`conv2`,participants:[VR[0],VR[2]],lastMessage:{id:`m2`,content:`See you tomorrow!`,senderId:`1`,timestamp:new Date(Date.now()-36e5),status:`delivered`}},{id:`conv3`,isGroup:!0,groupName:`Project Team`,participants:[VR[0],VR[1],VR[2],VR[3]],lastMessage:{id:`m3`,content:`Meeting at 3pm`,senderId:`4`,timestamp:new Date(Date.now()-72e5),status:`read`},unreadCount:5}],UR=[{id:`msg1`,content:`Hey! How are you doing?`,senderId:`2`,timestamp:new Date(Date.now()-36e5),status:`read`},{id:`msg2`,content:`I'm doing great, thanks for asking! Just finished the new feature.`,senderId:`1`,timestamp:new Date(Date.now()-35e5),status:`read`},{id:`msg3`,content:`That's awesome! Can you show me a demo?`,senderId:`2`,timestamp:new Date(Date.now()-34e5),status:`read`},{id:`msg4`,content:`Sure! Let me schedule a call for tomorrow. Does 2pm work for you?`,senderId:`1`,timestamp:new Date(Date.now()-33e5),status:`delivered`},{id:`msg5`,content:`Perfect, 2pm works great!`,senderId:`2`,timestamp:new Date(Date.now()-32e5),status:`read`}],WR={pending:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),label:`Pending`},building:{color:`text-blue-500 bg-blue-500/10`,icon:(0,f.jsx)(l.Loader2,{className:`h-4 w-4 animate-spin`}),label:`Building`},deploying:{color:`text-purple-500 bg-purple-500/10`,icon:(0,f.jsx)(l.Rocket,{className:`h-4 w-4 animate-pulse`}),label:`Deploying`},success:{color:`text-green-500 bg-green-500/10`,icon:(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),label:`Success`},failed:{color:`text-red-500 bg-red-500/10`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Failed`},cancelled:{color:`text-gray-500 bg-gray-500/10`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Cancelled`},rollback:{color:`text-orange-500 bg-orange-500/10`,icon:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`}),label:`Rollback`}},GR={development:{color:`text-blue-500 border-blue-500/30 bg-blue-500/10`,icon:(0,f.jsx)(l.Terminal,{className:`h-4 w-4`})},staging:{color:`text-yellow-500 border-yellow-500/30 bg-yellow-500/10`,icon:(0,f.jsx)(l.Server,{className:`h-4 w-4`})},production:{color:`text-green-500 border-green-500/30 bg-green-500/10`,icon:(0,f.jsx)(l.Globe,{className:`h-4 w-4`})}};function KR({status:e}){let r=WR[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function qR({environment:e}){let r=GR[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1 capitalize`,r.color),children:[r.icon,e]})}function JR({deployment:e,onRollback:t,onCancel:n,onRetry:i}){let a=e.status===`building`||e.status===`deploying`,o=e.status===`success`&&e.environment===`production`,s=e.status===`failed`,c=a;return(0,f.jsx)(`div`,{className:`p-4 rounded-lg border bg-card hover:bg-muted/50 transition-colors`,children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(ve,{className:`h-10 w-10`,children:[(0,f.jsx)(ye,{src:e.author.avatar}),(0,f.jsx)(be,{children:e.author.name.slice(0,2).toUpperCase()})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(KR,{status:e.status}),(0,f.jsx)(qR,{environment:e.environment})]}),(0,f.jsx)(`p`,{className:`text-sm mt-1 line-clamp-1`,children:e.commitMessage}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3`}),e.branch]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.GitCommit,{className:`h-3 w-3`}),e.commit.slice(0,7)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),typeof e.startedAt==`string`?e.startedAt:ZR(e.startedAt)]}),e.duration&&(0,f.jsx)(`span`,{children:e.duration})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.url&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,asChild:!0,children:(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4`})})}),c&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:n,children:(0,f.jsx)(l.Pause,{className:`h-4 w-4`})}),s&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:i,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),o&&(0,f.jsx)(r.r,{variant:`ghost`,size:`icon`,onClick:t,children:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`})})]})]})})}function YR({pipeline:e}){let n=e.stages.filter(e=>e.status===`success`).length/e.stages.length*100;return(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{className:`pb-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(KR,{status:e.status}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.startedAt==`string`?e.startedAt:ZR(e.startedAt)})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3`}),e.branch,(0,f.jsx)(`span`,{className:`mx-1`,children:`•`}),`Triggered by `,e.trigger]})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(Zn,{value:n,className:`h-2`}),(0,f.jsx)(`div`,{className:`flex items-center justify-between`,children:e.stages.map((n,r)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center`,WR[n.status].color),children:WR[n.status].icon}),(0,f.jsx)(`span`,{className:`text-xs`,children:n.name}),n.duration&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.duration})]}),r<e.stages.length-1&&(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4 text-muted-foreground`})]},n.id))})]})})]})}function XR({env:e}){let n={healthy:`text-green-500`,degraded:`text-yellow-500`,down:`text-red-500`},r={healthy:(0,f.jsx)(l.CheckCircle,{className:`h-5 w-5`}),degraded:(0,f.jsx)(l.AlertCircle,{className:`h-5 w-5`}),down:(0,f.jsx)(l.XCircle,{className:`h-5 w-5`})};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`capitalize flex items-center gap-2`,children:[GR[e.name].icon,e.name]}),(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-1`,n[e.status]),children:[r[e.status],(0,f.jsx)(`span`,{className:`text-sm capitalize`,children:e.status})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline truncate`,children:e.url})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[e.uptime&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Uptime`}),(0,f.jsx)(`p`,{className:`font-medium`,children:e.uptime})]}),e.responseTime&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Response Time`}),(0,f.jsx)(`p`,{className:`font-medium`,children:e.responseTime})]})]}),e.lastDeployment&&(0,f.jsxs)(`div`,{className:`pt-2 border-t`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Last Deployment`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,f.jsx)(KR,{status:e.lastDeployment.status}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:typeof e.lastDeployment.startedAt==`string`?e.lastDeployment.startedAt:ZR(e.lastDeployment.startedAt)})]})]})]})]})}function ZR(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function QR({deployments:e=[],pipelines:i=[],environments:a=[],onDeploy:o,onRollback:c,onCancel:u,onRetry:d,branches:p=[`main`,`develop`,`staging`],className:m}){let[h,g]=s.useState(p[0]),[_,v]=s.useState(`staging`),y=e.filter(e=>e.status===`building`||e.status===`deploying`);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Deployments`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage and monitor your deployments`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:h,onValueChange:g,children:[(0,f.jsxs)(n.y,{className:`w-[160px]`,children:[(0,f.jsx)(l.GitBranch,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsx)(n.f,{children:p.map(e=>(0,f.jsx)(n.m,{value:e,children:e},e))})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsxs)(n.y,{className:`w-[160px]`,children:[(0,f.jsx)(l.Server,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`development`,children:`Development`}),(0,f.jsx)(n.m,{value:`staging`,children:`Staging`}),(0,f.jsx)(n.m,{value:`production`,children:`Production`})]})]}),(0,f.jsxs)(r.r,{onClick:()=>o?.(_,h),children:[(0,f.jsx)(l.Rocket,{className:`h-4 w-4 mr-2`}),`Deploy`]})]})]}),y.length>0&&(0,f.jsx)(Y,{className:`border-blue-500/50 bg-blue-500/5`,children:(0,f.jsx)(Q,{className:`py-4`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-blue-500/10 flex items-center justify-center`,children:(0,f.jsx)(l.Rocket,{className:`h-5 w-5 text-blue-500 animate-pulse`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[y.length,` deployment`,y.length>1?`s`:``,` in progress`]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.map(e=>e.environment).join(`, `)})]})]})})}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:a.map(e=>(0,f.jsx)(XR,{env:e},e.name))}),(0,f.jsxs)(Cr,{defaultValue:`deployments`,className:`w-full`,children:[(0,f.jsxs)(wr,{children:[(0,f.jsx)(Tr,{value:`deployments`,children:`Recent Deployments`}),(0,f.jsx)(Tr,{value:`pipelines`,children:`Pipelines`})]}),(0,f.jsx)(Er,{value:`deployments`,className:`mt-4 space-y-3`,children:e.length>0?e.map(e=>(0,f.jsx)(JR,{deployment:e,onRollback:()=>c?.(e.id),onCancel:()=>u?.(e.id),onRetry:()=>d?.(e.id)},e.id)):(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`py-12 text-center`,children:[(0,f.jsx)(l.Rocket,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`No deployments yet`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Deploy your first version to get started`})]})})}),(0,f.jsx)(Er,{value:`pipelines`,className:`mt-4 space-y-4`,children:i.length>0?i.map(e=>(0,f.jsx)(YR,{pipeline:e},e.id)):(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`py-12 text-center`,children:[(0,f.jsx)(l.Activity,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`No active pipelines`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pipelines will appear here when triggered`})]})})})]})]})}var $R=[{id:`d1`,status:`success`,environment:`production`,branch:`main`,commit:`a1b2c3d4e5f6`,commitMessage:`feat: Add new dashboard component`,author:{name:`John Doe`},startedAt:new Date(Date.now()-36e5),finishedAt:new Date(Date.now()-33e5),duration:`5m 12s`,url:`https://app.example.com`},{id:`d2`,status:`building`,environment:`staging`,branch:`develop`,commit:`f6e5d4c3b2a1`,commitMessage:`fix: Resolve login issue`,author:{name:`Jane Smith`},startedAt:new Date(Date.now()-18e4)},{id:`d3`,status:`failed`,environment:`development`,branch:`feature/new-api`,commit:`1a2b3c4d5e6f`,commitMessage:`wip: New API endpoints`,author:{name:`Bob Wilson`},startedAt:new Date(Date.now()-72e5),finishedAt:new Date(Date.now()-7e6),duration:`3m 20s`}],ez=[{id:`p1`,name:`CI/CD Pipeline`,status:`building`,trigger:`push to main`,branch:`main`,startedAt:new Date(Date.now()-3e5),stages:[{id:`s1`,name:`Build`,status:`success`,duration:`1m 30s`},{id:`s2`,name:`Test`,status:`success`,duration:`2m 45s`},{id:`s3`,name:`Deploy`,status:`building`},{id:`s4`,name:`Verify`,status:`pending`}]}],tz=[{name:`production`,status:`healthy`,url:`https://app.example.com`,uptime:`99.9%`,responseTime:`120ms`,lastDeployment:$R[0]},{name:`staging`,status:`degraded`,url:`https://staging.example.com`,uptime:`98.5%`,responseTime:`250ms`},{name:`development`,status:`healthy`,url:`https://dev.example.com`,uptime:`95.0%`,responseTime:`180ms`}],nz={critical:{label:`Critical`,color:`text-red-500`,bgColor:`bg-red-500`},high:{label:`High`,color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{label:`Medium`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{label:`Low`,color:`text-blue-500`,bgColor:`bg-blue-500`}},rz={triggered:{label:`Triggered`,color:`text-red-500`,icon:l.AlertCircle},acknowledged:{label:`Acknowledged`,color:`text-orange-500`,icon:l.Bell},investigating:{label:`Investigating`,color:`text-yellow-500`,icon:l.Search},identified:{label:`Identified`,color:`text-blue-500`,icon:l.Activity},resolved:{label:`Resolved`,color:`text-green-500`,icon:l.CheckCircle2},closed:{label:`Closed`,color:`text-gray-500`,icon:l.XCircle}};function iz(e,t){let n=(t||new Date).getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return a>0?`${a}d ${i%24}h`:i>0?`${i}h ${r%60}m`:`${r}m`}function az(e){return e.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}function oz({incident:e,onAcknowledge:i,onResolve:a,onSelect:o}){let s=nz[e.severity],c=rz[e.status],u=c.icon,d=![`resolved`,`closed`].includes(e.status);return(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.severity===`critical`&&d&&`border-red-500/50 bg-red-500/5`,e.severity===`high`&&d&&`border-orange-500/30`),onClick:o,children:(0,f.jsx)(Q,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,`${s.bgColor}/10`),children:(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-5 w-5`,s.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(n.x,{className:t.t(`text-white text-xs`,s.bgColor),children:s.label}),(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs`,c.color),children:[(0,f.jsx)(u,{className:`h-3 w-3 mr-1`}),c.label]}),e.service&&(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e.service})]}),(0,f.jsx)(`h4`,{className:`font-semibold mt-2 truncate`,children:e.title}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.description}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),iz(e.createdAt,e.resolvedAt)]}),e.affectedUsers!==void 0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Users,{className:`h-3 w-3`}),e.affectedUsers,` affected`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.MessageSquare,{className:`h-3 w-3`}),e.events.length]})]}),e.responders.length>0&&(0,f.jsx)(`div`,{className:`flex items-center gap-2 mt-3`,children:(0,f.jsxs)(`div`,{className:`flex -space-x-2`,children:[e.responders.slice(0,3).map(e=>(0,f.jsxs)(ve,{className:`h-6 w-6 border-2 border-background`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id)),e.responders.length>3&&(0,f.jsxs)(`div`,{className:`h-6 w-6 rounded-full bg-muted flex items-center justify-center text-xs border-2 border-background`,children:[`+`,e.responders.length-3]})]})})]}),d&&(0,f.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[e.status===`triggered`&&i&&(0,f.jsx)(r.r,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:e=>{e.stopPropagation(),i()},children:`Ack`}),e.status!==`triggered`&&e.status!==`resolved`&&a&&(0,f.jsx)(r.r,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-green-500`,onClick:e=>{e.stopPropagation(),a()},children:`Resolve`})]})]})})})}function sz({incidents:e}){let t=e.filter(e=>![`resolved`,`closed`].includes(e.status)),n=t.filter(e=>e.severity===`critical`),r=s.useMemo(()=>{let t=e.filter(e=>e.resolvedAt);if(t.length===0)return 0;let n=t.reduce((e,t)=>e+(t.resolvedAt.getTime()-t.createdAt.getTime()),0);return Math.round(n/t.length/6e4)},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-red-500`,children:t.length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Incidents`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-orange-500`,children:n.length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Critical`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-3xl font-bold`,children:[r,`m`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg MTTR`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-3xl font-bold text-green-500`,children:e.filter(e=>e.status===`resolved`).length}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Resolved Today`})]})})]})}function cz({incidents:e,onCreateIncident:i,onAcknowledge:a,onResolve:o,onEscalate:c,onAssign:u,className:d}){let[p,m]=s.useState(``),[h,g]=s.useState(`all`),[_,v]=s.useState(`active`),[y,b]=s.useState(null),x=s.useMemo(()=>e.filter(e=>!(p&&!e.title.toLowerCase().includes(p.toLowerCase())||h!==`all`&&e.severity!==h||_===`active`&&[`resolved`,`closed`].includes(e.status)||_===`resolved`&&![`resolved`,`closed`].includes(e.status))).sort((e,t)=>{let n={critical:0,high:1,medium:2,low:3},r=n[e.severity]-n[t.severity];return r===0?t.createdAt.getTime()-e.createdAt.getTime():r}),[e,p,h,_]);return(0,f.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,d),children:[(0,f.jsx)(sz,{incidents:e}),(0,f.jsxs)(`div`,{className:`flex gap-6`,children:[(0,f.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search incidents...`,value:p,onChange:e=>m(e.target.value),className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Severity`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Severity`}),(0,f.jsx)(n.m,{value:`critical`,children:`Critical`}),(0,f.jsx)(n.m,{value:`high`,children:`High`}),(0,f.jsx)(n.m,{value:`medium`,children:`Medium`}),(0,f.jsx)(n.m,{value:`low`,children:`Low`})]})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`active`,children:`Active`}),(0,f.jsx)(n.m,{value:`resolved`,children:`Resolved`}),(0,f.jsx)(n.m,{value:`all`,children:`All`})]})]}),i&&(0,f.jsxs)(r.r,{onClick:i,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Create Incident`]})]}),(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`space-y-3 pr-4`,children:x.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-12 w-12 mb-4 text-green-500`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No incidents`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`All systems are operational`})]}):x.map(e=>(0,f.jsx)(oz,{incident:e,onAcknowledge:a?()=>a(e):void 0,onResolve:o?()=>o(e):void 0,onSelect:()=>b(e)},e.id))})})]}),y&&(0,f.jsxs)(Y,{className:`w-96 shrink-0`,children:[(0,f.jsxs)(X,{className:`pb-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(n.x,{className:t.t(`text-white`,nz[y.severity].bgColor),children:nz[y.severity].label}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>b(null),children:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`})})]}),(0,f.jsx)(Z,{className:`mt-2`,children:y.title}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,f.jsx)(n.x,{variant:`outline`,className:rz[y.status].color,children:rz[y.status].label}),y.service&&(0,f.jsx)(n.x,{variant:`secondary`,children:y.service})]})]}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[y.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.description}),y.impact&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Impact`}),(0,f.jsx)(`p`,{className:`text-sm`,children:y.impact})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Timeline`}),(0,f.jsx)(`div`,{className:`space-y-2`,children:y.events.slice(0,5).map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:az(e.timestamp)}),(0,f.jsx)(`span`,{children:e.content})]},e.id))})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Responders`}),(0,f.jsx)(`div`,{className:`space-y-2`,children:y.responders.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(ve,{className:`h-6 w-6`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{className:`text-sm`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs ml-auto`,children:e.role})]},e.id))})]}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t`,children:[y.slackChannel&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-2`}),`Join #`,y.slackChannel]}),y.runbookUrl&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,f.jsx)(l.ExternalLink,{className:`h-4 w-4 mr-2`}),`View Runbook`]}),c&&![`resolved`,`closed`].includes(y.status)&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`justify-start text-orange-500`,onClick:()=>c(y),children:[(0,f.jsx)(l.Phone,{className:`h-4 w-4 mr-2`}),`Escalate`]})]})]})]})]})]})}var lz=[{id:`1`,title:`Database connection pool exhausted`,description:`Production database is experiencing connection pool exhaustion, causing request timeouts`,severity:`critical`,status:`investigating`,service:`api-gateway`,createdAt:new Date(Date.now()-45*6e4),acknowledgedAt:new Date(Date.now()-40*6e4),impact:`50% of API requests failing with 504 errors`,affectedUsers:12500,slackChannel:`incident-db-001`,runbookUrl:`https://runbooks.example.com/db-pool`,responders:[{id:`1`,name:`John Doe`,role:`Incident Commander`,status:`engaged`},{id:`2`,name:`Jane Smith`,role:`DBA`,status:`engaged`}],events:[{id:`e1`,type:`status_change`,timestamp:new Date(Date.now()-45*6e4),content:`Incident triggered by alerting system`},{id:`e2`,type:`assignment`,timestamp:new Date(Date.now()-43*6e4),content:`John Doe assigned as IC`,user:`System`},{id:`e3`,type:`status_change`,timestamp:new Date(Date.now()-40*6e4),content:`Incident acknowledged`,user:`John Doe`},{id:`e4`,type:`comment`,timestamp:new Date(Date.now()-35*6e4),content:`Investigating connection pool settings`,user:`Jane Smith`},{id:`e5`,type:`status_change`,timestamp:new Date(Date.now()-30*6e4),content:`Status changed to investigating`,user:`John Doe`}]},{id:`2`,title:`High latency on payment service`,description:`Payment processing latency increased to >2s, above SLA threshold`,severity:`high`,status:`acknowledged`,service:`payment-service`,createdAt:new Date(Date.now()-20*6e4),acknowledgedAt:new Date(Date.now()-15*6e4),affectedUsers:3200,responders:[{id:`3`,name:`Alice Johnson`,role:`On-Call Engineer`,status:`engaged`}],events:[{id:`e6`,type:`status_change`,timestamp:new Date(Date.now()-20*6e4),content:`Incident triggered`},{id:`e7`,type:`status_change`,timestamp:new Date(Date.now()-15*6e4),content:`Acknowledged by Alice Johnson`}]},{id:`3`,title:`Elevated error rate on search API`,severity:`medium`,status:`triggered`,service:`search-service`,createdAt:new Date(Date.now()-5*6e4),responders:[],events:[{id:`e8`,type:`status_change`,timestamp:new Date(Date.now()-5*6e4),content:`Incident triggered by alerting system`}]},{id:`4`,title:`Memory leak in recommendation engine`,description:`Gradual memory increase detected, auto-scaling keeping up but needs investigation`,severity:`low`,status:`resolved`,service:`recommendation-engine`,createdAt:new Date(Date.now()-4*36e5),acknowledgedAt:new Date(Date.now()-3.5*36e5),resolvedAt:new Date(Date.now()-2*36e5),responders:[{id:`4`,name:`Bob Wilson`,role:`Backend Engineer`,status:`available`}],events:[{id:`e9`,type:`status_change`,timestamp:new Date(Date.now()-4*36e5),content:`Incident triggered`},{id:`e10`,type:`status_change`,timestamp:new Date(Date.now()-2*36e5),content:`Resolved - deployed fix v2.3.1`}]}],uz={region:{icon:l.Globe,color:`text-blue-500`,label:`Region`},vpc:{icon:l.Network,color:`text-purple-500`,label:`VPC`},subnet:{icon:l.Layers,color:`text-indigo-500`,label:`Subnet`},server:{icon:l.Server,color:`text-gray-500`,label:`Server`},database:{icon:l.Database,color:`text-green-500`,label:`Database`},loadbalancer:{icon:l.Activity,color:`text-cyan-500`,label:`Load Balancer`},cache:{icon:l.HardDrive,color:`text-red-500`,label:`Cache`},storage:{icon:l.HardDrive,color:`text-orange-500`,label:`Storage`},container:{icon:l.Container,color:`text-blue-400`,label:`Container`},function:{icon:l.Cpu,color:`text-yellow-500`,label:`Function`},cdn:{icon:l.Globe,color:`text-teal-500`,label:`CDN`},firewall:{icon:l.Shield,color:`text-red-400`,label:`Firewall`}},dz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},maintenance:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Maintenance`}},fz={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},custom:{label:`Custom`,color:`text-gray-500`}};function pz({resource:e,depth:r=0,onClick:i,isExpanded:a,onToggle:o}){let s=uz[e.type],c=dz[e.status],u=s.icon,d=e.children&&e.children.length>0;return(0,f.jsx)(`div`,{className:t.t(`border-l-2`,r>0&&`ml-6`,c.color.replace(`text-`,`border-`)),children:(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-3 cursor-pointer rounded-r-lg transition-all`,`hover:bg-muted/50`,e.status===`critical`&&`bg-red-500/5`,e.status===`warning`&&`bg-yellow-500/5`),onClick:i,children:[d&&(0,f.jsx)(`button`,{className:`p-1 hover:bg-muted rounded`,onClick:e=>{e.stopPropagation(),o?.()},children:(0,f.jsx)(l.Layers,{className:t.t(`h-4 w-4`,a&&`rotate-90`)})}),(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg bg-muted/50`),children:(0,f.jsx)(u,{className:t.t(`h-5 w-5`,s.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs shrink-0`,children:s.label}),e.provider&&(0,f.jsx)(n.x,{variant:`secondary`,className:t.t(`text-xs shrink-0`,fz[e.provider].color),children:fz[e.provider].label})]}),e.region&&(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.region})]}),e.metrics&&(0,f.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.metrics.cpu!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[`CPU: `,e.metrics.cpu,`%`]}),e.metrics.memory!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.memory>80&&`text-red-500`),children:[`MEM: `,e.metrics.memory,`%`]}),e.metrics.latency!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.latency>500&&`text-yellow-500`),children:[e.metrics.latency,`ms`]})]}),(0,f.jsx)(ti,{children:(0,f.jsxs)(ni,{children:[(0,f.jsx)(ri,{children:(0,f.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full shrink-0`,c.bgColor)})}),(0,f.jsx)(ii,{children:c.label})]})})]})})}function mz({resources:e,depth:n=0,expandedIds:r,onToggle:i,onResourceClick:a}){return(0,f.jsx)(`div`,{className:t.t(n>0&&`ml-4`),children:e.map(e=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsx)(pz,{resource:e,depth:n,onClick:()=>a?.(e),isExpanded:r.has(e.id),onToggle:()=>i(e.id)}),r.has(e.id)&&e.children&&(0,f.jsx)(mz,{resources:e.children,depth:n+1,expandedIds:r,onToggle:i,onResourceClick:a})]},e.id))})}function hz({resources:e,onResourceClick:n}){let r=e=>e.reduce((e,t)=>(e.push(t),t.children&&e.push(...r(t.children)),e),[]);return(0,f.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3`,children:r(e).map(e=>{let r=uz[e.type],i=dz[e.status],a=r.icon;return(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/50`),onClick:()=>n?.(e),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(a,{className:t.t(`h-5 w-5`,r.color)})}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.label})]}),e.metrics&&(0,f.jsx)(`div`,{className:`flex items-center gap-2 mt-2 text-xs`,children:e.metrics.cpu!==void 0&&(0,f.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[e.metrics.cpu,`%`]})})]})},e.id)})})}function gz({resources:e}){let t=s.useMemo(()=>{let t=0,n=0,r=0,i=0,a=e=>{e.forEach(e=>{t++,e.status===`healthy`&&n++,e.status===`warning`&&r++,e.status===`critical`&&i++,e.children&&a(e.children)})};return a(e),{total:t,healthy:n,warning:r,critical:i}},[e]);return(0,f.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Box,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`font-medium`,children:t.total}),(0,f.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Resources`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500`}),(0,f.jsx)(`span`,{className:`font-medium text-green-500`,children:t.healthy})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),(0,f.jsx)(`span`,{className:`font-medium text-yellow-500`,children:t.warning})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-red-500`}),(0,f.jsx)(`span`,{className:`font-medium text-red-500`,children:t.critical})]})]})}function _z({resources:e,onResourceClick:t,onRefresh:i,showConnections:a=!1,viewMode:o=`tree`,className:c}){let[u,d]=s.useState(o),[p,m]=s.useState(()=>new Set(e.map(e=>e.id))),[h,g]=s.useState(`all`),_=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=()=>{let t=new Set,n=e=>{e.forEach(e=>{t.add(e.id),e.children&&n(e.children)})};n(e),m(t)},y=()=>{m(new Set)},b=s.useMemo(()=>{if(h===`all`)return e;let t=e=>e.filter(e=>{let n=e.children?.some(e=>t([e]).length>0);return e.status===h||n}).map(e=>({...e,children:e.children?t(e.children):void 0}));return t(e)},[e,h]);return(0,f.jsxs)(Y,{className:c,children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Cloud,{className:`h-5 w-5`}),(0,f.jsx)(Z,{children:`Infrastructure Map`})]}),(0,f.jsx)(gz,{resources:e})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:u,onValueChange:e=>d(e),children:[(0,f.jsx)(n.y,{className:`w-28`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`tree`,children:`Tree View`}),(0,f.jsx)(n.m,{value:`grid`,children:`Grid View`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Filter,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{placeholder:`Status`})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`healthy`,children:`Healthy`}),(0,f.jsx)(n.m,{value:`warning`,children:`Warning`}),(0,f.jsx)(n.m,{value:`critical`,children:`Critical`}),(0,f.jsx)(n.m,{value:`maintenance`,children:`Maintenance`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u===`tree`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,f.jsx)(l.Maximize2,{className:`h-4 w-4 mr-1`}),`Expand`]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:y,children:`Collapse`})]}),i&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:i,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(`div`,{className:`min-h-[400px]`,children:b.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-64 text-muted-foreground`,children:[(0,f.jsx)(l.Cloud,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{children:`No resources found`})]}):u===`tree`?(0,f.jsx)(mz,{resources:b,expandedIds:p,onToggle:_,onResourceClick:t}):(0,f.jsx)(hz,{resources:b,onResourceClick:t})})]})]})}var vz=[{id:`region-us-east-1`,name:`us-east-1`,type:`region`,status:`healthy`,provider:`aws`,region:`N. Virginia`,children:[{id:`vpc-prod`,name:`production-vpc`,type:`vpc`,status:`healthy`,provider:`aws`,metadata:{cidr:`10.0.0.0/16`},children:[{id:`subnet-public-1`,name:`public-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.1.0/24`},children:[{id:`alb-1`,name:`api-load-balancer`,type:`loadbalancer`,status:`healthy`,metrics:{requests:15e3,latency:45}},{id:`nat-1`,name:`nat-gateway-1a`,type:`firewall`,status:`healthy`}]},{id:`subnet-private-1`,name:`private-subnet-1a`,type:`subnet`,status:`warning`,metadata:{az:`us-east-1a`,cidr:`10.0.10.0/24`},children:[{id:`ec2-api-1`,name:`api-server-1`,type:`server`,status:`healthy`,metrics:{cpu:45,memory:62}},{id:`ec2-api-2`,name:`api-server-2`,type:`server`,status:`warning`,metrics:{cpu:85,memory:78}},{id:`ec2-api-3`,name:`api-server-3`,type:`server`,status:`healthy`,metrics:{cpu:52,memory:55}}]},{id:`subnet-data-1`,name:`data-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.20.0/24`},children:[{id:`rds-primary`,name:`postgres-primary`,type:`database`,status:`healthy`,metrics:{cpu:35,memory:68}},{id:`redis-1`,name:`redis-cluster`,type:`cache`,status:`healthy`,metrics:{memory:45}}]}]}]},{id:`region-eu-west-1`,name:`eu-west-1`,type:`region`,status:`critical`,provider:`aws`,region:`Ireland`,children:[{id:`vpc-prod-eu`,name:`production-vpc-eu`,type:`vpc`,status:`critical`,children:[{id:`ec2-eu-1`,name:`api-server-eu-1`,type:`server`,status:`critical`,metrics:{cpu:98,memory:95}},{id:`rds-eu`,name:`postgres-replica`,type:`database`,status:`warning`,metrics:{cpu:75,memory:82}}]}]}],yz={build:{icon:l.Box,color:`text-blue-500`,label:`Build`},test:{icon:l.TestTube,color:`text-purple-500`,label:`Test`},deploy:{icon:l.Rocket,color:`text-green-500`,label:`Deploy`},script:{icon:l.Terminal,color:`text-gray-500`,label:`Script`},docker:{icon:l.Container,color:`text-cyan-500`,label:`Docker`},notify:{icon:l.Bell,color:`text-yellow-500`,label:`Notify`},approval:{icon:l.Shield,color:`text-orange-500`,label:`Approval`},artifact:{icon:l.Upload,color:`text-indigo-500`,label:`Artifact`},cache:{icon:l.Database,color:`text-pink-500`,label:`Cache`},parallel:{icon:l.Zap,color:`text-amber-500`,label:`Parallel`}},bz={pending:{color:`text-muted-foreground`,bgColor:`bg-muted`,icon:l.Clock},running:{color:`text-blue-500`,bgColor:`bg-blue-500`,icon:l.Play},success:{color:`text-green-500`,bgColor:`bg-green-500`,icon:l.CheckCircle2},failed:{color:`text-red-500`,bgColor:`bg-red-500`,icon:l.XCircle},skipped:{color:`text-gray-400`,bgColor:`bg-gray-400`,icon:l.ChevronRight},waiting:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,icon:l.Clock}};function xz({step:e,onUpdate:i,onDelete:a,readOnly:o}){let[c,u]=s.useState(!1),d=yz[e.type],p=d.icon,m=e.status?bz[e.status]:null,h=m?.icon;return(0,f.jsxs)(`div`,{className:t.t(`border rounded-lg transition-all`,e.status===`failed`&&`border-red-500/50`,e.status===`running`&&`border-blue-500/50 bg-blue-500/5`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-3 cursor-pointer`,onClick:()=>u(!c),children:[!o&&(0,f.jsx)(l.GripVertical,{className:`h-4 w-4 text-muted-foreground cursor-grab`}),(0,f.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${d.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(p,{className:t.t(`h-4 w-4`,d.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:d.label})]}),e.command&&(0,f.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono truncate block mt-0.5`,children:e.command})]}),h&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs`,m?.color),children:[(0,f.jsx)(h,{className:`h-3 w-3 mr-1`}),e.status]}),!o&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{onClick:()=>u(!0),children:[(0,f.jsx)(l.Settings,{className:`h-4 w-4 mr-2`}),`Configure`]}),(0,f.jsxs)($,{children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:a,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsx)(l.ChevronRight,{className:t.t(`h-4 w-4 transition-transform`,c&&`rotate-90`)})]}),c&&(0,f.jsxs)(`div`,{className:`px-3 pb-3 pt-0 space-y-3 border-t mt-2`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Step Name`}),(0,f.jsx)(r.n,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 mt-1`,disabled:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Type`}),(0,f.jsxs)(n.d,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:o,children:[(0,f.jsx)(n.y,{className:`h-8 mt-1`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(yz).map(([e,r])=>(0,f.jsx)(n.m,{value:e,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.icon,{className:t.t(`h-4 w-4`,r.color)}),r.label]})},e))})]})]})]}),(e.type===`script`||e.type===`build`||e.type===`test`)&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,f.jsx)(r.n,{value:e.command||``,onChange:t=>i({...e,command:t.target.value}),placeholder:`npm run build`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]}),e.type===`docker`&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Docker Image`}),(0,f.jsx)(r.n,{value:e.image||``,onChange:t=>i({...e,image:t.target.value}),placeholder:`node:18-alpine`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Timeout (seconds)`}),(0,f.jsx)(r.n,{type:`number`,value:e.timeout||``,onChange:t=>i({...e,timeout:parseInt(t.target.value)||void 0}),placeholder:`300`,className:`h-8 mt-1`,disabled:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Retries`}),(0,f.jsx)(r.n,{type:`number`,value:e.retries||``,onChange:t=>i({...e,retries:parseInt(t.target.value)||void 0}),placeholder:`0`,className:`h-8 mt-1`,disabled:o})]})]}),e.condition!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Condition`}),(0,f.jsx)(r.n,{value:e.condition,onChange:t=>i({...e,condition:t.target.value}),placeholder:`$CI_COMMIT_BRANCH == 'main'`,className:`h-8 mt-1 font-mono text-sm`,disabled:o})]})]})]})}function Sz({stage:e,onUpdate:i,onDelete:a,onAddStep:o,readOnly:c}){let[u,d]=s.useState(!1),p=e.status?bz[e.status]:null,m=p?.icon,h=(t,n)=>{i({...e,steps:e.steps.map(e=>e.id===t?n:e)})},g=t=>{i({...e,steps:e.steps.filter(e=>e.id!==t)})};return(0,f.jsxs)(Y,{className:t.t(e.status===`failed`&&`border-red-500/30`,e.status===`running`&&`border-blue-500/30`),children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`button`,{onClick:()=>d(!u),children:(0,f.jsx)(l.ChevronDown,{className:t.t(`h-4 w-4 transition-transform`,u&&`-rotate-90`)})}),(0,f.jsx)(r.n,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:c}),m&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`text-xs ml-auto`,p?.color),children:[(0,f.jsx)(m,{className:`h-3 w-3 mr-1`}),e.status]}),(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.steps.length,` steps`]}),!c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[(0,f.jsxs)($,{children:[(0,f.jsx)(l.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate Stage`]}),(0,f.jsx)(ln,{}),(0,f.jsxs)($,{className:`text-destructive`,onClick:a,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete Stage`]})]})]})]})}),!u&&(0,f.jsxs)(Q,{className:`space-y-2`,children:[e.steps.map(e=>(0,f.jsx)(xz,{step:e,onUpdate:t=>h(e.id,t),onDelete:()=>g(e.id),readOnly:c},e.id)),!c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Step`]})}),(0,f.jsx)(an,{className:`w-48`,children:Object.entries(yz).map(([e,n])=>(0,f.jsxs)($,{onClick:()=>o(e),children:[(0,f.jsx)(n.icon,{className:t.t(`h-4 w-4 mr-2`,n.color)}),n.label]},e))})]})]})]})}function Cz({pipeline:e,onPipelineChange:i,onRun:a,onSave:o,onExport:c,readOnly:u=!1,className:d}){let[p,m]=s.useState(e),h=e=>{let t={...p,...e};m(t),i?.(t)},g=()=>{let e={id:`stage-${Date.now()}`,name:`Stage ${p.stages.length+1}`,steps:[]};h({stages:[...p.stages,e]})},_=(e,t)=>{h({stages:p.stages.map(n=>n.id===e?t:n)})},v=e=>{h({stages:p.stages.filter(t=>t.id!==e)})},y=(e,t)=>{let n=p.stages.find(t=>t.id===e);if(!n)return;let r={id:`step-${Date.now()}`,name:`${yz[t].label} Step`,type:t};_(e,{...n,steps:[...n.steps,r]})};return(0,f.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,d),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.GitBranch,{className:`h-5 w-5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(r.n,{value:p.name,onChange:e=>h({name:e.target.value}),className:`h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:u}),p.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:p.description})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})}),(0,f.jsxs)(an,{children:[(0,f.jsx)($,{onClick:()=>c(`yaml`),children:`Export as YAML`}),(0,f.jsx)($,{onClick:()=>c(`json`),children:`Export as JSON`})]})]}),o&&!u&&(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:`Save`}),a&&(0,f.jsxs)(r.r,{size:`sm`,onClick:a,children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Run Pipeline`]})]})]})}),p.trigger&&(0,f.jsx)(Q,{className:`pt-0`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Triggers:`}),p.trigger.events?.map(e=>(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e},e)),p.trigger.branches?.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[(0,f.jsx)(l.GitBranch,{className:`h-3 w-3 mr-1`}),e]},e)),p.trigger.schedule&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3 mr-1`}),p.trigger.schedule]})]})})]}),(0,f.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto pb-2`,children:p.stages.map((e,n)=>(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`w-4 h-4 rounded-full border-2`,e.status===`success`&&`bg-green-500 border-green-500`,e.status===`failed`&&`bg-red-500 border-red-500`,e.status===`running`&&`bg-blue-500 border-blue-500 animate-pulse`,!e.status&&`bg-muted border-muted-foreground`)}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e.name})]}),n<p.stages.length-1&&(0,f.jsx)(l.ArrowRight,{className:`h-4 w-4 text-muted-foreground shrink-0`})]},e.id))}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsxs)(`div`,{className:`space-y-4 pr-4`,children:[p.stages.map(e=>(0,f.jsx)(Sz,{stage:e,onUpdate:t=>_(e.id,t),onDelete:()=>v(e.id),onAddStep:t=>y(e.id,t),readOnly:u},e.id)),!u&&(0,f.jsxs)(r.r,{variant:`outline`,className:`w-full`,onClick:g,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Stage`]})]})})]})}var wz={id:`1`,name:`Production Deploy`,description:`Build, test, and deploy to production`,trigger:{branches:[`main`,`release/*`],events:[`push`,`pull_request`]},stages:[{id:`build`,name:`Build`,status:`success`,steps:[{id:`install`,name:`Install Dependencies`,type:`script`,command:`npm ci`,status:`success`},{id:`build`,name:`Build Application`,type:`build`,command:`npm run build`,status:`success`},{id:`artifact`,name:`Upload Build Artifacts`,type:`artifact`,artifacts:[`dist/**`,`build/**`],status:`success`}]},{id:`test`,name:`Test`,status:`running`,steps:[{id:`unit`,name:`Unit Tests`,type:`test`,command:`npm run test:unit`,status:`success`},{id:`integration`,name:`Integration Tests`,type:`test`,command:`npm run test:integration`,status:`running`},{id:`e2e`,name:`E2E Tests`,type:`test`,command:`npm run test:e2e`,status:`pending`}]},{id:`security`,name:`Security`,status:`pending`,steps:[{id:`sast`,name:`SAST Scan`,type:`script`,command:`npm run security:sast`},{id:`deps`,name:`Dependency Check`,type:`script`,command:`npm audit`}]},{id:`deploy`,name:`Deploy`,status:`pending`,steps:[{id:`approval`,name:`Production Approval`,type:`approval`,condition:`$CI_COMMIT_BRANCH == 'main'`},{id:`docker`,name:`Build Docker Image`,type:`docker`,image:`app:$CI_COMMIT_SHA`},{id:`deploy-prod`,name:`Deploy to Production`,type:`deploy`,command:`kubectl apply -f k8s/`},{id:`notify`,name:`Notify Team`,type:`notify`}]}],variables:{NODE_ENV:`production`,REGISTRY:`gcr.io/my-project`}},Tz={feature:{icon:l.Sparkles,color:`text-green-500`,bgColor:`bg-green-500/10`,label:`New Feature`},fix:{icon:l.Bug,color:`text-red-500`,bgColor:`bg-red-500/10`,label:`Bug Fix`},improvement:{icon:l.Wrench,color:`text-blue-500`,bgColor:`bg-blue-500/10`,label:`Improvement`},breaking:{icon:l.AlertTriangle,color:`text-orange-500`,bgColor:`bg-orange-500/10`,label:`Breaking Change`},security:{icon:l.ShieldCheck,color:`text-purple-500`,bgColor:`bg-purple-500/10`,label:`Security`},performance:{icon:l.Zap,color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,label:`Performance`},docs:{icon:l.BookOpen,color:`text-cyan-500`,bgColor:`bg-cyan-500/10`,label:`Documentation`},deprecation:{icon:l.AlertTriangle,color:`text-gray-500`,bgColor:`bg-gray-500/10`,label:`Deprecation`}},Ez={major:{label:`Major`,color:`text-red-500`},minor:{label:`Minor`,color:`text-blue-500`},patch:{label:`Patch`,color:`text-green-500`},prerelease:{label:`Pre-release`,color:`text-purple-500`}};function Dz(e){return e.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`})}function Oz({change:e}){let r=Tz[e.type],i=r.icon;return(0,f.jsxs)(`div`,{className:t.t(`flex items-start gap-3 p-3 rounded-lg`,r.bgColor),children:[(0,f.jsx)(`div`,{className:`p-1.5 rounded bg-background`,children:(0,f.jsx)(i,{className:t.t(`h-4 w-4`,r.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.title}),e.breaking&&(0,f.jsx)(n.x,{className:`bg-orange-500 text-xs`,children:`Breaking`}),e.pullRequest&&(0,f.jsxs)(`a`,{href:e.pullRequest.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-primary flex items-center gap-1`,children:[(0,f.jsx)(l.GitPullRequest,{className:`h-3 w-3`}),`#`,e.pullRequest.number]})]}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.contributors&&e.contributors.length>0&&(0,f.jsx)(`div`,{className:`flex items-center gap-1 mt-2`,children:e.contributors.map(e=>(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id))})]})]})}function kz({release:e,onEdit:i,onPublish:a,expanded:o=!1}){let[c,u]=s.useState(o),d=Ez[e.releaseType],p=s.useMemo(()=>{let t={breaking:[],security:[],feature:[],improvement:[],performance:[],fix:[],docs:[],deprecation:[]};return e.changes.forEach(e=>{t[e.type].push(e)}),t},[e.changes]);return(0,f.jsxs)(Y,{className:t.t(e.status===`draft`&&`border-dashed`,e.status===`scheduled`&&`border-blue-500/30`),children:[(0,f.jsx)(X,{className:`pb-3`,children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Tag,{className:`h-5 w-5`}),(0,f.jsx)(Z,{className:`text-xl`,children:e.version}),e.name&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`- `,e.name]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(n.x,{variant:`outline`,className:d.color,children:d.label}),(0,f.jsxs)(n.x,{variant:e.status===`published`?`default`:`secondary`,className:e.status===`published`?`bg-green-500`:``,children:[e.status===`published`?(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 mr-1`}):e.status===`scheduled`?(0,f.jsx)(l.Clock,{className:`h-3 w-3 mr-1`}):(0,f.jsx)(l.Edit,{className:`h-3 w-3 mr-1`}),e.status]}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Calendar,{className:`h-3 w-3`}),e.publishedAt?Dz(e.publishedAt):Dz(e.createdAt)]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.compareUrl&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,f.jsxs)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noopener noreferrer`,children:[(0,f.jsx)(l.GitCommit,{className:`h-4 w-4 mr-1`}),`Compare`]})}),i&&e.status===`draft`&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.Edit,{className:`h-4 w-4 mr-1`}),`Edit`]}),a&&e.status===`draft`&&(0,f.jsxs)(r.r,{size:`sm`,onClick:a,children:[(0,f.jsx)(l.Rocket,{className:`h-4 w-4 mr-1`}),`Publish`]})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[e.summary&&(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:e.summary}),e.upgradeNotes&&(0,f.jsxs)(`div`,{className:`p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-yellow-600 mb-1`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Upgrade Notes`]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.upgradeNotes})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:Object.entries(p).map(([e,n])=>{if(n.length===0)return null;let i=Tz[e];return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,f.jsx)(i.icon,{className:t.t(`h-4 w-4`,i.color)}),i.label,`s (`,n.length,`)`]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(c?n:n.slice(0,3)).map(e=>(0,f.jsx)(Oz,{change:e},e.id)),!c&&n.length>3&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>u(!0),children:[`Show `,n.length-3,` more...`]})]})]},e)})}),e.contributors.length>0&&(0,f.jsxs)(`div`,{className:`pt-4 border-t`,children:[(0,f.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Contributors (`,e.contributors.length,`)`]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.contributors.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 bg-muted rounded-full`,children:[(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`@`,e.username]})]},e.id))})]}),e.downloadUrl&&(0,f.jsx)(`div`,{className:`pt-4 border-t`,children:(0,f.jsx)(r.r,{variant:`outline`,asChild:!0,children:(0,f.jsxs)(`a`,{href:e.downloadUrl,download:!0,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Download Release`]})})})]})]})}function Az({releases:e,onCreateRelease:i,onEditRelease:a,onPublishRelease:o,onAddChange:c,showEditor:u=!1,className:d}){let[p,m]=s.useState(`all`),[h,g]=s.useState(`all`),_=s.useMemo(()=>e.filter(e=>!(p!==`all`&&e.releaseType!==p||h!==`all`&&e.status!==h)).sort((e,t)=>{let n=e=>e.replace(/^v/,``).split(/[.-]/).map(e=>parseInt(e)||0),r=n(e.version),i=n(t.version);for(let e=0;e<Math.max(r.length,i.length);e++){let t=(i[e]||0)-(r[e]||0);if(t!==0)return t}return 0}),[e,p,h]),v=s.useMemo(()=>({total:e.length,published:e.filter(e=>e.status===`published`).length,draft:e.filter(e=>e.status===`draft`).length,features:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`feature`).length,0),fixes:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`fix`).length,0)}),[e]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,d),children:[(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Rocket,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Release Notes`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Track changes and publish releases`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-6 text-sm`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Tag,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`strong`,{children:v.total}),` releases`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Sparkles,{className:`h-4 w-4 text-green-500`}),(0,f.jsx)(`strong`,{children:v.features}),` features`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Bug,{className:`h-4 w-4 text-red-500`}),(0,f.jsx)(`strong`,{children:v.fixes}),` fixes`]})]}),i&&(0,f.jsxs)(r.r,{onClick:i,children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`New Release`]})]})]})}),(0,f.jsx)(Q,{className:`pt-0`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(n.d,{value:p,onValueChange:e=>m(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Type`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Types`}),(0,f.jsx)(n.m,{value:`major`,children:`Major`}),(0,f.jsx)(n.m,{value:`minor`,children:`Minor`}),(0,f.jsx)(n.m,{value:`patch`,children:`Patch`}),(0,f.jsx)(n.m,{value:`prerelease`,children:`Pre-release`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>g(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`published`,children:`Published`}),(0,f.jsx)(n.m,{value:`draft`,children:`Draft`}),(0,f.jsx)(n.m,{value:`scheduled`,children:`Scheduled`})]})]})]})})]}),(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:_.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Tag,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No releases found`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`Create your first release to get started`})]}):_.map((e,t)=>(0,f.jsx)(kz,{release:e,expanded:t===0,onEdit:a?()=>a(e):void 0,onPublish:o?()=>o(e):void 0},e.id))})})]})}var jz=[{id:`1`,name:`John Doe`,username:`johndoe`,avatar:``},{id:`2`,name:`Jane Smith`,username:`janesmith`,avatar:``},{id:`3`,name:`Bob Wilson`,username:`bobwilson`,avatar:``}],Mz=[{id:`1`,version:`v2.5.0`,name:`Aurora`,releaseType:`minor`,status:`published`,publishedAt:new Date(Date.now()-48*36e5),createdAt:new Date(Date.now()-120*36e5),summary:`This release introduces new authentication features, performance improvements, and several bug fixes.`,contributors:jz,compareUrl:`https://github.com/example/repo/compare/v2.4.0...v2.5.0`,changes:[{id:`c1`,type:`feature`,title:`Added OAuth 2.0 support for GitHub and Google`,description:`Users can now sign in using their GitHub or Google accounts`,pullRequest:{number:234,url:`#`},contributors:[jz[0]]},{id:`c2`,type:`feature`,title:`New dashboard widgets for analytics`,pullRequest:{number:238,url:`#`},contributors:[jz[1]]},{id:`c3`,type:`improvement`,title:`Redesigned settings page with better UX`,pullRequest:{number:241,url:`#`}},{id:`c4`,type:`performance`,title:`Reduced initial bundle size by 30%`,description:`Implemented code splitting and lazy loading for major routes`,pullRequest:{number:245,url:`#`},contributors:[jz[2]]},{id:`c5`,type:`fix`,title:`Fixed memory leak in WebSocket connection`,pullRequest:{number:250,url:`#`}},{id:`c6`,type:`fix`,title:`Fixed date picker not respecting timezone`,pullRequest:{number:252,url:`#`}},{id:`c7`,type:`security`,title:`Updated dependencies with security vulnerabilities`,description:`Updated axios, lodash, and other packages with known CVEs`,pullRequest:{number:248,url:`#`}}]},{id:`2`,version:`v2.4.1`,releaseType:`patch`,status:`published`,publishedAt:new Date(Date.now()-336*36e5),createdAt:new Date(Date.now()-360*36e5),contributors:[jz[0]],changes:[{id:`c8`,type:`fix`,title:`Fixed critical authentication bypass vulnerability`,breaking:!1,pullRequest:{number:230,url:`#`}},{id:`c9`,type:`fix`,title:`Fixed incorrect pagination in search results`,pullRequest:{number:231,url:`#`}}]},{id:`3`,version:`v3.0.0-beta.1`,name:`Next Generation`,releaseType:`prerelease`,status:`draft`,createdAt:new Date(Date.now()-24*36e5),contributors:jz,upgradeNotes:`This is a major release with breaking changes. Please review the migration guide before upgrading.`,changes:[{id:`c10`,type:`breaking`,title:`Removed deprecated API endpoints`,description:`The v1 API endpoints have been removed. Please migrate to v2 endpoints.`,breaking:!0},{id:`c11`,type:`feature`,title:`New real-time collaboration features`,description:`Multiple users can now edit documents simultaneously with live cursors`},{id:`c12`,type:`feature`,title:`Dark mode support throughout the application`},{id:`c13`,type:`breaking`,title:`Changed authentication token format`,description:`Tokens now use JWT format. Old tokens will be invalidated.`,breaking:!0}]}],Nz={1:{label:`Primary`,color:`text-green-500`,bgColor:`bg-green-500`},2:{label:`Secondary`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},3:{label:`Tertiary`,color:`text-red-500`,bgColor:`bg-red-500`}},Pz={available:{color:`bg-green-500`,label:`Available`},busy:{color:`bg-yellow-500`,label:`Busy`},dnd:{color:`bg-red-500`,label:`Do Not Disturb`},offline:{color:`bg-gray-500`,label:`Offline`}};function Fz(e){let t=new Date;return e.startTime<=t&&e.endTime>t}function Iz({shift:e,nextShift:i,onContact:a}){if(!e)return(0,f.jsx)(Y,{className:`border-dashed`,children:(0,f.jsxs)(Q,{className:`p-6 text-center text-muted-foreground`,children:[(0,f.jsx)(l.AlertCircle,{className:`h-8 w-8 mx-auto mb-2`}),(0,f.jsx)(`p`,{children:`No one is currently on call`})]})});let o=Nz[e.level],s=e.user.status?Pz[e.user.status]:null,c=e.endTime.getTime()-Date.now(),u=Math.floor(c/36e5),d=Math.floor(c%36e5/6e4);return(0,f.jsxs)(Y,{className:`border-green-500/30 bg-green-500/5`,children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(n.x,{className:t.t(`text-white`,o.bgColor),children:[o.label,` On-Call`]}),(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4`}),u,`h `,d,`m remaining`]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-16 w-16`,children:[(0,f.jsx)(ye,{src:e.user.avatar}),(0,f.jsx)(be,{className:`text-xl`,children:e.user.name.slice(0,2).toUpperCase()})]}),s&&(0,f.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 w-4 h-4 rounded-full border-2 border-background`,s.color)})]}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`text-xl font-semibold`,children:e.user.name}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.user.email}),e.user.timezone&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Timezone: `,e.user.timezone]})]}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.user.phone&&(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>a?.(e.user),children:[(0,f.jsx)(l.Phone,{className:`h-4 w-4 mr-1`}),`Call`]}),(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>a?.(e.user),children:[(0,f.jsx)(l.MessageSquare,{className:`h-4 w-4 mr-1`}),`Message`]})]})]}),e.overrideReason&&(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground bg-muted/50 p-2 rounded`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Override:`}),` `,e.overrideReason]}),i&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 border-t text-sm`,children:[(0,f.jsx)(l.ArrowRight,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Next:`}),(0,f.jsxs)(ve,{className:`h-5 w-5`,children:[(0,f.jsx)(ye,{src:i.user.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:i.user.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{children:i.user.name}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`at `,i.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})]})]})]})]})}function Lz({policy:e,currentLevel:r}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),`Escalation Policy`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(i=>{let a=Nz[i],o=i===1?e.level1Timeout:i===2?e.level2Timeout:e.level3Timeout,s=r===i;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,s&&`${a.bgColor}/10 border ${a.bgColor}/30`),children:[(0,f.jsx)(`div`,{className:t.t(`w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold`,a.bgColor),children:i}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:a.label}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Escalates after `,o,` minutes`]})]}),s&&(0,f.jsx)(n.x,{variant:`outline`,className:a.color,children:`Active`})]},i)})})})]})}function Rz({shifts:e,weekStart:n,onShiftClick:r}){let i=s.useMemo(()=>{let e=[];for(let t=0;t<7;t++){let r=new Date(n);r.setDate(r.getDate()+t),e.push(r)}return e},[n]),a=t=>e.filter(e=>new Date(e.startTime).toDateString()===t.toDateString()),o=e=>e.toDateString()===new Date().toDateString();return(0,f.jsx)(`div`,{className:`grid grid-cols-7 gap-2`,children:i.map(e=>{let n=a(e),i=o(e);return(0,f.jsxs)(`div`,{className:t.t(`border rounded-lg p-2 min-h-[120px]`,i&&`border-primary bg-primary/5`),children:[(0,f.jsxs)(`div`,{className:t.t(`text-center mb-2`,i&&`font-bold text-primary`),children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.toLocaleDateString(`en-US`,{weekday:`short`})}),(0,f.jsx)(`div`,{className:t.t(`text-lg`,i&&`text-primary`),children:e.getDate()})]}),(0,f.jsx)(`div`,{className:`space-y-1`,children:n.map(e=>{let n=Nz[e.level],i=Fz(e);return(0,f.jsxs)(`button`,{className:t.t(`w-full text-left p-1.5 rounded text-xs transition-colors`,`${n.bgColor}/10 hover:${n.bgColor}/20`,i&&`ring-2 ring-${n.bgColor}`),onClick:()=>r?.(e),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsxs)(ve,{className:`h-4 w-4`,children:[(0,f.jsx)(ye,{src:e.user.avatar}),(0,f.jsx)(be,{className:`text-[8px]`,children:e.user.name.slice(0,2).toUpperCase()})]}),(0,f.jsx)(`span`,{className:`truncate`,children:e.user.name.split(` `)[0]})]}),(0,f.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:e.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})})]},e.id)})})]},e.toISOString())})})}function zz({users:e,shifts:r}){let i=s.useMemo(()=>e.map(e=>{let t=r.filter(t=>t.user.id===e.id),n=t.reduce((e,t)=>e+(t.endTime.getTime()-t.startTime.getTime())/36e5,0),i=t.some(Fz);return{user:e,totalHours:n,shiftCount:t.length,isOnCall:i}}),[e,r]);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Team Members`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-2`,children:i.map(({user:e,totalHours:r,shiftCount:i,isOnCall:a})=>{let o=e.status?Pz[e.status]:null;return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,a&&`bg-green-500/10 border border-green-500/30`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(ve,{className:`h-8 w-8`,children:[(0,f.jsx)(ye,{src:e.avatar}),(0,f.jsx)(be,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),o&&(0,f.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-background`,o.color)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`font-medium truncate flex items-center gap-2`,children:[e.name,a&&(0,f.jsx)(n.x,{className:`bg-green-500 text-xs`,children:`On-Call`})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[i,` shifts • `,Math.round(r),`h total`]})]})]},e.id)})})})]})}function Bz({schedule:e,onEditSchedule:i,onAddOverride:a,onSwapShift:o,onContactOnCall:c,className:u}){let[d,p]=s.useState(0),m=s.useMemo(()=>{let e=new Date,t=e.getDay(),n=new Date(e);return n.setDate(e.getDate()-t+d*7),n.setHours(0,0,0,0),n},[d]),h=e.shifts.find(Fz),g=e.shifts.filter(e=>e.startTime>new Date).sort((e,t)=>e.startTime.getTime()-t.startTime.getTime())[0];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Phone,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:e.name}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsx)(n.x,{variant:`outline`,children:e.team}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[(0,f.jsx)(l.Repeat,{className:`h-3 w-3 mr-1`}),e.rotation]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>a(new Date),children:[(0,f.jsx)(l.Plus,{className:`h-4 w-4 mr-1`}),`Add Override`]}),i&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:i,children:[(0,f.jsx)(l.Settings,{className:`h-4 w-4 mr-1`}),`Settings`]})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,f.jsx)(Iz,{shift:h,nextShift:g,onContact:c}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4`}),`Schedule`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(e=>e-1),children:(0,f.jsx)(l.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsxs)(`span`,{className:`text-sm min-w-[120px] text-center`,children:[m.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}),` -`,new Date(m.getTime()+144*36e5).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(e=>e+1),children:(0,f.jsx)(l.ChevronRight,{className:`h-4 w-4`})}),d!==0&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>p(0),children:`Today`})]})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(Rz,{shifts:e.shifts,weekStart:m,onShiftClick:o})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(Lz,{policy:e.escalationPolicy,currentLevel:h?.level}),(0,f.jsx)(zz,{users:e.users,shifts:e.shifts})]})]})]})}var Vz=[{id:`1`,name:`John Doe`,email:`john@example.com`,phone:`+1 555-0101`,status:`available`,timezone:`America/New_York`},{id:`2`,name:`Jane Smith`,email:`jane@example.com`,phone:`+1 555-0102`,status:`available`,timezone:`America/Los_Angeles`},{id:`3`,name:`Bob Wilson`,email:`bob@example.com`,phone:`+1 555-0103`,status:`busy`,timezone:`Europe/London`},{id:`4`,name:`Alice Brown`,email:`alice@example.com`,phone:`+1 555-0104`,status:`available`,timezone:`Europe/Paris`}];function Hz(){let e=[],t=new Date,n=new Date(t);n.setDate(t.getDate()-t.getDay()),n.setHours(0,0,0,0);for(let t=-1;t<3;t++)for(let r=0;r<7;r++){let i=new Date(n);i.setDate(n.getDate()+t*7+r),i.setHours(9,0,0,0);let a=new Date(i);a.setDate(a.getDate()+1);let o=(t+1+r)%Vz.length;e.push({id:`shift-${t}-${r}`,user:Vz[o],startTime:i,endTime:a,level:1})}return e}var Uz={id:`1`,name:`Platform Team On-Call`,description:`Primary on-call rotation for the platform engineering team`,team:`Platform Engineering`,rotation:`weekly`,escalationPolicy:{level1Timeout:15,level2Timeout:30,level3Timeout:60},shifts:Hz(),users:Vz},Wz={compute:{icon:l.Cpu,color:`text-blue-500`,label:`Compute`},storage:{icon:l.HardDrive,color:`text-green-500`,label:`Storage`},database:{icon:l.Database,color:`text-purple-500`,label:`Database`},network:{icon:l.Network,color:`text-cyan-500`,label:`Network`},security:{icon:l.Shield,color:`text-red-500`,label:`Security`},other:{icon:l.Cloud,color:`text-gray-500`,label:`Other`}},Gz={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},all:{label:`All Providers`,color:`text-gray-500`}};function Kz(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function qz(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function Jz({title:e,value:r,previousValue:i,icon:a,trend:o,budget:s,forecast:c}){let u=i===void 0?o:(r-i)/i*100,d=s!==void 0&&r>s,p=s===void 0?void 0:r/s*100;return(0,f.jsx)(Y,{className:t.t(d&&`border-red-500/50`),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-muted-foreground`})}),u!==void 0&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(u>0?`text-red-500`:`text-green-500`),children:[u>0?(0,f.jsx)(l.ArrowUpRight,{className:`h-3 w-3 mr-1`}):(0,f.jsx)(l.ArrowDownRight,{className:`h-3 w-3 mr-1`}),qz(Math.abs(u))]})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:Kz(r)}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e})]}),p!==void 0&&(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Budget`}),(0,f.jsxs)(`span`,{className:t.t(d&&`text-red-500`),children:[Kz(r),` / `,Kz(s)]})]}),(0,f.jsx)(Zn,{value:Math.min(p,100),className:t.t(`h-2`,p>100&&`[&>div]:bg-red-500`,p>80&&p<=100&&`[&>div]:bg-yellow-500`)})]}),c!==void 0&&(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Forecast: `,Kz(c)]})]})})}function Yz({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.PieChart,{className:`h-4 w-4`}),`Cost by Category`]})}),(0,f.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=Wz[e],a=i.icon,o=r/n*100;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(a,{className:t.t(`h-4 w-4`,i.color)}),(0,f.jsx)(`span`,{className:`text-sm`,children:i.label})]}),(0,f.jsxs)(`div`,{className:`text-sm font-medium`,children:[Kz(r),(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,o.toFixed(0),`%)`]})]})]}),(0,f.jsx)(Zn,{value:o,className:`h-2`})]},e)})})]})}function Xz({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).filter(([e])=>e!==`all`).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Cloud,{className:`h-4 w-4`}),`Cost by Provider`]})}),(0,f.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=Gz[e],a=r/n*100;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,f.jsx)(`span`,{className:t.t(`text-sm font-medium`,i.color),children:i.label}),(0,f.jsxs)(`div`,{className:`text-sm font-medium`,children:[Kz(r),(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,a.toFixed(0),`%)`]})]})]}),(0,f.jsx)(Zn,{value:a,className:`h-2`})]},e)})})]})}function Zz({items:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.BarChart3,{className:`h-4 w-4`}),`Top Services by Cost`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>{let r=Wz[e.category],i=r.icon,a=Gz[e.provider],o=e.previousCost===void 0?e.trend:(e.cost-e.previousCost)/e.previousCost*100;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors`,children:[(0,f.jsx)(`div`,{className:`text-lg font-bold text-muted-foreground w-6 text-center`,children:n+1}),(0,f.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(i,{className:t.t(`h-4 w-4`,r.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:a.color,children:a.label}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{children:r.label}),e.usage!==void 0&&e.unit&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{children:`•`}),(0,f.jsxs)(`span`,{children:[e.usage,` `,e.unit]})]})]})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:`font-semibold`,children:Kz(e.cost)}),o!==void 0&&(0,f.jsxs)(`div`,{className:t.t(`text-xs flex items-center justify-end gap-0.5`,o>0?`text-red-500`:`text-green-500`),children:[o>0?(0,f.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,f.jsx)(l.TrendingDown,{className:`h-3 w-3`}),qz(Math.abs(o))]})]})]},e.id)})})})})]})}function Qz({anomalies:e,onAcknowledge:r}){let i=e.filter(e=>e.status===`new`);return(0,f.jsxs)(Y,{className:t.t(i.length>0&&`border-yellow-500/50`),children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Cost Anomalies`]}),i.length>0&&(0,f.jsxs)(n.x,{className:`bg-yellow-500`,children:[i.length,` new`]})]})}),(0,f.jsx)(Q,{children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center text-muted-foreground py-4`,children:[(0,f.jsx)(l.Zap,{className:`h-8 w-8 mx-auto mb-2 text-green-500`}),(0,f.jsx)(`p`,{children:`No anomalies detected`})]}):(0,f.jsx)(`div`,{className:`space-y-2`,children:e.slice(0,5).map(e=>(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg`,e.status===`new`&&`bg-yellow-500/10`),children:[(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-4 w-4 shrink-0`,e.deviation>100?`text-red-500`:`text-yellow-500`)}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium truncate`,children:e.service}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expected `,Kz(e.expectedCost),` • Actual `,Kz(e.actualCost)]})]}),(0,f.jsxs)(n.x,{variant:`outline`,className:`text-red-500 shrink-0`,children:[`+`,e.deviation.toFixed(0),`%`]})]},e.id))})})]})}function $z({summary:e,items:i,anomalies:a=[],timeRange:o=`month`,onTimeRangeChange:c,onProviderFilter:u,onExport:d,onRefresh:p,className:m}){let[h,g]=s.useState(`all`),_=e=>{g(e),u?.(e)},v=s.useMemo(()=>h===`all`?i:i.filter(e=>e.provider===h),[i,h]);return e.previousTotalCost!==void 0&&(e.totalCost-e.previousTotalCost)/e.previousTotalCost*100,(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.DollarSign,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Cloud Cost Dashboard`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor and optimize your cloud spending`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:o,onValueChange:e=>c?.(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`day`,children:`Today`}),(0,f.jsx)(n.m,{value:`week`,children:`This Week`}),(0,f.jsx)(n.m,{value:`month`,children:`This Month`}),(0,f.jsx)(n.m,{value:`quarter`,children:`This Quarter`}),(0,f.jsx)(n.m,{value:`year`,children:`This Year`})]})]}),(0,f.jsxs)(n.d,{value:h,onValueChange:e=>_(e),children:[(0,f.jsxs)(n.y,{className:`w-32`,children:[(0,f.jsx)(l.Cloud,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Providers`}),(0,f.jsx)(n.m,{value:`aws`,children:`AWS`}),(0,f.jsx)(n.m,{value:`gcp`,children:`GCP`}),(0,f.jsx)(n.m,{value:`azure`,children:`Azure`})]})]}),p&&(0,f.jsx)(r.r,{variant:`outline`,size:`icon`,onClick:p,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),d&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:d,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Jz,{title:`Total Cost`,value:e.totalCost,previousValue:e.previousTotalCost,icon:l.DollarSign,budget:e.budget}),(0,f.jsx)(Jz,{title:`Compute`,value:e.byCategory.compute,icon:l.Cpu,trend:-5.2}),(0,f.jsx)(Jz,{title:`Storage`,value:e.byCategory.storage,icon:l.HardDrive,trend:12.3}),(0,f.jsx)(Jz,{title:`Forecast (EOM)`,value:e.forecast||e.totalCost*1.1,icon:l.TrendingUp,budget:e.budget})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsx)(`div`,{className:`col-span-2 space-y-6`,children:(0,f.jsx)(Zz,{items:v.slice(0,10)})}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsx)(Yz,{data:e.byCategory}),(0,f.jsx)(Xz,{data:e.byProvider}),(0,f.jsx)(Qz,{anomalies:a})]})]})]})}var eB={totalCost:45230,previousTotalCost:42100,budget:5e4,forecast:48500,byProvider:{aws:28500,gcp:12300,azure:4430,all:45230},byCategory:{compute:22e3,storage:8500,database:7200,network:4100,security:1800,other:1630},topServices:[]},tB=[{id:`1`,name:`EC2 Instances`,category:`compute`,provider:`aws`,cost:12500,previousCost:11800,usage:450,unit:`hours`},{id:`2`,name:`RDS PostgreSQL`,category:`database`,provider:`aws`,cost:4200,previousCost:4e3},{id:`3`,name:`S3 Storage`,category:`storage`,provider:`aws`,cost:3800,previousCost:3200,usage:12,unit:`TB`},{id:`4`,name:`GKE Clusters`,category:`compute`,provider:`gcp`,cost:6500,previousCost:6800},{id:`5`,name:`Cloud SQL`,category:`database`,provider:`gcp`,cost:2800,previousCost:2600},{id:`6`,name:`BigQuery`,category:`database`,provider:`gcp`,cost:1800,previousCost:1500,usage:45,unit:`TB scanned`},{id:`7`,name:`Azure VMs`,category:`compute`,provider:`azure`,cost:2400,previousCost:2200},{id:`8`,name:`Blob Storage`,category:`storage`,provider:`azure`,cost:1200,previousCost:1100},{id:`9`,name:`CloudFront CDN`,category:`network`,provider:`aws`,cost:2100,previousCost:1900,usage:85,unit:`TB`},{id:`10`,name:`Lambda Functions`,category:`compute`,provider:`aws`,cost:850,previousCost:720,usage:12e6,unit:`invocations`}],nB=[{id:`1`,service:`EC2 Spot Instances`,expectedCost:500,actualCost:1250,deviation:150,timestamp:new Date,status:`new`},{id:`2`,service:`Data Transfer`,expectedCost:800,actualCost:1400,deviation:75,timestamp:new Date(Date.now()-36e5),status:`new`},{id:`3`,service:`Lambda`,expectedCost:200,actualCost:320,deviation:60,timestamp:new Date(Date.now()-72e5),status:`acknowledged`}],rB={synced:{icon:l.CheckCircle2,color:`text-green-500`,bgColor:`bg-green-500`,label:`Synced`},out_of_sync:{icon:l.AlertTriangle,color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Out of Sync`},syncing:{icon:l.Loader2,color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Syncing`},failed:{icon:l.XCircle,color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},unknown:{icon:l.Clock,color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},suspended:{icon:l.Pause,color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Suspended`}},iB={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},degraded:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Degraded`},progressing:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Progressing`},missing:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Missing`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}};function aB(e){let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function oB(e){return e.slice(0,7)}function sB({status:e}){let r=rB[e],i=r.icon;return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[(0,f.jsx)(i,{className:t.t(`h-3 w-3`,e===`syncing`&&`animate-spin`)}),r.label]})}function cB({status:e}){let n=iB[e];return(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,n.bgColor)}),(0,f.jsx)(`span`,{className:t.t(`text-sm`,n.color),children:n.label})]})}function lB({app:e,onSync:i,onSuspend:a,onResume:o,onViewDetails:c}){let u=rB[e.syncStatus];iB[e.healthStatus];let d=u.icon,p=s.useMemo(()=>({synced:e.resources.filter(e=>e.syncStatus===`synced`).length,healthy:e.resources.filter(e=>e.healthStatus===`healthy`).length,total:e.resources.length}),[e.resources]);return(0,f.jsx)(Y,{className:t.t(e.syncStatus===`failed`&&`border-red-500/50`,e.syncStatus===`out_of_sync`&&`border-yellow-500/30`,e.healthStatus===`degraded`&&`border-red-500/30`),children:(0,f.jsx)(Q,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`w-12 h-12 rounded-lg flex items-center justify-center shrink-0`,`${u.bgColor}/10`),children:(0,f.jsx)(d,{className:t.t(`h-6 w-6`,u.color,e.syncStatus===`syncing`&&`animate-spin`)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e.project})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Server,{className:`h-3 w-3`}),(0,f.jsx)(`span`,{children:e.destination.namespace}),(0,f.jsx)(`span`,{children:`@`}),(0,f.jsx)(`span`,{className:`truncate max-w-[200px]`,children:e.destination.server})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsx)(sB,{status:e.syncStatus}),(0,f.jsx)(cB,{status:e.healthStatus})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,f.jsx)(l.GitBranch,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{children:e.repo.branch})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,f.jsx)(l.Folder,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`truncate max-w-[150px]`,children:e.repo.path})]}),e.lastSyncedRevision&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(l.GitCommit,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`code`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded`,children:oB(e.lastSyncedRevision)}),e.targetRevision&&e.lastSyncedRevision!==e.targetRevision&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ArrowRight,{className:`h-3 w-3 text-muted-foreground`}),(0,f.jsx)(`code`,{className:`text-xs bg-yellow-500/20 text-yellow-600 px-1.5 py-0.5 rounded`,children:oB(e.targetRevision)})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Synced`}),(0,f.jsxs)(`span`,{children:[p.synced,`/`,p.total]})]}),(0,f.jsx)(Zn,{value:p.synced/p.total*100,className:`h-1.5`})]}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Healthy`}),(0,f.jsxs)(`span`,{children:[p.healthy,`/`,p.total]})]}),(0,f.jsx)(Zn,{value:p.healthy/p.total*100,className:t.t(`h-1.5`,p.healthy<p.total&&`[&>div]:bg-yellow-500`)})]})]}),e.message&&(e.syncStatus===`failed`||e.healthStatus===`degraded`)&&(0,f.jsx)(`div`,{className:`text-sm text-red-500 bg-red-500/10 p-2 rounded`,children:e.message}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.lastSyncedAt&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),`Last synced `,aB(e.lastSyncedAt)]}),e.autoSync&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3 mr-1`}),`Auto-sync`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c&&(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:c,children:[(0,f.jsx)(l.Eye,{className:`h-4 w-4 mr-1`}),`Details`]}),e.syncStatus===`suspended`&&o?(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:o,children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Resume`]}):(0,f.jsxs)(f.Fragment,{children:[a&&e.syncStatus!==`suspended`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:a,children:(0,f.jsx)(l.Pause,{className:`h-4 w-4`})}),i&&e.syncStatus!==`syncing`&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:i,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-1`}),`Sync`]})]})]})]})]})]})})})}function uB({applications:e}){let t=s.useMemo(()=>({total:e.length,synced:e.filter(e=>e.syncStatus===`synced`).length,outOfSync:e.filter(e=>e.syncStatus===`out_of_sync`).length,failed:e.filter(e=>e.syncStatus===`failed`).length,healthy:e.filter(e=>e.healthStatus===`healthy`).length,degraded:e.filter(e=>e.healthStatus===`degraded`).length}),[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-6 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.total}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Apps`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.synced}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Synced`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-yellow-500`,children:t.outOfSync}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Out of Sync`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.failed}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Failed`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.healthy}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Healthy`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.degraded}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Degraded`})]})})]})}function dB({applications:e,onSync:n,onRefresh:i,onSuspend:a,onResume:o,onViewDetails:c,className:u}){let[d,p]=s.useState(`all`),m=s.useMemo(()=>d===`all`?e:e.filter(e=>e.syncStatus===d),[e,d]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.GitBranch,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`GitOps Sync Status`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor application synchronization with Git`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[[`all`,`synced`,`out_of_sync`,`failed`,`syncing`].map(e=>(0,f.jsx)(r.r,{variant:d===e?`default`:`ghost`,size:`sm`,onClick:()=>p(e),children:e===`all`?`All`:rB[e].label},e)),i&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:i,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-1`}),`Refresh All`]})]})]})})}),(0,f.jsx)(uB,{applications:e}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:m.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Cloud,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No applications found`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`Adjust your filters or add new applications`})]}):m.map(e=>(0,f.jsx)(lB,{app:e,onSync:n?()=>n(e):void 0,onSuspend:a?()=>a(e):void 0,onResume:o?()=>o(e):void 0,onViewDetails:c?()=>c(e):void 0},e.id))})})]})}var fB=[{id:`1`,name:`api-gateway`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/api-gateway`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`synced`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-5*6e4),lastSyncedRevision:`a1b2c3d4e5f6789`,autoSync:!0,resources:[{kind:`Deployment`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Service`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`ConfigMap`,name:`api-gateway-config`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Ingress`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`2`,name:`user-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/user-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`out_of_sync`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-2*36e5),lastSyncedRevision:`old123456789`,targetRevision:`new987654321`,autoSync:!1,resources:[{kind:`Deployment`,name:`user-service`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`},{kind:`Service`,name:`user-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`user-service-secrets`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`}]},{id:`3`,name:`payment-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/payment-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`failed`,healthStatus:`degraded`,lastSyncedAt:new Date(Date.now()-30*6e4),lastSyncedRevision:`abc123def456`,message:`Failed to apply resource: Deployment/payment-service: ImagePullBackOff`,autoSync:!0,resources:[{kind:`Deployment`,name:`payment-service`,namespace:`production`,syncStatus:`failed`,healthStatus:`degraded`,message:`ImagePullBackOff`},{kind:`Service`,name:`payment-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`payment-service-secrets`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`4`,name:`notification-service`,project:`staging`,repo:{url:`https://github.com/example/infra`,branch:`develop`,path:`apps/notification-service`},destination:{server:`https://staging.k8s.example.com`,namespace:`staging`},syncStatus:`syncing`,healthStatus:`progressing`,lastSyncedAt:new Date(Date.now()-6e4),lastSyncedRevision:`syncing123`,autoSync:!0,resources:[{kind:`Deployment`,name:`notification-service`,namespace:`staging`,syncStatus:`syncing`,healthStatus:`progressing`},{kind:`Service`,name:`notification-service`,namespace:`staging`,syncStatus:`synced`,healthStatus:`healthy`}]}],pB={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}},mB={api:{icon:l.Globe,color:`text-blue-500`},web:{icon:l.Globe,color:`text-purple-500`},worker:{icon:l.Cpu,color:`text-orange-500`},database:{icon:l.Database,color:`text-green-500`},cache:{icon:l.HardDrive,color:`text-red-500`},queue:{icon:l.Activity,color:`text-cyan-500`}};function hB(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function gB(e){return e<1e3?e.toFixed(0):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function _B({current:e,previous:n}){if(n===void 0)return null;let r=(e-n)/n*100,i=r>0;return(0,f.jsxs)(`span`,{className:t.t(`text-xs flex items-center gap-0.5`,i?`text-red-500`:`text-green-500`),children:[i?(0,f.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,f.jsx)(l.TrendingDown,{className:`h-3 w-3`}),Math.abs(r).toFixed(1),`%`]})}function vB({title:e,value:n,unit:r,previousValue:i,status:a,icon:o}){let s=a?pB[a]:null;return(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,f.jsx)(o,{className:`h-4 w-4 text-muted-foreground`})}),s&&(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,s.bgColor)})]}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,f.jsx)(`span`,{className:`text-2xl font-bold`,children:gB(n)}),r&&(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:r})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e}),(0,f.jsx)(_B,{current:n,previous:i})]})]})]})})}function yB({service:e,onClick:r}){let i=pB[e.status],a=mB[e.type],o=a.icon,{metrics:s,previousMetrics:c}=e;return s.successRate/100*(1-s.p95ResponseTime/3e3),(0,f.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/30`),onClick:r,children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${a.color.replace(`text-`,`bg-`)}/10`),children:(0,f.jsx)(o,{className:t.t(`h-5 w-5`,a.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold truncate`,children:e.name}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full shrink-0`,i.bgColor)}),e.version&&(0,f.jsxs)(n.x,{variant:`outline`,className:`text-xs`,children:[`v`,e.version]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-sm`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Zap,{className:`h-3 w-3 text-muted-foreground`}),s.requestsPerSecond,`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3 text-muted-foreground`}),hB(s.avgResponseTime)]}),(0,f.jsxs)(`span`,{className:t.t(`flex items-center gap-1`,s.errorRate>5&&`text-red-500`,s.errorRate>1&&s.errorRate<=5&&`text-yellow-500`),children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),s.errorRate.toFixed(2),`%`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`p50: `,hB(s.p50ResponseTime)]}),(0,f.jsxs)(`span`,{children:[`p95: `,hB(s.p95ResponseTime)]}),(0,f.jsxs)(`span`,{children:[`p99: `,hB(s.p99ResponseTime)]})]}),e.tags&&e.tags.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[e.tags.slice(0,3).map(e=>(0,f.jsx)(n.x,{variant:`secondary`,className:`text-xs`,children:e},e)),e.tags.length>3&&(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,e.tags.length-3]})]})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`text-lg font-bold text-green-500`,children:[s.successRate.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Success`}),e.instances&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.instances,` instances`]})]})]}),(s.cpuUsage!==void 0||s.memoryUsage!==void 0)&&(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-4 pt-3 border-t`,children:[s.cpuUsage!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{className:t.t(s.cpuUsage>80&&`text-red-500`),children:[s.cpuUsage,`%`]})]}),(0,f.jsx)(Zn,{value:s.cpuUsage,className:t.t(`h-1.5`,s.cpuUsage>80&&`[&>div]:bg-red-500`)})]}),s.memoryUsage!==void 0&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` Memory`]}),(0,f.jsxs)(`span`,{className:t.t(s.memoryUsage>80&&`text-red-500`),children:[s.memoryUsage,`%`]})]}),(0,f.jsx)(Zn,{value:s.memoryUsage,className:t.t(`h-1.5`,s.memoryUsage>80&&`[&>div]:bg-red-500`)})]})]})]})})}function bB({transactions:e,onClick:n}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Transactions`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors`,onClick:()=>n?.(e),children:[e.status===`success`?(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):(0,f.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.service})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>1e3&&`text-yellow-500`,e.duration>3e3&&`text-red-500`),children:hB(e.duration)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.timestamp.toLocaleTimeString()})]})]},e.id))})})})]})}function xB({services:e,recentTransactions:i=[],timeRange:a=`1h`,onTimeRangeChange:o,onServiceClick:c,onTransactionClick:u,onRefresh:d,className:p}){let[m,h]=s.useState(`all`),g=s.useMemo(()=>({totalRequests:e.reduce((e,t)=>e+t.metrics.requestsPerSecond,0),avgResponseTime:e.reduce((e,t)=>e+t.metrics.avgResponseTime,0)/e.length,avgErrorRate:e.reduce((e,t)=>e+t.metrics.errorRate,0)/e.length,healthyCount:e.filter(e=>e.status===`healthy`).length,totalServices:e.length}),[e]),_=s.useMemo(()=>m===`all`?e:e.filter(e=>e.status===m),[e,m]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Activity,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Application Performance`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor service health and performance metrics`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(n.d,{value:a,onValueChange:e=>o?.(e),children:[(0,f.jsxs)(n.y,{className:`w-28`,children:[(0,f.jsx)(l.Clock,{className:`h-4 w-4 mr-2`}),(0,f.jsx)(n.b,{})]}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`1h`,children:`Last 1h`}),(0,f.jsx)(n.m,{value:`6h`,children:`Last 6h`}),(0,f.jsx)(n.m,{value:`24h`,children:`Last 24h`}),(0,f.jsx)(n.m,{value:`7d`,children:`Last 7d`}),(0,f.jsx)(n.m,{value:`30d`,children:`Last 30d`})]})]}),d&&(0,f.jsx)(r.r,{variant:`outline`,onClick:d,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(vB,{title:`Total Requests`,value:g.totalRequests,unit:`/s`,icon:l.Zap}),(0,f.jsx)(vB,{title:`Avg Response Time`,value:g.avgResponseTime,unit:`ms`,icon:l.Clock,status:g.avgResponseTime>500?`warning`:`healthy`}),(0,f.jsx)(vB,{title:`Error Rate`,value:g.avgErrorRate,unit:`%`,icon:l.AlertTriangle,status:g.avgErrorRate>5?`critical`:g.avgErrorRate>1?`warning`:`healthy`}),(0,f.jsx)(vB,{title:`Services Healthy`,value:g.healthyCount,unit:`/ ${g.totalServices}`,icon:l.CheckCircle2,status:g.healthyCount===g.totalServices?`healthy`:`warning`})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,f.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`font-semibold`,children:`Services`}),(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:[`all`,`healthy`,`warning`,`critical`].map(e=>(0,f.jsx)(r.r,{variant:m===e?`default`:`ghost`,size:`sm`,onClick:()=>h(e),children:e===`all`?`All`:pB[e].label},e))})]}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:_.map(e=>(0,f.jsx)(yB,{service:e,onClick:()=>c?.(e)},e.id))})})]}),(0,f.jsx)(`div`,{children:(0,f.jsx)(bB,{transactions:i,onClick:u})})]})]})}var SB=[{id:`1`,name:`api-gateway`,type:`api`,status:`healthy`,version:`2.4.1`,instances:3,metrics:{requestsPerSecond:1250,avgResponseTime:45,p50ResponseTime:32,p95ResponseTime:120,p99ResponseTime:250,errorRate:.12,successRate:99.88,activeConnections:450,cpuUsage:45,memoryUsage:62},tags:[`production`,`critical`]},{id:`2`,name:`user-service`,type:`api`,status:`healthy`,version:`1.8.0`,instances:2,metrics:{requestsPerSecond:350,avgResponseTime:85,p50ResponseTime:65,p95ResponseTime:180,p99ResponseTime:450,errorRate:.5,successRate:99.5,activeConnections:120,cpuUsage:35,memoryUsage:55},tags:[`production`]},{id:`3`,name:`payment-service`,type:`api`,status:`warning`,version:`3.1.0`,instances:2,metrics:{requestsPerSecond:150,avgResponseTime:520,p50ResponseTime:280,p95ResponseTime:1200,p99ResponseTime:2500,errorRate:2.5,successRate:97.5,activeConnections:85,cpuUsage:78,memoryUsage:82},tags:[`production`,`payment`]},{id:`4`,name:`notification-worker`,type:`worker`,status:`healthy`,instances:5,metrics:{requestsPerSecond:500,avgResponseTime:25,p50ResponseTime:18,p95ResponseTime:55,p99ResponseTime:120,errorRate:.05,successRate:99.95,activeConnections:0,cpuUsage:25,memoryUsage:40}},{id:`5`,name:`postgres-primary`,type:`database`,status:`healthy`,instances:1,metrics:{requestsPerSecond:2500,avgResponseTime:8,p50ResponseTime:5,p95ResponseTime:25,p99ResponseTime:80,errorRate:.01,successRate:99.99,activeConnections:120,cpuUsage:55,memoryUsage:72}},{id:`6`,name:`redis-cache`,type:`cache`,status:`healthy`,instances:3,metrics:{requestsPerSecond:15e3,avgResponseTime:.5,p50ResponseTime:.3,p95ResponseTime:1.2,p99ResponseTime:3,errorRate:.001,successRate:99.999,activeConnections:500,memoryUsage:45}}],CB=[{id:`1`,name:`POST /api/users`,service:`user-service`,duration:85,timestamp:new Date(Date.now()-5e3),status:`success`},{id:`2`,name:`GET /api/products`,service:`api-gateway`,duration:42,timestamp:new Date(Date.now()-12e3),status:`success`},{id:`3`,name:`POST /api/payments`,service:`payment-service`,duration:1250,timestamp:new Date(Date.now()-25e3),status:`error`},{id:`4`,name:`GET /api/orders/:id`,service:`api-gateway`,duration:65,timestamp:new Date(Date.now()-45e3),status:`success`},{id:`5`,name:`POST /api/notifications`,service:`notification-worker`,duration:22,timestamp:new Date(Date.now()-6e4),status:`success`},{id:`6`,name:`GET /api/users/:id`,service:`user-service`,duration:95,timestamp:new Date(Date.now()-9e4),status:`success`},{id:`7`,name:`PUT /api/cart`,service:`api-gateway`,duration:180,timestamp:new Date(Date.now()-12e4),status:`success`},{id:`8`,name:`POST /api/checkout`,service:`payment-service`,duration:3200,timestamp:new Date(Date.now()-18e4),status:`error`}],wB={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Stopped`},paused:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Paused`},restarting:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Restarting`},creating:{color:`text-blue-400`,bgColor:`bg-blue-400`,label:`Creating`},removing:{color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Removing`},exited:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Exited`},dead:{color:`text-red-600`,bgColor:`bg-red-600`,label:`Dead`}},TB={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},updating:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Updating`},scaled:{color:`text-purple-500`,bgColor:`bg-purple-500`,label:`Scaling`},failed:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},pending:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Pending`}};function EB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function DB(e){if(!e)return`N/A`;let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function OB({container:e,onViewLogs:i,onExecShell:a}){let o=wB[e.status],s=e.resources.memory/e.resources.memoryLimit*100;return(0,f.jsx)(`div`,{className:t.t(`border rounded-lg p-3 transition-all hover:bg-muted/30`,e.status===`exited`&&`border-red-500/30 bg-red-500/5`,e.healthCheck===`unhealthy`&&`border-yellow-500/30`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Container,{className:t.t(`h-5 w-5`,o.color)}),e.healthCheck&&e.healthCheck!==`none`&&(0,f.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background`,e.healthCheck===`healthy`&&`bg-green-500`,e.healthCheck===`unhealthy`&&`bg-red-500`,e.healthCheck===`starting`&&`bg-yellow-500`)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs`,o.color),children:o.label})]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 truncate`,children:e.image}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mt-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,f.jsx)(Zn,{value:e.resources.cpu,className:t.t(`h-1`,e.resources.cpu>80&&`[&>div]:bg-red-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` MEM`]}),(0,f.jsxs)(`span`,{children:[e.resources.memory,`MB`]})]}),(0,f.jsx)(Zn,{value:s,className:t.t(`h-1`,s>80&&`[&>div]:bg-red-500`)})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),DB(e.startedAt)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.ArrowDown,{className:`h-3 w-3`}),EB(e.resources.networkRx),`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.ArrowUp,{className:`h-3 w-3`}),EB(e.resources.networkTx),`/s`]}),e.restartCount!==void 0&&e.restartCount>0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-500`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3`}),e.restartCount,` restarts`]})]})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[i&&(0,f.jsxs)($,{onClick:i,children:[(0,f.jsx)(l.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),a&&(0,f.jsxs)($,{onClick:a,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4 mr-2`}),`Shell`]})]})]})]})})}function kB({service:e,onScale:i,onRestart:a,onStop:o,onDelete:c,onViewLogs:u,onExecShell:d}){let[p,m]=s.useState(!1),[h,g]=s.useState(e.replicas.desired),_=TB[e.status],v=e.containers.every(e=>e.status===`running`),y=e.replicas.running/e.replicas.desired*100;return(0,f.jsx)(Y,{className:t.t(e.status===`failed`&&`border-red-500/50`,!v&&`border-yellow-500/30`),children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${_.bgColor}/10`),children:(0,f.jsx)(l.Layers,{className:t.t(`h-5 w-5`,_.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.x,{className:t.t(`text-white text-xs`,_.bgColor),children:_.label})]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-1`,children:e.image}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Replicas`}),(0,f.jsxs)(`span`,{className:t.t(e.replicas.running<e.replicas.desired&&`text-yellow-500`),children:[e.replicas.running,`/`,e.replicas.desired,` running`,e.replicas.ready<e.replicas.running&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.replicas.ready,` ready)`]})]})]}),(0,f.jsx)(Zn,{value:y,className:t.t(`h-2`,y<100&&`[&>div]:bg-yellow-500`,e.status===`failed`&&`[&>div]:bg-red-500`)})]}),e.updateStatus&&(0,f.jsxs)(`div`,{className:`mt-3 p-2 bg-muted/50 rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500`,children:[(0,f.jsx)(l.RefreshCw,{className:`h-3 w-3 animate-spin`}),e.updateStatus.state]}),(0,f.jsxs)(`span`,{children:[e.updateStatus.progress,`%`]})]}),e.updateStatus.message&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.updateStatus.message}),(0,f.jsx)(Zn,{value:e.updateStatus.progress,className:`h-1 mt-2`})]}),e.ports&&e.ports.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(l.Network,{className:`h-3 w-3`}),e.ports.map((t,n)=>(0,f.jsxs)(`span`,{children:[t.published,`:`,t.target,n<e.ports.length-1&&`,`]},n))]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 border rounded`,children:[(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=Math.max(0,h-1);g(e),i?.(e)},children:(0,f.jsx)(l.Minus,{className:`h-4 w-4`})}),(0,f.jsx)(r.n,{type:`number`,value:h,onChange:e=>{g(parseInt(e.target.value)||0)},onBlur:()=>i?.(h),className:`w-12 h-8 text-center border-0 p-0`,min:0}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=h+1;g(e),i?.(e)},children:(0,f.jsx)(l.Plus,{className:`h-4 w-4`})})]}),(0,f.jsxs)(Xt,{children:[(0,f.jsx)(Zt,{asChild:!0,children:(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(an,{align:`end`,children:[a&&(0,f.jsxs)($,{onClick:a,children:[(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 mr-2`}),`Restart`]}),o&&(0,f.jsxs)($,{onClick:o,children:[(0,f.jsx)(l.Square,{className:`h-4 w-4 mr-2`}),`Stop`]}),(0,f.jsx)(ln,{}),c&&(0,f.jsxs)($,{onClick:c,className:`text-destructive`,children:[(0,f.jsx)(l.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>m(!p),children:[(0,f.jsx)(l.Eye,{className:`h-4 w-4 mr-1`}),p?`Hide`:`Show`,` Containers`]})]})]}),p&&(0,f.jsx)(`div`,{className:`mt-4 pt-4 border-t space-y-2`,children:e.containers.length===0?(0,f.jsx)(`div`,{className:`text-center text-muted-foreground py-4`,children:`No containers running`}):e.containers.map(e=>(0,f.jsx)(OB,{container:e,onViewLogs:u?()=>u(e):void 0,onExecShell:d?()=>d(e):void 0},e.id))})]})})}function AB({services:e}){let t=s.useMemo(()=>{let t=e.length,n=e.reduce((e,t)=>e+t.containers.length,0),r=e.reduce((e,t)=>e+t.containers.filter(e=>e.status===`running`).length,0),i=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.cpu,0),0),a=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.memory,0),0);return{totalServices:t,totalContainers:n,runningContainers:r,avgCpu:i/n,totalMemory:a}},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-5 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalServices}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Services`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Containers`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.runningContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Running`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[t.avgCpu.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg CPU`})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(t.totalMemory/1024).toFixed(1),`GB`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Memory`})]})})]})}function jB({services:e,onScaleService:i,onRestartService:a,onStopService:o,onDeleteService:c,onViewLogs:u,onExecShell:d,onRefresh:p,className:m}){let[h,g]=s.useState(``),[_,v]=s.useState(`all`),y=s.useMemo(()=>e.filter(e=>!(h&&!e.name.toLowerCase().includes(h.toLowerCase())||_!==`all`&&e.status!==_)),[e,h,_]);return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Container,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Container Orchestrator`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage and monitor containerized services`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Search services...`,value:h,onChange:e=>g(e.target.value),className:`pl-9 w-64`})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>v(e),children:[(0,f.jsx)(n.y,{className:`w-32`,children:(0,f.jsx)(n.b,{placeholder:`Status`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`All Status`}),(0,f.jsx)(n.m,{value:`running`,children:`Running`}),(0,f.jsx)(n.m,{value:`updating`,children:`Updating`}),(0,f.jsx)(n.m,{value:`failed`,children:`Failed`}),(0,f.jsx)(n.m,{value:`pending`,children:`Pending`})]})]}),p&&(0,f.jsx)(r.r,{variant:`outline`,onClick:p,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(AB,{services:e}),(0,f.jsx)(er,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:y.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(l.Container,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No services found`})]}):y.map(e=>(0,f.jsx)(kB,{service:e,onScale:i?t=>i(e,t):void 0,onRestart:a?()=>a(e):void 0,onStop:o?()=>o(e):void 0,onDelete:c?()=>c(e):void 0,onViewLogs:u,onExecShell:d},e.id))})})]})}function MB(e,t){return Array.from({length:t},(t,n)=>({id:`${e}-${n+1}`,name:`${e}-${n+1}`,image:`myregistry/${e}:latest`,status:`running`,createdAt:new Date(Date.now()-(n+1)*36e5),startedAt:new Date(Date.now()-n*36e5),healthCheck:`healthy`,restartCount:Math.floor(Math.random()*3),node:`node-${Math.floor(Math.random()*3)+1}`,resources:{cpu:Math.random()*50+10,memory:Math.floor(Math.random()*500+200),memoryLimit:1024,networkRx:Math.floor(Math.random()*1e6),networkTx:Math.floor(Math.random()*5e5)}}))}var NB=[{id:`1`,name:`api-gateway`,image:`myregistry/api-gateway:v2.4.1`,status:`running`,replicas:{desired:3,running:3,ready:3},containers:MB(`api-gateway`,3),ports:[{published:80,target:8080},{published:443,target:8443}],createdAt:new Date(Date.now()-168*36e5),updatedAt:new Date(Date.now()-48*36e5)},{id:`2`,name:`user-service`,image:`myregistry/user-service:v1.8.0`,status:`updating`,replicas:{desired:2,running:2,ready:1},containers:MB(`user-service`,2),updateStatus:{state:`updating`,progress:50,message:`Updating replica 1 of 2`},ports:[{published:8081,target:8080}],createdAt:new Date(Date.now()-336*36e5),updatedAt:new Date},{id:`3`,name:`payment-service`,image:`myregistry/payment-service:v3.1.0`,status:`running`,replicas:{desired:2,running:2,ready:2},containers:MB(`payment-service`,2),ports:[{published:8082,target:8080}],createdAt:new Date(Date.now()-720*36e5),updatedAt:new Date(Date.now()-120*36e5)},{id:`4`,name:`notification-worker`,image:`myregistry/notification-worker:v2.0.0`,status:`running`,replicas:{desired:5,running:5,ready:5},containers:MB(`notification-worker`,5),createdAt:new Date(Date.now()-504*36e5),updatedAt:new Date(Date.now()-168*36e5)},{id:`5`,name:`analytics-pipeline`,image:`myregistry/analytics:v1.2.0`,status:`failed`,replicas:{desired:3,running:1,ready:1},containers:[...MB(`analytics-pipeline`,1),{id:`analytics-pipeline-2`,name:`analytics-pipeline-2`,image:`myregistry/analytics:v1.2.0`,status:`exited`,createdAt:new Date(Date.now()-2*36e5),healthCheck:`unhealthy`,restartCount:5,node:`node-2`,resources:{cpu:0,memory:0,memoryLimit:1024,networkRx:0,networkTx:0}}],createdAt:new Date(Date.now()-240*36e5),updatedAt:new Date(Date.now()-24*36e5)}],PB={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},offline:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Offline`}},FB={active:{color:`text-green-500`,label:`Active`},idle:{color:`text-gray-500`,label:`Idle`},idle_in_transaction:{color:`text-yellow-500`,label:`Idle in Transaction`},waiting:{color:`text-orange-500`,label:`Waiting`}};function IB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function LB(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function RB(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(2)}ms`:`${(e/1e3).toFixed(2)}s`}function zB({metrics:e,status:r}){let i=PB[r],a=e.connections.active/e.connections.max*100,o=e.storage.used/e.storage.total*100;return(0,f.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.connections.active}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,f.jsxs)(`span`,{children:[e.connections.idle,` idle`]}),(0,f.jsxs)(`span`,{children:[`max `,e.connections.max]})]}),(0,f.jsx)(Zn,{value:a,className:t.t(`h-1.5`,a>80&&`[&>div]:bg-red-500`)})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,f.jsx)(l.Zap,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(n.x,{variant:`secondary`,className:`text-xs`,children:[e.transactions.perSecond,`/s`]})]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:e.transactions.committed}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Transactions`}),(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`text-red-500`,children:e.transactions.rolledBack}),` rolled back`]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,f.jsx)(l.Activity,{className:`h-4 w-4 text-muted-foreground`})}),(0,f.jsxs)(`div`,{className:t.t(`text-2xl font-bold`,e.cache.hitRatio<90&&`text-yellow-500`,e.cache.hitRatio<80&&`text-red-500`),children:[e.cache.hitRatio.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Cache Hit Ratio`}),(0,f.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Buffer: `,e.cache.bufferHit,` • Disk: `,e.cache.diskRead]})]})}),(0,f.jsx)(Y,{children:(0,f.jsxs)(Q,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,f.jsx)(l.HardDrive,{className:`h-4 w-4 text-muted-foreground`})}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:IB(e.storage.used)}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Storage Used`}),(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:o,className:t.t(`h-1.5`,o>80&&`[&>div]:bg-red-500`)}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`of `,IB(e.storage.total)]})]})]})})]})}function BB({connections:e,onKill:i}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4`}),`Active Connections`]}),(0,f.jsx)(n.x,{variant:`secondary`,children:e.length})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let a=FB[e.state];return(0,f.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg border`,e.state===`idle_in_transaction`&&`border-yellow-500/30`,e.duration>60&&`bg-yellow-500/5`),children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.user}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs`,a.color),children:a.label}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`@ `,e.database]})]}),e.query&&(0,f.jsx)(`code`,{className:`text-xs text-muted-foreground block truncate mt-1`,children:e.query})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>60&&`text-yellow-500`,e.duration>300&&`text-red-500`),children:LB(e.duration)}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.client})]}),i&&e.state!==`idle`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-red-500`,onClick:()=>i(e),children:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`})})]},e.id)})})})})]})}function VB({backups:e,onRestore:t,onCreate:i}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4`}),`Backups`]}),i&&(0,f.jsxs)(r.r,{size:`sm`,onClick:i,children:[(0,f.jsx)(l.Upload,{className:`h-4 w-4 mr-1`}),`Create Backup`]})]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[200px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg border`,children:[e.status===`completed`?(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):e.status===`failed`?(0,f.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}):e.status===`running`?(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4 text-blue-500 animate-spin shrink-0`}):(0,f.jsx)(l.Clock,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,f.jsx)(n.x,{variant:`outline`,className:`text-xs`,children:e.type})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.startedAt.toLocaleString(),e.duration&&` • ${LB(e.duration)}`]})]}),(0,f.jsx)(`div`,{className:`text-right shrink-0`,children:e.size&&(0,f.jsx)(`div`,{className:`text-sm font-medium`,children:IB(e.size)})}),t&&e.status===`completed`&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>t(e),children:(0,f.jsx)(l.RotateCcw,{className:`h-4 w-4`})})]},e.id))})})})]})}function HB({queries:e}){let[t,n]=s.useState(null),i=e=>{navigator.clipboard.writeText(e.query),n(e.id),setTimeout(()=>n(null),2e3)};return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Slow Queries`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:`h-[300px]`,children:(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`p-2 rounded-lg border bg-muted/30`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,f.jsx)(`code`,{className:`text-xs font-mono line-clamp-2 flex-1`,children:e.query}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 shrink-0`,onClick:()=>i(e),children:t===e.id?(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 text-green-500`}):(0,f.jsx)(l.Copy,{className:`h-3 w-3`})})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`Calls: `,(0,f.jsx)(`strong`,{children:e.calls})]}),(0,f.jsxs)(`span`,{children:[`Mean: `,(0,f.jsx)(`strong`,{className:`text-yellow-500`,children:RB(e.meanTime)})]}),(0,f.jsxs)(`span`,{children:[`Max: `,(0,f.jsx)(`strong`,{className:`text-red-500`,children:RB(e.maxTime)})]}),(0,f.jsxs)(`span`,{children:[`Total: `,(0,f.jsx)(`strong`,{children:RB(e.totalTime)})]}),(0,f.jsxs)(`span`,{children:[`Rows: `,(0,f.jsx)(`strong`,{children:e.rows})]})]})]},e.id))})})})]})}function UB({onExecute:e}){let[t,a]=s.useState(``),[o,c]=s.useState([]);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{className:`pb-2`,children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4`}),`Query Editor`]})}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsx)(i.n,{value:t,onChange:e=>a(e.target.value),placeholder:`SELECT * FROM users LIMIT 10;`,className:`font-mono text-sm min-h-[120px]`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:o.length>0&&(0,f.jsxs)(n.d,{onValueChange:e=>a(e),children:[(0,f.jsxs)(n.y,{className:`w-40`,children:[(0,f.jsx)(l.History,{className:`h-4 w-4 mr-2`}),`History`]}),(0,f.jsx)(n.f,{children:o.map((e,t)=>(0,f.jsx)(n.m,{value:e,children:(0,f.jsx)(`span`,{className:`truncate max-w-[300px]`,children:e})},t))})]})}),(0,f.jsxs)(r.r,{onClick:()=>{t.trim()&&(e?.(t),c(e=>[t,...e.slice(0,9)]))},disabled:!t.trim(),children:[(0,f.jsx)(l.Play,{className:`h-4 w-4 mr-1`}),`Execute`]})]})]})]})}function WB({instance:e,onExecuteQuery:i,onCreateBackup:a,onRestoreBackup:o,onKillConnection:s,onRefresh:c,className:u}){let d=PB[e.status];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,f.jsx)(Y,{children:(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(l.Database,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Z,{children:e.name}),(0,f.jsx)(n.x,{className:t.t(`text-white`,d.bgColor),children:d.label}),(0,f.jsx)(n.x,{variant:`outline`,children:e.role})]}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.type,` `,e.version,` • `,e.host,`:`,e.port]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.metrics.replication&&(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(e.metrics.replication.lag>1e3?`text-red-500`:e.metrics.replication.lag>100?`text-yellow-500`:`text-green-500`),children:[`Replication: `,RB(e.metrics.replication.lag),` lag`]}),c&&(0,f.jsx)(r.r,{variant:`outline`,onClick:c,children:(0,f.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(zB,{metrics:e.metrics,status:e.status}),(0,f.jsxs)(Cr,{defaultValue:`connections`,children:[(0,f.jsxs)(wr,{children:[(0,f.jsxs)(Tr,{value:`connections`,children:[(0,f.jsx)(l.Users,{className:`h-4 w-4 mr-1`}),`Connections`]}),(0,f.jsxs)(Tr,{value:`queries`,children:[(0,f.jsx)(l.Terminal,{className:`h-4 w-4 mr-1`}),`Query`]}),(0,f.jsxs)(Tr,{value:`slow`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4 mr-1`}),`Slow Queries`]}),(0,f.jsxs)(Tr,{value:`backups`,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Backups`]})]}),(0,f.jsx)(Er,{value:`connections`,className:`mt-4`,children:(0,f.jsx)(BB,{connections:e.connections,onKill:s})}),(0,f.jsx)(Er,{value:`queries`,className:`mt-4`,children:(0,f.jsx)(UB,{onExecute:i})}),(0,f.jsx)(Er,{value:`slow`,className:`mt-4`,children:(0,f.jsx)(HB,{queries:e.slowQueries})}),(0,f.jsx)(Er,{value:`backups`,className:`mt-4`,children:(0,f.jsx)(VB,{backups:e.backups,onRestore:o,onCreate:a})})]})]})}var GB={id:`1`,name:`production-db`,type:`postgresql`,version:`15.4`,host:`db.example.com`,port:5432,status:`healthy`,role:`primary`,metrics:{connections:{active:45,idle:25,max:100},transactions:{committed:125e3,rolledBack:15,perSecond:250},cache:{hitRatio:98.5,bufferHit:15e3,diskRead:250},storage:{used:85*1024*1024*1024,total:200*1024*1024*1024,tablespace:75*1024*1024*1024,indexes:10*1024*1024*1024},replication:{lag:25,state:`streaming`,replicas:2}},connections:[{id:`1`,user:`api_user`,database:`production`,state:`active`,query:`SELECT * FROM users WHERE id = $1`,duration:.5,client:`192.168.1.10`},{id:`2`,user:`api_user`,database:`production`,state:`active`,query:`UPDATE orders SET status = $1 WHERE id = $2`,duration:1.2,client:`192.168.1.11`},{id:`3`,user:`analytics`,database:`production`,state:`idle_in_transaction`,query:`SELECT COUNT(*) FROM events WHERE...`,duration:125,client:`192.168.1.20`},{id:`4`,user:`admin`,database:`production`,state:`idle`,duration:300,client:`192.168.1.5`},{id:`5`,user:`api_user`,database:`production`,state:`active`,duration:.1,client:`192.168.1.12`}],backups:[{id:`1`,name:`daily-backup-20240110`,type:`full`,status:`completed`,size:45*1024*1024*1024,startedAt:new Date(Date.now()-4*36e5),completedAt:new Date(Date.now()-2*36e5),duration:7200},{id:`2`,name:`hourly-backup-20240110-12`,type:`incremental`,status:`completed`,size:250*1024*1024,startedAt:new Date(Date.now()-1*36e5),completedAt:new Date(Date.now()-50*6e4),duration:600},{id:`3`,name:`hourly-backup-20240110-13`,type:`incremental`,status:`running`,startedAt:new Date(Date.now()-5*6e4)},{id:`4`,name:`daily-backup-20240111`,type:`full`,status:`scheduled`,startedAt:new Date(Date.now()+8*36e5)}],slowQueries:[{id:`1`,query:`SELECT * FROM orders o JOIN order_items oi ON o.id = oi.order_id WHERE o.created_at > $1 AND o.status = $2`,calls:1250,totalTime:45e3,meanTime:36,maxTime:520,rows:15e3},{id:`2`,query:`SELECT u.*, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id ORDER BY order_count DESC LIMIT 100`,calls:500,totalTime:85e3,meanTime:170,maxTime:1200,rows:100},{id:`3`,query:`UPDATE products SET view_count = view_count + 1 WHERE id = $1`,calls:5e4,totalTime:25e3,meanTime:.5,maxTime:15,rows:1},{id:`4`,query:`SELECT * FROM analytics_events WHERE event_type = $1 AND created_at BETWEEN $2 AND $3`,calls:250,totalTime:125e3,meanTime:500,maxTime:3500,rows:5e4}]},KB={healthy:{color:`text-green-500 bg-green-500/10`,icon:(0,f.jsx)(l.ShieldCheck,{className:`h-4 w-4`}),label:`Healthy`},degraded:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4`}),label:`Degraded`},down:{color:`text-red-500 bg-red-500/10`,icon:(0,f.jsx)(l.ShieldX,{className:`h-4 w-4`}),label:`Down`}},qB={clean:{color:`text-green-500`,icon:(0,f.jsx)(l.CheckCircle,{className:`h-4 w-4`}),label:`Clean`,bgColor:`bg-green-500`},infected:{color:`text-red-500`,icon:(0,f.jsx)(l.XCircle,{className:`h-4 w-4`}),label:`Infected`,bgColor:`bg-red-500`},error:{color:`text-orange-500`,icon:(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4`}),label:`Error`,bgColor:`bg-orange-500`}},JB={critical:{color:`text-red-500`,bgColor:`bg-red-500`},high:{color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{color:`text-blue-500`,bgColor:`bg-blue-500`}};function YB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function XB(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function ZB(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function QB({health:e}){let r=KB[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function $B({result:e}){let r=qB[e];return(0,f.jsxs)(n.x,{variant:`outline`,className:t.t(`gap-1`,r.color),children:[r.icon,r.label]})}function eV({title:e,value:n,icon:r,trend:i,color:a=`text-primary`}){return(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mb-1`,children:e}),(0,f.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,f.jsx)(`p`,{className:t.t(`text-3xl font-bold`,a),children:n}),i&&(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]})]}),(0,f.jsx)(`div`,{className:t.t(`p-3 rounded-lg`,`${a.replace(`text-`,`bg-`)}/10`),children:r})]})})})}function tV({stats:e}){let t=Math.max(...e.map(e=>Math.max(e.scans,e.threats)),1);return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.TrendingUp,{className:`h-4 w-4`}),`Weekly Activity`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{let r=e.scans/t*100,i=e.threats/t*100;return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground min-w-12`,children:e.day}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),e.scans,` scans`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-red-500`}),e.threats,` threats`]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:`h-full bg-blue-500 rounded-full transition-all`,style:{width:`${r}%`}})}),e.threats>0&&(0,f.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:`h-full bg-red-500 rounded-full transition-all`,style:{width:`${i}%`}})})]})]},e.day)})})})]})}function nV({scans:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Scans`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-12 w-12 mx-auto mb-3 opacity-50`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`No scans yet`})]}):e.map(e=>(0,f.jsx)(`div`,{className:t.t(`flex items-center justify-between p-3 rounded-lg border transition-colors`,e.result===`infected`&&`border-red-500/50 bg-red-500/5`),children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,qB[e.result].color.replace(`text-`,`bg-`)+`/10`),children:qB[e.result].icon}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,f.jsx)($B,{result:e.result})]}),e.threatName&&(0,f.jsxs)(`p`,{className:`text-xs text-red-500 mt-1 flex items-center gap-1`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),e.threatName]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`h-3 w-3`}),ZB(e.scanDate)]}),(0,f.jsx)(`span`,{children:XB(e.duration)}),(0,f.jsx)(`span`,{children:YB(e.fileSize)})]})]})]})},e.id))})})]})}function rV({threats:e}){return(0,f.jsxs)(Y,{children:[(0,f.jsx)(X,{children:(0,f.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Top Threats`]})}),(0,f.jsx)(Q,{children:(0,f.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,f.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,f.jsx)(l.ShieldCheck,{className:`h-12 w-12 mx-auto mb-3 text-green-500 opacity-50`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`No threats detected`})]}):e.map((r,i)=>{let a=JB[r.severity];return(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-full bg-muted text-sm font-medium`,children:i+1}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium truncate`,children:r.name}),(0,f.jsx)(n.x,{variant:`outline`,className:t.t(`text-xs capitalize`,a.color),children:r.severity})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:t.t(`h-full rounded-full`,a.bgColor),style:{width:`${Math.min(r.count/Math.max(...e.map(e=>e.count))*100,100)}%`}})}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium min-w-12 text-right`,children:[r.count,` `,r.count===1?`time`:`times`]})]})]})]},r.name)})})})]})}function iV({serviceHealth:e=`healthy`,clamavVersion:n=`1.0.3`,signatureCount:i=8642758,lastSignatureUpdate:a,scansToday:o=0,threatsDetected:s=0,quarantinedFiles:c=0,detectionRate:u=0,recentScans:d=[],weeklyStats:p=[],topThreats:m=[],onStartScan:h,onViewQuarantine:g,className:_}){return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,_),children:[(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between items-start`,children:[(0,f.jsx)(`div`,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10`,children:(0,f.jsx)(l.Shield,{className:`h-6 w-6 text-primary`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Antivirus ClamAV`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` • `,i.toLocaleString(),` signatures`,a&&(0,f.jsxs)(f.Fragment,{children:[` • Updated `,ZB(a)]})]})]})]})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(QB,{health:e}),g&&(0,f.jsxs)(r.r,{variant:`outline`,onClick:g,children:[(0,f.jsx)(l.Archive,{className:`h-4 w-4 mr-2`}),`Quarantine`]}),h&&(0,f.jsxs)(r.r,{onClick:h,children:[(0,f.jsx)(l.PlayCircle,{className:`h-4 w-4 mr-2`}),`Start Scan`]})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(eV,{title:`Scans Today`,value:o.toLocaleString(),icon:(0,f.jsx)(l.Activity,{className:`h-6 w-6`}),color:`text-blue-500`}),(0,f.jsx)(eV,{title:`Threats Detected`,value:s.toLocaleString(),icon:(0,f.jsx)(l.AlertTriangle,{className:`h-6 w-6`}),color:`text-red-500`}),(0,f.jsx)(eV,{title:`Quarantined Files`,value:c.toLocaleString(),icon:(0,f.jsx)(l.Archive,{className:`h-6 w-6`}),color:`text-orange-500`}),(0,f.jsx)(eV,{title:`Detection Rate`,value:`${u.toFixed(1)}%`,icon:(0,f.jsx)(l.ShieldCheck,{className:`h-6 w-6`}),color:`text-green-500`})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,f.jsx)(tV,{stats:p}),(0,f.jsx)(rV,{threats:m})]}),(0,f.jsx)(nV,{scans:d})]})}var aV=[{id:`scan1`,filename:`document.pdf`,result:`clean`,scanDate:new Date(Date.now()-5*6e4),duration:234,fileSize:2048576,userId:`user123`},{id:`scan2`,filename:`malicious_script.js`,result:`infected`,threatName:`Trojan.GenericKD.67890123`,scanDate:new Date(Date.now()-15*6e4),duration:156,fileSize:45678,userId:`user456`},{id:`scan3`,filename:`eicar_test.txt`,result:`infected`,threatName:`Eicar-Test-Signature`,scanDate:new Date(Date.now()-30*6e4),duration:89,fileSize:68,userId:`admin`},{id:`scan4`,filename:`report_2024.xlsx`,result:`clean`,scanDate:new Date(Date.now()-45*6e4),duration:567,fileSize:5242880,userId:`user789`},{id:`scan5`,filename:`suspicious_archive.zip`,result:`infected`,threatName:`Win.Trojan.Genome-9999999`,scanDate:new Date(Date.now()-60*6e4),duration:1234,fileSize:10485760,userId:`user321`}],oV=[{day:`Mon`,scans:145,threats:3},{day:`Tue`,scans:198,threats:5},{day:`Wed`,scans:167,threats:2},{day:`Thu`,scans:223,threats:8},{day:`Fri`,scans:189,threats:4},{day:`Sat`,scans:98,threats:1},{day:`Sun`,scans:76,threats:0}],sV=[{name:`Eicar-Test-Signature`,count:12,severity:`low`},{name:`Trojan.GenericKD.67890123`,count:8,severity:`high`},{name:`Win.Trojan.Genome-9999999`,count:5,severity:`critical`},{name:`JS.Downloader.Nemucod`,count:4,severity:`medium`},{name:`PHP.Webshell.Generic`,count:3,severity:`high`}],cV=e=>{if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**+r*100)/100+` `+n[r]},lV=e=>{switch(e){case`pending`:return(0,f.jsx)(l.Shield,{className:`h-4 w-4 text-muted-foreground`});case`scanning`:return(0,f.jsx)(l.Scan,{className:`h-4 w-4 text-blue-500 animate-pulse`});case`clean`:return(0,f.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500`});case`infected`:return(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 text-red-500`});case`error`:return(0,f.jsx)(l.AlertCircle,{className:`h-4 w-4 text-orange-500`})}},uV=e=>{switch(e){case`pending`:return(0,f.jsx)(n.x,{variant:`outline`,children:`En attente`});case`scanning`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:`Scan en cours`});case`clean`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-green-500 text-green-500`,children:`Sain`});case`infected`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Infecté`});case`error`:return(0,f.jsx)(n.x,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:`Erreur`})}};function dV({files:e=[],maxFileSize:i=100*1024*1024,acceptedTypes:a=[`*/*`],maxConcurrentScans:o=3,onFilesAdded:c,onScanStart:u,onScanComplete:d,onFileRemove:p,onScanAll:m,className:h}){let[g,_]=(0,s.useState)(!1),v=(0,s.useRef)(null),y=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!0)},[]),b=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1)},[]),x=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1);let t=Array.from(e.dataTransfer.files);c&&c(t)},[c]),S=(0,s.useCallback)(e=>{let t=e.target.files?Array.from(e.target.files):[];c&&c(t)},[c]),C=()=>{v.current?.click()},w=e.filter(e=>e.status===`pending`).length,T=e.filter(e=>e.status===`scanning`).length,E=e.filter(e=>e.status===`clean`).length,D=e.filter(e=>e.status===`infected`).length,O=e.filter(e=>e.status===`error`).length;return(0,f.jsxs)(Y,{className:t.t(`w-full`,h),children:[(0,f.jsx)(X,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Z,{children:`Scan Antivirus (ClamAV)`}),(0,f.jsx)(Se,{children:`Uploadez vos fichiers pour analyse de sécurité`})]}),e.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.length,` fichier`,e.length>1?`s`:``]}),w>0&&(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:m,className:`gap-2`,children:[(0,f.jsx)(l.Scan,{className:`h-4 w-4`}),`Scanner tout`]}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>e.forEach(e=>p?.(e.id)),children:`Tout supprimer`})]})]})}),(0,f.jsxs)(Q,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{onDragOver:y,onDragLeave:b,onDrop:x,onClick:C,className:t.t(`relative flex min-h-[200px] cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 transition-colors`,g?`border-primary bg-primary/5`:`border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50`),children:[(0,f.jsx)(l.Upload,{className:`h-10 w-10 text-muted-foreground`}),(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium`,children:`Glissez vos fichiers ici ou cliquez pour parcourir`}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Taille max: `,cV(i)]})]}),(0,f.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:a.join(`,`),onChange:S,className:`hidden`})]}),e.length>0&&(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-green-500 text-green-500`,children:[(0,f.jsx)(l.CheckCircle2,{className:`mr-1 h-3 w-3`}),E,` sain`,E>1?`s`:``]}),D>0&&(0,f.jsxs)(n.x,{variant:`destructive`,children:[(0,f.jsx)(l.ShieldAlert,{className:`mr-1 h-3 w-3`}),D,` infecté`,D>1?`s`:``]}),T>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:[(0,f.jsx)(l.Scan,{className:`mr-1 h-3 w-3`}),T,` en cours`]}),w>0&&(0,f.jsxs)(n.x,{variant:`outline`,children:[(0,f.jsx)(l.Shield,{className:`mr-1 h-3 w-3`}),w,` en attente`]}),O>0&&(0,f.jsxs)(n.x,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:[(0,f.jsx)(l.AlertCircle,{className:`mr-1 h-3 w-3`}),O,` erreur`,O>1?`s`:``]})]}),e.length>0&&(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsx)(`div`,{className:t.t(`rounded-lg border p-4 transition-colors`,e.status===`infected`&&`border-red-500/50 bg-red-50/50 dark:bg-red-950/20`,e.status===`clean`&&`border-green-500/50 bg-green-50/50 dark:bg-green-950/20`),children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex flex-1 items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`mt-1`,children:lV(e.status)}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-medium text-sm`,children:e.file.name}),uV(e.status)]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[cV(e.file.size),e.scanDuration&&(0,f.jsxs)(f.Fragment,{children:[` • Scanné en `,e.scanDuration,`ms`]})]}),e.status===`scanning`&&(0,f.jsxs)(`div`,{className:`mt-2`,children:[(0,f.jsx)(Zn,{value:e.progress,className:`h-1.5`}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Scan en cours... `,e.progress,`%`]})]}),e.status===`infected`&&e.threatName&&(0,f.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-red-100 px-2 py-1 dark:bg-red-950/50`,children:[(0,f.jsx)(l.ShieldAlert,{className:`h-3 w-3 text-red-600 dark:text-red-400`}),(0,f.jsxs)(`span`,{className:`text-xs font-medium text-red-600 dark:text-red-400`,children:[`Menace détectée: `,e.threatName]})]}),e.status===`clean`&&e.scannedAt&&(0,f.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,f.jsx)(l.CheckCircle2,{className:`h-3 w-3 text-green-600 dark:text-green-400`}),(0,f.jsx)(`span`,{className:`text-xs text-green-600 dark:text-green-400`,children:`Fichier sain, aucune menace détectée`})]})]})]}),(0,f.jsx)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>p?.(e.id),className:`h-8 w-8 p-0`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]})},e.id))})]})]})}var fV={critical:{label:`Critique`,color:`bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20`},high:{label:`Élevée`,color:`bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20`},medium:{label:`Moyenne`,color:`bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20`},low:{label:`Faible`,color:`bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20`}},pV=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,mV=e=>new Intl.DateTimeFormat(`fr-FR`,{dateStyle:`short`,timeStyle:`short`}).format(e),hV=({files:e=[],totalCount:i=0,onDelete:a,onRestore:o,onRescan:c,onPurgeAll:u,onDownloadReport:d,className:p})=>{let[m,h]=s.useState(``),[g,_]=s.useState(`all`),[v,y]=s.useState(`all`),[b,x]=s.useState(!1),[S,C]=s.useState(!1),[w,T]=s.useState(!1),[E,D]=s.useState(null),O=s.useMemo(()=>{let t=e;if(m){let e=m.toLowerCase();t=t.filter(t=>t.originalName.toLowerCase().includes(e)||t.threatName.toLowerCase().includes(e)||t.originalPath.toLowerCase().includes(e))}if(g!==`all`&&(t=t.filter(e=>e.severity===g)),v!==`all`){let e=new Date,n=new Date;switch(v){case`today`:n.setHours(0,0,0,0);break;case`week`:n.setDate(e.getDate()-7);break;case`month`:n.setMonth(e.getMonth()-1);break}v!==`all`&&(t=t.filter(e=>new Date(e.quarantinedAt)>=n))}return t},[e,m,g,v]),k=s.useMemo(()=>{let t={critical:0,high:0,medium:0,low:0};return e.forEach(e=>{t[e.severity]++}),t},[e]),A=e=>{D(e),x(!0)},j=e=>{D(e),C(!0)};return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight`,children:`Quarantaine`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[i||e.length,` fichier`,(i||e.length)>1?`s`:``,` en quarantaine`]})]}),(0,f.jsxs)(r.r,{variant:`destructive`,onClick:()=>T(!0),disabled:e.length===0,children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-4 w-4`}),`Vider la quarantaine`]})]}),(0,f.jsx)(`div`,{className:`grid gap-4 md:grid-cols-4`,children:[`critical`,`high`,`medium`,`low`].map(e=>(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:fV[e].label}),(0,f.jsx)(`p`,{className:`text-2xl font-bold`,children:k[e]})]}),(0,f.jsx)(l.AlertTriangle,{className:t.t(`h-5 w-5`,e===`critical`&&`text-red-500`,e===`high`&&`text-orange-500`,e===`medium`&&`text-yellow-500`,e===`low`&&`text-blue-500`)})]})},e))}),(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher par nom, menace ou chemin...`,value:m,onChange:e=>h(e.target.value),className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:g,onValueChange:e=>_(e),children:[(0,f.jsx)(`option`,{value:`all`,children:`Toutes les sévérités`}),(0,f.jsx)(`option`,{value:`critical`,children:`Critique`}),(0,f.jsx)(`option`,{value:`high`,children:`Élevée`}),(0,f.jsx)(`option`,{value:`medium`,children:`Moyenne`}),(0,f.jsx)(`option`,{value:`low`,children:`Faible`})]}),(0,f.jsxs)(n.d,{value:v,onValueChange:y,children:[(0,f.jsx)(`option`,{value:`all`,children:`Toutes les dates`}),(0,f.jsx)(`option`,{value:`today`,children:`Aujourd'hui`}),(0,f.jsx)(`option`,{value:`week`,children:`7 derniers jours`}),(0,f.jsx)(`option`,{value:`month`,children:`30 derniers jours`})]})]})}),(0,f.jsx)(Y,{children:(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`p-4`,children:O.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,f.jsx)(l.AlertTriangle,{className:`mb-4 h-12 w-12 text-muted-foreground`}),(0,f.jsx)(`h3`,{className:`mb-1 text-lg font-semibold`,children:`Aucun fichier trouvé`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.length===0?`La quarantaine est vide`:`Aucun fichier ne correspond aux filtres`})]}):(0,f.jsx)(`div`,{className:`space-y-4`,children:O.map(e=>(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-medium`,children:e.originalName}),(0,f.jsx)(n.x,{className:fV[e.severity].color,children:fV[e.severity].label})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.originalPath})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm md:grid-cols-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Menace détectée:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.threatName})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Date quarantaine:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:mV(e.quarantinedAt)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Taille:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:pV(e.fileSize)})]}),e.uploadedBy&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Uploadé par:`}),` `,(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.uploadedBy})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Hash:`}),` `,(0,f.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[e.fileHash.substring(0,16),`...`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:`Moteur:`}),` `,(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.scanEngine,` (`,e.signatureVersion,`)`]})]})]}),(0,f.jsxs)(`div`,{className:`flex gap-2 border-t pt-3`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>c?.(e.id),children:[(0,f.jsx)(l.RefreshCw,{className:`mr-2 h-3 w-3`}),`Re-scanner`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>j(e),children:[(0,f.jsx)(l.RotateCcw,{className:`mr-2 h-3 w-3`}),`Restaurer`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>d?.(e.id),children:[(0,f.jsx)(l.Download,{className:`mr-2 h-3 w-3`}),`Rapport`]}),(0,f.jsxs)(r.r,{variant:`destructive`,size:`sm`,onClick:()=>A(e),children:[(0,f.jsx)(l.Trash2,{className:`mr-2 h-3 w-3`}),`Supprimer`]})]})]})},e.id))})})})}),(0,f.jsx)(gt,{open:b,onOpenChange:x,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Supprimer définitivement`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir supprimer définitivement le fichier`,` `,(0,f.jsx)(`span`,{className:`font-medium`,children:E?.originalName}),` ?`,(0,f.jsx)(`br`,{}),`Cette action est irréversible.`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>x(!1),children:`Annuler`}),(0,f.jsx)(r.r,{variant:`destructive`,onClick:()=>{E&&a&&a(E.id),x(!1),D(null)},children:`Supprimer`})]})]})}),(0,f.jsx)(gt,{open:S,onOpenChange:C,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Restaurer le fichier`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir restaurer le fichier`,` `,(0,f.jsx)(`span`,{className:`font-medium`,children:E?.originalName}),` ?`,(0,f.jsx)(`br`,{}),`Le fichier sera replacé à son emplacement d'origine :`,` `,(0,f.jsx)(`span`,{className:`font-mono text-xs`,children:E?.originalPath})]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>C(!1),children:`Annuler`}),(0,f.jsx)(r.r,{onClick:()=>{E&&o&&o(E.id),C(!1),D(null)},children:`Restaurer`})]})]})}),(0,f.jsx)(gt,{open:w,onOpenChange:T,children:(0,f.jsxs)(xt,{children:[(0,f.jsxs)(St,{children:[(0,f.jsx)(wt,{children:`Vider la quarantaine`}),(0,f.jsxs)(Tt,{children:[`Êtes-vous sûr de vouloir supprimer définitivement tous les fichiers en quarantaine ?`,(0,f.jsx)(`br`,{}),e.length,` fichier`,e.length>1?`s`:``,` ser`,e.length>1?`ont`:`a`,` `,`supprimé`,e.length>1?`s`:``,`. Cette action est irréversible.`]})]}),(0,f.jsxs)(Ct,{children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:()=>T(!1),children:`Annuler`}),(0,f.jsx)(r.r,{variant:`destructive`,onClick:()=>{u&&u(),T(!1)},children:`Vider la quarantaine`})]})]})})]})},gV=[];function _V({entries:e=gV,totalEntries:i=e.length,currentPage:a=1,pageSize:o=10,periodFilter:c=`7d`,onPageChange:u,onFilterChange:d,onExport:p,className:m}){let[h,g]=(0,s.useState)(``),[_,v]=(0,s.useState)(`all`),[y,b]=(0,s.useState)(c),[x,S]=(0,s.useState)(`all`),[C,w]=(0,s.useState)(null),T=e.filter(e=>!(h&&!e.filename.toLowerCase().includes(h.toLowerCase())||_!==`all`&&e.result!==_||x!==`all`&&e.userId!==x)),E=T.slice((a-1)*o,a*o),D=Math.ceil(T.length/o),O={total:T.length,clean:T.filter(e=>e.result===`clean`).length,infected:T.filter(e=>e.result===`infected`).length,errors:T.filter(e=>e.result===`error`).length},k=Array.from(new Set(e.map(e=>e.userId))),A=e=>{navigator.clipboard.writeText(e),w(e),setTimeout(()=>w(null),2e3)},j=(e,t)=>{d?.({search:h,result:_,period:y,user:x,[e]:t})},M=e=>{switch(e){case`clean`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Clean`});case`infected`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Infected`});case`error`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Error`})}},N=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`,P=e=>new Intl.DateTimeFormat(`fr-FR`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e),F=e=>`${e.slice(0,8)}...${e.slice(-8)}`;return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Historique des scans`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:[i,` scan`,i>1?`s`:``,` au total`]})]}),(0,f.jsxs)(r.r,{onClick:p,variant:`outline`,children:[(0,f.jsx)(l.Download,{className:`w-4 h-4 mr-2`}),`Exporter le journal`]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Total scans`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1`,children:O.total})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Clean`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-green-600 dark:text-green-500`,children:O.clean})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Infected`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-red-600 dark:text-red-500`,children:O.infected})]}),(0,f.jsxs)(Y,{className:`p-4`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Errors`}),(0,f.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-orange-600 dark:text-orange-500`,children:O.errors})]})]}),(0,f.jsx)(Y,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(l.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground`}),(0,f.jsx)(r.n,{placeholder:`Rechercher un fichier...`,value:h,onChange:e=>{g(e.target.value),j(`search`,e.target.value)},className:`pl-9`})]}),(0,f.jsxs)(n.d,{value:_,onValueChange:e=>{v(e),j(`result`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Résultat`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les résultats`}),(0,f.jsx)(n.m,{value:`clean`,children:`Clean`}),(0,f.jsx)(n.m,{value:`infected`,children:`Infected`}),(0,f.jsx)(n.m,{value:`error`,children:`Error`})]})]}),(0,f.jsxs)(n.d,{value:y,onValueChange:e=>{b(e),j(`period`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Période`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`today`,children:`Aujourd'hui`}),(0,f.jsx)(n.m,{value:`7d`,children:`7 derniers jours`}),(0,f.jsx)(n.m,{value:`30d`,children:`30 derniers jours`}),(0,f.jsx)(n.m,{value:`custom`,children:`Personnalisé`})]})]}),(0,f.jsxs)(n.d,{value:x,onValueChange:e=>{S(e),j(`user`,e)},children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{placeholder:`Utilisateur`})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`all`,children:`Tous les utilisateurs`}),k.map(t=>(0,f.jsx)(n.m,{value:t,children:e.find(e=>e.userId===t)?.userName||t},t))]})]})]})}),(0,f.jsxs)(Y,{children:[(0,f.jsx)(er,{className:`h-[600px]`,children:(0,f.jsx)(`div`,{className:`min-w-full`,children:(0,f.jsxs)(`table`,{className:`w-full`,children:[(0,f.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur-sm border-b`,children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Date/Heure`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Fichier`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Taille`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Hash SHA256`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Résultat`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Menace`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Utilisateur`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Durée`}),(0,f.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Moteur`})]})}),(0,f.jsx)(`tbody`,{className:`divide-y`,children:E.length===0?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{colSpan:9,className:`px-4 py-8 text-center text-muted-foreground`,children:`Aucun scan trouvé`})}):E.map(e=>(0,f.jsxs)(`tr`,{className:`hover:bg-muted/50 transition-colors`,children:[(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:P(e.scanDate)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm font-medium max-w-xs truncate`,children:e.filename}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:N(e.fileSize)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`code`,{className:`text-xs bg-muted px-2 py-1 rounded`,children:F(e.fileHash)}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>A(e.fileHash),className:`h-6 w-6 p-0`,children:C===e.fileHash?(0,f.jsx)(l.Check,{className:`w-3 h-3 text-green-600`}):(0,f.jsx)(l.Copy,{className:`w-3 h-3`})})]})}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:M(e.result)}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:e.threatName?(0,f.jsx)(`code`,{className:`text-xs bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-400 px-2 py-1 rounded`,children:e.threatName}):(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:e.userName}),(0,f.jsxs)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:[e.duration,`ms`]}),(0,f.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:(0,f.jsxs)(`div`,{className:`text-xs`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.engineVersion}),(0,f.jsx)(`div`,{className:`text-muted-foreground`,children:e.signatureVersion})]})})]},e.id))})]})})}),D>1&&(0,f.jsxs)(`div`,{className:`border-t px-4 py-3 flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Page `,a,` sur `,D]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u?.(a-1),disabled:a===1,children:`Précédent`}),(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u?.(a+1),disabled:a===D,children:`Suivant`})]})]})]})]})}var vV=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},yV=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5),i=Math.floor(t/864e5);return n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`},bV={running:{color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/20`,icon:l.CheckCircle,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/20`,icon:l.Activity,label:`Stopped`},error:{color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/20`,icon:l.AlertTriangle,label:`Error`},restarting:{color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,borderColor:`border-yellow-500/20`,icon:l.Loader2,label:`Restarting`}},xV={running:{color:`text-green-500`,label:`Running`},stopped:{color:`text-gray-500`,label:`Stopped`},error:{color:`text-red-500`,label:`Error`},updating:{color:`text-blue-500`,label:`Updating`}},SV={up:`bg-green-500`,degraded:`bg-yellow-500`,down:`bg-red-500`},CV=({status:e=`running`,version:i=`1.0.3`,uptime:a=259200,metrics:o={cpuUsage:2.5,memoryUsage:512,threads:4,scanQueue:0,activeConnections:3},signatures:s={version:`27456`,count:8764532,lastUpdate:new Date(Date.now()-36e5),freshclamStatus:`running`,nextScheduledUpdate:new Date(Date.now()+36e5)},socketType:c=`tcp`,socketPath:u=`3310`,uptimeHistory:d=[],onRestart:p,onUpdateSignatures:m,onViewLogs:h,className:g})=>{let _=bV[e],v=_.icon;return(0,f.jsxs)(`div`,{className:t.t(`space-y-4`,g),children:[(0,f.jsx)(Y,{className:t.t(`p-6 border-2`,_.borderColor,_.bgColor),children:(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.t(`p-3 rounded-xl`,_.bgColor),children:(0,f.jsx)(v,{className:t.t(`w-8 h-8`,_.color,e===`restarting`&&`animate-spin`)})}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h3`,{className:`text-2xl font-semibold`,children:`ClamAV Daemon`}),(0,f.jsx)(n.x,{variant:e===`error`?`destructive`:`secondary`,className:e===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:_.label})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,f.jsxs)(`span`,{children:[`Version `,i]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(l.Clock,{className:`w-3.5 h-3.5`}),`Uptime: `,vV(a)]})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:h,children:[(0,f.jsx)(l.Terminal,{className:`w-4 h-4 mr-2`}),`Logs`]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:p,disabled:e===`restarting`,children:[(0,f.jsx)(l.RefreshCw,{className:t.t(`w-4 h-4 mr-2`,e===`restarting`&&`animate-spin`)}),`Restart`]})]})]})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.Activity,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`System Metrics`})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`CPU Usage`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[o.cpuUsage.toFixed(1),`%`]})]}),(0,f.jsx)(Zn,{value:o.cpuUsage,className:t.t(`h-2`,o.cpuUsage>80&&`bg-red-500/20`,o.cpuUsage>50&&o.cpuUsage<=80&&`bg-yellow-500/20`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Memory Usage`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[o.memoryUsage,` MB`]})]}),(0,f.jsx)(Zn,{value:o.memoryUsage/1024*100,className:t.t(`h-2`,o.memoryUsage>800&&`bg-red-500/20`,o.memoryUsage>600&&o.memoryUsage<=800&&`bg-yellow-500/20`)})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 pt-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Threads`}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.threads})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Scan Queue`}),(0,f.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.scanQueue})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Connections`}),(0,f.jsxs)(`div`,{className:`text-2xl font-semibold flex items-center gap-1`,children:[o.activeConnections,(0,f.jsx)(l.Wifi,{className:`w-4 h-4 text-muted-foreground`})]})]})]})]})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Database,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Signature Database`})]}),(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:m,children:[(0,f.jsx)(l.RefreshCw,{className:`w-4 h-4 mr-2`}),`Update`]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Version`}),(0,f.jsx)(`div`,{className:`text-lg font-semibold`,children:s.version})]}),(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Signatures`}),(0,f.jsx)(`div`,{className:`text-lg font-semibold`,children:s.count.toLocaleString()})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2 pt-2 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Updated`}),(0,f.jsx)(`span`,{className:`font-medium`,children:yV(s.lastUpdate)})]}),s.nextScheduledUpdate&&(0,f.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Next Update`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[`in `,yV(new Date(Date.now()-(Date.now()-s.nextScheduledUpdate.getTime())))]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Freshclam Status`}),(0,f.jsx)(n.x,{variant:s.freshclamStatus===`error`?`destructive`:s.freshclamStatus===`updating`?`default`:`secondary`,className:s.freshclamStatus===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:(0,f.jsx)(`span`,{className:t.t(xV[s.freshclamStatus].color),children:xV[s.freshclamStatus].label})})]})]})]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.Wifi,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Connection`})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Socket Type`}),(0,f.jsx)(n.x,{variant:`outline`,children:c.toUpperCase()})]}),(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:c===`tcp`?`Port`:`Path`}),(0,f.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:u})]}),(0,f.jsxs)(`div`,{className:`flex justify-between pt-2 border-t`,children:[(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,f.jsx)(`span`,{className:`text-lg font-semibold`,children:o.activeConnections})]})]})]}),(0,f.jsxs)(Y,{className:`p-6 lg:col-span-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(l.HardDrive,{className:`w-5 h-5 text-primary`}),(0,f.jsx)(`h4`,{className:`font-semibold`,children:`Uptime History (Last 7 Days)`})]}),d.length>0?(0,f.jsx)(`div`,{className:`flex items-end justify-between gap-1 h-20`,children:d.map((e,n)=>(0,f.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1`,children:[(0,f.jsx)(`div`,{className:t.t(`w-full rounded-t transition-all`,SV[e.status],e.status===`up`&&`h-full`,e.status===`degraded`&&`h-3/4`,e.status===`down`&&`h-1/4`)}),(0,f.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.hour})]},n))}):(0,f.jsx)(`div`,{className:`h-20 flex items-center justify-center text-sm text-muted-foreground`,children:`No uptime history available`}),(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mt-4 pt-4 border-t`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-green-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-yellow-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Degraded`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`div`,{className:`w-3 h-3 rounded bg-red-500`}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Down`})]})]})]})]})]})},wV=[{name:`main.cvd`,version:`62`,signatureCount:6647427,size:162.5*1024*1024,lastUpdated:new Date(`2024-12-15T10:30:00`),buildTime:new Date(`2024-12-15T08:00:00`)},{name:`daily.cvd`,version:`27458`,signatureCount:2145789,size:89.3*1024*1024,lastUpdated:new Date(`2025-01-15T14:20:00`),buildTime:new Date(`2025-01-15T12:00:00`)},{name:`bytecode.cvd`,version:`334`,signatureCount:52438,size:2.8*1024*1024,lastUpdated:new Date(`2025-01-10T09:15:00`),buildTime:new Date(`2025-01-10T06:00:00`)}],TV=[{id:`upd-1`,date:new Date(`2025-01-15T14:20:00`),fromVersion:`27457`,toVersion:`27458`,newSignatures:1247,removedSignatures:89,duration:45,status:`success`,source:`daily.cvd`},{id:`upd-2`,date:new Date(`2025-01-14T14:15:00`),fromVersion:`27456`,toVersion:`27457`,newSignatures:2134,removedSignatures:156,duration:52,status:`success`,source:`daily.cvd`},{id:`upd-3`,date:new Date(`2025-01-13T14:10:00`),fromVersion:`27455`,toVersion:`27456`,newSignatures:1876,removedSignatures:203,duration:48,status:`success`,source:`daily.cvd`},{id:`upd-4`,date:new Date(`2025-01-12T14:05:00`),fromVersion:`27454`,toVersion:`27455`,newSignatures:0,removedSignatures:0,duration:12,status:`failed`,source:`daily.cvd`},{id:`upd-5`,date:new Date(`2025-01-11T14:00:00`),fromVersion:`27453`,toVersion:`27454`,newSignatures:3245,removedSignatures:178,duration:67,status:`success`,source:`daily.cvd`}],EV={updateFrequency:24,mirror:`database.clamav.net`,lastCheck:new Date(`2025-01-15T14:20:00`),checksToday:12,proxyEnabled:!1},DV=e=>e<1024?e+` B`:e<1024*1024?(e/1024).toFixed(2)+` KB`:(e/(1024*1024)).toFixed(2)+` MB`,OV=e=>new Intl.DateTimeFormat(`fr-FR`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e),kV=e=>new Intl.NumberFormat(`fr-FR`).format(e),AV=e=>{switch(e){case`success`:return(0,f.jsx)(l.CheckCircle2,{className:`size-4 text-green-600 dark:text-green-400`});case`failed`:return(0,f.jsx)(l.XCircle,{className:`size-4 text-red-600 dark:text-red-400`});case`in_progress`:return(0,f.jsx)(l.Loader2,{className:`size-4 text-blue-600 dark:text-blue-400 animate-spin`});case`scheduled`:return(0,f.jsx)(l.Clock,{className:`size-4 text-amber-600 dark:text-amber-400`})}},jV=e=>{switch(e){case`success`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Réussie`});case`failed`:return(0,f.jsx)(n.x,{variant:`destructive`,children:`Échouée`});case`in_progress`:return(0,f.jsx)(n.x,{variant:`default`,children:`En cours`});case`scheduled`:return(0,f.jsx)(n.x,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Planifiée`})}};function MV({databases:e=wV,updates:i=TV,freshclamConfig:a=EV,totalSignatures:o=e.reduce((e,t)=>e+t.signatureCount,0),isUpdating:s=!1,onUpdateNow:c,onScheduleUpdate:u,onViewChangelog:d,className:p}){let m=i[0];return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,p),children:[(0,f.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Version DB`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:m?.toVersion||`N/A`})]}),(0,f.jsx)(l.Database,{className:`size-8 text-blue-600 dark:text-blue-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Total Signatures`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:kV(o)})]}),(0,f.jsx)(l.FileText,{className:`size-8 text-purple-600 dark:text-purple-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Dernière MAJ`}),(0,f.jsx)(`h3`,{className:`text-sm font-bold`,children:m?OV(m.date):`N/A`})]}),(0,f.jsx)(l.Clock,{className:`size-8 text-green-600 dark:text-green-400`})]})}),(0,f.jsx)(Y,{className:`p-6`,children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Taille Totale`}),(0,f.jsx)(`h3`,{className:`text-2xl font-bold`,children:DV(e.reduce((e,t)=>e+t.size,0))})]}),(0,f.jsx)(l.HardDrive,{className:`size-8 text-amber-600 dark:text-amber-400`})]})})]}),(0,f.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Bases de données`}),(0,f.jsxs)(n.x,{variant:`outline`,children:[e.length,` bases`]})]}),(0,f.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 p-4 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.Database,{className:`size-4 text-muted-foreground`}),(0,f.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[`v`,e.version]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Signatures`}),(0,f.jsx)(`p`,{className:`font-medium`,children:kV(e.signatureCount)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Taille`}),(0,f.jsx)(`p`,{className:`font-medium`,children:DV(e.size)})]}),(0,f.jsxs)(`div`,{className:`col-span-2`,children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Dernière mise à jour`}),(0,f.jsx)(`p`,{className:`font-medium`,children:OV(e.lastUpdated)})]})]})]},e.name))})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Configuration Freshclam`}),(0,f.jsxs)(r.r,{size:`sm`,variant:`outline`,onClick:()=>u?.(a.updateFrequency),children:[(0,f.jsx)(l.Calendar,{className:`mr-2 size-4`}),`Planifier`]})]}),(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Fréquence de MAJ`}),(0,f.jsxs)(`p`,{className:`text-lg font-semibold`,children:[`Toutes les `,a.updateFrequency,`h`]})]}),(0,f.jsx)(l.Clock,{className:`size-6 text-blue-600 dark:text-blue-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mirror utilisé`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:a.mirror})]}),(0,f.jsx)(l.Globe,{className:`size-6 text-purple-600 dark:text-purple-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Dernier check`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:OV(a.lastCheck)})]}),(0,f.jsx)(l.RefreshCw,{className:`size-6 text-green-600 dark:text-green-400`})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checks aujourd'hui`}),(0,f.jsx)(`p`,{className:`text-lg font-semibold`,children:a.checksToday})]}),(0,f.jsx)(l.AlertCircle,{className:`size-6 text-amber-600 dark:text-amber-400`})]}),a.proxyEnabled&&(0,f.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50 p-3`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-amber-800 dark:text-amber-200`,children:[(0,f.jsx)(l.AlertCircle,{className:`size-4`}),(0,f.jsx)(`span`,{children:`Proxy activé`})]})}),(0,f.jsx)(r.r,{className:`w-full`,onClick:c,disabled:s,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Loader2,{className:`mr-2 size-4 animate-spin`}),`Mise à jour en cours...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.Download,{className:`mr-2 size-4`}),`Mettre à jour maintenant`]})})]})]})]}),(0,f.jsxs)(Y,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Historique des mises à jour`}),(0,f.jsxs)(n.x,{variant:`outline`,children:[i.length,` mises à jour`]})]}),(0,f.jsx)(er,{className:`h-[400px]`,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:i.map((e,t)=>(0,f.jsxs)(`div`,{className:`relative rounded-lg border border-border bg-muted/50 p-4`,children:[t<i.length-1&&(0,f.jsx)(`div`,{className:`absolute left-6 top-12 h-full w-px bg-border`}),(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border border-border bg-background`,children:AV(e.status)}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[e.source,` - v`,e.fromVersion,` → v`,e.toVersion]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:OV(e.date)})]}),jV(e.status)]}),e.status===`success`&&(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Ajoutées`}),(0,f.jsxs)(`p`,{className:`font-medium text-green-600 dark:text-green-400`,children:[`+`,kV(e.newSignatures)]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Supprimées`}),(0,f.jsxs)(`p`,{className:`font-medium text-red-600 dark:text-red-400`,children:[`-`,kV(e.removedSignatures)]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Durée`}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[e.duration,`s`]})]})]}),e.status===`failed`&&(0,f.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/50 p-2`,children:(0,f.jsx)(`p`,{className:`text-sm text-red-800 dark:text-red-200`,children:`Échec de la mise à jour`})}),(0,f.jsxs)(r.r,{size:`sm`,variant:`ghost`,onClick:()=>d?.(e.id),children:[(0,f.jsx)(l.FileText,{className:`mr-2 size-3`}),`Voir le changelog`]})]})]})]},e.id))})})]})]})}var NV={autoScanOnUpload:!0,maxFileSize:100,maxFileSizeUnit:`MB`,scanTimeout:120,maxConcurrentScans:4,scanArchives:!0,maxArchiveDepth:3,excludedExtensions:[`.log`,`.tmp`,`.lock`],excludedPaths:[`/tmp`,`/var/cache`],whitelistedHashes:[],detectionAction:`quarantine`,notifyAdmin:!0,notifyUser:!0,auditLog:!0},PV=[{value:`quarantine`,label:`Quarantaine`},{value:`delete`,label:`Suppression`},{value:`notify_only`,label:`Notification seule`},{value:`block_and_notify`,label:`Bloquer + notifier`}],FV=[{value:`MB`,label:`MB`},{value:`GB`,label:`GB`}];function IV({policy:e=NV,isLoading:a=!1,onSave:o,onCancel:c,onResetDefaults:u,className:d}){let[p,m]=(0,s.useState)(e),[h,g]=(0,s.useState)(``),[_,v]=(0,s.useState)(``),[y,b]=(0,s.useState)(``),x=e=>{m(t=>({...t,...e}))},S=()=>{h.trim()&&!p.excludedExtensions.includes(h.trim())&&(x({excludedExtensions:[...p.excludedExtensions,h.trim()]}),g(``))},C=e=>{x({excludedExtensions:p.excludedExtensions.filter(t=>t!==e)})},w=()=>{_.trim()&&!p.excludedPaths.includes(_.trim())&&(x({excludedPaths:[...p.excludedPaths,_.trim()]}),v(``))},T=e=>{x({excludedPaths:p.excludedPaths.filter(t=>t!==e)})},E=()=>{y.trim()&&!p.whitelistedHashes.includes(y.trim())&&(x({whitelistedHashes:[...p.whitelistedHashes,y.trim()]}),b(``))},D=e=>{x({whitelistedHashes:p.whitelistedHashes.filter(t=>t!==e)})};return(0,f.jsxs)(Y,{className:t.t(`w-full`,d),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 p-6 border-b border-border/50`,children:[(0,f.jsx)(l.Shield,{className:`w-5 h-5 text-primary`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Configuration des politiques de scan`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Definissez les regles de scan antivirus`})]})]}),(0,f.jsxs)(Cr,{defaultValue:`general`,className:`w-full`,children:[(0,f.jsxs)(wr,{className:`w-full justify-start border-b border-border/50 rounded-none px-6`,children:[(0,f.jsx)(Tr,{value:`general`,children:`Regles generales`}),(0,f.jsx)(Tr,{value:`exclusions`,children:`Exclusions`}),(0,f.jsx)(Tr,{value:`actions`,children:`Actions`}),(0,f.jsx)(Tr,{value:`notifications`,children:`Notifications`})]}),(0,f.jsxs)(Er,{value:`general`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Scan automatique a l'upload`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scanner tous les fichiers lors de l'envoi`})]}),(0,f.jsx)(mr,{checked:p.autoScanOnUpload,onCheckedChange:e=>x({autoScanOnUpload:e}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Taille maximale de fichier`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{type:`number`,value:p.maxFileSize,onChange:e=>x({maxFileSize:parseInt(e.target.value)||0}),disabled:a,className:`flex-1`}),(0,f.jsxs)(n.d,{value:p.maxFileSizeUnit,onValueChange:e=>x({maxFileSizeUnit:e}),disabled:a,children:[(0,f.jsx)(n.y,{className:`w-24`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:FV.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Timeout de scan (secondes)`}),(0,f.jsx)(r.n,{type:`number`,value:p.scanTimeout,onChange:e=>x({scanTimeout:parseInt(e.target.value)||0}),disabled:a})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Nombre maximum de scans concurrents`}),(0,f.jsx)(r.n,{type:`number`,value:p.maxConcurrentScans,onChange:e=>x({maxConcurrentScans:parseInt(e.target.value)||1}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Scanner les archives (zip, tar, 7z)`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Analyser le contenu des fichiers archives`})]}),(0,f.jsx)(mr,{checked:p.scanArchives,onCheckedChange:e=>x({scanArchives:e}),disabled:a})]}),p.scanArchives&&(0,f.jsxs)(`div`,{className:`space-y-2 pl-6`,children:[(0,f.jsx)(i.o,{children:`Profondeur maximale d'archives imbriquees`}),(0,f.jsx)(r.n,{type:`number`,value:p.maxArchiveDepth,onChange:e=>x({maxArchiveDepth:parseInt(e.target.value)||1}),disabled:a})]})]}),(0,f.jsxs)(Er,{value:`exclusions`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Extensions exclues`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`.ext`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>e.key===`Enter`&&S(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:S,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.excludedExtensions.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,f.jsx)(`button`,{onClick:()=>C(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Chemins exclus`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`/path/to/exclude`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:w,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.excludedPaths.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,f.jsx)(`button`,{onClick:()=>T(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(i.o,{children:`Hash exclus (whitelist)`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`SHA256 hash`,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>e.key===`Enter`&&E(),disabled:a,className:`flex-1`}),(0,f.jsx)(r.r,{onClick:E,disabled:a,size:`sm`,children:(0,f.jsx)(l.Plus,{className:`w-4 h-4`})})]}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.whitelistedHashes.map(e=>(0,f.jsxs)(n.x,{variant:`secondary`,className:`flex items-center gap-1`,children:[e.substring(0,12),`...`,(0,f.jsx)(`button`,{onClick:()=>D(e),disabled:a,className:`ml-1 hover:text-destructive`,children:(0,f.jsx)(l.X,{className:`w-3 h-3`})})]},e))})]})]}),(0,f.jsxs)(Er,{value:`actions`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{children:`Action sur detection`}),(0,f.jsxs)(n.d,{value:p.detectionAction,onValueChange:e=>x({detectionAction:e}),disabled:a,children:[(0,f.jsx)(n.y,{children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:PV.map(e=>(0,f.jsx)(n.m,{value:e.value,children:e.label},e.value))})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Logger dans l'audit trail`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enregistrer toutes les detections`})]}),(0,f.jsx)(mr,{checked:p.auditLog,onCheckedChange:e=>x({auditLog:e}),disabled:a})]})]}),(0,f.jsxs)(Er,{value:`notifications`,className:`p-6 space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Notifier l'administrateur`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Alerter en cas de menace detectee`})]}),(0,f.jsx)(mr,{checked:p.notifyAdmin,onCheckedChange:e=>x({notifyAdmin:e}),disabled:a})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,f.jsx)(i.o,{children:`Notifier l'utilisateur`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Informer l'utilisateur de l'action prise`})]}),(0,f.jsx)(mr,{checked:p.notifyUser,onCheckedChange:e=>x({notifyUser:e}),disabled:a})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-t border-border/50`,children:[(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>{m(NV),u?.()},disabled:a,children:[(0,f.jsx)(l.RotateCcw,{className:`w-4 h-4 mr-2`}),`Restaurer defauts`]}),(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[(0,f.jsx)(r.r,{variant:`outline`,onClick:c,disabled:a,children:`Annuler`}),(0,f.jsx)(r.r,{onClick:()=>{o?.(p)},disabled:a,children:`Sauvegarder`})]})]})]})}var LV={critical:{icon:l.ShieldAlert,bgColor:`bg-red-950/50 border-red-800`,iconColor:`text-red-400`,badgeVariant:`destructive`},high:{icon:l.AlertTriangle,bgColor:`bg-orange-950/50 border-orange-800`,iconColor:`text-orange-400`,badgeVariant:`destructive`},medium:{icon:l.AlertCircle,bgColor:`bg-yellow-950/50 border-yellow-800`,iconColor:`text-yellow-400`,badgeVariant:`secondary`},low:{icon:l.Info,bgColor:`bg-blue-950/50 border-blue-800`,iconColor:`text-blue-400`,badgeVariant:`default`}},RV={quarantined:`Mis en quarantaine`,deleted:`Supprimé`,blocked:`Bloqué`,allowed:`Autorisé`},zV={quarantined:`text-orange-400`,deleted:`text-red-400`,blocked:`text-red-400`,allowed:`text-green-400`},BV=({alerts:e=[],maxVisible:i=3,autoHideAfter:a=0,onDismiss:o,onDismissAll:c,onViewDetails:u,onViewQuarantine:d,className:p})=>{let[m,h]=(0,s.useState)(new Set),g=e.filter(e=>!e.dismissed);if(g.length===0)return null;let _=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=g.slice(0,i),y=g.length-i,b=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5);return n<1?`À l'instant`:n<60?`Il y a ${n}m`:r<24?`Il y a ${r}h`:e.toLocaleDateString(`fr-FR`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})};return(0,f.jsxs)(`div`,{className:t.t(`space-y-2`,p),children:[g.length>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between bg-red-950/30 border border-red-800/50 rounded-lg px-4 py-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(l.ShieldAlert,{className:`h-4 w-4 text-red-400`}),(0,f.jsxs)(`span`,{className:`text-sm font-medium text-red-200`,children:[g.length,` alerte`,g.length>1?`s`:``,` active`,g.length>1?`s`:``]})]}),c&&(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:c,className:`text-red-300 hover:text-red-200`,children:`Tout ignorer`})]}),v.map(e=>{let i=LV[e.severity],a=i.icon,s=m.has(e.id);return(0,f.jsx)(Y,{className:t.t(`border-2 backdrop-blur-sm transition-all duration-200`,i.bgColor,s&&`shadow-lg`),children:(0,f.jsx)(`div`,{className:`p-4`,children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:t.t(`mt-0.5 flex-shrink-0`,i.iconColor),children:(0,f.jsx)(a,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`h4`,{className:`text-sm font-semibold text-white truncate`,children:e.threatName}),(0,f.jsx)(n.x,{variant:i.badgeVariant,className:`text-xs`,children:e.severity.toUpperCase()})]}),(0,f.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-gray-400`,children:[(0,f.jsx)(`span`,{className:`truncate`,title:e.filePath,children:e.filename}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{className:zV[e.action],children:RV[e.action]}),(0,f.jsx)(`span`,{children:`•`}),(0,f.jsx)(`span`,{children:b(e.detectedAt)})]})]}),(0,f.jsx)(r.r,{variant:`ghost`,size:`sm`,onClick:()=>o?.(e.id),className:`flex-shrink-0 h-8 w-8 p-0 text-gray-400 hover:text-white`,children:(0,f.jsx)(l.X,{className:`h-4 w-4`})})]}),s&&(0,f.jsx)(`div`,{className:`mt-3 pt-3 border-t border-white/10 space-y-2 text-xs text-gray-300`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Chemin complet:`}),(0,f.jsx)(`p`,{className:`font-mono break-all`,children:e.filePath})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Moteur antivirus:`}),(0,f.jsx)(`p`,{className:`font-mono`,children:e.engineVersion})]}),e.userId&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Utilisateur:`}),(0,f.jsx)(`p`,{className:`font-mono`,children:e.userId})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`text-gray-500`,children:`Détecté le:`}),(0,f.jsx)(`p`,{children:e.detectedAt.toLocaleString(`fr-FR`,{dateStyle:`medium`,timeStyle:`short`})})]})]})}),(0,f.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,f.jsx)(r.r,{variant:`outline`,size:`sm`,onClick:()=>_(e.id),className:`text-xs`,children:s?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ChevronUp,{className:`h-3 w-3 mr-1`}),`Masquer`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ChevronDown,{className:`h-3 w-3 mr-1`}),`Détails`]})}),u&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),className:`text-xs`,children:[(0,f.jsx)(l.Eye,{className:`h-3 w-3 mr-1`}),`Analyse complète`]}),e.action===`quarantined`&&d&&(0,f.jsxs)(r.r,{variant:`outline`,size:`sm`,onClick:d,className:`text-xs`,children:[(0,f.jsx)(l.Archive,{className:`h-3 w-3 mr-1`}),`Quarantaine`]})]})]})]})})},e.id)}),y>0&&(0,f.jsx)(`div`,{className:`text-center`,children:(0,f.jsxs)(r.r,{variant:`ghost`,size:`sm`,className:`text-xs text-gray-400 hover:text-white`,children:[`+ `,y,` autre`,y>1?`s`:``,` alerte`,y>1?`s`:``]})})]})},VV=[{id:`1`,threatName:`Trojan.GenericKD.12345678`,filename:`invoice_2024.pdf.exe`,filePath:`/home/user/Downloads/invoice_2024.pdf.exe`,severity:`critical`,action:`quarantined`,detectedAt:new Date(Date.now()-5*6e4),userId:`user@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`2`,threatName:`Malware.Suspicious.Archive`,filename:`files.zip`,filePath:`/var/www/uploads/files.zip`,severity:`high`,action:`blocked`,detectedAt:new Date(Date.now()-15*6e4),engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`3`,threatName:`PUA.Win.Adware.Generic`,filename:`installer.exe`,filePath:`/tmp/installer.exe`,severity:`medium`,action:`deleted`,detectedAt:new Date(Date.now()-36e5),userId:`admin@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1}],HV={startDate:new Date(Date.now()-720*60*60*1e3),endDate:new Date,format:`pdf`,type:`executive_summary`,includeSections:{generalStats:!0,threatDetails:!0,scannedFiles:!0,actionsTaken:!0,recommendations:!0}},UV={totalScans:1247,totalThreats:34,detectionRate:98.5,quarantinedFiles:28,threatsBySeverity:[{severity:`critical`,count:3},{severity:`high`,count:8},{severity:`medium`,count:15},{severity:`low`,count:8}],complianceChecks:[{name:`Antivirus actif`,passed:!0,details:`ClamAV opérationnel`},{name:`Scans automatisés`,passed:!0,details:`Planification quotidienne`},{name:`Quarantaine sécurisée`,passed:!0,details:`Isolation cryptographique`},{name:`Audit trail`,passed:!0,details:`Logs immutables activés`}],weeklyTrend:[{week:`S1`,scans:280,threats:7},{week:`S2`,scans:295,threats:9},{week:`S3`,scans:340,threats:11},{week:`S4`,scans:332,threats:7}]};function WV({config:e,preview:a,isGenerating:o=!1,generationProgress:c=0,onGenerate:u,onSchedule:d,onSendEmail:p,className:m}){let[h,g]=(0,s.useState)({...HV,...e}),[_]=(0,s.useState)(a||UV),[v,y]=(0,s.useState)(``),[b,x]=(0,s.useState)(`config`),S={pdf:(0,f.jsx)(l.FileText,{className:`h-4 w-4`}),csv:(0,f.jsx)(l.FileSpreadsheet,{className:`h-4 w-4`}),json:(0,f.jsx)(l.FileJson,{className:`h-4 w-4`})},C={executive_summary:`Résumé exécutif`,detailed:`Détail complet`,iso27001_compliance:`Conformité ISO27001`,hds_audit:`Audit HDS`},w={critical:`bg-red-500`,high:`bg-orange-500`,medium:`bg-yellow-500`,low:`bg-blue-500`},T=(e,t)=>{g({...h,includeSections:{...h.includeSections,[e]:t}})},E=Math.max(..._.threatsBySeverity.map(e=>e.count)),D=Math.max(..._.weeklyTrend.map(e=>Math.max(e.scans,e.threats)));return(0,f.jsxs)(`div`,{className:t.t(`space-y-6`,m),children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Générateur de rapports`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Créez des rapports de scan personnalisés pour vos audits de sécurité`})]}),(0,f.jsxs)(n.x,{variant:`outline`,className:`gap-1.5`,children:[(0,f.jsx)(l.Shield,{className:`h-3.5 w-3.5`}),`ISO27001 / HDS`]})]}),(0,f.jsxs)(Cr,{value:b,onValueChange:x,children:[(0,f.jsxs)(wr,{children:[(0,f.jsx)(Tr,{value:`config`,children:`Configuration`}),(0,f.jsx)(Tr,{value:`preview`,children:`Aperçu`})]}),(0,f.jsxs)(Er,{value:`config`,className:`space-y-6`,children:[(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Période du rapport`}),(0,f.jsx)(Se,{children:`Sélectionnez la plage de dates à analyser`})]}),(0,f.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`startDate`,children:`Date de début`}),(0,f.jsx)(r.n,{id:`startDate`,type:`date`,value:h.startDate.toISOString().split(`T`)[0],onChange:e=>g({...h,startDate:new Date(e.target.value)})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`endDate`,children:`Date de fin`}),(0,f.jsx)(r.n,{id:`endDate`,type:`date`,value:h.endDate.toISOString().split(`T`)[0],onChange:e=>g({...h,endDate:new Date(e.target.value)})})]})]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Type et format`}),(0,f.jsx)(Se,{children:`Choisissez le type de rapport et le format de sortie`})]}),(0,f.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`reportType`,children:`Type de rapport`}),(0,f.jsxs)(n.d,{value:h.type,onValueChange:e=>g({...h,type:e}),children:[(0,f.jsx)(n.y,{id:`reportType`,children:(0,f.jsx)(n.b,{})}),(0,f.jsx)(n.f,{children:Object.entries(C).map(([e,t])=>(0,f.jsx)(n.m,{value:e,children:t},e))})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(i.o,{htmlFor:`format`,children:`Format de sortie`}),(0,f.jsxs)(n.d,{value:h.format,onValueChange:e=>g({...h,format:e}),children:[(0,f.jsx)(n.y,{id:`format`,children:(0,f.jsx)(n.b,{})}),(0,f.jsxs)(n.f,{children:[(0,f.jsx)(n.m,{value:`pdf`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.pdf,`PDF`]})}),(0,f.jsx)(n.m,{value:`csv`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.csv,`CSV`]})}),(0,f.jsx)(n.m,{value:`json`,children:(0,f.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S.json,`JSON`]})})]})]})]})]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Sections à inclure`}),(0,f.jsx)(Se,{children:`Personnalisez le contenu du rapport`})]}),(0,f.jsxs)(Q,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`generalStats`,checked:h.includeSections.generalStats,onCheckedChange:e=>T(`generalStats`,e)}),(0,f.jsx)(i.o,{htmlFor:`generalStats`,className:`cursor-pointer`,children:`Statistiques générales`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`threatDetails`,checked:h.includeSections.threatDetails,onCheckedChange:e=>T(`threatDetails`,e)}),(0,f.jsx)(i.o,{htmlFor:`threatDetails`,className:`cursor-pointer`,children:`Détails des menaces détectées`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`scannedFiles`,checked:h.includeSections.scannedFiles,onCheckedChange:e=>T(`scannedFiles`,e)}),(0,f.jsx)(i.o,{htmlFor:`scannedFiles`,className:`cursor-pointer`,children:`Liste des fichiers scannés`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`actionsTaken`,checked:h.includeSections.actionsTaken,onCheckedChange:e=>T(`actionsTaken`,e)}),(0,f.jsx)(i.o,{htmlFor:`actionsTaken`,className:`cursor-pointer`,children:`Actions prises`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(we,{id:`recommendations`,checked:h.includeSections.recommendations,onCheckedChange:e=>T(`recommendations`,e)}),(0,f.jsx)(i.o,{htmlFor:`recommendations`,className:`cursor-pointer`,children:`Recommandations`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,f.jsxs)(r.r,{className:`flex-1`,onClick:()=>u?.(h),disabled:o,children:[(0,f.jsx)(l.Download,{className:`h-4 w-4 mr-2`}),`Générer le rapport`]}),(0,f.jsxs)(r.r,{variant:`outline`,className:`flex-1`,onClick:()=>d?.(h,`weekly`),disabled:o,children:[(0,f.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),`Planifier génération`]})]}),(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Envoi par email`}),(0,f.jsx)(Se,{children:`Envoyez le rapport directement par email`})]}),(0,f.jsxs)(Q,{className:`flex gap-2`,children:[(0,f.jsx)(r.n,{placeholder:`email@example.com`,type:`email`,value:v,onChange:e=>y(e.target.value),className:`flex-1`}),(0,f.jsxs)(r.r,{variant:`outline`,onClick:()=>p?.(h,v),disabled:!v||o,children:[(0,f.jsx)(l.Mail,{className:`h-4 w-4 mr-2`}),`Envoyer`]})]})]}),o&&(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Génération en cours...`}),(0,f.jsxs)(`span`,{className:`font-medium`,children:[c,`%`]})]}),(0,f.jsx)(Zn,{value:c})]})})})]}),(0,f.jsxs)(Er,{value:`preview`,className:`space-y-6`,children:[(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center mb-3`,children:(0,f.jsx)(l.Shield,{className:`h-6 w-6 text-white`})}),(0,f.jsx)(`h3`,{className:`text-xl font-bold`,children:`Rapport de scan de sécurité`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:C[h.type]})]}),(0,f.jsxs)(n.x,{variant:`secondary`,children:[h.startDate.toLocaleDateString(),` -`,` `,h.endDate.toLocaleDateString()]})]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Généré le `,new Date().toLocaleString()]})]})})}),h.includeSections.generalStats&&(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.BarChart3,{className:`h-4 w-4`}),`Total scans`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.totalScans.toLocaleString()})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.AlertTriangle,{className:`h-4 w-4`}),`Menaces détectées`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.totalThreats})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.TrendingUp,{className:`h-4 w-4`}),`Taux de détection`]}),(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[_.detectionRate,`%`]})]})})}),(0,f.jsx)(Y,{children:(0,f.jsx)(Q,{className:`pt-6`,children:(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,f.jsx)(l.Shield,{className:`h-4 w-4`}),`Fichiers en quarantaine`]}),(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:_.quarantinedFiles})]})})})]}),h.includeSections.threatDetails&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Menaces par sévérité`}),(0,f.jsx)(Se,{children:`Distribution des menaces détectées`})]}),(0,f.jsx)(Q,{className:`space-y-4`,children:_.threatsBySeverity.map(e=>(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,f.jsx)(`span`,{className:`capitalize font-medium`,children:e.severity}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:e.count})]}),(0,f.jsx)(`div`,{className:`h-2 bg-muted rounded-full overflow-hidden`,children:(0,f.jsx)(`div`,{className:t.t(`h-full rounded-full`,w[e.severity]),style:{width:`${e.count/E*100}%`}})})]},e.severity))})]}),h.includeSections.generalStats&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Tendance hebdomadaire`}),(0,f.jsx)(Se,{children:`Évolution des scans et menaces`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`flex items-end gap-4 h-48`,children:_.weeklyTrend.map(e=>(0,f.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-2`,children:[(0,f.jsxs)(`div`,{className:`flex-1 w-full flex items-end gap-1`,children:[(0,f.jsx)(`div`,{className:`flex-1 bg-blue-500 rounded-t`,style:{height:`${e.scans/D*100}%`},title:`Scans: ${e.scans}`}),(0,f.jsx)(`div`,{className:`flex-1 bg-orange-500 rounded-t`,style:{height:`${e.threats/D*100}%`},title:`Menaces: ${e.threats}`})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.week})]},e.week))}),(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-6 text-xs`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-3 w-3 rounded bg-blue-500`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Scans`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`h-3 w-3 rounded bg-orange-500`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Menaces`})]})]})]})})]}),(h.type===`iso27001_compliance`||h.type===`hds_audit`)&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Vérifications de conformité`}),(0,f.jsx)(Se,{children:h.type===`iso27001_compliance`?`Conformité ISO27001`:`Audit HDS`})]}),(0,f.jsx)(Q,{className:`space-y-3`,children:_.complianceChecks.map((e,t)=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border bg-card`,children:[e.passed?(0,f.jsx)(l.CheckCircle2,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,f.jsx)(l.XCircle,{className:`h-5 w-5 text-red-500 mt-0.5`}),(0,f.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,f.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.details})]}),(0,f.jsx)(n.x,{variant:e.passed?`default`:`destructive`,className:e.passed?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:e.passed?`Conforme`:`Non conforme`})]},t))})]}),h.includeSections.recommendations&&(0,f.jsxs)(Y,{children:[(0,f.jsxs)(X,{children:[(0,f.jsx)(Z,{children:`Recommandations`}),(0,f.jsx)(Se,{children:`Actions suggérées pour améliorer la sécurité`})]}),(0,f.jsx)(Q,{children:(0,f.jsxs)(`ul`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Augmenter la fréquence des scans pour les répertoires critiques`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Mettre à jour les signatures de virus (dernière mise à jour: il y a 2h)`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Configurer des alertes en temps réel pour les menaces critiques`})]}),(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,f.jsx)(`span`,{children:`Réviser la politique de quarantaine automatique`})]})]})})]})]})]})]})}exports.AD_SIZES=Hj,exports.APMOverview=xB,exports.Accordion=q,exports.AccordionContent=te,exports.AccordionItem=ee,exports.AccordionTrigger=J,exports.ActorBadge=SP,exports.ActorsList=LP,exports.AdmincrumbProvider=nF,exports.AiAssistantButton=PP,exports.Alert=me,exports.AlertDescription=ge,exports.AlertDialog=ne,exports.AlertDialogAction=de,exports.AlertDialogCancel=fe,exports.AlertDialogContent=oe,exports.AlertDialogDescription=ue,exports.AlertDialogFooter=ce,exports.AlertDialogHeader=se,exports.AlertDialogOverlay=ae,exports.AlertDialogPortal=ie,exports.AlertDialogTitle=le,exports.AlertDialogTrigger=re,exports.AlertTitle=he,exports.AntivirusDashboard=iV,exports.AspectRatio=_e,exports.Auth2FA=jR,exports.Avatar=ve,exports.AvatarFallback=be,exports.AvatarImage=ye,exports.Badge=n.x,exports.BlockEmptyState=VI,exports.BlockLanguageSelector=lF,exports.Blockquote=ui,exports.Button=r.r,exports.CHART_SIZE_MAP=a.t,exports.CICDBuilder=Cz,exports.COUNTRIES=cD,exports.Calendar=xe,exports.Card=Y,exports.CardContent=Q,exports.CardDescription=Se,exports.CardFooter=Ce,exports.CardHeader=X,exports.CardTitle=Z,exports.ChatInterface=BR,exports.Checkbox=we,exports.CheckoutFlow=fR,exports.CheckoutNavigation=Jx,exports.CheckoutProgressBar=Yx,exports.ClamAVServiceStatus=CV,exports.CloudCostDashboard=$z,exports.Code=ft,exports.Collapsible=pt,exports.CollapsibleContent=ht,exports.CollapsibleTrigger=mt,exports.Command=Et,exports.CommandDialog=Dt,exports.CommandEmpty=At,exports.CommandGroup=jt,exports.CommandInput=Ot,exports.CommandItem=Nt,exports.CommandList=kt,exports.CommandSeparator=Mt,exports.CommandShortcut=Pt,exports.ContainerOrchestrator=jB,exports.ContextMenu=Ft,exports.ContextMenuCheckboxItem=Gt,exports.ContextMenuContent=Ut,exports.ContextMenuGroup=Lt,exports.ContextMenuItem=Wt,exports.ContextMenuLabel=qt,exports.ContextMenuPortal=Rt,exports.ContextMenuRadioGroup=Bt,exports.ContextMenuRadioItem=Kt,exports.ContextMenuSeparator=Jt,exports.ContextMenuShortcut=Yt,exports.ContextMenuSub=zt,exports.ContextMenuSubContent=Ht,exports.ContextMenuSubTrigger=Vt,exports.ContextMenuTrigger=It,exports.DEFAULT_CHART_COLORS=a.n,exports.DashboardKPI=sR,exports.DataTable=Oi,exports.DataTableAdvanced=Fi,exports.DataTableColumnResizer=Ii,exports.DataTableContextMenu=Bi,exports.DataTableEditCell=Ei,exports.DataTableFilters=Ti,exports.DataTableGroupTotals=Ri,exports.DataTableGrouping=Li,exports.DataTableGroupingControls=zi,exports.DataTablePagination=wi,exports.DataTableSelection=Vi,exports.DataTableToolbar=Ci,exports.DatabaseAdmin=WB,exports.DeploymentDashboard=QR,exports.Dialog=gt,exports.DialogClose=yt,exports.DialogContent=xt,exports.DialogDescription=Tt,exports.DialogFooter=Ct,exports.DialogHeader=St,exports.DialogOverlay=bt,exports.DialogPortal=vt,exports.DialogTitle=wt,exports.DialogTrigger=_t,exports.DocumentFlyover=NP,exports.DocumentPreviewPopup=MP,exports.DrawerBody=Ra,exports.DrawerClose=Ga,exports.DrawerDescription=Va,exports.DrawerFooter=za,exports.DrawerHeader=La,exports.DrawerTitle=Ba,exports.DrawerTrigger=Wa,exports.DropdownMenu=Xt,exports.DropdownMenuCheckboxItem=on,exports.DropdownMenuContent=an,exports.DropdownMenuGroup=Qt,exports.DropdownMenuItem=$,exports.DropdownMenuLabel=cn,exports.DropdownMenuPortal=$t,exports.DropdownMenuRadioGroup=tn,exports.DropdownMenuRadioItem=sn,exports.DropdownMenuSeparator=ln,exports.DropdownMenuShortcut=un,exports.DropdownMenuSub=en,exports.DropdownMenuSubContent=rn,exports.DropdownMenuSubTrigger=nn,exports.DropdownMenuTrigger=Zt,exports.EmptyCartState=KI,exports.Error403Page=eL,exports.Error404Page=QI,exports.Error500Page=$I,exports.ErrorState=JI,exports.FileScanUploader=dV,exports.Footer=oF,exports.Form=dn,exports.FormControl=vn,exports.FormDescription=yn,exports.FormField=pn,exports.FormItem=gn,exports.FormLabel=_n,exports.FormMessage=bn,exports.GitOpsSyncStatus=dB,exports.Heading=ci,exports.Headtab=sF,exports.HeadtabBreadcrumb=cF,exports.HourBalanceBadge=bP,exports.HourConsumptionTable=VP,exports.HourPackDialog=BP,exports.HoverCard=xn,exports.HoverCardContent=Cn,exports.HoverCardTrigger=Sn,exports.IncidentManager=cz,exports.InfrastructureMap=_z,exports.Input=r.n,exports.InputOTP=wn,exports.KPICard=uE,exports.Kbd=fi,exports.Label=i.o,exports.LanguageProvider=UP,exports.LanguageSelector=Tn,exports.Layout=uF,exports.LegacyThemeProvider=KP,exports.Login=hF,exports.MaintenancePage=tL,exports.Menubar=jn,exports.MenubarCheckboxItem=Ln,exports.MenubarContent=Fn,exports.MenubarGroup=Dn,exports.MenubarItem=In,exports.MenubarLabel=zn,exports.MenubarMenu=En,exports.MenubarPortal=On,exports.MenubarRadioGroup=An,exports.MenubarRadioItem=Rn,exports.MenubarSeparator=Bn,exports.MenubarShortcut=Vn,exports.MenubarSub=kn,exports.MenubarSubContent=Pn,exports.MenubarSubTrigger=Nn,exports.MenubarTrigger=Mn,exports.ModalBody=uo,exports.ModalContent=oo,exports.ModalDescription=lo,exports.ModalFooter=fo,exports.ModalHeader=so,exports.ModalOverlay=ao,exports.ModalTitle=co,exports.NavigationMenu=Hn,exports.NavigationMenuContent=qn,exports.NavigationMenuIndicator=Xn,exports.NavigationMenuItem=Wn,exports.NavigationMenuLink=Jn,exports.NavigationMenuList=Un,exports.NavigationMenuTrigger=Kn,exports.NavigationMenuViewport=Yn,exports.NoDataState=HI,exports.NoFilesState=GI,exports.NoMessagesState=WI,exports.NoNotificationsState=qI,exports.NoResultsState=UI,exports.OfflinePage=nL,exports.OnCallScheduleBlock=Bz,exports.POINTS_PRESETS=yy,exports.PlayerProfile=SR,exports.Popover=i.r,exports.PopoverContent=i.i,exports.PopoverTrigger=i.a,exports.Progress=Zn,exports.ProjectStatsHeader=zP,exports.QuarantineManager=hV,exports.RadioGroup=Qn,exports.RadioGroupItem=$n,exports.ReleaseNotes=Az,exports.ScanHistoryLog=_V,exports.ScanPolicyEditor=IV,exports.ScanReportGenerator=WV,exports.ScrollArea=er,exports.ScrollBar=tr,exports.Select=n.d,exports.SelectContent=n.f,exports.SelectGroup=n.p,exports.SelectItem=n.m,exports.SelectLabel=n.h,exports.SelectScrollDownButton=n.g,exports.SelectScrollUpButton=n._,exports.SelectSeparator=n.v,exports.SelectTrigger=n.y,exports.SelectValue=n.b,exports.Separator=r.t,exports.SessionCard=GS,exports.SessionConfirmDialog=WS,exports.Sheet=nr,exports.SheetClose=ir,exports.SheetContent=cr,exports.SheetDescription=fr,exports.SheetFooter=ur,exports.SheetHeader=lr,exports.SheetOverlay=or,exports.SheetPortal=ar,exports.SheetTitle=dr,exports.SheetTrigger=rr,exports.SidebarLayout=wF,exports.SignatureDatabaseManager=MV,exports.Skeleton=a.m,exports.Slider=pr,exports.StepCommentBubble=CP,exports.StepCommentPanel=wP,exports.StepPermissionMatrix=FP,exports.StepperNavigation=Qo,exports.SuggestionDropdown=ND,exports.Switch=mr,exports.Table=hr,exports.TableBody=_r,exports.TableCaption=Sr,exports.TableCell=xr,exports.TableFooter=vr,exports.TableHead=br,exports.TableHeader=gr,exports.TableRow=yr,exports.Tabs=Cr,exports.TabsContent=Er,exports.TabsList=wr,exports.TabsTrigger=Tr,exports.TagChip=MD,exports.Text=oi,exports.Textarea=i.n,exports.ThemeLoader=it,exports.ThemeProvider=Or,exports.ThemeSelector=jr,exports.ThreatAlertBanner=BV,exports.TimeEntryDialog=TP,exports.TimeTrackingFlyover=EP,exports.Toast=Fr,exports.ToastAction=Ir,exports.ToastClose=Lr,exports.ToastDescription=zr,exports.ToastProvider=Mr,exports.ToastTitle=Rr,exports.ToastViewport=Nr,exports.Toaster=Qr,exports.Toggle=ei,exports.Tooltip=ni,exports.TooltipContent=ii,exports.TooltipProvider=ti,exports.TooltipTrigger=ri,exports.Waka3DPieChart=_l,exports.WakaAchievementBadge=Cd,exports.WakaAchievementGrid=wd,exports.WakaAchievementUnlock=Sd,exports.WakaActivityFeed=Xv,exports.WakaActivityTimeline=cI,exports.WakaAdBanner=Qj,exports.WakaAdFallback=Xj,exports.WakaAdInline=eM,exports.WakaAdInterstitial=tM,exports.WakaAdPlaceholder=Yj,exports.WakaAdProvider=Jj,exports.WakaAdSidebar=$j,exports.WakaAdStickyFooter=nM,exports.WakaAddressAutocomplete=sD,exports.WakaAdmincrumb=Yi,exports.WakaAlertPanel=Bk,exports.WakaAlertStack=jg,exports.WakaAllocationMatrix=Kh,exports.WakaAppDock=yp,exports.WakaApprovalChain=lg,exports.WakaAreaChart=a.c,exports.WakaArtifactList=LA,exports.WakaAsyncButton=vc,exports.WakaAuditLog=gC,exports.WakaAutocomplete=Zi,exports.WakaAutocompleteForm=Qi,exports.WakaBadgeShowcase=p_,exports.WakaBadgeShowcaseCompact=m_,exports.WakaBadgeShowcaseHero=g_,exports.WakaBadgeShowcaseList=h_,exports.WakaBadgeStats=__,exports.WakaBarChart=a.u,exports.WakaBarcode=oa,exports.WakaBiometricPrompt=UC,exports.WakaBottomSheet=ec,exports.WakaBreadcrumb=la,exports.WakaBreadcrumbPath=rl,exports.WakaBudgetBurn=Pu,exports.WakaBuildMatrix=SA,exports.WakaCalendarView=bI,exports.WakaCapacityPlanner=Mh,exports.WakaCarousel=da,exports.WakaCartSummary=Lx,exports.WakaChallengeTimer=ev,exports.WakaChallengeTimerSkeleton=tv,exports.WakaChart=a.d,exports.WakaChat=FI,exports.WakaChatBubble=bw,exports.WakaChatDateSeparator=Sw,exports.WakaChatSystemMessage=Cw,exports.WakaChatTypingIndicator=xw,exports.WakaChatWidget=TI,exports.WakaChecklist=BO,exports.WakaCheckoutStepper=Xx,exports.WakaCohortTable=nE,exports.WakaColorPicker=ya,exports.WakaColorPickerForm=ba,exports.WakaComboCounter=Fd,exports.WakaCombobox=Sa,exports.WakaCommandBar=ep,exports.WakaCompactDailyReward=T_,exports.WakaCompactGoalProgress=wE,exports.WakaCompactLevelProgress=Vd,exports.WakaComparePeriod=yx,exports.WakaConfigComparator=pj,exports.WakaConnectionMatrix=Sg,exports.WakaContainerList=Kk,exports.WakaContentRecommendation=aM,exports.WakaContributionGraph=cu,exports.WakaCostBreakdown=Su,exports.WakaCouponInput=$x,exports.WakaCpuGauge=Dl,exports.WakaCreditActivityFeed=dN,exports.WakaCreditAlert=VM,exports.WakaCreditBalance=gM,exports.WakaCreditBreakdown=zN,exports.WakaCreditBurnRate=ON,exports.WakaCreditCardInput=AD,exports.WakaCreditHistory=iN,exports.WakaCreditMeter=DM,exports.WakaCreditPricingPack=QN,exports.WakaCreditProjection=qN,exports.WakaCreditQuota=LM,exports.WakaCreditReceipt=mP,exports.WakaCreditTopUp=oP,exports.WakaCreditTransaction=KM,exports.WakaCreditTransferForm=_P,exports.WakaCreditUsageChart=yN,exports.WakaDailyReward=w_,exports.WakaDashboard=NF,exports.WakaDatabaseCard=wj,exports.WakaDateRangePicker=Ta,exports.WakaDateTimePicker=ja,exports.WakaDateTimePickerForm=Ma,exports.WakaDependencyTree=ZA,exports.WakaDeploymentLane=$h,exports.WakaDeviceTrust=sw,exports.WakaDocBreadcrumb=n.r,exports.WakaDocCallout=n.u,exports.WakaDocCodeBlock=n.l,exports.WakaDocNav=n.s,exports.WakaDocRenderer=n.t,exports.WakaDocSearch=n.o,exports.WakaDocTable=n.n,exports.WakaDocToc=n.c,exports.WakaDocToolbar=n.i,exports.WakaDocVersion=n.a,exports.WakaDock=_p,exports.WakaDrawer=Ha,exports.WakaEmptyState=qO,exports.WakaEmptyStateError=YO,exports.WakaEmptyStateSearch=JO,exports.WakaEnvVarEditor=ej,exports.WakaErrorPage=ZI,exports.WakaErrorShake=ed,exports.WakaFAQ=oL,exports.WakaFeatureAnnouncement=ak,exports.WakaFeatureFlagRow=_j,exports.WakaFileManager=pL,exports.WakaFileUpload=Ja,exports.WakaFloatingDock=vp,exports.WakaFloatingNav=Qc,exports.WakaFlowDiagram=Sp,exports.WakaFormFieldShake=nd,exports.WakaFunnelChart=VT,exports.WakaFunnelChartCompact=UT,exports.WakaFunnelChartSimple=HT,exports.WakaGlowCard=op,exports.WakaGlowCardDanger=up,exports.WakaGlowCardPrimary=sp,exports.WakaGlowCardRainbow=dp,exports.WakaGlowCardSuccess=cp,exports.WakaGlowCardWarning=lp,exports.WakaGlowGrid=fp,exports.WakaGoalCard=TE,exports.WakaGoalProgress=CE,exports.WakaHapticButton=oc,exports.WakaHapticIconButton=sc,exports.WakaHeader=TF,exports.WakaHealthPulse=hm,exports.WakaHeatmap=PE,exports.WakaHotspot=OO,exports.WakaHotspotGroup=AO,exports.WakaI18nEditor=tR,exports.WakaImage=Ya,exports.WakaImageGallery=Xa,exports.WakaIncidentTimeline=Ym,exports.WakaInvoicePreview=DS,exports.WakaKPIDashboard=dE,exports.WakaKanban=eo,exports.WakaKanbanBoard=yL,exports.WakaKubernetesOverview=$k,exports.WakaLanding=kL,exports.WakaLeaderboard=Jd,exports.WakaLevelBadge=zd,exports.WakaLevelProgress=Bd,exports.WakaLineChart=a.l,exports.WakaLiquidButton=Tc,exports.WakaLiquidButtonDestructive=Oc,exports.WakaLiquidButtonGradient=Ac,exports.WakaLiquidButtonNeon=jc,exports.WakaLiquidButtonPrimary=Ec,exports.WakaLiquidButtonSecondary=Dc,exports.WakaLiquidButtonSuccess=kc,exports.WakaLoadingOrbit=ld,exports.WakaLoadingOrbitAtom=pd,exports.WakaLoadingOrbitGalaxy=hd,exports.WakaLoadingOrbitMinimal=md,exports.WakaLoadingOrbitSimple=dd,exports.WakaLoadingOrbitSolar=fd,exports.WakaLogViewer=Ok,exports.WakaLootBox=P_,exports.WakaMagicLink=hp,exports.WakaMagneticButton=zc,exports.WakaMagneticIconButton=Bc,exports.WakaMagneticLink=Vc,exports.WakaMentionInput=ax,exports.WakaMetricSparkline=Cm,exports.WakaMigrationList=jj,exports.WakaMilestoneRoad=cf,exports.WakaMiniChart=a.a,exports.WakaMiniLeaderboard=Yd,exports.WakaMiniStreak=pf,exports.WakaModal=po,exports.WakaModalTrigger=mo,exports.WakaMorphButton=gc,exports.WakaMultiQuotaBar=hh,exports.WakaNetworkGauge=Al,exports.WakaNetworkTopology=um,exports.WakaNotifications=Co,exports.WakaNumberInput=Do,exports.WakaOrbitalMenu=dl,exports.WakaOrbitalMenuCompact=fl,exports.WakaOrderTracker=pS,exports.WakaOutstreamVideo=sM,exports.WakaPagination=Ao,exports.WakaPasswordStrength=IS,exports.WakaPasswordStrengthIndicator=LS,exports.WakaPaymentMethodPicker=Tb,exports.WakaPaymentMethodPickerCards=Ob,exports.WakaPaymentMethodPickerCompact=Ab,exports.WakaPaymentMethodPickerRadio=kb,exports.WakaPermissionMatrix=rC,exports.WakaPhoneInput=_D,exports.WakaPieChart=a.s,exports.WakaPipelineView=Ap,exports.WakaPlayerCard=Iy,exports.WakaPodCard=uA,exports.WakaPodium=Kd,exports.WakaPointsPopup=_y,exports.WakaPowerUp=ly,exports.WakaPowerUpList=dy,exports.WakaPresenceAvatarStack=mb,exports.WakaPresenceCard=fb,exports.WakaPresenceIndicator=sb,exports.WakaPresenceLastSeen=db,exports.WakaPresenceList=pb,exports.WakaPresenceSelector=ub,exports.WakaPresenceStatusBadge=lb,exports.WakaPresenceWithAvatar=cb,exports.WakaPricing=VL,exports.WakaPricingTable=Dx,exports.WakaProductCard=Bb,exports.WakaProductCardSkeleton=Hb,exports.WakaProductGrid=Vb,exports.WakaProfile=KF,exports.WakaProgressOnboarding=uk,exports.WakaProvider=QP,exports.WakaPullToRefresh=qs,exports.WakaQRCode=No,exports.WakaQueryExplain=Bj,exports.WakaQuestCard=Tf,exports.WakaQuestCardSkeleton=Ef,exports.WakaQuestList=Df,exports.WakaQuotaBar=mh,exports.WakaRadarScore=ml,exports.WakaRadarScoreCompare=gl,exports.WakaRadarScoreSimple=hl,exports.WakaRamGauge=Ol,exports.WakaRankBadge=hv,exports.WakaRankBadgeGroup=gv,exports.WakaRatingDisplay=$D,exports.WakaRatingInput=ZD,exports.WakaReactionPicker=TT,exports.WakaRegionMap=Jp,exports.WakaResourceGauge=El,exports.WakaResourceGaugeGroup=jl,exports.WakaResourcePool=oh,exports.WakaResourcePoolComparison=sh,exports.WakaRichTextEditor=i.t,exports.WakaRollbackSlider=Bp,exports.WakaSLATracker=qg,exports.WakaSankeyDiagram=BE,exports.WakaSchedulePicker=gO,exports.WakaScratchCard=Nf,exports.WakaSeasonPass=eb,exports.WakaSecretCard=cj,exports.WakaSecurityScanResult=UA,exports.WakaSecurityScore=MC,exports.WakaSecurityScoreCompact=NC,exports.WakaSegmentedControl=Fo,exports.WakaServerRack=tm,exports.WakaServerRackDemo=nm,exports.WakaServiceGraph=gA,exports.WakaSessionManager=KS,exports.WakaSettings=LF,exports.WakaSidebar=SF,exports.WakaSignaturePad=QE,exports.WakaSkeletonAvatar=Yu,exports.WakaSkeletonCard=Xu,exports.WakaSkeletonGrid=Qu,exports.WakaSkeletonList=Zu,exports.WakaSkeletonText=qu,exports.WakaSkeletonWave=Gu,exports.WakaSkillTree=H_,exports.WakaSliderRange=GD,exports.WakaSparkline=a.o,exports.WakaSpinWheel=Dy,exports.WakaSpinner=Ro,exports.WakaSponsoredBadge=Zj,exports.WakaSponsoredCard=rM,exports.WakaSponsoredFeed=iM,exports.WakaSpotlight=ip,exports.WakaStat=Uo,exports.WakaStatGroup=Wo,exports.WakaStatsHexagon=Vy,exports.WakaStatsHexagonRPG=Uy,exports.WakaStatsHexagonSimple=Hy,exports.WakaStatsHexagonSkills=Wy,exports.WakaStatusMatrix=ql,exports.WakaStepper=Zo,exports.WakaStorageGauge=kl,exports.WakaStreakCounter=ff,exports.WakaSuccessExplosion=Bu,exports.WakaSwipeCard=Rs,exports.WakaSwipeCardActions=Bs,exports.WakaTabPanel=ll,exports.WakaTabsMorph=sl,exports.WakaTagInput=FD,exports.WakaTeamBanner=zv,exports.WakaTeamBannerCompact=Bv,exports.WakaTeamBannerExpanded=Vv,exports.WakaTerminalOutput=Nm,exports.WakaTestReport=kA,exports.WakaThemeCreator=$o,exports.WakaThemeManager=ns,exports.WakaThreadView=lT,exports.WakaTiltCard=pp,exports.WakaTiltShowcaseCard=mp,exports.WakaTimePicker=us,exports.WakaTimeline=hs,exports.WakaTooltipTour=Tk,exports.WakaTourGuide=SO,exports.WakaTournamentBracket=Ov,exports.WakaTraceViewer=Pk,exports.WakaTree=bs,exports.WakaTreemapChart=JE,exports.WakaTwoFactorSetup=Qb,exports.WakaTypewriter=Kc,exports.WakaTypewriterCode=Yc,exports.WakaTypewriterHeading=qc,exports.WakaTypewriterLines=Jc,exports.WakaTypingIndicator=Fw,exports.WakaTypingIndicatorDots=Lw,exports.WakaTypingIndicatorPulse=zw,exports.WakaTypingIndicatorText=Rw,exports.WakaUserManagement=tI,exports.WakaVersusCard=Wf,exports.WakaVideo=Ds,exports.WakaVideoAd=oM,exports.WakaVideoCall=Qw,exports.WakaVideoOverlay=cM,exports.WakaVirtualList=As,exports.WakaVoiceMessage=MT,exports.WakaWelcomeModal=bo,exports.WakaWizard=JL,exports.WakaXPBar=r_,exports.addChildNode=ws,exports.applyTheme=lt,exports.badgeVariants=n.S,exports.blockquoteVariants=li,exports.calculateDuration=ze,exports.cn=t.t,exports.compareRanges=tt,exports.createBookingDateValidator=Ke,exports.createCardExpiryValidator=Ge,exports.createChartColumn=a.r,exports.createCommonPresets=Te,exports.createCustomPreset=Oe,exports.createHighlightRegex=Xf,exports.createLastDaysPresets=Ee,exports.createMaxAgeValidator=Le,exports.createMaxRangeDaysValidator=qe,exports.createMinAgeValidator=Ie,exports.createMonthlyPresets=Ze,exports.createNextDaysPresets=De,exports.createQuarterPresets=Xe,exports.createSafeRegex=Yf,exports.dateToTimestamp=Qe,exports.defaultAPMServices=SB,exports.defaultAPMTransactions=CB,exports.defaultAchievements=wR,exports.defaultActivities=uI,exports.defaultActivityFilters=lI,exports.defaultArtifacts=RA,exports.defaultAuth2FAStatus=NR,exports.defaultBackupCodes=MR,exports.defaultBadges=TR,exports.defaultBuildMatrixColumns=CA,exports.defaultBuildMatrixRows=wA,exports.defaultCalendarEvents=xI,exports.defaultCartItems=hR,exports.defaultCategories=jD,exports.defaultChatConversations=LI,exports.defaultChatInterfaceConversations=HR,exports.defaultChatInterfaceMessages=UR,exports.defaultChatInterfaceUsers=VR,exports.defaultChatMessages=RI,exports.defaultChatUser=II,exports.defaultCloudCostItems=tB,exports.defaultCloudCostSummary=eB,exports.defaultConfigEnvironments=mj,exports.defaultConnections=vA,exports.defaultContainers=qk,exports.defaultCostAnomalies=nB,exports.defaultCoverage=jA,exports.defaultDashboardStats=PF,exports.defaultDatabase=Tj,exports.defaultDatabaseInstance=GB,exports.defaultDatabases=Ej,exports.defaultDependencies=QA,exports.defaultDeployments=$R,exports.defaultEnvVariables=tj,exports.defaultEnvironments=tz,exports.defaultFAQCategories=sL,exports.defaultFAQItems=cL,exports.defaultFeatureFlags=vj,exports.defaultFeatures=Ax,exports.defaultFileManagerBreadcrumbs=hL,exports.defaultFiles=mL,exports.defaultGitOpsApplications=fB,exports.defaultGoals=lR,exports.defaultIncidents=lz,exports.defaultInfraResources=vz,exports.defaultK8sDeployments=nA,exports.defaultK8sNamespaces=iA,exports.defaultK8sNodes=eA,exports.defaultK8sPods=tA,exports.defaultK8sServices=rA,exports.defaultKPIMetrics=cR,exports.defaultKanbanColumns=bL,exports.defaultKanbanLabels=xL,exports.defaultLandingCTA=PL,exports.defaultLandingFeatures=jL,exports.defaultLandingHero=NL,exports.defaultLandingNavItems=AL,exports.defaultLandingTestimonials=ML,exports.defaultLogs=kk,exports.defaultMatchHistory=ER,exports.defaultMigrations=Mj,exports.defaultOnCallSchedule=Uz,exports.defaultOrchestratorServices=NB,exports.defaultPanelAlerts=Vk,exports.defaultPaymentMethods=mR,exports.defaultPermissions=rI,exports.defaultPipeline=wz,exports.defaultPipelines=ez,exports.defaultPlayerStats=CR,exports.defaultPodDetails=dA,exports.defaultPresets=wa,exports.defaultPricingFAQ=UL,exports.defaultPricingPlans=HL,exports.defaultProfileData=qF,exports.defaultQueryPlan=Vj,exports.defaultRecentScans=aV,exports.defaultReleases=Mz,exports.defaultScanPolicy=NV,exports.defaultSecret=lj,exports.defaultServices=_A,exports.defaultSettingsTabs=RF,exports.defaultShippingMethods=pR,exports.defaultTestSuites=AA,exports.defaultThreatAlerts=VV,exports.defaultTiers=kx,exports.defaultTopThreats=sV,exports.defaultTraceSpans=Fk,exports.defaultUsers=nI,exports.defaultVulnerabilities=WA,exports.defaultWeeklyStats=oV,exports.defaultWelcomeSteps=go,exports.defaultWizardSteps=YL,exports.escapeHtml=Zf,exports.escapeRegex=Jf,exports.exportToCSV=mi,exports.exportToJSON=hi,exports.findNodeById=xs,exports.formatCurrency=gS,exports.formatDate=_S,exports.formatDateRange=Be,exports.formatMinutes=vP,exports.formatPhoneNumber=lD,exports.formatSize=jP,exports.getCountryByCode=pD,exports.getCountryByDialCode=mD,exports.getDatesInMonth=He,exports.getFrenchHolidays=Ve,exports.getThemeLoader=st,exports.getWeekdaysInMonth=We,exports.getWeekendsInMonth=Ue,exports.getWorkingDays=Ye,exports.headingVariants=si,exports.initThemeLoader=ot,exports.isDateInRange=Fe,exports.isFutureDate=ke,exports.isHoliday=Pe,exports.isNotExpired=Re,exports.isPastDate=Ae,exports.isSameDay=Je,exports.isToday=je,exports.isWeekday=Me,exports.isWeekend=Ne,exports.kbdVariants=di,exports.loadTableState=vi,exports.loadTheme=ct,exports.mergeRanges=nt,exports.moveNode=Ts,exports.navigationMenuTriggerStyle=Gn,exports.normalizeDate=et,exports.orbitPresets=ud,exports.parseCSV=gi,exports.rangesOverlap=rt,exports.reducer=Kr,exports.removeNode=Cs,exports.safeNavigate=qf,exports.sanitizeUrl=Kf,exports.saveTableState=_i,exports.sparklineTemplate=a.i,exports.textVariants=ai,exports.themeManagerVariants=ts,exports.timestampToDate=$e,exports.toast=Xr,exports.toggleVariants=$r,exports.tweak=t.n,exports.unformatPhoneNumber=uD,exports.updateNode=Ss,exports.useAchievements=Td,exports.useActivityFeed=Zv,exports.useAdConsent=Kj,exports.useAdContext=Wj,exports.useAdSlot=qj,exports.useAdVisibility=Gj,exports.useAddressAutocomplete=nD,exports.useAdmincrumb=Xi,exports.useAdmincrumbContext=rF,exports.useAdmincrumbContextOptional=iF,exports.useAlertStack=Og,exports.useAllocationMatrix=Vh,exports.useAuditLog=_C,exports.useBiometricPrompt=PC,exports.useBottomSheet=tc,exports.useBreadcrumbFromPath=ua,exports.useBreadcrumbPath=il,exports.useBudgetBurn=Fu,exports.useCapacityPlanner=Dh,exports.useCartSummary=Rx,exports.useChallengeTimer=W_,exports.useChartTheme=a.f,exports.useChatWidget=EI,exports.useChecklist=FO,exports.useCheckoutStepper=Bx,exports.useCheckoutStepperContext=Hx,exports.useCohortTable=rE,exports.useComboCounter=Id,exports.useCombobox=Ca,exports.useCommandBar=np,exports.useComparePeriod=bx,exports.useConnectionMatrix=hg,exports.useCostBreakdown=Cu,exports.useCouponInput=Zx,exports.useCreditCardInput=kD,exports.useDailyRewards=E_,exports.useDataTable=bi,exports.useDataTableAdvanced=ki,exports.useDataTableEdit=Si,exports.useDataTableExport=o.n,exports.useDataTableImport=o.t,exports.useDataTableSelection=Hi,exports.useDataTableTheme=Pi,exports.useDataTableVirtualization=Ni,exports.useDateForm=Na,exports.useDateRangePicker=Ea,exports.useDeploymentLane=eg,exports.useDeviceTrust=cw,exports.useDrawer=Ua,exports.useEmptyState=XO,exports.useErrorShake=td,exports.useFeatureAnnouncement=ok,exports.useFloatingNav=$c,exports.useFlowDiagram=Cp,exports.useFormField=mn,exports.useFunnelChart=NT,exports.useGoalProgress=yE,exports.useHeatmap=kE,exports.useHotspot=kO,exports.useInvoice=OS,exports.useKPIDashboard=fE,exports.useKanban=to,exports.useLanguage=WP,exports.useLeaderboard=Xd,exports.useLegacyTheme=ZP,exports.useLevelProgress=Hd,exports.useLoadingOrbit=gd,exports.useLootBox=N_,exports.useMagicLink=gp,exports.useMentionInput=ex,exports.useMilestoneRoad=lf,exports.useModal=ho,exports.useMorphButton=_c,exports.useNotifications=wo,exports.useNumberInput=Oo,exports.useOrbitalMenu=ul,exports.useOrderTracker=nS,exports.usePagination=jo,exports.usePasswordStrength=jS,exports.usePaymentMethodPicker=jb,exports.usePermissionMatrix=QS,exports.usePhoneInput=gD,exports.usePointsPopup=vy,exports.usePointsPopupWithPresets=by,exports.usePowerUp=uy,exports.usePresence=ib,exports.usePricingTable=Ox,exports.useProgressOnboarding=dk,exports.usePullToRefresh=Js,exports.useQRCode=Po,exports.useQuests=Of,exports.useQuota=gh,exports.useRadarScore=pl,exports.useRank=_v,exports.useRatingInput=QD,exports.useReactionPicker=_T,exports.useRechartsLoader=a.p,exports.useResourceGauge=Tl,exports.useResourcePool=ch,exports.useRollbackSlider=zp,exports.useSLATracker=Jg,exports.useSankeyDiagram=IE,exports.useSchedulePicker=uO,exports.useScratchCard=Af,exports.useSeasonPass=tb,exports.useSecurityScore=DC,exports.useSegmentedControl=Io,exports.useSessionManager=qS,exports.useSidebar=CF,exports.useSignaturePad=YE,exports.useSkillTree=U_,exports.useSliderRange=HD,exports.useSparklineData=wm,exports.useSpotlight=ap,exports.useStat=Go,exports.useStatsHexagon=By,exports.useStepperContext=qo,exports.useSuccessExplosion=Vu,exports.useTableLayout=xi,exports.useTabs=cl,exports.useTagInput=ID,exports.useTeamBanner=Nv,exports.useTerminalOutput=Pm,exports.useTheme=Ar,exports.useThemeLoader=ut,exports.useThreadView=uT,exports.useTimePicker=ds,exports.useToast=Zr,exports.useTooltipTour=Sk,exports.useTourGuide=_O,exports.useTournamentBracket=kv,exports.useTranslation=Aa,exports.useTreemapChart=HE,exports.useTwoFactorSetup=Gb,exports.useTypewriter=Wc,exports.useTypingIndicator=Iw,exports.useVersusCard=Gf,exports.useVideo=Os,exports.useVideoCall=$w,exports.useVirtualList=js,exports.useVoiceMessage=OT,exports.useWaka=eF,exports.useWelcomeModal=_o,exports.useWizard=GL,exports.useXPBar=i_;