@wakastellar/ui 2.3.2 → 2.3.4

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
@@ -2632,6 +2632,6 @@ LIMIT 10;`,planningTime:.125,executionTime:45.32,totalCost:1250.5,rootNode:{id:"
2632
2632
  transform: translateX(100%);
2633
2633
  }
2634
2634
  }
2635
- `})]})}function oo({variant:t="house",size:s="rectangle",width:a,height:r,title:n="Your Ad Here",description:l="Advertise with us",ctaText:o="Learn More",ctaUrl:c,imageUrl:m,showBorder:u=!0,className:h,onClick:f,children:g}){const p=Wn[s],j=a??p.width,b=r??p.height;if(t==="custom"&&g)return e.jsx("div",{className:d.cn("rounded-md overflow-hidden",h),style:{width:j,height:b,maxWidth:"100%"},children:g});if(t==="empty")return e.jsx("div",{className:d.cn("relative overflow-hidden rounded-md",u&&"border border-dashed border-muted-foreground/20","flex items-center justify-center","bg-muted/20",h),style:{width:j,height:b,maxWidth:"100%"},children:e.jsx("span",{className:"text-xs text-muted-foreground/40",children:"Ad"})});const w=e.jsxs("div",{className:d.cn("relative overflow-hidden rounded-md transition-all duration-200",u&&"border border-dashed border-muted-foreground/30","hover:border-muted-foreground/50 hover:bg-muted/50","flex flex-col items-center justify-center p-4 text-center","bg-gradient-to-br from-muted/30 to-muted/10",h),style:{width:j,height:b,maxWidth:"100%",backgroundImage:m?`url(${m})`:void 0,backgroundSize:"cover",backgroundPosition:"center"},children:[m&&e.jsx("div",{className:"absolute inset-0 bg-black/40"}),e.jsxs("div",{className:d.cn("relative z-10",m&&"text-white"),children:[e.jsx("div",{className:"mb-2",children:e.jsx("svg",{className:"h-10 w-10 mx-auto text-muted-foreground/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z"})})}),e.jsx("h3",{className:d.cn("font-semibold text-sm mb-1",!m&&"text-muted-foreground"),children:n}),e.jsx("p",{className:d.cn("text-xs mb-3",m?"text-white/80":"text-muted-foreground/70"),children:l}),e.jsxs("span",{className:d.cn("inline-flex items-center px-3 py-1 rounded text-xs font-medium transition-colors",m?"bg-white text-black hover:bg-white/90":"bg-primary/10 text-primary hover:bg-primary/20"),children:[o,e.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]});return c?e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer sponsored",onClick:f,className:"block cursor-pointer",children:w}):f?e.jsx("button",{onClick:f,className:"block cursor-pointer text-left",children:w}):w}function Mt({sponsor:t,variant:s="default",size:a="sm",showIcon:r=!0,label:n="Sponsored",className:l,onInfoClick:o}){const c={default:"bg-muted text-muted-foreground border-transparent",subtle:"bg-black/50 text-white border-transparent backdrop-blur-sm",outline:"bg-transparent text-muted-foreground border-muted-foreground/30",dark:"bg-black/70 text-white border-transparent"},m={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-1 gap-1.5",lg:"text-sm px-2.5 py-1 gap-2"},u={sm:"h-2.5 w-2.5",md:"h-3 w-3",lg:"h-3.5 w-3.5"};return e.jsxs("span",{className:d.cn("inline-flex items-center rounded border font-medium",c[s],m[a],l),children:[e.jsx("span",{className:"whitespace-nowrap",children:t?`${n} by ${t}`:n}),r&&e.jsx("button",{onClick:h=>{h.preventDefault(),h.stopPropagation(),o?.()},className:d.cn("rounded-full hover:opacity-70 transition-opacity focus:outline-none focus:ring-1 focus:ring-current",u[a]),"aria-label":"Why am I seeing this ad?",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"w-full h-full",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})})]})}function tr({slotId:t,size:s="rectangle",customWidth:a,customHeight:r,adUnitPath:n,targeting:l,refreshInterval:o=0,lazyLoad:c=!0,fallback:m,showBadge:u=!0,badgePosition:h="top-right",className:f,onLoad:g,onError:p,onClick:j}){const b=J.useRef(null),{config:w,isReady:y,hasConsent:v,registerSlot:N,unregisterSlot:k,getCustomAd:S,trackEvent:C}=_t(),{isVisible:M}=ba(b),[D,A]=J.useState("loading"),[T,E]=J.useState(null),I=s==="custom"?{width:a||300,height:r||250}:Wn[s];J.useEffect(()=>{const W={id:t,network:w.network,size:s,position:"inline",targeting:l,refreshInterval:o,lazyLoad:c,customWidth:a,customHeight:r};return N(W),()=>k(t)},[t,w.network,s,l,o,c,a,r,N,k]);const $=J.useCallback(async()=>{if(!(!y||v===!1)){A("loading");try{if(w.network==="gpt"&&window.googletag&&n)window.googletag.cmd.push(()=>{window.googletag.defineSlot(n,[I.width,I.height],t)&&l&&Object.entries(l).forEach(([U,G])=>{window.googletag.pubads().setTargeting(U,G)}),window.googletag.enableServices(),window.googletag.display(t)}),A("loaded"),C({type:"loaded",slotId:t,timestamp:new Date}),g?.();else if(w.network==="custom"){const W=await S(t);W?(E(W),A("loaded"),C({type:"loaded",slotId:t,timestamp:new Date}),g?.(),W.impressionUrl&&fetch(W.impressionUrl,{mode:"no-cors"}).catch(()=>{}),W.trackingPixels?.forEach(U=>{const G=new Image;G.src=U})):(A("empty"),C({type:"empty",slotId:t,timestamp:new Date}))}}catch(W){A("error"),C({type:"error",slotId:t,timestamp:new Date,data:{error:W}}),p?.(W)}}},[y,v,w.network,n,I,t,l,S,C,g,p]);J.useEffect(()=>{c?M&&$():$()},[c,M,$]),J.useEffect(()=>{if(o>0&&D==="loaded"&&M){const W=setInterval(()=>{$()},o*1e3);return()=>clearInterval(W)}},[o,D,M,$]),J.useEffect(()=>{M&&D==="loaded"&&C({type:"viewable",slotId:t,timestamp:new Date})},[M,D,t,C]);const P=()=>{C({type:"click",slotId:t,timestamp:new Date}),j?.(),T?.clickUrl&&fetch(T.clickUrl,{mode:"no-cors"}).catch(()=>{}),T?.targetUrl&&window.open(T.targetUrl,"_blank","noopener,noreferrer")},R=()=>v===!1?m||e.jsx(oo,{width:I.width,height:I.height}):D==="loading"?e.jsx(On,{width:I.width,height:I.height}):D==="error"||D==="empty"?m||e.jsx(oo,{width:I.width,height:I.height}):w.network==="gpt"?null:T?e.jsxs("button",{onClick:P,className:"relative w-full h-full cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary",children:[T.imageUrl&&e.jsx("img",{src:T.imageUrl,alt:T.title||"Advertisement",className:"w-full h-full object-cover"}),T.title&&!T.imageUrl&&e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 bg-muted",children:[e.jsx("p",{className:"font-semibold text-center",children:T.title}),T.description&&e.jsx("p",{className:"text-sm text-muted-foreground text-center mt-1",children:T.description}),T.cta&&e.jsx("span",{className:"mt-2 px-4 py-1 bg-primary text-primary-foreground rounded text-sm",children:T.cta})]})]}):null,F={"top-left":"top-1 left-1","top-right":"top-1 right-1","bottom-left":"bottom-1 left-1","bottom-right":"bottom-1 right-1"};return e.jsxs("div",{ref:b,id:t,className:d.cn("relative overflow-hidden bg-muted/20 border border-border/50 rounded-md",f),style:{width:I.width,height:I.height,maxWidth:"100%"},"data-ad-slot":t,"data-ad-size":s,"data-ad-status":D,children:[R(),u&&D==="loaded"&&e.jsx("div",{className:d.cn("absolute z-10",F[h]),children:e.jsx(Mt,{sponsor:T?.sponsor})})]})}function o$({slotId:t,sticky:s=!0,stickyOffset:a=80,boundarySelector:r,gap:n=16,additionalSlots:l=[],className:o,...c}){const m=J.useRef(null),[u,h]=J.useState(!1),[f,g]=J.useState({});return J.useEffect(()=>{if(!s||!m.current)return;const p=m.current,j=r?document.querySelector(r):null,b=()=>{const w=p.getBoundingClientRect(),y=j?.getBoundingClientRect();if(w.top<=a){if(y&&y.top-p.offsetHeight-n<a){g({position:"absolute",top:j.offsetTop-p.offsetHeight-n,width:w.width}),h(!1);return}h(!0),g({position:"fixed",top:a,width:w.width})}else h(!1),g({})};return window.addEventListener("scroll",b,{passive:!0}),b(),()=>window.removeEventListener("scroll",b)},[s,a,r,n]),e.jsx("div",{ref:m,className:d.cn("relative",o),"data-sticky":u,children:e.jsx("div",{style:f,children:e.jsxs("div",{className:"flex flex-col",style:{gap:n},children:[e.jsx(tr,{slotId:t,size:"skyscraper",...c}),l.map((p,j)=>e.jsx(tr,{slotId:p.slotId,size:"rectangle",adUnitPath:p.adUnitPath,lazyLoad:!0,...c},p.slotId))]})})})}function i$({slotId:t,size:s="responsive",align:a="center",margin:r="md",showSeparators:n=!1,label:l,className:o,...c}){const m={left:"justify-start",center:"justify-center",right:"justify-end"},u={none:"my-0",sm:"my-4",md:"my-8",lg:"my-12"},h=()=>typeof window>"u"?"rectangle":window.innerWidth>=768?"leaderboard":window.innerWidth>=480?"rectangle":"mobile-banner",[f,g]=i.useState("rectangle");i.useEffect(()=>{const j=()=>{g(h())};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const p=s==="responsive"?f:s;return e.jsxs("div",{className:d.cn("w-full",u[r],o),children:[n&&e.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:l||"Advertisement"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),!n&&l&&e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wider mb-2 text-center",children:l}),e.jsx("div",{className:d.cn("flex w-full",m[a]),children:e.jsx(tr,{slotId:t,size:p,...c})}),n&&e.jsx("div",{className:"h-px bg-border mt-3"})]})}function c$({slotId:t,open:s,onClose:a,minDisplayTime:r=5,autoCloseAfter:n=0,adUnitPath:l,showCountdown:o=!0,skipText:c="Skip Ad",className:m,onLoad:u,onClick:h}){const{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),[w,y]=J.useState("loading"),[v,N]=J.useState(null),[k,S]=J.useState(r),[C,M]=J.useState(r===0),[D,A]=J.useState(n);J.useEffect(()=>{if(!s||!g||p===!1)return;(async()=>{y("loading"),S(r),M(r===0),A(n);try{if(f.network==="custom"){const $=await j(t);$?(N($),y("loaded"),b({type:"loaded",slotId:t,timestamp:new Date}),b({type:"impression",slotId:t,timestamp:new Date}),u?.(),$.impressionUrl&&fetch($.impressionUrl,{mode:"no-cors"}).catch(()=>{})):(y("error"),a())}else y("loaded"),u?.()}catch{y("error"),a()}})()},[s,g,p,f.network,t,j,b,r,n,u,a]),J.useEffect(()=>{if(!s||C||k<=0)return;const I=setInterval(()=>{S($=>$<=1?(M(!0),0):$-1)},1e3);return()=>clearInterval(I)},[s,C,k]),J.useEffect(()=>{if(!s||n===0||D<=0)return;const I=setInterval(()=>{A($=>$<=1?(a(),0):$-1)},1e3);return()=>clearInterval(I)},[s,n,D,a]),J.useEffect(()=>{s&&w==="loaded"&&b({type:"viewable",slotId:t,timestamp:new Date})},[s,w,t,b]);const T=J.useCallback(()=>{b({type:"click",slotId:t,timestamp:new Date}),h?.(),v?.clickUrl&&fetch(v.clickUrl,{mode:"no-cors"}).catch(()=>{}),v?.targetUrl&&window.open(v.targetUrl,"_blank","noopener,noreferrer")},[t,v,b,h]),E=J.useCallback(()=>{C&&a()},[C,a]);return J.useEffect(()=>{if(!s)return;const I=$=>{$.key==="Escape"&&C&&a()};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[s,C,a]),J.useEffect(()=>{if(s)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[s]),s?e.jsxs("div",{className:d.cn("fixed inset-0 z-50 flex items-center justify-center","bg-black/80 backdrop-blur-sm",m),role:"dialog","aria-modal":"true","aria-label":"Advertisement",children:[e.jsx("div",{className:"absolute top-4 right-4 z-10",children:C?e.jsxs("button",{onClick:E,className:"flex items-center gap-2 px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-full transition-colors",children:[e.jsx("span",{className:"text-sm font-medium",children:c}),e.jsx(x.X,{className:"h-4 w-4"})]}):o?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-white/10 text-white rounded-full",children:[e.jsx("span",{className:"text-sm",children:"Skip in"}),e.jsx("span",{className:"w-6 h-6 flex items-center justify-center bg-white/20 rounded-full text-sm font-bold",children:k})]}):null}),e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Mt,{sponsor:v?.sponsor,variant:"dark",size:"md"})}),n>0&&w==="loaded"&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10",children:e.jsxs("div",{className:"px-4 py-2 bg-white/10 text-white rounded-full text-sm",children:["Closing in ",D,"s"]})}),e.jsx("div",{className:"relative max-w-4xl max-h-[80vh] w-full mx-4",children:w==="loading"?e.jsx(On,{width:800,height:600}):v?e.jsx("button",{onClick:T,className:"relative w-full focus:outline-none focus:ring-2 focus:ring-white/50 rounded-lg overflow-hidden",children:v.videoUrl?e.jsx("video",{src:v.videoUrl,autoPlay:!0,muted:!0,playsInline:!0,className:"w-full max-h-[80vh] object-contain bg-black"}):v.imageUrl?e.jsx("img",{src:v.imageUrl,alt:v.title||"Advertisement",className:"w-full max-h-[80vh] object-contain"}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-96 bg-muted rounded-lg p-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-2",children:v.title}),v.description&&e.jsx("p",{className:"text-muted-foreground mb-4 text-center max-w-md",children:v.description}),v.cta&&e.jsx("span",{className:"px-6 py-3 bg-primary text-primary-foreground rounded-lg font-medium",children:v.cta})]})}):null})]}):null}function d$({slotId:t,dismissable:s=!0,showCloseAfter:a=0,animation:r="slide",safeAreaPadding:n=!0,blur:l=!0,className:o,containerClassName:c,...m}){const[u,h]=J.useState(!0),[f,g]=J.useState(a===0),[p,j]=J.useState(!1);J.useEffect(()=>{if(a>0&&!f){const y=setTimeout(()=>{g(!0)},a*1e3);return()=>clearTimeout(y)}},[a,f]);const b=()=>{!s||!f||(r!=="none"?(j(!0),setTimeout(()=>{h(!1)},300)):h(!1))};if(!u)return null;const w={slide:d.cn("transition-transform duration-300",p?"translate-y-full":"translate-y-0"),fade:d.cn("transition-opacity duration-300",p?"opacity-0":"opacity-100"),none:""};return e.jsx("div",{className:d.cn("fixed bottom-0 left-0 right-0 z-40",l&&"backdrop-blur-sm",n&&"pb-safe",w[r],c),role:"complementary","aria-label":"Advertisement",children:e.jsxs("div",{className:d.cn("relative flex items-center justify-center","bg-background/95 border-t border-border shadow-lg","py-2 px-4",o),children:[s&&e.jsx("button",{onClick:b,disabled:!f,className:d.cn("absolute top-1 right-1 p-1 rounded-full transition-all",f?"bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground cursor-pointer":"bg-muted/50 text-muted-foreground/50 cursor-not-allowed"),"aria-label":"Close advertisement",children:e.jsx(x.X,{className:"h-4 w-4"})}),e.jsx(tr,{slotId:t,size:"mobile-banner",showBadge:!1,...m})]})})}function vp({slotId:t,variant:s="article",adUnitPath:a,showImage:r=!0,showDescription:n=!0,showCta:l=!0,aspectRatio:o="video",className:c,onClick:m,onLoad:u}){const h=J.useRef(null),{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),{isVisible:w}=ba(h),[y,v]=J.useState("loading"),[N,k]=J.useState(null);J.useEffect(()=>{if(!g||!w||p===!1)return;(async()=>{try{const D=await j(t);D?(k(D),v("loaded"),b({type:"loaded",slotId:t,timestamp:new Date}),b({type:"impression",slotId:t,timestamp:new Date}),u?.(),D.impressionUrl&&fetch(D.impressionUrl,{mode:"no-cors"}).catch(()=>{})):v("error")}catch{v("error")}})()},[g,w,p,t,j,b,u]);const S=J.useCallback(()=>{N&&(b({type:"click",slotId:t,timestamp:new Date}),m?.(),N.clickUrl&&fetch(N.clickUrl,{mode:"no-cors"}).catch(()=>{}),N.targetUrl&&window.open(N.targetUrl,"_blank","noopener,noreferrer"))},[N,t,b,m]),C={video:"aspect-video",square:"aspect-square",portrait:"aspect-[3/4]"};return y==="error"||!N?null:y==="loading"?e.jsx("div",{ref:h,className:d.cn("rounded-lg border bg-muted animate-pulse",s==="horizontal"?"h-32":"h-64",c)}):s==="horizontal"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full flex gap-4 p-3 rounded-lg border bg-card hover:bg-accent/50 transition-colors text-left",children:[r&&N.imageUrl&&e.jsx("div",{className:"w-24 h-24 flex-shrink-0 rounded-md overflow-hidden bg-muted",children:e.jsx("img",{src:N.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 group-hover:text-primary transition-colors",children:N.title}),e.jsx(Mt,{sponsor:N.sponsor,size:"sm",showIcon:!1})]}),n&&N.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:N.description}),l&&N.cta&&e.jsxs("span",{className:"text-xs text-primary font-medium inline-flex items-center gap-1",children:[N.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})}):s==="compact"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full p-2 rounded-lg border bg-card hover:bg-accent/50 transition-colors text-left",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx(Mt,{sponsor:N.sponsor,size:"sm",showIcon:!1})}),e.jsx("h3",{className:"font-medium text-sm line-clamp-2 group-hover:text-primary transition-colors",children:N.title})]})}):s==="product"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full rounded-lg border bg-card overflow-hidden hover:shadow-md transition-shadow text-left",children:[r&&N.imageUrl&&e.jsxs("div",{className:d.cn("relative bg-muted",C[o]),children:[e.jsx("img",{src:N.imageUrl,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx(Mt,{variant:"subtle",size:"sm",showIcon:!1})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-sm mb-1 group-hover:text-primary transition-colors line-clamp-2",children:N.title}),n&&N.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-3",children:N.description}),l&&N.cta&&e.jsx("span",{className:"inline-flex items-center justify-center w-full px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm font-medium hover:bg-primary/90 transition-colors",children:N.cta})]})]})}):e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full rounded-lg border bg-card overflow-hidden hover:shadow-md transition-shadow text-left",children:[r&&N.imageUrl&&e.jsxs("div",{className:d.cn("relative bg-muted",C[o]),children:[e.jsx("img",{src:N.imageUrl,alt:"",className:"absolute inset-0 w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(Mt,{variant:"subtle",size:"sm"})})]}),e.jsxs("div",{className:"p-4",children:[!r&&e.jsx("div",{className:"mb-2",children:e.jsx(Mt,{sponsor:N.sponsor,size:"sm"})}),e.jsx("h3",{className:"font-semibold mb-2 group-hover:text-primary transition-colors line-clamp-2",children:N.title}),n&&N.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 mb-3",children:N.description}),l&&N.cta&&e.jsxs("span",{className:"text-sm text-primary font-medium inline-flex items-center gap-1",children:[N.cta,e.jsx(x.ExternalLink,{className:"h-4 w-4"})]})]})]})})}function u$({items:t,renderItem:s,adSlots:a,adFrequency:r=5,adStartPosition:n=2,adVariant:l="article",maxAds:o,columns:c=1,gap:m="md",className:u,keyExtractor:h}){const f={sm:"gap-2",md:"gap-4",lg:"gap-6"},g={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},p=y=>{if(y<n)return null;const v=Math.floor((y-n)/(r+1));return!((y-n)%(r+1)===0)||o!==void 0&&v>=o||v>=a.length?null:a[v]},j=[];let b=0,w=0;for(;b<t.length;){const y=p(w);y?j.push({type:"ad",slot:y}):(j.push({type:"content",item:t[b],index:b}),b++),w++}return e.jsx("div",{className:d.cn("grid",g[c],f[m],u),children:j.map((y,v)=>{if(y.type==="ad")return e.jsx(vp,{slotId:y.slot.slotId,adUnitPath:y.slot.adUnitPath,variant:l},`ad-${y.slot.slotId}`);const N=h?h(y.item,y.index):`item-${y.index}`;return e.jsx("div",{children:s(y.item,y.index)},N)})})}function m$({title:t="You May Also Like",slotIds:s,layout:a="grid",columns:r=3,showArrows:n=!0,autoScroll:l=!1,autoScrollInterval:o=5,className:c,onItemClick:m}){const u=J.useRef(null),h=J.useRef(null),{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),{isVisible:w}=ba(u),[y,v]=J.useState(new Map),[N,k]=J.useState(!0),[S,C]=J.useState(0);J.useEffect(()=>{if(!g||!w||p===!1)return;(async()=>{k(!0);const $=new Map;await Promise.all(s.map(async P=>{try{const R=await j(P);R&&($.set(P,R),b({type:"loaded",slotId:P,timestamp:new Date}),R.impressionUrl&&fetch(R.impressionUrl,{mode:"no-cors"}).catch(()=>{}))}catch{}})),v($),k(!1)})()},[g,w,p,s,j,b]),J.useEffect(()=>{w&&y.size>0&&y.forEach((I,$)=>{b({type:"viewable",slotId:$,timestamp:new Date})})},[w,y,b]),J.useEffect(()=>{if(a!=="carousel"||!l||y.size===0)return;const I=setInterval(()=>{C($=>($+1)%y.size)},o*1e3);return()=>clearInterval(I)},[a,l,o,y.size]),J.useEffect(()=>{if(a!=="carousel"||!h.current)return;const I=h.current.offsetWidth/Math.min(r,y.size);h.current.scrollTo({left:S*I,behavior:"smooth"})},[S,a,r,y.size]);const M=(I,$)=>{b({type:"click",slotId:I,timestamp:new Date}),m?.(I),$.clickUrl&&fetch($.clickUrl,{mode:"no-cors"}).catch(()=>{}),$.targetUrl&&window.open($.targetUrl,"_blank","noopener,noreferrer")},D=()=>{C(I=>(I-1+y.size)%y.size)},A=()=>{C(I=>(I+1)%y.size)};if(y.size===0&&!N)return null;const T={2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},E=(I,$)=>e.jsxs("button",{onClick:()=>M(I,$),className:"group flex-shrink-0 w-full text-left rounded-lg overflow-hidden bg-card border hover:shadow-md transition-shadow",children:[$.imageUrl&&e.jsx("div",{className:"relative aspect-video bg-muted overflow-hidden",children:e.jsx("img",{src:$.imageUrl,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors",children:$.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:$.sponsor||"Sponsored"}),e.jsx(x.ExternalLink,{className:"h-3 w-3 text-muted-foreground"})]})]})]},I);return e.jsxs("div",{ref:u,className:d.cn("relative",c),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:t}),e.jsx(Mt,{size:"sm",showIcon:!1})]}),a==="carousel"&&n&&y.size>r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:D,className:"p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors","aria-label":"Previous",children:e.jsx(x.ChevronLeft,{className:"h-4 w-4"})}),e.jsx("button",{onClick:A,className:"p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors","aria-label":"Next",children:e.jsx(x.ChevronRight,{className:"h-4 w-4"})})]})]}),N?e.jsx("div",{className:d.cn("grid gap-4",T[r]),children:s.slice(0,r).map((I,$)=>e.jsx("div",{className:"rounded-lg border bg-muted animate-pulse aspect-[4/3]"},$))}):a==="grid"?e.jsx("div",{className:d.cn("grid gap-4",T[r]),children:Array.from(y.entries()).map(([I,$])=>E(I,$))}):a==="carousel"?e.jsx("div",{ref:h,className:"flex gap-4 overflow-x-auto scrollbar-hide snap-x snap-mandatory",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:Array.from(y.entries()).map(([I,$])=>e.jsx("div",{className:"snap-start",style:{minWidth:`calc((100% - ${(r-1)*16}px) / ${r})`},children:E(I,$)},I))}):e.jsx("div",{className:"space-y-3",children:Array.from(y.entries()).map(([I,$])=>e.jsxs("button",{onClick:()=>M(I,$),className:"group w-full flex gap-3 p-2 rounded-lg border hover:bg-accent/50 transition-colors text-left",children:[$.imageUrl&&e.jsx("div",{className:"w-20 h-20 flex-shrink-0 rounded-md overflow-hidden bg-muted",children:e.jsx("img",{src:$.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors",children:$.title}),e.jsx("span",{className:"text-xs text-muted-foreground",children:$.sponsor||"Sponsored"})]})]},I))}),a==="carousel"&&y.size>r&&e.jsx("div",{className:"flex justify-center gap-1.5 mt-4",children:Array.from({length:Math.ceil(y.size/r)}).map((I,$)=>e.jsx("button",{onClick:()=>C($*r),className:d.cn("w-2 h-2 rounded-full transition-colors",Math.floor(S/r)===$?"bg-primary":"bg-muted-foreground/30"),"aria-label":`Go to slide ${$+1}`},$))})]})}function x$({slotId:t,width:s=640,height:a=360,aspectRatio:r="16/9",autoplay:n=!0,muted:l=!0,showControls:o=!0,skipAfter:c=5,showProgress:m=!0,ctaPosition:u="bottom",className:h,onComplete:f,onSkip:g,onClick:p}){const j=J.useRef(null),b=J.useRef(null),{config:w,isReady:y,hasConsent:v,getCustomAd:N,trackEvent:k}=_t(),{isVisible:S}=ba(j),[C,M]=J.useState("loading"),[D,A]=J.useState(null),[T,E]=J.useState(!1),[I,$]=J.useState(l),[P,R]=J.useState(0),[F,W]=J.useState(0),[U,G]=J.useState(c===0),[O,_]=J.useState(c),[z,V]=J.useState(!1);J.useEffect(()=>{if(!y||v===!1)return;(async()=>{try{const re=await N(t);re?.videoUrl?(A(re),M("loaded"),k({type:"loaded",slotId:t,timestamp:new Date})):M("error")}catch{M("error")}})()},[y,v,t,N,k]),J.useEffect(()=>{!b.current||!n||C!=="loaded"||(S?b.current.play().catch(()=>{}):b.current.pause())},[S,n,C]),J.useEffect(()=>{T&&D&&(k({type:"impression",slotId:t,timestamp:new Date}),D.impressionUrl&&fetch(D.impressionUrl,{mode:"no-cors"}).catch(()=>{}))},[T,D,t,k]),J.useEffect(()=>{if(!T||U||c===0)return;const ae=setInterval(()=>{_(re=>re<=1?(G(!0),0):re-1)},1e3);return()=>clearInterval(ae)},[T,U,c]);const q=()=>{b.current?.play()},B=()=>{b.current?.pause()},H=()=>{T?B():q()},Y=()=>{b.current&&(b.current.muted=!I,$(!I))},Z=()=>{j.current?.requestFullscreen?.()},X=()=>{if(b.current){const ae=b.current.currentTime,re=b.current.duration;R(ae/re*100),u==="end"&&re-ae<5&&V(!0)}},se=()=>{b.current&&W(b.current.duration)},K=()=>{E(!1),V(!0),k({type:"viewable",slotId:t,timestamp:new Date,data:{completed:!0}}),f?.()},Q=()=>{U&&(b.current?.pause(),V(!0),g?.())},ee=J.useCallback(()=>{D&&(k({type:"click",slotId:t,timestamp:new Date}),p?.(),D.clickUrl&&fetch(D.clickUrl,{mode:"no-cors"}).catch(()=>{}),D.targetUrl&&window.open(D.targetUrl,"_blank","noopener,noreferrer"))},[D,t,k,p]),te=ae=>{const re=Math.floor(ae/60),le=Math.floor(ae%60);return`${re}:${le.toString().padStart(2,"0")}`};return C==="error"?null:C==="loading"?e.jsx("div",{ref:j,children:e.jsx(On,{width:s,height:a})}):e.jsxs("div",{ref:j,className:d.cn("relative overflow-hidden rounded-lg bg-black group",h),style:{width:s,maxWidth:"100%"},children:[e.jsxs("div",{className:d.cn("relative",`aspect-[${r}]`),children:[e.jsx("video",{ref:b,src:D?.videoUrl,muted:I,playsInline:!0,onClick:H,onPlay:()=>E(!0),onPause:()=>E(!1),onTimeUpdate:X,onLoadedMetadata:se,onEnded:K,className:"w-full h-full object-contain cursor-pointer"}),e.jsx("div",{className:"absolute top-2 left-2 z-10",children:e.jsx(Mt,{variant:"dark",size:"sm",sponsor:D?.sponsor})}),c>0&&e.jsx("div",{className:"absolute top-2 right-2 z-10",children:U?e.jsx("button",{onClick:Q,className:"px-3 py-1.5 bg-white/90 text-black text-sm font-medium rounded hover:bg-white transition-colors",children:"Skip Ad"}):e.jsxs("div",{className:"px-3 py-1.5 bg-black/50 text-white text-sm rounded",children:["Skip in ",O,"s"]})}),!T&&e.jsx("button",{onClick:q,className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(x.Play,{className:"h-16 w-16 text-white fill-white"})}),u==="overlay"&&D?.cta&&e.jsxs("button",{onClick:ee,className:"absolute bottom-16 left-1/2 -translate-x-1/2 px-6 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors flex items-center gap-2",children:[D.cta,e.jsx(x.ExternalLink,{className:"h-4 w-4"})]}),z&&u==="end"&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/80 p-6",children:[D?.imageUrl&&e.jsx("img",{src:D.imageUrl,alt:"",className:"w-24 h-24 rounded-lg object-cover mb-4"}),e.jsx("h3",{className:"text-white text-xl font-bold text-center mb-2",children:D?.title}),D?.description&&e.jsx("p",{className:"text-white/80 text-center mb-4 max-w-sm",children:D.description}),e.jsxs("button",{onClick:ee,className:"px-6 py-3 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors flex items-center gap-2",children:[D?.cta||"Learn More",e.jsx(x.ExternalLink,{className:"h-4 w-4"})]})]}),o&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-3 bg-gradient-to-t from-black/80 to-transparent opacity-0 group-hover:opacity-100 transition-opacity",children:[m&&e.jsx("div",{className:"mb-2",children:e.jsx("div",{className:"h-1 bg-white/30 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${P}%`}})})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:H,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:T?e.jsx(x.Pause,{className:"h-5 w-5 text-white"}):e.jsx(x.Play,{className:"h-5 w-5 text-white fill-white"})}),e.jsx("button",{onClick:Y,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:I?e.jsx(x.VolumeX,{className:"h-5 w-5 text-white"}):e.jsx(x.Volume2,{className:"h-5 w-5 text-white"})}),e.jsxs("span",{className:"text-white text-xs",children:[te(P/100*F)," / ",te(F)]})]}),e.jsx("button",{onClick:Z,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:e.jsx(x.Maximize,{className:"h-5 w-5 text-white"})})]})]})]}),u==="bottom"&&D?.cta&&e.jsxs("button",{onClick:ee,className:"w-full px-4 py-3 bg-muted hover:bg-muted/80 transition-colors flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[D.imageUrl&&e.jsx("img",{src:D.imageUrl,alt:"",className:"w-10 h-10 rounded object-cover"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"font-medium text-sm",children:D.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:D.sponsor})]})]}),e.jsxs("span",{className:"px-4 py-1.5 bg-primary text-primary-foreground rounded text-sm font-medium flex items-center gap-1",children:[D.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})}function h$({slotId:t,collapseOnEnd:s=!0,collapseDuration:a=300,muted:r=!0,showClose:n=!0,closeAfter:l=0,visibilityThreshold:o=.5,className:c,onComplete:m,onClose:u}){const h=J.useRef(null),f=J.useRef(null),{config:g,isReady:p,hasConsent:j,getCustomAd:b,trackEvent:w}=_t(),{isVisible:y}=ba(h,o),[v,N]=J.useState("loading"),[k,S]=J.useState(null),[C,M]=J.useState(r),[D,A]=J.useState(!1),[T,E]=J.useState("auto"),[I,$]=J.useState(!1);J.useEffect(()=>{if(!p||j===!1)return;(async()=>{try{const G=await b(t);G?.videoUrl?(S(G),N("loaded"),w({type:"loaded",slotId:t,timestamp:new Date})):N("collapsed")}catch{N("collapsed")}})()},[p,j,t,b,w]),J.useEffect(()=>{!f.current||v!=="loaded"||(y?f.current.play().then(()=>{I||($(!0),w({type:"impression",slotId:t,timestamp:new Date}),k?.impressionUrl&&fetch(k.impressionUrl,{mode:"no-cors"}).catch(()=>{}))}).catch(()=>{}):f.current.pause())},[y,v,I,t,k,w]),J.useEffect(()=>{if(l===0||!I)return;const U=setTimeout(()=>{P()},l*1e3);return()=>clearTimeout(U)},[l,I]),J.useEffect(()=>{v==="loaded"&&h.current&&E(h.current.offsetHeight)},[v]);const P=()=>{s?(A(!0),E(0),setTimeout(()=>{N("collapsed"),u?.()},a)):(N("collapsed"),u?.())},R=()=>{w({type:"viewable",slotId:t,timestamp:new Date,data:{completed:!0}}),m?.(),P()},F=()=>{f.current&&(f.current.muted=!C,M(!C))},W=()=>{k&&(w({type:"click",slotId:t,timestamp:new Date}),k.clickUrl&&fetch(k.clickUrl,{mode:"no-cors"}).catch(()=>{}),k.targetUrl&&window.open(k.targetUrl,"_blank","noopener,noreferrer"))};return v==="collapsed"||v==="error"?null:v==="loading"?e.jsx("div",{ref:h,className:d.cn("w-full aspect-video bg-muted animate-pulse rounded-lg",c)}):e.jsx("div",{ref:h,className:d.cn("relative w-full overflow-hidden rounded-lg bg-black",D&&"transition-all",c),style:{height:T,transitionDuration:`${a}ms`},children:e.jsxs("div",{className:"relative aspect-video",children:[e.jsx("video",{ref:f,src:k?.videoUrl,muted:C,playsInline:!0,loop:!1,onClick:W,onEnded:R,className:"w-full h-full object-contain cursor-pointer"}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsxs("div",{className:"absolute top-0 left-0 right-0 p-3 flex items-center justify-between bg-gradient-to-b from-black/50 to-transparent pointer-events-auto",children:[e.jsx(Mt,{variant:"dark",size:"sm",sponsor:k?.sponsor}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:F,className:"p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors",children:C?e.jsx(x.VolumeX,{className:"h-4 w-4 text-white"}):e.jsx(x.Volume2,{className:"h-4 w-4 text-white"})}),n&&e.jsx("button",{onClick:P,className:"p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors",children:e.jsx(x.X,{className:"h-4 w-4 text-white"})})]})]}),k?.cta&&e.jsx("div",{className:"absolute bottom-3 left-3 right-3 pointer-events-auto",children:e.jsx("button",{onClick:W,className:"w-full px-4 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors text-center",children:k.cta})})]})]})})}function f$({slotId:t,visible:s=!0,trigger:a="manual",triggerTime:r=0,position:n="bottom",dismissable:l=!0,hideAfter:o=0,className:c,onDismiss:m,onClick:u}){const{config:h,isReady:f,hasConsent:g,getCustomAd:p,trackEvent:j}=_t(),[b,w]=J.useState("loading"),[y,v]=J.useState(null),[N,k]=J.useState(s);J.useEffect(()=>{if(!f||g===!1)return;(async()=>{try{const A=await p(t);A?(v(A),w("loaded"),j({type:"loaded",slotId:t,timestamp:new Date})):w("error")}catch{w("error")}})()},[f,g,t,p,j]),J.useEffect(()=>{N&&b==="loaded"&&y&&(j({type:"impression",slotId:t,timestamp:new Date}),y.impressionUrl&&fetch(y.impressionUrl,{mode:"no-cors"}).catch(()=>{}))},[N,b,y,t,j]),J.useEffect(()=>{k(s)},[s]),J.useEffect(()=>{if(o===0||!N)return;const D=setTimeout(()=>{k(!1),w("hidden"),m?.()},o*1e3);return()=>clearTimeout(D)},[o,N,m]);const S=J.useCallback(()=>{l&&(k(!1),w("hidden"),m?.())},[l,m]),C=J.useCallback(()=>{y&&(j({type:"click",slotId:t,timestamp:new Date}),u?.(),y.clickUrl&&fetch(y.clickUrl,{mode:"no-cors"}).catch(()=>{}),y.targetUrl&&window.open(y.targetUrl,"_blank","noopener,noreferrer"))},[y,t,j,u]);if(b==="error"||b==="hidden"||!N||b==="loading")return null;const M={bottom:"bottom-0 left-0 right-0",top:"top-0 left-0 right-0",corner:"bottom-4 right-4 max-w-sm"};return n==="corner"?e.jsxs("div",{className:d.cn("absolute z-20 rounded-lg overflow-hidden shadow-lg bg-card border animate-in slide-in-from-right",M[n],c),children:[l&&e.jsx("button",{onClick:S,className:"absolute top-2 right-2 p-1 rounded-full bg-black/50 hover:bg-black/70 transition-colors z-10",children:e.jsx(x.X,{className:"h-3 w-3 text-white"})}),e.jsxs("button",{onClick:C,className:"w-full text-left",children:[y?.imageUrl&&e.jsx("div",{className:"aspect-video bg-muted",children:e.jsx("img",{src:y.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("div",{className:"flex items-start justify-between gap-2 mb-1",children:e.jsx("p",{className:"font-medium text-sm line-clamp-2",children:y?.title})}),y?.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:y.description}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Mt,{size:"sm",sponsor:y?.sponsor,showIcon:!1}),y?.cta&&e.jsxs("span",{className:"text-xs text-primary font-medium flex items-center gap-1",children:[y.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})]})]}):e.jsx("div",{className:d.cn("absolute z-20 bg-gradient-to-t from-black/80 to-black/50 backdrop-blur-sm",n==="top"&&"bg-gradient-to-b",M[n],c),children:e.jsxs("div",{className:"flex items-center gap-4 p-3",children:[y?.imageUrl&&e.jsx("button",{onClick:C,className:"flex-shrink-0",children:e.jsx("img",{src:y.imageUrl,alt:"",className:"w-16 h-16 rounded object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:e.jsx(Mt,{variant:"dark",size:"sm",showIcon:!1})}),e.jsxs("button",{onClick:C,className:"text-left",children:[e.jsx("p",{className:"font-medium text-white text-sm line-clamp-1",children:y?.title}),y?.description&&e.jsx("p",{className:"text-xs text-white/70 line-clamp-1",children:y.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[y?.cta&&e.jsxs("button",{onClick:C,className:"px-4 py-2 bg-primary text-primary-foreground rounded text-sm font-medium hover:bg-primary/90 transition-colors flex items-center gap-1",children:[y.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]}),l&&e.jsx("button",{onClick:S,className:"p-1.5 rounded-full hover:bg-white/20 transition-colors",children:e.jsx(x.X,{className:"h-4 w-4 text-white"})})]})]})})}const yp=i.createContext(void 0);function wp({children:t,languages:s,defaultLanguage:a="fr",s3Config:r,onLanguageChange:n}){const{i18n:l}=zt.useTranslation(),[o,c]=i.useState(a),[m,u]=i.useState(!0),[h,f]=i.useState(new Set),[g,p]=i.useState(!1),j=i.useCallback(async y=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:v,prefix:N="",extension:k="json",headers:S={}}=r,C=`${v.replace(/\/$/,"")}/${N}${y}.${k}`;console.log(`[LanguageProvider] Loading translations from S3: ${C}`);try{const M=await fetch(C,{headers:{Accept:"application/json",...S}});if(!M.ok)throw new Error(`Failed to load translations: ${M.status} ${M.statusText}`);const D=await M.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${y}`),D}catch(M){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${y}:`,M),M}},[r]);i.useEffect(()=>{if(g||!l||!r)return;(async()=>{try{const v=typeof window<"u"?localStorage.getItem("language"):null,N=v&&s.some(S=>S.code===v)?v:a;console.log(`[LanguageProvider] Initializing with language: ${N}`);const k=await j(N);l.addResourceBundle&&l.addResourceBundle(N,"translation",k,!0,!0),await l.changeLanguage(N),c(N),f(new Set([N])),p(!0),console.log(`[LanguageProvider] ✓ Initialized with ${N}`)}catch(v){console.error("[LanguageProvider] Error initializing:",v),p(!0)}finally{u(!1)}})()},[g,l,r,a,s,j]);const b=i.useCallback(async y=>{if(y!==o){if(!l?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}if(!r){console.error("[LanguageProvider] S3 config not provided");return}u(!0);try{if(!h.has(y)){console.log(`[LanguageProvider] Loading ${y} from S3...`);const v=await j(y);l.addResourceBundle&&l.addResourceBundle(y,"translation",v,!0,!0),f(N=>new Set([...N,y]))}await l.changeLanguage(y),c(y),typeof window<"u"&&localStorage.setItem("language",y),n?.(y),console.log(`[LanguageProvider] ✓ Language changed to: ${y}`)}catch(v){throw console.error("[LanguageProvider] ✗ Error changing language:",v),v}finally{u(!1)}}},[o,h,r,j,l,n]),w={currentLanguage:o,languages:s,changeLanguage:b,isLoading:m,loadedLanguages:h};return e.jsx(yp.Provider,{value:w,children:t})}function sc(){const t=i.useContext(yp);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Np=i.createContext(void 0);function g$({children:t,config:s}){const{defaultTheme:a="light",storageKey:r="waka-ui-theme",themes:n,enableSystem:l=!0,s3Config:o}=s||{},[c,m]=i.useState(a),[u,h]=i.useState(),[f,g]=i.useState([]),[p,j]=i.useState(!0),[b,w]=i.useState("fallback");i.useEffect(()=>{(async()=>{if(j(!0),n&&n.length>0){const S=p$(n);g(S),w("config"),j(!1),console.log("[ThemeProvider] Using themes from config:",S.length);return}if(o?.baseUrl)try{const S=await b$(o.baseUrl);if(S.length>0){g(S),w("s3"),j(!1),console.log("[ThemeProvider] Loaded themes from S3:",S.length);return}}catch(S){console.error("[ThemeProvider] Failed to load themes from S3:",S)}g([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),w("fallback"),j(!1),console.log("[ThemeProvider] Using fallback themes")})()},[n,o]),i.useEffect(()=>{if(!l)return;const N=window.matchMedia("(prefers-color-scheme: dark)"),k=S=>{h(S.matches?"dark":"light")};return h(N.matches?"dark":"light"),N.addEventListener("change",k),()=>N.removeEventListener("change",k)},[l]),i.useEffect(()=>{if(f.length===0)return;const N=localStorage.getItem(r),k=f.map(S=>S.id);N&&k.includes(N)&&m(N)},[r,f]),i.useEffect(()=>{if(f.length===0)return;const N=document.documentElement,k=c==="system"&&u?u:c;f.forEach(S=>N.classList.remove(S.id)),N.classList.add(k),N.setAttribute("data-theme",k),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Theme applied: ${k}`)},[c,u,f]);const y=i.useCallback(N=>{const k=f.map(S=>S.id);if(!k.includes(N)&&N!=="system"){console.warn(`[WakaUI] Theme "${N}" is not in the list of available themes:`,k);return}m(N),localStorage.setItem(r,N)},[f,r]),v=i.useMemo(()=>({theme:c,setTheme:y,themes:f,systemTheme:u,isLoadingThemes:p,themesSource:b}),[c,y,f,u,p,b]);return e.jsx(Np.Provider,{value:v,children:t})}function p$(t){return t.length===0?[]:typeof t[0]=="string"?t.map(s=>({id:s,label:j$(s),previewColor:v$(s)})):t}async function b$(t){try{const s=await fetch("/api/themes/list",{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return(await s.json()).themes||[]}catch(s){return console.error("[ThemeProvider] Failed to fetch themes from S3:",s),[]}}function j$(t){return t.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function v$(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function y$(){const t=i.useContext(Np);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function w$({children:t,config:s}){const[a]=i.useState(()=>Yt.createInstance()),[r,n]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{await a.use(zt.initReactI18next).init({lng:s.language.defaultLanguage,fallbackLng:s.language.defaultLanguage,supportedLngs:s.language.supportedLanguages,resources:s.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:s.debug}),s.language.s3Config&&await N$(a,s.language.s3Config,s.language.supportedLanguages),n(!0),s.debug&&console.log("[WakaUI] i18n initialized successfully")}catch(o){console.error("[WakaUI] Failed to initialize i18n:",o),n(!0)}})()},[a,s]),i.useEffect(()=>{if(!r)return;const l=s.language.storageKey||"waka-ui-language",o=localStorage.getItem(l);o&&s.language.supportedLanguages.includes(o)&&a.changeLanguage(o);const c=m=>{localStorage.setItem(l,m),s.debug&&console.log(`[WakaUI] Language changed to: ${m}`)};return a.on("languageChanged",c),()=>{a.off("languageChanged",c)}},[r,a,s]),r?e.jsx(zt.I18nextProvider,{i18n:a,children:e.jsx(wp,{languages:s.language.languages||[],defaultLanguage:s.language.defaultLanguage,s3Config:s.language.s3Config?{baseUrl:s.language.s3Config.bucketUrl,prefix:s.language.s3Config.translationsPath?`${s.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(ox,{themes:s.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:s.theme?.defaultTheme||"default",s3Config:s.theme?.s3Config,enableDarkMode:s.theme?.enableSystem,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function N$(t,s,a){if(!s)return;const{bucketUrl:r,translationsPath:n="translations"}=s;try{await Promise.all(a.map(async l=>{try{const o=`${r}/${n}/${l}.json`,c=await fetch(o);if(!c.ok){console.warn(`[WakaUI] Failed to load translations for ${l} from S3`);return}const m=await c.json();t.addResourceBundle(l,"translation",m,!0,!0),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Loaded translations for ${l} from S3`)}catch(o){console.warn(`[WakaUI] Error loading translations for ${l}:`,o)}}))}catch(l){console.error("[WakaUI] Error loading translations from S3:",l)}}function k$(){const{i18n:t,t:s}=zt.useTranslation(),a=sc(),r=ir();return{currentLanguage:t.language||a.currentLanguage,changeLanguage:async n=>{await a.changeLanguage(n),await t.changeLanguage(n)},languages:a.languages,isLanguageLoading:a.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t:s}}const ac=i.createContext(void 0);function C$({children:t,initialSelection:s,onSelectionChange:a,persistKey:r="admincrumb-selection"}){const[n,l]=i.useState(()=>{if(typeof window<"u"&&r){const p=localStorage.getItem(r);if(p)try{return JSON.parse(p)}catch(j){console.error("Failed to parse stored admincrumb selection",j)}}return s||{}});i.useEffect(()=>{typeof window<"u"&&r&&localStorage.setItem(r,JSON.stringify(n))},[n,r]),i.useEffect(()=>{a?.(n)},[n,a]);const o=i.useCallback(p=>{l({partner:p,network:void 0,customer:void 0})},[]),c=i.useCallback(p=>{l(j=>({...j,network:p,customer:void 0}))},[]),m=i.useCallback(p=>{l(j=>({...j,customer:p}))},[]),u=i.useCallback(()=>{l({})},[]),h=i.useMemo(()=>!!(n.partner||n.network||n.customer),[n]),f=i.useCallback(()=>({...n.partner?.id&&{partnerId:n.partner.id},...n.network?.id&&{networkId:n.network.id},...n.customer?.id&&{customerId:n.customer.id}}),[n]),g=i.useMemo(()=>({selection:n,setPartner:o,setNetwork:c,setCustomer:m,reset:u,isFiltered:h,getFilterQuery:f}),[n,o,c,m,u,h,f]);return e.jsx(ac.Provider,{value:g,children:t})}function S$(){const t=i.useContext(ac);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function M$(){return i.useContext(ac)}const T$={github:x.Github,twitter:x.Twitter,linkedin:x.Linkedin,email:x.Mail};function D$({columns:t=[],socialLinks:s=[],copyright:a="© 2024 Tous droits réservés.",className:r}){return e.jsx("footer",{className:d.cn("bg-muted/40",r),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((n,l)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("ul",{className:"space-y-2",children:n.links.map((o,c)=>e.jsx("li",{children:e.jsx("a",{href:o.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:o.label})},c))})]},l)),s.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:s.map((n,l)=>{const o=T$[n.platform];return e.jsx(L.Button,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":n.platform,children:e.jsx(o,{className:"h-4 w-4"})})},l)})})]})]}),e.jsx(L.Separator,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function $$({items:t,defaultActiveId:s,variant:a="default",size:r="md",className:n,onTabChange:l}){const[o,c]=i.useState(s||t[0]?.id||""),m=f=>{c(f),l?.(f)},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},h={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:d.cn("w-full",n),children:e.jsxs(rs,{value:o,onValueChange:m,children:[e.jsx(Ut,{className:d.cn("grid w-full",a==="pills"&&"grid-cols-auto",a!=="pills"&&`grid-cols-${t.length}`,h[a]),children:t.map(f=>e.jsx(dt,{value:f.id,disabled:f.disabled,className:d.cn(u[r],a==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",a==="pills"&&"rounded-full"),children:f.label},f.id))}),t.map(f=>e.jsx(ut,{value:f.id,className:"mt-6",children:f.content},f.id))]})})}function A$({items:t,separator:s="/",className:a}){return e.jsx("nav",{className:d.cn("flex items-center space-x-1 text-sm text-muted-foreground",a),children:t.map((r,n)=>e.jsxs(i.Fragment,{children:[n>0&&e.jsx("span",{className:"mx-2 text-muted-foreground",children:s}),r.href?e.jsx("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):e.jsx("span",{className:"text-foreground font-medium",children:r.label})]},n))})}function E$({variant:t="dropdown",showFlags:s=!0,className:a}){const{currentLanguage:r,languages:n,changeLanguage:l,isLoading:o}=sc(),c=n.find(m=>m.code===r);return t==="select"?e.jsxs(Ee,{value:r,onValueChange:l,disabled:o,children:[e.jsx($e,{className:d.cn("w-[180px]",a),children:e.jsxs(Re,{children:[s&&c?.flagEmoji&&e.jsx("span",{className:"mr-2",children:c.flagEmoji}),c?.label]})}),e.jsx(Ae,{children:n.map(m=>e.jsxs(xe,{value:m.code,children:[s&&m.flagEmoji&&e.jsx("span",{className:"mr-2",children:m.flagEmoji}),m.label]},m.code))})]}):e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",className:d.cn("gap-2",a),disabled:o,children:[e.jsx(x.Globe,{className:"h-4 w-4"}),s&&c?.flagEmoji&&e.jsx("span",{children:c.flagEmoji}),c?.label]})}),e.jsx(We,{align:"end",children:n.map(m=>e.jsxs(ye,{onClick:()=>l(m.code),className:"cursor-pointer",children:[s&&m.flagEmoji&&e.jsx("span",{className:"mr-2",children:m.flagEmoji}),m.label]},m.code))})]})}function R$({children:t,header:s,sidebar:a,footer:r,collapsible:n=!1,className:l}){const[o,c]=i.useState(!1);return e.jsxs("div",{className:d.cn("min-h-screen bg-background",l),children:[s&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[n&&a&&e.jsxs(nr,{open:o,onOpenChange:c,children:[e.jsx(Eo,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(x.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(ua,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:()=>c(!1),children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a})]})})]}),s]})}),e.jsxs("div",{className:"flex",children:[a&&!n&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:a})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),r&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:r})})]})}function I$({config:t,onSubmit:s,onForgotPassword:a,onSignUp:r,onSSOGoogle:n,onSSOMicrosoft:l,onSSOApple:o,onSSOLinkedIn:c,onSSOGithub:m,onSSOFacebook:u,onSSOInstagram:h,onSSOFranceConnect:f,showSocialLogin:g=!1,className:p}){let j=!1;try{j=ir().isDarkMode}catch{}const b=t?.theme_json?.dark_mode??j,[w,y]=i.useState({email:"",password:"",rememberMe:!1}),[v,N]=i.useState(!1),k=i.useMemo(()=>t?.assets?b?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,b]),S=i.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),C=i.useMemo(()=>{const T=[];if(!t?.signup_options)return g&&(m&&T.push({id:"github",label:"GitHub",icon:e.jsx(x.Github,{className:"h-4 w-4"}),onClick:m}),n&&T.push({id:"google",label:"Google",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:n})),T;const E=t.signup_options;return E.allow_sso_google&&T.push({id:"google",label:"Google",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:n}),E.allow_sso_microsoft&&T.push({id:"microsoft",label:"Microsoft",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:l}),E.allow_sso_apple&&T.push({id:"apple",label:"Apple",icon:e.jsx(x.Apple,{className:"h-4 w-4"}),onClick:o}),E.allow_sso_linkedIn&&T.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(x.Linkedin,{className:"h-4 w-4"}),onClick:c}),E.allow_sso_github&&T.push({id:"github",label:"GitHub",icon:e.jsx(x.Github,{className:"h-4 w-4"}),onClick:m}),E.allow_sso_facebook&&T.push({id:"facebook",label:"Facebook",icon:e.jsx(x.Facebook,{className:"h-4 w-4"}),onClick:u}),E.allow_sso_instagram&&T.push({id:"instagram",label:"Instagram",icon:e.jsx(x.Instagram,{className:"h-4 w-4"}),onClick:h}),E.allow_sso_france_connect&&T.push({id:"france-connect",label:"France Connect",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:f}),T},[t?.signup_options,g,n,l,o,c,m,u,h,f]),M=t?.signup_options?.allow_login!==!1,D=async T=>{T.preventDefault(),N(!0);try{await s?.(w)}finally{N(!1)}},A=T=>E=>{y(I=>({...I,[T]:T==="rememberMe"?E.target.checked:E.target.value}))};return e.jsx("div",{className:d.cn("flex items-center justify-center p-4",p),style:S,children:e.jsxs(me,{className:"w-full max-w-md",children:[e.jsxs(we,{className:"space-y-1",children:[k&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:k,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Ne,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(Ze,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(fe,{className:"space-y-4",children:[C.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d.cn("grid gap-4",C.length===1?"grid-cols-1":"grid-cols-2"),children:C.map(T=>e.jsxs(L.Button,{variant:"outline",className:"w-full",onClick:T.onClick,type:"button",children:[T.icon,T.label]},T.id))}),M&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(L.Separator,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),M&&e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"email",children:"Email"}),e.jsx(L.Input,{id:"email",type:"email",placeholder:"votre@email.com",value:w.email,onChange:A("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"password",children:"Mot de passe"}),e.jsx(L.Input,{id:"password",type:"password",placeholder:"••••••••",value:w.password,onChange:A("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:w.rememberMe,onChange:A("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(L.Label,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),a&&e.jsx(L.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:a,children:"Mot de passe oublié ?"})]}),e.jsx(L.Button,{type:"submit",className:"w-full",disabled:v,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:v?"Connexion...":"Se connecter"})]}),r&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(L.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:r,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const kp=i.createContext(null);function P$(){const t=i.useContext(kp);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function L$({config:t}){const s=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:s}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:s}):e.jsx("div",{children:s})}function Cp({item:t,isChild:s=!1,renderItem:a}){const{activeId:r,setActiveId:n,expandedIds:l,toggleExpanded:o,isMobile:c,closeOnNavigate:m,onClose:u}=P$(),h=t.children&&t.children.length>0,f=l.includes(t.id),g=r===t.id||t.active,p=()=>{t.disabled||(h?o(t.id):(n(t.id),t.onClick?.(),c&&m&&u()))};if(a)return e.jsx(e.Fragment,{children:a(t,s)});const j=e.jsxs("div",{className:d.cn("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&&!h&&"bg-sidebar-active text-sidebar-active-foreground",s&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:d.cn("flex-shrink-0",s?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.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:t.badge}),h&&e.jsx(x.ChevronDown,{className:d.cn("h-4 w-4 transition-transform duration-200",f&&"rotate-180")})]});return h?e.jsxs(um,{open:f,onOpenChange:()=>o(t.id),children:[e.jsx(mm,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:j})}),e.jsx(xm,{className:"space-y-1 pt-1",children:t.children?.map(b=>e.jsx(Cp,{item:b,isChild:!0,renderItem:a},b.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:b=>{if(t.disabled){b.preventDefault();return}p()},className:"block",children:j}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:p,children:j})}function Fu({config:t}){const s=t.initials||t.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase(),a=[{id:"profile",label:"Profil",icon:e.jsx(x.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(x.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(x.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],r=t.actions??a;return e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.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:[e.jsxs(tt,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(st,{src:t.avatarUrl,alt:t.name}),e.jsx(at,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:s})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(x.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(We,{align:"end",className:"w-56",children:r.map((n,l)=>e.jsxs(i.Fragment,{children:[n.variant==="destructive"&&l>0&&e.jsx(Ke,{}),e.jsx(ye,{onClick:n.onClick,className:d.cn(n.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!n.href,children:n.href?e.jsxs("a",{href:n.href,className:"flex items-center gap-2",children:[n.icon,n.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[n.icon,n.label]})})]},n.id))})]})}function F$({logo:t,menu:s,user:a,userPosition:r="bottom",header:n,footer:l,renderItem:o}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(L$,{config:t})}),n&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:n}),a&&r==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx(Fu,{config:a})}),e.jsx(Ie,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:s.map(c=>e.jsx(Cp,{item:c,renderItem:o},c.id))})}),l&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:l}),a&&r==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx(Fu,{config:a})})]})}function Sp({logo:t,menu:s,user:a,width:r=260,mobileBreakpoint:n=768,open:l,onOpenChange:o,className:c,contentClassName:m,backgroundColor:u,textColor:h,activeColor:f,hoverColor:g,userPosition:p="bottom",showHamburger:j=!0,hamburgerPosition:b="left",renderItem:w,footer:y,header:v,position:N="fixed"}){const[k,S]=i.useState(!1),C=l!==void 0,M=C?l:k,D=C?o:S,[A,T]=i.useState(!1);i.useEffect(()=>{const O=()=>{T(window.innerWidth<n)};return O(),window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[n]);const[E,I]=i.useState(()=>{const O=_=>{for(const z of _){if(z.active)return z.id;if(z.children){const V=O(z.children);if(V)return V}}return null};return O(s)}),[$,P]=i.useState(()=>{const O=(_,z=[])=>{for(const V of _){if(V.active)return z;if(V.children){const q=O(V.children,[...z,V.id]);if(q.length>z.length)return q}}return[]};return O(s)}),R=i.useCallback(O=>{P(_=>_.includes(O)?_.filter(z=>z!==O):[..._,O])},[]),F={activeId:E,setActiveId:I,expandedIds:$,toggleExpanded:R,isMobile:A,closeOnNavigate:!0,onClose:()=>D(!1)},W={"--sidebar-bg":u||"hsl(var(--sidebar-background, var(--card)))","--sidebar-text":h||"hsl(var(--sidebar-foreground, var(--card-foreground)))","--sidebar-active":f||"hsl(var(--sidebar-primary, var(--primary)))","--sidebar-active-foreground":"hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))","--sidebar-hover":g||"hsl(var(--sidebar-accent, var(--accent)))"},U=d.cn("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)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",m),G=e.jsx(kp.Provider,{value:F,children:e.jsx("div",{className:d.cn("h-full",U),style:W,children:e.jsx(F$,{logo:t,menu:s,user:a,userPosition:p,header:v,footer:y,renderItem:w})})});return e.jsxs(e.Fragment,{children:[j&&A&&e.jsxs(L.Button,{variant:"ghost",size:"icon",className:d.cn("fixed top-3 z-50",b==="left"?"left-3":"right-3"),onClick:()=>D(!0),children:[e.jsx(x.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!A&&e.jsx("aside",{className:d.cn(N==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",c),style:{width:r},children:G}),A&&e.jsx(nr,{open:M,onOpenChange:D,children:e.jsxs(ua,{side:"left",className:d.cn("w-[280px] p-0 border-0",c),style:W,"aria-describedby":"sidebar-description",children:[e.jsx(lr,{className:"sr-only",children:"Menu de navigation"}),e.jsx(or,{id:"sidebar-description",className:"sr-only",children:"Menu principal de l'application"}),G]})})]})}function B$(){const[t,s]=i.useState(!1),a=i.useCallback(()=>s(!0),[]),r=i.useCallback(()=>s(!1),[]),n=i.useCallback(()=>s(l=>!l),[]);return{isOpen:t,setIsOpen:s,open:a,close:r,toggle:n}}function z$({sidebar:t,children:s,sidebarWidth:a=260,className:r,contentClassName:n}){const[l,o]=i.useState(!1),c=t.mobileBreakpoint||768;return i.useEffect(()=>{const m=()=>o(window.innerWidth<c);return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[c]),e.jsxs("div",{className:d.cn("min-h-screen bg-background",r),children:[e.jsx(Sp,{...t,width:a}),e.jsx("main",{className:d.cn("min-h-screen transition-all duration-300",n),style:{marginLeft:l?0:a},children:s})]})}function W$({title:t,subtitle:s,showSearch:a=!0,searchPlaceholder:r="Rechercher...",searchValue:n,onSearchChange:l,onSearchSubmit:o,primaryAction:c,secondaryActions:m,filters:u,notifications:h,unreadCount:f=0,onNotificationsClick:g,userMenu:p,leftContent:j,rightContent:b,filterContent:w,className:y,mainBarClassName:v,filterBarClassName:N,sticky:k=!0}){const[S,C]=i.useState(n||""),M=T=>{const E=T.target.value;C(E),l?.(E)},D=T=>{T.key==="Enter"&&o?.(S)},A=u&&u.length>0||w;return e.jsxs("header",{className:d.cn("w-full bg-background border-b",k&&"sticky top-0 z-50",y),children:[e.jsxs("div",{className:d.cn("flex items-center gap-4 px-4 py-2 min-h-[56px]",v),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[c&&e.jsxs(L.Button,{variant:c.variant||"default",size:"sm",onClick:c.onClick,className:"gap-2",children:[c.icon||e.jsx(x.Plus,{className:"h-4 w-4"}),c.label]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{type:"search",placeholder:r,value:S,onChange:M,onKeyDown:D,className:"pl-9 w-[200px] h-9 bg-muted/50"})]}),j]}),(t||s)&&e.jsxs("div",{className:"flex-1 text-center",children:[t&&e.jsx("h1",{className:"text-lg font-semibold leading-none",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[m?.map(T=>e.jsxs(L.Button,{variant:T.variant||"ghost",size:"sm",onClick:T.onClick,className:"gap-2",children:[T.icon,T.label]},T.id)),b,(h||g)&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"icon",className:"relative",onClick:h?void 0:g,children:[e.jsx(x.Bell,{className:"h-5 w-5"}),f>0&&e.jsx(ne,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs",children:f>9?"9+":f})]})}),h&&h.length>0&&e.jsxs(We,{align:"end",className:"w-80",children:[e.jsx("div",{className:"p-2 font-semibold border-b",children:"Notifications"}),h.slice(0,5).map(T=>e.jsxs(ye,{onClick:T.onClick,className:d.cn("flex flex-col items-start gap-1 p-3",!T.read&&"bg-muted/50"),children:[e.jsx("div",{className:"font-medium",children:T.title}),T.description&&e.jsx("div",{className:"text-sm text-muted-foreground",children:T.description}),T.time&&e.jsx("div",{className:"text-xs text-muted-foreground",children:T.time})]},T.id))]})]}),p&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsxs(tt,{className:"h-7 w-7",children:[p.avatar&&e.jsx(st,{src:p.avatar,alt:p.name}),e.jsx(at,{className:"text-xs",children:p.initials||p.name.slice(0,2).toUpperCase()})]}),e.jsx(x.ChevronDown,{className:"h-4 w-4"})]})}),e.jsxs(We,{align:"end",className:"w-56",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-medium",children:p.name}),p.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p.email})]}),e.jsx(Ke,{}),p.items.map((T,E)=>T.separator?e.jsx(Ke,{},E):e.jsxs(ye,{onClick:T.onClick,children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]},E))]})]})]})]}),A&&e.jsxs("div",{className:d.cn("flex items-center gap-2 px-4 py-2 border-t bg-muted/30",N),children:[u?.map(T=>e.jsxs(Ee,{value:T.value,onValueChange:T.onChange,children:[e.jsxs($e,{className:"w-auto h-8 gap-2 bg-muted/50 border-0",children:[T.icon,e.jsx(Re,{placeholder:T.placeholder||T.label})]}),e.jsx(Ae,{children:T.options.map(E=>e.jsx(xe,{value:E.value,children:E.label},E.value))})]},T.id)),w]})]})}function O$({title:t="Tableau de bord",description:s,period:a,onPeriodChange:r,periods:n=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"},{value:"year",label:"Cette année"}],onRefresh:l,loading:o,quickActions:c}){return e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",children:[e.jsx(x.Calendar,{className:"mr-2 h-4 w-4"}),n.find(m=>m.value===a)?.label||"Période"]})}),e.jsx(We,{align:"end",children:n.map(m=>e.jsx(ye,{onClick:()=>r(m.value),className:d.cn(a===m.value&&"bg-muted"),children:m.label},m.value))})]}),l&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:l,disabled:o,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",o&&"animate-spin")})}),c?.map(m=>e.jsx(L.Button,{variant:m.variant||"default",size:"sm",onClick:m.onClick,asChild:!!m.href,children:m.href?e.jsxs("a",{href:m.href,children:[m.icon&&e.jsx("span",{className:"mr-2",children:m.icon}),m.label]}):e.jsxs(e.Fragment,{children:[m.icon&&e.jsx("span",{className:"mr-2",children:m.icon}),m.label]})},m.id))]})]})}function U$({stats:t,layout:s="grid",columns:a=4,loading:r}){return e.jsx(Vx,{layout:s,columns:a,gap:"md",children:t.map(n=>e.jsx(_x,{label:n.label,value:n.value,trend:n.trend,trendValue:n.trendValue,trendText:n.trendText,icon:n.icon,color:n.color,variant:"card",loading:r},n.id))})}function _$({config:t}){return e.jsxs(me,{children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(We,{align:"end",children:t.actions.map((s,a)=>e.jsx(ye,{onClick:s.onClick,children:s.label},a))})]})]}),e.jsx(fe,{children:t.chart})]})}function V$({config:t}){return e.jsxs(me,{children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"flex gap-2",children:t.actions.map((s,a)=>e.jsx(L.Button,{variant:"outline",size:"sm",onClick:s.onClick,asChild:!!s.href,children:s.href?e.jsxs("a",{href:s.href,children:[s.label,e.jsx(x.ArrowUpRight,{className:"ml-1 h-3 w-3"})]}):s.label},a))})]}),e.jsx(fe,{children:t.table})]})}function H$({activities:t}){const s=r=>{const n=typeof r=="string"?new Date(r):r,o=new Date().getTime()-n.getTime(),c=Math.floor(o/6e4),m=Math.floor(c/60),u=Math.floor(m/24);return c<1?"À l'instant":c<60?`Il y a ${c} min`:m<24?`Il y a ${m}h`:u<7?`Il y a ${u}j`:n.toLocaleDateString("fr-FR")},a={info:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500"};return e.jsxs(me,{children:[e.jsx(we,{children:e.jsx(Ne,{className:"text-base",children:"Activité récente"})}),e.jsx(fe,{children:e.jsx("div",{className:"space-y-4",children:t.map(r=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:d.cn("h-2 w-2 rounded-full mt-2 flex-shrink-0",a[r.type||"info"])}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r.title}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:s(r.timestamp)})]},r.id))})})]})}function G$({title:t="Tableau de bord",description:s,stats:a,charts:r,tables:n,activities:l,quickActions:o,showHeader:c=!0,onRefresh:m,loading:u=!1,period:h="month",onPeriodChange:f,periods:g,statsLayout:p="grid",statsColumns:j=4,className:b}){return e.jsxs("div",{className:d.cn("space-y-6",b),children:[c&&e.jsx(O$,{title:t,description:s,period:h,onPeriodChange:f,periods:g,onRefresh:m,loading:u,quickActions:o}),a&&a.length>0&&e.jsx(U$,{stats:a,layout:p,columns:j,loading:u}),r&&r.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:r.map(w=>e.jsx(_$,{config:w},w.id))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[n&&n.length>0&&e.jsx("div",{className:d.cn("space-y-6",l?"lg:col-span-2":"lg:col-span-3"),children:n.map(w=>e.jsx(V$,{config:w},w.id))}),l&&l.length>0&&e.jsx("div",{className:d.cn(!n||n.length===0?"lg:col-span-3":""),children:e.jsx(H$,{activities:l})})]})]})}const q$=[{id:"revenue",label:"Revenus",value:"€45,231.89",trend:"up",trendValue:"+20.1%",trendText:"vs mois dernier",icon:e.jsx(x.DollarSign,{className:"h-5 w-5"}),color:"success"},{id:"users",label:"Utilisateurs",value:"2,350",trend:"up",trendValue:"+180",trendText:"cette semaine",icon:e.jsx(x.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:e.jsx(x.ShoppingCart,{className:"h-5 w-5"}),color:"purple"},{id:"performance",label:"Performance",value:"94.2%",trend:"up",trendValue:"+2.4%",icon:e.jsx(x.Activity,{className:"h-5 w-5"}),color:"primary"}];function X$({field:t,value:s,onChange:a}){const r=n=>{a?.(n)};return t.type==="custom"&&t.customComponent?e.jsx("div",{className:"space-y-2",children:t.customComponent}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(L.Label,{htmlFor:t.id,className:"text-sm font-medium",children:[t.label,t.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.type==="switch"&&e.jsx(Us,{id:t.id,checked:s,onCheckedChange:r,disabled:t.disabled})]}),t.description&&t.type!=="switch"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="switch"&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="text"&&e.jsx(L.Input,{id:t.id,type:"text",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="email"&&e.jsx(L.Input,{id:t.id,type:"email",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="password"&&e.jsx(L.Input,{id:t.id,type:"password",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="textarea"&&e.jsx(L.Textarea,{id:t.id,value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled,rows:3}),t.type==="select"&&t.options&&e.jsxs(Ee,{value:s,onValueChange:r,disabled:t.disabled,children:[e.jsx($e,{id:t.id,children:e.jsx(Re,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Ae,{children:t.options.map(n=>e.jsx(xe,{value:n.value,children:n.label},n.value))})]})]})}function Y$({section:t,values:s,onChange:a}){return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]})]})}),e.jsx(fe,{className:"space-y-6",children:t.fields.map((r,n)=>e.jsxs(i.Fragment,{children:[e.jsx(X$,{field:r,value:s?.[r.id],onChange:l=>a?.(r.id,l)}),n<t.fields.length-1&&e.jsx(L.Separator,{className:"my-4"})]},r.id))})]})}function Z$({title:t="Paramètres",description:s="Gérez les paramètres de votre compte et de l'application.",tabs:a,sections:r,useTabs:n=!0,defaultTab:l,values:o={},onChange:c,onSave:m,saving:u=!1,showSaveButton:h=!0,showDeleteAccount:f=!1,onDeleteAccount:g,className:p}){const[j,b]=i.useState(o),[w,y]=i.useState(!1);i.useEffect(()=>{b(o)},[o]);const v=(S,C)=>{b(M=>({...M,[S]:C})),y(!0),c?.(S,C)},N=async()=>{await m?.(j),y(!1)},k=S=>e.jsx("div",{className:"space-y-6",children:S.map(C=>e.jsx(Y$,{section:C,values:j,onChange:v},C.id))});return e.jsxs("div",{className:d.cn("space-y-6",p),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),h&&m&&e.jsxs(L.Button,{onClick:N,disabled:u||!w,children:[u?e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(x.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),n&&a&&a.length>0?e.jsxs(rs,{defaultValue:l||a[0].id,className:"space-y-6",children:[e.jsx(Ut,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:a.map(S=>e.jsxs(dt,{value:S.id,className:"gap-2",children:[S.icon,S.label]},S.id))}),a.map(S=>e.jsx(ut,{value:S.id,className:"space-y-6",children:k(S.sections)},S.id))]}):r&&k(r),f&&g&&e.jsxs(me,{className:"border-destructive",children:[e.jsxs(we,{children:[e.jsxs(Ne,{className:"text-base text-destructive flex items-center gap-2",children:[e.jsx(x.Trash2,{className:"h-4 w-4"}),"Zone dangereuse"]}),e.jsx(Ze,{children:"Actions irréversibles concernant votre compte."})]}),e.jsx(fe,{children:e.jsxs(zs,{children:[e.jsx(tm,{asChild:!0,children:e.jsxs(L.Button,{variant:"destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer mon compte"]})}),e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Êtes-vous sûr ?"}),e.jsx(js,{children:"Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées."})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer définitivement"})]})]})]})})]})]})}const K$=[{id:"profile",label:"Profil",icon:e.jsx(x.User,{className:"h-4 w-4"}),sections:[{id:"personal",title:"Informations personnelles",description:"Mettez à jour vos informations personnelles.",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Shield,{className:"h-4 w-4"}),sections:[{id:"password",title:"Mot de passe",description:"Changez votre mot de passe.",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Palette,{className:"h-4 w-4"}),sections:[{id:"appearance",title:"Apparence",description:"Personnalisez l'apparence de l'application.",icon:e.jsx(x.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 Bu({url:t,name:s,size:a="lg",editable:r,onAvatarChange:n}){const l=i.useRef(null),o={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24",xl:"h-32 w-32"},c=s.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2),m=u=>{const h=u.target.files?.[0];h&&n&&n(h)};return e.jsxs("div",{className:"relative inline-block",children:[e.jsxs(tt,{className:d.cn(o[a],"border-4 border-background shadow-lg"),children:[e.jsx(st,{src:t,alt:s}),e.jsx(at,{className:"text-lg font-medium",children:c})]}),r&&n&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:l,type:"file",accept:"image/*",onChange:m,className:"hidden"}),e.jsx(L.Button,{size:"icon",variant:"secondary",className:"absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md",onClick:()=>l.current?.click(),children:e.jsx(x.Camera,{className:"h-4 w-4"})})]})]})}function Q$({field:t,value:s,onChange:a,isEditing:r}){if(!r)return e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:d.cn(!s&&"text-muted-foreground italic"),children:s||"Non renseigné"})]});const n={id:t.id,value:s||"",onChange:l=>a(l.target.value),placeholder:t.placeholder,disabled:t.disabled};return t.type==="textarea"?e.jsx(L.Textarea,{...n,rows:3}):t.type==="select"&&t.options?e.jsxs(Ee,{value:s,onValueChange:a,disabled:t.disabled,children:[e.jsx($e,{children:e.jsx(Re,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Ae,{children:t.options.map(l=>e.jsx(xe,{value:l.value,children:l.label},l.value))})]}):e.jsx(L.Input,{type:t.type||"text",...n})}function zu({section:t,values:s,onChange:a,isEditing:r}){return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]})]})}),e.jsx(fe,{className:"space-y-4",children:t.fields.map((n,l)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(L.Label,{htmlFor:n.id,className:"text-sm font-medium",children:[n.label,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx(Q$,{field:n,value:s[n.id]||"",onChange:o=>a(n.id,o),isEditing:r})]}),l<t.fields.length-1&&r&&e.jsx(L.Separator,{className:"my-4"})]},n.id))})]})}function J$({links:t,isEditing:s}){const a=r=>{switch(r){case"twitter":return e.jsx(x.Twitter,{className:"h-4 w-4"});case"github":return e.jsx(x.Github,{className:"h-4 w-4"});case"linkedin":return e.jsx(x.Linkedin,{className:"h-4 w-4"});case"website":return e.jsx(x.Globe,{className:"h-4 w-4"});default:return e.jsx(x.Link,{className:"h-4 w-4"})}};return s?e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[a(r.type),e.jsx(L.Input,{value:r.url,className:"flex-1",readOnly:!0})]},r.id))}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.map(r=>e.jsxs("a",{href:r.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:[a(r.type),e.jsx("span",{children:r.label||r.type})]},r.id))})}function eA({profile:t,editable:s=!1,isEditing:a,onEditToggle:r,onChange:n,onSave:l,saving:o=!1,onAvatarChange:c,customSections:m,showSocialLinks:u=!0,showStats:h=!1,stats:f,layout:g="card",useTabs:p=!1,className:j}){const[b,w]=i.useState(!1),[y,v]=i.useState(t),N=a??b;i.useEffect(()=>{v(t)},[t]);const k=I=>{r?r(I):w(I),I||v(t)},S=(I,$)=>{v(P=>({...P,[I]:$})),n?.(I,$)},C=async()=>{await l?.(y),k(!1)},M=[{id:"personal",title:"Informations personnelles",icon:e.jsx(x.User,{className:"h-5 w-5"}),fields:[{id:"firstName",label:"Prénom",value:y.firstName||"",type:"text",placeholder:"Jean",icon:e.jsx(x.User,{className:"h-4 w-4"})},{id:"lastName",label:"Nom",value:y.lastName||"",type:"text",placeholder:"Dupont"},{id:"email",label:"Email",value:y.email,type:"email",placeholder:"jean@exemple.com",required:!0,icon:e.jsx(x.Mail,{className:"h-4 w-4"})},{id:"phone",label:"Téléphone",value:y.phone||"",type:"tel",placeholder:"+33 6 12 34 56 78",icon:e.jsx(x.Phone,{className:"h-4 w-4"})},{id:"bio",label:"Bio",value:y.bio||"",type:"textarea",placeholder:"Parlez-nous de vous..."}]},{id:"professional",title:"Informations professionnelles",icon:e.jsx(x.Briefcase,{className:"h-5 w-5"}),fields:[{id:"role",label:"Poste",value:y.role||"",type:"text",placeholder:"Développeur Senior",icon:e.jsx(x.Briefcase,{className:"h-4 w-4"})},{id:"department",label:"Département",value:y.department||"",type:"text",placeholder:"Engineering"},{id:"company",label:"Entreprise",value:y.company||"",type:"text",placeholder:"Acme Inc.",icon:e.jsx(x.Building,{className:"h-4 w-4"})},{id:"location",label:"Localisation",value:y.location||"",type:"text",placeholder:"Paris, France",icon:e.jsx(x.MapPin,{className:"h-4 w-4"})},{id:"website",label:"Site web",value:y.website||"",type:"url",placeholder:"https://exemple.com",icon:e.jsx(x.Globe,{className:"h-4 w-4"})}]}],D=m||M,A={firstName:y.firstName||"",lastName:y.lastName||"",email:y.email,phone:y.phone||"",bio:y.bio||"",role:y.role||"",department:y.department||"",company:y.company||"",location:y.location||"",website:y.website||"",...y.customFields};if(g==="compact")return e.jsxs("div",{className:d.cn("flex items-center gap-4",j),children:[e.jsx(Bu,{url:y.avatarUrl,name:y.displayName,size:"md"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:y.displayName}),y.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:y.role}),y.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:y.email})]})]});const T=()=>e.jsxs("div",{className:"flex flex-col items-center text-center gap-4 md:flex-row md:text-left",children:[e.jsx(Bu,{url:y.avatarUrl,name:y.displayName,size:"xl",editable:s&&N,onAvatarChange:c}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:y.displayName}),y.role&&e.jsx("p",{className:"text-muted-foreground",children:y.role}),y.company&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Building,{className:"h-3 w-3"}),y.company]}),y.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.MapPin,{className:"h-3 w-3"}),y.location]})]}),s&&e.jsx("div",{className:"flex gap-2",children:N?e.jsxs(e.Fragment,{children:[e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:o,children:[e.jsx(x.X,{className:"mr-2 h-4 w-4"}),"Annuler"]}),e.jsxs(L.Button,{size:"sm",onClick:C,disabled:o,children:[o?e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(x.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}):e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[e.jsx(x.Edit3,{className:"mr-2 h-4 w-4"}),"Modifier"]})})]}),h&&f&&f.length>0&&e.jsx("div",{className:"flex gap-6 mt-4",children:f.map((I,$)=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:I.value}),e.jsx("div",{className:"text-xs text-muted-foreground",children:I.label})]},$))}),u&&y.socialLinks&&y.socialLinks.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(J$,{links:y.socialLinks,isEditing:N})}),y.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-1",children:[e.jsx(x.Calendar,{className:"h-3 w-3"}),"Membre depuis"," ",new Date(y.joinedAt).toLocaleDateString("fr-FR",{month:"long",year:"numeric"})]})]})]}),E=()=>e.jsx("div",{className:"space-y-6",children:D.map(I=>e.jsx(zu,{section:I,values:A,onChange:S,isEditing:N},I.id))});return g==="card"?e.jsx(me,{className:j,children:e.jsx(fe,{className:"pt-6",children:e.jsxs("div",{className:"space-y-6",children:[T(),e.jsx(L.Separator,{}),E()]})})}):e.jsxs("div",{className:d.cn("space-y-6",j),children:[T(),p?e.jsxs(rs,{defaultValue:D[0]?.id,className:"space-y-6",children:[e.jsx(Ut,{children:D.map(I=>e.jsxs(dt,{value:I.id,className:"gap-2",children:[I.icon,I.title]},I.id))}),D.map(I=>e.jsx(ut,{value:I.id,children:e.jsx(zu,{section:I,values:A,onChange:S,isEditing:N})},I.id))]}):E()]})}const tA={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"}]},Mp=[{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"}],Un={active:{label:"Actif",color:"bg-green-500",icon:x.CheckCircle},inactive:{label:"Inactif",color:"bg-gray-500",icon:x.XCircle},pending:{label:"En attente",color:"bg-yellow-500",icon:x.Mail},banned:{label:"Banni",color:"bg-red-500",icon:x.Ban}};function sA({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.displayName.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(tt,{className:a[s],children:[e.jsx(st,{src:t.avatarUrl,alt:t.displayName}),e.jsx(at,{className:"text-xs",children:r})]})}function aA({role:t,roles:s=Mp}){const a=s.find(n=>n.value===t),r=t==="admin"?x.ShieldAlert:t==="moderator"?x.ShieldCheck:x.Shield;return e.jsxs(ne,{variant:a?.color,children:[e.jsx(r,{className:"h-3 w-3 mr-1"}),a?.label||t]})}function rA({status:t}){const s=Un[t];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",s.color)}),e.jsx("span",{className:"text-sm",children:s.label})]})}function Wu({open:t,onOpenChange:s,user:a,roles:r,permissions:n,onSubmit:l,loading:o}){const[c,m]=i.useState({email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]});i.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,t]);const u=async f=>{f.preventDefault(),await l(c),s(!1)},h=f=>{m(g=>({...g,permissions:g.permissions?.includes(f)?g.permissions.filter(p=>p!==f):[...g.permissions||[],f]}))};return e.jsx(Jt,{open:t,onOpenChange:s,children:e.jsx(Ot,{className:"sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs(ms,{children:[e.jsx(es,{children:a?"Modifier l'utilisateur":"Créer un utilisateur"}),e.jsx(na,{children:a?"Modifiez les informations de l'utilisateur.":"Remplissez les informations pour créer un nouvel utilisateur."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"firstName",children:"Prénom"}),e.jsx(L.Input,{id:"firstName",value:c.firstName,onChange:f=>m(g=>({...g,firstName:f.target.value})),placeholder:"Jean"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"lastName",children:"Nom"}),e.jsx(L.Input,{id:"lastName",value:c.lastName,onChange:f=>m(g=>({...g,lastName:f.target.value})),placeholder:"Dupont"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"displayName",children:"Nom d'affichage *"}),e.jsx(L.Input,{id:"displayName",value:c.displayName,onChange:f=>m(g=>({...g,displayName:f.target.value})),placeholder:"Jean Dupont",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"email",children:"Email *"}),e.jsx(L.Input,{id:"email",type:"email",value:c.email,onChange:f=>m(g=>({...g,email:f.target.value})),placeholder:"jean@exemple.com",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"role",children:"Rôle"}),e.jsxs(Ee,{value:c.role,onValueChange:f=>m(g=>({...g,role:f})),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsx(Ae,{children:r.map(f=>e.jsx(xe,{value:f.value,children:f.label},f.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"status",children:"Statut"}),e.jsxs(Ee,{value:c.status,onValueChange:f=>m(g=>({...g,status:f})),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsx(Ae,{children:Object.entries(Un).map(([f,g])=>e.jsx(xe,{value:f,children:g.label},f))})]})]})]}),n&&n.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Permissions"}),e.jsx("div",{className:"border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto",children:n.map(f=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xt,{id:f.id,checked:c.permissions?.includes(f.id),onCheckedChange:()=>h(f.id)}),e.jsx("label",{htmlFor:f.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:f.name})]},f.id))})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Annuler"}),e.jsxs(L.Button,{type:"submit",disabled:o,children:[o&&e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Enregistrer":"Créer"]})]})]})})})}function nA({user:t,onEdit:s,onDelete:a,onResetPassword:r,onStatusChange:n,onRoleChange:l,roles:o}){return e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[s&&e.jsxs(ye,{onClick:s,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),r&&e.jsxs(ye,{onClick:r,children:[e.jsx(x.Key,{className:"mr-2 h-4 w-4"}),"Réinitialiser le mot de passe"]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsx(Ls,{children:"Changer le rôle"}),o.map(c=>e.jsx(ye,{onClick:()=>l(c.value),disabled:t.role===c.value,children:c.label},c.value))]}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsx(Ls,{children:"Changer le statut"}),Object.entries(Un).map(([c,m])=>e.jsx(ye,{onClick:()=>n(c),disabled:t.status===c,children:m.label},c))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:a,className:"text-destructive focus:text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})}function lA({users:t,roles:s=Mp,permissions:a,selectedUsers:r=[],onSelectionChange:n,onCreate:l,onEdit:o,onDelete:c,onBulkDelete:m,onRoleChange:u,onStatusChange:h,onResetPassword:f,onExport:g,onRefresh:p,loading:j=!1,actionLoading:b=!1,searchQuery:w="",onSearchChange:y,roleFilter:v="all",onRoleFilterChange:N,statusFilter:k="all",onStatusFilterChange:S,showBulkActions:C=!0,showCreateButton:M=!0,title:D="Gestion des utilisateurs",description:A="Gérez les utilisateurs, leurs rôles et permissions.",className:T}){const[E,I]=i.useState(!1),[$,P]=i.useState(null),[R,F]=i.useState(null),[W,U]=i.useState(!1),G=i.useMemo(()=>t.filter(Y=>{if(w){const Z=w.toLowerCase();if(!(Y.displayName.toLowerCase().includes(Z)||Y.email.toLowerCase().includes(Z)))return!1}return!(v!=="all"&&Y.role!==v||k!=="all"&&Y.status!==k)}),[t,w,v,k]),O=Y=>{n?.(Y?G.map(Z=>Z.id):[])},_=(Y,Z)=>{n?.(Z?[...r,Y]:r.filter(X=>X!==Y))},z=async Y=>{await l?.(Y)},V=async Y=>{$&&(await o?.($.id,Y),P(null))},q=async()=>{R&&(await c?.(R.id),F(null))},B=async()=>{await m?.(r),n?.([]),U(!1)},H=Y=>(typeof Y=="string"?new Date(Y):Y).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{className:d.cn("space-y-6",T),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-6 w-6"}),D]}),A&&e.jsx("p",{className:"text-muted-foreground mt-1",children:A})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:p,disabled:j,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",j&&"animate-spin")})}),g&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Exporter"]}),M&&l&&e.jsxs(L.Button,{size:"sm",onClick:()=>I(!0),children:[e.jsx(x.UserPlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})]}),e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[y&&e.jsxs("div",{className:"relative flex-1",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher un utilisateur...",value:w,onChange:Y=>y(Y.target.value),className:"pl-9"})]}),N&&e.jsxs(Ee,{value:v,onValueChange:Y=>N(Y),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(Re,{placeholder:"Rôle"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Tous les rôles"}),s.map(Y=>e.jsx(xe,{value:Y.value,children:Y.label},Y.value))]})]}),S&&e.jsxs(Ee,{value:k,onValueChange:Y=>S(Y),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(Re,{placeholder:"Statut"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Tous les statuts"}),Object.entries(Un).map(([Y,Z])=>e.jsx(xe,{value:Y,children:Z.label},Y))]})]})]}),C&&r.length>0&&e.jsxs("div",{className:"flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.length," utilisateur(s) sélectionné(s)"]}),m&&e.jsxs(L.Button,{variant:"destructive",size:"sm",onClick:()=>U(!0),children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]}),e.jsx(L.Button,{variant:"outline",size:"sm",onClick:()=>n?.([]),children:"Désélectionner"})]})]})}),e.jsx(me,{children:e.jsx(fe,{className:"p-0",children:e.jsxs(yn,{children:[e.jsx(wn,{children:e.jsxs(us,{children:[n&&e.jsx(jt,{className:"w-[50px]",children:e.jsx(xt,{checked:G.length>0&&r.length===G.length,onCheckedChange:O})}),e.jsx(jt,{children:"Utilisateur"}),e.jsx(jt,{children:"Rôle"}),e.jsx(jt,{children:"Statut"}),e.jsx(jt,{children:"Inscrit le"}),e.jsx(jt,{children:"Dernière connexion"}),e.jsx(jt,{className:"w-[50px]"})]})}),e.jsx(Nn,{children:j?e.jsx(us,{children:e.jsx(ft,{colSpan:n?7:6,className:"text-center py-8",children:e.jsx(x.Loader2,{className:"h-6 w-6 animate-spin mx-auto"})})}):G.length===0?e.jsx(us,{children:e.jsx(ft,{colSpan:n?7:6,className:"text-center py-8 text-muted-foreground",children:"Aucun utilisateur trouvé"})}):G.map(Y=>e.jsxs(us,{children:[n&&e.jsx(ft,{children:e.jsx(xt,{checked:r.includes(Y.id),onCheckedChange:Z=>_(Y.id,Z)})}),e.jsx(ft,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(sA,{user:Y}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Y.displayName}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Y.email})]})]})}),e.jsx(ft,{children:e.jsx(aA,{role:Y.role,roles:s})}),e.jsx(ft,{children:e.jsx(rA,{status:Y.status})}),e.jsx(ft,{className:"text-muted-foreground",children:H(Y.createdAt)}),e.jsx(ft,{className:"text-muted-foreground",children:Y.lastLogin?H(Y.lastLogin):"-"}),e.jsx(ft,{children:e.jsx(nA,{user:Y,roles:s,onEdit:o?()=>P(Y):void 0,onDelete:c?()=>F(Y):void 0,onResetPassword:f?()=>f(Y.id):void 0,onRoleChange:u?Z=>u(Y.id,Z):void 0,onStatusChange:h?Z=>h(Y.id,Z):void 0})})]},Y.id))})]})})}),e.jsx(Wu,{open:E,onOpenChange:I,roles:s,permissions:a,onSubmit:z,loading:b}),e.jsx(Wu,{open:!!$,onOpenChange:Y=>!Y&&P(null),user:$||void 0,roles:s,permissions:a,onSubmit:V,loading:b}),e.jsx(zs,{open:!!R,onOpenChange:Y=>!Y&&F(null),children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer l'utilisateur ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",R?.displayName," ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})}),e.jsx(zs,{open:W,onOpenChange:U,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer les utilisateurs ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",r.length," utilisateur(s) ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:B,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const oA=[{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")}],iA=[{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"}],Tp={created:{icon:x.Plus,color:"text-green-500",label:"créé"},updated:{icon:x.Edit,color:"text-blue-500",label:"modifié"},deleted:{icon:x.Trash2,color:"text-red-500",label:"supprimé"},commented:{icon:x.MessageSquare,color:"text-purple-500",label:"commenté"},uploaded:{icon:x.Upload,color:"text-cyan-500",label:"uploadé"},downloaded:{icon:x.Download,color:"text-gray-500",label:"téléchargé"},shared:{icon:x.User,color:"text-orange-500",label:"partagé"},approved:{icon:x.Check,color:"text-green-500",label:"approuvé"},rejected:{icon:x.X,color:"text-red-500",label:"rejeté"},mentioned:{icon:x.Bell,color:"text-yellow-500",label:"mentionné"},assigned:{icon:x.User,color:"text-indigo-500",label:"assigné"},completed:{icon:x.Check,color:"text-green-500",label:"terminé"},custom:{icon:x.AlertCircle,color:"text-gray-500",label:""}};function Ou({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(tt,{className:a[s],children:[e.jsx(st,{src:t.avatar,alt:t.name}),e.jsx(at,{className:"text-xs",children:r})]})}function Uu({type:t,customIcon:s,customColor:a}){const r=Tp[t],n=r.icon;return e.jsx("div",{className:d.cn("flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm",a||r.color),children:s||e.jsx(n,{className:"h-4 w-4"})})}function cA({activity:t,showAvatar:s,relativeTime:a,layout:r,isLast:n}){const l=c=>{const m=typeof c=="string"?new Date(c):c;if(a){const h=new Date().getTime()-m.getTime(),f=Math.floor(h/6e4),g=Math.floor(f/60),p=Math.floor(g/24);if(f<1)return"À l'instant";if(f<60)return`Il y a ${f} min`;if(g<24)return`Il y a ${g}h`;if(p<7)return`Il y a ${p}j`}return m.toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},o=Tp[t.type];return r==="compact"?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(Uu,{type:t.type,customIcon:t.icon,customColor:t.color}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"text-sm truncate",children:[e.jsx("span",{className:"font-medium",children:t.user.name})," ",e.jsx("span",{className:"text-muted-foreground",children:t.title})]})}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:l(t.timestamp)})]}):r==="feed"?e.jsx(me,{className:"mb-4",children:e.jsx(fe,{className:"pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[s&&e.jsx(Ou,{user:t.user,size:"md"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx(ne,{variant:"secondary",className:"text-xs",children:o.label||t.type}),e.jsx("span",{className:"text-xs text-muted-foreground",children:l(t.timestamp)})]}),e.jsx("p",{className:"text-sm",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment})]})]})})}):e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(Uu,{type:t.type,customIcon:t.icon,customColor:t.color}),!n&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-2"})]}),e.jsx("div",{className:"flex-1 pb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s&&e.jsx(Ou,{user:t.user}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx("span",{className:"text-muted-foreground",children:t.title})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment}),e.jsx("span",{className:"text-xs text-muted-foreground mt-2 block",children:l(t.timestamp)})]})]})})]})}function dA({activities:t,title:s="Activité",showSearch:a=!0,showFilters:r=!0,filters:n=[],activeFilter:l,onFilterChange:o,showRefresh:c=!0,onRefresh:m,loading:u=!1,groupByDay:h=!0,showLoadMore:f=!1,onLoadMore:g,loadingMore:p=!1,showAvatars:j=!0,relativeTime:b=!0,layout:w="timeline",className:y}){const[v,N]=i.useState(""),[k,S]=i.useState(null),C=l??k,M=E=>{o?o(E):S(E)},D=i.useMemo(()=>{let E=t;if(v){const I=v.toLowerCase();E=E.filter($=>$.title.toLowerCase().includes(I)||$.user.name.toLowerCase().includes(I)||$.description?.toLowerCase().includes(I))}if(C){const I=n.find($=>$.id===C);I&&(E=E.filter($=>I.types.includes($.type)))}return E},[t,v,C,n]),A=i.useMemo(()=>{if(!h)return null;const E={};return D.forEach(I=>{const P=(typeof I.timestamp=="string"?new Date(I.timestamp):I.timestamp).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"});E[P]||(E[P]=[]),E[P].push(I)}),E},[D,h]),T=E=>e.jsx("div",{children:E.map((I,$)=>e.jsx(cA,{activity:I,showAvatar:j,relativeTime:b,layout:w,isLast:$===E.length-1},I.id))});return e.jsxs("div",{className:d.cn("space-y-4",y),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:s}),e.jsx("div",{className:"flex items-center gap-2",children:c&&m&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:m,disabled:u,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",u&&"animate-spin")})})})]}),(a||r)&&e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:v,onChange:E=>N(E.target.value),className:"pl-9"})]}),r&&n.length>0&&e.jsxs(Ee,{value:C||"all",onValueChange:E=>M(E==="all"?null:E),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{placeholder:"Filtrer"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Toutes les activités"}),n.map(E=>e.jsx(xe,{value:E.id,children:E.label},E.id))]})]})]}),u?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(x.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):D.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(x.Clock,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune activité"})]}):h&&A?e.jsx("div",{className:"space-y-6",children:Object.entries(A).map(([E,I])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-4 capitalize",children:E}),T(I)]},E))}):T(D),f&&g&&e.jsx("div",{className:"flex justify-center pt-4",children:e.jsxs(L.Button,{variant:"outline",onClick:g,disabled:p,children:[p?e.jsx(x.RefreshCw,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(x.ChevronDown,{className:"h-4 w-4 mr-2"}),"Charger plus"]})})]})}const uA=[{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"]}],mA=[{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)}],rc={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 xA(t,s){const a=[],r=new Date(t,s+1,0);for(let n=1;n<=r.getDate();n++)a.push(new Date(t,s,n));return a}function io(t,s){return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function hA(t,s){return t.filter(a=>{const r=typeof a.start=="string"?new Date(a.start):a.start,n=typeof a.end=="string"?new Date(a.end):a.end;return a.allDay?io(r,s)||s>=r&&s<=n:io(r,s)})}function fA({currentDate:t,viewMode:s,onPrevious:a,onNext:r,onToday:n,onViewModeChange:l,onAddClick:o,showViewSelector:c,showAddButton:m,locale:u}){const h=()=>{switch(s){case"month":return t.toLocaleDateString(u,{month:"long",year:"numeric"});case"week":return`Semaine du ${t.toLocaleDateString(u,{day:"numeric",month:"long"})}`;case"day":return t.toLocaleDateString(u,{weekday:"long",day:"numeric",month:"long",year:"numeric"});case"agenda":return"Agenda";default:return""}};return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L.Button,{variant:"outline",size:"icon",onClick:a,children:e.jsx(x.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"outline",size:"icon",onClick:r,children:e.jsx(x.ChevronRight,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"outline",size:"sm",onClick:n,children:"Aujourd'hui"}),e.jsx("h2",{className:"text-xl font-semibold ml-4 capitalize",children:h()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&l&&e.jsxs(Ee,{value:s,onValueChange:f=>l(f),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"month",children:"Mois"}),e.jsx(xe,{value:"week",children:"Semaine"}),e.jsx(xe,{value:"day",children:"Jour"}),e.jsx(xe,{value:"agenda",children:"Agenda"})]})]}),m&&o&&e.jsxs(L.Button,{onClick:o,children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Événement"]})]})]})}function gA({event:t,onClick:s,compact:a=!1}){const r=rc[t.color||"blue"],n=typeof t.start=="string"?new Date(t.start):t.start;return e.jsxs("button",{onClick:l=>{l.stopPropagation(),s?.()},className:d.cn("w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2",r.bg,r.text,r.border),children:[!t.allDay&&!a&&e.jsx("span",{className:"font-medium mr-1",children:n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}),t.title]})}function pA({event:t,onEdit:s,onDelete:a}){const r=typeof t.start=="string"?new Date(t.start):t.start,n=typeof t.end=="string"?new Date(t.end):t.end,l=rc[t.color||"blue"];return e.jsxs("div",{className:"w-72",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:d.cn("w-3 h-3 rounded-full mt-1",l.bg.replace("100","500"))}),e.jsxs("div",{className:"flex gap-1",children:[s&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:e.jsx(x.Edit,{className:"h-3 w-3"})}),a&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,children:e.jsx(x.Trash2,{className:"h-3 w-3"})})]})]}),e.jsx("h4",{className:"font-semibold mt-2",children:t.title}),e.jsxs("div",{className:"space-y-2 mt-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Clock,{className:"h-4 w-4"}),t.allDay?e.jsx("span",{children:"Toute la journée"}):e.jsxs("span",{children:[r.toLocaleString("fr-FR",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})," - ",n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),t.location&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-4 w-4"}),e.jsx("span",{children:t.location})]}),t.attendees&&t.attendees.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-4 w-4"}),e.jsxs("span",{children:[t.attendees.length," participant(s)"]})]})]}),t.description&&e.jsx("p",{className:"mt-3 text-sm",children:t.description})]})}function bA({currentDate:t,events:s,weekStartsOn:a,locale:r,onDayClick:n,onEventClick:l,onEventEdit:o,onEventDelete:c}){const m=t.getFullYear(),u=t.getMonth(),h=xA(m,u),f=new Date,g=Array.from({length:7},(w,y)=>new Date(2024,0,a+y).toLocaleDateString(r,{weekday:"short"})),j=(new Date(m,u,1).getDay()-a+7)%7,b=[];for(let w=0;w<j;w++)b.push(null);for(b.push(...h);b.length%7!==0;)b.push(null);return e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 bg-muted",children:g.map(w=>e.jsx("div",{className:"p-2 text-center text-sm font-medium capitalize",children:w},w))}),e.jsx("div",{className:"grid grid-cols-7",children:b.map((w,y)=>{const v=w?hA(s,w):[],N=w&&io(w,f),k=w&&w.getMonth()===u;return e.jsx("div",{className:d.cn("min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50",!k&&"bg-muted/30 text-muted-foreground"),onClick:()=>w&&n?.(w),children:w&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d.cn("text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full",N&&"bg-primary text-primary-foreground"),children:w.getDate()}),e.jsxs("div",{className:"space-y-1",children:[v.slice(0,3).map(S=>e.jsxs(L.Popover,{children:[e.jsx(L.PopoverTrigger,{asChild:!0,children:e.jsx("div",{children:e.jsx(gA,{event:S,onClick:()=>l?.(S),compact:!0})})}),e.jsx(L.PopoverContent,{children:e.jsx(pA,{event:S,onEdit:()=>o?.(S.id,{}),onDelete:()=>c?.(S.id)})})]},S.id)),v.length>3&&e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground",children:["+",v.length-3," autres"]})]})]})},y)})})]})}function jA({currentDate:t,events:s,locale:a,onEventClick:r}){const n=s.filter(o=>{const c=typeof o.start=="string"?new Date(o.start):o.start,m=new Date(t);return m.setDate(m.getDate()+30),c>=t&&c<=m}).sort((o,c)=>{const m=typeof o.start=="string"?new Date(o.start):o.start,u=typeof c.start=="string"?new Date(c.start):c.start;return m.getTime()-u.getTime()}),l={};return n.forEach(o=>{const m=(typeof o.start=="string"?new Date(o.start):o.start).toDateString();l[m]||(l[m]=[]),l[m].push(o)}),e.jsxs("div",{className:"space-y-4",children:[Object.entries(l).map(([o,c])=>{const m=new Date(o);return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2 capitalize",children:m.toLocaleDateString(a,{weekday:"long",day:"numeric",month:"long"})}),e.jsx("div",{className:"space-y-2",children:c.map(u=>{const h=rc[u.color||"blue"],f=typeof u.start=="string"?new Date(u.start):u.start,g=typeof u.end=="string"?new Date(u.end):u.end;return e.jsx(me,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>r?.(u),children:e.jsxs(fe,{className:"p-3 flex gap-3",children:[e.jsx("div",{className:d.cn("w-1 rounded-full",h.bg.replace("100","500"))}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium",children:u.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u.allDay?"Toute la journée":`${f.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})} - ${g.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}`}),u.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(x.MapPin,{className:"h-3 w-3"}),u.location]})]})]})},u.id)})})]},o)}),Object.keys(l).length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun événement à venir"})]})}function vA({events:t,currentDate:s,onDateChange:a,viewMode:r,onViewModeChange:n,onEventClick:l,onEventCreate:o,onEventEdit:c,onEventDelete:m,onDayClick:u,showHeader:h=!0,showViewSelector:f=!0,showAddButton:g=!0,weekStartsOn:p=1,locale:j="fr-FR",className:b}){const[w,y]=i.useState(new Date),[v,N]=i.useState("month"),[k,S]=i.useState(!1),C=s??w,M=r??v,D=$=>{a?a($):y($)},A=$=>{n?n($):N($)},T=()=>{const $=new Date(C);switch(M){case"month":$.setMonth($.getMonth()-1);break;case"week":$.setDate($.getDate()-7);break;case"day":$.setDate($.getDate()-1);break}D($)},E=()=>{const $=new Date(C);switch(M){case"month":$.setMonth($.getMonth()+1);break;case"week":$.setDate($.getDate()+7);break;case"day":$.setDate($.getDate()+1);break}D($)},I=()=>{D(new Date)};return e.jsxs("div",{className:d.cn("space-y-4",b),children:[h&&e.jsx(fA,{currentDate:C,viewMode:M,onPrevious:T,onNext:E,onToday:I,onViewModeChange:A,onAddClick:()=>S(!0),showViewSelector:f,showAddButton:g,locale:j}),M==="month"&&e.jsx(bA,{currentDate:C,events:t,weekStartsOn:p,locale:j,onDayClick:u,onEventClick:l,onEventEdit:c,onEventDelete:m}),M==="agenda"&&e.jsx(jA,{currentDate:C,events:t,locale:j,onEventClick:l}),(M==="week"||M==="day")&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:["Vue ",M==="week"?"semaine":"jour"," - À implémenter"]})]})}const yA=[{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}],Dp="waka-chat-widget-position",co=t=>{if(typeof window>"u")return null;try{const s=localStorage.getItem(t);if(s)return JSON.parse(s)}catch{}return null},$p=(t,s)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,JSON.stringify(s))}catch{}};function wA({defaultPosition:t,position:s,onPositionChange:a,persistPosition:r=!0,positionStorageKey:n=Dp,defaultOpen:l=!1,open:o,onOpenChange:c,bubbleSize:m="md",bubbleColor:u="primary",bubbleIcon:h,bubbleText:f,showUnreadBadge:g=!0,bubbleAnimation:p="none",widgetPosition:j="top-left",widgetSize:b="md",bubbleClassName:w,widgetClassName:y,draggable:v=!0,constrainToViewport:N=!0,edgeOffset:k=16,onWidgetClose:S,onWidgetMinimize:C,zIndex:M=9999,conversations:D=[],...A}){const[T,E]=i.useState(l),[I,$]=i.useState(()=>{if(t)return t;if(r){const te=co(n);if(te)return te}return{x:typeof window<"u"?window.innerWidth-80:0,y:typeof window<"u"?window.innerHeight-80:0}}),[P,R]=i.useState(!1),[F,W]=i.useState({x:0,y:0}),U=i.useRef(null),G=o!==void 0?o:T,O=s!==void 0?s:I;i.useEffect(()=>{if(!(typeof window>"u")&&!s&&!t){const te=r?co(n):null;$(te||{x:window.innerWidth-80,y:window.innerHeight-80})}},[s,t,r,n]);const _=te=>{o===void 0&&E(te),c?.(te)},z=te=>{s===void 0&&$(te),a?.(te),r&&$p(n,te)},V=te=>{if(!N||typeof window>"u")return te;const ae=U.current?.offsetWidth||60,re=U.current?.offsetHeight||60;return{x:Math.max(k,Math.min(te.x,window.innerWidth-ae-k)),y:Math.max(k,Math.min(te.y,window.innerHeight-re-k))}},q=te=>{!v||G||(R(!0),W({x:te.clientX-O.x,y:te.clientY-O.y}))},B=te=>{if(!v||G)return;const ae=te.touches[0];R(!0),W({x:ae.clientX-O.x,y:ae.clientY-O.y})};i.useEffect(()=>{if(!P)return;const te=le=>{const de=V({x:le.clientX-F.x,y:le.clientY-F.y});z(de)},ae=le=>{const de=le.touches[0],oe=V({x:de.clientX-F.x,y:de.clientY-F.y});z(oe)},re=()=>{R(!1)};return document.addEventListener("mousemove",te),document.addEventListener("mouseup",re),document.addEventListener("touchmove",ae),document.addEventListener("touchend",re),()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",re),document.removeEventListener("touchmove",ae),document.removeEventListener("touchend",re)}},[P,F]);const H=()=>{P||_(!G)},Y=D.reduce((te,ae)=>te+(ae.unreadCount||0),0),Z={sm:"h-12 w-12",md:"h-14 w-14",lg:"h-16 w-16"},X={sm:"h-5 w-5",md:"h-6 w-6",lg:"h-7 w-7"},se={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"},K={none:"",pulse:"animate-pulse",bounce:"animate-bounce"},Q={sm:"h-[400px] w-[300px]",md:"h-[500px] w-[380px]",lg:"h-[600px] w-[420px]"},ee=()=>{const te=U.current?.offsetWidth||60,ae=U.current?.offsetHeight||60,re=Q[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),le=re?parseInt(re[1]):500,de=re?parseInt(re[2]):380;let oe=O.x,he=O.y;switch(j){case"top-left":oe=O.x-de+te,he=O.y-le-12;break;case"top-right":he=O.y-le-12;break;case"bottom-left":oe=O.x-de+te,he=O.y+ae+12;break;case"bottom-right":he=O.y+ae+12;break}return typeof window<"u"&&(oe=Math.max(k,Math.min(oe,window.innerWidth-de-k)),he=Math.max(k,Math.min(he,window.innerHeight-le-k))),{position:"fixed",left:oe,top:he,zIndex:M+1}};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:U,onClick:H,onMouseDown:q,onTouchStart:B,className:d.cn("fixed rounded-full shadow-lg transition-all duration-200","flex items-center justify-center gap-2",Z[m],se[u],K[p],P&&"cursor-grabbing scale-110",v&&!P&&!G&&"cursor-grab",G&&"opacity-0 pointer-events-none scale-75",f&&"px-4 w-auto",w),style:{left:O.x,top:O.y,zIndex:M,touchAction:"none"},"aria-label":"Ouvrir le chat",children:[h||e.jsx(x.MessageCircle,{className:X[m]}),f&&e.jsx("span",{className:"font-medium text-sm",children:f}),g&&Y>0&&e.jsx(ne,{className:d.cn("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:Y>99?"99+":Y})]}),G&&e.jsx("div",{className:d.cn("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",Q[b],y),style:ee(),children:e.jsx(Ap,{...A,conversations:D,layout:"widget",onClose:()=>{_(!1),S?.()},onMinimize:()=>{_(!1),C?.()},showCloseButton:!0,className:"h-full"})}),G&&e.jsx("div",{className:"fixed inset-0 bg-black/20 sm:hidden",style:{zIndex:M-1},onClick:()=>_(!1)})]})}function NA(t={}){const{defaultOpen:s=!1,defaultPosition:a,persistPosition:r=!0,positionStorageKey:n=Dp}=t,[l,o]=i.useState(s),[c,m]=i.useState(()=>{if(a)return a;if(typeof window>"u")return{x:0,y:0};if(r){const j=co(n);if(j)return j}return{x:window.innerWidth-80,y:window.innerHeight-80}}),u=()=>o(!0),h=()=>o(!1),f=()=>o(j=>!j),g=j=>{m(j),r&&$p(n,j)};return{isOpen:l,position:c,open:u,close:h,toggle:f,setIsOpen:o,updatePosition:g,resetPosition:()=>{if(typeof window>"u")return;const j=a||{x:window.innerWidth-80,y:window.innerHeight-80};g(j)},widgetProps:{open:l,onOpenChange:o,position:c,onPositionChange:g}}}const kA=t=>{const s=typeof t=="string"?new Date(t):t,a=new Date,r=new Date(a.getFullYear(),a.getMonth(),a.getDate()),n=new Date(r.getTime()-1440*60*1e3),l=new Date(s.getFullYear(),s.getMonth(),s.getDate());return l.getTime()===r.getTime()?"Aujourd'hui":l.getTime()===n.getTime()?"Hier":s.toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long"})},CA=(t,s)=>{const a=typeof t=="string"?new Date(t):t,r=typeof s=="string"?new Date(s):s;return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()&&a.getDate()===r.getDate()},nc=t=>{if(t.initials)return t.initials;const s=t.name.split(" ");return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t.name.substring(0,2).toUpperCase()};function SA({date:t}){return e.jsx("div",{className:"flex items-center justify-center my-4",children:e.jsx("div",{className:"px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full",children:kA(t)})})}function MA({conversations:t,activeId:s,currentUser:a,onSelect:r,onSearch:n}){const[l,o]=i.useState(""),c=f=>f.name?f.name:f.participants.filter(p=>p.id!==a.id).map(p=>p.name).join(", "),m=f=>{if(f.avatar)return{url:f.avatar,fallback:f.name?.charAt(0)||"G"};if(f.isGroup)return{fallback:"G"};const g=f.participants.find(p=>p.id!==a.id);return{url:g?.avatar,fallback:nc(g||{name:"?"})}},u=f=>{if(!f)return"";const g=typeof f=="string"?new Date(f):f,j=new Date().getTime()-g.getTime(),b=Math.floor(j/(1e3*60*60*24));return b===0?g.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):b===1?"Hier":b<7?g.toLocaleDateString("fr-FR",{weekday:"short"}):g.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})},h=t.filter(f=>l?c(f).toLowerCase().includes(l.toLowerCase()):!0);return e.jsxs("div",{className:"flex flex-col h-full border-r",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:l,onChange:f=>{o(f.target.value),n?.(f.target.value)},className:"pl-9"})]})}),e.jsx(Ie,{className:"flex-1",children:h.map(f=>{const g=m(f),p=c(f),j=f.participants.find(b=>b.id!==a.id);return e.jsxs("button",{onClick:()=>r(f),className:d.cn("w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",s===f.id&&"bg-muted"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{children:[e.jsx(st,{src:g.url}),e.jsx(at,{children:g.fallback})]}),j?.status==="online"&&e.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:p}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u(f.lastMessage?.timestamp)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.lastMessage?.content||"Aucun message"}),f.unreadCount&&f.unreadCount>0&&e.jsx(ne,{className:"h-5 min-w-[20px] justify-center",children:f.unreadCount})]})]})]},f.id)})})]})}function TA({conversation:t,currentUser:s,title:a,statusText:r,showStatus:n=!0,showCloseButton:l,onAudioCall:o,onVideoCall:c,onClose:m,onCloseConversation:u,onMinimize:h,layout:f}){const g=t?.participants.find(w=>w.id!==s.id),p=a||t?.name||g?.name||"Messages",j=()=>r||(t?t.isGroup?`${t.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":""),b=f==="floating"||f==="widget";return e.jsxs("div",{className:d.cn("flex items-center justify-between p-3 border-b",b&&"bg-primary text-primary-foreground rounded-t-lg"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t&&e.jsxs(tt,{className:d.cn(b&&"border-2 border-primary-foreground/20"),children:[e.jsx(st,{src:t.avatar||g?.avatar}),e.jsx(at,{className:d.cn(b&&"bg-primary-foreground/20 text-primary-foreground"),children:nc(g||{name:p})})]}),!t&&e.jsx(x.MessageCircle,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:p}),n&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[g?.status==="online"&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",b?"bg-green-400":"bg-green-500")}),g?.status==="offline"&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",b?"bg-gray-400":"bg-gray-500")}),e.jsx("p",{className:d.cn("text-xs",b?"text-primary-foreground/80":"text-muted-foreground"),children:j()})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o&&!b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:o,children:e.jsx(x.Phone,{className:"h-4 w-4"})}),c&&!b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:c,children:e.jsx(x.Video,{className:"h-4 w-4"})}),l&&u&&e.jsxs(L.Button,{variant:b?"ghost":"outline",size:"sm",onClick:u,className:d.cn(b&&"text-primary-foreground hover:bg-primary-foreground/20"),children:[e.jsx(x.Calendar,{className:"h-4 w-4 mr-1.5"}),"Clôturer"]}),h&&b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:h,className:"text-primary-foreground hover:bg-primary-foreground/20",children:e.jsx(x.Minimize2,{className:"h-4 w-4"})}),m&&b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:m,className:"text-primary-foreground hover:bg-primary-foreground/20",children:e.jsx(x.X,{className:"h-4 w-4"})}),!b&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsx(We,{align:"end",children:e.jsxs(ye,{children:[e.jsx(x.Settings,{className:"mr-2 h-4 w-4"}),"Paramètres"]})})]})]})]})}function DA({message:t,isOwn:s,showStatus:a,showTimestamp:r,onDelete:n,onReply:l}){const o=m=>(typeof m=="string"?new Date(m):m).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}),c=()=>{switch(t.status){case"sending":return e.jsx("div",{className:"h-3 w-3 rounded-full border-2 border-current animate-pulse"});case"sent":return e.jsx(x.Check,{className:"h-3 w-3"});case"delivered":return e.jsx(x.CheckCheck,{className:"h-3 w-3"});case"read":return e.jsx(x.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"error":return e.jsx(x.X,{className:"h-3 w-3 text-red-500"});default:return null}};return e.jsxs("div",{className:d.cn("flex gap-2 group",s?"flex-row-reverse":"flex-row"),children:[!s&&e.jsxs(tt,{className:"h-8 w-8",children:[e.jsx(st,{src:t.sender.avatar}),e.jsx(at,{className:"text-xs",children:nc(t.sender)})]}),e.jsxs("div",{className:d.cn("max-w-[70%]",s&&"items-end"),children:[t.replyTo&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary",children:[e.jsx("span",{className:"font-medium",children:t.replyTo.sender.name}),e.jsx("p",{className:"truncate",children:t.replyTo.content})]}),e.jsxs("div",{className:d.cn("relative rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-tr-sm":"bg-muted rounded-tl-sm"),children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"space-y-2 mb-2",children:t.attachments.map((m,u)=>e.jsx("div",{children:m.type==="image"?e.jsx("img",{src:m.url,alt:m.name,className:"rounded-lg max-w-full"}):e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background/10 rounded",children:[e.jsx(x.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm truncate",children:m.name})]})},u))}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:d.cn("absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",s?"-left-20":"-right-20"),children:[e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l?.(t),children:e.jsx(x.Reply,{className:"h-3 w-3"})}),s&&n&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t.id),children:e.jsx(x.Trash2,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:d.cn("flex items-center gap-1 mt-1 text-xs text-muted-foreground",s&&"justify-end"),children:[r&&e.jsx("span",{children:o(t.timestamp)}),t.isEdited&&e.jsx("span",{children:"(modifié)"}),s&&a&&c()]})]})]})}function $A({onSend:t,replyTo:s,onCancelReply:a,showAttachments:r,showEmoji:n,placeholder:l,sending:o,showHint:c=!0,hintText:m="Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne"}){const[u,h]=i.useState(""),f=i.useRef(null),g=()=>{u.trim()&&!o&&(t(u.trim()),h(""))},p=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),g())};return i.useEffect(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=Math.min(f.current.scrollHeight,120)+"px")},[u]),e.jsxs("div",{className:"border-t p-3",children:[s&&e.jsxs("div",{className:"flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Reply,{className:"h-4 w-4 text-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.sender.name}),e.jsx("p",{className:"text-muted-foreground truncate",children:s.content})]})]}),e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[r&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:e.jsx(x.Paperclip,{className:"h-4 w-4"})}),e.jsx(L.Textarea,{ref:f,value:u,onChange:j=>h(j.target.value),onKeyDown:p,placeholder:l,className:"flex-1 min-h-[40px] max-h-[120px] resize-none",disabled:o,rows:1}),n&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:e.jsx(x.Smile,{className:"h-4 w-4"})}),e.jsx(L.Button,{onClick:g,disabled:!u.trim()||o,size:"icon",className:"flex-shrink-0 rounded-full",children:e.jsx(x.Send,{className:"h-4 w-4"})})]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:m})]})}function Ap({conversations:t=[],activeConversation:s,messages:a,currentUser:r,onSendMessage:n,onConversationSelect:l,onMessageDelete:o,onMessageReply:c,onSearch:m,onAudioCall:u,onVideoCall:h,onClose:f,onCloseConversation:g,onMinimize:p,showConversationList:j=!0,showHeader:b=!0,showMessageStatus:w=!0,showTimestamps:y=!0,showAttachments:v=!0,showEmoji:N=!0,showDateSeparators:k=!0,showInputHint:S=!0,showCloseButton:C=!1,inputPlaceholder:M,inputHintText:D,sending:A=!1,loading:T=!1,layout:E="full",headerTitle:I,showHeaderStatus:$=!0,statusText:P,minimized:R=!1,className:F}){const[W,U]=i.useState(null),G=i.useRef(null);i.useEffect(()=>{G.current?.scrollIntoView({behavior:"smooth"})},[a]);const O=(B,H)=>{n?.(B,H),U(null)},_=B=>{U(B),c?.(B)},z=()=>{if(M)return M;if(s){const B=s.participants.find(H=>H.id!==r.id);if(B)return`Écrire à ${B.name}...`}return"Écrivez votre message..."},V=()=>{const B=[];let H=null;return a.forEach((Y,Z)=>{const X=typeof Y.timestamp=="string"?new Date(Y.timestamp):Y.timestamp;k&&(!H||!CA(H,X))&&(B.push(e.jsx(SA,{date:X},`separator-${Z}`)),H=X),B.push(e.jsx(DA,{message:Y,isOwn:Y.sender.id===r.id,showStatus:w,showTimestamp:y,onDelete:o,onReply:_},Y.id))}),B},q={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"};return(E==="floating"||E==="widget")&&R?e.jsxs("button",{onClick:p,className:d.cn("flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow",F),children:[e.jsx(x.MessageCircle,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium",children:"Messages"}),t.reduce((B,H)=>B+(H.unreadCount||0),0)>0&&e.jsx(ne,{variant:"secondary",className:"bg-white text-primary",children:t.reduce((B,H)=>B+(H.unreadCount||0),0)})]}):e.jsxs("div",{className:d.cn("flex bg-background overflow-hidden",q[E],F),children:[j&&E!=="widget"&&E!=="floating"&&e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsx(MA,{conversations:t,activeId:s?.id,currentUser:r,onSelect:B=>l?.(B),onSearch:m})}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:s||E==="widget"||E==="floating"?e.jsxs(e.Fragment,{children:[b&&e.jsx(TA,{conversation:s,currentUser:r,title:I,statusText:P,showStatus:$,showCloseButton:C,onAudioCall:u,onVideoCall:h,onClose:f,onCloseConversation:g,onMinimize:p,layout:E}),e.jsx(Ie,{className:"flex-1 p-4",children:e.jsxs("div",{className:"space-y-4",children:[T?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):V(),e.jsx("div",{ref:G})]})}),e.jsx($A,{onSend:O,replyTo:W,onCancelReply:()=>U(null),showAttachments:v,showEmoji:N,placeholder:z(),sending:A,showHint:S,hintText:D})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(x.MessageCircle,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})}const Va={id:"current",name:"Moi",status:"online"},AA=[{id:"1",participants:[Va,{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:[Va,{id:"3",name:"Pierre Martin",status:"offline"}],lastMessage:{id:"m2",content:"On se voit demain ?",sender:Va,timestamp:new Date(Date.now()-1e3*60*60),status:"delivered"},unreadCount:2}],EA=[{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:Va,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"}],Ep={"no-data":{title:"Aucune donnée",description:"Il n'y a pas encore de données à afficher.",icon:x.Inbox,actionLabel:"Ajouter",actionIcon:x.Plus},"no-results":{title:"Aucun résultat",description:"Aucun élément ne correspond à votre recherche.",icon:x.Search,actionLabel:"Effacer les filtres",actionIcon:x.Filter},"no-messages":{title:"Aucun message",description:"Votre boîte de réception est vide.",icon:x.MessageSquare,actionLabel:"Nouveau message",actionIcon:x.Plus},"no-files":{title:"Aucun fichier",description:"Vous n'avez pas encore de fichiers.",icon:x.FolderOpen,actionLabel:"Importer un fichier",actionIcon:x.Upload},"no-users":{title:"Aucun utilisateur",description:"Il n'y a pas encore d'utilisateurs.",icon:x.Users,actionLabel:"Inviter des utilisateurs",actionIcon:x.Plus},"no-cart":{title:"Panier vide",description:"Votre panier est vide.",icon:x.ShoppingCart,actionLabel:"Parcourir les produits",actionIcon:x.ArrowRight},"no-notifications":{title:"Aucune notification",description:"Vous êtes à jour !",icon:x.Bell},"no-events":{title:"Aucun événement",description:"Aucun événement prévu.",icon:x.Calendar,actionLabel:"Créer un événement",actionIcon:x.Plus},"no-images":{title:"Aucune image",description:"Vous n'avez pas encore d'images.",icon:x.Image,actionLabel:"Importer des images",actionIcon:x.Upload},"no-bookmarks":{title:"Aucun favori",description:"Vous n'avez pas encore de favoris.",icon:x.Bookmark,actionLabel:"Parcourir",actionIcon:x.ArrowRight},"no-favorites":{title:"Aucun favori",description:"Vous n'avez pas encore aimé de contenu.",icon:x.Heart},error:{title:"Une erreur est survenue",description:"Impossible de charger les données.",icon:x.FileQuestion,actionLabel:"Réessayer",actionIcon:x.RefreshCw},custom:{title:"Aucun élément",description:"Il n'y a rien à afficher.",icon:x.Inbox}};function _u({type:t,size:s,className:a}){const n=Ep[t].icon,o={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"}}}[s];return e.jsxs("div",{className:d.cn("relative flex items-center justify-center",o.container,a),children:[e.jsx("div",{className:d.cn("absolute rounded-full bg-muted/50",o.circles.outer)}),e.jsx("div",{className:d.cn("absolute rounded-full bg-muted",o.circles.inner)}),e.jsx("div",{className:"relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm",children:e.jsx(n,{className:d.cn(o.icon,"text-muted-foreground")})}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10"})]})}function Ys({type:t="no-data",title:s,description:a,icon:r,actions:n,illustration:l,showIllustration:o=!0,size:c="md",layout:m="vertical",centered:u=!0,children:h,className:f}){const g=Ep[t],p=s??g.title,j=a??g.description;g.icon;const 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"}},w=[];if(g.actionLabel&&!n){const v=g.actionIcon;w.push({label:g.actionLabel,variant:"default",icon:v?e.jsx(v,{className:"h-4 w-4"}):void 0})}const y=n||(w.length>0?w:void 0);return m==="horizontal"?e.jsxs("div",{className:d.cn("flex items-center gap-6",b[c].container,u&&"justify-center",f),children:[o&&e.jsx("div",{className:"flex-shrink-0",children:l||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-4",children:r}):e.jsx(_u,{type:t,size:c}))}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:d.cn("font-semibold",b[c].title),children:p}),e.jsx("p",{className:d.cn("text-muted-foreground mt-1",b[c].description),children:j}),h&&e.jsx("div",{className:"mt-4",children:h}),y&&y.length>0&&e.jsx("div",{className:"flex gap-3 mt-4",children:y.map((v,N)=>e.jsx(L.Button,{variant:v.variant||"default",size:"sm",onClick:v.onClick,asChild:!!v.href,children:v.href?e.jsxs("a",{href:v.href,children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]}):e.jsxs(e.Fragment,{children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]})},N))})]})]}):e.jsxs("div",{className:d.cn("flex flex-col items-center",u&&"text-center",b[c].container,f),children:[o&&e.jsx("div",{className:"mb-6",children:l||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-6",children:i.cloneElement(r,{className:d.cn(b[c].icon,"text-muted-foreground")})}):e.jsx(_u,{type:t,size:c}))}),e.jsx("h3",{className:d.cn("font-semibold",b[c].title),children:p}),e.jsx("p",{className:d.cn("text-muted-foreground mt-2 max-w-sm",b[c].description),children:j}),h&&e.jsx("div",{className:"mt-4",children:h}),y&&y.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mt-6 justify-center",children:y.map((v,N)=>e.jsx(L.Button,{variant:v.variant||"default",onClick:v.onClick,asChild:!!v.href,children:v.href?e.jsxs("a",{href:v.href,children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]}):e.jsxs(e.Fragment,{children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]})},N))})]})}function RA(t){return e.jsx(Ys,{type:"no-data",...t})}function IA(t){return e.jsx(Ys,{type:"no-results",...t})}function PA(t){return e.jsx(Ys,{type:"no-messages",...t})}function LA(t){return e.jsx(Ys,{type:"no-files",...t})}function FA(t){return e.jsx(Ys,{type:"no-cart",...t})}function BA(t){return e.jsx(Ys,{type:"no-notifications",...t})}function zA(t){return e.jsx(Ys,{type:"error",...t})}const Rp={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:x.FileQuestion},500:{code:"500",title:"Erreur serveur",description:"Une erreur inattendue s'est produite. Notre équipe a été notifiée.",icon:x.ServerCrash},403:{code:"403",title:"Accès refusé",description:"Vous n'avez pas les permissions nécessaires pour accéder à cette page.",icon:x.ShieldX},503:{code:"503",title:"Service indisponible",description:"Le service est temporairement indisponible. Veuillez réessayer plus tard.",icon:x.ServerCrash},offline:{code:"Hors ligne",title:"Vous êtes hors ligne",description:"Vérifiez votre connexion internet et réessayez.",icon:x.Wifi},maintenance:{code:"Maintenance",title:"Maintenance en cours",description:"Nous effectuons une maintenance. Nous serons bientôt de retour.",icon:x.Construction},custom:{code:"",title:"Erreur",description:"Une erreur s'est produite.",icon:x.FileQuestion}};function Vu({type:t,className:s}){const r=Rp[t].icon;return e.jsxs("div",{className:d.cn("relative flex items-center justify-center",s),children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-48 w-48 rounded-full bg-muted/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-32 w-32 rounded-full bg-muted"})}),e.jsx("div",{className:"relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg",children:e.jsx(r,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("div",{className:"absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10"})]})}function ja({type:t="404",code:s,title:a,description:r,actions:n,illustration:l,showCode:o=!0,showIllustration:c=!0,showBackButton:m=!0,onBack:u,showHomeButton:h=!0,homeUrl:f="/",showRefreshButton:g=!1,children:p,layout:j="centered",size:b="md",className:w}){const y=Rp[t],v=s??y.code,N=a??y.title,k=r??y.description,S={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"}},C=[];m&&C.push({label:"Retour",onClick:u||(()=>window.history.back()),variant:"outline",icon:e.jsx(x.ArrowLeft,{className:"h-4 w-4"})}),h&&C.push({label:"Accueil",href:f,variant:"default",icon:e.jsx(x.Home,{className:"h-4 w-4"})}),g&&C.push({label:"Réessayer",onClick:()=>window.location.reload(),variant:"secondary",icon:e.jsx(x.RefreshCw,{className:"h-4 w-4"})});const M=n||C,D=()=>e.jsxs("div",{className:"flex flex-col items-center text-center",children:[c&&e.jsx("div",{className:d.cn("mb-8",S[b].illustration),children:l||e.jsx(Vu,{type:t})}),o&&v&&e.jsx("div",{className:d.cn("font-bold text-muted-foreground/20 mb-4",S[b].code),children:v}),e.jsx("h1",{className:d.cn("font-bold tracking-tight mb-4",S[b].title),children:N}),e.jsx("p",{className:d.cn("text-muted-foreground max-w-md mb-8",S[b].description),children:k}),p&&e.jsx("div",{className:"mb-8",children:p}),M.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:M.map((A,T)=>e.jsx(L.Button,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},T))})]});return j==="split"?e.jsxs("div",{className:d.cn("min-h-screen flex flex-col lg:flex-row",w),children:[e.jsx("div",{className:"flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16",children:e.jsx("div",{className:S[b].illustration,children:l||e.jsx(Vu,{type:t})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 lg:p-16",children:e.jsxs("div",{className:"max-w-md",children:[o&&v&&e.jsx("div",{className:d.cn("font-bold text-primary mb-4",b==="sm"?"text-4xl":b==="md"?"text-5xl":"text-6xl"),children:v}),e.jsx("h1",{className:d.cn("font-bold tracking-tight mb-4",S[b].title),children:N}),e.jsx("p",{className:d.cn("text-muted-foreground mb-8",S[b].description),children:k}),p&&e.jsx("div",{className:"mb-8",children:p}),M.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:M.map((A,T)=>e.jsx(L.Button,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},T))})]})})]}):e.jsx("div",{className:d.cn("min-h-screen flex items-center justify-center",S[b].container,w),children:D()})}function WA(t){return e.jsx(ja,{type:"404",...t})}function OA(t){return e.jsx(ja,{type:"500",showRefreshButton:!0,...t})}function UA(t){return e.jsx(ja,{type:"403",...t})}function _A(t){return e.jsx(ja,{type:"maintenance",showBackButton:!1,showHomeButton:!1,...t})}function VA(t){return e.jsx(ja,{type:"offline",showRefreshButton:!0,...t})}function HA({value:t,onChange:s,placeholder:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{type:"text",placeholder:a,value:t,onChange:r=>s(r.target.value),className:"pl-10"})]})}function GA({categories:t,activeCategory:s,onCategoryChange:a,itemCounts:r}){return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(null),className:d.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===null?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:["Tous",e.jsx(ne,{variant:"secondary",className:"ml-1",children:Object.values(r).reduce((n,l)=>n+l,0)})]}),t.map(n=>e.jsxs("button",{type:"button",onClick:()=>a(n.id),className:d.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===n.id?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[n.icon,n.name,e.jsx(ne,{variant:"secondary",className:"ml-1",children:r[n.id]||0})]},n.id))]})}function qA({itemId:t,helpful:s=0,notHelpful:a=0,onFeedback:r}){const[n,l]=i.useState(null),o=c=>{n===null&&(l(c),r(t,c))};return e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Cette réponse vous a-t-elle aidé ?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>o(!0),disabled:n!==null,className:d.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!0?"bg-green-100 text-green-700":n===null?"hover:bg-muted":"opacity-50"),children:["👍 ",s+(n===!0?1:0)]}),e.jsxs("button",{type:"button",onClick:()=>o(!1),disabled:n!==null,className:d.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!1?"bg-red-100 text-red-700":n===null?"hover:bg-muted":"opacity-50"),children:["👎 ",a+(n===!1?1:0)]})]})]})}function XA({items:t,categories:s=[],title:a="Questions fréquentes",description:r,showSearch:n=!0,searchPlaceholder:l="Rechercher une question...",showCategoryFilter:o=!0,activeCategory:c,onCategoryChange:m,allowMultiple:u=!1,defaultOpen:h=[],showFeedback:f=!1,onFeedback:g,layout:p="default",size:j="md",className:b}){const[w,y]=i.useState(""),[v,N]=i.useState(null),k=c??v,S=I=>{m?m(I):N(I)},C=i.useMemo(()=>t.filter(I=>{if(w){const $=w.toLowerCase();if(!(I.question.toLowerCase().includes($)||typeof I.answer=="string"&&I.answer.toLowerCase().includes($)||I.tags?.some(R=>R.toLowerCase().includes($))))return!1}return!(k&&I.category!==k)}),[t,w,k]),M=i.useMemo(()=>{const I={};return t.forEach($=>{$.category&&(I[$.category]=(I[$.category]||0)+1)}),I},[t]),D=i.useMemo(()=>{if(p!=="grouped")return null;const I={};return C.forEach($=>{const P=$.category||"other";I[P]||(I[P]=[]),I[P].push($)}),I},[C,p]),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"}},T=I=>e.jsx(e.Fragment,{children:I.map($=>e.jsxs(bo,{value:$.id,className:d.cn(p==="cards"&&"border rounded-lg px-4 bg-card"),children:[e.jsx(jo,{className:d.cn("hover:no-underline",A[j].question),children:e.jsx("span",{className:"text-left",children:$.question})}),e.jsxs(vo,{children:[e.jsx("div",{className:d.cn("text-muted-foreground",A[j].answer),children:typeof $.answer=="string"?e.jsx("p",{children:$.answer}):$.answer}),$.tags&&$.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:$.tags.map(P=>e.jsx(ne,{variant:"outline",className:"text-xs",children:P},P))}),f&&g&&e.jsx(qA,{itemId:$.id,helpful:$.helpful,notHelpful:$.notHelpful,onFeedback:g})]})]},$.id))}),E=I=>u?e.jsx(Rl,{type:"multiple",defaultValue:h,className:"space-y-2",children:T(I)}):e.jsx(Rl,{type:"single",defaultValue:h[0],collapsible:!0,className:"space-y-2",children:T(I)});return e.jsxs("div",{className:d.cn("space-y-6",b),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:d.cn("font-bold tracking-tight",A[j].title),children:a}),r&&e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl mx-auto",children:r})]}),n&&e.jsx("div",{className:"max-w-md mx-auto",children:e.jsx(HA,{value:w,onChange:y,placeholder:l})}),o&&s.length>0&&e.jsx("div",{className:"flex justify-center",children:e.jsx(GA,{categories:s,activeCategory:k,onCategoryChange:S,itemCounts:M})}),C.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(x.HelpCircle,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune question ne correspond à votre recherche."})]}):p==="grouped"&&D?e.jsx("div",{className:"space-y-8",children:Object.entries(D).map(([I,$])=>{const P=s.find(R=>R.id===I);return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[P?.icon,P?.name||I]}),E($)]},I)})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:E(C)})]})}const YA=[{id:"general",name:"Général",icon:e.jsx(x.HelpCircle,{className:"h-4 w-4"})},{id:"billing",name:"Facturation",icon:e.jsx(x.MessageCircle,{className:"h-4 w-4"})},{id:"technical",name:"Technique",icon:e.jsx(x.MessageCircle,{className:"h-4 w-4"})}],ZA=[{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"]}],KA={folder:{icon:x.Folder,color:"text-yellow-500"},document:{icon:x.FileText,color:"text-blue-500"},image:{icon:x.FileImage,color:"text-green-500"},video:{icon:x.FileVideo,color:"text-purple-500"},audio:{icon:x.FileAudio,color:"text-pink-500"},archive:{icon:x.FileArchive,color:"text-orange-500"},code:{icon:x.FileCode,color:"text-cyan-500"},other:{icon:x.File,color:"text-gray-500"}};function Hu(t){if(!t)return"-";const s=["B","KB","MB","GB","TB"];let a=0,r=t;for(;r>=1024&&a<s.length-1;)r/=1024,a++;return`${r.toFixed(1)} ${s[a]}`}function QA({breadcrumbs:t,viewMode:s,onViewModeChange:a,onNavigate:r,onCreateFolder:n,onUpload:l,onRefresh:o,showSearch:c,onSearch:m,selectedCount:u,onDeleteSelected:h,onDownloadSelected:f}){const[g,p]=i.useState("");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:o,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})}),l&&e.jsxs(L.Button,{variant:"outline",onClick:l,children:[e.jsx(x.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]}),n&&e.jsxs(L.Button,{variant:"outline",onClick:n,children:[e.jsx(x.FolderPlus,{className:"h-4 w-4 mr-2"}),"Nouveau dossier"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&m&&e.jsxs("div",{className:"relative w-64",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:g,onChange:j=>{p(j.target.value),m(j.target.value)},className:"pl-9"})]}),e.jsx(L.Button,{variant:s==="grid"?"secondary":"ghost",size:"icon",onClick:()=>a("grid"),children:e.jsx(x.Grid,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:s==="list"?"secondary":"ghost",size:"icon",onClick:()=>a("list"),children:e.jsx(x.List,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx("button",{onClick:()=>r("/"),className:"flex items-center gap-1 hover:text-primary",children:e.jsx(x.Home,{className:"h-4 w-4"})}),t.map((j,b)=>e.jsxs(i.Fragment,{children:[e.jsx(x.ChevronRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>r(j.path),className:d.cn("hover:text-primary",b===t.length-1&&"font-medium"),children:j.name})]},j.id))]}),u>0&&e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[u," élément(s) sélectionné(s)"]}),f&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Télécharger"]}),h&&e.jsxs(L.Button,{variant:"destructive",size:"sm",onClick:h,children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})}function Gu({file:t,viewMode:s,isSelected:a,onSelect:r,onOpen:n,onRename:l,onDelete:o,onDownload:c,onShare:m,onToggleStar:u}){const h=KA[t.type],f=h.icon,g=typeof t.modifiedAt=="string"?new Date(t.modifiedAt):t.modifiedAt,p=()=>{t.type==="folder"&&n()};return s==="grid"?e.jsxs("div",{className:d.cn("relative group p-4 rounded-lg border cursor-pointer transition-colors",a?"bg-primary/10 border-primary":"hover:bg-muted"),onClick:()=>r(!a),onDoubleClick:p,children:[e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(xt,{checked:a,onCheckedChange:j=>r(j),onClick:j=>j.stopPropagation()})}),t.starred&&e.jsx(x.Star,{className:"absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.thumbnail&&t.type==="image"?e.jsx("img",{src:t.thumbnail,alt:t.name,className:"w-16 h-16 object-cover rounded"}):e.jsx(f,{className:d.cn("h-12 w-12",h.color)}),e.jsx("span",{className:"text-sm font-medium text-center line-clamp-2",children:t.name}),t.type!=="folder"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Hu(t.size)})]}),e.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:j=>j.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:n,children:[e.jsx(x.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),l&&e.jsxs(ye,{onClick:l,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(ye,{onClick:c,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),m&&e.jsxs(ye,{onClick:m,children:[e.jsx(x.Share2,{className:"mr-2 h-4 w-4"}),"Partager"]}),u&&e.jsx(ye,{onClick:u,children:t.starred?e.jsxs(e.Fragment,{children:[e.jsx(x.StarOff,{className:"mr-2 h-4 w-4"}),"Retirer des favoris"]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Star,{className:"mr-2 h-4 w-4"}),"Ajouter aux favoris"]})}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:o,className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]}):e.jsxs(us,{className:d.cn("cursor-pointer",a&&"bg-primary/10"),onClick:()=>r(!a),onDoubleClick:p,children:[e.jsx(ft,{className:"w-12",children:e.jsx(xt,{checked:a,onCheckedChange:j=>r(j),onClick:j=>j.stopPropagation()})}),e.jsx(ft,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{className:d.cn("h-5 w-5",h.color)}),e.jsx("span",{className:"font-medium",children:t.name}),t.starred&&e.jsx(x.Star,{className:"h-4 w-4 text-yellow-500 fill-yellow-500"}),t.shared&&e.jsx(ne,{variant:"secondary",className:"text-xs",children:"Partagé"})]})}),e.jsx(ft,{className:"text-muted-foreground",children:Hu(t.size)}),e.jsx(ft,{className:"text-muted-foreground",children:g.toLocaleDateString("fr-FR")}),e.jsx(ft,{children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:j=>j.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:n,children:[e.jsx(x.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),l&&e.jsxs(ye,{onClick:l,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(ye,{onClick:c,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:o,className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]})}function JA({files:t,currentPath:s="/",breadcrumbs:a=[],selectedFiles:r=[],onSelectionChange:n,onNavigate:l,onFileOpen:o,onDownload:c,onDelete:m,onRename:u,onCopy:h,onMove:f,onCreateFolder:g,onUpload:p,onShare:j,onToggleStar:b,onRefresh:w,viewMode:y,onViewModeChange:v,showSearch:N=!0,onSearch:k,showHeader:S=!0,showActions:C=!0,loading:M=!1,className:D}){const[A,T]=i.useState("grid"),[E,I]=i.useState(!1),[$,P]=i.useState(null),[R,F]=i.useState(""),[W,U]=i.useState(!1),[G,O]=i.useState([]),[_,z]=i.useState(!1),[V,q]=i.useState(""),B=y??A,H=ae=>{v?v(ae):T(ae)},Y=(ae,re)=>{n?.(re?[...r,ae]:r.filter(le=>le!==ae))},Z=ae=>{ae.type==="folder"?l?.(ae.path,ae.id):o?.(ae)},X=ae=>{P(ae),F(ae.name),I(!0)},se=()=>{$&&R.trim()&&R!==$.name&&u?.($.id,R.trim()),I(!1),P(null)},K=()=>{O(r),U(!0)},Q=()=>{m?.(G),U(!1),O([]),n?.([])},ee=()=>{V.trim()&&(g?.(V.trim(),s),z(!1),q(""))},te=[...t].sort((ae,re)=>ae.type==="folder"&&re.type!=="folder"?-1:ae.type!=="folder"&&re.type==="folder"?1:ae.name.localeCompare(re.name));return e.jsxs("div",{className:d.cn("space-y-4",D),children:[S&&e.jsx(QA,{breadcrumbs:a,viewMode:B,onViewModeChange:H,onNavigate:ae=>l?.(ae),onCreateFolder:g?()=>z(!0):void 0,onUpload:p?()=>{}:void 0,onRefresh:w,showSearch:N,onSearch:k,selectedCount:r.length,onDeleteSelected:m?K:void 0,onDownloadSelected:c?()=>c(r):void 0}),M?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(x.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):te.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(x.Folder,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"Ce dossier est vide"})]}):B==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4",children:te.map(ae=>e.jsx(Gu,{file:ae,viewMode:"grid",isSelected:r.includes(ae.id),onSelect:re=>Y(ae.id,re),onOpen:()=>Z(ae),onRename:u?()=>X(ae):void 0,onDelete:m?()=>{O([ae.id]),U(!0)}:void 0,onDownload:c?()=>c([ae.id]):void 0,onShare:j?()=>j(ae.id):void 0,onToggleStar:b?()=>b(ae.id):void 0},ae.id))}):e.jsxs(yn,{children:[e.jsx(wn,{children:e.jsxs(us,{children:[e.jsx(jt,{className:"w-12",children:e.jsx(xt,{checked:r.length===t.length&&t.length>0,onCheckedChange:ae=>{n?.(ae?t.map(re=>re.id):[])}})}),e.jsx(jt,{children:"Nom"}),e.jsx(jt,{children:"Taille"}),e.jsx(jt,{children:"Modifié"}),e.jsx(jt,{className:"w-12"})]})}),e.jsx(Nn,{children:te.map(ae=>e.jsx(Gu,{file:ae,viewMode:"list",isSelected:r.includes(ae.id),onSelect:re=>Y(ae.id,re),onOpen:()=>Z(ae),onRename:u?()=>X(ae):void 0,onDelete:m?()=>{O([ae.id]),U(!0)}:void 0,onDownload:c?()=>c([ae.id]):void 0,onShare:j?()=>j(ae.id):void 0,onToggleStar:b?()=>b(ae.id):void 0},ae.id))})]}),e.jsx(Jt,{open:E,onOpenChange:I,children:e.jsxs(Ot,{children:[e.jsx(ms,{children:e.jsx(es,{children:"Renommer"})}),e.jsx(L.Input,{value:R,onChange:ae=>F(ae.target.value),placeholder:"Nouveau nom",onKeyDown:ae=>ae.key==="Enter"&&se()}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>I(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:se,children:"Renommer"})]})]})}),e.jsx(zs,{open:W,onOpenChange:U,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",G.length," élément(s) ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:Q,children:"Supprimer"})]})]})}),e.jsx(Jt,{open:_,onOpenChange:z,children:e.jsxs(Ot,{children:[e.jsx(ms,{children:e.jsx(es,{children:"Nouveau dossier"})}),e.jsx(L.Input,{value:V,onChange:ae=>q(ae.target.value),placeholder:"Nom du dossier",onKeyDown:ae=>ae.key==="Enter"&&ee()}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>z(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:ee,children:"Créer"})]})]})})]})}const eE=[{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}],tE=[{id:"root",name:"Mes fichiers",path:"/"}],qu={low:{label:"Basse",color:"bg-gray-500",icon:x.Clock},medium:{label:"Moyenne",color:"bg-blue-500",icon:x.Clock},high:{label:"Haute",color:"bg-orange-500",icon:x.AlertCircle},urgent:{label:"Urgente",color:"bg-red-500",icon:x.AlertCircle}};function sE({card:t,columnId:s,showAssignees:a,showLabels:r,showPriority:n,showDueDate:l,draggable:o,onCardClick:c,onCardEdit:m,onCardDelete:u,onDragStart:h}){const f=i.useMemo(()=>t.dueDate?(typeof t.dueDate=="string"?new Date(t.dueDate):t.dueDate)<new Date:!1,[t.dueDate]),g=p=>(typeof p=="string"?new Date(p):p).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return e.jsx(me,{className:d.cn("cursor-pointer hover:shadow-md transition-shadow",o&&"cursor-grab active:cursor-grabbing"),draggable:o,onDragStart:p=>h?.(p,t.id,s),onClick:()=>c?.(t,s),children:e.jsxs(fe,{className:"p-3 space-y-2",children:[r&&t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.labels.map(p=>e.jsx("div",{className:"h-1.5 w-8 rounded-full",style:{backgroundColor:p.color},title:p.name},p.id))}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium leading-tight",children:t.title}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:p=>p.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",children:e.jsx(x.MoreHorizontal,{className:"h-3 w-3"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:p=>{p.stopPropagation(),c?.(t,s)},children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),e.jsx(Ke,{}),e.jsxs(ye,{onClick:p=>{p.stopPropagation(),u?.(t.id,s)},className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n&&t.priority&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",qu[t.priority].color),title:qu[t.priority].label}),l&&t.dueDate&&e.jsxs(ne,{variant:f?"destructive":"outline",className:"text-xs px-1.5 py-0",children:[e.jsx(x.Calendar,{className:"h-3 w-3 mr-1"}),g(t.dueDate)]})]}),a&&t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[t.assignees.slice(0,3).map(p=>e.jsxs(tt,{className:"h-5 w-5 border-2 border-background",children:[e.jsx(st,{src:p.avatar}),e.jsx(at,{className:"text-[8px]",children:p.name.charAt(0)})]},p.id)),t.assignees.length>3&&e.jsxs("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background",children:["+",t.assignees.length-3]})]})]})]})})}function aE({column:t,showCardCount:s,showAddCard:a,showAssignees:r,showLabels:n,showPriority:l,showDueDate:o,draggable:c,onCardClick:m,onCardAdd:u,onCardEdit:h,onCardDelete:f,onColumnEdit:g,onColumnDelete:p,onDragStart:j,onDragOver:b,onDrop:w}){const[y,v]=i.useState(!1),[N,k]=i.useState(""),[S,C]=i.useState(!1),[M,D]=i.useState(t.title),A=()=>{N.trim()&&(u?.(t.id,{title:N.trim()}),k(""),v(!1))},T=()=>{M.trim()&&M!==t.title&&g?.(t.id,{title:M.trim()}),C(!1)},E=t.limit&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg",onDragOver:b,onDrop:I=>w?.(I,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:t.color}}),S?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(L.Input,{value:M,onChange:I=>D(I.target.value),className:"h-7 text-sm font-semibold",autoFocus:!0,onBlur:T,onKeyDown:I=>{I.key==="Enter"&&T(),I.key==="Escape"&&C(!1)}})}):e.jsx("h3",{className:"font-semibold text-sm cursor-pointer",onClick:()=>C(!0),children:t.title}),s&&e.jsxs(ne,{variant:"secondary",className:"text-xs",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>C(!0),children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),e.jsx(Ke,{}),e.jsxs(ye,{onClick:()=>p?.(t.id),className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto",children:[t.cards.map(I=>e.jsx(sE,{card:I,columnId:t.id,showAssignees:r,showLabels:n,showPriority:l,showDueDate:o,draggable:c,onCardClick:m,onCardEdit:h,onCardDelete:f,onDragStart:j},I.id)),y&&e.jsxs(me,{className:"p-2",children:[e.jsx(L.Textarea,{placeholder:"Titre de la carte...",value:N,onChange:I=>k(I.target.value),className:"min-h-[60px] text-sm",autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L.Button,{size:"sm",onClick:A,children:"Ajouter"}),e.jsx(L.Button,{size:"sm",variant:"ghost",onClick:()=>{v(!1),k("")},children:e.jsx(x.X,{className:"h-4 w-4"})})]})]})]}),a&&!y&&!E&&e.jsx("div",{className:"p-2 border-t",children:e.jsxs(L.Button,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:()=>v(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une carte"]})}),E&&e.jsx("div",{className:"p-2 border-t text-center text-xs text-muted-foreground",children:"Limite atteinte"})]})}function rE({columns:t,onColumnsChange:s,onCardClick:a,onCardAdd:r,onCardEdit:n,onCardDelete:l,onCardMove:o,onColumnAdd:c,onColumnEdit:m,onColumnDelete:u,showAddCard:h=!0,showAddColumn:f=!0,showCardCount:g=!0,showAssignees:p=!0,showLabels:j=!0,showPriority:b=!0,showDueDate:w=!0,draggable:y=!0,availableLabels:v=[],availableAssignees:N=[],className:k}){const[S,C]=i.useState(t),[M,D]=i.useState(null),[A,T]=i.useState(!1),[E,I]=i.useState("");i.useEffect(()=>{C(t)},[t]);const $=(O,_,z)=>{D({cardId:_,columnId:z}),O.dataTransfer.effectAllowed="move"},P=O=>{O.preventDefault(),O.dataTransfer.dropEffect="move"},R=(O,_)=>{if(O.preventDefault(),!M)return;const{cardId:z,columnId:V}=M;if(V===_){D(null);return}if(o)o(z,V,_,0);else{const q=S.map(B=>{if(B.id===V)return{...B,cards:B.cards.filter(H=>H.id!==z)};if(B.id===_){const H=S.find(Y=>Y.id===V)?.cards.find(Y=>Y.id===z);if(H)return{...B,cards:[...B.cards,H]}}return B});C(q),s?.(q)}D(null)},F=(O,_)=>{if(r)r(O,_);else{const z={id:`card-${Date.now()}`,title:_.title||"Nouvelle carte",..._},V=S.map(q=>q.id===O?{...q,cards:[...q.cards,z]}:q);C(V),s?.(V)}},W=(O,_)=>{if(l)l(O,_);else{const z=S.map(V=>V.id===_?{...V,cards:V.cards.filter(q=>q.id!==O)}:V);C(z),s?.(z)}},U=O=>{if(u)u(O);else{const _=S.filter(z=>z.id!==O);C(_),s?.(_)}},G=()=>{if(E.trim()){const O={id:`column-${Date.now()}`,title:E.trim(),cards:[]};if(c)c(O);else{const _=[...S,O];C(_),s?.(_)}I(""),T(!1)}};return e.jsx("div",{className:d.cn("overflow-x-auto",k),children:e.jsxs("div",{className:"flex gap-4 p-4 min-h-[500px]",children:[S.map(O=>e.jsx(aE,{column:O,showCardCount:g,showAddCard:h,showAssignees:p,showLabels:j,showPriority:b,showDueDate:w,draggable:y,onCardClick:a,onCardAdd:F,onCardEdit:n,onCardDelete:W,onColumnEdit:m,onColumnDelete:U,onDragStart:$,onDragOver:P,onDrop:R},O.id)),f&&e.jsx("div",{className:"w-72 flex-shrink-0",children:A?e.jsxs(me,{className:"p-3",children:[e.jsx(L.Input,{placeholder:"Titre de la colonne...",value:E,onChange:O=>I(O.target.value),autoFocus:!0,onKeyDown:O=>{O.key==="Enter"&&G(),O.key==="Escape"&&T(!1)}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L.Button,{size:"sm",onClick:G,children:"Ajouter"}),e.jsx(L.Button,{size:"sm",variant:"ghost",onClick:()=>{T(!1),I("")},children:e.jsx(x.X,{className:"h-4 w-4"})})]})]}):e.jsxs(L.Button,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>T(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})})}const nE=[{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"}]}],lE=[{id:"dev",name:"Dev",color:"#3b82f6"},{id:"design",name:"Design",color:"#8b5cf6"},{id:"bug",name:"Bug",color:"#ef4444"},{id:"feature",name:"Feature",color:"#10b981"}];function oE({logo:t,brandName:s="Brand",navItems:a=[],showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:l,loginHref:o}){const[c,m]=i.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"container flex h-16 items-center justify-between",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-2 font-bold text-xl",children:[t,e.jsx("span",{children:s})]}),e.jsx("div",{className:"hidden md:flex items-center gap-6",children:a.map(u=>e.jsx("a",{href:u.href,className:d.cn("text-sm font-medium transition-colors hover:text-primary",u.isActive?"text-primary":"text-muted-foreground"),children:u.label},u.href))}),e.jsx("div",{className:"hidden md:flex items-center gap-4",children:r&&e.jsx(L.Button,{variant:"default",onClick:l,asChild:!!o,children:o?e.jsx("a",{href:o,children:n}):n})}),e.jsx(L.Button,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>m(!c),children:c?e.jsx(x.X,{className:"h-5 w-5"}):e.jsx(x.Menu,{className:"h-5 w-5"})})]}),c&&e.jsx("div",{className:"md:hidden border-t bg-background p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(u=>e.jsx("a",{href:u.href,className:"text-sm font-medium",onClick:()=>m(!1),children:u.label},u.href)),r&&e.jsx(L.Button,{onClick:l,asChild:!!o,children:o?e.jsx("a",{href:o,children:n}):n})]})})]})}function iE({badge:t,title:s,highlightedTitle:a,description:r,primaryButtonText:n="Commencer",primaryButtonAction:l,primaryButtonHref:o,secondaryButtonText:c,secondaryButtonAction:m,secondaryButtonHref:u,image:h,stats:f}){return e.jsx("section",{className:"container py-24 md:py-32",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-12",children:[e.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[t&&e.jsx(ne,{variant:"secondary",className:"mb-4",children:t}),e.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6",children:[s," ",a&&e.jsx("span",{className:"text-primary",children:a})]}),e.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none",children:r}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8",children:[e.jsx(L.Button,{size:"lg",onClick:l,asChild:!!o,children:o?e.jsxs("a",{href:o,children:[n,e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]})}),c&&e.jsx(L.Button,{size:"lg",variant:"outline",onClick:m,asChild:!!u,children:u?e.jsxs("a",{href:u,children:[e.jsx(x.Play,{className:"mr-2 h-4 w-4"}),c]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Play,{className:"mr-2 h-4 w-4"}),c]})})]}),f&&f.length>0&&e.jsx("div",{className:"flex gap-8 justify-center lg:justify-start",children:f.map((g,p)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold",children:g.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:g.label})]},p))})]}),h&&e.jsx("div",{className:"flex-1 w-full lg:w-auto",children:h})]})})}function cE({title:t="Fonctionnalités",description:s,features:a}){return e.jsxs("section",{className:"container py-24 bg-muted/30",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(r=>e.jsxs(me,{className:"bg-background",children:[e.jsxs(we,{children:[e.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:e.jsx("span",{className:"text-primary",children:r.icon})}),e.jsx(Ne,{className:"text-xl",children:r.title})]}),e.jsx(fe,{children:e.jsx(Ze,{className:"text-base",children:r.description})})]},r.id))})]})}function dE({title:t="Ce que disent nos clients",testimonials:s}){return e.jsxs("section",{className:"container py-24",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight text-center mb-12",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(a=>e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[a.rating&&e.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((r,n)=>e.jsx(x.Star,{className:d.cn("h-4 w-4",n<a.rating?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},n))}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['"',a.content,'"']}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.author,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-primary",children:a.author.charAt(0)})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.author}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.role,a.company&&` @ ${a.company}`]})]})]})]})},a.id))})]})}function uE({title:t,description:s,buttonText:a,buttonAction:r,buttonHref:n,secondaryButtonText:l,secondaryButtonAction:o,variant:c="default"}){const m={default:"bg-muted/50",gradient:"bg-gradient-to-r from-primary/10 via-primary/5 to-background",dark:"bg-foreground text-background"};return e.jsx("section",{className:d.cn("py-24",m[c]),children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[e.jsx("h2",{className:d.cn("text-3xl md:text-4xl font-bold tracking-tight mb-4",c==="dark"&&"text-background"),children:t}),s&&e.jsx("p",{className:d.cn("text-lg mb-8",c==="dark"?"text-background/80":"text-muted-foreground"),children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(L.Button,{size:"lg",variant:c==="dark"?"secondary":"default",onClick:r,asChild:!!n,children:n?e.jsxs("a",{href:n,children:[a,e.jsx(x.ChevronRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a,e.jsx(x.ChevronRight,{className:"ml-2 h-4 w-4"})]})}),l&&e.jsx(L.Button,{size:"lg",variant:"outline",onClick:o,className:c==="dark"?"border-background/20 text-background hover:bg-background/10":"",children:l})]})]})})})}function mE({logo:t,brandName:s="Brand",navItems:a,showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:l,loginHref:o,hero:c,features:m,featuresTitle:u,featuresDescription:h,testimonials:f,testimonialsTitle:g,cta:p,footer:j,className:b}){return e.jsxs("div",{className:d.cn("min-h-screen",b),children:[e.jsx(oE,{logo:t,brandName:s,navItems:a,showLoginButton:r,loginButtonText:n,onLogin:l,loginHref:o}),c&&e.jsx(iE,{...c}),m&&m.length>0&&e.jsx(cE,{title:u,description:h,features:m}),f&&f.length>0&&e.jsx(dE,{title:g,testimonials:f}),p&&e.jsx(uE,{...p}),j]})}const xE=[{label:"Fonctionnalités",href:"#features"},{label:"Tarifs",href:"#pricing"},{label:"Témoignages",href:"#testimonials"},{label:"Contact",href:"#contact"}],hE=[{id:"1",icon:e.jsx(x.Zap,{className:"h-6 w-6"}),title:"Rapide et performant",description:"Optimisé pour la vitesse avec des temps de chargement minimaux."},{id:"2",icon:e.jsx(x.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:e.jsx(x.Users,{className:"h-6 w-6"}),title:"Collaboration",description:"Travaillez en équipe avec des outils de collaboration intégrés."},{id:"4",icon:e.jsx(x.Globe,{className:"h-6 w-6"}),title:"Accessible partout",description:"Accédez à votre espace depuis n'importe quel appareil."}],fE=[{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}],gE={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"}]},pE={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"};function bE({period:t,onChange:s,yearlyDiscount:a}){return e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsx(L.Label,{htmlFor:"billing-toggle",className:d.cn("cursor-pointer transition-colors",t==="monthly"?"text-foreground":"text-muted-foreground"),children:"Mensuel"}),e.jsx(Us,{id:"billing-toggle",checked:t==="yearly",onCheckedChange:r=>s(r?"yearly":"monthly")}),e.jsxs(L.Label,{htmlFor:"billing-toggle",className:d.cn("cursor-pointer transition-colors flex items-center gap-2",t==="yearly"?"text-foreground":"text-muted-foreground"),children:["Annuel",a&&e.jsxs(ne,{variant:"secondary",className:"text-xs",children:["-",a]})]})]})}function jE({plan:t,billingPeriod:s}){const a=s==="yearly"&&t.priceYearly!==void 0?t.priceYearly:t.price,r=s==="yearly"&&t.periodYearly?t.periodYearly:t.period||"/mois",n=typeof a=="string";return e.jsxs(me,{className:d.cn("relative flex flex-col",t.popular&&"border-primary shadow-lg scale-105"),children:[t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsxs(ne,{className:"px-3",children:[e.jsx(x.Zap,{className:"h-3 w-3 mr-1"}),t.badge||"Populaire"]})}),e.jsxs(we,{className:"text-center pb-2",children:[e.jsx(Ne,{className:"text-xl",children:t.name}),t.description&&e.jsx(Ze,{children:t.description})]}),e.jsxs(fe,{className:"flex-1",children:[e.jsx("div",{className:"text-center mb-6",children:n?e.jsx("div",{className:"text-3xl font-bold",children:a}):e.jsxs("div",{className:"flex items-baseline justify-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:t.currency||"€"}),e.jsx("span",{className:"text-4xl font-bold",children:a}),e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:r})]})}),e.jsx("ul",{className:"space-y-3",children:t.features.map((l,o)=>e.jsxs("li",{className:"flex items-start gap-2",children:[l.included===!0?e.jsx(x.Check,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):l.included==="partial"||l.included==="limited"?e.jsx(x.Check,{className:"h-5 w-5 text-yellow-500 flex-shrink-0"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:d.cn("text-sm",!l.included&&"text-muted-foreground"),children:[l.name,l.value&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",l.value,")"]})]}),l.tooltip&&e.jsx(He,{children:e.jsxs(Ge,{children:[e.jsx(qe,{asChild:!0,children:e.jsx(x.HelpCircle,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(Oe,{children:e.jsx("p",{className:"max-w-xs",children:l.tooltip})})]})})]},o))})]}),e.jsx(Ft,{children:e.jsx(L.Button,{className:"w-full",variant:t.buttonVariant||(t.popular?"default":"outline"),onClick:t.onSelect,disabled:t.disabled,asChild:!!t.href,children:t.href?e.jsx("a",{href:t.href,children:t.buttonText||"Choisir"}):t.buttonText||"Choisir"})})]})}function vE({plans:t,billingPeriod:s}){const a=Array.from(new Set(t.flatMap(r=>r.features.map(n=>n.name))));return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 border-b bg-muted/50",children:"Fonctionnalité"}),t.map(r=>e.jsxs("th",{className:d.cn("text-center p-4 border-b min-w-[150px]",r.popular&&"bg-primary/5"),children:[e.jsx("div",{className:"font-bold",children:r.name}),r.popular&&e.jsx(ne,{className:"mt-1",variant:"default",children:"Populaire"})]},r.id))]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4 border-b bg-muted/50 font-medium",children:"Prix"}),t.map(r=>{const n=s==="yearly"&&r.priceYearly!==void 0?r.priceYearly:r.price,l=s==="yearly"&&r.periodYearly?r.periodYearly:r.period||"/mois",o=typeof n=="string";return e.jsx("td",{className:d.cn("text-center p-4 border-b",r.popular&&"bg-primary/5"),children:o?e.jsx("span",{className:"font-bold",children:n}):e.jsxs("span",{className:"font-bold",children:[r.currency||"€",n,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:l})]})},r.id)})]})]}),e.jsxs("tbody",{children:[a.map((r,n)=>e.jsxs("tr",{className:n%2===0?"bg-muted/20":"",children:[e.jsx("td",{className:"p-4 border-b",children:r}),t.map(l=>{const o=l.features.find(c=>c.name===r);return e.jsx("td",{className:d.cn("text-center p-4 border-b",l.popular&&"bg-primary/5"),children:o?o.included===!0?o.value?e.jsx("span",{children:o.value}):e.jsx(x.Check,{className:"h-5 w-5 text-green-500 mx-auto"}):o.included==="partial"||o.included==="limited"?e.jsx("span",{className:"text-yellow-600",children:o.value||"Limité"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground mx-auto"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground mx-auto"})},l.id)})]},n)),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4"}),t.map(r=>e.jsx("td",{className:d.cn("text-center p-4",r.popular&&"bg-primary/5"),children:e.jsx(L.Button,{variant:r.buttonVariant||(r.popular?"default":"outline"),onClick:r.onSelect,disabled:r.disabled,asChild:!!r.href,children:r.href?e.jsx("a",{href:r.href,children:r.buttonText||"Choisir"}):r.buttonText||"Choisir"})},r.id))]})]})]})})}function yE({title:t="Questions fréquentes",items:s}){return e.jsxs("div",{className:"mt-16",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:s.map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:a.question}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a.answer})]},r))})]})}function wE({title:t="Tarification",description:s,plans:a,showBillingToggle:r=!0,billingPeriod:n,onBillingPeriodChange:l,yearlyDiscount:o,faq:c,faqTitle:m,layout:u="cards",columns:h=3,showComparison:f=!1,className:g}){const[p,j]=i.useState("monthly"),b=n??p,w=v=>{l?l(v):j(v)},y={2:"md:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 lg:grid-cols-4"};return e.jsxs("div",{className:d.cn("container py-16",g),children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),r&&e.jsx(bE,{period:b,onChange:w,yearlyDiscount:o}),u==="cards"&&!f?e.jsx("div",{className:d.cn("grid gap-6 items-stretch",y[h]),children:a.map(v=>e.jsx(jE,{plan:v,billingPeriod:b},v.id))}):e.jsx(vE,{plans:a,billingPeriod:b}),c&&c.length>0&&e.jsx(yE,{title:m,items:c})]})}const NE=[{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"}],kE=[{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."}],Ip=i.createContext(null);function CE(){const t=i.useContext(Ip);if(!t)throw new Error("useWizard must be used within a WakaWizard");return t}function SE({steps:t,currentStep:s,stepStatuses:a,showStepNumbers:r,orientation:n,onStepClick:l,allowBackNavigation:o}){const c=(u,h)=>h==="completed"?e.jsx(x.Check,{className:"h-4 w-4"}):h==="error"?e.jsx(x.AlertCircle,{className:"h-4 w-4"}):h==="skipped"?e.jsx(x.X,{className:"h-4 w-4 text-muted-foreground"}):r?e.jsx("span",{className:"text-xs font-medium",children:u+1}):e.jsx(x.Circle,{className:"h-3 w-3"}),m=u=>{switch(u){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 n==="vertical"?e.jsx("div",{className:"flex flex-col gap-0",children:t.map((u,h)=>{const f=a[h],g=o&&h<s;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",disabled:!g,onClick:()=>g&&l?.(h),className:d.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",m(f),g&&"cursor-pointer hover:opacity-80"),children:u.icon||c(h,f)}),h<t.length-1&&e.jsx("div",{className:d.cn("w-0.5 flex-1 min-h-[24px]",a[h]==="completed"?"bg-primary":"bg-border")})]}),e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:d.cn("font-medium",f==="current"?"text-foreground":"text-muted-foreground"),children:[u.title,u.optional&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optionnel)"})]}),u.description&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:u.description})]})]},u.id)})}):e.jsx("div",{className:"flex items-center gap-0",children:t.map((u,h)=>{const f=a[h],g=o&&h<s;return e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("button",{type:"button",disabled:!g,onClick:()=>g&&l?.(h),className:d.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",m(f),g&&"cursor-pointer hover:opacity-80"),children:u.icon||c(h,f)}),e.jsx("div",{className:"text-center",children:e.jsx("div",{className:d.cn("text-sm font-medium",f==="current"?"text-foreground":"text-muted-foreground"),children:u.title})})]}),h<t.length-1&&e.jsx("div",{className:d.cn("flex-1 h-0.5 mx-2 mb-6",a[h]==="completed"?"bg-primary":"bg-border")})]},u.id)})})}function ME({onPrev:t,onNext:s,onSkip:a,onCancel:r,isFirstStep:n,isLastStep:l,isOptional:o,prevButtonText:c,nextButtonText:m,finishButtonText:u,skipButtonText:h,cancelButtonText:f,showCancelButton:g,submitting:p}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:g&&r&&e.jsx(L.Button,{type:"button",variant:"ghost",onClick:r,disabled:p,children:f})}),e.jsxs("div",{className:"flex gap-2",children:[!n&&e.jsxs(L.Button,{type:"button",variant:"outline",onClick:t,disabled:p,children:[e.jsx(x.ArrowLeft,{className:"mr-2 h-4 w-4"}),c]}),o&&a&&!l&&e.jsx(L.Button,{type:"button",variant:"ghost",onClick:a,disabled:p,children:h}),e.jsxs(L.Button,{type:"button",onClick:s,disabled:p,children:[p&&e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),l?u:m,!l&&!p&&e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})}function TE({steps:t,currentStep:s,onStepChange:a,onSubmit:r,onCancel:n,title:l,description:o,prevButtonText:c="Précédent",nextButtonText:m="Suivant",finishButtonText:u="Terminer",cancelButtonText:h="Annuler",skipButtonText:f="Passer",showCancelButton:g=!0,showProgress:p=!0,showStepNumbers:j=!0,showStepper:b=!0,stepperPosition:w="top",allowBackNavigation:y=!0,confirmCancel:v=!0,cancelConfirmMessage:N="Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.",submitting:k=!1,layout:S="card",className:C}){const[M,D]=i.useState(0),[A,T]=i.useState(t.map((Z,X)=>X===0?"current":"pending")),[E,I]=i.useState(!1),$=s??M,P=$===0,R=$===t.length-1,F=t[$],W=($+1)/t.length*100,U=(Z,X)=>{T(se=>{const K=[...se];if(X==="next"&&$<t.length)K[$]="completed";else if(X==="skip")K[$]="skipped";else if(X==="goto"&&Z<$)for(let Q=Z+1;Q<t.length;Q++)K[Q]="pending";return K[Z]="current",K})},G=async Z=>{if(Z<0||Z>=t.length||Z>$&&!y)return;F.onLeave&&await F.onLeave(),U(Z,"goto"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},O=async()=>{if(F.validate&&!await F.validate()){T(X=>{const se=[...X];return se[$]="error",se});return}if(F.onLeave&&await F.onLeave(),R){const Z={steps:t.map((X,se)=>({id:X.id,status:se===$?"completed":A[se]})),completedSteps:t.filter((X,se)=>A[se]==="completed"||se===$).map(X=>X.id),skippedSteps:t.filter((X,se)=>A[se]==="skipped").map(X=>X.id)};await r?.(Z)}else{const Z=$+1;U(Z,"next"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()}},_=async()=>{if(P)return;F.onLeave&&await F.onLeave();const Z=$-1;U(Z,"prev"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},z=async()=>{if(!F.optional||R)return;F.onLeave&&await F.onLeave();const Z=$+1;U(Z,"skip"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},V=()=>{v?I(!0):n?.()},q={currentStep:$,totalSteps:t.length,stepStatuses:A,goToStep:G,nextStep:O,prevStep:_,skipStep:z,isFirstStep:P,isLastStep:R},B=b&&e.jsx(SE,{steps:t,currentStep:$,stepStatuses:A,showStepNumbers:j,orientation:w==="left"?"vertical":"horizontal",onStepClick:G,allowBackNavigation:y}),H=e.jsx(ME,{onPrev:_,onNext:O,onSkip:F.optional?z:void 0,onCancel:n?V:void 0,isFirstStep:P,isLastStep:R,isOptional:F.optional||!1,prevButtonText:c,nextButtonText:m,finishButtonText:u,skipButtonText:f,cancelButtonText:h,showCancelButton:g,submitting:k}),Y=e.jsxs(Ip.Provider,{value:q,children:[w==="left"?e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-64 flex-shrink-0",children:B}),e.jsxs("div",{className:"flex-1",children:[p&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",$+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Be,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:F.content}),e.jsx("div",{className:"mt-8",children:H})]})]}):e.jsxs(e.Fragment,{children:[B&&e.jsx("div",{className:"mb-8",children:B}),p&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",$+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Be,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:F.content}),e.jsx("div",{className:"mt-8",children:H})]}),e.jsx(zs,{open:E,onOpenChange:I,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Annuler ?"}),e.jsx(js,{children:N})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Non, continuer"}),e.jsx(vs,{onClick:()=>{I(!1),n?.()},children:"Oui, annuler"})]})]})})]});return S==="minimal"?e.jsx("div",{className:d.cn("space-y-6",C),children:Y}):S==="page"?e.jsxs("div",{className:d.cn("container py-8 max-w-4xl",C),children:[(l||o)&&e.jsxs("div",{className:"mb-8",children:[l&&e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:l}),o&&e.jsx("p",{className:"text-muted-foreground mt-1",children:o})]}),Y]}):e.jsxs(me,{className:C,children:[(l||o)&&e.jsxs(we,{children:[l&&e.jsx(Ne,{children:l}),o&&e.jsx(Ze,{children:o})]}),e.jsx(fe,{children:Y})]})}const DE=[{id:"step-1",title:"Informations de base",description:"Renseignez vos informations personnelles",content:e.jsx("div",{className:"space-y-4",children:e.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:e.jsx("div",{className:"space-y-4",children:e.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:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 3 - Confirmation"})})}];function Pp(t,s,a){const r=t.translations[a]?.value||"",n=t.translations[s]?.value;return!n||n.trim()===""?"missing":n===r?"identical":"valid"}function Tl(t,s,a){const r=s.filter(n=>n!==a).map(n=>Pp(t,n,a));return r.includes("missing")?"missing":r.includes("identical")?"identical":"valid"}function $E(t,s){const a=new Map;for(const r of t){const n=r.key.split(s),l=n.length>1?n[0]:"__root__";a.has(l)||a.set(l,[]),a.get(l).push(r)}return a}function AE({status:t}){const s={valid:{label:"OK",variant:"default",icon:x.CheckCircle,className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"},missing:{label:"Manquant",variant:"destructive",icon:x.XCircle,className:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"},identical:{label:"Identique",variant:"secondary",icon:x.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"},warning:{label:"Attention",variant:"secondary",icon:x.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"}},{label:a,icon:r,className:n}=s[t];return e.jsxs(ne,{variant:"outline",className:d.cn("gap-1 text-xs",n),children:[e.jsx(r,{className:"h-3 w-3"}),a]})}function Xu({value:t,onChange:s,onBlur:a,placeholder:r,status:n,disabled:l}){const[o,c]=i.useState(t);i.useEffect(()=>{c(t)},[t]);const m=u=>{c(u.target.value),s(u.target.value)};return e.jsx(L.Textarea,{value:o,onChange:m,onBlur:a,placeholder:r,disabled:l,className:d.cn("min-h-[60px] resize-none text-sm",n==="missing"&&"border-red-300 dark:border-red-700",n==="identical"&&"border-yellow-300 dark:border-yellow-700")})}function EE({config:t,translations:s,onChange:a,onSave:r,onAddKey:n,onDeleteKey:l,onAddLanguage:o,onExport:c,onImport:m,isLoading:u=!1,isSaving:h=!1,className:f,title:g="Translation Editor",description:p="Gérez vos traductions i18n"}){const[j,b]=i.useState(s),[w,y]=i.useState(""),[v,N]=i.useState("all"),[k,S]=i.useState(new Set),[C,M]=i.useState(null),[D,A]=i.useState(!1),[T,E]=i.useState(!1),[I,$]=i.useState(!1),[P,R]=i.useState(!1),[F,W]=i.useState(""),[U,G]=i.useState({code:"",label:"",flag:""}),[O,_]=i.useState(null),[z,V]=i.useState(""),[q,B]=i.useState("merge"),[H,Y]=i.useState(new Map),Z=i.useRef(null),{languages:X,sourceLanguage:se,keyPathSeparator:K=".",autoSave:Q=!0,saveDebounceMs:ee=300,placeholderPatterns:te=["{{.*?}}","{.*?}","%s","%d"]}=t,ae=X.filter(ie=>ie.code!==se);i.useEffect(()=>{b(s)},[s]),i.useEffect(()=>(Q&&H.size>0&&r&&(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(async()=>{await r(j),Y(new Map)},ee)),()=>{Z.current&&clearTimeout(Z.current)}),[H,Q,ee,r,j]);const re=i.useMemo(()=>{let ie=j;if(w){const ue=w.toLowerCase();ie=ie.filter(ge=>{if(ge.key.toLowerCase().includes(ue))return!0;for(const Me of Object.keys(ge.translations))if(ge.translations[Me]?.value?.toLowerCase().includes(ue))return!0;return!1})}return v!=="all"&&(ie=ie.filter(ue=>{const ge=Tl(ue,X.map(Me=>Me.code),se);switch(v){case"missing":return ge==="missing";case"incomplete":return ge==="missing"||ge==="identical";case"identical":return ge==="identical";default:return!0}})),ie},[j,w,v,X,se]),le=i.useMemo(()=>$E(re,K),[re,K]),de=(ie,ue,ge)=>{b(Me=>Me.map(Se=>Se.key===ie?{...Se,translations:{...Se.translations,[ue]:{...Se.translations[ue],value:ge,updatedAt:new Date}}}:Se)),Y(Me=>{const Se=new Map(Me);return Se.has(ie)||Se.set(ie,new Map),Se.get(ie).set(ue,ge),Se}),a?.(ie,ue,ge)},oe=async()=>{F.trim()&&(await n?.(F),W(""),E(!1))},he=async ie=>{await l?.(ie),b(ue=>ue.filter(ge=>ge.key!==ie))},ve=async()=>{!U.code||!U.label||(await o?.(U),G({code:"",label:"",flag:""}),$(!1))},be=async()=>{!O||!z||(await m?.(O,z,q),_(null),V(""),R(!1))},pe=ie=>{navigator.clipboard.writeText(ie)},je=ie=>{S(ue=>{const ge=new Set(ue);return ge.has(ie)?ge.delete(ie):ge.add(ie),ge})},Ce=i.useMemo(()=>{let ie=j.length,ue=0,ge=0,Me=0;for(const Se of j){const Xe=Tl(Se,X.map(mt=>mt.code),se);Xe==="missing"?ue++:Xe==="identical"?ge++:Me++}return{total:ie,missing:ue,identical:ge,valid:Me}},[j,X,se]);return u?e.jsx("div",{className:d.cn("flex items-center justify-center py-12",f),children:e.jsx(x.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(He,{children:e.jsxs("div",{className:d.cn("flex flex-col h-full",f),children:[e.jsxs("div",{className:"flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(x.Languages,{className:"h-6 w-6"}),g]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une clé"]}),e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>$(!0),children:[e.jsx(x.Flag,{className:"h-4 w-4 mr-1"}),"Ajouter une langue"]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"outline",size:"sm",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>c?.(),children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Exporter tout"]}),X.map(ie=>e.jsxs(ye,{onClick:()=>c?.(ie.code),children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Exporter ",ie.label]},ie.code)),e.jsx(Ke,{}),e.jsxs(ye,{onClick:()=>R(!0),children:[e.jsx(x.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]})]})]}),h&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Loader2,{className:"h-4 w-4 animate-spin"}),"Sauvegarde..."]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Ce.total," clés"]}),e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400",children:[e.jsx(x.CheckCircle,{className:"h-4 w-4"}),Ce.valid," traduites"]}),e.jsxs("span",{className:"flex items-center gap-1 text-red-600 dark:text-red-400",children:[e.jsx(x.XCircle,{className:"h-4 w-4"}),Ce.missing," manquantes"]}),e.jsxs("span",{className:"flex items-center gap-1 text-yellow-600 dark:text-yellow-400",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4"}),Ce.identical," identiques"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher une clé ou une traduction...",value:w,onChange:ie=>y(ie.target.value),className:"pl-10"}),w&&e.jsx("button",{onClick:()=>y(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Filter,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs(Ee,{value:v,onValueChange:ie=>N(ie),children:[e.jsx($e,{className:"w-[180px]",children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsxs(xe,{value:"all",children:["Toutes (",Ce.total,")"]}),e.jsxs(xe,{value:"missing",children:["Manquantes (",Ce.missing,")"]}),e.jsxs(xe,{value:"incomplete",children:["Incomplètes (",Ce.missing+Ce.identical,")"]}),e.jsxs(xe,{value:"identical",children:["Identiques (",Ce.identical,")"]})]})]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-muted/50 backdrop-blur z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b w-[280px]",children:"Clé"}),e.jsxs("th",{className:"text-left p-3 font-medium text-sm border-b",children:[X.find(ie=>ie.code===se)?.label||se," (source)"]}),ae.map(ie=>e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b",children:e.jsxs("span",{className:"flex items-center gap-2",children:[ie.flag&&e.jsx("span",{children:ie.flag}),ie.label]})},ie.code)),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[100px]",children:"État"}),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[60px]",children:"Actions"})]})}),e.jsxs("tbody",{children:[Array.from(le.entries()).map(([ie,ue])=>e.jsxs(i.Fragment,{children:[ie!=="__root__"&&e.jsx("tr",{className:"bg-muted/30",children:e.jsx("td",{colSpan:ae.length+4,className:"p-2",children:e.jsxs("button",{onClick:()=>je(ie),className:"flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors",children:[k.has(ie)?e.jsx(x.ChevronRight,{className:"h-4 w-4"}):e.jsx(x.ChevronDown,{className:"h-4 w-4"}),ie,e.jsx(ne,{variant:"secondary",className:"text-xs",children:ue.length})]})})}),!k.has(ie)&&ue.map(ge=>{const Me=Tl(ge,X.map(Se=>Se.code),se);return e.jsxs("tr",{className:"border-b hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"p-3 font-mono text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate max-w-[200px]",title:ge.key,children:ge.key}),e.jsxs(Ge,{children:[e.jsx(qe,{asChild:!0,children:e.jsx("button",{onClick:()=>pe(ge.key),className:"text-muted-foreground hover:text-foreground",children:e.jsx(x.Copy,{className:"h-3 w-3"})})}),e.jsx(Oe,{children:"Copier la clé"})]})]})}),e.jsx("td",{className:"p-2",children:e.jsx(Xu,{value:ge.translations[se]?.value||"",onChange:Se=>de(ge.key,se,Se),placeholder:"Texte source...",status:ge.translations[se]?.value?"valid":"missing"})}),ae.map(Se=>{const Xe=Pp(ge,Se.code,se);return e.jsx("td",{className:"p-2",children:e.jsx(Xu,{value:ge.translations[Se.code]?.value||"",onChange:mt=>de(ge.key,Se.code,mt),placeholder:`Traduction ${Se.label}...`,status:Xe})},Se.code)}),e.jsx("td",{className:"p-3 text-center",children:e.jsx(AE,{status:Me})}),e.jsx("td",{className:"p-3 text-center",children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"sm",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>{M(ge),A(!0)},children:[e.jsx(x.Edit3,{className:"h-4 w-4 mr-2"}),"Éditer"]}),e.jsxs(ye,{onClick:()=>pe(ge.key),children:[e.jsx(x.Copy,{className:"h-4 w-4 mr-2"}),"Copier la clé"]}),e.jsx(Ke,{}),e.jsxs(ye,{className:"text-destructive",onClick:()=>he(ge.key),children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})})]},ge.key)})]},ie)),re.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:ae.length+4,className:"p-12 text-center",children:[e.jsx(x.Languages,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:w||v!=="all"?"Aucune traduction ne correspond à vos critères":"Aucune traduction disponible"})]})})]})]})}),e.jsx(nr,{open:D,onOpenChange:A,children:e.jsxs(ua,{className:"w-[500px] sm:max-w-[500px]",children:[e.jsxs(vn,{children:[e.jsx(lr,{children:"Éditer la traduction"}),e.jsx(or,{children:C?.key})]}),C&&e.jsxs("div",{className:"py-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:[X.find(ie=>ie.code===se)?.label," (source)"]}),e.jsx(L.Textarea,{value:C.translations[se]?.value||"",onChange:ie=>{de(C.key,se,ie.target.value),M({...C,translations:{...C.translations,[se]:{...C.translations[se],value:ie.target.value}}})},placeholder:"Texte source...",className:"min-h-[100px]"})]}),X.filter(ie=>ie.code!==se).map(ie=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[ie.flag&&e.jsx("span",{children:ie.flag}),ie.label]}),e.jsx(L.Textarea,{value:C.translations[ie.code]?.value||"",onChange:ue=>{de(C.key,ie.code,ue.target.value),M({...C,translations:{...C.translations,[ie.code]:{...C.translations[ie.code],value:ue.target.value}}})},placeholder:`Traduction ${ie.label}...`,className:"min-h-[100px]"})]},ie.code)),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Commentaire (optionnel)"}),e.jsx(L.Textarea,{placeholder:"Contexte ou indication pour la traduction...",className:"min-h-[80px]"})]})]}),e.jsx(Io,{children:e.jsx(L.Button,{variant:"outline",onClick:()=>A(!1),children:"Fermer"})})]})}),e.jsx(Jt,{open:T,onOpenChange:E,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Ajouter une clé de traduction"}),e.jsx(na,{children:"Entrez la clé de traduction (ex: common.buttons.submit)"})]}),e.jsx("div",{className:"py-4",children:e.jsx(L.Input,{value:F,onChange:ie=>W(ie.target.value),placeholder:"namespace.key.name"})}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>E(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:oe,children:"Ajouter"})]})]})}),e.jsx(Jt,{open:I,onOpenChange:$,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Ajouter une langue"}),e.jsx(na,{children:"Configurez la nouvelle langue à ajouter"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Code (ex: de, it, pt)"}),e.jsx(L.Input,{value:U.code,onChange:ie=>G({...U,code:ie.target.value}),placeholder:"de"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Label"}),e.jsx(L.Input,{value:U.label,onChange:ie=>G({...U,label:ie.target.value}),placeholder:"Allemand"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Emoji drapeau (optionnel)"}),e.jsx(L.Input,{value:U.flag,onChange:ie=>G({...U,flag:ie.target.value}),placeholder:"🇩🇪"})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>$(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:ve,children:"Ajouter"})]})]})}),e.jsx(Jt,{open:P,onOpenChange:R,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Importer des traductions"}),e.jsx(na,{children:"Sélectionnez un fichier JSON à importer"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Fichier JSON"}),e.jsx(L.Input,{type:"file",accept:".json",onChange:ie=>_(ie.target.files?.[0]||null)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Langue cible"}),e.jsxs(Ee,{value:z,onValueChange:V,children:[e.jsx($e,{children:e.jsx(Re,{placeholder:"Sélectionner une langue"})}),e.jsx(Ae,{children:X.map(ie=>e.jsxs(xe,{value:ie.code,children:[ie.flag&&e.jsx("span",{className:"mr-2",children:ie.flag}),ie.label]},ie.code))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Stratégie"}),e.jsxs(Ee,{value:q,onValueChange:ie=>B(ie),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"merge",children:"Fusionner (conserver les existantes)"}),e.jsx(xe,{value:"overwrite",children:"Écraser tout"})]})]})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>R(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:be,disabled:!O||!z,children:"Importer"})]})]})})]})})}const uo={default:"text-foreground",blue:"text-blue-500",green:"text-green-500",yellow:"text-yellow-500",red:"text-red-500",purple:"text-purple-500"},RE={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 IE({data:t,color:s="blue"}){const a=Math.max(...t),r=Math.min(...t),n=a-r||1,l=t.map((o,c)=>{const m=c/(t.length-1)*100,u=100-(o-r)/n*100;return`${m},${u}`}).join(" ");return e.jsx("svg",{className:"w-16 h-8",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:e.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"3",className:d.cn("opacity-60",uo[s]||uo.blue)})})}function PE({metric:t}){const s=t.icon,a=t.trend==="up"?"text-green-500":t.trend==="down"?"text-red-500":"text-muted-foreground",r=t.trend==="up"?x.TrendingUp:t.trend==="down"?x.TrendingDown:null;return e.jsxs(me,{className:"relative overflow-hidden",children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(Ne,{className:"text-sm font-medium text-muted-foreground",children:t.label}),s&&e.jsx("div",{className:d.cn("p-2 rounded-lg",RE[t.color||"default"]),children:e.jsx("span",{className:d.cn("h-4 w-4",uo[t.color||"default"]),children:s})})]}),e.jsxs(fe,{children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold",children:t.value}),t.change!==void 0&&e.jsxs("div",{className:d.cn("flex items-center gap-1 text-sm",a),children:[r&&e.jsx(r,{className:"h-3 w-3"}),e.jsxs("span",{children:[t.change>0?"+":"",t.change,"%"]}),t.changeLabel&&e.jsx("span",{className:"text-muted-foreground",children:t.changeLabel})]})]}),t.sparkline&&e.jsx(IE,{data:t.sparkline,color:t.color})]}),t.target!==void 0&&t.current!==void 0&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{children:[Math.round(t.current/t.target*100),"%"]})]}),e.jsx(Be,{value:t.current/t.target*100,className:"h-1.5"})]})]})]})}function LE({goal:t}){const s=t.current/t.target*100,a=s>=100;return e.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border bg-card",children:[e.jsx("div",{className:d.cn("h-10 w-10 rounded-full flex items-center justify-center",a?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.jsx(x.Target,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium truncate",children:t.label}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.current,t.unit," / ",t.target,t.unit]})]}),e.jsx(Be,{value:Math.min(s,100),className:"h-2"})]}),a&&e.jsx(ne,{variant:"default",className:"bg-green-500",children:"Complete"})]})}function FE({title:t="Dashboard",description:s,metrics:a,periods:r=[{value:"7d",label:"7 days"},{value:"30d",label:"30 days"},{value:"90d",label:"90 days"},{value:"12m",label:"12 months"}],selectedPeriod:n="30d",onPeriodChange:l,onRefresh:o,onExport:c,chart:m,secondaryMetrics:u,goals:h,isLoading:f=!1,lastUpdated:g,className:p}){return e.jsxs("div",{className:d.cn("space-y-6",p),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r.length>0&&e.jsxs(Ee,{value:n,onValueChange:l,children:[e.jsxs($e,{className:"w-[140px]",children:[e.jsx(x.Calendar,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsx(Ae,{children:r.map(j=>e.jsx(xe,{value:j.value,children:j.label},j.value))})]}),o&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:o,disabled:f,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",f&&"animate-spin")})}),c&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:c,children:e.jsx(x.Download,{className:"h-4 w-4"})})]})]}),g&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Clock,{className:"h-4 w-4"}),e.jsxs("span",{children:["Last updated: ",typeof g=="string"?g:g.toLocaleString()]})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:a.slice(0,4).map(j=>e.jsx(PE,{metric:j},j.id))}),m&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Overview"}),e.jsx(Ze,{children:"Performance metrics over time"})]}),e.jsx(fe,{children:m})]}),u&&u.length>0&&e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:u.map(j=>e.jsx(me,{children:e.jsx(fe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:j.label}),e.jsx("p",{className:"text-xl font-bold",children:j.value})]}),j.change!==void 0&&e.jsxs(ne,{variant:j.trend==="up"?"default":j.trend==="down"?"destructive":"secondary",className:"gap-1",children:[j.trend==="up"?e.jsx(x.ArrowUpRight,{className:"h-3 w-3"}):j.trend==="down"?e.jsx(x.ArrowDownRight,{className:"h-3 w-3"}):null,j.change>0?"+":"",j.change,"%"]})]})})},j.id))}),h&&h.length>0&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.Target,{className:"h-5 w-5"}),"Goals & Targets"]}),e.jsx(Ze,{children:"Track your progress towards key objectives"})]}),e.jsx(fe,{className:"space-y-4",children:h.map(j=>e.jsx(LE,{goal:j},j.id))})]})]})}const BE=[{id:"revenue",label:"Total Revenue",value:"$45,231.89",change:20.1,changeLabel:"from last month",trend:"up",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Activity,{className:"h-4 w-4"}),color:"yellow",sparkline:[100,90,85,88,70,65,60,58,55]}],zE=[{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 WE({steps:t,currentStep:s}){const a=t.findIndex(r=>r.id===s);return e.jsx("div",{className:"flex items-center justify-center mb-8",children:t.map((r,n)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:d.cn("h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium",n<a?"bg-primary text-primary-foreground":n===a?"bg-primary text-primary-foreground ring-4 ring-primary/20":"bg-muted text-muted-foreground"),children:n<a?e.jsx(x.Check,{className:"h-4 w-4"}):n+1}),e.jsx("span",{className:d.cn("ml-2 text-sm font-medium hidden sm:inline",n<=a?"text-foreground":"text-muted-foreground"),children:r.label})]}),n<t.length-1&&e.jsx("div",{className:d.cn("w-8 sm:w-16 h-0.5 mx-2",n<a?"bg-primary":"bg-muted")})]},r.id))})}function OE({items:t,currency:s="$",discount:a,couponCode:r,setCouponCode:n,onApplyCoupon:l,onRemoveDiscount:o,isApplyingCoupon:c,shippingPrice:m=0,taxRate:u=0}){const h=t.reduce((b,w)=>b+w.price*w.quantity,0),f=a?a.type==="percent"?h*a.amount/100:a.amount:0,g=h-f,p=g*u/100,j=g+p+m;return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.ShoppingBag,{className:"h-5 w-5"}),"Order Summary"]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsx("div",{className:"space-y-3",children:t.map(b=>e.jsxs("div",{className:"flex gap-3",children:[b.image&&e.jsx("div",{className:"h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0",children:e.jsx("img",{src:b.image,alt:b.name,className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:b.name}),b.variant&&e.jsx("p",{className:"text-sm text-muted-foreground",children:b.variant}),e.jsxs("p",{className:"text-sm",children:["Qty: ",b.quantity]})]}),e.jsxs("p",{className:"font-medium",children:[s,(b.price*b.quantity).toFixed(2)]})]},b.id))}),e.jsx(L.Separator,{}),a?e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Percent,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.code}),e.jsxs("span",{className:"text-sm",children:["(-",a.type==="percent"?`${a.amount}%`:`${s}${a.amount}`,")"]})]}),e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(x.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L.Input,{placeholder:"Coupon code",value:r,onChange:b=>n(b.target.value),className:"flex-1"}),e.jsx(L.Button,{variant:"outline",onClick:l,disabled:!r||c,children:c?e.jsx(x.Loader2,{className:"h-4 w-4 animate-spin"}):"Apply"})]}),e.jsx(L.Separator,{}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subtotal"}),e.jsxs("span",{children:[s,h.toFixed(2)]})]}),f>0&&e.jsxs("div",{className:"flex justify-between text-green-600",children:[e.jsx("span",{children:"Discount"}),e.jsxs("span",{children:["-",s,f.toFixed(2)]})]}),m>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Shipping"}),e.jsxs("span",{children:[s,m.toFixed(2)]})]}),p>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Tax (",u,"%)"]}),e.jsxs("span",{children:[s,p.toFixed(2)]})]}),e.jsx(L.Separator,{}),e.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:[s,j.toFixed(2)]})]})]})]})]})}function UE({items:t,shippingMethods:s=Lp,paymentMethods:a=Fp,onApplyCoupon:r,discount:n,onRemoveDiscount:l,onSubmitOrder:o,currency:c="$",taxRate:m=8.5,className:u}){const[h,f]=i.useState("cart"),[g,p]=i.useState(""),[j,b]=i.useState(!1),[w,y]=i.useState(!1),[v,N]=i.useState({firstName:"",lastName:"",email:"",phone:"",address:"",apartment:"",city:"",state:"",postalCode:"",country:"US"}),[k,S]=i.useState(s[0]?.id||""),[C,M]=i.useState(a[0]?.id||""),[D,A]=i.useState(!1),T=[{id:"cart",label:"Cart"},{id:"shipping",label:"Shipping"},{id:"payment",label:"Payment"},{id:"review",label:"Review"}],E=s.find(F=>F.id===k),I=async()=>{!r||!g||(b(!0),await r(g),b(!1))},$=async()=>{if(o){y(!0);try{await o({address:v,shippingMethod:k,paymentMethod:C,saveInfo:D})}finally{y(!1)}}},P=()=>{const F=T.findIndex(W=>W.id===h);F<T.length-1&&f(T[F+1].id)},R=()=>{const F=T.findIndex(W=>W.id===h);F>0&&f(T[F-1].id)};return e.jsxs("div",{className:d.cn("max-w-6xl mx-auto",u),children:[e.jsx(WE,{steps:T,currentStep:h}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[h==="cart"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Shopping Cart"}),e.jsxs(Ze,{children:[t.length," items in your cart"]})]}),e.jsx(fe,{className:"space-y-4",children:t.map(F=>e.jsxs("div",{className:"flex gap-4 p-4 rounded-lg border",children:[F.image&&e.jsx("div",{className:"h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0",children:e.jsx("img",{src:F.image,alt:F.name,className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium",children:F.name}),F.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:F.description}),F.variant&&e.jsx(ne,{variant:"secondary",className:"mt-1",children:F.variant}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:["Qty: ",F.quantity]}),e.jsxs("span",{className:"font-bold",children:[c,(F.price*F.quantity).toFixed(2)]})]})]})]},F.id))}),e.jsx(Ft,{children:e.jsxs(L.Button,{className:"w-full",onClick:P,children:["Continue to Shipping",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})})]}),h==="shipping"&&e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-5 w-5"}),"Shipping Address"]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"First Name"}),e.jsx(L.Input,{value:v.firstName,onChange:F=>N({...v,firstName:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Last Name"}),e.jsx(L.Input,{value:v.lastName,onChange:F=>N({...v,lastName:F.target.value})})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Email"}),e.jsx(L.Input,{type:"email",value:v.email,onChange:F=>N({...v,email:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Phone"}),e.jsx(L.Input,{type:"tel",value:v.phone,onChange:F=>N({...v,phone:F.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Address"}),e.jsx(L.Input,{value:v.address,onChange:F=>N({...v,address:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Apartment, suite, etc. (optional)"}),e.jsx(L.Input,{value:v.apartment,onChange:F=>N({...v,apartment:F.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"City"}),e.jsx(L.Input,{value:v.city,onChange:F=>N({...v,city:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"State"}),e.jsx(L.Input,{value:v.state,onChange:F=>N({...v,state:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Postal Code"}),e.jsx(L.Input,{value:v.postalCode,onChange:F=>N({...v,postalCode:F.target.value})})]})]}),e.jsx(L.Separator,{className:"my-6"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[e.jsx(x.Truck,{className:"h-5 w-5"}),"Shipping Method"]}),e.jsx(qa,{value:k,onValueChange:S,children:e.jsx("div",{className:"space-y-3",children:s.map(F=>e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",k===F.id?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:F.id}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:F.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:F.description})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"font-medium",children:F.price===0?"Free":`${c}${F.price.toFixed(2)}`}),e.jsx("p",{className:"text-sm text-muted-foreground",children:F.estimatedDays})]})]},F.id))})})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs(L.Button,{className:"flex-1",onClick:P,children:["Continue to Payment",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})]})]}),h==="payment"&&e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.CreditCard,{className:"h-5 w-5"}),"Payment Method"]})}),e.jsxs(fe,{children:[e.jsx(qa,{value:C,onValueChange:M,children:e.jsx("div",{className:"space-y-3",children:a.map(F=>e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",C===F.id?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:F.id}),F.icon,e.jsx("span",{className:"font-medium",children:F.label}),F.last4&&e.jsxs("span",{className:"text-muted-foreground",children:["•••• ",F.last4]})]},F.id))})}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[e.jsx(xt,{id:"save-info",checked:D,onCheckedChange:F=>A(F)}),e.jsx(L.Label,{htmlFor:"save-info",className:"text-sm",children:"Save my information for faster checkout"})]}),e.jsxs("div",{className:"mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3",children:[e.jsx(x.Shield,{className:"h-5 w-5 text-green-500"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment information is encrypted and secure"})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs(L.Button,{className:"flex-1",onClick:P,children:["Review Order",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})]})]}),h==="review"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Review Your Order"}),e.jsx(Ze,{children:"Please verify all information before placing your order"})]}),e.jsxs(fe,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-4 w-4"}),"Shipping Address"]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:[e.jsxs("p",{className:"font-medium",children:[v.firstName," ",v.lastName]}),e.jsxs("p",{children:[v.address,v.apartment&&`, ${v.apartment}`]}),e.jsxs("p",{children:[v.city,", ",v.state," ",v.postalCode]}),e.jsx("p",{children:v.email}),e.jsx("p",{children:v.phone})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.Truck,{className:"h-4 w-4"}),"Shipping Method"]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:[e.jsx("p",{className:"font-medium",children:E?.name}),e.jsx("p",{className:"text-muted-foreground",children:E?.estimatedDays})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.CreditCard,{className:"h-4 w-4"}),"Payment Method"]}),e.jsx("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:e.jsx("p",{className:"font-medium",children:a.find(F=>F.id===C)?.label})})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsx(L.Button,{className:"flex-1",onClick:$,disabled:w,children:w?e.jsxs(e.Fragment,{children:[e.jsx(x.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Lock,{className:"h-4 w-4 mr-2"}),"Place Order"]})})]})]})]}),e.jsx("div",{className:"lg:sticky lg:top-4 h-fit",children:e.jsx(OE,{items:t,currency:c,discount:n,couponCode:g,setCouponCode:p,onApplyCoupon:I,onRemoveDiscount:l,isApplyingCoupon:j,shippingPrice:E?.price||0,taxRate:m})})]})]})}const Lp=[{id:"standard",name:"Standard Shipping",description:"Delivered by postal service",price:4.99,estimatedDays:"5-7 business days",icon:e.jsx(x.Package,{className:"h-5 w-5"})},{id:"express",name:"Express Shipping",description:"Fast delivery guaranteed",price:14.99,estimatedDays:"2-3 business days",icon:e.jsx(x.Truck,{className:"h-5 w-5"})},{id:"overnight",name:"Overnight Shipping",description:"Next day delivery",price:29.99,estimatedDays:"Next business day",icon:e.jsx(x.Truck,{className:"h-5 w-5"})}],Fp=[{id:"card",type:"card",label:"Credit Card",icon:e.jsx(x.CreditCard,{className:"h-5 w-5"})},{id:"paypal",type:"paypal",label:"PayPal",icon:e.jsx("div",{className:"h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold",children:"P"})}],_E=[{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"}],VE={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"},HE={common:"",rare:"shadow-blue-500/20",epic:"shadow-purple-500/20",legendary:"shadow-amber-500/30 shadow-lg"};function GE({current:t,max:s,level:a}){const r=t/s*100;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold",children:a}),e.jsxs("span",{className:"text-muted-foreground",children:["Level ",a]})]}),e.jsxs("span",{className:"text-muted-foreground",children:[t.toLocaleString()," / ",s.toLocaleString()," XP"]})]}),e.jsxs("div",{className:"relative h-3 rounded-full bg-muted overflow-hidden",children:[e.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}%`}}),e.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full",style:{width:`${r}%`}})]})]})}function qE({stat:t}){const s={default:"text-foreground",blue:"text-blue-500",green:"text-green-500",yellow:"text-yellow-500",red:"text-red-500",purple:"text-purple-500"};return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[t.icon&&e.jsx("div",{className:d.cn("h-10 w-10 rounded-lg bg-background flex items-center justify-center",s[t.color||"default"]),children:t.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:t.value}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.label})]})]})}function XE({achievement:t}){const s=t.unlockedAt||t.progress!==void 0&&t.maxProgress!==void 0&&t.progress>=t.maxProgress;return e.jsx("div",{className:d.cn("p-4 rounded-lg border transition-all",s?d.cn(VE[t.rarity||"common"],HE[t.rarity||"common"]):"bg-muted/30 border-dashed opacity-60"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:d.cn("h-12 w-12 rounded-lg flex items-center justify-center",s?"bg-background/50":"bg-muted"),children:t.icon||e.jsx(x.Trophy,{className:"h-6 w-6"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-medium truncate",children:t.name}),t.rarity&&e.jsx(ne,{variant:"outline",className:"text-xs capitalize",children:t.rarity})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.progress!==void 0&&t.maxProgress!==void 0&&!s&&e.jsxs("div",{className:"mt-2",children:[e.jsx(Be,{value:t.progress/t.maxProgress*100,className:"h-1.5"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t.progress," / ",t.maxProgress]})]}),t.unlockedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Unlocked ",typeof t.unlockedAt=="string"?t.unlockedAt:t.unlockedAt.toLocaleDateString()]})]})]})})}function YE({match:t}){const s={win:"text-green-500 bg-green-500/10",loss:"text-red-500 bg-red-500/10",draw:"text-yellow-500 bg-yellow-500/10"},a={win:e.jsx(x.Trophy,{className:"h-4 w-4"}),loss:e.jsx(x.Swords,{className:"h-4 w-4"}),draw:e.jsx(x.Shield,{className:"h-4 w-4"})};return e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/50",children:[e.jsx("div",{className:d.cn("h-10 w-10 rounded-lg flex items-center justify-center",s[t.result]),children:a[t.result]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium capitalize",children:t.result}),t.score&&e.jsx("span",{className:"text-muted-foreground",children:t.score})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.opponent&&e.jsxs("span",{children:["vs ",t.opponent]}),t.mode&&e.jsx(ne,{variant:"outline",className:"text-xs",children:t.mode})]})]}),e.jsxs("div",{className:"text-right",children:[t.xpGained&&e.jsxs("p",{className:"text-sm font-medium text-green-500",children:["+",t.xpGained," XP"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:typeof t.date=="string"?t.date:t.date.toLocaleDateString()})]})]})}function ZE({name:t,avatar:s,title:a,level:r,currentXP:n,maxXP:l,totalXP:o,rank:c,rankIcon:m,stats:u,achievements:h,badges:f,matchHistory:g,streak:p,joinDate:j,playtime:b,friendsCount:w,isOnline:y=!1,className:v}){return e.jsxs("div",{className:d.cn("space-y-6",v),children:[e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{className:"h-24 w-24 border-4 border-primary/20",children:[e.jsx(st,{src:s,alt:t}),e.jsx(at,{className:"text-2xl",children:t.slice(0,2).toUpperCase()})]}),y&&e.jsx("div",{className:"absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background"}),e.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:r})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:t}),a&&e.jsx("p",{className:"text-muted-foreground",children:a}),c&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[m||e.jsx(x.Medal,{className:"h-5 w-5 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:c})]})]})]}),e.jsxs("div",{className:"flex-1 grid grid-cols-2 md:grid-cols-4 gap-4",children:[p!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-orange-500/10",children:[e.jsx(x.Flame,{className:"h-6 w-6 text-orange-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:p}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Day Streak"})]}),o!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-purple-500/10",children:[e.jsx(x.Zap,{className:"h-6 w-6 text-purple-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:o.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total XP"})]}),b&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-blue-500/10",children:[e.jsx(x.Clock,{className:"h-6 w-6 text-blue-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Playtime"})]}),w!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-green-500/10",children:[e.jsx(x.Users,{className:"h-6 w-6 text-green-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Friends"})]})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx(GE,{current:n,max:l,level:r})}),f&&f.length>0&&e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Badges"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(N=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm",style:N.color?{backgroundColor:`${N.color}20`,color:N.color}:void 0,children:[N.icon,e.jsx("span",{children:N.name})]},N.id))})]})]})}),e.jsxs(rs,{defaultValue:"stats",className:"w-full",children:[e.jsxs(Ut,{className:"w-full justify-start",children:[e.jsx(dt,{value:"stats",children:"Stats"}),e.jsx(dt,{value:"achievements",children:"Achievements"}),e.jsx(dt,{value:"history",children:"Match History"})]}),e.jsx(ut,{value:"stats",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Player Statistics"}),e.jsx(Ze,{children:"Your performance metrics"})]}),e.jsx(fe,{children:u&&u.length>0?e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:u.map((N,k)=>e.jsx(qE,{stat:N},k))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No statistics available"})})]})}),e.jsx(ut,{value:"achievements",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Achievements"}),e.jsxs(Ze,{children:[h?.filter(N=>N.unlockedAt).length||0," / ",h?.length||0," unlocked"]})]}),e.jsx(fe,{children:h&&h.length>0?e.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:h.map(N=>e.jsx(XE,{achievement:N},N.id))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No achievements yet"})})]})}),e.jsx(ut,{value:"history",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Match History"}),e.jsx(Ze,{children:"Your recent games"})]}),e.jsx(fe,{children:g&&g.length>0?e.jsx("div",{className:"space-y-3",children:g.map(N=>e.jsx(YE,{match:N},N.id))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No matches played yet"})})]})})]}),j&&e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Calendar,{className:"h-4 w-4"}),e.jsxs("span",{children:["Member since ",typeof j=="string"?j:j.toLocaleDateString()]})]})]})}const KE=[{label:"Matches Played",value:342,icon:e.jsx(x.Gamepad2,{className:"h-5 w-5"}),color:"blue"},{label:"Wins",value:189,icon:e.jsx(x.Trophy,{className:"h-5 w-5"}),color:"green"},{label:"Win Rate",value:"55.3%",icon:e.jsx(x.TrendingUp,{className:"h-5 w-5"}),color:"yellow"},{label:"Best Score",value:"12,450",icon:e.jsx(x.Star,{className:"h-5 w-5"}),color:"purple"},{label:"Kills",value:"1,234",icon:e.jsx(x.Target,{className:"h-5 w-5"}),color:"red"},{label:"Assists",value:876,icon:e.jsx(x.Heart,{className:"h-5 w-5"}),color:"default"}],QE=[{id:"first-win",name:"First Victory",description:"Win your first match",rarity:"common",unlockedAt:new Date("2024-01-15"),icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Users,{className:"h-6 w-6 text-purple-500"})}],JE=[{id:"beta",name:"Beta Tester",icon:e.jsx(x.Shield,{className:"h-4 w-4"}),color:"#3b82f6"},{id:"premium",name:"Premium",icon:e.jsx(x.Crown,{className:"h-4 w-4"}),color:"#f59e0b"},{id:"verified",name:"Verified",icon:e.jsx(x.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}],Bp={authenticator:{icon:e.jsx(x.Smartphone,{className:"h-5 w-5"}),title:"Authenticator App",description:"Use an app like Google Authenticator or Authy",recommended:!0},sms:{icon:e.jsx(x.MessageSquare,{className:"h-5 w-5"}),title:"SMS",description:"Receive codes via text message",recommended:!1},email:{icon:e.jsx(x.Mail,{className:"h-5 w-5"}),title:"Email",description:"Receive codes via email",recommended:!1},hardware:{icon:e.jsx(x.Key,{className:"h-5 w-5"}),title:"Hardware Key",description:"Use a physical security key (YubiKey, etc.)",recommended:!0}};function tR({methods:t,selected:s,onSelect:a}){return e.jsx(qa,{value:s,onValueChange:r=>a(r),children:e.jsx("div",{className:"space-y-3",children:t.map(r=>{const n=Bp[r];return e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",s===r?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:r}),e.jsx("div",{className:"h-10 w-10 rounded-lg bg-muted flex items-center justify-center",children:n.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.title}),n.recommended&&e.jsx(ne,{variant:"secondary",className:"text-xs",children:"Recommended"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]})]},r)})})})}function Yu({length:t=6,value:s,onChange:a}){const r=i.useRef([]),n=s.padEnd(t,"").split("").slice(0,t),l=(m,u)=>{if(!/^\d*$/.test(u))return;const h=[...n];h[m]=u.slice(-1),a(h.join("")),u&&m<t-1&&r.current[m+1]?.focus()},o=(m,u)=>{u.key==="Backspace"&&!n[m]&&m>0&&r.current[m-1]?.focus()},c=m=>{m.preventDefault();const u=m.clipboardData.getData("text").replace(/\D/g,"").slice(0,t);a(u)};return e.jsx("div",{className:"flex gap-2 justify-center",children:n.map((m,u)=>e.jsx(L.Input,{ref:h=>{r.current[u]=h},type:"text",inputMode:"numeric",maxLength:1,value:m,onChange:h=>l(u,h.target.value),onKeyDown:h=>o(u,h),onPaste:c,className:"w-12 h-14 text-center text-2xl font-mono"},u))})}function sR({codes:t,onRegenerate:s,onDownload:a}){const[r,n]=i.useState(!1),[l,o]=i.useState(!1),c=()=>{const u=t.map(h=>h.code).join(`
2635
+ `})]})}function oo({variant:t="house",size:s="rectangle",width:a,height:r,title:n="Your Ad Here",description:l="Advertise with us",ctaText:o="Learn More",ctaUrl:c,imageUrl:m,showBorder:u=!0,className:h,onClick:f,children:g}){const p=Wn[s],j=a??p.width,b=r??p.height;if(t==="custom"&&g)return e.jsx("div",{className:d.cn("rounded-md overflow-hidden",h),style:{width:j,height:b,maxWidth:"100%"},children:g});if(t==="empty")return e.jsx("div",{className:d.cn("relative overflow-hidden rounded-md",u&&"border border-dashed border-muted-foreground/20","flex items-center justify-center","bg-muted/20",h),style:{width:j,height:b,maxWidth:"100%"},children:e.jsx("span",{className:"text-xs text-muted-foreground/40",children:"Ad"})});const w=e.jsxs("div",{className:d.cn("relative overflow-hidden rounded-md transition-all duration-200",u&&"border border-dashed border-muted-foreground/30","hover:border-muted-foreground/50 hover:bg-muted/50","flex flex-col items-center justify-center p-4 text-center","bg-gradient-to-br from-muted/30 to-muted/10",h),style:{width:j,height:b,maxWidth:"100%",backgroundImage:m?`url(${m})`:void 0,backgroundSize:"cover",backgroundPosition:"center"},children:[m&&e.jsx("div",{className:"absolute inset-0 bg-black/40"}),e.jsxs("div",{className:d.cn("relative z-10",m&&"text-white"),children:[e.jsx("div",{className:"mb-2",children:e.jsx("svg",{className:"h-10 w-10 mx-auto text-muted-foreground/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z"})})}),e.jsx("h3",{className:d.cn("font-semibold text-sm mb-1",!m&&"text-muted-foreground"),children:n}),e.jsx("p",{className:d.cn("text-xs mb-3",m?"text-white/80":"text-muted-foreground/70"),children:l}),e.jsxs("span",{className:d.cn("inline-flex items-center px-3 py-1 rounded text-xs font-medium transition-colors",m?"bg-white text-black hover:bg-white/90":"bg-primary/10 text-primary hover:bg-primary/20"),children:[o,e.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]});return c?e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer sponsored",onClick:f,className:"block cursor-pointer",children:w}):f?e.jsx("button",{onClick:f,className:"block cursor-pointer text-left",children:w}):w}function Mt({sponsor:t,variant:s="default",size:a="sm",showIcon:r=!0,label:n="Sponsored",className:l,onInfoClick:o}){const c={default:"bg-muted text-muted-foreground border-transparent",subtle:"bg-black/50 text-white border-transparent backdrop-blur-sm",outline:"bg-transparent text-muted-foreground border-muted-foreground/30",dark:"bg-black/70 text-white border-transparent"},m={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-1 gap-1.5",lg:"text-sm px-2.5 py-1 gap-2"},u={sm:"h-2.5 w-2.5",md:"h-3 w-3",lg:"h-3.5 w-3.5"};return e.jsxs("span",{className:d.cn("inline-flex items-center rounded border font-medium",c[s],m[a],l),children:[e.jsx("span",{className:"whitespace-nowrap",children:t?`${n} by ${t}`:n}),r&&e.jsx("button",{onClick:h=>{h.preventDefault(),h.stopPropagation(),o?.()},className:d.cn("rounded-full hover:opacity-70 transition-opacity focus:outline-none focus:ring-1 focus:ring-current",u[a]),"aria-label":"Why am I seeing this ad?",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"w-full h-full",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})})]})}function tr({slotId:t,size:s="rectangle",customWidth:a,customHeight:r,adUnitPath:n,targeting:l,refreshInterval:o=0,lazyLoad:c=!0,fallback:m,showBadge:u=!0,badgePosition:h="top-right",className:f,onLoad:g,onError:p,onClick:j}){const b=J.useRef(null),{config:w,isReady:y,hasConsent:v,registerSlot:N,unregisterSlot:k,getCustomAd:S,trackEvent:C}=_t(),{isVisible:M}=ba(b),[D,A]=J.useState("loading"),[T,E]=J.useState(null),I=s==="custom"?{width:a||300,height:r||250}:Wn[s];J.useEffect(()=>{const W={id:t,network:w.network,size:s,position:"inline",targeting:l,refreshInterval:o,lazyLoad:c,customWidth:a,customHeight:r};return N(W),()=>k(t)},[t,w.network,s,l,o,c,a,r,N,k]);const $=J.useCallback(async()=>{if(!(!y||v===!1)){A("loading");try{if(w.network==="gpt"&&window.googletag&&n)window.googletag.cmd.push(()=>{window.googletag.defineSlot(n,[I.width,I.height],t)&&l&&Object.entries(l).forEach(([U,G])=>{window.googletag.pubads().setTargeting(U,G)}),window.googletag.enableServices(),window.googletag.display(t)}),A("loaded"),C({type:"loaded",slotId:t,timestamp:new Date}),g?.();else if(w.network==="custom"){const W=await S(t);W?(E(W),A("loaded"),C({type:"loaded",slotId:t,timestamp:new Date}),g?.(),W.impressionUrl&&fetch(W.impressionUrl,{mode:"no-cors"}).catch(()=>{}),W.trackingPixels?.forEach(U=>{const G=new Image;G.src=U})):(A("empty"),C({type:"empty",slotId:t,timestamp:new Date}))}}catch(W){A("error"),C({type:"error",slotId:t,timestamp:new Date,data:{error:W}}),p?.(W)}}},[y,v,w.network,n,I,t,l,S,C,g,p]);J.useEffect(()=>{c?M&&$():$()},[c,M,$]),J.useEffect(()=>{if(o>0&&D==="loaded"&&M){const W=setInterval(()=>{$()},o*1e3);return()=>clearInterval(W)}},[o,D,M,$]),J.useEffect(()=>{M&&D==="loaded"&&C({type:"viewable",slotId:t,timestamp:new Date})},[M,D,t,C]);const P=()=>{C({type:"click",slotId:t,timestamp:new Date}),j?.(),T?.clickUrl&&fetch(T.clickUrl,{mode:"no-cors"}).catch(()=>{}),T?.targetUrl&&window.open(T.targetUrl,"_blank","noopener,noreferrer")},R=()=>v===!1?m||e.jsx(oo,{width:I.width,height:I.height}):D==="loading"?e.jsx(On,{width:I.width,height:I.height}):D==="error"||D==="empty"?m||e.jsx(oo,{width:I.width,height:I.height}):w.network==="gpt"?null:T?e.jsxs("button",{onClick:P,className:"relative w-full h-full cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary",children:[T.imageUrl&&e.jsx("img",{src:T.imageUrl,alt:T.title||"Advertisement",className:"w-full h-full object-cover"}),T.title&&!T.imageUrl&&e.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 bg-muted",children:[e.jsx("p",{className:"font-semibold text-center",children:T.title}),T.description&&e.jsx("p",{className:"text-sm text-muted-foreground text-center mt-1",children:T.description}),T.cta&&e.jsx("span",{className:"mt-2 px-4 py-1 bg-primary text-primary-foreground rounded text-sm",children:T.cta})]})]}):null,F={"top-left":"top-1 left-1","top-right":"top-1 right-1","bottom-left":"bottom-1 left-1","bottom-right":"bottom-1 right-1"};return e.jsxs("div",{ref:b,id:t,className:d.cn("relative overflow-hidden bg-muted/20 border border-border/50 rounded-md",f),style:{width:I.width,height:I.height,maxWidth:"100%"},"data-ad-slot":t,"data-ad-size":s,"data-ad-status":D,children:[R(),u&&D==="loaded"&&e.jsx("div",{className:d.cn("absolute z-10",F[h]),children:e.jsx(Mt,{sponsor:T?.sponsor})})]})}function o$({slotId:t,sticky:s=!0,stickyOffset:a=80,boundarySelector:r,gap:n=16,additionalSlots:l=[],className:o,...c}){const m=J.useRef(null),[u,h]=J.useState(!1),[f,g]=J.useState({});return J.useEffect(()=>{if(!s||!m.current)return;const p=m.current,j=r?document.querySelector(r):null,b=()=>{const w=p.getBoundingClientRect(),y=j?.getBoundingClientRect();if(w.top<=a){if(y&&y.top-p.offsetHeight-n<a){g({position:"absolute",top:j.offsetTop-p.offsetHeight-n,width:w.width}),h(!1);return}h(!0),g({position:"fixed",top:a,width:w.width})}else h(!1),g({})};return window.addEventListener("scroll",b,{passive:!0}),b(),()=>window.removeEventListener("scroll",b)},[s,a,r,n]),e.jsx("div",{ref:m,className:d.cn("relative",o),"data-sticky":u,children:e.jsx("div",{style:f,children:e.jsxs("div",{className:"flex flex-col",style:{gap:n},children:[e.jsx(tr,{slotId:t,size:"skyscraper",...c}),l.map((p,j)=>e.jsx(tr,{slotId:p.slotId,size:"rectangle",adUnitPath:p.adUnitPath,lazyLoad:!0,...c},p.slotId))]})})})}function i$({slotId:t,size:s="responsive",align:a="center",margin:r="md",showSeparators:n=!1,label:l,className:o,...c}){const m={left:"justify-start",center:"justify-center",right:"justify-end"},u={none:"my-0",sm:"my-4",md:"my-8",lg:"my-12"},h=()=>typeof window>"u"?"rectangle":window.innerWidth>=768?"leaderboard":window.innerWidth>=480?"rectangle":"mobile-banner",[f,g]=i.useState("rectangle");i.useEffect(()=>{const j=()=>{g(h())};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const p=s==="responsive"?f:s;return e.jsxs("div",{className:d.cn("w-full",u[r],o),children:[n&&e.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:l||"Advertisement"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),!n&&l&&e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wider mb-2 text-center",children:l}),e.jsx("div",{className:d.cn("flex w-full",m[a]),children:e.jsx(tr,{slotId:t,size:p,...c})}),n&&e.jsx("div",{className:"h-px bg-border mt-3"})]})}function c$({slotId:t,open:s,onClose:a,minDisplayTime:r=5,autoCloseAfter:n=0,adUnitPath:l,showCountdown:o=!0,skipText:c="Skip Ad",className:m,onLoad:u,onClick:h}){const{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),[w,y]=J.useState("loading"),[v,N]=J.useState(null),[k,S]=J.useState(r),[C,M]=J.useState(r===0),[D,A]=J.useState(n);J.useEffect(()=>{if(!s||!g||p===!1)return;(async()=>{y("loading"),S(r),M(r===0),A(n);try{if(f.network==="custom"){const $=await j(t);$?(N($),y("loaded"),b({type:"loaded",slotId:t,timestamp:new Date}),b({type:"impression",slotId:t,timestamp:new Date}),u?.(),$.impressionUrl&&fetch($.impressionUrl,{mode:"no-cors"}).catch(()=>{})):(y("error"),a())}else y("loaded"),u?.()}catch{y("error"),a()}})()},[s,g,p,f.network,t,j,b,r,n,u,a]),J.useEffect(()=>{if(!s||C||k<=0)return;const I=setInterval(()=>{S($=>$<=1?(M(!0),0):$-1)},1e3);return()=>clearInterval(I)},[s,C,k]),J.useEffect(()=>{if(!s||n===0||D<=0)return;const I=setInterval(()=>{A($=>$<=1?(a(),0):$-1)},1e3);return()=>clearInterval(I)},[s,n,D,a]),J.useEffect(()=>{s&&w==="loaded"&&b({type:"viewable",slotId:t,timestamp:new Date})},[s,w,t,b]);const T=J.useCallback(()=>{b({type:"click",slotId:t,timestamp:new Date}),h?.(),v?.clickUrl&&fetch(v.clickUrl,{mode:"no-cors"}).catch(()=>{}),v?.targetUrl&&window.open(v.targetUrl,"_blank","noopener,noreferrer")},[t,v,b,h]),E=J.useCallback(()=>{C&&a()},[C,a]);return J.useEffect(()=>{if(!s)return;const I=$=>{$.key==="Escape"&&C&&a()};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[s,C,a]),J.useEffect(()=>{if(s)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[s]),s?e.jsxs("div",{className:d.cn("fixed inset-0 z-50 flex items-center justify-center","bg-black/80 backdrop-blur-sm",m),role:"dialog","aria-modal":"true","aria-label":"Advertisement",children:[e.jsx("div",{className:"absolute top-4 right-4 z-10",children:C?e.jsxs("button",{onClick:E,className:"flex items-center gap-2 px-4 py-2 bg-white/10 hover:bg-white/20 text-white rounded-full transition-colors",children:[e.jsx("span",{className:"text-sm font-medium",children:c}),e.jsx(x.X,{className:"h-4 w-4"})]}):o?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-white/10 text-white rounded-full",children:[e.jsx("span",{className:"text-sm",children:"Skip in"}),e.jsx("span",{className:"w-6 h-6 flex items-center justify-center bg-white/20 rounded-full text-sm font-bold",children:k})]}):null}),e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Mt,{sponsor:v?.sponsor,variant:"dark",size:"md"})}),n>0&&w==="loaded"&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10",children:e.jsxs("div",{className:"px-4 py-2 bg-white/10 text-white rounded-full text-sm",children:["Closing in ",D,"s"]})}),e.jsx("div",{className:"relative max-w-4xl max-h-[80vh] w-full mx-4",children:w==="loading"?e.jsx(On,{width:800,height:600}):v?e.jsx("button",{onClick:T,className:"relative w-full focus:outline-none focus:ring-2 focus:ring-white/50 rounded-lg overflow-hidden",children:v.videoUrl?e.jsx("video",{src:v.videoUrl,autoPlay:!0,muted:!0,playsInline:!0,className:"w-full max-h-[80vh] object-contain bg-black"}):v.imageUrl?e.jsx("img",{src:v.imageUrl,alt:v.title||"Advertisement",className:"w-full max-h-[80vh] object-contain"}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-96 bg-muted rounded-lg p-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-2",children:v.title}),v.description&&e.jsx("p",{className:"text-muted-foreground mb-4 text-center max-w-md",children:v.description}),v.cta&&e.jsx("span",{className:"px-6 py-3 bg-primary text-primary-foreground rounded-lg font-medium",children:v.cta})]})}):null})]}):null}function d$({slotId:t,dismissable:s=!0,showCloseAfter:a=0,animation:r="slide",safeAreaPadding:n=!0,blur:l=!0,className:o,containerClassName:c,...m}){const[u,h]=J.useState(!0),[f,g]=J.useState(a===0),[p,j]=J.useState(!1);J.useEffect(()=>{if(a>0&&!f){const y=setTimeout(()=>{g(!0)},a*1e3);return()=>clearTimeout(y)}},[a,f]);const b=()=>{!s||!f||(r!=="none"?(j(!0),setTimeout(()=>{h(!1)},300)):h(!1))};if(!u)return null;const w={slide:d.cn("transition-transform duration-300",p?"translate-y-full":"translate-y-0"),fade:d.cn("transition-opacity duration-300",p?"opacity-0":"opacity-100"),none:""};return e.jsx("div",{className:d.cn("fixed bottom-0 left-0 right-0 z-40",l&&"backdrop-blur-sm",n&&"pb-safe",w[r],c),role:"complementary","aria-label":"Advertisement",children:e.jsxs("div",{className:d.cn("relative flex items-center justify-center","bg-background/95 border-t border-border shadow-lg","py-2 px-4",o),children:[s&&e.jsx("button",{onClick:b,disabled:!f,className:d.cn("absolute top-1 right-1 p-1 rounded-full transition-all",f?"bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground cursor-pointer":"bg-muted/50 text-muted-foreground/50 cursor-not-allowed"),"aria-label":"Close advertisement",children:e.jsx(x.X,{className:"h-4 w-4"})}),e.jsx(tr,{slotId:t,size:"mobile-banner",showBadge:!1,...m})]})})}function vp({slotId:t,variant:s="article",adUnitPath:a,showImage:r=!0,showDescription:n=!0,showCta:l=!0,aspectRatio:o="video",className:c,onClick:m,onLoad:u}){const h=J.useRef(null),{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),{isVisible:w}=ba(h),[y,v]=J.useState("loading"),[N,k]=J.useState(null);J.useEffect(()=>{if(!g||!w||p===!1)return;(async()=>{try{const D=await j(t);D?(k(D),v("loaded"),b({type:"loaded",slotId:t,timestamp:new Date}),b({type:"impression",slotId:t,timestamp:new Date}),u?.(),D.impressionUrl&&fetch(D.impressionUrl,{mode:"no-cors"}).catch(()=>{})):v("error")}catch{v("error")}})()},[g,w,p,t,j,b,u]);const S=J.useCallback(()=>{N&&(b({type:"click",slotId:t,timestamp:new Date}),m?.(),N.clickUrl&&fetch(N.clickUrl,{mode:"no-cors"}).catch(()=>{}),N.targetUrl&&window.open(N.targetUrl,"_blank","noopener,noreferrer"))},[N,t,b,m]),C={video:"aspect-video",square:"aspect-square",portrait:"aspect-[3/4]"};return y==="error"||!N?null:y==="loading"?e.jsx("div",{ref:h,className:d.cn("rounded-lg border bg-muted animate-pulse",s==="horizontal"?"h-32":"h-64",c)}):s==="horizontal"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full flex gap-4 p-3 rounded-lg border bg-card hover:bg-accent/50 transition-colors text-left",children:[r&&N.imageUrl&&e.jsx("div",{className:"w-24 h-24 flex-shrink-0 rounded-md overflow-hidden bg-muted",children:e.jsx("img",{src:N.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 group-hover:text-primary transition-colors",children:N.title}),e.jsx(Mt,{sponsor:N.sponsor,size:"sm",showIcon:!1})]}),n&&N.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:N.description}),l&&N.cta&&e.jsxs("span",{className:"text-xs text-primary font-medium inline-flex items-center gap-1",children:[N.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})}):s==="compact"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full p-2 rounded-lg border bg-card hover:bg-accent/50 transition-colors text-left",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx(Mt,{sponsor:N.sponsor,size:"sm",showIcon:!1})}),e.jsx("h3",{className:"font-medium text-sm line-clamp-2 group-hover:text-primary transition-colors",children:N.title})]})}):s==="product"?e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full rounded-lg border bg-card overflow-hidden hover:shadow-md transition-shadow text-left",children:[r&&N.imageUrl&&e.jsxs("div",{className:d.cn("relative bg-muted",C[o]),children:[e.jsx("img",{src:N.imageUrl,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx(Mt,{variant:"subtle",size:"sm",showIcon:!1})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-sm mb-1 group-hover:text-primary transition-colors line-clamp-2",children:N.title}),n&&N.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-3",children:N.description}),l&&N.cta&&e.jsx("span",{className:"inline-flex items-center justify-center w-full px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm font-medium hover:bg-primary/90 transition-colors",children:N.cta})]})]})}):e.jsx("div",{ref:h,className:d.cn("group",c),children:e.jsxs("button",{onClick:S,className:"w-full rounded-lg border bg-card overflow-hidden hover:shadow-md transition-shadow text-left",children:[r&&N.imageUrl&&e.jsxs("div",{className:d.cn("relative bg-muted",C[o]),children:[e.jsx("img",{src:N.imageUrl,alt:"",className:"absolute inset-0 w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(Mt,{variant:"subtle",size:"sm"})})]}),e.jsxs("div",{className:"p-4",children:[!r&&e.jsx("div",{className:"mb-2",children:e.jsx(Mt,{sponsor:N.sponsor,size:"sm"})}),e.jsx("h3",{className:"font-semibold mb-2 group-hover:text-primary transition-colors line-clamp-2",children:N.title}),n&&N.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 mb-3",children:N.description}),l&&N.cta&&e.jsxs("span",{className:"text-sm text-primary font-medium inline-flex items-center gap-1",children:[N.cta,e.jsx(x.ExternalLink,{className:"h-4 w-4"})]})]})]})})}function u$({items:t,renderItem:s,adSlots:a,adFrequency:r=5,adStartPosition:n=2,adVariant:l="article",maxAds:o,columns:c=1,gap:m="md",className:u,keyExtractor:h}){const f={sm:"gap-2",md:"gap-4",lg:"gap-6"},g={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},p=y=>{if(y<n)return null;const v=Math.floor((y-n)/(r+1));return!((y-n)%(r+1)===0)||o!==void 0&&v>=o||v>=a.length?null:a[v]},j=[];let b=0,w=0;for(;b<t.length;){const y=p(w);y?j.push({type:"ad",slot:y}):(j.push({type:"content",item:t[b],index:b}),b++),w++}return e.jsx("div",{className:d.cn("grid",g[c],f[m],u),children:j.map((y,v)=>{if(y.type==="ad")return e.jsx(vp,{slotId:y.slot.slotId,adUnitPath:y.slot.adUnitPath,variant:l},`ad-${y.slot.slotId}`);const N=h?h(y.item,y.index):`item-${y.index}`;return e.jsx("div",{children:s(y.item,y.index)},N)})})}function m$({title:t="You May Also Like",slotIds:s,layout:a="grid",columns:r=3,showArrows:n=!0,autoScroll:l=!1,autoScrollInterval:o=5,className:c,onItemClick:m}){const u=J.useRef(null),h=J.useRef(null),{config:f,isReady:g,hasConsent:p,getCustomAd:j,trackEvent:b}=_t(),{isVisible:w}=ba(u),[y,v]=J.useState(new Map),[N,k]=J.useState(!0),[S,C]=J.useState(0);J.useEffect(()=>{if(!g||!w||p===!1)return;(async()=>{k(!0);const $=new Map;await Promise.all(s.map(async P=>{try{const R=await j(P);R&&($.set(P,R),b({type:"loaded",slotId:P,timestamp:new Date}),R.impressionUrl&&fetch(R.impressionUrl,{mode:"no-cors"}).catch(()=>{}))}catch{}})),v($),k(!1)})()},[g,w,p,s,j,b]),J.useEffect(()=>{w&&y.size>0&&y.forEach((I,$)=>{b({type:"viewable",slotId:$,timestamp:new Date})})},[w,y,b]),J.useEffect(()=>{if(a!=="carousel"||!l||y.size===0)return;const I=setInterval(()=>{C($=>($+1)%y.size)},o*1e3);return()=>clearInterval(I)},[a,l,o,y.size]),J.useEffect(()=>{if(a!=="carousel"||!h.current)return;const I=h.current.offsetWidth/Math.min(r,y.size);h.current.scrollTo({left:S*I,behavior:"smooth"})},[S,a,r,y.size]);const M=(I,$)=>{b({type:"click",slotId:I,timestamp:new Date}),m?.(I),$.clickUrl&&fetch($.clickUrl,{mode:"no-cors"}).catch(()=>{}),$.targetUrl&&window.open($.targetUrl,"_blank","noopener,noreferrer")},D=()=>{C(I=>(I-1+y.size)%y.size)},A=()=>{C(I=>(I+1)%y.size)};if(y.size===0&&!N)return null;const T={2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"},E=(I,$)=>e.jsxs("button",{onClick:()=>M(I,$),className:"group flex-shrink-0 w-full text-left rounded-lg overflow-hidden bg-card border hover:shadow-md transition-shadow",children:[$.imageUrl&&e.jsx("div",{className:"relative aspect-video bg-muted overflow-hidden",children:e.jsx("img",{src:$.imageUrl,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors",children:$.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:$.sponsor||"Sponsored"}),e.jsx(x.ExternalLink,{className:"h-3 w-3 text-muted-foreground"})]})]})]},I);return e.jsxs("div",{ref:u,className:d.cn("relative",c),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:t}),e.jsx(Mt,{size:"sm",showIcon:!1})]}),a==="carousel"&&n&&y.size>r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:D,className:"p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors","aria-label":"Previous",children:e.jsx(x.ChevronLeft,{className:"h-4 w-4"})}),e.jsx("button",{onClick:A,className:"p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors","aria-label":"Next",children:e.jsx(x.ChevronRight,{className:"h-4 w-4"})})]})]}),N?e.jsx("div",{className:d.cn("grid gap-4",T[r]),children:s.slice(0,r).map((I,$)=>e.jsx("div",{className:"rounded-lg border bg-muted animate-pulse aspect-[4/3]"},$))}):a==="grid"?e.jsx("div",{className:d.cn("grid gap-4",T[r]),children:Array.from(y.entries()).map(([I,$])=>E(I,$))}):a==="carousel"?e.jsx("div",{ref:h,className:"flex gap-4 overflow-x-auto scrollbar-hide snap-x snap-mandatory",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:Array.from(y.entries()).map(([I,$])=>e.jsx("div",{className:"snap-start",style:{minWidth:`calc((100% - ${(r-1)*16}px) / ${r})`},children:E(I,$)},I))}):e.jsx("div",{className:"space-y-3",children:Array.from(y.entries()).map(([I,$])=>e.jsxs("button",{onClick:()=>M(I,$),className:"group w-full flex gap-3 p-2 rounded-lg border hover:bg-accent/50 transition-colors text-left",children:[$.imageUrl&&e.jsx("div",{className:"w-20 h-20 flex-shrink-0 rounded-md overflow-hidden bg-muted",children:e.jsx("img",{src:$.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors",children:$.title}),e.jsx("span",{className:"text-xs text-muted-foreground",children:$.sponsor||"Sponsored"})]})]},I))}),a==="carousel"&&y.size>r&&e.jsx("div",{className:"flex justify-center gap-1.5 mt-4",children:Array.from({length:Math.ceil(y.size/r)}).map((I,$)=>e.jsx("button",{onClick:()=>C($*r),className:d.cn("w-2 h-2 rounded-full transition-colors",Math.floor(S/r)===$?"bg-primary":"bg-muted-foreground/30"),"aria-label":`Go to slide ${$+1}`},$))})]})}function x$({slotId:t,width:s=640,height:a=360,aspectRatio:r="16/9",autoplay:n=!0,muted:l=!0,showControls:o=!0,skipAfter:c=5,showProgress:m=!0,ctaPosition:u="bottom",className:h,onComplete:f,onSkip:g,onClick:p}){const j=J.useRef(null),b=J.useRef(null),{config:w,isReady:y,hasConsent:v,getCustomAd:N,trackEvent:k}=_t(),{isVisible:S}=ba(j),[C,M]=J.useState("loading"),[D,A]=J.useState(null),[T,E]=J.useState(!1),[I,$]=J.useState(l),[P,R]=J.useState(0),[F,W]=J.useState(0),[U,G]=J.useState(c===0),[O,_]=J.useState(c),[z,V]=J.useState(!1);J.useEffect(()=>{if(!y||v===!1)return;(async()=>{try{const re=await N(t);re?.videoUrl?(A(re),M("loaded"),k({type:"loaded",slotId:t,timestamp:new Date})):M("error")}catch{M("error")}})()},[y,v,t,N,k]),J.useEffect(()=>{!b.current||!n||C!=="loaded"||(S?b.current.play().catch(()=>{}):b.current.pause())},[S,n,C]),J.useEffect(()=>{T&&D&&(k({type:"impression",slotId:t,timestamp:new Date}),D.impressionUrl&&fetch(D.impressionUrl,{mode:"no-cors"}).catch(()=>{}))},[T,D,t,k]),J.useEffect(()=>{if(!T||U||c===0)return;const ae=setInterval(()=>{_(re=>re<=1?(G(!0),0):re-1)},1e3);return()=>clearInterval(ae)},[T,U,c]);const q=()=>{b.current?.play()},B=()=>{b.current?.pause()},H=()=>{T?B():q()},Y=()=>{b.current&&(b.current.muted=!I,$(!I))},Z=()=>{j.current?.requestFullscreen?.()},X=()=>{if(b.current){const ae=b.current.currentTime,re=b.current.duration;R(ae/re*100),u==="end"&&re-ae<5&&V(!0)}},se=()=>{b.current&&W(b.current.duration)},K=()=>{E(!1),V(!0),k({type:"viewable",slotId:t,timestamp:new Date,data:{completed:!0}}),f?.()},Q=()=>{U&&(b.current?.pause(),V(!0),g?.())},ee=J.useCallback(()=>{D&&(k({type:"click",slotId:t,timestamp:new Date}),p?.(),D.clickUrl&&fetch(D.clickUrl,{mode:"no-cors"}).catch(()=>{}),D.targetUrl&&window.open(D.targetUrl,"_blank","noopener,noreferrer"))},[D,t,k,p]),te=ae=>{const re=Math.floor(ae/60),le=Math.floor(ae%60);return`${re}:${le.toString().padStart(2,"0")}`};return C==="error"?null:C==="loading"?e.jsx("div",{ref:j,children:e.jsx(On,{width:s,height:a})}):e.jsxs("div",{ref:j,className:d.cn("relative overflow-hidden rounded-lg bg-black group",h),style:{width:s,maxWidth:"100%"},children:[e.jsxs("div",{className:d.cn("relative",`aspect-[${r}]`),children:[e.jsx("video",{ref:b,src:D?.videoUrl,muted:I,playsInline:!0,onClick:H,onPlay:()=>E(!0),onPause:()=>E(!1),onTimeUpdate:X,onLoadedMetadata:se,onEnded:K,className:"w-full h-full object-contain cursor-pointer"}),e.jsx("div",{className:"absolute top-2 left-2 z-10",children:e.jsx(Mt,{variant:"dark",size:"sm",sponsor:D?.sponsor})}),c>0&&e.jsx("div",{className:"absolute top-2 right-2 z-10",children:U?e.jsx("button",{onClick:Q,className:"px-3 py-1.5 bg-white/90 text-black text-sm font-medium rounded hover:bg-white transition-colors",children:"Skip Ad"}):e.jsxs("div",{className:"px-3 py-1.5 bg-black/50 text-white text-sm rounded",children:["Skip in ",O,"s"]})}),!T&&e.jsx("button",{onClick:q,className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(x.Play,{className:"h-16 w-16 text-white fill-white"})}),u==="overlay"&&D?.cta&&e.jsxs("button",{onClick:ee,className:"absolute bottom-16 left-1/2 -translate-x-1/2 px-6 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors flex items-center gap-2",children:[D.cta,e.jsx(x.ExternalLink,{className:"h-4 w-4"})]}),z&&u==="end"&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/80 p-6",children:[D?.imageUrl&&e.jsx("img",{src:D.imageUrl,alt:"",className:"w-24 h-24 rounded-lg object-cover mb-4"}),e.jsx("h3",{className:"text-white text-xl font-bold text-center mb-2",children:D?.title}),D?.description&&e.jsx("p",{className:"text-white/80 text-center mb-4 max-w-sm",children:D.description}),e.jsxs("button",{onClick:ee,className:"px-6 py-3 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors flex items-center gap-2",children:[D?.cta||"Learn More",e.jsx(x.ExternalLink,{className:"h-4 w-4"})]})]}),o&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-3 bg-gradient-to-t from-black/80 to-transparent opacity-0 group-hover:opacity-100 transition-opacity",children:[m&&e.jsx("div",{className:"mb-2",children:e.jsx("div",{className:"h-1 bg-white/30 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${P}%`}})})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:H,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:T?e.jsx(x.Pause,{className:"h-5 w-5 text-white"}):e.jsx(x.Play,{className:"h-5 w-5 text-white fill-white"})}),e.jsx("button",{onClick:Y,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:I?e.jsx(x.VolumeX,{className:"h-5 w-5 text-white"}):e.jsx(x.Volume2,{className:"h-5 w-5 text-white"})}),e.jsxs("span",{className:"text-white text-xs",children:[te(P/100*F)," / ",te(F)]})]}),e.jsx("button",{onClick:Z,className:"p-1.5 hover:bg-white/20 rounded transition-colors",children:e.jsx(x.Maximize,{className:"h-5 w-5 text-white"})})]})]})]}),u==="bottom"&&D?.cta&&e.jsxs("button",{onClick:ee,className:"w-full px-4 py-3 bg-muted hover:bg-muted/80 transition-colors flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[D.imageUrl&&e.jsx("img",{src:D.imageUrl,alt:"",className:"w-10 h-10 rounded object-cover"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"font-medium text-sm",children:D.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:D.sponsor})]})]}),e.jsxs("span",{className:"px-4 py-1.5 bg-primary text-primary-foreground rounded text-sm font-medium flex items-center gap-1",children:[D.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})}function h$({slotId:t,collapseOnEnd:s=!0,collapseDuration:a=300,muted:r=!0,showClose:n=!0,closeAfter:l=0,visibilityThreshold:o=.5,className:c,onComplete:m,onClose:u}){const h=J.useRef(null),f=J.useRef(null),{config:g,isReady:p,hasConsent:j,getCustomAd:b,trackEvent:w}=_t(),{isVisible:y}=ba(h,o),[v,N]=J.useState("loading"),[k,S]=J.useState(null),[C,M]=J.useState(r),[D,A]=J.useState(!1),[T,E]=J.useState("auto"),[I,$]=J.useState(!1);J.useEffect(()=>{if(!p||j===!1)return;(async()=>{try{const G=await b(t);G?.videoUrl?(S(G),N("loaded"),w({type:"loaded",slotId:t,timestamp:new Date})):N("collapsed")}catch{N("collapsed")}})()},[p,j,t,b,w]),J.useEffect(()=>{!f.current||v!=="loaded"||(y?f.current.play().then(()=>{I||($(!0),w({type:"impression",slotId:t,timestamp:new Date}),k?.impressionUrl&&fetch(k.impressionUrl,{mode:"no-cors"}).catch(()=>{}))}).catch(()=>{}):f.current.pause())},[y,v,I,t,k,w]),J.useEffect(()=>{if(l===0||!I)return;const U=setTimeout(()=>{P()},l*1e3);return()=>clearTimeout(U)},[l,I]),J.useEffect(()=>{v==="loaded"&&h.current&&E(h.current.offsetHeight)},[v]);const P=()=>{s?(A(!0),E(0),setTimeout(()=>{N("collapsed"),u?.()},a)):(N("collapsed"),u?.())},R=()=>{w({type:"viewable",slotId:t,timestamp:new Date,data:{completed:!0}}),m?.(),P()},F=()=>{f.current&&(f.current.muted=!C,M(!C))},W=()=>{k&&(w({type:"click",slotId:t,timestamp:new Date}),k.clickUrl&&fetch(k.clickUrl,{mode:"no-cors"}).catch(()=>{}),k.targetUrl&&window.open(k.targetUrl,"_blank","noopener,noreferrer"))};return v==="collapsed"||v==="error"?null:v==="loading"?e.jsx("div",{ref:h,className:d.cn("w-full aspect-video bg-muted animate-pulse rounded-lg",c)}):e.jsx("div",{ref:h,className:d.cn("relative w-full overflow-hidden rounded-lg bg-black",D&&"transition-all",c),style:{height:T,transitionDuration:`${a}ms`},children:e.jsxs("div",{className:"relative aspect-video",children:[e.jsx("video",{ref:f,src:k?.videoUrl,muted:C,playsInline:!0,loop:!1,onClick:W,onEnded:R,className:"w-full h-full object-contain cursor-pointer"}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsxs("div",{className:"absolute top-0 left-0 right-0 p-3 flex items-center justify-between bg-gradient-to-b from-black/50 to-transparent pointer-events-auto",children:[e.jsx(Mt,{variant:"dark",size:"sm",sponsor:k?.sponsor}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:F,className:"p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors",children:C?e.jsx(x.VolumeX,{className:"h-4 w-4 text-white"}):e.jsx(x.Volume2,{className:"h-4 w-4 text-white"})}),n&&e.jsx("button",{onClick:P,className:"p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors",children:e.jsx(x.X,{className:"h-4 w-4 text-white"})})]})]}),k?.cta&&e.jsx("div",{className:"absolute bottom-3 left-3 right-3 pointer-events-auto",children:e.jsx("button",{onClick:W,className:"w-full px-4 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors text-center",children:k.cta})})]})]})})}function f$({slotId:t,visible:s=!0,trigger:a="manual",triggerTime:r=0,position:n="bottom",dismissable:l=!0,hideAfter:o=0,className:c,onDismiss:m,onClick:u}){const{config:h,isReady:f,hasConsent:g,getCustomAd:p,trackEvent:j}=_t(),[b,w]=J.useState("loading"),[y,v]=J.useState(null),[N,k]=J.useState(s);J.useEffect(()=>{if(!f||g===!1)return;(async()=>{try{const A=await p(t);A?(v(A),w("loaded"),j({type:"loaded",slotId:t,timestamp:new Date})):w("error")}catch{w("error")}})()},[f,g,t,p,j]),J.useEffect(()=>{N&&b==="loaded"&&y&&(j({type:"impression",slotId:t,timestamp:new Date}),y.impressionUrl&&fetch(y.impressionUrl,{mode:"no-cors"}).catch(()=>{}))},[N,b,y,t,j]),J.useEffect(()=>{k(s)},[s]),J.useEffect(()=>{if(o===0||!N)return;const D=setTimeout(()=>{k(!1),w("hidden"),m?.()},o*1e3);return()=>clearTimeout(D)},[o,N,m]);const S=J.useCallback(()=>{l&&(k(!1),w("hidden"),m?.())},[l,m]),C=J.useCallback(()=>{y&&(j({type:"click",slotId:t,timestamp:new Date}),u?.(),y.clickUrl&&fetch(y.clickUrl,{mode:"no-cors"}).catch(()=>{}),y.targetUrl&&window.open(y.targetUrl,"_blank","noopener,noreferrer"))},[y,t,j,u]);if(b==="error"||b==="hidden"||!N||b==="loading")return null;const M={bottom:"bottom-0 left-0 right-0",top:"top-0 left-0 right-0",corner:"bottom-4 right-4 max-w-sm"};return n==="corner"?e.jsxs("div",{className:d.cn("absolute z-20 rounded-lg overflow-hidden shadow-lg bg-card border animate-in slide-in-from-right",M[n],c),children:[l&&e.jsx("button",{onClick:S,className:"absolute top-2 right-2 p-1 rounded-full bg-black/50 hover:bg-black/70 transition-colors z-10",children:e.jsx(x.X,{className:"h-3 w-3 text-white"})}),e.jsxs("button",{onClick:C,className:"w-full text-left",children:[y?.imageUrl&&e.jsx("div",{className:"aspect-video bg-muted",children:e.jsx("img",{src:y.imageUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-3",children:[e.jsx("div",{className:"flex items-start justify-between gap-2 mb-1",children:e.jsx("p",{className:"font-medium text-sm line-clamp-2",children:y?.title})}),y?.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:y.description}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Mt,{size:"sm",sponsor:y?.sponsor,showIcon:!1}),y?.cta&&e.jsxs("span",{className:"text-xs text-primary font-medium flex items-center gap-1",children:[y.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]})]})]})]})]}):e.jsx("div",{className:d.cn("absolute z-20 bg-gradient-to-t from-black/80 to-black/50 backdrop-blur-sm",n==="top"&&"bg-gradient-to-b",M[n],c),children:e.jsxs("div",{className:"flex items-center gap-4 p-3",children:[y?.imageUrl&&e.jsx("button",{onClick:C,className:"flex-shrink-0",children:e.jsx("img",{src:y.imageUrl,alt:"",className:"w-16 h-16 rounded object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:e.jsx(Mt,{variant:"dark",size:"sm",showIcon:!1})}),e.jsxs("button",{onClick:C,className:"text-left",children:[e.jsx("p",{className:"font-medium text-white text-sm line-clamp-1",children:y?.title}),y?.description&&e.jsx("p",{className:"text-xs text-white/70 line-clamp-1",children:y.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[y?.cta&&e.jsxs("button",{onClick:C,className:"px-4 py-2 bg-primary text-primary-foreground rounded text-sm font-medium hover:bg-primary/90 transition-colors flex items-center gap-1",children:[y.cta,e.jsx(x.ExternalLink,{className:"h-3 w-3"})]}),l&&e.jsx("button",{onClick:S,className:"p-1.5 rounded-full hover:bg-white/20 transition-colors",children:e.jsx(x.X,{className:"h-4 w-4 text-white"})})]})]})})}const yp=i.createContext(void 0);function wp({children:t,languages:s,defaultLanguage:a="fr",s3Config:r,onLanguageChange:n}){const{i18n:l}=zt.useTranslation(),[o,c]=i.useState(a),[m,u]=i.useState(!0),[h,f]=i.useState(new Set),[g,p]=i.useState(!1),j=i.useCallback(async y=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:v,prefix:N="",extension:k="json",headers:S={}}=r,C=`${v.replace(/\/$/,"")}/${N}${y}.${k}`;console.log(`[LanguageProvider] Loading translations from S3: ${C}`);try{const M=await fetch(C,{headers:{Accept:"application/json",...S}});if(!M.ok)throw new Error(`Failed to load translations: ${M.status} ${M.statusText}`);const D=await M.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${y}`),D}catch(M){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${y}:`,M),M}},[r]);i.useEffect(()=>{if(g||!l||!r)return;(async()=>{try{const v=typeof window<"u"?localStorage.getItem("language"):null,N=v&&s.some(S=>S.code===v)?v:a;console.log(`[LanguageProvider] Initializing with language: ${N}`);const k=await j(N);l.addResourceBundle&&l.addResourceBundle(N,"translation",k,!0,!0),await l.changeLanguage(N),c(N),f(new Set([N])),p(!0),console.log(`[LanguageProvider] ✓ Initialized with ${N}`)}catch(v){console.error("[LanguageProvider] Error initializing:",v),p(!0)}finally{u(!1)}})()},[g,l,r,a,s,j]);const b=i.useCallback(async y=>{if(y!==o){if(!l?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}if(!r){console.error("[LanguageProvider] S3 config not provided");return}u(!0);try{if(!h.has(y)){console.log(`[LanguageProvider] Loading ${y} from S3...`);const v=await j(y);l.addResourceBundle&&l.addResourceBundle(y,"translation",v,!0,!0),f(N=>new Set([...N,y]))}await l.changeLanguage(y),c(y),typeof window<"u"&&localStorage.setItem("language",y),n?.(y),console.log(`[LanguageProvider] ✓ Language changed to: ${y}`)}catch(v){throw console.error("[LanguageProvider] ✗ Error changing language:",v),v}finally{u(!1)}}},[o,h,r,j,l,n]),w={currentLanguage:o,languages:s,changeLanguage:b,isLoading:m,loadedLanguages:h};return e.jsx(yp.Provider,{value:w,children:t})}function sc(){const t=i.useContext(yp);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Np=i.createContext(void 0);function g$({children:t,config:s}){const{defaultTheme:a="light",storageKey:r="waka-ui-theme",themes:n,enableSystem:l=!0,s3Config:o}=s||{},[c,m]=i.useState(a),[u,h]=i.useState(),[f,g]=i.useState([]),[p,j]=i.useState(!0),[b,w]=i.useState("fallback");i.useEffect(()=>{(async()=>{if(j(!0),n&&n.length>0){const S=p$(n);g(S),w("config"),j(!1),console.log("[ThemeProvider] Using themes from config:",S.length);return}if(o?.baseUrl)try{const S=await b$(o.baseUrl);if(S.length>0){g(S),w("s3"),j(!1),console.log("[ThemeProvider] Loaded themes from S3:",S.length);return}}catch(S){console.error("[ThemeProvider] Failed to load themes from S3:",S)}g([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),w("fallback"),j(!1),console.log("[ThemeProvider] Using fallback themes")})()},[n,o]),i.useEffect(()=>{if(!l)return;const N=window.matchMedia("(prefers-color-scheme: dark)"),k=S=>{h(S.matches?"dark":"light")};return h(N.matches?"dark":"light"),N.addEventListener("change",k),()=>N.removeEventListener("change",k)},[l]),i.useEffect(()=>{if(f.length===0)return;const N=localStorage.getItem(r),k=f.map(S=>S.id);N&&k.includes(N)&&m(N)},[r,f]),i.useEffect(()=>{if(f.length===0)return;const N=document.documentElement,k=c==="system"&&u?u:c;f.forEach(S=>N.classList.remove(S.id)),N.classList.add(k),N.setAttribute("data-theme",k),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Theme applied: ${k}`)},[c,u,f]);const y=i.useCallback(N=>{const k=f.map(S=>S.id);if(!k.includes(N)&&N!=="system"){console.warn(`[WakaUI] Theme "${N}" is not in the list of available themes:`,k);return}m(N),localStorage.setItem(r,N)},[f,r]),v=i.useMemo(()=>({theme:c,setTheme:y,themes:f,systemTheme:u,isLoadingThemes:p,themesSource:b}),[c,y,f,u,p,b]);return e.jsx(Np.Provider,{value:v,children:t})}function p$(t){return t.length===0?[]:typeof t[0]=="string"?t.map(s=>({id:s,label:j$(s),previewColor:v$(s)})):t}async function b$(t){try{const s=await fetch("/api/themes/list",{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return(await s.json()).themes||[]}catch(s){return console.error("[ThemeProvider] Failed to fetch themes from S3:",s),[]}}function j$(t){return t.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function v$(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function y$(){const t=i.useContext(Np);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function w$({children:t,config:s}){const[a]=i.useState(()=>Yt.createInstance()),[r,n]=i.useState(!1);return i.useEffect(()=>{(async()=>{try{await a.use(zt.initReactI18next).init({lng:s.language.defaultLanguage,fallbackLng:s.language.defaultLanguage,supportedLngs:s.language.supportedLanguages,resources:s.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:s.debug}),s.language.s3Config&&await N$(a,s.language.s3Config,s.language.supportedLanguages),n(!0),s.debug&&console.log("[WakaUI] i18n initialized successfully")}catch(o){console.error("[WakaUI] Failed to initialize i18n:",o),n(!0)}})()},[a,s]),i.useEffect(()=>{if(!r)return;const l=s.language.storageKey||"waka-ui-language",o=localStorage.getItem(l);o&&s.language.supportedLanguages.includes(o)&&a.changeLanguage(o);const c=m=>{localStorage.setItem(l,m),s.debug&&console.log(`[WakaUI] Language changed to: ${m}`)};return a.on("languageChanged",c),()=>{a.off("languageChanged",c)}},[r,a,s]),r?e.jsx(zt.I18nextProvider,{i18n:a,children:e.jsx(wp,{languages:s.language.languages||[],defaultLanguage:s.language.defaultLanguage,s3Config:s.language.s3Config?{baseUrl:s.language.s3Config.bucketUrl,prefix:s.language.s3Config.translationsPath?`${s.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(ox,{themes:s.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:s.theme?.defaultTheme||"default",s3Config:s.theme?.s3Config,enableDarkMode:s.theme?.enableSystem,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function N$(t,s,a){if(!s)return;const{bucketUrl:r,translationsPath:n="translations"}=s;try{await Promise.all(a.map(async l=>{try{const o=`${r}/${n}/${l}.json`,c=await fetch(o);if(!c.ok){console.warn(`[WakaUI] Failed to load translations for ${l} from S3`);return}const m=await c.json();t.addResourceBundle(l,"translation",m,!0,!0),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Loaded translations for ${l} from S3`)}catch(o){console.warn(`[WakaUI] Error loading translations for ${l}:`,o)}}))}catch(l){console.error("[WakaUI] Error loading translations from S3:",l)}}function k$(){const{i18n:t,t:s}=zt.useTranslation(),a=sc(),r=ir();return{currentLanguage:t.language||a.currentLanguage,changeLanguage:async n=>{await a.changeLanguage(n),await t.changeLanguage(n)},languages:a.languages,isLanguageLoading:a.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t:s}}const ac=i.createContext(void 0);function C$({children:t,initialSelection:s,onSelectionChange:a,persistKey:r="admincrumb-selection"}){const[n,l]=i.useState(()=>{if(typeof window<"u"&&r){const p=localStorage.getItem(r);if(p)try{return JSON.parse(p)}catch(j){console.error("Failed to parse stored admincrumb selection",j)}}return s||{}});i.useEffect(()=>{typeof window<"u"&&r&&localStorage.setItem(r,JSON.stringify(n))},[n,r]),i.useEffect(()=>{a?.(n)},[n,a]);const o=i.useCallback(p=>{l({partner:p,network:void 0,customer:void 0})},[]),c=i.useCallback(p=>{l(j=>({...j,network:p,customer:void 0}))},[]),m=i.useCallback(p=>{l(j=>({...j,customer:p}))},[]),u=i.useCallback(()=>{l({})},[]),h=i.useMemo(()=>!!(n.partner||n.network||n.customer),[n]),f=i.useCallback(()=>({...n.partner?.id&&{partnerId:n.partner.id},...n.network?.id&&{networkId:n.network.id},...n.customer?.id&&{customerId:n.customer.id}}),[n]),g=i.useMemo(()=>({selection:n,setPartner:o,setNetwork:c,setCustomer:m,reset:u,isFiltered:h,getFilterQuery:f}),[n,o,c,m,u,h,f]);return e.jsx(ac.Provider,{value:g,children:t})}function S$(){const t=i.useContext(ac);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function M$(){return i.useContext(ac)}const T$={github:x.Github,twitter:x.Twitter,linkedin:x.Linkedin,email:x.Mail};function D$({columns:t=[],socialLinks:s=[],copyright:a="© 2024 Tous droits réservés.",className:r}){return e.jsx("footer",{className:d.cn("bg-muted/40",r),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((n,l)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("ul",{className:"space-y-2",children:n.links.map((o,c)=>e.jsx("li",{children:e.jsx("a",{href:o.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:o.label})},c))})]},l)),s.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:s.map((n,l)=>{const o=T$[n.platform];return e.jsx(L.Button,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":n.platform,children:e.jsx(o,{className:"h-4 w-4"})})},l)})})]})]}),e.jsx(L.Separator,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function $$({items:t,defaultActiveId:s,variant:a="default",size:r="md",className:n,onTabChange:l}){const[o,c]=i.useState(s||t[0]?.id||""),m=f=>{c(f),l?.(f)},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},h={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:d.cn("w-full",n),children:e.jsxs(rs,{value:o,onValueChange:m,children:[e.jsx(Ut,{className:d.cn("grid w-full",a==="pills"&&"grid-cols-auto",a!=="pills"&&`grid-cols-${t.length}`,h[a]),children:t.map(f=>e.jsx(dt,{value:f.id,disabled:f.disabled,className:d.cn(u[r],a==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",a==="pills"&&"rounded-full"),children:f.label},f.id))}),t.map(f=>e.jsx(ut,{value:f.id,className:"mt-6",children:f.content},f.id))]})})}function A$({items:t,separator:s="/",className:a}){return e.jsx("nav",{className:d.cn("flex items-center space-x-1 text-sm text-muted-foreground",a),children:t.map((r,n)=>e.jsxs(i.Fragment,{children:[n>0&&e.jsx("span",{className:"mx-2 text-muted-foreground",children:s}),r.href?e.jsx("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):e.jsx("span",{className:"text-foreground font-medium",children:r.label})]},n))})}function E$({variant:t="dropdown",showFlags:s=!0,className:a}){const{currentLanguage:r,languages:n,changeLanguage:l,isLoading:o}=sc(),c=n.find(m=>m.code===r);return t==="select"?e.jsxs(Ee,{value:r,onValueChange:l,disabled:o,children:[e.jsx($e,{className:d.cn("w-[180px]",a),children:e.jsxs(Re,{children:[s&&c?.flagEmoji&&e.jsx("span",{className:"mr-2",children:c.flagEmoji}),c?.label]})}),e.jsx(Ae,{children:n.map(m=>e.jsxs(xe,{value:m.code,children:[s&&m.flagEmoji&&e.jsx("span",{className:"mr-2",children:m.flagEmoji}),m.label]},m.code))})]}):e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",className:d.cn("gap-2",a),disabled:o,children:[e.jsx(x.Globe,{className:"h-4 w-4"}),s&&c?.flagEmoji&&e.jsx("span",{children:c.flagEmoji}),c?.label]})}),e.jsx(We,{align:"end",children:n.map(m=>e.jsxs(ye,{onClick:()=>l(m.code),className:"cursor-pointer",children:[s&&m.flagEmoji&&e.jsx("span",{className:"mr-2",children:m.flagEmoji}),m.label]},m.code))})]})}function R$({children:t,header:s,sidebar:a,footer:r,collapsible:n=!1,className:l}){const[o,c]=i.useState(!1);return e.jsxs("div",{className:d.cn("min-h-screen bg-background",l),children:[s&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[n&&a&&e.jsxs(nr,{open:o,onOpenChange:c,children:[e.jsx(Eo,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(x.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(ua,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:()=>c(!1),children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a})]})})]}),s]})}),e.jsxs("div",{className:"flex",children:[a&&!n&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:a})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),r&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:r})})]})}function I$({config:t,onSubmit:s,onForgotPassword:a,onSignUp:r,onSSOGoogle:n,onSSOMicrosoft:l,onSSOApple:o,onSSOLinkedIn:c,onSSOGithub:m,onSSOFacebook:u,onSSOInstagram:h,onSSOFranceConnect:f,showSocialLogin:g=!1,className:p}){let j=!1;try{j=ir().isDarkMode}catch{}const b=t?.theme_json?.dark_mode??j,[w,y]=i.useState({email:"",password:"",rememberMe:!1}),[v,N]=i.useState(!1),k=i.useMemo(()=>t?.assets?b?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,b]),S=i.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),C=i.useMemo(()=>{const T=[];if(!t?.signup_options)return g&&(m&&T.push({id:"github",label:"GitHub",icon:e.jsx(x.Github,{className:"h-4 w-4"}),onClick:m}),n&&T.push({id:"google",label:"Google",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:n})),T;const E=t.signup_options;return E.allow_sso_google&&T.push({id:"google",label:"Google",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:n}),E.allow_sso_microsoft&&T.push({id:"microsoft",label:"Microsoft",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:l}),E.allow_sso_apple&&T.push({id:"apple",label:"Apple",icon:e.jsx(x.Apple,{className:"h-4 w-4"}),onClick:o}),E.allow_sso_linkedIn&&T.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(x.Linkedin,{className:"h-4 w-4"}),onClick:c}),E.allow_sso_github&&T.push({id:"github",label:"GitHub",icon:e.jsx(x.Github,{className:"h-4 w-4"}),onClick:m}),E.allow_sso_facebook&&T.push({id:"facebook",label:"Facebook",icon:e.jsx(x.Facebook,{className:"h-4 w-4"}),onClick:u}),E.allow_sso_instagram&&T.push({id:"instagram",label:"Instagram",icon:e.jsx(x.Instagram,{className:"h-4 w-4"}),onClick:h}),E.allow_sso_france_connect&&T.push({id:"france-connect",label:"France Connect",icon:e.jsx(x.Mail,{className:"h-4 w-4"}),onClick:f}),T},[t?.signup_options,g,n,l,o,c,m,u,h,f]),M=t?.signup_options?.allow_login!==!1,D=async T=>{T.preventDefault(),N(!0);try{await s?.(w)}finally{N(!1)}},A=T=>E=>{y(I=>({...I,[T]:T==="rememberMe"?E.target.checked:E.target.value}))};return e.jsx("div",{className:d.cn("flex items-center justify-center p-4",p),style:S,children:e.jsxs(me,{className:"w-full max-w-md",children:[e.jsxs(we,{className:"space-y-1",children:[k&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:k,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Ne,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(Ze,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(fe,{className:"space-y-4",children:[C.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d.cn("grid gap-4",C.length===1?"grid-cols-1":"grid-cols-2"),children:C.map(T=>e.jsxs(L.Button,{variant:"outline",className:"w-full",onClick:T.onClick,type:"button",children:[T.icon,T.label]},T.id))}),M&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(L.Separator,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),M&&e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"email",children:"Email"}),e.jsx(L.Input,{id:"email",type:"email",placeholder:"votre@email.com",value:w.email,onChange:A("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"password",children:"Mot de passe"}),e.jsx(L.Input,{id:"password",type:"password",placeholder:"••••••••",value:w.password,onChange:A("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:w.rememberMe,onChange:A("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(L.Label,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),a&&e.jsx(L.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:a,children:"Mot de passe oublié ?"})]}),e.jsx(L.Button,{type:"submit",className:"w-full",disabled:v,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:v?"Connexion...":"Se connecter"})]}),r&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(L.Button,{type:"button",variant:"link",className:"px-0 text-sm",onClick:r,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const kp=i.createContext(null);function P$(){const t=i.useContext(kp);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function L$({config:t}){const s=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:s}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:s}):e.jsx("div",{children:s})}function Cp({item:t,isChild:s=!1,renderItem:a}){const{activeId:r,setActiveId:n,expandedIds:l,toggleExpanded:o,isMobile:c,closeOnNavigate:m,onClose:u}=P$(),h=t.children&&t.children.length>0,f=l.includes(t.id),g=r===t.id||t.active,p=()=>{t.disabled||(h?o(t.id):(n(t.id),t.onClick?.(),c&&m&&u()))};if(a)return e.jsx(e.Fragment,{children:a(t,s)});const j=e.jsxs("div",{className:d.cn("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&&!h&&"bg-sidebar-active text-sidebar-active-foreground",s&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:d.cn("flex-shrink-0",s?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.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:t.badge}),h&&e.jsx(x.ChevronDown,{className:d.cn("h-4 w-4 transition-transform duration-200",f&&"rotate-180")})]});return h?e.jsxs(um,{open:f,onOpenChange:()=>o(t.id),children:[e.jsx(mm,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:j})}),e.jsx(xm,{className:"space-y-1 pt-1",children:t.children?.map(b=>e.jsx(Cp,{item:b,isChild:!0,renderItem:a},b.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:b=>{if(t.disabled){b.preventDefault();return}p()},className:"block",children:j}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:p,children:j})}function Fu({config:t}){const s=t.initials||t.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase(),a=[{id:"profile",label:"Profil",icon:e.jsx(x.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(x.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(x.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],r=t.actions??a;return e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.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:[e.jsxs(tt,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(st,{src:t.avatarUrl,alt:t.name}),e.jsx(at,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:s})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(x.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(We,{align:"end",className:"w-56",children:r.map((n,l)=>e.jsxs(i.Fragment,{children:[n.variant==="destructive"&&l>0&&e.jsx(Ke,{}),e.jsx(ye,{onClick:n.onClick,className:d.cn(n.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!n.href,children:n.href?e.jsxs("a",{href:n.href,className:"flex items-center gap-2",children:[n.icon,n.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[n.icon,n.label]})})]},n.id))})]})}function F$({logo:t,menu:s,user:a,userPosition:r="bottom",header:n,footer:l,renderItem:o}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(L$,{config:t})}),n&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:n}),a&&r==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx(Fu,{config:a})}),e.jsx(Ie,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:s.map(c=>e.jsx(Cp,{item:c,renderItem:o},c.id))})}),l&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:l}),a&&r==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx(Fu,{config:a})})]})}function Sp({logo:t,menu:s,user:a,width:r=260,mobileBreakpoint:n=768,open:l,onOpenChange:o,className:c,contentClassName:m,backgroundColor:u,textColor:h,activeColor:f,hoverColor:g,userPosition:p="bottom",showHamburger:j=!0,hamburgerPosition:b="left",renderItem:w,footer:y,header:v,position:N="fixed"}){const[k,S]=i.useState(!1),C=l!==void 0,M=C?l:k,D=C?o:S,[A,T]=i.useState(!1);i.useEffect(()=>{const O=()=>{T(window.innerWidth<n)};return O(),window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[n]);const[E,I]=i.useState(()=>{const O=_=>{for(const z of _){if(z.active)return z.id;if(z.children){const V=O(z.children);if(V)return V}}return null};return O(s)}),[$,P]=i.useState(()=>{const O=(_,z=[])=>{for(const V of _){if(V.active)return z;if(V.children){const q=O(V.children,[...z,V.id]);if(q.length>z.length)return q}}return[]};return O(s)}),R=i.useCallback(O=>{P(_=>_.includes(O)?_.filter(z=>z!==O):[..._,O])},[]),F={activeId:E,setActiveId:I,expandedIds:$,toggleExpanded:R,isMobile:A,closeOnNavigate:!0,onClose:()=>D(!1)},W={"--sidebar-bg":u||"hsl(var(--sidebar-background, var(--card)))","--sidebar-text":h||"hsl(var(--sidebar-foreground, var(--muted-foreground)))","--sidebar-active":f||"hsl(var(--sidebar-primary, var(--primary)))","--sidebar-active-foreground":"hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))","--sidebar-hover":g||"hsl(var(--sidebar-accent, var(--accent)))"},U=d.cn("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)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",m),G=e.jsx(kp.Provider,{value:F,children:e.jsx("div",{className:d.cn("h-full",U),style:W,children:e.jsx(F$,{logo:t,menu:s,user:a,userPosition:p,header:v,footer:y,renderItem:w})})});return e.jsxs(e.Fragment,{children:[j&&A&&e.jsxs(L.Button,{variant:"ghost",size:"icon",className:d.cn("fixed top-3 z-50",b==="left"?"left-3":"right-3"),onClick:()=>D(!0),children:[e.jsx(x.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!A&&e.jsx("aside",{className:d.cn(N==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",c),style:{width:r},children:G}),A&&e.jsx(nr,{open:M,onOpenChange:D,children:e.jsxs(ua,{side:"left",className:d.cn("w-[280px] p-0 border-0",c),style:W,"aria-describedby":"sidebar-description",children:[e.jsx(lr,{className:"sr-only",children:"Menu de navigation"}),e.jsx(or,{id:"sidebar-description",className:"sr-only",children:"Menu principal de l'application"}),G]})})]})}function B$(){const[t,s]=i.useState(!1),a=i.useCallback(()=>s(!0),[]),r=i.useCallback(()=>s(!1),[]),n=i.useCallback(()=>s(l=>!l),[]);return{isOpen:t,setIsOpen:s,open:a,close:r,toggle:n}}function z$({sidebar:t,children:s,sidebarWidth:a=260,className:r,contentClassName:n}){const[l,o]=i.useState(!1),c=t.mobileBreakpoint||768;return i.useEffect(()=>{const m=()=>o(window.innerWidth<c);return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[c]),e.jsxs("div",{className:d.cn("min-h-screen bg-background",r),children:[e.jsx(Sp,{...t,width:a}),e.jsx("main",{className:d.cn("min-h-screen transition-all duration-300",n),style:{marginLeft:l?0:a},children:s})]})}function W$({title:t,subtitle:s,showSearch:a=!0,searchPlaceholder:r="Rechercher...",searchValue:n,onSearchChange:l,onSearchSubmit:o,primaryAction:c,secondaryActions:m,filters:u,notifications:h,unreadCount:f=0,onNotificationsClick:g,userMenu:p,leftContent:j,rightContent:b,filterContent:w,className:y,mainBarClassName:v,filterBarClassName:N,sticky:k=!0}){const[S,C]=i.useState(n||""),M=T=>{const E=T.target.value;C(E),l?.(E)},D=T=>{T.key==="Enter"&&o?.(S)},A=u&&u.length>0||w;return e.jsxs("header",{className:d.cn("w-full bg-background border-b",k&&"sticky top-0 z-50",y),children:[e.jsxs("div",{className:d.cn("flex items-center gap-4 px-4 py-2 min-h-[56px]",v),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[c&&e.jsxs(L.Button,{variant:c.variant||"default",size:"sm",onClick:c.onClick,className:"gap-2",children:[c.icon||e.jsx(x.Plus,{className:"h-4 w-4"}),c.label]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{type:"search",placeholder:r,value:S,onChange:M,onKeyDown:D,className:"pl-9 w-[200px] h-9 bg-muted/50"})]}),j]}),(t||s)&&e.jsxs("div",{className:"flex-1 text-center",children:[t&&e.jsx("h1",{className:"text-lg font-semibold leading-none",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[m?.map(T=>e.jsxs(L.Button,{variant:T.variant||"ghost",size:"sm",onClick:T.onClick,className:"gap-2",children:[T.icon,T.label]},T.id)),b,(h||g)&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"icon",className:"relative",onClick:h?void 0:g,children:[e.jsx(x.Bell,{className:"h-5 w-5"}),f>0&&e.jsx(ne,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs",children:f>9?"9+":f})]})}),h&&h.length>0&&e.jsxs(We,{align:"end",className:"w-80",children:[e.jsx("div",{className:"p-2 font-semibold border-b",children:"Notifications"}),h.slice(0,5).map(T=>e.jsxs(ye,{onClick:T.onClick,className:d.cn("flex flex-col items-start gap-1 p-3",!T.read&&"bg-muted/50"),children:[e.jsx("div",{className:"font-medium",children:T.title}),T.description&&e.jsx("div",{className:"text-sm text-muted-foreground",children:T.description}),T.time&&e.jsx("div",{className:"text-xs text-muted-foreground",children:T.time})]},T.id))]})]}),p&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsxs(tt,{className:"h-7 w-7",children:[p.avatar&&e.jsx(st,{src:p.avatar,alt:p.name}),e.jsx(at,{className:"text-xs",children:p.initials||p.name.slice(0,2).toUpperCase()})]}),e.jsx(x.ChevronDown,{className:"h-4 w-4"})]})}),e.jsxs(We,{align:"end",className:"w-56",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-medium",children:p.name}),p.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p.email})]}),e.jsx(Ke,{}),p.items.map((T,E)=>T.separator?e.jsx(Ke,{},E):e.jsxs(ye,{onClick:T.onClick,children:[T.icon&&e.jsx("span",{className:"mr-2",children:T.icon}),T.label]},E))]})]})]})]}),A&&e.jsxs("div",{className:d.cn("flex items-center gap-2 px-4 py-2 border-t bg-muted/30",N),children:[u?.map(T=>e.jsxs(Ee,{value:T.value,onValueChange:T.onChange,children:[e.jsxs($e,{className:"w-auto h-8 gap-2 bg-muted/50 border-0",children:[T.icon,e.jsx(Re,{placeholder:T.placeholder||T.label})]}),e.jsx(Ae,{children:T.options.map(E=>e.jsx(xe,{value:E.value,children:E.label},E.value))})]},T.id)),w]})]})}function O$({title:t="Tableau de bord",description:s,period:a,onPeriodChange:r,periods:n=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"},{value:"year",label:"Cette année"}],onRefresh:l,loading:o,quickActions:c}){return e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",children:[e.jsx(x.Calendar,{className:"mr-2 h-4 w-4"}),n.find(m=>m.value===a)?.label||"Période"]})}),e.jsx(We,{align:"end",children:n.map(m=>e.jsx(ye,{onClick:()=>r(m.value),className:d.cn(a===m.value&&"bg-muted"),children:m.label},m.value))})]}),l&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:l,disabled:o,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",o&&"animate-spin")})}),c?.map(m=>e.jsx(L.Button,{variant:m.variant||"default",size:"sm",onClick:m.onClick,asChild:!!m.href,children:m.href?e.jsxs("a",{href:m.href,children:[m.icon&&e.jsx("span",{className:"mr-2",children:m.icon}),m.label]}):e.jsxs(e.Fragment,{children:[m.icon&&e.jsx("span",{className:"mr-2",children:m.icon}),m.label]})},m.id))]})]})}function U$({stats:t,layout:s="grid",columns:a=4,loading:r}){return e.jsx(Vx,{layout:s,columns:a,gap:"md",children:t.map(n=>e.jsx(_x,{label:n.label,value:n.value,trend:n.trend,trendValue:n.trendValue,trendText:n.trendText,icon:n.icon,color:n.color,variant:"card",loading:r},n.id))})}function _$({config:t}){return e.jsxs(me,{children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(We,{align:"end",children:t.actions.map((s,a)=>e.jsx(ye,{onClick:s.onClick,children:s.label},a))})]})]}),e.jsx(fe,{children:t.chart})]})}function V$({config:t}){return e.jsxs(me,{children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"flex gap-2",children:t.actions.map((s,a)=>e.jsx(L.Button,{variant:"outline",size:"sm",onClick:s.onClick,asChild:!!s.href,children:s.href?e.jsxs("a",{href:s.href,children:[s.label,e.jsx(x.ArrowUpRight,{className:"ml-1 h-3 w-3"})]}):s.label},a))})]}),e.jsx(fe,{children:t.table})]})}function H$({activities:t}){const s=r=>{const n=typeof r=="string"?new Date(r):r,o=new Date().getTime()-n.getTime(),c=Math.floor(o/6e4),m=Math.floor(c/60),u=Math.floor(m/24);return c<1?"À l'instant":c<60?`Il y a ${c} min`:m<24?`Il y a ${m}h`:u<7?`Il y a ${u}j`:n.toLocaleDateString("fr-FR")},a={info:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500"};return e.jsxs(me,{children:[e.jsx(we,{children:e.jsx(Ne,{className:"text-base",children:"Activité récente"})}),e.jsx(fe,{children:e.jsx("div",{className:"space-y-4",children:t.map(r=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:d.cn("h-2 w-2 rounded-full mt-2 flex-shrink-0",a[r.type||"info"])}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r.title}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:s(r.timestamp)})]},r.id))})})]})}function G$({title:t="Tableau de bord",description:s,stats:a,charts:r,tables:n,activities:l,quickActions:o,showHeader:c=!0,onRefresh:m,loading:u=!1,period:h="month",onPeriodChange:f,periods:g,statsLayout:p="grid",statsColumns:j=4,className:b}){return e.jsxs("div",{className:d.cn("space-y-6",b),children:[c&&e.jsx(O$,{title:t,description:s,period:h,onPeriodChange:f,periods:g,onRefresh:m,loading:u,quickActions:o}),a&&a.length>0&&e.jsx(U$,{stats:a,layout:p,columns:j,loading:u}),r&&r.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:r.map(w=>e.jsx(_$,{config:w},w.id))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[n&&n.length>0&&e.jsx("div",{className:d.cn("space-y-6",l?"lg:col-span-2":"lg:col-span-3"),children:n.map(w=>e.jsx(V$,{config:w},w.id))}),l&&l.length>0&&e.jsx("div",{className:d.cn(!n||n.length===0?"lg:col-span-3":""),children:e.jsx(H$,{activities:l})})]})]})}const q$=[{id:"revenue",label:"Revenus",value:"€45,231.89",trend:"up",trendValue:"+20.1%",trendText:"vs mois dernier",icon:e.jsx(x.DollarSign,{className:"h-5 w-5"}),color:"success"},{id:"users",label:"Utilisateurs",value:"2,350",trend:"up",trendValue:"+180",trendText:"cette semaine",icon:e.jsx(x.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:e.jsx(x.ShoppingCart,{className:"h-5 w-5"}),color:"purple"},{id:"performance",label:"Performance",value:"94.2%",trend:"up",trendValue:"+2.4%",icon:e.jsx(x.Activity,{className:"h-5 w-5"}),color:"primary"}];function X$({field:t,value:s,onChange:a}){const r=n=>{a?.(n)};return t.type==="custom"&&t.customComponent?e.jsx("div",{className:"space-y-2",children:t.customComponent}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(L.Label,{htmlFor:t.id,className:"text-sm font-medium",children:[t.label,t.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.type==="switch"&&e.jsx(Us,{id:t.id,checked:s,onCheckedChange:r,disabled:t.disabled})]}),t.description&&t.type!=="switch"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="switch"&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="text"&&e.jsx(L.Input,{id:t.id,type:"text",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="email"&&e.jsx(L.Input,{id:t.id,type:"email",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="password"&&e.jsx(L.Input,{id:t.id,type:"password",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="textarea"&&e.jsx(L.Textarea,{id:t.id,value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled,rows:3}),t.type==="select"&&t.options&&e.jsxs(Ee,{value:s,onValueChange:r,disabled:t.disabled,children:[e.jsx($e,{id:t.id,children:e.jsx(Re,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Ae,{children:t.options.map(n=>e.jsx(xe,{value:n.value,children:n.label},n.value))})]})]})}function Y$({section:t,values:s,onChange:a}){return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]})]})}),e.jsx(fe,{className:"space-y-6",children:t.fields.map((r,n)=>e.jsxs(i.Fragment,{children:[e.jsx(X$,{field:r,value:s?.[r.id],onChange:l=>a?.(r.id,l)}),n<t.fields.length-1&&e.jsx(L.Separator,{className:"my-4"})]},r.id))})]})}function Z$({title:t="Paramètres",description:s="Gérez les paramètres de votre compte et de l'application.",tabs:a,sections:r,useTabs:n=!0,defaultTab:l,values:o={},onChange:c,onSave:m,saving:u=!1,showSaveButton:h=!0,showDeleteAccount:f=!1,onDeleteAccount:g,className:p}){const[j,b]=i.useState(o),[w,y]=i.useState(!1);i.useEffect(()=>{b(o)},[o]);const v=(S,C)=>{b(M=>({...M,[S]:C})),y(!0),c?.(S,C)},N=async()=>{await m?.(j),y(!1)},k=S=>e.jsx("div",{className:"space-y-6",children:S.map(C=>e.jsx(Y$,{section:C,values:j,onChange:v},C.id))});return e.jsxs("div",{className:d.cn("space-y-6",p),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),h&&m&&e.jsxs(L.Button,{onClick:N,disabled:u||!w,children:[u?e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(x.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),n&&a&&a.length>0?e.jsxs(rs,{defaultValue:l||a[0].id,className:"space-y-6",children:[e.jsx(Ut,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:a.map(S=>e.jsxs(dt,{value:S.id,className:"gap-2",children:[S.icon,S.label]},S.id))}),a.map(S=>e.jsx(ut,{value:S.id,className:"space-y-6",children:k(S.sections)},S.id))]}):r&&k(r),f&&g&&e.jsxs(me,{className:"border-destructive",children:[e.jsxs(we,{children:[e.jsxs(Ne,{className:"text-base text-destructive flex items-center gap-2",children:[e.jsx(x.Trash2,{className:"h-4 w-4"}),"Zone dangereuse"]}),e.jsx(Ze,{children:"Actions irréversibles concernant votre compte."})]}),e.jsx(fe,{children:e.jsxs(zs,{children:[e.jsx(tm,{asChild:!0,children:e.jsxs(L.Button,{variant:"destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer mon compte"]})}),e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Êtes-vous sûr ?"}),e.jsx(js,{children:"Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées."})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer définitivement"})]})]})]})})]})]})}const K$=[{id:"profile",label:"Profil",icon:e.jsx(x.User,{className:"h-4 w-4"}),sections:[{id:"personal",title:"Informations personnelles",description:"Mettez à jour vos informations personnelles.",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Shield,{className:"h-4 w-4"}),sections:[{id:"password",title:"Mot de passe",description:"Changez votre mot de passe.",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Palette,{className:"h-4 w-4"}),sections:[{id:"appearance",title:"Apparence",description:"Personnalisez l'apparence de l'application.",icon:e.jsx(x.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 Bu({url:t,name:s,size:a="lg",editable:r,onAvatarChange:n}){const l=i.useRef(null),o={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24",xl:"h-32 w-32"},c=s.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2),m=u=>{const h=u.target.files?.[0];h&&n&&n(h)};return e.jsxs("div",{className:"relative inline-block",children:[e.jsxs(tt,{className:d.cn(o[a],"border-4 border-background shadow-lg"),children:[e.jsx(st,{src:t,alt:s}),e.jsx(at,{className:"text-lg font-medium",children:c})]}),r&&n&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:l,type:"file",accept:"image/*",onChange:m,className:"hidden"}),e.jsx(L.Button,{size:"icon",variant:"secondary",className:"absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md",onClick:()=>l.current?.click(),children:e.jsx(x.Camera,{className:"h-4 w-4"})})]})]})}function Q$({field:t,value:s,onChange:a,isEditing:r}){if(!r)return e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:d.cn(!s&&"text-muted-foreground italic"),children:s||"Non renseigné"})]});const n={id:t.id,value:s||"",onChange:l=>a(l.target.value),placeholder:t.placeholder,disabled:t.disabled};return t.type==="textarea"?e.jsx(L.Textarea,{...n,rows:3}):t.type==="select"&&t.options?e.jsxs(Ee,{value:s,onValueChange:a,disabled:t.disabled,children:[e.jsx($e,{children:e.jsx(Re,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Ae,{children:t.options.map(l=>e.jsx(xe,{value:l.value,children:l.label},l.value))})]}):e.jsx(L.Input,{type:t.type||"text",...n})}function zu({section:t,values:s,onChange:a,isEditing:r}){return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Ne,{className:"text-base",children:t.title}),t.description&&e.jsx(Ze,{children:t.description})]})]})}),e.jsx(fe,{className:"space-y-4",children:t.fields.map((n,l)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(L.Label,{htmlFor:n.id,className:"text-sm font-medium",children:[n.label,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx(Q$,{field:n,value:s[n.id]||"",onChange:o=>a(n.id,o),isEditing:r})]}),l<t.fields.length-1&&r&&e.jsx(L.Separator,{className:"my-4"})]},n.id))})]})}function J$({links:t,isEditing:s}){const a=r=>{switch(r){case"twitter":return e.jsx(x.Twitter,{className:"h-4 w-4"});case"github":return e.jsx(x.Github,{className:"h-4 w-4"});case"linkedin":return e.jsx(x.Linkedin,{className:"h-4 w-4"});case"website":return e.jsx(x.Globe,{className:"h-4 w-4"});default:return e.jsx(x.Link,{className:"h-4 w-4"})}};return s?e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[a(r.type),e.jsx(L.Input,{value:r.url,className:"flex-1",readOnly:!0})]},r.id))}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.map(r=>e.jsxs("a",{href:r.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:[a(r.type),e.jsx("span",{children:r.label||r.type})]},r.id))})}function eA({profile:t,editable:s=!1,isEditing:a,onEditToggle:r,onChange:n,onSave:l,saving:o=!1,onAvatarChange:c,customSections:m,showSocialLinks:u=!0,showStats:h=!1,stats:f,layout:g="card",useTabs:p=!1,className:j}){const[b,w]=i.useState(!1),[y,v]=i.useState(t),N=a??b;i.useEffect(()=>{v(t)},[t]);const k=I=>{r?r(I):w(I),I||v(t)},S=(I,$)=>{v(P=>({...P,[I]:$})),n?.(I,$)},C=async()=>{await l?.(y),k(!1)},M=[{id:"personal",title:"Informations personnelles",icon:e.jsx(x.User,{className:"h-5 w-5"}),fields:[{id:"firstName",label:"Prénom",value:y.firstName||"",type:"text",placeholder:"Jean",icon:e.jsx(x.User,{className:"h-4 w-4"})},{id:"lastName",label:"Nom",value:y.lastName||"",type:"text",placeholder:"Dupont"},{id:"email",label:"Email",value:y.email,type:"email",placeholder:"jean@exemple.com",required:!0,icon:e.jsx(x.Mail,{className:"h-4 w-4"})},{id:"phone",label:"Téléphone",value:y.phone||"",type:"tel",placeholder:"+33 6 12 34 56 78",icon:e.jsx(x.Phone,{className:"h-4 w-4"})},{id:"bio",label:"Bio",value:y.bio||"",type:"textarea",placeholder:"Parlez-nous de vous..."}]},{id:"professional",title:"Informations professionnelles",icon:e.jsx(x.Briefcase,{className:"h-5 w-5"}),fields:[{id:"role",label:"Poste",value:y.role||"",type:"text",placeholder:"Développeur Senior",icon:e.jsx(x.Briefcase,{className:"h-4 w-4"})},{id:"department",label:"Département",value:y.department||"",type:"text",placeholder:"Engineering"},{id:"company",label:"Entreprise",value:y.company||"",type:"text",placeholder:"Acme Inc.",icon:e.jsx(x.Building,{className:"h-4 w-4"})},{id:"location",label:"Localisation",value:y.location||"",type:"text",placeholder:"Paris, France",icon:e.jsx(x.MapPin,{className:"h-4 w-4"})},{id:"website",label:"Site web",value:y.website||"",type:"url",placeholder:"https://exemple.com",icon:e.jsx(x.Globe,{className:"h-4 w-4"})}]}],D=m||M,A={firstName:y.firstName||"",lastName:y.lastName||"",email:y.email,phone:y.phone||"",bio:y.bio||"",role:y.role||"",department:y.department||"",company:y.company||"",location:y.location||"",website:y.website||"",...y.customFields};if(g==="compact")return e.jsxs("div",{className:d.cn("flex items-center gap-4",j),children:[e.jsx(Bu,{url:y.avatarUrl,name:y.displayName,size:"md"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:y.displayName}),y.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:y.role}),y.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:y.email})]})]});const T=()=>e.jsxs("div",{className:"flex flex-col items-center text-center gap-4 md:flex-row md:text-left",children:[e.jsx(Bu,{url:y.avatarUrl,name:y.displayName,size:"xl",editable:s&&N,onAvatarChange:c}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:y.displayName}),y.role&&e.jsx("p",{className:"text-muted-foreground",children:y.role}),y.company&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Building,{className:"h-3 w-3"}),y.company]}),y.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.MapPin,{className:"h-3 w-3"}),y.location]})]}),s&&e.jsx("div",{className:"flex gap-2",children:N?e.jsxs(e.Fragment,{children:[e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:o,children:[e.jsx(x.X,{className:"mr-2 h-4 w-4"}),"Annuler"]}),e.jsxs(L.Button,{size:"sm",onClick:C,disabled:o,children:[o?e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(x.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}):e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[e.jsx(x.Edit3,{className:"mr-2 h-4 w-4"}),"Modifier"]})})]}),h&&f&&f.length>0&&e.jsx("div",{className:"flex gap-6 mt-4",children:f.map((I,$)=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:I.value}),e.jsx("div",{className:"text-xs text-muted-foreground",children:I.label})]},$))}),u&&y.socialLinks&&y.socialLinks.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(J$,{links:y.socialLinks,isEditing:N})}),y.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-1",children:[e.jsx(x.Calendar,{className:"h-3 w-3"}),"Membre depuis"," ",new Date(y.joinedAt).toLocaleDateString("fr-FR",{month:"long",year:"numeric"})]})]})]}),E=()=>e.jsx("div",{className:"space-y-6",children:D.map(I=>e.jsx(zu,{section:I,values:A,onChange:S,isEditing:N},I.id))});return g==="card"?e.jsx(me,{className:j,children:e.jsx(fe,{className:"pt-6",children:e.jsxs("div",{className:"space-y-6",children:[T(),e.jsx(L.Separator,{}),E()]})})}):e.jsxs("div",{className:d.cn("space-y-6",j),children:[T(),p?e.jsxs(rs,{defaultValue:D[0]?.id,className:"space-y-6",children:[e.jsx(Ut,{children:D.map(I=>e.jsxs(dt,{value:I.id,className:"gap-2",children:[I.icon,I.title]},I.id))}),D.map(I=>e.jsx(ut,{value:I.id,children:e.jsx(zu,{section:I,values:A,onChange:S,isEditing:N})},I.id))]}):E()]})}const tA={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"}]},Mp=[{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"}],Un={active:{label:"Actif",color:"bg-green-500",icon:x.CheckCircle},inactive:{label:"Inactif",color:"bg-gray-500",icon:x.XCircle},pending:{label:"En attente",color:"bg-yellow-500",icon:x.Mail},banned:{label:"Banni",color:"bg-red-500",icon:x.Ban}};function sA({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.displayName.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(tt,{className:a[s],children:[e.jsx(st,{src:t.avatarUrl,alt:t.displayName}),e.jsx(at,{className:"text-xs",children:r})]})}function aA({role:t,roles:s=Mp}){const a=s.find(n=>n.value===t),r=t==="admin"?x.ShieldAlert:t==="moderator"?x.ShieldCheck:x.Shield;return e.jsxs(ne,{variant:a?.color,children:[e.jsx(r,{className:"h-3 w-3 mr-1"}),a?.label||t]})}function rA({status:t}){const s=Un[t];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",s.color)}),e.jsx("span",{className:"text-sm",children:s.label})]})}function Wu({open:t,onOpenChange:s,user:a,roles:r,permissions:n,onSubmit:l,loading:o}){const[c,m]=i.useState({email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]});i.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,t]);const u=async f=>{f.preventDefault(),await l(c),s(!1)},h=f=>{m(g=>({...g,permissions:g.permissions?.includes(f)?g.permissions.filter(p=>p!==f):[...g.permissions||[],f]}))};return e.jsx(Jt,{open:t,onOpenChange:s,children:e.jsx(Ot,{className:"sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs(ms,{children:[e.jsx(es,{children:a?"Modifier l'utilisateur":"Créer un utilisateur"}),e.jsx(na,{children:a?"Modifiez les informations de l'utilisateur.":"Remplissez les informations pour créer un nouvel utilisateur."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"firstName",children:"Prénom"}),e.jsx(L.Input,{id:"firstName",value:c.firstName,onChange:f=>m(g=>({...g,firstName:f.target.value})),placeholder:"Jean"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"lastName",children:"Nom"}),e.jsx(L.Input,{id:"lastName",value:c.lastName,onChange:f=>m(g=>({...g,lastName:f.target.value})),placeholder:"Dupont"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"displayName",children:"Nom d'affichage *"}),e.jsx(L.Input,{id:"displayName",value:c.displayName,onChange:f=>m(g=>({...g,displayName:f.target.value})),placeholder:"Jean Dupont",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"email",children:"Email *"}),e.jsx(L.Input,{id:"email",type:"email",value:c.email,onChange:f=>m(g=>({...g,email:f.target.value})),placeholder:"jean@exemple.com",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"role",children:"Rôle"}),e.jsxs(Ee,{value:c.role,onValueChange:f=>m(g=>({...g,role:f})),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsx(Ae,{children:r.map(f=>e.jsx(xe,{value:f.value,children:f.label},f.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{htmlFor:"status",children:"Statut"}),e.jsxs(Ee,{value:c.status,onValueChange:f=>m(g=>({...g,status:f})),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsx(Ae,{children:Object.entries(Un).map(([f,g])=>e.jsx(xe,{value:f,children:g.label},f))})]})]})]}),n&&n.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Permissions"}),e.jsx("div",{className:"border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto",children:n.map(f=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xt,{id:f.id,checked:c.permissions?.includes(f.id),onCheckedChange:()=>h(f.id)}),e.jsx("label",{htmlFor:f.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:f.name})]},f.id))})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Annuler"}),e.jsxs(L.Button,{type:"submit",disabled:o,children:[o&&e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Enregistrer":"Créer"]})]})]})})})}function nA({user:t,onEdit:s,onDelete:a,onResetPassword:r,onStatusChange:n,onRoleChange:l,roles:o}){return e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[s&&e.jsxs(ye,{onClick:s,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),r&&e.jsxs(ye,{onClick:r,children:[e.jsx(x.Key,{className:"mr-2 h-4 w-4"}),"Réinitialiser le mot de passe"]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsx(Ls,{children:"Changer le rôle"}),o.map(c=>e.jsx(ye,{onClick:()=>l(c.value),disabled:t.role===c.value,children:c.label},c.value))]}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsx(Ls,{children:"Changer le statut"}),Object.entries(Un).map(([c,m])=>e.jsx(ye,{onClick:()=>n(c),disabled:t.status===c,children:m.label},c))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:a,className:"text-destructive focus:text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})}function lA({users:t,roles:s=Mp,permissions:a,selectedUsers:r=[],onSelectionChange:n,onCreate:l,onEdit:o,onDelete:c,onBulkDelete:m,onRoleChange:u,onStatusChange:h,onResetPassword:f,onExport:g,onRefresh:p,loading:j=!1,actionLoading:b=!1,searchQuery:w="",onSearchChange:y,roleFilter:v="all",onRoleFilterChange:N,statusFilter:k="all",onStatusFilterChange:S,showBulkActions:C=!0,showCreateButton:M=!0,title:D="Gestion des utilisateurs",description:A="Gérez les utilisateurs, leurs rôles et permissions.",className:T}){const[E,I]=i.useState(!1),[$,P]=i.useState(null),[R,F]=i.useState(null),[W,U]=i.useState(!1),G=i.useMemo(()=>t.filter(Y=>{if(w){const Z=w.toLowerCase();if(!(Y.displayName.toLowerCase().includes(Z)||Y.email.toLowerCase().includes(Z)))return!1}return!(v!=="all"&&Y.role!==v||k!=="all"&&Y.status!==k)}),[t,w,v,k]),O=Y=>{n?.(Y?G.map(Z=>Z.id):[])},_=(Y,Z)=>{n?.(Z?[...r,Y]:r.filter(X=>X!==Y))},z=async Y=>{await l?.(Y)},V=async Y=>{$&&(await o?.($.id,Y),P(null))},q=async()=>{R&&(await c?.(R.id),F(null))},B=async()=>{await m?.(r),n?.([]),U(!1)},H=Y=>(typeof Y=="string"?new Date(Y):Y).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{className:d.cn("space-y-6",T),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-6 w-6"}),D]}),A&&e.jsx("p",{className:"text-muted-foreground mt-1",children:A})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:p,disabled:j,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",j&&"animate-spin")})}),g&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Exporter"]}),M&&l&&e.jsxs(L.Button,{size:"sm",onClick:()=>I(!0),children:[e.jsx(x.UserPlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})]}),e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[y&&e.jsxs("div",{className:"relative flex-1",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher un utilisateur...",value:w,onChange:Y=>y(Y.target.value),className:"pl-9"})]}),N&&e.jsxs(Ee,{value:v,onValueChange:Y=>N(Y),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(Re,{placeholder:"Rôle"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Tous les rôles"}),s.map(Y=>e.jsx(xe,{value:Y.value,children:Y.label},Y.value))]})]}),S&&e.jsxs(Ee,{value:k,onValueChange:Y=>S(Y),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(Re,{placeholder:"Statut"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Tous les statuts"}),Object.entries(Un).map(([Y,Z])=>e.jsx(xe,{value:Y,children:Z.label},Y))]})]})]}),C&&r.length>0&&e.jsxs("div",{className:"flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.length," utilisateur(s) sélectionné(s)"]}),m&&e.jsxs(L.Button,{variant:"destructive",size:"sm",onClick:()=>U(!0),children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]}),e.jsx(L.Button,{variant:"outline",size:"sm",onClick:()=>n?.([]),children:"Désélectionner"})]})]})}),e.jsx(me,{children:e.jsx(fe,{className:"p-0",children:e.jsxs(yn,{children:[e.jsx(wn,{children:e.jsxs(us,{children:[n&&e.jsx(jt,{className:"w-[50px]",children:e.jsx(xt,{checked:G.length>0&&r.length===G.length,onCheckedChange:O})}),e.jsx(jt,{children:"Utilisateur"}),e.jsx(jt,{children:"Rôle"}),e.jsx(jt,{children:"Statut"}),e.jsx(jt,{children:"Inscrit le"}),e.jsx(jt,{children:"Dernière connexion"}),e.jsx(jt,{className:"w-[50px]"})]})}),e.jsx(Nn,{children:j?e.jsx(us,{children:e.jsx(ft,{colSpan:n?7:6,className:"text-center py-8",children:e.jsx(x.Loader2,{className:"h-6 w-6 animate-spin mx-auto"})})}):G.length===0?e.jsx(us,{children:e.jsx(ft,{colSpan:n?7:6,className:"text-center py-8 text-muted-foreground",children:"Aucun utilisateur trouvé"})}):G.map(Y=>e.jsxs(us,{children:[n&&e.jsx(ft,{children:e.jsx(xt,{checked:r.includes(Y.id),onCheckedChange:Z=>_(Y.id,Z)})}),e.jsx(ft,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(sA,{user:Y}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Y.displayName}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Y.email})]})]})}),e.jsx(ft,{children:e.jsx(aA,{role:Y.role,roles:s})}),e.jsx(ft,{children:e.jsx(rA,{status:Y.status})}),e.jsx(ft,{className:"text-muted-foreground",children:H(Y.createdAt)}),e.jsx(ft,{className:"text-muted-foreground",children:Y.lastLogin?H(Y.lastLogin):"-"}),e.jsx(ft,{children:e.jsx(nA,{user:Y,roles:s,onEdit:o?()=>P(Y):void 0,onDelete:c?()=>F(Y):void 0,onResetPassword:f?()=>f(Y.id):void 0,onRoleChange:u?Z=>u(Y.id,Z):void 0,onStatusChange:h?Z=>h(Y.id,Z):void 0})})]},Y.id))})]})})}),e.jsx(Wu,{open:E,onOpenChange:I,roles:s,permissions:a,onSubmit:z,loading:b}),e.jsx(Wu,{open:!!$,onOpenChange:Y=>!Y&&P(null),user:$||void 0,roles:s,permissions:a,onSubmit:V,loading:b}),e.jsx(zs,{open:!!R,onOpenChange:Y=>!Y&&F(null),children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer l'utilisateur ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",R?.displayName," ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})}),e.jsx(zs,{open:W,onOpenChange:U,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer les utilisateurs ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",r.length," utilisateur(s) ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:B,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const oA=[{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")}],iA=[{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"}],Tp={created:{icon:x.Plus,color:"text-green-500",label:"créé"},updated:{icon:x.Edit,color:"text-blue-500",label:"modifié"},deleted:{icon:x.Trash2,color:"text-red-500",label:"supprimé"},commented:{icon:x.MessageSquare,color:"text-purple-500",label:"commenté"},uploaded:{icon:x.Upload,color:"text-cyan-500",label:"uploadé"},downloaded:{icon:x.Download,color:"text-gray-500",label:"téléchargé"},shared:{icon:x.User,color:"text-orange-500",label:"partagé"},approved:{icon:x.Check,color:"text-green-500",label:"approuvé"},rejected:{icon:x.X,color:"text-red-500",label:"rejeté"},mentioned:{icon:x.Bell,color:"text-yellow-500",label:"mentionné"},assigned:{icon:x.User,color:"text-indigo-500",label:"assigné"},completed:{icon:x.Check,color:"text-green-500",label:"terminé"},custom:{icon:x.AlertCircle,color:"text-gray-500",label:""}};function Ou({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(tt,{className:a[s],children:[e.jsx(st,{src:t.avatar,alt:t.name}),e.jsx(at,{className:"text-xs",children:r})]})}function Uu({type:t,customIcon:s,customColor:a}){const r=Tp[t],n=r.icon;return e.jsx("div",{className:d.cn("flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm",a||r.color),children:s||e.jsx(n,{className:"h-4 w-4"})})}function cA({activity:t,showAvatar:s,relativeTime:a,layout:r,isLast:n}){const l=c=>{const m=typeof c=="string"?new Date(c):c;if(a){const h=new Date().getTime()-m.getTime(),f=Math.floor(h/6e4),g=Math.floor(f/60),p=Math.floor(g/24);if(f<1)return"À l'instant";if(f<60)return`Il y a ${f} min`;if(g<24)return`Il y a ${g}h`;if(p<7)return`Il y a ${p}j`}return m.toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},o=Tp[t.type];return r==="compact"?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(Uu,{type:t.type,customIcon:t.icon,customColor:t.color}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"text-sm truncate",children:[e.jsx("span",{className:"font-medium",children:t.user.name})," ",e.jsx("span",{className:"text-muted-foreground",children:t.title})]})}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:l(t.timestamp)})]}):r==="feed"?e.jsx(me,{className:"mb-4",children:e.jsx(fe,{className:"pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[s&&e.jsx(Ou,{user:t.user,size:"md"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx(ne,{variant:"secondary",className:"text-xs",children:o.label||t.type}),e.jsx("span",{className:"text-xs text-muted-foreground",children:l(t.timestamp)})]}),e.jsx("p",{className:"text-sm",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment})]})]})})}):e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(Uu,{type:t.type,customIcon:t.icon,customColor:t.color}),!n&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-2"})]}),e.jsx("div",{className:"flex-1 pb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s&&e.jsx(Ou,{user:t.user}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx("span",{className:"text-muted-foreground",children:t.title})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment}),e.jsx("span",{className:"text-xs text-muted-foreground mt-2 block",children:l(t.timestamp)})]})]})})]})}function dA({activities:t,title:s="Activité",showSearch:a=!0,showFilters:r=!0,filters:n=[],activeFilter:l,onFilterChange:o,showRefresh:c=!0,onRefresh:m,loading:u=!1,groupByDay:h=!0,showLoadMore:f=!1,onLoadMore:g,loadingMore:p=!1,showAvatars:j=!0,relativeTime:b=!0,layout:w="timeline",className:y}){const[v,N]=i.useState(""),[k,S]=i.useState(null),C=l??k,M=E=>{o?o(E):S(E)},D=i.useMemo(()=>{let E=t;if(v){const I=v.toLowerCase();E=E.filter($=>$.title.toLowerCase().includes(I)||$.user.name.toLowerCase().includes(I)||$.description?.toLowerCase().includes(I))}if(C){const I=n.find($=>$.id===C);I&&(E=E.filter($=>I.types.includes($.type)))}return E},[t,v,C,n]),A=i.useMemo(()=>{if(!h)return null;const E={};return D.forEach(I=>{const P=(typeof I.timestamp=="string"?new Date(I.timestamp):I.timestamp).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"});E[P]||(E[P]=[]),E[P].push(I)}),E},[D,h]),T=E=>e.jsx("div",{children:E.map((I,$)=>e.jsx(cA,{activity:I,showAvatar:j,relativeTime:b,layout:w,isLast:$===E.length-1},I.id))});return e.jsxs("div",{className:d.cn("space-y-4",y),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:s}),e.jsx("div",{className:"flex items-center gap-2",children:c&&m&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:m,disabled:u,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",u&&"animate-spin")})})})]}),(a||r)&&e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:v,onChange:E=>N(E.target.value),className:"pl-9"})]}),r&&n.length>0&&e.jsxs(Ee,{value:C||"all",onValueChange:E=>M(E==="all"?null:E),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(x.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{placeholder:"Filtrer"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"Toutes les activités"}),n.map(E=>e.jsx(xe,{value:E.id,children:E.label},E.id))]})]})]}),u?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(x.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):D.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(x.Clock,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune activité"})]}):h&&A?e.jsx("div",{className:"space-y-6",children:Object.entries(A).map(([E,I])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-4 capitalize",children:E}),T(I)]},E))}):T(D),f&&g&&e.jsx("div",{className:"flex justify-center pt-4",children:e.jsxs(L.Button,{variant:"outline",onClick:g,disabled:p,children:[p?e.jsx(x.RefreshCw,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(x.ChevronDown,{className:"h-4 w-4 mr-2"}),"Charger plus"]})})]})}const uA=[{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"]}],mA=[{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)}],rc={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 xA(t,s){const a=[],r=new Date(t,s+1,0);for(let n=1;n<=r.getDate();n++)a.push(new Date(t,s,n));return a}function io(t,s){return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function hA(t,s){return t.filter(a=>{const r=typeof a.start=="string"?new Date(a.start):a.start,n=typeof a.end=="string"?new Date(a.end):a.end;return a.allDay?io(r,s)||s>=r&&s<=n:io(r,s)})}function fA({currentDate:t,viewMode:s,onPrevious:a,onNext:r,onToday:n,onViewModeChange:l,onAddClick:o,showViewSelector:c,showAddButton:m,locale:u}){const h=()=>{switch(s){case"month":return t.toLocaleDateString(u,{month:"long",year:"numeric"});case"week":return`Semaine du ${t.toLocaleDateString(u,{day:"numeric",month:"long"})}`;case"day":return t.toLocaleDateString(u,{weekday:"long",day:"numeric",month:"long",year:"numeric"});case"agenda":return"Agenda";default:return""}};return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L.Button,{variant:"outline",size:"icon",onClick:a,children:e.jsx(x.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"outline",size:"icon",onClick:r,children:e.jsx(x.ChevronRight,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"outline",size:"sm",onClick:n,children:"Aujourd'hui"}),e.jsx("h2",{className:"text-xl font-semibold ml-4 capitalize",children:h()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&l&&e.jsxs(Ee,{value:s,onValueChange:f=>l(f),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"month",children:"Mois"}),e.jsx(xe,{value:"week",children:"Semaine"}),e.jsx(xe,{value:"day",children:"Jour"}),e.jsx(xe,{value:"agenda",children:"Agenda"})]})]}),m&&o&&e.jsxs(L.Button,{onClick:o,children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Événement"]})]})]})}function gA({event:t,onClick:s,compact:a=!1}){const r=rc[t.color||"blue"],n=typeof t.start=="string"?new Date(t.start):t.start;return e.jsxs("button",{onClick:l=>{l.stopPropagation(),s?.()},className:d.cn("w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2",r.bg,r.text,r.border),children:[!t.allDay&&!a&&e.jsx("span",{className:"font-medium mr-1",children:n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}),t.title]})}function pA({event:t,onEdit:s,onDelete:a}){const r=typeof t.start=="string"?new Date(t.start):t.start,n=typeof t.end=="string"?new Date(t.end):t.end,l=rc[t.color||"blue"];return e.jsxs("div",{className:"w-72",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:d.cn("w-3 h-3 rounded-full mt-1",l.bg.replace("100","500"))}),e.jsxs("div",{className:"flex gap-1",children:[s&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:e.jsx(x.Edit,{className:"h-3 w-3"})}),a&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,children:e.jsx(x.Trash2,{className:"h-3 w-3"})})]})]}),e.jsx("h4",{className:"font-semibold mt-2",children:t.title}),e.jsxs("div",{className:"space-y-2 mt-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Clock,{className:"h-4 w-4"}),t.allDay?e.jsx("span",{children:"Toute la journée"}):e.jsxs("span",{children:[r.toLocaleString("fr-FR",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})," - ",n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),t.location&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-4 w-4"}),e.jsx("span",{children:t.location})]}),t.attendees&&t.attendees.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-4 w-4"}),e.jsxs("span",{children:[t.attendees.length," participant(s)"]})]})]}),t.description&&e.jsx("p",{className:"mt-3 text-sm",children:t.description})]})}function bA({currentDate:t,events:s,weekStartsOn:a,locale:r,onDayClick:n,onEventClick:l,onEventEdit:o,onEventDelete:c}){const m=t.getFullYear(),u=t.getMonth(),h=xA(m,u),f=new Date,g=Array.from({length:7},(w,y)=>new Date(2024,0,a+y).toLocaleDateString(r,{weekday:"short"})),j=(new Date(m,u,1).getDay()-a+7)%7,b=[];for(let w=0;w<j;w++)b.push(null);for(b.push(...h);b.length%7!==0;)b.push(null);return e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 bg-muted",children:g.map(w=>e.jsx("div",{className:"p-2 text-center text-sm font-medium capitalize",children:w},w))}),e.jsx("div",{className:"grid grid-cols-7",children:b.map((w,y)=>{const v=w?hA(s,w):[],N=w&&io(w,f),k=w&&w.getMonth()===u;return e.jsx("div",{className:d.cn("min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50",!k&&"bg-muted/30 text-muted-foreground"),onClick:()=>w&&n?.(w),children:w&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d.cn("text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full",N&&"bg-primary text-primary-foreground"),children:w.getDate()}),e.jsxs("div",{className:"space-y-1",children:[v.slice(0,3).map(S=>e.jsxs(L.Popover,{children:[e.jsx(L.PopoverTrigger,{asChild:!0,children:e.jsx("div",{children:e.jsx(gA,{event:S,onClick:()=>l?.(S),compact:!0})})}),e.jsx(L.PopoverContent,{children:e.jsx(pA,{event:S,onEdit:()=>o?.(S.id,{}),onDelete:()=>c?.(S.id)})})]},S.id)),v.length>3&&e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground",children:["+",v.length-3," autres"]})]})]})},y)})})]})}function jA({currentDate:t,events:s,locale:a,onEventClick:r}){const n=s.filter(o=>{const c=typeof o.start=="string"?new Date(o.start):o.start,m=new Date(t);return m.setDate(m.getDate()+30),c>=t&&c<=m}).sort((o,c)=>{const m=typeof o.start=="string"?new Date(o.start):o.start,u=typeof c.start=="string"?new Date(c.start):c.start;return m.getTime()-u.getTime()}),l={};return n.forEach(o=>{const m=(typeof o.start=="string"?new Date(o.start):o.start).toDateString();l[m]||(l[m]=[]),l[m].push(o)}),e.jsxs("div",{className:"space-y-4",children:[Object.entries(l).map(([o,c])=>{const m=new Date(o);return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2 capitalize",children:m.toLocaleDateString(a,{weekday:"long",day:"numeric",month:"long"})}),e.jsx("div",{className:"space-y-2",children:c.map(u=>{const h=rc[u.color||"blue"],f=typeof u.start=="string"?new Date(u.start):u.start,g=typeof u.end=="string"?new Date(u.end):u.end;return e.jsx(me,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>r?.(u),children:e.jsxs(fe,{className:"p-3 flex gap-3",children:[e.jsx("div",{className:d.cn("w-1 rounded-full",h.bg.replace("100","500"))}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium",children:u.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u.allDay?"Toute la journée":`${f.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})} - ${g.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}`}),u.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(x.MapPin,{className:"h-3 w-3"}),u.location]})]})]})},u.id)})})]},o)}),Object.keys(l).length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun événement à venir"})]})}function vA({events:t,currentDate:s,onDateChange:a,viewMode:r,onViewModeChange:n,onEventClick:l,onEventCreate:o,onEventEdit:c,onEventDelete:m,onDayClick:u,showHeader:h=!0,showViewSelector:f=!0,showAddButton:g=!0,weekStartsOn:p=1,locale:j="fr-FR",className:b}){const[w,y]=i.useState(new Date),[v,N]=i.useState("month"),[k,S]=i.useState(!1),C=s??w,M=r??v,D=$=>{a?a($):y($)},A=$=>{n?n($):N($)},T=()=>{const $=new Date(C);switch(M){case"month":$.setMonth($.getMonth()-1);break;case"week":$.setDate($.getDate()-7);break;case"day":$.setDate($.getDate()-1);break}D($)},E=()=>{const $=new Date(C);switch(M){case"month":$.setMonth($.getMonth()+1);break;case"week":$.setDate($.getDate()+7);break;case"day":$.setDate($.getDate()+1);break}D($)},I=()=>{D(new Date)};return e.jsxs("div",{className:d.cn("space-y-4",b),children:[h&&e.jsx(fA,{currentDate:C,viewMode:M,onPrevious:T,onNext:E,onToday:I,onViewModeChange:A,onAddClick:()=>S(!0),showViewSelector:f,showAddButton:g,locale:j}),M==="month"&&e.jsx(bA,{currentDate:C,events:t,weekStartsOn:p,locale:j,onDayClick:u,onEventClick:l,onEventEdit:c,onEventDelete:m}),M==="agenda"&&e.jsx(jA,{currentDate:C,events:t,locale:j,onEventClick:l}),(M==="week"||M==="day")&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:["Vue ",M==="week"?"semaine":"jour"," - À implémenter"]})]})}const yA=[{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}],Dp="waka-chat-widget-position",co=t=>{if(typeof window>"u")return null;try{const s=localStorage.getItem(t);if(s)return JSON.parse(s)}catch{}return null},$p=(t,s)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,JSON.stringify(s))}catch{}};function wA({defaultPosition:t,position:s,onPositionChange:a,persistPosition:r=!0,positionStorageKey:n=Dp,defaultOpen:l=!1,open:o,onOpenChange:c,bubbleSize:m="md",bubbleColor:u="primary",bubbleIcon:h,bubbleText:f,showUnreadBadge:g=!0,bubbleAnimation:p="none",widgetPosition:j="top-left",widgetSize:b="md",bubbleClassName:w,widgetClassName:y,draggable:v=!0,constrainToViewport:N=!0,edgeOffset:k=16,onWidgetClose:S,onWidgetMinimize:C,zIndex:M=9999,conversations:D=[],...A}){const[T,E]=i.useState(l),[I,$]=i.useState(()=>{if(t)return t;if(r){const te=co(n);if(te)return te}return{x:typeof window<"u"?window.innerWidth-80:0,y:typeof window<"u"?window.innerHeight-80:0}}),[P,R]=i.useState(!1),[F,W]=i.useState({x:0,y:0}),U=i.useRef(null),G=o!==void 0?o:T,O=s!==void 0?s:I;i.useEffect(()=>{if(!(typeof window>"u")&&!s&&!t){const te=r?co(n):null;$(te||{x:window.innerWidth-80,y:window.innerHeight-80})}},[s,t,r,n]);const _=te=>{o===void 0&&E(te),c?.(te)},z=te=>{s===void 0&&$(te),a?.(te),r&&$p(n,te)},V=te=>{if(!N||typeof window>"u")return te;const ae=U.current?.offsetWidth||60,re=U.current?.offsetHeight||60;return{x:Math.max(k,Math.min(te.x,window.innerWidth-ae-k)),y:Math.max(k,Math.min(te.y,window.innerHeight-re-k))}},q=te=>{!v||G||(R(!0),W({x:te.clientX-O.x,y:te.clientY-O.y}))},B=te=>{if(!v||G)return;const ae=te.touches[0];R(!0),W({x:ae.clientX-O.x,y:ae.clientY-O.y})};i.useEffect(()=>{if(!P)return;const te=le=>{const de=V({x:le.clientX-F.x,y:le.clientY-F.y});z(de)},ae=le=>{const de=le.touches[0],oe=V({x:de.clientX-F.x,y:de.clientY-F.y});z(oe)},re=()=>{R(!1)};return document.addEventListener("mousemove",te),document.addEventListener("mouseup",re),document.addEventListener("touchmove",ae),document.addEventListener("touchend",re),()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",re),document.removeEventListener("touchmove",ae),document.removeEventListener("touchend",re)}},[P,F]);const H=()=>{P||_(!G)},Y=D.reduce((te,ae)=>te+(ae.unreadCount||0),0),Z={sm:"h-12 w-12",md:"h-14 w-14",lg:"h-16 w-16"},X={sm:"h-5 w-5",md:"h-6 w-6",lg:"h-7 w-7"},se={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"},K={none:"",pulse:"animate-pulse",bounce:"animate-bounce"},Q={sm:"h-[400px] w-[300px]",md:"h-[500px] w-[380px]",lg:"h-[600px] w-[420px]"},ee=()=>{const te=U.current?.offsetWidth||60,ae=U.current?.offsetHeight||60,re=Q[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),le=re?parseInt(re[1]):500,de=re?parseInt(re[2]):380;let oe=O.x,he=O.y;switch(j){case"top-left":oe=O.x-de+te,he=O.y-le-12;break;case"top-right":he=O.y-le-12;break;case"bottom-left":oe=O.x-de+te,he=O.y+ae+12;break;case"bottom-right":he=O.y+ae+12;break}return typeof window<"u"&&(oe=Math.max(k,Math.min(oe,window.innerWidth-de-k)),he=Math.max(k,Math.min(he,window.innerHeight-le-k))),{position:"fixed",left:oe,top:he,zIndex:M+1}};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:U,onClick:H,onMouseDown:q,onTouchStart:B,className:d.cn("fixed rounded-full shadow-lg transition-all duration-200","flex items-center justify-center gap-2",Z[m],se[u],K[p],P&&"cursor-grabbing scale-110",v&&!P&&!G&&"cursor-grab",G&&"opacity-0 pointer-events-none scale-75",f&&"px-4 w-auto",w),style:{left:O.x,top:O.y,zIndex:M,touchAction:"none"},"aria-label":"Ouvrir le chat",children:[h||e.jsx(x.MessageCircle,{className:X[m]}),f&&e.jsx("span",{className:"font-medium text-sm",children:f}),g&&Y>0&&e.jsx(ne,{className:d.cn("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:Y>99?"99+":Y})]}),G&&e.jsx("div",{className:d.cn("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",Q[b],y),style:ee(),children:e.jsx(Ap,{...A,conversations:D,layout:"widget",onClose:()=>{_(!1),S?.()},onMinimize:()=>{_(!1),C?.()},showCloseButton:!0,className:"h-full"})}),G&&e.jsx("div",{className:"fixed inset-0 bg-black/20 sm:hidden",style:{zIndex:M-1},onClick:()=>_(!1)})]})}function NA(t={}){const{defaultOpen:s=!1,defaultPosition:a,persistPosition:r=!0,positionStorageKey:n=Dp}=t,[l,o]=i.useState(s),[c,m]=i.useState(()=>{if(a)return a;if(typeof window>"u")return{x:0,y:0};if(r){const j=co(n);if(j)return j}return{x:window.innerWidth-80,y:window.innerHeight-80}}),u=()=>o(!0),h=()=>o(!1),f=()=>o(j=>!j),g=j=>{m(j),r&&$p(n,j)};return{isOpen:l,position:c,open:u,close:h,toggle:f,setIsOpen:o,updatePosition:g,resetPosition:()=>{if(typeof window>"u")return;const j=a||{x:window.innerWidth-80,y:window.innerHeight-80};g(j)},widgetProps:{open:l,onOpenChange:o,position:c,onPositionChange:g}}}const kA=t=>{const s=typeof t=="string"?new Date(t):t,a=new Date,r=new Date(a.getFullYear(),a.getMonth(),a.getDate()),n=new Date(r.getTime()-1440*60*1e3),l=new Date(s.getFullYear(),s.getMonth(),s.getDate());return l.getTime()===r.getTime()?"Aujourd'hui":l.getTime()===n.getTime()?"Hier":s.toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long"})},CA=(t,s)=>{const a=typeof t=="string"?new Date(t):t,r=typeof s=="string"?new Date(s):s;return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()&&a.getDate()===r.getDate()},nc=t=>{if(t.initials)return t.initials;const s=t.name.split(" ");return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t.name.substring(0,2).toUpperCase()};function SA({date:t}){return e.jsx("div",{className:"flex items-center justify-center my-4",children:e.jsx("div",{className:"px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full",children:kA(t)})})}function MA({conversations:t,activeId:s,currentUser:a,onSelect:r,onSearch:n}){const[l,o]=i.useState(""),c=f=>f.name?f.name:f.participants.filter(p=>p.id!==a.id).map(p=>p.name).join(", "),m=f=>{if(f.avatar)return{url:f.avatar,fallback:f.name?.charAt(0)||"G"};if(f.isGroup)return{fallback:"G"};const g=f.participants.find(p=>p.id!==a.id);return{url:g?.avatar,fallback:nc(g||{name:"?"})}},u=f=>{if(!f)return"";const g=typeof f=="string"?new Date(f):f,j=new Date().getTime()-g.getTime(),b=Math.floor(j/(1e3*60*60*24));return b===0?g.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):b===1?"Hier":b<7?g.toLocaleDateString("fr-FR",{weekday:"short"}):g.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})},h=t.filter(f=>l?c(f).toLowerCase().includes(l.toLowerCase()):!0);return e.jsxs("div",{className:"flex flex-col h-full border-r",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:l,onChange:f=>{o(f.target.value),n?.(f.target.value)},className:"pl-9"})]})}),e.jsx(Ie,{className:"flex-1",children:h.map(f=>{const g=m(f),p=c(f),j=f.participants.find(b=>b.id!==a.id);return e.jsxs("button",{onClick:()=>r(f),className:d.cn("w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",s===f.id&&"bg-muted"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{children:[e.jsx(st,{src:g.url}),e.jsx(at,{children:g.fallback})]}),j?.status==="online"&&e.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:p}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u(f.lastMessage?.timestamp)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.lastMessage?.content||"Aucun message"}),f.unreadCount&&f.unreadCount>0&&e.jsx(ne,{className:"h-5 min-w-[20px] justify-center",children:f.unreadCount})]})]})]},f.id)})})]})}function TA({conversation:t,currentUser:s,title:a,statusText:r,showStatus:n=!0,showCloseButton:l,onAudioCall:o,onVideoCall:c,onClose:m,onCloseConversation:u,onMinimize:h,layout:f}){const g=t?.participants.find(w=>w.id!==s.id),p=a||t?.name||g?.name||"Messages",j=()=>r||(t?t.isGroup?`${t.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":""),b=f==="floating"||f==="widget";return e.jsxs("div",{className:d.cn("flex items-center justify-between p-3 border-b",b&&"bg-primary text-primary-foreground rounded-t-lg"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t&&e.jsxs(tt,{className:d.cn(b&&"border-2 border-primary-foreground/20"),children:[e.jsx(st,{src:t.avatar||g?.avatar}),e.jsx(at,{className:d.cn(b&&"bg-primary-foreground/20 text-primary-foreground"),children:nc(g||{name:p})})]}),!t&&e.jsx(x.MessageCircle,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:p}),n&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[g?.status==="online"&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",b?"bg-green-400":"bg-green-500")}),g?.status==="offline"&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",b?"bg-gray-400":"bg-gray-500")}),e.jsx("p",{className:d.cn("text-xs",b?"text-primary-foreground/80":"text-muted-foreground"),children:j()})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o&&!b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:o,children:e.jsx(x.Phone,{className:"h-4 w-4"})}),c&&!b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:c,children:e.jsx(x.Video,{className:"h-4 w-4"})}),l&&u&&e.jsxs(L.Button,{variant:b?"ghost":"outline",size:"sm",onClick:u,className:d.cn(b&&"text-primary-foreground hover:bg-primary-foreground/20"),children:[e.jsx(x.Calendar,{className:"h-4 w-4 mr-1.5"}),"Clôturer"]}),h&&b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:h,className:"text-primary-foreground hover:bg-primary-foreground/20",children:e.jsx(x.Minimize2,{className:"h-4 w-4"})}),m&&b&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:m,className:"text-primary-foreground hover:bg-primary-foreground/20",children:e.jsx(x.X,{className:"h-4 w-4"})}),!b&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsx(We,{align:"end",children:e.jsxs(ye,{children:[e.jsx(x.Settings,{className:"mr-2 h-4 w-4"}),"Paramètres"]})})]})]})]})}function DA({message:t,isOwn:s,showStatus:a,showTimestamp:r,onDelete:n,onReply:l}){const o=m=>(typeof m=="string"?new Date(m):m).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}),c=()=>{switch(t.status){case"sending":return e.jsx("div",{className:"h-3 w-3 rounded-full border-2 border-current animate-pulse"});case"sent":return e.jsx(x.Check,{className:"h-3 w-3"});case"delivered":return e.jsx(x.CheckCheck,{className:"h-3 w-3"});case"read":return e.jsx(x.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"error":return e.jsx(x.X,{className:"h-3 w-3 text-red-500"});default:return null}};return e.jsxs("div",{className:d.cn("flex gap-2 group",s?"flex-row-reverse":"flex-row"),children:[!s&&e.jsxs(tt,{className:"h-8 w-8",children:[e.jsx(st,{src:t.sender.avatar}),e.jsx(at,{className:"text-xs",children:nc(t.sender)})]}),e.jsxs("div",{className:d.cn("max-w-[70%]",s&&"items-end"),children:[t.replyTo&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary",children:[e.jsx("span",{className:"font-medium",children:t.replyTo.sender.name}),e.jsx("p",{className:"truncate",children:t.replyTo.content})]}),e.jsxs("div",{className:d.cn("relative rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-tr-sm":"bg-muted rounded-tl-sm"),children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"space-y-2 mb-2",children:t.attachments.map((m,u)=>e.jsx("div",{children:m.type==="image"?e.jsx("img",{src:m.url,alt:m.name,className:"rounded-lg max-w-full"}):e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background/10 rounded",children:[e.jsx(x.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm truncate",children:m.name})]})},u))}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:d.cn("absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",s?"-left-20":"-right-20"),children:[e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l?.(t),children:e.jsx(x.Reply,{className:"h-3 w-3"})}),s&&n&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t.id),children:e.jsx(x.Trash2,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:d.cn("flex items-center gap-1 mt-1 text-xs text-muted-foreground",s&&"justify-end"),children:[r&&e.jsx("span",{children:o(t.timestamp)}),t.isEdited&&e.jsx("span",{children:"(modifié)"}),s&&a&&c()]})]})]})}function $A({onSend:t,replyTo:s,onCancelReply:a,showAttachments:r,showEmoji:n,placeholder:l,sending:o,showHint:c=!0,hintText:m="Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne"}){const[u,h]=i.useState(""),f=i.useRef(null),g=()=>{u.trim()&&!o&&(t(u.trim()),h(""))},p=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),g())};return i.useEffect(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=Math.min(f.current.scrollHeight,120)+"px")},[u]),e.jsxs("div",{className:"border-t p-3",children:[s&&e.jsxs("div",{className:"flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Reply,{className:"h-4 w-4 text-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.sender.name}),e.jsx("p",{className:"text-muted-foreground truncate",children:s.content})]})]}),e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[r&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:e.jsx(x.Paperclip,{className:"h-4 w-4"})}),e.jsx(L.Textarea,{ref:f,value:u,onChange:j=>h(j.target.value),onKeyDown:p,placeholder:l,className:"flex-1 min-h-[40px] max-h-[120px] resize-none",disabled:o,rows:1}),n&&e.jsx(L.Button,{variant:"ghost",size:"icon",className:"flex-shrink-0",children:e.jsx(x.Smile,{className:"h-4 w-4"})}),e.jsx(L.Button,{onClick:g,disabled:!u.trim()||o,size:"icon",className:"flex-shrink-0 rounded-full",children:e.jsx(x.Send,{className:"h-4 w-4"})})]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:m})]})}function Ap({conversations:t=[],activeConversation:s,messages:a,currentUser:r,onSendMessage:n,onConversationSelect:l,onMessageDelete:o,onMessageReply:c,onSearch:m,onAudioCall:u,onVideoCall:h,onClose:f,onCloseConversation:g,onMinimize:p,showConversationList:j=!0,showHeader:b=!0,showMessageStatus:w=!0,showTimestamps:y=!0,showAttachments:v=!0,showEmoji:N=!0,showDateSeparators:k=!0,showInputHint:S=!0,showCloseButton:C=!1,inputPlaceholder:M,inputHintText:D,sending:A=!1,loading:T=!1,layout:E="full",headerTitle:I,showHeaderStatus:$=!0,statusText:P,minimized:R=!1,className:F}){const[W,U]=i.useState(null),G=i.useRef(null);i.useEffect(()=>{G.current?.scrollIntoView({behavior:"smooth"})},[a]);const O=(B,H)=>{n?.(B,H),U(null)},_=B=>{U(B),c?.(B)},z=()=>{if(M)return M;if(s){const B=s.participants.find(H=>H.id!==r.id);if(B)return`Écrire à ${B.name}...`}return"Écrivez votre message..."},V=()=>{const B=[];let H=null;return a.forEach((Y,Z)=>{const X=typeof Y.timestamp=="string"?new Date(Y.timestamp):Y.timestamp;k&&(!H||!CA(H,X))&&(B.push(e.jsx(SA,{date:X},`separator-${Z}`)),H=X),B.push(e.jsx(DA,{message:Y,isOwn:Y.sender.id===r.id,showStatus:w,showTimestamp:y,onDelete:o,onReply:_},Y.id))}),B},q={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"};return(E==="floating"||E==="widget")&&R?e.jsxs("button",{onClick:p,className:d.cn("flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow",F),children:[e.jsx(x.MessageCircle,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium",children:"Messages"}),t.reduce((B,H)=>B+(H.unreadCount||0),0)>0&&e.jsx(ne,{variant:"secondary",className:"bg-white text-primary",children:t.reduce((B,H)=>B+(H.unreadCount||0),0)})]}):e.jsxs("div",{className:d.cn("flex bg-background overflow-hidden",q[E],F),children:[j&&E!=="widget"&&E!=="floating"&&e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsx(MA,{conversations:t,activeId:s?.id,currentUser:r,onSelect:B=>l?.(B),onSearch:m})}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:s||E==="widget"||E==="floating"?e.jsxs(e.Fragment,{children:[b&&e.jsx(TA,{conversation:s,currentUser:r,title:I,statusText:P,showStatus:$,showCloseButton:C,onAudioCall:u,onVideoCall:h,onClose:f,onCloseConversation:g,onMinimize:p,layout:E}),e.jsx(Ie,{className:"flex-1 p-4",children:e.jsxs("div",{className:"space-y-4",children:[T?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):V(),e.jsx("div",{ref:G})]})}),e.jsx($A,{onSend:O,replyTo:W,onCancelReply:()=>U(null),showAttachments:v,showEmoji:N,placeholder:z(),sending:A,showHint:S,hintText:D})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(x.MessageCircle,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})}const Va={id:"current",name:"Moi",status:"online"},AA=[{id:"1",participants:[Va,{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:[Va,{id:"3",name:"Pierre Martin",status:"offline"}],lastMessage:{id:"m2",content:"On se voit demain ?",sender:Va,timestamp:new Date(Date.now()-1e3*60*60),status:"delivered"},unreadCount:2}],EA=[{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:Va,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"}],Ep={"no-data":{title:"Aucune donnée",description:"Il n'y a pas encore de données à afficher.",icon:x.Inbox,actionLabel:"Ajouter",actionIcon:x.Plus},"no-results":{title:"Aucun résultat",description:"Aucun élément ne correspond à votre recherche.",icon:x.Search,actionLabel:"Effacer les filtres",actionIcon:x.Filter},"no-messages":{title:"Aucun message",description:"Votre boîte de réception est vide.",icon:x.MessageSquare,actionLabel:"Nouveau message",actionIcon:x.Plus},"no-files":{title:"Aucun fichier",description:"Vous n'avez pas encore de fichiers.",icon:x.FolderOpen,actionLabel:"Importer un fichier",actionIcon:x.Upload},"no-users":{title:"Aucun utilisateur",description:"Il n'y a pas encore d'utilisateurs.",icon:x.Users,actionLabel:"Inviter des utilisateurs",actionIcon:x.Plus},"no-cart":{title:"Panier vide",description:"Votre panier est vide.",icon:x.ShoppingCart,actionLabel:"Parcourir les produits",actionIcon:x.ArrowRight},"no-notifications":{title:"Aucune notification",description:"Vous êtes à jour !",icon:x.Bell},"no-events":{title:"Aucun événement",description:"Aucun événement prévu.",icon:x.Calendar,actionLabel:"Créer un événement",actionIcon:x.Plus},"no-images":{title:"Aucune image",description:"Vous n'avez pas encore d'images.",icon:x.Image,actionLabel:"Importer des images",actionIcon:x.Upload},"no-bookmarks":{title:"Aucun favori",description:"Vous n'avez pas encore de favoris.",icon:x.Bookmark,actionLabel:"Parcourir",actionIcon:x.ArrowRight},"no-favorites":{title:"Aucun favori",description:"Vous n'avez pas encore aimé de contenu.",icon:x.Heart},error:{title:"Une erreur est survenue",description:"Impossible de charger les données.",icon:x.FileQuestion,actionLabel:"Réessayer",actionIcon:x.RefreshCw},custom:{title:"Aucun élément",description:"Il n'y a rien à afficher.",icon:x.Inbox}};function _u({type:t,size:s,className:a}){const n=Ep[t].icon,o={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"}}}[s];return e.jsxs("div",{className:d.cn("relative flex items-center justify-center",o.container,a),children:[e.jsx("div",{className:d.cn("absolute rounded-full bg-muted/50",o.circles.outer)}),e.jsx("div",{className:d.cn("absolute rounded-full bg-muted",o.circles.inner)}),e.jsx("div",{className:"relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm",children:e.jsx(n,{className:d.cn(o.icon,"text-muted-foreground")})}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10"})]})}function Ys({type:t="no-data",title:s,description:a,icon:r,actions:n,illustration:l,showIllustration:o=!0,size:c="md",layout:m="vertical",centered:u=!0,children:h,className:f}){const g=Ep[t],p=s??g.title,j=a??g.description;g.icon;const 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"}},w=[];if(g.actionLabel&&!n){const v=g.actionIcon;w.push({label:g.actionLabel,variant:"default",icon:v?e.jsx(v,{className:"h-4 w-4"}):void 0})}const y=n||(w.length>0?w:void 0);return m==="horizontal"?e.jsxs("div",{className:d.cn("flex items-center gap-6",b[c].container,u&&"justify-center",f),children:[o&&e.jsx("div",{className:"flex-shrink-0",children:l||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-4",children:r}):e.jsx(_u,{type:t,size:c}))}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:d.cn("font-semibold",b[c].title),children:p}),e.jsx("p",{className:d.cn("text-muted-foreground mt-1",b[c].description),children:j}),h&&e.jsx("div",{className:"mt-4",children:h}),y&&y.length>0&&e.jsx("div",{className:"flex gap-3 mt-4",children:y.map((v,N)=>e.jsx(L.Button,{variant:v.variant||"default",size:"sm",onClick:v.onClick,asChild:!!v.href,children:v.href?e.jsxs("a",{href:v.href,children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]}):e.jsxs(e.Fragment,{children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]})},N))})]})]}):e.jsxs("div",{className:d.cn("flex flex-col items-center",u&&"text-center",b[c].container,f),children:[o&&e.jsx("div",{className:"mb-6",children:l||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-6",children:i.cloneElement(r,{className:d.cn(b[c].icon,"text-muted-foreground")})}):e.jsx(_u,{type:t,size:c}))}),e.jsx("h3",{className:d.cn("font-semibold",b[c].title),children:p}),e.jsx("p",{className:d.cn("text-muted-foreground mt-2 max-w-sm",b[c].description),children:j}),h&&e.jsx("div",{className:"mt-4",children:h}),y&&y.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mt-6 justify-center",children:y.map((v,N)=>e.jsx(L.Button,{variant:v.variant||"default",onClick:v.onClick,asChild:!!v.href,children:v.href?e.jsxs("a",{href:v.href,children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]}):e.jsxs(e.Fragment,{children:[v.icon&&e.jsx("span",{className:"mr-2",children:v.icon}),v.label]})},N))})]})}function RA(t){return e.jsx(Ys,{type:"no-data",...t})}function IA(t){return e.jsx(Ys,{type:"no-results",...t})}function PA(t){return e.jsx(Ys,{type:"no-messages",...t})}function LA(t){return e.jsx(Ys,{type:"no-files",...t})}function FA(t){return e.jsx(Ys,{type:"no-cart",...t})}function BA(t){return e.jsx(Ys,{type:"no-notifications",...t})}function zA(t){return e.jsx(Ys,{type:"error",...t})}const Rp={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:x.FileQuestion},500:{code:"500",title:"Erreur serveur",description:"Une erreur inattendue s'est produite. Notre équipe a été notifiée.",icon:x.ServerCrash},403:{code:"403",title:"Accès refusé",description:"Vous n'avez pas les permissions nécessaires pour accéder à cette page.",icon:x.ShieldX},503:{code:"503",title:"Service indisponible",description:"Le service est temporairement indisponible. Veuillez réessayer plus tard.",icon:x.ServerCrash},offline:{code:"Hors ligne",title:"Vous êtes hors ligne",description:"Vérifiez votre connexion internet et réessayez.",icon:x.Wifi},maintenance:{code:"Maintenance",title:"Maintenance en cours",description:"Nous effectuons une maintenance. Nous serons bientôt de retour.",icon:x.Construction},custom:{code:"",title:"Erreur",description:"Une erreur s'est produite.",icon:x.FileQuestion}};function Vu({type:t,className:s}){const r=Rp[t].icon;return e.jsxs("div",{className:d.cn("relative flex items-center justify-center",s),children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-48 w-48 rounded-full bg-muted/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-32 w-32 rounded-full bg-muted"})}),e.jsx("div",{className:"relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg",children:e.jsx(r,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("div",{className:"absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10"})]})}function ja({type:t="404",code:s,title:a,description:r,actions:n,illustration:l,showCode:o=!0,showIllustration:c=!0,showBackButton:m=!0,onBack:u,showHomeButton:h=!0,homeUrl:f="/",showRefreshButton:g=!1,children:p,layout:j="centered",size:b="md",className:w}){const y=Rp[t],v=s??y.code,N=a??y.title,k=r??y.description,S={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"}},C=[];m&&C.push({label:"Retour",onClick:u||(()=>window.history.back()),variant:"outline",icon:e.jsx(x.ArrowLeft,{className:"h-4 w-4"})}),h&&C.push({label:"Accueil",href:f,variant:"default",icon:e.jsx(x.Home,{className:"h-4 w-4"})}),g&&C.push({label:"Réessayer",onClick:()=>window.location.reload(),variant:"secondary",icon:e.jsx(x.RefreshCw,{className:"h-4 w-4"})});const M=n||C,D=()=>e.jsxs("div",{className:"flex flex-col items-center text-center",children:[c&&e.jsx("div",{className:d.cn("mb-8",S[b].illustration),children:l||e.jsx(Vu,{type:t})}),o&&v&&e.jsx("div",{className:d.cn("font-bold text-muted-foreground/20 mb-4",S[b].code),children:v}),e.jsx("h1",{className:d.cn("font-bold tracking-tight mb-4",S[b].title),children:N}),e.jsx("p",{className:d.cn("text-muted-foreground max-w-md mb-8",S[b].description),children:k}),p&&e.jsx("div",{className:"mb-8",children:p}),M.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:M.map((A,T)=>e.jsx(L.Button,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},T))})]});return j==="split"?e.jsxs("div",{className:d.cn("min-h-screen flex flex-col lg:flex-row",w),children:[e.jsx("div",{className:"flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16",children:e.jsx("div",{className:S[b].illustration,children:l||e.jsx(Vu,{type:t})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 lg:p-16",children:e.jsxs("div",{className:"max-w-md",children:[o&&v&&e.jsx("div",{className:d.cn("font-bold text-primary mb-4",b==="sm"?"text-4xl":b==="md"?"text-5xl":"text-6xl"),children:v}),e.jsx("h1",{className:d.cn("font-bold tracking-tight mb-4",S[b].title),children:N}),e.jsx("p",{className:d.cn("text-muted-foreground mb-8",S[b].description),children:k}),p&&e.jsx("div",{className:"mb-8",children:p}),M.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:M.map((A,T)=>e.jsx(L.Button,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},T))})]})})]}):e.jsx("div",{className:d.cn("min-h-screen flex items-center justify-center",S[b].container,w),children:D()})}function WA(t){return e.jsx(ja,{type:"404",...t})}function OA(t){return e.jsx(ja,{type:"500",showRefreshButton:!0,...t})}function UA(t){return e.jsx(ja,{type:"403",...t})}function _A(t){return e.jsx(ja,{type:"maintenance",showBackButton:!1,showHomeButton:!1,...t})}function VA(t){return e.jsx(ja,{type:"offline",showRefreshButton:!0,...t})}function HA({value:t,onChange:s,placeholder:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{type:"text",placeholder:a,value:t,onChange:r=>s(r.target.value),className:"pl-10"})]})}function GA({categories:t,activeCategory:s,onCategoryChange:a,itemCounts:r}){return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(null),className:d.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===null?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:["Tous",e.jsx(ne,{variant:"secondary",className:"ml-1",children:Object.values(r).reduce((n,l)=>n+l,0)})]}),t.map(n=>e.jsxs("button",{type:"button",onClick:()=>a(n.id),className:d.cn("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===n.id?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[n.icon,n.name,e.jsx(ne,{variant:"secondary",className:"ml-1",children:r[n.id]||0})]},n.id))]})}function qA({itemId:t,helpful:s=0,notHelpful:a=0,onFeedback:r}){const[n,l]=i.useState(null),o=c=>{n===null&&(l(c),r(t,c))};return e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Cette réponse vous a-t-elle aidé ?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>o(!0),disabled:n!==null,className:d.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!0?"bg-green-100 text-green-700":n===null?"hover:bg-muted":"opacity-50"),children:["👍 ",s+(n===!0?1:0)]}),e.jsxs("button",{type:"button",onClick:()=>o(!1),disabled:n!==null,className:d.cn("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!1?"bg-red-100 text-red-700":n===null?"hover:bg-muted":"opacity-50"),children:["👎 ",a+(n===!1?1:0)]})]})]})}function XA({items:t,categories:s=[],title:a="Questions fréquentes",description:r,showSearch:n=!0,searchPlaceholder:l="Rechercher une question...",showCategoryFilter:o=!0,activeCategory:c,onCategoryChange:m,allowMultiple:u=!1,defaultOpen:h=[],showFeedback:f=!1,onFeedback:g,layout:p="default",size:j="md",className:b}){const[w,y]=i.useState(""),[v,N]=i.useState(null),k=c??v,S=I=>{m?m(I):N(I)},C=i.useMemo(()=>t.filter(I=>{if(w){const $=w.toLowerCase();if(!(I.question.toLowerCase().includes($)||typeof I.answer=="string"&&I.answer.toLowerCase().includes($)||I.tags?.some(R=>R.toLowerCase().includes($))))return!1}return!(k&&I.category!==k)}),[t,w,k]),M=i.useMemo(()=>{const I={};return t.forEach($=>{$.category&&(I[$.category]=(I[$.category]||0)+1)}),I},[t]),D=i.useMemo(()=>{if(p!=="grouped")return null;const I={};return C.forEach($=>{const P=$.category||"other";I[P]||(I[P]=[]),I[P].push($)}),I},[C,p]),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"}},T=I=>e.jsx(e.Fragment,{children:I.map($=>e.jsxs(bo,{value:$.id,className:d.cn(p==="cards"&&"border rounded-lg px-4 bg-card"),children:[e.jsx(jo,{className:d.cn("hover:no-underline",A[j].question),children:e.jsx("span",{className:"text-left",children:$.question})}),e.jsxs(vo,{children:[e.jsx("div",{className:d.cn("text-muted-foreground",A[j].answer),children:typeof $.answer=="string"?e.jsx("p",{children:$.answer}):$.answer}),$.tags&&$.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:$.tags.map(P=>e.jsx(ne,{variant:"outline",className:"text-xs",children:P},P))}),f&&g&&e.jsx(qA,{itemId:$.id,helpful:$.helpful,notHelpful:$.notHelpful,onFeedback:g})]})]},$.id))}),E=I=>u?e.jsx(Rl,{type:"multiple",defaultValue:h,className:"space-y-2",children:T(I)}):e.jsx(Rl,{type:"single",defaultValue:h[0],collapsible:!0,className:"space-y-2",children:T(I)});return e.jsxs("div",{className:d.cn("space-y-6",b),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:d.cn("font-bold tracking-tight",A[j].title),children:a}),r&&e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl mx-auto",children:r})]}),n&&e.jsx("div",{className:"max-w-md mx-auto",children:e.jsx(HA,{value:w,onChange:y,placeholder:l})}),o&&s.length>0&&e.jsx("div",{className:"flex justify-center",children:e.jsx(GA,{categories:s,activeCategory:k,onCategoryChange:S,itemCounts:M})}),C.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(x.HelpCircle,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune question ne correspond à votre recherche."})]}):p==="grouped"&&D?e.jsx("div",{className:"space-y-8",children:Object.entries(D).map(([I,$])=>{const P=s.find(R=>R.id===I);return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[P?.icon,P?.name||I]}),E($)]},I)})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:E(C)})]})}const YA=[{id:"general",name:"Général",icon:e.jsx(x.HelpCircle,{className:"h-4 w-4"})},{id:"billing",name:"Facturation",icon:e.jsx(x.MessageCircle,{className:"h-4 w-4"})},{id:"technical",name:"Technique",icon:e.jsx(x.MessageCircle,{className:"h-4 w-4"})}],ZA=[{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"]}],KA={folder:{icon:x.Folder,color:"text-yellow-500"},document:{icon:x.FileText,color:"text-blue-500"},image:{icon:x.FileImage,color:"text-green-500"},video:{icon:x.FileVideo,color:"text-purple-500"},audio:{icon:x.FileAudio,color:"text-pink-500"},archive:{icon:x.FileArchive,color:"text-orange-500"},code:{icon:x.FileCode,color:"text-cyan-500"},other:{icon:x.File,color:"text-gray-500"}};function Hu(t){if(!t)return"-";const s=["B","KB","MB","GB","TB"];let a=0,r=t;for(;r>=1024&&a<s.length-1;)r/=1024,a++;return`${r.toFixed(1)} ${s[a]}`}function QA({breadcrumbs:t,viewMode:s,onViewModeChange:a,onNavigate:r,onCreateFolder:n,onUpload:l,onRefresh:o,showSearch:c,onSearch:m,selectedCount:u,onDeleteSelected:h,onDownloadSelected:f}){const[g,p]=i.useState("");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:o,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})}),l&&e.jsxs(L.Button,{variant:"outline",onClick:l,children:[e.jsx(x.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]}),n&&e.jsxs(L.Button,{variant:"outline",onClick:n,children:[e.jsx(x.FolderPlus,{className:"h-4 w-4 mr-2"}),"Nouveau dossier"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&m&&e.jsxs("div",{className:"relative w-64",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher...",value:g,onChange:j=>{p(j.target.value),m(j.target.value)},className:"pl-9"})]}),e.jsx(L.Button,{variant:s==="grid"?"secondary":"ghost",size:"icon",onClick:()=>a("grid"),children:e.jsx(x.Grid,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:s==="list"?"secondary":"ghost",size:"icon",onClick:()=>a("list"),children:e.jsx(x.List,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx("button",{onClick:()=>r("/"),className:"flex items-center gap-1 hover:text-primary",children:e.jsx(x.Home,{className:"h-4 w-4"})}),t.map((j,b)=>e.jsxs(i.Fragment,{children:[e.jsx(x.ChevronRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>r(j.path),className:d.cn("hover:text-primary",b===t.length-1&&"font-medium"),children:j.name})]},j.id))]}),u>0&&e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[u," élément(s) sélectionné(s)"]}),f&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Télécharger"]}),h&&e.jsxs(L.Button,{variant:"destructive",size:"sm",onClick:h,children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})}function Gu({file:t,viewMode:s,isSelected:a,onSelect:r,onOpen:n,onRename:l,onDelete:o,onDownload:c,onShare:m,onToggleStar:u}){const h=KA[t.type],f=h.icon,g=typeof t.modifiedAt=="string"?new Date(t.modifiedAt):t.modifiedAt,p=()=>{t.type==="folder"&&n()};return s==="grid"?e.jsxs("div",{className:d.cn("relative group p-4 rounded-lg border cursor-pointer transition-colors",a?"bg-primary/10 border-primary":"hover:bg-muted"),onClick:()=>r(!a),onDoubleClick:p,children:[e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(xt,{checked:a,onCheckedChange:j=>r(j),onClick:j=>j.stopPropagation()})}),t.starred&&e.jsx(x.Star,{className:"absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.thumbnail&&t.type==="image"?e.jsx("img",{src:t.thumbnail,alt:t.name,className:"w-16 h-16 object-cover rounded"}):e.jsx(f,{className:d.cn("h-12 w-12",h.color)}),e.jsx("span",{className:"text-sm font-medium text-center line-clamp-2",children:t.name}),t.type!=="folder"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Hu(t.size)})]}),e.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:j=>j.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:n,children:[e.jsx(x.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),l&&e.jsxs(ye,{onClick:l,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(ye,{onClick:c,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),m&&e.jsxs(ye,{onClick:m,children:[e.jsx(x.Share2,{className:"mr-2 h-4 w-4"}),"Partager"]}),u&&e.jsx(ye,{onClick:u,children:t.starred?e.jsxs(e.Fragment,{children:[e.jsx(x.StarOff,{className:"mr-2 h-4 w-4"}),"Retirer des favoris"]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Star,{className:"mr-2 h-4 w-4"}),"Ajouter aux favoris"]})}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:o,className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]}):e.jsxs(us,{className:d.cn("cursor-pointer",a&&"bg-primary/10"),onClick:()=>r(!a),onDoubleClick:p,children:[e.jsx(ft,{className:"w-12",children:e.jsx(xt,{checked:a,onCheckedChange:j=>r(j),onClick:j=>j.stopPropagation()})}),e.jsx(ft,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{className:d.cn("h-5 w-5",h.color)}),e.jsx("span",{className:"font-medium",children:t.name}),t.starred&&e.jsx(x.Star,{className:"h-4 w-4 text-yellow-500 fill-yellow-500"}),t.shared&&e.jsx(ne,{variant:"secondary",className:"text-xs",children:"Partagé"})]})}),e.jsx(ft,{className:"text-muted-foreground",children:Hu(t.size)}),e.jsx(ft,{className:"text-muted-foreground",children:g.toLocaleDateString("fr-FR")}),e.jsx(ft,{children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:j=>j.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:n,children:[e.jsx(x.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),l&&e.jsxs(ye,{onClick:l,children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),c&&t.type!=="folder"&&e.jsxs(ye,{onClick:c,children:[e.jsx(x.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Ke,{}),e.jsxs(ye,{onClick:o,className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]})}function JA({files:t,currentPath:s="/",breadcrumbs:a=[],selectedFiles:r=[],onSelectionChange:n,onNavigate:l,onFileOpen:o,onDownload:c,onDelete:m,onRename:u,onCopy:h,onMove:f,onCreateFolder:g,onUpload:p,onShare:j,onToggleStar:b,onRefresh:w,viewMode:y,onViewModeChange:v,showSearch:N=!0,onSearch:k,showHeader:S=!0,showActions:C=!0,loading:M=!1,className:D}){const[A,T]=i.useState("grid"),[E,I]=i.useState(!1),[$,P]=i.useState(null),[R,F]=i.useState(""),[W,U]=i.useState(!1),[G,O]=i.useState([]),[_,z]=i.useState(!1),[V,q]=i.useState(""),B=y??A,H=ae=>{v?v(ae):T(ae)},Y=(ae,re)=>{n?.(re?[...r,ae]:r.filter(le=>le!==ae))},Z=ae=>{ae.type==="folder"?l?.(ae.path,ae.id):o?.(ae)},X=ae=>{P(ae),F(ae.name),I(!0)},se=()=>{$&&R.trim()&&R!==$.name&&u?.($.id,R.trim()),I(!1),P(null)},K=()=>{O(r),U(!0)},Q=()=>{m?.(G),U(!1),O([]),n?.([])},ee=()=>{V.trim()&&(g?.(V.trim(),s),z(!1),q(""))},te=[...t].sort((ae,re)=>ae.type==="folder"&&re.type!=="folder"?-1:ae.type!=="folder"&&re.type==="folder"?1:ae.name.localeCompare(re.name));return e.jsxs("div",{className:d.cn("space-y-4",D),children:[S&&e.jsx(QA,{breadcrumbs:a,viewMode:B,onViewModeChange:H,onNavigate:ae=>l?.(ae),onCreateFolder:g?()=>z(!0):void 0,onUpload:p?()=>{}:void 0,onRefresh:w,showSearch:N,onSearch:k,selectedCount:r.length,onDeleteSelected:m?K:void 0,onDownloadSelected:c?()=>c(r):void 0}),M?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(x.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):te.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(x.Folder,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"Ce dossier est vide"})]}):B==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4",children:te.map(ae=>e.jsx(Gu,{file:ae,viewMode:"grid",isSelected:r.includes(ae.id),onSelect:re=>Y(ae.id,re),onOpen:()=>Z(ae),onRename:u?()=>X(ae):void 0,onDelete:m?()=>{O([ae.id]),U(!0)}:void 0,onDownload:c?()=>c([ae.id]):void 0,onShare:j?()=>j(ae.id):void 0,onToggleStar:b?()=>b(ae.id):void 0},ae.id))}):e.jsxs(yn,{children:[e.jsx(wn,{children:e.jsxs(us,{children:[e.jsx(jt,{className:"w-12",children:e.jsx(xt,{checked:r.length===t.length&&t.length>0,onCheckedChange:ae=>{n?.(ae?t.map(re=>re.id):[])}})}),e.jsx(jt,{children:"Nom"}),e.jsx(jt,{children:"Taille"}),e.jsx(jt,{children:"Modifié"}),e.jsx(jt,{className:"w-12"})]})}),e.jsx(Nn,{children:te.map(ae=>e.jsx(Gu,{file:ae,viewMode:"list",isSelected:r.includes(ae.id),onSelect:re=>Y(ae.id,re),onOpen:()=>Z(ae),onRename:u?()=>X(ae):void 0,onDelete:m?()=>{O([ae.id]),U(!0)}:void 0,onDownload:c?()=>c([ae.id]):void 0,onShare:j?()=>j(ae.id):void 0,onToggleStar:b?()=>b(ae.id):void 0},ae.id))})]}),e.jsx(Jt,{open:E,onOpenChange:I,children:e.jsxs(Ot,{children:[e.jsx(ms,{children:e.jsx(es,{children:"Renommer"})}),e.jsx(L.Input,{value:R,onChange:ae=>F(ae.target.value),placeholder:"Nouveau nom",onKeyDown:ae=>ae.key==="Enter"&&se()}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>I(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:se,children:"Renommer"})]})]})}),e.jsx(zs,{open:W,onOpenChange:U,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Supprimer ?"}),e.jsxs(js,{children:["Êtes-vous sûr de vouloir supprimer ",G.length," élément(s) ? Cette action est irréversible."]})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Annuler"}),e.jsx(vs,{onClick:Q,children:"Supprimer"})]})]})}),e.jsx(Jt,{open:_,onOpenChange:z,children:e.jsxs(Ot,{children:[e.jsx(ms,{children:e.jsx(es,{children:"Nouveau dossier"})}),e.jsx(L.Input,{value:V,onChange:ae=>q(ae.target.value),placeholder:"Nom du dossier",onKeyDown:ae=>ae.key==="Enter"&&ee()}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>z(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:ee,children:"Créer"})]})]})})]})}const eE=[{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}],tE=[{id:"root",name:"Mes fichiers",path:"/"}],qu={low:{label:"Basse",color:"bg-gray-500",icon:x.Clock},medium:{label:"Moyenne",color:"bg-blue-500",icon:x.Clock},high:{label:"Haute",color:"bg-orange-500",icon:x.AlertCircle},urgent:{label:"Urgente",color:"bg-red-500",icon:x.AlertCircle}};function sE({card:t,columnId:s,showAssignees:a,showLabels:r,showPriority:n,showDueDate:l,draggable:o,onCardClick:c,onCardEdit:m,onCardDelete:u,onDragStart:h}){const f=i.useMemo(()=>t.dueDate?(typeof t.dueDate=="string"?new Date(t.dueDate):t.dueDate)<new Date:!1,[t.dueDate]),g=p=>(typeof p=="string"?new Date(p):p).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return e.jsx(me,{className:d.cn("cursor-pointer hover:shadow-md transition-shadow",o&&"cursor-grab active:cursor-grabbing"),draggable:o,onDragStart:p=>h?.(p,t.id,s),onClick:()=>c?.(t,s),children:e.jsxs(fe,{className:"p-3 space-y-2",children:[r&&t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.labels.map(p=>e.jsx("div",{className:"h-1.5 w-8 rounded-full",style:{backgroundColor:p.color},title:p.name},p.id))}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium leading-tight",children:t.title}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:p=>p.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",children:e.jsx(x.MoreHorizontal,{className:"h-3 w-3"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:p=>{p.stopPropagation(),c?.(t,s)},children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),e.jsx(Ke,{}),e.jsxs(ye,{onClick:p=>{p.stopPropagation(),u?.(t.id,s)},className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n&&t.priority&&e.jsx("div",{className:d.cn("h-2 w-2 rounded-full",qu[t.priority].color),title:qu[t.priority].label}),l&&t.dueDate&&e.jsxs(ne,{variant:f?"destructive":"outline",className:"text-xs px-1.5 py-0",children:[e.jsx(x.Calendar,{className:"h-3 w-3 mr-1"}),g(t.dueDate)]})]}),a&&t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[t.assignees.slice(0,3).map(p=>e.jsxs(tt,{className:"h-5 w-5 border-2 border-background",children:[e.jsx(st,{src:p.avatar}),e.jsx(at,{className:"text-[8px]",children:p.name.charAt(0)})]},p.id)),t.assignees.length>3&&e.jsxs("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background",children:["+",t.assignees.length-3]})]})]})]})})}function aE({column:t,showCardCount:s,showAddCard:a,showAssignees:r,showLabels:n,showPriority:l,showDueDate:o,draggable:c,onCardClick:m,onCardAdd:u,onCardEdit:h,onCardDelete:f,onColumnEdit:g,onColumnDelete:p,onDragStart:j,onDragOver:b,onDrop:w}){const[y,v]=i.useState(!1),[N,k]=i.useState(""),[S,C]=i.useState(!1),[M,D]=i.useState(t.title),A=()=>{N.trim()&&(u?.(t.id,{title:N.trim()}),k(""),v(!1))},T=()=>{M.trim()&&M!==t.title&&g?.(t.id,{title:M.trim()}),C(!1)},E=t.limit&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg",onDragOver:b,onDrop:I=>w?.(I,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:t.color}}),S?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(L.Input,{value:M,onChange:I=>D(I.target.value),className:"h-7 text-sm font-semibold",autoFocus:!0,onBlur:T,onKeyDown:I=>{I.key==="Enter"&&T(),I.key==="Escape"&&C(!1)}})}):e.jsx("h3",{className:"font-semibold text-sm cursor-pointer",onClick:()=>C(!0),children:t.title}),s&&e.jsxs(ne,{variant:"secondary",className:"text-xs",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>C(!0),children:[e.jsx(x.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),e.jsx(Ke,{}),e.jsxs(ye,{onClick:()=>p?.(t.id),className:"text-destructive",children:[e.jsx(x.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto",children:[t.cards.map(I=>e.jsx(sE,{card:I,columnId:t.id,showAssignees:r,showLabels:n,showPriority:l,showDueDate:o,draggable:c,onCardClick:m,onCardEdit:h,onCardDelete:f,onDragStart:j},I.id)),y&&e.jsxs(me,{className:"p-2",children:[e.jsx(L.Textarea,{placeholder:"Titre de la carte...",value:N,onChange:I=>k(I.target.value),className:"min-h-[60px] text-sm",autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L.Button,{size:"sm",onClick:A,children:"Ajouter"}),e.jsx(L.Button,{size:"sm",variant:"ghost",onClick:()=>{v(!1),k("")},children:e.jsx(x.X,{className:"h-4 w-4"})})]})]})]}),a&&!y&&!E&&e.jsx("div",{className:"p-2 border-t",children:e.jsxs(L.Button,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:()=>v(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une carte"]})}),E&&e.jsx("div",{className:"p-2 border-t text-center text-xs text-muted-foreground",children:"Limite atteinte"})]})}function rE({columns:t,onColumnsChange:s,onCardClick:a,onCardAdd:r,onCardEdit:n,onCardDelete:l,onCardMove:o,onColumnAdd:c,onColumnEdit:m,onColumnDelete:u,showAddCard:h=!0,showAddColumn:f=!0,showCardCount:g=!0,showAssignees:p=!0,showLabels:j=!0,showPriority:b=!0,showDueDate:w=!0,draggable:y=!0,availableLabels:v=[],availableAssignees:N=[],className:k}){const[S,C]=i.useState(t),[M,D]=i.useState(null),[A,T]=i.useState(!1),[E,I]=i.useState("");i.useEffect(()=>{C(t)},[t]);const $=(O,_,z)=>{D({cardId:_,columnId:z}),O.dataTransfer.effectAllowed="move"},P=O=>{O.preventDefault(),O.dataTransfer.dropEffect="move"},R=(O,_)=>{if(O.preventDefault(),!M)return;const{cardId:z,columnId:V}=M;if(V===_){D(null);return}if(o)o(z,V,_,0);else{const q=S.map(B=>{if(B.id===V)return{...B,cards:B.cards.filter(H=>H.id!==z)};if(B.id===_){const H=S.find(Y=>Y.id===V)?.cards.find(Y=>Y.id===z);if(H)return{...B,cards:[...B.cards,H]}}return B});C(q),s?.(q)}D(null)},F=(O,_)=>{if(r)r(O,_);else{const z={id:`card-${Date.now()}`,title:_.title||"Nouvelle carte",..._},V=S.map(q=>q.id===O?{...q,cards:[...q.cards,z]}:q);C(V),s?.(V)}},W=(O,_)=>{if(l)l(O,_);else{const z=S.map(V=>V.id===_?{...V,cards:V.cards.filter(q=>q.id!==O)}:V);C(z),s?.(z)}},U=O=>{if(u)u(O);else{const _=S.filter(z=>z.id!==O);C(_),s?.(_)}},G=()=>{if(E.trim()){const O={id:`column-${Date.now()}`,title:E.trim(),cards:[]};if(c)c(O);else{const _=[...S,O];C(_),s?.(_)}I(""),T(!1)}};return e.jsx("div",{className:d.cn("overflow-x-auto",k),children:e.jsxs("div",{className:"flex gap-4 p-4 min-h-[500px]",children:[S.map(O=>e.jsx(aE,{column:O,showCardCount:g,showAddCard:h,showAssignees:p,showLabels:j,showPriority:b,showDueDate:w,draggable:y,onCardClick:a,onCardAdd:F,onCardEdit:n,onCardDelete:W,onColumnEdit:m,onColumnDelete:U,onDragStart:$,onDragOver:P,onDrop:R},O.id)),f&&e.jsx("div",{className:"w-72 flex-shrink-0",children:A?e.jsxs(me,{className:"p-3",children:[e.jsx(L.Input,{placeholder:"Titre de la colonne...",value:E,onChange:O=>I(O.target.value),autoFocus:!0,onKeyDown:O=>{O.key==="Enter"&&G(),O.key==="Escape"&&T(!1)}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L.Button,{size:"sm",onClick:G,children:"Ajouter"}),e.jsx(L.Button,{size:"sm",variant:"ghost",onClick:()=>{T(!1),I("")},children:e.jsx(x.X,{className:"h-4 w-4"})})]})]}):e.jsxs(L.Button,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>T(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})})}const nE=[{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"}]}],lE=[{id:"dev",name:"Dev",color:"#3b82f6"},{id:"design",name:"Design",color:"#8b5cf6"},{id:"bug",name:"Bug",color:"#ef4444"},{id:"feature",name:"Feature",color:"#10b981"}];function oE({logo:t,brandName:s="Brand",navItems:a=[],showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:l,loginHref:o}){const[c,m]=i.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"container flex h-16 items-center justify-between",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-2 font-bold text-xl",children:[t,e.jsx("span",{children:s})]}),e.jsx("div",{className:"hidden md:flex items-center gap-6",children:a.map(u=>e.jsx("a",{href:u.href,className:d.cn("text-sm font-medium transition-colors hover:text-primary",u.isActive?"text-primary":"text-muted-foreground"),children:u.label},u.href))}),e.jsx("div",{className:"hidden md:flex items-center gap-4",children:r&&e.jsx(L.Button,{variant:"default",onClick:l,asChild:!!o,children:o?e.jsx("a",{href:o,children:n}):n})}),e.jsx(L.Button,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>m(!c),children:c?e.jsx(x.X,{className:"h-5 w-5"}):e.jsx(x.Menu,{className:"h-5 w-5"})})]}),c&&e.jsx("div",{className:"md:hidden border-t bg-background p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(u=>e.jsx("a",{href:u.href,className:"text-sm font-medium",onClick:()=>m(!1),children:u.label},u.href)),r&&e.jsx(L.Button,{onClick:l,asChild:!!o,children:o?e.jsx("a",{href:o,children:n}):n})]})})]})}function iE({badge:t,title:s,highlightedTitle:a,description:r,primaryButtonText:n="Commencer",primaryButtonAction:l,primaryButtonHref:o,secondaryButtonText:c,secondaryButtonAction:m,secondaryButtonHref:u,image:h,stats:f}){return e.jsx("section",{className:"container py-24 md:py-32",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-12",children:[e.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[t&&e.jsx(ne,{variant:"secondary",className:"mb-4",children:t}),e.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6",children:[s," ",a&&e.jsx("span",{className:"text-primary",children:a})]}),e.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none",children:r}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8",children:[e.jsx(L.Button,{size:"lg",onClick:l,asChild:!!o,children:o?e.jsxs("a",{href:o,children:[n,e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]})}),c&&e.jsx(L.Button,{size:"lg",variant:"outline",onClick:m,asChild:!!u,children:u?e.jsxs("a",{href:u,children:[e.jsx(x.Play,{className:"mr-2 h-4 w-4"}),c]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Play,{className:"mr-2 h-4 w-4"}),c]})})]}),f&&f.length>0&&e.jsx("div",{className:"flex gap-8 justify-center lg:justify-start",children:f.map((g,p)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold",children:g.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:g.label})]},p))})]}),h&&e.jsx("div",{className:"flex-1 w-full lg:w-auto",children:h})]})})}function cE({title:t="Fonctionnalités",description:s,features:a}){return e.jsxs("section",{className:"container py-24 bg-muted/30",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(r=>e.jsxs(me,{className:"bg-background",children:[e.jsxs(we,{children:[e.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:e.jsx("span",{className:"text-primary",children:r.icon})}),e.jsx(Ne,{className:"text-xl",children:r.title})]}),e.jsx(fe,{children:e.jsx(Ze,{className:"text-base",children:r.description})})]},r.id))})]})}function dE({title:t="Ce que disent nos clients",testimonials:s}){return e.jsxs("section",{className:"container py-24",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight text-center mb-12",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(a=>e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[a.rating&&e.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((r,n)=>e.jsx(x.Star,{className:d.cn("h-4 w-4",n<a.rating?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},n))}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['"',a.content,'"']}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.author,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-primary",children:a.author.charAt(0)})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.author}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.role,a.company&&` @ ${a.company}`]})]})]})]})},a.id))})]})}function uE({title:t,description:s,buttonText:a,buttonAction:r,buttonHref:n,secondaryButtonText:l,secondaryButtonAction:o,variant:c="default"}){const m={default:"bg-muted/50",gradient:"bg-gradient-to-r from-primary/10 via-primary/5 to-background",dark:"bg-foreground text-background"};return e.jsx("section",{className:d.cn("py-24",m[c]),children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[e.jsx("h2",{className:d.cn("text-3xl md:text-4xl font-bold tracking-tight mb-4",c==="dark"&&"text-background"),children:t}),s&&e.jsx("p",{className:d.cn("text-lg mb-8",c==="dark"?"text-background/80":"text-muted-foreground"),children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(L.Button,{size:"lg",variant:c==="dark"?"secondary":"default",onClick:r,asChild:!!n,children:n?e.jsxs("a",{href:n,children:[a,e.jsx(x.ChevronRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a,e.jsx(x.ChevronRight,{className:"ml-2 h-4 w-4"})]})}),l&&e.jsx(L.Button,{size:"lg",variant:"outline",onClick:o,className:c==="dark"?"border-background/20 text-background hover:bg-background/10":"",children:l})]})]})})})}function mE({logo:t,brandName:s="Brand",navItems:a,showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:l,loginHref:o,hero:c,features:m,featuresTitle:u,featuresDescription:h,testimonials:f,testimonialsTitle:g,cta:p,footer:j,className:b}){return e.jsxs("div",{className:d.cn("min-h-screen",b),children:[e.jsx(oE,{logo:t,brandName:s,navItems:a,showLoginButton:r,loginButtonText:n,onLogin:l,loginHref:o}),c&&e.jsx(iE,{...c}),m&&m.length>0&&e.jsx(cE,{title:u,description:h,features:m}),f&&f.length>0&&e.jsx(dE,{title:g,testimonials:f}),p&&e.jsx(uE,{...p}),j]})}const xE=[{label:"Fonctionnalités",href:"#features"},{label:"Tarifs",href:"#pricing"},{label:"Témoignages",href:"#testimonials"},{label:"Contact",href:"#contact"}],hE=[{id:"1",icon:e.jsx(x.Zap,{className:"h-6 w-6"}),title:"Rapide et performant",description:"Optimisé pour la vitesse avec des temps de chargement minimaux."},{id:"2",icon:e.jsx(x.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:e.jsx(x.Users,{className:"h-6 w-6"}),title:"Collaboration",description:"Travaillez en équipe avec des outils de collaboration intégrés."},{id:"4",icon:e.jsx(x.Globe,{className:"h-6 w-6"}),title:"Accessible partout",description:"Accédez à votre espace depuis n'importe quel appareil."}],fE=[{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}],gE={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"}]},pE={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"};function bE({period:t,onChange:s,yearlyDiscount:a}){return e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsx(L.Label,{htmlFor:"billing-toggle",className:d.cn("cursor-pointer transition-colors",t==="monthly"?"text-foreground":"text-muted-foreground"),children:"Mensuel"}),e.jsx(Us,{id:"billing-toggle",checked:t==="yearly",onCheckedChange:r=>s(r?"yearly":"monthly")}),e.jsxs(L.Label,{htmlFor:"billing-toggle",className:d.cn("cursor-pointer transition-colors flex items-center gap-2",t==="yearly"?"text-foreground":"text-muted-foreground"),children:["Annuel",a&&e.jsxs(ne,{variant:"secondary",className:"text-xs",children:["-",a]})]})]})}function jE({plan:t,billingPeriod:s}){const a=s==="yearly"&&t.priceYearly!==void 0?t.priceYearly:t.price,r=s==="yearly"&&t.periodYearly?t.periodYearly:t.period||"/mois",n=typeof a=="string";return e.jsxs(me,{className:d.cn("relative flex flex-col",t.popular&&"border-primary shadow-lg scale-105"),children:[t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsxs(ne,{className:"px-3",children:[e.jsx(x.Zap,{className:"h-3 w-3 mr-1"}),t.badge||"Populaire"]})}),e.jsxs(we,{className:"text-center pb-2",children:[e.jsx(Ne,{className:"text-xl",children:t.name}),t.description&&e.jsx(Ze,{children:t.description})]}),e.jsxs(fe,{className:"flex-1",children:[e.jsx("div",{className:"text-center mb-6",children:n?e.jsx("div",{className:"text-3xl font-bold",children:a}):e.jsxs("div",{className:"flex items-baseline justify-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:t.currency||"€"}),e.jsx("span",{className:"text-4xl font-bold",children:a}),e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:r})]})}),e.jsx("ul",{className:"space-y-3",children:t.features.map((l,o)=>e.jsxs("li",{className:"flex items-start gap-2",children:[l.included===!0?e.jsx(x.Check,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):l.included==="partial"||l.included==="limited"?e.jsx(x.Check,{className:"h-5 w-5 text-yellow-500 flex-shrink-0"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:d.cn("text-sm",!l.included&&"text-muted-foreground"),children:[l.name,l.value&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",l.value,")"]})]}),l.tooltip&&e.jsx(He,{children:e.jsxs(Ge,{children:[e.jsx(qe,{asChild:!0,children:e.jsx(x.HelpCircle,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(Oe,{children:e.jsx("p",{className:"max-w-xs",children:l.tooltip})})]})})]},o))})]}),e.jsx(Ft,{children:e.jsx(L.Button,{className:"w-full",variant:t.buttonVariant||(t.popular?"default":"outline"),onClick:t.onSelect,disabled:t.disabled,asChild:!!t.href,children:t.href?e.jsx("a",{href:t.href,children:t.buttonText||"Choisir"}):t.buttonText||"Choisir"})})]})}function vE({plans:t,billingPeriod:s}){const a=Array.from(new Set(t.flatMap(r=>r.features.map(n=>n.name))));return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 border-b bg-muted/50",children:"Fonctionnalité"}),t.map(r=>e.jsxs("th",{className:d.cn("text-center p-4 border-b min-w-[150px]",r.popular&&"bg-primary/5"),children:[e.jsx("div",{className:"font-bold",children:r.name}),r.popular&&e.jsx(ne,{className:"mt-1",variant:"default",children:"Populaire"})]},r.id))]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4 border-b bg-muted/50 font-medium",children:"Prix"}),t.map(r=>{const n=s==="yearly"&&r.priceYearly!==void 0?r.priceYearly:r.price,l=s==="yearly"&&r.periodYearly?r.periodYearly:r.period||"/mois",o=typeof n=="string";return e.jsx("td",{className:d.cn("text-center p-4 border-b",r.popular&&"bg-primary/5"),children:o?e.jsx("span",{className:"font-bold",children:n}):e.jsxs("span",{className:"font-bold",children:[r.currency||"€",n,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:l})]})},r.id)})]})]}),e.jsxs("tbody",{children:[a.map((r,n)=>e.jsxs("tr",{className:n%2===0?"bg-muted/20":"",children:[e.jsx("td",{className:"p-4 border-b",children:r}),t.map(l=>{const o=l.features.find(c=>c.name===r);return e.jsx("td",{className:d.cn("text-center p-4 border-b",l.popular&&"bg-primary/5"),children:o?o.included===!0?o.value?e.jsx("span",{children:o.value}):e.jsx(x.Check,{className:"h-5 w-5 text-green-500 mx-auto"}):o.included==="partial"||o.included==="limited"?e.jsx("span",{className:"text-yellow-600",children:o.value||"Limité"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground mx-auto"}):e.jsx(x.X,{className:"h-5 w-5 text-muted-foreground mx-auto"})},l.id)})]},n)),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4"}),t.map(r=>e.jsx("td",{className:d.cn("text-center p-4",r.popular&&"bg-primary/5"),children:e.jsx(L.Button,{variant:r.buttonVariant||(r.popular?"default":"outline"),onClick:r.onSelect,disabled:r.disabled,asChild:!!r.href,children:r.href?e.jsx("a",{href:r.href,children:r.buttonText||"Choisir"}):r.buttonText||"Choisir"})},r.id))]})]})]})})}function yE({title:t="Questions fréquentes",items:s}){return e.jsxs("div",{className:"mt-16",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:s.map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:a.question}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a.answer})]},r))})]})}function wE({title:t="Tarification",description:s,plans:a,showBillingToggle:r=!0,billingPeriod:n,onBillingPeriodChange:l,yearlyDiscount:o,faq:c,faqTitle:m,layout:u="cards",columns:h=3,showComparison:f=!1,className:g}){const[p,j]=i.useState("monthly"),b=n??p,w=v=>{l?l(v):j(v)},y={2:"md:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 lg:grid-cols-4"};return e.jsxs("div",{className:d.cn("container py-16",g),children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),r&&e.jsx(bE,{period:b,onChange:w,yearlyDiscount:o}),u==="cards"&&!f?e.jsx("div",{className:d.cn("grid gap-6 items-stretch",y[h]),children:a.map(v=>e.jsx(jE,{plan:v,billingPeriod:b},v.id))}):e.jsx(vE,{plans:a,billingPeriod:b}),c&&c.length>0&&e.jsx(yE,{title:m,items:c})]})}const NE=[{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"}],kE=[{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."}],Ip=i.createContext(null);function CE(){const t=i.useContext(Ip);if(!t)throw new Error("useWizard must be used within a WakaWizard");return t}function SE({steps:t,currentStep:s,stepStatuses:a,showStepNumbers:r,orientation:n,onStepClick:l,allowBackNavigation:o}){const c=(u,h)=>h==="completed"?e.jsx(x.Check,{className:"h-4 w-4"}):h==="error"?e.jsx(x.AlertCircle,{className:"h-4 w-4"}):h==="skipped"?e.jsx(x.X,{className:"h-4 w-4 text-muted-foreground"}):r?e.jsx("span",{className:"text-xs font-medium",children:u+1}):e.jsx(x.Circle,{className:"h-3 w-3"}),m=u=>{switch(u){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 n==="vertical"?e.jsx("div",{className:"flex flex-col gap-0",children:t.map((u,h)=>{const f=a[h],g=o&&h<s;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",disabled:!g,onClick:()=>g&&l?.(h),className:d.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",m(f),g&&"cursor-pointer hover:opacity-80"),children:u.icon||c(h,f)}),h<t.length-1&&e.jsx("div",{className:d.cn("w-0.5 flex-1 min-h-[24px]",a[h]==="completed"?"bg-primary":"bg-border")})]}),e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:d.cn("font-medium",f==="current"?"text-foreground":"text-muted-foreground"),children:[u.title,u.optional&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optionnel)"})]}),u.description&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:u.description})]})]},u.id)})}):e.jsx("div",{className:"flex items-center gap-0",children:t.map((u,h)=>{const f=a[h],g=o&&h<s;return e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("button",{type:"button",disabled:!g,onClick:()=>g&&l?.(h),className:d.cn("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",m(f),g&&"cursor-pointer hover:opacity-80"),children:u.icon||c(h,f)}),e.jsx("div",{className:"text-center",children:e.jsx("div",{className:d.cn("text-sm font-medium",f==="current"?"text-foreground":"text-muted-foreground"),children:u.title})})]}),h<t.length-1&&e.jsx("div",{className:d.cn("flex-1 h-0.5 mx-2 mb-6",a[h]==="completed"?"bg-primary":"bg-border")})]},u.id)})})}function ME({onPrev:t,onNext:s,onSkip:a,onCancel:r,isFirstStep:n,isLastStep:l,isOptional:o,prevButtonText:c,nextButtonText:m,finishButtonText:u,skipButtonText:h,cancelButtonText:f,showCancelButton:g,submitting:p}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:g&&r&&e.jsx(L.Button,{type:"button",variant:"ghost",onClick:r,disabled:p,children:f})}),e.jsxs("div",{className:"flex gap-2",children:[!n&&e.jsxs(L.Button,{type:"button",variant:"outline",onClick:t,disabled:p,children:[e.jsx(x.ArrowLeft,{className:"mr-2 h-4 w-4"}),c]}),o&&a&&!l&&e.jsx(L.Button,{type:"button",variant:"ghost",onClick:a,disabled:p,children:h}),e.jsxs(L.Button,{type:"button",onClick:s,disabled:p,children:[p&&e.jsx(x.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),l?u:m,!l&&!p&&e.jsx(x.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})}function TE({steps:t,currentStep:s,onStepChange:a,onSubmit:r,onCancel:n,title:l,description:o,prevButtonText:c="Précédent",nextButtonText:m="Suivant",finishButtonText:u="Terminer",cancelButtonText:h="Annuler",skipButtonText:f="Passer",showCancelButton:g=!0,showProgress:p=!0,showStepNumbers:j=!0,showStepper:b=!0,stepperPosition:w="top",allowBackNavigation:y=!0,confirmCancel:v=!0,cancelConfirmMessage:N="Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.",submitting:k=!1,layout:S="card",className:C}){const[M,D]=i.useState(0),[A,T]=i.useState(t.map((Z,X)=>X===0?"current":"pending")),[E,I]=i.useState(!1),$=s??M,P=$===0,R=$===t.length-1,F=t[$],W=($+1)/t.length*100,U=(Z,X)=>{T(se=>{const K=[...se];if(X==="next"&&$<t.length)K[$]="completed";else if(X==="skip")K[$]="skipped";else if(X==="goto"&&Z<$)for(let Q=Z+1;Q<t.length;Q++)K[Q]="pending";return K[Z]="current",K})},G=async Z=>{if(Z<0||Z>=t.length||Z>$&&!y)return;F.onLeave&&await F.onLeave(),U(Z,"goto"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},O=async()=>{if(F.validate&&!await F.validate()){T(X=>{const se=[...X];return se[$]="error",se});return}if(F.onLeave&&await F.onLeave(),R){const Z={steps:t.map((X,se)=>({id:X.id,status:se===$?"completed":A[se]})),completedSteps:t.filter((X,se)=>A[se]==="completed"||se===$).map(X=>X.id),skippedSteps:t.filter((X,se)=>A[se]==="skipped").map(X=>X.id)};await r?.(Z)}else{const Z=$+1;U(Z,"next"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()}},_=async()=>{if(P)return;F.onLeave&&await F.onLeave();const Z=$-1;U(Z,"prev"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},z=async()=>{if(!F.optional||R)return;F.onLeave&&await F.onLeave();const Z=$+1;U(Z,"skip"),a?a(Z):D(Z);const X=t[Z];X.onEnter&&await X.onEnter()},V=()=>{v?I(!0):n?.()},q={currentStep:$,totalSteps:t.length,stepStatuses:A,goToStep:G,nextStep:O,prevStep:_,skipStep:z,isFirstStep:P,isLastStep:R},B=b&&e.jsx(SE,{steps:t,currentStep:$,stepStatuses:A,showStepNumbers:j,orientation:w==="left"?"vertical":"horizontal",onStepClick:G,allowBackNavigation:y}),H=e.jsx(ME,{onPrev:_,onNext:O,onSkip:F.optional?z:void 0,onCancel:n?V:void 0,isFirstStep:P,isLastStep:R,isOptional:F.optional||!1,prevButtonText:c,nextButtonText:m,finishButtonText:u,skipButtonText:f,cancelButtonText:h,showCancelButton:g,submitting:k}),Y=e.jsxs(Ip.Provider,{value:q,children:[w==="left"?e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-64 flex-shrink-0",children:B}),e.jsxs("div",{className:"flex-1",children:[p&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",$+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Be,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:F.content}),e.jsx("div",{className:"mt-8",children:H})]})]}):e.jsxs(e.Fragment,{children:[B&&e.jsx("div",{className:"mb-8",children:B}),p&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",$+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Be,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:F.content}),e.jsx("div",{className:"mt-8",children:H})]}),e.jsx(zs,{open:E,onOpenChange:I,children:e.jsxs(fs,{children:[e.jsxs(gs,{children:[e.jsx(bs,{children:"Annuler ?"}),e.jsx(js,{children:N})]}),e.jsxs(ps,{children:[e.jsx(ys,{children:"Non, continuer"}),e.jsx(vs,{onClick:()=>{I(!1),n?.()},children:"Oui, annuler"})]})]})})]});return S==="minimal"?e.jsx("div",{className:d.cn("space-y-6",C),children:Y}):S==="page"?e.jsxs("div",{className:d.cn("container py-8 max-w-4xl",C),children:[(l||o)&&e.jsxs("div",{className:"mb-8",children:[l&&e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:l}),o&&e.jsx("p",{className:"text-muted-foreground mt-1",children:o})]}),Y]}):e.jsxs(me,{className:C,children:[(l||o)&&e.jsxs(we,{children:[l&&e.jsx(Ne,{children:l}),o&&e.jsx(Ze,{children:o})]}),e.jsx(fe,{children:Y})]})}const DE=[{id:"step-1",title:"Informations de base",description:"Renseignez vos informations personnelles",content:e.jsx("div",{className:"space-y-4",children:e.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:e.jsx("div",{className:"space-y-4",children:e.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:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 3 - Confirmation"})})}];function Pp(t,s,a){const r=t.translations[a]?.value||"",n=t.translations[s]?.value;return!n||n.trim()===""?"missing":n===r?"identical":"valid"}function Tl(t,s,a){const r=s.filter(n=>n!==a).map(n=>Pp(t,n,a));return r.includes("missing")?"missing":r.includes("identical")?"identical":"valid"}function $E(t,s){const a=new Map;for(const r of t){const n=r.key.split(s),l=n.length>1?n[0]:"__root__";a.has(l)||a.set(l,[]),a.get(l).push(r)}return a}function AE({status:t}){const s={valid:{label:"OK",variant:"default",icon:x.CheckCircle,className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"},missing:{label:"Manquant",variant:"destructive",icon:x.XCircle,className:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"},identical:{label:"Identique",variant:"secondary",icon:x.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"},warning:{label:"Attention",variant:"secondary",icon:x.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"}},{label:a,icon:r,className:n}=s[t];return e.jsxs(ne,{variant:"outline",className:d.cn("gap-1 text-xs",n),children:[e.jsx(r,{className:"h-3 w-3"}),a]})}function Xu({value:t,onChange:s,onBlur:a,placeholder:r,status:n,disabled:l}){const[o,c]=i.useState(t);i.useEffect(()=>{c(t)},[t]);const m=u=>{c(u.target.value),s(u.target.value)};return e.jsx(L.Textarea,{value:o,onChange:m,onBlur:a,placeholder:r,disabled:l,className:d.cn("min-h-[60px] resize-none text-sm",n==="missing"&&"border-red-300 dark:border-red-700",n==="identical"&&"border-yellow-300 dark:border-yellow-700")})}function EE({config:t,translations:s,onChange:a,onSave:r,onAddKey:n,onDeleteKey:l,onAddLanguage:o,onExport:c,onImport:m,isLoading:u=!1,isSaving:h=!1,className:f,title:g="Translation Editor",description:p="Gérez vos traductions i18n"}){const[j,b]=i.useState(s),[w,y]=i.useState(""),[v,N]=i.useState("all"),[k,S]=i.useState(new Set),[C,M]=i.useState(null),[D,A]=i.useState(!1),[T,E]=i.useState(!1),[I,$]=i.useState(!1),[P,R]=i.useState(!1),[F,W]=i.useState(""),[U,G]=i.useState({code:"",label:"",flag:""}),[O,_]=i.useState(null),[z,V]=i.useState(""),[q,B]=i.useState("merge"),[H,Y]=i.useState(new Map),Z=i.useRef(null),{languages:X,sourceLanguage:se,keyPathSeparator:K=".",autoSave:Q=!0,saveDebounceMs:ee=300,placeholderPatterns:te=["{{.*?}}","{.*?}","%s","%d"]}=t,ae=X.filter(ie=>ie.code!==se);i.useEffect(()=>{b(s)},[s]),i.useEffect(()=>(Q&&H.size>0&&r&&(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(async()=>{await r(j),Y(new Map)},ee)),()=>{Z.current&&clearTimeout(Z.current)}),[H,Q,ee,r,j]);const re=i.useMemo(()=>{let ie=j;if(w){const ue=w.toLowerCase();ie=ie.filter(ge=>{if(ge.key.toLowerCase().includes(ue))return!0;for(const Me of Object.keys(ge.translations))if(ge.translations[Me]?.value?.toLowerCase().includes(ue))return!0;return!1})}return v!=="all"&&(ie=ie.filter(ue=>{const ge=Tl(ue,X.map(Me=>Me.code),se);switch(v){case"missing":return ge==="missing";case"incomplete":return ge==="missing"||ge==="identical";case"identical":return ge==="identical";default:return!0}})),ie},[j,w,v,X,se]),le=i.useMemo(()=>$E(re,K),[re,K]),de=(ie,ue,ge)=>{b(Me=>Me.map(Se=>Se.key===ie?{...Se,translations:{...Se.translations,[ue]:{...Se.translations[ue],value:ge,updatedAt:new Date}}}:Se)),Y(Me=>{const Se=new Map(Me);return Se.has(ie)||Se.set(ie,new Map),Se.get(ie).set(ue,ge),Se}),a?.(ie,ue,ge)},oe=async()=>{F.trim()&&(await n?.(F),W(""),E(!1))},he=async ie=>{await l?.(ie),b(ue=>ue.filter(ge=>ge.key!==ie))},ve=async()=>{!U.code||!U.label||(await o?.(U),G({code:"",label:"",flag:""}),$(!1))},be=async()=>{!O||!z||(await m?.(O,z,q),_(null),V(""),R(!1))},pe=ie=>{navigator.clipboard.writeText(ie)},je=ie=>{S(ue=>{const ge=new Set(ue);return ge.has(ie)?ge.delete(ie):ge.add(ie),ge})},Ce=i.useMemo(()=>{let ie=j.length,ue=0,ge=0,Me=0;for(const Se of j){const Xe=Tl(Se,X.map(mt=>mt.code),se);Xe==="missing"?ue++:Xe==="identical"?ge++:Me++}return{total:ie,missing:ue,identical:ge,valid:Me}},[j,X,se]);return u?e.jsx("div",{className:d.cn("flex items-center justify-center py-12",f),children:e.jsx(x.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(He,{children:e.jsxs("div",{className:d.cn("flex flex-col h-full",f),children:[e.jsxs("div",{className:"flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(x.Languages,{className:"h-6 w-6"}),g]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>E(!0),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une clé"]}),e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>$(!0),children:[e.jsx(x.Flag,{className:"h-4 w-4 mr-1"}),"Ajouter une langue"]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"outline",size:"sm",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>c?.(),children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Exporter tout"]}),X.map(ie=>e.jsxs(ye,{onClick:()=>c?.(ie.code),children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Exporter ",ie.label]},ie.code)),e.jsx(Ke,{}),e.jsxs(ye,{onClick:()=>R(!0),children:[e.jsx(x.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]})]})]}),h&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Loader2,{className:"h-4 w-4 animate-spin"}),"Sauvegarde..."]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Ce.total," clés"]}),e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400",children:[e.jsx(x.CheckCircle,{className:"h-4 w-4"}),Ce.valid," traduites"]}),e.jsxs("span",{className:"flex items-center gap-1 text-red-600 dark:text-red-400",children:[e.jsx(x.XCircle,{className:"h-4 w-4"}),Ce.missing," manquantes"]}),e.jsxs("span",{className:"flex items-center gap-1 text-yellow-600 dark:text-yellow-400",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4"}),Ce.identical," identiques"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Rechercher une clé ou une traduction...",value:w,onChange:ie=>y(ie.target.value),className:"pl-10"}),w&&e.jsx("button",{onClick:()=>y(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(x.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Filter,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs(Ee,{value:v,onValueChange:ie=>N(ie),children:[e.jsx($e,{className:"w-[180px]",children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsxs(xe,{value:"all",children:["Toutes (",Ce.total,")"]}),e.jsxs(xe,{value:"missing",children:["Manquantes (",Ce.missing,")"]}),e.jsxs(xe,{value:"incomplete",children:["Incomplètes (",Ce.missing+Ce.identical,")"]}),e.jsxs(xe,{value:"identical",children:["Identiques (",Ce.identical,")"]})]})]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-muted/50 backdrop-blur z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b w-[280px]",children:"Clé"}),e.jsxs("th",{className:"text-left p-3 font-medium text-sm border-b",children:[X.find(ie=>ie.code===se)?.label||se," (source)"]}),ae.map(ie=>e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b",children:e.jsxs("span",{className:"flex items-center gap-2",children:[ie.flag&&e.jsx("span",{children:ie.flag}),ie.label]})},ie.code)),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[100px]",children:"État"}),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[60px]",children:"Actions"})]})}),e.jsxs("tbody",{children:[Array.from(le.entries()).map(([ie,ue])=>e.jsxs(i.Fragment,{children:[ie!=="__root__"&&e.jsx("tr",{className:"bg-muted/30",children:e.jsx("td",{colSpan:ae.length+4,className:"p-2",children:e.jsxs("button",{onClick:()=>je(ie),className:"flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors",children:[k.has(ie)?e.jsx(x.ChevronRight,{className:"h-4 w-4"}):e.jsx(x.ChevronDown,{className:"h-4 w-4"}),ie,e.jsx(ne,{variant:"secondary",className:"text-xs",children:ue.length})]})})}),!k.has(ie)&&ue.map(ge=>{const Me=Tl(ge,X.map(Se=>Se.code),se);return e.jsxs("tr",{className:"border-b hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"p-3 font-mono text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate max-w-[200px]",title:ge.key,children:ge.key}),e.jsxs(Ge,{children:[e.jsx(qe,{asChild:!0,children:e.jsx("button",{onClick:()=>pe(ge.key),className:"text-muted-foreground hover:text-foreground",children:e.jsx(x.Copy,{className:"h-3 w-3"})})}),e.jsx(Oe,{children:"Copier la clé"})]})]})}),e.jsx("td",{className:"p-2",children:e.jsx(Xu,{value:ge.translations[se]?.value||"",onChange:Se=>de(ge.key,se,Se),placeholder:"Texte source...",status:ge.translations[se]?.value?"valid":"missing"})}),ae.map(Se=>{const Xe=Pp(ge,Se.code,se);return e.jsx("td",{className:"p-2",children:e.jsx(Xu,{value:ge.translations[Se.code]?.value||"",onChange:mt=>de(ge.key,Se.code,mt),placeholder:`Traduction ${Se.label}...`,status:Xe})},Se.code)}),e.jsx("td",{className:"p-3 text-center",children:e.jsx(AE,{status:Me})}),e.jsx("td",{className:"p-3 text-center",children:e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"sm",children:e.jsx(x.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>{M(ge),A(!0)},children:[e.jsx(x.Edit3,{className:"h-4 w-4 mr-2"}),"Éditer"]}),e.jsxs(ye,{onClick:()=>pe(ge.key),children:[e.jsx(x.Copy,{className:"h-4 w-4 mr-2"}),"Copier la clé"]}),e.jsx(Ke,{}),e.jsxs(ye,{className:"text-destructive",onClick:()=>he(ge.key),children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})})]},ge.key)})]},ie)),re.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:ae.length+4,className:"p-12 text-center",children:[e.jsx(x.Languages,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:w||v!=="all"?"Aucune traduction ne correspond à vos critères":"Aucune traduction disponible"})]})})]})]})}),e.jsx(nr,{open:D,onOpenChange:A,children:e.jsxs(ua,{className:"w-[500px] sm:max-w-[500px]",children:[e.jsxs(vn,{children:[e.jsx(lr,{children:"Éditer la traduction"}),e.jsx(or,{children:C?.key})]}),C&&e.jsxs("div",{className:"py-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:[X.find(ie=>ie.code===se)?.label," (source)"]}),e.jsx(L.Textarea,{value:C.translations[se]?.value||"",onChange:ie=>{de(C.key,se,ie.target.value),M({...C,translations:{...C.translations,[se]:{...C.translations[se],value:ie.target.value}}})},placeholder:"Texte source...",className:"min-h-[100px]"})]}),X.filter(ie=>ie.code!==se).map(ie=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[ie.flag&&e.jsx("span",{children:ie.flag}),ie.label]}),e.jsx(L.Textarea,{value:C.translations[ie.code]?.value||"",onChange:ue=>{de(C.key,ie.code,ue.target.value),M({...C,translations:{...C.translations,[ie.code]:{...C.translations[ie.code],value:ue.target.value}}})},placeholder:`Traduction ${ie.label}...`,className:"min-h-[100px]"})]},ie.code)),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Commentaire (optionnel)"}),e.jsx(L.Textarea,{placeholder:"Contexte ou indication pour la traduction...",className:"min-h-[80px]"})]})]}),e.jsx(Io,{children:e.jsx(L.Button,{variant:"outline",onClick:()=>A(!1),children:"Fermer"})})]})}),e.jsx(Jt,{open:T,onOpenChange:E,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Ajouter une clé de traduction"}),e.jsx(na,{children:"Entrez la clé de traduction (ex: common.buttons.submit)"})]}),e.jsx("div",{className:"py-4",children:e.jsx(L.Input,{value:F,onChange:ie=>W(ie.target.value),placeholder:"namespace.key.name"})}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>E(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:oe,children:"Ajouter"})]})]})}),e.jsx(Jt,{open:I,onOpenChange:$,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Ajouter une langue"}),e.jsx(na,{children:"Configurez la nouvelle langue à ajouter"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Code (ex: de, it, pt)"}),e.jsx(L.Input,{value:U.code,onChange:ie=>G({...U,code:ie.target.value}),placeholder:"de"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Label"}),e.jsx(L.Input,{value:U.label,onChange:ie=>G({...U,label:ie.target.value}),placeholder:"Allemand"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Emoji drapeau (optionnel)"}),e.jsx(L.Input,{value:U.flag,onChange:ie=>G({...U,flag:ie.target.value}),placeholder:"🇩🇪"})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>$(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:ve,children:"Ajouter"})]})]})}),e.jsx(Jt,{open:P,onOpenChange:R,children:e.jsxs(Ot,{children:[e.jsxs(ms,{children:[e.jsx(es,{children:"Importer des traductions"}),e.jsx(na,{children:"Sélectionnez un fichier JSON à importer"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Fichier JSON"}),e.jsx(L.Input,{type:"file",accept:".json",onChange:ie=>_(ie.target.files?.[0]||null)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Langue cible"}),e.jsxs(Ee,{value:z,onValueChange:V,children:[e.jsx($e,{children:e.jsx(Re,{placeholder:"Sélectionner une langue"})}),e.jsx(Ae,{children:X.map(ie=>e.jsxs(xe,{value:ie.code,children:[ie.flag&&e.jsx("span",{className:"mr-2",children:ie.flag}),ie.label]},ie.code))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Stratégie"}),e.jsxs(Ee,{value:q,onValueChange:ie=>B(ie),children:[e.jsx($e,{children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"merge",children:"Fusionner (conserver les existantes)"}),e.jsx(xe,{value:"overwrite",children:"Écraser tout"})]})]})]})]}),e.jsxs(xs,{children:[e.jsx(L.Button,{variant:"outline",onClick:()=>R(!1),children:"Annuler"}),e.jsx(L.Button,{onClick:be,disabled:!O||!z,children:"Importer"})]})]})})]})})}const uo={default:"text-foreground",blue:"text-blue-500",green:"text-green-500",yellow:"text-yellow-500",red:"text-red-500",purple:"text-purple-500"},RE={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 IE({data:t,color:s="blue"}){const a=Math.max(...t),r=Math.min(...t),n=a-r||1,l=t.map((o,c)=>{const m=c/(t.length-1)*100,u=100-(o-r)/n*100;return`${m},${u}`}).join(" ");return e.jsx("svg",{className:"w-16 h-8",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:e.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"3",className:d.cn("opacity-60",uo[s]||uo.blue)})})}function PE({metric:t}){const s=t.icon,a=t.trend==="up"?"text-green-500":t.trend==="down"?"text-red-500":"text-muted-foreground",r=t.trend==="up"?x.TrendingUp:t.trend==="down"?x.TrendingDown:null;return e.jsxs(me,{className:"relative overflow-hidden",children:[e.jsxs(we,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(Ne,{className:"text-sm font-medium text-muted-foreground",children:t.label}),s&&e.jsx("div",{className:d.cn("p-2 rounded-lg",RE[t.color||"default"]),children:e.jsx("span",{className:d.cn("h-4 w-4",uo[t.color||"default"]),children:s})})]}),e.jsxs(fe,{children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold",children:t.value}),t.change!==void 0&&e.jsxs("div",{className:d.cn("flex items-center gap-1 text-sm",a),children:[r&&e.jsx(r,{className:"h-3 w-3"}),e.jsxs("span",{children:[t.change>0?"+":"",t.change,"%"]}),t.changeLabel&&e.jsx("span",{className:"text-muted-foreground",children:t.changeLabel})]})]}),t.sparkline&&e.jsx(IE,{data:t.sparkline,color:t.color})]}),t.target!==void 0&&t.current!==void 0&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{children:[Math.round(t.current/t.target*100),"%"]})]}),e.jsx(Be,{value:t.current/t.target*100,className:"h-1.5"})]})]})]})}function LE({goal:t}){const s=t.current/t.target*100,a=s>=100;return e.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border bg-card",children:[e.jsx("div",{className:d.cn("h-10 w-10 rounded-full flex items-center justify-center",a?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.jsx(x.Target,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium truncate",children:t.label}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.current,t.unit," / ",t.target,t.unit]})]}),e.jsx(Be,{value:Math.min(s,100),className:"h-2"})]}),a&&e.jsx(ne,{variant:"default",className:"bg-green-500",children:"Complete"})]})}function FE({title:t="Dashboard",description:s,metrics:a,periods:r=[{value:"7d",label:"7 days"},{value:"30d",label:"30 days"},{value:"90d",label:"90 days"},{value:"12m",label:"12 months"}],selectedPeriod:n="30d",onPeriodChange:l,onRefresh:o,onExport:c,chart:m,secondaryMetrics:u,goals:h,isLoading:f=!1,lastUpdated:g,className:p}){return e.jsxs("div",{className:d.cn("space-y-6",p),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r.length>0&&e.jsxs(Ee,{value:n,onValueChange:l,children:[e.jsxs($e,{className:"w-[140px]",children:[e.jsx(x.Calendar,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsx(Ae,{children:r.map(j=>e.jsx(xe,{value:j.value,children:j.label},j.value))})]}),o&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:o,disabled:f,children:e.jsx(x.RefreshCw,{className:d.cn("h-4 w-4",f&&"animate-spin")})}),c&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:c,children:e.jsx(x.Download,{className:"h-4 w-4"})})]})]}),g&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Clock,{className:"h-4 w-4"}),e.jsxs("span",{children:["Last updated: ",typeof g=="string"?g:g.toLocaleString()]})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:a.slice(0,4).map(j=>e.jsx(PE,{metric:j},j.id))}),m&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Overview"}),e.jsx(Ze,{children:"Performance metrics over time"})]}),e.jsx(fe,{children:m})]}),u&&u.length>0&&e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:u.map(j=>e.jsx(me,{children:e.jsx(fe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:j.label}),e.jsx("p",{className:"text-xl font-bold",children:j.value})]}),j.change!==void 0&&e.jsxs(ne,{variant:j.trend==="up"?"default":j.trend==="down"?"destructive":"secondary",className:"gap-1",children:[j.trend==="up"?e.jsx(x.ArrowUpRight,{className:"h-3 w-3"}):j.trend==="down"?e.jsx(x.ArrowDownRight,{className:"h-3 w-3"}):null,j.change>0?"+":"",j.change,"%"]})]})})},j.id))}),h&&h.length>0&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.Target,{className:"h-5 w-5"}),"Goals & Targets"]}),e.jsx(Ze,{children:"Track your progress towards key objectives"})]}),e.jsx(fe,{className:"space-y-4",children:h.map(j=>e.jsx(LE,{goal:j},j.id))})]})]})}const BE=[{id:"revenue",label:"Total Revenue",value:"$45,231.89",change:20.1,changeLabel:"from last month",trend:"up",icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Activity,{className:"h-4 w-4"}),color:"yellow",sparkline:[100,90,85,88,70,65,60,58,55]}],zE=[{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 WE({steps:t,currentStep:s}){const a=t.findIndex(r=>r.id===s);return e.jsx("div",{className:"flex items-center justify-center mb-8",children:t.map((r,n)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:d.cn("h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium",n<a?"bg-primary text-primary-foreground":n===a?"bg-primary text-primary-foreground ring-4 ring-primary/20":"bg-muted text-muted-foreground"),children:n<a?e.jsx(x.Check,{className:"h-4 w-4"}):n+1}),e.jsx("span",{className:d.cn("ml-2 text-sm font-medium hidden sm:inline",n<=a?"text-foreground":"text-muted-foreground"),children:r.label})]}),n<t.length-1&&e.jsx("div",{className:d.cn("w-8 sm:w-16 h-0.5 mx-2",n<a?"bg-primary":"bg-muted")})]},r.id))})}function OE({items:t,currency:s="$",discount:a,couponCode:r,setCouponCode:n,onApplyCoupon:l,onRemoveDiscount:o,isApplyingCoupon:c,shippingPrice:m=0,taxRate:u=0}){const h=t.reduce((b,w)=>b+w.price*w.quantity,0),f=a?a.type==="percent"?h*a.amount/100:a.amount:0,g=h-f,p=g*u/100,j=g+p+m;return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.ShoppingBag,{className:"h-5 w-5"}),"Order Summary"]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsx("div",{className:"space-y-3",children:t.map(b=>e.jsxs("div",{className:"flex gap-3",children:[b.image&&e.jsx("div",{className:"h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0",children:e.jsx("img",{src:b.image,alt:b.name,className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:b.name}),b.variant&&e.jsx("p",{className:"text-sm text-muted-foreground",children:b.variant}),e.jsxs("p",{className:"text-sm",children:["Qty: ",b.quantity]})]}),e.jsxs("p",{className:"font-medium",children:[s,(b.price*b.quantity).toFixed(2)]})]},b.id))}),e.jsx(L.Separator,{}),a?e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Percent,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.code}),e.jsxs("span",{className:"text-sm",children:["(-",a.type==="percent"?`${a.amount}%`:`${s}${a.amount}`,")"]})]}),e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(x.X,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L.Input,{placeholder:"Coupon code",value:r,onChange:b=>n(b.target.value),className:"flex-1"}),e.jsx(L.Button,{variant:"outline",onClick:l,disabled:!r||c,children:c?e.jsx(x.Loader2,{className:"h-4 w-4 animate-spin"}):"Apply"})]}),e.jsx(L.Separator,{}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subtotal"}),e.jsxs("span",{children:[s,h.toFixed(2)]})]}),f>0&&e.jsxs("div",{className:"flex justify-between text-green-600",children:[e.jsx("span",{children:"Discount"}),e.jsxs("span",{children:["-",s,f.toFixed(2)]})]}),m>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Shipping"}),e.jsxs("span",{children:[s,m.toFixed(2)]})]}),p>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Tax (",u,"%)"]}),e.jsxs("span",{children:[s,p.toFixed(2)]})]}),e.jsx(L.Separator,{}),e.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:[s,j.toFixed(2)]})]})]})]})]})}function UE({items:t,shippingMethods:s=Lp,paymentMethods:a=Fp,onApplyCoupon:r,discount:n,onRemoveDiscount:l,onSubmitOrder:o,currency:c="$",taxRate:m=8.5,className:u}){const[h,f]=i.useState("cart"),[g,p]=i.useState(""),[j,b]=i.useState(!1),[w,y]=i.useState(!1),[v,N]=i.useState({firstName:"",lastName:"",email:"",phone:"",address:"",apartment:"",city:"",state:"",postalCode:"",country:"US"}),[k,S]=i.useState(s[0]?.id||""),[C,M]=i.useState(a[0]?.id||""),[D,A]=i.useState(!1),T=[{id:"cart",label:"Cart"},{id:"shipping",label:"Shipping"},{id:"payment",label:"Payment"},{id:"review",label:"Review"}],E=s.find(F=>F.id===k),I=async()=>{!r||!g||(b(!0),await r(g),b(!1))},$=async()=>{if(o){y(!0);try{await o({address:v,shippingMethod:k,paymentMethod:C,saveInfo:D})}finally{y(!1)}}},P=()=>{const F=T.findIndex(W=>W.id===h);F<T.length-1&&f(T[F+1].id)},R=()=>{const F=T.findIndex(W=>W.id===h);F>0&&f(T[F-1].id)};return e.jsxs("div",{className:d.cn("max-w-6xl mx-auto",u),children:[e.jsx(WE,{steps:T,currentStep:h}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[h==="cart"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Shopping Cart"}),e.jsxs(Ze,{children:[t.length," items in your cart"]})]}),e.jsx(fe,{className:"space-y-4",children:t.map(F=>e.jsxs("div",{className:"flex gap-4 p-4 rounded-lg border",children:[F.image&&e.jsx("div",{className:"h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0",children:e.jsx("img",{src:F.image,alt:F.name,className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium",children:F.name}),F.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:F.description}),F.variant&&e.jsx(ne,{variant:"secondary",className:"mt-1",children:F.variant}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:["Qty: ",F.quantity]}),e.jsxs("span",{className:"font-bold",children:[c,(F.price*F.quantity).toFixed(2)]})]})]})]},F.id))}),e.jsx(Ft,{children:e.jsxs(L.Button,{className:"w-full",onClick:P,children:["Continue to Shipping",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})})]}),h==="shipping"&&e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-5 w-5"}),"Shipping Address"]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"First Name"}),e.jsx(L.Input,{value:v.firstName,onChange:F=>N({...v,firstName:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Last Name"}),e.jsx(L.Input,{value:v.lastName,onChange:F=>N({...v,lastName:F.target.value})})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Email"}),e.jsx(L.Input,{type:"email",value:v.email,onChange:F=>N({...v,email:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Phone"}),e.jsx(L.Input,{type:"tel",value:v.phone,onChange:F=>N({...v,phone:F.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Address"}),e.jsx(L.Input,{value:v.address,onChange:F=>N({...v,address:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Apartment, suite, etc. (optional)"}),e.jsx(L.Input,{value:v.apartment,onChange:F=>N({...v,apartment:F.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"City"}),e.jsx(L.Input,{value:v.city,onChange:F=>N({...v,city:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"State"}),e.jsx(L.Input,{value:v.state,onChange:F=>N({...v,state:F.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Postal Code"}),e.jsx(L.Input,{value:v.postalCode,onChange:F=>N({...v,postalCode:F.target.value})})]})]}),e.jsx(L.Separator,{className:"my-6"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-4 flex items-center gap-2",children:[e.jsx(x.Truck,{className:"h-5 w-5"}),"Shipping Method"]}),e.jsx(qa,{value:k,onValueChange:S,children:e.jsx("div",{className:"space-y-3",children:s.map(F=>e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",k===F.id?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:F.id}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:F.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:F.description})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"font-medium",children:F.price===0?"Free":`${c}${F.price.toFixed(2)}`}),e.jsx("p",{className:"text-sm text-muted-foreground",children:F.estimatedDays})]})]},F.id))})})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs(L.Button,{className:"flex-1",onClick:P,children:["Continue to Payment",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})]})]}),h==="payment"&&e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.CreditCard,{className:"h-5 w-5"}),"Payment Method"]})}),e.jsxs(fe,{children:[e.jsx(qa,{value:C,onValueChange:M,children:e.jsx("div",{className:"space-y-3",children:a.map(F=>e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",C===F.id?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:F.id}),F.icon,e.jsx("span",{className:"font-medium",children:F.label}),F.last4&&e.jsxs("span",{className:"text-muted-foreground",children:["•••• ",F.last4]})]},F.id))})}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[e.jsx(xt,{id:"save-info",checked:D,onCheckedChange:F=>A(F)}),e.jsx(L.Label,{htmlFor:"save-info",className:"text-sm",children:"Save my information for faster checkout"})]}),e.jsxs("div",{className:"mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3",children:[e.jsx(x.Shield,{className:"h-5 w-5 text-green-500"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment information is encrypted and secure"})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs(L.Button,{className:"flex-1",onClick:P,children:["Review Order",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})]})]}),h==="review"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Review Your Order"}),e.jsx(Ze,{children:"Please verify all information before placing your order"})]}),e.jsxs(fe,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.MapPin,{className:"h-4 w-4"}),"Shipping Address"]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:[e.jsxs("p",{className:"font-medium",children:[v.firstName," ",v.lastName]}),e.jsxs("p",{children:[v.address,v.apartment&&`, ${v.apartment}`]}),e.jsxs("p",{children:[v.city,", ",v.state," ",v.postalCode]}),e.jsx("p",{children:v.email}),e.jsx("p",{children:v.phone})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.Truck,{className:"h-4 w-4"}),"Shipping Method"]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:[e.jsx("p",{className:"font-medium",children:E?.name}),e.jsx("p",{className:"text-muted-foreground",children:E?.estimatedDays})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(x.CreditCard,{className:"h-4 w-4"}),"Payment Method"]}),e.jsx("div",{className:"p-4 rounded-lg bg-muted/50 text-sm",children:e.jsx("p",{className:"font-medium",children:a.find(F=>F.id===C)?.label})})]})]}),e.jsxs(Ft,{className:"flex gap-4",children:[e.jsxs(L.Button,{variant:"outline",onClick:R,children:[e.jsx(x.ChevronLeft,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsx(L.Button,{className:"flex-1",onClick:$,disabled:w,children:w?e.jsxs(e.Fragment,{children:[e.jsx(x.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(x.Lock,{className:"h-4 w-4 mr-2"}),"Place Order"]})})]})]})]}),e.jsx("div",{className:"lg:sticky lg:top-4 h-fit",children:e.jsx(OE,{items:t,currency:c,discount:n,couponCode:g,setCouponCode:p,onApplyCoupon:I,onRemoveDiscount:l,isApplyingCoupon:j,shippingPrice:E?.price||0,taxRate:m})})]})]})}const Lp=[{id:"standard",name:"Standard Shipping",description:"Delivered by postal service",price:4.99,estimatedDays:"5-7 business days",icon:e.jsx(x.Package,{className:"h-5 w-5"})},{id:"express",name:"Express Shipping",description:"Fast delivery guaranteed",price:14.99,estimatedDays:"2-3 business days",icon:e.jsx(x.Truck,{className:"h-5 w-5"})},{id:"overnight",name:"Overnight Shipping",description:"Next day delivery",price:29.99,estimatedDays:"Next business day",icon:e.jsx(x.Truck,{className:"h-5 w-5"})}],Fp=[{id:"card",type:"card",label:"Credit Card",icon:e.jsx(x.CreditCard,{className:"h-5 w-5"})},{id:"paypal",type:"paypal",label:"PayPal",icon:e.jsx("div",{className:"h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold",children:"P"})}],_E=[{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"}],VE={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"},HE={common:"",rare:"shadow-blue-500/20",epic:"shadow-purple-500/20",legendary:"shadow-amber-500/30 shadow-lg"};function GE({current:t,max:s,level:a}){const r=t/s*100;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold",children:a}),e.jsxs("span",{className:"text-muted-foreground",children:["Level ",a]})]}),e.jsxs("span",{className:"text-muted-foreground",children:[t.toLocaleString()," / ",s.toLocaleString()," XP"]})]}),e.jsxs("div",{className:"relative h-3 rounded-full bg-muted overflow-hidden",children:[e.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}%`}}),e.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full",style:{width:`${r}%`}})]})]})}function qE({stat:t}){const s={default:"text-foreground",blue:"text-blue-500",green:"text-green-500",yellow:"text-yellow-500",red:"text-red-500",purple:"text-purple-500"};return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[t.icon&&e.jsx("div",{className:d.cn("h-10 w-10 rounded-lg bg-background flex items-center justify-center",s[t.color||"default"]),children:t.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:t.value}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.label})]})]})}function XE({achievement:t}){const s=t.unlockedAt||t.progress!==void 0&&t.maxProgress!==void 0&&t.progress>=t.maxProgress;return e.jsx("div",{className:d.cn("p-4 rounded-lg border transition-all",s?d.cn(VE[t.rarity||"common"],HE[t.rarity||"common"]):"bg-muted/30 border-dashed opacity-60"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:d.cn("h-12 w-12 rounded-lg flex items-center justify-center",s?"bg-background/50":"bg-muted"),children:t.icon||e.jsx(x.Trophy,{className:"h-6 w-6"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-medium truncate",children:t.name}),t.rarity&&e.jsx(ne,{variant:"outline",className:"text-xs capitalize",children:t.rarity})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.progress!==void 0&&t.maxProgress!==void 0&&!s&&e.jsxs("div",{className:"mt-2",children:[e.jsx(Be,{value:t.progress/t.maxProgress*100,className:"h-1.5"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t.progress," / ",t.maxProgress]})]}),t.unlockedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Unlocked ",typeof t.unlockedAt=="string"?t.unlockedAt:t.unlockedAt.toLocaleDateString()]})]})]})})}function YE({match:t}){const s={win:"text-green-500 bg-green-500/10",loss:"text-red-500 bg-red-500/10",draw:"text-yellow-500 bg-yellow-500/10"},a={win:e.jsx(x.Trophy,{className:"h-4 w-4"}),loss:e.jsx(x.Swords,{className:"h-4 w-4"}),draw:e.jsx(x.Shield,{className:"h-4 w-4"})};return e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/50",children:[e.jsx("div",{className:d.cn("h-10 w-10 rounded-lg flex items-center justify-center",s[t.result]),children:a[t.result]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium capitalize",children:t.result}),t.score&&e.jsx("span",{className:"text-muted-foreground",children:t.score})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.opponent&&e.jsxs("span",{children:["vs ",t.opponent]}),t.mode&&e.jsx(ne,{variant:"outline",className:"text-xs",children:t.mode})]})]}),e.jsxs("div",{className:"text-right",children:[t.xpGained&&e.jsxs("p",{className:"text-sm font-medium text-green-500",children:["+",t.xpGained," XP"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:typeof t.date=="string"?t.date:t.date.toLocaleDateString()})]})]})}function ZE({name:t,avatar:s,title:a,level:r,currentXP:n,maxXP:l,totalXP:o,rank:c,rankIcon:m,stats:u,achievements:h,badges:f,matchHistory:g,streak:p,joinDate:j,playtime:b,friendsCount:w,isOnline:y=!1,className:v}){return e.jsxs("div",{className:d.cn("space-y-6",v),children:[e.jsx(me,{children:e.jsxs(fe,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{className:"h-24 w-24 border-4 border-primary/20",children:[e.jsx(st,{src:s,alt:t}),e.jsx(at,{className:"text-2xl",children:t.slice(0,2).toUpperCase()})]}),y&&e.jsx("div",{className:"absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background"}),e.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:r})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:t}),a&&e.jsx("p",{className:"text-muted-foreground",children:a}),c&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[m||e.jsx(x.Medal,{className:"h-5 w-5 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:c})]})]})]}),e.jsxs("div",{className:"flex-1 grid grid-cols-2 md:grid-cols-4 gap-4",children:[p!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-orange-500/10",children:[e.jsx(x.Flame,{className:"h-6 w-6 text-orange-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:p}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Day Streak"})]}),o!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-purple-500/10",children:[e.jsx(x.Zap,{className:"h-6 w-6 text-purple-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:o.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total XP"})]}),b&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-blue-500/10",children:[e.jsx(x.Clock,{className:"h-6 w-6 text-blue-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Playtime"})]}),w!==void 0&&e.jsxs("div",{className:"text-center p-3 rounded-lg bg-green-500/10",children:[e.jsx(x.Users,{className:"h-6 w-6 text-green-500 mx-auto"}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Friends"})]})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx(GE,{current:n,max:l,level:r})}),f&&f.length>0&&e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Badges"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(N=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm",style:N.color?{backgroundColor:`${N.color}20`,color:N.color}:void 0,children:[N.icon,e.jsx("span",{children:N.name})]},N.id))})]})]})}),e.jsxs(rs,{defaultValue:"stats",className:"w-full",children:[e.jsxs(Ut,{className:"w-full justify-start",children:[e.jsx(dt,{value:"stats",children:"Stats"}),e.jsx(dt,{value:"achievements",children:"Achievements"}),e.jsx(dt,{value:"history",children:"Match History"})]}),e.jsx(ut,{value:"stats",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Player Statistics"}),e.jsx(Ze,{children:"Your performance metrics"})]}),e.jsx(fe,{children:u&&u.length>0?e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:u.map((N,k)=>e.jsx(qE,{stat:N},k))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No statistics available"})})]})}),e.jsx(ut,{value:"achievements",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Achievements"}),e.jsxs(Ze,{children:[h?.filter(N=>N.unlockedAt).length||0," / ",h?.length||0," unlocked"]})]}),e.jsx(fe,{children:h&&h.length>0?e.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:h.map(N=>e.jsx(XE,{achievement:N},N.id))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No achievements yet"})})]})}),e.jsx(ut,{value:"history",className:"mt-4",children:e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Match History"}),e.jsx(Ze,{children:"Your recent games"})]}),e.jsx(fe,{children:g&&g.length>0?e.jsx("div",{className:"space-y-3",children:g.map(N=>e.jsx(YE,{match:N},N.id))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No matches played yet"})})]})})]}),j&&e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[e.jsx(x.Calendar,{className:"h-4 w-4"}),e.jsxs("span",{children:["Member since ",typeof j=="string"?j:j.toLocaleDateString()]})]})]})}const KE=[{label:"Matches Played",value:342,icon:e.jsx(x.Gamepad2,{className:"h-5 w-5"}),color:"blue"},{label:"Wins",value:189,icon:e.jsx(x.Trophy,{className:"h-5 w-5"}),color:"green"},{label:"Win Rate",value:"55.3%",icon:e.jsx(x.TrendingUp,{className:"h-5 w-5"}),color:"yellow"},{label:"Best Score",value:"12,450",icon:e.jsx(x.Star,{className:"h-5 w-5"}),color:"purple"},{label:"Kills",value:"1,234",icon:e.jsx(x.Target,{className:"h-5 w-5"}),color:"red"},{label:"Assists",value:876,icon:e.jsx(x.Heart,{className:"h-5 w-5"}),color:"default"}],QE=[{id:"first-win",name:"First Victory",description:"Win your first match",rarity:"common",unlockedAt:new Date("2024-01-15"),icon:e.jsx(x.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:e.jsx(x.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:e.jsx(x.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:e.jsx(x.Users,{className:"h-6 w-6 text-purple-500"})}],JE=[{id:"beta",name:"Beta Tester",icon:e.jsx(x.Shield,{className:"h-4 w-4"}),color:"#3b82f6"},{id:"premium",name:"Premium",icon:e.jsx(x.Crown,{className:"h-4 w-4"}),color:"#f59e0b"},{id:"verified",name:"Verified",icon:e.jsx(x.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}],Bp={authenticator:{icon:e.jsx(x.Smartphone,{className:"h-5 w-5"}),title:"Authenticator App",description:"Use an app like Google Authenticator or Authy",recommended:!0},sms:{icon:e.jsx(x.MessageSquare,{className:"h-5 w-5"}),title:"SMS",description:"Receive codes via text message",recommended:!1},email:{icon:e.jsx(x.Mail,{className:"h-5 w-5"}),title:"Email",description:"Receive codes via email",recommended:!1},hardware:{icon:e.jsx(x.Key,{className:"h-5 w-5"}),title:"Hardware Key",description:"Use a physical security key (YubiKey, etc.)",recommended:!0}};function tR({methods:t,selected:s,onSelect:a}){return e.jsx(qa,{value:s,onValueChange:r=>a(r),children:e.jsx("div",{className:"space-y-3",children:t.map(r=>{const n=Bp[r];return e.jsxs(L.Label,{className:d.cn("flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors",s===r?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(Xa,{value:r}),e.jsx("div",{className:"h-10 w-10 rounded-lg bg-muted flex items-center justify-center",children:n.icon}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.title}),n.recommended&&e.jsx(ne,{variant:"secondary",className:"text-xs",children:"Recommended"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]})]},r)})})})}function Yu({length:t=6,value:s,onChange:a}){const r=i.useRef([]),n=s.padEnd(t,"").split("").slice(0,t),l=(m,u)=>{if(!/^\d*$/.test(u))return;const h=[...n];h[m]=u.slice(-1),a(h.join("")),u&&m<t-1&&r.current[m+1]?.focus()},o=(m,u)=>{u.key==="Backspace"&&!n[m]&&m>0&&r.current[m-1]?.focus()},c=m=>{m.preventDefault();const u=m.clipboardData.getData("text").replace(/\D/g,"").slice(0,t);a(u)};return e.jsx("div",{className:"flex gap-2 justify-center",children:n.map((m,u)=>e.jsx(L.Input,{ref:h=>{r.current[u]=h},type:"text",inputMode:"numeric",maxLength:1,value:m,onChange:h=>l(u,h.target.value),onKeyDown:h=>o(u,h),onPaste:c,className:"w-12 h-14 text-center text-2xl font-mono"},u))})}function sR({codes:t,onRegenerate:s,onDownload:a}){const[r,n]=i.useState(!1),[l,o]=i.useState(!1),c=()=>{const u=t.map(h=>h.code).join(`
2636
2636
  `);navigator.clipboard.writeText(u),n(!0),setTimeout(()=>n(!1),2e3)},m=t.filter(u=>!u.used);return e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.Key,{className:"h-5 w-5"}),"Backup Codes"]}),e.jsxs(Ze,{children:[m.length," of ",t.length," codes remaining"]})]}),e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:()=>o(!l),children:l?e.jsx(x.EyeOff,{className:"h-4 w-4"}):e.jsx(x.Eye,{className:"h-4 w-4"})})]})}),e.jsxs(fe,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.map((u,h)=>e.jsx("div",{className:d.cn("font-mono text-sm p-2 rounded border text-center",u.used?"bg-muted text-muted-foreground line-through":"bg-card"),children:l?u.code:"••••••••"},h))}),m.length<3&&e.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 flex items-center gap-3",children:[e.jsx(x.AlertTriangle,{className:"h-5 w-5 text-yellow-500"}),e.jsx("p",{className:"text-sm",children:"You're running low on backup codes. Consider regenerating them."})]})]}),e.jsxs(Ft,{className:"flex gap-2",children:[e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:c,children:[r?e.jsx(x.Check,{className:"h-4 w-4 mr-2"}):e.jsx(x.Copy,{className:"h-4 w-4 mr-2"}),r?"Copied":"Copy All"]}),a&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:a,children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Download"]}),s&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:s,children:[e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-2"}),"Regenerate"]})]})]})}function aR({status:t={enabled:!1},availableMethods:s=["authenticator","sms","email"],qrCodeUrl:a,secretKey:r,backupCodes:n,onEnable:l,onDisable:o,onRegenerateBackupCodes:c,onSendCode:m,className:u}){const[h,f]=i.useState("overview"),[g,p]=i.useState(s[0]),[j,b]=i.useState(""),[w,y]=i.useState(!1),[v,N]=i.useState(null),[k,S]=i.useState(!1),[C,M]=i.useState(!1),D=()=>{r&&(navigator.clipboard.writeText(r),S(!0),setTimeout(()=>S(!1),2e3))},A=async()=>{if(m){y(!0);try{await m(g),M(!0)}finally{y(!1)}}},T=async()=>{if(l){y(!0),N(null);try{await l(g,j)?(f("overview"),b("")):N("Invalid verification code. Please try again.")}finally{y(!1)}}},E=async()=>{if(o){y(!0),N(null);try{await o(j)?(f("overview"),b("")):N("Invalid verification code. Please try again.")}finally{y(!1)}}};return e.jsxs("div",{className:d.cn("space-y-6 max-w-2xl",u),children:[e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t.enabled?e.jsx("div",{className:"h-12 w-12 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(x.ShieldCheck,{className:"h-6 w-6 text-green-500"})}):e.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/10 flex items-center justify-center",children:e.jsx(x.ShieldAlert,{className:"h-6 w-6 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx(Ne,{children:"Two-Factor Authentication"}),e.jsx(Ze,{children:t.enabled?`Enabled via ${Bp[t.method]?.title}`:"Add an extra layer of security to your account"})]})]}),e.jsx(ne,{variant:t.enabled?"default":"secondary",children:t.enabled?"Enabled":"Disabled"})]})}),h==="overview"&&e.jsx(Ft,{children:t.enabled?e.jsxs("div",{className:"flex gap-2 w-full",children:[e.jsx(L.Button,{variant:"outline",className:"flex-1",onClick:()=>f("setup"),children:"Change Method"}),e.jsx(L.Button,{variant:"destructive",className:"flex-1",onClick:()=>f("disable"),children:"Disable 2FA"})]}):e.jsxs(L.Button,{className:"w-full",onClick:()=>f("setup"),children:[e.jsx(x.Shield,{className:"h-4 w-4 mr-2"}),"Enable Two-Factor Authentication"]})})]}),h==="setup"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:"Choose Authentication Method"}),e.jsx(Ze,{children:"Select how you want to receive verification codes"})]}),e.jsx(fe,{children:e.jsx(tR,{methods:s,selected:g,onSelect:p})}),e.jsxs(Ft,{className:"flex gap-2",children:[e.jsx(L.Button,{variant:"outline",onClick:()=>f("overview"),children:"Cancel"}),e.jsxs(L.Button,{className:"flex-1",onClick:()=>f("verify"),children:["Continue",e.jsx(x.ChevronRight,{className:"h-4 w-4 ml-2"})]})]})]}),h==="verify"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{children:g==="authenticator"?"Set Up Authenticator":"Verify Your Identity"}),e.jsx(Ze,{children:g==="authenticator"?"Scan the QR code with your authenticator app":`Enter the code sent to your ${g}`})]}),e.jsxs(fe,{className:"space-y-6",children:[g==="authenticator"&&e.jsxs(e.Fragment,{children:[a&&e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"p-4 bg-white rounded-lg",children:e.jsx("img",{src:a,alt:"QR Code",className:"h-48 w-48"})})}),r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Or enter this code manually:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L.Input,{value:r,readOnly:!0,className:"font-mono"}),e.jsx(L.Button,{variant:"outline",size:"icon",onClick:D,children:k?e.jsx(x.Check,{className:"h-4 w-4"}):e.jsx(x.Copy,{className:"h-4 w-4"})})]})]}),e.jsx(L.Separator,{})]}),(g==="sms"||g==="email")&&!C&&e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["We'll send a verification code to your ",g==="sms"?"phone":"email"]}),e.jsxs(L.Button,{onClick:A,disabled:w,children:[w?e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-2 animate-spin"}):g==="sms"?e.jsx(x.MessageSquare,{className:"h-4 w-4 mr-2"}):e.jsx(x.Mail,{className:"h-4 w-4 mr-2"}),"Send Code"]})]}),(g==="authenticator"||C)&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(L.Label,{className:"text-center block",children:"Enter the 6-digit code"}),e.jsx(Yu,{value:j,onChange:b}),v&&e.jsx("p",{className:"text-sm text-destructive text-center",children:v})]})]}),e.jsxs(Ft,{className:"flex gap-2",children:[e.jsx(L.Button,{variant:"outline",onClick:()=>f("setup"),children:"Back"}),e.jsxs(L.Button,{className:"flex-1",onClick:T,disabled:j.length!==6||w,children:[w?e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(x.Lock,{className:"h-4 w-4 mr-2"}),"Verify & Enable"]})]})]}),h==="disable"&&e.jsxs(me,{children:[e.jsxs(we,{children:[e.jsx(Ne,{className:"text-destructive",children:"Disable Two-Factor Authentication"}),e.jsx(Ze,{children:"Enter your verification code to confirm. This will make your account less secure."})]}),e.jsxs(fe,{className:"space-y-4",children:[e.jsx("div",{className:"p-4 rounded-lg bg-destructive/10 border border-destructive/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x.AlertTriangle,{className:"h-5 w-5 text-destructive mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-destructive",children:"Warning"}),e.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."})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L.Label,{children:"Enter your verification code"}),e.jsx(Yu,{value:j,onChange:b}),v&&e.jsx("p",{className:"text-sm text-destructive text-center",children:v})]})]}),e.jsxs(Ft,{className:"flex gap-2",children:[e.jsx(L.Button,{variant:"outline",onClick:()=>f("overview"),children:"Cancel"}),e.jsxs(L.Button,{variant:"destructive",className:"flex-1",onClick:E,disabled:j.length!==6||w,children:[w?e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(x.ShieldAlert,{className:"h-4 w-4 mr-2"}),"Disable 2FA"]})]})]}),t.enabled&&n&&n.length>0&&h==="overview"&&e.jsx(sR,{codes:n,onRegenerate:c,onDownload:()=>{const I=n.map(F=>F.code).join(`
2637
2637
  `),$=new Blob([I],{type:"text/plain"}),P=URL.createObjectURL($),R=document.createElement("a");R.href=P,R.download="backup-codes.txt",R.click()}}),e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[e.jsx(x.Fingerprint,{className:"h-5 w-5"}),"Security Tips"]})}),e.jsxs(fe,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x.Check,{className:"h-4 w-4 text-green-500 mt-1"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use an authenticator app for the most secure experience"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x.Check,{className:"h-4 w-4 text-green-500 mt-1"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Store your backup codes in a safe place (password manager, safe deposit box)"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(x.Check,{className:"h-4 w-4 text-green-500 mt-1"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Never share your verification codes with anyone"})]})]})]})]})}const rR=[{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")},zp={online:"bg-green-500",offline:"bg-gray-400",away:"bg-yellow-500",busy:"bg-red-500"};function Wp({user:t,size:s="md"}){const a={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};return e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{className:a[s],children:[e.jsx(st,{src:t.avatar,alt:t.name}),e.jsx(at,{children:t.name.slice(0,2).toUpperCase()})]}),t.status&&e.jsx("div",{className:d.cn("absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background",zp[t.status])})]})}function lR({conversation:t,currentUserId:s,isSelected:a,onClick:r}){const n=t.participants.find(c=>c.id!==s),l=t.isGroup?t.groupName:n?.name,o=t.isGroup?t.groupAvatar:n?.avatar;return e.jsxs("button",{onClick:r,className:d.cn("w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left",a?"bg-primary/10":"hover:bg-muted/50"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{children:[e.jsx(st,{src:o}),e.jsx(at,{children:l?.slice(0,2).toUpperCase()})]}),!t.isGroup&&n?.status&&e.jsx("div",{className:d.cn("absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background",zp[n.status])})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:l}),t.lastMessage&&e.jsx("span",{className:"text-xs text-muted-foreground",children:typeof t.lastMessage.timestamp=="string"?t.lastMessage.timestamp:Op(t.lastMessage.timestamp)})]}),t.lastMessage&&e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.lastMessage.content})]}),t.unreadCount&&t.unreadCount>0&&e.jsx(ne,{className:"h-5 w-5 p-0 flex items-center justify-center rounded-full",children:t.unreadCount}),t.isPinned&&e.jsx(x.Pin,{className:"h-3 w-3 text-muted-foreground"})]})}function oR({message:t,isOwn:s,sender:a,showAvatar:r}){const n={sending:e.jsx(x.Clock,{className:"h-3 w-3"}),sent:e.jsx(x.Check,{className:"h-3 w-3"}),delivered:e.jsx(x.CheckCheck,{className:"h-3 w-3"}),read:e.jsx(x.CheckCheck,{className:"h-3 w-3 text-blue-500"})};return e.jsxs("div",{className:d.cn("flex gap-2 max-w-[80%]",s?"ml-auto flex-row-reverse":""),children:[r&&a&&!s&&e.jsx(Wp,{user:a,size:"sm"}),!r&&!s&&e.jsx("div",{className:"w-8"}),e.jsxs("div",{className:"space-y-1",children:[!s&&r&&a&&e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:a.name}),e.jsxs("div",{className:d.cn("rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-br-md":"bg-muted rounded-bl-md"),children:[t.replyTo&&e.jsxs("div",{className:d.cn("text-xs mb-1 pb-1 border-b",s?"border-primary-foreground/20":"border-border"),children:[e.jsx(x.Reply,{className:"h-3 w-3 inline mr-1"}),"Reply to message"]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.content}),t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"mt-2 space-y-2",children:t.attachments.map(l=>e.jsxs("div",{className:"flex items-center gap-2",children:[l.type==="image"?e.jsx(x.Image,{className:"h-4 w-4"}):e.jsx(x.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs truncate",children:l.name})]},l.id))})]}),e.jsxs("div",{className:d.cn("flex items-center gap-1 text-xs text-muted-foreground",s?"justify-end":""),children:[e.jsx("span",{children:typeof t.timestamp=="string"?t.timestamp:Op(t.timestamp)}),s&&t.status&&n[t.status]]}),t.reactions&&t.reactions.length>0&&e.jsx("div",{className:"flex gap-1 mt-1",children:Array.from(new Set(t.reactions.map(l=>l.emoji))).map(l=>e.jsxs("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:[l," ",t.reactions.filter(o=>o.emoji===l).length]},l))})]})]})}function iR({users:t}){if(t.length===0)return null;const s=t.map(a=>a.name).join(", ");return e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx(x.Circle,{className:"h-2 w-2 animate-bounce",style:{animationDelay:"0ms"}}),e.jsx(x.Circle,{className:"h-2 w-2 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx(x.Circle,{className:"h-2 w-2 animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsxs("span",{children:[s," ",t.length===1?"is":"are"," typing..."]})]})}function Op(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function cR({currentUser:t,conversations:s=[],selectedConversation:a,messages:r=[],onSendMessage:n,onSelectConversation:l,onTyping:o,typingUsers:c=[],showSidebar:m=!0,className:u}){const[h,f]=i.useState(""),[g,p]=i.useState(""),j=i.useRef(null),b=()=>{j.current?.scrollIntoView({behavior:"smooth"})};i.useEffect(()=>{b()},[r]);const w=()=>{!h.trim()||!n||(n(h.trim()),f(""))},y=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),w())},v=s.filter(C=>{if(!g)return!0;const M=C.participants.find(A=>A.id!==t.id);return(C.isGroup?C.groupName:M?.name)?.toLowerCase().includes(g.toLowerCase())}),N=a?.participants.find(C=>C.id!==t.id),k=a?.isGroup?a.groupName:N?.name,S=r.reduce((C,M,D)=>{const A=r[D-1],T=!A||A.senderId!==M.senderId;return C.push({message:M,showAvatar:T}),C},[]);return e.jsxs("div",{className:d.cn("flex h-[600px] rounded-lg border overflow-hidden",u),children:[m&&e.jsxs("div",{className:"w-80 border-r flex flex-col bg-card",children:[e.jsxs("div",{className:"p-4 border-b",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"font-semibold text-lg",children:"Messages"}),e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Search conversations...",value:g,onChange:C=>p(C.target.value),className:"pl-9"})]})]}),e.jsx(Ie,{className:"flex-1",children:e.jsx("div",{className:"p-2 space-y-1",children:v.map(C=>e.jsx(lR,{conversation:C,currentUserId:t.id,isSelected:a?.id===C.id,onClick:()=>l?.(C)},C.id))})})]}),e.jsx("div",{className:"flex-1 flex flex-col",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-16 border-b flex items-center justify-between px-4 bg-card",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsx(Wp,{user:N}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:k}),N?.status&&e.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:N.status==="online"?"Online":`Last seen ${N.lastSeen||"recently"}`})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.Phone,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.Video,{className:"h-4 w-4"})}),e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})]})]}),e.jsxs(Ie,{className:"flex-1 p-4",children:[e.jsxs("div",{className:"space-y-4",children:[S.map(({message:C,showAvatar:M})=>e.jsx(oR,{message:C,isOwn:C.senderId===t.id,sender:a.participants.find(D=>D.id===C.senderId),showAvatar:M},C.id)),e.jsx("div",{ref:j})]}),c.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(iR,{users:c})})]}),e.jsx("div",{className:"p-4 border-t bg-card",children:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.Paperclip,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1",children:e.jsx(L.Input,{placeholder:"Type a message...",value:h,onChange:C=>{f(C.target.value),o?.()},onKeyDown:y,className:"rounded-full"})}),e.jsx(L.Button,{variant:"ghost",size:"icon",children:e.jsx(x.Smile,{className:"h-4 w-4"})}),e.jsx(L.Button,{size:"icon",onClick:w,disabled:!h.trim(),children:e.jsx(x.Send,{className:"h-4 w-4"})})]})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:e.jsx(x.Send,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h3",{className:"font-medium text-lg",children:"Your Messages"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Select a conversation to start chatting"})]})})})]})}const qt=[{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"}],dR=[{id:"conv1",participants:[qt[0],qt[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:[qt[0],qt[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:[qt[0],qt[1],qt[2],qt[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"}],mo={pending:{color:"text-yellow-500 bg-yellow-500/10",icon:e.jsx(x.Clock,{className:"h-4 w-4"}),label:"Pending"},building:{color:"text-blue-500 bg-blue-500/10",icon:e.jsx(x.Loader2,{className:"h-4 w-4 animate-spin"}),label:"Building"},deploying:{color:"text-purple-500 bg-purple-500/10",icon:e.jsx(x.Rocket,{className:"h-4 w-4 animate-pulse"}),label:"Deploying"},success:{color:"text-green-500 bg-green-500/10",icon:e.jsx(x.CheckCircle,{className:"h-4 w-4"}),label:"Success"},failed:{color:"text-red-500 bg-red-500/10",icon:e.jsx(x.XCircle,{className:"h-4 w-4"}),label:"Failed"},cancelled:{color:"text-gray-500 bg-gray-500/10",icon:e.jsx(x.XCircle,{className:"h-4 w-4"}),label:"Cancelled"},rollback:{color:"text-orange-500 bg-orange-500/10",icon:e.jsx(x.RotateCcw,{className:"h-4 w-4"}),label:"Rollback"}},Up={development:{color:"text-blue-500 border-blue-500/30 bg-blue-500/10",icon:e.jsx(x.Terminal,{className:"h-4 w-4"})},staging:{color:"text-yellow-500 border-yellow-500/30 bg-yellow-500/10",icon:e.jsx(x.Server,{className:"h-4 w-4"})},production:{color:"text-green-500 border-green-500/30 bg-green-500/10",icon:e.jsx(x.Globe,{className:"h-4 w-4"})}};function lc({status:t}){const s=mo[t];return e.jsxs(ne,{variant:"outline",className:d.cn("gap-1",s.color),children:[s.icon,s.label]})}function mR({environment:t}){const s=Up[t];return e.jsxs(ne,{variant:"outline",className:d.cn("gap-1 capitalize",s.color),children:[s.icon,t]})}function xR({deployment:t,onRollback:s,onCancel:a,onRetry:r}){const n=t.status==="building"||t.status==="deploying",l=t.status==="success"&&t.environment==="production",o=t.status==="failed",c=n;return e.jsx("div",{className:"p-4 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs(tt,{className:"h-10 w-10",children:[e.jsx(st,{src:t.author.avatar}),e.jsx(at,{children:t.author.name.slice(0,2).toUpperCase()})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(lc,{status:t.status}),e.jsx(mR,{environment:t.environment})]}),e.jsx("p",{className:"text-sm mt-1 line-clamp-1",children:t.commitMessage}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.GitBranch,{className:"h-3 w-3"}),t.branch]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.GitCommit,{className:"h-3 w-3"}),t.commit.slice(0,7)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-3 w-3"}),typeof t.startedAt=="string"?t.startedAt:oc(t.startedAt)]}),t.duration&&e.jsx("span",{children:t.duration})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[t.url&&e.jsx(L.Button,{variant:"ghost",size:"icon",asChild:!0,children:e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(x.ExternalLink,{className:"h-4 w-4"})})}),c&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:a,children:e.jsx(x.Pause,{className:"h-4 w-4"})}),o&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})}),l&&e.jsx(L.Button,{variant:"ghost",size:"icon",onClick:s,children:e.jsx(x.RotateCcw,{className:"h-4 w-4"})})]})]})})}function hR({pipeline:t}){const a=t.stages.filter(r=>r.status==="success").length/t.stages.length*100;return e.jsxs(me,{children:[e.jsxs(we,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(lc,{status:t.status}),e.jsx("span",{className:"font-medium",children:t.name})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:typeof t.startedAt=="string"?t.startedAt:oc(t.startedAt)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(x.GitBranch,{className:"h-3 w-3"}),t.branch,e.jsx("span",{className:"mx-1",children:"•"}),"Triggered by ",t.trigger]})]}),e.jsx(fe,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(Be,{value:a,className:"h-2"}),e.jsx("div",{className:"flex items-center justify-between",children:t.stages.map((r,n)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:d.cn("h-8 w-8 rounded-full flex items-center justify-center",mo[r.status].color),children:mo[r.status].icon}),e.jsx("span",{className:"text-xs",children:r.name}),r.duration&&e.jsx("span",{className:"text-xs text-muted-foreground",children:r.duration})]}),n<t.stages.length-1&&e.jsx(x.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})]},r.id))})]})})]})}function fR({env:t}){const s={healthy:"text-green-500",degraded:"text-yellow-500",down:"text-red-500"},a={healthy:e.jsx(x.CheckCircle,{className:"h-5 w-5"}),degraded:e.jsx(x.AlertCircle,{className:"h-5 w-5"}),down:e.jsx(x.XCircle,{className:"h-5 w-5"})};return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ne,{className:"capitalize flex items-center gap-2",children:[Up[t.name].icon,t.name]}),e.jsxs("div",{className:d.cn("flex items-center gap-1",s[t.status]),children:[a[t.status],e.jsx("span",{className:"text-sm capitalize",children:t.status})]})]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(x.ExternalLink,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:t.url})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[t.uptime&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Uptime"}),e.jsx("p",{className:"font-medium",children:t.uptime})]}),t.responseTime&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Response Time"}),e.jsx("p",{className:"font-medium",children:t.responseTime})]})]}),t.lastDeployment&&e.jsxs("div",{className:"pt-2 border-t",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Last Deployment"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(lc,{status:t.lastDeployment.status}),e.jsx("span",{className:"text-muted-foreground",children:typeof t.lastDeployment.startedAt=="string"?t.lastDeployment.startedAt:oc(t.lastDeployment.startedAt)})]})]})]})]})}function oc(t){const a=new Date().getTime()-t.getTime(),r=Math.floor(a/6e4),n=Math.floor(r/60),l=Math.floor(n/24);return r<1?"just now":r<60?`${r}m ago`:n<24?`${n}h ago`:`${l}d ago`}function gR({deployments:t=[],pipelines:s=[],environments:a=[],onDeploy:r,onRollback:n,onCancel:l,onRetry:o,branches:c=["main","develop","staging"],className:m}){const[u,h]=i.useState(c[0]),[f,g]=i.useState("staging"),p=t.filter(j=>j.status==="building"||j.status==="deploying");return e.jsxs("div",{className:d.cn("space-y-6",m),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Deployments"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage and monitor your deployments"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ee,{value:u,onValueChange:h,children:[e.jsxs($e,{className:"w-[160px]",children:[e.jsx(x.GitBranch,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsx(Ae,{children:c.map(j=>e.jsx(xe,{value:j,children:j},j))})]}),e.jsxs(Ee,{value:f,onValueChange:j=>g(j),children:[e.jsxs($e,{className:"w-[160px]",children:[e.jsx(x.Server,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"development",children:"Development"}),e.jsx(xe,{value:"staging",children:"Staging"}),e.jsx(xe,{value:"production",children:"Production"})]})]}),e.jsxs(L.Button,{onClick:()=>r?.(f,u),children:[e.jsx(x.Rocket,{className:"h-4 w-4 mr-2"}),"Deploy"]})]})]}),p.length>0&&e.jsx(me,{className:"border-blue-500/50 bg-blue-500/5",children:e.jsx(fe,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-blue-500/10 flex items-center justify-center",children:e.jsx(x.Rocket,{className:"h-5 w-5 text-blue-500 animate-pulse"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[p.length," deployment",p.length>1?"s":""," in progress"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p.map(j=>j.environment).join(", ")})]})]})})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:a.map(j=>e.jsx(fR,{env:j},j.name))}),e.jsxs(rs,{defaultValue:"deployments",className:"w-full",children:[e.jsxs(Ut,{children:[e.jsx(dt,{value:"deployments",children:"Recent Deployments"}),e.jsx(dt,{value:"pipelines",children:"Pipelines"})]}),e.jsx(ut,{value:"deployments",className:"mt-4 space-y-3",children:t.length>0?t.map(j=>e.jsx(xR,{deployment:j,onRollback:()=>n?.(j.id),onCancel:()=>l?.(j.id),onRetry:()=>o?.(j.id)},j.id)):e.jsx(me,{children:e.jsxs(fe,{className:"py-12 text-center",children:[e.jsx(x.Rocket,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No deployments yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Deploy your first version to get started"})]})})}),e.jsx(ut,{value:"pipelines",className:"mt-4 space-y-4",children:s.length>0?s.map(j=>e.jsx(hR,{pipeline:j},j.id)):e.jsx(me,{children:e.jsxs(fe,{className:"py-12 text-center",children:[e.jsx(x.Activity,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No active pipelines"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pipelines will appear here when triggered"})]})})})]})]})}const _p=[{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"}],pR=[{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"}]}],bR=[{name:"production",status:"healthy",url:"https://app.example.com",uptime:"99.9%",responseTime:"120ms",lastDeployment:_p[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"}],xo={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"}},ho={triggered:{label:"Triggered",color:"text-red-500",icon:x.AlertCircle},acknowledged:{label:"Acknowledged",color:"text-orange-500",icon:x.Bell},investigating:{label:"Investigating",color:"text-yellow-500",icon:x.Search},identified:{label:"Identified",color:"text-blue-500",icon:x.Activity},resolved:{label:"Resolved",color:"text-green-500",icon:x.CheckCircle2},closed:{label:"Closed",color:"text-gray-500",icon:x.XCircle}};function jR(t,s){const a=(s||new Date).getTime()-t.getTime(),r=Math.floor(a/6e4),n=Math.floor(r/60),l=Math.floor(n/24);return l>0?`${l}d ${n%24}h`:n>0?`${n}h ${r%60}m`:`${r}m`}function vR(t){return t.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}function yR({incident:t,onAcknowledge:s,onResolve:a,onSelect:r}){const n=xo[t.severity],l=ho[t.status],o=l.icon,c=!["resolved","closed"].includes(t.status);return e.jsx(me,{className:d.cn("cursor-pointer transition-all hover:shadow-md",t.severity==="critical"&&c&&"border-red-500/50 bg-red-500/5",t.severity==="high"&&c&&"border-orange-500/30"),onClick:r,children:e.jsx(fe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:d.cn("p-2 rounded-lg shrink-0",`${n.bgColor}/10`),children:e.jsx(x.AlertTriangle,{className:d.cn("h-5 w-5",n.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(ne,{className:d.cn("text-white text-xs",n.bgColor),children:n.label}),e.jsxs(ne,{variant:"outline",className:d.cn("text-xs",l.color),children:[e.jsx(o,{className:"h-3 w-3 mr-1"}),l.label]}),t.service&&e.jsx(ne,{variant:"secondary",className:"text-xs",children:t.service})]}),e.jsx("h4",{className:"font-semibold mt-2 truncate",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-3 w-3"}),jR(t.createdAt,t.resolvedAt)]}),t.affectedUsers!==void 0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Users,{className:"h-3 w-3"}),t.affectedUsers," affected"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.MessageSquare,{className:"h-3 w-3"}),t.events.length]})]}),t.responders.length>0&&e.jsx("div",{className:"flex items-center gap-2 mt-3",children:e.jsxs("div",{className:"flex -space-x-2",children:[t.responders.slice(0,3).map(m=>e.jsxs(tt,{className:"h-6 w-6 border-2 border-background",children:[e.jsx(st,{src:m.avatar}),e.jsx(at,{className:"text-xs",children:m.name.slice(0,2).toUpperCase()})]},m.id)),t.responders.length>3&&e.jsxs("div",{className:"h-6 w-6 rounded-full bg-muted flex items-center justify-center text-xs border-2 border-background",children:["+",t.responders.length-3]})]})})]}),c&&e.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[t.status==="triggered"&&s&&e.jsx(L.Button,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:m=>{m.stopPropagation(),s()},children:"Ack"}),t.status!=="triggered"&&t.status!=="resolved"&&a&&e.jsx(L.Button,{size:"sm",variant:"outline",className:"h-7 text-xs text-green-500",onClick:m=>{m.stopPropagation(),a()},children:"Resolve"})]})]})})})}function wR({incidents:t}){const s=t.filter(n=>!["resolved","closed"].includes(n.status)),a=s.filter(n=>n.severity==="critical"),r=i.useMemo(()=>{const n=t.filter(o=>o.resolvedAt);if(n.length===0)return 0;const l=n.reduce((o,c)=>o+(c.resolvedAt.getTime()-c.createdAt.getTime()),0);return Math.round(l/n.length/6e4)},[t]);return e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-red-500",children:s.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Active Incidents"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-orange-500",children:a.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Critical"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsxs("div",{className:"text-3xl font-bold",children:[r,"m"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Avg MTTR"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-green-500",children:t.filter(n=>n.status==="resolved").length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Resolved Today"})]})})]})}function NR({incidents:t,onCreateIncident:s,onAcknowledge:a,onResolve:r,onEscalate:n,onAssign:l,className:o}){const[c,m]=i.useState(""),[u,h]=i.useState("all"),[f,g]=i.useState("active"),[p,j]=i.useState(null),b=i.useMemo(()=>t.filter(w=>!(c&&!w.title.toLowerCase().includes(c.toLowerCase())||u!=="all"&&w.severity!==u||f==="active"&&["resolved","closed"].includes(w.status)||f==="resolved"&&!["resolved","closed"].includes(w.status))).sort((w,y)=>{const v={critical:0,high:1,medium:2,low:3},N=v[w.severity]-v[y.severity];return N!==0?N:y.createdAt.getTime()-w.createdAt.getTime()}),[t,c,u,f]);return e.jsxs("div",{className:d.cn("flex flex-col gap-6",o),children:[e.jsx(wR,{incidents:t}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Search incidents...",value:c,onChange:w=>m(w.target.value),className:"pl-9"})]}),e.jsxs(Ee,{value:u,onValueChange:w=>h(w),children:[e.jsx($e,{className:"w-32",children:e.jsx(Re,{placeholder:"Severity"})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Severity"}),e.jsx(xe,{value:"critical",children:"Critical"}),e.jsx(xe,{value:"high",children:"High"}),e.jsx(xe,{value:"medium",children:"Medium"}),e.jsx(xe,{value:"low",children:"Low"})]})]}),e.jsxs(Ee,{value:f,onValueChange:w=>g(w),children:[e.jsx($e,{className:"w-32",children:e.jsx(Re,{placeholder:"Status"})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"active",children:"Active"}),e.jsx(xe,{value:"resolved",children:"Resolved"}),e.jsx(xe,{value:"all",children:"All"})]})]}),s&&e.jsxs(L.Button,{onClick:s,children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Create Incident"]})]}),e.jsx(Ie,{className:"h-[600px]",children:e.jsx("div",{className:"space-y-3 pr-4",children:b.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground",children:[e.jsx(x.Shield,{className:"h-12 w-12 mb-4 text-green-500"}),e.jsx("p",{className:"text-lg font-medium",children:"No incidents"}),e.jsx("p",{className:"text-sm",children:"All systems are operational"})]}):b.map(w=>e.jsx(yR,{incident:w,onAcknowledge:a?()=>a(w):void 0,onResolve:r?()=>r(w):void 0,onSelect:()=>j(w)},w.id))})})]}),p&&e.jsxs(me,{className:"w-96 shrink-0",children:[e.jsxs(we,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ne,{className:d.cn("text-white",xo[p.severity].bgColor),children:xo[p.severity].label}),e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:()=>j(null),children:e.jsx(x.XCircle,{className:"h-4 w-4"})})]}),e.jsx(Ne,{className:"mt-2",children:p.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(ne,{variant:"outline",className:ho[p.status].color,children:ho[p.status].label}),p.service&&e.jsx(ne,{variant:"secondary",children:p.service})]})]}),e.jsxs(fe,{className:"space-y-4",children:[p.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p.description}),p.impact&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Impact"}),e.jsx("p",{className:"text-sm",children:p.impact})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Timeline"}),e.jsx("div",{className:"space-y-2",children:p.events.slice(0,5).map(w=>e.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:vR(w.timestamp)}),e.jsx("span",{children:w.content})]},w.id))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Responders"}),e.jsx("div",{className:"space-y-2",children:p.responders.map(w=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(tt,{className:"h-6 w-6",children:[e.jsx(st,{src:w.avatar}),e.jsx(at,{className:"text-xs",children:w.name.slice(0,2).toUpperCase()})]}),e.jsx("span",{className:"text-sm",children:w.name}),e.jsx(ne,{variant:"outline",className:"text-xs ml-auto",children:w.role})]},w.id))})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-2 border-t",children:[p.slackChannel&&e.jsxs(L.Button,{variant:"outline",size:"sm",className:"justify-start",children:[e.jsx(x.MessageSquare,{className:"h-4 w-4 mr-2"}),"Join #",p.slackChannel]}),p.runbookUrl&&e.jsxs(L.Button,{variant:"outline",size:"sm",className:"justify-start",children:[e.jsx(x.ExternalLink,{className:"h-4 w-4 mr-2"}),"View Runbook"]}),n&&!["resolved","closed"].includes(p.status)&&e.jsxs(L.Button,{variant:"outline",size:"sm",className:"justify-start text-orange-500",onClick:()=>n(p),children:[e.jsx(x.Phone,{className:"h-4 w-4 mr-2"}),"Escalate"]})]})]})]})]})]})}const kR=[{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"}]}],Vp={region:{icon:x.Globe,color:"text-blue-500",label:"Region"},vpc:{icon:x.Network,color:"text-purple-500",label:"VPC"},subnet:{icon:x.Layers,color:"text-indigo-500",label:"Subnet"},server:{icon:x.Server,color:"text-gray-500",label:"Server"},database:{icon:x.Database,color:"text-green-500",label:"Database"},loadbalancer:{icon:x.Activity,color:"text-cyan-500",label:"Load Balancer"},cache:{icon:x.HardDrive,color:"text-red-500",label:"Cache"},storage:{icon:x.HardDrive,color:"text-orange-500",label:"Storage"},container:{icon:x.Container,color:"text-blue-400",label:"Container"},function:{icon:x.Cpu,color:"text-yellow-500",label:"Function"},cdn:{icon:x.Globe,color:"text-teal-500",label:"CDN"},firewall:{icon:x.Shield,color:"text-red-400",label:"Firewall"}},Hp={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"}},Zu={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 CR({resource:t,depth:s=0,onClick:a,isExpanded:r,onToggle:n}){const l=Vp[t.type],o=Hp[t.status],c=l.icon,m=t.children&&t.children.length>0;return e.jsx("div",{className:d.cn("border-l-2",s>0&&"ml-6",o.color.replace("text-","border-")),children:e.jsxs("div",{className:d.cn("flex items-center gap-3 p-3 cursor-pointer rounded-r-lg transition-all","hover:bg-muted/50",t.status==="critical"&&"bg-red-500/5",t.status==="warning"&&"bg-yellow-500/5"),onClick:a,children:[m&&e.jsx("button",{className:"p-1 hover:bg-muted rounded",onClick:u=>{u.stopPropagation(),n?.()},children:e.jsx(x.Layers,{className:d.cn("h-4 w-4",r&&"rotate-90")})}),e.jsx("div",{className:d.cn("p-2 rounded-lg bg-muted/50"),children:e.jsx(c,{className:d.cn("h-5 w-5",l.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:t.name}),e.jsx(ne,{variant:"outline",className:"text-xs shrink-0",children:l.label}),t.provider&&e.jsx(ne,{variant:"secondary",className:d.cn("text-xs shrink-0",Zu[t.provider].color),children:Zu[t.provider].label})]}),t.region&&e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:t.region})]}),t.metrics&&e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[t.metrics.cpu!==void 0&&e.jsxs("span",{className:d.cn(t.metrics.cpu>80&&"text-red-500"),children:["CPU: ",t.metrics.cpu,"%"]}),t.metrics.memory!==void 0&&e.jsxs("span",{className:d.cn(t.metrics.memory>80&&"text-red-500"),children:["MEM: ",t.metrics.memory,"%"]}),t.metrics.latency!==void 0&&e.jsxs("span",{className:d.cn(t.metrics.latency>500&&"text-yellow-500"),children:[t.metrics.latency,"ms"]})]}),e.jsx(He,{children:e.jsxs(Ge,{children:[e.jsx(qe,{children:e.jsx("div",{className:d.cn("w-3 h-3 rounded-full shrink-0",o.bgColor)})}),e.jsx(Oe,{children:o.label})]})})]})})}function Gp({resources:t,depth:s=0,expandedIds:a,onToggle:r,onResourceClick:n}){return e.jsx("div",{className:d.cn(s>0&&"ml-4"),children:t.map(l=>e.jsxs(i.Fragment,{children:[e.jsx(CR,{resource:l,depth:s,onClick:()=>n?.(l),isExpanded:a.has(l.id),onToggle:()=>r(l.id)}),a.has(l.id)&&l.children&&e.jsx(Gp,{resources:l.children,depth:s+1,expandedIds:a,onToggle:r,onResourceClick:n})]},l.id))})}function SR({resources:t,onResourceClick:s}){const a=n=>n.reduce((l,o)=>(l.push(o),o.children&&l.push(...a(o.children)),l),[]),r=a(t);return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:r.map(n=>{const l=Vp[n.type],o=Hp[n.status],c=l.icon;return e.jsx(me,{className:d.cn("cursor-pointer transition-all hover:shadow-md",n.status==="critical"&&"border-red-500/50",n.status==="warning"&&"border-yellow-500/50"),onClick:()=>s?.(n),children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:d.cn("p-2 rounded-lg",`${l.color.replace("text-","bg-")}/10`),children:e.jsx(c,{className:d.cn("h-5 w-5",l.color)})}),e.jsx("div",{className:d.cn("w-2 h-2 rounded-full",o.bgColor)})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"font-medium truncate",children:n.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l.label})]}),n.metrics&&e.jsx("div",{className:"flex items-center gap-2 mt-2 text-xs",children:n.metrics.cpu!==void 0&&e.jsxs("span",{className:d.cn(n.metrics.cpu>80&&"text-red-500"),children:[n.metrics.cpu,"%"]})})]})},n.id)})})}function MR({resources:t}){const s=i.useMemo(()=>{let a=0,r=0,n=0,l=0;const o=c=>{c.forEach(m=>{a++,m.status==="healthy"&&r++,m.status==="warning"&&n++,m.status==="critical"&&l++,m.children&&o(m.children)})};return o(t),{total:a,healthy:r,warning:n,critical:l}},[t]);return e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Box,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:s.total}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"Resources"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.CheckCircle2,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"font-medium text-green-500",children:s.healthy})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium text-yellow-500",children:s.warning})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4 text-red-500"}),e.jsx("span",{className:"font-medium text-red-500",children:s.critical})]})]})}function TR({resources:t,onResourceClick:s,onRefresh:a,showConnections:r=!1,viewMode:n="tree",className:l}){const[o,c]=i.useState(n),[m,u]=i.useState(()=>new Set(t.map(w=>w.id))),[h,f]=i.useState("all"),g=w=>{u(y=>{const v=new Set(y);return v.has(w)?v.delete(w):v.add(w),v})},p=()=>{const w=new Set,y=v=>{v.forEach(N=>{w.add(N.id),N.children&&y(N.children)})};y(t),u(w)},j=()=>{u(new Set)},b=i.useMemo(()=>{if(h==="all")return t;const w=y=>y.filter(v=>{const N=v.children?.some(k=>w([k]).length>0);return v.status===h||N}).map(v=>({...v,children:v.children?w(v.children):void 0}));return w(t)},[t,h]);return e.jsxs(me,{className:l,children:[e.jsx(we,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Cloud,{className:"h-5 w-5"}),e.jsx(Ne,{children:"Infrastructure Map"})]}),e.jsx(MR,{resources:t})]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ee,{value:o,onValueChange:w=>c(w),children:[e.jsx($e,{className:"w-28",children:e.jsx(Re,{})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"tree",children:"Tree View"}),e.jsx(xe,{value:"grid",children:"Grid View"})]})]}),e.jsxs(Ee,{value:h,onValueChange:w=>f(w),children:[e.jsxs($e,{className:"w-32",children:[e.jsx(x.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{placeholder:"Status"})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Status"}),e.jsx(xe,{value:"healthy",children:"Healthy"}),e.jsx(xe,{value:"warning",children:"Warning"}),e.jsx(xe,{value:"critical",children:"Critical"}),e.jsx(xe,{value:"maintenance",children:"Maintenance"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o==="tree"&&e.jsxs(e.Fragment,{children:[e.jsxs(L.Button,{variant:"ghost",size:"sm",onClick:p,children:[e.jsx(x.Maximize2,{className:"h-4 w-4 mr-1"}),"Expand"]}),e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:j,children:"Collapse"})]}),a&&e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:a,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"min-h-[400px]",children:b.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground",children:[e.jsx(x.Cloud,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"No resources found"})]}):o==="tree"?e.jsx(Gp,{resources:b,expandedIds:m,onToggle:g,onResourceClick:s}):e.jsx(SR,{resources:b,onResourceClick:s})})]})]})}const DR=[{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}}]}]}],fn={build:{icon:x.Box,color:"text-blue-500",label:"Build"},test:{icon:x.TestTube,color:"text-purple-500",label:"Test"},deploy:{icon:x.Rocket,color:"text-green-500",label:"Deploy"},script:{icon:x.Terminal,color:"text-gray-500",label:"Script"},docker:{icon:x.Container,color:"text-cyan-500",label:"Docker"},notify:{icon:x.Bell,color:"text-yellow-500",label:"Notify"},approval:{icon:x.Shield,color:"text-orange-500",label:"Approval"},artifact:{icon:x.Upload,color:"text-indigo-500",label:"Artifact"},cache:{icon:x.Database,color:"text-pink-500",label:"Cache"},parallel:{icon:x.Zap,color:"text-amber-500",label:"Parallel"}},qp={pending:{color:"text-muted-foreground",bgColor:"bg-muted",icon:x.Clock},running:{color:"text-blue-500",bgColor:"bg-blue-500",icon:x.Play},success:{color:"text-green-500",bgColor:"bg-green-500",icon:x.CheckCircle2},failed:{color:"text-red-500",bgColor:"bg-red-500",icon:x.XCircle},skipped:{color:"text-gray-400",bgColor:"bg-gray-400",icon:x.ChevronRight},waiting:{color:"text-yellow-500",bgColor:"bg-yellow-500",icon:x.Clock}};function $R({step:t,onUpdate:s,onDelete:a,readOnly:r}){const[n,l]=i.useState(!1),o=fn[t.type],c=o.icon,m=t.status?qp[t.status]:null,u=m?.icon;return e.jsxs("div",{className:d.cn("border rounded-lg transition-all",t.status==="failed"&&"border-red-500/50",t.status==="running"&&"border-blue-500/50 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 cursor-pointer",onClick:()=>l(!n),children:[!r&&e.jsx(x.GripVertical,{className:"h-4 w-4 text-muted-foreground cursor-grab"}),e.jsx("div",{className:d.cn("p-1.5 rounded",`${o.color.replace("text-","bg-")}/10`),children:e.jsx(c,{className:d.cn("h-4 w-4",o.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsx(ne,{variant:"outline",className:"text-xs",children:o.label})]}),t.command&&e.jsx("code",{className:"text-xs text-muted-foreground font-mono truncate block mt-0.5",children:t.command})]}),u&&e.jsxs(ne,{variant:"outline",className:d.cn("text-xs",m?.color),children:[e.jsx(u,{className:"h-3 w-3 mr-1"}),t.status]}),!r&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,onClick:h=>h.stopPropagation(),children:e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{onClick:()=>l(!0),children:[e.jsx(x.Settings,{className:"h-4 w-4 mr-2"}),"Configure"]}),e.jsxs(ye,{children:[e.jsx(x.Copy,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),e.jsx(Ke,{}),e.jsxs(ye,{className:"text-destructive",onClick:a,children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),e.jsx(x.ChevronRight,{className:d.cn("h-4 w-4 transition-transform",n&&"rotate-90")})]}),n&&e.jsxs("div",{className:"px-3 pb-3 pt-0 space-y-3 border-t mt-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Step Name"}),e.jsx(L.Input,{value:t.name,onChange:h=>s({...t,name:h.target.value}),className:"h-8 mt-1",disabled:r})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Type"}),e.jsxs(Ee,{value:t.type,onValueChange:h=>s({...t,type:h}),disabled:r,children:[e.jsx($e,{className:"h-8 mt-1",children:e.jsx(Re,{})}),e.jsx(Ae,{children:Object.entries(fn).map(([h,f])=>e.jsx(xe,{value:h,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f.icon,{className:d.cn("h-4 w-4",f.color)}),f.label]})},h))})]})]})]}),(t.type==="script"||t.type==="build"||t.type==="test")&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Command"}),e.jsx(L.Input,{value:t.command||"",onChange:h=>s({...t,command:h.target.value}),placeholder:"npm run build",className:"h-8 mt-1 font-mono text-sm",disabled:r})]}),t.type==="docker"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Docker Image"}),e.jsx(L.Input,{value:t.image||"",onChange:h=>s({...t,image:h.target.value}),placeholder:"node:18-alpine",className:"h-8 mt-1 font-mono text-sm",disabled:r})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Timeout (seconds)"}),e.jsx(L.Input,{type:"number",value:t.timeout||"",onChange:h=>s({...t,timeout:parseInt(h.target.value)||void 0}),placeholder:"300",className:"h-8 mt-1",disabled:r})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Retries"}),e.jsx(L.Input,{type:"number",value:t.retries||"",onChange:h=>s({...t,retries:parseInt(h.target.value)||void 0}),placeholder:"0",className:"h-8 mt-1",disabled:r})]})]}),t.condition!==void 0&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Condition"}),e.jsx(L.Input,{value:t.condition,onChange:h=>s({...t,condition:h.target.value}),placeholder:"$CI_COMMIT_BRANCH == 'main'",className:"h-8 mt-1 font-mono text-sm",disabled:r})]})]})]})}function AR({stage:t,onUpdate:s,onDelete:a,onAddStep:r,readOnly:n}){const[l,o]=i.useState(!1),c=t.status?qp[t.status]:null,m=c?.icon,u=(f,g)=>{s({...t,steps:t.steps.map(p=>p.id===f?g:p)})},h=f=>{s({...t,steps:t.steps.filter(g=>g.id!==f)})};return e.jsxs(me,{className:d.cn(t.status==="failed"&&"border-red-500/30",t.status==="running"&&"border-blue-500/30"),children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>o(!l),children:e.jsx(x.ChevronDown,{className:d.cn("h-4 w-4 transition-transform",l&&"-rotate-90")})}),e.jsx(L.Input,{value:t.name,onChange:f=>s({...t,name:f.target.value}),className:"h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent",disabled:n}),m&&e.jsxs(ne,{variant:"outline",className:d.cn("text-xs ml-auto",c?.color),children:[e.jsx(m,{className:"h-3 w-3 mr-1"}),t.status]}),e.jsxs(ne,{variant:"secondary",className:"text-xs",children:[t.steps.length," steps"]}),!n&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[e.jsxs(ye,{children:[e.jsx(x.Copy,{className:"h-4 w-4 mr-2"}),"Duplicate Stage"]}),e.jsx(Ke,{}),e.jsxs(ye,{className:"text-destructive",onClick:a,children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Delete Stage"]})]})]})]})}),!l&&e.jsxs(fe,{className:"space-y-2",children:[t.steps.map(f=>e.jsx($R,{step:f,onUpdate:g=>u(f.id,g),onDelete:()=>h(f.id),readOnly:n},f.id)),!n&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",className:"w-full",children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Add Step"]})}),e.jsx(We,{className:"w-48",children:Object.entries(fn).map(([f,g])=>e.jsxs(ye,{onClick:()=>r(f),children:[e.jsx(g.icon,{className:d.cn("h-4 w-4 mr-2",g.color)}),g.label]},f))})]})]})]})}function ER({pipeline:t,onPipelineChange:s,onRun:a,onSave:r,onExport:n,readOnly:l=!1,className:o}){const[c,m]=i.useState(t),u=j=>{const b={...c,...j};m(b),s?.(b)},h=()=>{const j={id:`stage-${Date.now()}`,name:`Stage ${c.stages.length+1}`,steps:[]};u({stages:[...c.stages,j]})},f=(j,b)=>{u({stages:c.stages.map(w=>w.id===j?b:w)})},g=j=>{u({stages:c.stages.filter(b=>b.id!==j)})},p=(j,b)=>{const w=c.stages.find(v=>v.id===j);if(!w)return;const y={id:`step-${Date.now()}`,name:`${fn[b].label} Step`,type:b};f(j,{...w,steps:[...w.steps,y]})};return e.jsxs("div",{className:d.cn("flex flex-col gap-6",o),children:[e.jsxs(me,{children:[e.jsx(we,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.GitBranch,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx(L.Input,{value:c.name,onChange:j=>u({name:j.target.value}),className:"h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent",disabled:l}),c.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsxs(L.Button,{variant:"outline",size:"sm",children:[e.jsx(x.Download,{className:"h-4 w-4 mr-1"}),"Export"]})}),e.jsxs(We,{children:[e.jsx(ye,{onClick:()=>n("yaml"),children:"Export as YAML"}),e.jsx(ye,{onClick:()=>n("json"),children:"Export as JSON"})]})]}),r&&!l&&e.jsx(L.Button,{variant:"outline",size:"sm",onClick:r,children:"Save"}),a&&e.jsxs(L.Button,{size:"sm",onClick:a,children:[e.jsx(x.Play,{className:"h-4 w-4 mr-1"}),"Run Pipeline"]})]})]})}),c.trigger&&e.jsx(fe,{className:"pt-0",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Triggers:"}),c.trigger.events?.map(j=>e.jsx(ne,{variant:"outline",className:"text-xs",children:j},j)),c.trigger.branches?.map(j=>e.jsxs(ne,{variant:"secondary",className:"text-xs",children:[e.jsx(x.GitBranch,{className:"h-3 w-3 mr-1"}),j]},j)),c.trigger.schedule&&e.jsxs(ne,{variant:"outline",className:"text-xs",children:[e.jsx(x.Clock,{className:"h-3 w-3 mr-1"}),c.trigger.schedule]})]})})]}),e.jsx("div",{className:"flex items-center gap-2 overflow-x-auto pb-2",children:c.stages.map((j,b)=>e.jsxs(i.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:d.cn("w-4 h-4 rounded-full border-2",j.status==="success"&&"bg-green-500 border-green-500",j.status==="failed"&&"bg-red-500 border-red-500",j.status==="running"&&"bg-blue-500 border-blue-500 animate-pulse",!j.status&&"bg-muted border-muted-foreground")}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:j.name})]}),b<c.stages.length-1&&e.jsx(x.ArrowRight,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},j.id))}),e.jsx(Ie,{className:"h-[500px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[c.stages.map(j=>e.jsx(AR,{stage:j,onUpdate:b=>f(j.id,b),onDelete:()=>g(j.id),onAddStep:b=>p(j.id,b),readOnly:l},j.id)),!l&&e.jsxs(L.Button,{variant:"outline",className:"w-full",onClick:h,children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Add Stage"]})]})})]})}const RR={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"}},Xp={feature:{icon:x.Sparkles,color:"text-green-500",bgColor:"bg-green-500/10",label:"New Feature"},fix:{icon:x.Bug,color:"text-red-500",bgColor:"bg-red-500/10",label:"Bug Fix"},improvement:{icon:x.Wrench,color:"text-blue-500",bgColor:"bg-blue-500/10",label:"Improvement"},breaking:{icon:x.AlertTriangle,color:"text-orange-500",bgColor:"bg-orange-500/10",label:"Breaking Change"},security:{icon:x.ShieldCheck,color:"text-purple-500",bgColor:"bg-purple-500/10",label:"Security"},performance:{icon:x.Zap,color:"text-yellow-500",bgColor:"bg-yellow-500/10",label:"Performance"},docs:{icon:x.BookOpen,color:"text-cyan-500",bgColor:"bg-cyan-500/10",label:"Documentation"},deprecation:{icon:x.AlertTriangle,color:"text-gray-500",bgColor:"bg-gray-500/10",label:"Deprecation"}},IR={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 Ku(t){return t.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function PR({change:t}){const s=Xp[t.type],a=s.icon;return e.jsxs("div",{className:d.cn("flex items-start gap-3 p-3 rounded-lg",s.bgColor),children:[e.jsx("div",{className:"p-1.5 rounded bg-background",children:e.jsx(a,{className:d.cn("h-4 w-4",s.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.title}),t.breaking&&e.jsx(ne,{className:"bg-orange-500 text-xs",children:"Breaking"}),t.pullRequest&&e.jsxs("a",{href:t.pullRequest.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary flex items-center gap-1",children:[e.jsx(x.GitPullRequest,{className:"h-3 w-3"}),"#",t.pullRequest.number]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.contributors&&t.contributors.length>0&&e.jsx("div",{className:"flex items-center gap-1 mt-2",children:t.contributors.map(r=>e.jsxs(tt,{className:"h-5 w-5",children:[e.jsx(st,{src:r.avatar}),e.jsx(at,{className:"text-xs",children:r.name.slice(0,2).toUpperCase()})]},r.id))})]})]})}function LR({release:t,onEdit:s,onPublish:a,expanded:r=!1}){const[n,l]=i.useState(r),o=IR[t.releaseType],c=i.useMemo(()=>{const m={breaking:[],security:[],feature:[],improvement:[],performance:[],fix:[],docs:[],deprecation:[]};return t.changes.forEach(u=>{m[u.type].push(u)}),m},[t.changes]);return e.jsxs(me,{className:d.cn(t.status==="draft"&&"border-dashed",t.status==="scheduled"&&"border-blue-500/30"),children:[e.jsx(we,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x.Tag,{className:"h-5 w-5"}),e.jsx(Ne,{className:"text-xl",children:t.version}),t.name&&e.jsxs("span",{className:"text-muted-foreground",children:["- ",t.name]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{variant:"outline",className:o.color,children:o.label}),e.jsxs(ne,{variant:t.status==="published"?"default":"secondary",className:t.status==="published"?"bg-green-500":"",children:[t.status==="published"?e.jsx(x.CheckCircle2,{className:"h-3 w-3 mr-1"}):t.status==="scheduled"?e.jsx(x.Clock,{className:"h-3 w-3 mr-1"}):e.jsx(x.Edit,{className:"h-3 w-3 mr-1"}),t.status]}),e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Calendar,{className:"h-3 w-3"}),t.publishedAt?Ku(t.publishedAt):Ku(t.createdAt)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.compareUrl&&e.jsx(L.Button,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs("a",{href:t.compareUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(x.GitCommit,{className:"h-4 w-4 mr-1"}),"Compare"]})}),s&&t.status==="draft"&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:s,children:[e.jsx(x.Edit,{className:"h-4 w-4 mr-1"}),"Edit"]}),a&&t.status==="draft"&&e.jsxs(L.Button,{size:"sm",onClick:a,children:[e.jsx(x.Rocket,{className:"h-4 w-4 mr-1"}),"Publish"]})]})]})}),e.jsxs(fe,{className:"space-y-4",children:[t.summary&&e.jsx("p",{className:"text-muted-foreground",children:t.summary}),t.upgradeNotes&&e.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium text-yellow-600 mb-1",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4"}),"Upgrade Notes"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.upgradeNotes})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(c).map(([m,u])=>{if(u.length===0)return null;const h=Xp[m];return e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium flex items-center gap-2 mb-2",children:[e.jsx(h.icon,{className:d.cn("h-4 w-4",h.color)}),h.label,"s (",u.length,")"]}),e.jsxs("div",{className:"space-y-2",children:[(n?u:u.slice(0,3)).map(f=>e.jsx(PR,{change:f},f.id)),!n&&u.length>3&&e.jsxs(L.Button,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>l(!0),children:["Show ",u.length-3," more..."]})]})]},m)})}),t.contributors.length>0&&e.jsxs("div",{className:"pt-4 border-t",children:[e.jsxs("h4",{className:"font-medium flex items-center gap-2 mb-2",children:[e.jsx(x.Users,{className:"h-4 w-4"}),"Contributors (",t.contributors.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.contributors.map(m=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted rounded-full",children:[e.jsxs(tt,{className:"h-5 w-5",children:[e.jsx(st,{src:m.avatar}),e.jsx(at,{className:"text-xs",children:m.name.slice(0,2).toUpperCase()})]}),e.jsxs("span",{className:"text-sm",children:["@",m.username]})]},m.id))})]}),t.downloadUrl&&e.jsx("div",{className:"pt-4 border-t",children:e.jsx(L.Button,{variant:"outline",asChild:!0,children:e.jsxs("a",{href:t.downloadUrl,download:!0,children:[e.jsx(x.Download,{className:"h-4 w-4 mr-2"}),"Download Release"]})})})]})]})}function FR({releases:t,onCreateRelease:s,onEditRelease:a,onPublishRelease:r,onAddChange:n,showEditor:l=!1,className:o}){const[c,m]=i.useState("all"),[u,h]=i.useState("all"),f=i.useMemo(()=>t.filter(p=>!(c!=="all"&&p.releaseType!==c||u!=="all"&&p.status!==u)).sort((p,j)=>{const b=v=>v.replace(/^v/,"").split(/[.-]/).map(k=>parseInt(k)||0),w=b(p.version),y=b(j.version);for(let v=0;v<Math.max(w.length,y.length);v++){const N=(y[v]||0)-(w[v]||0);if(N!==0)return N}return 0}),[t,c,u]),g=i.useMemo(()=>({total:t.length,published:t.filter(p=>p.status==="published").length,draft:t.filter(p=>p.status==="draft").length,features:t.reduce((p,j)=>p+j.changes.filter(b=>b.type==="feature").length,0),fixes:t.reduce((p,j)=>p+j.changes.filter(b=>b.type==="fix").length,0)}),[t]);return e.jsxs("div",{className:d.cn("space-y-6",o),children:[e.jsxs(me,{children:[e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Rocket,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:"Release Notes"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track changes and publish releases"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Tag,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("strong",{children:g.total})," releases"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Sparkles,{className:"h-4 w-4 text-green-500"}),e.jsx("strong",{children:g.features})," features"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Bug,{className:"h-4 w-4 text-red-500"}),e.jsx("strong",{children:g.fixes})," fixes"]})]}),s&&e.jsxs(L.Button,{onClick:s,children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"New Release"]})]})]})}),e.jsx(fe,{className:"pt-0",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Ee,{value:c,onValueChange:p=>m(p),children:[e.jsx($e,{className:"w-32",children:e.jsx(Re,{placeholder:"Type"})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Types"}),e.jsx(xe,{value:"major",children:"Major"}),e.jsx(xe,{value:"minor",children:"Minor"}),e.jsx(xe,{value:"patch",children:"Patch"}),e.jsx(xe,{value:"prerelease",children:"Pre-release"})]})]}),e.jsxs(Ee,{value:u,onValueChange:p=>h(p),children:[e.jsx($e,{className:"w-32",children:e.jsx(Re,{placeholder:"Status"})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Status"}),e.jsx(xe,{value:"published",children:"Published"}),e.jsx(xe,{value:"draft",children:"Draft"}),e.jsx(xe,{value:"scheduled",children:"Scheduled"})]})]})]})})]}),e.jsx(Ie,{className:"h-[600px]",children:e.jsx("div",{className:"space-y-4 pr-4",children:f.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground",children:[e.jsx(x.Tag,{className:"h-12 w-12 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No releases found"}),e.jsx("p",{className:"text-sm",children:"Create your first release to get started"})]}):f.map((p,j)=>e.jsx(LR,{release:p,expanded:j===0,onEdit:a?()=>a(p):void 0,onPublish:r?()=>r(p):void 0},p.id))})})]})}const ea=[{id:"1",name:"John Doe",username:"johndoe",avatar:""},{id:"2",name:"Jane Smith",username:"janesmith",avatar:""},{id:"3",name:"Bob Wilson",username:"bobwilson",avatar:""}],BR=[{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:ea,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:[ea[0]]},{id:"c2",type:"feature",title:"New dashboard widgets for analytics",pullRequest:{number:238,url:"#"},contributors:[ea[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:[ea[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:[ea[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:ea,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}]}],ic={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"}},Yp={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 cc(t){const s=new Date;return t.startTime<=s&&t.endTime>s}function zR({shift:t,nextShift:s,onContact:a}){if(!t)return e.jsx(me,{className:"border-dashed",children:e.jsxs(fe,{className:"p-6 text-center text-muted-foreground",children:[e.jsx(x.AlertCircle,{className:"h-8 w-8 mx-auto mb-2"}),e.jsx("p",{children:"No one is currently on call"})]})});const r=ic[t.level],n=t.user.status?Yp[t.user.status]:null,l=t.endTime.getTime()-Date.now(),o=Math.floor(l/36e5),c=Math.floor(l%36e5/6e4);return e.jsxs(me,{className:"border-green-500/30 bg-green-500/5",children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(ne,{className:d.cn("text-white",r.bgColor),children:[r.label," On-Call"]}),e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-4 w-4"}),o,"h ",c,"m remaining"]})]})}),e.jsxs(fe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{className:"h-16 w-16",children:[e.jsx(st,{src:t.user.avatar}),e.jsx(at,{className:"text-xl",children:t.user.name.slice(0,2).toUpperCase()})]}),n&&e.jsx("div",{className:d.cn("absolute bottom-0 right-0 w-4 h-4 rounded-full border-2 border-background",n.color)})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xl font-semibold",children:t.user.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.user.email}),t.user.timezone&&e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Timezone: ",t.user.timezone]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[t.user.phone&&e.jsxs(L.Button,{size:"sm",variant:"outline",onClick:()=>a?.(t.user),children:[e.jsx(x.Phone,{className:"h-4 w-4 mr-1"}),"Call"]}),e.jsxs(L.Button,{size:"sm",variant:"outline",onClick:()=>a?.(t.user),children:[e.jsx(x.MessageSquare,{className:"h-4 w-4 mr-1"}),"Message"]})]})]}),t.overrideReason&&e.jsxs("div",{className:"text-sm text-muted-foreground bg-muted/50 p-2 rounded",children:[e.jsx("span",{className:"font-medium",children:"Override:"})," ",t.overrideReason]}),s&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t text-sm",children:[e.jsx(x.ArrowRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Next:"}),e.jsxs(tt,{className:"h-5 w-5",children:[e.jsx(st,{src:s.user.avatar}),e.jsx(at,{className:"text-xs",children:s.user.name.slice(0,2).toUpperCase()})]}),e.jsx("span",{children:s.user.name}),e.jsxs("span",{className:"text-muted-foreground",children:["at ",s.startTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})]})]})]})]})}function WR({policy:t,currentLevel:s}){return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Shield,{className:"h-4 w-4"}),"Escalation Policy"]})}),e.jsx(fe,{children:e.jsx("div",{className:"space-y-3",children:[1,2,3].map(a=>{const r=ic[a],n=a===1?t.level1Timeout:a===2?t.level2Timeout:t.level3Timeout,l=s===a;return e.jsxs("div",{className:d.cn("flex items-center gap-3 p-2 rounded",l&&`${r.bgColor}/10 border ${r.bgColor}/30`),children:[e.jsx("div",{className:d.cn("w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold",r.bgColor),children:a}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:r.label}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Escalates after ",n," minutes"]})]}),l&&e.jsx(ne,{variant:"outline",className:r.color,children:"Active"})]},a)})})})]})}function OR({shifts:t,weekStart:s,onShiftClick:a}){const r=i.useMemo(()=>{const o=[];for(let c=0;c<7;c++){const m=new Date(s);m.setDate(m.getDate()+c),o.push(m)}return o},[s]),n=o=>t.filter(c=>new Date(c.startTime).toDateString()===o.toDateString()),l=o=>o.toDateString()===new Date().toDateString();return e.jsx("div",{className:"grid grid-cols-7 gap-2",children:r.map(o=>{const c=n(o),m=l(o);return e.jsxs("div",{className:d.cn("border rounded-lg p-2 min-h-[120px]",m&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:d.cn("text-center mb-2",m&&"font-bold text-primary"),children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:o.toLocaleDateString("en-US",{weekday:"short"})}),e.jsx("div",{className:d.cn("text-lg",m&&"text-primary"),children:o.getDate()})]}),e.jsx("div",{className:"space-y-1",children:c.map(u=>{const h=ic[u.level],f=cc(u);return e.jsxs("button",{className:d.cn("w-full text-left p-1.5 rounded text-xs transition-colors",`${h.bgColor}/10 hover:${h.bgColor}/20`,f&&`ring-2 ring-${h.bgColor}`),onClick:()=>a?.(u),children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(tt,{className:"h-4 w-4",children:[e.jsx(st,{src:u.user.avatar}),e.jsx(at,{className:"text-[8px]",children:u.user.name.slice(0,2).toUpperCase()})]}),e.jsx("span",{className:"truncate",children:u.user.name.split(" ")[0]})]}),e.jsx("div",{className:"text-muted-foreground mt-0.5",children:u.startTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})})]},u.id)})})]},o.toISOString())})})}function UR({users:t,shifts:s}){const a=i.useMemo(()=>t.map(r=>{const n=s.filter(c=>c.user.id===r.id),l=n.reduce((c,m)=>c+(m.endTime.getTime()-m.startTime.getTime())/36e5,0),o=n.some(cc);return{user:r,totalHours:l,shiftCount:n.length,isOnCall:o}}),[t,s]);return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-4 w-4"}),"Team Members"]})}),e.jsx(fe,{children:e.jsx("div",{className:"space-y-2",children:a.map(({user:r,totalHours:n,shiftCount:l,isOnCall:o})=>{const c=r.status?Yp[r.status]:null;return e.jsxs("div",{className:d.cn("flex items-center gap-3 p-2 rounded",o&&"bg-green-500/10 border border-green-500/30"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(tt,{className:"h-8 w-8",children:[e.jsx(st,{src:r.avatar}),e.jsx(at,{className:"text-xs",children:r.name.slice(0,2).toUpperCase()})]}),c&&e.jsx("div",{className:d.cn("absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-background",c.color)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium truncate flex items-center gap-2",children:[r.name,o&&e.jsx(ne,{className:"bg-green-500 text-xs",children:"On-Call"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l," shifts • ",Math.round(n),"h total"]})]})]},r.id)})})})]})}function _R({schedule:t,onEditSchedule:s,onAddOverride:a,onSwapShift:r,onContactOnCall:n,className:l}){const[o,c]=i.useState(0),m=i.useMemo(()=>{const g=new Date,p=g.getDay(),j=new Date(g);return j.setDate(g.getDate()-p+o*7),j.setHours(0,0,0,0),j},[o]),u=t.shifts.find(cc),f=t.shifts.filter(g=>g.startTime>new Date).sort((g,p)=>g.startTime.getTime()-p.startTime.getTime())[0];return e.jsxs("div",{className:d.cn("space-y-6",l),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Phone,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:t.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(ne,{variant:"outline",children:t.team}),e.jsxs(ne,{variant:"secondary",children:[e.jsx(x.Repeat,{className:"h-3 w-3 mr-1"}),t.rotation]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsxs(L.Button,{variant:"outline",onClick:()=>a(new Date),children:[e.jsx(x.Plus,{className:"h-4 w-4 mr-1"}),"Add Override"]}),s&&e.jsxs(L.Button,{variant:"outline",onClick:s,children:[e.jsx(x.Settings,{className:"h-4 w-4 mr-1"}),"Settings"]})]})]})})}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsxs("div",{className:"col-span-2 space-y-4",children:[e.jsx(zR,{shift:u,nextShift:f,onContact:n}),e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Calendar,{className:"h-4 w-4"}),"Schedule"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:()=>c(g=>g-1),children:e.jsx(x.ChevronLeft,{className:"h-4 w-4"})}),e.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"})]}),e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:()=>c(g=>g+1),children:e.jsx(x.ChevronRight,{className:"h-4 w-4"})}),o!==0&&e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:()=>c(0),children:"Today"})]})]})}),e.jsx(fe,{children:e.jsx(OR,{shifts:t.shifts,weekStart:m,onShiftClick:r})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(WR,{policy:t.escalationPolicy,currentLevel:u?.level}),e.jsx(UR,{users:t.users,shifts:t.shifts})]})]})]})}const fo=[{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 VR(){const t=[],s=new Date,a=new Date(s);a.setDate(s.getDate()-s.getDay()),a.setHours(0,0,0,0);for(let r=-1;r<3;r++)for(let n=0;n<7;n++){const l=new Date(a);l.setDate(a.getDate()+r*7+n),l.setHours(9,0,0,0);const o=new Date(l);o.setDate(o.getDate()+1);const c=(r+1+n)%fo.length;t.push({id:`shift-${r}-${n}`,user:fo[c],startTime:l,endTime:o,level:1})}return t}const HR={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:VR(),users:fo},Zp={compute:{icon:x.Cpu,color:"text-blue-500",label:"Compute"},storage:{icon:x.HardDrive,color:"text-green-500",label:"Storage"},database:{icon:x.Database,color:"text-purple-500",label:"Database"},network:{icon:x.Network,color:"text-cyan-500",label:"Network"},security:{icon:x.Shield,color:"text-red-500",label:"Security"},other:{icon:x.Cloud,color:"text-gray-500",label:"Other"}},Kp={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 Qt(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}function Qp(t){return`${t>=0?"+":""}${t.toFixed(1)}%`}function Lr({title:t,value:s,previousValue:a,icon:r,trend:n,budget:l,forecast:o}){const c=a!==void 0?(s-a)/a*100:n,m=l!==void 0&&s>l,u=l!==void 0?s/l*100:void 0;return e.jsx(me,{className:d.cn(m&&"border-red-500/50"),children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"p-2 rounded-lg bg-muted",children:e.jsx(r,{className:"h-5 w-5 text-muted-foreground"})}),c!==void 0&&e.jsxs(ne,{variant:"outline",className:d.cn(c>0?"text-red-500":"text-green-500"),children:[c>0?e.jsx(x.ArrowUpRight,{className:"h-3 w-3 mr-1"}):e.jsx(x.ArrowDownRight,{className:"h-3 w-3 mr-1"}),Qp(Math.abs(c))]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"text-2xl font-bold",children:Qt(s)}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t})]}),u!==void 0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Budget"}),e.jsxs("span",{className:d.cn(m&&"text-red-500"),children:[Qt(s)," / ",Qt(l)]})]}),e.jsx(Be,{value:Math.min(u,100),className:d.cn("h-2",u>100&&"[&>div]:bg-red-500",u>80&&u<=100&&"[&>div]:bg-yellow-500")})]}),o!==void 0&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Forecast: ",Qt(o)]})]})})}function GR({data:t}){const s=Object.values(t).reduce((r,n)=>r+n,0),a=Object.entries(t).sort(([,r],[,n])=>n-r).filter(([,r])=>r>0);return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.PieChart,{className:"h-4 w-4"}),"Cost by Category"]})}),e.jsx(fe,{className:"space-y-3",children:a.map(([r,n])=>{const l=Zp[r],o=l.icon,c=n/s*100;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o,{className:d.cn("h-4 w-4",l.color)}),e.jsx("span",{className:"text-sm",children:l.label})]}),e.jsxs("div",{className:"text-sm font-medium",children:[Qt(n),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",c.toFixed(0),"%)"]})]})]}),e.jsx(Be,{value:c,className:"h-2"})]},r)})})]})}function qR({data:t}){const s=Object.values(t).reduce((r,n)=>r+n,0),a=Object.entries(t).filter(([r])=>r!=="all").sort(([,r],[,n])=>n-r).filter(([,r])=>r>0);return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Cloud,{className:"h-4 w-4"}),"Cost by Provider"]})}),e.jsx(fe,{className:"space-y-3",children:a.map(([r,n])=>{const l=Kp[r],o=n/s*100;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:d.cn("text-sm font-medium",l.color),children:l.label}),e.jsxs("div",{className:"text-sm font-medium",children:[Qt(n),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.toFixed(0),"%)"]})]})]}),e.jsx(Be,{value:o,className:"h-2"})]},r)})})]})}function XR({items:t}){return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.BarChart3,{className:"h-4 w-4"}),"Top Services by Cost"]})}),e.jsx(fe,{children:e.jsx(Ie,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-2",children:t.map((s,a)=>{const r=Zp[s.category],n=r.icon,l=Kp[s.provider],o=s.previousCost!==void 0?(s.cost-s.previousCost)/s.previousCost*100:s.trend;return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:"text-lg font-bold text-muted-foreground w-6 text-center",children:a+1}),e.jsx("div",{className:d.cn("p-1.5 rounded",`${r.color.replace("text-","bg-")}/10`),children:e.jsx(n,{className:d.cn("h-4 w-4",r.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:l.color,children:l.label}),e.jsx("span",{children:"•"}),e.jsx("span",{children:r.label}),s.usage!==void 0&&s.unit&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:[s.usage," ",s.unit]})]})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:"font-semibold",children:Qt(s.cost)}),o!==void 0&&e.jsxs("div",{className:d.cn("text-xs flex items-center justify-end gap-0.5",o>0?"text-red-500":"text-green-500"),children:[o>0?e.jsx(x.TrendingUp,{className:"h-3 w-3"}):e.jsx(x.TrendingDown,{className:"h-3 w-3"}),Qp(Math.abs(o))]})]})]},s.id)})})})})]})}function YR({anomalies:t,onAcknowledge:s}){const a=t.filter(r=>r.status==="new");return e.jsxs(me,{className:d.cn(a.length>0&&"border-yellow-500/50"),children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4 text-yellow-500"}),"Cost Anomalies"]}),a.length>0&&e.jsxs(ne,{className:"bg-yellow-500",children:[a.length," new"]})]})}),e.jsx(fe,{children:t.length===0?e.jsxs("div",{className:"text-center text-muted-foreground py-4",children:[e.jsx(x.Zap,{className:"h-8 w-8 mx-auto mb-2 text-green-500"}),e.jsx("p",{children:"No anomalies detected"})]}):e.jsx("div",{className:"space-y-2",children:t.slice(0,5).map(r=>e.jsxs("div",{className:d.cn("flex items-center gap-3 p-2 rounded-lg",r.status==="new"&&"bg-yellow-500/10"),children:[e.jsx(x.AlertTriangle,{className:d.cn("h-4 w-4 shrink-0",r.deviation>100?"text-red-500":"text-yellow-500")}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:r.service}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Expected ",Qt(r.expectedCost)," • Actual ",Qt(r.actualCost)]})]}),e.jsxs(ne,{variant:"outline",className:"text-red-500 shrink-0",children:["+",r.deviation.toFixed(0),"%"]})]},r.id))})})]})}function ZR({summary:t,items:s,anomalies:a=[],timeRange:r="month",onTimeRangeChange:n,onProviderFilter:l,onExport:o,onRefresh:c,className:m}){const[u,h]=i.useState("all"),f=p=>{h(p),l?.(p)},g=i.useMemo(()=>u==="all"?s:s.filter(p=>p.provider===u),[s,u]);return t.previousTotalCost!==void 0&&(t.totalCost-t.previousTotalCost)/t.previousTotalCost*100,e.jsxs("div",{className:d.cn("space-y-6",m),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.DollarSign,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:"Cloud Cost Dashboard"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Monitor and optimize your cloud spending"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ee,{value:r,onValueChange:p=>n?.(p),children:[e.jsxs($e,{className:"w-32",children:[e.jsx(x.Calendar,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"day",children:"Today"}),e.jsx(xe,{value:"week",children:"This Week"}),e.jsx(xe,{value:"month",children:"This Month"}),e.jsx(xe,{value:"quarter",children:"This Quarter"}),e.jsx(xe,{value:"year",children:"This Year"})]})]}),e.jsxs(Ee,{value:u,onValueChange:p=>f(p),children:[e.jsxs($e,{className:"w-32",children:[e.jsx(x.Cloud,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Providers"}),e.jsx(xe,{value:"aws",children:"AWS"}),e.jsx(xe,{value:"gcp",children:"GCP"}),e.jsx(xe,{value:"azure",children:"Azure"})]})]}),c&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:c,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})}),o&&e.jsxs(L.Button,{variant:"outline",onClick:o,children:[e.jsx(x.Download,{className:"h-4 w-4 mr-1"}),"Export"]})]})]})})}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(Lr,{title:"Total Cost",value:t.totalCost,previousValue:t.previousTotalCost,icon:x.DollarSign,budget:t.budget}),e.jsx(Lr,{title:"Compute",value:t.byCategory.compute,icon:x.Cpu,trend:-5.2}),e.jsx(Lr,{title:"Storage",value:t.byCategory.storage,icon:x.HardDrive,trend:12.3}),e.jsx(Lr,{title:"Forecast (EOM)",value:t.forecast||t.totalCost*1.1,icon:x.TrendingUp,budget:t.budget})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsx("div",{className:"col-span-2 space-y-6",children:e.jsx(XR,{items:g.slice(0,10)})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(GR,{data:t.byCategory}),e.jsx(qR,{data:t.byProvider}),e.jsx(YR,{anomalies:a})]})]})]})}const KR={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:[]},QR=[{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"}],JR=[{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"}],dc={synced:{icon:x.CheckCircle2,color:"text-green-500",bgColor:"bg-green-500",label:"Synced"},out_of_sync:{icon:x.AlertTriangle,color:"text-yellow-500",bgColor:"bg-yellow-500",label:"Out of Sync"},syncing:{icon:x.Loader2,color:"text-blue-500",bgColor:"bg-blue-500",label:"Syncing"},failed:{icon:x.XCircle,color:"text-red-500",bgColor:"bg-red-500",label:"Failed"},unknown:{icon:x.Clock,color:"text-gray-500",bgColor:"bg-gray-500",label:"Unknown"},suspended:{icon:x.Pause,color:"text-orange-500",bgColor:"bg-orange-500",label:"Suspended"}},Jp={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 eI(t){const s=Math.floor((Date.now()-t.getTime())/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const r=Math.floor(a/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Qu(t){return t.slice(0,7)}function tI({status:t}){const s=dc[t],a=s.icon;return e.jsxs(ne,{variant:"outline",className:d.cn("gap-1",s.color),children:[e.jsx(a,{className:d.cn("h-3 w-3",t==="syncing"&&"animate-spin")}),s.label]})}function sI({status:t}){const s=Jp[t];return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:d.cn("w-2 h-2 rounded-full",s.bgColor)}),e.jsx("span",{className:d.cn("text-sm",s.color),children:s.label})]})}function aI({app:t,onSync:s,onSuspend:a,onResume:r,onViewDetails:n}){const l=dc[t.syncStatus];Jp[t.healthStatus];const o=l.icon,c=i.useMemo(()=>{const m=t.resources.filter(h=>h.syncStatus==="synced").length,u=t.resources.filter(h=>h.healthStatus==="healthy").length;return{synced:m,healthy:u,total:t.resources.length}},[t.resources]);return e.jsx(me,{className:d.cn(t.syncStatus==="failed"&&"border-red-500/50",t.syncStatus==="out_of_sync"&&"border-yellow-500/30",t.healthStatus==="degraded"&&"border-red-500/30"),children:e.jsx(fe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:d.cn("w-12 h-12 rounded-lg flex items-center justify-center shrink-0",`${l.bgColor}/10`),children:e.jsx(o,{className:d.cn("h-6 w-6",l.color,t.syncStatus==="syncing"&&"animate-spin")})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:t.name}),e.jsx(ne,{variant:"secondary",className:"text-xs",children:t.project})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-sm text-muted-foreground",children:[e.jsx(x.Server,{className:"h-3 w-3"}),e.jsx("span",{children:t.destination.namespace}),e.jsx("span",{children:"@"}),e.jsx("span",{className:"truncate max-w-[200px]",children:t.destination.server})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(tI,{status:t.syncStatus}),e.jsx(sI,{status:t.healthStatus})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(x.GitBranch,{className:"h-4 w-4"}),e.jsx("span",{children:t.repo.branch})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(x.Folder,{className:"h-4 w-4"}),e.jsx("span",{className:"truncate max-w-[150px]",children:t.repo.path})]}),t.lastSyncedRevision&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(x.GitCommit,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Qu(t.lastSyncedRevision)}),t.targetRevision&&t.lastSyncedRevision!==t.targetRevision&&e.jsxs(e.Fragment,{children:[e.jsx(x.ArrowRight,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("code",{className:"text-xs bg-yellow-500/20 text-yellow-600 px-1.5 py-0.5 rounded",children:Qu(t.targetRevision)})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Resources Synced"}),e.jsxs("span",{children:[c.synced,"/",c.total]})]}),e.jsx(Be,{value:c.synced/c.total*100,className:"h-1.5"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Resources Healthy"}),e.jsxs("span",{children:[c.healthy,"/",c.total]})]}),e.jsx(Be,{value:c.healthy/c.total*100,className:d.cn("h-1.5",c.healthy<c.total&&"[&>div]:bg-yellow-500")})]})]}),t.message&&(t.syncStatus==="failed"||t.healthStatus==="degraded")&&e.jsx("div",{className:"text-sm text-red-500 bg-red-500/10 p-2 rounded",children:t.message}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.lastSyncedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-3 w-3"}),"Last synced ",eI(t.lastSyncedAt)]}),t.autoSync&&e.jsxs(ne,{variant:"outline",className:"text-xs",children:[e.jsx(x.RefreshCw,{className:"h-3 w-3 mr-1"}),"Auto-sync"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n&&e.jsxs(L.Button,{variant:"ghost",size:"sm",onClick:n,children:[e.jsx(x.Eye,{className:"h-4 w-4 mr-1"}),"Details"]}),t.syncStatus==="suspended"&&r?e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:r,children:[e.jsx(x.Play,{className:"h-4 w-4 mr-1"}),"Resume"]}):e.jsxs(e.Fragment,{children:[a&&t.syncStatus!=="suspended"&&e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:a,children:e.jsx(x.Pause,{className:"h-4 w-4"})}),s&&t.syncStatus!=="syncing"&&e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:s,children:[e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-1"}),"Sync"]})]})]})]})]})]})})})}function rI({applications:t}){const s=i.useMemo(()=>({total:t.length,synced:t.filter(a=>a.syncStatus==="synced").length,outOfSync:t.filter(a=>a.syncStatus==="out_of_sync").length,failed:t.filter(a=>a.syncStatus==="failed").length,healthy:t.filter(a=>a.healthStatus==="healthy").length,degraded:t.filter(a=>a.healthStatus==="degraded").length}),[t]);return e.jsxs("div",{className:"grid grid-cols-6 gap-4",children:[e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:s.total}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Apps"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:s.synced}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Synced"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-500",children:s.outOfSync}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Out of Sync"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-red-500",children:s.failed}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:s.healthy}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Healthy"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-red-500",children:s.degraded}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Degraded"})]})})]})}function nI({applications:t,onSync:s,onRefresh:a,onSuspend:r,onResume:n,onViewDetails:l,className:o}){const[c,m]=i.useState("all"),u=i.useMemo(()=>c==="all"?t:t.filter(h=>h.syncStatus===c),[t,c]);return e.jsxs("div",{className:d.cn("space-y-6",o),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.GitBranch,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:"GitOps Sync Status"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Monitor application synchronization with Git"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[["all","synced","out_of_sync","failed","syncing"].map(h=>e.jsx(L.Button,{variant:c===h?"default":"ghost",size:"sm",onClick:()=>m(h),children:h==="all"?"All":dc[h].label},h)),a&&e.jsxs(L.Button,{variant:"outline",onClick:a,children:[e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-1"}),"Refresh All"]})]})]})})}),e.jsx(rI,{applications:t}),e.jsx(Ie,{className:"h-[500px]",children:e.jsx("div",{className:"space-y-4 pr-4",children:u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground",children:[e.jsx(x.Cloud,{className:"h-12 w-12 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No applications found"}),e.jsx("p",{className:"text-sm",children:"Adjust your filters or add new applications"})]}):u.map(h=>e.jsx(aI,{app:h,onSync:s?()=>s(h):void 0,onSuspend:r?()=>r(h):void 0,onResume:n?()=>n(h):void 0,onViewDetails:l?()=>l(h):void 0},h.id))})})]})}const lI=[{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"}]}],uc={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"}},oI={api:{icon:x.Globe,color:"text-blue-500"},web:{icon:x.Globe,color:"text-purple-500"},worker:{icon:x.Cpu,color:"text-orange-500"},database:{icon:x.Database,color:"text-green-500"},cache:{icon:x.HardDrive,color:"text-red-500"},queue:{icon:x.Activity,color:"text-cyan-500"}};function La(t){return t<1?`${(t*1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function iI(t){return t<1e3?t.toFixed(0):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function cI({current:t,previous:s}){if(s===void 0)return null;const a=(t-s)/s*100,r=a>0;return e.jsxs("span",{className:d.cn("text-xs flex items-center gap-0.5",r?"text-red-500":"text-green-500"),children:[r?e.jsx(x.TrendingUp,{className:"h-3 w-3"}):e.jsx(x.TrendingDown,{className:"h-3 w-3"}),Math.abs(a).toFixed(1),"%"]})}function Fr({title:t,value:s,unit:a,previousValue:r,status:n,icon:l}){const o=n?uc[n]:null;return e.jsx(me,{children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:"p-2 rounded-lg bg-muted",children:e.jsx(l,{className:"h-4 w-4 text-muted-foreground"})}),o&&e.jsx("div",{className:d.cn("w-2 h-2 rounded-full",o.bgColor)})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold",children:iI(s)}),a&&e.jsx("span",{className:"text-sm text-muted-foreground",children:a})]}),e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t}),e.jsx(cI,{current:s,previous:r})]})]})]})})}function dI({service:t,onClick:s}){const a=uc[t.status],r=oI[t.type],n=r.icon,{metrics:l,previousMetrics:o}=t;return l.successRate/100*(1-l.p95ResponseTime/3e3),e.jsx(me,{className:d.cn("cursor-pointer transition-all hover:shadow-md",t.status==="critical"&&"border-red-500/50",t.status==="warning"&&"border-yellow-500/30"),onClick:s,children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:d.cn("p-2 rounded-lg",`${r.color.replace("text-","bg-")}/10`),children:e.jsx(n,{className:d.cn("h-5 w-5",r.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold truncate",children:t.name}),e.jsx("div",{className:d.cn("w-2 h-2 rounded-full shrink-0",a.bgColor)}),t.version&&e.jsxs(ne,{variant:"outline",className:"text-xs",children:["v",t.version]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Zap,{className:"h-3 w-3 text-muted-foreground"}),l.requestsPerSecond,"/s"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-3 w-3 text-muted-foreground"}),La(l.avgResponseTime)]}),e.jsxs("span",{className:d.cn("flex items-center gap-1",l.errorRate>5&&"text-red-500",l.errorRate>1&&l.errorRate<=5&&"text-yellow-500"),children:[e.jsx(x.AlertTriangle,{className:"h-3 w-3"}),l.errorRate.toFixed(2),"%"]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["p50: ",La(l.p50ResponseTime)]}),e.jsxs("span",{children:["p95: ",La(l.p95ResponseTime)]}),e.jsxs("span",{children:["p99: ",La(l.p99ResponseTime)]})]}),t.tags&&t.tags.length>0&&e.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[t.tags.slice(0,3).map(c=>e.jsx(ne,{variant:"secondary",className:"text-xs",children:c},c)),t.tags.length>3&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",t.tags.length-3]})]})]}),e.jsxs("div",{className:"text-right shrink-0 space-y-1",children:[e.jsxs("div",{className:"text-lg font-bold text-green-500",children:[l.successRate.toFixed(1),"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Success"}),t.instances&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.instances," instances"]})]})]}),(l.cpuUsage!==void 0||l.memoryUsage!==void 0)&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-4 pt-3 border-t",children:[l.cpuUsage!==void 0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Cpu,{className:"h-3 w-3"})," CPU"]}),e.jsxs("span",{className:d.cn(l.cpuUsage>80&&"text-red-500"),children:[l.cpuUsage,"%"]})]}),e.jsx(Be,{value:l.cpuUsage,className:d.cn("h-1.5",l.cpuUsage>80&&"[&>div]:bg-red-500")})]}),l.memoryUsage!==void 0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(x.MemoryStick,{className:"h-3 w-3"})," Memory"]}),e.jsxs("span",{className:d.cn(l.memoryUsage>80&&"text-red-500"),children:[l.memoryUsage,"%"]})]}),e.jsx(Be,{value:l.memoryUsage,className:d.cn("h-1.5",l.memoryUsage>80&&"[&>div]:bg-red-500")})]})]})]})})}function uI({transactions:t,onClick:s}){return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Activity,{className:"h-4 w-4"}),"Recent Transactions"]})}),e.jsx(fe,{children:e.jsx(Ie,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-2",children:t.map(a=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>s?.(a),children:[a.status==="success"?e.jsx(x.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0"}):e.jsx(x.XCircle,{className:"h-4 w-4 text-red-500 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:a.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.service})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:d.cn("text-sm font-medium",a.duration>1e3&&"text-yellow-500",a.duration>3e3&&"text-red-500"),children:La(a.duration)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.timestamp.toLocaleTimeString()})]})]},a.id))})})})]})}function mI({services:t,recentTransactions:s=[],timeRange:a="1h",onTimeRangeChange:r,onServiceClick:n,onTransactionClick:l,onRefresh:o,className:c}){const[m,u]=i.useState("all"),h=i.useMemo(()=>{const g=t.reduce((w,y)=>w+y.metrics.requestsPerSecond,0),p=t.reduce((w,y)=>w+y.metrics.avgResponseTime,0)/t.length,j=t.reduce((w,y)=>w+y.metrics.errorRate,0)/t.length,b=t.filter(w=>w.status==="healthy").length;return{totalRequests:g,avgResponseTime:p,avgErrorRate:j,healthyCount:b,totalServices:t.length}},[t]),f=i.useMemo(()=>m==="all"?t:t.filter(g=>g.status===m),[t,m]);return e.jsxs("div",{className:d.cn("space-y-6",c),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Activity,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:"Application Performance"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Monitor service health and performance metrics"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ee,{value:a,onValueChange:g=>r?.(g),children:[e.jsxs($e,{className:"w-28",children:[e.jsx(x.Clock,{className:"h-4 w-4 mr-2"}),e.jsx(Re,{})]}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"1h",children:"Last 1h"}),e.jsx(xe,{value:"6h",children:"Last 6h"}),e.jsx(xe,{value:"24h",children:"Last 24h"}),e.jsx(xe,{value:"7d",children:"Last 7d"}),e.jsx(xe,{value:"30d",children:"Last 30d"})]})]}),o&&e.jsx(L.Button,{variant:"outline",onClick:o,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})})]})]})})}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(Fr,{title:"Total Requests",value:h.totalRequests,unit:"/s",icon:x.Zap}),e.jsx(Fr,{title:"Avg Response Time",value:h.avgResponseTime,unit:"ms",icon:x.Clock,status:h.avgResponseTime>500?"warning":"healthy"}),e.jsx(Fr,{title:"Error Rate",value:h.avgErrorRate,unit:"%",icon:x.AlertTriangle,status:h.avgErrorRate>5?"critical":h.avgErrorRate>1?"warning":"healthy"}),e.jsx(Fr,{title:"Services Healthy",value:h.healthyCount,unit:`/ ${h.totalServices}`,icon:x.CheckCircle2,status:h.healthyCount===h.totalServices?"healthy":"warning"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsxs("div",{className:"col-span-2 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:"Services"}),e.jsx("div",{className:"flex items-center gap-2",children:["all","healthy","warning","critical"].map(g=>e.jsx(L.Button,{variant:m===g?"default":"ghost",size:"sm",onClick:()=>u(g),children:g==="all"?"All":uc[g].label},g))})]}),e.jsx(Ie,{className:"h-[500px]",children:e.jsx("div",{className:"space-y-4 pr-4",children:f.map(g=>e.jsx(dI,{service:g,onClick:()=>n?.(g)},g.id))})})]}),e.jsx("div",{children:e.jsx(uI,{transactions:s,onClick:l})})]})]})}const xI=[{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}}],hI=[{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"}],fI={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"}},gI={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 Ju(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(1)} GB`}function pI(t){if(!t)return"N/A";const s=Math.floor((Date.now()-t.getTime())/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const r=Math.floor(a/60);return r<24?`${r}h ${a%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function bI({container:t,onViewLogs:s,onExecShell:a}){const r=fI[t.status],n=t.resources.memory/t.resources.memoryLimit*100;return e.jsx("div",{className:d.cn("border rounded-lg p-3 transition-all hover:bg-muted/30",t.status==="exited"&&"border-red-500/30 bg-red-500/5",t.healthCheck==="unhealthy"&&"border-yellow-500/30"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(x.Container,{className:d.cn("h-5 w-5",r.color)}),t.healthCheck&&t.healthCheck!=="none"&&e.jsx("div",{className:d.cn("absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background",t.healthCheck==="healthy"&&"bg-green-500",t.healthCheck==="unhealthy"&&"bg-red-500",t.healthCheck==="starting"&&"bg-yellow-500")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm truncate",children:t.name}),e.jsx(ne,{variant:"outline",className:d.cn("text-xs",r.color),children:r.label})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:t.image}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-0.5",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(x.Cpu,{className:"h-3 w-3"})," CPU"]}),e.jsxs("span",{children:[t.resources.cpu.toFixed(1),"%"]})]}),e.jsx(Be,{value:t.resources.cpu,className:d.cn("h-1",t.resources.cpu>80&&"[&>div]:bg-red-500")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-0.5",children:[e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(x.MemoryStick,{className:"h-3 w-3"})," MEM"]}),e.jsxs("span",{children:[t.resources.memory,"MB"]})]}),e.jsx(Be,{value:n,className:d.cn("h-1",n>80&&"[&>div]:bg-red-500")})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.Clock,{className:"h-3 w-3"}),pI(t.startedAt)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.ArrowDown,{className:"h-3 w-3"}),Ju(t.resources.networkRx),"/s"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(x.ArrowUp,{className:"h-3 w-3"}),Ju(t.resources.networkTx),"/s"]}),t.restartCount!==void 0&&t.restartCount>0&&e.jsxs("span",{className:"flex items-center gap-1 text-yellow-500",children:[e.jsx(x.RefreshCw,{className:"h-3 w-3"}),t.restartCount," restarts"]})]})]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[s&&e.jsxs(ye,{onClick:s,children:[e.jsx(x.FileText,{className:"h-4 w-4 mr-2"}),"View Logs"]}),a&&e.jsxs(ye,{onClick:a,children:[e.jsx(x.Terminal,{className:"h-4 w-4 mr-2"}),"Shell"]})]})]})]})})}function jI({service:t,onScale:s,onRestart:a,onStop:r,onDelete:n,onViewLogs:l,onExecShell:o}){const[c,m]=i.useState(!1),[u,h]=i.useState(t.replicas.desired),f=gI[t.status],g=t.containers.every(j=>j.status==="running"),p=t.replicas.running/t.replicas.desired*100;return e.jsx(me,{className:d.cn(t.status==="failed"&&"border-red-500/50",!g&&"border-yellow-500/30"),children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:d.cn("p-2 rounded-lg",`${f.bgColor}/10`),children:e.jsx(x.Layers,{className:d.cn("h-5 w-5",f.color)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:t.name}),e.jsx(ne,{className:d.cn("text-white text-xs",f.bgColor),children:f.label})]}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:t.image}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Replicas"}),e.jsxs("span",{className:d.cn(t.replicas.running<t.replicas.desired&&"text-yellow-500"),children:[t.replicas.running,"/",t.replicas.desired," running",t.replicas.ready<t.replicas.running&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",t.replicas.ready," ready)"]})]})]}),e.jsx(Be,{value:p,className:d.cn("h-2",p<100&&"[&>div]:bg-yellow-500",t.status==="failed"&&"[&>div]:bg-red-500")})]}),t.updateStatus&&e.jsxs("div",{className:"mt-3 p-2 bg-muted/50 rounded text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1 text-blue-500",children:[e.jsx(x.RefreshCw,{className:"h-3 w-3 animate-spin"}),t.updateStatus.state]}),e.jsxs("span",{children:[t.updateStatus.progress,"%"]})]}),t.updateStatus.message&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.updateStatus.message}),e.jsx(Be,{value:t.updateStatus.progress,className:"h-1 mt-2"})]}),t.ports&&t.ports.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[e.jsx(x.Network,{className:"h-3 w-3"}),t.ports.map((j,b)=>e.jsxs("span",{children:[j.published,":",j.target,b<t.ports.length-1&&","]},b))]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1 border rounded",children:[e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const j=Math.max(0,u-1);h(j),s?.(j)},children:e.jsx(x.Minus,{className:"h-4 w-4"})}),e.jsx(L.Input,{type:"number",value:u,onChange:j=>{const b=parseInt(j.target.value)||0;h(b)},onBlur:()=>s?.(u),className:"w-12 h-8 text-center border-0 p-0",min:0}),e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const j=u+1;h(j),s?.(j)},children:e.jsx(x.Plus,{className:"h-4 w-4"})})]}),e.jsxs(Ue,{children:[e.jsx(_e,{asChild:!0,children:e.jsx(L.Button,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(x.MoreVertical,{className:"h-4 w-4"})})}),e.jsxs(We,{align:"end",children:[a&&e.jsxs(ye,{onClick:a,children:[e.jsx(x.RefreshCw,{className:"h-4 w-4 mr-2"}),"Restart"]}),r&&e.jsxs(ye,{onClick:r,children:[e.jsx(x.Square,{className:"h-4 w-4 mr-2"}),"Stop"]}),e.jsx(Ke,{}),n&&e.jsxs(ye,{onClick:n,className:"text-destructive",children:[e.jsx(x.Trash2,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),e.jsxs(L.Button,{variant:"ghost",size:"sm",onClick:()=>m(!c),children:[e.jsx(x.Eye,{className:"h-4 w-4 mr-1"}),c?"Hide":"Show"," Containers"]})]})]}),c&&e.jsx("div",{className:"mt-4 pt-4 border-t space-y-2",children:t.containers.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"No containers running"}):t.containers.map(j=>e.jsx(bI,{container:j,onViewLogs:l?()=>l(j):void 0,onExecShell:o?()=>o(j):void 0},j.id))})]})})}function vI({services:t}){const s=i.useMemo(()=>{const a=t.length,r=t.reduce((c,m)=>c+m.containers.length,0),n=t.reduce((c,m)=>c+m.containers.filter(u=>u.status==="running").length,0),l=t.reduce((c,m)=>c+m.containers.reduce((u,h)=>u+h.resources.cpu,0),0),o=t.reduce((c,m)=>c+m.containers.reduce((u,h)=>u+h.resources.memory,0),0);return{totalServices:a,totalContainers:r,runningContainers:n,avgCpu:l/r,totalMemory:o}},[t]);return e.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:s.totalServices}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Services"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:s.totalContainers}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Containers"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:s.runningContainers}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Running"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold",children:[s.avgCpu.toFixed(1),"%"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Avg CPU"})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold",children:[(s.totalMemory/1024).toFixed(1),"GB"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Memory"})]})})]})}function yI({services:t,onScaleService:s,onRestartService:a,onStopService:r,onDeleteService:n,onViewLogs:l,onExecShell:o,onRefresh:c,className:m}){const[u,h]=i.useState(""),[f,g]=i.useState("all"),p=i.useMemo(()=>t.filter(j=>!(u&&!j.name.toLowerCase().includes(u.toLowerCase())||f!=="all"&&j.status!==f)),[t,u,f]);return e.jsxs("div",{className:d.cn("space-y-6",m),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Container,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsx(Ne,{children:"Container Orchestrator"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage and monitor containerized services"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(L.Input,{placeholder:"Search services...",value:u,onChange:j=>h(j.target.value),className:"pl-9 w-64"})]}),e.jsxs(Ee,{value:f,onValueChange:j=>g(j),children:[e.jsx($e,{className:"w-32",children:e.jsx(Re,{placeholder:"Status"})}),e.jsxs(Ae,{children:[e.jsx(xe,{value:"all",children:"All Status"}),e.jsx(xe,{value:"running",children:"Running"}),e.jsx(xe,{value:"updating",children:"Updating"}),e.jsx(xe,{value:"failed",children:"Failed"}),e.jsx(xe,{value:"pending",children:"Pending"})]})]}),c&&e.jsx(L.Button,{variant:"outline",onClick:c,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})})]})]})})}),e.jsx(vI,{services:t}),e.jsx(Ie,{className:"h-[500px]",children:e.jsx("div",{className:"space-y-4 pr-4",children:p.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground",children:[e.jsx(x.Container,{className:"h-12 w-12 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No services found"})]}):p.map(j=>e.jsx(jI,{service:j,onScale:s?b=>s(j,b):void 0,onRestart:a?()=>a(j):void 0,onStop:r?()=>r(j):void 0,onDelete:n?()=>n(j):void 0,onViewLogs:l,onExecShell:o},j.id))})})]})}function Aa(t,s){return Array.from({length:s},(a,r)=>({id:`${t}-${r+1}`,name:`${t}-${r+1}`,image:`myregistry/${t}:latest`,status:"running",createdAt:new Date(Date.now()-(r+1)*36e5),startedAt:new Date(Date.now()-r*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)}}))}const wI=[{id:"1",name:"api-gateway",image:"myregistry/api-gateway:v2.4.1",status:"running",replicas:{desired:3,running:3,ready:3},containers:Aa("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:Aa("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:Aa("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:Aa("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:[...Aa("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)}],e0={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"}},NI={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 go(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(1)} GB`}function t0(t){return t<60?`${t.toFixed(0)}s`:t<3600?`${Math.floor(t/60)}m ${Math.floor(t%60)}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`}function _r(t){return t<1?`${(t*1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(2)}ms`:`${(t/1e3).toFixed(2)}s`}function kI({metrics:t,status:s}){const a=e0[s],r=t.connections.active/t.connections.max*100,n=t.storage.used/t.storage.total*100;return e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx(me,{children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(x.Users,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("div",{className:d.cn("w-2 h-2 rounded-full",a.bgColor)})]}),e.jsx("div",{className:"text-2xl font-bold",children:t.connections.active}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Active Connections"}),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[e.jsxs("span",{children:[t.connections.idle," idle"]}),e.jsxs("span",{children:["max ",t.connections.max]})]}),e.jsx(Be,{value:r,className:d.cn("h-1.5",r>80&&"[&>div]:bg-red-500")})]})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(x.Zap,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs(ne,{variant:"secondary",className:"text-xs",children:[t.transactions.perSecond,"/s"]})]}),e.jsx("div",{className:"text-2xl font-bold",children:t.transactions.committed}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Transactions"}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"text-red-500",children:t.transactions.rolledBack})," rolled back"]})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx(x.Activity,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:d.cn("text-2xl font-bold",t.cache.hitRatio<90&&"text-yellow-500",t.cache.hitRatio<80&&"text-red-500"),children:[t.cache.hitRatio.toFixed(1),"%"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Cache Hit Ratio"}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Buffer: ",t.cache.bufferHit," • Disk: ",t.cache.diskRead]})]})}),e.jsx(me,{children:e.jsxs(fe,{className:"p-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx(x.HardDrive,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("div",{className:"text-2xl font-bold",children:go(t.storage.used)}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Storage Used"}),e.jsxs("div",{className:"mt-2",children:[e.jsx(Be,{value:n,className:d.cn("h-1.5",n>80&&"[&>div]:bg-red-500")}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["of ",go(t.storage.total)]})]})]})})]})}function CI({connections:t,onKill:s}){return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Users,{className:"h-4 w-4"}),"Active Connections"]}),e.jsx(ne,{variant:"secondary",children:t.length})]})}),e.jsx(fe,{children:e.jsx(Ie,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-2",children:t.map(a=>{const r=NI[a.state];return e.jsxs("div",{className:d.cn("flex items-center gap-3 p-2 rounded-lg border",a.state==="idle_in_transaction"&&"border-yellow-500/30",a.duration>60&&"bg-yellow-500/5"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.user}),e.jsx(ne,{variant:"outline",className:d.cn("text-xs",r.color),children:r.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@ ",a.database]})]}),a.query&&e.jsx("code",{className:"text-xs text-muted-foreground block truncate mt-1",children:a.query})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("div",{className:d.cn("text-sm font-medium",a.duration>60&&"text-yellow-500",a.duration>300&&"text-red-500"),children:t0(a.duration)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.client})]}),s&&a.state!=="idle"&&e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-500",onClick:()=>s(a),children:e.jsx(x.XCircle,{className:"h-4 w-4"})})]},a.id)})})})})]})}function SI({backups:t,onRestore:s,onCreate:a}){return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Download,{className:"h-4 w-4"}),"Backups"]}),a&&e.jsxs(L.Button,{size:"sm",onClick:a,children:[e.jsx(x.Upload,{className:"h-4 w-4 mr-1"}),"Create Backup"]})]})}),e.jsx(fe,{children:e.jsx(Ie,{className:"h-[200px]",children:e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg border",children:[r.status==="completed"?e.jsx(x.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0"}):r.status==="failed"?e.jsx(x.XCircle,{className:"h-4 w-4 text-red-500 shrink-0"}):r.status==="running"?e.jsx(x.RefreshCw,{className:"h-4 w-4 text-blue-500 animate-spin shrink-0"}):e.jsx(x.Clock,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:r.name}),e.jsx(ne,{variant:"outline",className:"text-xs",children:r.type})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.startedAt.toLocaleString(),r.duration&&` • ${t0(r.duration)}`]})]}),e.jsx("div",{className:"text-right shrink-0",children:r.size&&e.jsx("div",{className:"text-sm font-medium",children:go(r.size)})}),s&&r.status==="completed"&&e.jsx(L.Button,{variant:"ghost",size:"sm",onClick:()=>s(r),children:e.jsx(x.RotateCcw,{className:"h-4 w-4"})})]},r.id))})})})]})}function MI({queries:t}){const[s,a]=i.useState(null),r=n=>{navigator.clipboard.writeText(n.query),a(n.id),setTimeout(()=>a(null),2e3)};return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4 text-yellow-500"}),"Slow Queries"]})}),e.jsx(fe,{children:e.jsx(Ie,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"p-2 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("code",{className:"text-xs font-mono line-clamp-2 flex-1",children:n.query}),e.jsx(L.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0",onClick:()=>r(n),children:s===n.id?e.jsx(x.CheckCircle2,{className:"h-3 w-3 text-green-500"}):e.jsx(x.Copy,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Calls: ",e.jsx("strong",{children:n.calls})]}),e.jsxs("span",{children:["Mean: ",e.jsx("strong",{className:"text-yellow-500",children:_r(n.meanTime)})]}),e.jsxs("span",{children:["Max: ",e.jsx("strong",{className:"text-red-500",children:_r(n.maxTime)})]}),e.jsxs("span",{children:["Total: ",e.jsx("strong",{children:_r(n.totalTime)})]}),e.jsxs("span",{children:["Rows: ",e.jsx("strong",{children:n.rows})]})]})]},n.id))})})})]})}function TI({onExecute:t}){const[s,a]=i.useState(""),[r,n]=i.useState([]),l=()=>{s.trim()&&(t?.(s),n(o=>[s,...o.slice(0,9)]))};return e.jsxs(me,{children:[e.jsx(we,{className:"pb-2",children:e.jsxs(Ne,{className:"text-base flex items-center gap-2",children:[e.jsx(x.Terminal,{className:"h-4 w-4"}),"Query Editor"]})}),e.jsxs(fe,{className:"space-y-3",children:[e.jsx(L.Textarea,{value:s,onChange:o=>a(o.target.value),placeholder:"SELECT * FROM users LIMIT 10;",className:"font-mono text-sm min-h-[120px]"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:r.length>0&&e.jsxs(Ee,{onValueChange:o=>a(o),children:[e.jsxs($e,{className:"w-40",children:[e.jsx(x.History,{className:"h-4 w-4 mr-2"}),"History"]}),e.jsx(Ae,{children:r.map((o,c)=>e.jsx(xe,{value:o,children:e.jsx("span",{className:"truncate max-w-[300px]",children:o})},c))})]})}),e.jsxs(L.Button,{onClick:l,disabled:!s.trim(),children:[e.jsx(x.Play,{className:"h-4 w-4 mr-1"}),"Execute"]})]})]})]})}function DI({instance:t,onExecuteQuery:s,onCreateBackup:a,onRestoreBackup:r,onKillConnection:n,onRefresh:l,className:o}){const c=e0[t.status];return e.jsxs("div",{className:d.cn("space-y-6",o),children:[e.jsx(me,{children:e.jsx(we,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.Database,{className:"h-6 w-6"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{children:t.name}),e.jsx(ne,{className:d.cn("text-white",c.bgColor),children:c.label}),e.jsx(ne,{variant:"outline",children:t.role})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.type," ",t.version," • ",t.host,":",t.port]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.metrics.replication&&e.jsxs(ne,{variant:"outline",className:d.cn(t.metrics.replication.lag>1e3?"text-red-500":t.metrics.replication.lag>100?"text-yellow-500":"text-green-500"),children:["Replication: ",_r(t.metrics.replication.lag)," lag"]}),l&&e.jsx(L.Button,{variant:"outline",onClick:l,children:e.jsx(x.RefreshCw,{className:"h-4 w-4"})})]})]})})}),e.jsx(kI,{metrics:t.metrics,status:t.status}),e.jsxs(rs,{defaultValue:"connections",children:[e.jsxs(Ut,{children:[e.jsxs(dt,{value:"connections",children:[e.jsx(x.Users,{className:"h-4 w-4 mr-1"}),"Connections"]}),e.jsxs(dt,{value:"queries",children:[e.jsx(x.Terminal,{className:"h-4 w-4 mr-1"}),"Query"]}),e.jsxs(dt,{value:"slow",children:[e.jsx(x.AlertTriangle,{className:"h-4 w-4 mr-1"}),"Slow Queries"]}),e.jsxs(dt,{value:"backups",children:[e.jsx(x.Download,{className:"h-4 w-4 mr-1"}),"Backups"]})]}),e.jsx(ut,{value:"connections",className:"mt-4",children:e.jsx(CI,{connections:t.connections,onKill:n})}),e.jsx(ut,{value:"queries",className:"mt-4",children:e.jsx(TI,{onExecute:s})}),e.jsx(ut,{value:"slow",className:"mt-4",children:e.jsx(MI,{queries:t.slowQueries})}),e.jsx(ut,{value:"backups",className:"mt-4",children:e.jsx(SI,{backups:t.backups,onRestore:r,onCreate:a})})]})]})}const $I={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}]};exports.cn=d.cn;exports.tweak=d.tweak;exports.Button=L.Button;exports.Input=L.Input;exports.Label=L.Label;exports.Popover=L.Popover;exports.PopoverContent=L.PopoverContent;exports.PopoverTrigger=L.PopoverTrigger;exports.Separator=L.Separator;exports.Textarea=L.Textarea;exports.WakaRichTextEditor=L.WakaRichTextEditor;exports.CHART_SIZE_MAP=yt.CHART_SIZE_MAP;exports.DEFAULT_CHART_COLORS=yt.DEFAULT_CHART_COLORS;exports.Skeleton=yt.Skeleton;exports.WakaAreaChart=yt.WakaAreaChart;exports.WakaBarChart=yt.WakaBarChart;exports.WakaChart=yt.WakaChart;exports.WakaLineChart=yt.WakaLineChart;exports.WakaMiniChart=yt.WakaMiniChart;exports.WakaPieChart=yt.WakaPieChart;exports.WakaSparkline=yt.WakaSparkline;exports.createChartColumn=yt.createChartColumn;exports.sparklineTemplate=yt.sparklineTemplate;exports.useChartTheme=yt.useChartTheme;exports.useRechartsLoader=yt.useRechartsLoader;exports.useDataTableExport=Vr.useDataTableExport;exports.useDataTableImport=Vr.useDataTableImport;exports.AD_SIZES=Wn;exports.APMOverview=mI;exports.Accordion=Rl;exports.AccordionContent=vo;exports.AccordionItem=bo;exports.AccordionTrigger=jo;exports.AdmincrumbProvider=C$;exports.Alert=am;exports.AlertDescription=nm;exports.AlertDialog=zs;exports.AlertDialogAction=vs;exports.AlertDialogCancel=ys;exports.AlertDialogContent=fs;exports.AlertDialogDescription=js;exports.AlertDialogFooter=ps;exports.AlertDialogHeader=gs;exports.AlertDialogOverlay=yo;exports.AlertDialogPortal=sm;exports.AlertDialogTitle=bs;exports.AlertDialogTrigger=tm;exports.AlertTitle=rm;exports.AspectRatio=X0;exports.Auth2FA=aR;exports.Avatar=tt;exports.AvatarFallback=at;exports.AvatarImage=st;exports.Badge=ne;exports.BlockLanguageSelector=E$;exports.Blockquote=vx;exports.CICDBuilder=ER;exports.COUNTRIES=Fs;exports.Calendar=jn;exports.CallTimer=bg;exports.Card=me;exports.CardContent=fe;exports.CardDescription=Ze;exports.CardFooter=Ft;exports.CardHeader=we;exports.CardTitle=Ne;exports.ChatInterface=cR;exports.Checkbox=xt;exports.CheckoutFlow=UE;exports.CheckoutNavigation=Hf;exports.CheckoutProgressBar=O4;exports.CloudCostDashboard=ZR;exports.Code=dm;exports.Collapsible=um;exports.CollapsibleContent=xm;exports.CollapsibleTrigger=mm;exports.Command=ws;exports.CommandDialog=Pb;exports.CommandEmpty=Os;exports.CommandGroup=ts;exports.CommandInput=Ws;exports.CommandItem=ss;exports.CommandList=ar;exports.CommandSeparator=Hr;exports.CommandShortcut=gm;exports.ConnectionQualityIndicator=Bn;exports.ContainerOrchestrator=yI;exports.ContextMenu=pm;exports.ContextMenuCheckboxItem=ym;exports.ContextMenuContent=Mo;exports.ContextMenuGroup=Lb;exports.ContextMenuItem=Xt;exports.ContextMenuLabel=Nm;exports.ContextMenuPortal=Fb;exports.ContextMenuRadioGroup=zb;exports.ContextMenuRadioItem=wm;exports.ContextMenuSeparator=Fa;exports.ContextMenuShortcut=km;exports.ContextMenuSub=Bb;exports.ContextMenuSubContent=vm;exports.ContextMenuSubTrigger=jm;exports.ContextMenuTrigger=bm;exports.ControlButton=Gt;exports.DashboardKPI=FE;exports.DataTable=hj;exports.DataTableAdvanced=bj;exports.DataTableColumnResizer=jj;exports.DataTableContextMenu=Nj;exports.DataTableEditCell=qr;exports.DataTableFilters=Vo;exports.DataTableGroupTotals=yj;exports.DataTableGrouping=vj;exports.DataTableGroupingControls=wj;exports.DataTablePagination=_o;exports.DataTableSelection=kj;exports.DataTableToolbar=Ya;exports.DatabaseAdmin=DI;exports.DeploymentDashboard=gR;exports.Dialog=Jt;exports.DialogClose=fm;exports.DialogContent=Ot;exports.DialogDescription=na;exports.DialogFooter=xs;exports.DialogHeader=ms;exports.DialogOverlay=So;exports.DialogPortal=hm;exports.DialogTitle=es;exports.DialogTrigger=Ib;exports.DrawerBody=Yo;exports.DrawerClose=ev;exports.DrawerDescription=Yr;exports.DrawerFooter=Zo;exports.DrawerHeader=Xo;exports.DrawerTitle=Xr;exports.DrawerTrigger=Jj;exports.DropdownMenu=Ue;exports.DropdownMenuCheckboxItem=As;exports.DropdownMenuContent=We;exports.DropdownMenuGroup=Wb;exports.DropdownMenuItem=ye;exports.DropdownMenuLabel=Ls;exports.DropdownMenuPortal=Ob;exports.DropdownMenuRadioGroup=_b;exports.DropdownMenuRadioItem=Mm;exports.DropdownMenuSeparator=Ke;exports.DropdownMenuShortcut=Tm;exports.DropdownMenuSub=Ub;exports.DropdownMenuSubContent=Sm;exports.DropdownMenuSubTrigger=Cm;exports.DropdownMenuTrigger=_e;exports.EmptyCartState=FA;exports.Error403Page=UA;exports.Error404Page=WA;exports.Error500Page=OA;exports.ErrorState=zA;exports.Footer=D$;exports.Form=Vb;exports.FormControl=Rm;exports.FormDescription=Im;exports.FormField=Hb;exports.FormItem=Am;exports.FormLabel=Em;exports.FormMessage=Pm;exports.GitOpsSyncStatus=nI;exports.Heading=bx;exports.Headtab=$$;exports.HeadtabBreadcrumb=A$;exports.HoverCard=Gb;exports.HoverCardContent=Lm;exports.HoverCardTrigger=qb;exports.IncidentManager=NR;exports.InfrastructureMap=TR;exports.InputOTP=Fm;exports.KPICard=$g;exports.Kbd=wx;exports.LanguageProvider=wp;exports.LanguageSelector=Yb;exports.Layout=R$;exports.LayoutSelector=vg;exports.LegacyThemeProvider=g$;exports.Login=I$;exports.MaintenancePage=_A;exports.Menubar=Wm;exports.MenubarCheckboxItem=Gm;exports.MenubarContent=Vm;exports.MenubarGroup=Kb;exports.MenubarItem=Hm;exports.MenubarLabel=Xm;exports.MenubarMenu=Zb;exports.MenubarPortal=Qb;exports.MenubarRadioGroup=ej;exports.MenubarRadioItem=qm;exports.MenubarSeparator=Ym;exports.MenubarShortcut=Zm;exports.MenubarSub=Jb;exports.MenubarSubContent=_m;exports.MenubarSubTrigger=Um;exports.MenubarTrigger=Om;exports.ModalBody=ei;exports.ModalContent=Qo;exports.ModalDescription=Kr;exports.ModalFooter=ti;exports.ModalHeader=Jo;exports.ModalOverlay=Ko;exports.ModalTitle=Zr;exports.NavigationMenu=Km;exports.NavigationMenuContent=tx;exports.NavigationMenuIndicator=sx;exports.NavigationMenuItem=tj;exports.NavigationMenuLink=sj;exports.NavigationMenuList=Qm;exports.NavigationMenuTrigger=ex;exports.NavigationMenuViewport=$o;exports.NoDataState=RA;exports.NoFilesState=LA;exports.NoMessagesState=PA;exports.NoNotificationsState=BA;exports.NoResultsState=IA;exports.OfflinePage=VA;exports.OnCallScheduleBlock=_R;exports.POINTS_PRESETS=ta;exports.ParticipantAvatar=Hi;exports.ParticipantsPanel=jg;exports.PlayerProfile=ZE;exports.Progress=Be;exports.RadioGroup=qa;exports.RadioGroupItem=Xa;exports.RecordingIndicator=pg;exports.ReleaseNotes=FR;exports.ScrollArea=Ie;exports.ScrollBar=Ao;exports.Select=Ee;exports.SelectContent=Ae;exports.SelectGroup=Xb;exports.SelectItem=xe;exports.SelectLabel=Bm;exports.SelectScrollDownButton=Do;exports.SelectScrollUpButton=To;exports.SelectSeparator=zm;exports.SelectTrigger=$e;exports.SelectValue=Re;exports.SessionCard=eg;exports.SessionConfirmDialog=Jf;exports.Sheet=nr;exports.SheetClose=aj;exports.SheetContent=ua;exports.SheetDescription=or;exports.SheetFooter=Io;exports.SheetHeader=vn;exports.SheetOverlay=Ro;exports.SheetPortal=ax;exports.SheetTitle=lr;exports.SheetTrigger=Eo;exports.SidebarLayout=z$;exports.Slider=Gr;exports.StepperNavigation=Lv;exports.SuggestionDropdown=qg;exports.Switch=Us;exports.Table=yn;exports.TableBody=Nn;exports.TableCaption=nx;exports.TableCell=ft;exports.TableFooter=rx;exports.TableHead=jt;exports.TableHeader=wn;exports.TableRow=us;exports.Tabs=rs;exports.TabsContent=ut;exports.TabsList=Ut;exports.TabsTrigger=dt;exports.TagChip=Gg;exports.Text=gx;exports.ThemeLoader=ko;exports.ThemeProvider=ox;exports.ThemeSelector=ix;exports.Toast=Lo;exports.ToastAction=dx;exports.ToastClose=Fo;exports.ToastDescription=zo;exports.ToastProvider=cx;exports.ToastTitle=Bo;exports.ToastViewport=Po;exports.Toaster=dj;exports.Toggle=hx;exports.Tooltip=Ge;exports.TooltipContent=Oe;exports.TooltipProvider=He;exports.TooltipTrigger=qe;exports.VideoTile=aa;exports.Waka3DPieChart=Ky;exports.WakaAchievementBadge=Fh;exports.WakaAchievementGrid=uN;exports.WakaAchievementUnlock=dN;exports.WakaActivityFeed=KC;exports.WakaActivityTimeline=dA;exports.WakaAdBanner=tr;exports.WakaAdFallback=oo;exports.WakaAdInline=i$;exports.WakaAdInterstitial=c$;exports.WakaAdPlaceholder=On;exports.WakaAdProvider=l$;exports.WakaAdSidebar=o$;exports.WakaAdStickyFooter=d$;exports.WakaAddressAutocomplete=Ug;exports.WakaAdmincrumb=Ex;exports.WakaAlertPanel=DD;exports.WakaAlertStack=Ak;exports.WakaAllocationMatrix=lk;exports.WakaAppDock=M1;exports.WakaApprovalChain=gk;exports.WakaArtifactList=h6;exports.WakaAsyncButton=sh;exports.WakaAuditLog=AS;exports.WakaAutocomplete=Ho;exports.WakaAutocompleteForm=Rx;exports.WakaBadgeShowcase=$n;exports.WakaBadgeShowcaseCompact=Yk;exports.WakaBadgeShowcaseHero=Kk;exports.WakaBadgeShowcaseList=Zk;exports.WakaBadgeStats=Qk;exports.WakaBarcode=Ij;exports.WakaBiometricPrompt=ig;exports.WakaBottomSheet=Jx;exports.WakaBreadcrumb=Lj;exports.WakaBreadcrumbPath=zy;exports.WakaBudgetBurn=qw;exports.WakaBuildMatrix=r6;exports.WakaCalendarView=vA;exports.WakaCapacityPlanner=Q2;exports.WakaCarousel=Bj;exports.WakaCartSummary=P4;exports.WakaChallengeTimer=vC;exports.WakaChallengeTimerSkeleton=yC;exports.WakaChat=Ap;exports.WakaChatBubble=mg;exports.WakaChatDateSeparator=p3;exports.WakaChatSystemMessage=b3;exports.WakaChatTypingIndicator=g3;exports.WakaChatWidget=wA;exports.WakaChecklist=XT;exports.WakaCheckoutStepper=U4;exports.WakaCohortTable=fM;exports.WakaColorPicker=Go;exports.WakaColorPickerForm=Px;exports.WakaComboCounter=vN;exports.WakaCombobox=Uj;exports.WakaCommandBar=x1;exports.WakaCompactDailyReward=nC;exports.WakaCompactGoalProgress=Ig;exports.WakaCompactLevelProgress=kN;exports.WakaComparePeriod=v4;exports.WakaConfigComparator=B6;exports.WakaConnectionMatrix=Ck;exports.WakaContainerList=ID;exports.WakaContentRecommendation=m$;exports.WakaContributionGraph=Aw;exports.WakaCostBreakdown=zw;exports.WakaCouponInput=qf;exports.WakaCpuGauge=rw;exports.WakaCreditCardInput=dT;exports.WakaDailyReward=rC;exports.WakaDashboard=G$;exports.WakaDatabaseCard=G6;exports.WakaDateRangePicker=Vj;exports.WakaDateTimePicker=qo;exports.WakaDateTimePickerForm=Gj;exports.WakaDependencyTree=C6;exports.WakaDeploymentLane=xk;exports.WakaDeviceTrust=n3;exports.WakaDock=bi;exports.WakaDrawer=Kj;exports.WakaEmptyState=Ji;exports.WakaEmptyStateError=JT;exports.WakaEmptyStateSearch=QT;exports.WakaEnvVarEditor=T6;exports.WakaErrorPage=ja;exports.WakaErrorShake=Cn;exports.WakaFAQ=XA;exports.WakaFeatureAnnouncement=lD;exports.WakaFeatureFlagRow=O6;exports.WakaFileManager=JA;exports.WakaFileUpload=Bx;exports.WakaFloatingDock=S1;exports.WakaFloatingNav=Py;exports.WakaFlowDiagram=$1;exports.WakaFormFieldShake=Th;exports.WakaFunnelChart=qi;exports.WakaFunnelChartCompact=oM;exports.WakaFunnelChartSimple=lM;exports.WakaGlowCard=ha;exports.WakaGlowCardDanger=v1;exports.WakaGlowCardPrimary=p1;exports.WakaGlowCardRainbow=y1;exports.WakaGlowCardSuccess=b1;exports.WakaGlowCardWarning=j1;exports.WakaGlowGrid=w1;exports.WakaGoalCard=Pg;exports.WakaGoalProgress=Zi;exports.WakaHapticButton=oi;exports.WakaHapticIconButton=eh;exports.WakaHeader=W$;exports.WakaHealthPulse=Kh;exports.WakaHeatmap=EM;exports.WakaHotspot=ep;exports.WakaHotspotGroup=OT;exports.WakaI18nEditor=EE;exports.WakaImage=zx;exports.WakaImageGallery=sv;exports.WakaIncidentTimeline=E2;exports.WakaInvoicePreview=rS;exports.WakaKPIDashboard=yM;exports.WakaKanban=lv;exports.WakaKanbanBoard=rE;exports.WakaKubernetesOverview=WD;exports.WakaLanding=mE;exports.WakaLeaderboard=MN;exports.WakaLevelBadge=nn;exports.WakaLevelProgress=NN;exports.WakaLiquidButton=Ns;exports.WakaLiquidButtonDestructive=lh;exports.WakaLiquidButtonGradient=ih;exports.WakaLiquidButtonNeon=ch;exports.WakaLiquidButtonPrimary=rh;exports.WakaLiquidButtonSecondary=nh;exports.WakaLiquidButtonSuccess=oh;exports.WakaLoadingOrbit=qs;exports.WakaLoadingOrbitAtom=Ah;exports.WakaLoadingOrbitGalaxy=Rh;exports.WakaLoadingOrbitMinimal=Eh;exports.WakaLoadingOrbitSimple=Dh;exports.WakaLoadingOrbitSolar=$h;exports.WakaLogViewer=yD;exports.WakaLootBox=vf;exports.WakaMagicLink=k1;exports.WakaMagneticButton=ci;exports.WakaMagneticIconButton=uh;exports.WakaMagneticLink=mh;exports.WakaMentionInput=zf;exports.WakaMetricSparkline=d2;exports.WakaMigrationList=K6;exports.WakaMilestoneRoad=zN;exports.WakaMiniLeaderboard=TN;exports.WakaMiniStreak=VN;exports.WakaModal=uv;exports.WakaModalTrigger=mv;exports.WakaMorphButton=ii;exports.WakaMultiQuotaBar=_2;exports.WakaNetworkGauge=ow;exports.WakaNetworkTopology=J1;exports.WakaNotifications=Ox;exports.WakaNumberInput=vv;exports.WakaOrbitalMenu=bh;exports.WakaOrbitalMenuCompact=qy;exports.WakaOrderTracker=K4;exports.WakaOutstreamVideo=h$;exports.WakaPagination=Nv;exports.WakaPasswordStrength=dS;exports.WakaPasswordStrengthIndicator=uS;exports.WakaPaymentMethodPicker=Fn;exports.WakaPaymentMethodPickerCards=H5;exports.WakaPaymentMethodPickerCompact=q5;exports.WakaPaymentMethodPickerRadio=G5;exports.WakaPermissionMatrix=wS;exports.WakaPhoneInput=aT;exports.WakaPipelineView=R1;exports.WakaPlayerCard=b5;exports.WakaPodCard=YD;exports.WakaPodium=zh;exports.WakaPointsPopup=Ri;exports.WakaPowerUp=Ei;exports.WakaPowerUpList=Sf;exports.WakaPresenceAvatarStack=F5;exports.WakaPresenceCard=Ef;exports.WakaPresenceIndicator=Ja;exports.WakaPresenceLastSeen=Af;exports.WakaPresenceList=L5;exports.WakaPresenceSelector=P5;exports.WakaPresenceStatusBadge=I5;exports.WakaPresenceWithAvatar=Ln;exports.WakaPricing=wE;exports.WakaPricingTable=C4;exports.WakaProductCard=s4;exports.WakaProductCardSkeleton=r4;exports.WakaProductGrid=a4;exports.WakaProfile=eA;exports.WakaProgressOnboarding=iD;exports.WakaProvider=w$;exports.WakaPullToRefresh=Qx;exports.WakaQRCode=Sv;exports.WakaQueryExplain=s$;exports.WakaQuestCard=Oh;exports.WakaQuestCardSkeleton=XN;exports.WakaQuestList=YN;exports.WakaQuotaBar=tf;exports.WakaRadarScore=di;exports.WakaRadarScoreCompare=Zy;exports.WakaRadarScoreSimple=Yy;exports.WakaRamGauge=nw;exports.WakaRankBadge=wf;exports.WakaRankBadgeGroup=AC;exports.WakaRatingDisplay=yT;exports.WakaRatingInput=Yg;exports.WakaReactionPicker=Ng;exports.WakaRegionMap=V1;exports.WakaResourceGauge=ma;exports.WakaResourceGaugeGroup=iw;exports.WakaResourcePool=F2;exports.WakaResourcePoolComparison=B2;exports.WakaRollbackSlider=W1;exports.WakaSLATracker=ff;exports.WakaSankeyDiagram=FM;exports.WakaSchedulePicker=Qg;exports.WakaScratchCard=_h;exports.WakaSeasonPass=A5;exports.WakaSecretCard=I6;exports.WakaSecurityScanResult=j6;exports.WakaSecurityScore=ng;exports.WakaSecurityScoreCompact=lg;exports.WakaSegmentedControl=Tv;exports.WakaServerRack=Yh;exports.WakaServerRackDemo=q1;exports.WakaServiceGraph=e6;exports.WakaSessionManager=gS;exports.WakaSettings=Z$;exports.WakaSidebar=Sp;exports.WakaSignaturePad=Wg;exports.WakaSkeletonAvatar=kn;exports.WakaSkeletonCard=Ch;exports.WakaSkeletonGrid=Mh;exports.WakaSkeletonList=Sh;exports.WakaSkeletonText=mi;exports.WakaSkeletonWave=Bt;exports.WakaSkillTree=pC;exports.WakaSliderRange=gT;exports.WakaSpinWheel=Tf;exports.WakaSpinner=Ux;exports.WakaSponsoredBadge=Mt;exports.WakaSponsoredCard=vp;exports.WakaSponsoredFeed=u$;exports.WakaSpotlight=f1;exports.WakaStat=_x;exports.WakaStatGroup=Vx;exports.WakaStatsHexagon=Pn;exports.WakaStatsHexagonRPG=k5;exports.WakaStatsHexagonSimple=N5;exports.WakaStatsHexagonSkills=C5;exports.WakaStatusMatrix=jw;exports.WakaStepper=Pv;exports.WakaStorageGauge=lw;exports.WakaStreakCounter=_N;exports.WakaSuccessExplosion=ui;exports.WakaSwipeCard=sy;exports.WakaSwipeCardActions=ay;exports.WakaTabPanel=Hy;exports.WakaTabsMorph=_y;exports.WakaTagInput=Xg;exports.WakaTeamBanner=Ti;exports.WakaTeamBannerCompact=UC;exports.WakaTeamBannerExpanded=_C;exports.WakaTerminalOutput=b2;exports.WakaTestReport=c6;exports.WakaThemeCreator=Hx;exports.WakaThemeManager=qx;exports.WakaThreadView=W3;exports.WakaTiltCard=Hh;exports.WakaTiltShowcaseCard=N1;exports.WakaTimePicker=Ov;exports.WakaTimeline=_v;exports.WakaTooltipTour=jD;exports.WakaTourGuide=IT;exports.WakaTournamentBracket=BC;exports.WakaTraceViewer=kD;exports.WakaTree=Gv;exports.WakaTreemapChart=_M;exports.WakaTwoFactorSetup=m4;exports.WakaTypewriter=cr;exports.WakaTypewriterCode=ph;exports.WakaTypewriterHeading=fh;exports.WakaTypewriterLines=gh;exports.WakaTypingIndicator=br;exports.WakaTypingIndicatorDots=hg;exports.WakaTypingIndicatorPulse=gg;exports.WakaTypingIndicatorText=fg;exports.WakaUserManagement=lA;exports.WakaVersusCard=o1;exports.WakaVideo=Xv;exports.WakaVideoAd=x$;exports.WakaVideoCall=E3;exports.WakaVideoOverlay=f$;exports.WakaVirtualList=Kv;exports.WakaVoiceMessage=tM;exports.WakaWelcomeModal=pv;exports.WakaWizard=TE;exports.WakaXPBar=pf;exports.addChildNode=li;exports.applyTheme=kb;exports.badgeVariants=lm;exports.blockquoteVariants=jx;exports.calculateDuration=rb;exports.compareRanges=jb;exports.createBookingDateValidator=db;exports.createCardExpiryValidator=cb;exports.createCommonPresets=Y0;exports.createCustomPreset=Q0;exports.createHighlightRegex=d1;exports.createLastDaysPresets=Z0;exports.createMaxAgeValidator=sb;exports.createMaxRangeDaysValidator=ub;exports.createMinAgeValidator=tb;exports.createMonthlyPresets=fb;exports.createNextDaysPresets=K0;exports.createQuarterPresets=hb;exports.createSafeRegex=c1;exports.dateToTimestamp=gb;exports.defaultAPMServices=xI;exports.defaultAPMTransactions=hI;exports.defaultAchievements=QE;exports.defaultActivities=mA;exports.defaultActivityFilters=uA;exports.defaultArtifacts=f6;exports.defaultBackupCodes=rR;exports.defaultBadges=JE;exports.defaultBuildMatrixColumns=n6;exports.defaultBuildMatrixRows=l6;exports.defaultCalendarEvents=yA;exports.defaultCartItems=_E;exports.defaultCategories=zn;exports.defaultChatConversations=AA;exports.defaultChatInterfaceConversations=dR;exports.defaultChatInterfaceMessages=uR;exports.defaultChatInterfaceUsers=qt;exports.defaultChatMessages=EA;exports.defaultChatUser=Va;exports.defaultCloudCostItems=QR;exports.defaultCloudCostSummary=KR;exports.defaultConfigEnvironments=z6;exports.defaultConnections=s6;exports.defaultContainers=PD;exports.defaultCostAnomalies=JR;exports.defaultCoverage=u6;exports.defaultDashboardStats=q$;exports.defaultDatabase=fp;exports.defaultDatabaseInstance=$I;exports.defaultDatabases=q6;exports.defaultDependencies=S6;exports.defaultDeployments=_p;exports.defaultEnvVariables=D6;exports.defaultEnvironments=bR;exports.defaultFAQCategories=YA;exports.defaultFAQItems=ZA;exports.defaultFeatureFlags=U6;exports.defaultFeatures=T4;exports.defaultFileManagerBreadcrumbs=tE;exports.defaultFiles=eE;exports.defaultGitOpsApplications=lI;exports.defaultGoals=zE;exports.defaultIncidents=kR;exports.defaultInfraResources=DR;exports.defaultK8sDeployments=_D;exports.defaultK8sNamespaces=HD;exports.defaultK8sNodes=OD;exports.defaultK8sPods=UD;exports.defaultK8sServices=VD;exports.defaultKPIMetrics=BE;exports.defaultKanbanColumns=nE;exports.defaultKanbanLabels=lE;exports.defaultLandingCTA=pE;exports.defaultLandingFeatures=hE;exports.defaultLandingHero=gE;exports.defaultLandingNavItems=xE;exports.defaultLandingTestimonials=fE;exports.defaultLogs=wD;exports.defaultMatchHistory=eR;exports.defaultMigrations=Q6;exports.defaultOnCallSchedule=HR;exports.defaultOrchestratorServices=wI;exports.defaultPanelAlerts=$D;exports.defaultPaymentMethods=Fp;exports.defaultPermissions=iA;exports.defaultPipeline=RR;exports.defaultPipelines=pR;exports.defaultPlayerStats=KE;exports.defaultPodDetails=ZD;exports.defaultPresets=Lx;exports.defaultPricingFAQ=kE;exports.defaultPricingPlans=NE;exports.defaultProfileData=tA;exports.defaultQueryPlan=a$;exports.defaultReleases=BR;exports.defaultSecret=P6;exports.defaultServices=t6;exports.defaultSettingsTabs=K$;exports.defaultShippingMethods=Lp;exports.defaultStatus=nR;exports.defaultTestSuites=d6;exports.defaultTiers=M4;exports.defaultTraceSpans=CD;exports.defaultUsers=oA;exports.defaultVulnerabilities=v6;exports.defaultWelcomeSteps=Wx;exports.defaultWizardSteps=DE;exports.escapeHtml=u1;exports.escapeRegex=pi;exports.exportToCSV=Nx;exports.exportToJSON=kx;exports.findNodeById=ri;exports.formatCurrency=ds;exports.formatDate=Hl;exports.formatDateRange=nb;exports.formatPhoneNumber=er;exports.getCountryByCode=xn;exports.getCountryByDialCode=eT;exports.getDatesInMonth=No;exports.getFrenchHolidays=lb;exports.getThemeLoader=Co;exports.getWeekdaysInMonth=ib;exports.getWeekendsInMonth=ob;exports.getWorkingDays=xb;exports.headingVariants=px;exports.initThemeLoader=wb;exports.isDateInRange=Zt;exports.isFutureDate=J0;exports.isHoliday=cm;exports.isNotExpired=ab;exports.isPastDate=om;exports.isSameDay=mb;exports.isToday=eb;exports.isWeekday=wo;exports.isWeekend=im;exports.kbdVariants=yx;exports.loadTableState=Sx;exports.loadTheme=Nb;exports.mergeRanges=vb;exports.moveNode=qv;exports.navigationMenuTriggerStyle=Jm;exports.normalizeDate=bb;exports.orbitPresets=xa;exports.parseCSV=uj;exports.rangesOverlap=yb;exports.reducer=ux;exports.removeNode=ni;exports.safeNavigate=gi;exports.sanitizeUrl=Vh;exports.saveTableState=Cx;exports.textVariants=fx;exports.themeManagerVariants=Gx;exports.timestampToDate=pb;exports.toast=mx;exports.toggleVariants=xx;exports.unformatPhoneNumber=Kt;exports.updateNode=Kx;exports.useAchievements=mN;exports.useActivityFeed=QC;exports.useAdConsent=r$;exports.useAdContext=_t;exports.useAdSlot=n$;exports.useAdVisibility=ba;exports.useAddressAutocomplete=Og;exports.useAdmincrumb=$j;exports.useAdmincrumbContext=S$;exports.useAdmincrumbContextOptional=M$;exports.useAlertStack=Dk;exports.useAllocationMatrix=rf;exports.useAuditLog=ES;exports.useBiometricPrompt=OS;exports.useBottomSheet=uy;exports.useBreadcrumbFromPath=Fj;exports.useBreadcrumbPath=Wy;exports.useBudgetBurn=Xw;exports.useCapacityPlanner=q2;exports.useCartSummary=L4;exports.useChallengeTimer=yf;exports.useChatWidget=NA;exports.useChecklist=tp;exports.useCheckoutStepper=_f;exports.useCheckoutStepperContext=hr;exports.useCohortTable=gM;exports.useComboCounter=yN;exports.useCombobox=_j;exports.useCommandBar=h1;exports.useComparePeriod=y4;exports.useConnectionMatrix=cf;exports.useCostBreakdown=Ww;exports.useCouponInput=Gf;exports.useCreditCardInput=Hg;exports.useDailyRewards=lC;exports.useDataTable=Mx;exports.useDataTableAdvanced=Tx;exports.useDataTableEdit=Uo;exports.useDataTableSelection=Cj;exports.useDataTableTheme=$x;exports.useDataTableVirtualization=Dx;exports.useDateForm=qj;exports.useDateRangePicker=Hj;exports.useDeploymentLane=hk;exports.useDeviceTrust=l3;exports.useDrawer=Qj;exports.useEmptyState=eD;exports.useErrorShake=tN;exports.useFeatureAnnouncement=oD;exports.useFloatingNav=Ly;exports.useFlowDiagram=A1;exports.useFormField=rr;exports.useFunnelChart=Cg;exports.useGoalProgress=Rg;exports.useHeatmap=Lg;exports.useHotspot=WT;exports.useInvoice=nS;exports.useKPIDashboard=wM;exports.useKanban=ov;exports.useLanguage=sc;exports.useLeaderboard=DN;exports.useLegacyTheme=y$;exports.useLevelProgress=CN;exports.useLoadingOrbit=oN;exports.useLootBox=jf;exports.useMagicLink=C1;exports.useMentionInput=x4;exports.useMilestoneRoad=WN;exports.useModal=xv;exports.useMorphButton=th;exports.useNotifications=jv;exports.useNumberInput=yv;exports.useOrbitalMenu=Gy;exports.useOrderTracker=V4;exports.usePagination=kv;exports.usePasswordStrength=Wi;exports.usePaymentMethodPicker=X5;exports.usePermissionMatrix=tg;exports.usePhoneInput=sT;exports.usePointsPopup=Mf;exports.usePointsPopupWithPresets=u5;exports.usePowerUp=n5;exports.usePresence=R5;exports.usePricingTable=S4;exports.useProgressOnboarding=cD;exports.usePullToRefresh=oy;exports.useQRCode=Mv;exports.useQuests=ZN;exports.useQuota=V2;exports.useRadarScore=Xy;exports.useRank=EC;exports.useRatingInput=vT;exports.useReactionPicker=H3;exports.useResourceGauge=aw;exports.useResourcePool=z2;exports.useRollbackSlider=z1;exports.useSLATracker=Pk;exports.useSankeyDiagram=Fg;exports.useSchedulePicker=ST;exports.useScratchCard=KN;exports.useSeasonPass=E5;exports.useSecurityScore=LS;exports.useSegmentedControl=Dv;exports.useSessionManager=pS;exports.useSidebar=B$;exports.useSignaturePad=zg;exports.useSkillTree=bC;exports.useSliderRange=hT;exports.useSparklineData=u2;exports.useSpotlight=g1;exports.useStat=Rv;exports.useStatsHexagon=w5;exports.useStepperContext=ai;exports.useSuccessExplosion=Qw;exports.useTableLayout=Oo;exports.useTabs=Vy;exports.useTagInput=mT;exports.useTeamBanner=OC;exports.useTerminalOutput=j2;exports.useTheme=ir;exports.useThemeLoader=Cb;exports.useThreadView=O3;exports.useTimePicker=Uv;exports.useToast=Wo;exports.useTooltipTour=gD;exports.useTourGuide=AT;exports.useTournamentBracket=zC;exports.useTranslation=Fx;exports.useTreemapChart=Bg;exports.useTwoFactorSetup=Ff;exports.useTypewriter=xh;exports.useTypingIndicator=T3;exports.useVersusCard=i1;exports.useVideo=Yv;exports.useVideoCall=R3;exports.useVirtualList=Qv;exports.useVoiceMessage=kg;exports.useWaka=k$;exports.useWelcomeModal=hv;exports.useWizard=CE;exports.useXPBar=Uk;