cortex-react-components 2.14.0 → 2.15.0

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 (59) hide show
  1. package/dist/chunk-5Y6FKL5W.mjs +4 -0
  2. package/dist/{chunk-F2Y3ELUO.mjs → chunk-A2KX5N75.mjs} +1 -1
  3. package/dist/chunk-EW6KWAHS.mjs +4 -0
  4. package/dist/{chunk-2Z5N6HIX.mjs → chunk-JTVWQ42C.mjs} +1 -1
  5. package/dist/{chunk-GSOFCLPO.mjs → chunk-RX63ABAF.mjs} +1 -1
  6. package/dist/chunk-UTHKFW4R.mjs +1 -0
  7. package/dist/components/Chat/ChatInterface.js +10 -9
  8. package/dist/components/Chat/ChatInterface.mjs +1 -1
  9. package/dist/components/Chat/CopilotInterface.js +11 -10
  10. package/dist/components/Chat/CopilotInterface.mjs +1 -1
  11. package/dist/components/Chat/PartTypes/Reasoning.css +1 -0
  12. package/dist/components/Chat/PartTypes/Reasoning.d.ts +16 -0
  13. package/dist/components/Chat/PartTypes/Reasoning.js +5 -0
  14. package/dist/components/Chat/PartTypes/Reasoning.mjs +2 -0
  15. package/dist/components/Chat/PartTypes/Response.css +1 -0
  16. package/dist/components/Chat/PartTypes/Response.d.ts +5 -0
  17. package/dist/components/Chat/PartTypes/Response.js +4 -0
  18. package/dist/components/Chat/PartTypes/Response.mjs +2 -0
  19. package/dist/components/Chat/PartTypes/index.css +1 -0
  20. package/dist/components/Chat/PartTypes/index.d.ts +2 -0
  21. package/dist/components/Chat/PartTypes/index.js +11 -10
  22. package/dist/components/Chat/PartTypes/index.mjs +1 -1
  23. package/dist/components/Chat/demo-long-messages.js +21 -20
  24. package/dist/components/Chat/demo-long-messages.mjs +1 -1
  25. package/dist/components/Chat/demo-tests.js +38 -37
  26. package/dist/components/Chat/demo-tests.mjs +1 -1
  27. package/dist/components/Chat/demo.js +11 -10
  28. package/dist/components/Chat/demo.mjs +1 -1
  29. package/dist/components/Chat/example-usage.js +11 -10
  30. package/dist/components/Chat/example-usage.mjs +1 -1
  31. package/dist/components/Chat/example-with-vercel-ai.js +11 -10
  32. package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
  33. package/dist/components/Chat/index.js +11 -10
  34. package/dist/components/Chat/index.mjs +1 -1
  35. package/dist/components/Foundary/Views/index.mjs +1 -1
  36. package/dist/components/Foundary/index.mjs +1 -1
  37. package/dist/components/Heros/RenderHero.mjs +1 -1
  38. package/dist/components/Heros/index.mjs +1 -1
  39. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  40. package/dist/components/Layouts/Print.mjs +1 -1
  41. package/dist/components/Layouts/SlideShow.mjs +1 -1
  42. package/dist/components/Layouts/index.mjs +1 -1
  43. package/dist/components/Payload/index.mjs +1 -1
  44. package/dist/components/index.js +19 -19
  45. package/dist/components/index.mjs +1 -1
  46. package/dist/globals.css +1 -1
  47. package/dist/index.js +18 -18
  48. package/dist/index.mjs +1 -1
  49. package/dist/metafile-cjs.json +1 -1
  50. package/dist/metafile-esm.json +1 -1
  51. package/dist/pages/LandingPage.mjs +1 -1
  52. package/dist/pages/Page.mjs +1 -1
  53. package/dist/pages/Publish.mjs +1 -1
  54. package/dist/pages/Website.mjs +1 -1
  55. package/dist/sections/PageSections.mjs +1 -1
  56. package/dist/sections/ServiceSection.mjs +1 -1
  57. package/dist/sections/index.mjs +1 -1
  58. package/package.json +6 -4
  59. package/dist/chunk-4RGIPI27.mjs +0 -1
@@ -1,23 +1,24 @@
1
1
  "use client";
2
2
  "use strict";
3
3
  "use client"
4
+ 'use client';
4
5
 
5
- "use strict";var Io=Object.create;var xt=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var Eo=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty;var zo=(e,t)=>{for(var a in t)xt(e,a,{get:t[a],enumerable:!0})},ba=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Bo(t))!Uo.call(e,l)&&l!==a&&xt(e,l,{get:()=>t[l],enumerable:!(o=Lo(t,l))||o.enumerable});return e};var $=(e,t,a)=>(a=e!=null?Io(Eo(e)):{},ba(t||!e||!e.__esModule?xt(a,"default",{value:e,enumerable:!0}):a,e)),Fo=e=>ba(xt({},"__esModule",{value:!0}),e);var Qi={};zo(Qi,{ApprovalRequestModal:()=>ma,CapabilityMenu:()=>na,ChatCardArtefact:()=>Kt,ChatCardTask:()=>mt,ChatInterface:()=>zt,ChatInterfaceMessages:()=>Ci,ChatMessage:()=>Wt,CopilotInterface:()=>$i,OAuthModal:()=>la,defaultColorScheme:()=>qt,findCapabilityByPath:()=>Ni,getAllCapabilities:()=>Pi,getCapabilityByTeam:()=>ki,getContextualActions:()=>Pt,getDataPart:()=>Xi,getFileParts:()=>_i,getTextContent:()=>Wi,getToolPart:()=>qi,hasDataPart:()=>Ji,hasFilePart:()=>Ki,hasToolPart:()=>Gi,testCapabilities:()=>kt});module.exports=Fo(Qi);var Ma=$(require("react"));var wt=$(require("react")),Le=$(require("@radix-ui/react-avatar"));var Pa=require("clsx");var Vt="-",jo=e=>{let t=Oo(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{let i=n.split(Vt);return i[0]===""&&i.length!==1&&i.shift(),ya(i,t)||Ho(n)},getConflictingClassGroupIds:(n,i)=>{let p=a[n]||[];return i&&o[n]?[...p,...o[n]]:p}}},ya=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),l=o?ya(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;let r=e.join(Vt);return t.validators.find(({validator:n})=>n(r))?.classGroupId},va=/^\[(.+)\]$/,Ho=e=>{if(va.test(e)){let t=va.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},Oo=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return $o(Object.entries(e.classGroups),a).forEach(([r,n])=>{Ot(n,o,r,t)}),o},Ot=(e,t,a,o)=>{e.forEach(l=>{if(typeof l=="string"){let r=l===""?t:ha(t,l);r.classGroupId=a;return}if(typeof l=="function"){if(Vo(l)){Ot(l(o),t,a,o);return}t.validators.push({validator:l,classGroupId:a});return}Object.entries(l).forEach(([r,n])=>{Ot(n,ha(t,r),a,o)})})},ha=(e,t)=>{let a=e;return t.split(Vt).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Vo=e=>e.isThemeGetter,$o=(e,t)=>t?e.map(([a,o])=>{let l=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([n,i])=>[t+n,i])):r);return[a,l]}):e,Wo=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,l=(r,n)=>{a.set(r,n),t++,t>e&&(t=0,o=a,a=new Map)};return{get(r){let n=a.get(r);if(n!==void 0)return n;if((n=o.get(r))!==void 0)return l(r,n),n},set(r,n){a.has(r)?a.set(r,n):l(r,n)}}},xa="!",Go=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,l=t[0],r=t.length,n=i=>{let p=[],m=0,k=0,f;for(let x=0;x<i.length;x++){let A=i[x];if(m===0){if(A===l&&(o||i.slice(x,x+r)===t)){p.push(i.slice(k,x)),k=x+r;continue}if(A==="/"){f=x;continue}}A==="["?m++:A==="]"&&m--}let y=p.length===0?i:i.substring(k),T=y.startsWith(xa),z=T?y.substring(1):y,R=f&&f>k?f-k:void 0;return{modifiers:p,hasImportantModifier:T,baseClassName:z,maybePostfixModifierPosition:R}};return a?i=>a({className:i,parseClassName:n}):n},qo=e=>{if(e.length<=1)return e;let t=[],a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},Ko=e=>({cache:Wo(e.cacheSize),parseClassName:Go(e),...jo(e)}),_o=/\Ct+/,Jo=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:l}=t,r=[],n=e.trim().split(_o),i="";for(let p=n.length-1;p>=0;p-=1){let m=n[p],{modifiers:k,hasImportantModifier:f,baseClassName:y,maybePostfixModifierPosition:T}=a(m),z=!!T,R=o(z?y.substring(0,T):y);if(!R){if(!z){i=m+(i.length>0?" "+i:i);continue}if(R=o(y),!R){i=m+(i.length>0?" "+i:i);continue}z=!1}let x=qo(k).join(":"),A=f?x+xa:x,F=A+R;if(r.includes(F))continue;r.push(F);let w=l(R,z);for(let E=0;E<w.length;++E){let ee=w[E];r.push(A+ee)}i=m+(i.length>0?" "+i:i)}return i};function Xo(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=wa(t))&&(o&&(o+=" "),o+=a);return o}var wa=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=wa(e[o]))&&(a&&(a+=" "),a+=t);return a};function Qo(e,...t){let a,o,l,r=n;function n(p){let m=t.reduce((k,f)=>f(k),e());return a=Ko(m),o=a.cache.get,l=a.cache.set,r=i,i(p)}function i(p){let m=o(p);if(m)return m;let k=Jo(p,a);return l(p,k),k}return function(){return r(Xo.apply(null,arguments))}}var O=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},Ca=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yo=/^\d+\/\d+$/,Zo=new Set(["px","full","screen"]),ei=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ti=/\d+(%|px|r?em|[sdl]?Ct([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|Ct|min|max))|\Ct(calc|min|max|clamp)\(.+\)|^0$/,ai=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,oi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ii=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ie=e=>et(e)||Zo.has(e)||Yo.test(e),He=e=>tt(e,"length",mi),et=e=>!!e&&!Number.isNaN(Number(e)),Ht=e=>tt(e,"number",et),ct=e=>!!e&&Number.isInteger(Number(e)),ri=e=>e.endsWith("%")&&et(e.slice(0,-1)),h=e=>Ca.test(e),Oe=e=>ei.test(e),ni=new Set(["length","size","percentage"]),si=e=>tt(e,ni,Na),li=e=>tt(e,"position",Na),ci=new Set(["image","url"]),di=e=>tt(e,ci,gi),pi=e=>tt(e,"",ui),dt=()=>!0,tt=(e,t,a)=>{let o=Ca.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},mi=e=>ti.test(e)&&!ai.test(e),Na=()=>!1,ui=e=>oi.test(e),gi=e=>ii.test(e);var fi=()=>{let e=O("colors"),t=O("spacing"),a=O("blur"),o=O("brightness"),l=O("borderColor"),r=O("borderRadius"),n=O("borderSpacing"),i=O("borderWidth"),p=O("contrast"),m=O("grayscale"),k=O("hueRotate"),f=O("invert"),y=O("gap"),T=O("gradientColorStops"),z=O("gradientColorStopPositions"),R=O("inset"),x=O("margin"),A=O("opacity"),F=O("padding"),w=O("saturate"),E=O("scale"),ee=O("sepia"),te=O("skew"),ae=O("space"),Z=O("translate"),q=()=>["auto","contain","none"],re=()=>["auto","hidden","clip","visible","scroll"],ce=()=>["auto",h,t],M=()=>[h,t],Se=()=>["",Ie,He],d=()=>["auto",et,h],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],u=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",h],_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>[et,h];return{cacheSize:500,separator:":",theme:{colors:[dt],spacing:[Ie,He],blur:["none","",Oe,h],brightness:S(),borderColor:[e],borderRadius:["none","","full",Oe,h],borderSpacing:M(),borderWidth:Se(),contrast:S(),grayscale:j(),hueRotate:S(),invert:j(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[ri,He],inset:ce(),margin:ce(),opacity:S(),padding:M(),saturate:S(),scale:S(),sepia:j(),skew:S(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",h]}],container:["container"],columns:[{columns:[Oe]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),h]}],overflow:[{overflow:re()}],"overflow-x":[{"overflow-x":re()}],"overflow-y":[{"overflow-y":re()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[R]}],"inset-x":[{"inset-x":[R]}],"inset-y":[{"inset-y":[R]}],start:[{start:[R]}],end:[{end:[R]}],top:[{top:[R]}],right:[{right:[R]}],bottom:[{bottom:[R]}],left:[{left:[R]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ct,h]}],basis:[{basis:ce()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",h]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",ct,h]}],"grid-cols":[{"grid-cols":[dt]}],"col-start-end":[{col:["auto",{span:["full",ct,h]},h]}],"col-start":[{"col-start":d()}],"col-end":[{"col-end":d()}],"grid-rows":[{"grid-rows":[dt]}],"row-start-end":[{row:["auto",{span:[ct,h]},h]}],"row-start":[{"row-start":d()}],"row-end":[{"row-end":d()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",h]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",h]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...u()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...u(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...u(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[F]}],px:[{px:[F]}],py:[{py:[F]}],ps:[{ps:[F]}],pe:[{pe:[F]}],pt:[{pt:[F]}],pr:[{pr:[F]}],pb:[{pb:[F]}],pl:[{pl:[F]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[ae]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ae]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",h,t]}],"min-w":[{"min-w":[h,t,"min","max","fit"]}],"max-w":[{"max-w":[h,t,"none","full","min","max","fit","prose",{screen:[Oe]},Oe]}],h:[{h:[h,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[h,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Oe,He]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ht]}],"font-family":[{font:[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",h]}],"line-clamp":[{"line-clamp":["none",et,Ht]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ie,h]}],"list-image":[{"list-image":["none",h]}],"list-style-type":[{list:["none","disc","decimal",h]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[A]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ie,He]}],"underline-offset":[{"underline-offset":["auto",Ie,h]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[A]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),li]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",si]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","Ct","bl","l","tl"]},di]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[z]}],"gradient-via-pos":[{via:[z]}],"gradient-to-pos":[{to:[z]}],"gradient-from":[{from:[T]}],"gradient-via":[{via:[T]}],"gradient-to":[{to:[T]}],rounded:[{rounded:[r]}],"rounded-Ct":[{"rounded-Ct":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-Ct":[{"rounded-Ct":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-Aa":[{"rounded-Aa":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-Ct":[{"border-Ct":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-Ct":[{"border-Ct":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[A]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[A]}],"divide-style":[{divide:I()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-Ct":[{"border-Ct":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-Ct":[{"border-Ct":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[Ie,h]}],"outline-w":[{outline:[Ie,He]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[A]}],"ring-offset-w":[{"ring-offset":[Ie,He]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Oe,pi]}],"shadow-color":[{shadow:[dt]}],opacity:[{opacity:[A]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Oe,h]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[k]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[ee]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[k]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[A]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[n]}],"border-spacing-x":[{"border-spacing-x":[n]}],"border-spacing-y":[{"border-spacing-y":[n]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",h]}],duration:[{duration:S()}],ease:[{ease:["linear","in","out","in-out",h]}],delay:[{delay:S()}],animate:[{animate:["none","spin","ping","pulse","bounce",h]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[ct,h]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[te]}],"skew-y":[{"skew-y":[te]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",h]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","Ct-resize","w-resize","ne-resize","nw-resize","Aa-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",h]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",h]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ie,He,Ht]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-Ct","rounded-e","rounded-t","rounded-r","rounded-Ct","rounded-l","rounded-ss","rounded-Aa","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-Ct":["rounded-ss","rounded-es"],"rounded-e":["rounded-Aa","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-Ct":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-Ct","border-w-e","border-w-t","border-w-r","border-w-Ct","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-Ct"],"border-color":["border-color-Ct","border-color-e","border-color-t","border-color-r","border-color-Ct","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-Ct"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var ka=Qo(fi);function c(...e){return ka((0,Pa.clsx)(e))}var Ct=require("react/jsx-runtime"),ge=wt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(Le.Root,{ref:a,className:c("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ge.displayName=Le.Root.displayName;var Ve=wt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(Le.Image,{ref:a,className:c("aspect-square h-full w-full",e),...t}));Ve.displayName=Le.Image.displayName;var fe=wt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(Le.Fallback,{ref:a,className:c("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));fe.displayName=Le.Fallback.displayName;var _e=$(require("react"));var be=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("rounded-xl border bg-card text-card-foreground shadow",e),...t}));be.displayName="Card";var Be=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("flex flex-col space-y-1.5 p-6",e),...t}));Be.displayName="CardHeader";var Ee=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("font-semibold leading-none tracking-tight",e),...t}));Ee.displayName="CardTitle";var $t=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("text-sm text-muted-foreground",e),...t}));$t.displayName="CardDescription";var Pe=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("p-6 pt-0",e),...t}));Pe.displayName="CardContent";var pt=_e.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)("div",{ref:a,className:c("flex items-center p-6 pt-0",e),...t}));pt.displayName="CardFooter";var Da=require("class-variance-authority");var bi=(0,Da.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function me({className:e,variant:t,...a}){return(0,Ct.jsx)("div",{className:c(bi({variant:t}),e),...a})}var Aa=require("lucide-react"),Sa=require("date-fns");var at=require("react");function Ra({taskId:e,polling:t=!0,system:a="payload"}){let[o,l]=(0,at.useState)(null),[r,n]=(0,at.useState)(!1),[i,p]=(0,at.useState)(null),m=async(f=!0)=>{if(e){f&&n(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let T=await y.json();l(T)}catch(y){console.error("Error fetching task:",y),p(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&n(!1)}}},k=()=>m(!1);return(0,at.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(k,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:o,loading:r,error:i}}var vi=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},hi=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function mt({data:e}){let{id:t,system:a,fetchLatest:o,taskData:l,error:r}=e||{};if(!t)return null;let n=null,i=!0,p=r,m=o!==void 0?o:!0;if(n=l||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:o,system:a,fetchLatest:m,taskData:n,error:p}),m){let{task:T,loading:z,error:R}=Ra({taskId:t,system:a});n=T,i=z,p=R}else i=!1;let k=vi(n?.status||"todo"),f=hi(n?.status||"todo"),y=n?.dateLogged||new Date().toISOString();try{let T=new Date(n?.dateLogged||"");isNaN(T.getTime())||(y=(0,Sa.formatDistanceToNow)(T,{addSuffix:!0}))}catch{}return(0,Ct.jsxs)(be,{className:c("w-full max-w-md shadow-md",p&&"border border-destructive"),children:[(0,Ct.jsxs)(Be,{className:"pb-2",children:[(0,Ct.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Ct.jsx)(Ee,{className:"text-lg font-semibold",children:i?"Loading...":n?.name||"Task"}),(0,Ct.jsx)(me,{className:`${k}`,children:f})]}),n?.project&&(0,Ct.jsxs)($t,{className:"text-sm text-gray-500",children:["Project: ",n.project.name]})]}),(0,Ct.jsx)(Pe,{className:"pb-2",children:i?(0,Ct.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):p?(0,Ct.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Ct.jsx)("p",{className:"text-sm text-foreground",children:n?.description||"......."})}),(0,Ct.jsx)(pt,{className:"pt-2 flex items-center justify-between",children:(0,Ct.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Ct.jsx)(Aa.Clock,{className:"h-3 w-3 mr-1"}),(0,Ct.jsxs)("span",{children:["Created ",y]}),(0,Ct.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Ct.jsxs)("span",{children:["Task #",t]})]})})]})}var yi={task:mt},xi=`
6
+ "use strict";var _o=Object.create;var Nt=Object.defineProperty;var Jo=Object.getOwnPropertyDescriptor;var Xo=Object.getOwnPropertyNames;var Qo=Object.getPrototypeOf,Yo=Object.prototype.hasOwnProperty;var Zo=(e,t)=>{for(var a in t)Nt(e,a,{get:t[a],enumerable:!0})},Pa=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Xo(t))!Yo.call(e,l)&&l!==a&&Nt(e,l,{get:()=>t[l],enumerable:!(o=Jo(t,l))||o.enumerable});return e};var V=(e,t,a)=>(a=e!=null?_o(Qo(e)):{},Pa(t||!e||!e.__esModule?Nt(a,"default",{value:e,enumerable:!0}):a,e)),ei=e=>Pa(Nt({},"__esModule",{value:!0}),e);var vr={};Zo(vr,{ApprovalRequestModal:()=>ba,CapabilityMenu:()=>da,ChatCardArtefact:()=>Qt,ChatCardTask:()=>ft,ChatInterface:()=>Ht,ChatInterfaceMessages:()=>Fi,ChatMessage:()=>_t,CopilotInterface:()=>cr,OAuthModal:()=>ma,defaultColorScheme:()=>Xt,findCapabilityByPath:()=>ji,getAllCapabilities:()=>Hi,getCapabilityByTeam:()=>Oi,getContextualActions:()=>Rt,getDataPart:()=>br,getFileParts:()=>gr,getTextContent:()=>dr,getToolPart:()=>mr,hasDataPart:()=>fr,hasFilePart:()=>ur,hasToolPart:()=>pr,testCapabilities:()=>Tt});module.exports=ei(vr);var Oa=V(require("react"));var kt=V(require("react")),Ee=V(require("@radix-ui/react-avatar"));var Ba=require("clsx");var qt="-",ti=e=>{let t=oi(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{let i=s.split(qt);return i[0]===""&&i.length!==1&&i.shift(),Ra(i,t)||ai(s)},getConflictingClassGroupIds:(s,i)=>{let d=a[s]||[];return i&&o[s]?[...d,...o[s]]:d}}},Ra=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),l=o?Ra(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;let r=e.join(qt);return t.validators.find(({validator:s})=>s(r))?.classGroupId},Da=/^\[(.+)\]$/,ai=e=>{if(Da.test(e)){let t=Da.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},oi=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return ri(Object.entries(e.classGroups),a).forEach(([r,s])=>{Gt(s,o,r,t)}),o},Gt=(e,t,a,o)=>{e.forEach(l=>{if(typeof l=="string"){let r=l===""?t:Ta(t,l);r.classGroupId=a;return}if(typeof l=="function"){if(ii(l)){Gt(l(o),t,a,o);return}t.validators.push({validator:l,classGroupId:a});return}Object.entries(l).forEach(([r,s])=>{Gt(s,Ta(t,r),a,o)})})},Ta=(e,t)=>{let a=e;return t.split(qt).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},ii=e=>e.isThemeGetter,ri=(e,t)=>t?e.map(([a,o])=>{let l=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,i])=>[t+s,i])):r);return[a,l]}):e,ni=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,l=(r,s)=>{a.set(r,s),t++,t>e&&(t=0,o=a,a=new Map)};return{get(r){let s=a.get(r);if(s!==void 0)return s;if((s=o.get(r))!==void 0)return l(r,s),s},set(r,s){a.has(r)?a.set(r,s):l(r,s)}}},Aa="!",si=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,l=t[0],r=t.length,s=i=>{let d=[],m=0,w=0,f;for(let x=0;x<i.length;x++){let P=i[x];if(m===0){if(P===l&&(o||i.slice(x,x+r)===t)){d.push(i.slice(w,x)),w=x+r;continue}if(P==="/"){f=x;continue}}P==="["?m++:P==="]"&&m--}let h=d.length===0?i:i.substring(w),R=h.startsWith(Aa),M=R?h.substring(1):h,T=f&&f>w?f-w:void 0;return{modifiers:d,hasImportantModifier:R,baseClassName:M,maybePostfixModifierPosition:T}};return a?i=>a({className:i,parseClassName:s}):s},li=e=>{if(e.length<=1)return e;let t=[],a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},ci=e=>({cache:ni(e.cacheSize),parseClassName:si(e),...ti(e)}),di=/\s+/,pi=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:l}=t,r=[],s=e.trim().split(di),i="";for(let d=s.length-1;d>=0;d-=1){let m=s[d],{modifiers:w,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:R}=a(m),M=!!R,T=o(M?h.substring(0,R):h);if(!T){if(!M){i=m+(i.length>0?" "+i:i);continue}if(T=o(h),!T){i=m+(i.length>0?" "+i:i);continue}M=!1}let x=li(w).join(":"),P=f?x+Aa:x,F=P+T;if(r.includes(F))continue;r.push(F);let C=l(T,M);for(let z=0;z<C.length;++z){let ee=C[z];r.push(P+ee)}i=m+(i.length>0?" "+i:i)}return i};function mi(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=Sa(t))&&(o&&(o+=" "),o+=a);return o}var Sa=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=Sa(e[o]))&&(a&&(a+=" "),a+=t);return a};function ui(e,...t){let a,o,l,r=s;function s(d){let m=t.reduce((w,f)=>f(w),e());return a=ci(m),o=a.cache.get,l=a.cache.set,r=i,i(d)}function i(d){let m=o(d);if(m)return m;let w=pi(d,a);return l(d,w),w}return function(){return r(mi.apply(null,arguments))}}var H=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},Ma=/^\[(?:([a-z-]+):)?(.+)\]$/i,gi=/^\d+\/\d+$/,fi=new Set(["px","full","screen"]),bi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vi=/\d+(%|px|r?em|[sdl]?Pt([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|Pt|min|max))|\Pt(calc|min|max|clamp)\(.+\)|^0$/,hi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,yi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>at(e)||fi.has(e)||gi.test(e),Ve=e=>ot(e,"length",Ri),at=e=>!!e&&!Number.isNaN(Number(e)),Wt=e=>ot(e,"number",at),mt=e=>!!e&&Number.isInteger(Number(e)),wi=e=>e.endsWith("%")&&at(e.slice(0,-1)),y=e=>Ma.test(e),$e=e=>bi.test(e),Ci=new Set(["length","size","percentage"]),Ni=e=>ot(e,Ci,Ia),ki=e=>ot(e,"position",Ia),Pi=new Set(["image","url"]),Di=e=>ot(e,Pi,Si),Ti=e=>ot(e,"",Ai),ut=()=>!0,ot=(e,t,a)=>{let o=Ma.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},Ri=e=>vi.test(e)&&!hi.test(e),Ia=()=>!1,Ai=e=>yi.test(e),Si=e=>xi.test(e);var Mi=()=>{let e=H("colors"),t=H("spacing"),a=H("blur"),o=H("brightness"),l=H("borderColor"),r=H("borderRadius"),s=H("borderSpacing"),i=H("borderWidth"),d=H("contrast"),m=H("grayscale"),w=H("hueRotate"),f=H("invert"),h=H("gap"),R=H("gradientColorStops"),M=H("gradientColorStopPositions"),T=H("inset"),x=H("margin"),P=H("opacity"),F=H("padding"),C=H("saturate"),z=H("scale"),ee=H("sepia"),te=H("skew"),ae=H("space"),Z=H("translate"),q=()=>["auto","contain","none"],re=()=>["auto","hidden","clip","visible","scroll"],de=()=>["auto",y,t],I=()=>[y,t],Ie=()=>["",Be,Ve],p=()=>["auto",at,y],E=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L=()=>["solid","dashed","dotted","double","none"],_=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],u=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",y],J=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>[at,y];return{cacheSize:500,separator:":",theme:{colors:[ut],spacing:[Be,Ve],blur:["none","",$e,y],brightness:A(),borderColor:[e],borderRadius:["none","","full",$e,y],borderSpacing:I(),borderWidth:Ie(),contrast:A(),grayscale:j(),hueRotate:A(),invert:j(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[wi,Ve],inset:de(),margin:de(),opacity:A(),padding:I(),saturate:A(),scale:A(),sepia:j(),skew:A(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",y]}],container:["container"],columns:[{columns:[$e]}],"break-after":[{"break-after":J()}],"break-before":[{"break-before":J()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...E(),y]}],overflow:[{overflow:re()}],"overflow-x":[{"overflow-x":re()}],"overflow-y":[{"overflow-y":re()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[T]}],"inset-x":[{"inset-x":[T]}],"inset-y":[{"inset-y":[T]}],start:[{start:[T]}],end:[{end:[T]}],top:[{top:[T]}],right:[{right:[T]}],bottom:[{bottom:[T]}],left:[{left:[T]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",mt,y]}],basis:[{basis:de()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",y]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",mt,y]}],"grid-cols":[{"grid-cols":[ut]}],"col-start-end":[{col:["auto",{span:["full",mt,y]},y]}],"col-start":[{"col-start":p()}],"col-end":[{"col-end":p()}],"grid-rows":[{"grid-rows":[ut]}],"row-start-end":[{row:["auto",{span:[mt,y]},y]}],"row-start":[{"row-start":p()}],"row-end":[{"row-end":p()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",y]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",y]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...u()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...u(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...u(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[F]}],px:[{px:[F]}],py:[{py:[F]}],ps:[{ps:[F]}],it:[{it:[F]}],pt:[{pt:[F]}],pr:[{pr:[F]}],pb:[{pb:[F]}],pl:[{pl:[F]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[ae]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ae]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",y,t]}],"min-w":[{"min-w":[y,t,"min","max","fit"]}],"max-w":[{"max-w":[y,t,"none","full","min","max","fit","prose",{screen:[$e]},$e]}],h:[{h:[y,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[y,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[y,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[y,t,"auto","min","max","fit"]}],"font-size":[{text:["base",$e,Ve]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wt]}],"font-family":[{font:[ut]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",y]}],"line-clamp":[{"line-clamp":["none",at,Wt]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Be,y]}],"list-image":[{"list-image":["none",y]}],"list-style-type":[{list:["none","disc","decimal",y]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[P]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Be,Ve]}],"underline-offset":[{"underline-offset":["auto",Be,y]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[P]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...E(),ki]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ni]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","Pt","bl","l","tl"]},Di]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[M]}],"gradient-via-pos":[{via:[M]}],"gradient-to-pos":[{to:[M]}],"gradient-from":[{from:[R]}],"gradient-via":[{via:[R]}],"gradient-to":[{to:[R]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-Pt":[{"rounded-Pt":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-Fa":[{"rounded-Fa":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-Pt":[{"border-Pt":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[P]}],"border-style":[{border:[...L(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[P]}],"divide-style":[{divide:L()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-Pt":[{"border-Pt":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...L()]}],"outline-offset":[{"outline-offset":[Be,y]}],"outline-w":[{outline:[Be,Ve]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[P]}],"ring-offset-w":[{"ring-offset":[Be,Ve]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",$e,Ti]}],"shadow-color":[{shadow:[ut]}],opacity:[{opacity:[P]}],"mix-blend":[{"mix-blend":[..._(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":_()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",$e,y]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[w]}],invert:[{invert:[f]}],saturate:[{saturate:[C]}],sepia:[{sepia:[ee]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[w]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[P]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",y]}],duration:[{duration:A()}],ease:[{ease:["linear","in","out","in-out",y]}],delay:[{delay:A()}],animate:[{animate:["none","spin","ping","pulse","bounce",y]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[mt,y]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[te]}],"skew-y":[{"skew-y":[te]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",y]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","Pt-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","Fa-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",y]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-it":[{"scroll-it":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",y]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Be,Ve,Wt]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","it","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-Pt","rounded-l","rounded-ss","rounded-Fa","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-Fa","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-Pt":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-Pt","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-Pt"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-Pt","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-Pt"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-it","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var La=ui(Mi);function c(...e){return La((0,Ba.clsx)(e))}var Pt=require("react/jsx-runtime"),be=kt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(Ee.Root,{ref:a,className:c("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));be.displayName=Ee.Root.displayName;var We=kt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(Ee.Image,{ref:a,className:c("aspect-square h-full w-full",e),...t}));We.displayName=Ee.Image.displayName;var ve=kt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(Ee.Fallback,{ref:a,className:c("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ve.displayName=Ee.Fallback.displayName;var Xe=V(require("react"));var he=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("rounded-xl border bg-card text-card-foreground shadow",e),...t}));he.displayName="Card";var ze=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("flex flex-col space-y-1.5 p-6",e),...t}));ze.displayName="CardHeader";var Ue=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("font-semibold leading-none tracking-tight",e),...t}));Ue.displayName="CardTitle";var Kt=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("text-sm text-muted-foreground",e),...t}));Kt.displayName="CardDescription";var Te=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("p-6 pt-0",e),...t}));Te.displayName="CardContent";var gt=Xe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)("div",{ref:a,className:c("flex items-center p-6 pt-0",e),...t}));gt.displayName="CardFooter";var Ea=require("class-variance-authority");var Ii=(0,Ea.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ge({className:e,variant:t,...a}){return(0,Pt.jsx)("div",{className:c(Ii({variant:t}),e),...a})}var Fa=require("lucide-react"),ja=require("date-fns");var it=require("react");function Ua({taskId:e,polling:t=!0,system:a="payload"}){let[o,l]=(0,it.useState)(null),[r,s]=(0,it.useState)(!1),[i,d]=(0,it.useState)(null),m=async(f=!0)=>{if(e){f&&s(!0);try{let h=await fetch(`/api/tasks/${e}`);if(!h.ok)throw new Error(`Failed to fetch task: ${h.statusText}`);let R=await h.json();l(R)}catch(h){console.error("Error fetching task:",h),d(h instanceof Error?h:new Error("Unknown error occurred"))}finally{f&&s(!1)}}},w=()=>m(!1);return(0,it.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:o,loading:r,error:i}}var Li=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},Bi=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function ft({data:e}){let{id:t,system:a,fetchLatest:o,taskData:l,error:r}=e||{};if(!t)return null;let s=null,i=!0,d=r,m=o!==void 0?o:!0;if(s=l||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:o,system:a,fetchLatest:m,taskData:s,error:d}),m){let{task:R,loading:M,error:T}=Ua({taskId:t,system:a});s=R,i=M,d=T}else i=!1;let w=Li(s?.status||"todo"),f=Bi(s?.status||"todo"),h=s?.dateLogged||new Date().toISOString();try{let R=new Date(s?.dateLogged||"");isNaN(R.getTime())||(h=(0,ja.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Pt.jsxs)(he,{className:c("w-full max-w-md shadow-md",d&&"border border-destructive"),children:[(0,Pt.jsxs)(ze,{className:"pb-2",children:[(0,Pt.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Pt.jsx)(Ue,{className:"text-lg font-semibold",children:i?"Loading...":s?.name||"Task"}),(0,Pt.jsx)(ge,{className:`${w}`,children:f})]}),s?.project&&(0,Pt.jsxs)(Kt,{className:"text-sm text-gray-500",children:["Project: ",s.project.name]})]}),(0,Pt.jsx)(Te,{className:"pb-2",children:i?(0,Pt.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):d?(0,Pt.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Pt.jsx)("p",{className:"text-sm text-foreground",children:s?.description||"......."})}),(0,Pt.jsx)(gt,{className:"pt-2 flex items-center justify-between",children:(0,Pt.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Pt.jsx)(Fa.Clock,{className:"h-3 w-3 mr-1"}),(0,Pt.jsxs)("span",{children:["Created ",h]}),(0,Pt.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Pt.jsxs)("span",{children:["Task #",t]})]})})]})}var Ei={task:ft},zi=`
6
7
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="white" width="20" height="20">
7
8
  <path d="M327.5 85.2c-4.5 1.7-7.5 6-7.5 10.8s3 9.1 7.5 10.8L384 128l21.2 56.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L448 128l56.5-21.2c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L448 64 426.8 7.5C425.1 3 420.8 0 416 0s-9.1 3-10.8 7.5L384 64 327.5 85.2zM205.1 73.3c-2.6-5.7-8.3-9.3-14.5-9.3s-11.9 3.6-14.5 9.3L123.3 187.3 9.3 240C3.6 242.6 0 248.3 0 254.6s3.6 11.9 9.3 14.5l114.1 52.7L176 435.8c2.6 5.7 8.3 9.3 14.5 9.3s11.9-3.6 14.5-9.3l52.7-114.1 114.1-52.7c5.7-2.6 9.3-8.3 9.3-14.5s-3.6-11.9-9.3-14.5L257.8 187.4 205.1 73.3zM384 384l-56.5 21.2c-4.5 1.7-7.5 6-7.5 10.8s3 9.1 7.5 10.8L384 448l21.2 56.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L448 448l56.5-21.2c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L448 384l-21.2-56.5c-1.7-4.5-6-7.5-10.8-7.5s-9.1 3-10.8 7.5L384 384z"/>
