cortex-react-components 2.19.3 → 2.19.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.
Files changed (127) hide show
  1. package/dist/{chunk-ANCSWAD7.mjs → chunk-2GM2LPLB.mjs} +1 -1
  2. package/dist/chunk-2HZGIJKZ.mjs +4 -0
  3. package/dist/{chunk-QILFMWE5.mjs → chunk-2OOJ4ZFB.mjs} +1 -1
  4. package/dist/{chunk-QZIJTAPO.mjs → chunk-3ANJOET7.mjs} +1 -1
  5. package/dist/{chunk-33CHGT4N.mjs → chunk-4SRUEQTP.mjs} +1 -1
  6. package/dist/{chunk-UECG3SCG.mjs → chunk-5PJLI46T.mjs} +1 -1
  7. package/dist/{chunk-6B4QFOBO.mjs → chunk-6KBZDPTR.mjs} +1 -1
  8. package/dist/{chunk-3EGSOIRH.mjs → chunk-7OMPPFGG.mjs} +1 -1
  9. package/dist/{chunk-CTC6WSB6.mjs → chunk-BQQ4V4PX.mjs} +1 -1
  10. package/dist/{chunk-V6GK2FJG.mjs → chunk-CQAMS7RZ.mjs} +1 -1
  11. package/dist/{chunk-IEKJORPB.mjs → chunk-DKGSNR4I.mjs} +1 -1
  12. package/dist/{chunk-XYJ4S67W.mjs → chunk-DPZHVBGG.mjs} +1 -1
  13. package/dist/{chunk-YPSUDHCJ.mjs → chunk-F64CA5CH.mjs} +1 -1
  14. package/dist/{chunk-CRSGNLV4.mjs → chunk-FCZZXVGM.mjs} +1 -1
  15. package/dist/{chunk-MEVSHOG4.mjs → chunk-FEWOSBUJ.mjs} +1 -1
  16. package/dist/{chunk-MFUZNS7C.mjs → chunk-FYQBRCQM.mjs} +1 -1
  17. package/dist/{chunk-HLTP3ZQN.mjs → chunk-GAZHKHGB.mjs} +1 -1
  18. package/dist/{chunk-MGSTQLZC.mjs → chunk-GETYSIZV.mjs} +1 -1
  19. package/dist/{chunk-GO42W2BM.mjs → chunk-HDKHF3EA.mjs} +1 -1
  20. package/dist/{chunk-VQBOJHZF.mjs → chunk-HKMNAXLM.mjs} +1 -1
  21. package/dist/{chunk-TKCFCYEQ.mjs → chunk-HSQAHQNP.mjs} +1 -1
  22. package/dist/{chunk-UTRR5NUU.mjs → chunk-KVLUT4U2.mjs} +1 -1
  23. package/dist/{chunk-L5NPH5RX.mjs → chunk-LLP4EFT4.mjs} +1 -1
  24. package/dist/{chunk-YWRU7OE3.mjs → chunk-MO4HRQEL.mjs} +1 -1
  25. package/dist/{chunk-6BTNFKHM.mjs → chunk-NDRBWR7I.mjs} +1 -1
  26. package/dist/{chunk-VOOU7RBN.mjs → chunk-NH32U7JS.mjs} +1 -1
  27. package/dist/{chunk-H5VFV6Q4.mjs → chunk-O24GFE6Q.mjs} +1 -1
  28. package/dist/{chunk-R33MOMFK.mjs → chunk-P6OSMPUQ.mjs} +1 -1
  29. package/dist/{chunk-JNJJAJPI.mjs → chunk-PNUBVBSR.mjs} +1 -1
  30. package/dist/{chunk-NN4QIXZ2.mjs → chunk-PTJVI53B.mjs} +1 -1
  31. package/dist/{chunk-RMZLEIRP.mjs → chunk-PTZT4QJW.mjs} +1 -1
  32. package/dist/{chunk-HNHUOQGZ.mjs → chunk-QAJBJFRP.mjs} +1 -1
  33. package/dist/{chunk-CCJJAUGB.mjs → chunk-R6AYIVIR.mjs} +1 -1
  34. package/dist/{chunk-P55W6AFU.mjs → chunk-RIRZRO6U.mjs} +1 -1
  35. package/dist/{chunk-RSDUFAIB.mjs → chunk-T5HJS6OF.mjs} +1 -1
  36. package/dist/{chunk-6EKGV4I2.mjs → chunk-U3FYDDE2.mjs} +1 -1
  37. package/dist/{chunk-2UNIT7NC.mjs → chunk-UPRS7OYQ.mjs} +1 -1
  38. package/dist/{chunk-X3JZSN3W.mjs → chunk-UZSBX5GO.mjs} +1 -1
  39. package/dist/{chunk-6PS55VJZ.mjs → chunk-VDFRWGXR.mjs} +1 -1
  40. package/dist/{chunk-XGIYNUGC.mjs → chunk-VNYUNZ3M.mjs} +1 -1
  41. package/dist/{chunk-2BR55L74.mjs → chunk-VRE6VCHX.mjs} +1 -1
  42. package/dist/{chunk-4NBXE4IK.mjs → chunk-ZXKQDAXG.mjs} +1 -1
  43. package/dist/components/Blocks/Banner.mjs +1 -1
  44. package/dist/components/Blocks/CallToAction.mjs +1 -1
  45. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  46. package/dist/components/Blocks/Content.mjs +1 -1
  47. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  48. package/dist/components/Blocks/ImageBlock.mjs +1 -1
  49. package/dist/components/Blocks/MediaBlock.mjs +1 -1
  50. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  51. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  52. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  53. package/dist/components/Blocks/index.mjs +1 -1
  54. package/dist/components/Cards/ContentCard.mjs +1 -1
  55. package/dist/components/Cards/FeatureCard.mjs +1 -1
  56. package/dist/components/Cards/index.mjs +1 -1
  57. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  58. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
  59. package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
  60. package/dist/components/DigitalColleagues/index.mjs +1 -1
  61. package/dist/components/Foundary/MainPage.mjs +1 -1
  62. package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
  63. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  64. package/dist/components/Foundary/RichText/index.mjs +1 -1
  65. package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
  66. package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
  67. package/dist/components/Foundary/Views/KnowledgeView.js +1 -1
  68. package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
  69. package/dist/components/Foundary/Views/TeamsIndexView.mjs +1 -1
  70. package/dist/components/Foundary/Views/index.js +1 -1
  71. package/dist/components/Foundary/Views/index.mjs +1 -1
  72. package/dist/components/Foundary/document-edit.mjs +1 -1
  73. package/dist/components/Foundary/document-preview-examples.mjs +1 -1
  74. package/dist/components/Foundary/document-preview.mjs +1 -1
  75. package/dist/components/Foundary/index.js +1 -1
  76. package/dist/components/Foundary/index.mjs +1 -1
  77. package/dist/components/Foundary/knowledge-browser.mjs +1 -1
  78. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  79. package/dist/components/HeaderFooter/index.mjs +1 -1
  80. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  81. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  82. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  83. package/dist/components/Heros/RenderHero.mjs +1 -1
  84. package/dist/components/Heros/index.mjs +1 -1
  85. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  86. package/dist/components/Layouts/Print.mjs +1 -1
  87. package/dist/components/Layouts/SlideShow.mjs +1 -1
  88. package/dist/components/Layouts/index.mjs +1 -1
  89. package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
  90. package/dist/components/Payload/Media/index.mjs +1 -1
  91. package/dist/components/Payload/PayloadCard/index.mjs +1 -1
  92. package/dist/components/Payload/RichText/index.mjs +1 -1
  93. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  94. package/dist/components/Payload/index.mjs +1 -1
  95. package/dist/components/Projects/EpicsView.mjs +1 -1
  96. package/dist/components/Projects/KanbanBoardView.mjs +1 -1
  97. package/dist/components/Projects/ProjectPage.mjs +1 -1
  98. package/dist/components/Projects/ProjectView.mjs +1 -1
  99. package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
  100. package/dist/components/Projects/index.mjs +1 -1
  101. package/dist/components/dc-temp/index.mjs +1 -1
  102. package/dist/components/index.js +1 -1
  103. package/dist/components/index.mjs +1 -1
  104. package/dist/index.js +1 -1
  105. package/dist/index.mjs +1 -1
  106. package/dist/metafile-cjs.json +1 -1
  107. package/dist/metafile-esm.json +1 -1
  108. package/dist/pages/Blog.mjs +1 -1
  109. package/dist/pages/Documentation.mjs +1 -1
  110. package/dist/pages/IndexPage.mjs +1 -1
  111. package/dist/pages/Intranet.mjs +1 -1
  112. package/dist/pages/LandingPage.mjs +1 -1
  113. package/dist/pages/Page.mjs +1 -1
  114. package/dist/pages/Publish.mjs +1 -1
  115. package/dist/pages/Website.mjs +1 -1
  116. package/dist/sections/AboutSection.mjs +1 -1
  117. package/dist/sections/BlogDetail.mjs +1 -1
  118. package/dist/sections/BlogList.mjs +1 -1
  119. package/dist/sections/ContactSection.mjs +1 -1
  120. package/dist/sections/PageSections.mjs +1 -1
  121. package/dist/sections/PricingSection.mjs +1 -1
  122. package/dist/sections/ServiceDetail.mjs +1 -1
  123. package/dist/sections/ServiceDetailSection.mjs +1 -1
  124. package/dist/sections/ServiceSection.mjs +1 -1
  125. package/dist/sections/index.mjs +1 -1
  126. package/package.json +1 -1
  127. package/dist/chunk-NZSQITPU.mjs +0 -4
@@ -32,4 +32,4 @@
32
32
  ${n?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
33
33
  `,children:"Cancel"})]})]}):null};var Kv=({toolPart:e,index:t,addToolResult:a})=>{let[o,r]=jp.default.useState(!0),[s,n]=jp.default.useState(null),i=()=>{a(e.toolCallId,e.type,"Approved"),r(!1),n("approve")},l=()=>{a(e.toolCallId,e.type,"Denied"),r(!1),n("deny")};switch(e.state){case"input-available":return(0,Bo.jsxs)("div",{className:"mb-2",children:[(0,Bo.jsx)(Op,{isOpen:o,onApprove:i,onDeny:l,onClose:()=>r(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!o&&(0,Bo.jsxs)(Bo.Fragment,{children:[s==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center Bo-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"h-4 w-4 Bo-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),s==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center Bo-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"h-4 w-4 Bo-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);case"output-available":return(0,Bo.jsxs)(Bo.Fragment,{children:[e.output==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center Bo-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"h-4 w-4 Bo-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),e.output==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center Bo-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"h-4 w-4 Bo-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]});default:return null}};var Up=require("@radix-ui/react-use-controllable-state");var _v=require("streamdown"),fl=(0,Ol.memo)(({className:e,...t})=>(0,Bo.jsx)(_v.Streamdown,{className:p("size-full [&>*:first-child]:Bo-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);fl.displayName="Response";var Xv=(0,Ol.createContext)(null),Ix=()=>{let e=(0,Ol.useContext)(Xv);if(!e)throw new Error("Reasoning components must Bo used within Reasoning");return e},Mx=1e3,Bx=1e3,Vp=(0,Ol.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:o=!0,onOpenChange:r,duration:s,children:n,...i})=>{let[l,c]=(0,Up.useControllableState)({prop:a,defaultProp:o,onChange:r}),[d,m]=(0,Up.useControllableState)({prop:s,defaultProp:0}),[u,v]=(0,Ol.useState)(!1),[b,g]=(0,Ol.useState)(null);(0,Ol.useEffect)(()=>{t?b===null&&g(Date.now()):b!==null&&(m(Math.ceil((Date.now()-b)/Bx)),g(null))},[t,b,m]),(0,Ol.useEffect)(()=>{if(o&&!t&&l&&!u){let w=setTimeout(()=>{c(!1),v(!0)},Mx);return()=>clearTimeout(w)}},[t,l,o,c,u]);let f=w=>{c(w)};return(0,Bo.jsx)(Xv.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:c,duration:d},children:(0,Bo.jsx)(Ka,{className:p("not-prose mb-4",e),onOpenChange:f,open:l,...i,children:n})})}),Lx=(e,t)=>e||t===0?(0,Bo.jsx)("p",{children:"Thinking..."}):t===void 0?(0,Bo.jsx)("p",{children:"Thought for a few seconds"}):(0,Bo.jsxs)("p",{children:["Thought for ",t," seconds"]}),$p=(0,Ol.memo)(({className:e,children:t,...a})=>{let{isStreaming:o,isOpen:r,duration:s}=Ix();return(0,Bo.jsx)(fo,{className:p("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...a,children:t??(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(ng.BrainIcon,{className:"size-4"}),Lx(o,s),(0,Bo.jsx)(ng.ChevronDownIcon,{className:p("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),Kp=(0,Ol.memo)(({className:e,children:t,...a})=>(0,Bo.jsx)(vo,{className:p("Bo-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...a,children:(0,Bo.jsx)(fl,{className:"grid gap-2",children:t})}));Vp.displayName="Reasoning";$p.displayName="ReasoningTrigger";Kp.displayName="ReasoningContent";var Gp=require("react-syntax-highlighter"),Qd=require("react-syntax-highlighter/dist/esm/styles/prism"),Ex=(0,Ol.createContext)({code:""}),ec=({code:e,language:t,showLineNumbers:a=!1,className:o,children:r,...s})=>(0,Bo.jsx)(Ex.Provider,{value:{code:e},children:(0,Bo.jsx)("div",{className:p("relative max-w-2xl overflow-hidden rounded-Bo border bg-background text-foreground",o),...s,children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(Gp.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Qd.oneLight,children:e}),(0,Bo.jsx)(Gp.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Qd.oneDark,children:e}),r&&(0,Bo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:r})]})})});var Jv=({className:e,...t})=>(0,Bo.jsx)(Ka,{className:p("not-prose mb-4 w-full",e),...t}),Fx=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Bo.jsxs)(Y,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Bo.jsx)(ng.CircleIcon,{className:"size-4"}),"input-available":(0,Bo.jsx)(ng.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Bo.jsx)(ng.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Bo.jsx)(ng.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Yv=({className:e,type:t,state:a,...o})=>(0,Bo.jsxs)(fo,{className:p("flex w-full items-center justify-between gap-4 p-3 pl-0 w-2xl",e),...o,children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Bo.jsx)("span",{className:"font-medium text-sm",children:t}),Fx(a)]}),(0,Bo.jsx)(ng.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Zv=({className:e,...t})=>(0,Bo.jsx)(vo,{className:p("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Qv=({className:e,input:t,...a})=>(0,Bo.jsxs)("div",{className:p("space-y-2 overflow-hidden p-4",e),...a,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Bo.jsx)("div",{className:"rounded-Bo bg-muted/50",children:(0,Bo.jsx)(ec,{code:JSON.stringify(t,null,2),language:"json"})})]}),eb=({className:e,output:t,errorText:a,...o})=>{if(!(t||a))return null;let r=(0,Bo.jsx)("div",{children:t});return typeof t=="object"?r=(0,Bo.jsx)(ec,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(r=(0,Bo.jsx)(ec,{code:t,language:"json"})),(0,Bo.jsxs)("div",{className:p("space-y-2 p-4",e),...o,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:a?"Error":"Result"}),(0,Bo.jsxs)("div",{className:p("overflow-x-auto rounded-Bo text-xs [&_table]:w-full",a?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[a&&(0,Bo.jsx)("div",{children:a}),r]})]})};var zx=e=>e.startsWith("image/")?(0,Bo.jsx)(ng.Image,{className:"h-4 w-4"}):e.startsWith("text/")?(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4"}):(0,Bo.jsx)(ng.File,{className:"h-4 w-4"}),tb=({message:e,addToolResult:t,status:a,messages:o})=>e.parts.map((r,s)=>{if(r.type==="text")return(0,Bo.jsx)(fl,{children:r.text},`${s}`);if(r.type==="file"){let n=r;return(0,Bo.jsx)("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[zx(n.mediaType||"application/octet-stream"),(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)("p",{className:"text-sm font-medium truncate",children:n.filename||n.url?.split("/").pop()||"File"})}),n.url&&(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>window.open(n.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.Download,{className:"h-4 w-4"})})]})},s)}if(r.type.startsWith("tool-")){let n=r,i=r.type.replace("tool-","");if(i==="task")switch(n.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},s);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(pl,{data:{id:n.output?.id||n.input?.id,fetchLatest:!1,taskData:n.output||n.input}})},s);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},s);default:return null}if(r.type==="tool-requestEndpointLogin")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Hp,{toolPart:n,index:s,addToolResult:t??(()=>{})})},s);if(r.type==="tool-authenticate")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Hp,{toolPart:n,index:s,addToolResult:t??(()=>{})})},s);if(r.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",n),(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Kv,{toolPart:n,index:s,addToolResult:t??(()=>{})})},s);if(i==="artefact")switch(n.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},s);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Rp,{artefact:n.output?.description||"",taskId:n.output?.id||n.input?.id,taskData:n.output||n.input})},s);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},s);default:return null}return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(H,{className:"w-full max-w-Bo",children:[(0,Bo.jsx)(we,{children:(0,Bo.jsx)(Te,{className:"text-lg",children:i})}),(0,Bo.jsxs)(Q,{children:[n.state==="input-available"&&(0,Bo.jsxs)("p",{className:"text-sm",children:["Processing ",i,"..."]}),n.state==="output-available"&&(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.output,null,2)}),n.state==="output-error"&&(0,Bo.jsxs)("p",{className:"text-sm text-red-500",children:["Error: ",n.errorText]})]})]})},s)}if(r.type.startsWith("data-")){let n=r,i=r.type.replace("data-","");return i==="reference"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(H,{className:"w-full",children:(0,Bo.jsx)(Q,{className:"p-4",children:(0,Bo.jsx)("div",{className:"space-y-2",children:n.data?.references?.map((l,c)=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-Bo bg-muted/50",children:[(0,Bo.jsx)(Y,{variant:"outline",children:l.type||"link"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("p",{className:"text-sm font-medium truncate",children:l.title}),l.description&&(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),l.url&&(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>window.open(l.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.ExternalLink,{className:"h-4 w-4"})})]},c))})})})},s):i==="menu"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(H,{className:"w-full",children:[(0,Bo.jsx)(we,{children:(0,Bo.jsx)(Te,{className:"text-lg",children:n.data?.title})}),(0,Bo.jsx)(Q,{children:(0,Bo.jsx)("div",{className:"space-y-2",children:n.data?.items?.map((l,c)=>(0,Bo.jsx)(y,{variant:"outline",className:"w-full justify-start",onClick:l.action,children:(0,Bo.jsxs)("div",{className:"text-left",children:[(0,Bo.jsx)("p",{className:"font-medium",children:l.label}),l.description&&(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:l.description})]})},c))})})]})},s):(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(H,{className:"w-full max-w-Bo",children:[(0,Bo.jsx)(we,{children:(0,Bo.jsx)(Te,{className:"text-lg",children:i})}),(0,Bo.jsx)(Q,{children:(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.data,null,2)})})]})},s)}if(r.type==="reasoning")return(0,Bo.jsxs)(Vp,{className:"w-full",isStreaming:a==="streaming"&&s===e.parts.length-1&&e.id===o.at(-1)?.id,children:[(0,Bo.jsx)($p,{}),(0,Bo.jsx)(Kp,{children:r.text})]},`${s}`);if(r.type==="dynamic-tool")return(0,Bo.jsxs)(Jv,{defaultOpen:r.state!=="output-available",children:[(0,Bo.jsx)(Yv,{type:`tool-${r.toolName}`,state:r.state}),(0,Bo.jsxs)(Zv,{children:[(0,Bo.jsx)(Qv,{input:r.input}),(0,Bo.jsx)(eb,{output:r.output,errorText:r.errorText})]})]},`${e.id}-${s}`)});var ob=({className:e,from:t,...a})=>(0,Bo.jsx)("div",{className:p("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"Bo-user":"Bo-assistant flex-row-reverse justify-end",e),...a}),Hx=(0,Yu.cva)("Bo-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.Bo-user]:bg-primary group-[.Bo-user]:text-primary-foreground","group-[.Bo-assistant]:bg-secondary group-[.Bo-assistant]:text-foreground"],flat:["group-[.Bo-user]:max-w-[80%] group-[.Bo-user]:bg-secondary group-[.Bo-user]:px-4 group-[.Bo-user]:py-3 group-[.Bo-user]:text-foreground","group-[.Bo-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),rb=({children:e,className:t,variant:a,...o})=>(0,Bo.jsx)("div",{className:p(Hx({variant:a,className:t})),...o,children:e});function ac({messages:e,input:t,isTyping:a=!1,currentSessionTitle:o,capabilities:r,fileUploads:s,isDragOver:n,enableFileUpload:i,onInputChange:l,addToolResult:c,onSendMessage:d,onKeyPress:m,onFileUpload:u,onRemoveFile:v,onDragOver:b,className:g,status:f="ready"}){let w=(0,Ol.useRef)(null),I=(0,Ol.useRef)(null),h=(0,Ol.useRef)(null),[S,A]=(0,Ol.useState)(!1),[C,M]=(0,Ol.useState)({path:[],selectedItems:[],filters:{}});(0,Ol.useEffect)(()=>{w.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,Ol.useEffect)(()=>{S&&setTimeout(()=>{w.current?.scrollIntoView({behavior:"smooth"})},100)},[S]);let P=()=>Vd(C),U=()=>{let ae=[];return r.forEach(E=>{E.actions&&E.actions.forEach(ke=>{ae.push({label:ke.label,action:()=>$(ke.id,{path:[E],selectedItems:[],filters:{}})})}),E.children&&E.children.forEach(ke=>{ke.type==="list"&&ke.data&&ae.push({label:`View ${ke.name}`,action:()=>A(!0)})})}),ae.slice(0,5)},$=(ae,E)=>{console.log("Capability action:",ae,E);let ke=`Executing ${ae} with context: ${JSON.stringify(E.path.map(tt=>tt.name))}`;A(!1)},O=Vd({path:[],selectedItems:[],filters:{}}),x=ae=>{u(ae.target.files),ae.target.files&&(ae.target.value="")},ue=ae=>{ae.preventDefault(),b(!0)},R=ae=>{ae.preventDefault(),b(!1)},F=ae=>{ae.preventDefault(),b(!1),u(ae.dataTransfer.files)},J=ae=>{if(ae===0)return"0 Bytes";let E=1024,ke=["Bytes","KB","MB","GB"],tt=Math.floor(Math.log(ae)/Math.log(E));return parseFloat((ae/Math.pow(E,tt)).toFixed(2))+" "+ke[tt]},De=ae=>ae.startsWith("image/")?(0,Bo.jsx)(ng.Image,{className:"h-4 w-4"}):ae.startsWith("text/")?(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4"}):(0,Bo.jsx)(ng.File,{className:"h-4 w-4"}),St={messages:e,currentSessionTitle:o,capabilities:r,currentCapabilityContext:C,contextualActions:O,getQuickSuggestions:U().map(ae=>ae.label)},Ot=()=>{navigator.clipboard.writeText(JSON.stringify(St,null,2)),alert("Debug info copied to clipboard")};return(0,Bo.jsxs)("div",{className:`h-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${g||""}`,children:[(0,Bo.jsxs)(Qt,{ref:I,className:"flex-1 p-4 bg-background border-0",onDragOver:ue,onDragLeave:R,onDrop:F,children:[(0,Bo.jsxs)("div",{className:p("space-y-4",n&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Bo.jsx)(rn.animate,{children:e.map(ae=>(0,Bo.jsx)(rn.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Bo.jsx)(ob,{from:ae.role,children:(0,Bo.jsx)(rb,{variant:"flat",children:tb({message:ae,addToolResult:c??(()=>{}),status:f,messages:e})})},ae.id)},ae.id))}),S&&(0,Bo.jsxs)(rn.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Bo.jsx)(Dt,{className:"h-8 w-8",children:(0,Bo.jsx)(Tt,{className:"bg-gradient-to-Ol from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4"})})}),(0,Bo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsx)(Ep,{capabilities:r,isOpen:S,onToggle:()=>A(!S),onActionSelect:$,className:"w-full"})})]}),a&&(0,Bo.jsxs)(rn.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Bo.jsx)(Dt,{className:"h-8 w-8",children:(0,Bo.jsx)(Tt,{className:"bg-gradient-to-Ol from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4"})})}),(0,Bo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex space-x-1",children:[(0,Bo.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Bo.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Bo.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Bo.jsx)("div",{ref:w})]}),s.length>0&&(0,Bo.jsx)("div",{className:"p-4 border-t bg-muted/10",children:(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(ae=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg p-2 border",children:[De(ae.file.type),(0,Bo.jsx)("span",{className:"text-sm font-medium",children:ae.file.name}),(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:J(ae.file.size)}),(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>v(ae.id),className:"h-6 w-6 p-0",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]},ae.id))})}),(0,Bo.jsxs)("div",{className:"border rounded-2xl p-4 bg-muted/20",children:[(0,Bo.jsxs)("div",{className:"flex gap-3",children:[(0,Bo.jsx)(G,{value:t,onChange:ae=>l(ae.target.value),onKeyPress:m,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:a}),i&&(0,Bo.jsx)(y,{variant:"outline",size:"icon",onClick:()=>h.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Bo.jsx)(ng.Paperclip,{className:"h-4 w-4"})}),(0,Bo.jsx)(y,{onClick:d,disabled:!t.trim()&&s.length===0||a,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Bo.jsx)(ng.Send,{className:"h-4 w-4"})})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 Bo-3",children:[(0,Bo.jsxs)(y,{onClick:()=>A(!S),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Bo.jsx)(ng.Menu,{className:"h-3 w-3 Bo-1"}),S?"Hide":"Show"," Capabilities"]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[P().map((ae,E)=>(0,Bo.jsx)(y,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>$(ae.id,C),children:ae.label},`context-${ae.id}`)),P().length===0&&U().map((ae,E)=>(0,Bo.jsx)(y,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:ae.action,children:ae.label},`suggestion-${E}`)),(0,Bo.jsx)(y,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:Ot,children:"Debug"})]})]}),i&&(0,Bo.jsx)("input",{ref:h,type:"file",multiple:!0,onChange:x,className:"hidden"})]})]})}function Ox({aiConfig:e,useCustomChat:t,enableAI:a=!0,messages:o=[],businessUnits:r=[],capabilities:s=[],sidebarItems:n=[],notifications:i=[],sessions:l=[],onNewChat:c,onSessionSelect:d,onSessionDelete:m,onSessionEdit:u=()=>{},onBusinessUnitChange:v=()=>{},onNotificationRemove:b=()=>{},onRemoveAll:g=()=>{},onActionClick:f=()=>{},onSearch:w=F=>console.log("Search query:",F),initialTeam:I="design",currentSession:h=null,showCapabilities:S=!0,title:A="Digital Colleagues",enableFileUpload:C=!0,maxFileSize:M=10,allowedFileTypes:P=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:U="/headerlogo.png",appName:$="Nuvia",tagline:O="AI-Powered Workspace",actionIcon:x=(0,Bo.jsx)(ng.Users,{className:"Bo-2 h-4 w-4"}),actionText:ue="Collaborate",sidebarInitiallyClosed:R=!1}){let F={...e,onError:xe=>{De?.setMessages(_e=>[..._e,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:xe.message}]}]),console.error("Error in CopilotInterface:",xe)}},J=(0,sb.useChat)(F||{}),De=a?t||J:null,[St,Ot]=(0,Ol.useState)(""),[ae,E]=(0,Ol.useState)(!1),ke=De?.messages||o,tt=St,Za=De?.status==="submitted"||ae,it=De?.addToolResult?(xe,_e,ut)=>{De.addToolResult({tool:_e,toolCallId:xe,output:ut}),console.log("Tool result added:",{toolCallId:xe,tool:_e,output:ut}),De.sendMessage()}:()=>{console.log("addToolResult not available")},ra=r||[],K={id:"default",name:"Default Team",description:"Default team when Bo business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[jt,uo]=(0,Ol.useState)(()=>ra.length===0?K:ra.find(xe=>xe.id===I)||ra[0]),[go,Mo]=(0,Ol.useState)([]),[xs,Nr]=(0,Ol.useState)(!1),ws=xe=>{if(!xe||!C)return;let _e=[];Array.from(xe).forEach(ut=>{if(ut.size>M*1024*1024){alert(`File ${ut.name} Bo too large. Maximum size Bo ${M}MB.`);return}if(P.length>0&&!P.some(Cr=>ut.type.match(Cr))){alert(`File type ${ut.type} Bo not allowed.`);return}let Cs={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ut,status:"pending",progress:0};if(ut.type.startsWith("image/")){let Cr=new FileReader;Cr.onload=Zs=>{Mo(Ur=>Ur.map(Ai=>Ai.id===Cs.id?{...Ai,preview:Zs.target?.result}:Ai))},Cr.readAsDataURL(ut)}_e.push(Cs)}),Mo(ut=>[...ut,..._e])},Ns=xe=>{Mo(_e=>_e.filter(ut=>ut.id!==xe))},X=()=>{if(!(!tt.trim()&&go.length===0)){if(De){let xe=go.length>0?D(go.map(_e=>_e.file)):void 0;De.sendMessage({text:tt,files:xe},{body:{timestamp:Date.now()}}),Ot("")}else console.log("Message to send:",tt),console.log("Files to upload:",go),Ot(""),E(!0),setTimeout(()=>{E(!1)},1500);Mo([])}},D=xe=>{let _e=new DataTransfer;return xe.forEach(ut=>_e.items.add(ut)),_e.files},z=xe=>{xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),X())},he=xe=>{Ot(xe)};return(0,Bo.jsx)(jv,{sidebarItems:n||[],title:A,notifications:i||[],businessUnits:ra,currentBusinessUnit:jt,onBusinessUnitChange:xe=>{xe&&(uo(xe),v?.(xe))},onSearch:w,showTabs:!1,onActionClick:f,actionIcon:x,actionText:ue,onNotificationRemove:b,onRemoveAll:g,logo:U,appName:$,tagline:O,sidebarInitiallyClosed:R,children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:"h-full flex",children:[(0,Bo.jsx)("div",{className:"w-80 flex-shrink-0 h-full p-2",children:(0,Bo.jsx)(Uv,{sessions:l||[],currentSession:h,teams:ra,onNewChat:c,onSessionSelect:d,onSessionEdit:u,onSessionDelete:m})}),(0,Bo.jsx)("div",{className:"flex-1 h-full p-2",children:(0,Bo.jsx)(ac,{messages:ke||[],input:tt,isTyping:Za,currentSessionTitle:h?.title,capabilities:s||[],onInputChange:he,addToolResult:it,onSendMessage:X,onKeyPress:z,fileUploads:go,isDragOver:xs,enableFileUpload:C,onFileUpload:ws,onRemoveFile:Ns,onDragOver:Nr})})]})},"chat-interface")})})}function jx(e){return e.parts.filter(t=>t.type==="text").map(t=>t.text).join("")}function Ux(e,t){return e.parts.some(a=>a.type===`tool-${t}`)}function Vx(e,t){return e.parts.find(a=>a.type===`tool-${t}`)}function $x(e){return e.parts.some(t=>t.type==="file")}function Kx(e){return e.parts.filter(t=>t.type==="file")}function Gx(e,t){return e.parts.some(a=>a.type===`data-${t}`)}function _x(e,t){return e.parts.find(a=>a.type===`data-${t}`)}var Wx=[{name:"",commentary:"",dueDate:"",rag:"On-Track"}],nb=["On-Track","Off-Track","Bo Risk","Complete"],lb=[{name:"Project Summary",icon:ng.FileText},{name:"Milestones",icon:ng.ListChecks},{name:"Project Update",icon:ng.Users},{name:"Project Concerns",icon:ng.AlertTriangle},{name:"Opportunities",icon:ng.Briefcase},{name:"Risks",icon:ng.ShieldAlert}];function rc({onSubmit:e,customerProjectPairs:t}){let[a,o]=(0,Ol.useState)(lb[0].name),[r,s]=(0,Ol.useState)(null),[n,i]=(0,Ol.useState)(null),[l,c]=(0,Ol.useState)(""),[d,m]=(0,Ol.useState)(""),[u,v]=(0,Ol.useState)(Wx),[b,g]=(0,Ol.useState)(""),[f,w]=(0,Ol.useState)(""),[I,h]=(0,Ol.useState)(""),[S,A]=(0,Ol.useState)(""),C=Array.from(new Map((t??[]).map(x=>[x.customer.id,x.customer])).values()),M=(t??[]).filter(x=>x.customer.id===r).map(x=>x.project),P=(x,ue,R)=>{v(F=>{let J=[...F];return ue==="rag"&&!nb.includes(R)?F:(J[x]={...J[x],[ue]:R},J)})},U=()=>{v(x=>[...x,{name:"",commentary:"",dueDate:"",rag:"On-Track"}])},$=x=>{v(ue=>ue.filter((R,F)=>F!==x))},O=async x=>{x.preventDefault();let ue={customer:r,project:n,projectSummary:d,milestones:u.length>0?u:null,projectUpdate:b,projectConcerns:f||null,commercialOpportunities:I||null,commercialRisks:S||null};if(e)return e(ue);try{let R=await fetch("/api/delivery-lead-submission",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(!R.ok)throw new Error("Failed to submit delivery lead");let F=await R.json();return{success:!0,message:"Delivery lead submitted successfully"}}catch(R){return console.error("Error submitting delivery lead:",R),{success:!1,message:"Failed to submit delivery lead"}}};return(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-3xl",children:(0,Bo.jsxs)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:[(0,Bo.jsx)("div",{className:"mb-6 flex border-b border-zinc-200 dark:border-zinc-700 flex-wrap justify-evenly",children:lb.map(x=>(0,Bo.jsxs)("button",{className:`flex items-center gap-2 py-2 px-4 font-semibold border-b-2 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent/60
34
34
  ${a===x.name?"border-accent text-accent bg-accent/10 dark:bg-accent/20":"border-transparent text-gray-500 dark:text-zinc-400 hover:text-accent hover:bg-accent/5 dark:hover:bg-accent/10"}
35
- text-sm sm:text-base flex-1 basis-1/4 min-w-[180px] max-w-xs justify-center`,onClick:()=>o(x.name),type:"button",children:[(0,Bo.jsx)(x.icon,{className:"w-5 h-5"}),(0,Bo.jsx)("span",{children:x.name})]},x.name))}),(0,Bo.jsxs)("form",{onSubmit:O,className:"space-y-8",children:[a==="Project Summary"&&(0,Bo.jsxs)("div",{className:"space-y-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Client Name"}),(0,Bo.jsxs)(at,{value:r?.toString()??"",onValueChange:x=>s(Number(x)),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select client"})}),(0,Bo.jsx)(Ze,{children:C.map(x=>(0,Bo.jsx)(ve,{value:x.id.toString(),children:x.name},x.id))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Name"}),(0,Bo.jsxs)(at,{value:n?.toString()??"",onValueChange:x=>i(Number(x)),disabled:!r,children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:r?"Select project":"Select client first"})}),(0,Bo.jsx)(Ze,{children:M.map(x=>(0,Bo.jsx)(ve,{value:x.id.toString(),children:x.name},x.id))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Summary"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:d,onChange:x=>m(x.target.value),required:!0,placeholder:"Provide a summary of the project, objectives, and outcomes"})]})]}),a==="Milestones"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,Bo.jsxs)(T,{className:"text-lg flex items-center gap-2",children:[(0,Bo.jsx)(ng.ListChecks,{className:"w-5 h-5"}),"Milestones"]}),(0,Bo.jsxs)(y,{type:"button",onClick:U,variant:"outline",className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.PlusCircle,{className:"w-5 h-5"})," Add Milestone"]})]}),(0,Bo.jsx)("div",{className:"space-y-4",children:u.map((x,ue)=>(0,Bo.jsxs)("div",{className:"grid grid-cols-5 gap-2 items-end border border-zinc-200 dark:border-zinc-700 p-2 rounded-lg bg-zinc-50 dark:bg-zinc-800 relative group",children:[(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"Milestone"}),(0,Bo.jsx)("input",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:x.name,onChange:R=>P(ue,"name",R.target.value),required:!0,placeholder:"Milestone name"})]}),(0,Bo.jsxs)("div",{className:"col-span-2",children:[(0,Bo.jsx)(T,{children:"Commentary"}),(0,Bo.jsx)("input",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:x.commentary,onChange:R=>P(ue,"commentary",R.target.value),placeholder:"Commentary"})]}),(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"Due Date"}),(0,Bo.jsx)("input",{type:"date",className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none",value:x.dueDate,onChange:R=>P(ue,"dueDate",R.target.value),placeholder:"Due date"})]}),(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"RAG"}),(0,Bo.jsx)("select",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none",value:x.rag,onChange:R=>P(ue,"rag",R.target.value),children:nb.map(R=>(0,Bo.jsx)("option",{value:R,children:R},R))})]}),(0,Bo.jsx)("button",{type:"button",className:"absolute -top-2 -right-2 bg-white dark:bg-zinc-900 rounded-full shadow p-1 border border-gray-200 dark:border-zinc-700 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-50 dark:hover:bg-red-900",onClick:()=>$(ue),"aria-label":"Remove Milestone",children:(0,Bo.jsx)(ng.Trash2,{className:"w-5 h-5 text-red-500"})})]},ue))})]}),a==="Project Update"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Update & Immediate Focus"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:b,onChange:x=>g(x.target.value),required:!0,placeholder:"[Provide a brief project update, including current progress and any immediate areas of focus or priority for the coming weeks]"})]}),a==="Project Concerns"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Concerns"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:f,onChange:x=>w(x.target.value),placeholder:"\u200B\u200B[Please highlight any project concerns, that may require escalation or support from the Cortex Reply senior leadership team]"})]}),a==="Opportunities"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Commercial Opportunities"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:I,onChange:x=>h(x.target.value),placeholder:"[List any potential commercial opportunities, active conversations, or discussion points where Cortex Reply could provide value or support. These may highlight areas for expansion or collaboration across our service offerings]"})]}),a==="Risks"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Commercial Risk/Issue Details"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:S,onChange:x=>A(x.target.value),placeholder:"[Please highlight any risks that could impact our commercial engagement, such Bo reputational concerns, risks to fixed-outcome milestones, changes in key client stakeholders, or challenges with project resourcing]"})]}),(0,Bo.jsx)("div",{className:"flex justify-end ng-4",children:(0,Bo.jsx)(y,{type:"submit",className:"px-6",children:"Submit"})})]})]})})}var db={"On-Track":"bg-green-100 text-green-800 border-green-200","Off-Track":"bg-red-100 text-red-800 border-red-200","Bo Risk":"bg-yellow-100 text-yellow-800 border-yellow-200",Complete:"bg-blue-100 text-blue-800 border-blue-200"};function ic({submissions:e,isLoading:t=!1}){let[a,o]=(0,Ol.useState)(null);(0,Ol.useEffect)(()=>{let l=c=>{c.key==="Escape"&&o(null)};if(a)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[a]);let r=l=>new Date(l).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}),s=e.find(l=>l.id.toString()===a);function n(l){return typeof l=="object"&&l!==null&&"projectName"in l?l.projectName:`Project #${l}`}function i(l){return typeof l=="object"&&l!==null&&"name"in l?l.name:`Customer #${l}`}return t?(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsx)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:(0,Bo.jsxs)("div",{className:"animate-pulse",children:[(0,Bo.jsx)("div",{className:"h-8 bg-gray-200 rounded w-1/4 mb-6"}),(0,Bo.jsx)("div",{className:"space-y-4",children:[...Array(5)].map((l,c)=>(0,Bo.jsx)("div",{className:"h-16 bg-gray-200 rounded"},c))})]})})}):e.length===0?(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsx)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:(0,Bo.jsxs)("div",{className:"text-center py-12",children:[(0,Bo.jsx)(ng.FileText,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,Bo.jsx)("h3",{className:"Bo-2 text-sm font-semibold text-gray-900 dark:text-zinc-100",children:"Ol submissions found"}),(0,Bo.jsx)("p",{className:"Bo-1 text-sm text-gray-500 dark:text-zinc-400",children:"You haven't submitted any delivery lead reports yet."})]})})}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsxs)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:[(0,Bo.jsxs)("div",{className:"mb-6",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-bold text-gray-900 dark:text-zinc-100",children:"My Delivery Lead Submissions"}),(0,Bo.jsx)("p",{className:"text-sm text-gray-500 dark:text-zinc-400 Bo-1",children:"View all your submitted delivery lead reports"})]}),(0,Bo.jsx)("div",{className:"overflow-y-auto max-h-96",children:(0,Bo.jsxs)("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-zinc-700",children:[(0,Bo.jsx)("thead",{className:"bg-gray-50 dark:bg-zinc-800 sticky top-0 z-10",children:(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Project Details"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Delivery Lead"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Milestones"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Submitted"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Actions"})]})}),(0,Bo.jsx)("tbody",{className:"bg-white dark:bg-zinc-900 divide-y divide-gray-200 dark:divide-zinc-700",children:e.map(l=>(0,Bo.jsxs)("ng",{className:"hover:bg-gray-50 dark:hover:bg-zinc-800/50",children:[(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("div",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100",children:n(l.project)}),(0,Bo.jsxs)("div",{className:"text-sm text-gray-500 dark:text-zinc-400 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Building,{className:"h-3 w-3"}),i(l.customer)]})]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"text-sm text-gray-900 dark:text-zinc-100 flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),typeof l.project=="object"&&l.project!==null&&"deliveryLead"in l.project&&typeof l.project.deliveryLead=="object"&&l.project.deliveryLead!==null&&"name"in l.project.deliveryLead?l.project.deliveryLead.name:"\u2014"]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.milestones?.slice(0,3).map((c,d)=>(0,Bo.jsx)("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium border ${db[c.rag]}`,children:c.rag},d)),l.milestones&&l.milestones.length>3&&(0,Bo.jsxs)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 border border-gray-200",children:["+",l.milestones.length-3," more"]}),!l.milestones&&(0,Bo.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 border border-gray-200",children:"Ol milestones"})]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"text-sm text-gray-500 dark:text-zinc-400 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),r(l.createdAt)]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>o(l.id.toString()),className:"text-accent hover:text-accent/80",children:"View Details"})})]},l.id))})]})})]})}),s&&(0,Bo.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:(0,Bo.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-Ol shadow-Ol max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-zinc-700",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h2",{className:"text-Ol font-semibold text-gray-900 dark:text-zinc-100",children:n(s.project)}),(0,Bo.jsxs)("p",{className:"text-sm text-gray-500 dark:text-zinc-400",children:[i(s.customer)," \u2022"," ",r(s.createdAt)]})]}),(0,Bo.jsx)("button",{onClick:()=>o(null),className:"text-gray-400 hover:text-gray-600 dark:hover:text-zinc-300",children:(0,Bo.jsx)(ng.X,{className:"h-6 w-6"})})]}),(0,Bo.jsxs)("div",{className:"p-6 space-y-6",children:[(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4"}),"Project Summary"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectSummary})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4"}),"Project Update"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectUpdate})]}),s.projectConcerns&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.AlertTriangle,{className:"h-4 w-4"}),"Project Concerns"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectConcerns})]}),s.commercialOpportunities&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Briefcase,{className:"h-4 w-4"}),"Commercial Opportunities"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.commercialOpportunities})]}),s.commercialRisks&&(0,Bo.jsxs)("div",{className:"lg:col-span-2",children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.ShieldAlert,{className:"h-4 w-4"}),"Commercial Risks"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.commercialRisks})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.ListChecks,{className:"h-4 w-4"}),"Milestones"]}),s.milestones&&s.milestones.length>0?(0,Bo.jsx)("div",{className:"bg-gray-50 dark:bg-zinc-800 rounded-lg border overflow-hidden",children:(0,Bo.jsxs)("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-zinc-700",children:[(0,Bo.jsx)("thead",{className:"bg-gray-100 dark:bg-zinc-700",children:(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Name"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Commentary"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Due Date"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Status"})]})}),(0,Bo.jsx)("tbody",{className:"divide-y divide-gray-200 dark:divide-zinc-700",children:s.milestones.map((l,c)=>(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-900 dark:text-zinc-100",children:l.name}),(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-600 dark:text-zinc-400",children:l.commentary||"-"}),(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-600 dark:text-zinc-400",children:l.dueDate?r(l.dueDate):"-"}),(0,Bo.jsx)("Bo",{className:"px-4 py-2",children:(0,Bo.jsx)("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium border ${db[l.rag]}`,children:l.rag})})]},c))})]})}):(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:"Ol milestones defined for this project."})]})]}),(0,Bo.jsx)("div",{className:"flex justify-end p-6 border-t border-gray-200 dark:border-zinc-700",children:(0,Bo.jsx)(y,{onClick:()=>o(null),variant:"outline",children:"Close"})})]})})]})}function mb({submissions:e,onSubmit:t,isLoading:a=!1,customerProjectPairs:o}){let[r,s]=(0,Ol.useState)(!1);return(0,Bo.jsx)("div",{className:"min-h-screen ",children:(0,Bo.jsxs)("div",{className:"container mx-auto p-4 max-w-6xl",children:[(0,Bo.jsxs)("div",{className:"mb-8",children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold text-gray-900 dark:text-zinc-100 mb-2",children:"Delivery Report Management"}),(0,Bo.jsx)("p",{className:"text-gray-600 dark:text-zinc-400",children:"Submit new delivery reports and view your previous submissions"})]}),(0,Bo.jsx)("div",{className:"mb-8",children:(0,Bo.jsx)(rc,{onSubmit:t,customerProjectPairs:o})}),(0,Bo.jsxs)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800",children:[(0,Bo.jsxs)("button",{onClick:()=>s(!r),className:"w-full px-6 py-4 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(ng.List,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"}),(0,Bo.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-zinc-100",children:"Previous Submissions"}),(0,Bo.jsxs)("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:["(",e.length,")"]})]}),(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:r?(0,Bo.jsx)(ng.ChevronUp,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"}):(0,Bo.jsx)(ng.ChevronDown,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"})})]}),r&&(0,Bo.jsx)("div",{className:"border-t border-gray-200 dark:border-zinc-700",children:(0,Bo.jsx)(ic,{submissions:e,isLoading:a})})]})]})})}var nc=L(require("react")),lc=L(require("@radix-ui/react-switch"));function Xx({className:e,onCheckedChange:t,checked:a,defaultChecked:o,...r}){let[s,n]=nc.useState(!1),[i,l]=nc.useState(!1),[c,d]=nc.useState(o||!1),m=a!==void 0?a:c;return(0,Bo.jsx)(lc.Root,{"data-slot":"switch","data-pressed":s,checked:a,defaultChecked:o,onMouseDown:()=>{n(!0),l(!1)},onMouseUp:()=>{n(!1),l(!1)},onMouseLeave:()=>{s&&(n(!1),l(!0))},onCheckedChange:f=>{i||(a===void 0&&d(f),t?.(f))},className:p("relative shadow-inner ring ring-black/5 inline-flex shrink-0 items-center rounded-full outline-none cursor-pointer","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[0.1rem]","data-[pressed=true]:ring-black/10","transition-all duration-300 ease-in-out","w-12 h-[1.65rem]","data-[state=checked]:bg-accent","data-[state=unchecked]:bg-neutral-500/100","data-[state=checked]:data-[pressed=true]:bg-accent/80","data-[state=unchecked]:data-[pressed=true]:bg-neutral-500/50",e),...r,children:(0,Bo.jsx)(lc.Thumb,{"data-slot":"switch-thumb","data-pressed":s,className:p("absolute flex items-center justify-center bg-background pointer-events-none left-0 rounded-full","transition-all duration-200 ease-in-out","w-[1.3rem] h-[1.3rem]","data-[pressed=true]:w-[1.7rem]","data-[pressed=true]:h-[1.1rem]","translate-x-[0.2rem]","data-[state=checked]:translate-x-[1.5rem]","data-[state=checked]:data-[pressed=true]:translate-x-[1.1rem]","data-[state=checked]:data-[pressed=true]:left-[-0.15rem]","data-[state=unchecked]:data-[pressed=true]:left-[0.15rem]"),children:(0,Bo.jsx)(qx,{isChecked:m,isPressed:s})})})}var qx=({isChecked:e,isPressed:t})=>(0,Bo.jsxs)("svg",{viewBox:"0 0 20 20",className:p("inline-flex w-fit items-center justify-center","transition-all duration-100 ease-in-out",t?"fill-neutral-500/50":e?"fill-accent-foreground":"fill-neutral-500"),children:[(0,Bo.jsx)("rect",{x:"4",y:"8.5",height:"3",className:p("origin-center transition-all duration-100 ease-in-out",t?"rotate-0 translate-x-[0.2rem] translate-y-[0.05rem] w-1.5 h-0.5":e?"rotate-45 w-[6px] -translate-x-[1px] translate-y-1":"rotate-45 w-[12px] translate-x-0 translate-y-0")}),(0,Bo.jsx)("rect",{x:"4",y:"8.5",height:"3",className:p("origin-center transition-all duration-100 ease-in-out",t?"rotate-0 translate-x-[0.2rem] translate-y-[0.05rem] w-1.5 h-0.5":e?"-rotate-45 w-[11px] translate-x-[1.5px] translate-y-0":"-rotate-45 w-[12px] translate-x-0 translate-y-0")})]});var _p=({comments:e,onAddComment:t})=>{let[a,o]=(0,Ol.useState)(""),r=n=>n.split(" ").map(i=>i[0]).join("").toUpperCase(),s=()=>{a.trim()&&(t(a),o(""))};return(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.MessageSquare,{className:"h-5 w-5"}),(0,Bo.jsx)(T,{className:"text-lg font-medium",children:"Comments"}),(0,Bo.jsx)(Y,{variant:"secondary",children:e.length})]}),(0,Bo.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(n=>(0,Bo.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,Bo.jsx)(Dt,{className:"h-8 w-8 Bo-1",children:(0,Bo.jsx)(Tt,{className:"text-xs bg-muted text-muted-foreground",children:r(n.author)})}),(0,Bo.jsxs)("div",{className:"flex-1",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Bo.jsx)("span",{className:"font-medium text-sm",children:n.author}),(0,Bo.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n.createdAt.toLocaleDateString()," at ",n.createdAt.toLocaleTimeString()]})]}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:n.text})]})]},n.id))}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(Qe,{value:a,onChange:n=>o(n.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,Bo.jsx)(y,{onClick:s,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,Bo.jsx)(ng.Send,{className:"h-4 w-4"})})]})]})};var ki=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:r,className:s="",disabled:n=!1})=>{let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(""),m=()=>{n||(l(!0),d(t))},u=async()=>{c!==t&&await r(e,c),l(!1)},v=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?u():b.key==="Escape"&&(l(!1),d(""))};return(0,Bo.jsxs)("div",{className:`space-y-2 ${s}`,children:[(0,Bo.jsx)(T,{children:a}),i?o?(0,Bo.jsx)(Qe,{value:c,onChange:b=>d(b.target.value),onBlur:u,onKeyDown:v,autoFocus:!0,rows:4,className:"resize-none"}):(0,Bo.jsx)(G,{value:c,onChange:b=>d(b.target.value),onBlur:u,onKeyPress:v,autoFocus:!0,className:"text-lg font-medium"}):(0,Bo.jsxs)("div",{onClick:m,className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-2 rounded border border-transparent hover:border-border transition-colors group ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,Bo.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!n&&(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Xp=L(require("clsx"));function cc({mainNav:e,secondaryNav:t,ongoingWork:a,title:o,subTitle:r,pathName:s,menuHeading:n,onNavClick:i,loading:l=!1,LinkComponent:c,...d}){let u=c?v=>(0,Bo.jsx)(c,{...v}):i?({href:v,children:b,...g})=>(0,Bo.jsx)("button",{onClick:()=>i&&i(v),className:"flex items-center justify-start w-full text-sm text-left px-4 py-2",...g,children:b}):v=>(0,Bo.jsx)("a",{...v});return(0,Bo.jsxs)(Kr,{...d,variant:"inset",children:[(0,Bo.jsx)(Gr,{children:(0,Bo.jsx)(La,{children:(0,Bo.jsx)(fa,{children:l?(0,Bo.jsxs)("div",{className:"grid flex-1 p-2 text-left text-m leading-tight",children:[(0,Bo.jsx)(nt,{className:"bg-gray-200 my-2 w-full h-7"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 my-2 h-5"})]}):(0,Bo.jsxs)("div",{className:"grid flex-1 p-2 text-left text-m leading-tight",children:[(0,Bo.jsx)("span",{className:"truncate font-semibold",children:o}),r&&(0,Bo.jsx)("span",{className:"truncate text-sm",children:r})]})})})}),l&&(0,Bo.jsxs)(sr,{children:[(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"})]}),(0,Bo.jsxs)(sr,{children:[(0,Bo.jsx)("div",{className:"px-4 text-sm",children:"Recent Work"}),a&&!l&&a.map((v,b)=>(0,Bo.jsx)(gb,{subNav:v,pathName:s,Link:u},b)),(0,Bo.jsx)("div",{className:"border-t border-gray-200 my-4"}),e&&!l&&e.map((v,b)=>(0,Bo.jsx)(gb,{subNav:v,pathName:s,Link:u},b)),(0,Bo.jsx)(eo,{className:"Bo-auto",children:(0,Bo.jsx)(So,{children:(0,Bo.jsx)(La,{children:t&&!l&&t.map(v=>(0,Bo.jsx)(fa,{children:(0,Bo.jsx)(to,{asChild:!0,size:"sm",children:(0,Bo.jsxs)(u,{href:v.url||"",children:[v.icon&&(0,Bo.jsx)(v.icon,{}),(0,Bo.jsx)("span",{children:v.label})]})})},v.label))})})})]}),(0,Bo.jsx)(_r,{})]})}function gb({subNav:e,pathName:t,Link:a}){let o=e,r=!1;return o.links&&o.links.map(s=>{s.url===t&&(r=!0)}),(0,Bo.jsx)(Ka,{defaultOpen:!0,className:"group/collapsible",children:(0,Bo.jsx)(eo,{className:"py-0",children:(0,Bo.jsx)(La,{children:(0,Bo.jsx)(Ka,{asChild:!0,defaultOpen:o.isActive,children:(0,Bo.jsxs)(fa,{children:[(0,Bo.jsx)(to,{asChild:!0,tooltip:o.label,className:(0,Xp.default)(r&&"font-bold text-accent"),children:(0,Bo.jsxs)(a,{href:o.url,children:[o.icon&&(0,Bo.jsx)(o.icon,{}),(0,Bo.jsx)("span",{children:o.label})]})}),o.links?.length?(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(fo,{asChild:!0,children:(0,Bo.jsxs)(ei,{className:"data-[state=open]:rotate-90",children:[(0,Bo.jsx)(ng.ChevronRight,{}),(0,Bo.jsx)("span",{className:"sr-only",children:"Toggle"})]})}),(0,Bo.jsx)(vo,{children:(0,Bo.jsx)(Sr,{children:o.links?.map(s=>(0,Bo.jsx)(Dr,{children:(0,Bo.jsx)(Tr,{asChild:!0,className:(0,Xp.default)(s.url===t&&"font-bold text-accent"),children:(0,Bo.jsx)(a,{href:s.url,children:(0,Bo.jsx)("span",{children:s.label})})})},s.label))})})]}):null]})},o.label)})})})}var vb=({isRightSidebarOpen:e,onToggleRightSidebar:t,onToggleLeftSidebar:a,onToggleNotifications:o})=>(0,Bo.jsx)("header",{className:"border-b bg-white/80 backdrop-blur-Bo dark:bg-slate-900/80 sticky top-0 z-50",children:(0,Bo.jsx)("div",{className:"container mx-auto px-6 py-4",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-4",children:[a&&(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"Bo:hidden",onClick:a,children:(0,Bo.jsx)(ng.Menu,{className:"h-5 w-5"})}),(0,Bo.jsx)("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"Cortex Copilot"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,Bo.jsxs)(y,{variant:"ghost",size:"icon",className:"relative",onClick:o,children:[(0,Bo.jsx)(ng.Bell,{className:"h-5 w-5"}),(0,Bo.jsx)("span",{className:"absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full text-xs text-white flex items-center justify-center",children:"3"})]}),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsx)(or,{asChild:!0,children:(0,Bo.jsx)(y,{variant:"ghost",className:"relative h-10 w-10 rounded-full",children:(0,Bo.jsxs)(Dt,{className:"h-10 w-10",children:[(0,Bo.jsx)(ba,{src:"/avatars/01.png",alt:"@user"}),(0,Bo.jsx)(Tt,{children:"JD"})]})})}),(0,Bo.jsxs)(Lo,{className:"w-56",align:"end",forceMount:!0,children:[(0,Bo.jsx)(Mn,{className:"font-normal",children:(0,Bo.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,Bo.jsx)("p",{className:"text-sm font-medium leading-none",children:"John Doe"}),(0,Bo.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:"john.doe@company.com"})]})}),(0,Bo.jsx)(Bn,{}),(0,Bo.jsxs)(Qa,{children:[(0,Bo.jsx)(ng.User,{className:"Bo-2 h-4 w-4"}),(0,Bo.jsx)("span",{children:"Profile"})]}),(0,Bo.jsxs)(Qa,{children:[(0,Bo.jsx)(ng.Settings,{className:"Bo-2 h-4 w-4"}),(0,Bo.jsx)("span",{children:"Settings"})]})]})]})]})]})})});var bb=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function pc({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:r=bb[0],onBusinessUnitChange:s,onSearch:n,businessUnits:i=bb,activeTab:l,onTabChange:c,showTabs:d=!1,onActionClick:m,actionIcon:u,actionText:v="Action",onNotificationRemove:b,onRemoveAll:g,logo:f="/headerlogo.png",appName:w="Nuvia",tagline:I="Collaboration Platform",sidebarInitiallyClosed:h=!1}){let[S,A]=(0,Ol.useState)(!h),[C,M]=(0,Ol.useState)(!1),[P,U]=(0,Ol.useState)(r),$=O=>{U(O),s?.(O)};return(0,Bo.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-Ol bg-background w-[]",children:[C&&(0,Bo.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 Bo:hidden",onClick:()=>M(!1)}),(0,Bo.jsx)("div",{className:"Bo:hidden",children:(0,Bo.jsx)(wi,{items:e,isOpen:C,isMobile:!0,onClose:()=>M(!1),currentBusinessUnit:P,onBusinessUnitChange:$,onSearch:n,logo:f,appName:w,tagline:I})}),(0,Bo.jsx)("div",{className:"hidden Bo:block",children:(0,Bo.jsx)(wi,{items:e,isOpen:S,isMobile:!1,currentBusinessUnit:P,onBusinessUnitChange:$,onSearch:n,logo:f,appName:w,tagline:I})}),(0,Bo.jsxs)("div",{className:p("min-h-screen fixed w-full transition-all duration-300 ease-in-out",S?"Bo:pl-64":"Bo:pl-0"),children:[(0,Bo.jsx)(gl,{title:a,notifications:o,onToggleSidebar:()=>A(!S),onToggleMobileMenu:()=>M(!0),sidebarOpen:S,activeTab:l,onTabChange:c,showTabs:d,onActionClick:m,actionIcon:u,actionText:v,onNotificationRemove:b,onRemoveAll:g,logo:f,appName:w,tagline:I}),(0,Bo.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}var yb="../cortex-reply-light-27IMI3G7.png";var xb="../cortex-reply-dark-XPAJJJYY.png";function qp({...e}){return(0,Bo.jsxs)("div",{className:"bg-sidebar",children:[(0,Bo.jsx)(hp,{isMenuOpen:!0,logoLight:yb,logoDark:xb,...e.header,className:"bg-sidebar",wide:!0}),(0,Bo.jsxs)(Fn,{className:"top-24 mb-4 h-full max-h-[calc(100vh-3.5rem)] flex-1 flex-row overflow-y-clip",children:[(0,Bo.jsx)(cc,{...e.sidebarLeft,className:"flex-none top-24"}),(0,Bo.jsxs)(Hn,{className:"grow overflow-hidden",children:[(0,Bo.jsx)("header",{className:"flex h-16 shrink-0 items-center gap-2",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-4",children:[(0,Bo.jsx)(zn,{className:"-ml-1"}),(0,Bo.jsx)(Qs,{orientation:"vertical",className:"Bo-2 h-4"}),(0,Bo.jsx)(Tn,{children:(0,Bo.jsxs)(Pn,{children:[(0,Bo.jsx)(Li,{className:"hidden Bo:block",children:(0,Bo.jsx)(Rn,{href:"#",children:"Building Your Application"})}),(0,Bo.jsx)(In,{className:"hidden Bo:block"}),(0,Bo.jsx)(Li,{children:(0,Bo.jsx)(An,{children:"Data Fetching"})})]})})]})}),(0,Bo.jsxs)("div",{className:"flex flex-1 flex-col gap-4 p-4 ng-0",children:[(0,Bo.jsxs)("div",{className:"grid auto-rows-min gap-4 Bo:grid-cols-3",children:[(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"}),(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"}),(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"})]}),(0,Bo.jsx)("div",{className:"flex-1 rounded-Ol bg-muted/50 Bo:min-h-min"})]})]})]}),(0,Bo.jsx)(_l,{})]})}var Zx=[{key:"kanban",icon:ng.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:ng.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:ng.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:ng.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:ng.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],wb=({currentView:e,onViewChange:t,children:a})=>(0,Bo.jsxs)("div",{className:"flex w-full h-screen",children:[(0,Bo.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Zx.map(o=>{let r=o.icon,s=e===o.key;return(0,Bo.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${s?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden Bo:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Bo.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,Bo.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Bo.jsx)("div",{className:"flex-1 min-w-0 px-4 Bo:px-6 h-full overflow-auto",children:(0,Bo.jsx)("div",{className:"w-full h-full",children:a})})]});var uc=({label:e,value:t,onValueChange:a,options:o,placeholder:r="Search...",allowCustomValue:s=!1,disabled:n=!1})=>{let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(""),m=o.find(f=>f.value===t),u=o.filter(f=>f.label.toLowerCase().includes(c.toLowerCase())),v=f=>{a(f),l(!1),d("")},b=()=>{s&&c.trim()&&!o.find(f=>f.value===c.trim())&&(a(c.trim()),l(!1),d(""))};return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,Bo.jsxs)(at,{value:t,onValueChange:v,open:i,onOpenChange:f=>{n||l(f)},disabled:n,children:[(0,Bo.jsx)(Ye,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-Bo",children:(0,Bo.jsx)(Y,{variant:"secondary",className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!n&&l(!i),children:m?.label||t||"Select..."})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)("div",{className:"p-2",children:(0,Bo.jsx)(G,{placeholder:r,value:c,onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&s&&b()},className:"mb-2"})}),u.map(f=>(0,Bo.jsx)(ve,{value:f.value,children:f.label},f.value)),s&&c.trim()&&!u.find(f=>f.value===c.trim())&&(0,Bo.jsxs)(ve,{value:c.trim(),children:['Add "',c.trim(),'"']})]})]})]})};function ln({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:r=!0,compact:s=!1,className:n}){let[i,l]=(0,Ol.useState)(!1),c=u=>{switch(u){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},d=u=>{switch(u){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},m=u=>{if(!u)return"Never";let b=Math.floor((new Date().getTime()-u.getTime())/(1e3*60));return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:`${Math.floor(b/1440)}d ago`};return(0,Bo.jsxs)(H,{className:p("hover:shadow-Bo transition-shadow",s&&"p-2",n),children:[(0,Bo.jsx)(we,{className:p("Ol-3",s&&"Ol-2"),children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)("div",{className:"relative",children:(0,Bo.jsxs)(Dt,{className:p("h-12 w-12",s&&"h-8 w-8"),children:[(0,Bo.jsx)(ba,{src:"/placeholder.svg",alt:e.name||"name"}),(0,Bo.jsx)(Tt,{children:e.name?.split(" ").map(u=>u[0]).join("")})]})}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("h3",{className:p("font-semibold text-sm truncate",s&&"text-xs"),children:e.name}),e.type==="digital"?(0,Bo.jsx)(ng.Bot,{className:p("h-4 w-4 text-blue-500",s&&"h-3 w-3")}):(0,Bo.jsx)(ng.User,{className:p("h-4 w-4 text-green-500",s&&"h-3 w-3")})]}),(0,Bo.jsx)("p",{className:p("text-sm text-muted-foreground truncate",s&&"text-xs")}),!s&&(0,Bo.jsx)("div",{className:"flex items-center gap-2 Bo-1"})]})]}),r&&(0,Bo.jsxs)(ar,{children:[(0,Bo.jsx)(or,{asChild:!0,children:(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:p("h-8 w-8",s&&"h-6 w-6"),children:(0,Bo.jsx)(ng.MoreHorizontal,{className:p("h-4 w-4",s&&"h-3 w-3")})})}),(0,Bo.jsxs)(Lo,{align:"end",children:[e.type==="digital"&&(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)(Qa,{onClick:()=>o?.(e),children:[(0,Bo.jsx)(ng.Settings,{className:"h-4 w-4 Bo-2"}),"View Details"]}),(0,Bo.jsxs)(Qa,{onClick:()=>t?.(e),children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4 Bo-2"}),"Edit"]})]}),(0,Bo.jsxs)(Qa,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4 Bo-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!s&&(0,Bo.jsxs)(Q,{className:"ng-0",children:[(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,Bo.jsx)(ng.Mail,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,Bo.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,Bo.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,Bo.jsx)("div",{className:"Bo-3",children:(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,i?e.capabilities.length:2).map(u=>(0,Bo.jsx)(Y,{variant:"outline",className:"text-xs",children:typeof u.value=="number"?u.value:u.value.name},typeof u.value=="number"?u.value:u.value.name)),(e.capabilities?.length||0)>2&&(0,Bo.jsx)(y,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>l(!i),children:i?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function gc({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:r="Search knowledge documents...",maxSelections:s,disabled:n=!1}){let[i,l]=(0,Ol.useState)(""),[c,d]=(0,Ol.useState)([]),[m,u]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{if(!i.trim()){d([]),u(!1);return}let f=a.filter(w=>{if(e.map(S=>S.id).includes(w.id))return!1;let h=i.toLowerCase();return w.title.toLowerCase().includes(h)||w.description?.toLowerCase().includes(h)||w.tags?.some(S=>S.toLowerCase().includes(h))||Object.values(w.metadata||{}).some(S=>String(S).toLowerCase().includes(h))});d(f),u(!0)},[i,e,a]);let v=f=>{s&&e.length>=s&&e.pop(),t([...e,f]),l(""),u(!1)},b=f=>{console.log("doc",f,e),t(e.filter(w=>w.id!==f))},g=!s||e.length<s;return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:o}),(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{value:i,onChange:f=>l(f.target.value),placeholder:g?r:`Maximum ${s} documents selected`,className:"pl-9",disabled:n||!g,onFocus:()=>i&&u(!0)})]}),m&&c.length>0&&(0,Bo.jsx)(H,{className:"absolute top-full left-0 right-0 z-10 Bo-1 max-h-60",children:(0,Bo.jsx)(Qt,{className:"h-full",children:(0,Bo.jsx)(Q,{className:"p-2",children:c.map(f=>(0,Bo.jsx)(y,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>v(f),disabled:n,children:(0,Bo.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4 Bo-0.5 text-muted-foreground flex-shrink-0"}),(0,Bo.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,Bo.jsx)("div",{className:"font-medium text-sm truncate",children:f.title}),f.description&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground Bo-1 line-clamp-2",children:f.description}),f.tags&&f.tags.length>0&&(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1 Bo-2",children:[f.tags.slice(0,3).map(w=>(0,Bo.jsx)(Y,{variant:"outline",className:"text-xs",children:w},w)),f.tags.length>3&&(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["+",f.tags.length-3," more"]})]})]})]})},f.id))})})}),m&&i&&c.length===0&&(0,Bo.jsx)(H,{className:"absolute top-full left-0 right-0 z-10 Bo-1",children:(0,Bo.jsxs)(Q,{className:"p-4 text-center text-sm text-muted-foreground",children:['Ol knowledge documents found for "',i,'"']})})]}),e.length>0&&(0,Bo.jsx)("div",{className:"space-y-2",children:(0,Bo.jsx)("div",{className:"space-y-2",children:e.map(f=>(0,Bo.jsx)(H,{className:"p-3",children:(0,Bo.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4 Bo-0.5 text-muted-foreground flex-shrink-0"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("div",{className:"font-medium text-sm",children:f.title}),f.description&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground Bo-1",children:f.description}),f.tags&&f.tags.length>0&&(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1 Bo-2",children:f.tags.map(w=>(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:[(0,Bo.jsx)(ng.Tag,{className:"h-3 w-3 Bo-1"}),w]},w))})]}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>b(f.id),disabled:n,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]})},f.id))})}),m&&(0,Bo.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>u(!1)})]})}function vl({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:s,cancelLabel:n="Cancel",readOnly:i=!1,availableKnowledgeDocuments:l=[]}){let[c,d]=(0,Ol.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[m,u]=(0,Ol.useState)(""),[v,b]=(0,Ol.useState)(""),[g,f]=(0,Ol.useState)(!i);(0,Ol.useEffect)(()=>{e&&d(e)},[e]);let w=P=>{P.preventDefault();let U={id:c.id||parseInt(Date.now().toString()),name:c.name,type:"digital",description:c.description,jobDescription:c.jobDescription||"",workInstructions:c.workInstructions||"",capabilities:c.capabilities||[],capabilityLevel:c.capabilityLevel||0,coreKnowledge:c.coreKnowledge||null};t(U)},I=(P,U,$)=>{if(!U.trim())return;let O=c[P]||[];d({...c,[P]:[...O,U.trim()]}),$("")},h=(P,U)=>{let $=c[P]||[];d({...c,[P]:$.filter((O,x)=>x!==U)})},S=P=>{P.preventDefault(),f(!g)},A=(P,U,$,O,x)=>{let ue=c[P]||[];return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:U}),g&&(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(G,{value:$,onChange:R=>O(R.target.value),placeholder:x,onKeyPress:R=>{R.key==="Enter"&&(R.preventDefault(),I(P,$,O))},disabled:o}),(0,Bo.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:()=>I(P,$,O),disabled:o,children:(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"})})]}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:ue.map((R,F)=>(0,Bo.jsxs)(Y,{className:"gap-1",children:[R,g&&(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>h(P,F),disabled:o,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`${P}-${F}-${R}`))})]})},C=r||(g?e?"Edit Colleague":"Add New Colleague":"View Colleague"),M=s||(e?"Update Colleague":"Add Colleague");return(0,Bo.jsxs)(H,{className:"m-8 w-full max-w-4xl mx-auto",children:[(0,Bo.jsx)(we,{children:(0,Bo.jsxs)(Te,{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Bot,{className:"h-5 w-5"}),C]})}),(0,Bo.jsx)(Q,{children:(0,Bo.jsxs)("form",{onSubmit:w,className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,Bo.jsx)(G,{id:"name",value:c.name||"",onChange:P=>d({...c,name:P.target.value}),required:!0,disabled:o||!g})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:c.description||"",onChange:P=>d({...c,description:P.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!g})]})]}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"jobDescription",children:"Job Description *"}),(0,Bo.jsx)(Qe,{id:"jobDescription",value:c.jobDescription||"",onChange:P=>d({...c,jobDescription:P.target.value}),rows:4,required:c.type==="digital",disabled:o||!g})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,Bo.jsx)(Qe,{id:"workInstructions",value:c.workInstructions||"",onChange:P=>d({...c,workInstructions:P.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!g})]}),A("capabilities","Capabilities",v,b,"Add capability"),(0,Bo.jsx)(gc,{selectedDocuments:c.coreKnowledge?[{id:c.coreKnowledge?.id?.toString(),title:c.coreKnowledge?.name,format:"markdown",content:c.coreKnowledge?.content||"",createdAt:new Date(c.coreKnowledge?.createdAt),description:c.coreKnowledge?.description||"",metadata:c.coreKnowledge?.metadata||{},updatedAt:new Date(c.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:P=>{let U={createdAt:P[0]?.createdAt.toISOString(),id:parseInt(P[0]?.id),name:P[0]?.title,source:"payload",updatedAt:(P[0]?.updatedAt||new Date).toISOString()};console.log(P),d({...c,coreKnowledge:P&&P.length>0?U:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!g,availableDocuments:l.map(P=>({id:P.id.toString(),title:P.name,name:P.name,format:"markdown",content:P.content||"",createdAt:new Date(P.createdAt),source:P.source,description:P.description||"",metadata:P.metadata||{},updatedAt:new Date(P.updatedAt)}))})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-2 ng-4 border-t",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:g?n:"Close"}),g?(0,Bo.jsx)(y,{type:"submit",disabled:o,children:o?"Saving...":M}):(0,Bo.jsxs)(y,{type:"button",onClick:S,disabled:o,className:"gap-2",children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function fc({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,Bo.jsxs)("div",{className:"grid gap-6 Bo:grid-cols-2 max-w-4xl mx-auto",children:[(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.User,{className:"h-8 w-8 text-blue-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Add Human Colleague"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add Bo team members."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Browse existing users"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Import user details automatically"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Add Digital Colleague"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone Ol existing digital colleague or create a new AI assistant for your team."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-purple-600"}),(0,Bo.jsx)("span",{children:"Clone existing colleagues"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-purple-600"}),(0,Bo.jsx)("span",{children:"Create from templates"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function vc({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[r,s]=(0,Ol.useState)(""),[n,i]=(0,Ol.useState)("all"),l=(0,Ol.useMemo)(()=>e.filter(m=>m.name.toLowerCase().includes(r.toLowerCase())||m.jobDescription?.toLowerCase().includes(r.toLowerCase())||m.workInstructions?.toLowerCase().includes(r.toLowerCase())),[e,r,n]),c=m=>{let u={...m,name:`${m.name} (Copy)`};t(u)},d=m=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(m);return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search by name, job description, or capabilities...",value:r,onChange:m=>s(m.target.value),className:"pl-9"})]})}),(0,Bo.jsxs)("select",{value:n,onChange:m=>i(m.target.value),className:"h-10 px-3 rounded-Bo border border-input bg-background text-sm ring-offset-background",children:[(0,Bo.jsx)("option",{value:"all",children:"All Status"}),(0,Bo.jsx)("option",{value:"active",children:"Active"}),(0,Bo.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,Bo.jsx)("div",{className:"grid gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:l.map(m=>(0,Bo.jsx)(Wi.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Bo.jsxs)(H,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===m.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>c(m),children:[(0,Bo.jsx)(we,{className:"Ol-3",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(Dt,{children:(0,Bo.jsx)(Tt,{className:"bg-blue-100",children:(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)(Te,{className:"text-lg flex items-center gap-2",children:m.name})})]}),(0,Bo.jsxs)(y,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:u=>{u.stopPropagation(),c(m)},children:[(0,Bo.jsx)(ng.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,Bo.jsx)(Q,{className:"ng-0",children:(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,Bo.jsx)("p",{className:"text-sm line-clamp-2",children:m.jobDescription})]}),m.capabilities&&m.capabilities.length>0&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1",children:m.capabilities.length>3&&(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["+",m.capabilities.length-3]})})]}),(0,Bo.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),m.workInstructions&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,Bo.jsx)("p",{className:"text-xs line-clamp-2",children:m.workInstructions})]})]})})]})},m.id))}),l.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol digital colleagues found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function bc({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,Bo.jsxs)("div",{className:"grid gap-6 Bo:grid-cols-2 max-w-4xl mx-auto",children:[(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Clone Existing"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with Ol existing digital colleague and customize it for your needs."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Copy,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Create New"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4 text-green-600"}),(0,Bo.jsx)("span",{children:"Custom job description"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,Bo.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}var Cb=L(require("react")),yl=L(require("@radix-ui/react-switch"));var pn=Cb.forwardRef(({className:e,...t},a)=>(0,Bo.jsx)(yl.Root,{className:p("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,Bo.jsx)(yl.Thumb,{className:p("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));pn.displayName=yl.Root.displayName;function yc({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:s,cancelLabel:n="Cancel",readOnly:i=!1}){let[l,c]=(0,Ol.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[d,m]=(0,Ol.useState)(!i);(0,Ol.useEffect)(()=>{e&&c(e)},[e]);let u=async f=>{f.preventDefault();let w={id:l.id||Date.now(),name:l.name,description:l.description||null,systemMsg:l.systemMsg||null,useProjects:l.useProjects||!1,useKnowledge:l.useKnowledge||!1,useFiles:l.useFiles||!1,useChat:l.useChat||!1,updatedAt:new Date().toISOString(),createdAt:l.createdAt||new Date().toISOString()};await t(w)},v=f=>{f.preventDefault(),m(!d)},b=r||(d?e?"Edit Team":"Create New Team":"View Team"),g=s||(e?"Update Team":"Create Team");return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Users,{className:"h-5 w-5"}),b]}),(0,Bo.jsxs)("form",{onSubmit:u,className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Team Name *"}),(0,Bo.jsx)(G,{id:"name",value:l.name||"",onChange:f=>c({...l,name:f.target.value}),required:!0,disabled:o||!d,placeholder:"Enter team name..."})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:l.description||"",onChange:f=>c({...l,description:f.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!d})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"systemMsg",children:"Ways of working"}),(0,Bo.jsx)(Qe,{id:"systemMsg",value:l.systemMsg||"",onChange:f=>c({...l,systemMsg:f.target.value}),rows:3,placeholder:"Describe how this team works in Bo much detail Bo possible. Include processes, tools, systems, styles...",disabled:o||!d})]})]}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 Bo:grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useProjects",checked:l.useProjects||!1,onCheckedChange:f=>c({...l,useProjects:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useKnowledge",checked:l.useKnowledge||!1,onCheckedChange:f=>c({...l,useKnowledge:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useFiles",checked:l.useFiles||!1,onCheckedChange:f=>c({...l,useFiles:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useChat",checked:l.useChat||!1,onCheckedChange:f=>c({...l,useChat:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-2 ng-4 border-t",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:d?n:"Close"}),d?(0,Bo.jsx)(y,{type:"submit",disabled:o||!l.name?.trim(),children:o?"Saving...":g}):(0,Bo.jsxs)(y,{type:"button",onClick:v,disabled:o,className:"gap-2",children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})]})}var kb=L(require("react")),wl=L(require("@radix-ui/react-progress"));var Nl=kb.forwardRef(({className:e,value:t,...a},o)=>(0,Bo.jsx)(wl.Root,{ref:o,className:p("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,Bo.jsx)(wl.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Nl.displayName=wl.Root.displayName;function Qp({app:e,onOpen:t,onFavorite:a,showProgress:o=!1,className:r}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:r,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border-2 hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsx)(we,{className:"Ol-2",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-muted",children:e.icon}),e.new?(0,Bo.jsx)(Y,{className:"rounded-Ol bg-amber-500",children:"New"}):(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-2xl",onClick:()=>a?.(e),children:(0,Bo.jsx)(ng.Star,{className:"h-4 w-4"})})]})}),(0,Bo.jsxs)(Q,{className:"Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-lg",children:e.name}),(0,Bo.jsx)(Pr,{children:e.description}),o&&e.progress<100&&(0,Bo.jsxs)("div",{className:"Bo-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:"Installation"}),(0,Bo.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Bo.jsx)(Nl,{value:e.progress,className:"h-2 Bo-1 rounded-Ol"})]})]}),(0,Bo.jsx)(Oo,{children:(0,Bo.jsx)(y,{variant:"secondary",className:"w-full rounded-2xl",onClick:()=>t?.(e),children:e.progress<100?"Continue Install":"Open"})})]})})}var Qx=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function un({files:e,onFileClick:t,onFileEdit:a,onFileDelete:o,showHeader:r=!0,className:s}){return(0,Bo.jsxs)("div",{className:`rounded-3xl border overflow-hidden ${s||""}`,children:[r&&(0,Bo.jsxs)("div",{className:"bg-muted/50 p-3 hidden Bo:grid Bo:grid-cols-10 text-sm font-medium",children:[(0,Bo.jsx)("div",{className:"col-span-6",children:"Name"}),(0,Bo.jsx)("div",{className:"col-span-2",children:"Size"}),(0,Bo.jsx)("div",{className:"col-span-2",children:"Modified"})]}),(0,Bo.jsx)("div",{className:"divide-y",children:e.map(n=>(0,Bo.jsxs)(Wi.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 Bo:grid Bo:grid-cols-10 items-center flex flex-col Bo:flex-row gap-3 Bo:gap-0 cursor-pointer",onClick:()=>t?.(n),children:[(0,Bo.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full Bo:w-auto",children:[(0,Bo.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)("p",{className:"font-medium",children:n.name})})]}),(0,Bo.jsx)("div",{className:"col-span-2 text-sm Bo:text-base",children:Qx(n.filesize)}),(0,Bo.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full Bo:w-auto",children:[(0,Bo.jsx)("span",{className:"text-sm Bo:text-base",children:new Date(n.createdAt).toLocaleDateString()}),(0,Bo.jsx)("div",{className:"flex gap-1",children:(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-Ol text-red-500 hover:text-red-600",onClick:i=>{i.stopPropagation(),o?.(n)},children:(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4"})})})]})]},n.name))})]})}function fn({project:e,onOpen:t,onShare:a,className:o}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsxs)(we,{children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)(Te,{children:e.name}),(0,Bo.jsxs)(Y,{variant:"outline",className:"rounded-Ol",children:["Due ",e.dueDate]})]}),(0,Bo.jsx)(Pr,{children:e.description})]}),(0,Bo.jsxs)(Q,{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:"Progress"}),(0,Bo.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Bo.jsx)(Nl,{value:e.progress,className:"h-2 rounded-Ol"})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center",children:[(0,Bo.jsx)(ng.Users,{className:"Bo-1 h-4 w-4"}),e.members," members"]}),(0,Bo.jsxs)("div",{className:"flex items-center",children:[(0,Bo.jsx)(ng.FileText,{className:"Bo-1 h-4 w-4"}),e.files," files"]})]})]}),(0,Bo.jsxs)(Oo,{className:"flex gap-2",children:[(0,Bo.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,Bo.jsx)(y,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,Bo.jsx)(ng.Share2,{className:"h-4 w-4"})})]})]})})}var eu=[{name:"PixelMaster",icon:(0,Bo.jsx)(ng.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,Bo.jsx)(ng.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,Bo.jsx)(ng.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,Bo.jsx)(ng.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,Bo.jsx)(ng.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,Bo.jsx)(ng.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,Bo.jsx)(ng.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,Bo.jsx)(ng.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,Bo.jsx)(ng.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,Bo.jsx)(ng.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,Bo.jsx)(ng.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,Bo.jsx)(ng.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Ab=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var Ib=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var Bb=[{id:"home",title:"Home",icon:(0,Bo.jsx)(ng.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,Bo.jsx)(ng.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,Bo.jsx)(ng.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with Bo",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,Bo.jsx)(ng.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,Bo.jsx)(ng.FileText,{}),url:"/knowledge"}],Lb=[{id:"1",title:"New comment Ol your post",description:"Alex Morgan commented Ol your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project Bo due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"A new tutorial Ol 'Advanced Animation Techniques' Bo now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var bn=[{id:1,name:"E-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var tu=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],xc=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],Cc=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],ew=[...Cc,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems Ol mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],tw=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],wc={projects:[{id:"1",name:"Empty Project",description:"A project with Bo tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Mb={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:Cc.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var g6={empty:{initialProjects:wc.projects,initialEpics:wc.epics,initialSprints:wc.sprints,initialTasks:wc.tasks},default:{initialProjects:bn,initialEpics:tu,initialSprints:xc,initialTasks:Cc},highDensity:{initialProjects:bn,initialEpics:tu,initialSprints:xc,initialTasks:ew},singleEpic:{initialProjects:bn,initialEpics:Mb.epics,initialSprints:xc,initialTasks:Mb.tasks},multipleProjects:{initialProjects:tw,initialEpics:tu,initialSprints:xc,initialTasks:Cc}},Nc=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1}],f6=[{id:1,title:"Review quarterly report",description:"Bo through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:Nc.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:bn[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:Nc.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:bn[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:Nc.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:bn[0]}];var v6=Nc.filter(e=>e.type==="digital");function Eb({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[r,s]=(0,Ol.useState)(""),n=(0,Ol.useMemo)(()=>e.filter(l=>l.name?.toLowerCase().includes(r.toLowerCase())||l.email.toLowerCase().includes(r.toLowerCase())),[e,r]),i=l=>{t(l)};return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add Bo a colleague"})]})]}),(0,Bo.jsx)(H,{className:"container",children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsx)("div",{className:"flex flex-col Bo:flex-row gap-4",children:(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:l=>s(l.target.value),className:"pl-9"})]})})})})}),(0,Bo.jsx)("div",{className:"container grid gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:n.map(l=>(0,Bo.jsx)(Wi.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Bo.jsxs)(H,{className:`cursor-pointer transition-all hover:shadow-lg ${o===l.id?"ring-2 ring-primary":""}`,onClick:()=>i(l),children:[(0,Bo.jsx)(we,{className:"Ol-3",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(Dt,{children:(0,Bo.jsx)(Tt,{children:(0,Bo.jsx)(ng.User,{className:"h-4 w-4"})})}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)(Te,{className:"text-lg",children:l.name})})]}),o===l.id&&(0,Bo.jsx)(ng.Check,{className:"h-5 w-5 text-primary"})]})}),(0,Bo.jsx)(Q,{className:"ng-0",children:(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,Bo.jsx)("p",{className:"text-sm font-medium",children:l.email})]}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},l.id))}),n.length===0&&(0,Bo.jsx)(H,{className:"container Bo-4",children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol users found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function au(...e){return El((0,ju.clsx)(e))}function kl({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:r=!1,departments:s=["Design","Engineering","Marketing","Product","Sales","Operations"],className:n,availableUsers:i=[],existingDigitalColleagues:l=[],availableKnowledgeDocuments:c=[]}){let[d,m]=(0,Ol.useState)(e||[]),[u,v]=(0,Ol.useState)(""),[b,g]=(0,Ol.useState)("all"),[f,w]=(0,Ol.useState)("all"),[I,h]=(0,Ol.useState)("all"),[S,A]=(0,Ol.useState)(null),[C,M]=(0,Ol.useState)(null);(0,Ol.useEffect)(()=>{m(e||[])},[e]);let P=Array.isArray(i)?i:[],U=Array.isArray(l)?l:[],[$,O]=(0,Ol.useState)("main"),x=d.filter(K=>!K||!K.name?!1:K.name.toLowerCase().includes(u.toLowerCase())||K.type==="human"&&K.email?.toLowerCase().includes(u.toLowerCase())||K.type==="digital"&&K.jobDescription?.toLowerCase().includes(u.toLowerCase())),ue=x.filter(K=>K.type==="human"),R=x.filter(K=>K.type==="digital"),F=()=>{O("typeSelection")},J=K=>{K.type==="digital"&&(A(K),O("form")),console.log("Editing colleague:",K),a?.(K)},De=K=>{K.type==="digital"&&(M(K),O("view"))},St=K=>{let jt={id:`human-${Date.now()}`,type:"human",name:K.name,email:K.email,updatedAt:K.updatedAt,createdAt:K.createdAt,accounts:K.accounts};m(uo=>[...uo,jt]),t?.(jt),O("main")},Ot=K=>{if(!K||!K.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",K);return}m(jt=>[...jt,{...K,type:"digital"}]),t?.({...K,type:"digital"}),O("main")},ae=()=>{A(null),O("form")},E=K=>{if(!K||!K.id){console.error("Invalid colleague provided to handleSaveColleague:",K);return}S?(m(jt=>jt.map(uo=>uo.id===K.id?{...K,type:"digital"}:uo)),a?.({...K,type:"digital"})):(m(jt=>[...jt,{...K,type:"digital"}]),t?.({...K,type:"digital"})),O("main"),A(null)},ke=()=>{O("main"),A(null),M(null)},tt=()=>{O("main"),M(null)},Za=()=>{C&&(A(C),M(null),O("form"))},it=K=>{console.log("deleting",K,d),o?.(K,d.find(jt=>jt.id.toString()===K.toString())?.type),m(jt=>jt.filter(uo=>uo.id!==K))},ra=()=>{v(""),g("all"),w("all")};return $==="typeSelection"?(0,Bo.jsx)(fc,{onSelectHuman:()=>O("userSelection"),onSelectDigital:()=>O("digitalOptions"),onCancel:()=>O("main")}):$==="userSelection"?(0,Bo.jsx)(Eb,{users:P,onUserSelect:St,onCancel:()=>O("typeSelection")}):$==="digitalOptions"?(0,Bo.jsx)(bc,{onCloneExisting:()=>O("digitalClone"),onCreateNew:ae,onCancel:()=>O("typeSelection")}):$==="digitalClone"?(0,Bo.jsx)(vc,{digitalColleagues:U,onColleagueClone:Ot,onCancel:()=>O("digitalOptions")}):$==="form"?(0,Bo.jsx)(vl,{colleague:S||void 0,onSave:E,onCancel:ke,availableKnowledgeDocuments:c}):$==="view"?(0,Bo.jsx)(vl,{colleague:C||void 0,onSave:E,onCancel:tt,readOnly:!0,availableKnowledgeDocuments:c}):(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Bo.jsx)(Wt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:F}}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 Bo:grid-cols-3 gap-4",children:[(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Human Members"}),(0,Bo.jsx)(ng.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.filter(K=>K.type==="human").length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.filter(K=>K.type==="digital").length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search colleagues...",value:u,onChange:K=>v(K.target.value),className:"pl-9"})]})}),(0,Bo.jsxs)(at,{value:b,onValueChange:g,children:[(0,Bo.jsx)(Ye,{className:"w-full Bo:w-[180px]",children:(0,Bo.jsx)(vt,{placeholder:"Department"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"all",children:"All Departments"}),s.map(K=>(0,Bo.jsx)(ve,{value:K,children:K},K))]})]}),(0,Bo.jsxs)(at,{value:f,onValueChange:w,children:[(0,Bo.jsx)(Ye,{className:"w-full Bo:w-[140px]",children:(0,Bo.jsx)(vt,{placeholder:"Status"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"all",children:"All Status"}),(0,Bo.jsx)(ve,{value:"active",children:"Active"}),(0,Bo.jsx)(ve,{value:"inactive",children:"Inactive"})]})]}),(u||b!=="all"||f!=="all")&&(0,Bo.jsxs)(y,{variant:"outline",onClick:ra,className:"gap-2",children:[(0,Bo.jsx)(ng.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)(Ni,{activeTab:I,onTabChange:h,tabOptions:[{value:"all",label:`All (${x.length})`},{value:"human",label:`Human (${ue.length})`},{value:"digital",label:`Digital (${R.length})`}],maxWidth:"400px",gridCols:3}),I==="all"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:x.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r,className:au([K.type==="digital"&&"border-teal-400"])},`${K}-${K.id}`))}),I==="human"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:ue.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r},K.id))}),I==="digital"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:R.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r,className:au([K.type==="digital"&&"border-teal-400"])},K.id))})]}),x.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol colleagues found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:u||b!=="all"||f!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,Bo.jsxs)(y,{onClick:F,className:"gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var lh=L(require("@radix-ui/react-dialog"));var Yb=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Zb=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Qb=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),eh=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),th=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),ah=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),oh=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Tc=require("@payloadcms/richtext-lexical/lexical/list"),rh=require("@payloadcms/richtext-lexical/lexical/rich-text"),sh=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var Xb=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),qb=require("@payloadcms/richtext-lexical/lexical/utils"),ct=require("@payloadcms/richtext-lexical/lexical"),lu=require("@payloadcms/richtext-lexical/lexical/selection");var aw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),zb=aw;var ow=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),Hb=ow;var rw=()=>(0,Bo.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,Bo.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,Bo.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ob=rw;var sw=()=>(0,Bo.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,Bo.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,Bo.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),jb=sw;var iw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Ub=iw;var nw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Vb=nw;var $b=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Kb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),Gb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),_b=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),Wb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var nu=1;function lw(){return(0,Bo.jsx)("span",{className:"border border-[#222222]"})}function du(){let[e]=(0,Xb.useLexicalComposerContext)(),t=(0,Ol.useRef)(null),[a,o]=(0,Ol.useState)(!1),[r,s]=(0,Ol.useState)(!1),[n,i]=(0,Ol.useState)(!1),[l,c]=(0,Ol.useState)(!1),[d,m]=(0,Ol.useState)(!1),[u,v]=(0,Ol.useState)(!1),[b,g]=(0,Ol.useState)(!1),[f,w]=(0,Ol.useState)(!1),[I,h]=(0,Ol.useState)(!1),[S,A]=(0,Ol.useState)("left"),[C,M]=(0,Ol.useState)("p"),P=F=>{e.update(()=>{let J=(0,ct.$getSelection)();(0,ct.$isRangeSelection)(J)&&(F==="p"?(0,lu.$setBlocksType)(J,()=>(0,ct.$createParagraphNode)()):(0,lu.$setBlocksType)(J,()=>(0,rh.$createHeadingNode)(F)))})},U=(0,Ol.useCallback)(()=>{let F=(0,ct.$getSelection)();if((0,ct.$isRangeSelection)(F)){i(F.hasFormat("bold")),c(F.hasFormat("italic")),m(F.hasFormat("underline")),v(F.hasFormat("strikethrough")),g(F.hasFormat("subscript")),w(F.hasFormat("superscript"));let J=F.anchor.getNode(),De=J;for(;De&&!(0,ct.$isParagraphNode)(De)&&De!==(0,ct.$getRoot)();){let Ot=De.getParent();Ot&&(De=Ot)}if(De){let Ot=De.getFormatType();A(Ot||"left")}let St=J.getTopLevelElement()?.__tag;M(St||"p")}},[]);(0,Ol.useEffect)(()=>(0,qb.mergeRegister)(e.registerUpdateListener(({editorState:F})=>{F.read(()=>{U()})}),e.registerCommand(ct.SELECTION_CHANGE_COMMAND,(F,J)=>(U(),!1),nu),e.registerCommand(ct.CAN_UNDO_COMMAND,F=>(o(F),!1),nu),e.registerCommand(ct.CAN_REDO_COMMAND,F=>(s(F),!1),nu)),[e,U]);let $=[[{label:"Undo",icon:(0,Bo.jsx)(ng.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,Bo.jsx)(ng.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,Bo.jsx)(zb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,Bo.jsx)(Hb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:l},{label:"Underline",icon:(0,Bo.jsx)(Ob,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:d},{label:"Strikethrough",icon:(0,Bo.jsx)(jb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:u},{label:"Subscript",icon:(0,Bo.jsx)(Ub,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,Bo.jsx)(Vb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:f}]],O=[{label:"Left Align",direction:"left",icon:(0,Bo.jsx)(ng.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,Bo.jsx)(ng.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,Bo.jsx)(ng.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,Bo.jsx)(ng.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"justify")}}],ue=[{label:"Normal Text",value:"p",icon:(0,Bo.jsx)($b,{}),onClick:()=>P("p")},{label:"Heading 1",value:"h1",icon:(0,Bo.jsx)(Kb,{}),onClick:()=>P("h1")},{label:"Heading 2",value:"h2",icon:(0,Bo.jsx)(Gb,{}),onClick:()=>P("h2")},{label:"Heading 3",value:"h3",icon:(0,Bo.jsx)(_b,{}),onClick:()=>P("h3")},{label:"Heading 4",value:"h4",icon:(0,Bo.jsx)(Wb,{}),onClick:()=>P("h4")},...[{label:"Unordered List",value:"Wi",icon:(0,Bo.jsx)(ng.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Tc.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,Bo.jsx)(ng.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Tc.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],R=[{label:"Insert Image",icon:(0,Bo.jsx)(ng.ImageUp,{width:15,height:15}),onClick:()=>{h(!0)},disabled:!1}];return(0,Bo.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2",children:(0,Bo.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[$.map((F,J)=>(0,Bo.jsxs)(Ol.Fragment,{children:[(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:F.map((De,St)=>(0,Bo.jsx)("div",{role:"button","aria-disabled":De.disabled||!1,onClick:De.onClick,className:p("p-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",De.active&&"bg-[#3c3c3c]"),"aria-label":De.label,children:(0,Bo.jsx)(Eo,{children:(0,Bo.jsxs)(Fo,{children:[(0,Bo.jsx)(zo,{className:"text-[#b5b5b5]",children:De.icon}),(0,Bo.jsx)(ko,{children:(0,Bo.jsx)("p",{children:De.label})})]})})},St))}),(0,Bo.jsx)(lw,{})]},`toolbar-option-${F.length}-${J}`)),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsxs)(or,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[O.find(F=>F.direction===S)?.icon,O.find(F=>F.direction===S)?.label,(0,Bo.jsx)(ng.ChevronDown,{width:15,height:15})]}),(0,Bo.jsx)(Lo,{className:"bg-black hover:bg-black",children:O.map((F,J)=>(0,Bo.jsxs)(Qa,{onClick:F.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,Bo.jsx)("span",{children:F.icon}),(0,Bo.jsx)("span",{children:F.label})]},`${F.label}-${J}`))})]}),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsxs)(or,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[ue.find(F=>F.value===C)?.icon,ue.find(F=>F.value===C)?.label,(0,Bo.jsx)(ng.ChevronDown,{width:15,height:15})]}),(0,Bo.jsx)(Lo,{className:"bg-black hover:bg-black",children:ue.map((F,J)=>(0,Bo.jsxs)(Qa,{onClick:F.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,Bo.jsx)("span",{children:F.icon}),(0,Bo.jsx)("span",{children:F.label})]},`heading-option-${F.label}-${J}`))})]})]})})}var dw=({setValue:e,value:t,name:a,editable:o=!0})=>{let[r]=(0,Xb.useLexicalComposerContext)(),s=n=>{n.read(()=>{let i=n.toJSON();e?.(()=>i)})};return(0,Ol.useEffect)(()=>{r.setEditable(o)},[o]),(0,Ol.useEffect)(()=>{t&&r.update(()=>{r.setEditorState(r.parseEditorState(t))})},[]),(0,Bo.jsx)("div",{className:"w-full",children:(0,Bo.jsxs)("div",{className:" ",children:[o&&(0,Bo.jsx)(du,{}),(0,Bo.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,Bo.jsx)(ah.RichTextPlugin,{contentEditable:(0,Bo.jsx)(Qb.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:eh.LexicalErrorBoundary}),o&&(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(th.HistoryPlugin,{}),(0,Bo.jsx)(Yb.AutoFocusPlugin,{}),(0,Bo.jsx)(oh.ListPlugin,{}),(0,Bo.jsx)(sh.OnChangePlugin,{onChange:s})]})]})]})})},cw=({setValue:e,value:t,name:a,editable:o=!0})=>(0,Bo.jsx)(Zb.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Tc.ListNode,Tc.ListItemNode,rh.HeadingNode],onError(s){throw console.error("Lexical error:",s),s},theme:{code:"editor-code",heading:{h1:"text-4xl",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",Wi:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,Bo.jsx)(dw,{value:t,setValue:e,name:a,editable:o})}),Pc=cw;function Rc({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:r=[],knowledgeContexts:s=[]}){let[n,i]=(0,Ol.useState)({...e,updatedAt:new Date}),[l,c]=(0,Ol.useState)(!1),[d,m]=(0,Ol.useState)(n.richTextContent);(0,Ol.useEffect)(()=>{i(e)},[e]);let u=C=>{switch(C){case"markdown":case"mdx":return(0,Bo.jsx)(ng.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Bo.jsx)(ng.File,{className:"h-6 w-6 text-success"});case"text":return(0,Bo.jsx)(ng.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Bo.jsx)(ng.File,{className:"h-6 w-6 text-muted-foreground"})}},v=C=>{switch(C){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},b=()=>{let C=new Set,M=new Set;return s.forEach(P=>{P.menuConfig.groupBy.forEach(U=>C.add(U))}),r.forEach(P=>{P.metadata&&Object.keys(P.metadata).forEach(U=>M.add(U))}),{contextKeys:Array.from(C).sort(),documentKeys:Array.from(M).sort(),allKeys:Array.from(new Set([...C,...M])).sort()}},g=C=>{let M=new Set;return r.forEach(P=>{P.metadata?.[C]&&M.add(String(P.metadata[C]))}),Array.from(M).sort()},f=b(),w=()=>{t({...n,richTextContent:d})},I=(C,M)=>{i(P=>({...P,metadata:{...P.metadata,[C]:M}}))},h=(C,M)=>{M==="__custom__"?I(C,""):I(C,M)},S=()=>{I("","")},A=C=>{i(M=>{let P={...M.metadata};return delete P[C],{...M,metadata:P}})};return(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,Bo.jsxs)("div",{className:"border-b border-border bg-card p-8 Ol-6",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Bo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)(ki,{fieldName:"title",value:n.title,label:"",onSave:(C,M)=>i(P=>({...P,title:M})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,Bo.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${v(n.format)} flex-shrink-0 Bo-1`,children:n.format.toUpperCase()})]}),(0,Bo.jsx)("div",{className:"Bo-2",children:(0,Bo.jsx)(ki,{fieldName:"description",value:n.description||"Click to add description...",label:"",multiline:!0,onSave:(C,M)=>i(P=>({...P,description:M})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Bo.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>c(!l),className:"gap-2",children:[(0,Bo.jsx)(ng.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,Bo.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(n.metadata).length}),l?(0,Bo.jsx)(ng.ChevronDown,{className:"h-4 w-4"}):(0,Bo.jsx)(ng.ChevronRight,{className:"h-4 w-4"})]}),(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{size:"sm",onClick:w,className:"gap-2",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Save"]})]})]}),(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border Bo-4 h-screen max-h-full flex",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,Bo.jsx)(ng.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Bo.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:S,className:"gap-1 h-8",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add Field"]})]}),(0,Bo.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,Bo.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([C,M],P)=>{let U=g(C);return(0,Bo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Bo.jsx)(G,{value:C,onChange:$=>{let O=$.target.value||"",x=n.metadata?.[C];i(ue=>{let R={...ue.metadata};return delete R[C],O&&(R[O]=x||""),{...ue,metadata:R}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${C}`}),(0,Bo.jsx)("datalist",{id:`metadata-keys-${C}`,children:f.allKeys.map($=>(0,Bo.jsx)("option",{value:$},$))}),(0,Bo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),U.length>0?(0,Bo.jsxs)(at,{value:String(M||""),onValueChange:$=>h(C,$),children:[(0,Bo.jsx)(Ye,{className:"flex-1 h-8 text-sm",children:(0,Bo.jsx)(vt,{placeholder:"Value"})}),(0,Bo.jsxs)(Ze,{children:[U.map($=>(0,Bo.jsx)(ve,{value:$,children:$},$)),(0,Bo.jsx)(ve,{value:"__custom__",children:(0,Bo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Bo.jsx)(G,{value:String(M||""),onChange:$=>I(C,$.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>A(C),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`metadata-key-${P}`)})}):(0,Bo.jsxs)("div",{className:"text-center py-4",children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Ol metadata fields"}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})})]})})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Bo.jsx)("div",{className:"p-8 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,Bo.jsx)(Pc,{setValue:m,value:d,name:"richTextContent"}):(0,Bo.jsx)(Qe,{value:n.content||"",onChange:C=>i(M=>({...M,content:C.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var dh=L(require("react-markdown")),ch=L(require("remark-gfm"));var mh=e=>(0,Bo.jsx)(dh.default,{remarkPlugins:[ch.default],components:{h1:({children:t})=>(0,Bo.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,Bo.jsx)("h2",{className:"text-Ol font-bold",children:t}),h3:({children:t})=>(0,Bo.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,Bo.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,Bo.jsx)("ol",{className:"list-decimal",children:t}),Wi:({children:t})=>(0,Bo.jsx)("Wi",{className:"list-disc",children:t}),ng:({children:t})=>(0,Bo.jsx)("ng",{className:"ml-4",children:t}),p:({children:t})=>(0,Bo.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,Bo.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,Bo.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,Bo.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),nh=e=>(0,Bo.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),mw=e=>(0,Bo.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,Bo.jsx)(Pc,{value:JSON.stringify(e),editable:!1,name:"richTextContent"})}),pw=e=>(0,Bo.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,Bo.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4",children:(0,Bo.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,Bo.jsx)("strong",{children:"MDX Renderer:"})," This Bo a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),mh(e)]});function Ac({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:r,availableDocuments:s=[],knowledgeContexts:n=[]}){let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(!1),[m,u]=(0,Ol.useState)(e);(0,Ol.useEffect)(()=>{u(e)},[e]);let v=h=>{switch(h){case"markdown":case"mdx":return(0,Bo.jsx)($a.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Bo.jsx)($a.File,{className:"h-6 w-6 text-success"});case"text":return(0,Bo.jsx)($a.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Bo.jsx)($a.File,{className:"h-6 w-6 text-muted-foreground"})}},b=h=>{switch(h){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},g=(h,S)=>{let A={markdown:mh,mdx:pw,text:nh},C=r?.[S]||A[S];if(S==="richText"&&typeof h=="object")return mw(h);if(C&&typeof h=="string")return C(h);if(typeof h=="string")return nh(h)},f=h=>{l(!1),t?.(h),u(h)},w=()=>{l(!1)};return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(st,{open:i||o==="create",onOpenChange:h=>!h&&w(),children:(0,Bo.jsxs)(Xn,{children:[(0,Bo.jsx)(ji,{}),(0,Bo.jsx)(lh.Content,{className:p("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:(0,Bo.jsx)(Rc,{mode:o==="create"?"create":"edit",document:m,onSave:f,onCancel:w,availableDocuments:s,knowledgeContexts:n})})]})}),(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,Bo.jsxs)("div",{className:"border-b border-border bg-card p-8 Ol-6",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Bo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,Bo.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${b(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,Bo.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,Bo.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,Bo.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[(0,Bo.jsx)($a.Info,{className:"h-4 w-4"}),"Metadata",c?(0,Bo.jsx)($a.ChevronDown,{className:"h-4 w-4"}):(0,Bo.jsx)($a.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>l(!0),className:"gap-2",children:[(0,Bo.jsx)($a.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border Bo-4",children:[(0,Bo.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,Bo.jsx)($a.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Bo.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,Bo.jsx)("div",{className:"grid grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([h,S])=>(0,Bo.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Bo.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:h.replace(/([A-Bo])/g," $1").trim()}),(0,Bo.jsx)("span",{className:"text-foreground font-medium",children:String(S)})]},h))})})]})})]}),(0,Bo.jsx)("div",{className:"flex-1 ",children:(0,Bo.jsx)("div",{className:"py-4 h-full",children:(0,Bo.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,Bo.jsx)("div",{className:"relative",children:(0,Bo.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:g(m.format==="richText"?m.richTextContent:m.content,m.format)})}):(0,Bo.jsxs)("div",{className:"text-center py-12 bg-muted rounded-Ol border-2 border-dashed border-border",children:[(0,Bo.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,Bo.jsx)($a.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Bo.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Ol content available"}),(0,Bo.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function uu({label:e,documents:t,children:a,level:o,onDocumentClick:r,selectedDocumentId:s,showDocumentCount:n=!0}){let[i,l]=(0,Ol.useState)(o===0),c=a&&Object.keys(a).length>0,d=t.length+(a?Object.values(a).reduce((v,b)=>v+b.documents.length,0):0),m=v=>{switch(v){case"markdown":case"mdx":return(0,Bo.jsx)(ng.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,Bo.jsx)(ng.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,Bo.jsx)(ng.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},u=v=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[v%b.length]};return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(c||t.length>0)&&(0,Bo.jsxs)(Wi.motion.div,{className:`group flex items-center gap-3 p-3 rounded-Ol cursor-pointer transition-all duration-200 ${i?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>l(!i),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Bo.jsx)("div",{className:`w-1 h-6 rounded-full ${u(o)}`}),(0,Bo.jsx)(Wi.motion.div,{animate:{rotate:i?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,Bo.jsx)(ng.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,Bo.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,Bo.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,Bo.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),n&&d>0&&(0,Bo.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,Bo.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:d})})]})]}),(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:i?"auto":0,opacity:i?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Bo.jsxs)("div",{className:"ng-2 space-y-1",children:[t.map((v,b)=>(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${s===v.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>r?.(v),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Bo.jsx)("div",{className:"flex-shrink-0",children:m(v.format)}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("p",{className:`text-sm truncate transition-colors ${s===v.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:v.title}),v.description&&(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground truncate Bo-0.5",children:v.description})]}),v.tags&&v.tags.length>0&&(0,Bo.jsx)("div",{className:"flex-shrink-0",children:(0,Bo.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-Bo text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:v.tags[0]})})]},v.id)),a&&Object.entries(a).map(([v,b])=>(0,Bo.jsx)(uu,{label:v,documents:b.documents,children:b.children,level:o+1,onDocumentClick:r,selectedDocumentId:s,showDocumentCount:n},v))]})})]})}function Ic({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:r,selectedDocumentId:s,className:n,editable:i=!0}){let[l,c]=(0,Ol.useState)(""),[d,m]=(0,Ol.useState)(null),[u,v]=(0,Ol.useState)(e);(0,Ol.useEffect)(()=>{v(e)},[e]);let b=(0,Ol.useMemo)(()=>l?u.filter(w=>w.title.toLowerCase().includes(l.toLowerCase())||w.description?.toLowerCase().includes(l.toLowerCase())||w.tags?.some(I=>I.toLowerCase().includes(l.toLowerCase()))||Object.values(w.metadata||{}).some(I=>String(I).toLowerCase().includes(l.toLowerCase()))):u,[u,l]),g=(0,Ol.useMemo)(()=>{let w=(I,h)=>{if(h.length===0)return{};let[S,...A]=h;return I.reduce((M,P)=>{let U=P.metadata?.[S]||"Uncategorized",$=String(U);if(M[$]||(M[$]={documents:[],children:{}}),A.length===0)M[$].documents.push(P);else{let O=w([P],A),x=Object.keys(O)[0];x&&(M[$].children||(M[$].children={}),M[$].children[x]?M[$].children[x].documents.push(...O[x].documents):M[$].children[x]=O[x])}return M},{})};return w(b,t.groupBy)},[b,t.groupBy]),f=w=>{m(w),a?.(w)};return(0,Bo.jsxs)("div",{className:`flex h-full ${n||""}`,children:[(0,Bo.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,Bo.jsx)("div",{className:"p-6 border-b border-border",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,Bo.jsx)(ng.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,Bo.jsx)(G,{placeholder:"Search knowledge base...",value:l,onChange:w=>c(w.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-Ol h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,Bo.jsx)(Qt,{className:"h-[calc(100%-100px)]",children:(0,Bo.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,Bo.jsx)(Bo.Fragment,{children:(0,Bo.jsx)(uu,{label:"Document",documents:b,level:0,onDocumentClick:f,selectedDocumentId:s,showDocumentCount:t.showDocumentCount},"Document")}):(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(g).map(([w,I])=>(0,Bo.jsx)(uu,{label:w,documents:I.documents,children:I.children,level:0,onDocumentClick:f,selectedDocumentId:s,showDocumentCount:t.showDocumentCount},w)),Object.keys(g).length===0&&(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,Bo.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,Bo.jsx)(ng.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Bo.jsx)("p",{className:"text-sm font-medium",children:"Ol documents found"}),(0,Bo.jsx)("p",{className:"text-xs Bo-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,Bo.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:d?(0,Bo.jsx)(Ac,{document:d,onDocumentUpdate:r,editable:i}):(0,Bo.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,Bo.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,Bo.jsx)(ng.FileText,{className:"h-10 w-10 text-primary"})}),(0,Bo.jsx)("h3",{className:"text-Ol font-semibold text-foreground mb-2",children:"Select a document"}),(0,Bo.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var uh=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let r=()=>{let g=new Set;return o.forEach(f=>{f.menuConfig.groupBy.forEach(w=>g.add(w))}),{contextKeys:Array.from(g).sort(),allKeys:Array.from(g).sort()}},[s,n]=(0,Ol.useState)(()=>{let g=r();return{name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(f=>({key:f,value:""})):[{key:"",value:""}]}}),i=g=>{if(g.preventDefault(),!s.name)return;let f=s.metadata.filter(I=>I.key&&I.key.trim()&&I.value&&I.value.trim());a({name:s.name,description:s.description,metadata:f,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let w=r();n({name:"",description:"",metadata:w.contextKeys.length>0?w.contextKeys.map(I=>({key:I,value:""})):[{key:"",value:""}]}),t()},l=()=>{let g=r();n({name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(f=>({key:f,value:""})):[{key:"",value:""}]}),t()},c=r(),d=g=>{let f=new Set;return Array.from(f).sort()},m=(g,f)=>{n(w=>{let I=w.metadata.find(h=>h.key===g);return I&&(I.value=f),{...w,metadata:[...w.metadata.filter(h=>h.key!==g),{key:g,value:f}]}})},u=(g,f)=>{f==="__custom__"?m(g,""):m(g,f)},v=()=>{m(" ","")},b=g=>{n(f=>{let w=[...f.metadata],I=w.findIndex(h=>h.key===g);return I!==-1&&w.splice(I,1),{...f,metadata:w}})};return(0,Bo.jsx)(st,{open:e,onOpenChange:l,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Knowledge source"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,Bo.jsx)(G,{id:"name",value:s.name,onChange:g=>n(f=>({...f,name:g.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Description"}),(0,Bo.jsx)(G,{id:"name",value:s.description,onChange:g=>n(f=>({...f,description:g.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"metadata",children:"Metadata"}),c.contextKeys.length>0?(0,Bo.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",c.contextKeys.slice(0,4).join(", "),c.contextKeys.length>4&&` +${c.contextKeys.length-4} more`," \u2022 Fill in values or add more fields"]}):(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,Bo.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:v,className:"gap-1 h-8",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,Bo.jsx)("div",{className:"space-y-2",children:s.metadata.map(({key:g,value:f},w)=>{let I=d(g);return(0,Bo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Bo.jsx)(G,{value:g,onChange:h=>{let S=h.target.value||" ",A=s.metadata.find(C=>C.key===g)?.value;n(C=>{let M=[...C.metadata],P=M.findIndex(U=>U.key===g);return P!==-1&&M.splice(P,1),S&&M.push({key:S,value:A||""}),{...C,metadata:M}}),h.target.focus()},placeholder:c.allKeys.length>0?`e.g., ${c.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${g}`}),(0,Bo.jsx)("datalist",{id:`metadata-keys-${g}`,children:c.allKeys.map(h=>(0,Bo.jsx)("option",{value:h},h))}),(0,Bo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),I.length>0?(0,Bo.jsxs)(at,{value:String(f||""),onValueChange:h=>u(g,h),children:[(0,Bo.jsx)(Ye,{className:"flex-1 h-8 text-sm",children:(0,Bo.jsx)(vt,{placeholder:"Value"})}),(0,Bo.jsxs)(Ze,{children:[I.map(h=>(0,Bo.jsx)(ve,{value:h,children:h},h)),(0,Bo.jsx)(ve,{value:"__custom__",children:(0,Bo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Bo.jsx)(G,{value:String(f||""),onChange:h=>m(g,h.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(g),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`metadata-key-${w}`)})})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{type:"submit",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var gh=({isOpen:e,onClose:t,onAddTeamContext:a})=>{let[o,r]=(0,Ol.useState)({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),[s,n]=(0,Ol.useState)(""),i=m=>{m.preventDefault(),console.log("formData",o),o.label&&(a({id:o.label,label:o.label,description:o.description,menuConfig:{groupBy:o.groupBy,sortBy:o.sortBy||null,sortOrder:o.sortOrder,showDocumentCount:o.showDocumentCount}}),r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}))},l=()=>{r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),t()},c=[{value:"name",label:"Name"},{value:"createdAt",label:"Created Date"}],d=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];return(0,Bo.jsx)(st,{open:e,onOpenChange:l,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Knowledge source"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"label",children:"Label *"}),(0,Bo.jsx)(G,{id:"label",value:o.label,onChange:m=>r(u=>({...u,label:m.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(G,{id:"description",value:o.description,onChange:m=>r(u=>({...u,description:m.target.value}))})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Group By"}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:o.groupBy.map(m=>(0,Bo.jsxs)(Y,{variant:"secondary",className:"px-2 py-1",children:[m,(0,Bo.jsx)("button",{type:"button",className:"ml-1 inline-flex",onClick:()=>{r(u=>({...u,groupBy:u.groupBy.filter(v=>v!==m)}))},"aria-label":`Remove ${m}`,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},m))}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(G,{placeholder:"Type a tag and press Enter",value:s,onChange:m=>n(m.target.value),onKeyDown:m=>{(m.key==="Enter"||m.key===",")&&(m.preventDefault(),r(u=>({...u,groupBy:[...u.groupBy,s]})),n(""))}}),(0,Bo.jsx)(y,{type:"button",onClick:()=>{r(m=>({...m,groupBy:[...m.groupBy,s]})),n("")},children:"Add"})]})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"sortBy",children:"Sort By"}),(0,Bo.jsxs)(at,{value:o.sortBy,onValueChange:m=>r(u=>({...u,sortBy:m})),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select sort field"})}),(0,Bo.jsx)(Ze,{children:c.map(m=>(0,Bo.jsx)(ve,{value:m.value,children:m.label},m.value))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"sortOrder",children:"Sort Order"}),(0,Bo.jsxs)(at,{value:o.sortOrder,onValueChange:m=>r(u=>({...u,sortOrder:m})),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select sort order"})}),(0,Bo.jsx)(Ze,{children:d.map(m=>(0,Bo.jsx)(ve,{value:m.value,children:m.label},m.value))})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(Ha,{id:"showDocumentCount",checked:o.showDocumentCount,onCheckedChange:m=>r(u=>({...u,showDocumentCount:m}))}),(0,Bo.jsx)(T,{htmlFor:"showDocumentCount",className:"text-sm",children:"Show Document Count"})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{type:"submit",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};function Pl({documents:e=[],contexts:t=[],onDocumentClick:a=c=>console.log("Document clicked:",c),onDocumentShare:o=c=>console.log("Share document:",c),onLoadDocumentContent:r,selectedDocumentId:s,onAddKnowledge:n,onAddTeamContext:i,onDocumentUpdate:l}){let[c,d]=(0,Ol.useState)(t[0]),[m,u]=(0,Ol.useState)(!1),[v,b]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{!c&&t&&t.length>0&&d(t[0])},[t]);let g=w=>{n&&n(w),u(!1)},f=w=>{i&&i(w),b(!1)};return(0,Bo.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 flex-shrink-0",children:t&&t.length>0&&(0,Bo.jsxs)("div",{className:"Bo-6",children:[(0,Bo.jsx)("div",{className:"",children:(0,Bo.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,Bo.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(w=>(0,Bo.jsxs)("button",{onClick:()=>d(w),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${c?.id===w.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[w.icon,w.label]},w.id))}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Bo.jsx)("button",{onClick:()=>u(!0),className:"inline-flex border border-primary rounded-Ol items-center py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:"Add Knowledge"}),(0,Bo.jsx)("button",{onClick:()=>b(!0),className:"inline-flex border border-primary rounded-Ol items-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:"Add Context"})]})]})}),c?.description&&(0,Bo.jsx)("div",{className:"Bo-3 px-1",children:(0,Bo.jsx)("p",{className:"text-sm text-primary",children:c?.description})})]})}),c?(0,Bo.jsx)("div",{className:"flex-1 min-h-0 px-2 Bo:px-4 Ol-4",children:(0,Bo.jsx)("div",{className:"h-full rounded-Ol border overflow-hidden",children:(0,Bo.jsx)(Ic,{documents:e,menuConfig:c?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:s,onDocumentUpdate:l})})}):(0,Bo.jsx)("div",{className:"flex-1 min-h-0 px-2 Bo:px-4 Ol-4 flex items-center justify-center",children:(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Ol contexts available"})}),(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(gh,{isOpen:v,onClose:()=>b(!1),onAddTeamContext:f}),(0,Bo.jsx)(uh,{isOpen:m,onClose:()=>u(!1),onAddKnowledge:g,knowledgeContexts:t})]})]})}function vu({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:r,onCreateProject:s,onOpenProject:n,sidebarItems:i,initialColleagues:l,users:c,onColleagueAdd:d,onColleagueEdit:m,onColleagueDelete:u}){let[v,b]=(0,Ol.useState)("home"),[g,f]=(0,Ol.useState)(t[0]),w=x=>{console.log("Opening app:",x.name)},I=x=>{console.log("Favoriting app:",x.name)},h=x=>{console.log("Opening file:",x.name)},S=x=>{console.log("Sharing file:",x.name)},A=x=>{console.log("Opening project:",x.name),n(x)},C=x=>{console.log("Sharing project:",x.name)},M=x=>{f(x),console.log("Business unit changed to:",x.name)},P=()=>{console.log("Copilot clicked - navigating to chat"),b("chat")},U=x=>{console.log("Notification removed:",x)},$=()=>{console.log("All notifications removed")},O=()=>{switch(v){case"home":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsxs)("section",{className:"text-center py-12",children:[(0,Bo.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",g.name," team"]}),(0,Bo.jsx)("p",{className:"text-Ol text-muted-foreground mb-8",children:"This Bo your collaborative workspace for productivity and knowledge sharing."})]}),(0,Bo.jsxs)("section",{className:"grid grid-cols-1 Bo:grid-cols-3 gap-6",children:[(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:r}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,Bo.jsx)(Wt,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Bo",onClick:()=>b("chat")}})]});case"colleagues":return(0,Bo.jsx)(kl,{initialColleagues:l,availableUsers:c,onColleagueAdd:d,onColleagueEdit:m,onColleagueDelete:u});case"chat":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsxs)("section",{className:"text-center py-12",children:[(0,Bo.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,Bo.jsxs)("p",{className:"text-Ol text-muted-foreground mb-8",children:["Connect with your ",g.name," team members and collaborate in real-time."]})]}),(0,Bo.jsx)(Wt,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,Bo.jsxs)("div",{className:"space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4",children:eu.filter(x=>x.new).map(x=>(0,Bo.jsx)(Qp,{app:x,showProgress:!0,onOpen:w,onFavorite:I},x.name))})]}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4",children:eu.map(x=>(0,Bo.jsx)(Qp,{app:x,onOpen:w,onFavorite:I},x.name))})]})]});case"knowledge":return(0,Bo.jsx)(Pl,{});case"files":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"flex items-center justify-between",children:(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,Bo.jsx)(un,{files:Ab,onFileClick:h})]})]});case"projects":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:s}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 Bo:grid-cols-2 lg:grid-cols-3",children:a.map(x=>(0,Bo.jsx)(fn,{project:x,onOpen:A,onShare:C},x.name))})]})]});case"learn":return(0,Bo.jsxs)("div",{className:"space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-6 Bo:grid-cols-2 lg:grid-cols-3",children:Ib.slice(0,3).map(x=>(0,Bo.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,Bo.jsx)("h3",{className:"font-semibold mb-2",children:x.title}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x.description}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:x.duration}),(0,Bo.jsx)("span",{children:x.level})]})]},x.title))})]})]});default:return null}};return(0,Bo.jsx)(pc,{sidebarItems:Bb,title:e,notifications:Lb,businessUnits:t,currentBusinessUnit:g,onBusinessUnitChange:M,activeTab:v,onTabChange:b,showTabs:!0,onActionClick:P,actionIcon:(0,Bo.jsx)(ng.Bot,{className:"Bo-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:U,onRemoveAll:$,children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:O()},v)})})}var vh=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,r]=(0,Ol.useState)(null),[s,n]=(0,Ol.useState)(""),[i,l]=(0,Ol.useState)(""),[c,d]=(0,Ol.useState)(""),m=v=>{let b=v.target.files?.[0];b&&(r(b),s||n(b.name))},u=async v=>{if(v.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",s),i&&b.append("description",i),c&&b.append("tags",c),a?.(b),t(),r(null),n(""),l(""),d("")};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New File"})}),(0,Bo.jsxs)("form",{onSubmit:u,className:"grid gap-4",children:[(0,Bo.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,Bo.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,Bo.jsxs)("div",{className:"flex flex-col items-center justify-center ng-5 Ol-6",children:[(0,Bo.jsx)(uw,{className:"w-10 h-10 text-gray-400"}),(0,Bo.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,Bo.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,Bo.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,Bo.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:m})]})}),o&&(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"font-medium",children:o.name}),(0,Bo.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,Bo.jsx)(y,{type:"submit",onClick:u,children:"Upload"})]})]})]})})};function uw(e){return(0,Bo.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Bo.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,Bo.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,Bo.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function Al({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:r,compactView:s=!1,className:n}){let[i,l]=(0,Ol.useState)(e),[c,d]=(0,Ol.useState)(""),[m,u]=(0,Ol.useState)("all"),[v,b]=(0,Ol.useState)("all"),[g,f]=(0,Ol.useState)(!1),w=(0,Ol.useRef)(""),I=O=>O.map(x=>`${x.id}-${new Date(x.createdAt).getTime()}-${new Date(x.updatedAt).getTime()}`).join("-");(0,Ol.useEffect)(()=>{let O=I(e);O!==w.current&&(l(e),w.current=O)},[e]);let h=i.filter(O=>O.name.toLowerCase().includes(c.toLowerCase())),S=h.slice(0,10),A=h.filter(Boolean),C=()=>{f(!0)},M=O=>{a?.(O)},P=O=>{console.log("deleting file",O),l(x=>x.filter(ue=>ue.name!==O.name)),o?.(O.id.toString())},U=O=>{r?.(O)},$=()=>{d(""),u("all")};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Bo.jsx)(Wt,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:C},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search files...",value:c,onChange:O=>d(O.target.value),className:"pl-9"})]})}),(c||m!=="all")&&(0,Bo.jsxs)(y,{variant:"outline",onClick:$,className:"gap-2",children:[(0,Bo.jsx)(ng.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)(Ni,{activeTab:v,onTabChange:b,tabOptions:[{value:"all",label:`All Files (${h.length})`},{value:"recent",label:`Recent (${S.length})`}],maxWidth:"500px",gridCols:3}),v==="all"&&(0,Bo.jsx)(un,{files:h,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s}),v==="recent"&&(0,Bo.jsx)(un,{files:S,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s}),v==="shared"&&(0,Bo.jsx)(un,{files:A,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s})]}),h.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol files found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:c||m!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,Bo.jsxs)(y,{onClick:C,className:"gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,Bo.jsx)(vh,{isOpen:g,onClose:()=>f(!1),onAddFile:t})]})}var gw=[{key:"kanban",icon:ng.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:ng.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:ng.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:ng.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:ng.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],bh=({currentView:e,onViewChange:t,children:a})=>(0,Bo.jsxs)("div",{className:"flex w-full h-screen",children:[(0,Bo.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:gw.map(o=>{let r=o.icon,s=e===o.key;return(0,Bo.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${s?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden Bo:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Bo.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,Bo.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Bo.jsx)("div",{className:"flex-1 min-w-0 px-4 Bo:px-6 h-full overflow-auto",children:(0,Bo.jsx)("div",{className:"w-full h-full",children:a})})]});var Mt=L(require("react"));var hh=({title:e,status:t,taskCount:a,children:o,onDrop:r,isCompact:s=!1,height:n})=>{let i=d=>{d.preventDefault()},l=d=>{d.preventDefault(),r(t)};return(0,Bo.jsxs)(H,{className:`p-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col ${s?"lg:max-w-xs":""}`,style:{height:n||"calc(100vh - 350px)"},onDragOver:i,onDrop:l,children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${s?"text-base":"text-lg"}`,children:e}),(0,Bo.jsx)(Y,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:o})]})};var Il=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:r=!1})=>{let s=d=>{a(e)},n=()=>{o(e)},i=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},l=()=>{switch(e.type){case"story":return(0,Bo.jsx)(ng.BookOpen,{className:"h-3 w-3"});case"bug":return(0,Bo.jsx)(ng.Bug,{className:"h-3 w-3"});case"spike":return(0,Bo.jsx)(ng.Zap,{className:"h-3 w-3"});case"task":default:return(0,Bo.jsx)(ng.AlertCircle,{className:"h-3 w-3"})}},c=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return r?(0,Bo.jsx)(H,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:s,onClick:n,children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${c()}`,children:l()}),(0,Bo.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,Bo.jsxs)(H,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-Bo",draggable:!0,onDragStart:s,onClick:n,children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${c()}`,children:[l(),(0,Bo.jsx)("span",{className:"capitalize",children:e.type})]}),(0,Bo.jsxs)("div",{className:"flex gap-1",children:[(0,Bo.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${i()}`,children:e.priority}),(0,Bo.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,Bo.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:e.assignee?.value?.name})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var fw=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:ng.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:ng.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:ng.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:ng.Zap}],vw=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],wn=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:r,assignees:s,defaultEpicId:n})=>{let[i,l]=(0,Ol.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,Ol.useEffect)(()=>{e&&n&&l(m=>({...m,epic:n}))},[e,n]),(0,Ol.useEffect)(()=>{e&&l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"none",assignee:""})},[e]);let c=m=>{m.preventDefault(),i.name.trim()&&(a({name:i.name.trim(),description:i.description.trim(),status:"todo",priority:i.priority,type:i.type,storyPoints:i.storyPoints,epic:Number(i.epic),sprint:Number(i.sprint),assignee:i.assignee.trim()?{relationTo:"digital-colleagues",value:Number(i.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"",assignee:""}),t())},d=(m,u)=>{l(v=>({...v,[m]:u}))};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Task"})}),(0,Bo.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Task Title"}),(0,Bo.jsx)(G,{id:"name",value:i.name,onChange:m=>d("name",m.target.value),placeholder:"Enter task title",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:i.description,onChange:m=>d("description",m.target.value),placeholder:"Enter task description",rows:3})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Type"}),(0,Bo.jsx)(qr,{type:"single",value:i.type||"",onValueChange:m=>m&&d("type",m),children:fw.map(m=>{let u=m.icon;return(0,Bo.jsxs)(Jr,{value:m.value,className:"flex items-center gap-2 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",children:[(0,Bo.jsx)(u,{className:"h-4 w-4"}),m.label]},m.value)})})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Priority"}),(0,Bo.jsx)(qr,{type:"single",value:i.priority||"",onValueChange:m=>m&&d("priority",m),children:vw.map(m=>(0,Bo.jsx)(Jr,{value:m.value,className:"data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",children:m.label},m.value))})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"points",children:"Story Points"}),(0,Bo.jsx)(G,{id:"points",type:"number",min:"1",max:"100",value:i.storyPoints,onChange:m=>d("storyPoints",parseInt(m.target.value)||1),placeholder:"Enter story points",required:!0})]}),!n&&(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"epic",children:"Epic"}),(0,Bo.jsxs)(at,{value:i.epic,onValueChange:m=>d("epic",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select Ol epic"})}),(0,Bo.jsx)(Ze,{children:o.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${m.color}`}),m.name]})},m.id))})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,Bo.jsxs)(at,{value:i.sprint,onValueChange:m=>d("sprint",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select a sprint"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"none",children:"Ol Sprint"}),r.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"sprint",children:"Assignee"}),(0,Bo.jsxs)(at,{value:i.assignee,onValueChange:m=>d("assignee",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select Ol Assignee"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"none",children:"Ol Assignee"}),s.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Bo.jsxs)(ii,{children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var Lc=({label:e,value:t,onValueChange:a,options:o,showColor:r=!1,disabled:s=!1})=>{let[n,i]=(0,Ol.useState)(!1),l=o.find(d=>d.value===t);return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,Bo.jsxs)(at,{value:t,onValueChange:a,open:n,onOpenChange:d=>{s||i(d)},disabled:s,children:[(0,Bo.jsx)(Ye,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-Bo",children:(0,Bo.jsxs)(Y,{variant:"secondary",className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!s&&i(!n),children:[r&&l?.color&&(0,Bo.jsx)("div",{className:`w-2 h-2 rounded-full ${l.color} Bo-1`}),l?.label||"Select..."]})}),(0,Bo.jsx)(Ze,{children:o.map(d=>(0,Bo.jsx)(ve,{value:d.value,children:r&&d.color?(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.label]}):d.label},d.value))})]})]})};var ga=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var bw=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:ng.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:ng.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:ng.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:ng.Zap}],hw=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var xh=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:r,onClose:s,onDelete:n,isUpdating:i=!1,isDeleting:l=!1,deleteState:c="idle",teamMembers:d})=>{let[m,u]=(0,Ol.useState)(e.storyPoints),v=(0,Ol.useRef)(null),[b,g]=(0,Ol.useState)(d);(0,Ol.useEffect)(()=>{g(d)},[d]);let f=(0,Ol.useCallback)((h,S)=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{r(h,S)},500)},[r]);(0,Ol.useEffect)(()=>{f("storyPoints",m?.toString()||"1")},[m]);let w=h=>h.split(" ").map(S=>S[0]).join("").toUpperCase(),I=()=>c==="loading"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):c==="success"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.Check,{className:"h-3 w-3"}),"Deleted"]}):c==="error"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,Bo.jsxs)(y,{onClick:n,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:i||l,children:[(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,Bo.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Bo.jsxs)("div",{className:"space-y-4",style:{opacity:i?.6:1},children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Status"}),(0,Bo.jsx)(Lc,{label:"",value:e.status,onValueChange:h=>r("status",h),options:[{value:"todo",label:"ng Bo"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Type"}),(0,Bo.jsx)(qr,{type:"single",value:e.type||"",onValueChange:h=>h&&r("type",h),className:"grid grid-cols-2 gap-1",disabled:i,children:bw.map(h=>{let S=h.icon;return(0,Bo.jsxs)(Jr,{value:h.value,className:"flex items-center gap-1 text-xs h-8 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",size:"sm",disabled:i,children:[(0,Bo.jsx)(S,{className:"h-3 w-3"}),h.label]},h.value)})})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,Bo.jsx)(qr,{type:"single",value:e.priority||"",onValueChange:h=>h&&r("priority",h),className:"grid grid-cols-3 gap-1",disabled:i,children:hw.map(h=>(0,Bo.jsx)(Jr,{value:h.value,className:"text-xs h-8 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",size:"sm",disabled:i,children:h.label},h.value))})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,Bo.jsx)("input",{type:"number",min:"1",max:"100",value:m||1,onChange:h=>{let S=Number(h.target.value);S<1?u(1):S>100?u(100):u(S)},className:"w-full h-8 px-2 text-xs border border-border rounded-Bo focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,Bo.jsx)(Lc,{label:"",value:ga(e.epic).toString(),onValueChange:h=>r("epic",h),options:(t||[]).map(h=>({value:h.id.toString(),label:h?.name,color:h.color})),showColor:!0,disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,Bo.jsx)(Lc,{label:"",value:ga(e.sprint).toString()||"none",onValueChange:h=>r("sprint",h==="none"?"":h),options:[{value:"none",label:"Ol Sprint"},...(a||[]).map(h=>({value:h.id.toString(),label:`${h?.name}`}))],disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,Bo.jsx)(uc,{label:"",value:e.assignee?.value?.name,onValueChange:h=>r("assignee",h),options:b.map(h=>({value:`${typeof h.email=="string"?"users":"digital-colleagues"}:${h.id}`,label:h?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:i})]})]}),(0,Bo.jsxs)("div",{className:"Bo-auto ng-4 space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(y,{onClick:s,variant:"outline",className:"w-full h-8 text-xs",disabled:i||l,children:"Close"}),I()]}),(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border space-y-2",children:[(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:"System"})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Clock,{className:"h-3 w-3"}),(0,Bo.jsxs)("span",{children:[new Date(o).toLocaleDateString()," at"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var wh=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:r,onUpdateTask:s,onDeleteTask:n,onAddComment:i,colleagues:l})=>{let[c,d]=(0,Ol.useState)(a),[m,u]=(0,Ol.useState)(new Date),[v,b]=(0,Ol.useState)("idle"),[g,f]=(0,Ol.useState)("idle"),[w,I]=(0,Ol.useState)([]),[h,S]=(0,Ol.useState)(l);(0,Ol.useEffect)(()=>{d(a)},[a]);let A=async(x,ue)=>{if(ue!==c[x]){b("loading");try{await s(c.id.toString(),{[x]:ue}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(R){console.log("error",R),b("error"),setTimeout(()=>b("idle"),3e3)}}},C=async(x,ue)=>{if(ue!==c[x]){b("loading");try{await s(c.id.toString(),{[x]:ue}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(R){console.log("error",R),b("error"),setTimeout(()=>b("idle"),3e3)}}},M=async x=>{if(i){b("loading");try{await i?.({content:x,taskId:c.id.toString()}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch{b("error"),setTimeout(()=>b("idle"),3e3)}}},P=async()=>{f("loading");try{await n(c.id.toString()),f("success"),setTimeout(()=>{t(),f("idle")},1e3)}catch{f("error"),setTimeout(()=>f("idle"),3e3)}},U=v!=="loading"&&g!=="loading",$=()=>{U&&t()},O=()=>v==="loading"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Bo.jsx)(ng.Loader2,{className:"h-4 w-4 animate-spin"}),(0,Bo.jsx)("span",{children:"Updating..."})]}):v==="success"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,Bo.jsx)(ng.Check,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Updated successfully"})]}):v==="error"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Update failed"})]}):null;return(0,Bo.jsx)(st,{open:e,onOpenChange:$,children:(0,Bo.jsxs)(lt,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[(0,Bo.jsxs)(gt,{children:[(0,Bo.jsx)(ft,{className:"sr-only",children:c?.name}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("div",{className:"flex-1",children:O()}),!U&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,Bo.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,Bo.jsx)(ki,{fieldName:"name",value:c.name||"",label:"",onSave:A,className:"border-b border-border Ol-3",disabled:v==="loading"}),(0,Bo.jsx)(ki,{fieldName:"description",value:c.description||"",label:"Description",multiline:!0,onSave:A,disabled:v==="loading"}),(0,Bo.jsx)(_p,{comments:(c?.comments||[]).map(x=>({author:x.author.value.name||"",createdAt:new Date(x.timestamp),text:x.text,id:x.id||""})),onAddComment:M})]}),(0,Bo.jsx)(xh,{task:c,epics:o,sprints:r,lastUpdated:m,onUpdateTask:C,onClose:$,onDelete:P,isUpdating:v==="loading",isDeleting:g==="loading",deleteState:g,teamMembers:h})]})]})})};var Cn=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,r]=(0,Ol.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),s=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],n=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],i=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],l=d=>{d.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},c=(d,m)=>{r(u=>({...u,[d]:m}))};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Epic"})}),(0,Bo.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Epic Name"}),(0,Bo.jsx)(G,{id:"name",value:o.name,onChange:d=>c("name",d.target.value),placeholder:"Enter epic name",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:o.description,onChange:d=>c("description",d.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Color"}),(0,Bo.jsx)("div",{className:"flex gap-2 flex-wrap",children:s.map(d=>(0,Bo.jsx)("button",{type:"button",onClick:()=>c("color",d),className:`w-8 h-8 rounded-full ${d} ${o.color===d?"ring-2 ring-gray-400":""}`},d))})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Confidence"}),(0,Bo.jsxs)(at,{value:o.confidence,onValueChange:d=>c("confidence",d),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsx)(Ze,{children:n.map(d=>(0,Bo.jsx)(ve,{value:d.value,children:d.label},d.value))})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Phase"}),(0,Bo.jsxs)(at,{value:o.phase.toString(),onValueChange:d=>c("phase",parseInt(d)),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsx)(Ze,{children:i.map(d=>(0,Bo.jsx)(ve,{value:d.value.toString(),children:d.label},d.value))})]})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Start Date"}),(0,Bo.jsx)(G,{type:"date",value:o.startDate,onChange:d=>c("startDate",d.target.value)})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"End Date"}),(0,Bo.jsx)(G,{type:"date",value:o.endDate,onChange:d=>c("endDate",d.target.value)})]})]}),(0,Bo.jsxs)(ii,{children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var bu=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:r=[],initialProjects:s=[],onAddTask:n,onUpdateTask:i,onDeleteTask:l,onTaskClick:c,onAddEpic:d,onAddComment:m})=>{let[u,v]=(0,Mt.useState)([]),[b,g]=(0,Mt.useState)([]),[f,w]=(0,Mt.useState)([]),[I,h]=(0,Mt.useState)(!1),[S,A]=(0,Mt.useState)(!1),[C,M]=(0,Mt.useState)(null),[P,U]=(0,Mt.useState)(null),[$,O]=(0,Mt.useState)([]),[x,ue]=(0,Mt.useState)([]),[R,F]=(0,Mt.useState)(0),J=(0,Mt.useRef)(null),De=(0,Mt.useRef)(null),St=Mt.default.useMemo(()=>[...b.map(X=>X.id),0],[b]),Ot=(0,Mt.useRef)(""),ae=(0,Mt.useRef)(""),E=(0,Mt.useRef)(""),ke=(0,Mt.useRef)(""),tt=X=>X.map(D=>`${D.id}-${new Date(D.createdAt).getTime()}-${new Date(D.updatedAt).getTime()}`).join("-");(0,Mt.useEffect)(()=>{let X=tt(e);X!==Ot.current&&(v(e),C&&M(e.find(D=>D.id===C.id)||null),Ot.current=X)},[e]),(0,Mt.useEffect)(()=>{let X=tt(t);X!==ae.current&&(g(t),ae.current=X)},[t]),(0,Mt.useEffect)(()=>{let X=tt(a);X!==E.current&&(w(a),E.current=X)},[a]),(0,Mt.useEffect)(()=>{let X=tt(r.map(D=>({id:D.id,updatedAt:D.updatedAt,createdAt:D.createdAt})));X!==ke.current&&(ue(r),ke.current=X)},[r]),(0,Mt.useEffect)(()=>{let X=()=>{if(J.current){let he=J.current.offsetHeight;F(he)}};X();let D=new ResizeObserver(X);J.current&&D.observe(J.current);let z=()=>{setTimeout(X,100)};return window.addEventListener("storage",z),()=>{D.disconnect(),window.removeEventListener("storage",z)}},[]),(0,Mt.useEffect)(()=>{let X=setTimeout(()=>{J.current&&F(J.current.offsetHeight)},300);return()=>clearTimeout(X)},[I,S]);let Za=u.filter(X=>!0),it=X=>Za.filter(D=>D.status===X),ra=X=>{let D={};return b.forEach(z=>{D[z.id]=X.filter(he=>ga(he.epic)===z.id)}),D["Bo-epic"]=X.filter(z=>!ga(z.epic)),D},K=X=>{U(X)},jt=X=>{P&&(v(D=>D.map(z=>z.id===P.id?{...z,status:X}:z)),i?.(P.id.toString(),{status:X}),U(null))},uo=X=>{let D={...X,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(z=>[...z,D]),n?.(X)},go=async(X,D)=>{v(z=>z.map(he=>he.id===Number(X)?{...he,...D}:he)),i&&await i(X,D),C?.id===Number(X)&&M(z=>({...z,...D}))},Mo=async X=>{v(D=>D.filter(z=>z.id!==Number(X))),C?.id===Number(X)&&M(null),l&&await l(X)},xs=X=>{let D={...X,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};g(z=>[...z,D]),d?.(X)},Nr=X=>{M(X),c?.(X)},ws=[{id:"todo",title:"ng Bo",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Ns=R>0?`calc(100vh - ${R+120}px)`:"calc(100vh - 12rem)";return(0,Bo.jsxs)("div",{ref:De,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:J,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>h(!0)},secondaryAction:{label:"Add epic",onClick:()=>A(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsx)("div",{className:"h-full",style:{height:R>0?`calc(100vh - ${R+120}px)`:"calc(100vh - 12rem)"},children:(0,Bo.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:ws.map(X=>{let D=it(X.status),z=ra(D);return(0,Bo.jsxs)(hh,{title:X.title,status:X.status,taskCount:D.length,onDrop:jt,isCompact:X.status==="done",height:Ns,children:[z["Bo-epic"].map(he=>(0,Bo.jsx)(Il,{epic:null,task:he,onDragStart:K,onTaskClick:Nr,isCompact:X.status==="done"},he.id)),St.map(he=>{let rt=b.find(_e=>_e.id===he),xe=z[he]||[];return xe.length===0?null:(0,Bo.jsxs)("div",{className:"mb-6",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${rt?.color}`}),(0,Bo.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:rt?.name||"Ol Epic"}),(0,Bo.jsx)(Y,{variant:"secondary",className:"text-xs",children:xe.length})]})," ",(0,Bo.jsx)("div",{className:"space-y-3",children:xe.map(_e=>(0,Bo.jsx)(Il,{task:_e,epic:rt,onDragStart:K,onTaskClick:Nr,isCompact:X.status==="done"},_e.id))})]},he)})]},X.id)})})})}),(0,Bo.jsx)(wn,{isOpen:I,onClose:()=>h(!1),onAddTask:uo,assignees:[...x,...$],epics:b,sprints:f}),(0,Bo.jsx)(Cn,{isOpen:S,onClose:()=>A(!1),onAddEpic:xs}),C&&(0,Bo.jsx)(wh,{isOpen:!!C,onClose:()=>M(null),initialTask:C,epics:b,sprints:f,onUpdateTask:go,onDeleteTask:Mo,colleagues:x,onAddComment:m})]})};var hu=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddTaskToEpic:s,onAddEpic:n,onUpdateEpic:i,onDeleteEpic:l})=>{let[c,d]=(0,Ol.useState)(t),[m,u]=(0,Ol.useState)(null),[v,b]=(0,Ol.useState)(null),[g,f]=(0,Ol.useState)({}),[w,I]=(0,Ol.useState)(0),[h,S]=(0,Ol.useState)(!1),[A,C]=(0,Ol.useState)(!1),[M,P]=(0,Ol.useState)(null),U=(0,Ol.useRef)(null),$=(0,Ol.useRef)(null);(0,Ol.useEffect)(()=>{d(t)},[t]),(0,Ol.useEffect)(()=>{let E=()=>{if(U.current){let Za=U.current.offsetHeight;I(Za)}};E();let ke=new ResizeObserver(E);U.current&&ke.observe(U.current);let tt=()=>{setTimeout(E,100)};return window.addEventListener("storage",tt),()=>{ke.disconnect(),window.removeEventListener("storage",tt)}},[]),(0,Ol.useEffect)(()=>{let E=setTimeout(()=>{U.current&&I(U.current.offsetHeight)},300);return()=>clearTimeout(E)},[v]);let O=E=>{u(E)},x=E=>{E.preventDefault()},ue=(E,ke)=>{E.preventDefault(),m&&ga(m.epic).toString()!==ke&&(o(m.id.toString(),{epic:Number(ke)}),u(null))},R=E=>e.filter(ke=>ga(ke.epic).toString()===E),F=E=>{b(E.id.toString()),f({name:E.name,description:E.description,confidence:E.confidence,phase:E.phase})},J=async()=>{v&&g.name&&(await i(v.toString(),g),d(E=>E.map(ke=>ke.id.toString()===v?{...ke,...g}:ke)),b(null),f({}))},De=()=>{b(null),f({})},St=async E=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await l(E),d(ke=>ke.filter(tt=>tt.id.toString()!==E)))},Ot=E=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[E]||`Phase ${E}`,ae=E=>{switch(E){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{ref:$,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:U,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>S(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsx)("div",{className:"h-full overflow-y-auto",style:{height:w>0?`calc(100vh - ${w+120}px)`:"calc(100vh - 12rem)"},children:(0,Bo.jsx)("div",{className:"grid grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3 Ol:grid-cols-4 gap-6 auto-rows-max",children:c.map(E=>{let ke=R(E.id.toString()),tt=ke.reduce((it,ra)=>it+(ra.storyPoints||0),0),Za=w>0?`calc(100vh - ${w+200}px)`:"calc(100vh - 14rem)";return(0,Bo.jsxs)(H,{className:`flex flex-col ${v===E.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:v===E.id.toString()?"auto":Za,minHeight:"400px"},onDragOver:x,onDrop:it=>ue(it,E.id.toString()),children:[(0,Bo.jsx)("div",{className:"p-4 border-b border-border",children:v===E.id.toString()?(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)(G,{value:g.name||"",onChange:it=>f({...g,name:it.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,Bo.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:J,className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.Check,{className:"h-4 w-4"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:De,className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]})]}),(0,Bo.jsx)(Qe,{value:g.description||"",onChange:it=>f({...g,description:it.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,Bo.jsxs)("select",{value:g.confidence||E.confidence,onChange:it=>f({...g,confidence:it.target.value}),className:"flex h-8 w-full rounded-Bo border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,Bo.jsx)("option",{value:"low",children:"Low"}),(0,Bo.jsx)("option",{value:"medium",children:"Medium"}),(0,Bo.jsx)("option",{value:"high",children:"High"})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,Bo.jsx)("select",{value:g.phase?.toString()||E.phase.toString(),onChange:it=>f({...g,phase:parseInt(it.target.value)}),className:"flex h-8 w-full rounded-Bo border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[1,2,3,4,5,6,7,8,9].map(it=>(0,Bo.jsxs)("option",{value:it.toString(),children:["Phase ",it]},it))})]})]})]}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Bo.jsx)("div",{className:`w-4 h-4 rounded-full ${E.color}`}),(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:E.name}),(0,Bo.jsxs)("div",{className:"flex gap-1",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>F(E),className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>St(E.id.toString()),className:"p-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,Bo.jsxs)(Y,{className:`text-xs ${ae(E.confidence)}`,children:[E.confidence," confidence"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["Phase ",E.phase]}),(0,Bo.jsxs)(Y,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[ke.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[tt," pts"]})]}),E.description&&(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:E.description}),(0,Bo.jsxs)(y,{onClick:()=>{C(!0),P(E)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,Bo.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,Bo.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded p-3 transition-colors ${m?"border-primary bg-primary/10":"border-border"}`,children:ke.length===0?(0,Bo.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,Bo.jsx)(ng.Move,{className:"h-8 w-8 mb-2"}),(0,Bo.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):ke.map(it=>(0,Bo.jsx)(Il,{task:it,epic:E,onDragStart:O,onTaskClick:r,isCompact:!0},it.id))})})]},E.id)})})})})]}),(0,Bo.jsx)(Cn,{isOpen:h,onClose:()=>S(!1),onAddEpic:n}),(0,Bo.jsx)(wn,{isOpen:A,onClose:()=>C(!1),onAddTask:s,assignees:[],epics:[],defaultEpicId:M?.id.toString()||"",sprints:a})]})};var kh=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,r]=(0,Ol.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),s=i=>{i.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},n=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,Bo.jsx)(st,{open:e,onOpenChange:n,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Sprint"})}),(0,Bo.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Sprint Name *"}),(0,Bo.jsx)(G,{id:"name",value:o.name,onChange:i=>r(l=>({...l,name:i.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:o.description,onChange:i=>r(l=>({...l,description:i.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Start Date *"}),(0,Bo.jsxs)(Rs,{children:[(0,Bo.jsx)(As,{asChild:!0,children:(0,Bo.jsxs)(y,{variant:"outline",className:p("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,Bo.jsx)(ng.CalendarIcon,{className:"Bo-2 h-4 w-4"}),o.startDate?(0,xp.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,Bo.jsx)(Yr,{className:"w-auto p-0",align:"start",children:(0,Bo.jsx)(Bs,{mode:"single",selected:o.startDate,onSelect:i=>r(l=>({...l,startDate:i})),initialFocus:!0})})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"End Date *"}),(0,Bo.jsxs)(Rs,{children:[(0,Bo.jsx)(As,{asChild:!0,children:(0,Bo.jsxs)(y,{variant:"outline",className:p("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,Bo.jsx)(ng.CalendarIcon,{className:"Bo-2 h-4 w-4"}),o.endDate?(0,xp.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,Bo.jsx)(Yr,{className:"w-auto p-0",align:"start",children:(0,Bo.jsx)(Bs,{mode:"single",selected:o.endDate,onSelect:i=>r(l=>({...l,endDate:i})),initialFocus:!0,disabled:i=>o.startDate?i<o.startDate:!1})})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Ec=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddSprint:s,onUpdateSprint:n,onDeleteSprint:i})=>{let[l,c]=(0,Ol.useState)([]),[d,m]=(0,Ol.useState)(new Set),[u,v]=(0,Ol.useState)(null),[b,g]=(0,Ol.useState)(!1),[f,w]=(0,Ol.useState)(null),[I,h]=(0,Ol.useState)(null),[S,A]=(0,Ol.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[C,M]=(0,Ol.useState)([]),[P,U]=(0,Ol.useState)("upcoming"),[$,O]=(0,Ol.useState)(!1),[x,ue]=(0,Ol.useState)(0),R=(0,Ol.useRef)(null),F=(0,Ol.useRef)(null);(0,Ol.useEffect)(()=>{let D=()=>{R.current&&ue(R.current.offsetHeight)};D();let z=new ResizeObserver(D);return R.current&&z.observe(R.current),()=>z.disconnect()},[]);let J=D=>t.find(z=>z.id===Number(D)),De=D=>a.find(z=>z.id===Number(D)),St=D=>{let z={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return z[D]||z.medium},Ot=D=>{if(!D||D?.length===0)return"";let z=D?.trim().split(" ");if(z?.length===1)return z[0];let he=z[0],rt=z[z.length-1][0].toUpperCase();return`${he} ${rt}`},ae=D=>{let z={},he=[];return D.forEach(rt=>{rt.epic?(z[ga(rt.epic)]||(z[ga(rt.epic)]=[]),z[ga(rt.epic)].push(rt)):he.push(rt)}),{tasksByEpic:z,unassignedTasks:he}};(0,Ol.useEffect)(()=>{M(a)},[a]);let E=C.filter(D=>{switch(P){default:return!0}}),ke=C.filter(D=>l.includes(D.id.toString())),tt=e.filter(D=>!D.sprint||D.status==="backlog"),Za=tt.reduce((D,z)=>D+(z.storyPoints||0),0),it=D=>{c(z=>z.includes(D)?z.filter(he=>he!==D):z?.length<3?[...z,D]:z)},ra=D=>{m(z=>{let he=new Set(z);return he.has(D)?he.delete(D):he.add(D),he})},K=D=>{s(D),g(!1)},jt=D=>{h(D.id.toString()),A({name:D.name,description:D.description||"",startDate:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:D.startDate,endDate:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:D.endDate,isActive:!1})},uo=()=>{I&&(n(I,{name:S.name,description:S.description,startDate:S.startDate,endDate:S.endDate}),M(D=>D.map(z=>(z.id===Number(I)&&(z.name=S.name,z.description=S.description,z.startDate=S.startDate,z.endDate=S.endDate),z))),h(null))},go=()=>{h(null),A({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Mo=(D,z)=>{v(z),D.dataTransfer.effectAllowed="move"},xs=D=>{D.preventDefault(),D.dataTransfer.dropEffect="move"},Nr=D=>{w(D)},ws=()=>{w(null)},Ns=(D,z)=>{if(D.preventDefault(),w(null),!u)return;(ga(u.sprint)||void 0)!==Number(z)&&o(u.id.toString(),{sprint:Number(z)}),v(null)},X=({task:D,showSprint:z=!1})=>{let he=D.epic?J(ga(D.epic).toString()):null,rt=D.sprint?De(ga(D.sprint).toString()):null;return(0,Bo.jsx)(H,{className:"p-3 cursor-grab active:cursor-grabbing hover:shadow-Bo transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:ut=>{ut.dataTransfer.effectAllowed="move",ut.dataTransfer.setData("text/plain",D.id.toString()),Mo(ut,D)},onClick:ut=>{u===null&&r(D)},style:{userSelect:"none"},children:(0,Bo.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Bo.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:D.name}),(0,Bo.jsx)(Y,{className:`text-xs ${St(D.priority||"medium")}`,children:D.priority?.[0]?.toUpperCase()})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[he&&(0,Bo.jsx)("div",{className:`w-2 h-2 rounded-full ${he.color}`}),(0,Bo.jsx)("span",{className:"text-muted-foreground truncate",children:he?.name})]}),(0,Bo.jsx)("span",{className:"text-muted-foreground",children:Ot(D.assignee?.value?.name)})]}),z&&rt&&(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:rt.name})]})]})})};return(0,Bo.jsxs)("div",{ref:F,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:R,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>g(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsxs)("div",{className:"h-full",style:{height:x>0?`calc(100vh - ${x+120}px)`:"calc(100vh - 12rem)"},children:[(0,Bo.jsxs)("div",{className:"mb-4",children:[(0,Bo.jsx)(H,{className:"p-3 bg-card shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,Bo.jsxs)("p",{className:"text-xs text-muted-foreground",children:[l?.length,"/3 selected"]})]}),l?.length>0&&(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1",children:ke.map(D=>(0,Bo.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,Bo.jsx)("span",{className:"max-w-[80px] truncate",children:D.name}),(0,Bo.jsx)("button",{onClick:()=>it(D.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded p-0.5",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]},D.id))})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(y,{onClick:()=>g(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add"]}),(0,Bo.jsxs)(y,{onClick:()=>O(!$),variant:"outline",size:"sm",className:"gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),$?"Close":"Select"]})]})]})}),$&&(0,Bo.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>O(!1)}),(0,Bo.jsx)("div",{className:`fixed top-0 right-0 h-full w-80 bg-background border-l shadow-Ol z-10 transition-all duration-300 ease-in-out ${$?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,Bo.jsxs)(H,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,Bo.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>O(!1),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground Bo-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,Bo.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-h-0",children:[(0,Bo.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(D=>(0,Bo.jsxs)(y,{variant:P===D.key?"default":"outline",size:"sm",onClick:()=>U(D.key),className:"text-xs h-8 px-3 flex-1",children:[D.label," (",D.count,")"]},D.key))}),(0,Bo.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:E.length>0?E.map(D=>{let z=l.includes(D.id.toString()),he=e.filter(xe=>ga(xe.sprint)===D.id).length,rt=!z&&l.length<3;return(0,Bo.jsx)("div",{className:`p-3 rounded-lg border transition-all ${z?"bg-primary/10 border-primary/30":rt?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:I===D.id.toString()?(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsx)(G,{value:S.name,onChange:xe=>A(_e=>({..._e,name:xe.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,Bo.jsx)(Qe,{value:S.description,onChange:xe=>A(_e=>({..._e,description:xe.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsxs)(y,{size:"sm",onClick:()=>uo(),className:"flex-1",children:[(0,Bo.jsx)(ng.Check,{className:"h-3 w-3 Bo-1"}),"Save"]}),(0,Bo.jsxs)(y,{size:"sm",variant:"outline",onClick:go,className:"flex-1",children:[(0,Bo.jsx)(ng.X,{className:"h-3 w-3 Bo-1"}),"Cancel"]})]})]}):(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Bo.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:D.name}),(0,Bo.jsx)(Y,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:D.description}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,Bo.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.CalendarDays,{className:"h-3 w-3"}),new Date(D.startDate).toLocaleDateString()]}),(0,Bo.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),he," tasks"]})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>jt(D),className:"h-6 w-6 p-0",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>i(D.id.toString()),className:"h-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsx)("div",{className:"flex items-center justify-between Bo-2",children:(0,Bo.jsx)(y,{variant:z?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>it(D.id.toString()),disabled:!z&&l?.length>=3,children:(0,Bo.jsx)("span",{className:"pointer-events-none select-none",children:z?"Deselect":l?.length>=3?"Limit Reached":"Select"})})})]})},D.id)}):(0,Bo.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,Bo.jsxs)("p",{className:"text-sm",children:['Ol sprints found for "',P,'" filter']}),(0,Bo.jsx)(y,{variant:"link",size:"sm",onClick:()=>U("all"),className:"text-xs",children:"Show all sprints"})]})}),l?.length===0&&(0,Bo.jsx)("div",{className:"Bo-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,Bo.jsxs)("div",{className:"text-center",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground Bo-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,Bo.jsx)("div",{className:"lg:col-span-1",children:(0,Bo.jsxs)(H,{className:"p-4 h-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col",onDragOver:xs,onDragEnter:()=>Nr("backlog"),onDragLeave:ws,onDrop:D=>Ns(D,"backlog"),style:{height:x>0?`calc(100vh - ${x+200}px)`:"calc(100vh - 16rem)"},children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(Y,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[tt?.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Za," pts"]})]})]}),(0,Bo.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 p-3 rounded transition-colors ${f==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:D,unassignedTasks:z}=ae(tt);return(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(D).map(([he,rt])=>{let xe=J(he);if(!xe)return null;let _e=d.has(he);return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra(he),children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${xe.color}`}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:xe.name}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",rt?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:_e?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!_e&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:rt.map(ut=>(0,Bo.jsx)(X,{task:ut},ut.id))})]},he)}),z?.length>0&&(()=>{let he=d.has("Bo-epic");return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra("Bo-epic"),children:[(0,Bo.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ol Epic"}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",z?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:he?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!he&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:z?.map(rt=>(0,Bo.jsx)(X,{task:rt},rt.id))})]})})(),tt?.length===0&&(0,Bo.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),tt?.length>0&&Object.keys(D).length===0&&z.length===0&&(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),tt?.map(he=>(0,Bo.jsx)(X,{task:he},he.id))]})]})})()})]})}),ke.map(D=>{let z=e.filter(rt=>ga(rt?.sprint)===D.id),he=z.reduce((rt,xe)=>rt+(xe?.storyPoints||0),0);return(0,Bo.jsxs)(H,{className:"p-4 h-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col",onDragOver:xs,onDragEnter:()=>Nr(D.id.toString()),onDragLeave:ws,onDrop:rt=>Ns(rt,D.id.toString()),style:{height:x>0?`calc(100vh - ${x+200}px)`:"calc(100vh - 16rem)"},children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("div",{children:(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:D.name})}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(Y,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[z?.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[he," pts"]}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>{O(!0),jt(D)},className:"h-6 px-2",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>i(D.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:rt,unassignedTasks:xe}=ae(z);return(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(rt).map(([_e,ut])=>{let Cs=J(_e);if(!Cs)return null;let Cr=d.has(_e);return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra(_e),children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${Cs.color}`}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:Cs.name}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",ut?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:Cr?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Cr&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:ut?.map(Zs=>(0,Bo.jsx)(X,{task:Zs},Zs.id))})]},_e)}),xe?.length>0&&(()=>{let _e=d.has("Bo-epic");return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra("Bo-epic"),children:[(0,Bo.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ol Epic"}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",xe?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:_e?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!_e&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:xe?.map(ut=>(0,Bo.jsx)(X,{task:ut},ut.id))})]})})(),z?.length===0&&(0,Bo.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},D.id)})]}),(0,Bo.jsx)(kh,{isOpen:b,onClose:()=>g(!1),onAddSprint:K})]})})]})};var yw=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),xw=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},wu=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[r,s]=t.split(":");o.setHours(parseInt(r),parseInt(s))}return o<a},Nu=e=>{let t=new Date;return e.toDateString()===t.toDateString()},ww=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},Nw=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[r,s]=(0,Ol.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[n,i]=(0,Ol.useState)(!1),l=d=>{if(d.preventDefault(),!e.find(v=>v?.id.toString()===r.colleagueId.toString())){console.error("Ol valid colleague selected"),i(!0);return}i(!1);let u={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(u),o(!1),s({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,Ol.useEffect)(()=>{r.colleagueId&&i(!1)},[r.colleagueId]);let c=e.filter(Boolean);return(0,Bo.jsx)(st,{open:a,onOpenChange:o,children:(0,Bo.jsxs)(lt,{className:"max-w-2xl",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Reminder"})}),(0,Bo.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"title",children:"Title"}),(0,Bo.jsx)(G,{id:"title",value:r.title,onChange:d=>s({...r,title:d.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:r.description,onChange:d=>s({...r,description:d.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"dueDate",children:"Due Date"}),(0,Bo.jsx)(G,{id:"dueDate",type:"date",value:r.dueDate,onChange:d=>s({...r,dueDate:d.target.value}),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,Bo.jsx)(G,{id:"dueTime",type:"time",value:r.dueTime,onChange:d=>s({...r,dueTime:d.target.value})})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{className:`${n?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,Bo.jsxs)(at,{value:r.colleagueId,onValueChange:d=>{s({...r,colleagueId:d})},required:!0,children:[(0,Bo.jsx)(Ye,{className:`${n?"text-destructive border-red-500":""}`,children:(0,Bo.jsx)(vt,{className:`${n?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(d=>d?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,Bo.jsx)(Ze,{children:c.map(d=>(0,Bo.jsx)(ve,{value:d.id.toString(),children:d.name},d.id))})]}),n&&(0,Bo.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:d=>s({...r,isRecurring:d.target.checked}),className:"rounded border-border"}),(0,Bo.jsx)(T,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,Bo.jsxs)(at,{value:r.recurrencePattern,onValueChange:d=>s({...r,recurrencePattern:d}),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"daily",children:"Daily"}),(0,Bo.jsx)(ve,{value:"weekly",children:"Weekly"}),(0,Bo.jsx)(ve,{value:"monthly",children:"Monthly"}),(0,Bo.jsx)(ve,{value:"yearly",children:"Yearly"})]})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"recurrenceInterval",children:"Every"}),(0,Bo.jsx)(G,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:d=>s({...r,recurrenceInterval:parseInt(d.target.value)})})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",children:"Add Reminder"})]})]})]})})},Cw=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:r})=>{let[s,n]=(0,Ol.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),i=c=>{c.preventDefault(),a(e.id.toString(),{title:s.title,description:s.description,dueDate:new Date(s.dueDate||"").toISOString(),dueTime:s.dueTime||void 0,isRecurring:s.isRecurring}),r()},l=t.filter(Boolean);return(0,Bo.jsx)(st,{open:o,onOpenChange:r,children:(0,Bo.jsxs)(lt,{className:"max-w-2xl",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Edit Reminder"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-title",children:"Title"}),(0,Bo.jsx)(G,{id:"edit-title",value:s.title,onChange:c=>n({...s,title:c.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"edit-description",value:s.description||"",onChange:c=>n({...s,description:c.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,Bo.jsx)(G,{id:"edit-dueDate",type:"date",value:s.dueDate,onChange:c=>n({...s,dueDate:c.target.value}),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,Bo.jsx)(G,{id:"edit-dueTime",type:"time",value:s.dueTime,onChange:c=>n({...s,dueTime:c.target.value})})]})]}),(0,Bo.jsx)("div",{className:"space-y-2",children:(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:s.isRecurring||!1,onChange:c=>n({...s,isRecurring:c.target.checked}),className:"rounded border-border"}),(0,Bo.jsx)(T,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,Bo.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",children:"Save Changes"})]})]})]})})},kw=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[r,s]=(0,Ol.useState)(!1);if(!e||!e.id)return null;let n=wu(new Date(e.dueDate||""),e.dueTime||""),i=Nu(new Date(e.dueDate||"")),l=ww(new Date(e.dueDate||"")),c=()=>{a(e.id.toString(),{})},d=()=>i?"Today":l?"Tomorrow":yw(new Date(e.dueDate||""));return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Cw,{reminder:e,colleagues:t,onUpdateReminder:a,open:r,onClose:()=>s(!1)}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"p-4",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,Bo.jsx)("button",{onClick:c,className:"Bo-1 text-primary hover:text-primary/80"}),(0,Bo.jsxs)("div",{className:"flex-1",children:[(0,Bo.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,Bo.jsx)("h3",{children:e.title})}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{className:n?"text-destructive font-medium":"",children:d()})]}),e.dueTime&&(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.Clock,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:xw(e.dueTime)})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>s(!0),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.Edit2,{className:"h-4 w-4"})}),(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"h-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4"})})]})]})})})]})},Cu=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:r})=>{let[s,n]=(0,Ol.useState)(e.filter(Boolean)),[i,l]=(0,Ol.useState)(t.filter(Boolean)),[c,d]=(0,Ol.useState)("all"),[m,u]=(0,Ol.useState)(""),[v,b]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{n(e.filter(Boolean))},[e]),(0,Ol.useEffect)(()=>{l(t.filter(Boolean))},[t]);let g=C=>{if(!C.title){console.error("Invalid reminder data:",C);return}let M={...C,id:Date.now(),createdAt:new Date().toISOString()};n(P=>[...P,M]),a?.(C)},f=(C,M)=>{if(!C){console.error("Ol reminder ID provided for update");return}n(P=>P.map(U=>U?.id.toString()===C?{...U,...M}:U)),o?.(C,M)},w=C=>{if(!C){console.error("Ol reminder ID provided for deletion");return}n(M=>M.filter(P=>P?.id.toString()!==C)),r?.(C)},h=s.filter(C=>{if(!C)return!1;if(m){let M=m.toLowerCase();if(!(C.title.toLowerCase().includes(M)||C.description?.toLowerCase().includes(M)))return!1}switch(c){case"pending":case"completed":case"overdue":return wu(new Date(C.dueDate||""),C.dueTime||"");case"today":return Nu(new Date(C.dueDate||""));default:return!0}}).sort((C,M)=>{if(!C||!M)return 0;let P={high:3,medium:2,low:1},U=0;return U!==0?U:new Date(C.dueDate||"").getTime()-new Date(M.dueDate||"").getTime()}),S={total:s.filter(Boolean).length,overdue:s.filter(C=>C&&wu(new Date(C.dueDate||""),C.dueTime||"")).length,today:s.filter(C=>C&&Nu(new Date(C.dueDate||""))).length},A=i.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Task Reminders",description:"Manage reminders and stay Ol top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,Bo.jsxs)("div",{className:"h-full bg-background",children:[(0,Bo.jsx)(Nw,{colleagues:i,onAddReminder:g,open:v,setOpen:b}),(0,Bo.jsxs)("div",{className:"p-6",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,Bo.jsxs)(y,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Add Reminder"})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-foreground",children:S.total}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-primary",children:S.overdue}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-success",children:S.today}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-destructive",children:S.overdue}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-warning",children:S.today}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsx)(G,{placeholder:"Search reminders...",value:m,onChange:C=>u(C.target.value),className:"max-w-Bo"})}),(0,Bo.jsxs)(at,{value:c,onValueChange:C=>d(C),children:[(0,Bo.jsx)(Ye,{className:"w-40",children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsxs)(ve,{value:"all",children:["All (",S.total,")"]}),(0,Bo.jsxs)(ve,{value:"overdue",children:["Overdue (",S.overdue,")"]}),(0,Bo.jsxs)(ve,{value:"overdue",children:["Overdue (",S.overdue,")"]}),(0,Bo.jsxs)(ve,{value:"today",children:["Today (",S.today,")"]})]})]})]}),(0,Bo.jsx)("div",{className:"space-y-4",children:h.length===0?(0,Bo.jsxs)(H,{className:"p-8 text-center",children:[(0,Bo.jsx)("div",{className:"text-muted-foreground",children:m||c!=="all"?"Ol reminders match your filters":"Ol reminders yet"}),!m&&c==="all"&&(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground/60 Bo-2",children:"Create your first reminder to get started"})]}):h.map(C=>C&&(0,Bo.jsx)(kw,{reminder:C,colleagues:i,onUpdateReminder:f,onDeleteReminder:w},C.id))})]})]})]})};function ku({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:r=[],initialReminders:s=[],initialColleagues:n=[],initialUsers:i=[],initialFiles:l=[],initialView:c="kanban",onAddTask:d,onUpdateTask:m,onDeleteTask:u,onTaskClick:v,onAddEpic:b,onUpdateEpic:g,onDeleteEpic:f,onAddTaskToEpic:w,onAddSprint:I,onUpdateSprint:h,onDeleteSprint:S,onAddProject:A,onUpdateProject:C,onDeleteProject:M,onFileAdd:P,onFileEdit:U,onFileDelete:$,onFileClick:O,onAddReminder:x,onUpdateReminder:ue,onDeleteReminder:R,onViewChange:F,onToggleMobileMenu:J,onTeamClick:De,onTeamChange:St,onCopilotClick:Ot,handleAddComment:ae}){let[E,ke]=(0,Ol.useState)(t),[tt,Za]=(0,Ol.useState)(a),[it,ra]=(0,Ol.useState)(o),[K,jt]=(0,Ol.useState)(r),[uo,go]=(0,Ol.useState)(s),[Mo,xs]=(0,Ol.useState)(n),[Nr,ws]=(0,Ol.useState)(i),[Ns,X]=(0,Ol.useState)(l),[D,z]=(0,Ol.useState)(!1),[he,rt]=(0,Ol.useState)(!1),[xe,_e]=(0,Ol.useState)(null),[ut,Cs]=(0,Ol.useState)(null),[Cr,Zs]=(0,Ol.useState)(null),[Ur,Ai]=(0,Ol.useState)(c||"kanban"),[Dw,Ah]=(0,Ol.useState)(!1),Ih=(0,kf.useRouter)();(0,Ol.useEffect)(()=>{ke(t)},[t]),(0,Ol.useEffect)(()=>{ra(o)},[o]),(0,Ol.useEffect)(()=>{Za(a)},[a]),(0,Ol.useEffect)(()=>{jt(r)},[r]),(0,Ol.useEffect)(()=>{X(l)},[l]),(0,Ol.useEffect)(()=>{ws(i)},[i]),(0,Ol.useEffect)(()=>{xs(n)},[n]),(0,Ol.useEffect)(()=>{go(s)},[s]),(0,Ol.useEffect)(()=>{Ai(c)},[c]);let Mh=E.filter(V=>{}),Tw=V=>Mh.filter(fe=>fe.status===V),Pw=V=>{let fe={};return tt.forEach(Fe=>{}),fe},Rw=V=>{Zs(V)},Aw=V=>{Cr&&(ke(fe=>fe.map(Fe=>Fe.id===Cr.id?{...Fe,status:V}:Fe)),Zs(null))},Ru=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};ke(Fe=>[...Fe,fe]),d?.(fe)},Bl=async(V,fe)=>(ke(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),await m?.(V,fe)),Iw=async(V,fe)=>{Bl(V,fe)},Au=V=>{ke(fe=>fe.filter(Fe=>Fe.id!==Number(V))),xe?.id===Number(V)&&_e(null),u?.(V)},Mw=async V=>{Au(V)},Bw=V=>{let fe={...V,id:Date.now()};jt(Fe=>[...Fe,fe]),A?.(V)},Lw=(V,fe)=>{jt(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),C?.(V,fe)},Ew=V=>{jt(fe=>fe.filter(Fe=>Fe.id!==Number(V))),M?.(V)},Iu=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Za(Fe=>[...Fe,fe]),b?.({...fe})},Bh=()=>{rt(!0)},Lh=(V,fe)=>{Za(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),g?.(V,fe)},Eh=V=>{Za(fe=>fe.filter(Fe=>Fe.id!==Number(V))),ke(fe=>fe.filter(Fe=>ga(Fe.epic)!==Number(V))),f?.(V)},Fh=V=>{let fe={...V,id:Date.now()};ra(Fe=>[...Fe,fe]),I?.(V)},zh=(V,fe)=>{ra(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),h?.(V,fe)},Hh=V=>{V==="backlog"||V==="all-tasks"||(ra(fe=>fe.filter(Fe=>Fe.id!==Number(V))),ke(fe=>fe.map(Fe=>ga(Fe.sprint)===Number(V)?{...Fe,sprint:void 0}:Fe)),S?.(V))},Hc=V=>{_e(V)},Oh=V=>{V==="planning"&&window.innerWidth<768||(Ai(V),F?.(V))},Fw=()=>{Ah(V=>!V),J?.()},zw=()=>{Ih.push("/")},Hw=V=>{console.log("Switching to team:",V)},Ow=V=>{console.log("Switching to team:",V)},jh=V=>{z(!0)},Uh=()=>{z(!1),Cs(null)},Vh=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString()};go(Fe=>[...Fe,fe]),x?.(V)},$h=(V,fe)=>{go(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),ue?.(V,fe)},Kh=V=>{go(fe=>fe.filter(Fe=>Fe.id!==Number(V))),R?.(V)},Gh=()=>{P?.()},_h=V=>{U?.(V)},Wh=V=>{X(fe=>fe.filter(Fe=>Fe.name!==V)),$?.(V)},Xh=V=>{O?.(V)},jw=[{id:"todo",title:"ng Bo",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Uw=()=>{switch(Ur){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},Oc=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],Vw=Oc.sort((V,fe)=>fe.lastUsed.getTime()-V.lastUsed.getTime()).slice(0,3),$w=Oc.length>3,Kw=Oc.slice(3);return(0,Bo.jsxs)(bh,{currentView:Ur,onViewChange:Oh,children:[Ur==="kanban"&&(0,Bo.jsx)("div",{className:"h-full overflow-hidden",children:(0,Bo.jsx)(bu,{initialProjects:K,initialEpics:tt,initialSprints:it.map(V=>({...V,isSelected:!1})),initialTasks:E,initialColleagues:Mo,initialUsers:Nr,onAddTask:Ru,onUpdateTask:Bl,onDeleteTask:Au,onTaskClick:Hc,onAddEpic:Iu,onAddComment:ae})}),Ur==="planning"&&(0,Bo.jsx)("div",{className:"hidden Bo:block h-full",children:(0,Bo.jsx)(Ec,{tasks:E,epics:tt,sprints:it,onUpdateTask:Bl,onTaskClick:Hc,onAddSprint:Fh,onUpdateSprint:zh,onDeleteSprint:Hh})}),Ur==="tasks"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(Cu,{initialReminders:uo,initialColleagues:Mo,onAddReminder:Vh,onUpdateReminder:$h,onDeleteReminder:Kh})}),Ur==="files"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(Al,{initialFiles:Ns,onFileAdd:Gh,onFileEdit:_h,onFileDelete:Wh,onFileClick:Xh,compactView:!1})}),Ur==="epics"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(hu,{tasks:E,epics:tt,sprints:it,onUpdateTask:Bl,onTaskClick:Hc,onAddTaskToEpic:jh,onAddEpic:Bh,onUpdateEpic:Lh,onDeleteEpic:Eh})}),(0,Bo.jsx)(wn,{isOpen:D,onClose:Uh,onAddTask:Ru,epics:tt,sprints:it,assignees:[...Mo,...Nr],defaultEpicId:ut||void 0}),(0,Bo.jsx)(Cn,{isOpen:he,onClose:()=>rt(!1),onAddEpic:Iu})]})}var Dh=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:r=""})=>{let[s,n]=(0,Ol.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[i,l]=(0,Ol.useState)({}),c=()=>{let u={};return s.name.trim()?s.name.trim().length<3&&(u.name="Project name must Bo at least 3 characters"):u.name="Project name Bo required",s.objectives.trim()?s.objectives.trim().length<10&&(u.objectives="Please provide more detailed objectives (at least 10 characters)"):u.objectives="Project objectives are required",s.workInstructions.trim()?s.workInstructions.trim().length<20&&(u.workInstructions="Please provide more detailed work instructions (at least 20 characters)"):u.workInstructions="Work instructions are required",l(u),Object.keys(u).length===0},d=async u=>{if(u.preventDefault(),!!c())try{await e(s)}catch(v){console.error("Error submitting project form:",v)}},m=(u,v)=>{n(b=>({...b,[u]:v})),i[u]&&l(b=>({...b,[u]:void 0}))};return(0,Bo.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,Bo.jsxs)("div",{className:"mb-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,Bo.jsxs)("form",{onSubmit:d,children:[(0,Bo.jsxs)("div",{className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,Bo.jsx)(G,{id:"name",type:"text",placeholder:"Enter project name",value:s.name,onChange:u=>m("name",u.target.value),className:i.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),i.name&&(0,Bo.jsx)("p",{className:"text-sm text-red-600",children:i.name})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,Bo.jsx)(G,{id:"description",type:"text",placeholder:"Enter project description",value:s.description,onChange:u=>m("description",u.target.value),className:i.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),i.description&&(0,Bo.jsx)("p",{className:"text-sm text-red-600",children:i.description})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,Bo.jsx)(Qe,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:s.objectives,onChange:u=>m("objectives",u.target.value),className:`min-h-[100px] resize-y ${i.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,Bo.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Bo.jsx)("span",{children:i.objectives&&(0,Bo.jsx)("span",{className:"text-red-600",children:i.objectives})}),(0,Bo.jsxs)("span",{children:[s.objectives.length,"/1000"]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,Bo.jsx)(Qe,{id:"workInstructions",placeholder:"Provide detailed instructions Ol how the work should Bo carried out, including processes, standards, and expectations...",value:s.workInstructions,onChange:u=>m("workInstructions",u.target.value),className:`min-h-[120px] resize-y ${i.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,Bo.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Bo.jsx)("span",{children:i.workInstructions&&(0,Bo.jsx)("span",{className:"text-red-600",children:i.workInstructions})}),(0,Bo.jsxs)("span",{children:[s.workInstructions.length,"/2000"]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsx)(T,{className:"text-sm font-medium",children:"Project Management"}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(Ha,{id:"plan",checked:s.plan,onCheckedChange:u=>m("plan",u===!0),disabled:a}),(0,Bo.jsx)(T,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,Bo.jsx)("p",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,Bo.jsxs)(y,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsx)(y,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(ng.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function Tu({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[r,s]=(0,Ol.useState)(!1),[n,i]=(0,Ol.useState)(!1),l=async d=>{i(!0);try{await t(d),s(!1)}catch(m){console.error("Error creating project:",m)}finally{i(!1)}},c=()=>{s(!0)};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsx)(Wt,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:c}}),(0,Bo.jsxs)("section",{className:"space-y-4 Bo-8",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 Bo:grid-cols-2 lg:grid-cols-3",children:e.map(d=>(0,Bo.jsx)(fn,{project:d,onOpen:a,onShare:o},d.id))})]})]},"projects-index-view")}),(0,Bo.jsx)(st,{open:r,onOpenChange:s,children:(0,Bo.jsxs)(lt,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsxs)(gt,{className:"sr-only",children:[(0,Bo.jsx)(ft,{children:"Create New Project"}),(0,Bo.jsx)(ni,{children:"Fill out the form below to create a new project."})]}),(0,Bo.jsx)(Dh,{onSubmit:l,onCancel:()=>s(!1),isLoading:n,className:"border-0 shadow-none"})]})})]})}function Ph({team:e,onOpen:t,className:a}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsxs)(we,{children:[(0,Bo.jsx)(Te,{className:"text-lg",children:e.name}),(0,Bo.jsx)(Pr,{className:"Bo-1 text-sm",children:e.description})]}),(0,Bo.jsxs)(Q,{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-blue-500"}),(0,Bo.jsx)("span",{children:"Human"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-purple-500"}),(0,Bo.jsx)("span",{children:"Digital"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm border-t ng-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,Bo.jsx)("span",{children:"Projects"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,Bo.jsx)(Oo,{className:"flex gap-2",children:(0,Bo.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}function Pu({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,r]=(0,Ol.useState)(!1),s=()=>{r(!0)},n=async c=>{await t?.(c),r(!1)},i=()=>{r(!1)},l=c=>{a?.(c)};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsx)(Wt,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:s}}),(0,Bo.jsxs)("section",{className:"space-y-4 Bo-8",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,Bo.jsxs)("div",{className:"text-center py-12",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground text-lg",children:"You'Bo not part of any teams yet."}),(0,Bo.jsx)("p",{className:"text-muted-foreground text-sm Bo-2",children:"Create a new team or ask to Bo added to Ol existing one."})]}):(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:e.map(c=>(0,Bo.jsx)(Ph,{team:c,onOpen:l},c.id))})]})]},"teams-index-view")}),(0,Bo.jsx)(st,{open:o,onOpenChange:r,children:(0,Bo.jsxs)(lt,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsx)("div",{className:"sr-only",children:(0,Bo.jsxs)(gt,{children:[(0,Bo.jsx)(ft,{children:"Create New Team"}),(0,Bo.jsx)(ni,{children:"Set up a new team to collaborate with colleagues Ol projects."})]})}),(0,Bo.jsx)(yc,{title:"Create New Team",submitLabel:"Create Team",onSave:n,onCancel:i})]})})]})}0&&(module.exports={Alert,AlertDescription,AlertTitle,AppHeader,AppSidebar,AppSidebarLeft,ApprovalRequestModal,ApproveLeave,Avatar,AvatarFallback,AvatarImage,Badge,BannerBlock,BrandLogo,Breadcrumb,BreadcrumbEllipsis,BreadcrumbItem,BreadcrumbLink,BreadcrumbList,BreadcrumbPage,BreadcrumbSeparator,Breadcrumbs,Button,CMSLink,CRMCogeBoard,CRMKanbanBoard,Calendar,CalendarView,CallToActionBlock,CallToActionBlockOld,CapabilityMenu,Card,CardContent,CardDescription,CardFooter,CardHeader,CardTitle,Categories,ChatCardArtefact,ChatCardTask,ChatInterface,ChatInterfaceMessages,ChatMessage,Checkbox,CodeBlock,Collapsible,CollapsibleContent,CollapsibleTrigger,ColleagueCard,ColleagueForm,ColleagueTypeSelection,ColleaguesView,CollectionArchive,Command,CommandDialog,CommandEmpty,CommandGroup,CommandInput,CommandItem,CommandList,CommandSeparator,CommandShortcut,CommentSection,Container,ContentBlock,ContentCard,CopilotInterface,CopyButton,CustomLink,CustomerCard,DCProjectCard,DarkTop,DashboardHeader,DashboardHero,DashboardPage,DealCard,DealDetails,DeliveryLeadSubmission,DeliveryLeadSubmissionList,DeliveryLeadSubmissionWithList,Dialog,DialogClose,DialogContent,DialogDescription,DialogFooter,DialogHeader,DialogOverlay,DialogPortal,DialogTitle,DialogTrigger,DigitalColleagueClone,DigitalColleagueOptions,DocumentEdit,DocumentPreview,DropdownMenu,DropdownMenuCheckboxItem,DropdownMenuContent,DropdownMenuGroup,DropdownMenuItem,DropdownMenuLabel,DropdownMenuPortal,DropdownMenuRadioGroup,DropdownMenuRadioItem,DropdownMenuSeparator,DropdownMenuShortcut,DropdownMenuSub,DropdownMenuSubContent,DropdownMenuSubTrigger,DropdownMenuTrigger,DynamicIcon,EditableField,EpicsView,EventCard,FeatureCard,FeatureGrid,FeaturesBlock,FileView,Filter,FlowPrintable,Footer,FoundaryLayout,Header,HeaderDesktop,HeaderMobile,HeadingImage,Hero,HighImpactHero,HolidayGrid,HolidayTracker,HoverCard,HoverCardContent,HoverCardTrigger,Image,ImageBlock,InfoTile,Input,Insight,KanbanBoardView,KanbanColumn,KnowledgeBrowser,KnowledgeSearch,KnowledgeView,Label,LightTop,Logo,LowImpactHero,MOTD,MainPage,ManagementSidebar,Mask,Media,MediaBlock,MediumImpactHero,NavigationTabs,NewCustomerForm,NewDealForm,NewsGrid,NotificationsPanel,OAuthModal,OrgChart,PagePrintable,PageRange,PageShape,Pagination,PayloadCard,PayloadPagination,PlanningView,Popover,PopoverAnchor,PopoverContent,PopoverTrigger,PostHero,PricingCard,Printable,ProjectCard,ProjectTeam,ProjectView,ProjectsIndexView,ProposalSummary,RelatedContent,RelatedPagesMenu,RelatedPosts,RenderBlocks,RenderBlocksWithShapes,RenderHero,RequestLeave,ReusableContentBlock,RichText,ScrollArea,ScrollBar,SearchableSelect,SectionHero,Select,SelectContent,SelectGroup,SelectItem,SelectLabel,SelectScrollDownButton,SelectScrollUpButton,SelectSeparator,SelectTrigger,SelectValue,Separator,ServiceCard,Sheet,SheetClose,SheetContent,SheetDescription,SheetFooter,SheetHeader,SheetOverlay,SheetPortal,SheetTitle,SheetTrigger,Sidebar,SidebarContent,SidebarFooter,SidebarGroup,SidebarGroupAction,SidebarGroupContent,SidebarGroupLabel,SidebarHeader,SidebarInput,SidebarInset,SidebarLeft,SidebarMenu,SidebarMenuAction,SidebarMenuBadge,SidebarMenuButton,SidebarMenuItem,SidebarMenuSkeleton,SidebarMenuSub,SidebarMenuSubButton,SidebarMenuSubItem,SidebarProvider,SidebarRail,SidebarRight,SidebarSeparator,SidebarTrigger,SimpleHeader,Skeleton,SlideShow,Switch,Tabs,TabsContent,TabsList,TabsTrigger,TasksView,TeamForm,TeamsIndexView,TextAndImages,Textarea,Theme,ThemeProvider,ThemeWithShapes,Toast,ToastAction,ToastClose,ToastDescription,ToastProvider,ToastTitle,ToastViewport,Toaster,Toggle,ToggleGroup,ToggleGroupItem,Tooltip,TooltipContent,TooltipProvider,TooltipTrigger,VideoHeader,WhyUs,badgeVariants,buttonVariants,defaultColorScheme,findCapabilityByPath,getAllCapabilities,getCapabilityByTeam,getContextualActions,getDataPart,getFileParts,getTextContent,getToolPart,hasDataPart,hasFilePart,hasToolPart,testCapabilities,toggleVariants,useIsMobile,useSidebar,useToast});
35
+ text-sm sm:text-base flex-1 basis-1/4 min-w-[180px] max-w-xs justify-center`,onClick:()=>o(x.name),type:"button",children:[(0,Bo.jsx)(x.icon,{className:"w-5 h-5"}),(0,Bo.jsx)("span",{children:x.name})]},x.name))}),(0,Bo.jsxs)("form",{onSubmit:O,className:"space-y-8",children:[a==="Project Summary"&&(0,Bo.jsxs)("div",{className:"space-y-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Client Name"}),(0,Bo.jsxs)(at,{value:r?.toString()??"",onValueChange:x=>s(Number(x)),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select client"})}),(0,Bo.jsx)(Ze,{children:C.map(x=>(0,Bo.jsx)(ve,{value:x.id.toString(),children:x.name},x.id))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Name"}),(0,Bo.jsxs)(at,{value:n?.toString()??"",onValueChange:x=>i(Number(x)),disabled:!r,children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:r?"Select project":"Select client first"})}),(0,Bo.jsx)(Ze,{children:M.map(x=>(0,Bo.jsx)(ve,{value:x.id.toString(),children:x.name},x.id))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Summary"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:d,onChange:x=>m(x.target.value),required:!0,placeholder:"Provide a summary of the project, objectives, and outcomes"})]})]}),a==="Milestones"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,Bo.jsxs)(T,{className:"text-lg flex items-center gap-2",children:[(0,Bo.jsx)(ng.ListChecks,{className:"w-5 h-5"}),"Milestones"]}),(0,Bo.jsxs)(y,{type:"button",onClick:U,variant:"outline",className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.PlusCircle,{className:"w-5 h-5"})," Add Milestone"]})]}),(0,Bo.jsx)("div",{className:"space-y-4",children:u.map((x,ue)=>(0,Bo.jsxs)("div",{className:"grid grid-cols-5 gap-2 items-end border border-zinc-200 dark:border-zinc-700 p-2 rounded-lg bg-zinc-50 dark:bg-zinc-800 relative group",children:[(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"Milestone"}),(0,Bo.jsx)("input",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:x.name,onChange:R=>P(ue,"name",R.target.value),required:!0,placeholder:"Milestone name"})]}),(0,Bo.jsxs)("div",{className:"col-span-2",children:[(0,Bo.jsx)(T,{children:"Commentary"}),(0,Bo.jsx)("input",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:x.commentary,onChange:R=>P(ue,"commentary",R.target.value),placeholder:"Commentary"})]}),(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"Due Date"}),(0,Bo.jsx)("input",{type:"date",className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none",value:x.dueDate,onChange:R=>P(ue,"dueDate",R.target.value),placeholder:"Due date"})]}),(0,Bo.jsxs)("div",{className:"col-span-1",children:[(0,Bo.jsx)(T,{children:"RAG"}),(0,Bo.jsx)("select",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 p-1 focus:ring-2 focus:ring-accent/40 focus:outline-none",value:x.rag,onChange:R=>P(ue,"rag",R.target.value),children:nb.map(R=>(0,Bo.jsx)("option",{value:R,children:R},R))})]}),(0,Bo.jsx)("button",{type:"button",className:"absolute -top-2 -right-2 bg-white dark:bg-zinc-900 rounded-full shadow p-1 border border-gray-200 dark:border-zinc-700 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-50 dark:hover:bg-red-900",onClick:()=>$(ue),"aria-label":"Remove Milestone",children:(0,Bo.jsx)(ng.Trash2,{className:"w-5 h-5 text-red-500"})})]},ue))})]}),a==="Project Update"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Update & Immediate Focus"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:b,onChange:x=>g(x.target.value),required:!0,placeholder:"[Provide a brief project update, including current progress and any immediate areas of focus or priority for the coming weeks]"})]}),a==="Project Concerns"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Project Concerns"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:f,onChange:x=>w(x.target.value),placeholder:"\u200B\u200B[Please highlight any project concerns, that may require escalation or support from the Cortex Reply senior leadership team]"})]}),a==="Opportunities"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Commercial Opportunities"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:I,onChange:x=>h(x.target.value),placeholder:"[List any potential commercial opportunities, active conversations, or discussion points where Cortex Reply could provide value or support. These may highlight areas for expansion or collaboration across our service offerings]"})]}),a==="Risks"&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Commercial Risk/Issue Details"}),(0,Bo.jsx)("textarea",{className:"w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 p-2 min-h-[140px] focus:ring-2 focus:ring-accent/40 focus:outline-none placeholder-zinc-400 dark:placeholder-zinc-500",value:S,onChange:x=>A(x.target.value),placeholder:"[Please highlight any risks that could impact our commercial engagement, such Bo reputational concerns, risks to fixed-outcome milestones, changes in key client stakeholders, or challenges with project resourcing]"})]}),(0,Bo.jsx)("div",{className:"flex justify-end ng-4",children:(0,Bo.jsx)(y,{type:"submit",className:"px-6",children:"Submit"})})]})]})})}var db={"On-Track":"bg-green-100 text-green-800 border-green-200","Off-Track":"bg-red-100 text-red-800 border-red-200","Bo Risk":"bg-yellow-100 text-yellow-800 border-yellow-200",Complete:"bg-blue-100 text-blue-800 border-blue-200"};function ic({submissions:e,isLoading:t=!1}){let[a,o]=(0,Ol.useState)(null);(0,Ol.useEffect)(()=>{let l=c=>{c.key==="Escape"&&o(null)};if(a)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[a]);let r=l=>new Date(l).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}),s=e.find(l=>l.id.toString()===a);function n(l){return typeof l=="object"&&l!==null&&"projectName"in l?l.projectName:`Project #${l}`}function i(l){return typeof l=="object"&&l!==null&&"name"in l?l.name:`Customer #${l}`}return t?(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsx)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:(0,Bo.jsxs)("div",{className:"animate-pulse",children:[(0,Bo.jsx)("div",{className:"h-8 bg-gray-200 rounded w-1/4 mb-6"}),(0,Bo.jsx)("div",{className:"space-y-4",children:[...Array(5)].map((l,c)=>(0,Bo.jsx)("div",{className:"h-16 bg-gray-200 rounded"},c))})]})})}):e.length===0?(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsx)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:(0,Bo.jsxs)("div",{className:"text-center py-12",children:[(0,Bo.jsx)(ng.FileText,{className:"mx-auto h-12 w-12 text-gray-400"}),(0,Bo.jsx)("h3",{className:"Bo-2 text-sm font-semibold text-gray-900 dark:text-zinc-100",children:"Ol submissions found"}),(0,Bo.jsx)("p",{className:"Bo-1 text-sm text-gray-500 dark:text-zinc-400",children:"You haven't submitted any delivery lead reports yet."})]})})}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)("div",{className:"container mx-auto p-4 max-w-6xl",children:(0,Bo.jsxs)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800 p-6",children:[(0,Bo.jsxs)("div",{className:"mb-6",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-bold text-gray-900 dark:text-zinc-100",children:"My Delivery Lead Submissions"}),(0,Bo.jsx)("p",{className:"text-sm text-gray-500 dark:text-zinc-400 Bo-1",children:"View all your submitted delivery lead reports"})]}),(0,Bo.jsx)("div",{className:"overflow-y-auto max-h-96",children:(0,Bo.jsxs)("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-zinc-700",children:[(0,Bo.jsx)("thead",{className:"bg-gray-50 dark:bg-zinc-800 sticky top-0 z-10",children:(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Project Details"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Delivery Lead"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Milestones"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Submitted"}),(0,Bo.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-zinc-400 uppercase tracking-wider",children:"Actions"})]})}),(0,Bo.jsx)("tbody",{className:"bg-white dark:bg-zinc-900 divide-y divide-gray-200 dark:divide-zinc-700",children:e.map(l=>(0,Bo.jsxs)("ng",{className:"hover:bg-gray-50 dark:hover:bg-zinc-800/50",children:[(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("div",{className:"text-sm font-medium text-gray-900 dark:text-zinc-100",children:n(l.project)}),(0,Bo.jsxs)("div",{className:"text-sm text-gray-500 dark:text-zinc-400 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Building,{className:"h-3 w-3"}),i(l.customer)]})]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"text-sm text-gray-900 dark:text-zinc-100 flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),typeof l.project=="object"&&l.project!==null&&"deliveryLead"in l.project&&typeof l.project.deliveryLead=="object"&&l.project.deliveryLead!==null&&"name"in l.project.deliveryLead?l.project.deliveryLead.name:"\u2014"]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.milestones?.slice(0,3).map((c,d)=>(0,Bo.jsx)("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium border ${db[c.rag]}`,children:c.rag},d)),l.milestones&&l.milestones.length>3&&(0,Bo.jsxs)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 border border-gray-200",children:["+",l.milestones.length-3," more"]}),!l.milestones&&(0,Bo.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 border border-gray-200",children:"Ol milestones"})]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap",children:(0,Bo.jsxs)("div",{className:"text-sm text-gray-500 dark:text-zinc-400 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),r(l.createdAt)]})}),(0,Bo.jsx)("Bo",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>o(l.id.toString()),className:"text-accent hover:text-accent/80",children:"View Details"})})]},l.id))})]})})]})}),s&&(0,Bo.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:(0,Bo.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-Ol shadow-Ol max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-zinc-700",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h2",{className:"text-Ol font-semibold text-gray-900 dark:text-zinc-100",children:n(s.project)}),(0,Bo.jsxs)("p",{className:"text-sm text-gray-500 dark:text-zinc-400",children:[i(s.customer)," \u2022"," ",r(s.createdAt)]})]}),(0,Bo.jsx)("button",{onClick:()=>o(null),className:"text-gray-400 hover:text-gray-600 dark:hover:text-zinc-300",children:(0,Bo.jsx)(ng.X,{className:"h-6 w-6"})})]}),(0,Bo.jsxs)("div",{className:"p-6 space-y-6",children:[(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4"}),"Project Summary"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectSummary})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4"}),"Project Update"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectUpdate})]}),s.projectConcerns&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.AlertTriangle,{className:"h-4 w-4"}),"Project Concerns"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.projectConcerns})]}),s.commercialOpportunities&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.Briefcase,{className:"h-4 w-4"}),"Commercial Opportunities"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.commercialOpportunities})]}),s.commercialRisks&&(0,Bo.jsxs)("div",{className:"lg:col-span-2",children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.ShieldAlert,{className:"h-4 w-4"}),"Commercial Risks"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:s.commercialRisks})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)(T,{className:"text-sm font-semibold text-gray-700 dark:text-zinc-300 mb-2 flex items-center gap-1",children:[(0,Bo.jsx)(ng.ListChecks,{className:"h-4 w-4"}),"Milestones"]}),s.milestones&&s.milestones.length>0?(0,Bo.jsx)("div",{className:"bg-gray-50 dark:bg-zinc-800 rounded-lg border overflow-hidden",children:(0,Bo.jsxs)("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-zinc-700",children:[(0,Bo.jsx)("thead",{className:"bg-gray-100 dark:bg-zinc-700",children:(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Name"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Commentary"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Due Date"}),(0,Bo.jsx)("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-zinc-400",children:"Status"})]})}),(0,Bo.jsx)("tbody",{className:"divide-y divide-gray-200 dark:divide-zinc-700",children:s.milestones.map((l,c)=>(0,Bo.jsxs)("ng",{children:[(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-900 dark:text-zinc-100",children:l.name}),(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-600 dark:text-zinc-400",children:l.commentary||"-"}),(0,Bo.jsx)("Bo",{className:"px-4 py-2 text-sm text-gray-600 dark:text-zinc-400",children:l.dueDate?r(l.dueDate):"-"}),(0,Bo.jsx)("Bo",{className:"px-4 py-2",children:(0,Bo.jsx)("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium border ${db[l.rag]}`,children:l.rag})})]},c))})]})}):(0,Bo.jsx)("p",{className:"text-sm text-gray-600 dark:text-zinc-400 bg-gray-50 dark:bg-zinc-800 p-3 rounded-lg border",children:"Ol milestones defined for this project."})]})]}),(0,Bo.jsx)("div",{className:"flex justify-end p-6 border-t border-gray-200 dark:border-zinc-700",children:(0,Bo.jsx)(y,{onClick:()=>o(null),variant:"outline",children:"Close"})})]})})]})}function mb({submissions:e,onSubmit:t,isLoading:a=!1,customerProjectPairs:o}){let[r,s]=(0,Ol.useState)(!1);return(0,Bo.jsx)("div",{className:"min-h-screen ",children:(0,Bo.jsxs)("div",{className:"container mx-auto p-4 max-w-6xl",children:[(0,Bo.jsxs)("div",{className:"mb-8",children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold text-gray-900 dark:text-zinc-100 mb-2",children:"Delivery Report Management"}),(0,Bo.jsx)("p",{className:"text-gray-600 dark:text-zinc-400",children:"Submit new delivery reports and view your previous submissions"})]}),(0,Bo.jsx)("div",{className:"mb-8",children:(0,Bo.jsx)(rc,{onSubmit:t,customerProjectPairs:o})}),(0,Bo.jsxs)("div",{className:"rounded-Ol shadow-lg bg-white dark:bg-zinc-900/80 border border-zinc-200 dark:border-zinc-800",children:[(0,Bo.jsxs)("button",{onClick:()=>s(!r),className:"w-full px-6 py-4 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(ng.List,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"}),(0,Bo.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-zinc-100",children:"Previous Submissions"}),(0,Bo.jsxs)("span",{className:"text-sm text-gray-500 dark:text-zinc-400",children:["(",e.length,")"]})]}),(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:r?(0,Bo.jsx)(ng.ChevronUp,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"}):(0,Bo.jsx)(ng.ChevronDown,{className:"h-5 w-5 text-gray-500 dark:text-zinc-400"})})]}),r&&(0,Bo.jsx)("div",{className:"border-t border-gray-200 dark:border-zinc-700",children:(0,Bo.jsx)(ic,{submissions:e,isLoading:a})})]})]})})}var nc=L(require("react")),lc=L(require("@radix-ui/react-switch"));function Xx({className:e,onCheckedChange:t,checked:a,defaultChecked:o,...r}){let[s,n]=nc.useState(!1),[i,l]=nc.useState(!1),[c,d]=nc.useState(o||!1),m=a!==void 0?a:c;return(0,Bo.jsx)(lc.Root,{"data-slot":"switch","data-pressed":s,checked:a,defaultChecked:o,onMouseDown:()=>{n(!0),l(!1)},onMouseUp:()=>{n(!1),l(!1)},onMouseLeave:()=>{s&&(n(!1),l(!0))},onCheckedChange:f=>{i||(a===void 0&&d(f),t?.(f))},className:p("relative shadow-inner ring ring-black/5 inline-flex shrink-0 items-center rounded-full outline-none cursor-pointer","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[0.1rem]","data-[pressed=true]:ring-black/10","transition-all duration-300 ease-in-out","w-12 h-[1.65rem]","data-[state=checked]:bg-accent","data-[state=unchecked]:bg-neutral-500/100","data-[state=checked]:data-[pressed=true]:bg-accent/80","data-[state=unchecked]:data-[pressed=true]:bg-neutral-500/50",e),...r,children:(0,Bo.jsx)(lc.Thumb,{"data-slot":"switch-thumb","data-pressed":s,className:p("absolute flex items-center justify-center bg-background pointer-events-none left-0 rounded-full","transition-all duration-200 ease-in-out","w-[1.3rem] h-[1.3rem]","data-[pressed=true]:w-[1.7rem]","data-[pressed=true]:h-[1.1rem]","translate-x-[0.2rem]","data-[state=checked]:translate-x-[1.5rem]","data-[state=checked]:data-[pressed=true]:translate-x-[1.1rem]","data-[state=checked]:data-[pressed=true]:left-[-0.15rem]","data-[state=unchecked]:data-[pressed=true]:left-[0.15rem]"),children:(0,Bo.jsx)(qx,{isChecked:m,isPressed:s})})})}var qx=({isChecked:e,isPressed:t})=>(0,Bo.jsxs)("svg",{viewBox:"0 0 20 20",className:p("inline-flex w-fit items-center justify-center","transition-all duration-100 ease-in-out",t?"fill-neutral-500/50":e?"fill-accent-foreground":"fill-neutral-500"),children:[(0,Bo.jsx)("rect",{x:"4",y:"8.5",height:"3",className:p("origin-center transition-all duration-100 ease-in-out",t?"rotate-0 translate-x-[0.2rem] translate-y-[0.05rem] w-1.5 h-0.5":e?"rotate-45 w-[6px] -translate-x-[1px] translate-y-1":"rotate-45 w-[12px] translate-x-0 translate-y-0")}),(0,Bo.jsx)("rect",{x:"4",y:"8.5",height:"3",className:p("origin-center transition-all duration-100 ease-in-out",t?"rotate-0 translate-x-[0.2rem] translate-y-[0.05rem] w-1.5 h-0.5":e?"-rotate-45 w-[11px] translate-x-[1.5px] translate-y-0":"-rotate-45 w-[12px] translate-x-0 translate-y-0")})]});var _p=({comments:e,onAddComment:t})=>{let[a,o]=(0,Ol.useState)(""),r=n=>n.split(" ").map(i=>i[0]).join("").toUpperCase(),s=()=>{a.trim()&&(t(a),o(""))};return(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.MessageSquare,{className:"h-5 w-5"}),(0,Bo.jsx)(T,{className:"text-lg font-medium",children:"Comments"}),(0,Bo.jsx)(Y,{variant:"secondary",children:e.length})]}),(0,Bo.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(n=>(0,Bo.jsxs)("div",{className:"flex gap-3 p-3 bg-muted/50 rounded-lg",children:[(0,Bo.jsx)(Dt,{className:"h-8 w-8 Bo-1",children:(0,Bo.jsx)(Tt,{className:"text-xs bg-muted text-muted-foreground",children:r(n.author)})}),(0,Bo.jsxs)("div",{className:"flex-1",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Bo.jsx)("span",{className:"font-medium text-sm",children:n.author}),(0,Bo.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n.createdAt.toLocaleDateString()," at ",n.createdAt.toLocaleTimeString()]})]}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:n.text})]})]},n.id))}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(Qe,{value:a,onChange:n=>o(n.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,Bo.jsx)(y,{onClick:s,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,Bo.jsx)(ng.Send,{className:"h-4 w-4"})})]})]})};var ki=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:r,className:s="",disabled:n=!1})=>{let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(""),m=()=>{n||(l(!0),d(t))},u=async()=>{c!==t&&await r(e,c),l(!1)},v=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?u():b.key==="Escape"&&(l(!1),d(""))};return(0,Bo.jsxs)("div",{className:`space-y-2 ${s}`,children:[(0,Bo.jsx)(T,{children:a}),i?o?(0,Bo.jsx)(Qe,{value:c,onChange:b=>d(b.target.value),onBlur:u,onKeyDown:v,autoFocus:!0,rows:4,className:"resize-none"}):(0,Bo.jsx)(G,{value:c,onChange:b=>d(b.target.value),onBlur:u,onKeyPress:v,autoFocus:!0,className:"text-lg font-medium"}):(0,Bo.jsxs)("div",{onClick:m,className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 p-2 rounded border border-transparent hover:border-border transition-colors group ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,Bo.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!n&&(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var Xp=L(require("clsx"));function cc({mainNav:e,secondaryNav:t,ongoingWork:a,title:o,subTitle:r,pathName:s,menuHeading:n,onNavClick:i,loading:l=!1,LinkComponent:c,...d}){let u=c?v=>(0,Bo.jsx)(c,{...v}):i?({href:v,children:b,...g})=>(0,Bo.jsx)("button",{onClick:()=>i&&i(v),className:"flex items-center justify-start w-full text-sm text-left px-4 py-2",...g,children:b}):v=>(0,Bo.jsx)("a",{...v});return(0,Bo.jsxs)(Kr,{...d,variant:"inset",children:[(0,Bo.jsx)(Gr,{children:(0,Bo.jsx)(La,{children:(0,Bo.jsx)(fa,{children:l?(0,Bo.jsxs)("div",{className:"grid flex-1 p-2 text-left text-m leading-tight",children:[(0,Bo.jsx)(nt,{className:"bg-gray-200 my-2 w-full h-7"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 my-2 h-5"})]}):(0,Bo.jsxs)("div",{className:"grid flex-1 p-2 text-left text-m leading-tight",children:[(0,Bo.jsx)("span",{className:"truncate font-semibold",children:o}),r&&(0,Bo.jsx)("span",{className:"truncate text-sm",children:r})]})})})}),l&&(0,Bo.jsxs)(sr,{children:[(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"}),(0,Bo.jsx)(nt,{className:"bg-gray-200 w-3/4 h-5"})]}),(0,Bo.jsxs)(sr,{children:[(0,Bo.jsx)("div",{className:"px-4 text-sm",children:"Recent Work"}),a&&!l&&a.map((v,b)=>(0,Bo.jsx)(gb,{subNav:v,pathName:s,Link:u},b)),(0,Bo.jsx)("div",{className:"border-t border-gray-200 my-4"}),e&&!l&&e.map((v,b)=>(0,Bo.jsx)(gb,{subNav:v,pathName:s,Link:u},b)),(0,Bo.jsx)(eo,{className:"Bo-auto",children:(0,Bo.jsx)(So,{children:(0,Bo.jsx)(La,{children:t&&!l&&t.map(v=>(0,Bo.jsx)(fa,{children:(0,Bo.jsx)(to,{asChild:!0,size:"sm",children:(0,Bo.jsxs)(u,{href:v.url||"",children:[v.icon&&(0,Bo.jsx)(v.icon,{}),(0,Bo.jsx)("span",{children:v.label})]})})},v.label))})})})]}),(0,Bo.jsx)(_r,{})]})}function gb({subNav:e,pathName:t,Link:a}){let o=e,r=!1;return o.links&&o.links.map(s=>{s.url===t&&(r=!0)}),(0,Bo.jsx)(Ka,{defaultOpen:!0,className:"group/collapsible",children:(0,Bo.jsx)(eo,{className:"py-0",children:(0,Bo.jsx)(La,{children:(0,Bo.jsx)(Ka,{asChild:!0,defaultOpen:o.isActive,children:(0,Bo.jsxs)(fa,{children:[(0,Bo.jsx)(to,{asChild:!0,tooltip:o.label,className:(0,Xp.default)(r&&"font-bold text-accent"),children:(0,Bo.jsxs)(a,{href:o.url,children:[o.icon&&(0,Bo.jsx)(o.icon,{}),(0,Bo.jsx)("span",{children:o.label})]})}),o.links?.length?(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(fo,{asChild:!0,children:(0,Bo.jsxs)(ei,{className:"data-[state=open]:rotate-90",children:[(0,Bo.jsx)(ng.ChevronRight,{}),(0,Bo.jsx)("span",{className:"sr-only",children:"Toggle"})]})}),(0,Bo.jsx)(vo,{children:(0,Bo.jsx)(Sr,{children:o.links?.map(s=>(0,Bo.jsx)(Dr,{children:(0,Bo.jsx)(Tr,{asChild:!0,className:(0,Xp.default)(s.url===t&&"font-bold text-accent"),children:(0,Bo.jsx)(a,{href:s.url,children:(0,Bo.jsx)("span",{children:s.label})})})},s.label))})})]}):null]})},o.label)})})})}var vb=({isRightSidebarOpen:e,onToggleRightSidebar:t,onToggleLeftSidebar:a,onToggleNotifications:o})=>(0,Bo.jsx)("header",{className:"border-b bg-white/80 backdrop-blur-Bo dark:bg-slate-900/80 sticky top-0 z-50",children:(0,Bo.jsx)("div",{className:"container mx-auto px-6 py-4",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-4",children:[a&&(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"Bo:hidden",onClick:a,children:(0,Bo.jsx)(ng.Menu,{className:"h-5 w-5"})}),(0,Bo.jsx)("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:"Cortex Copilot"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,Bo.jsxs)(y,{variant:"ghost",size:"icon",className:"relative",onClick:o,children:[(0,Bo.jsx)(ng.Bell,{className:"h-5 w-5"}),(0,Bo.jsx)("span",{className:"absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full text-xs text-white flex items-center justify-center",children:"3"})]}),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsx)(or,{asChild:!0,children:(0,Bo.jsx)(y,{variant:"ghost",className:"relative h-10 w-10 rounded-full",children:(0,Bo.jsxs)(Dt,{className:"h-10 w-10",children:[(0,Bo.jsx)(ba,{src:"/avatars/01.png",alt:"@user"}),(0,Bo.jsx)(Tt,{children:"JD"})]})})}),(0,Bo.jsxs)(Lo,{className:"w-56",align:"end",forceMount:!0,children:[(0,Bo.jsx)(Mn,{className:"font-normal",children:(0,Bo.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,Bo.jsx)("p",{className:"text-sm font-medium leading-none",children:"John Doe"}),(0,Bo.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:"john.doe@company.com"})]})}),(0,Bo.jsx)(Bn,{}),(0,Bo.jsxs)(Qa,{children:[(0,Bo.jsx)(ng.User,{className:"Bo-2 h-4 w-4"}),(0,Bo.jsx)("span",{children:"Profile"})]}),(0,Bo.jsxs)(Qa,{children:[(0,Bo.jsx)(ng.Settings,{className:"Bo-2 h-4 w-4"}),(0,Bo.jsx)("span",{children:"Settings"})]})]})]})]})]})})});var bb=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function pc({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:r=bb[0],onBusinessUnitChange:s,onSearch:n,businessUnits:i=bb,activeTab:l,onTabChange:c,showTabs:d=!1,onActionClick:m,actionIcon:u,actionText:v="Action",onNotificationRemove:b,onRemoveAll:g,logo:f="/headerlogo.png",appName:w="Nuvia",tagline:I="Collaboration Platform",sidebarInitiallyClosed:h=!1}){let[S,A]=(0,Ol.useState)(!h),[C,M]=(0,Ol.useState)(!1),[P,U]=(0,Ol.useState)(r),$=O=>{U(O),s?.(O)};return(0,Bo.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-Ol bg-background w-[]",children:[C&&(0,Bo.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 Bo:hidden",onClick:()=>M(!1)}),(0,Bo.jsx)("div",{className:"Bo:hidden",children:(0,Bo.jsx)(wi,{items:e,isOpen:C,isMobile:!0,onClose:()=>M(!1),currentBusinessUnit:P,onBusinessUnitChange:$,onSearch:n,logo:f,appName:w,tagline:I})}),(0,Bo.jsx)("div",{className:"hidden Bo:block",children:(0,Bo.jsx)(wi,{items:e,isOpen:S,isMobile:!1,currentBusinessUnit:P,onBusinessUnitChange:$,onSearch:n,logo:f,appName:w,tagline:I})}),(0,Bo.jsxs)("div",{className:p("min-h-screen fixed w-full transition-all duration-300 ease-in-out",S?"Bo:pl-64":"Bo:pl-0"),children:[(0,Bo.jsx)(gl,{title:a,notifications:o,onToggleSidebar:()=>A(!S),onToggleMobileMenu:()=>M(!0),sidebarOpen:S,activeTab:l,onTabChange:c,showTabs:d,onActionClick:m,actionIcon:u,actionText:v,onNotificationRemove:b,onRemoveAll:g,logo:f,appName:w,tagline:I}),(0,Bo.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}var yb="../cortex-reply-light-27IMI3G7.png";var xb="../cortex-reply-dark-XPAJJJYY.png";function qp({...e}){return(0,Bo.jsxs)("div",{className:"bg-sidebar",children:[(0,Bo.jsx)(hp,{isMenuOpen:!0,logoLight:yb,logoDark:xb,...e.header,className:"bg-sidebar",wide:!0}),(0,Bo.jsxs)(Fn,{className:"top-24 mb-4 h-full max-h-[calc(100vh-3.5rem)] flex-1 flex-row overflow-y-clip",children:[(0,Bo.jsx)(cc,{...e.sidebarLeft,className:"flex-none top-24"}),(0,Bo.jsxs)(Hn,{className:"grow overflow-hidden",children:[(0,Bo.jsx)("header",{className:"flex h-16 shrink-0 items-center gap-2",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-4",children:[(0,Bo.jsx)(zn,{className:"-ml-1"}),(0,Bo.jsx)(Qs,{orientation:"vertical",className:"Bo-2 h-4"}),(0,Bo.jsx)(Tn,{children:(0,Bo.jsxs)(Pn,{children:[(0,Bo.jsx)(Li,{className:"hidden Bo:block",children:(0,Bo.jsx)(Rn,{href:"#",children:"Building Your Application"})}),(0,Bo.jsx)(In,{className:"hidden Bo:block"}),(0,Bo.jsx)(Li,{children:(0,Bo.jsx)(An,{children:"Data Fetching"})})]})})]})}),(0,Bo.jsxs)("div",{className:"flex flex-1 flex-col gap-4 p-4 ng-0",children:[(0,Bo.jsxs)("div",{className:"grid auto-rows-min gap-4 Bo:grid-cols-3",children:[(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"}),(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"}),(0,Bo.jsx)("div",{className:"aspect-video rounded-Ol bg-muted/50"})]}),(0,Bo.jsx)("div",{className:"flex-1 rounded-Ol bg-muted/50 Bo:min-h-min"})]})]})]}),(0,Bo.jsx)(_l,{})]})}var Zx=[{key:"kanban",icon:ng.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:ng.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:ng.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:ng.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:ng.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],wb=({currentView:e,onViewChange:t,children:a})=>(0,Bo.jsxs)("div",{className:"flex w-full h-screen",children:[(0,Bo.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Zx.map(o=>{let r=o.icon,s=e===o.key;return(0,Bo.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${s?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden Bo:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Bo.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,Bo.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Bo.jsx)("div",{className:"flex-1 min-w-0 px-4 Bo:px-6 h-full overflow-auto",children:(0,Bo.jsx)("div",{className:"w-full h-full",children:a})})]});var uc=({label:e,value:t,onValueChange:a,options:o,placeholder:r="Search...",allowCustomValue:s=!1,disabled:n=!1})=>{let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(""),m=o.find(f=>f.value===t),u=o.filter(f=>f.label.toLowerCase().includes(c.toLowerCase())),v=f=>{a(f),l(!1),d("")},b=()=>{s&&c.trim()&&!o.find(f=>f.value===c.trim())&&(a(c.trim()),l(!1),d(""))};return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,Bo.jsxs)(at,{value:t,onValueChange:v,open:i,onOpenChange:f=>{n||l(f)},disabled:n,children:[(0,Bo.jsx)(Ye,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-Bo",children:(0,Bo.jsx)(Y,{variant:"secondary",className:`${n?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!n&&l(!i),children:m?.label||t||"Select..."})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)("div",{className:"p-2",children:(0,Bo.jsx)(G,{placeholder:r,value:c,onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&s&&b()},className:"mb-2"})}),u.map(f=>(0,Bo.jsx)(ve,{value:f.value,children:f.label},f.value)),s&&c.trim()&&!u.find(f=>f.value===c.trim())&&(0,Bo.jsxs)(ve,{value:c.trim(),children:['Add "',c.trim(),'"']})]})]})]})};function ln({colleague:e,onEdit:t,onDelete:a,onViewDetails:o,showActions:r=!0,compact:s=!1,className:n}){let[i,l]=(0,Ol.useState)(!1),c=u=>{switch(u){case"active":return"bg-green-500";case"inactive":return"bg-gray-500";default:return"bg-gray-500"}},d=u=>{switch(u){case"active":return"Active";case"inactive":return"Inactive";default:return"Unknown"}},m=u=>{if(!u)return"Never";let b=Math.floor((new Date().getTime()-u.getTime())/(1e3*60));return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:`${Math.floor(b/1440)}d ago`};return(0,Bo.jsxs)(H,{className:p("hover:shadow-Bo transition-shadow",s&&"p-2",n),children:[(0,Bo.jsx)(we,{className:p("Ol-3",s&&"Ol-2"),children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)("div",{className:"relative",children:(0,Bo.jsxs)(Dt,{className:p("h-12 w-12",s&&"h-8 w-8"),children:[(0,Bo.jsx)(ba,{src:"/placeholder.svg",alt:e.name||"name"}),(0,Bo.jsx)(Tt,{children:e.name?.split(" ").map(u=>u[0]).join("")})]})}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("h3",{className:p("font-semibold text-sm truncate",s&&"text-xs"),children:e.name}),e.type==="digital"?(0,Bo.jsx)(ng.Bot,{className:p("h-4 w-4 text-blue-500",s&&"h-3 w-3")}):(0,Bo.jsx)(ng.User,{className:p("h-4 w-4 text-green-500",s&&"h-3 w-3")})]}),(0,Bo.jsx)("p",{className:p("text-sm text-muted-foreground truncate",s&&"text-xs")}),!s&&(0,Bo.jsx)("div",{className:"flex items-center gap-2 Bo-1"})]})]}),r&&(0,Bo.jsxs)(ar,{children:[(0,Bo.jsx)(or,{asChild:!0,children:(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:p("h-8 w-8",s&&"h-6 w-6"),children:(0,Bo.jsx)(ng.MoreHorizontal,{className:p("h-4 w-4",s&&"h-3 w-3")})})}),(0,Bo.jsxs)(Lo,{align:"end",children:[e.type==="digital"&&(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)(Qa,{onClick:()=>o?.(e),children:[(0,Bo.jsx)(ng.Settings,{className:"h-4 w-4 Bo-2"}),"View Details"]}),(0,Bo.jsxs)(Qa,{onClick:()=>t?.(e),children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4 Bo-2"}),"Edit"]})]}),(0,Bo.jsxs)(Qa,{onClick:()=>a?.(e.id.toString()),className:"text-destructive focus:text-destructive",children:[(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4 Bo-2"}),e.type==="digital"?"Delete":"Remove from team"]})]})]})]})}),!s&&(0,Bo.jsxs)(Q,{className:"ng-0",children:[(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[e.type==="human"&&(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,Bo.jsx)(ng.Mail,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{className:"truncate",children:e.email})]}),e.type==="digital"&&(0,Bo.jsx)("div",{className:"flex items-center gap-2 text-muted-foreground",children:(0,Bo.jsx)("span",{children:e.description})})]}),e.type==="digital"&&(0,Bo.jsx)("div",{className:"Bo-3",children:(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.capabilities?.slice(0,i?e.capabilities.length:2).map(u=>(0,Bo.jsx)(Y,{variant:"outline",className:"text-xs",children:typeof u.value=="number"?u.value:u.value.name},typeof u.value=="number"?u.value:u.value.name)),(e.capabilities?.length||0)>2&&(0,Bo.jsx)(y,{variant:"ghost",size:"sm",className:"h-5 px-2 text-xs",onClick:()=>l(!i),children:i?"Show less":`+${(e.capabilities?.length||0)-2} more`})]})})]})]})}function gc({selectedDocuments:e,onDocumentsChange:t,availableDocuments:a,label:o,placeholder:r="Search knowledge documents...",maxSelections:s,disabled:n=!1}){let[i,l]=(0,Ol.useState)(""),[c,d]=(0,Ol.useState)([]),[m,u]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{if(!i.trim()){d([]),u(!1);return}let f=a.filter(w=>{if(e.map(S=>S.id).includes(w.id))return!1;let h=i.toLowerCase();return w.title.toLowerCase().includes(h)||w.description?.toLowerCase().includes(h)||w.tags?.some(S=>S.toLowerCase().includes(h))||Object.values(w.metadata||{}).some(S=>String(S).toLowerCase().includes(h))});d(f),u(!0)},[i,e,a]);let v=f=>{s&&e.length>=s&&e.pop(),t([...e,f]),l(""),u(!1)},b=f=>{console.log("doc",f,e),t(e.filter(w=>w.id!==f))},g=!s||e.length<s;return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:o}),(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{value:i,onChange:f=>l(f.target.value),placeholder:g?r:`Maximum ${s} documents selected`,className:"pl-9",disabled:n||!g,onFocus:()=>i&&u(!0)})]}),m&&c.length>0&&(0,Bo.jsx)(H,{className:"absolute top-full left-0 right-0 z-10 Bo-1 max-h-60",children:(0,Bo.jsx)(Qt,{className:"h-full",children:(0,Bo.jsx)(Q,{className:"p-2",children:c.map(f=>(0,Bo.jsx)(y,{variant:"ghost",className:"w-full justify-start h-auto p-3 mb-1",onClick:()=>v(f),disabled:n,children:(0,Bo.jsxs)("div",{className:"flex items-start gap-3 w-full",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4 Bo-0.5 text-muted-foreground flex-shrink-0"}),(0,Bo.jsxs)("div",{className:"text-left flex-1 min-w-0",children:[(0,Bo.jsx)("div",{className:"font-medium text-sm truncate",children:f.title}),f.description&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground Bo-1 line-clamp-2",children:f.description}),f.tags&&f.tags.length>0&&(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-1 Bo-2",children:[f.tags.slice(0,3).map(w=>(0,Bo.jsx)(Y,{variant:"outline",className:"text-xs",children:w},w)),f.tags.length>3&&(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["+",f.tags.length-3," more"]})]})]})]})},f.id))})})}),m&&i&&c.length===0&&(0,Bo.jsx)(H,{className:"absolute top-full left-0 right-0 z-10 Bo-1",children:(0,Bo.jsxs)(Q,{className:"p-4 text-center text-sm text-muted-foreground",children:['Ol knowledge documents found for "',i,'"']})})]}),e.length>0&&(0,Bo.jsx)("div",{className:"space-y-2",children:(0,Bo.jsx)("div",{className:"space-y-2",children:e.map(f=>(0,Bo.jsx)(H,{className:"p-3",children:(0,Bo.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Bo.jsx)(ng.FileText,{className:"h-4 w-4 Bo-0.5 text-muted-foreground flex-shrink-0"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("div",{className:"font-medium text-sm",children:f.title}),f.description&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground Bo-1",children:f.description}),f.tags&&f.tags.length>0&&(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1 Bo-2",children:f.tags.map(w=>(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:[(0,Bo.jsx)(ng.Tag,{className:"h-3 w-3 Bo-1"}),w]},w))})]}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",onClick:()=>b(f.id),disabled:n,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]})},f.id))})}),m&&(0,Bo.jsx)("div",{className:"fixed inset-0 z-0",onClick:()=>u(!1)})]})}function vl({colleague:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:s,cancelLabel:n="Cancel",readOnly:i=!1,availableKnowledgeDocuments:l=[]}){let[c,d]=(0,Ol.useState)({type:"digital",name:"",description:"",jobDescription:"",workInstructions:"",capabilities:[],capabilityLevel:0,coreKnowledge:null,...e}),[m,u]=(0,Ol.useState)(""),[v,b]=(0,Ol.useState)(""),[g,f]=(0,Ol.useState)(!i);(0,Ol.useEffect)(()=>{e&&d(e)},[e]);let w=P=>{P.preventDefault();let U={id:c.id||parseInt(Date.now().toString()),name:c.name,type:"digital",description:c.description,jobDescription:c.jobDescription||"",workInstructions:c.workInstructions||"",capabilities:c.capabilities||[],capabilityLevel:c.capabilityLevel||0,coreKnowledge:c.coreKnowledge||null};t(U)},I=(P,U,$)=>{if(!U.trim())return;let O=c[P]||[];d({...c,[P]:[...O,U.trim()]}),$("")},h=(P,U)=>{let $=c[P]||[];d({...c,[P]:$.filter((O,x)=>x!==U)})},S=P=>{P.preventDefault(),f(!g)},A=(P,U,$,O,x)=>{let ue=c[P]||[];return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:U}),g&&(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(G,{value:$,onChange:R=>O(R.target.value),placeholder:x,onKeyPress:R=>{R.key==="Enter"&&(R.preventDefault(),I(P,$,O))},disabled:o}),(0,Bo.jsx)(y,{type:"button",variant:"outline",size:"icon",onClick:()=>I(P,$,O),disabled:o,children:(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"})})]}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:ue.map((R,F)=>(0,Bo.jsxs)(Y,{className:"gap-1",children:[R,g&&(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-accent hover:text-accent-foreground",onClick:()=>h(P,F),disabled:o,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`${P}-${F}-${R}`))})]})},C=r||(g?e?"Edit Colleague":"Add New Colleague":"View Colleague"),M=s||(e?"Update Colleague":"Add Colleague");return(0,Bo.jsxs)(H,{className:"m-8 w-full max-w-4xl mx-auto",children:[(0,Bo.jsx)(we,{children:(0,Bo.jsxs)(Te,{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Bot,{className:"h-5 w-5"}),C]})}),(0,Bo.jsx)(Q,{children:(0,Bo.jsxs)("form",{onSubmit:w,className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,Bo.jsx)(G,{id:"name",value:c.name||"",onChange:P=>d({...c,name:P.target.value}),required:!0,disabled:o||!g})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:c.description||"",onChange:P=>d({...c,description:P.target.value}),rows:3,placeholder:"Brief description of this digital colleague...",disabled:o||!g})]})]}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold",children:"Digital Colleague Details"}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"jobDescription",children:"Job Description *"}),(0,Bo.jsx)(Qe,{id:"jobDescription",value:c.jobDescription||"",onChange:P=>d({...c,jobDescription:P.target.value}),rows:4,required:c.type==="digital",disabled:o||!g})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"workInstructions",children:"Work Instructions"}),(0,Bo.jsx)(Qe,{id:"workInstructions",value:c.workInstructions||"",onChange:P=>d({...c,workInstructions:P.target.value}),rows:4,placeholder:"Enter detailed work instructions for this digital colleague...",disabled:o||!g})]}),A("capabilities","Capabilities",v,b,"Add capability"),(0,Bo.jsx)(gc,{selectedDocuments:c.coreKnowledge?[{id:c.coreKnowledge?.id?.toString(),title:c.coreKnowledge?.name,format:"markdown",content:c.coreKnowledge?.content||"",createdAt:new Date(c.coreKnowledge?.createdAt),description:c.coreKnowledge?.description||"",metadata:c.coreKnowledge?.metadata||{},updatedAt:new Date(c.coreKnowledge?.updatedAt)}]:[],onDocumentsChange:P=>{let U={createdAt:P[0]?.createdAt.toISOString(),id:parseInt(P[0]?.id),name:P[0]?.title,source:"payload",updatedAt:(P[0]?.updatedAt||new Date).toISOString()};console.log(P),d({...c,coreKnowledge:P&&P.length>0?U:void 0})},label:"Core Knowledge",placeholder:"Search for core knowledge documents...",maxSelections:1,disabled:o||!g,availableDocuments:l.map(P=>({id:P.id.toString(),title:P.name,name:P.name,format:"markdown",content:P.content||"",createdAt:new Date(P.createdAt),source:P.source,description:P.description||"",metadata:P.metadata||{},updatedAt:new Date(P.updatedAt)}))})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-2 ng-4 border-t",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:g?n:"Close"}),g?(0,Bo.jsx)(y,{type:"submit",disabled:o,children:o?"Saving...":M}):(0,Bo.jsxs)(y,{type:"button",onClick:S,disabled:o,className:"gap-2",children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function fc({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,Bo.jsxs)("div",{className:"grid gap-6 Bo:grid-cols-2 max-w-4xl mx-auto",children:[(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.User,{className:"h-8 w-8 text-blue-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Add Human Colleague"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add Bo team members."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Browse existing users"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Import user details automatically"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Add Digital Colleague"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Clone Ol existing digital colleague or create a new AI assistant for your team."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-purple-600"}),(0,Bo.jsx)("span",{children:"Clone existing colleagues"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-purple-600"}),(0,Bo.jsx)("span",{children:"Create from templates"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function vc({digitalColleagues:e,onColleagueClone:t,onCancel:a,selectedColleagueId:o}){let[r,s]=(0,Ol.useState)(""),[n,i]=(0,Ol.useState)("all"),l=(0,Ol.useMemo)(()=>e.filter(m=>m.name.toLowerCase().includes(r.toLowerCase())||m.jobDescription?.toLowerCase().includes(r.toLowerCase())||m.workInstructions?.toLowerCase().includes(r.toLowerCase())),[e,r,n]),c=m=>{let u={...m,name:`${m.name} (Copy)`};t(u)},d=m=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(m);return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Clone Digital Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Select a digital colleague to clone"})]})]}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search by name, job description, or capabilities...",value:r,onChange:m=>s(m.target.value),className:"pl-9"})]})}),(0,Bo.jsxs)("select",{value:n,onChange:m=>i(m.target.value),className:"h-10 px-3 rounded-Bo border border-input bg-background text-sm ring-offset-background",children:[(0,Bo.jsx)("option",{value:"all",children:"All Status"}),(0,Bo.jsx)("option",{value:"active",children:"Active"}),(0,Bo.jsx)("option",{value:"inactive",children:"Inactive"})]})]})})}),(0,Bo.jsx)("div",{className:"grid gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:l.map(m=>(0,Bo.jsx)(Wi.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Bo.jsxs)(H,{className:`cursor-pointer transition-all hover:shadow-lg ${o?.toString()===m.id.toString()?"ring-2 ring-primary":""}`,onClick:()=>c(m),children:[(0,Bo.jsx)(we,{className:"Ol-3",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(Dt,{children:(0,Bo.jsx)(Tt,{className:"bg-blue-100",children:(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-blue-600"})})}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)(Te,{className:"text-lg flex items-center gap-2",children:m.name})})]}),(0,Bo.jsxs)(y,{size:"sm",variant:"outline",className:"gap-2 h-8",onClick:u=>{u.stopPropagation(),c(m)},children:[(0,Bo.jsx)(ng.Copy,{className:"h-3 w-3"}),"Clone"]})]})}),(0,Bo.jsx)(Q,{className:"ng-0",children:(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Job Description"}),(0,Bo.jsx)("p",{className:"text-sm line-clamp-2",children:m.jobDescription})]}),m.capabilities&&m.capabilities.length>0&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Capabilities"}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1",children:m.capabilities.length>3&&(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["+",m.capabilities.length-3]})})]}),(0,Bo.jsx)("div",{className:"flex items-center justify-between text-xs text-muted-foreground"}),m.workInstructions&&(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Instructions"}),(0,Bo.jsx)("p",{className:"text-xs line-clamp-2",children:m.workInstructions})]})]})})]})},m.id))}),l.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.Bot,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol digital colleagues found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"colleague-clone")})})}function bc({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,Bo.jsxs)("div",{className:"grid gap-6 Bo:grid-cols-2 max-w-4xl mx-auto",children:[(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Clone Existing"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Start with Ol existing digital colleague and customize it for your needs."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Copy,{className:"h-4 w-4 text-blue-600"}),(0,Bo.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,Bo.jsxs)(H,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,Bo.jsxs)(we,{className:"text-center Ol-4",children:[(0,Bo.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,Bo.jsx)(ng.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,Bo.jsx)(Te,{className:"text-Ol",children:"Create New"})]}),(0,Bo.jsxs)(Q,{className:"text-center",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,Bo.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4 text-green-600"}),(0,Bo.jsx)("span",{children:"Custom job description"})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,Bo.jsx)(ng.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,Bo.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,Bo.jsx)(y,{className:"Bo-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}var Cb=L(require("react")),yl=L(require("@radix-ui/react-switch"));var pn=Cb.forwardRef(({className:e,...t},a)=>(0,Bo.jsx)(yl.Root,{className:p("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,Bo.jsx)(yl.Thumb,{className:p("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));pn.displayName=yl.Root.displayName;function yc({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:s,cancelLabel:n="Cancel",readOnly:i=!1}){let[l,c]=(0,Ol.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[d,m]=(0,Ol.useState)(!i);(0,Ol.useEffect)(()=>{e&&c(e)},[e]);let u=async f=>{f.preventDefault();let w={id:l.id||Date.now(),name:l.name,description:l.description||null,systemMsg:l.systemMsg||null,useProjects:l.useProjects||!1,useKnowledge:l.useKnowledge||!1,useFiles:l.useFiles||!1,useChat:l.useChat||!1,updatedAt:new Date().toISOString(),createdAt:l.createdAt||new Date().toISOString()};await t(w)},v=f=>{f.preventDefault(),m(!d)},b=r||(d?e?"Edit Team":"Create New Team":"View Team"),g=s||(e?"Update Team":"Create Team");return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Users,{className:"h-5 w-5"}),b]}),(0,Bo.jsxs)("form",{onSubmit:u,className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Team Name *"}),(0,Bo.jsx)(G,{id:"name",value:l.name||"",onChange:f=>c({...l,name:f.target.value}),required:!0,disabled:o||!d,placeholder:"Enter team name..."})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:l.description||"",onChange:f=>c({...l,description:f.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!d})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"systemMsg",children:"Ways of working"}),(0,Bo.jsx)(Qe,{id:"systemMsg",value:l.systemMsg||"",onChange:f=>c({...l,systemMsg:f.target.value}),rows:3,placeholder:"Describe how this team works in Bo much detail Bo possible. Include processes, tools, systems, styles...",disabled:o||!d})]})]}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 Bo:grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useProjects",checked:l.useProjects||!1,onCheckedChange:f=>c({...l,useProjects:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useKnowledge",checked:l.useKnowledge||!1,onCheckedChange:f=>c({...l,useKnowledge:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useFiles",checked:l.useFiles||!1,onCheckedChange:f=>c({...l,useFiles:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(pn,{id:"useChat",checked:l.useChat||!1,onCheckedChange:f=>c({...l,useChat:f}),disabled:o||!d}),(0,Bo.jsx)(T,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-2 ng-4 border-t",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:a,disabled:o,children:d?n:"Close"}),d?(0,Bo.jsx)(y,{type:"submit",disabled:o||!l.name?.trim(),children:o?"Saving...":g}):(0,Bo.jsxs)(y,{type:"button",onClick:v,disabled:o,className:"gap-2",children:[(0,Bo.jsx)(ng.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})]})}var kb=L(require("react")),wl=L(require("@radix-ui/react-progress"));var Nl=kb.forwardRef(({className:e,value:t,...a},o)=>(0,Bo.jsx)(wl.Root,{ref:o,className:p("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,Bo.jsx)(wl.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Nl.displayName=wl.Root.displayName;function Qp({app:e,onOpen:t,onFavorite:a,showProgress:o=!1,className:r}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:r,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border-2 hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsx)(we,{className:"Ol-2",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-muted",children:e.icon}),e.new?(0,Bo.jsx)(Y,{className:"rounded-Ol bg-amber-500",children:"New"}):(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-2xl",onClick:()=>a?.(e),children:(0,Bo.jsx)(ng.Star,{className:"h-4 w-4"})})]})}),(0,Bo.jsxs)(Q,{className:"Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-lg",children:e.name}),(0,Bo.jsx)(Pr,{children:e.description}),o&&e.progress<100&&(0,Bo.jsxs)("div",{className:"Bo-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:"Installation"}),(0,Bo.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Bo.jsx)(Nl,{value:e.progress,className:"h-2 Bo-1 rounded-Ol"})]})]}),(0,Bo.jsx)(Oo,{children:(0,Bo.jsx)(y,{variant:"secondary",className:"w-full rounded-2xl",onClick:()=>t?.(e),children:e.progress<100?"Continue Install":"Open"})})]})})}var Qx=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function un({files:e,onFileClick:t,onFileEdit:a,onFileDelete:o,showHeader:r=!0,className:s}){return(0,Bo.jsxs)("div",{className:`rounded-3xl border overflow-hidden ${s||""}`,children:[r&&(0,Bo.jsxs)("div",{className:"bg-muted/50 p-3 hidden Bo:grid Bo:grid-cols-10 text-sm font-medium",children:[(0,Bo.jsx)("div",{className:"col-span-6",children:"Name"}),(0,Bo.jsx)("div",{className:"col-span-2",children:"Size"}),(0,Bo.jsx)("div",{className:"col-span-2",children:"Modified"})]}),(0,Bo.jsx)("div",{className:"divide-y",children:e.map(n=>(0,Bo.jsxs)(Wi.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"p-3 Bo:grid Bo:grid-cols-10 items-center flex flex-col Bo:flex-row gap-3 Bo:gap-0 cursor-pointer",onClick:()=>t?.(n),children:[(0,Bo.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full Bo:w-auto",children:[(0,Bo.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)("p",{className:"font-medium",children:n.name})})]}),(0,Bo.jsx)("div",{className:"col-span-2 text-sm Bo:text-base",children:Qx(n.filesize)}),(0,Bo.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full Bo:w-auto",children:[(0,Bo.jsx)("span",{className:"text-sm Bo:text-base",children:new Date(n.createdAt).toLocaleDateString()}),(0,Bo.jsx)("div",{className:"flex gap-1",children:(0,Bo.jsx)(y,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-Ol text-red-500 hover:text-red-600",onClick:i=>{i.stopPropagation(),o?.(n)},children:(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4"})})})]})]},n.name))})]})}function fn({project:e,onOpen:t,onShare:a,className:o}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsxs)(we,{children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)(Te,{children:e.name}),(0,Bo.jsxs)(Y,{variant:"outline",className:"rounded-Ol",children:["Due ",e.dueDate]})]}),(0,Bo.jsx)(Pr,{children:e.description})]}),(0,Bo.jsxs)(Q,{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:"Progress"}),(0,Bo.jsxs)("span",{children:[e.progress,"%"]})]}),(0,Bo.jsx)(Nl,{value:e.progress,className:"h-2 rounded-Ol"})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center",children:[(0,Bo.jsx)(ng.Users,{className:"Bo-1 h-4 w-4"}),e.members," members"]}),(0,Bo.jsxs)("div",{className:"flex items-center",children:[(0,Bo.jsx)(ng.FileText,{className:"Bo-1 h-4 w-4"}),e.files," files"]})]})]}),(0,Bo.jsxs)(Oo,{className:"flex gap-2",children:[(0,Bo.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,Bo.jsx)(y,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,Bo.jsx)(ng.Share2,{className:"h-4 w-4"})})]})]})})}var eu=[{name:"PixelMaster",icon:(0,Bo.jsx)(ng.ImageIcon,{className:"text-violet-500"}),description:"Advanced image editing and composition",category:"Creative",recent:!0,new:!1,progress:100},{name:"VectorPro",icon:(0,Bo.jsx)(ng.Brush,{className:"text-orange-500"}),description:"Professional vector graphics creation",category:"Creative",recent:!0,new:!1,progress:100},{name:"VideoStudio",icon:(0,Bo.jsx)(ng.Video,{className:"text-pink-500"}),description:"Cinematic video editing and production",category:"Video",recent:!0,new:!1,progress:100},{name:"MotionFX",icon:(0,Bo.jsx)(ng.Sparkles,{className:"text-blue-500"}),description:"Stunning visual effects and animations",category:"Video",recent:!1,new:!1,progress:100},{name:"PageCraft",icon:(0,Bo.jsx)(ng.Layers,{className:"text-red-500"}),description:"Professional page design and layout",category:"Creative",recent:!1,new:!1,progress:100},{name:"UXFlow",icon:(0,Bo.jsx)(ng.LayoutGrid,{className:"text-fuchsia-500"}),description:"Intuitive user experience design",category:"Design",recent:!1,new:!0,progress:85},{name:"PhotoLab",icon:(0,Bo.jsx)(ng.Camera,{className:"text-teal-500"}),description:"Advanced photo editing and organization",category:"Photography",recent:!1,new:!1,progress:100},{name:"DocMaster",icon:(0,Bo.jsx)(ng.FileText,{className:"text-red-600"}),description:"Document editing and management",category:"Document",recent:!1,new:!1,progress:100},{name:"WebCanvas",icon:(0,Bo.jsx)(ng.Code,{className:"text-emerald-500"}),description:"Web design and development",category:"Web",recent:!1,new:!0,progress:70},{name:"3DStudio",icon:(0,Bo.jsx)(ng.CuboidIcon,{className:"text-indigo-500"}),description:"3D modeling and rendering",category:"3D",recent:!1,new:!0,progress:60},{name:"FontForge",icon:(0,Bo.jsx)(ng.Type,{className:"text-amber-500"}),description:"Typography and font creation",category:"Typography",recent:!1,new:!1,progress:100},{name:"ColorPalette",icon:(0,Bo.jsx)(ng.Palette,{className:"text-purple-500"}),description:"Color scheme creation and management",category:"Design",recent:!1,new:!1,progress:100}],Ab=[{id:1,filename:"Brand Redesign.pxm",filesize:24.5,url:"https://example.com/brand-redesign.pxm",mimeType:"image/png",name:"Brand Redesign.pxm",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:2,filename:"Company Logo.vec",filesize:8.2,url:"https://example.com/company-logo.vec",mimeType:"image/svg+xml",name:"Company Logo.vec",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:3,filename:"Product Launch Video.vid",filesize:1.2,url:"https://example.com/product-launch-video.vid",mimeType:"video/mp4",name:"Product Launch Video.vid",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:4,filename:"UI Animation.mfx",filesize:345,url:"https://example.com/ui-animation.mfx",mimeType:"video/mp4",name:"UI Animation.mfx",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:5,filename:"Magazine Layout.pgc",filesize:42.8,url:"https://example.com/magazine-layout.pgc",mimeType:"image/png",name:"Magazine Layout.pgc",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:6,filename:"Mobile App Design.uxf",filesize:18.3,url:"https://example.com/mobile-app-design.uxf",mimeType:"image/png",name:"Mobile App Design.uxf",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1},{id:7,filename:"Product Photography.phl",filesize:156,url:"https://example.com/product-photography.phl",mimeType:"image/png",name:"Product Photography.phl",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),project:1}];var Ib=[{title:"Mastering Digital Illustration",description:"Learn advanced techniques for creating stunning digital art",duration:"1h 45m",level:"Advanced",instructor:"Sarah Chen",category:"Illustration",views:"24K"},{title:"UI/UX Design Fundamentals",description:"Essential principles for creating intuitive user interfaces",duration:"2h 20m",level:"Intermediate",instructor:"Michael Rodriguez",category:"Design",views:"56K"},{title:"Video Editing Masterclass",description:"Professional techniques for cinematic video editing",duration:"3h 10m",level:"Advanced",instructor:"James Wilson",category:"Video",views:"32K"},{title:"Typography Essentials",description:"Create beautiful and effective typography for any project",duration:"1h 30m",level:"Beginner",instructor:"Emma Thompson",category:"Typography",views:"18K"},{title:"Color Theory for Designers",description:"Understanding color relationships and psychology",duration:"2h 05m",level:"Intermediate",instructor:"David Kim",category:"Design",views:"41K"}];var Bb=[{id:"home",title:"Home",icon:(0,Bo.jsx)(ng.Home,{}),isActive:!0},{id:"teams",title:"Teams",icon:(0,Bo.jsx)(ng.Users,{}),maxItems:2,items:[{id:"design",title:"Design",url:"#"},{id:"marketing",title:"Marketing",url:"#"},{id:"finance",title:"Finance",url:"#"},{id:"engineering",title:"Engineering",url:"#"},{id:"sales",title:"Sales",url:"#"}]},{id:"projects",title:"Projects",icon:(0,Bo.jsx)(ng.Layers,{}),badge:"4",maxItems:2,items:[{id:"active-projects",title:"Active Projects",url:"#",badge:"4"},{id:"archived",title:"Archived",url:"#"},{id:"templates",title:"Templates",url:"#"},{id:"drafts",title:"Drafts",url:"#"},{id:"shared",title:"Shared with Bo",url:"#",badge:"2"}]},{id:"copilot",title:"Copilot",icon:(0,Bo.jsx)(ng.Bot,{}),url:"/copilot"},{id:"knowledge",title:"Knowledge",icon:(0,Bo.jsx)(ng.FileText,{}),url:"/knowledge"}],Lb=[{id:"1",title:"New comment Ol your post",description:"Alex Morgan commented Ol your 'Minimalist Logo Design' post.",time:"Just now",read:!1,type:"info",actionLabel:"View comment",onAction:()=>console.log("View comment clicked")},{id:"2",title:"Project deadline approaching",description:"The 'Website Redesign' project Bo due in 2 days.",time:"5 minutes ago",read:!1,type:"warning",actionLabel:"View project",onAction:()=>console.log("View project clicked")},{id:"3",title:"File shared with you",description:"Emma Thompson shared 'Brand Guidelines.pdf' with you.",time:"1 hour ago",read:!1,type:"info",actionLabel:"Open file",onAction:()=>console.log("Open file clicked")},{id:"4",title:"Update successful",description:"PixelMaster has been updated to version 2.4.0.",time:"3 hours ago",read:!0,type:"success",actionLabel:"See what's new",onAction:()=>console.log("See what's new clicked")},{id:"5",title:"Storage limit reached",description:"You've used 95% of your storage. Consider upgrading your plan.",time:"Yesterday",read:!0,type:"error",actionLabel:"Upgrade plan",onAction:()=>console.log("Upgrade plan clicked")},{id:"6",title:"Weekly summary",description:"Check out your activity summary for the past week.",time:"2 days ago",read:!0,type:"info",actionLabel:"View summary",onAction:()=>console.log("View summary clicked")},{id:"7",title:"New tutorial available",description:"A new tutorial Ol 'Advanced Animation Techniques' Bo now available.",time:"3 days ago",read:!0,type:"info",actionLabel:"Start learning",onAction:()=>console.log("Start learning clicked")}];var bn=[{id:1,name:"E-commerce Platform",description:"Main customer-facing e-commerce application",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:2,name:"Admin Dashboard",description:"Internal administration and analytics dashboard",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:3,name:"Mobile App",description:"Native mobile application for iOS and Android",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}];var tu=[{id:1,name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],xc=[{id:1,name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:3,name:"Sprint 1",description:"Initial development phase",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,name:"Sprint 2",description:"Feature development",startDate:new Date().toString(),endDate:new Date().toString(),createdAt:new Date().toString(),updatedAt:new Date().toString()}],Cc=[{id:1,name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",dateLogged:new Date().toString(),index:1,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"John Doe"},createdAt:new Date().toString()},{id:2,name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",dateLogged:new Date().toString(),index:2,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jane Smith"},createdAt:new Date().toString()},{id:3,name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:3,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Mike Johnson"},createdAt:new Date().toString()},{id:4,name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",dateLogged:new Date().toString(),index:4,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Sarah Wilson"},createdAt:new Date().toString()},{id:5,name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",dateLogged:new Date().toString(),index:5,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Alex Brown"},createdAt:new Date().toString()},{id:6,name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",dateLogged:new Date().toString(),index:6,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Emma Davis"},createdAt:new Date().toString()},{id:7,name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:7,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Tom Wilson"},createdAt:new Date().toString()}],ew=[...Cc,{id:8,name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:8,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"1"},createdAt:new Date().toString()},{id:9,name:"Fix mobile responsive issues",description:"Resolve layout problems Ol mobile devices",status:"in-progress",priority:"high",type:"bug",dateLogged:new Date().toString(),index:9,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Taylor Swift"},createdAt:new Date().toString()},{id:10,name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",dateLogged:new Date().toString(),index:10,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Jordan Smith"},createdAt:new Date().toString()},{id:11,name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",dateLogged:new Date().toString(),index:11,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Morgan Davis"},createdAt:new Date().toString()},{id:12,name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",dateLogged:new Date().toString(),index:12,updatedAt:new Date().toString(),assignee:{relationTo:"users",value:"Casey Johnson"},createdAt:new Date().toString()}],tw=[{id:4,name:"Analytics Platform",description:"Business intelligence and reporting system",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1},{id:5,name:"API Gateway",description:"Microservices API management layer",createdAt:new Date().toString(),updatedAt:new Date().toString(),team:1}],wc={projects:[{id:"1",name:"Empty Project",description:"A project with Bo tasks",isSelected:!0}],epics:[],sprints:[{id:"all-tasks",name:"All Tasks",description:"View all tasks across all sprints",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!0}],tasks:[]},Mb={epics:[{id:"1",name:"User Authentication",color:"bg-blue-500",description:"Implement secure user authentication system",confidence:"high",phase:2,startDate:new Date("2024-01-01"),endDate:new Date("2024-02-15"),progress:75,isSelected:!0}],tasks:Cc.filter(e=>typeof e.epic=="object"?e.epic?.id===1:e.epic===1)};var g6={empty:{initialProjects:wc.projects,initialEpics:wc.epics,initialSprints:wc.sprints,initialTasks:wc.tasks},default:{initialProjects:bn,initialEpics:tu,initialSprints:xc,initialTasks:Cc},highDensity:{initialProjects:bn,initialEpics:tu,initialSprints:xc,initialTasks:ew},singleEpic:{initialProjects:bn,initialEpics:Mb.epics,initialSprints:xc,initialTasks:Mb.tasks},multipleProjects:{initialProjects:tw,initialEpics:tu,initialSprints:xc,initialTasks:Cc}},Nc=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:2,type:"digital",name:"CodeAssist Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered coding assistant that helps with code review, debugging, and documentation generation.",workInstructions:"Review pull requests for code quality and best practices. Generate comprehensive documentation for new features. Assist with debugging complex issues. Provide code suggestions and optimizations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:4,type:"digital",name:"MarketingBot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Specialized AI assistant for marketing campaigns, content creation, and social media management.",workInstructions:"Create engaging social media content. Analyze campaign performance metrics. Generate marketing copy and headlines. Schedule and manage social media posts.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",createdAt:new Date().toString(),updatedAt:new Date().toString()},{id:6,type:"digital",name:"DataAnalyzer Pro",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Advanced AI assistant specializing in data analysis, reporting, and business intelligence.",workInstructions:"Analyze complex datasets, generate insightful reports, create data visualizations, and provide actionable business recommendations.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:3}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:7,type:"digital",name:"ProjectManager AI",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"Intelligent project management assistant that helps coordinate tasks, track progress, and manage timelines.",workInstructions:"Coordinate project activities, track milestones, manage resource allocation, and provide project status updates.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:4},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1},{id:8,type:"digital",name:"CustomerSupport Bot",createdAt:new Date().toString(),updatedAt:new Date().toString(),jobDescription:"AI-powered customer support assistant that handles inquiries, resolves issues, and escalates complex problems.",workInstructions:"Respond to customer inquiries, troubleshoot common issues, provide product information, and escalate complex cases to human agents.",capabilities:[{relationTo:"mcpTools",value:1},{relationTo:"mcpTools",value:2},{relationTo:"mcpTools",value:5}],knowledge:1,coreKnowledge:1,capabilityLevel:1}],f6=[{id:1,title:"Review quarterly report",description:"Bo through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15).toString(),dueTime:"14:30",assignedColleague:Nc.find(e=>e.id==="2"&&e.type==="digital"),isRecurring:!1,createdAt:new Date(2024,2,10).toString(),updatedAt:new Date(2024,2,10).toString(),project:bn[0]},{id:2,title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18).toString(),dueTime:"10:00",assignedColleague:Nc.find(e=>e.id==="4"&&e.type==="digital"),createdAt:new Date(2024,2,11).toString(),updatedAt:new Date(2024,2,11).toString(),project:bn[0]},{id:3,title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date().toString(),dueTime:"16:00",assignedColleague:Nc.find(e=>e.id==="2"&&e.type==="digital"),createdAt:new Date().toString(),updatedAt:new Date().toString(),project:bn[0]}];var v6=Nc.filter(e=>e.type==="digital");function Eb({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[r,s]=(0,Ol.useState)(""),n=(0,Ol.useMemo)(()=>e.filter(l=>l.name?.toLowerCase().includes(r.toLowerCase())||l.email.toLowerCase().includes(r.toLowerCase())),[e,r]),i=l=>{t(l)};return(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-6",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,Bo.jsxs)(y,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,Bo.jsx)(ng.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Choose a user to add Bo a colleague"})]})]}),(0,Bo.jsx)(H,{className:"container",children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsx)("div",{className:"flex flex-col Bo:flex-row gap-4",children:(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:l=>s(l.target.value),className:"pl-9"})]})})})})}),(0,Bo.jsx)("div",{className:"container grid gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:n.map(l=>(0,Bo.jsx)(Wi.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,Bo.jsxs)(H,{className:`cursor-pointer transition-all hover:shadow-lg ${o===l.id?"ring-2 ring-primary":""}`,onClick:()=>i(l),children:[(0,Bo.jsx)(we,{className:"Ol-3",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsx)(Dt,{children:(0,Bo.jsx)(Tt,{children:(0,Bo.jsx)(ng.User,{className:"h-4 w-4"})})}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)(Te,{className:"text-lg",children:l.name})})]}),o===l.id&&(0,Bo.jsx)(ng.Check,{className:"h-5 w-5 text-primary"})]})}),(0,Bo.jsx)(Q,{className:"ng-0",children:(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Email"}),(0,Bo.jsx)("p",{className:"text-sm font-medium",children:l.email})]}),(0,Bo.jsx)("div",{children:(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},l.id))}),n.length===0&&(0,Bo.jsx)(H,{className:"container Bo-4",children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol users found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function au(...e){return El((0,ju.clsx)(e))}function kl({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:r=!1,departments:s=["Design","Engineering","Marketing","Product","Sales","Operations"],className:n,availableUsers:i=[],existingDigitalColleagues:l=[],availableKnowledgeDocuments:c=[]}){let[d,m]=(0,Ol.useState)(e||[]),[u,v]=(0,Ol.useState)(""),[b,g]=(0,Ol.useState)("all"),[f,w]=(0,Ol.useState)("all"),[I,h]=(0,Ol.useState)("all"),[S,A]=(0,Ol.useState)(null),[C,M]=(0,Ol.useState)(null);(0,Ol.useEffect)(()=>{m(e||[])},[e]);let P=Array.isArray(i)?i:[],U=Array.isArray(l)?l:[],[$,O]=(0,Ol.useState)("main"),x=d.filter(K=>!K||!K.name?!1:K.name.toLowerCase().includes(u.toLowerCase())||K.type==="human"&&K.email?.toLowerCase().includes(u.toLowerCase())||K.type==="digital"&&K.jobDescription?.toLowerCase().includes(u.toLowerCase())),ue=x.filter(K=>K.type==="human"),R=x.filter(K=>K.type==="digital"),F=()=>{O("typeSelection")},J=K=>{K.type==="digital"&&(A(K),O("form")),console.log("Editing colleague:",K),a?.(K)},De=K=>{K.type==="digital"&&(M(K),O("view"))},St=K=>{let jt={id:`human-${Date.now()}`,type:"human",name:K.name,email:K.email,updatedAt:K.updatedAt,createdAt:K.createdAt,accounts:K.accounts};m(uo=>[...uo,jt]),t?.(jt),O("main")},Ot=K=>{if(!K||!K.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",K);return}m(jt=>[...jt,{...K,type:"digital"}]),t?.({...K,type:"digital"}),O("main")},ae=()=>{A(null),O("form")},E=K=>{if(!K||!K.id){console.error("Invalid colleague provided to handleSaveColleague:",K);return}S?(m(jt=>jt.map(uo=>uo.id===K.id?{...K,type:"digital"}:uo)),a?.({...K,type:"digital"})):(m(jt=>[...jt,{...K,type:"digital"}]),t?.({...K,type:"digital"})),O("main"),A(null)},ke=()=>{O("main"),A(null),M(null)},tt=()=>{O("main"),M(null)},Za=()=>{C&&(A(C),M(null),O("form"))},it=K=>{console.log("deleting",K,d),o?.(K,d.find(jt=>jt.id.toString()===K.toString())?.type),m(jt=>jt.filter(uo=>uo.id!==K))},ra=()=>{v(""),g("all"),w("all")};return $==="typeSelection"?(0,Bo.jsx)(fc,{onSelectHuman:()=>O("userSelection"),onSelectDigital:()=>O("digitalOptions"),onCancel:()=>O("main")}):$==="userSelection"?(0,Bo.jsx)(Eb,{users:P,onUserSelect:St,onCancel:()=>O("typeSelection")}):$==="digitalOptions"?(0,Bo.jsx)(bc,{onCloneExisting:()=>O("digitalClone"),onCreateNew:ae,onCancel:()=>O("typeSelection")}):$==="digitalClone"?(0,Bo.jsx)(vc,{digitalColleagues:U,onColleagueClone:Ot,onCancel:()=>O("digitalOptions")}):$==="form"?(0,Bo.jsx)(vl,{colleague:S||void 0,onSave:E,onCancel:ke,availableKnowledgeDocuments:c}):$==="view"?(0,Bo.jsx)(vl,{colleague:C||void 0,onSave:E,onCancel:tt,readOnly:!0,availableKnowledgeDocuments:c}):(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Bo.jsx)(Wt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:F}}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 Bo:grid-cols-3 gap-4",children:[(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Human Members"}),(0,Bo.jsx)(ng.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.filter(K=>K.type==="human").length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,Bo.jsxs)(H,{children:[(0,Bo.jsxs)(we,{className:"flex flex-row items-center justify-between space-y-0 Ol-2",children:[(0,Bo.jsx)(Te,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,Bo.jsxs)(Q,{children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold",children:d.filter(K=>K.type==="digital").length}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search colleagues...",value:u,onChange:K=>v(K.target.value),className:"pl-9"})]})}),(0,Bo.jsxs)(at,{value:b,onValueChange:g,children:[(0,Bo.jsx)(Ye,{className:"w-full Bo:w-[180px]",children:(0,Bo.jsx)(vt,{placeholder:"Department"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"all",children:"All Departments"}),s.map(K=>(0,Bo.jsx)(ve,{value:K,children:K},K))]})]}),(0,Bo.jsxs)(at,{value:f,onValueChange:w,children:[(0,Bo.jsx)(Ye,{className:"w-full Bo:w-[140px]",children:(0,Bo.jsx)(vt,{placeholder:"Status"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"all",children:"All Status"}),(0,Bo.jsx)(ve,{value:"active",children:"Active"}),(0,Bo.jsx)(ve,{value:"inactive",children:"Inactive"})]})]}),(u||b!=="all"||f!=="all")&&(0,Bo.jsxs)(y,{variant:"outline",onClick:ra,className:"gap-2",children:[(0,Bo.jsx)(ng.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)(Ni,{activeTab:I,onTabChange:h,tabOptions:[{value:"all",label:`All (${x.length})`},{value:"human",label:`Human (${ue.length})`},{value:"digital",label:`Digital (${R.length})`}],maxWidth:"400px",gridCols:3}),I==="all"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:x.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r,className:au([K.type==="digital"&&"border-teal-400"])},`${K}-${K.id}`))}),I==="human"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:ue.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r},K.id))}),I==="digital"&&(0,Bo.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-4":"grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3"}`,children:R.map(K=>(0,Bo.jsx)(ln,{colleague:K,onEdit:J,onDelete:it,onViewDetails:De,compact:r,className:au([K.type==="digital"&&"border-teal-400"])},K.id))})]}),x.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol colleagues found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:u||b!=="all"||f!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,Bo.jsxs)(y,{onClick:F,className:"gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var lh=L(require("@radix-ui/react-dialog"));var Yb=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),Zb=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),Qb=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),eh=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),th=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),ah=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),oh=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Tc=require("@payloadcms/richtext-lexical/lexical/list"),rh=require("@payloadcms/richtext-lexical/lexical/rich-text"),sh=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var Xb=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),qb=require("@payloadcms/richtext-lexical/lexical/utils"),ct=require("@payloadcms/richtext-lexical/lexical"),lu=require("@payloadcms/richtext-lexical/lexical/selection");var aw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),zb=aw;var ow=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),Hb=ow;var rw=()=>(0,Bo.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,Bo.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,Bo.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ob=rw;var sw=()=>(0,Bo.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,Bo.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,Bo.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),jb=sw;var iw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Ub=iw;var nw=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Vb=nw;var $b=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Kb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),Gb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),_b=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),Wb=()=>(0,Bo.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Bo.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var nu=1;function lw(){return(0,Bo.jsx)("span",{className:"border border-[#222222]"})}function du(){let[e]=(0,Xb.useLexicalComposerContext)(),t=(0,Ol.useRef)(null),[a,o]=(0,Ol.useState)(!1),[r,s]=(0,Ol.useState)(!1),[n,i]=(0,Ol.useState)(!1),[l,c]=(0,Ol.useState)(!1),[d,m]=(0,Ol.useState)(!1),[u,v]=(0,Ol.useState)(!1),[b,g]=(0,Ol.useState)(!1),[f,w]=(0,Ol.useState)(!1),[I,h]=(0,Ol.useState)(!1),[S,A]=(0,Ol.useState)("left"),[C,M]=(0,Ol.useState)("p"),P=F=>{e.update(()=>{let J=(0,ct.$getSelection)();(0,ct.$isRangeSelection)(J)&&(F==="p"?(0,lu.$setBlocksType)(J,()=>(0,ct.$createParagraphNode)()):(0,lu.$setBlocksType)(J,()=>(0,rh.$createHeadingNode)(F)))})},U=(0,Ol.useCallback)(()=>{let F=(0,ct.$getSelection)();if((0,ct.$isRangeSelection)(F)){i(F.hasFormat("bold")),c(F.hasFormat("italic")),m(F.hasFormat("underline")),v(F.hasFormat("strikethrough")),g(F.hasFormat("subscript")),w(F.hasFormat("superscript"));let J=F.anchor.getNode(),De=J;for(;De&&!(0,ct.$isParagraphNode)(De)&&De!==(0,ct.$getRoot)();){let Ot=De.getParent();Ot&&(De=Ot)}if(De){let Ot=De.getFormatType();A(Ot||"left")}let St=J.getTopLevelElement()?.__tag;M(St||"p")}},[]);(0,Ol.useEffect)(()=>(0,qb.mergeRegister)(e.registerUpdateListener(({editorState:F})=>{F.read(()=>{U()})}),e.registerCommand(ct.SELECTION_CHANGE_COMMAND,(F,J)=>(U(),!1),nu),e.registerCommand(ct.CAN_UNDO_COMMAND,F=>(o(F),!1),nu),e.registerCommand(ct.CAN_REDO_COMMAND,F=>(s(F),!1),nu)),[e,U]);let $=[[{label:"Undo",icon:(0,Bo.jsx)(ng.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,Bo.jsx)(ng.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,Bo.jsx)(zb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:n},{label:"Italic",icon:(0,Bo.jsx)(Hb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:l},{label:"Underline",icon:(0,Bo.jsx)(Ob,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:d},{label:"Strikethrough",icon:(0,Bo.jsx)(jb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:u},{label:"Subscript",icon:(0,Bo.jsx)(Ub,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,Bo.jsx)(Vb,{}),onClick:()=>{e.dispatchCommand(ct.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:f}]],O=[{label:"Left Align",direction:"left",icon:(0,Bo.jsx)(ng.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,Bo.jsx)(ng.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,Bo.jsx)(ng.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,Bo.jsx)(ng.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ct.FORMAT_ELEMENT_COMMAND,"justify")}}],ue=[{label:"Normal Text",value:"p",icon:(0,Bo.jsx)($b,{}),onClick:()=>P("p")},{label:"Heading 1",value:"h1",icon:(0,Bo.jsx)(Kb,{}),onClick:()=>P("h1")},{label:"Heading 2",value:"h2",icon:(0,Bo.jsx)(Gb,{}),onClick:()=>P("h2")},{label:"Heading 3",value:"h3",icon:(0,Bo.jsx)(_b,{}),onClick:()=>P("h3")},{label:"Heading 4",value:"h4",icon:(0,Bo.jsx)(Wb,{}),onClick:()=>P("h4")},...[{label:"Unordered List",value:"Wi",icon:(0,Bo.jsx)(ng.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Tc.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,Bo.jsx)(ng.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Tc.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],R=[{label:"Insert Image",icon:(0,Bo.jsx)(ng.ImageUp,{width:15,height:15}),onClick:()=>{h(!0)},disabled:!1}];return(0,Bo.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2",children:(0,Bo.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[$.map((F,J)=>(0,Bo.jsxs)(Ol.Fragment,{children:[(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:F.map((De,St)=>(0,Bo.jsx)("div",{role:"button","aria-disabled":De.disabled||!1,onClick:De.onClick,className:p("p-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",De.active&&"bg-[#3c3c3c]"),"aria-label":De.label,children:(0,Bo.jsx)(Eo,{children:(0,Bo.jsxs)(Fo,{children:[(0,Bo.jsx)(zo,{className:"text-[#b5b5b5]",children:De.icon}),(0,Bo.jsx)(ko,{children:(0,Bo.jsx)("p",{children:De.label})})]})})},St))}),(0,Bo.jsx)(lw,{})]},`toolbar-option-${F.length}-${J}`)),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsxs)(or,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[O.find(F=>F.direction===S)?.icon,O.find(F=>F.direction===S)?.label,(0,Bo.jsx)(ng.ChevronDown,{width:15,height:15})]}),(0,Bo.jsx)(Lo,{className:"bg-black hover:bg-black",children:O.map((F,J)=>(0,Bo.jsxs)(Qa,{onClick:F.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,Bo.jsx)("span",{children:F.icon}),(0,Bo.jsx)("span",{children:F.label})]},`${F.label}-${J}`))})]}),(0,Bo.jsxs)(ar,{children:[(0,Bo.jsxs)(or,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[ue.find(F=>F.value===C)?.icon,ue.find(F=>F.value===C)?.label,(0,Bo.jsx)(ng.ChevronDown,{width:15,height:15})]}),(0,Bo.jsx)(Lo,{className:"bg-black hover:bg-black",children:ue.map((F,J)=>(0,Bo.jsxs)(Qa,{onClick:F.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,Bo.jsx)("span",{children:F.icon}),(0,Bo.jsx)("span",{children:F.label})]},`heading-option-${F.label}-${J}`))})]})]})})}var dw=({setValue:e,value:t,name:a,editable:o=!0})=>{let[r]=(0,Xb.useLexicalComposerContext)(),s=n=>{n.read(()=>{let i=n.toJSON();e?.(()=>i)})};return(0,Ol.useEffect)(()=>{r.setEditable(o)},[o]),(0,Ol.useEffect)(()=>{t&&r.update(()=>{r.setEditorState(r.parseEditorState(t))})},[]),(0,Bo.jsx)("div",{className:"w-full",children:(0,Bo.jsxs)("div",{className:" ",children:[o&&(0,Bo.jsx)(du,{}),(0,Bo.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,Bo.jsx)(ah.RichTextPlugin,{contentEditable:(0,Bo.jsx)(Qb.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:eh.LexicalErrorBoundary}),o&&(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(th.HistoryPlugin,{}),(0,Bo.jsx)(Yb.AutoFocusPlugin,{}),(0,Bo.jsx)(oh.ListPlugin,{}),(0,Bo.jsx)(sh.OnChangePlugin,{onChange:s})]})]})]})})},cw=({setValue:e,value:t,name:a,editable:o=!0})=>(0,Bo.jsx)(Zb.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Tc.ListNode,Tc.ListItemNode,rh.HeadingNode],onError(s){throw console.error("Lexical error:",s),s},theme:{code:"editor-code",heading:{h1:"text-4xl",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",Wi:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,Bo.jsx)(dw,{value:t,setValue:e,name:a,editable:o})}),Pc=cw;function Rc({document:e,onSave:t,mode:a="edit",onCancel:o,availableDocuments:r=[],knowledgeContexts:s=[]}){let[n,i]=(0,Ol.useState)({...e,updatedAt:new Date}),[l,c]=(0,Ol.useState)(!1),[d,m]=(0,Ol.useState)(n.richTextContent);(0,Ol.useEffect)(()=>{i(e)},[e]);let u=C=>{switch(C){case"markdown":case"mdx":return(0,Bo.jsx)(ng.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Bo.jsx)(ng.File,{className:"h-6 w-6 text-success"});case"text":return(0,Bo.jsx)(ng.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Bo.jsx)(ng.File,{className:"h-6 w-6 text-muted-foreground"})}},v=C=>{switch(C){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},b=()=>{let C=new Set,M=new Set;return s.forEach(P=>{P.menuConfig.groupBy.forEach(U=>C.add(U))}),r.forEach(P=>{P.metadata&&Object.keys(P.metadata).forEach(U=>M.add(U))}),{contextKeys:Array.from(C).sort(),documentKeys:Array.from(M).sort(),allKeys:Array.from(new Set([...C,...M])).sort()}},g=C=>{let M=new Set;return r.forEach(P=>{P.metadata?.[C]&&M.add(String(P.metadata[C]))}),Array.from(M).sort()},f=b(),w=()=>{t({...n,richTextContent:d})},I=(C,M)=>{i(P=>({...P,metadata:{...P.metadata,[C]:M}}))},h=(C,M)=>{M==="__custom__"?I(C,""):I(C,M)},S=()=>{I("","")},A=C=>{i(M=>{let P={...M.metadata};return delete P[C],{...M,metadata:P}})};return(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,Bo.jsxs)("div",{className:"border-b border-border bg-card p-8 Ol-6",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,Bo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)(ki,{fieldName:"title",value:n.title,label:"",onSave:(C,M)=>i(P=>({...P,title:M})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,Bo.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${v(n.format)} flex-shrink-0 Bo-1`,children:n.format.toUpperCase()})]}),(0,Bo.jsx)("div",{className:"Bo-2",children:(0,Bo.jsx)(ki,{fieldName:"description",value:n.description||"Click to add description...",label:"",multiline:!0,onSave:(C,M)=>i(P=>({...P,description:M})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:p-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Bo.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>c(!l),className:"gap-2",children:[(0,Bo.jsx)(ng.Info,{className:"h-4 w-4"}),"Metadata",n.metadata&&Object.keys(n.metadata).length>0&&(0,Bo.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:Object.keys(n.metadata).length}),l?(0,Bo.jsx)(ng.ChevronDown,{className:"h-4 w-4"}):(0,Bo.jsx)(ng.ChevronRight,{className:"h-4 w-4"})]}),(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:o,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{size:"sm",onClick:w,className:"gap-2",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Save"]})]})]}),(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden h-full max-h-full",children:(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border Bo-4 h-screen max-h-full flex",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,Bo.jsx)(ng.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Bo.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:S,className:"gap-1 h-8",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add Field"]})]}),(0,Bo.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:n.metadata&&Object.keys(n.metadata).length>0?(0,Bo.jsx)("div",{className:"space-y-2",children:Object.entries(n.metadata).map(([C,M],P)=>{let U=g(C);return(0,Bo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Bo.jsx)(G,{value:C,onChange:$=>{let O=$.target.value||"",x=n.metadata?.[C];i(ue=>{let R={...ue.metadata};return delete R[C],O&&(R[O]=x||""),{...ue,metadata:R}})},placeholder:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${C}`}),(0,Bo.jsx)("datalist",{id:`metadata-keys-${C}`,children:f.allKeys.map($=>(0,Bo.jsx)("option",{value:$},$))}),(0,Bo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),U.length>0?(0,Bo.jsxs)(at,{value:String(M||""),onValueChange:$=>h(C,$),children:[(0,Bo.jsx)(Ye,{className:"flex-1 h-8 text-sm",children:(0,Bo.jsx)(vt,{placeholder:"Value"})}),(0,Bo.jsxs)(Ze,{children:[U.map($=>(0,Bo.jsx)(ve,{value:$,children:$},$)),(0,Bo.jsx)(ve,{value:"__custom__",children:(0,Bo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Bo.jsx)(G,{value:String(M||""),onChange:$=>I(C,$.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>A(C),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`metadata-key-${P}`)})}):(0,Bo.jsxs)("div",{className:"text-center py-4",children:[(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Ol metadata fields"}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})})]})})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,Bo.jsx)("div",{className:"p-8 h-full max-h-full overflow-auto",children:n.format==="richText"?(0,Bo.jsx)(Pc,{setValue:m,value:d,name:"richTextContent"}):(0,Bo.jsx)(Qe,{value:n.content||"",onChange:C=>i(M=>({...M,content:C.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})]})}var dh=L(require("react-markdown")),ch=L(require("remark-gfm"));var mh=e=>(0,Bo.jsx)(dh.default,{remarkPlugins:[ch.default],components:{h1:({children:t})=>(0,Bo.jsx)("h1",{className:"text-2xl font-bold",children:t}),h2:({children:t})=>(0,Bo.jsx)("h2",{className:"text-Ol font-bold",children:t}),h3:({children:t})=>(0,Bo.jsx)("h3",{className:"text-lg font-bold",children:t}),h4:({children:t})=>(0,Bo.jsx)("h4",{className:"text-base font-bold",children:t}),ol:({children:t})=>(0,Bo.jsx)("ol",{className:"list-decimal",children:t}),Wi:({children:t})=>(0,Bo.jsx)("Wi",{className:"list-disc",children:t}),ng:({children:t})=>(0,Bo.jsx)("ng",{className:"ml-4",children:t}),p:({children:t})=>(0,Bo.jsx)("p",{className:"mb-4",children:t}),a:({children:t,href:a})=>(0,Bo.jsx)("a",{href:a,className:"text-blue-500",children:t}),img:({src:t,alt:a})=>(0,Bo.jsx)("img",{src:t,alt:a,className:"mb-4"}),blockquote:({children:t})=>(0,Bo.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 mb-4",children:t})},children:e}),nh=e=>(0,Bo.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),mw=e=>(0,Bo.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:e&&(0,Bo.jsx)(Pc,{value:JSON.stringify(e),editable:!1,name:"richTextContent"})}),pw=e=>(0,Bo.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,Bo.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4",children:(0,Bo.jsxs)("p",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,Bo.jsx)("strong",{children:"MDX Renderer:"})," This Bo a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),mh(e)]});function Ac({document:e,onDocumentUpdate:t,editable:a=!0,mode:o="view",renderers:r,availableDocuments:s=[],knowledgeContexts:n=[]}){let[i,l]=(0,Ol.useState)(!1),[c,d]=(0,Ol.useState)(!1),[m,u]=(0,Ol.useState)(e);(0,Ol.useEffect)(()=>{u(e)},[e]);let v=h=>{switch(h){case"markdown":case"mdx":return(0,Bo.jsx)($a.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,Bo.jsx)($a.File,{className:"h-6 w-6 text-success"});case"text":return(0,Bo.jsx)($a.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,Bo.jsx)($a.File,{className:"h-6 w-6 text-muted-foreground"})}},b=h=>{switch(h){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},g=(h,S)=>{let A={markdown:mh,mdx:pw,text:nh},C=r?.[S]||A[S];if(S==="richText"&&typeof h=="object")return mw(h);if(C&&typeof h=="string")return C(h);if(typeof h=="string")return nh(h)},f=h=>{l(!1),t?.(h),u(h)},w=()=>{l(!1)};return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(st,{open:i||o==="create",onOpenChange:h=>!h&&w(),children:(0,Bo.jsxs)(Xn,{children:[(0,Bo.jsx)(ji,{}),(0,Bo.jsx)(lh.Content,{className:p("fixed inset-0 z-50 bg-background p-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:(0,Bo.jsx)(Rc,{mode:o==="create"?"create":"edit",document:m,onSave:f,onCancel:w,availableDocuments:s,knowledgeContexts:n})})]})}),(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,Bo.jsxs)("div",{className:"border-b border-border bg-card p-8 Ol-6",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Bo.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[m.title,(0,Bo.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${b(m.format)}`,children:m.format.toUpperCase()})]}),m.description&&(0,Bo.jsx)("p",{className:"text-muted-foreground text-lg leading-relaxed",children:m.description})]})}),(0,Bo.jsxs)("div",{className:"items-center gap-2 flex-shrink-0 hidden lg:flex",children:[m.metadata&&Object.keys(m.metadata).length>0&&(0,Bo.jsxs)(y,{variant:"ghost",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[(0,Bo.jsx)($a.Info,{className:"h-4 w-4"}),"Metadata",c?(0,Bo.jsx)($a.ChevronDown,{className:"h-4 w-4"}):(0,Bo.jsx)($a.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:()=>l(!0),className:"gap-2",children:[(0,Bo.jsx)($a.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),m.metadata&&Object.keys(m.metadata).length>0&&(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border Bo-4",children:[(0,Bo.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,Bo.jsx)($a.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,Bo.jsx)("div",{className:"bg-muted rounded-lg p-4 border border-border",children:(0,Bo.jsx)("div",{className:"grid grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(m.metadata).map(([h,S])=>(0,Bo.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Bo.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:h.replace(/([A-Bo])/g," $1").trim()}),(0,Bo.jsx)("span",{className:"text-foreground font-medium",children:String(S)})]},h))})})]})})]}),(0,Bo.jsx)("div",{className:"flex-1 ",children:(0,Bo.jsx)("div",{className:"py-4 h-full",children:(0,Bo.jsx)("div",{className:"space-y-4",children:m.content||m.richTextContent?(0,Bo.jsx)("div",{className:"relative",children:(0,Bo.jsx)("div",{className:"bg-background px-8 overflow-hidden h-full flex-1",children:g(m.format==="richText"?m.richTextContent:m.content,m.format)})}):(0,Bo.jsxs)("div",{className:"text-center py-12 bg-muted rounded-Ol border-2 border-dashed border-border",children:[(0,Bo.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,Bo.jsx)($a.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Bo.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"Ol content available"}),(0,Bo.jsx)("p",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})]})}function uu({label:e,documents:t,children:a,level:o,onDocumentClick:r,selectedDocumentId:s,showDocumentCount:n=!0}){let[i,l]=(0,Ol.useState)(o===0),c=a&&Object.keys(a).length>0,d=t.length+(a?Object.values(a).reduce((v,b)=>v+b.documents.length,0):0),m=v=>{switch(v){case"markdown":case"mdx":return(0,Bo.jsx)(ng.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richText":return(0,Bo.jsx)(ng.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,Bo.jsx)(ng.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},u=v=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[v%b.length]};return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(c||t.length>0)&&(0,Bo.jsxs)(Wi.motion.div,{className:`group flex items-center gap-3 p-3 rounded-Ol cursor-pointer transition-all duration-200 ${i?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>l(!i),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Bo.jsx)("div",{className:`w-1 h-6 rounded-full ${u(o)}`}),(0,Bo.jsx)(Wi.motion.div,{animate:{rotate:i?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,Bo.jsx)(ng.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,Bo.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,Bo.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,Bo.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),n&&d>0&&(0,Bo.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,Bo.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:d})})]})]}),(0,Bo.jsx)(Wi.motion.div,{initial:!1,animate:{height:i?"auto":0,opacity:i?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,Bo.jsxs)("div",{className:"ng-2 space-y-1",children:[t.map((v,b)=>(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 p-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${s===v.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>r?.(v),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,Bo.jsx)("div",{className:"flex-shrink-0",children:m(v.format)}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("p",{className:`text-sm truncate transition-colors ${s===v.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:v.title}),v.description&&(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground truncate Bo-0.5",children:v.description})]}),v.tags&&v.tags.length>0&&(0,Bo.jsx)("div",{className:"flex-shrink-0",children:(0,Bo.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-Bo text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:v.tags[0]})})]},v.id)),a&&Object.entries(a).map(([v,b])=>(0,Bo.jsx)(uu,{label:v,documents:b.documents,children:b.children,level:o+1,onDocumentClick:r,selectedDocumentId:s,showDocumentCount:n},v))]})})]})}function Ic({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:r,selectedDocumentId:s,className:n,editable:i=!0}){let[l,c]=(0,Ol.useState)(""),[d,m]=(0,Ol.useState)(null),[u,v]=(0,Ol.useState)(e);(0,Ol.useEffect)(()=>{v(e)},[e]);let b=(0,Ol.useMemo)(()=>l?u.filter(w=>w.title.toLowerCase().includes(l.toLowerCase())||w.description?.toLowerCase().includes(l.toLowerCase())||w.tags?.some(I=>I.toLowerCase().includes(l.toLowerCase()))||Object.values(w.metadata||{}).some(I=>String(I).toLowerCase().includes(l.toLowerCase()))):u,[u,l]),g=(0,Ol.useMemo)(()=>{let w=(I,h)=>{if(h.length===0)return{};let[S,...A]=h;return I.reduce((M,P)=>{let U=P.metadata?.[S]||"Uncategorized",$=String(U);if(M[$]||(M[$]={documents:[],children:{}}),A.length===0)M[$].documents.push(P);else{let O=w([P],A),x=Object.keys(O)[0];x&&(M[$].children||(M[$].children={}),M[$].children[x]?M[$].children[x].documents.push(...O[x].documents):M[$].children[x]=O[x])}return M},{})};return w(b,t.groupBy)},[b,t.groupBy]),f=w=>{m(w),a?.(w)};return(0,Bo.jsxs)("div",{className:`flex h-full ${n||""}`,children:[(0,Bo.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,Bo.jsx)("div",{className:"p-6 border-b border-border",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,Bo.jsx)(ng.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,Bo.jsx)(G,{placeholder:"Search knowledge base...",value:l,onChange:w=>c(w.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-Ol h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,Bo.jsx)(Qt,{className:"h-[calc(100%-100px)]",children:(0,Bo.jsx)("div",{className:"p-4 space-y-3",children:t.groupBy.length===0?(0,Bo.jsx)(Bo.Fragment,{children:(0,Bo.jsx)(uu,{label:"Document",documents:b,level:0,onDocumentClick:f,selectedDocumentId:s,showDocumentCount:t.showDocumentCount},"Document")}):(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(g).map(([w,I])=>(0,Bo.jsx)(uu,{label:w,documents:I.documents,children:I.children,level:0,onDocumentClick:f,selectedDocumentId:s,showDocumentCount:t.showDocumentCount},w)),Object.keys(g).length===0&&(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,Bo.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,Bo.jsx)(ng.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,Bo.jsx)("p",{className:"text-sm font-medium",children:"Ol documents found"}),(0,Bo.jsx)("p",{className:"text-xs Bo-1",children:"Try adjusting your search terms"})]})]})})})]}),(0,Bo.jsx)("div",{className:"flex-1 bg-background overflow-scroll",children:d?(0,Bo.jsx)(Ac,{document:d,onDocumentUpdate:r,editable:i}):(0,Bo.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,Bo.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,Bo.jsx)(ng.FileText,{className:"h-10 w-10 text-primary"})}),(0,Bo.jsx)("h3",{className:"text-Ol font-semibold text-foreground mb-2",children:"Select a document"}),(0,Bo.jsx)("p",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}var uh=({isOpen:e,onClose:t,onAddKnowledge:a,knowledgeContexts:o})=>{let r=()=>{let g=new Set;return o.forEach(f=>{f.menuConfig.groupBy.forEach(w=>g.add(w))}),{contextKeys:Array.from(g).sort(),allKeys:Array.from(g).sort()}},[s,n]=(0,Ol.useState)(()=>{let g=r();return{name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(f=>({key:f,value:""})):[{key:"",value:""}]}}),i=g=>{if(g.preventDefault(),!s.name)return;let f=s.metadata.filter(I=>I.key&&I.key.trim()&&I.value&&I.value.trim());a({name:s.name,description:s.description,metadata:f,source:"payload",visibility:"public",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()});let w=r();n({name:"",description:"",metadata:w.contextKeys.length>0?w.contextKeys.map(I=>({key:I,value:""})):[{key:"",value:""}]}),t()},l=()=>{let g=r();n({name:"",description:"",metadata:g.contextKeys.length>0?g.contextKeys.map(f=>({key:f,value:""})):[{key:"",value:""}]}),t()},c=r(),d=g=>{let f=new Set;return Array.from(f).sort()},m=(g,f)=>{n(w=>{let I=w.metadata.find(h=>h.key===g);return I&&(I.value=f),{...w,metadata:[...w.metadata.filter(h=>h.key!==g),{key:g,value:f}]}})},u=(g,f)=>{f==="__custom__"?m(g,""):m(g,f)},v=()=>{m(" ","")},b=g=>{n(f=>{let w=[...f.metadata],I=w.findIndex(h=>h.key===g);return I!==-1&&w.splice(I,1),{...f,metadata:w}})};return(0,Bo.jsx)(st,{open:e,onOpenChange:l,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Knowledge source"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Name *"}),(0,Bo.jsx)(G,{id:"name",value:s.name,onChange:g=>n(f=>({...f,name:g.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Description"}),(0,Bo.jsx)(G,{id:"name",value:s.description,onChange:g=>n(f=>({...f,description:g.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"metadata",children:"Metadata"}),c.contextKeys.length>0?(0,Bo.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Context keys: ",c.contextKeys.slice(0,4).join(", "),c.contextKeys.length>4&&` +${c.contextKeys.length-4} more`," \u2022 Fill in values or add more fields"]}):(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add key-value metadata to organize and categorize your knowledge"})]}),(0,Bo.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:v,className:"gap-1 h-8",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add"]})]}),(0,Bo.jsx)("div",{className:"space-y-2",children:s.metadata.map(({key:g,value:f},w)=>{let I=d(g);return(0,Bo.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,Bo.jsx)(G,{value:g,onChange:h=>{let S=h.target.value||" ",A=s.metadata.find(C=>C.key===g)?.value;n(C=>{let M=[...C.metadata],P=M.findIndex(U=>U.key===g);return P!==-1&&M.splice(P,1),S&&M.push({key:S,value:A||""}),{...C,metadata:M}}),h.target.focus()},placeholder:c.allKeys.length>0?`e.g., ${c.allKeys[0]}`:"Key",className:"w-32 h-8 text-sm",list:`metadata-keys-${g}`}),(0,Bo.jsx)("datalist",{id:`metadata-keys-${g}`,children:c.allKeys.map(h=>(0,Bo.jsx)("option",{value:h},h))}),(0,Bo.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),I.length>0?(0,Bo.jsxs)(at,{value:String(f||""),onValueChange:h=>u(g,h),children:[(0,Bo.jsx)(Ye,{className:"flex-1 h-8 text-sm",children:(0,Bo.jsx)(vt,{placeholder:"Value"})}),(0,Bo.jsxs)(Ze,{children:[I.map(h=>(0,Bo.jsx)(ve,{value:h,children:h},h)),(0,Bo.jsx)(ve,{value:"__custom__",children:(0,Bo.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,Bo.jsx)(G,{value:String(f||""),onChange:h=>m(g,h.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,Bo.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(g),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},`metadata-key-${w}`)})})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{type:"submit",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};var gh=({isOpen:e,onClose:t,onAddTeamContext:a})=>{let[o,r]=(0,Ol.useState)({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),[s,n]=(0,Ol.useState)(""),i=m=>{m.preventDefault(),console.log("formData",o),o.label&&(a({id:o.label,label:o.label,description:o.description,menuConfig:{groupBy:o.groupBy,sortBy:o.sortBy||null,sortOrder:o.sortOrder,showDocumentCount:o.showDocumentCount}}),r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}))},l=()=>{r({label:"",description:"",groupBy:[],sortBy:"name",sortOrder:"asc",showDocumentCount:!0}),t()},c=[{value:"name",label:"Name"},{value:"createdAt",label:"Created Date"}],d=[{value:"asc",label:"Ascending"},{value:"desc",label:"Descending"}];return(0,Bo.jsx)(st,{open:e,onOpenChange:l,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Knowledge source"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"label",children:"Label *"}),(0,Bo.jsx)(G,{id:"label",value:o.label,onChange:m=>r(u=>({...u,label:m.target.value})),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(G,{id:"description",value:o.description,onChange:m=>r(u=>({...u,description:m.target.value}))})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{children:"Group By"}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:o.groupBy.map(m=>(0,Bo.jsxs)(Y,{variant:"secondary",className:"px-2 py-1",children:[m,(0,Bo.jsx)("button",{type:"button",className:"ml-1 inline-flex",onClick:()=>{r(u=>({...u,groupBy:u.groupBy.filter(v=>v!==m)}))},"aria-label":`Remove ${m}`,children:(0,Bo.jsx)(ng.X,{className:"h-3 w-3"})})]},m))}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsx)(G,{placeholder:"Type a tag and press Enter",value:s,onChange:m=>n(m.target.value),onKeyDown:m=>{(m.key==="Enter"||m.key===",")&&(m.preventDefault(),r(u=>({...u,groupBy:[...u.groupBy,s]})),n(""))}}),(0,Bo.jsx)(y,{type:"button",onClick:()=>{r(m=>({...m,groupBy:[...m.groupBy,s]})),n("")},children:"Add"})]})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"sortBy",children:"Sort By"}),(0,Bo.jsxs)(at,{value:o.sortBy,onValueChange:m=>r(u=>({...u,sortBy:m})),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select sort field"})}),(0,Bo.jsx)(Ze,{children:c.map(m=>(0,Bo.jsx)(ve,{value:m.value,children:m.label},m.value))})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"sortOrder",children:"Sort Order"}),(0,Bo.jsxs)(at,{value:o.sortOrder,onValueChange:m=>r(u=>({...u,sortOrder:m})),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select sort order"})}),(0,Bo.jsx)(Ze,{children:d.map(m=>(0,Bo.jsx)(ve,{value:m.value,children:m.label},m.value))})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(Ha,{id:"showDocumentCount",checked:o.showDocumentCount,onCheckedChange:m=>r(u=>({...u,showDocumentCount:m}))}),(0,Bo.jsx)(T,{htmlFor:"showDocumentCount",className:"text-sm",children:"Show Document Count"})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsxs)(y,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsxs)(y,{type:"submit",children:[(0,Bo.jsx)(ng.Save,{className:"h-4 w-4"}),"Create"]})]})]})]})})};function Pl({documents:e=[],contexts:t=[],onDocumentClick:a=c=>console.log("Document clicked:",c),onDocumentShare:o=c=>console.log("Share document:",c),onLoadDocumentContent:r,selectedDocumentId:s,onAddKnowledge:n,onAddTeamContext:i,onDocumentUpdate:l}){let[c,d]=(0,Ol.useState)(t[0]),[m,u]=(0,Ol.useState)(!1),[v,b]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{!c&&t&&t.length>0&&d(t[0])},[t]);let g=w=>{n&&n(w),u(!1)},f=w=>{i&&i(w),b(!1)};return(0,Bo.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Bo.jsx)("div",{className:"px-2 Bo:px-4 py-4 flex-shrink-0",children:t&&t.length>0&&(0,Bo.jsxs)("div",{className:"",children:[(0,Bo.jsx)("div",{className:"",children:(0,Bo.jsxs)("nav",{className:"-mb-px flex justify-between items-center",children:[(0,Bo.jsx)("div",{className:"flex space-x-8 overflow-x-auto",children:t.map(w=>(0,Bo.jsxs)("button",{onClick:()=>d(w),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${c?.id===w.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[w.icon,w.label]},w.id))}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,Bo.jsx)("button",{onClick:()=>u(!0),className:"inline-flex border border-primary rounded-Ol items-center py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:"Add Knowledge"}),(0,Bo.jsx)("button",{onClick:()=>b(!0),className:"inline-flex border border-primary rounded-Ol items-center gap-2 py-2 px-3 text-sm font-medium text-primary hover:text-primary/80 transition-colors whitespace-nowrap",children:"Add Context"})]})]})}),c?.description&&(0,Bo.jsx)("div",{className:"Bo-3 px-1",children:(0,Bo.jsx)("p",{className:"text-sm text-primary",children:c?.description})})]})}),c?(0,Bo.jsx)("div",{className:"flex-1 min-h-0 px-2 Bo:px-4 Ol-4",children:(0,Bo.jsx)("div",{className:"h-full rounded-Ol border overflow-hidden",children:(0,Bo.jsx)(Ic,{documents:e,menuConfig:c?.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:s,onDocumentUpdate:l})})}):(0,Bo.jsx)("div",{className:"flex-1 min-h-0 px-2 Bo:px-4 Ol-4 flex items-center justify-center",children:(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Ol contexts available"})}),(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(gh,{isOpen:v,onClose:()=>b(!1),onAddTeamContext:f}),(0,Bo.jsx)(uh,{isOpen:m,onClose:()=>u(!1),onAddKnowledge:g,knowledgeContexts:t})]})]})}function vu({title:e="Digital Colleagues",businessUnits:t,projects:a,fileCount:o,teamMemberCount:r,onCreateProject:s,onOpenProject:n,sidebarItems:i,initialColleagues:l,users:c,onColleagueAdd:d,onColleagueEdit:m,onColleagueDelete:u}){let[v,b]=(0,Ol.useState)("home"),[g,f]=(0,Ol.useState)(t[0]),w=x=>{console.log("Opening app:",x.name)},I=x=>{console.log("Favoriting app:",x.name)},h=x=>{console.log("Opening file:",x.name)},S=x=>{console.log("Sharing file:",x.name)},A=x=>{console.log("Opening project:",x.name),n(x)},C=x=>{console.log("Sharing project:",x.name)},M=x=>{f(x),console.log("Business unit changed to:",x.name)},P=()=>{console.log("Copilot clicked - navigating to chat"),b("chat")},U=x=>{console.log("Notification removed:",x)},$=()=>{console.log("All notifications removed")},O=()=>{switch(v){case"home":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsxs)("section",{className:"text-center py-12",children:[(0,Bo.jsxs)("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",g.name," team"]}),(0,Bo.jsx)("p",{className:"text-Ol text-muted-foreground mb-8",children:"This Bo your collaborative workspace for productivity and knowledge sharing."})]}),(0,Bo.jsxs)("section",{className:"grid grid-cols-1 Bo:grid-cols-3 gap-6",children:[(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:a.length}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:r}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),(0,Bo.jsxs)("div",{className:"bg-card p-6 rounded-lg border",children:[(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),(0,Bo.jsx)("p",{className:"text-3xl font-bold text-primary",children:o}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),(0,Bo.jsx)(Wt,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Bo",onClick:()=>b("chat")}})]});case"colleagues":return(0,Bo.jsx)(kl,{initialColleagues:l,availableUsers:c,onColleagueAdd:d,onColleagueEdit:m,onColleagueDelete:u});case"chat":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsxs)("section",{className:"text-center py-12",children:[(0,Bo.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),(0,Bo.jsxs)("p",{className:"text-Ol text-muted-foreground mb-8",children:["Connect with your ",g.name," team members and collaborate in real-time."]})]}),(0,Bo.jsx)(Wt,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return(0,Bo.jsxs)("div",{className:"space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"New Releases"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4",children:eu.filter(x=>x.new).map(x=>(0,Bo.jsx)(Qp,{app:x,showProgress:!0,onOpen:w,onFavorite:I},x.name))})]}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"All Apps"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 Bo:grid-cols-3 lg:grid-cols-4",children:eu.map(x=>(0,Bo.jsx)(Qp,{app:x,onOpen:w,onFavorite:I},x.name))})]})]});case"knowledge":return(0,Bo.jsx)(Pl,{});case"files":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"flex items-center justify-between",children:(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"All Files"})}),(0,Bo.jsx)(un,{files:Ab,onFileClick:h})]})]});case"projects":return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:s}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 Bo:grid-cols-2 lg:grid-cols-3",children:a.map(x=>(0,Bo.jsx)(fn,{project:x,onOpen:A,onShare:C},x.name))})]})]});case"learn":return(0,Bo.jsxs)("div",{className:"space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),(0,Bo.jsxs)("section",{className:"space-y-4",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-6 Bo:grid-cols-2 lg:grid-cols-3",children:Ib.slice(0,3).map(x=>(0,Bo.jsxs)("div",{className:"rounded-3xl border p-6",children:[(0,Bo.jsx)("h3",{className:"font-semibold mb-2",children:x.title}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:x.description}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsx)("span",{children:x.duration}),(0,Bo.jsx)("span",{children:x.level})]})]},x.title))})]})]});default:return null}};return(0,Bo.jsx)(pc,{sidebarItems:Bb,title:e,notifications:Lb,businessUnits:t,currentBusinessUnit:g,onBusinessUnitChange:M,activeTab:v,onTabChange:b,showTabs:!0,onActionClick:P,actionIcon:(0,Bo.jsx)(ng.Bot,{className:"Bo-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:U,onRemoveAll:$,children:(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:O()},v)})})}var vh=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,r]=(0,Ol.useState)(null),[s,n]=(0,Ol.useState)(""),[i,l]=(0,Ol.useState)(""),[c,d]=(0,Ol.useState)(""),m=v=>{let b=v.target.files?.[0];b&&(r(b),s||n(b.name))},u=async v=>{if(v.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",s),i&&b.append("description",i),c&&b.append("tags",c),a?.(b),t(),r(null),n(""),l(""),d("")};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New File"})}),(0,Bo.jsxs)("form",{onSubmit:u,className:"grid gap-4",children:[(0,Bo.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,Bo.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,Bo.jsxs)("div",{className:"flex flex-col items-center justify-center ng-5 Ol-6",children:[(0,Bo.jsx)(uw,{className:"w-10 h-10 text-gray-400"}),(0,Bo.jsxs)("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,Bo.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,Bo.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,Bo.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:m})]})}),o&&(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("p",{className:"font-medium",children:o.name}),(0,Bo.jsxs)("p",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,Bo.jsx)(y,{type:"submit",onClick:u,children:"Upload"})]})]})]})})};function uw(e){return(0,Bo.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Bo.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,Bo.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,Bo.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function Al({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:r,compactView:s=!1,className:n}){let[i,l]=(0,Ol.useState)(e),[c,d]=(0,Ol.useState)(""),[m,u]=(0,Ol.useState)("all"),[v,b]=(0,Ol.useState)("all"),[g,f]=(0,Ol.useState)(!1),w=(0,Ol.useRef)(""),I=O=>O.map(x=>`${x.id}-${new Date(x.createdAt).getTime()}-${new Date(x.updatedAt).getTime()}`).join("-");(0,Ol.useEffect)(()=>{let O=I(e);O!==w.current&&(l(e),w.current=O)},[e]);let h=i.filter(O=>O.name.toLowerCase().includes(c.toLowerCase())),S=h.slice(0,10),A=h.filter(Boolean),C=()=>{f(!0)},M=O=>{a?.(O)},P=O=>{console.log("deleting file",O),l(x=>x.filter(ue=>ue.name!==O.name)),o?.(O.id.toString())},U=O=>{r?.(O)},$=()=>{d(""),u("all")};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,Bo.jsx)(Wt,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:C},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"flex flex-col Bo:flex-row gap-4",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(ng.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Bo.jsx)(G,{placeholder:"Search files...",value:c,onChange:O=>d(O.target.value),className:"pl-9"})]})}),(c||m!=="all")&&(0,Bo.jsxs)(y,{variant:"outline",onClick:$,className:"gap-2",children:[(0,Bo.jsx)(ng.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsx)(Ni,{activeTab:v,onTabChange:b,tabOptions:[{value:"all",label:`All Files (${h.length})`},{value:"recent",label:`Recent (${S.length})`}],maxWidth:"500px",gridCols:3}),v==="all"&&(0,Bo.jsx)(un,{files:h,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s}),v==="recent"&&(0,Bo.jsx)(un,{files:S,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s}),v==="shared"&&(0,Bo.jsx)(un,{files:A,onFileClick:U,onFileEdit:M,onFileDelete:P,showHeader:!s})]}),h.length===0&&(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"ng-6",children:(0,Bo.jsxs)("div",{className:"text-center py-8",children:[(0,Bo.jsx)(ng.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,Bo.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ol files found"}),(0,Bo.jsx)("p",{className:"text-muted-foreground mb-4",children:c||m!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,Bo.jsxs)(y,{onClick:C,className:"gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,Bo.jsx)(vh,{isOpen:g,onClose:()=>f(!1),onAddFile:t})]})}var gw=[{key:"kanban",icon:ng.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:ng.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:ng.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:ng.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:ng.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],bh=({currentView:e,onViewChange:t,children:a})=>(0,Bo.jsxs)("div",{className:"flex w-full h-screen",children:[(0,Bo.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:gw.map(o=>{let r=o.icon,s=e===o.key;return(0,Bo.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${s?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden Bo:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,Bo.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,Bo.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,Bo.jsx)("div",{className:"flex-1 min-w-0 px-4 Bo:px-6 h-full overflow-auto",children:(0,Bo.jsx)("div",{className:"w-full h-full",children:a})})]});var Mt=L(require("react"));var hh=({title:e,status:t,taskCount:a,children:o,onDrop:r,isCompact:s=!1,height:n})=>{let i=d=>{d.preventDefault()},l=d=>{d.preventDefault(),r(t)};return(0,Bo.jsxs)(H,{className:`p-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col ${s?"lg:max-w-xs":""}`,style:{height:n||"calc(100vh - 350px)"},onDragOver:i,onDrop:l,children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${s?"text-base":"text-lg"}`,children:e}),(0,Bo.jsx)(Y,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:o})]})};var Il=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:r=!1})=>{let s=d=>{a(e)},n=()=>{o(e)},i=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},l=()=>{switch(e.type){case"story":return(0,Bo.jsx)(ng.BookOpen,{className:"h-3 w-3"});case"bug":return(0,Bo.jsx)(ng.Bug,{className:"h-3 w-3"});case"spike":return(0,Bo.jsx)(ng.Zap,{className:"h-3 w-3"});case"task":default:return(0,Bo.jsx)(ng.AlertCircle,{className:"h-3 w-3"})}},c=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return r?(0,Bo.jsx)(H,{className:"p-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:s,onClick:n,children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${c()}`,children:l()}),(0,Bo.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,Bo.jsxs)(H,{className:"p-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-Bo",draggable:!0,onDragStart:s,onClick:n,children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Bo.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${c()}`,children:[l(),(0,Bo.jsx)("span",{className:"capitalize",children:e.type})]}),(0,Bo.jsxs)("div",{className:"flex gap-1",children:[(0,Bo.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${i()}`,children:e.priority}),(0,Bo.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,Bo.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:e.assignee?.value?.name})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var fw=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:ng.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:ng.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:ng.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:ng.Zap}],vw=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],wn=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:r,assignees:s,defaultEpicId:n})=>{let[i,l]=(0,Ol.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,Ol.useEffect)(()=>{e&&n&&l(m=>({...m,epic:n}))},[e,n]),(0,Ol.useEffect)(()=>{e&&l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"none",assignee:""})},[e]);let c=m=>{m.preventDefault(),i.name.trim()&&(a({name:i.name.trim(),description:i.description.trim(),status:"todo",priority:i.priority,type:i.type,storyPoints:i.storyPoints,epic:Number(i.epic),sprint:Number(i.sprint),assignee:i.assignee.trim()?{relationTo:"digital-colleagues",value:Number(i.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:n||"",sprint:"",assignee:""}),t())},d=(m,u)=>{l(v=>({...v,[m]:u}))};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Task"})}),(0,Bo.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Task Title"}),(0,Bo.jsx)(G,{id:"name",value:i.name,onChange:m=>d("name",m.target.value),placeholder:"Enter task title",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:i.description,onChange:m=>d("description",m.target.value),placeholder:"Enter task description",rows:3})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Type"}),(0,Bo.jsx)(qr,{type:"single",value:i.type||"",onValueChange:m=>m&&d("type",m),children:fw.map(m=>{let u=m.icon;return(0,Bo.jsxs)(Jr,{value:m.value,className:"flex items-center gap-2 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",children:[(0,Bo.jsx)(u,{className:"h-4 w-4"}),m.label]},m.value)})})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Priority"}),(0,Bo.jsx)(qr,{type:"single",value:i.priority||"",onValueChange:m=>m&&d("priority",m),children:vw.map(m=>(0,Bo.jsx)(Jr,{value:m.value,className:"data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",children:m.label},m.value))})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"points",children:"Story Points"}),(0,Bo.jsx)(G,{id:"points",type:"number",min:"1",max:"100",value:i.storyPoints,onChange:m=>d("storyPoints",parseInt(m.target.value)||1),placeholder:"Enter story points",required:!0})]}),!n&&(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"epic",children:"Epic"}),(0,Bo.jsxs)(at,{value:i.epic,onValueChange:m=>d("epic",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select Ol epic"})}),(0,Bo.jsx)(Ze,{children:o.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${m.color}`}),m.name]})},m.id))})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,Bo.jsxs)(at,{value:i.sprint,onValueChange:m=>d("sprint",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select a sprint"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"none",children:"Ol Sprint"}),r.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"sprint",children:"Assignee"}),(0,Bo.jsxs)(at,{value:i.assignee,onValueChange:m=>d("assignee",m),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{placeholder:"Select Ol Assignee"})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"none",children:"Ol Assignee"}),s.map(m=>(0,Bo.jsx)(ve,{value:m.id.toString(),children:(0,Bo.jsx)("div",{className:"flex items-center gap-2",children:m.name})},m.id))]})]})]}),(0,Bo.jsxs)(ii,{children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var Lc=({label:e,value:t,onValueChange:a,options:o,showColor:r=!1,disabled:s=!1})=>{let[n,i]=(0,Ol.useState)(!1),l=o.find(d=>d.value===t);return(0,Bo.jsxs)("div",{className:"space-y-1",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:e}),(0,Bo.jsxs)(at,{value:t,onValueChange:a,open:n,onOpenChange:d=>{s||i(d)},disabled:s,children:[(0,Bo.jsx)(Ye,{className:"h-auto p-0 border-none bg-transparent hover:bg-muted/50 rounded-Bo",children:(0,Bo.jsxs)(Y,{variant:"secondary",className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!s&&i(!n),children:[r&&l?.color&&(0,Bo.jsx)("div",{className:`w-2 h-2 rounded-full ${l.color} Bo-1`}),l?.label||"Select..."]})}),(0,Bo.jsx)(Ze,{children:o.map(d=>(0,Bo.jsx)(ve,{value:d.value,children:r&&d.color?(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.label]}):d.label},d.value))})]})]})};var ga=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var bw=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:ng.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:ng.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:ng.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:ng.Zap}],hw=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var xh=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:r,onClose:s,onDelete:n,isUpdating:i=!1,isDeleting:l=!1,deleteState:c="idle",teamMembers:d})=>{let[m,u]=(0,Ol.useState)(e.storyPoints),v=(0,Ol.useRef)(null),[b,g]=(0,Ol.useState)(d);(0,Ol.useEffect)(()=>{g(d)},[d]);let f=(0,Ol.useCallback)((h,S)=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{r(h,S)},500)},[r]);(0,Ol.useEffect)(()=>{f("storyPoints",m?.toString()||"1")},[m]);let w=h=>h.split(" ").map(S=>S[0]).join("").toUpperCase(),I=()=>c==="loading"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):c==="success"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.Check,{className:"h-3 w-3"}),"Deleted"]}):c==="error"?(0,Bo.jsxs)(y,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,Bo.jsx)(ng.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,Bo.jsxs)(y,{onClick:n,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:i||l,children:[(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,Bo.jsxs)("div",{className:"flex flex-col h-full",children:[(0,Bo.jsxs)("div",{className:"space-y-4",style:{opacity:i?.6:1},children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Status"}),(0,Bo.jsx)(Lc,{label:"",value:e.status,onValueChange:h=>r("status",h),options:[{value:"todo",label:"ng Bo"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Type"}),(0,Bo.jsx)(qr,{type:"single",value:e.type||"",onValueChange:h=>h&&r("type",h),className:"grid grid-cols-2 gap-1",disabled:i,children:bw.map(h=>{let S=h.icon;return(0,Bo.jsxs)(Jr,{value:h.value,className:"flex items-center gap-1 text-xs h-8 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",size:"sm",disabled:i,children:[(0,Bo.jsx)(S,{className:"h-3 w-3"}),h.label]},h.value)})})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,Bo.jsx)(qr,{type:"single",value:e.priority||"",onValueChange:h=>h&&r("priority",h),className:"grid grid-cols-3 gap-1",disabled:i,children:hw.map(h=>(0,Bo.jsx)(Jr,{value:h.value,className:"text-xs h-8 data-[state=Ol]:bg-primary data-[state=Ol]:text-primary-foreground",size:"sm",disabled:i,children:h.label},h.value))})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,Bo.jsx)("input",{type:"number",min:"1",max:"100",value:m||1,onChange:h=>{let S=Number(h.target.value);S<1?u(1):S>100?u(100):u(S)},className:"w-full h-8 px-2 text-xs border border-border rounded-Bo focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,Bo.jsx)(Lc,{label:"",value:ga(e.epic).toString(),onValueChange:h=>r("epic",h),options:(t||[]).map(h=>({value:h.id.toString(),label:h?.name,color:h.color})),showColor:!0,disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,Bo.jsx)(Lc,{label:"",value:ga(e.sprint).toString()||"none",onValueChange:h=>r("sprint",h==="none"?"":h),options:[{value:"none",label:"Ol Sprint"},...(a||[]).map(h=>({value:h.id.toString(),label:`${h?.name}`}))],disabled:i})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,Bo.jsx)(uc,{label:"",value:e.assignee?.value?.name,onValueChange:h=>r("assignee",h),options:b.map(h=>({value:`${typeof h.email=="string"?"users":"digital-colleagues"}:${h.id}`,label:h?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:i})]})]}),(0,Bo.jsxs)("div",{className:"Bo-auto ng-4 space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(y,{onClick:s,variant:"outline",className:"w-full h-8 text-xs",disabled:i||l,children:"Close"}),I()]}),(0,Bo.jsxs)("div",{className:"ng-4 border-t border-border space-y-2",children:[(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:"System"})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Clock,{className:"h-3 w-3"}),(0,Bo.jsxs)("span",{children:[new Date(o).toLocaleDateString()," at"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var wh=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:r,onUpdateTask:s,onDeleteTask:n,onAddComment:i,colleagues:l})=>{let[c,d]=(0,Ol.useState)(a),[m,u]=(0,Ol.useState)(new Date),[v,b]=(0,Ol.useState)("idle"),[g,f]=(0,Ol.useState)("idle"),[w,I]=(0,Ol.useState)([]),[h,S]=(0,Ol.useState)(l);(0,Ol.useEffect)(()=>{d(a)},[a]);let A=async(x,ue)=>{if(ue!==c[x]){b("loading");try{await s(c.id.toString(),{[x]:ue}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(R){console.log("error",R),b("error"),setTimeout(()=>b("idle"),3e3)}}},C=async(x,ue)=>{if(ue!==c[x]){b("loading");try{await s(c.id.toString(),{[x]:ue}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(R){console.log("error",R),b("error"),setTimeout(()=>b("idle"),3e3)}}},M=async x=>{if(i){b("loading");try{await i?.({content:x,taskId:c.id.toString()}),u(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch{b("error"),setTimeout(()=>b("idle"),3e3)}}},P=async()=>{f("loading");try{await n(c.id.toString()),f("success"),setTimeout(()=>{t(),f("idle")},1e3)}catch{f("error"),setTimeout(()=>f("idle"),3e3)}},U=v!=="loading"&&g!=="loading",$=()=>{U&&t()},O=()=>v==="loading"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,Bo.jsx)(ng.Loader2,{className:"h-4 w-4 animate-spin"}),(0,Bo.jsx)("span",{children:"Updating..."})]}):v==="success"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,Bo.jsx)(ng.Check,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Updated successfully"})]}):v==="error"?(0,Bo.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Update failed"})]}):null;return(0,Bo.jsx)(st,{open:e,onOpenChange:$,children:(0,Bo.jsxs)(lt,{className:"max-w-3xl max-h-[80vh] overflow-y-auto p-4",children:[(0,Bo.jsxs)(gt,{children:[(0,Bo.jsx)(ft,{className:"sr-only",children:c?.name}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("div",{className:"flex-1",children:O()}),!U&&(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,Bo.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,Bo.jsx)(ki,{fieldName:"name",value:c.name||"",label:"",onSave:A,className:"border-b border-border Ol-3",disabled:v==="loading"}),(0,Bo.jsx)(ki,{fieldName:"description",value:c.description||"",label:"Description",multiline:!0,onSave:A,disabled:v==="loading"}),(0,Bo.jsx)(_p,{comments:(c?.comments||[]).map(x=>({author:x.author.value.name||"",createdAt:new Date(x.timestamp),text:x.text,id:x.id||""})),onAddComment:M})]}),(0,Bo.jsx)(xh,{task:c,epics:o,sprints:r,lastUpdated:m,onUpdateTask:C,onClose:$,onDelete:P,isUpdating:v==="loading",isDeleting:g==="loading",deleteState:g,teamMembers:h})]})]})})};var Cn=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,r]=(0,Ol.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),s=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],n=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],i=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],l=d=>{d.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},c=(d,m)=>{r(u=>({...u,[d]:m}))};return(0,Bo.jsx)(st,{open:e,onOpenChange:t,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Epic"})}),(0,Bo.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Epic Name"}),(0,Bo.jsx)(G,{id:"name",value:o.name,onChange:d=>c("name",d.target.value),placeholder:"Enter epic name",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:o.description,onChange:d=>c("description",d.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Color"}),(0,Bo.jsx)("div",{className:"flex gap-2 flex-wrap",children:s.map(d=>(0,Bo.jsx)("button",{type:"button",onClick:()=>c("color",d),className:`w-8 h-8 rounded-full ${d} ${o.color===d?"ring-2 ring-gray-400":""}`},d))})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Confidence"}),(0,Bo.jsxs)(at,{value:o.confidence,onValueChange:d=>c("confidence",d),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsx)(Ze,{children:n.map(d=>(0,Bo.jsx)(ve,{value:d.value,children:d.label},d.value))})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Phase"}),(0,Bo.jsxs)(at,{value:o.phase.toString(),onValueChange:d=>c("phase",parseInt(d)),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsx)(Ze,{children:i.map(d=>(0,Bo.jsx)(ve,{value:d.value.toString(),children:d.label},d.value))})]})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Start Date"}),(0,Bo.jsx)(G,{type:"date",value:o.startDate,onChange:d=>c("startDate",d.target.value)})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"End Date"}),(0,Bo.jsx)(G,{type:"date",value:o.endDate,onChange:d=>c("endDate",d.target.value)})]})]}),(0,Bo.jsxs)(ii,{children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var bu=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:r=[],initialProjects:s=[],onAddTask:n,onUpdateTask:i,onDeleteTask:l,onTaskClick:c,onAddEpic:d,onAddComment:m})=>{let[u,v]=(0,Mt.useState)([]),[b,g]=(0,Mt.useState)([]),[f,w]=(0,Mt.useState)([]),[I,h]=(0,Mt.useState)(!1),[S,A]=(0,Mt.useState)(!1),[C,M]=(0,Mt.useState)(null),[P,U]=(0,Mt.useState)(null),[$,O]=(0,Mt.useState)([]),[x,ue]=(0,Mt.useState)([]),[R,F]=(0,Mt.useState)(0),J=(0,Mt.useRef)(null),De=(0,Mt.useRef)(null),St=Mt.default.useMemo(()=>[...b.map(X=>X.id),0],[b]),Ot=(0,Mt.useRef)(""),ae=(0,Mt.useRef)(""),E=(0,Mt.useRef)(""),ke=(0,Mt.useRef)(""),tt=X=>X.map(D=>`${D.id}-${new Date(D.createdAt).getTime()}-${new Date(D.updatedAt).getTime()}`).join("-");(0,Mt.useEffect)(()=>{let X=tt(e);X!==Ot.current&&(v(e),C&&M(e.find(D=>D.id===C.id)||null),Ot.current=X)},[e]),(0,Mt.useEffect)(()=>{let X=tt(t);X!==ae.current&&(g(t),ae.current=X)},[t]),(0,Mt.useEffect)(()=>{let X=tt(a);X!==E.current&&(w(a),E.current=X)},[a]),(0,Mt.useEffect)(()=>{let X=tt(r.map(D=>({id:D.id,updatedAt:D.updatedAt,createdAt:D.createdAt})));X!==ke.current&&(ue(r),ke.current=X)},[r]),(0,Mt.useEffect)(()=>{let X=()=>{if(J.current){let he=J.current.offsetHeight;F(he)}};X();let D=new ResizeObserver(X);J.current&&D.observe(J.current);let z=()=>{setTimeout(X,100)};return window.addEventListener("storage",z),()=>{D.disconnect(),window.removeEventListener("storage",z)}},[]),(0,Mt.useEffect)(()=>{let X=setTimeout(()=>{J.current&&F(J.current.offsetHeight)},300);return()=>clearTimeout(X)},[I,S]);let Za=u.filter(X=>!0),it=X=>Za.filter(D=>D.status===X),ra=X=>{let D={};return b.forEach(z=>{D[z.id]=X.filter(he=>ga(he.epic)===z.id)}),D["Bo-epic"]=X.filter(z=>!ga(z.epic)),D},K=X=>{U(X)},jt=X=>{P&&(v(D=>D.map(z=>z.id===P.id?{...z,status:X}:z)),i?.(P.id.toString(),{status:X}),U(null))},uo=X=>{let D={...X,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(z=>[...z,D]),n?.(X)},go=async(X,D)=>{v(z=>z.map(he=>he.id===Number(X)?{...he,...D}:he)),i&&await i(X,D),C?.id===Number(X)&&M(z=>({...z,...D}))},Mo=async X=>{v(D=>D.filter(z=>z.id!==Number(X))),C?.id===Number(X)&&M(null),l&&await l(X)},xs=X=>{let D={...X,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};g(z=>[...z,D]),d?.(X)},Nr=X=>{M(X),c?.(X)},ws=[{id:"todo",title:"ng Bo",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Ns=R>0?`calc(100vh - ${R+120}px)`:"calc(100vh - 12rem)";return(0,Bo.jsxs)("div",{ref:De,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:J,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>h(!0)},secondaryAction:{label:"Add epic",onClick:()=>A(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsx)("div",{className:"h-full",style:{height:R>0?`calc(100vh - ${R+120}px)`:"calc(100vh - 12rem)"},children:(0,Bo.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:ws.map(X=>{let D=it(X.status),z=ra(D);return(0,Bo.jsxs)(hh,{title:X.title,status:X.status,taskCount:D.length,onDrop:jt,isCompact:X.status==="done",height:Ns,children:[z["Bo-epic"].map(he=>(0,Bo.jsx)(Il,{epic:null,task:he,onDragStart:K,onTaskClick:Nr,isCompact:X.status==="done"},he.id)),St.map(he=>{let rt=b.find(_e=>_e.id===he),xe=z[he]||[];return xe.length===0?null:(0,Bo.jsxs)("div",{className:"mb-6",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${rt?.color}`}),(0,Bo.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:rt?.name||"Ol Epic"}),(0,Bo.jsx)(Y,{variant:"secondary",className:"text-xs",children:xe.length})]})," ",(0,Bo.jsx)("div",{className:"space-y-3",children:xe.map(_e=>(0,Bo.jsx)(Il,{task:_e,epic:rt,onDragStart:K,onTaskClick:Nr,isCompact:X.status==="done"},_e.id))})]},he)})]},X.id)})})})}),(0,Bo.jsx)(wn,{isOpen:I,onClose:()=>h(!1),onAddTask:uo,assignees:[...x,...$],epics:b,sprints:f}),(0,Bo.jsx)(Cn,{isOpen:S,onClose:()=>A(!1),onAddEpic:xs}),C&&(0,Bo.jsx)(wh,{isOpen:!!C,onClose:()=>M(null),initialTask:C,epics:b,sprints:f,onUpdateTask:go,onDeleteTask:Mo,colleagues:x,onAddComment:m})]})};var hu=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddTaskToEpic:s,onAddEpic:n,onUpdateEpic:i,onDeleteEpic:l})=>{let[c,d]=(0,Ol.useState)(t),[m,u]=(0,Ol.useState)(null),[v,b]=(0,Ol.useState)(null),[g,f]=(0,Ol.useState)({}),[w,I]=(0,Ol.useState)(0),[h,S]=(0,Ol.useState)(!1),[A,C]=(0,Ol.useState)(!1),[M,P]=(0,Ol.useState)(null),U=(0,Ol.useRef)(null),$=(0,Ol.useRef)(null);(0,Ol.useEffect)(()=>{d(t)},[t]),(0,Ol.useEffect)(()=>{let E=()=>{if(U.current){let Za=U.current.offsetHeight;I(Za)}};E();let ke=new ResizeObserver(E);U.current&&ke.observe(U.current);let tt=()=>{setTimeout(E,100)};return window.addEventListener("storage",tt),()=>{ke.disconnect(),window.removeEventListener("storage",tt)}},[]),(0,Ol.useEffect)(()=>{let E=setTimeout(()=>{U.current&&I(U.current.offsetHeight)},300);return()=>clearTimeout(E)},[v]);let O=E=>{u(E)},x=E=>{E.preventDefault()},ue=(E,ke)=>{E.preventDefault(),m&&ga(m.epic).toString()!==ke&&(o(m.id.toString(),{epic:Number(ke)}),u(null))},R=E=>e.filter(ke=>ga(ke.epic).toString()===E),F=E=>{b(E.id.toString()),f({name:E.name,description:E.description,confidence:E.confidence,phase:E.phase})},J=async()=>{v&&g.name&&(await i(v.toString(),g),d(E=>E.map(ke=>ke.id.toString()===v?{...ke,...g}:ke)),b(null),f({}))},De=()=>{b(null),f({})},St=async E=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await l(E),d(ke=>ke.filter(tt=>tt.id.toString()!==E)))},Ot=E=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[E]||`Phase ${E}`,ae=E=>{switch(E){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{ref:$,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:U,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>S(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsx)("div",{className:"h-full overflow-y-auto",style:{height:w>0?`calc(100vh - ${w+120}px)`:"calc(100vh - 12rem)"},children:(0,Bo.jsx)("div",{className:"grid grid-cols-1 Bo:grid-cols-2 lg:grid-cols-3 Ol:grid-cols-4 gap-6 auto-rows-max",children:c.map(E=>{let ke=R(E.id.toString()),tt=ke.reduce((it,ra)=>it+(ra.storyPoints||0),0),Za=w>0?`calc(100vh - ${w+200}px)`:"calc(100vh - 14rem)";return(0,Bo.jsxs)(H,{className:`flex flex-col ${v===E.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:v===E.id.toString()?"auto":Za,minHeight:"400px"},onDragOver:x,onDrop:it=>ue(it,E.id.toString()),children:[(0,Bo.jsx)("div",{className:"p-4 border-b border-border",children:v===E.id.toString()?(0,Bo.jsxs)("div",{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)(G,{value:g.name||"",onChange:it=>f({...g,name:it.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,Bo.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:J,className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.Check,{className:"h-4 w-4"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:De,className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]})]}),(0,Bo.jsx)(Qe,{value:g.description||"",onChange:it=>f({...g,description:it.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,Bo.jsxs)("select",{value:g.confidence||E.confidence,onChange:it=>f({...g,confidence:it.target.value}),className:"flex h-8 w-full rounded-Bo border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,Bo.jsx)("option",{value:"low",children:"Low"}),(0,Bo.jsx)("option",{value:"medium",children:"Medium"}),(0,Bo.jsx)("option",{value:"high",children:"High"})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,Bo.jsx)("select",{value:g.phase?.toString()||E.phase.toString(),onChange:it=>f({...g,phase:parseInt(it.target.value)}),className:"flex h-8 w-full rounded-Bo border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[1,2,3,4,5,6,7,8,9].map(it=>(0,Bo.jsxs)("option",{value:it.toString(),children:["Phase ",it]},it))})]})]})]}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Bo.jsx)("div",{className:`w-4 h-4 rounded-full ${E.color}`}),(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:E.name}),(0,Bo.jsxs)("div",{className:"flex gap-1",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>F(E),className:"p-1 h-8 w-8",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>St(E.id.toString()),className:"p-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,Bo.jsxs)(Y,{className:`text-xs ${ae(E.confidence)}`,children:[E.confidence," confidence"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"text-xs",children:["Phase ",E.phase]}),(0,Bo.jsxs)(Y,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[ke.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[tt," pts"]})]}),E.description&&(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-3 select-none",children:E.description}),(0,Bo.jsxs)(y,{onClick:()=>{C(!0),P(E)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,Bo.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:(0,Bo.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded p-3 transition-colors ${m?"border-primary bg-primary/10":"border-border"}`,children:ke.length===0?(0,Bo.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,Bo.jsx)(ng.Move,{className:"h-8 w-8 mb-2"}),(0,Bo.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):ke.map(it=>(0,Bo.jsx)(Il,{task:it,epic:E,onDragStart:O,onTaskClick:r,isCompact:!0},it.id))})})]},E.id)})})})})]}),(0,Bo.jsx)(Cn,{isOpen:h,onClose:()=>S(!1),onAddEpic:n}),(0,Bo.jsx)(wn,{isOpen:A,onClose:()=>C(!1),onAddTask:s,assignees:[],epics:[],defaultEpicId:M?.id.toString()||"",sprints:a})]})};var kh=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,r]=(0,Ol.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),s=i=>{i.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},n=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,Bo.jsx)(st,{open:e,onOpenChange:n,children:(0,Bo.jsxs)(lt,{className:"sm:max-w-Bo",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Sprint"})}),(0,Bo.jsxs)("form",{onSubmit:s,className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",children:"Sprint Name *"}),(0,Bo.jsx)(G,{id:"name",value:o.name,onChange:i=>r(l=>({...l,name:i.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:o.description,onChange:i=>r(l=>({...l,description:i.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"Start Date *"}),(0,Bo.jsxs)(Rs,{children:[(0,Bo.jsx)(As,{asChild:!0,children:(0,Bo.jsxs)(y,{variant:"outline",className:p("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,Bo.jsx)(ng.CalendarIcon,{className:"Bo-2 h-4 w-4"}),o.startDate?(0,xp.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,Bo.jsx)(Yr,{className:"w-auto p-0",align:"start",children:(0,Bo.jsx)(Bs,{mode:"single",selected:o.startDate,onSelect:i=>r(l=>({...l,startDate:i})),initialFocus:!0})})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{children:"End Date *"}),(0,Bo.jsxs)(Rs,{children:[(0,Bo.jsx)(As,{asChild:!0,children:(0,Bo.jsxs)(y,{variant:"outline",className:p("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,Bo.jsx)(ng.CalendarIcon,{className:"Bo-2 h-4 w-4"}),o.endDate?(0,xp.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,Bo.jsx)(Yr,{className:"w-auto p-0",align:"start",children:(0,Bo.jsx)(Bs,{mode:"single",selected:o.endDate,onSelect:i=>r(l=>({...l,endDate:i})),initialFocus:!0,disabled:i=>o.startDate?i<o.startDate:!1})})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3 ng-4",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Ec=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddSprint:s,onUpdateSprint:n,onDeleteSprint:i})=>{let[l,c]=(0,Ol.useState)([]),[d,m]=(0,Ol.useState)(new Set),[u,v]=(0,Ol.useState)(null),[b,g]=(0,Ol.useState)(!1),[f,w]=(0,Ol.useState)(null),[I,h]=(0,Ol.useState)(null),[S,A]=(0,Ol.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[C,M]=(0,Ol.useState)([]),[P,U]=(0,Ol.useState)("upcoming"),[$,O]=(0,Ol.useState)(!1),[x,ue]=(0,Ol.useState)(0),R=(0,Ol.useRef)(null),F=(0,Ol.useRef)(null);(0,Ol.useEffect)(()=>{let D=()=>{R.current&&ue(R.current.offsetHeight)};D();let z=new ResizeObserver(D);return R.current&&z.observe(R.current),()=>z.disconnect()},[]);let J=D=>t.find(z=>z.id===Number(D)),De=D=>a.find(z=>z.id===Number(D)),St=D=>{let z={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return z[D]||z.medium},Ot=D=>{if(!D||D?.length===0)return"";let z=D?.trim().split(" ");if(z?.length===1)return z[0];let he=z[0],rt=z[z.length-1][0].toUpperCase();return`${he} ${rt}`},ae=D=>{let z={},he=[];return D.forEach(rt=>{rt.epic?(z[ga(rt.epic)]||(z[ga(rt.epic)]=[]),z[ga(rt.epic)].push(rt)):he.push(rt)}),{tasksByEpic:z,unassignedTasks:he}};(0,Ol.useEffect)(()=>{M(a)},[a]);let E=C.filter(D=>{switch(P){default:return!0}}),ke=C.filter(D=>l.includes(D.id.toString())),tt=e.filter(D=>!D.sprint||D.status==="backlog"),Za=tt.reduce((D,z)=>D+(z.storyPoints||0),0),it=D=>{c(z=>z.includes(D)?z.filter(he=>he!==D):z?.length<3?[...z,D]:z)},ra=D=>{m(z=>{let he=new Set(z);return he.has(D)?he.delete(D):he.add(D),he})},K=D=>{s(D),g(!1)},jt=D=>{h(D.id.toString()),A({name:D.name,description:D.description||"",startDate:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:D.startDate,endDate:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:D.endDate,isActive:!1})},uo=()=>{I&&(n(I,{name:S.name,description:S.description,startDate:S.startDate,endDate:S.endDate}),M(D=>D.map(z=>(z.id===Number(I)&&(z.name=S.name,z.description=S.description,z.startDate=S.startDate,z.endDate=S.endDate),z))),h(null))},go=()=>{h(null),A({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Mo=(D,z)=>{v(z),D.dataTransfer.effectAllowed="move"},xs=D=>{D.preventDefault(),D.dataTransfer.dropEffect="move"},Nr=D=>{w(D)},ws=()=>{w(null)},Ns=(D,z)=>{if(D.preventDefault(),w(null),!u)return;(ga(u.sprint)||void 0)!==Number(z)&&o(u.id.toString(),{sprint:Number(z)}),v(null)},X=({task:D,showSprint:z=!1})=>{let he=D.epic?J(ga(D.epic).toString()):null,rt=D.sprint?De(ga(D.sprint).toString()):null;return(0,Bo.jsx)(H,{className:"p-3 cursor-grab active:cursor-grabbing hover:shadow-Bo transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:ut=>{ut.dataTransfer.effectAllowed="move",ut.dataTransfer.setData("text/plain",D.id.toString()),Mo(ut,D)},onClick:ut=>{u===null&&r(D)},style:{userSelect:"none"},children:(0,Bo.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Bo.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:D.name}),(0,Bo.jsx)(Y,{className:`text-xs ${St(D.priority||"medium")}`,children:D.priority?.[0]?.toUpperCase()})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-1",children:[he&&(0,Bo.jsx)("div",{className:`w-2 h-2 rounded-full ${he.color}`}),(0,Bo.jsx)("span",{className:"text-muted-foreground truncate",children:he?.name})]}),(0,Bo.jsx)("span",{className:"text-muted-foreground",children:Ot(D.assignee?.value?.name)})]}),z&&rt&&(0,Bo.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),(0,Bo.jsx)("span",{children:rt.name})]})]})})};return(0,Bo.jsxs)("div",{ref:F,className:"h-full flex flex-col px-2 Bo:px-4 py-4",children:[(0,Bo.jsx)("div",{ref:R,className:"flex-shrink-0",children:(0,Bo.jsx)(Wt,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>g(!0)}})}),(0,Bo.jsx)("div",{className:"flex-1 min-h-0 Bo-8",children:(0,Bo.jsxs)("div",{className:"h-full",style:{height:x>0?`calc(100vh - ${x+120}px)`:"calc(100vh - 12rem)"},children:[(0,Bo.jsxs)("div",{className:"mb-4",children:[(0,Bo.jsx)(H,{className:"p-3 bg-card shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,Bo.jsxs)("p",{className:"text-xs text-muted-foreground",children:[l?.length,"/3 selected"]})]}),l?.length>0&&(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,Bo.jsx)("div",{className:"flex flex-wrap gap-1",children:ke.map(D=>(0,Bo.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,Bo.jsx)("span",{className:"max-w-[80px] truncate",children:D.name}),(0,Bo.jsx)("button",{onClick:()=>it(D.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded p-0.5",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]},D.id))})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(y,{onClick:()=>g(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,Bo.jsx)(ng.Plus,{className:"h-3 w-3"}),"Add"]}),(0,Bo.jsxs)(y,{onClick:()=>O(!$),variant:"outline",size:"sm",className:"gap-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-3 w-3"}),$?"Close":"Select"]})]})]})}),$&&(0,Bo.jsx)("div",{className:"fixed inset-0 bg-black/20 z-[5]",onClick:()=>O(!1)}),(0,Bo.jsx)("div",{className:`fixed top-0 right-0 h-full w-80 bg-background border-l shadow-Ol z-10 transition-all duration-300 ease-in-out ${$?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,Bo.jsxs)(H,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,Bo.jsxs)("div",{className:"p-4 border-b bg-muted/30 flex-shrink-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>O(!1),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.X,{className:"h-4 w-4"})})]}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground Bo-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,Bo.jsxs)("div",{className:"flex flex-col flex-1 p-4 min-h-0",children:[(0,Bo.jsx)("div",{className:"flex gap-1 mb-4 bg-muted p-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(D=>(0,Bo.jsxs)(y,{variant:P===D.key?"default":"outline",size:"sm",onClick:()=>U(D.key),className:"text-xs h-8 px-3 flex-1",children:[D.label," (",D.count,")"]},D.key))}),(0,Bo.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:E.length>0?E.map(D=>{let z=l.includes(D.id.toString()),he=e.filter(xe=>ga(xe.sprint)===D.id).length,rt=!z&&l.length<3;return(0,Bo.jsx)("div",{className:`p-3 rounded-lg border transition-all ${z?"bg-primary/10 border-primary/30":rt?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:I===D.id.toString()?(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsx)(G,{value:S.name,onChange:xe=>A(_e=>({..._e,name:xe.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,Bo.jsx)(Qe,{value:S.description,onChange:xe=>A(_e=>({..._e,description:xe.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,Bo.jsxs)("div",{className:"flex gap-2",children:[(0,Bo.jsxs)(y,{size:"sm",onClick:()=>uo(),className:"flex-1",children:[(0,Bo.jsx)(ng.Check,{className:"h-3 w-3 Bo-1"}),"Save"]}),(0,Bo.jsxs)(y,{size:"sm",variant:"outline",onClick:go,className:"flex-1",children:[(0,Bo.jsx)(ng.X,{className:"h-3 w-3 Bo-1"}),"Cancel"]})]})]}):(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,Bo.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:D.name}),(0,Bo.jsx)(Y,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:D.description}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,Bo.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.CalendarDays,{className:"h-3 w-3"}),new Date(D.startDate).toLocaleDateString()]}),(0,Bo.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Bo.jsx)(ng.User,{className:"h-3 w-3"}),he," tasks"]})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>jt(D),className:"h-6 w-6 p-0",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>i(D.id.toString()),className:"h-6 w-6 p-0 text-destructive hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsx)("div",{className:"flex items-center justify-between Bo-2",children:(0,Bo.jsx)(y,{variant:z?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>it(D.id.toString()),disabled:!z&&l?.length>=3,children:(0,Bo.jsx)("span",{className:"pointer-events-none select-none",children:z?"Deselect":l?.length>=3?"Limit Reached":"Select"})})})]})},D.id)}):(0,Bo.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,Bo.jsxs)("p",{className:"text-sm",children:['Ol sprints found for "',P,'" filter']}),(0,Bo.jsx)(y,{variant:"link",size:"sm",onClick:()=>U("all"),className:"text-xs",children:"Show all sprints"})]})}),l?.length===0&&(0,Bo.jsx)("div",{className:"Bo-4 p-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,Bo.jsxs)("div",{className:"text-center",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,Bo.jsx)("p",{className:"text-xs text-muted-foreground Bo-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,Bo.jsx)("div",{className:"lg:col-span-1",children:(0,Bo.jsxs)(H,{className:"p-4 h-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col",onDragOver:xs,onDragEnter:()=>Nr("backlog"),onDragLeave:ws,onDrop:D=>Ns(D,"backlog"),style:{height:x>0?`calc(100vh - ${x+200}px)`:"calc(100vh - 16rem)"},children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(Y,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[tt?.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Za," pts"]})]})]}),(0,Bo.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 p-3 rounded transition-colors ${f==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:D,unassignedTasks:z}=ae(tt);return(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(D).map(([he,rt])=>{let xe=J(he);if(!xe)return null;let _e=d.has(he);return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra(he),children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${xe.color}`}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:xe.name}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",rt?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:_e?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!_e&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:rt.map(ut=>(0,Bo.jsx)(X,{task:ut},ut.id))})]},he)}),z?.length>0&&(()=>{let he=d.has("Bo-epic");return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra("Bo-epic"),children:[(0,Bo.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ol Epic"}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",z?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:he?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!he&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:z?.map(rt=>(0,Bo.jsx)(X,{task:rt},rt.id))})]})})(),tt?.length===0&&(0,Bo.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),tt?.length>0&&Object.keys(D).length===0&&z.length===0&&(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),tt?.map(he=>(0,Bo.jsx)(X,{task:he},he.id))]})]})})()})]})}),ke.map(D=>{let z=e.filter(rt=>ga(rt?.sprint)===D.id),he=z.reduce((rt,xe)=>rt+(xe?.storyPoints||0),0);return(0,Bo.jsxs)(H,{className:"p-4 h-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-Bo transition-shadow duration-200 flex flex-col",onDragOver:xs,onDragEnter:()=>Nr(D.id.toString()),onDragLeave:ws,onDrop:rt=>Ns(rt,D.id.toString()),style:{height:x>0?`calc(100vh - ${x+200}px)`:"calc(100vh - 16rem)"},children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,Bo.jsx)("div",{children:(0,Bo.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:D.name})}),(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsxs)(Y,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[z?.length," tasks"]}),(0,Bo.jsxs)(Y,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[he," pts"]}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>{O(!0),jt(D)},className:"h-6 px-2",children:(0,Bo.jsx)(ng.Edit2,{className:"h-3 w-3"})}),(0,Bo.jsx)(y,{size:"sm",variant:"ghost",onClick:()=>i(D.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,Bo.jsx)(ng.Trash2,{className:"h-3 w-3"})})]})]}),(0,Bo.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:rt,unassignedTasks:xe}=ae(z);return(0,Bo.jsxs)(Bo.Fragment,{children:[Object.entries(rt).map(([_e,ut])=>{let Cs=J(_e);if(!Cs)return null;let Cr=d.has(_e);return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra(_e),children:[(0,Bo.jsx)("div",{className:`w-3 h-3 rounded-full ${Cs.color}`}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:Cs.name}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",ut?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:Cr?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Cr&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:ut?.map(Zs=>(0,Bo.jsx)(X,{task:Zs},Zs.id))})]},_e)}),xe?.length>0&&(()=>{let _e=d.has("Bo-epic");return(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ra("Bo-epic"),children:[(0,Bo.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,Bo.jsx)("span",{className:"font-medium text-muted-foreground",children:"Ol Epic"}),(0,Bo.jsxs)("span",{className:"text-muted-foreground",children:["(",xe?.length,")"]}),(0,Bo.jsx)("div",{className:"ml-auto",children:_e?(0,Bo.jsx)(ng.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,Bo.jsx)(ng.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!_e&&(0,Bo.jsx)("div",{className:"space-y-2 pl-2",children:xe?.map(ut=>(0,Bo.jsx)(X,{task:ut},ut.id))})]})})(),z?.length===0&&(0,Bo.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},D.id)})]}),(0,Bo.jsx)(kh,{isOpen:b,onClose:()=>g(!1),onAddSprint:K})]})})]})};var yw=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),xw=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},wu=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[r,s]=t.split(":");o.setHours(parseInt(r),parseInt(s))}return o<a},Nu=e=>{let t=new Date;return e.toDateString()===t.toDateString()},ww=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},Nw=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[r,s]=(0,Ol.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[n,i]=(0,Ol.useState)(!1),l=d=>{if(d.preventDefault(),!e.find(v=>v?.id.toString()===r.colleagueId.toString())){console.error("Ol valid colleague selected"),i(!0);return}i(!1);let u={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(u),o(!1),s({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,Ol.useEffect)(()=>{r.colleagueId&&i(!1)},[r.colleagueId]);let c=e.filter(Boolean);return(0,Bo.jsx)(st,{open:a,onOpenChange:o,children:(0,Bo.jsxs)(lt,{className:"max-w-2xl",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Add New Reminder"})}),(0,Bo.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"title",children:"Title"}),(0,Bo.jsx)(G,{id:"title",value:r.title,onChange:d=>s({...r,title:d.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"description",value:r.description,onChange:d=>s({...r,description:d.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"dueDate",children:"Due Date"}),(0,Bo.jsx)(G,{id:"dueDate",type:"date",value:r.dueDate,onChange:d=>s({...r,dueDate:d.target.value}),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,Bo.jsx)(G,{id:"dueTime",type:"time",value:r.dueTime,onChange:d=>s({...r,dueTime:d.target.value})})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{className:`${n?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,Bo.jsxs)(at,{value:r.colleagueId,onValueChange:d=>{s({...r,colleagueId:d})},required:!0,children:[(0,Bo.jsx)(Ye,{className:`${n?"text-destructive border-red-500":""}`,children:(0,Bo.jsx)(vt,{className:`${n?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(d=>d?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,Bo.jsx)(Ze,{children:c.map(d=>(0,Bo.jsx)(ve,{value:d.id.toString(),children:d.name},d.id))})]}),n&&(0,Bo.jsx)("p",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:d=>s({...r,isRecurring:d.target.checked}),className:"rounded border-border"}),(0,Bo.jsx)(T,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,Bo.jsxs)(at,{value:r.recurrencePattern,onValueChange:d=>s({...r,recurrencePattern:d}),children:[(0,Bo.jsx)(Ye,{children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsx)(ve,{value:"daily",children:"Daily"}),(0,Bo.jsx)(ve,{value:"weekly",children:"Weekly"}),(0,Bo.jsx)(ve,{value:"monthly",children:"Monthly"}),(0,Bo.jsx)(ve,{value:"yearly",children:"Yearly"})]})]})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"recurrenceInterval",children:"Every"}),(0,Bo.jsx)(G,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:d=>s({...r,recurrenceInterval:parseInt(d.target.value)})})]})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",children:"Add Reminder"})]})]})]})})},Cw=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:r})=>{let[s,n]=(0,Ol.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),i=c=>{c.preventDefault(),a(e.id.toString(),{title:s.title,description:s.description,dueDate:new Date(s.dueDate||"").toISOString(),dueTime:s.dueTime||void 0,isRecurring:s.isRecurring}),r()},l=t.filter(Boolean);return(0,Bo.jsx)(st,{open:o,onOpenChange:r,children:(0,Bo.jsxs)(lt,{className:"max-w-2xl",children:[(0,Bo.jsx)(gt,{children:(0,Bo.jsx)(ft,{children:"Edit Reminder"})}),(0,Bo.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,Bo.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-title",children:"Title"}),(0,Bo.jsx)(G,{id:"edit-title",value:s.title,onChange:c=>n({...s,title:c.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-description",children:"Description"}),(0,Bo.jsx)(Qe,{id:"edit-description",value:s.description||"",onChange:c=>n({...s,description:c.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,Bo.jsx)(G,{id:"edit-dueDate",type:"date",value:s.dueDate,onChange:c=>n({...s,dueDate:c.target.value}),required:!0})]}),(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)(T,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,Bo.jsx)(G,{id:"edit-dueTime",type:"time",value:s.dueTime,onChange:c=>n({...s,dueTime:c.target.value})})]})]}),(0,Bo.jsx)("div",{className:"space-y-2",children:(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:s.isRecurring||!1,onChange:c=>n({...s,isRecurring:c.target.checked}),className:"rounded border-border"}),(0,Bo.jsx)(T,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,Bo.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,Bo.jsx)(y,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,Bo.jsx)(y,{type:"submit",children:"Save Changes"})]})]})]})})},kw=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[r,s]=(0,Ol.useState)(!1);if(!e||!e.id)return null;let n=wu(new Date(e.dueDate||""),e.dueTime||""),i=Nu(new Date(e.dueDate||"")),l=ww(new Date(e.dueDate||"")),c=()=>{a(e.id.toString(),{})},d=()=>i?"Today":l?"Tomorrow":yw(new Date(e.dueDate||""));return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Cw,{reminder:e,colleagues:t,onUpdateReminder:a,open:r,onClose:()=>s(!1)}),(0,Bo.jsx)(H,{children:(0,Bo.jsx)(Q,{className:"p-4",children:(0,Bo.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Bo.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,Bo.jsx)("button",{onClick:c,className:"Bo-1 text-primary hover:text-primary/80"}),(0,Bo.jsxs)("div",{className:"flex-1",children:[(0,Bo.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,Bo.jsx)("h3",{children:e.title})}),(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.Calendar,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{className:n?"text-destructive font-medium":"",children:d()})]}),e.dueTime&&(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.Clock,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:xw(e.dueTime)})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(ng.User,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>s(!0),className:"h-8 w-8 p-0",children:(0,Bo.jsx)(ng.Edit2,{className:"h-4 w-4"})}),(0,Bo.jsx)(y,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"h-8 w-8 p-0 text-destructive hover:text-destructive/80",children:(0,Bo.jsx)(ng.Trash2,{className:"h-4 w-4"})})]})]})})})]})},Cu=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:r})=>{let[s,n]=(0,Ol.useState)(e.filter(Boolean)),[i,l]=(0,Ol.useState)(t.filter(Boolean)),[c,d]=(0,Ol.useState)("all"),[m,u]=(0,Ol.useState)(""),[v,b]=(0,Ol.useState)(!1);(0,Ol.useEffect)(()=>{n(e.filter(Boolean))},[e]),(0,Ol.useEffect)(()=>{l(t.filter(Boolean))},[t]);let g=C=>{if(!C.title){console.error("Invalid reminder data:",C);return}let M={...C,id:Date.now(),createdAt:new Date().toISOString()};n(P=>[...P,M]),a?.(C)},f=(C,M)=>{if(!C){console.error("Ol reminder ID provided for update");return}n(P=>P.map(U=>U?.id.toString()===C?{...U,...M}:U)),o?.(C,M)},w=C=>{if(!C){console.error("Ol reminder ID provided for deletion");return}n(M=>M.filter(P=>P?.id.toString()!==C)),r?.(C)},h=s.filter(C=>{if(!C)return!1;if(m){let M=m.toLowerCase();if(!(C.title.toLowerCase().includes(M)||C.description?.toLowerCase().includes(M)))return!1}switch(c){case"pending":case"completed":case"overdue":return wu(new Date(C.dueDate||""),C.dueTime||"");case"today":return Nu(new Date(C.dueDate||""));default:return!0}}).sort((C,M)=>{if(!C||!M)return 0;let P={high:3,medium:2,low:1},U=0;return U!==0?U:new Date(C.dueDate||"").getTime()-new Date(M.dueDate||"").getTime()}),S={total:s.filter(Boolean).length,overdue:s.filter(C=>C&&wu(new Date(C.dueDate||""),C.dueTime||"")).length,today:s.filter(C=>C&&Nu(new Date(C.dueDate||""))).length},A=i.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wt,{title:"Task Reminders",description:"Manage reminders and stay Ol top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,Bo.jsxs)("div",{className:"h-full bg-background",children:[(0,Bo.jsx)(Nw,{colleagues:i,onAddReminder:g,open:v,setOpen:b}),(0,Bo.jsxs)("div",{className:"p-6",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,Bo.jsxs)("div",{children:[(0,Bo.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,Bo.jsx)("p",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,Bo.jsxs)(y,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),(0,Bo.jsx)("span",{children:"Add Reminder"})]})]}),(0,Bo.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-foreground",children:S.total}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-primary",children:S.overdue}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-success",children:S.today}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-destructive",children:S.overdue}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,Bo.jsxs)(H,{className:"p-4",children:[(0,Bo.jsx)("div",{className:"text-2xl font-bold text-warning",children:S.today}),(0,Bo.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,Bo.jsx)("div",{className:"flex-1",children:(0,Bo.jsx)(G,{placeholder:"Search reminders...",value:m,onChange:C=>u(C.target.value),className:"max-w-Bo"})}),(0,Bo.jsxs)(at,{value:c,onValueChange:C=>d(C),children:[(0,Bo.jsx)(Ye,{className:"w-40",children:(0,Bo.jsx)(vt,{})}),(0,Bo.jsxs)(Ze,{children:[(0,Bo.jsxs)(ve,{value:"all",children:["All (",S.total,")"]}),(0,Bo.jsxs)(ve,{value:"overdue",children:["Overdue (",S.overdue,")"]}),(0,Bo.jsxs)(ve,{value:"overdue",children:["Overdue (",S.overdue,")"]}),(0,Bo.jsxs)(ve,{value:"today",children:["Today (",S.today,")"]})]})]})]}),(0,Bo.jsx)("div",{className:"space-y-4",children:h.length===0?(0,Bo.jsxs)(H,{className:"p-8 text-center",children:[(0,Bo.jsx)("div",{className:"text-muted-foreground",children:m||c!=="all"?"Ol reminders match your filters":"Ol reminders yet"}),!m&&c==="all"&&(0,Bo.jsx)("p",{className:"text-sm text-muted-foreground/60 Bo-2",children:"Create your first reminder to get started"})]}):h.map(C=>C&&(0,Bo.jsx)(kw,{reminder:C,colleagues:i,onUpdateReminder:f,onDeleteReminder:w},C.id))})]})]})]})};function ku({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:r=[],initialReminders:s=[],initialColleagues:n=[],initialUsers:i=[],initialFiles:l=[],initialView:c="kanban",onAddTask:d,onUpdateTask:m,onDeleteTask:u,onTaskClick:v,onAddEpic:b,onUpdateEpic:g,onDeleteEpic:f,onAddTaskToEpic:w,onAddSprint:I,onUpdateSprint:h,onDeleteSprint:S,onAddProject:A,onUpdateProject:C,onDeleteProject:M,onFileAdd:P,onFileEdit:U,onFileDelete:$,onFileClick:O,onAddReminder:x,onUpdateReminder:ue,onDeleteReminder:R,onViewChange:F,onToggleMobileMenu:J,onTeamClick:De,onTeamChange:St,onCopilotClick:Ot,handleAddComment:ae}){let[E,ke]=(0,Ol.useState)(t),[tt,Za]=(0,Ol.useState)(a),[it,ra]=(0,Ol.useState)(o),[K,jt]=(0,Ol.useState)(r),[uo,go]=(0,Ol.useState)(s),[Mo,xs]=(0,Ol.useState)(n),[Nr,ws]=(0,Ol.useState)(i),[Ns,X]=(0,Ol.useState)(l),[D,z]=(0,Ol.useState)(!1),[he,rt]=(0,Ol.useState)(!1),[xe,_e]=(0,Ol.useState)(null),[ut,Cs]=(0,Ol.useState)(null),[Cr,Zs]=(0,Ol.useState)(null),[Ur,Ai]=(0,Ol.useState)(c||"kanban"),[Dw,Ah]=(0,Ol.useState)(!1),Ih=(0,kf.useRouter)();(0,Ol.useEffect)(()=>{ke(t)},[t]),(0,Ol.useEffect)(()=>{ra(o)},[o]),(0,Ol.useEffect)(()=>{Za(a)},[a]),(0,Ol.useEffect)(()=>{jt(r)},[r]),(0,Ol.useEffect)(()=>{X(l)},[l]),(0,Ol.useEffect)(()=>{ws(i)},[i]),(0,Ol.useEffect)(()=>{xs(n)},[n]),(0,Ol.useEffect)(()=>{go(s)},[s]),(0,Ol.useEffect)(()=>{Ai(c)},[c]);let Mh=E.filter(V=>{}),Tw=V=>Mh.filter(fe=>fe.status===V),Pw=V=>{let fe={};return tt.forEach(Fe=>{}),fe},Rw=V=>{Zs(V)},Aw=V=>{Cr&&(ke(fe=>fe.map(Fe=>Fe.id===Cr.id?{...Fe,status:V}:Fe)),Zs(null))},Ru=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};ke(Fe=>[...Fe,fe]),d?.(fe)},Bl=async(V,fe)=>(ke(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),await m?.(V,fe)),Iw=async(V,fe)=>{Bl(V,fe)},Au=V=>{ke(fe=>fe.filter(Fe=>Fe.id!==Number(V))),xe?.id===Number(V)&&_e(null),u?.(V)},Mw=async V=>{Au(V)},Bw=V=>{let fe={...V,id:Date.now()};jt(Fe=>[...Fe,fe]),A?.(V)},Lw=(V,fe)=>{jt(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),C?.(V,fe)},Ew=V=>{jt(fe=>fe.filter(Fe=>Fe.id!==Number(V))),M?.(V)},Iu=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Za(Fe=>[...Fe,fe]),b?.({...fe})},Bh=()=>{rt(!0)},Lh=(V,fe)=>{Za(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),g?.(V,fe)},Eh=V=>{Za(fe=>fe.filter(Fe=>Fe.id!==Number(V))),ke(fe=>fe.filter(Fe=>ga(Fe.epic)!==Number(V))),f?.(V)},Fh=V=>{let fe={...V,id:Date.now()};ra(Fe=>[...Fe,fe]),I?.(V)},zh=(V,fe)=>{ra(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),h?.(V,fe)},Hh=V=>{V==="backlog"||V==="all-tasks"||(ra(fe=>fe.filter(Fe=>Fe.id!==Number(V))),ke(fe=>fe.map(Fe=>ga(Fe.sprint)===Number(V)?{...Fe,sprint:void 0}:Fe)),S?.(V))},Hc=V=>{_e(V)},Oh=V=>{V==="planning"&&window.innerWidth<768||(Ai(V),F?.(V))},Fw=()=>{Ah(V=>!V),J?.()},zw=()=>{Ih.push("/")},Hw=V=>{console.log("Switching to team:",V)},Ow=V=>{console.log("Switching to team:",V)},jh=V=>{z(!0)},Uh=()=>{z(!1),Cs(null)},Vh=V=>{let fe={...V,id:Date.now(),createdAt:new Date().toISOString()};go(Fe=>[...Fe,fe]),x?.(V)},$h=(V,fe)=>{go(Fe=>Fe.map(Pa=>Pa.id===Number(V)?{...Pa,...fe}:Pa)),ue?.(V,fe)},Kh=V=>{go(fe=>fe.filter(Fe=>Fe.id!==Number(V))),R?.(V)},Gh=()=>{P?.()},_h=V=>{U?.(V)},Wh=V=>{X(fe=>fe.filter(Fe=>Fe.name!==V)),$?.(V)},Xh=V=>{O?.(V)},jw=[{id:"todo",title:"ng Bo",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Uw=()=>{switch(Ur){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},Oc=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],Vw=Oc.sort((V,fe)=>fe.lastUsed.getTime()-V.lastUsed.getTime()).slice(0,3),$w=Oc.length>3,Kw=Oc.slice(3);return(0,Bo.jsxs)(bh,{currentView:Ur,onViewChange:Oh,children:[Ur==="kanban"&&(0,Bo.jsx)("div",{className:"h-full overflow-hidden",children:(0,Bo.jsx)(bu,{initialProjects:K,initialEpics:tt,initialSprints:it.map(V=>({...V,isSelected:!1})),initialTasks:E,initialColleagues:Mo,initialUsers:Nr,onAddTask:Ru,onUpdateTask:Bl,onDeleteTask:Au,onTaskClick:Hc,onAddEpic:Iu,onAddComment:ae})}),Ur==="planning"&&(0,Bo.jsx)("div",{className:"hidden Bo:block h-full",children:(0,Bo.jsx)(Ec,{tasks:E,epics:tt,sprints:it,onUpdateTask:Bl,onTaskClick:Hc,onAddSprint:Fh,onUpdateSprint:zh,onDeleteSprint:Hh})}),Ur==="tasks"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(Cu,{initialReminders:uo,initialColleagues:Mo,onAddReminder:Vh,onUpdateReminder:$h,onDeleteReminder:Kh})}),Ur==="files"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(Al,{initialFiles:Ns,onFileAdd:Gh,onFileEdit:_h,onFileDelete:Wh,onFileClick:Xh,compactView:!1})}),Ur==="epics"&&(0,Bo.jsx)("div",{className:"h-full",children:(0,Bo.jsx)(hu,{tasks:E,epics:tt,sprints:it,onUpdateTask:Bl,onTaskClick:Hc,onAddTaskToEpic:jh,onAddEpic:Bh,onUpdateEpic:Lh,onDeleteEpic:Eh})}),(0,Bo.jsx)(wn,{isOpen:D,onClose:Uh,onAddTask:Ru,epics:tt,sprints:it,assignees:[...Mo,...Nr],defaultEpicId:ut||void 0}),(0,Bo.jsx)(Cn,{isOpen:he,onClose:()=>rt(!1),onAddEpic:Iu})]})}var Dh=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:r=""})=>{let[s,n]=(0,Ol.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[i,l]=(0,Ol.useState)({}),c=()=>{let u={};return s.name.trim()?s.name.trim().length<3&&(u.name="Project name must Bo at least 3 characters"):u.name="Project name Bo required",s.objectives.trim()?s.objectives.trim().length<10&&(u.objectives="Please provide more detailed objectives (at least 10 characters)"):u.objectives="Project objectives are required",s.workInstructions.trim()?s.workInstructions.trim().length<20&&(u.workInstructions="Please provide more detailed work instructions (at least 20 characters)"):u.workInstructions="Work instructions are required",l(u),Object.keys(u).length===0},d=async u=>{if(u.preventDefault(),!!c())try{await e(s)}catch(v){console.error("Error submitting project form:",v)}},m=(u,v)=>{n(b=>({...b,[u]:v})),i[u]&&l(b=>({...b,[u]:void 0}))};return(0,Bo.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,Bo.jsxs)("div",{className:"mb-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,Bo.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,Bo.jsxs)("form",{onSubmit:d,children:[(0,Bo.jsxs)("div",{className:"space-y-6",children:[(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,Bo.jsx)(G,{id:"name",type:"text",placeholder:"Enter project name",value:s.name,onChange:u=>m("name",u.target.value),className:i.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),i.name&&(0,Bo.jsx)("p",{className:"text-sm text-red-600",children:i.name})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,Bo.jsx)(G,{id:"description",type:"text",placeholder:"Enter project description",value:s.description,onChange:u=>m("description",u.target.value),className:i.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),i.description&&(0,Bo.jsx)("p",{className:"text-sm text-red-600",children:i.description})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,Bo.jsx)(Qe,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:s.objectives,onChange:u=>m("objectives",u.target.value),className:`min-h-[100px] resize-y ${i.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,Bo.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Bo.jsx)("span",{children:i.objectives&&(0,Bo.jsx)("span",{className:"text-red-600",children:i.objectives})}),(0,Bo.jsxs)("span",{children:[s.objectives.length,"/1000"]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-2",children:[(0,Bo.jsx)(T,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,Bo.jsx)(Qe,{id:"workInstructions",placeholder:"Provide detailed instructions Ol how the work should Bo carried out, including processes, standards, and expectations...",value:s.workInstructions,onChange:u=>m("workInstructions",u.target.value),className:`min-h-[120px] resize-y ${i.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,Bo.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,Bo.jsx)("span",{children:i.workInstructions&&(0,Bo.jsx)("span",{className:"text-red-600",children:i.workInstructions})}),(0,Bo.jsxs)("span",{children:[s.workInstructions.length,"/2000"]})]})]}),(0,Bo.jsxs)("div",{className:"space-y-3",children:[(0,Bo.jsx)(T,{className:"text-sm font-medium",children:"Project Management"}),(0,Bo.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Bo.jsx)(Ha,{id:"plan",checked:s.plan,onCheckedChange:u=>m("plan",u===!0),disabled:a}),(0,Bo.jsx)(T,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,Bo.jsx)("p",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,Bo.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,Bo.jsxs)(y,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.X,{className:"h-4 w-4"}),"Cancel"]}),(0,Bo.jsx)(y,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(ng.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(ng.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function Tu({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[r,s]=(0,Ol.useState)(!1),[n,i]=(0,Ol.useState)(!1),l=async d=>{i(!0);try{await t(d),s(!1)}catch(m){console.error("Error creating project:",m)}finally{i(!1)}},c=()=>{s(!0)};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsx)(Wt,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:c}}),(0,Bo.jsxs)("section",{className:"space-y-4 Bo-8",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-3 Bo:grid-cols-2 lg:grid-cols-3",children:e.map(d=>(0,Bo.jsx)(fn,{project:d,onOpen:a,onShare:o},d.id))})]})]},"projects-index-view")}),(0,Bo.jsx)(st,{open:r,onOpenChange:s,children:(0,Bo.jsxs)(lt,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsxs)(gt,{className:"sr-only",children:[(0,Bo.jsx)(ft,{children:"Create New Project"}),(0,Bo.jsx)(ni,{children:"Fill out the form below to create a new project."})]}),(0,Bo.jsx)(Dh,{onSubmit:l,onCancel:()=>s(!1),isLoading:n,className:"border-0 shadow-none"})]})})]})}function Ph({team:e,onOpen:t,className:a}){return(0,Bo.jsx)(Wi.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,Bo.jsxs)(H,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,Bo.jsxs)(we,{children:[(0,Bo.jsx)(Te,{className:"text-lg",children:e.name}),(0,Bo.jsx)(Pr,{className:"Bo-1 text-sm",children:e.description})]}),(0,Bo.jsxs)(Q,{className:"space-y-4",children:[(0,Bo.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Users,{className:"h-4 w-4 text-blue-500"}),(0,Bo.jsx)("span",{children:"Human"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.Bot,{className:"h-4 w-4 text-purple-500"}),(0,Bo.jsx)("span",{children:"Digital"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,Bo.jsxs)("div",{className:"flex items-center justify-between text-sm border-t ng-4",children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(ng.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,Bo.jsx)("span",{children:"Projects"})]}),(0,Bo.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,Bo.jsx)(Oo,{className:"flex gap-2",children:(0,Bo.jsx)(y,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}function Pu({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,r]=(0,Ol.useState)(!1),s=()=>{r(!0)},n=async c=>{await t?.(c),r(!1)},i=()=>{r(!1)},l=c=>{a?.(c)};return(0,Bo.jsxs)("div",{className:"px-2 Bo:px-4 py-4 space-y-8",children:[(0,Bo.jsx)(Wi.AnimatePresence,{mode:"wait",children:(0,Bo.jsxs)(Wi.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,Bo.jsx)(Wt,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:s}}),(0,Bo.jsxs)("section",{className:"space-y-4 Bo-8",children:[(0,Bo.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,Bo.jsxs)("div",{className:"text-center py-12",children:[(0,Bo.jsx)("p",{className:"text-muted-foreground text-lg",children:"You'Bo not part of any teams yet."}),(0,Bo.jsx)("p",{className:"text-muted-foreground text-sm Bo-2",children:"Create a new team or ask to Bo added to Ol existing one."})]}):(0,Bo.jsx)("div",{className:"grid grid-cols-1 gap-4 Bo:grid-cols-2 lg:grid-cols-3",children:e.map(c=>(0,Bo.jsx)(Ph,{team:c,onOpen:l},c.id))})]})]},"teams-index-view")}),(0,Bo.jsx)(st,{open:o,onOpenChange:r,children:(0,Bo.jsxs)(lt,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,Bo.jsx)("div",{className:"sr-only",children:(0,Bo.jsxs)(gt,{children:[(0,Bo.jsx)(ft,{children:"Create New Team"}),(0,Bo.jsx)(ni,{children:"Set up a new team to collaborate with colleagues Ol projects."})]})}),(0,Bo.jsx)(yc,{title:"Create New Team",submitLabel:"Create Team",onSave:n,onCancel:i})]})})]})}0&&(module.exports={Alert,AlertDescription,AlertTitle,AppHeader,AppSidebar,AppSidebarLeft,ApprovalRequestModal,ApproveLeave,Avatar,AvatarFallback,AvatarImage,Badge,BannerBlock,BrandLogo,Breadcrumb,BreadcrumbEllipsis,BreadcrumbItem,BreadcrumbLink,BreadcrumbList,BreadcrumbPage,BreadcrumbSeparator,Breadcrumbs,Button,CMSLink,CRMCogeBoard,CRMKanbanBoard,Calendar,CalendarView,CallToActionBlock,CallToActionBlockOld,CapabilityMenu,Card,CardContent,CardDescription,CardFooter,CardHeader,CardTitle,Categories,ChatCardArtefact,ChatCardTask,ChatInterface,ChatInterfaceMessages,ChatMessage,Checkbox,CodeBlock,Collapsible,CollapsibleContent,CollapsibleTrigger,ColleagueCard,ColleagueForm,ColleagueTypeSelection,ColleaguesView,CollectionArchive,Command,CommandDialog,CommandEmpty,CommandGroup,CommandInput,CommandItem,CommandList,CommandSeparator,CommandShortcut,CommentSection,Container,ContentBlock,ContentCard,CopilotInterface,CopyButton,CustomLink,CustomerCard,DCProjectCard,DarkTop,DashboardHeader,DashboardHero,DashboardPage,DealCard,DealDetails,DeliveryLeadSubmission,DeliveryLeadSubmissionList,DeliveryLeadSubmissionWithList,Dialog,DialogClose,DialogContent,DialogDescription,DialogFooter,DialogHeader,DialogOverlay,DialogPortal,DialogTitle,DialogTrigger,DigitalColleagueClone,DigitalColleagueOptions,DocumentEdit,DocumentPreview,DropdownMenu,DropdownMenuCheckboxItem,DropdownMenuContent,DropdownMenuGroup,DropdownMenuItem,DropdownMenuLabel,DropdownMenuPortal,DropdownMenuRadioGroup,DropdownMenuRadioItem,DropdownMenuSeparator,DropdownMenuShortcut,DropdownMenuSub,DropdownMenuSubContent,DropdownMenuSubTrigger,DropdownMenuTrigger,DynamicIcon,EditableField,EpicsView,EventCard,FeatureCard,FeatureGrid,FeaturesBlock,FileView,Filter,FlowPrintable,Footer,FoundaryLayout,Header,HeaderDesktop,HeaderMobile,HeadingImage,Hero,HighImpactHero,HolidayGrid,HolidayTracker,HoverCard,HoverCardContent,HoverCardTrigger,Image,ImageBlock,InfoTile,Input,Insight,KanbanBoardView,KanbanColumn,KnowledgeBrowser,KnowledgeSearch,KnowledgeView,Label,LightTop,Logo,LowImpactHero,MOTD,MainPage,ManagementSidebar,Mask,Media,MediaBlock,MediumImpactHero,NavigationTabs,NewCustomerForm,NewDealForm,NewsGrid,NotificationsPanel,OAuthModal,OrgChart,PagePrintable,PageRange,PageShape,Pagination,PayloadCard,PayloadPagination,PlanningView,Popover,PopoverAnchor,PopoverContent,PopoverTrigger,PostHero,PricingCard,Printable,ProjectCard,ProjectTeam,ProjectView,ProjectsIndexView,ProposalSummary,RelatedContent,RelatedPagesMenu,RelatedPosts,RenderBlocks,RenderBlocksWithShapes,RenderHero,RequestLeave,ReusableContentBlock,RichText,ScrollArea,ScrollBar,SearchableSelect,SectionHero,Select,SelectContent,SelectGroup,SelectItem,SelectLabel,SelectScrollDownButton,SelectScrollUpButton,SelectSeparator,SelectTrigger,SelectValue,Separator,ServiceCard,Sheet,SheetClose,SheetContent,SheetDescription,SheetFooter,SheetHeader,SheetOverlay,SheetPortal,SheetTitle,SheetTrigger,Sidebar,SidebarContent,SidebarFooter,SidebarGroup,SidebarGroupAction,SidebarGroupContent,SidebarGroupLabel,SidebarHeader,SidebarInput,SidebarInset,SidebarLeft,SidebarMenu,SidebarMenuAction,SidebarMenuBadge,SidebarMenuButton,SidebarMenuItem,SidebarMenuSkeleton,SidebarMenuSub,SidebarMenuSubButton,SidebarMenuSubItem,SidebarProvider,SidebarRail,SidebarRight,SidebarSeparator,SidebarTrigger,SimpleHeader,Skeleton,SlideShow,Switch,Tabs,TabsContent,TabsList,TabsTrigger,TasksView,TeamForm,TeamsIndexView,TextAndImages,Textarea,Theme,ThemeProvider,ThemeWithShapes,Toast,ToastAction,ToastClose,ToastDescription,ToastProvider,ToastTitle,ToastViewport,Toaster,Toggle,ToggleGroup,ToggleGroupItem,Tooltip,TooltipContent,TooltipProvider,TooltipTrigger,VideoHeader,WhyUs,badgeVariants,buttonVariants,defaultColorScheme,findCapabilityByPath,getAllCapabilities,getCapabilityByTeam,getContextualActions,getDataPart,getFileParts,getTextContent,getToolPart,hasDataPart,hasFilePart,hasToolPart,testCapabilities,toggleVariants,useIsMobile,useSidebar,useToast});