8
- </svg>`,wi=`data:image/svg+xml;utf8,${encodeURIComponent(xi)}`,Wt=Ma.default.memo(function(t){let{id:a,message:o,currentUser:l,role:r}=t,n=r==="user",i=n?l?.name||"You":l?.name||"AI Assistant",p=n?l?.avatar||"/placeholder-user.jpg":"/placeholder.svg?height=40&width=40";switch(o.type){case"forwarding":return(0,Ct.jsxs)("div",{className:`flex items-start gap-3 text-primary text-xs ${n?"flex-row-reverse":""}`,children:["Forwarding to ",o?.data?.content]},a);case"text":return(0,Ct.jsxs)("div",{className:`flex items-start gap-3 ${n?"flex-row-reverse":""}`,children:[n?(0,Ct.jsxs)(ge,{children:[(0,Ct.jsx)(Ve,{src:p,alt:i}),(0,Ct.jsx)(fe,{children:i.substring(0,2).toUpperCase()})]}):(0,Ct.jsx)("img",{src:wi,alt:"AI Assistant",className:"w-10 h-10"}),(0,Ct.jsxs)("div",{className:`grid gap-1.5 ${n?"text-right":""}`,children:[(0,Ct.jsx)("div",{className:"flex items-center gap-2",children:(0,Ct.jsx)("span",{className:"font-medium",children:i})}),(0,Ct.jsx)("div",{className:`rounded-lg p-3 text-sm ${n?"bg-primary text-primary-foreground":"bg-muted"}`,style:{whiteSpace:"pre-line"},children:o?.data?.content})]})]},a);case"image":return(0,Ct.jsxs)("div",{className:`flex items-start gap-3 ${n?"flex-row-reverse":""}`,children:[(0,Ct.jsxs)(ge,{className:n?"":"ai-border",children:[(0,Ct.jsx)(Ve,{src:p,alt:i}),(0,Ct.jsx)(fe,{children:i.substring(0,2).toUpperCase()})]}),(0,Ct.jsxs)("div",{className:`grid gap-1.5 ${n?"text-right":""}`,children:[(0,Ct.jsx)("div",{className:"flex items-center gap-2",children:(0,Ct.jsx)("span",{className:"font-medium",children:i})}),(0,Ct.jsx)("img",{src:o?.data?.image,alt:"User uploaded content",className:`rounded-lg p-3 text-sm ${n?"bg-primary text-primary-foreground":"bg-muted"}`,style:{maxWidth:"100%",height:"auto"}})]})]},a);case"tool-invocation":if(o.data&&o.data.tool){let m=yi[o.data.tool];return m?(0,Ct.jsx)("div",{className:"mt-2",children:(0,Ct.jsx)(m,{data:o.data})}):(console.warn(`Tool ${o.data.tool} is not defined.`),(0,Ct.jsx)("div",{className:"mt-2",children:"......"}))}}});var Gt=$(require("react")),ve=$(require("@radix-ui/react-scroll-area"));var he=Gt.forwardRef(({className:e,children:t,...a},o)=>(0,$e.jsxs)(ve.Root,{ref:o,className:c("relative overflow-hidden",e),...a,children:[(0,$e.jsx)(ve.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,$e.jsx)(Ia,{}),(0,$e.jsx)(ve.Corner,{})]}));he.displayName=ve.Root.displayName;var Ia=Gt.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,$e.jsx)(ve.ScrollAreaScrollbar,{ref:o,orientation:t,className:c("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,$e.jsx)(ve.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ia.displayName=ve.ScrollAreaScrollbar.displayName;function Ci({messages:e,isLoading:t}){let a=(0,at.useRef)(null);return(0,at.useEffect)(()=>{a.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,Ct.jsx)("div",{className:"flex flex-col h-full overflow-hidden",children:(0,Ct.jsxs)(he,{className:"container flex-1 p-4",children:[(0,Ct.jsxs)("div",{className:"space-y-6",children:[e.length===0&&(0,Ct.jsx)("div",{className:"flex items-center justify-center h-full pt-60",children:(0,Ct.jsxs)("div",{className:"text-center max-w-md",children:[(0,Ct.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Welcome to Dexter"}),(0,Ct.jsx)("p",{className:"text-zinc-400",children:"Ask me anything or direct your question to a business function directly using the toolbar below."})]})}),t&&(0,Ct.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Ct.jsxs)(ge,{className:"ai-border",children:[(0,Ct.jsx)(Ve,{src:"/placeholder.svg?height=40&width=40",alt:"AI Assistant"}),(0,Ct.jsx)(fe,{children:"AI"})]}),(0,Ct.jsxs)("div",{className:"grid gap-1.5",children:[(0,Ct.jsx)("div",{className:"flex items-center gap-2",children:(0,Ct.jsx)("span",{className:"font-medium",children:"AI Assistant"})}),(0,Ct.jsx)("div",{className:"rounded-lg p-3 text-sm bg-muted",children:(0,Ct.jsxs)("div",{className:"flex space-x-2",children:[(0,Ct.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce"}),(0,Ct.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce [animation-delay:0.2s]"}),(0,Ct.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce [animation-delay:0.4s]"})]})})]})]}),e.map((o,l)=>(0,Ct.jsx)(Wt,{...o},l))]}),(0,Ct.jsx)("div",{ref:a})]})})}var qt={primary:"bg-blue-500",secondary:"bg-gray-500",accent:"bg-purple-500",categories:["bg-green-500","bg-blue-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-orange-500"],lists:["bg-green-400","bg-blue-400","bg-purple-400","bg-pink-400","bg-indigo-400","bg-orange-400"],items:["bg-green-300","bg-blue-300","bg-purple-300","bg-pink-300","bg-indigo-300","bg-orange-300"]},kt=[{id:"sales",name:"Sales",description:"Revenue and customer management",iconName:"DollarSign",color:"bg-green-600",type:"category",actions:[{id:"view-pipeline",label:"View Pipeline",description:"See all opportunities in pipeline",iconName:"BarChart",action:e=>console.log("View pipeline",e)},{id:"create-opportunity",label:"Create Opportunity",iconName:"Target",action:e=>console.log("Create opportunity",e)}],children:[{id:"customers",name:"Customers",description:"Customer accounts and contacts",iconName:"Users",color:"bg-blue-500",type:"list",actions:[{id:"add-customer",label:"Add Customer",iconName:"User",action:e=>console.log("Add customer",e)},{id:"export-customers",label:"Export List",iconName:"FileText",action:e=>console.log("Export customers",e)}],data:[{id:"acme-corp",title:"Acme Corp",subtitle:"Enterprise Customer",value:"$125K ARR",metadata:{industry:"Technology",employees:500,lastContact:"2024-01-15"}},{id:"beta-inc",title:"Beta Inc",subtitle:"Mid-market",value:"$45K ARR",metadata:{industry:"Healthcare",employees:150,lastContact:"2024-01-10"}},{id:"gamma-llc",title:"Gamma LLC",subtitle:"Small Business",value:"$15K ARR",metadata:{industry:"Manufacturing",employees:50,lastContact:"2024-01-08"}}]},{id:"opportunities",name:"Opportunities",description:"Sales opportunities and deals",iconName:"Target",color:"bg-yellow-500",type:"list",actions:[{id:"close-won",label:"Mark as Won",iconName:"CheckCircle",action:e=>console.log("Close won",e)},{id:"schedule-followup",label:"Schedule Follow-up",iconName:"Clock",action:e=>console.log("Schedule follow-up",e)}],data:[{id:"opp-1",title:"Acme Corp - Enterprise License",subtitle:"Closing Q1 2024",value:"$85K",metadata:{stage:"Negotiation",probability:80,closeDate:"2024-03-31"}},{id:"opp-2",title:"Beta Inc - Platform Upgrade",subtitle:"Closing Q2 2024",value:"$32K",metadata:{stage:"Proposal",probability:65,closeDate:"2024-06-15"}}]}]},{id:"marketing",name:"Marketing",description:"Marketing campaigns and analytics",iconName:"TrendingUp",color:"bg-pink-600",type:"category",actions:[{id:"view-analytics",label:"View Analytics",iconName:"BarChart",action:e=>console.log("View analytics",e)}],children:[{id:"campaigns",name:"Campaigns",description:"Marketing campaigns and performance",iconName:"TrendingUp",color:"bg-pink-500",type:"list",data:[{id:"campaign-1",title:"Q1 Product Launch",subtitle:"Active Campaign",value:"45% CTR",metadata:{budget:"$50K",spend:"$32K",leads:1250}},{id:"campaign-2",title:"Holiday Promotion",subtitle:"Completed",value:"38% CTR",metadata:{budget:"$25K",spend:"$24K",leads:890}}]}]},{id:"projects",name:"Projects",description:"Project management and tracking",iconName:"Briefcase",color:"bg-blue-600",type:"category",children:[{id:"active-projects",name:"Active Projects",description:"Currently active projects",iconName:"Activity",color:"bg-blue-500",type:"list",data:[{id:"project-1",title:"Website Redesign",subtitle:"In Progress",value:"75% Complete",metadata:{team:"Design",deadline:"2024-02-15",status:"On Track"}},{id:"project-2",title:"Mobile App Development",subtitle:"Planning",value:"25% Complete",metadata:{team:"Engineering",deadline:"2024-03-31",status:"On Track"}}]}]},{id:"engineering",name:"Engineering",description:"Development and technical operations",iconName:"Code",color:"bg-purple-600",type:"category",actions:[{id:"view-repos",label:"View Repositories",description:"See all code repositories",iconName:"Git",action:e=>console.log("View repositories",e)},{id:"create-task",label:"Create Task",iconName:"Plus",action:e=>console.log("Create task",e)}],children:[{id:"repositories",name:"Repositories",description:"Code repositories and projects",iconName:"GitBranch",color:"bg-purple-500",type:"list",actions:[{id:"create-repo",label:"Create Repository",iconName:"Plus",action:e=>console.log("Create repository",e)},{id:"view-commits",label:"View Commits",iconName:"Git",action:e=>console.log("View commits",e)}],data:[{id:"repo-1",title:"frontend-app",subtitle:"React Application",value:"Main Branch",metadata:{language:"TypeScript",commits:1247,contributors:8}},{id:"repo-2",title:"backend-api",subtitle:"Node.js API",value:"Main Branch",metadata:{language:"Node.js",commits:892,contributors:5}}]},{id:"tasks",name:"Tasks",description:"Development tasks and issues",iconName:"CheckSquare",color:"bg-blue-500",type:"list",actions:[{id:"create-task",label:"Create Task",iconName:"Plus",action:e=>console.log("Create task",e)},{id:"assign-task",label:"Assign Task",iconName:"UserPlus",action:e=>console.log("Assign task",e)}],data:[{id:"task-1",title:"Fix authentication bug",subtitle:"High Priority",value:"In Progress",metadata:{assignee:"John Doe",priority:"High",estimate:"4h"}},{id:"task-2",title:"Implement dark mode",subtitle:"Feature Request",value:"Todo",metadata:{assignee:"Jane Smith",priority:"Medium",estimate:"8h"}}]}]},{id:"design",name:"Design",description:"User experience and visual design",iconName:"Palette",color:"bg-pink-600",type:"category",actions:[{id:"view-designs",label:"View Designs",description:"See all design assets",iconName:"Image",action:e=>console.log("View designs",e)},{id:"create-mockup",label:"Create Mockup",iconName:"Plus",action:e=>console.log("Create mockup",e)}],children:[{id:"assets",name:"Assets",description:"Design assets and components",iconName:"Package",color:"bg-pink-500",type:"list",actions:[{id:"add-asset",label:"Add Asset",iconName:"Plus",action:e=>console.log("Add asset",e)},{id:"organize-assets",label:"Organize",iconName:"FolderOpen",action:e=>console.log("Organize assets",e)}],data:[{id:"asset-1",title:"Logo Variations",subtitle:"Brand Assets",value:"12 files",metadata:{format:"SVG",size:"2.4MB",updated:"2024-01-20"}},{id:"asset-2",title:"UI Components",subtitle:"Component Library",value:"45 components",metadata:{format:"Figma",size:"18.7MB",updated:"2024-01-22"}}]}]},{id:"product",name:"Product",description:"Product management and strategy",iconName:"Layers",color:"bg-indigo-600",type:"category",actions:[{id:"view-roadmap",label:"View Roadmap",description:"See product roadmap",iconName:"Map",action:e=>console.log("View roadmap",e)},{id:"create-feature",label:"Create Feature",iconName:"Plus",action:e=>console.log("Create feature",e)}],children:[{id:"features",name:"Features",description:"Product features and requirements",iconName:"Star",color:"bg-indigo-500",type:"list",actions:[{id:"add-feature",label:"Add Feature",iconName:"Plus",action:e=>console.log("Add feature",e)},{id:"prioritize-features",label:"Prioritize",iconName:"ArrowUp",action:e=>console.log("Prioritize features",e)}],data:[{id:"feature-1",title:"User Authentication",subtitle:"Security Feature",value:"In Development",metadata:{priority:"High",effort:"Large",impact:"High"}},{id:"feature-2",title:"Dark Mode",subtitle:"UI Enhancement",value:"Backlog",metadata:{priority:"Medium",effort:"Small",impact:"Medium"}}]}]}];function Ni(e){let t=kt,a=null;for(let o of e){if(a=t.find(l=>l.id===o||l.name===o)||null,!a)return null;t=a.children||[]}return a}function Pt(e){let t=e.path[e.path.length-1];return t?.actions?t.actions:[]}function ki(e){return kt.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(t.name.toLowerCase()))}function Pi(){return kt}function Kt({artefact:e,taskId:t,taskData:a,loading:o=!1,error:l=null}){let r=a||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},n=r.dateLogged;try{let i=new Date(r.dateLogged);isNaN(i.getTime())||(n=(0,Sa.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,Ct.jsxs)(be,{className:"w-full max-w-md shadow-md",children:[(0,Ct.jsx)(Be,{className:"pb-2",children:(0,Ct.jsx)("div",{className:"flex justify-between items-start",children:(0,Ct.jsx)(Ee,{className:"text-lg font-semibold",children:o?"Loading...":r.name})})}),(0,Ct.jsx)(Pe,{className:"pb-2",children:o?(0,Ct.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):l?(0,Ct.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Ct.jsx)("p",{className:"text-sm text-foreground",children:e})}),(0,Ct.jsx)(pt,{className:"pt-2 flex items-center justify-between",children:(0,Ct.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Ct.jsx)(Aa.Clock,{className:"h-3 w-3 mr-1"}),(0,Ct.jsxs)("span",{children:["Created ",n]}),(0,Ct.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Ct.jsxs)("span",{children:["Task #",r.id]})]})})]})}var ho=require("@ai-sdk/react"),Ft=require("motion/react");var Lt=$(require("react")),Zt=$(require("next/link"));var Ea=require("@radix-ui/react-slot"),za=$(require("react")),Di=(0,Da.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"h-10 px-4 py-2",icon:"h-10 w-10",lg:"h-11 rounded px-8",sm:"h-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),D=za.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...l},r)=>(0,Ct.jsx)(e?Ea.Slot:"button",{className:c(Di({className:t,size:a,variant:o})),ref:r,...l}));D.displayName="Button";var ja=$(require("react"));var ut=ja.forwardRef(({className:e,type:t,...a},o)=>(0,Ct.jsx)("input",{type:t,className:c("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...a}));ut.displayName="Input";var gt=$(require("react")),X=$(require("@radix-ui/react-dialog"));var Va=X.Root;var Ti=X.Portal;var $a=gt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(X.Overlay,{ref:a,className:c("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));$a.displayName=X.Overlay.displayName;var _t=gt.forwardRef(({className:e,children:t,...a},o)=>(0,Ct.jsxs)(Ti,{children:[(0,Ct.jsx)($a,{}),(0,Ct.jsxs)(X.Content,{ref:o,className:c("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,Ct.jsxs)(X.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,Ct.jsx)(Aa.X,{className:"h-4 w-4"}),(0,Ct.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));_t.displayName=X.Content.displayName;var Jt=({className:e,...t})=>(0,Ct.jsx)("div",{className:c("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Jt.displayName="DialogHeader";var Ri=({className:e,...t})=>(0,Ct.jsx)("div",{className:c("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ri.displayName="DialogFooter";var Xt=gt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(X.Title,{ref:a,className:c("text-lg font-semibold leading-none tracking-tight",e),...t}));Xt.displayName=X.Title.displayName;var Ai=gt.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(X.Description,{ref:a,className:c("text-sm text-muted-foreground",e),...t}));Ai.displayName=X.Description.displayName;var ft=$(require("@radix-ui/react-checkbox")),Ga=$(require("react")),Qt=Ga.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(ft.Root,{className:c("peer h-4 w-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:a,...t,children:(0,Ct.jsx)(ft.Indicator,{className:c("flex items-center justify-center text-current"),children:(0,Ct.jsx)(Aa.Check,{className:"h-4 w-4"})})}));Qt.displayName=ft.Root.displayName;var De=e=>({id:Math.random().toString(36).substr(2,9),title:e,format:"markdown",createdAt:new Date});var Ka=[{id:"design",name:"Design",description:"Creative and visual design team",icon:(0,Ct.jsx)(Aa.Palette,{className:"h-4 w-4"}),color:"bg-purple-600",accentColor:"text-purple-600"},{id:"engineering",name:"Engineering",description:"Software development and technical teams",icon:(0,Ct.jsx)(Aa.Code,{className:"h-4 w-4"}),color:"bg-blue-600",accentColor:"text-blue-600"},{id:"marketing",name:"Marketing",description:"Brand, campaigns, and growth marketing",icon:(0,Ct.jsx)(Aa.TrendingUp,{className:"h-4 w-4"}),color:"bg-pink-600",accentColor:"text-pink-600"},{id:"sales",name:"Sales",description:"Revenue generation and customer acquisition",icon:(0,Ct.jsx)(Aa.DollarSign,{className:"h-4 w-4"}),color:"bg-green-600",accentColor:"text-green-600"},{id:"hr",name:"Human Resources",description:"People operations and talent management",icon:(0,Ct.jsx)(Aa.Users,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"},{id:"operations",name:"Operations",description:"Business operations and process optimization",icon:(0,Ct.jsx)(Aa.Wrench,{className:"h-4 w-4"}),color:"bg-indigo-600",accentColor:"text-indigo-600"},{id:"legal",name:"Legal",description:"Legal affairs and compliance",icon:(0,Ct.jsx)(Aa.Scale,{className:"h-4 w-4"}),color:"bg-slate-600",accentColor:"text-slate-600"},{id:"product",name:"Product",description:"Product strategy and management",icon:(0,Ct.jsx)(Aa.Package,{className:"h-4 w-4"}),color:"bg-violet-600",accentColor:"text-violet-600"},{id:"it",name:"IT Support",description:"Information technology and infrastructure",icon:(0,Ct.jsx)(Aa.Zap,{className:"h-4 w-4"}),color:"bg-cyan-600",accentColor:"text-cyan-600"},{id:"company",name:"Company",description:"Company-wide resources and information",icon:(0,Ct.jsx)(Aa.Building2,{className:"h-4 w-4"}),color:"bg-gray-600",accentColor:"text-gray-600"}],At=[{id:"1",name:"E-commerce Platform",description:"Main customer-facing e-commerce application",isSelected:!0},{id:"2",name:"Admin Dashboard",description:"Internal administration and analytics dashboard",isSelected:!1},{id:"3",name:"Mobile App",description:"Native mobile application for iOS and Android",isSelected:!1}];var Yt=[{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},{id:"2",name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date("2024-02-01"),endDate:new Date("2024-03-15"),progress:30,isSelected:!0},{id:"3",name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date("2024-03-01"),endDate:new Date("2024-04-15"),progress:10,isSelected:!0},{id:"4",name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date("2024-01-15"),endDate:new Date("2024-02-28"),progress:90,isSelected:!0}],Tt=[{id:"backlog",name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!1},{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},{id:"1",name:"Sprint 1",description:"Initial development phase",startDate:new Date("2024-01-01"),endDate:new Date("2024-01-14"),isActive:!1,isSelected:!1},{id:"2",name:"Sprint 2",description:"Feature development",startDate:new Date("2024-01-15"),endDate:new Date("2024-01-28"),isActive:!0,isSelected:!1}],Mt=[{id:"1",name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",points:5,epicId:"1",sprintId:"2",assignee:"John Doe",createdAt:new Date("2024-01-15")},{id:"2",name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",points:8,epicId:"1",sprintId:"2",assignee:"Jane Smith",createdAt:new Date("2024-01-16")},{id:"3",name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Mike Johnson",createdAt:new Date("2024-01-17")},{id:"4",name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",points:3,epicId:"1",sprintId:"1",assignee:"Sarah Wilson",createdAt:new Date("2024-01-14")},{id:"5",name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",points:5,epicId:"3",assignee:"Alex Brown",createdAt:new Date("2024-01-18")},{id:"6",name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Emma Davis",createdAt:new Date("2024-01-19")},{id:"7",name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",points:13,epicId:"4",sprintId:"1",assignee:"Tom Wilson",createdAt:new Date("2024-01-13")}],Si=[...Mt,{id:"8",name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Chris Lee",createdAt:new Date("2024-01-20")},{id:"9",name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",points:5,epicId:"3",sprintId:"2",assignee:"Taylor Swift",createdAt:new Date("2024-01-21")},{id:"10",name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Jordan Smith",createdAt:new Date("2024-01-22")},{id:"11",name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",points:8,epicId:"4",sprintId:"1",assignee:"Morgan Davis",createdAt:new Date("2024-01-12")},{id:"12",name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",points:21,epicId:"1",sprintId:"2",assignee:"Casey Johnson",createdAt:new Date("2024-01-23")}],Mi=[...At,{id:"4",name:"Analytics Platform",description:"Business intelligence and reporting system",isSelected:!1},{id:"5",name:"API Gateway",description:"Microservices API management layer",isSelected:!1}],Rt={projects:[{id:"1",name:"Empty Project",description:"A project with no 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:[]},qa={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:Mt.filter(e=>e.epicId==="1")};var Kr={empty:{initialProjects:Rt.projects,initialEpics:Rt.epics,initialSprints:Rt.sprints,initialTasks:Rt.tasks},default:{initialProjects:At,initialEpics:Yt,initialSprints:Tt,initialTasks:Mt},highDensity:{initialProjects:At,initialEpics:Yt,initialSprints:Tt,initialTasks:Si},singleEpic:{initialProjects:At,initialEpics:qa.epics,initialSprints:Tt,initialTasks:qa.tasks},multipleProjects:{initialProjects:Mi,initialEpics:Yt,initialSprints:Tt,initialTasks:Mt}},St=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",role:"Senior Designer",department:"Design",status:"active",joinedDate:new Date("2023-01-15"),lastActive:new Date,phone:"+1 (555) 123-4567",location:"San Francisco, CA",timezone:"PST",skills:["UI/UX Design","Figma","Adobe Creative Suite","Prototyping","User Research"],bio:"Passionate designer with 8+ years of experience creating user-centered digital experiences."},{id:"2",type:"digital",name:"CodeAssist Pro",status:"active",joinedDate:new Date("2024-01-01"),lastActive:new Date,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:["Code Review","Documentation Generation","Debugging","Code Optimization","Testing"],knowledge:["JavaScript","TypeScript","React","Node.js","Python","Git"].map(De),coreKnowledge:["Company coding standards","Architecture patterns","Security guidelines"].map(De),version:"2",lastUpdated:new Date("2024-01-15"),isActive:!0},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",role:"Product Manager",department:"Product",status:"inactive",joinedDate:new Date("2022-08-20"),lastActive:new Date(Date.now()-2*60*60*1e3),phone:"+1 (555) 987-6543",location:"New York, NY",timezone:"EST",skills:["Product Strategy","Agile","Data Analysis","User Stories","Roadmapping"],bio:"Strategic product manager focused on driving user engagement and business growth."},{id:"4",type:"digital",name:"MarketingBot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,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:["Content Creation","Social Media Management","Analytics","SEO Optimization","Campaign Management"],knowledge:["Digital Marketing","Social Media Platforms","Content Strategy","Analytics Tools"].map(De),coreKnowledge:["Brand guidelines","Target audience personas","Marketing objectives"].map(De),version:"52",lastUpdated:new Date("2024-02-10"),isActive:!0},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",role:"UX Researcher",department:"Design",status:"inactive",joinedDate:new Date("2023-06-10"),lastActive:new Date(Date.now()-7*24*60*60*1e3),phone:"+1 (555) 456-7890",location:"Austin, TX",timezone:"CST",skills:["User Research","Usability Testing","Data Analysis","Survey Design","Interview Techniques"],bio:"User researcher dedicated to understanding user needs and improving product experiences."},{id:"6",type:"digital",name:"DataAnalyzer Pro",status:"active",joinedDate:new Date("2024-01-10"),lastActive:new Date,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:["Data Analysis","Report Generation","Data Visualization","Business Intelligence","Statistical Analysis"],knowledge:["Python","SQL","Tableau","Excel","R","Statistics"].map(De),coreKnowledge:["Company data sources","KPI definitions","Reporting standards"].map(De),version:"3.1",lastUpdated:new Date("2024-02-20"),isActive:!0},{id:"7",type:"digital",name:"ProjectManager AI",status:"active",joinedDate:new Date("2024-01-05"),lastActive:new Date,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:["Project Planning","Task Coordination","Timeline Management","Resource Allocation","Progress Tracking"],knowledge:["Agile","Scrum","Gantt Charts","Risk Management","Stakeholder Management"].map(De),coreKnowledge:["Company project templates","Resource availability","Project methodologies"].map(De),version:"2.5",lastUpdated:new Date("2024-02-15"),isActive:!0},{id:"8",type:"digital",name:"CustomerSupport Bot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,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:["Customer Support","Issue Resolution","Product Knowledge","Escalation Management","Chat Support"],knowledge:["Product Documentation","FAQ","Troubleshooting Guides","Customer Service Best Practices"].map(De),coreKnowledge:["Product catalog","Support processes","Escalation procedures"].map(De),version:"1.8",lastUpdated:new Date("2024-02-25"),isActive:!0}],_r=[{id:"1",title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15),dueTime:"14:30",colleague:St.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:30,createdAt:new Date(2024,2,10),tags:["quarterly","review","urgent"]},{id:"2",title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18),dueTime:"10:00",colleague:St.find(e=>e.id==="4"&&e.type==="digital"),isCompleted:!1,isRecurring:!0,recurrencePattern:"weekly",recurrenceInterval:1,priority:"medium",reminderEnabled:!0,reminderMinutes:15,createdAt:new Date(2024,2,11),tags:["meeting","standup","weekly"]},{id:"3",title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date,dueTime:"16:00",colleague:St.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:60,createdAt:new Date,tags:["deploy","production","urgent"]}];var Jr=St.filter(e=>e.type==="digital");function _a(e,t){let[a,o]=(0,at.useState)(()=>{if(typeof window>"u")return t;try{let r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}),l=r=>{try{o(r),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(r))}catch{}};return(0,at.useEffect)(()=>{l(a)},[]),[a,l]}function ea({items:e,isOpen:t,isMobile:a=!1,onClose:o,currentBusinessUnit:l=Ka[0],onBusinessUnitChange:r,onSearch:n,className:i,logo:p="/headerlogo.png",appName:m="Nuvia",tagline:k="Collaboration Platform"}){let[f,y]=Lt.useState({}),[T,z]=_a("sidebar-favorites",{}),[R,x]=Lt.useState(null),[A,F]=Lt.useState(""),w=d=>{y(B=>({...B,[d]:!B[d]}))},E=d=>{r?.(d)},ee=()=>{A.trim()&&n?.(A.trim())},te=d=>{d.key==="Enter"&&(d.preventDefault(),ee())},ae=(d,B)=>{let I=T[d]||[],K=I.includes(B)?I.filter(u=>u!==B):I.concat(B);z({...T,[d]:K})},Z=d=>{if(!d.items||!d.maxItems||d.items.length<=d.maxItems)return d.items||[];let B=T[d.id]||[],I=d.items.filter(u=>B.includes(u.id)),K=d.items.filter(u=>!B.includes(u.id));return[...I,...K].slice(0,d.maxItems)},q=d=>d.maxItems&&d.items&&d.items.length>d.maxItems,re=e,ce=d=>{let B=q(d),I=Z(d),K=(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsxs)("div",{className:"flex items-center gap-3",children:[d.icon,(0,Ct.jsx)("span",{children:d.title})]}),d.badge&&(0,Ct.jsx)(me,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:d.badge}),d.items&&(0,Ct.jsx)(Aa.ChevronDown,{className:c("ml-2 h-4 w-4 transition-transform",f[d.title]?"rotate-180":"")})]}),u=c("flex w-full items-center justify-between rounded-2xl px-3 py-2 text-sm font-medium",d.isActive?"bg-primary/10 text-primary":"hover:bg-muted");return d.url?(0,Ct.jsx)(Zt.default,{href:d.url,className:u,onClick:a?o:void 0,children:K}):(0,Ct.jsx)("button",{className:u,onClick:()=>d.items&&w(d.title),children:K})},M=()=>{let d=e.find(I=>I.id===R);if(!d||!d.items||!d.maxItems)return null;let B=T[d.id]||[];return(0,Ct.jsx)(Va,{open:!!R,onOpenChange:I=>!I&&x(null),children:(0,Ct.jsxs)(_t,{className:"sm:max-w-md",children:[(0,Ct.jsxs)(Jt,{children:[(0,Ct.jsxs)(Xt,{children:["Manage ",d.title," Favorites"]}),(0,Ct.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select up to ",d.maxItems," items to show in ",d.title.toLowerCase(),"."]})]}),(0,Ct.jsx)(he,{className:"max-h-96 pr-4",children:(0,Ct.jsx)("div",{className:"space-y-4",children:d.items.map(I=>(0,Ct.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Ct.jsx)(Qt,{id:I.id,checked:B.includes(I.id),onCheckedChange:()=>ae(d.id,I.id),disabled:!B.includes(I.id)&&B.length>=(d.maxItems||0)}),(0,Ct.jsxs)("label",{htmlFor:I.id,className:"flex items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[I.title,I.badge&&(0,Ct.jsx)(me,{variant:"outline",className:"text-xs",children:I.badge})]})]},I.id))})})]})})},Se=(0,Ct.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,Ct.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,Ct.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Ct.jsx)("div",{className:"flex h-14 w-14 items-center justify-center",children:(0,Ct.jsx)("img",{src:p,alt:"Header Logo",className:"h-14 w-14 object-contain"})}),(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)("h2",{className:"font-semibold",children:m}),(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground",children:k})]})]}),a&&(0,Ct.jsx)(D,{variant:"ghost",size:"icon",onClick:o,children:(0,Ct.jsx)(Aa.X,{className:"h-5 w-5"})})]}),(0,Ct.jsx)("div",{className:"px-3 py-2",children:(0,Ct.jsxs)("div",{className:"relative",children:[(0,Ct.jsx)(Aa.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Ct.jsx)(ut,{type:"search",placeholder:"Search...",className:"w-full rounded-2xl bg-muted pl-9 pr-4 py-2",value:A,onChange:d=>F(d.target.value),onKeyPress:te})]})}),(0,Ct.jsx)(he,{className:"flex-1 px-3 py-2",children:(0,Ct.jsx)("div",{className:"space-y-1",children:re.map(d=>(0,Ct.jsxs)("div",{className:"mb-1",children:[ce(d),d.items&&f[d.title]&&(0,Ct.jsxs)("div",{className:"mt-1 ml-6 space-y-1 border-l pl-3",children:[Z(d).map(B=>(0,Ct.jsxs)(Zt.default,{href:B.url,className:"flex items-center justify-between rounded-2xl px-3 py-2 text-sm hover:bg-muted",onClick:a?o:void 0,children:[B.title,B.badge&&(0,Ct.jsx)(me,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:B.badge})]},B.id)),q(d)&&d.items&&d.items.length>Z(d).length&&(0,Ct.jsxs)("button",{onClick:()=>x(d.id),className:"w-full px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded-2xl transition-colors text-left",children:["...",d.items.length-Z(d).length," more available"]})]})]},d.id))})}),(0,Ct.jsx)("div",{className:"p-3",children:(0,Ct.jsx)("div",{className:"space-y-1",children:(0,Ct.jsxs)("button",{className:"flex w-full items-center gap-3 rounded-2xl px-3 py-2 text-sm font-medium hover:bg-muted",children:[(0,Ct.jsx)(Aa.Settings,{className:"h-5 w-5"}),(0,Ct.jsx)("span",{children:"Settings"})]})})}),(0,Ct.jsx)(M,{})]});return a?(0,Ct.jsx)("div",{className:c("fixed inset-y-0 left-0 z-50 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",i),children:Se}):(0,Ct.jsx)("div",{className:c("fixed inset-y-0 left-0 z-30 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",i),children:Se})}var Ja=$(require("react")),we=$(require("@radix-ui/react-tooltip"));var ot=we.Provider,it=we.Root,rt=we.Trigger,Xe=Ja.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Ct.jsx)(we.Portal,{children:(0,Ct.jsx)(we.Content,{ref:o,sideOffset:t,className:c("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Xe.displayName=we.Content.displayName;var Xa=require("next-themes");function Qa(){let{setTheme:e,theme:t}=(0,Xa.useTheme)();return(0,Ct.jsx)(ot,{children:(0,Ct.jsxs)(it,{children:[(0,Ct.jsx)(rt,{asChild:!0,children:(0,Ct.jsxs)(D,{variant:"ghost",size:"icon",className:"rounded-2xl",onClick:()=>e(t==="light"?"dark":"light"),children:[(0,Ct.jsx)(Aa.Sun,{className:"h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,Ct.jsx)(Aa.Moon,{className:"absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,Ct.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}),(0,Ct.jsx)(Xe,{children:"Toggle theme"})]})})}function Ya({notifications:e,open:t,onClose:a,onNotificationRemove:o,onRemoveAll:l,className:r}){let n=e.filter(m=>!m.read),i=n.length,p=m=>{switch(m){case"info":return(0,Ct.jsx)(Aa.Info,{className:"h-5 w-5 text-blue-500"});case"success":return(0,Ct.jsx)(Aa.Check,{className:"h-5 w-5 text-green-500"});case"warning":return(0,Ct.jsx)(Aa.AlertTriangle,{className:"h-5 w-5 text-amber-500"});case"error":return(0,Ct.jsx)(Aa.AlertTriangle,{className:"h-5 w-5 text-red-500"})}};return(0,Ct.jsx)(Ft.AnimatePresence,{children:t&&(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)(Ft.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-sm md:hidden",onClick:a}),(0,Ct.jsx)(Ft.motion.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:20,stiffness:300},className:c("fixed inset-y-0 right-0 z-50 w-full max-w-sm border-l bg-background shadow-lg md:w-96",r),children:(0,Ct.jsxs)("div",{className:"flex h-full flex-col",children:[(0,Ct.jsxs)("div",{className:"flex items-center justify-between border-Ct p-4",children:[(0,Ct.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ct.jsx)(Aa.Bell,{className:"h-5 w-5"}),(0,Ct.jsx)("h2",{className:"text-lg font-semibold",children:"Notifications"}),i>0&&(0,Ct.jsxs)(me,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:[i," new"]})]}),(0,Ct.jsxs)(D,{variant:"ghost",size:"icon",onClick:a,className:"rounded-full",children:[(0,Ct.jsx)(Aa.X,{className:"h-5 w-5"}),(0,Ct.jsx)("span",{className:"sr-only",children:"Close"})]})]}),i>0&&(0,Ct.jsxs)("div",{className:"flex items-center justify-between border-Ct p-2",children:[(0,Ct.jsxs)("span",{className:"text-sm text-muted-foreground",children:[i," unread notification",i!==1?"Ct":""]}),(0,Ct.jsx)(D,{variant:"ghost",size:"sm",onClick:l,className:"text-sm",children:"Dismiss all"})]}),n.length>0?(0,Ct.jsx)(he,{className:"flex-1",children:(0,Ct.jsx)("div",{className:"divide-y",children:n.map(m=>(0,Ct.jsxs)("div",{className:c("flex gap-3 p-4 transition-colors bg-muted/50"),children:[(0,Ct.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted",children:p(m.type)}),(0,Ct.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Ct.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ct.jsx)("p",{className:"font-medium",children:m.title}),(0,Ct.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground",children:m.time}),(0,Ct.jsx)(D,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o?.(m.id),title:"Dismiss",children:(0,Ct.jsx)(Aa.Check,{className:"h-3 w-3"})})]})]}),(0,Ct.jsx)("p",{className:"text-sm text-muted-foreground",children:m.description}),m.actionLabel&&(0,Ct.jsxs)(D,{variant:"link",size:"sm",className:"h-auto p-0 text-sm",onClick:m.onAction,children:[m.actionLabel,(0,Ct.jsx)(Aa.ChevronRight,{className:"ml-1 h-3 w-3"})]})]})]},m.id))})}):(0,Ct.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center p-8 text-center",children:[(0,Ct.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:(0,Ct.jsx)(Aa.Bell,{className:"h-8 w-8 text-muted-foreground"})}),(0,Ct.jsx)("h3",{className:"mt-4 text-lg font-medium",children:"No notifications"}),(0,Ct.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"When you receive notifications, they'll appear here."})]})]})})]})})}var Qe=$(require("@radix-ui/react-tabs"));function Za({className:e,...t}){return(0,Ct.jsx)(Qe.Root,{"data-slot":"tabs",className:c("flex flex-col gap-2",e),...t})}function eo({className:e,...t}){return(0,Ct.jsx)(Qe.List,{"data-slot":"tabs-list",className:c("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function to({className:e,...t}){return(0,Ct.jsx)(Qe.Trigger,{"data-slot":"tabs-trigger",className:c("data-[state=active]:bg-accent data-[state=active]:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var Ue=$(require("react")),P=$(require("@radix-ui/react-dropdown-menu")),nt=require("@radix-ui/react-icons");var ao=P.Root,oo=P.Trigger;var Ii=Ue.forwardRef(({className:e,inset:t,children:a,...o},l)=>(0,Ct.jsxs)(P.SubTrigger,{ref:l,className:c("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[a,(0,Ct.jsx)(nt.ChevronRightIcon,{className:"ml-auto"})]}));Ii.displayName=P.SubTrigger.displayName;var Li=Ue.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(P.SubContent,{ref:a,className:c("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Li.displayName=P.SubContent.displayName;var aa=Ue.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Ct.jsx)(P.Portal,{children:(0,Ct.jsx)(P.Content,{ref:o,sideOffset:t,className:c("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));aa.displayName=P.Content.displayName;var oa=Ue.forwardRef(({className:e,inset:t,...a},o)=>(0,Ct.jsx)(P.Item,{ref:o,className:c("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...a}));oa.displayName=P.Item.displayName;var Bi=Ue.forwardRef(({className:e,children:t,checked:a,...o},l)=>(0,Ct.jsxs)(P.CheckboxItem,{ref:l,className:c("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...o,children:[(0,Ct.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Ct.jsx)(P.ItemIndicator,{children:(0,Ct.jsx)(nt.CheckIcon,{className:"h-4 w-4"})})}),t]}));Bi.displayName=P.CheckboxItem.displayName;var Ei=Ue.forwardRef(({className:e,children:t,...a},o)=>(0,Ct.jsxs)(P.RadioItem,{ref:o,className:c("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,Ct.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Ct.jsx)(P.ItemIndicator,{children:(0,Ct.jsx)(nt.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Ei.displayName=P.RadioItem.displayName;var Ui=Ue.forwardRef(({className:e,inset:t,...a},o)=>(0,Ct.jsx)(P.Label,{ref:o,className:c("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));Ui.displayName=P.Label.displayName;var zi=Ue.forwardRef(({className:e,...t},a)=>(0,Ct.jsx)(P.Separator,{ref:a,className:c("-mx-1 my-1 h-px bg-muted",e),...t}));zi.displayName=P.Separator.displayName;var Fi=({className:e,...t})=>(0,Ct.jsx)("span",{className:c("ml-auto text-xs tracking-widest opacity-60",e),...t});Fi.displayName="DropdownMenuShortcut";function ro({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:l="700px",gridCols:r=6}){let n=a.find(i=>i.value===e);return(0,Ct.jsxs)(Ft.motion.div,{className:`flex-1 flex justify-center ${o}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,Ct.jsx)("div",{className:"hidden lg:block",children:(0,Ct.jsx)(Za,{value:e,onValueChange:t,children:(0,Ct.jsx)(eo,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:l,gridTemplateColumns:`repeat(${Math.min(r,a.length)}, minmax(0, 1fr))`},children:a.map(i=>(0,Ct.jsx)(Ft.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,Ct.jsx)(to,{value:i.value,className:"w-full h-8 rounded-xl data-[state=active]:rounded-xl transition-all duration-200 hover:border hover:border-accent hover:bg-accent/10 px-4 py-2 text-sm font-medium",children:i.label})},i.value))})})}),(0,Ct.jsx)("div",{className:"lg:hidden",children:(0,Ct.jsxs)(ao,{children:[(0,Ct.jsx)(oo,{asChild:!0,children:(0,Ct.jsxs)(D,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[n?.label||"Select",(0,Ct.jsx)(Aa.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,Ct.jsx)(aa,{align:"center",className:"w-[180px]",children:a.map(i=>(0,Ct.jsx)(oa,{onClick:()=>t?.(i.value),className:`cursor-pointer ${e===i.value?"bg-accent":""}`,children:i.label},i.value))})]})})]})}function no({title:e,notifications:t=[],onToggleSidebar:a,onToggleMobileMenu:o,sidebarOpen:l=!0,className:r,activeTab:n="assistant",onTabChange:i,showTabs:p=!0,tabOptions:m=[{value:"home",label:"Home"},{value:"chat",label:"Chat"},{value:"projects",label:"Projects"},{value:"colleagues",label:"Colleagues"},{value:"knowledge",label:"Knowledge"}],onActionClick:k,actionIcon:f=(0,Ct.jsx)(Aa.Bot,{className:"mr-2 h-4 w-4"}),actionText:y="Action",onNotificationRemove:T,onRemoveAll:z,logo:R="/headerlogo.png",appName:x="Nuvia",tagline:A="Collaboration Platform"}){let[F,w]=(0,at.useState)(!1),[E,ee]=(0,at.useState)(t),te=E.filter(q=>!q.read).length,ae=q=>{ee(re=>re.filter(ce=>ce.id!==q)),T?.(q)},Z=()=>{ee(q=>q.filter(re=>re.read)),z?.()};return(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsxs)("header",{className:`sticky top-0 z-10 flex h-16 items-center gap-3 pl-2 pr-4 backdrop-blur ${r||""}`,children:[(0,Ct.jsx)(D,{variant:"ghost",size:"icon",className:"md:hidden",onClick:o,children:(0,Ct.jsx)(Aa.Menu,{className:"h-5 w-5"})}),(0,Ct.jsx)(D,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:a,children:(0,Ct.jsx)(Aa.PanelLeft,{className:"h-5 w-5"})}),!l&&(0,Ct.jsxs)(Ft.motion.div,{className:"flex items-center gap-3",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},children:[(0,Ct.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:(0,Ct.jsx)("img",{src:R,alt:"Logo",className:"h-10 w-10 object-contain"})}),(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)("h2",{className:"font-semibold text-sm",children:x}),(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground",children:A})]})]}),(0,Ct.jsxs)("div",{className:"flex flex-1 items-center",children:[p&&(0,Ct.jsx)(ro,{activeTab:n,onTabChange:i,tabOptions:m}),(0,Ct.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,Ct.jsx)(Ft.motion.div,{className:"hidden md:flex gap-2",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:(0,Ct.jsx)(Ft.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Ct.jsxs)(D,{className:"rounded-2xl transition-all duration-200 hover:shadow-md",onClick:k,children:[f,y]})})}),(0,Ct.jsx)(Qa,{}),(0,Ct.jsx)(ot,{children:(0,Ct.jsxs)(it,{children:[(0,Ct.jsx)(rt,{asChild:!0,children:(0,Ct.jsx)(Ft.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Ct.jsxs)(D,{variant:"ghost",size:"icon",className:"rounded-2xl relative transition-all duration-200",onClick:()=>w(!0),children:[(0,Ct.jsx)(Ft.motion.div,{animate:te>0?{rotate:[0,-10,10,-10,0]}:{},transition:{duration:.5,repeat:te>0?1/0:0,repeatDelay:3},children:(0,Ct.jsx)(Aa.Bell,{className:"h-5 w-5"})}),te>0&&(0,Ct.jsx)(Ft.motion.span,{className:"absolute -right-1 -top-1 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-xs text-white",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:15},children:te})]})})}),(0,Ct.jsx)(Xe,{children:"Notifications"})]})}),(0,Ct.jsx)(Ft.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Ct.jsxs)(ge,{className:"h-9 w-9 border-2 border-primary transition-all duration-200 hover:shadow-md cursor-pointer",children:[(0,Ct.jsx)(Ve,{src:"/placeholder.svg?height=40&width=40",alt:"User"}),(0,Ct.jsx)(fe,{})]})})]})]})]}),(0,Ct.jsx)(Ya,{notifications:E,open:F,onClose:()=>w(!1),onNotificationRemove:ae,onRemoveAll:Z})]})}var so=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,Ct.jsx)(Aa.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function co({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:l=so[0],onBusinessUnitChange:r,onSearch:n,businessUnits:i=so,activeTab:p,onTabChange:m,showTabs:k=!1,onActionClick:f,actionIcon:y,actionText:T="Action",onNotificationRemove:z,onRemoveAll:R,logo:x="/headerlogo.png",appName:A="Nuvia",tagline:F="Collaboration Platform",sidebarInitiallyClosed:w=!1}){let[E,ee]=(0,at.useState)(!w),[te,ae]=(0,at.useState)(!1),[Z,q]=(0,at.useState)(l),re=ce=>{q(ce),r?.(ce)};return(0,Ct.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-xl bg-background w-[]",children:[te&&(0,Ct.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>ae(!1)}),(0,Ct.jsx)("div",{className:"md:hidden",children:(0,Ct.jsx)(ea,{items:e,isOpen:te,isMobile:!0,onClose:()=>ae(!1),currentBusinessUnit:Z,onBusinessUnitChange:re,onSearch:n,logo:x,appName:A,tagline:F})}),(0,Ct.jsx)("div",{className:"hidden md:block",children:(0,Ct.jsx)(ea,{items:e,isOpen:E,isMobile:!1,currentBusinessUnit:Z,onBusinessUnitChange:re,onSearch:n,logo:x,appName:A,tagline:F})}),(0,Ct.jsxs)("div",{className:c("min-h-screen fixed w-full transition-all duration-300 ease-in-out",E?"md:pl-64":"md:pl-0"),children:[(0,Ct.jsx)(no,{title:a,notifications:o,onToggleSidebar:()=>ee(!E),onToggleMobileMenu:()=>ae(!0),sidebarOpen:E,activeTab:p,onTabChange:m,showTabs:k,onActionClick:f,actionIcon:y,actionText:T,onNotificationRemove:z,onRemoveAll:R,logo:x,appName:A,tagline:F}),(0,Ct.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}function po({sessions:e,currentSession:t,teams:a,onNewChat:o,onSessionSelect:l,onSessionEdit:r,onSessionDelete:n,className:i}){return(0,Ct.jsx)(ot,{children:(0,Ct.jsx)("div",{className:`space-y-4 h-full ${i||""}`,children:(0,Ct.jsxs)(be,{className:"shadow-sm h-full",children:[(0,Ct.jsx)("div",{className:"p-4 border-Ct",children:(0,Ct.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ct.jsxs)("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[(0,Ct.jsx)(Aa.Clock,{className:"h-4 w-4"}),"Recent Chats"]}),(0,Ct.jsxs)(D,{onClick:o,size:"sm",className:"gap-1 h-7 px-2 rounded-lg shadow-sm",children:[(0,Ct.jsx)(Aa.Plus,{className:"h-3 w-3"}),"New"]})]})}),(0,Ct.jsx)(he,{className:"h-[600px]",children:(0,Ct.jsx)("div",{className:"p-2",children:e.length===0?(0,Ct.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No chat sessions yet"}):e.map(p=>(0,Ct.jsxs)(it,{children:[(0,Ct.jsx)(rt,{asChild:!0,children:(0,Ct.jsx)("div",{className:c("group relative p-3 rounded-xl cursor-pointer transition-all hover:bg-muted/50 mb-2",t?.id===p.id&&"bg-muted border"),onClick:()=>l(p),children:(0,Ct.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-start",children:[(0,Ct.jsxs)("div",{className:"min-w-0 overflow-hidden",children:[(0,Ct.jsx)("h4",{className:"font-medium text-sm truncate mb-1",children:p.title}),(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:p.lastMessage})]}),(0,Ct.jsxs)("div",{className:"flex items-start gap-1 pt-0.5",children:[r&&(0,Ct.jsx)(D,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded opacity-30 group-hover:opacity-100 transition-opacity",onClick:m=>{m.stopPropagation(),r(p.id)},children:(0,Ct.jsx)(Aa.Edit3,{className:"h-3 w-3"})}),n&&(0,Ct.jsx)(D,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded text-destructive hover:text-destructive opacity-30 group-hover:opacity-100 transition-opacity",onClick:m=>{m.stopPropagation(),n(p.id)},children:(0,Ct.jsx)(Aa.Trash2,{className:"h-3 w-3"})})]})]})})}),(0,Ct.jsx)(Xe,{side:"right",className:"max-w-xs",children:(0,Ct.jsxs)("div",{className:"space-y-1",children:[(0,Ct.jsx)("p",{className:"font-medium text-sm",children:p.title}),(0,Ct.jsx)("p",{className:"text-xs",children:p.lastMessage})]})})]},p.id))})})]})})})}var Ze=$(require("motion/react-client"));function na({capabilities:e,isOpen:t,onToggle:a,onActionSelect:o,onContextChange:l,colorScheme:r=qt,className:n}){let[i,p]=(0,at.useState)([]),[m,k]=(0,at.useState)([]),f=i[i.length-1],y=f?.children||e,T=(w,E)=>{switch(w.type){case"category":return r.categories[E%r.categories.length];case"list":return r.lists[E%r.lists.length];case"item":return r.items[E%r.items.length];default:return r.primary}},z=(0,at.useMemo)(()=>({path:i,selectedItems:m,filters:{}}),[i,m]);(0,at.useEffect)(()=>{l&&l(z)},[z,l]);let R=w=>{w.type==="category"||w.type==="list"?p([...i,w]):w.type==="item"&&k([...m,w])},x=()=>{p(i.slice(0,-1))},A=w=>{p(i.slice(0,w+1))},F=()=>f?.actions?f.actions:[];return t?(0,Ct.jsxs)("div",{className:c("w-full",n),children:[(0,Ct.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Ct.jsxs)("div",{className:"flex items-center gap-2",children:[i.length>0&&(0,Ct.jsx)(Ft.motion.button,{whileHover:{scale:1.1,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.9,transition:{duration:.15,ease:[.4,0,.2,1]}},onClick:x,className:c("group p-1 h-6 w-6 rounded-md backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:shadow-sm"),children:(0,Ct.jsx)(Aa.ChevronLeft,{className:c("h-3 w-3 transition-transform duration-300 ease-in-out","group-hover:-translate-x-0.5")})}),(0,Ct.jsx)("h4",{className:"font-medium text-sm",children:f?.name||"Capabilities"})]}),(0,Ct.jsx)(Ft.motion.button,{whileHover:{scale:1.1,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.9,transition:{duration:.15,ease:[.4,0,.2,1]}},onClick:a,className:c("group p-1 h-6 w-6 rounded-md backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:shadow-sm"),children:(0,Ct.jsx)(Aa.X,{className:c("h-3 w-3 transition-transform duration-300 ease-in-out","group-hover:rotate-90")})})]}),i.length>0&&(0,Ct.jsxs)("div",{className:"flex items-center gap-1 mb-3 text-xs text-muted-foreground",children:[(0,Ct.jsx)(Ft.motion.button,{whileHover:{scale:1.05,transition:{duration:.3,ease:[.4,0,.2,1]}},onClick:()=>p([]),className:c("group relative transition-colors duration-300 ease-in-out hover:text-accent"),children:(0,Ct.jsxs)("span",{className:"relative",children:["Capabilities",(0,Ct.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]})}),i.map((w,E)=>(0,Ct.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Ct.jsx)(Aa.ChevronRight,{className:"h-2 w-2"}),(0,Ct.jsx)(Ft.motion.button,{whileHover:{scale:1.05,transition:{duration:.3,ease:[.4,0,.2,1]}},onClick:()=>A(E),className:c("group relative transition-colors duration-300 ease-in-out hover:text-accent"),children:(0,Ct.jsxs)("span",{className:"relative",children:[w.name,(0,Ct.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]})})]},w.id))]}),(0,Ct.jsx)("div",{className:"max-h-40 overflow-y-auto",children:(0,Ct.jsx)(Ft.AnimatePresence,{mode:"wait",children:(0,Ct.jsx)(Ft.motion.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.2,ease:[.4,0,.2,1]},children:f?.type==="list"&&f.data?(0,Ct.jsx)(Oi,{data:f.data,onItemSelect:w=>k([...m,w]),colorScheme:r}):(0,Ct.jsx)(ji,{capabilities:y,onSelect:R,colorScheme:r})},f?.id||"root")})})]}):(0,Ct.jsxs)(D,{onClick:a,size:"sm",variant:"outline",className:"rounded-full",children:[(0,Ct.jsx)(Aa.Menu,{className:"h-4 w-4"}),(0,Ct.jsx)("span",{className:"ml-2",children:"Capabilities"})]})}function ji({capabilities:e,onSelect:t,colorScheme:a}){return(0,Ct.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((o,l)=>(0,Ct.jsx)(Hi,{capability:o,onClick:()=>t(o),color:a.categories[l%a.categories.length]},o.id))})}function Hi({capability:e,onClick:t,selected:a,color:o}){return(0,Ct.jsxs)(Ft.motion.button,{whileHover:{scale:1.02,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.95,transition:{duration:.15,ease:[.4,0,.2,1]}},className:c("group relative inline-flex items-center gap-2 px-3 py-2 rounded-lg border cursor-pointer","bg-background text-left text-sm font-medium backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:border-accent/50 hover:shadow-sm",a&&"border-primary bg-accent scale-105"),onClick:t,children:[(0,Ct.jsx)("div",{className:c("w-2 h-2 rounded-full flex-shrink-0 transition-transform duration-300 ease-in-out","group-hover:scale-125",o)}),(0,Ct.jsxs)("span",{className:"truncate relative",children:[e.name,(0,Ct.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]}),(e.children||e.data)&&(0,Ct.jsx)(Aa.ChevronRight,{className:c("h-3 w-3 text-muted-foreground flex-shrink-0","transition-transform duration-300 ease-in-out group-hover:translate-x-0.5")}),e.type==="list"&&e.data&&(0,Ct.jsx)(me,{variant:"secondary",className:c("text-xs h-5 px-1.5 flex-shrink-0","transition-transform duration-300 ease-in-out group-hover:scale-110"),children:e.data.length})]})}function Oi({data:e,onItemSelect:t,colorScheme:a}){return(0,Ct.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((o,l)=>(0,Ct.jsxs)(Ft.motion.button,{whileHover:{scale:1.02,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.95,transition:{duration:.15,ease:[.4,0,.2,1]}},className:c("group relative inline-flex items-center gap-2 px-3 py-2 rounded-lg border cursor-pointer","bg-background text-left text-sm font-medium backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:border-accent/50 hover:shadow-sm"),onClick:()=>t(o),children:[(0,Ct.jsx)("div",{className:c("w-2 h-2 rounded-full flex-shrink-0 transition-transform duration-300 ease-in-out","group-hover:scale-125",a.items[l%a.items.length])}),(0,Ct.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Ct.jsxs)("span",{className:"truncate relative font-medium",children:[o.title,(0,Ct.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]}),o.subtitle&&(0,Ct.jsx)("div",{className:c("text-xs text-muted-foreground truncate","transition-colors duration-300 ease-in-out group-hover:text-accent/80"),children:o.subtitle})]}),o.value&&(0,Ct.jsx)(me,{variant:"secondary",className:c("text-xs h-5 px-1.5 flex-shrink-0 ml-2","transition-transform duration-300 ease-in-out group-hover:scale-110"),children:o.value})]},o.id))})}var mo=$(require("react"));var la=({isOpen:e=!0,authUrl:t,onClose:a,onSuccess:o,description:l="This endpoint requires authentication to sync functions."})=>{let[r,n]=(0,at.useState)(!1),[i,p]=(0,at.useState)(""),m=()=>{if(!t){p("No authentication URL provided");return}n(!0),p("");try{let f=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!f){p("Popup blocked. Please allow popups for this site and try again."),n(!1);return}let y=setInterval(()=>{try{f.closed&&(clearInterval(y),n(!1),o(),a())}catch{}},1e3);setTimeout(()=>{f.closed||(f.close(),clearInterval(y),n(!1),p("Authentication timed out. Please try again."))},6e5)}catch{p("Failed to open authentication window"),n(!1)}},k=async()=>{try{await navigator.clipboard.writeText(t),p("")}catch{p("Failed to copy URL to clipboard")}};return e?(0,Ct.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,Ct.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,Ct.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,Ct.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l}),i&&(0,Ct.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:i}),(0,Ct.jsxs)("div",{className:"flex gap-2",children:[(0,Ct.jsx)("button",{onClick:m,disabled:r||!t,className:`
9
+ </svg>`,Ui=`data:image/svg+xml;utf8,${encodeURIComponent(zi)}`,_t=Oa.default.memo(function(t){let{id:a,message:o,currentUser:l,role:r}=t,s=r==="user",i=s?l?.name||"You":l?.name||"AI Assistant",d=s?l?.avatar||"/placeholder-user.jpg":"/placeholder.svg?height=40&width=40";switch(o.type){case"forwarding":return(0,Pt.jsxs)("div",{className:`flex items-start gap-3 text-primary text-xs ${s?"flex-row-reverse":""}`,children:["Forwarding to ",o?.data?.content]},a);case"text":return(0,Pt.jsxs)("div",{className:`flex items-start gap-3 ${s?"flex-row-reverse":""}`,children:[s?(0,Pt.jsxs)(be,{children:[(0,Pt.jsx)(We,{src:d,alt:i}),(0,Pt.jsx)(ve,{children:i.substring(0,2).toUpperCase()})]}):(0,Pt.jsx)("img",{src:Ui,alt:"AI Assistant",className:"w-10 h-10"}),(0,Pt.jsxs)("div",{className:`grid gap-1.5 ${s?"text-right":""}`,children:[(0,Pt.jsx)("div",{className:"flex items-center gap-2",children:(0,Pt.jsx)("span",{className:"font-medium",children:i})}),(0,Pt.jsx)("div",{className:`rounded-lg p-3 text-sm ${s?"bg-primary text-primary-foreground":"bg-muted"}`,style:{whiteSpace:"pre-line"},children:o?.data?.content})]})]},a);case"image":return(0,Pt.jsxs)("div",{className:`flex items-start gap-3 ${s?"flex-row-reverse":""}`,children:[(0,Pt.jsxs)(be,{className:s?"":"ai-border",children:[(0,Pt.jsx)(We,{src:d,alt:i}),(0,Pt.jsx)(ve,{children:i.substring(0,2).toUpperCase()})]}),(0,Pt.jsxs)("div",{className:`grid gap-1.5 ${s?"text-right":""}`,children:[(0,Pt.jsx)("div",{className:"flex items-center gap-2",children:(0,Pt.jsx)("span",{className:"font-medium",children:i})}),(0,Pt.jsx)("img",{src:o?.data?.image,alt:"User uploaded content",className:`rounded-lg p-3 text-sm ${s?"bg-primary text-primary-foreground":"bg-muted"}`,style:{maxWidth:"100%",height:"auto"}})]})]},a);case"tool-invocation":if(o.data&&o.data.tool){let m=Ei[o.data.tool];return m?(0,Pt.jsx)("div",{className:"mt-2",children:(0,Pt.jsx)(m,{data:o.data})}):(console.warn(`Tool ${o.data.tool} is not defined.`),(0,Pt.jsx)("div",{className:"mt-2",children:"......"}))}}});var Jt=V(require("react")),ye=V(require("@radix-ui/react-scroll-area"));var xe=Jt.forwardRef(({className:e,children:t,...a},o)=>(0,Pt.jsxs)(ye.Root,{ref:o,className:c("relative overflow-hidden",e),...a,children:[(0,Pt.jsx)(ye.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,Pt.jsx)(Ha,{}),(0,Pt.jsx)(ye.Corner,{})]}));xe.displayName=ye.Root.displayName;var Ha=Jt.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,Pt.jsx)(ye.ScrollAreaScrollbar,{ref:o,orientation:t,className:c("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,Pt.jsx)(ye.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ha.displayName=ye.ScrollAreaScrollbar.displayName;function Fi({messages:e,isLoading:t}){let a=(0,it.useRef)(null);return(0,it.useEffect)(()=>{a.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,Pt.jsx)("div",{className:"flex flex-col h-full overflow-hidden",children:(0,Pt.jsxs)(xe,{className:"container flex-1 p-4",children:[(0,Pt.jsxs)("div",{className:"space-y-6",children:[e.length===0&&(0,Pt.jsx)("div",{className:"flex items-center justify-center h-full pt-60",children:(0,Pt.jsxs)("div",{className:"text-center max-w-md",children:[(0,Pt.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Welcome to Dexter"}),(0,Pt.jsx)("p",{className:"text-zinc-400",children:"Ask me anything or direct your question to a business function directly using the toolbar below."})]})}),t&&(0,Pt.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Pt.jsxs)(be,{className:"ai-border",children:[(0,Pt.jsx)(We,{src:"/placeholder.svg?height=40&width=40",alt:"AI Assistant"}),(0,Pt.jsx)(ve,{children:"AI"})]}),(0,Pt.jsxs)("div",{className:"grid gap-1.5",children:[(0,Pt.jsx)("div",{className:"flex items-center gap-2",children:(0,Pt.jsx)("span",{className:"font-medium",children:"AI Assistant"})}),(0,Pt.jsx)("div",{className:"rounded-lg p-3 text-sm bg-muted",children:(0,Pt.jsxs)("div",{className:"flex space-x-2",children:[(0,Pt.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce"}),(0,Pt.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce [animation-delay:0.2s]"}),(0,Pt.jsx)("div",{className:"w-2 h-2 rounded-full bg-current animate-bounce [animation-delay:0.4s]"})]})})]})]}),e.map((o,l)=>(0,Pt.jsx)(_t,{...o},l))]}),(0,Pt.jsx)("div",{ref:a})]})})}var Xt={primary:"bg-blue-500",secondary:"bg-gray-500",accent:"bg-purple-500",categories:["bg-green-500","bg-blue-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-orange-500"],lists:["bg-green-400","bg-blue-400","bg-purple-400","bg-pink-400","bg-indigo-400","bg-orange-400"],items:["bg-green-300","bg-blue-300","bg-purple-300","bg-pink-300","bg-indigo-300","bg-orange-300"]},Tt=[{id:"sales",name:"Sales",description:"Revenue and customer management",iconName:"DollarSign",color:"bg-green-600",type:"category",actions:[{id:"view-pipeline",label:"View Pipeline",description:"See all opportunities in pipeline",iconName:"BarChart",action:e=>console.log("View pipeline",e)},{id:"create-opportunity",label:"Create Opportunity",iconName:"Target",action:e=>console.log("Create opportunity",e)}],children:[{id:"customers",name:"Customers",description:"Customer accounts and contacts",iconName:"Users",color:"bg-blue-500",type:"list",actions:[{id:"add-customer",label:"Add Customer",iconName:"User",action:e=>console.log("Add customer",e)},{id:"export-customers",label:"Export List",iconName:"FileText",action:e=>console.log("Export customers",e)}],data:[{id:"acme-corp",title:"Acme Corp",subtitle:"Enterprise Customer",value:"$125K ARR",metadata:{industry:"Technology",employees:500,lastContact:"2024-01-15"}},{id:"beta-inc",title:"Beta Inc",subtitle:"Mid-market",value:"$45K ARR",metadata:{industry:"Healthcare",employees:150,lastContact:"2024-01-10"}},{id:"gamma-llc",title:"Gamma LLC",subtitle:"Small Business",value:"$15K ARR",metadata:{industry:"Manufacturing",employees:50,lastContact:"2024-01-08"}}]},{id:"opportunities",name:"Opportunities",description:"Sales opportunities and deals",iconName:"Target",color:"bg-yellow-500",type:"list",actions:[{id:"close-won",label:"Mark as Won",iconName:"CheckCircle",action:e=>console.log("Close won",e)},{id:"schedule-followup",label:"Schedule Follow-up",iconName:"Clock",action:e=>console.log("Schedule follow-up",e)}],data:[{id:"opp-1",title:"Acme Corp - Enterprise License",subtitle:"Closing Q1 2024",value:"$85K",metadata:{stage:"Negotiation",probability:80,closeDate:"2024-03-31"}},{id:"opp-2",title:"Beta Inc - Platform Upgrade",subtitle:"Closing Q2 2024",value:"$32K",metadata:{stage:"Proposal",probability:65,closeDate:"2024-06-15"}}]}]},{id:"marketing",name:"Marketing",description:"Marketing campaigns and analytics",iconName:"TrendingUp",color:"bg-pink-600",type:"category",actions:[{id:"view-analytics",label:"View Analytics",iconName:"BarChart",action:e=>console.log("View analytics",e)}],children:[{id:"campaigns",name:"Campaigns",description:"Marketing campaigns and performance",iconName:"TrendingUp",color:"bg-pink-500",type:"list",data:[{id:"campaign-1",title:"Q1 Product Launch",subtitle:"Active Campaign",value:"45% CTR",metadata:{budget:"$50K",spend:"$32K",leads:1250}},{id:"campaign-2",title:"Holiday Promotion",subtitle:"Completed",value:"38% CTR",metadata:{budget:"$25K",spend:"$24K",leads:890}}]}]},{id:"projects",name:"Projects",description:"Project management and tracking",iconName:"Briefcase",color:"bg-blue-600",type:"category",children:[{id:"active-projects",name:"Active Projects",description:"Currently active projects",iconName:"Activity",color:"bg-blue-500",type:"list",data:[{id:"project-1",title:"Website Redesign",subtitle:"In Progress",value:"75% Complete",metadata:{team:"Design",deadline:"2024-02-15",status:"On Track"}},{id:"project-2",title:"Mobile App Development",subtitle:"Planning",value:"25% Complete",metadata:{team:"Engineering",deadline:"2024-03-31",status:"On Track"}}]}]},{id:"engineering",name:"Engineering",description:"Development and technical operations",iconName:"Code",color:"bg-purple-600",type:"category",actions:[{id:"view-repos",label:"View Repositories",description:"See all code repositories",iconName:"Git",action:e=>console.log("View repositories",e)},{id:"create-task",label:"Create Task",iconName:"Plus",action:e=>console.log("Create task",e)}],children:[{id:"repositories",name:"Repositories",description:"Code repositories and projects",iconName:"GitBranch",color:"bg-purple-500",type:"list",actions:[{id:"create-repo",label:"Create Repository",iconName:"Plus",action:e=>console.log("Create repository",e)},{id:"view-commits",label:"View Commits",iconName:"Git",action:e=>console.log("View commits",e)}],data:[{id:"repo-1",title:"frontend-app",subtitle:"React Application",value:"Main Branch",metadata:{language:"TypeScript",commits:1247,contributors:8}},{id:"repo-2",title:"backend-api",subtitle:"Node.js API",value:"Main Branch",metadata:{language:"Node.js",commits:892,contributors:5}}]},{id:"tasks",name:"Tasks",description:"Development tasks and issues",iconName:"CheckSquare",color:"bg-blue-500",type:"list",actions:[{id:"create-task",label:"Create Task",iconName:"Plus",action:e=>console.log("Create task",e)},{id:"assign-task",label:"Assign Task",iconName:"UserPlus",action:e=>console.log("Assign task",e)}],data:[{id:"task-1",title:"Fix authentication bug",subtitle:"High Priority",value:"In Progress",metadata:{assignee:"John Doe",priority:"High",estimate:"4h"}},{id:"task-2",title:"Implement dark mode",subtitle:"Feature Request",value:"Todo",metadata:{assignee:"Jane Smith",priority:"Medium",estimate:"8h"}}]}]},{id:"design",name:"Design",description:"User experience and visual design",iconName:"Palette",color:"bg-pink-600",type:"category",actions:[{id:"view-designs",label:"View Designs",description:"See all design assets",iconName:"Image",action:e=>console.log("View designs",e)},{id:"create-mockup",label:"Create Mockup",iconName:"Plus",action:e=>console.log("Create mockup",e)}],children:[{id:"assets",name:"Assets",description:"Design assets and components",iconName:"Package",color:"bg-pink-500",type:"list",actions:[{id:"add-asset",label:"Add Asset",iconName:"Plus",action:e=>console.log("Add asset",e)},{id:"organize-assets",label:"Organize",iconName:"FolderOpen",action:e=>console.log("Organize assets",e)}],data:[{id:"asset-1",title:"Logo Variations",subtitle:"Brand Assets",value:"12 files",metadata:{format:"SVG",size:"2.4MB",updated:"2024-01-20"}},{id:"asset-2",title:"UI Components",subtitle:"Component Library",value:"45 components",metadata:{format:"Figma",size:"18.7MB",updated:"2024-01-22"}}]}]},{id:"product",name:"Product",description:"Product management and strategy",iconName:"Layers",color:"bg-indigo-600",type:"category",actions:[{id:"view-roadmap",label:"View Roadmap",description:"See product roadmap",iconName:"Map",action:e=>console.log("View roadmap",e)},{id:"create-feature",label:"Create Feature",iconName:"Plus",action:e=>console.log("Create feature",e)}],children:[{id:"features",name:"Features",description:"Product features and requirements",iconName:"Star",color:"bg-indigo-500",type:"list",actions:[{id:"add-feature",label:"Add Feature",iconName:"Plus",action:e=>console.log("Add feature",e)},{id:"prioritize-features",label:"Prioritize",iconName:"ArrowUp",action:e=>console.log("Prioritize features",e)}],data:[{id:"feature-1",title:"User Authentication",subtitle:"Security Feature",value:"In Development",metadata:{priority:"High",effort:"Large",impact:"High"}},{id:"feature-2",title:"Dark Mode",subtitle:"UI Enhancement",value:"Backlog",metadata:{priority:"Medium",effort:"Small",impact:"Medium"}}]}]}];function ji(e){let t=Tt,a=null;for(let o of e){if(a=t.find(l=>l.id===o||l.name===o)||null,!a)return null;t=a.children||[]}return a}function Rt(e){let t=e.path[e.path.length-1];return t?.actions?t.actions:[]}function Oi(e){return Tt.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||e.toLowerCase().includes(t.name.toLowerCase()))}function Hi(){return Tt}function Qt({artefact:e,taskId:t,taskData:a,loading:o=!1,error:l=null}){let r=a||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},s=r.dateLogged;try{let i=new Date(r.dateLogged);isNaN(i.getTime())||(s=(0,$a.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,Pt.jsxs)(he,{className:"w-full max-w-md shadow-md",children:[(0,Pt.jsx)(ze,{className:"pb-2",children:(0,Pt.jsx)("div",{className:"flex justify-between items-start",children:(0,Pt.jsx)(Ue,{className:"text-lg font-semibold",children:o?"Loading...":r.name})})}),(0,Pt.jsx)(Te,{className:"pb-2",children:o?(0,Pt.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):l?(0,Pt.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Pt.jsx)("p",{className:"text-sm text-foreground",children:e})}),(0,Pt.jsx)(gt,{className:"pt-2 flex items-center justify-between",children:(0,Pt.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Pt.jsx)(Fa.Clock,{className:"h-3 w-3 mr-1"}),(0,Pt.jsxs)("span",{children:["Created ",s]}),(0,Pt.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Pt.jsxs)("span",{children:["Task #",r.id]})]})})]})}var Bo=require("@ai-sdk/react"),Vt=require("motion/react");var zt=V(require("react")),oa=V(require("next/link"));var Wa=require("@radix-ui/react-slot"),qa=V(require("react")),Vi=(0,Ea.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"h-10 px-4 py-2",icon:"h-10 w-10",lg:"h-11 rounded px-8",sm:"h-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),S=qa.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...l},r)=>(0,Pt.jsx)(e?Wa.Slot:"button",{className:c(Vi({className:t,size:a,variant:o})),ref:r,...l}));S.displayName="Button";var _a=V(require("react"));var bt=_a.forwardRef(({className:e,type:t,...a},o)=>(0,Pt.jsx)("input",{type:t,className:c("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...a}));bt.displayName="Input";var vt=V(require("react")),X=V(require("@radix-ui/react-dialog"));var Qa=X.Root;var $i=X.Portal;var Ya=vt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(X.Overlay,{ref:a,className:c("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Ya.displayName=X.Overlay.displayName;var Yt=vt.forwardRef(({className:e,children:t,...a},o)=>(0,Pt.jsxs)($i,{children:[(0,Pt.jsx)(Ya,{}),(0,Pt.jsxs)(X.Content,{ref:o,className:c("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,Pt.jsxs)(X.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,Pt.jsx)(Fa.X,{className:"h-4 w-4"}),(0,Pt.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Yt.displayName=X.Content.displayName;var Zt=({className:e,...t})=>(0,Pt.jsx)("div",{className:c("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Zt.displayName="DialogHeader";var Wi=({className:e,...t})=>(0,Pt.jsx)("div",{className:c("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Wi.displayName="DialogFooter";var ea=vt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(X.Title,{ref:a,className:c("text-lg font-semibold leading-none tracking-tight",e),...t}));ea.displayName=X.Title.displayName;var Gi=vt.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(X.Description,{ref:a,className:c("text-sm text-muted-foreground",e),...t}));Gi.displayName=X.Description.displayName;var ht=V(require("@radix-ui/react-checkbox")),eo=V(require("react")),ta=eo.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(ht.Root,{className:c("peer h-4 w-4 shrink-0 rounded border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),ref:a,...t,children:(0,Pt.jsx)(ht.Indicator,{className:c("flex items-center justify-center text-current"),children:(0,Pt.jsx)(Fa.Check,{className:"h-4 w-4"})})}));ta.displayName=ht.Root.displayName;var Re=e=>({id:Math.random().toString(36).substr(2,9),title:e,format:"markdown",createdAt:new Date});var ao=[{id:"design",name:"Design",description:"Creative and visual design team",icon:(0,Pt.jsx)(Fa.Palette,{className:"h-4 w-4"}),color:"bg-purple-600",accentColor:"text-purple-600"},{id:"engineering",name:"Engineering",description:"Software development and technical teams",icon:(0,Pt.jsx)(Fa.Code,{className:"h-4 w-4"}),color:"bg-blue-600",accentColor:"text-blue-600"},{id:"marketing",name:"Marketing",description:"Brand, campaigns, and growth marketing",icon:(0,Pt.jsx)(Fa.TrendingUp,{className:"h-4 w-4"}),color:"bg-pink-600",accentColor:"text-pink-600"},{id:"sales",name:"Sales",description:"Revenue generation and customer acquisition",icon:(0,Pt.jsx)(Fa.DollarSign,{className:"h-4 w-4"}),color:"bg-green-600",accentColor:"text-green-600"},{id:"hr",name:"Human Resources",description:"People operations and talent management",icon:(0,Pt.jsx)(Fa.Users,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"},{id:"operations",name:"Operations",description:"Business operations and process optimization",icon:(0,Pt.jsx)(Fa.Wrench,{className:"h-4 w-4"}),color:"bg-indigo-600",accentColor:"text-indigo-600"},{id:"legal",name:"Legal",description:"Legal affairs and compliance",icon:(0,Pt.jsx)(Fa.Scale,{className:"h-4 w-4"}),color:"bg-slate-600",accentColor:"text-slate-600"},{id:"product",name:"Product",description:"Product strategy and management",icon:(0,Pt.jsx)(Fa.Package,{className:"h-4 w-4"}),color:"bg-violet-600",accentColor:"text-violet-600"},{id:"it",name:"IT Support",description:"Information technology and infrastructure",icon:(0,Pt.jsx)(Fa.Zap,{className:"h-4 w-4"}),color:"bg-cyan-600",accentColor:"text-cyan-600"},{id:"company",name:"Company",description:"Company-wide resources and information",icon:(0,Pt.jsx)(Fa.Building2,{className:"h-4 w-4"}),color:"bg-gray-600",accentColor:"text-gray-600"}],It=[{id:"1",name:"E-commerce Platform",description:"Main customer-facing e-commerce application",isSelected:!0},{id:"2",name:"Admin Dashboard",description:"Internal administration and analytics dashboard",isSelected:!1},{id:"3",name:"Mobile App",description:"Native mobile application for iOS and Android",isSelected:!1}];var aa=[{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},{id:"2",name:"Dashboard Features",color:"bg-green-500",description:"Build comprehensive dashboard functionality",confidence:"medium",phase:1,startDate:new Date("2024-02-01"),endDate:new Date("2024-03-15"),progress:30,isSelected:!0},{id:"3",name:"Mobile Optimization",color:"bg-purple-500",description:"Optimize application for mobile devices",confidence:"low",phase:1,startDate:new Date("2024-03-01"),endDate:new Date("2024-04-15"),progress:10,isSelected:!0},{id:"4",name:"Performance Improvements",color:"bg-orange-500",description:"Enhance application performance and speed",confidence:"high",phase:3,startDate:new Date("2024-01-15"),endDate:new Date("2024-02-28"),progress:90,isSelected:!0}],St=[{id:"backlog",name:"Backlog",description:"Tasks not yet assigned to a sprint",startDate:new Date("2024-01-01"),endDate:new Date("2024-12-31"),isActive:!1,isSelected:!1},{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},{id:"1",name:"Sprint 1",description:"Initial development phase",startDate:new Date("2024-01-01"),endDate:new Date("2024-01-14"),isActive:!1,isSelected:!1},{id:"2",name:"Sprint 2",description:"Feature development",startDate:new Date("2024-01-15"),endDate:new Date("2024-01-28"),isActive:!0,isSelected:!1}],Bt=[{id:"1",name:"Design login page",description:"Create wireframes and mockups for the login interface",status:"todo",priority:"high",type:"story",points:5,epicId:"1",sprintId:"2",assignee:"John Doe",createdAt:new Date("2024-01-15")},{id:"2",name:"Implement OAuth integration",description:"Add Google and GitHub OAuth authentication",status:"review",priority:"high",type:"task",points:8,epicId:"1",sprintId:"2",assignee:"Jane Smith",createdAt:new Date("2024-01-16")},{id:"3",name:"Create dashboard widgets",description:"Build analytics and metrics widgets for the main dashboard",status:"todo",priority:"medium",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Mike Johnson",createdAt:new Date("2024-01-17")},{id:"4",name:"Fix login redirect bug",description:"Resolve issue where users are not redirected after login",status:"done",priority:"high",type:"bug",points:3,epicId:"1",sprintId:"1",assignee:"Sarah Wilson",createdAt:new Date("2024-01-14")},{id:"5",name:"Research mobile frameworks",description:"Investigate best practices for mobile responsive design",status:"in-progress",priority:"medium",type:"spike",points:5,epicId:"3",assignee:"Alex Brown",createdAt:new Date("2024-01-18")},{id:"6",name:"Update user profile page",description:"Enhance user profile with new settings and preferences",status:"review",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Emma Davis",createdAt:new Date("2024-01-19")},{id:"7",name:"Performance optimization",description:"Optimize database queries and improve page load times",status:"done",priority:"high",type:"task",points:13,epicId:"4",sprintId:"1",assignee:"Tom Wilson",createdAt:new Date("2024-01-13")}],qi=[...Bt,{id:"8",name:"Add search functionality",description:"Implement search across all dashboard widgets",status:"todo",priority:"medium",type:"story",points:8,epicId:"2",sprintId:"2",assignee:"Chris Lee",createdAt:new Date("2024-01-20")},{id:"9",name:"Fix mobile responsive issues",description:"Resolve layout problems on mobile devices",status:"in-progress",priority:"high",type:"bug",points:5,epicId:"3",sprintId:"2",assignee:"Taylor Swift",createdAt:new Date("2024-01-21")},{id:"10",name:"Implement dark mode",description:"Add dark theme support across the application",status:"review",priority:"low",type:"story",points:13,epicId:"2",sprintId:"2",assignee:"Jordan Smith",createdAt:new Date("2024-01-22")},{id:"11",name:"API rate limiting",description:"Implement rate limiting for API endpoints",status:"done",priority:"high",type:"task",points:8,epicId:"4",sprintId:"1",assignee:"Morgan Davis",createdAt:new Date("2024-01-12")},{id:"12",name:"User onboarding flow",description:"Create guided tour for new users",status:"todo",priority:"medium",type:"story",points:21,epicId:"1",sprintId:"2",assignee:"Casey Johnson",createdAt:new Date("2024-01-23")}],Ki=[...It,{id:"4",name:"Analytics Platform",description:"Business intelligence and reporting system",isSelected:!1},{id:"5",name:"API Gateway",description:"Microservices API management layer",isSelected:!1}],Mt={projects:[{id:"1",name:"Empty Project",description:"A project with no 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:[]},to={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:Bt.filter(e=>e.epicId==="1")};var gn={empty:{initialProjects:Mt.projects,initialEpics:Mt.epics,initialSprints:Mt.sprints,initialTasks:Mt.tasks},default:{initialProjects:It,initialEpics:aa,initialSprints:St,initialTasks:Bt},highDensity:{initialProjects:It,initialEpics:aa,initialSprints:St,initialTasks:qi},singleEpic:{initialProjects:It,initialEpics:to.epics,initialSprints:St,initialTasks:to.tasks},multipleProjects:{initialProjects:Ki,initialEpics:aa,initialSprints:St,initialTasks:Bt}},Lt=[{id:"1",type:"human",name:"Sarah Johnson",email:"sarah.johnson@company.com",role:"Senior Designer",department:"Design",status:"active",joinedDate:new Date("2023-01-15"),lastActive:new Date,phone:"+1 (555) 123-4567",location:"San Francisco, CA",timezone:"PST",skills:["UI/UX Design","Figma","Adobe Creative Suite","Prototyping","User Research"],bio:"Passionate designer with 8+ years of experience creating user-centered digital experiences."},{id:"2",type:"digital",name:"CodeAssist Pro",status:"active",joinedDate:new Date("2024-01-01"),lastActive:new Date,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:["Code Review","Documentation Generation","Debugging","Code Optimization","Testing"],knowledge:["JavaScript","TypeScript","React","Node.js","Python","Git"].map(Re),coreKnowledge:["Company coding standards","Architecture patterns","Security guidelines"].map(Re),version:"2",lastUpdated:new Date("2024-01-15"),isActive:!0},{id:"3",type:"human",name:"Michael Chen",email:"michael.chen@company.com",role:"Product Manager",department:"Product",status:"inactive",joinedDate:new Date("2022-08-20"),lastActive:new Date(Date.now()-2*60*60*1e3),phone:"+1 (555) 987-6543",location:"New York, NY",timezone:"EST",skills:["Product Strategy","Agile","Data Analysis","User Stories","Roadmapping"],bio:"Strategic product manager focused on driving user engagement and business growth."},{id:"4",type:"digital",name:"MarketingBot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,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:["Content Creation","Social Media Management","Analytics","SEO Optimization","Campaign Management"],knowledge:["Digital Marketing","Social Media Platforms","Content Strategy","Analytics Tools"].map(Re),coreKnowledge:["Brand guidelines","Target audience personas","Marketing objectives"].map(Re),version:"52",lastUpdated:new Date("2024-02-10"),isActive:!0},{id:"5",type:"human",name:"Emily Rodriguez",email:"emily.rodriguez@company.com",role:"UX Researcher",department:"Design",status:"inactive",joinedDate:new Date("2023-06-10"),lastActive:new Date(Date.now()-7*24*60*60*1e3),phone:"+1 (555) 456-7890",location:"Austin, TX",timezone:"CST",skills:["User Research","Usability Testing","Data Analysis","Survey Design","Interview Techniques"],bio:"User researcher dedicated to understanding user needs and improving product experiences."},{id:"6",type:"digital",name:"DataAnalyzer Pro",status:"active",joinedDate:new Date("2024-01-10"),lastActive:new Date,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:["Data Analysis","Report Generation","Data Visualization","Business Intelligence","Statistical Analysis"],knowledge:["Python","SQL","Tableau","Excel","R","Statistics"].map(Re),coreKnowledge:["Company data sources","KPI definitions","Reporting standards"].map(Re),version:"3.1",lastUpdated:new Date("2024-02-20"),isActive:!0},{id:"7",type:"digital",name:"ProjectManager AI",status:"active",joinedDate:new Date("2024-01-05"),lastActive:new Date,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:["Project Planning","Task Coordination","Timeline Management","Resource Allocation","Progress Tracking"],knowledge:["Agile","Scrum","Gantt Charts","Risk Management","Stakeholder Management"].map(Re),coreKnowledge:["Company project templates","Resource availability","Project methodologies"].map(Re),version:"2.5",lastUpdated:new Date("2024-02-15"),isActive:!0},{id:"8",type:"digital",name:"CustomerSupport Bot",status:"active",joinedDate:new Date("2024-02-01"),lastActive:new Date,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:["Customer Support","Issue Resolution","Product Knowledge","Escalation Management","Chat Support"],knowledge:["Product Documentation","FAQ","Troubleshooting Guides","Customer Service Best Practices"].map(Re),coreKnowledge:["Product catalog","Support processes","Escalation procedures"].map(Re),version:"1.8",lastUpdated:new Date("2024-02-25"),isActive:!0}],fn=[{id:"1",title:"Review quarterly report",description:"Go through Q4 performance metrics and prepare summary for the team meeting",dueDate:new Date(2024,2,15),dueTime:"14:30",colleague:Lt.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:30,createdAt:new Date(2024,2,10),tags:["quarterly","review","urgent"]},{id:"2",title:"Weekly team standup",description:"Join the weekly team synchronization meeting",dueDate:new Date(2024,2,18),dueTime:"10:00",colleague:Lt.find(e=>e.id==="4"&&e.type==="digital"),isCompleted:!1,isRecurring:!0,recurrencePattern:"weekly",recurrenceInterval:1,priority:"medium",reminderEnabled:!0,reminderMinutes:15,createdAt:new Date(2024,2,11),tags:["meeting","standup","weekly"]},{id:"3",title:"Deploy to production",description:"Deploy the latest version to production environment",dueDate:new Date,dueTime:"16:00",colleague:Lt.find(e=>e.id==="2"&&e.type==="digital"),isCompleted:!1,isRecurring:!1,priority:"high",reminderEnabled:!0,reminderMinutes:60,createdAt:new Date,tags:["deploy","production","urgent"]}];var bn=Lt.filter(e=>e.type==="digital");function oo(e,t){let[a,o]=(0,it.useState)(()=>{if(typeof window>"u")return t;try{let r=window.localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}}),l=r=>{try{o(r),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(r))}catch{}};return(0,it.useEffect)(()=>{l(a)},[]),[a,l]}function ia({items:e,isOpen:t,isMobile:a=!1,onClose:o,currentBusinessUnit:l=ao[0],onBusinessUnitChange:r,onSearch:s,className:i,logo:d="/headerlogo.png",appName:m="Nuvia",tagline:w="Collaboration Platform"}){let[f,h]=zt.useState({}),[R,M]=oo("sidebar-favorites",{}),[T,x]=zt.useState(null),[P,F]=zt.useState(""),C=p=>{h(E=>({...E,[p]:!E[p]}))},z=p=>{r?.(p)},ee=()=>{P.trim()&&s?.(P.trim())},te=p=>{p.key==="Enter"&&(p.preventDefault(),ee())},ae=(p,E)=>{let L=R[p]||[],_=L.includes(E)?L.filter(u=>u!==E):L.concat(E);M({...R,[p]:_})},Z=p=>{if(!p.items||!p.maxItems||p.items.length<=p.maxItems)return p.items||[];let E=R[p.id]||[],L=p.items.filter(u=>E.includes(u.id)),_=p.items.filter(u=>!E.includes(u.id));return[...L,..._].slice(0,p.maxItems)},q=p=>p.maxItems&&p.items&&p.items.length>p.maxItems,re=e,de=p=>{let E=q(p),L=Z(p),_=(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsxs)("div",{className:"flex items-center gap-3",children:[p.icon,(0,Pt.jsx)("span",{children:p.title})]}),p.badge&&(0,Pt.jsx)(ge,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:p.badge}),p.items&&(0,Pt.jsx)(Fa.ChevronDown,{className:c("ml-2 h-4 w-4 transition-transform",f[p.title]?"rotate-180":"")})]}),u=c("flex w-full items-center justify-between rounded-2xl px-3 py-2 text-sm font-medium",p.isActive?"bg-primary/10 text-primary":"hover:bg-muted");return p.url?(0,Pt.jsx)(oa.default,{href:p.url,className:u,onClick:a?o:void 0,children:_}):(0,Pt.jsx)("button",{className:u,onClick:()=>p.items&&C(p.title),children:_})},I=()=>{let p=e.find(L=>L.id===T);if(!p||!p.items||!p.maxItems)return null;let E=R[p.id]||[];return(0,Pt.jsx)(Qa,{open:!!T,onOpenChange:L=>!L&&x(null),children:(0,Pt.jsxs)(Yt,{className:"sm:max-w-md",children:[(0,Pt.jsxs)(Zt,{children:[(0,Pt.jsxs)(ea,{children:["Manage ",p.title," Favorites"]}),(0,Pt.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select up to ",p.maxItems," items to show in ",p.title.toLowerCase(),"."]})]}),(0,Pt.jsx)(xe,{className:"max-h-96 pr-4",children:(0,Pt.jsx)("div",{className:"space-y-4",children:p.items.map(L=>(0,Pt.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,Pt.jsx)(ta,{id:L.id,checked:E.includes(L.id),onCheckedChange:()=>ae(p.id,L.id),disabled:!E.includes(L.id)&&E.length>=(p.maxItems||0)}),(0,Pt.jsxs)("label",{htmlFor:L.id,className:"flex items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[L.title,L.badge&&(0,Pt.jsx)(ge,{variant:"outline",className:"text-xs",children:L.badge})]})]},L.id))})})]})})},Ie=(0,Pt.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,Pt.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,Pt.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Pt.jsx)("div",{className:"flex h-14 w-14 items-center justify-center",children:(0,Pt.jsx)("img",{src:d,alt:"Header Logo",className:"h-14 w-14 object-contain"})}),(0,Pt.jsxs)("div",{children:[(0,Pt.jsx)("h2",{className:"font-semibold",children:m}),(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground",children:w})]})]}),a&&(0,Pt.jsx)(S,{variant:"ghost",size:"icon",onClick:o,children:(0,Pt.jsx)(Fa.X,{className:"h-5 w-5"})})]}),(0,Pt.jsx)("div",{className:"px-3 py-2",children:(0,Pt.jsxs)("div",{className:"relative",children:[(0,Pt.jsx)(Fa.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,Pt.jsx)(bt,{type:"search",placeholder:"Search...",className:"w-full rounded-2xl bg-muted pl-9 pr-4 py-2",value:P,onChange:p=>F(p.target.value),onKeyPress:te})]})}),(0,Pt.jsx)(xe,{className:"flex-1 px-3 py-2",children:(0,Pt.jsx)("div",{className:"space-y-1",children:re.map(p=>(0,Pt.jsxs)("div",{className:"mb-1",children:[de(p),p.items&&f[p.title]&&(0,Pt.jsxs)("div",{className:"mt-1 ml-6 space-y-1 border-l pl-3",children:[Z(p).map(E=>(0,Pt.jsxs)(oa.default,{href:E.url,className:"flex items-center justify-between rounded-2xl px-3 py-2 text-sm hover:bg-muted",onClick:a?o:void 0,children:[E.title,E.badge&&(0,Pt.jsx)(ge,{variant:"outline",className:"ml-auto rounded-full px-2 py-0.5 text-xs",children:E.badge})]},E.id)),q(p)&&p.items&&p.items.length>Z(p).length&&(0,Pt.jsxs)("button",{onClick:()=>x(p.id),className:"w-full px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded-2xl transition-colors text-left",children:["...",p.items.length-Z(p).length," more available"]})]})]},p.id))})}),(0,Pt.jsx)("div",{className:"p-3",children:(0,Pt.jsx)("div",{className:"space-y-1",children:(0,Pt.jsxs)("button",{className:"flex w-full items-center gap-3 rounded-2xl px-3 py-2 text-sm font-medium hover:bg-muted",children:[(0,Pt.jsx)(Fa.Settings,{className:"h-5 w-5"}),(0,Pt.jsx)("span",{children:"Settings"})]})})}),(0,Pt.jsx)(I,{})]});return a?(0,Pt.jsx)("div",{className:c("fixed inset-y-0 left-0 z-50 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",i),children:Ie}):(0,Pt.jsx)("div",{className:c("fixed inset-y-0 left-0 z-30 w-64 transform bg-background transition-transform duration-300 ease-in-out",t?"translate-x-0":"-translate-x-full",i),children:Ie})}var io=V(require("react")),Ne=V(require("@radix-ui/react-tooltip"));var rt=Ne.Provider,nt=Ne.Root,st=Ne.Trigger,Ye=io.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Pt.jsx)(Ne.Portal,{children:(0,Pt.jsx)(Ne.Content,{ref:o,sideOffset:t,className:c("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Ye.displayName=Ne.Content.displayName;var ro=require("next-themes");function no(){let{setTheme:e,theme:t}=(0,ro.useTheme)();return(0,Pt.jsx)(rt,{children:(0,Pt.jsxs)(nt,{children:[(0,Pt.jsx)(st,{asChild:!0,children:(0,Pt.jsxs)(S,{variant:"ghost",size:"icon",className:"rounded-2xl",onClick:()=>e(t==="light"?"dark":"light"),children:[(0,Pt.jsx)(Fa.Sun,{className:"h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,Pt.jsx)(Fa.Moon,{className:"absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,Pt.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}),(0,Pt.jsx)(Ye,{children:"Toggle theme"})]})})}function so({notifications:e,open:t,onClose:a,onNotificationRemove:o,onRemoveAll:l,className:r}){let s=e.filter(m=>!m.read),i=s.length,d=m=>{switch(m){case"info":return(0,Pt.jsx)(Fa.Info,{className:"h-5 w-5 text-blue-500"});case"success":return(0,Pt.jsx)(Fa.Check,{className:"h-5 w-5 text-green-500"});case"warning":return(0,Pt.jsx)(Fa.AlertTriangle,{className:"h-5 w-5 text-amber-500"});case"error":return(0,Pt.jsx)(Fa.AlertTriangle,{className:"h-5 w-5 text-red-500"})}};return(0,Pt.jsx)(Vt.AnimatePresence,{children:t&&(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsx)(Vt.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-sm md:hidden",onClick:a}),(0,Pt.jsx)(Vt.motion.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:20,stiffness:300},className:c("fixed inset-y-0 right-0 z-50 w-full max-w-sm border-l bg-background shadow-lg md:w-96",r),children:(0,Pt.jsxs)("div",{className:"flex h-full flex-col",children:[(0,Pt.jsxs)("div",{className:"flex items-center justify-between border-Pt p-4",children:[(0,Pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Pt.jsx)(Fa.Bell,{className:"h-5 w-5"}),(0,Pt.jsx)("h2",{className:"text-lg font-semibold",children:"Notifications"}),i>0&&(0,Pt.jsxs)(ge,{variant:"secondary",className:"rounded-full px-2 py-0.5",children:[i," new"]})]}),(0,Pt.jsxs)(S,{variant:"ghost",size:"icon",onClick:a,className:"rounded-full",children:[(0,Pt.jsx)(Fa.X,{className:"h-5 w-5"}),(0,Pt.jsx)("span",{className:"sr-only",children:"Close"})]})]}),i>0&&(0,Pt.jsxs)("div",{className:"flex items-center justify-between border-Pt p-2",children:[(0,Pt.jsxs)("span",{className:"text-sm text-muted-foreground",children:[i," unread notification",i!==1?"s":""]}),(0,Pt.jsx)(S,{variant:"ghost",size:"sm",onClick:l,className:"text-sm",children:"Dismiss all"})]}),s.length>0?(0,Pt.jsx)(xe,{className:"flex-1",children:(0,Pt.jsx)("div",{className:"divide-y",children:s.map(m=>(0,Pt.jsxs)("div",{className:c("flex gap-3 p-4 transition-colors bg-muted/50"),children:[(0,Pt.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted",children:d(m.type)}),(0,Pt.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Pt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Pt.jsx)("p",{className:"font-medium",children:m.title}),(0,Pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground",children:m.time}),(0,Pt.jsx)(S,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o?.(m.id),title:"Dismiss",children:(0,Pt.jsx)(Fa.Check,{className:"h-3 w-3"})})]})]}),(0,Pt.jsx)("p",{className:"text-sm text-muted-foreground",children:m.description}),m.actionLabel&&(0,Pt.jsxs)(S,{variant:"link",size:"sm",className:"h-auto p-0 text-sm",onClick:m.onAction,children:[m.actionLabel,(0,Pt.jsx)(Fa.ChevronRight,{className:"ml-1 h-3 w-3"})]})]})]},m.id))})}):(0,Pt.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center p-8 text-center",children:[(0,Pt.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted",children:(0,Pt.jsx)(Fa.Bell,{className:"h-8 w-8 text-muted-foreground"})}),(0,Pt.jsx)("h3",{className:"mt-4 text-lg font-medium",children:"No notifications"}),(0,Pt.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"When you receive notifications, they'll appear here."})]})]})})]})})}var Ze=V(require("@radix-ui/react-tabs"));function lo({className:e,...t}){return(0,Pt.jsx)(Ze.Root,{"data-slot":"tabs",className:c("flex flex-col gap-2",e),...t})}function co({className:e,...t}){return(0,Pt.jsx)(Ze.List,{"data-slot":"tabs-list",className:c("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function po({className:e,...t}){return(0,Pt.jsx)(Ze.Trigger,{"data-slot":"tabs-trigger",className:c("data-[state=active]:bg-accent data-[state=active]:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var Fe=V(require("react")),D=V(require("@radix-ui/react-dropdown-menu")),lt=require("@radix-ui/react-icons");var mo=D.Root,uo=D.Trigger;var _i=Fe.forwardRef(({className:e,inset:t,children:a,...o},l)=>(0,Pt.jsxs)(D.SubTrigger,{ref:l,className:c("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[a,(0,Pt.jsx)(lt.ChevronRightIcon,{className:"ml-auto"})]}));_i.displayName=D.SubTrigger.displayName;var Ji=Fe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(D.SubContent,{ref:a,className:c("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ji.displayName=D.SubContent.displayName;var na=Fe.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,Pt.jsx)(D.Portal,{children:(0,Pt.jsx)(D.Content,{ref:o,sideOffset:t,className:c("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));na.displayName=D.Content.displayName;var sa=Fe.forwardRef(({className:e,inset:t,...a},o)=>(0,Pt.jsx)(D.Item,{ref:o,className:c("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...a}));sa.displayName=D.Item.displayName;var Xi=Fe.forwardRef(({className:e,children:t,checked:a,...o},l)=>(0,Pt.jsxs)(D.CheckboxItem,{ref:l,className:c("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...o,children:[(0,Pt.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Pt.jsx)(D.ItemIndicator,{children:(0,Pt.jsx)(lt.CheckIcon,{className:"h-4 w-4"})})}),t]}));Xi.displayName=D.CheckboxItem.displayName;var Qi=Fe.forwardRef(({className:e,children:t,...a},o)=>(0,Pt.jsxs)(D.RadioItem,{ref:o,className:c("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,Pt.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,Pt.jsx)(D.ItemIndicator,{children:(0,Pt.jsx)(lt.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Qi.displayName=D.RadioItem.displayName;var Yi=Fe.forwardRef(({className:e,inset:t,...a},o)=>(0,Pt.jsx)(D.Label,{ref:o,className:c("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));Yi.displayName=D.Label.displayName;var Zi=Fe.forwardRef(({className:e,...t},a)=>(0,Pt.jsx)(D.Separator,{ref:a,className:c("-mx-1 my-1 h-px bg-muted",e),...t}));Zi.displayName=D.Separator.displayName;var er=({className:e,...t})=>(0,Pt.jsx)("span",{className:c("ml-auto text-xs tracking-widest opacity-60",e),...t});er.displayName="DropdownMenuShortcut";function fo({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:l="700px",gridCols:r=6}){let s=a.find(i=>i.value===e);return(0,Pt.jsxs)(Vt.motion.div,{className:`flex-1 flex justify-center ${o}`,initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:[(0,Pt.jsx)("div",{className:"hidden lg:block",children:(0,Pt.jsx)(lo,{value:e,onValueChange:t,children:(0,Pt.jsx)(co,{className:"grid w-full rounded-2xl p-0 h-10",style:{maxWidth:l,gridTemplateColumns:`repeat(${Math.min(r,a.length)}, minmax(0, 1fr))`},children:a.map(i=>(0,Pt.jsx)(Vt.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,Pt.jsx)(po,{value:i.value,className:"w-full h-8 rounded-xl data-[state=active]:rounded-xl transition-all duration-200 hover:border hover:border-accent hover:bg-accent/10 px-4 py-2 text-sm font-medium",children:i.label})},i.value))})})}),(0,Pt.jsx)("div",{className:"lg:hidden",children:(0,Pt.jsxs)(mo,{children:[(0,Pt.jsx)(uo,{asChild:!0,children:(0,Pt.jsxs)(S,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[s?.label||"Select",(0,Pt.jsx)(Fa.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,Pt.jsx)(na,{align:"center",className:"w-[180px]",children:a.map(i=>(0,Pt.jsx)(sa,{onClick:()=>t?.(i.value),className:`cursor-pointer ${e===i.value?"bg-accent":""}`,children:i.label},i.value))})]})})]})}function bo({title:e,notifications:t=[],onToggleSidebar:a,onToggleMobileMenu:o,sidebarOpen:l=!0,className:r,activeTab:s="assistant",onTabChange:i,showTabs:d=!0,tabOptions:m=[{value:"home",label:"Home"},{value:"chat",label:"Chat"},{value:"projects",label:"Projects"},{value:"colleagues",label:"Colleagues"},{value:"knowledge",label:"Knowledge"}],onActionClick:w,actionIcon:f=(0,Pt.jsx)(Fa.Bot,{className:"mr-2 h-4 w-4"}),actionText:h="Action",onNotificationRemove:R,onRemoveAll:M,logo:T="/headerlogo.png",appName:x="Nuvia",tagline:P="Collaboration Platform"}){let[F,C]=(0,it.useState)(!1),[z,ee]=(0,it.useState)(t),te=z.filter(q=>!q.read).length,ae=q=>{ee(re=>re.filter(de=>de.id!==q)),R?.(q)},Z=()=>{ee(q=>q.filter(re=>re.read)),M?.()};return(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsxs)("header",{className:`sticky top-0 z-10 flex h-16 items-center gap-3 pl-2 pr-4 backdrop-blur ${r||""}`,children:[(0,Pt.jsx)(S,{variant:"ghost",size:"icon",className:"md:hidden",onClick:o,children:(0,Pt.jsx)(Fa.Menu,{className:"h-5 w-5"})}),(0,Pt.jsx)(S,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:a,children:(0,Pt.jsx)(Fa.PanelLeft,{className:"h-5 w-5"})}),!l&&(0,Pt.jsxs)(Vt.motion.div,{className:"flex items-center gap-3",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},children:[(0,Pt.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:(0,Pt.jsx)("img",{src:T,alt:"Logo",className:"h-10 w-10 object-contain"})}),(0,Pt.jsxs)("div",{children:[(0,Pt.jsx)("h2",{className:"font-semibold text-sm",children:x}),(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground",children:P})]})]}),(0,Pt.jsxs)("div",{className:"flex flex-1 items-center",children:[d&&(0,Pt.jsx)(fo,{activeTab:s,onTabChange:i,tabOptions:m}),(0,Pt.jsxs)("div",{className:"flex items-center gap-3 ml-auto",children:[(0,Pt.jsx)(Vt.motion.div,{className:"hidden md:flex gap-2",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:(0,Pt.jsx)(Vt.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Pt.jsxs)(S,{className:"rounded-2xl transition-all duration-200 hover:shadow-md",onClick:w,children:[f,h]})})}),(0,Pt.jsx)(no,{}),(0,Pt.jsx)(rt,{children:(0,Pt.jsxs)(nt,{children:[(0,Pt.jsx)(st,{asChild:!0,children:(0,Pt.jsx)(Vt.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Pt.jsxs)(S,{variant:"ghost",size:"icon",className:"rounded-2xl relative transition-all duration-200",onClick:()=>C(!0),children:[(0,Pt.jsx)(Vt.motion.div,{animate:te>0?{rotate:[0,-10,10,-10,0]}:{},transition:{duration:.5,repeat:te>0?1/0:0,repeatDelay:3},children:(0,Pt.jsx)(Fa.Bell,{className:"h-5 w-5"})}),te>0&&(0,Pt.jsx)(Vt.motion.span,{className:"absolute -right-1 -top-1 flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-xs text-white",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:15},children:te})]})})}),(0,Pt.jsx)(Ye,{children:"Notifications"})]})}),(0,Pt.jsx)(Vt.motion.div,{whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:(0,Pt.jsxs)(be,{className:"h-9 w-9 border-2 border-primary transition-all duration-200 hover:shadow-md cursor-pointer",children:[(0,Pt.jsx)(We,{src:"/placeholder.svg?height=40&width=40",alt:"User"}),(0,Pt.jsx)(ve,{})]})})]})]})]}),(0,Pt.jsx)(so,{notifications:z,open:F,onClose:()=>C(!1),onNotificationRemove:ae,onRemoveAll:Z})]})}var vo=[{id:"copilot",name:"Peronal Copilot",description:"Your personal AI assistant for all tasks",icon:(0,Pt.jsx)(Fa.User,{className:"h-4 w-4"}),color:"bg-orange-600",accentColor:"text-orange-600"}];function yo({sidebarItems:e,children:t,title:a="Digital Colleagues",notifications:o=[],currentBusinessUnit:l=vo[0],onBusinessUnitChange:r,onSearch:s,businessUnits:i=vo,activeTab:d,onTabChange:m,showTabs:w=!1,onActionClick:f,actionIcon:h,actionText:R="Action",onNotificationRemove:M,onRemoveAll:T,logo:x="/headerlogo.png",appName:P="Nuvia",tagline:F="Collaboration Platform",sidebarInitiallyClosed:C=!1}){let[z,ee]=(0,it.useState)(!C),[te,ae]=(0,it.useState)(!1),[Z,q]=(0,it.useState)(l),re=de=>{q(de),r?.(de)};return(0,Pt.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-xl bg-background w-[]",children:[te&&(0,Pt.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>ae(!1)}),(0,Pt.jsx)("div",{className:"md:hidden",children:(0,Pt.jsx)(ia,{items:e,isOpen:te,isMobile:!0,onClose:()=>ae(!1),currentBusinessUnit:Z,onBusinessUnitChange:re,onSearch:s,logo:x,appName:P,tagline:F})}),(0,Pt.jsx)("div",{className:"hidden md:block",children:(0,Pt.jsx)(ia,{items:e,isOpen:z,isMobile:!1,currentBusinessUnit:Z,onBusinessUnitChange:re,onSearch:s,logo:x,appName:P,tagline:F})}),(0,Pt.jsxs)("div",{className:c("min-h-screen fixed w-full transition-all duration-300 ease-in-out",z?"md:pl-64":"md:pl-0"),children:[(0,Pt.jsx)(bo,{title:a,notifications:o,onToggleSidebar:()=>ee(!z),onToggleMobileMenu:()=>ae(!0),sidebarOpen:z,activeTab:d,onTabChange:m,showTabs:w,onActionClick:f,actionIcon:h,actionText:R,onNotificationRemove:M,onRemoveAll:T,logo:x,appName:P,tagline:F}),(0,Pt.jsx)("main",{className:"flex-1 p-0 flex flex-col h-[calc(100vh-4rem)] overflow-hidden",children:t})]})]})}function xo({sessions:e,currentSession:t,teams:a,onNewChat:o,onSessionSelect:l,onSessionEdit:r,onSessionDelete:s,className:i}){return(0,Pt.jsx)(rt,{children:(0,Pt.jsx)("div",{className:`space-y-4 h-full ${i||""}`,children:(0,Pt.jsxs)(he,{className:"shadow-sm h-full",children:[(0,Pt.jsx)("div",{className:"p-4 border-Pt",children:(0,Pt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Pt.jsxs)("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[(0,Pt.jsx)(Fa.Clock,{className:"h-4 w-4"}),"Recent Chats"]}),(0,Pt.jsxs)(S,{onClick:o,size:"sm",className:"gap-1 h-7 px-2 rounded-lg shadow-sm",children:[(0,Pt.jsx)(Fa.Plus,{className:"h-3 w-3"}),"New"]})]})}),(0,Pt.jsx)(xe,{className:"h-[600px]",children:(0,Pt.jsx)("div",{className:"p-2",children:e.length===0?(0,Pt.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No chat sessions yet"}):e.map(d=>(0,Pt.jsxs)(nt,{children:[(0,Pt.jsx)(st,{asChild:!0,children:(0,Pt.jsx)("div",{className:c("group relative p-3 rounded-xl cursor-pointer transition-all hover:bg-muted/50 mb-2",t?.id===d.id&&"bg-muted border"),onClick:()=>l(d),children:(0,Pt.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-start",children:[(0,Pt.jsxs)("div",{className:"min-w-0 overflow-hidden",children:[(0,Pt.jsx)("h4",{className:"font-medium text-sm truncate mb-1",children:d.title}),(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:d.lastMessage})]}),(0,Pt.jsxs)("div",{className:"flex items-start gap-1 pt-0.5",children:[r&&(0,Pt.jsx)(S,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded opacity-30 group-hover:opacity-100 transition-opacity",onClick:m=>{m.stopPropagation(),r(d.id)},children:(0,Pt.jsx)(Fa.Edit3,{className:"h-3 w-3"})}),s&&(0,Pt.jsx)(S,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded text-destructive hover:text-destructive opacity-30 group-hover:opacity-100 transition-opacity",onClick:m=>{m.stopPropagation(),s(d.id)},children:(0,Pt.jsx)(Fa.Trash2,{className:"h-3 w-3"})})]})]})})}),(0,Pt.jsx)(Ye,{side:"right",className:"max-w-xs",children:(0,Pt.jsxs)("div",{className:"space-y-1",children:[(0,Pt.jsx)("p",{className:"font-medium text-sm",children:d.title}),(0,Pt.jsx)("p",{className:"text-xs",children:d.lastMessage})]})})]},d.id))})})]})})})}var tt=V(require("motion/react-client"));function da({capabilities:e,isOpen:t,onToggle:a,onActionSelect:o,onContextChange:l,colorScheme:r=Xt,className:s}){let[i,d]=(0,it.useState)([]),[m,w]=(0,it.useState)([]),f=i[i.length-1],h=f?.children||e,R=(C,z)=>{switch(C.type){case"category":return r.categories[z%r.categories.length];case"list":return r.lists[z%r.lists.length];case"item":return r.items[z%r.items.length];default:return r.primary}},M=(0,it.useMemo)(()=>({path:i,selectedItems:m,filters:{}}),[i,m]);(0,it.useEffect)(()=>{l&&l(M)},[M,l]);let T=C=>{C.type==="category"||C.type==="list"?d([...i,C]):C.type==="item"&&w([...m,C])},x=()=>{d(i.slice(0,-1))},P=C=>{d(i.slice(0,C+1))},F=()=>f?.actions?f.actions:[];return t?(0,Pt.jsxs)("div",{className:c("w-full",s),children:[(0,Pt.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,Pt.jsxs)("div",{className:"flex items-center gap-2",children:[i.length>0&&(0,Pt.jsx)(Vt.motion.button,{whileHover:{scale:1.1,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.9,transition:{duration:.15,ease:[.4,0,.2,1]}},onClick:x,className:c("group p-1 h-6 w-6 rounded-md backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:shadow-sm"),children:(0,Pt.jsx)(Fa.ChevronLeft,{className:c("h-3 w-3 transition-transform duration-300 ease-in-out","group-hover:-translate-x-0.5")})}),(0,Pt.jsx)("h4",{className:"font-medium text-sm",children:f?.name||"Capabilities"})]}),(0,Pt.jsx)(Vt.motion.button,{whileHover:{scale:1.1,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.9,transition:{duration:.15,ease:[.4,0,.2,1]}},onClick:a,className:c("group p-1 h-6 w-6 rounded-md backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:shadow-sm"),children:(0,Pt.jsx)(Fa.X,{className:c("h-3 w-3 transition-transform duration-300 ease-in-out","group-hover:rotate-90")})})]}),i.length>0&&(0,Pt.jsxs)("div",{className:"flex items-center gap-1 mb-3 text-xs text-muted-foreground",children:[(0,Pt.jsx)(Vt.motion.button,{whileHover:{scale:1.05,transition:{duration:.3,ease:[.4,0,.2,1]}},onClick:()=>d([]),className:c("group relative transition-colors duration-300 ease-in-out hover:text-accent"),children:(0,Pt.jsxs)("span",{className:"relative",children:["Capabilities",(0,Pt.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]})}),i.map((C,z)=>(0,Pt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Pt.jsx)(Fa.ChevronRight,{className:"h-2 w-2"}),(0,Pt.jsx)(Vt.motion.button,{whileHover:{scale:1.05,transition:{duration:.3,ease:[.4,0,.2,1]}},onClick:()=>P(z),className:c("group relative transition-colors duration-300 ease-in-out hover:text-accent"),children:(0,Pt.jsxs)("span",{className:"relative",children:[C.name,(0,Pt.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]})})]},C.id))]}),(0,Pt.jsx)("div",{className:"max-h-40 overflow-y-auto",children:(0,Pt.jsx)(Vt.AnimatePresence,{mode:"wait",children:(0,Pt.jsx)(Vt.motion.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.2,ease:[.4,0,.2,1]},children:f?.type==="list"&&f.data?(0,Pt.jsx)(or,{data:f.data,onItemSelect:C=>w([...m,C]),colorScheme:r}):(0,Pt.jsx)(tr,{capabilities:h,onSelect:T,colorScheme:r})},f?.id||"root")})})]}):(0,Pt.jsxs)(S,{onClick:a,size:"sm",variant:"outline",className:"rounded-full",children:[(0,Pt.jsx)(Fa.Menu,{className:"h-4 w-4"}),(0,Pt.jsx)("span",{className:"ml-2",children:"Capabilities"})]})}function tr({capabilities:e,onSelect:t,colorScheme:a}){return(0,Pt.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((o,l)=>(0,Pt.jsx)(ar,{capability:o,onClick:()=>t(o),color:a.categories[l%a.categories.length]},o.id))})}function ar({capability:e,onClick:t,selected:a,color:o}){return(0,Pt.jsxs)(Vt.motion.button,{whileHover:{scale:1.02,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.95,transition:{duration:.15,ease:[.4,0,.2,1]}},className:c("group relative inline-flex items-center gap-2 px-3 py-2 rounded-lg border cursor-pointer","bg-background text-left text-sm font-medium backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:border-accent/50 hover:shadow-sm",a&&"border-primary bg-accent scale-105"),onClick:t,children:[(0,Pt.jsx)("div",{className:c("w-2 h-2 rounded-full flex-shrink-0 transition-transform duration-300 ease-in-out","group-hover:scale-125",o)}),(0,Pt.jsxs)("span",{className:"truncate relative",children:[e.name,(0,Pt.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]}),(e.children||e.data)&&(0,Pt.jsx)(Fa.ChevronRight,{className:c("h-3 w-3 text-muted-foreground flex-shrink-0","transition-transform duration-300 ease-in-out group-hover:translate-x-0.5")}),e.type==="list"&&e.data&&(0,Pt.jsx)(ge,{variant:"secondary",className:c("text-xs h-5 px-1.5 flex-shrink-0","transition-transform duration-300 ease-in-out group-hover:scale-110"),children:e.data.length})]})}function or({data:e,onItemSelect:t,colorScheme:a}){return(0,Pt.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((o,l)=>(0,Pt.jsxs)(Vt.motion.button,{whileHover:{scale:1.02,transition:{duration:.3,ease:[.4,0,.2,1]}},whileTap:{scale:.95,transition:{duration:.15,ease:[.4,0,.2,1]}},className:c("group relative inline-flex items-center gap-2 px-3 py-2 rounded-lg border cursor-pointer","bg-background text-left text-sm font-medium backdrop-blur-sm","transition-all duration-300 ease-in-out","hover:bg-accent/50 hover:border-accent/50 hover:shadow-sm"),onClick:()=>t(o),children:[(0,Pt.jsx)("div",{className:c("w-2 h-2 rounded-full flex-shrink-0 transition-transform duration-300 ease-in-out","group-hover:scale-125",a.items[l%a.items.length])}),(0,Pt.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Pt.jsxs)("span",{className:"truncate relative font-medium",children:[o.title,(0,Pt.jsx)("span",{className:"absolute -bottom-0.5 left-1/2 w-0 h-0.5 bg-accent transform -translate-x-1/2 transition-all duration-300 ease-in-out group-hover:w-full"})]}),o.subtitle&&(0,Pt.jsx)("div",{className:c("text-xs text-muted-foreground truncate","transition-colors duration-300 ease-in-out group-hover:text-accent/80"),children:o.subtitle})]}),o.value&&(0,Pt.jsx)(ge,{variant:"secondary",className:c("text-xs h-5 px-1.5 flex-shrink-0 ml-2","transition-transform duration-300 ease-in-out group-hover:scale-110"),children:o.value})]},o.id))})}var wo=V(require("react"));var ma=({isOpen:e=!0,authUrl:t,onClose:a,onSuccess:o,description:l="This endpoint requires authentication to sync functions."})=>{let[r,s]=(0,it.useState)(!1),[i,d]=(0,it.useState)(""),m=()=>{if(!t){d("No authentication URL provided");return}s(!0),d("");try{let f=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!f){d("Popup blocked. Please allow popups for this site and try again."),s(!1);return}let h=setInterval(()=>{try{f.closed&&(clearInterval(h),s(!1),o(),a())}catch{}},1e3);setTimeout(()=>{f.closed||(f.close(),clearInterval(h),s(!1),d("Authentication timed out. Please try again."))},6e5)}catch{d("Failed to open authentication window"),s(!1)}},w=async()=>{try{await navigator.clipboard.writeText(t),d("")}catch{d("Failed to copy URL to clipboard")}};return e?(0,Pt.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,Pt.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,Pt.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,Pt.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l}),i&&(0,Pt.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:i}),(0,Pt.jsxs)("div",{className:"flex gap-2",children:[(0,Pt.jsx)("button",{onClick:m,disabled:r||!t,className:`
9
10
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
10
11
  ${r||!t?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
11
- `,children:r?"Authenticating...":"Authenticate"}),(0,Ct.jsx)("button",{onClick:k,disabled:!t,className:`
12
+ `,children:r?"Authenticating...":"Authenticate"}),(0,Pt.jsx)("button",{onClick:w,disabled:!t,className:`
12
13
  px-4 py-2 text-white border-none rounded text-sm
13
14
  ${t?"bg-blue-600 hover:bg-blue-700 cursor-pointer":"bg-gray-400 cursor-not-allowed"}
14
- `,children:"Copy URL"}),(0,Ct.jsx)("button",{onClick:a,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var ca=({toolPart:e,index:t,addToolResult:a})=>{let[o,l]=mo.default.useState(!0),r=()=>{a(e.input?.toolCallId,e.input?.tool,"Authentication completed"),l(!1)};switch(e.state){case"input-available":return(0,Ct.jsxs)("div",{className:"mb-2",children:[(0,Ct.jsx)(la,{isOpen:o,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>l(!1),onSuccess:r,description:e.output?.reason||e.input?.reason}),!o&&(0,Ct.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Ct.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,Ct.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Ct.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,Ct.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var uo=require("marked"),go=$(require("react-markdown"));function Vi(e){return uo.marked.lexer(e).map(a=>a.raw)}var fo=(0,at.memo)(({content:e})=>(0,Ct.jsx)(go.default,{children:e}),(e,t)=>e.content===t.content);fo.displayName="MemoizedMarkdownBlock";var da=(0,at.memo)(({content:e,id:t})=>(0,at.useMemo)(()=>Vi(e),[e]).map((o,l)=>(0,Ct.jsx)(fo,{content:o},`${t}-block_${l}`)));da.displayName="PartText";var ua=$(require("react"));var ma=({isOpen:e=!0,reason:t,onClose:a,onApprove:o,onDeny:l,title:r="Approval Required"})=>{let[n,i]=(0,at.useState)(!1),p=()=>{i(!0),o(),a()},m=()=>{i(!0),l(),a()},k=()=>{i(!0),l(),a()};return e?(0,Ct.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,Ct.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:r}),(0,Ct.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:t}),(0,Ct.jsxs)("div",{className:"flex gap-2",children:[(0,Ct.jsx)("button",{onClick:p,disabled:n,className:`
15
+ `,children:"Copy URL"}),(0,Pt.jsx)("button",{onClick:a,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var ua=({toolPart:e,index:t,addToolResult:a})=>{let[o,l]=wo.default.useState(!0),r=()=>{a(e.input?.toolCallId,e.input?.tool,"Authentication completed"),l(!1)};switch(e.state){case"input-available":return(0,Pt.jsxs)("div",{className:"mb-2",children:[(0,Pt.jsx)(ma,{isOpen:o,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>l(!1),onSuccess:r,description:e.output?.reason||e.input?.reason}),!o&&(0,Pt.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Pt.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,Pt.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Pt.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,Pt.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var Co=require("marked"),No=V(require("react-markdown"));function ir(e){return Co.marked.lexer(e).map(a=>a.raw)}var ko=(0,it.memo)(({content:e})=>(0,Pt.jsx)(No.default,{children:e}),(e,t)=>e.content===t.content);ko.displayName="MemoizedMarkdownBlock";var ga=(0,it.memo)(({content:e,id:t})=>(0,it.useMemo)(()=>ir(e),[e]).map((o,l)=>(0,Pt.jsx)(ko,{content:o},`${t}-block_${l}`)));ga.displayName="PartText";var va=V(require("react"));var ba=({isOpen:e=!0,reason:t,onClose:a,onApprove:o,onDeny:l,title:r="Approval Required"})=>{let[s,i]=(0,it.useState)(!1),d=()=>{i(!0),o(),a()},m=()=>{i(!0),l(),a()},w=()=>{i(!0),l(),a()};return e?(0,Pt.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,Pt.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:r}),(0,Pt.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:t}),(0,Pt.jsxs)("div",{className:"flex gap-2",children:[(0,Pt.jsx)("button",{onClick:d,disabled:s,className:`
15
16
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
16
- ${n?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
17
- `,children:n?"Processing...":"Approve"}),(0,Ct.jsx)("button",{onClick:m,disabled:n,className:`
17
+ ${s?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
18
+ `,children:s?"Processing...":"Approve"}),(0,Pt.jsx)("button",{onClick:m,disabled:s,className:`
18
19
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
19
- ${n?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700 cursor-pointer"}
20
- `,children:n?"Processing...":"Deny"}),(0,Ct.jsx)("button",{onClick:k,disabled:n,className:`
20
+ ${s?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700 cursor-pointer"}
21
+ `,children:s?"Processing...":"Deny"}),(0,Pt.jsx)("button",{onClick:w,disabled:s,className:`
21
22
  px-4 py-2 text-white border-none rounded text-sm
22
- ${n?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
23
- `,children:"Cancel"})]})]}):null};var vo=({toolPart:e,index:t,addToolResult:a})=>{let[o,l]=ua.default.useState(!0),[r,n]=ua.default.useState(null),i=()=>{a(e.input?.toolCallId,e.input?.tool,"Approved"),l(!1),n("approve")},p=()=>{a(e.input?.toolCallId,e.input?.tool,"Denied"),l(!1),n("deny")};switch(e.state){case"input-available":return(0,Ct.jsxs)("div",{className:"mb-2",children:[(0,Ct.jsx)(ma,{isOpen:o,onApprove:i,onDeny:p,onClose:()=>l(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!o&&(0,Ct.jsxs)(Ct.Fragment,{children:[r==="approve"&&(0,Ct.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Ct.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,Ct.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Ct.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),r==="deny"&&(0,Ct.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Ct.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,Ct.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Ct.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Ct.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};function zt({messages:e,input:t,isTyping:a=!1,currentSessionTitle:o,capabilities:l,fileUploads:r,isDragOver:n,enableFileUpload:i,onInputChange:p,addToolResult:m,onSendMessage:k,onKeyPress:f,onFileUpload:y,onRemoveFile:T,onDragOver:z,className:R}){let x=(0,at.useRef)(null),A=(0,at.useRef)(null),F=(0,at.useRef)(null),[w,E]=(0,at.useState)(!1),[ee,te]=(0,at.useState)({path:[],selectedItems:[],filters:{}});(0,at.useEffect)(()=>{x.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,at.useEffect)(()=>{w&&setTimeout(()=>{x.current?.scrollIntoView({behavior:"smooth"})},100)},[w]);let ae=()=>Pt(ee),Z=()=>{let u=[];return l.forEach(j=>{j.actions&&j.actions.forEach(_=>{u.push({label:_.label,action:()=>q(_.id,{path:[j],selectedItems:[],filters:{}})})}),j.children&&j.children.forEach(_=>{_.type==="list"&&_.data&&u.push({label:`View ${_.name}`,action:()=>E(!0)})})}),u.slice(0,5)},q=(u,j)=>{console.log("Capability action:",u,j);let _=`Executing ${u} with context: ${JSON.stringify(j.path.map(S=>S.name))}`;E(!1)},re=Pt({path:[],selectedItems:[],filters:{}}),ce=u=>{y(u.target.files),u.target.files&&(u.target.value="")},M=u=>{u.preventDefault(),z(!0)},Se=u=>{u.preventDefault(),z(!1)},d=u=>{u.preventDefault(),z(!1),y(u.dataTransfer.files)},B=u=>{if(u===0)return"0 Bytes";let j=1024,_=["Bytes","KB","MB","GB"],S=Math.floor(Math.log(u)/Math.log(j));return parseFloat((u/Math.pow(j,S)).toFixed(2))+" "+_[S]},I=u=>u.startsWith("image/")?(0,Ct.jsx)(Aa.Image,{className:"h-4 w-4"}):u.startsWith("text/")?(0,Ct.jsx)(Aa.FileText,{className:"h-4 w-4"}):(0,Ct.jsx)(Aa.File,{className:"h-4 w-4"}),K=u=>{let j=u.role==="assistant",_=u.role==="user";return(0,Ct.jsxs)("div",{className:c("flex my-2 items-start gap-3",_?"flex-row-reverse":""),children:[(0,Ct.jsx)(ge,{className:"h-8 w-8 shrink-0",children:(0,Ct.jsx)(fe,{className:c(_?"bg-primary text-primary-foreground":"bg-gradient-to-br from-purple-600 to-blue-600 text-white"),children:_?(0,Ct.jsx)(Aa.User,{className:"h-4 w-4"}):(0,Ct.jsx)(Aa.Bot,{className:"h-4 w-4"})})}),(0,Ct.jsx)("div",{className:c("max-w-[80%] rounded-2xl px-4 py-3 shadow-sm",_?"bg-primary text-primary-foreground":"bg-muted"),children:u.parts.map((S,J)=>{if(S.type==="text")return(0,Ct.jsx)(da,{id:u.id,content:S.text},`${u.id}-text`);if(S.type==="file"){let N=S;return(0,Ct.jsx)("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:(0,Ct.jsxs)("div",{className:"flex items-center gap-2",children:[I(N.mediaType||"application/octet-stream"),(0,Ct.jsx)("div",{className:"flex-1 min-w-0",children:(0,Ct.jsx)("p",{className:"text-sm font-medium truncate",children:N.filename||N.url?.split("/").pop()||"File"})}),N.url&&(0,Ct.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(N.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Ct.jsx)(Aa.Download,{className:"h-4 w-4"})})]})},J)}if(S.type.startsWith("tool-")){let N=S,ke=S.type.replace("tool-","");if(ke==="task")switch(N.state){case"input-available":return(0,Ct.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},J);case"output-available":return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(mt,{data:{id:N.output?.id||N.input?.id,fetchLatest:!1,taskData:N.output||N.input}})},J);case"output-error":return(0,Ct.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",N.errorText]},J);default:return null}if(S.type==="tool-requestEndpointLogin")return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(ca,{toolPart:N,index:J,addToolResult:m??(()=>{})})},J);if(S.type==="tool-authenticate")return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(ca,{toolPart:N,index:J,addToolResult:m??(()=>{})})},J);if(S.type==="tool-requestApproval")return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(vo,{toolPart:N,index:J,addToolResult:m??(()=>{})})},J);if(ke==="artefact")switch(N.state){case"input-available":return(0,Ct.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},J);case"output-available":return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(Kt,{artefact:N.output?.description||"",taskId:N.output?.id||N.input?.id,taskData:N.output||N.input})},J);case"output-error":return(0,Ct.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",N.errorText]},J);default:return null}return(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsxs)(be,{className:"w-full max-w-md",children:[(0,Ct.jsx)(Be,{children:(0,Ct.jsx)(Ee,{className:"text-lg",children:ke})}),(0,Ct.jsxs)(Pe,{children:[N.state==="input-available"&&(0,Ct.jsxs)("p",{className:"text-sm",children:["Processing ",ke,"..."]}),N.state==="output-available"&&(0,Ct.jsx)("pre",{className:"text-sm",children:JSON.stringify(N.output,null,2)}),N.state==="output-error"&&(0,Ct.jsxs)("p",{className:"text-sm text-red-500",children:["Error: ",N.errorText]})]})]})},J)}if(S.type.startsWith("data-")){let N=S,ke=S.type.replace("data-","");return ke==="reference"?(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsx)(be,{className:"w-full",children:(0,Ct.jsx)(Pe,{className:"p-4",children:(0,Ct.jsx)("div",{className:"space-y-2",children:N.data?.references?.map((de,Me)=>(0,Ct.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted/50",children:[(0,Ct.jsx)(me,{variant:"outline",children:de.type||"link"}),(0,Ct.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Ct.jsx)("p",{className:"text-sm font-medium truncate",children:de.title}),de.description&&(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:de.description})]}),de.url&&(0,Ct.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(de.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Ct.jsx)(Aa.ExternalLink,{className:"h-4 w-4"})})]},Me))})})})},J):ke==="menu"?(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsxs)(be,{className:"w-full",children:[(0,Ct.jsx)(Be,{children:(0,Ct.jsx)(Ee,{className:"text-lg",children:N.data?.title})}),(0,Ct.jsx)(Pe,{children:(0,Ct.jsx)("div",{className:"space-y-2",children:N.data?.items?.map((de,Me)=>(0,Ct.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:de.action,children:(0,Ct.jsxs)("div",{className:"text-left",children:[(0,Ct.jsx)("p",{className:"font-medium",children:de.label}),de.description&&(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground",children:de.description})]})},Me))})})]})},J):(0,Ct.jsx)("div",{className:"mb-2",children:(0,Ct.jsxs)(be,{className:"w-full max-w-md",children:[(0,Ct.jsx)(Be,{children:(0,Ct.jsx)(Ee,{className:"text-lg",children:ke})}),(0,Ct.jsx)(Pe,{children:(0,Ct.jsx)("pre",{className:"text-sm",children:JSON.stringify(N.data,null,2)})})]})},J)}return null})})]})};return(0,Ct.jsxs)("div",{className:`h-full flex flex-col shadow-sm max-w-4xl mx-auto ${R||""}`,children:[(0,Ct.jsxs)(he,{ref:A,className:"flex-1 p-4 bg-background border-0",onDragOver:M,onDragLeave:Se,onDrop:d,children:[(0,Ct.jsxs)("div",{className:c("space-y-4",n&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Ct.jsx)(Ze.animate,{children:e.map(u=>(0,Ct.jsx)(Ze.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:c("flex gap-3",u.role==="user"?"flex-row-reverse":"flex-row"),children:K(u)},u.id))}),w&&(0,Ct.jsxs)(Ze.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Ct.jsx)(ge,{className:"h-8 w-8",children:(0,Ct.jsx)(fe,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Ct.jsx)(Aa.Bot,{className:"h-4 w-4"})})}),(0,Ct.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Ct.jsx)(na,{capabilities:l,isOpen:w,onToggle:()=>E(!w),onActionSelect:q,className:"w-full"})})]}),a&&(0,Ct.jsxs)(Ze.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Ct.jsx)(ge,{className:"h-8 w-8",children:(0,Ct.jsx)(fe,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Ct.jsx)(Aa.Bot,{className:"h-4 w-4"})})}),(0,Ct.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Ct.jsxs)("div",{className:"flex space-x-1",children:[(0,Ct.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Ct.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Ct.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Ct.jsx)("div",{ref:x})]}),r.length>0&&(0,Ct.jsx)("div",{className:"p-4 border-t bg-muted/10",children:(0,Ct.jsx)("div",{className:"flex flex-wrap gap-2",children:r.map(u=>(0,Ct.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg p-2 border",children:[I(u.file.type),(0,Ct.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Ct.jsx)("span",{className:"text-xs text-muted-foreground",children:B(u.file.size)}),(0,Ct.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>T(u.id),className:"h-6 w-6 p-0",children:(0,Ct.jsx)(Aa.X,{className:"h-4 w-4"})})]},u.id))})}),(0,Ct.jsxs)("div",{className:"border rounded-2xl p-4 bg-muted/20",children:[(0,Ct.jsxs)("div",{className:"flex gap-3",children:[(0,Ct.jsx)(ut,{value:t,onChange:u=>p(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:a}),i&&(0,Ct.jsx)(D,{variant:"outline",size:"icon",onClick:()=>F.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Ct.jsx)(Aa.Paperclip,{className:"h-4 w-4"})}),(0,Ct.jsx)(D,{onClick:k,disabled:!t.trim()&&r.length===0||a,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Ct.jsx)(Aa.Send,{className:"h-4 w-4"})})]}),(0,Ct.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Ct.jsxs)(D,{onClick:()=>E(!w),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Ct.jsx)(Aa.Menu,{className:"h-3 w-3 mr-1"}),w?"Hide":"Show"," Capabilities"]}),(0,Ct.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[ae().map((u,j)=>(0,Ct.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>q(u.id,ee),children:u.label},`context-${u.id}`)),ae().length===0&&Z().map((u,j)=>(0,Ct.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${j}`))]})]}),i&&(0,Ct.jsx)("input",{ref:F,type:"file",multiple:!0,onChange:ce,className:"hidden"})]})]})}function $i({aiConfig:e,useCustomChat:t,enableAI:a=!0,messages:o=[],businessUnits:l=[],capabilities:r=[],sidebarItems:n=[],notifications:i=[],sessions:p=[],onNewChat:m,onSessionSelect:k,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:T=()=>{},onNotificationRemove:z=()=>{},onRemoveAll:R=()=>{},onActionClick:x=()=>{},onSearch:A=B=>console.log("Search query:",B),initialTeam:F="design",currentSession:w=null,showCapabilities:E=!0,title:ee="Digital Colleagues",enableFileUpload:te=!0,maxFileSize:ae=10,allowedFileTypes:Z=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:q="/headerlogo.png",appName:re="Nuvia",tagline:ce="AI-Powered Workspace",actionIcon:M=(0,Ct.jsx)(Aa.Users,{className:"mr-2 h-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let B={...e,onError:H=>{K?.setMessages(pe=>[...pe,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:H.message}]}]),console.error("Error in CopilotInterface:",H)}},I=(0,ho.useChat)(B||{}),K=a?t||I:null,[u,j]=(0,at.useState)(""),[_,S]=(0,at.useState)(!1),J=K?.messages||o,N=u,ke=K?.status==="submitted"||_,de=K?.addToolResult?(H,pe,ne)=>{K.addToolResult({tool:pe,toolCallId:H,output:ne}),K.sendMessage()}:()=>{},Me=l||[],xo={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[wo,Co]=(0,at.useState)(()=>Me.length===0?xo:Me.find(H=>H.id===F)||Me[0]),[lt,ht]=(0,at.useState)([]),[No,ko]=(0,at.useState)(!1),Po=H=>{if(!H||!te)return;let pe=[];Array.from(H).forEach(ne=>{if(ne.size>ae*1024*1024){alert(`File ${ne.name} is too large. Maximum size is ${ae}MB.`);return}if(Z.length>0&&!Z.some(yt=>ne.type.match(yt))){alert(`File type ${ne.type} is not allowed.`);return}let fa={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ne,status:"pending",progress:0};if(ne.type.startsWith("image/")){let yt=new FileReader;yt.onload=So=>{ht(Mo=>Mo.map(jt=>jt.id===fa.id?{...jt,preview:So.target?.result}:jt))},yt.readAsDataURL(ne)}pe.push(fa)}),ht(ne=>[...ne,...pe])},Do=H=>{ht(pe=>pe.filter(ne=>ne.id!==H))},ga=()=>{if(!(!N.trim()&&lt.length===0)){if(K){let H=lt.length>0?To(lt.map(pe=>pe.file)):void 0;K.sendMessage({text:N,files:H},{body:{timestamp:Date.now()}}),j("")}else console.log("Message to send:",N),console.log("Files to upload:",lt),j(""),S(!0),setTimeout(()=>{S(!1)},1500);ht([])}},To=H=>{let pe=new DataTransfer;return H.forEach(ne=>pe.items.add(ne)),pe.files},Ro=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),ga())},Ao=H=>{j(H)};return(0,Ct.jsx)(co,{sidebarItems:n||[],title:ee,notifications:i||[],businessUnits:Me,currentBusinessUnit:wo,onBusinessUnitChange:H=>{H&&(Co(H),T?.(H))},onSearch:A,showTabs:!1,onActionClick:x,actionIcon:M,actionText:Se,onNotificationRemove:z,onRemoveAll:R,logo:q,appName:re,tagline:ce,sidebarInitiallyClosed:d,children:(0,Ct.jsx)(Ft.AnimatePresence,{mode:"wait",children:(0,Ct.jsx)(Ft.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,Ct.jsxs)("div",{className:"h-full flex",children:[(0,Ct.jsx)("div",{className:"w-80 flex-shrink-0 h-full p-2",children:(0,Ct.jsx)(po,{sessions:p||[],currentSession:w,teams:Me,onNewChat:m,onSessionSelect:k,onSessionEdit:y,onSessionDelete:f})}),(0,Ct.jsx)("div",{className:"flex-1 h-full p-2",children:(0,Ct.jsx)(zt,{messages:J||[],input:N,isTyping:ke,currentSessionTitle:w?.title,capabilities:r||[],onInputChange:Ao,addToolResult:de,onSendMessage:ga,onKeyPress:Ro,fileUploads:lt,isDragOver:No,enableFileUpload:te,onFileUpload:Po,onRemoveFile:Do,onDragOver:ko})})]})},"chat-interface")})})}function Wi(e){return e.parts.filter(t=>t.type==="text").map(t=>t.text).join("")}function Gi(e,t){return e.parts.some(a=>a.type===`tool-${t}`)}function qi(e,t){return e.parts.find(a=>a.type===`tool-${t}`)}function Ki(e){return e.parts.some(t=>t.type==="file")}function _i(e){return e.parts.filter(t=>t.type==="file")}function Ji(e,t){return e.parts.some(a=>a.type===`data-${t}`)}function Xi(e,t){return e.parts.find(a=>a.type===`data-${t}`)}0&&(module.exports={ApprovalRequestModal,CapabilityMenu,ChatCardArtefact,ChatCardTask,ChatInterface,ChatInterfaceMessages,ChatMessage,CopilotInterface,OAuthModal,defaultColorScheme,findCapabilityByPath,getAllCapabilities,getCapabilityByTeam,getContextualActions,getDataPart,getFileParts,getTextContent,getToolPart,hasDataPart,hasFilePart,hasToolPart,testCapabilities});
23
+ ${s?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
24
+ `,children:"Cancel"})]})]}):null};var Do=({toolPart:e,index:t,addToolResult:a})=>{let[o,l]=va.default.useState(!0),[r,s]=va.default.useState(null),i=()=>{a(e.input?.toolCallId,e.input?.tool,"Approved"),l(!1),s("approve")},d=()=>{a(e.input?.toolCallId,e.input?.tool,"Denied"),l(!1),s("deny")};switch(e.state){case"input-available":return(0,Pt.jsxs)("div",{className:"mb-2",children:[(0,Pt.jsx)(ba,{isOpen:o,onApprove:i,onDeny:d,onClose:()=>l(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!o&&(0,Pt.jsxs)(Pt.Fragment,{children:[r==="approve"&&(0,Pt.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Pt.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,Pt.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Pt.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),r==="deny"&&(0,Pt.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Pt.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,Pt.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Pt.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Pt.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var ya=require("@radix-ui/react-use-controllable-state");var ct=V(require("@radix-ui/react-collapsible")),To=ct.Root,Ro=ct.CollapsibleTrigger,Ao=ct.CollapsibleContent;var Mo=require("streamdown"),ha=(0,it.memo)(({className:e,...t})=>(0,Pt.jsx)(Mo.Streamdown,{className:c("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);ha.displayName="Response";var Lo=(0,it.createContext)(null),rr=()=>{let e=(0,it.useContext)(Lo);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},nr=1e3,sr=1e3,xa=(0,it.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:o=!0,onOpenChange:l,duration:r,children:s,...i})=>{let[d,m]=(0,ya.useControllableState)({prop:a,defaultProp:o,onChange:l}),[w,f]=(0,ya.useControllableState)({prop:r,defaultProp:0}),[h,R]=(0,it.useState)(!1),[M,T]=(0,it.useState)(null);(0,it.useEffect)(()=>{t?M===null&&T(Date.now()):M!==null&&(f(Math.ceil((Date.now()-M)/sr)),T(null))},[t,M,f]),(0,it.useEffect)(()=>{if(o&&!t&&d&&!h){let P=setTimeout(()=>{m(!1),R(!0)},nr);return()=>clearTimeout(P)}},[t,d,o,m,h]);let x=P=>{m(P)};return(0,Pt.jsx)(Lo.Provider,{value:{isStreaming:t,isOpen:d,setIsOpen:m,duration:w},children:(0,Pt.jsx)(To,{className:c("not-prose mb-4",e),onOpenChange:x,open:d,...i,children:s})})}),lr=(e,t)=>e||t===0?(0,Pt.jsx)("p",{children:"Thinking..."}):t===void 0?(0,Pt.jsx)("p",{children:"Thought for a few seconds"}):(0,Pt.jsxs)("p",{children:["Thought for ",t," seconds"]}),wa=(0,it.memo)(({className:e,children:t,...a})=>{let{isStreaming:o,isOpen:l,duration:r}=rr();return(0,Pt.jsx)(Ro,{className:c("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...a,children:t??(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsx)(Fa.BrainIcon,{className:"size-4"}),lr(o,r),(0,Pt.jsx)(Fa.ChevronDownIcon,{className:c("size-4 transition-transform",l?"rotate-180":"rotate-0")})]})})}),Ca=(0,it.memo)(({className:e,children:t,...a})=>(0,Pt.jsx)(Ao,{className:c("mt-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,Pt.jsx)(ha,{className:"grid gap-2",children:t})}));xa.displayName="Reasoning";wa.displayName="ReasoningTrigger";Ca.displayName="ReasoningContent";function Ht({messages:e,input:t,isTyping:a=!1,currentSessionTitle:o,capabilities:l,fileUploads:r,isDragOver:s,enableFileUpload:i,onInputChange:d,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:h,onRemoveFile:R,onDragOver:M,className:T}){let x=(0,it.useRef)(null),P=(0,it.useRef)(null),F=(0,it.useRef)(null),[C,z]=(0,it.useState)(!1),[ee,te]=(0,it.useState)({path:[],selectedItems:[],filters:{}});(0,it.useEffect)(()=>{x.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,it.useEffect)(()=>{C&&setTimeout(()=>{x.current?.scrollIntoView({behavior:"smooth"})},100)},[C]);let ae=()=>Rt(ee),Z=()=>{let u=[];return l.forEach(j=>{j.actions&&j.actions.forEach(J=>{u.push({label:J.label,action:()=>q(J.id,{path:[j],selectedItems:[],filters:{}})})}),j.children&&j.children.forEach(J=>{J.type==="list"&&J.data&&u.push({label:`View ${J.name}`,action:()=>z(!0)})})}),u.slice(0,5)},q=(u,j)=>{console.log("Capability action:",u,j);let J=`Executing ${u} with context: ${JSON.stringify(j.path.map(A=>A.name))}`;z(!1)},re=Rt({path:[],selectedItems:[],filters:{}}),de=u=>{h(u.target.files),u.target.files&&(u.target.value="")},I=u=>{u.preventDefault(),M(!0)},Ie=u=>{u.preventDefault(),M(!1)},p=u=>{u.preventDefault(),M(!1),h(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let j=1024,J=["Bytes","KB","MB","GB"],A=Math.floor(Math.log(u)/Math.log(j));return parseFloat((u/Math.pow(j,A)).toFixed(2))+" "+J[A]},L=u=>u.startsWith("image/")?(0,Pt.jsx)($.Image,{className:"h-4 w-4"}):u.startsWith("text/")?(0,Pt.jsx)($.FileText,{className:"h-4 w-4"}):(0,Pt.jsx)($.File,{className:"h-4 w-4"}),_=u=>{let j=u.role==="assistant",J=u.role==="user";return(0,Pt.jsxs)("div",{className:c("flex my-2 items-start gap-3",J?"flex-row-reverse":""),children:[(0,Pt.jsx)(be,{className:"h-8 w-8 shrink-0",children:(0,Pt.jsx)(ve,{className:c(J?"bg-primary text-primary-foreground":"bg-gradient-to-br from-purple-600 to-blue-600 text-white"),children:J?(0,Pt.jsx)($.User,{className:"h-4 w-4"}):(0,Pt.jsx)($.Bot,{className:"h-4 w-4"})})}),(0,Pt.jsx)("div",{className:c("max-w-[80%] rounded-2xl px-4 py-3 shadow-sm",J?"bg-primary text-primary-foreground":"bg-muted"),children:u.parts.map((A,K)=>{if(A.type==="text")return(0,Pt.jsx)(ga,{id:u.id,content:A.text},`${u.id}-text`);if(A.type==="file"){let k=A;return(0,Pt.jsx)("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:(0,Pt.jsxs)("div",{className:"flex items-center gap-2",children:[L(k.mediaType||"application/octet-stream"),(0,Pt.jsx)("div",{className:"flex-1 min-w-0",children:(0,Pt.jsx)("p",{className:"text-sm font-medium truncate",children:k.filename||k.url?.split("/").pop()||"File"})}),k.url&&(0,Pt.jsx)(S,{variant:"ghost",size:"sm",onClick:()=>window.open(k.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Pt.jsx)($.Download,{className:"h-4 w-4"})})]})},K)}if(A.type.startsWith("tool-")){let k=A,De=A.type.replace("tool-","");if(De==="task")switch(k.state){case"input-available":return(0,Pt.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},K);case"output-available":return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(ft,{data:{id:k.output?.id||k.input?.id,fetchLatest:!1,taskData:k.output||k.input}})},K);case"output-error":return(0,Pt.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",k.errorText]},K);default:return null}if(A.type==="tool-requestEndpointLogin")return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(ua,{toolPart:k,index:K,addToolResult:m??(()=>{})})},K);if(A.type==="tool-authenticate")return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(ua,{toolPart:k,index:K,addToolResult:m??(()=>{})})},K);if(A.type==="tool-requestApproval")return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(Do,{toolPart:k,index:K,addToolResult:m??(()=>{})})},K);if(De==="artefact")switch(k.state){case"input-available":return(0,Pt.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},K);case"output-available":return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(Qt,{artefact:k.output?.description||"",taskId:k.output?.id||k.input?.id,taskData:k.output||k.input})},K);case"output-error":return(0,Pt.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",k.errorText]},K);default:return null}return(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsxs)(he,{className:"w-full max-w-md",children:[(0,Pt.jsx)(ze,{children:(0,Pt.jsx)(Ue,{className:"text-lg",children:De})}),(0,Pt.jsxs)(Te,{children:[k.state==="input-available"&&(0,Pt.jsxs)("p",{className:"text-sm",children:["Processing ",De,"..."]}),k.state==="output-available"&&(0,Pt.jsx)("pre",{className:"text-sm",children:JSON.stringify(k.output,null,2)}),k.state==="output-error"&&(0,Pt.jsxs)("p",{className:"text-sm text-red-500",children:["Error: ",k.errorText]})]})]})},K)}if(A.type.startsWith("data-")){let k=A,De=A.type.replace("data-","");return De==="reference"?(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsx)(he,{className:"w-full",children:(0,Pt.jsx)(Te,{className:"p-4",children:(0,Pt.jsx)("div",{className:"space-y-2",children:k.data?.references?.map((me,Le)=>(0,Pt.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted/50",children:[(0,Pt.jsx)(ge,{variant:"outline",children:me.type||"link"}),(0,Pt.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Pt.jsx)("p",{className:"text-sm font-medium truncate",children:me.title}),me.description&&(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:me.description})]}),me.url&&(0,Pt.jsx)(S,{variant:"ghost",size:"sm",onClick:()=>window.open(me.url,"_blank"),className:"h-8 w-8 p-0",children:(0,Pt.jsx)($.ExternalLink,{className:"h-4 w-4"})})]},Le))})})})},K):De==="menu"?(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsxs)(he,{className:"w-full",children:[(0,Pt.jsx)(ze,{children:(0,Pt.jsx)(Ue,{className:"text-lg",children:k.data?.title})}),(0,Pt.jsx)(Te,{children:(0,Pt.jsx)("div",{className:"space-y-2",children:k.data?.items?.map((me,Le)=>(0,Pt.jsx)(S,{variant:"outline",className:"w-full justify-start",onClick:me.action,children:(0,Pt.jsxs)("div",{className:"text-left",children:[(0,Pt.jsx)("p",{className:"font-medium",children:me.label}),me.description&&(0,Pt.jsx)("p",{className:"text-xs text-muted-foreground",children:me.description})]})},Le))})})]})},K):(0,Pt.jsx)("div",{className:"mb-2",children:(0,Pt.jsxs)(he,{className:"w-full max-w-md",children:[(0,Pt.jsx)(ze,{children:(0,Pt.jsx)(Ue,{className:"text-lg",children:De})}),(0,Pt.jsx)(Te,{children:(0,Pt.jsx)("pre",{className:"text-sm",children:JSON.stringify(k.data,null,2)})})]})},K)}if(A.type==="reasoning")return(0,Pt.jsxs)(xa,{className:"w-full",isStreaming:status==="streaming"&&K===u.parts.length-1&&u.id===e.at(-1)?.id,children:[(0,Pt.jsx)(wa,{}),(0,Pt.jsx)(Ca,{children:A.text})]},`${u.id}-${K}`)})})]})};return(0,Pt.jsxs)("div",{className:`h-full flex flex-col shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Pt.jsxs)(xe,{ref:P,className:"flex-1 p-4 bg-background border-0",onDragOver:I,onDragLeave:Ie,onDrop:p,children:[(0,Pt.jsxs)("div",{className:c("space-y-4",s&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Pt.jsx)(tt.animate,{children:e.map(u=>(0,Pt.jsx)(tt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:c("flex gap-3",u.role==="user"?"flex-row-reverse":"flex-row"),children:_(u)},u.id))}),C&&(0,Pt.jsxs)(tt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Pt.jsx)(be,{className:"h-8 w-8",children:(0,Pt.jsx)(ve,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Pt.jsx)($.Bot,{className:"h-4 w-4"})})}),(0,Pt.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Pt.jsx)(da,{capabilities:l,isOpen:C,onToggle:()=>z(!C),onActionSelect:q,className:"w-full"})})]}),a&&(0,Pt.jsxs)(tt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Pt.jsx)(be,{className:"h-8 w-8",children:(0,Pt.jsx)(ve,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Pt.jsx)($.Bot,{className:"h-4 w-4"})})}),(0,Pt.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Pt.jsxs)("div",{className:"flex space-x-1",children:[(0,Pt.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Pt.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Pt.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Pt.jsx)("div",{ref:x})]}),r.length>0&&(0,Pt.jsx)("div",{className:"p-4 border-t bg-muted/10",children:(0,Pt.jsx)("div",{className:"flex flex-wrap gap-2",children:r.map(u=>(0,Pt.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg p-2 border",children:[L(u.file.type),(0,Pt.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Pt.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Pt.jsx)(S,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"h-6 w-6 p-0",children:(0,Pt.jsx)($.X,{className:"h-4 w-4"})})]},u.id))})}),(0,Pt.jsxs)("div",{className:"border rounded-2xl p-4 bg-muted/20",children:[(0,Pt.jsxs)("div",{className:"flex gap-3",children:[(0,Pt.jsx)(bt,{value:t,onChange:u=>d(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:a}),i&&(0,Pt.jsx)(S,{variant:"outline",size:"icon",onClick:()=>F.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Pt.jsx)($.Paperclip,{className:"h-4 w-4"})}),(0,Pt.jsx)(S,{onClick:w,disabled:!t.trim()&&r.length===0||a,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Pt.jsx)($.Send,{className:"h-4 w-4"})})]}),(0,Pt.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Pt.jsxs)(S,{onClick:()=>z(!C),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Pt.jsx)($.Menu,{className:"h-3 w-3 mr-1"}),C?"Hide":"Show"," Capabilities"]}),(0,Pt.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[ae().map((u,j)=>(0,Pt.jsx)(S,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>q(u.id,ee),children:u.label},`context-${u.id}`)),ae().length===0&&Z().map((u,j)=>(0,Pt.jsx)(S,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${j}`))]})]}),i&&(0,Pt.jsx)("input",{ref:F,type:"file",multiple:!0,onChange:de,className:"hidden"})]})]})}function cr({aiConfig:e,useCustomChat:t,enableAI:a=!0,messages:o=[],businessUnits:l=[],capabilities:r=[],sidebarItems:s=[],notifications:i=[],sessions:d=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:h=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:M=()=>{},onRemoveAll:T=()=>{},onActionClick:x=()=>{},onSearch:P=E=>console.log("Search query:",E),initialTeam:F="design",currentSession:C=null,showCapabilities:z=!0,title:ee="Digital Colleagues",enableFileUpload:te=!0,maxFileSize:ae=10,allowedFileTypes:Z=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:q="/headerlogo.png",appName:re="Nuvia",tagline:de="AI-Powered Workspace",actionIcon:I=(0,Pt.jsx)(Fa.Users,{className:"mr-2 h-4 w-4"}),actionText:Ie="Collaborate",sidebarInitiallyClosed:p=!1}){let E={...e,onError:O=>{_?.setMessages(ue=>[...ue,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:O.message}]}]),console.error("Error in CopilotInterface:",O)}},L=(0,Bo.useChat)(E||{}),_=a?t||L:null,[u,j]=(0,it.useState)(""),[J,A]=(0,it.useState)(!1),K=_?.messages||o,k=u,De=_?.status==="submitted"||J,me=_?.addToolResult?(O,ue,ne)=>{_.addToolResult({tool:ue,toolCallId:O,output:ne}),_.sendMessage()}:()=>{},Le=l||[],zo={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[Uo,Fo]=(0,it.useState)(()=>Le.length===0?zo:Le.find(O=>O.id===F)||Le[0]),[pt,wt]=(0,it.useState)([]),[jo,Oo]=(0,it.useState)(!1),Ho=O=>{if(!O||!te)return;let ue=[];Array.from(O).forEach(ne=>{if(ne.size>ae*1024*1024){alert(`File ${ne.name} is too large. Maximum size is ${ae}MB.`);return}if(Z.length>0&&!Z.some(Ct=>ne.type.match(Ct))){alert(`File type ${ne.type} is not allowed.`);return}let ka={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ne,status:"pending",progress:0};if(ne.type.startsWith("image/")){let Ct=new FileReader;Ct.onload=qo=>{wt(Ko=>Ko.map($t=>$t.id===ka.id?{...$t,preview:qo.target?.result}:$t))},Ct.readAsDataURL(ne)}ue.push(ka)}),wt(ne=>[...ne,...ue])},Vo=O=>{wt(ue=>ue.filter(ne=>ne.id!==O))},Na=()=>{if(!(!k.trim()&&pt.length===0)){if(_){let O=pt.length>0?$o(pt.map(ue=>ue.file)):void 0;_.sendMessage({text:k,files:O},{body:{timestamp:Date.now()}}),j("")}else console.log("Message to send:",k),console.log("Files to upload:",pt),j(""),A(!0),setTimeout(()=>{A(!1)},1500);wt([])}},$o=O=>{let ue=new DataTransfer;return O.forEach(ne=>ue.items.add(ne)),ue.files},Wo=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),Na())},Go=O=>{j(O)};return(0,Pt.jsx)(yo,{sidebarItems:s||[],title:ee,notifications:i||[],businessUnits:Le,currentBusinessUnit:Uo,onBusinessUnitChange:O=>{O&&(Fo(O),R?.(O))},onSearch:P,showTabs:!1,onActionClick:x,actionIcon:I,actionText:Ie,onNotificationRemove:M,onRemoveAll:T,logo:q,appName:re,tagline:de,sidebarInitiallyClosed:p,children:(0,Pt.jsx)(Vt.AnimatePresence,{mode:"wait",children:(0,Pt.jsx)(Vt.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,Pt.jsxs)("div",{className:"h-full flex",children:[(0,Pt.jsx)("div",{className:"w-80 flex-shrink-0 h-full p-2",children:(0,Pt.jsx)(xo,{sessions:d||[],currentSession:C,teams:Le,onNewChat:m,onSessionSelect:w,onSessionEdit:h,onSessionDelete:f})}),(0,Pt.jsx)("div",{className:"flex-1 h-full p-2",children:(0,Pt.jsx)(Ht,{messages:K||[],input:k,isTyping:De,currentSessionTitle:C?.title,capabilities:r||[],onInputChange:Go,addToolResult:me,onSendMessage:Na,onKeyPress:Wo,fileUploads:pt,isDragOver:jo,enableFileUpload:te,onFileUpload:Ho,onRemoveFile:Vo,onDragOver:Oo})})]})},"chat-interface")})})}function dr(e){return e.parts.filter(t=>t.type==="text").map(t=>t.text).join("")}function pr(e,t){return e.parts.some(a=>a.type===`tool-${t}`)}function mr(e,t){return e.parts.find(a=>a.type===`tool-${t}`)}function ur(e){return e.parts.some(t=>t.type==="file")}function gr(e){return e.parts.filter(t=>t.type==="file")}function fr(e,t){return e.parts.some(a=>a.type===`data-${t}`)}function br(e,t){return e.parts.find(a=>a.type===`data-${t}`)}0&&(module.exports={ApprovalRequestModal,CapabilityMenu,ChatCardArtefact,ChatCardTask,ChatInterface,ChatInterfaceMessages,ChatMessage,CopilotInterface,OAuthModal,defaultColorScheme,findCapabilityByPath,getAllCapabilities,getCapabilityByTeam,getContextualActions,getDataPart,getFileParts,getTextContent,getToolPart,hasDataPart,hasFilePart,hasToolPart,testCapabilities});