cortex-react-components 2.24.0 → 2.25.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.
- package/dist/chunk-2HKAJ4TZ.mjs +4 -0
- package/dist/{chunk-IF3425JX.mjs → chunk-2VOOH4YJ.mjs} +1 -1
- package/dist/{chunk-LBUC4M6L.mjs → chunk-3MCZBHGA.mjs} +1 -1
- package/dist/{chunk-6DDMDQLX.mjs → chunk-3Y4EXCL7.mjs} +1 -1
- package/dist/{chunk-XKGBG5FX.mjs → chunk-4IVQWIYV.mjs} +1 -1
- package/dist/{chunk-67QPOSVV.mjs → chunk-57PJ7CHJ.mjs} +1 -1
- package/dist/{chunk-5WVFEIMC.mjs → chunk-6DQ7FEQQ.mjs} +1 -1
- package/dist/chunk-6UDBIRMT.mjs +1 -0
- package/dist/{chunk-HKGW6JI2.mjs → chunk-75XBZHOC.mjs} +1 -1
- package/dist/{chunk-M7NV6EFH.mjs → chunk-B2TBKNIJ.mjs} +1 -1
- package/dist/{chunk-SDKKYDWS.mjs → chunk-BZOG5JBW.mjs} +1 -1
- package/dist/{chunk-N3B3XNV3.mjs → chunk-FRXZ2OKW.mjs} +1 -1
- package/dist/{chunk-MXCW6SOT.mjs → chunk-FX6IXEMQ.mjs} +1 -1
- package/dist/{chunk-NWISIJFD.mjs → chunk-K4MFTVNB.mjs} +1 -1
- package/dist/{chunk-5SHZBJ5R.mjs → chunk-KY3ELFX5.mjs} +1 -1
- package/dist/{chunk-I2GNNRFH.mjs → chunk-MUHR5KA5.mjs} +1 -1
- package/dist/{chunk-YKG4FNS4.mjs → chunk-N52FSTLG.mjs} +1 -1
- package/dist/{chunk-ERJXTG6X.mjs → chunk-NPGGDQ6F.mjs} +1 -1
- package/dist/chunk-P5LSKHQC.mjs +9 -0
- package/dist/{chunk-JOG27B7P.mjs → chunk-PDAMYUP7.mjs} +1 -1
- package/dist/{chunk-XDW3TPGL.mjs → chunk-PYFPL7A5.mjs} +1 -1
- package/dist/{chunk-2RQDJ5XT.mjs → chunk-Q7KKN6MH.mjs} +1 -1
- package/dist/{chunk-H3CJOE6S.mjs → chunk-QWFFSMKK.mjs} +1 -1
- package/dist/{chunk-P55W6AFU.mjs → chunk-RIRZRO6U.mjs} +1 -1
- package/dist/{chunk-PK3OBSCB.mjs → chunk-RUZVSK25.mjs} +1 -1
- package/dist/{chunk-FKU4VQR6.mjs → chunk-S4ES6P3Y.mjs} +1 -1
- package/dist/chunk-SEITRCGW.mjs +1 -0
- package/dist/{chunk-7GMAMIHM.mjs → chunk-SPAOEUCG.mjs} +1 -1
- package/dist/{chunk-M7ZG6HLI.mjs → chunk-STX6KQP5.mjs} +1 -1
- package/dist/{chunk-RSDUFAIB.mjs → chunk-T5HJS6OF.mjs} +1 -1
- package/dist/{chunk-LJQPLE4S.mjs → chunk-TUACRDU3.mjs} +1 -1
- package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
- package/dist/{chunk-X3JZSN3W.mjs → chunk-UZSBX5GO.mjs} +1 -1
- package/dist/{chunk-255P6K5W.mjs → chunk-VBSFVJM5.mjs} +1 -1
- package/dist/{chunk-6PS55VJZ.mjs → chunk-VDFRWGXR.mjs} +1 -1
- package/dist/{chunk-XGIYNUGC.mjs → chunk-VNYUNZ3M.mjs} +1 -1
- package/dist/{chunk-2BR55L74.mjs → chunk-VRE6VCHX.mjs} +1 -1
- package/dist/{chunk-GCIEF545.mjs → chunk-XDELWNND.mjs} +1 -1
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.mjs +1 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/DigitalColleagues/Pages/dashboardpage.js +4 -4
- package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.js +4 -4
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.js +4 -4
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-team-context.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.js +5 -5
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.js +5 -5
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/file-edit.js +3 -3
- package/dist/components/Foundary/file-edit.mjs +1 -1
- package/dist/components/Foundary/index.js +4 -4
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/types.d.ts +1 -0
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/PostHero/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Payload/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/PayloadCard/index.mjs +1 -1
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/EpicsView.mjs +1 -1
- package/dist/components/Projects/FileView.js +4 -4
- package/dist/components/Projects/FileView.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.d.ts +3 -0
- package/dist/components/Projects/KanbanBoardView.js +6 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.js +4 -4
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.js +4 -4
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/ProjectsIndexView.mjs +1 -1
- package/dist/components/Projects/TaskDetailsModal.d.ts +3 -0
- package/dist/components/Projects/TaskDetailsModal.js +6 -1
- package/dist/components/Projects/TaskDetailsModal.mjs +1 -1
- package/dist/components/Projects/file-list.d.ts +3 -1
- package/dist/components/Projects/file-list.js +4 -4
- package/dist/components/Projects/file-list.mjs +1 -1
- package/dist/components/Projects/index.js +6 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/dc-temp/index.js +5 -5
- package/dist/components/dc-temp/index.mjs +1 -1
- package/dist/components/index.js +23 -23
- package/dist/components/index.mjs +1 -1
- package/dist/components/ui/index.mjs +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.js +33 -33
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/form/index.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ICFBQXVC.mjs +0 -4
- package/dist/chunk-M7KIL6AS.mjs +0 -9
- package/dist/chunk-RQLUMNJE.mjs +0 -1
- package/dist/chunk-UM57PWI7.mjs +0 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
"use client"
|
|
4
4
|
|
|
5
|
-
"use strict";var Rs=Object.create;var So=Object.defineProperty;var As=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Ms=Object.getPrototypeOf,Is=Object.prototype.hasOwnProperty;var Fs=(e,t)=>{for(var a in t)So(e,a,{get:t[a],enumerable:!0})},Xr=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Es(t))!Is.call(e,r)&&r!==a&&So(e,r,{get:()=>t[r],enumerable:!(o=As(t,r))||o.enumerable});return e};var pe=(e,t,a)=>(a=e!=null?Rs(Ms(e)):{},Xr(t||!e||!e.__esModule?So(a,"default",{value:e,enumerable:!0}):a,e)),Ls=e=>Xr(So({},"__esModule",{value:!0}),e);var sd={};Fs(sd,{ColleaguesView:()=>nr,FileView:()=>ho,KnowledgeView:()=>Ir,PlanningView:()=>Jo,ProjectView:()=>Vr,ProjectsIndexView:()=>Kr,TeamsIndexView:()=>Gr});module.exports=Ls(sd);var jt=require("react"),Pt=require("lucide-react");var ni=require("clsx");var rr="-",Bs=e=>{let t=Hs(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{let n=s.split(rr);return n[0]===""&&n.length!==1&&n.shift(),ei(n,t)||Os(s)},getConflictingClassGroupIds:(s,n)=>{let l=a[s]||[];return n&&o[s]?[...l,...o[s]]:l}}},ei=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),r=o?ei(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;let i=e.join(rr);return t.validators.find(({validator:s})=>s(i))?.classGroupId},Yr=/^\[(.+)\]$/,Os=e=>{if(Yr.test(e)){let t=Yr.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},Hs=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return js(Object.entries(e.classGroups),a).forEach(([i,s])=>{or(s,o,i,t)}),o},or=(e,t,a,o)=>{e.forEach(r=>{if(typeof r=="string"){let i=r===""?t:Qr(t,r);i.classGroupId=a;return}if(typeof r=="function"){if(Vs(r)){or(r(o),t,a,o);return}t.validators.push({validator:r,classGroupId:a});return}Object.entries(r).forEach(([i,s])=>{or(s,Qr(t,i),a,o)})})},Qr=(e,t)=>{let a=e;return t.split(rr).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},Vs=e=>e.isThemeGetter,js=(e,t)=>t?e.map(([a,o])=>{let r=o.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,n])=>[t+s,n])):i);return[a,r]}):e,Us=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,r=(i,s)=>{a.set(i,s),t++,t>e&&(t=0,o=a,a=new Map)};return{get(i){let s=a.get(i);if(s!==void 0)return s;if((s=o.get(i))!==void 0)return r(i,s),s},set(i,s){a.has(i)?a.set(i,s):r(i,s)}}},ti="!",$s=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,r=t[0],i=t.length,s=n=>{let l=[],c=0,d=0,g;for(let u=0;u<n.length;u++){let F=n[u];if(c===0){if(F===r&&(o||n.slice(u,u+i)===t)){l.push(n.slice(d,u)),d=u+i;continue}if(F==="/"){g=u;continue}}F==="["?c++:F==="]"&&c--}let v=l.length===0?n:n.substring(d),x=v.startsWith(ti),b=x?v.substring(1):v,y=g&&g>d?g-d:void 0;return{modifiers:l,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:y}};return a?n=>a({className:n,parseClassName:s}):s},zs=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},Ks=e=>({cache:Us(e.cacheSize),parseClassName:$s(e),...Bs(e)}),_s=/\s+/,Gs=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:r}=t,i=[],s=e.trim().split(_s),n="";for(let l=s.length-1;l>=0;l-=1){let c=s[l],{modifiers:d,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:x}=a(c),b=!!x,y=o(b?v.substring(0,x):v);if(!y){if(!b){n=c+(n.length>0?" "+n:n);continue}if(y=o(v),!y){n=c+(n.length>0?" "+n:n);continue}b=!1}let u=zs(d).join(":"),F=g?u+ti:u,j=F+y;if(i.includes(j))continue;i.push(j);let T=r(y,b);for(let C=0;C<T.length;++C){let W=T[C];i.push(F+W)}n=c+(n.length>0?" "+n:n)}return n};function Ws(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=ai(t))&&(o&&(o+=" "),o+=a);return o}var ai=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=ai(e[o]))&&(a&&(a+=" "),a+=t);return a};function Zs(e,...t){let a,o,r,i=s;function s(l){let c=t.reduce((d,g)=>g(d),e());return a=Ks(c),o=a.cache.get,r=a.cache.set,i=n,n(l)}function n(l){let c=o(l);if(c)return c;let d=Gs(l,a);return r(l,d),d}return function(){return i(Ws.apply(null,arguments))}}var Ie=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},oi=/^\[(?:([a-ci-]+):)?(.+)\]$/i,qs=/^\d+\/\d+$/,Js=new Set(["px","full","screen"]),Xs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ys=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|ci|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qs=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,el=/^(inset_)?-?((\d+)?\.?(\d+)[a-ci]+|0)_-?((\d+)?\.?(\d+)[a-ci]+|0)/,tl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qt=e=>Ea(e)||Js.has(e)||qs.test(e),na=e=>Ma(e,"length",dl),Ea=e=>!!e&&!Number.isNaN(Number(e)),ar=e=>Ma(e,"number",Ea),Ja=e=>!!e&&Number.isInteger(Number(e)),al=e=>e.endsWith("%")&&Ea(e.slice(0,-1)),re=e=>oi.test(e),sa=e=>Xs.test(e),ol=new Set(["length","size","percentage"]),rl=e=>Ma(e,ol,ri),il=e=>Ma(e,"position",ri),nl=new Set(["image","url"]),sl=e=>Ma(e,nl,ml),ll=e=>Ma(e,"",cl),Xa=()=>!0,Ma=(e,t,a)=>{let o=oi.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},dl=e=>Ys.test(e)&&!Qs.test(e),ri=()=>!1,cl=e=>el.test(e),ml=e=>tl.test(e);var pl=()=>{let e=Ie("colors"),t=Ie("spacing"),a=Ie("blur"),o=Ie("brightness"),r=Ie("borderColor"),i=Ie("borderRadius"),s=Ie("borderSpacing"),n=Ie("borderWidth"),l=Ie("contrast"),c=Ie("grayscale"),d=Ie("hueRotate"),g=Ie("invert"),v=Ie("gap"),x=Ie("gradientColorStops"),b=Ie("gradientColorStopPositions"),y=Ie("inset"),u=Ie("margin"),F=Ie("opacity"),j=Ie("padding"),T=Ie("saturate"),C=Ie("scale"),W=Ie("sepia"),h=Ie("skew"),P=Ie("space"),k=Ie("translate"),B=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],ke=()=>["auto",re,t],R=()=>[re,t],ve=()=>["",qt,na],be=()=>["auto",Ea,re],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ft=()=>["start","end","center","between","around","evenly","stretch"],je=()=>["","0",re],Tt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>[Ea,re];return{cacheSize:500,separator:":",theme:{colors:[Xa],spacing:[qt,na],blur:["none","",sa,re],brightness:A(),borderColor:[e],borderRadius:["none","","full",sa,re],borderSpacing:R(),borderWidth:ve(),contrast:A(),grayscale:je(),hueRotate:A(),invert:je(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[al,na],inset:ke(),margin:ke(),opacity:A(),padding:R(),saturate:A(),scale:A(),sepia:je(),skew:A(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[sa]}],"break-after":[{"break-after":Tt()}],"break-before":[{"break-before":Tt()}],"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:[...O(),re]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],ci:[{ci:["auto",Ja,re]}],basis:[{basis:ke()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:je()}],shrink:[{shrink:je()}],order:[{order:["first","last","none",Ja,re]}],"grid-cols":[{"grid-cols":[Xa]}],"col-start-end":[{col:["auto",{span:["full",Ja,re]},re]}],"col-start":[{"col-start":be()}],"col-end":[{"col-end":be()}],"grid-rows":[{"grid-rows":[Xa]}],"row-start-end":[{row:["auto",{span:[Ja,re]},re]}],"row-start":[{"row-start":be()}],"row-end":[{"row-end":be()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","ci",re]}],"auto-rows":[{"auto-rows":["auto","min","max","ci",re]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...ft()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ft(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ft(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],ci:[{ci:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],ci:[{ci:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],ci:[{ci:[u]}],mx:[{mx:[u]}],my:[{my:[u]}],ms:[{ms:[u]}],me:[{me:[u]}],ci:[{ci:[u]}],mr:[{mr:[u]}],mb:[{mb:[u]}],ml:[{ml:[u]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,t]}],"min-w":[{"min-w":[re,t,"min","max","fit"]}],"max-w":[{"max-w":[re,t,"none","full","min","max","fit","prose",{screen:[sa]},sa]}],h:[{h:[re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",sa,na]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ar]}],"font-family":[{font:[Xa]}],"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",re]}],"line-clamp":[{"line-clamp":["none",Ea,ar]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qt,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[F]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[F]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qt,na]}],"underline-offset":[{"underline-offset":["auto",qt,re]}],"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:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],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",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[F]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),il]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rl]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","ci","b","bl","l","tl"]},sl]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-ci":[{"rounded-ci":[i]}],"rounded-ci":[{"rounded-ci":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-ci":[{"rounded-ci":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[n]}],"border-w-x":[{"border-x":[n]}],"border-w-y":[{"border-y":[n]}],"border-w-s":[{"border-s":[n]}],"border-w-e":[{"border-e":[n]}],"border-w-t":[{"border-t":[n]}],"border-w-r":[{"border-r":[n]}],"border-w-b":[{"border-b":[n]}],"border-w-l":[{"border-l":[n]}],"border-opacity":[{"border-opacity":[F]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[n]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[n]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[F]}],"divide-style":[{divide:ie()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[qt,re]}],"outline-w":[{outline:[qt,na]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[F]}],"ring-offset-w":[{"ring-offset":[qt,na]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",sa,ll]}],"shadow-color":[{shadow:[Xa]}],opacity:[{opacity:[F]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",sa,re]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[g]}],saturate:[{saturate:[T]}],sepia:[{sepia:[W]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[F]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[W]}],"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",re]}],duration:[{duration:A()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:A()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Ja,re]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[h]}],"skew-y":[{"skew-y":[h]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],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","s-resize","w-resize","ne-resize","nw-resize","ci-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-ci":[{"scroll-ci":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-ci":[{"scroll-ci":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-ci":[{"scroll-ci":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-ci":[{"scroll-ci":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[qt,na,ar]}],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"],ci:["px","py","ps","pe","ci","pr","pb","pl"],px:["pr","pl"],py:["ci","pb"],ci:["mx","my","ms","me","ci","mr","mb","ml"],mx:["mr","ml"],my:["ci","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-b","rounded-l","rounded-ss","rounded-ci","rounded-ci","rounded-es","rounded-tl","rounded-tr","rounded-ci","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-ci","rounded-ci"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-ci"],"rounded-b":["rounded-ci","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-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-ci":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-ci","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-ci","scroll-mb"],"scroll-ci":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-ci","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-ci","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var ii=Zs(pl);function S(...e){return ii((0,ni.clsx)(e))}var si=require("@radix-ui/react-slot"),li=require("class-variance-authority"),di=pe(require("react")),ci=require("react/jsx-runtime"),Ya=(0,li.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"}}}),w=di.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...r},i)=>(0,ci.jsx)(e?si.Slot:"button",{className:S(Ya({className:t,size:a,variant:o})),ref:i,...r}));w.displayName="Button";var fa=pe(require("react"));var X=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("rounded-xl border bg-card text-card-foreground shadow",e),...t}));X.displayName="Card";var it=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("flex flex-col space-y-1.5 ci-6",e),...t}));it.displayName="CardHeader";var nt=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("font-semibold leading-none tracking-tight",e),...t}));nt.displayName="CardTitle";var Qa=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("text-sm text-muted-foreground",e),...t}));Qa.displayName="CardDescription";var Ce=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("ci-6 ci-0",e),...t}));Ce.displayName="CardContent";var eo=fa.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("div",{ref:a,className:S("flex items-center ci-6 ci-0",e),...t}));eo.displayName="CardFooter";var mi=pe(require("react"));var Y=mi.forwardRef(({className:e,type:t,...a},o)=>(0,ci.jsx)("input",{type:t,className:S("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}));Y.displayName="Input";var le=pe(require("@radix-ui/react-select")),la=pe(require("react")),Je=le.Root;var ht=le.Value,_e=la.forwardRef(({children:e,className:t,...a},o)=>(0,ci.jsxs)(le.Trigger,{className:S("flex h-10 w-full items-center justify-between rounded border border-input bg-background px-3 py-2 text-inherit ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),ref:o,...a,children:[e,(0,ci.jsx)(le.Icon,{asChild:!0,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));_e.displayName=le.Trigger.displayName;var ui=la.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(le.ScrollUpButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,ci.jsx)(Pt.ChevronUp,{className:"h-4 w-4"})}));ui.displayName=le.ScrollUpButton.displayName;var gi=la.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(le.ScrollDownButton,{className:S("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4"})}));gi.displayName=le.ScrollDownButton.displayName;var Ge=la.forwardRef(({children:e,className:t,position:a="popper",...o},r)=>(0,ci.jsx)(le.Portal,{children:(0,ci.jsxs)(le.Content,{className:S("relative ci-50 max-h-96 min-w-[8rem] overflow-hidden rounded border bg-card 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,ref:r,...o,children:[(0,ci.jsx)(ui,{}),(0,ci.jsx)(le.Viewport,{className:S("ci-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,ci.jsx)(gi,{})]})}));Ge.displayName=le.Content.displayName;var ul=la.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(le.Label,{className:S("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:a,...t}));ul.displayName=le.Label.displayName;var ue=la.forwardRef(({children:e,className:t,...a},o)=>(0,ci.jsxs)(le.Item,{className:S("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:o,...a,children:[(0,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(le.ItemIndicator,{children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})})}),(0,ci.jsx)(le.ItemText,{children:e})]}));ue.displayName=le.Item.displayName;var gl=la.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(le.Separator,{className:S("-mx-1 my-1 h-px bg-muted",e),ref:a,...t}));gl.displayName=le.Separator.displayName;var ir=require("motion/react");var ba=pe(require("@radix-ui/react-tabs"));function fi({className:e,...t}){return(0,ci.jsx)(ba.Root,{"data-slot":"tabs",className:S("flex flex-col gap-2",e),...t})}function vi({className:e,...t}){return(0,ci.jsx)(ba.List,{"data-slot":"tabs-list",className:S("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg ci-[3px]",e),...t})}function hi({className:e,...t}){return(0,ci.jsx)(ba.Trigger,{"data-slot":"tabs-trigger",className:S("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 Jt=pe(require("react")),de=pe(require("@radix-ui/react-dropdown-menu")),Ia=require("@radix-ui/react-icons");var Fa=de.Root,La=de.Trigger;var fl=Jt.forwardRef(({className:e,inset:t,children:a,...o},r)=>(0,ci.jsxs)(de.SubTrigger,{ref:r,className:S("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,ci.jsx)(Ia.ChevronRightIcon,{className:"ml-auto"})]}));fl.displayName=de.SubTrigger.displayName;var vl=Jt.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(de.SubContent,{ref:a,className:S("ci-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover ci-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}));vl.displayName=de.SubContent.displayName;var xa=Jt.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,ci.jsx)(de.Portal,{children:(0,ci.jsx)(de.Content,{ref:o,sideOffset:t,className:S("ci-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover ci-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})}));xa.displayName=de.Content.displayName;var ya=Jt.forwardRef(({className:e,inset:t,...a},o)=>(0,ci.jsx)(de.Item,{ref:o,className:S("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}));ya.displayName=de.Item.displayName;var hl=Jt.forwardRef(({className:e,children:t,checked:a,...o},r)=>(0,ci.jsxs)(de.CheckboxItem,{ref:r,className:S("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,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(de.ItemIndicator,{children:(0,ci.jsx)(Ia.CheckIcon,{className:"h-4 w-4"})})}),t]}));hl.displayName=de.CheckboxItem.displayName;var bl=Jt.forwardRef(({className:e,children:t,...a},o)=>(0,ci.jsxs)(de.RadioItem,{ref:o,className:S("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,ci.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ci.jsx)(de.ItemIndicator,{children:(0,ci.jsx)(Ia.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));bl.displayName=de.RadioItem.displayName;var xl=Jt.forwardRef(({className:e,inset:t,...a},o)=>(0,ci.jsx)(de.Label,{ref:o,className:S("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));xl.displayName=de.Label.displayName;var yl=Jt.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(de.Separator,{ref:a,className:S("-mx-1 my-1 h-px bg-muted",e),...t}));yl.displayName=de.Separator.displayName;var wl=({className:e,...t})=>(0,ci.jsx)("span",{className:S("ml-auto text-xs tracking-widest opacity-60",e),...t});wl.displayName="DropdownMenuShortcut";function To({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:r="700px",gridCols:i=6}){let s=a.find(n=>n.value===e);return(0,ci.jsxs)(ir.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,ci.jsx)("div",{className:"hidden lg:block",children:(0,ci.jsx)(fi,{value:e,onValueChange:t,children:(0,ci.jsx)(vi,{className:"grid w-full rounded-2xl ci-0 h-10",style:{maxWidth:r,gridTemplateColumns:`repeat(${Math.min(i,a.length)}, minmax(0, 1fr))`},children:a.map(n=>(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,ci.jsx)(hi,{value:n.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:n.label})},n.value))})})}),(0,ci.jsx)("div",{className:"lg:hidden",children:(0,ci.jsxs)(Fa,{children:[(0,ci.jsx)(La,{asChild:!0,children:(0,ci.jsxs)(w,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[s?.label||"Select",(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,ci.jsx)(xa,{align:"center",className:"w-[180px]",children:a.map(n=>(0,ci.jsx)(ya,{onClick:()=>t?.(n.value),className:`cursor-pointer ${e===n.value?"bg-accent":""}`,children:n.label},n.value))})]})})]})}var ko=pe(require("react")),Xt=pe(require("@radix-ui/react-avatar"));var to=ko.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(Xt.Root,{ref:a,className:S("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));to.displayName=Xt.Root.displayName;var Nl=ko.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(Xt.Image,{ref:a,className:S("aspect-square h-full w-full",e),...t}));Nl.displayName=Xt.Image.displayName;var ao=ko.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(Xt.Fallback,{ref:a,className:S("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ao.displayName=Xt.Fallback.displayName;function xi({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[r,i]=(0,jt.useState)(""),s=(0,jt.useMemo)(()=>e.filter(l=>l.name?.toLowerCase().includes(r.toLowerCase())||l.email.toLowerCase().includes(r.toLowerCase())),[e,r]),n=l=>{t(l)};return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(w,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"Choose a user to add ir a colleague"})]})]}),(0,ci.jsx)(X,{className:"container",children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(Y,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:l=>i(l.target.value),className:"pl-9"})]})})})})}),(0,ci.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:s.map(l=>(0,ci.jsx)(ir.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,ci.jsxs)(X,{className:`cursor-pointer transition-all hover:shadow-lg ${o===l.id?"ring-2 ring-primary":""}`,onClick:()=>n(l),children:[(0,ci.jsx)(it,{className:"pb-3",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsx)(to,{children:(0,ci.jsx)(ao,{children:(0,ci.jsx)(Pt.User,{className:"h-4 w-4"})})}),(0,ci.jsx)("div",{children:(0,ci.jsx)(nt,{className:"text-lg",children:l.name})})]}),o===l.id&&(0,ci.jsx)(Pt.Check,{className:"h-5 w-5 text-primary"})]})}),(0,ci.jsx)(Ce,{className:"ci-0",children:(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground",children:"Email"}),(0,ci.jsx)("ci",{className:"text-sm font-medium",children:l.email})]}),(0,ci.jsx)("div",{children:(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},l.id))}),s.length===0&&(0,ci.jsx)(X,{className:"container ci-4",children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt users found"}),(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function yi({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(w,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(X,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(it,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.User,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(nt,{className:"text-xl",children:"Add Human Colleague"})]}),(0,ci.jsxs)(Ce,{className:"text-center",children:[(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add ir team members."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Browse existing users"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Import user details automatically"})]})]}),(0,ci.jsx)(w,{className:"ci-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(X,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(it,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,ci.jsx)(nt,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,ci.jsxs)(Ce,{className:"text-center",children:[(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:"Clone an existing digital colleague or create a new AI assistant for your team."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Clone existing colleagues"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-purple-600"}),(0,ci.jsx)("span",{children:"Create from templates"})]})]}),(0,ci.jsx)(w,{className:"ci-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function wi({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,ci.jsxs)(w,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,ci.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(X,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,ci.jsxs)(it,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,ci.jsx)(nt,{className:"text-xl",children:"Clone Existing"})]}),(0,ci.jsxs)(Ce,{className:"text-center",children:[(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:"Start with an existing digital colleague and customize it for your needs."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Copy,{className:"h-4 w-4 text-blue-600"}),(0,ci.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,ci.jsx)(w,{className:"ci-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,ci.jsxs)(X,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,ci.jsxs)(it,{className:"text-center pb-4",children:[(0,ci.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,ci.jsx)(Pt.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,ci.jsx)(nt,{className:"text-xl",children:"Create New"})]}),(0,ci.jsxs)(Ce,{className:"text-center",children:[(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,ci.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Custom job description"})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,ci.jsx)(Pt.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,ci.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,ci.jsx)(w,{className:"ci-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}var Cl=(0,li.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 Pe({className:e,variant:t,...a}){return(0,ci.jsx)("div",{className:S(Cl({variant:t}),e),...a})}function Si(e,t){let[a,o]=(0,jt.useState)(()=>{if(typeof window>"u")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch{return t}}),r=i=>{try{o(i),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(i))}catch{}};return(0,jt.useEffect)(()=>{r(a)},[]),[a,r]}var Eo=require("react-icons/fa");function dt({title:e,description:t,badge:a,primaryAction:o,secondaryAction:r,gradient:i,children:s,className:n}){let[l,c]=Si(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!r&&!t),d=!r&&!t||l;return(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${i} ci-8 text-white ${n||""}`,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,ci.jsx)(Pe,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,ci.jsx)("h2",{className:"text-3xl font-bold ci-0",children:e})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[d&&o&&(0,ci.jsx)(w,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(r||t)&&(0,ci.jsx)("button",{"aria-label":l?"Expand hero section":"Minimize hero section",className:"rounded-full bg-white/20 hover:bg-white/30 ci-1 text-white transition-colors",onClick:()=>c(!l),style:{lineHeight:0},children:l?(0,ci.jsx)(Eo.FaChevronDown,{size:22}):(0,ci.jsx)(Eo.FaChevronUp,{size:22})})]})]}),!d&&(0,ci.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("ci",{className:"max-w-[600px] text-white/80",children:t}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,ci.jsx)(w,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),r&&(0,ci.jsx)(w,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:r.onClick,children:r.label})]})]}),s&&(0,ci.jsx)("div",{className:"hidden lg:block",children:s})]})]})}function nr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:r=!1,departments:i=["Design","Engineering","Marketing","Product","Sales","Operations"],className:s,availableUsers:n=[],existingDigitalColleagues:l=[]}){let[c,d]=(0,jt.useState)(e||[]),[g,v]=(0,jt.useState)(""),[x,b]=(0,jt.useState)("all"),[y,u]=(0,jt.useState)("all"),[F,j]=(0,jt.useState)("all"),[T,C]=(0,jt.useState)(null),[W,h]=(0,jt.useState)(null);(0,jt.useEffect)(()=>{d(e||[])},[e]);let P=Array.isArray(n)?n:[],k=Array.isArray(l)?l:[],[B,G]=(0,jt.useState)("main"),ke=c.filter(L=>!L||!L.name?!1:L.name.toLowerCase().includes(g.toLowerCase())||L.type==="human"&&L.email?.toLowerCase().includes(g.toLowerCase())||L.type==="digital"&&L.jobDescription?.toLowerCase().includes(g.toLowerCase())),R=ke.filter(L=>L.type==="human"),ve=ke.filter(L=>L.type==="digital"),be=()=>{G("typeSelection")},O=L=>{L.type==="digital"&&(C(L),G("form")),console.log("Editing colleague:",L),a?.(L)},ie=L=>{L.type==="digital"&&(h(L),G("view"))},Ne=L=>{let Fe={id:`human-${Date.now()}`,type:"human",name:L.name||"",email:L.email,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};d(we=>[...we,Fe]),t?.(Fe),G("main")},ft=L=>{if(!L||!L.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",L);return}d(Fe=>[...Fe,L]),t?.(L),G("main")},je=()=>{C(null),G("form")},Tt=L=>{if(!L||!L.id){console.error("Invalid colleague provided to handleSaveColleague:",L);return}T?(d(Fe=>Fe.map(we=>we.id===L.id?L:we)),a?.(L)):(d(Fe=>[...Fe,L]),t?.(L)),G("main"),C(null)},A=()=>{G("main"),C(null),h(null)},ce=()=>{G("main"),h(null)},Me=()=>{W&&(C(W),h(null),G("form"))},kt=L=>{o?.(L,c.find(Fe=>Fe.id===L).type),d(Fe=>Fe.filter(we=>we.id!==L))},xe=()=>{v(""),b("all"),u("all")},Ct=()=>{let L=[];return k.forEach(we=>{we.knowledge&&Array.isArray(we.knowledge)&&L.push(...we.knowledge),we.coreKnowledge&&Array.isArray(we.coreKnowledge)&&L.push(...we.coreKnowledge)}),c.forEach(we=>{we.type==="digital"&&(we.knowledge&&Array.isArray(we.knowledge)&&L.push(...we.knowledge),we.coreKnowledge&&Array.isArray(we.coreKnowledge)&&L.push(...we.coreKnowledge))}),L.filter((we,Kt,Zt)=>Kt===Zt.findIndex(ra=>ra.id===we.id))};return B==="typeSelection"?(0,ci.jsx)(yi,{onSelectHuman:()=>G("userSelection"),onSelectDigital:()=>G("digitalOptions"),onCancel:()=>G("main")}):B==="userSelection"?(0,ci.jsx)(xi,{users:P,onUserSelect:Ne,onCancel:()=>G("typeSelection")}):B==="digitalOptions"?(0,ci.jsx)(wi,{onCloneExisting:()=>G("digitalClone"),onCreateNew:je,onCancel:()=>G("typeSelection")}):(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${s||""}`,children:[(0,ci.jsx)(dt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:be}}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,ci.jsxs)(X,{children:[(0,ci.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(nt,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(Ce,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:c.length}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground"})]})]}),(0,ci.jsxs)(X,{children:[(0,ci.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(nt,{className:"text-sm font-medium",children:"Human Members"}),(0,ci.jsx)(Pt.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(Ce,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:c.filter(L=>L.type==="human").length}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,ci.jsxs)(X,{children:[(0,ci.jsxs)(it,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,ci.jsx)(nt,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,ci.jsxs)(Ce,{children:[(0,ci.jsx)("div",{className:"text-2xl font-bold",children:c.filter(L=>L.type==="digital").length}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground",children:"active"})]})]})]}),(0,ci.jsx)(X,{children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(Y,{placeholder:"Search colleagues...",value:g,onChange:L=>v(L.target.value),className:"pl-9"})]})}),(0,ci.jsxs)(Je,{value:x,onValueChange:b,children:[(0,ci.jsx)(_e,{className:"w-full md:w-[180px]",children:(0,ci.jsx)(ht,{placeholder:"Department"})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(ue,{value:"all",children:"All Departments"}),i.map(L=>(0,ci.jsx)(ue,{value:L,children:L},L))]})]}),(0,ci.jsxs)(Je,{value:y,onValueChange:u,children:[(0,ci.jsx)(_e,{className:"w-full md:w-[140px]",children:(0,ci.jsx)(ht,{placeholder:"Status"})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(ue,{value:"all",children:"All Status"}),(0,ci.jsx)(ue,{value:"active",children:"Active"}),(0,ci.jsx)(ue,{value:"inactive",children:"Inactive"})]})]}),(g||x!=="all"||y!=="all")&&(0,ci.jsxs)(w,{variant:"outline",onClick:xe,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(To,{activeTab:F,onTabChange:j,tabOptions:[{value:"all",label:`All (${ke.length})`},{value:"human",label:`Human (${R.length})`},{value:"digital",label:`Digital (${ve.length})`}],maxWidth:"400px",gridCols:3}),F==="all"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`}),F==="human"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`}),F==="digital"&&(0,ci.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`})]}),ke.length===0&&(0,ci.jsx)(X,{children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt colleagues found"}),(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:g||x!=="all"||y!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,ci.jsxs)(w,{onClick:be,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var ro=pe(require("react")),ct=pe(require("@radix-ui/react-dialog"));var We=ct.Root;var sr=ct.Portal;var Io=ro.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(ct.Overlay,{ref:a,className:S("fixed inset-0 ci-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}));Io.displayName=ct.Overlay.displayName;var Xe=ro.forwardRef(({className:e,children:t,...a},o)=>(0,ci.jsxs)(sr,{children:[(0,ci.jsx)(Io,{}),(0,ci.jsxs)(ct.Content,{ref:o,className:S("fixed left-[50%] top-[50%] ci-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background ci-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,ci.jsxs)(ct.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,ci.jsx)(Pt.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Xe.displayName=ct.Content.displayName;var Ye=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ye.displayName="DialogHeader";var io=({className:e,...t})=>(0,ci.jsx)("div",{className:S("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});io.displayName="DialogFooter";var Qe=ro.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(ct.Title,{ref:a,className:S("text-lg font-semibold leading-none tracking-tight",e),...t}));Qe.displayName=ct.Title.displayName;var no=ro.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(ct.Description,{ref:a,className:S("text-sm text-muted-foreground",e),...t}));no.displayName=ct.Description.displayName;var An=pe(require("@radix-ui/react-dialog"));var ki=pe(require("react")),Se=ki.forwardRef(({className:e,...t},a)=>(0,ci.jsx)("textarea",{className:S("flex min-h-[80px] w-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...t}));Se.displayName="Textarea";var Ri=pe(require("react")),lr=pe(require("@radix-ui/react-label"));var Sl=(0,li.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),E=Ri.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(lr.Root,{ref:a,className:S(Sl(),e),...t}));E.displayName=lr.Root.displayName;var da=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:r,className:i="",disabled:s=!1})=>{let[n,l]=(0,jt.useState)(!1),[c,d]=(0,jt.useState)(""),g=()=>{s||(l(!0),d(t))},v=async()=>{c!==t&&await r(e,c),l(!1)},x=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?v():b.key==="Escape"&&(l(!1),d(""))};return(0,ci.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,ci.jsx)(E,{children:a}),n?o?(0,ci.jsx)(Se,{value:c,onChange:b=>d(b.target.value),onBlur:v,onKeyDown:x,autoFocus:!0,rows:4,className:"resize-none"}):(0,ci.jsx)(Y,{value:c,onChange:b=>d(b.target.value),onBlur:v,onKeyPress:x,autoFocus:!0,className:"text-lg font-medium"}):(0,ci.jsxs)("div",{onClick:g,className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 ci-2 rounded border border-transparent hover:border-border transition-colors group ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,ci.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!s&&(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var nn=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),sn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),ln=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),dn=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),cn=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),mn=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),pn=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Vo=require("@payloadcms/richtext-lexical/lexical/list"),un=require("@payloadcms/richtext-lexical/lexical/rich-text"),gn=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var on=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),po=require("@payloadcms/richtext-lexical/lexical/utils"),ne=require("@payloadcms/richtext-lexical/lexical"),yr=require("@payloadcms/richtext-lexical/lexical/selection");var zi=require("@radix-ui/react-dialog"),Oo=require("@payloadcms/richtext-lexical/client");var mr=pe(require("bson-objectid"));var Fi=require("@payloadcms/ui");var Ii=pe(require("react")),Ut=pe(require("@radix-ui/react-tooltip"));var Fo=Ut.Provider,Lo=Ut.Root,Bo=Ut.Trigger,so=Ii.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,ci.jsx)(Ut.Portal,{children:(0,ci.jsx)(Ut.Content,{ref:o,sideOffset:t,className:S("ci-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})}));so.displayName=Ut.Content.displayName;var Dl=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[r]=(0,on.useLexicalComposerContext)(),[i,s]=(0,jt.useState)(""),[n,l]=(0,jt.useState)(""),[c,d]=(0,jt.useState)(""),g=async u=>{console.log("fetchMedia",u)};(0,jt.useEffect)(()=>{typeof a=="string"?a.length===24?g(a):(s(a||""),d(y(b())),l(x()||"")):typeof a=="object"&&(s(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),d(y(a.filesize)),l(a.mimeType?.split("/")[1]||""))},[]);let v=(0,jt.useCallback)(()=>{r.update(()=>{(0,ne.$getNodeByKey)(o)?.remove()})},[r,o]),x=()=>{let u=e.data.value;return typeof u=="string"?u.split(";base64")[0]?.split("image/")[1]:""},b=()=>{let u=e.data.value;if(typeof u=="string"){let F=u.split(",")[1]?.length||0;return 4*Math.ceil(F/3)*.5624896334383812/1e3}return 0};function y(u){if(u>=1e6){let j=u/1e6;return`${j>=10?Math.round(j).toString():j.toFixed(1)} MB`}return`${Math.floor(u/1e3)} KB`}return(0,ci.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,ci.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,ci.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,ci.jsx)("div",{className:"flex-1",children:e.data.value?(0,ci.jsx)("img",{className:"object-cover ci-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":a,"data-lexical-upload-relation-to":t,src:i}):(0,ci.jsx)(Fi.File,{})}),(0,ci.jsx)(Fo,{children:(0,ci.jsxs)(Lo,{children:[(0,ci.jsxs)(Bo,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,ci.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,ci.jsx)("button",{onClick:u=>{u.preventDefault(),v()},className:"flex-1 flex justify-center items-center",children:(0,ci.jsx)(Pt.X,{width:24,height:24,strokeWidth:1})})]}),(0,ci.jsx)(so,{children:(0,ci.jsx)("span",{children:"Remove image"})})]})})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,ci.jsx)("span",{className:"",children:n?.toLocaleUpperCase()}),(0,ci.jsx)("span",{children:c})]})]})})},Hi=Dl;function Tl(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id");if(a)return{node:Ha({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var lo=class extends Oo.UploadNode{static importDOM(){return{img:()=>({conversion:Tl,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new mr.default().toHexString(),t.version=3);let a={id:t.id??new mr.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=Ha(a);return o.setFormat?.(t.format),o}decorate(){return(0,ci.jsx)(Hi,{data:this.__data,nodeKey:this.getKey()})}};function Ha(e){return new lo({data:e})}var kl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Pl=e=>kl?(e||window).getSelection():null,tm=(0,ne.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),pr=(0,ne.createCommand)("INSERT_UPLOAD_COMMAND");function Ki({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,jt.useRef)(!1),[r,i]=(0,jt.useState)(!0),[s,n]=(0,jt.useState)(""),[l,c]=(0,jt.useState)(""),[d,g]=(0,jt.useState)(!1),[v,x]=(0,jt.useState)("left"),b=s==="",y=C=>{g(C.target.checked)},u=C=>{x(C.target.value)},F=C=>{let W=new FileReader;W.onload=function(){return typeof W.result=="string"&&n(W.result),""},C!==null&&C[0]&&W.readAsDataURL(C[0])};(0,jt.useEffect)(()=>{o.current=!1;let C=W=>{o.current=W.altKey};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[e]),(0,jt.useEffect)(()=>{r||t()},[r]),(0,jt.useEffect)(()=>{i(a)},[a]);let j=({editor:C,relationTo:W,replaceNodeKey:h,value:P})=>{if(h)C.update(()=>{let k=(0,ne.$getNodeByKey)(h);k&&k.replace(Ha({id:"",fields:{},relationTo:"media",value:P}))});else{let k=C.dispatchCommand(pr,{fields:null,relationTo:"media",value:P})}},T=()=>{j({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:l,src:s,showCaption:d,position:v}.src}),i(!1),t()};return(0,ci.jsx)(We,{open:r,onOpenChange:C=>i(C),children:(0,ci.jsxs)(Xe,{children:[(0,ci.jsxs)(Ye,{children:[(0,ci.jsx)(Qe,{children:"Upload Image"}),(0,ci.jsx)(zi.DialogDescription,{children:"Description"})]}),(0,ci.jsxs)("div",{className:"",children:[(0,ci.jsx)("div",{style:{marginBottom:"1em"},children:(0,ci.jsx)(Y,{type:"file",onChange:C=>F(C.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,ci.jsx)("div",{style:{marginBottom:"1em"},children:(0,ci.jsx)(Y,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:C=>c(C.currentTarget.value),value:l,"data-test-id":"image-modal-alt-text-input"})}),(0,ci.jsx)(w,{"data-test-id":"image-modal-file-upload-btn",disabled:b,onClick:()=>T(),children:"Confirm"})]})]})})}function ur({captionsEnabled:e}){let[t]=(0,on.useLexicalComposerContext)();return(0,jt.useEffect)(()=>{if(!t.hasNodes([Oo.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,$i.mergeRegister)(t.registerCommand(ne.DRAGSTART_COMMAND,a=>Rl(a),ne.COMMAND_PRIORITY_HIGH),t.registerCommand(ne.DRAGOVER_COMMAND,a=>Al(a),ne.COMMAND_PRIORITY_LOW),t.registerCommand(ne.DROP_COMMAND,a=>El(a,t),ne.COMMAND_PRIORITY_HIGH))},[e,t]),null}function Rl(e){if(!gr())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","_"),!0):!1}function Al(e){return gr()?(_i(e)||e.preventDefault(),!0):!1}function El(e,t){let a=gr();if(!a)return!1;if(e.preventDefault(),_i(e)){let o=Ml(e);a.remove();let r=(0,ne.$createRangeSelection)();o!=null&&r.applyDOMRange(o),(0,ne.$setSelection)(r)}return!0}function gr(){let e=(0,ne.$getSelection)();if(!(0,ne.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,Oo.$isUploadNode)(a)?a:null}function _i(e){let t=e.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function Ml(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,r=Pl(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&r!==null)r.collapse(e.rangeParent,e.rangeOffset||0),t=r.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var Il=()=>(0,ci.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,ci.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),Gi=Il;var Fl=()=>(0,ci.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,ci.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),Wi=Fl;var Ll=()=>(0,ci.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,ci.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,ci.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Zi=Ll;var Bl=()=>(0,ci.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,ci.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,ci.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),qi=Bl;var Ol=()=>(0,ci.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,ci.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Ji=Ol;var Hl=()=>(0,ci.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,ci.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Xi=Hl;var Yi=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),Qi=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),en=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),tn=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),an=()=>(0,$t.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,$t.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var xr=1;function Vl(){return(0,ci.jsx)("span",{className:"border border-[#222222]"})}function wr(){let[e]=(0,on.useLexicalComposerContext)(),t=(0,jt.useRef)(null),[a,o]=(0,jt.useState)(!1),[r,i]=(0,jt.useState)(!1),[s,n]=(0,jt.useState)(!1),[l,c]=(0,jt.useState)(!1),[d,g]=(0,jt.useState)(!1),[v,x]=(0,jt.useState)(!1),[b,y]=(0,jt.useState)(!1),[u,F]=(0,jt.useState)(!1),[j,T]=(0,jt.useState)(!1),[C,W]=(0,jt.useState)("left"),[h,P]=(0,jt.useState)("ci"),k=O=>{e.update(()=>{let ie=(0,ne.$getSelection)();(0,ne.$isRangeSelection)(ie)&&(O==="ci"?(0,yr.$setBlocksType)(ie,()=>(0,ne.$createParagraphNode)()):(0,yr.$setBlocksType)(ie,()=>(0,un.$createHeadingNode)(O)))})},B=(0,jt.useCallback)(()=>{let O=(0,ne.$getSelection)();if((0,ne.$isRangeSelection)(O)){n(O.hasFormat("bold")),c(O.hasFormat("italic")),g(O.hasFormat("underline")),x(O.hasFormat("strikethrough")),y(O.hasFormat("subscript")),F(O.hasFormat("superscript"));let ie=O.anchor.getNode(),Ne=ie;for(;Ne&&!(0,ne.$isParagraphNode)(Ne)&&Ne!==(0,ne.$getRoot)();){let je=Ne.getParent();je&&(Ne=je)}if(Ne){let je=Ne.getFormatType();W(je||"left")}let ft=ie.getTopLevelElement()?.__tag;P(ft||"ci")}},[]);(0,jt.useEffect)(()=>(0,po.mergeRegister)(e.registerUpdateListener(({editorState:O})=>{O.read(()=>{B()})}),e.registerCommand(ne.SELECTION_CHANGE_COMMAND,(O,ie)=>(B(),!1),xr),e.registerCommand(ne.CAN_UNDO_COMMAND,O=>(o(O),!1),xr),e.registerCommand(ne.CAN_REDO_COMMAND,O=>(i(O),!1),xr),(0,po.mergeRegister)(e.registerCommand(pr,O=>(e.update(()=>{let ie=(0,ne.$getSelection)()||(0,ne.$getPreviousSelection)();if((0,ne.$isRangeSelection)(ie)){let Ne=Ha({id:O.id,fields:O.fields,relationTo:O.relationTo,value:O.value}),{focus:ft}=ie,je=ft.getNode();(0,po.$insertNodeToNearestRoot)(Ne),(0,ne.$isParagraphNode)(je)&&!je.__first&&je.remove()}}),!0),ne.COMMAND_PRIORITY_EDITOR))),[e,B]);let G=[[{label:"Undo",icon:(0,ci.jsx)(Pt.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,ci.jsx)(Pt.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,ci.jsx)(Gi,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:s},{label:"Italic",icon:(0,ci.jsx)(Wi,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:l},{label:"Underline",icon:(0,ci.jsx)(Zi,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:d},{label:"Strikethrough",icon:(0,ci.jsx)(qi,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:v},{label:"Subscript",icon:(0,ci.jsx)(Ji,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,ci.jsx)(Xi,{}),onClick:()=>{e.dispatchCommand(ne.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:u}]],ke=[{label:"Left Align",direction:"left",icon:(0,ci.jsx)(Pt.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,ci.jsx)(Pt.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,ci.jsx)(Pt.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,ci.jsx)(Pt.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(ne.FORMAT_ELEMENT_COMMAND,"justify")}}],ve=[{label:"Normal Text",value:"ci",icon:(0,ci.jsx)(Yi,{}),onClick:()=>k("ci")},{label:"Heading 1",value:"h1",icon:(0,ci.jsx)(Qi,{}),onClick:()=>k("h1")},{label:"Heading 2",value:"h2",icon:(0,ci.jsx)(en,{}),onClick:()=>k("h2")},{label:"Heading 3",value:"h3",icon:(0,ci.jsx)(tn,{}),onClick:()=>k("h3")},{label:"Heading 4",value:"h4",icon:(0,ci.jsx)(an,{}),onClick:()=>k("h4")},...[{label:"Unordered List",value:"ul",icon:(0,ci.jsx)(Pt.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Vo.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,ci.jsx)(Pt.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Vo.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],be=[{label:"Insert Image",icon:(0,ci.jsx)(Pt.ImageUp,{width:15,height:15}),onClick:()=>{T(!0)},disabled:!1}];return(0,ci.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black ci-50",children:(0,ci.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[G.map((O,ie)=>(0,ci.jsxs)(jt.Fragment,{children:[(0,ci.jsx)("div",{className:"flex items-center gap-2",children:O.map((Ne,ft)=>(0,ci.jsx)("div",{role:"button","aria-disabled":Ne.disabled||!1,onClick:Ne.onClick,className:S("ci-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",Ne.active&&"bg-[#3c3c3c]"),"aria-label":Ne.label,children:(0,ci.jsx)(Fo,{children:(0,ci.jsxs)(Lo,{children:[(0,ci.jsx)(Bo,{className:"text-[#b5b5b5]",children:Ne.icon}),(0,ci.jsx)(so,{children:(0,ci.jsx)("ci",{children:Ne.label})})]})})},ft))}),(0,ci.jsx)(Vl,{})]},`toolbar-option-${O.length}-${ie}`)),(0,ci.jsxs)(Fa,{children:[(0,ci.jsxs)(La,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[ke.find(O=>O.direction===C)?.icon,ke.find(O=>O.direction===C)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(xa,{className:"bg-black hover:bg-black",children:ke.map((O,ie)=>(0,ci.jsxs)(ya,{onClick:O.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,ci.jsx)("span",{children:O.icon}),(0,ci.jsx)("span",{children:O.label})]},`${O.label}-${ie}`))})]}),(0,ci.jsxs)(Fa,{children:[(0,ci.jsxs)(La,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[ve.find(O=>O.value===h)?.icon,ve.find(O=>O.value===h)?.label,(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(xa,{className:"bg-black hover:bg-black",children:ve.map((O,ie)=>(0,ci.jsxs)(ya,{onClick:O.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,ci.jsx)("span",{children:O.icon}),(0,ci.jsx)("span",{children:O.label})]},`heading-option-${O.label}-${ie}`))})]}),(0,ci.jsxs)(Fa,{children:[(0,ci.jsxs)(La,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[(0,ci.jsx)(Pt.Plus,{width:15,height:15}),(0,ci.jsx)(Pt.ChevronDown,{width:15,height:15})]}),(0,ci.jsx)(xa,{className:"bg-black hover:bg-black",children:be.map((O,ie)=>(0,ci.jsxs)(ya,{onClick:O.onClick,disabled:O.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,ci.jsx)("span",{children:O.icon}),(0,ci.jsx)("span",{children:O.label})]},ie))})]}),j&&(0,ci.jsx)(Ki,{activeEditor:e,onClose:()=>{T(!1)},isOpen:j})]})})}var jl=({setValue:e,value:t,name:a,editable:o=!0})=>{let[r]=(0,on.useLexicalComposerContext)(),i=(0,jt.useRef)(null),s=n=>{n.read(()=>{let l=n.toJSON();JSON.stringify(l)!==JSON.stringify(i.current)&&(i.current=l,e?.(()=>l))})};return(0,jt.useEffect)(()=>{r.setEditable(o)},[o,r]),(0,jt.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(i.current)&&r.update(()=>{try{let n=r.parseEditorState(t);r.setEditorState(n),i.current=t}catch(n){console.error("Error parsing editor state:",n)}},{discrete:!0})},[t,r]),(0,ci.jsx)("div",{className:"w-full",children:(0,ci.jsxs)("div",{className:" ",children:[o&&(0,ci.jsx)(wr,{}),(0,ci.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,ci.jsx)(mn.RichTextPlugin,{contentEditable:(0,ci.jsx)(ln.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:dn.LexicalErrorBoundary}),o&&(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(cn.HistoryPlugin,{}),(0,ci.jsx)(nn.AutoFocusPlugin,{}),(0,ci.jsx)(pn.ListPlugin,{}),(0,ci.jsx)(gn.OnChangePlugin,{onChange:s}),(0,ci.jsx)(ur,{})]})]})]})})},Ul=({setValue:e,value:t,name:a,editable:o=!0})=>(0,ci.jsx)(sn.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Vo.ListNode,Vo.ListItemNode,un.HeadingNode,lo],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl text-primary",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",ul:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,ci.jsx)(jl,{value:t,setValue:e,name:a,editable:o})}),vn=Ul;var hn=pe(require("react")),Nr=pe(require("@radix-ui/react-toggle"));var Cr=(0,li.cva)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),$l=hn.forwardRef(({className:e,variant:t,size:a,...o},r)=>(0,ci.jsx)(Nr.Root,{ref:r,className:S(Cr({variant:t,size:a,className:e})),...o}));$l.displayName=Nr.Root.displayName;var wa=pe(require("react")),Va=pe(require("@radix-ui/react-toggle-group"));var yn=wa.createContext({size:"default",variant:"default"}),Na=wa.forwardRef(({className:e,variant:t,size:a,children:o,...r},i)=>(0,ci.jsx)(Va.Root,{ref:i,className:S("flex items-center justify-center gap-1",e),...r,children:(0,ci.jsx)(yn.Provider,{value:{variant:t,size:a},children:o})}));Na.displayName=Va.Root.displayName;var Ca=wa.forwardRef(({className:e,children:t,variant:a,size:o,...r},i)=>{let s=wa.useContext(yn);return(0,ci.jsx)(Va.Item,{ref:i,className:S(Cr({variant:s.variant||a,size:s.size||o}),e),...r,children:t})});Ca.displayName=Va.Item.displayName;var Sr=pe(require("react")),It=pe(require("@radix-ui/react-scroll-area"));var Dr=Sr.forwardRef(({className:e,children:t,...a},o)=>(0,ci.jsxs)(It.Root,{ref:o,className:S("relative overflow-hidden",e),...a,children:[(0,ci.jsx)(It.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,ci.jsx)(wn,{}),(0,ci.jsx)(It.Corner,{})]}));Dr.displayName=It.Root.displayName;var wn=Sr.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,ci.jsx)(It.ScrollAreaScrollbar,{ref:o,orientation:t,className:S("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent ci-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent ci-[1px]",e),...a,children:(0,ci.jsx)(It.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));wn.displayName=It.ScrollAreaScrollbar.displayName;var Nn=pe(require("react")),_t=pe(require("@radix-ui/react-popover"));var kr=_t.Root,Pr=_t.Trigger;var Uo=Nn.forwardRef(({className:e,align:t="center",sideOffset:a=4,...o},r)=>(0,ci.jsx)(_t.Portal,{children:(0,ci.jsx)(_t.Content,{ref:r,align:t,sideOffset:a,className:S("ci-50 w-72 rounded-md border bg-popover ci-4 text-popover-foreground shadow-md outline-none 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),...o})}));Uo.displayName=_t.Content.displayName;var go=pe(require("@radix-ui/react-checkbox")),Sn=pe(require("react")),Rr=Sn.forwardRef(({className:e,...t},a)=>(0,$o.jsx)(go.Root,{className:S("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,$o.jsx)(go.Indicator,{className:S("flex items-center justify-center text-current"),children:(0,$o.jsx)(Pt.Check,{className:"h-4 w-4"})})}));Rr.displayName=go.Root.displayName;var Dn=require("react-day-picker");function zo({className:e,classNames:t,showOutsideDays:a=!0,...o}){return(0,ci.jsx)(Dn.DayPicker,{showOutsideDays:a,weekStartsOn:1,className:S("ci-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center ci-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:S(Ya({variant:"outline"}),"h-7 w-7 bg-transparent ci-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full ci-2",cell:S("relative ci-0 text-center text-sm focus-within:relative focus-within:ci-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:S(Ya({variant:"ghost"}),"h-8 w-8 ci-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},...o})}zo.displayName="Calendar";var fo=e=>"mimeType"in e&&"url"in e&&!("format"in e),zl=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let i=r.tag?parseInt(r.tag.replace("h","")):1,s=o(r.children||[]);return"#".repeat(i)+" "+s}case"paragraph":return o(r.children||[]);case"list":{let i=[],s=r.listType==="number"?"1.":"-";return r.children?.forEach((n,l)=>{if(n.type==="listitem"){let c=o(n.children||[]),d=r.listType==="number"?`${l+1}.`:s;i.push(`${d} ${c}`)}}),i.join(`
|
|
6
|
-
`)}case"listitem":return o(r.children||[]);case"text":{let i=r.text||"";if(r.format){let s=(r.format&1)!==0,n=(r.format&2)!==0,l=(r.format&4)!==0,
|
|
5
|
+
"use strict";var As=Object.create;var To=Object.defineProperty;var Es=Object.getOwnPropertyDescriptor;var Ms=Object.getOwnPropertyNames;var Is=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var Ls=(e,t)=>{for(var a in t)To(e,a,{get:t[a],enumerable:!0})},Qr=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ms(t))!Fs.call(e,r)&&r!==a&&To(e,r,{get:()=>t[r],enumerable:!(o=Es(t,r))||o.enumerable});return e};var ve=(e,t,a)=>(a=e!=null?As(Is(e)):{},Qr(t||!e||!e.__esModule?To(a,"default",{value:e,enumerable:!0}):a,e)),Bs=e=>Qr(To({},"__esModule",{value:!0}),e);var sd={};Ls(sd,{ColleaguesView:()=>sr,FileView:()=>xo,KnowledgeView:()=>Lr,PlanningView:()=>Xo,ProjectView:()=>Ur,ProjectsIndexView:()=>Gr,TeamsIndexView:()=>Zr});module.exports=Bs(sd);var Ut=require("react"),kt=require("lucide-react");var li=require("clsx");var ir="-",Hs=e=>{let t=Vs(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{let n=s.split(ir);return n[0]===""&&n.length!==1&&n.shift(),ai(n,t)||Os(s)},getConflictingClassGroupIds:(s,n)=>{let l=a[s]||[];return n&&o[s]?[...l,...o[s]]:l}}},ai=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],o=t.nextPart.get(a),r=o?ai(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;let i=e.join(ir);return t.validators.find(({validator:s})=>s(i))?.classGroupId},ei=/^\[(.+)\]$/,Os=e=>{if(ei.test(e)){let t=ei.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},Vs=e=>{let{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return Us(Object.entries(e.classGroups),a).forEach(([i,s])=>{rr(s,o,i,t)}),o},rr=(e,t,a,o)=>{e.forEach(r=>{if(typeof r=="string"){let i=r===""?t:ti(t,r);i.classGroupId=a;return}if(typeof r=="function"){if(js(r)){rr(r(o),t,a,o);return}t.validators.push({validator:r,classGroupId:a});return}Object.entries(r).forEach(([i,s])=>{rr(s,ti(t,i),a,o)})})},ti=(e,t)=>{let a=e;return t.split(ir).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},js=e=>e.isThemeGetter,Us=(e,t)=>t?e.map(([a,o])=>{let r=o.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,n])=>[t+s,n])):i);return[a,r]}):e,$s=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map,r=(i,s)=>{a.set(i,s),t++,t>e&&(t=0,o=a,a=new Map)};return{get(i){let s=a.get(i);if(s!==void 0)return s;if((s=o.get(i))!==void 0)return r(i,s),s},set(i,s){a.has(i)?a.set(i,s):r(i,s)}}},oi="!",zs=e=>{let{separator:t,experimentalParseClassName:a}=e,o=t.length===1,r=t[0],i=t.length,s=n=>{let l=[],m=0,d=0,f;for(let c=0;c<n.length;c++){let N=n[c];if(m===0){if(N===r&&(o||n.slice(c,c+i)===t)){l.push(n.slice(d,c)),d=c+i;continue}if(N==="/"){f=c;continue}}N==="["?m++:N==="]"&&m--}let g=l.length===0?n:n.substring(d),h=g.startsWith(oi),b=h?g.substring(1):g,w=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:b,maybePostfixModifierPosition:w}};return a?n=>a({className:n,parseClassName:s}):s},Ks=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},_s=e=>({cache:$s(e.cacheSize),parseClassName:zs(e),...Hs(e)}),Gs=/\s+/,Ws=(e,t)=>{let{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:r}=t,i=[],s=e.trim().split(Gs),n="";for(let l=s.length-1;l>=0;l-=1){let m=s[l],{modifiers:d,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:h}=a(m),b=!!h,w=o(b?g.substring(0,h):g);if(!w){if(!b){n=m+(n.length>0?" "+n:n);continue}if(w=o(g),!w){n=m+(n.length>0?" "+n:n);continue}b=!1}let c=Ks(d).join(":"),N=f?c+oi:c,O=N+w;if(i.includes(O))continue;i.push(O);let S=r(w,b);for(let D=0;D<S.length;++D){let J=S[D];i.push(N+J)}n=m+(n.length>0?" "+n:n)}return n};function Zs(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=ri(t))&&(o&&(o+=" "),o+=a);return o}var ri=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=ri(e[o]))&&(a&&(a+=" "),a+=t);return a};function qs(e,...t){let a,o,r,i=s;function s(l){let m=t.reduce((d,f)=>f(d),e());return a=_s(m),o=a.cache.get,r=a.cache.set,i=n,n(l)}function n(l){let m=o(l);if(m)return m;let d=Ws(l,a);return r(l,d),d}return function(){return i(Zs.apply(null,arguments))}}var Le=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},ii=/^\[(?:([a-pi-]+):)?(.+)\]$/i,Js=/^\d+\/\d+$/,Xs=new Set(["px","full","screen"]),Ys=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,el=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,tl=/^(inset_)?-?((\d+)?\.?(\d+)[a-pi]+|0)pi-?((\d+)?\.?(\d+)[a-pi]+|0)/,al=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qt=e=>Fa(e)||Xs.has(e)||Js.test(e),la=e=>La(e,"length",cl),Fa=e=>!!e&&!Number.isNaN(Number(e)),or=e=>La(e,"number",Fa),Ya=e=>!!e&&Number.isInteger(Number(e)),ol=e=>e.endsWith("%")&&Fa(e.slice(0,-1)),ne=e=>ii.test(e),da=e=>Ys.test(e),rl=new Set(["length","size","percentage"]),il=e=>La(e,rl,ni),nl=e=>La(e,"position",ni),sl=new Set(["image","url"]),ll=e=>La(e,sl,pl),dl=e=>La(e,"",ml),Qa=()=>!0,La=(e,t,a)=>{let o=ii.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},cl=e=>Qs.test(e)&&!el.test(e),ni=()=>!1,ml=e=>tl.test(e),pl=e=>al.test(e);var ul=()=>{let e=Le("colors"),t=Le("spacing"),a=Le("blur"),o=Le("brightness"),r=Le("borderColor"),i=Le("borderRadius"),s=Le("borderSpacing"),n=Le("borderWidth"),l=Le("contrast"),m=Le("grayscale"),d=Le("hueRotate"),f=Le("invert"),g=Le("gap"),h=Le("gradientColorStops"),b=Le("gradientColorStopPositions"),w=Le("inset"),c=Le("margin"),N=Le("opacity"),O=Le("padding"),S=Le("saturate"),D=Le("scale"),J=Le("sepia"),v=Le("skew"),A=Le("space"),R=Le("translate"),I=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],Se=()=>["auto",ne,t],V=()=>[ne,t],Re=()=>["",Qt,la],Be=()=>["auto",Fa,ne],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ce=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_e=()=>["start","end","center","between","around","evenly","stretch"],Ce=()=>["","0",ne],ge=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[Fa,ne];return{cacheSize:500,separator:":",theme:{colors:[Qa],spacing:[Qt,la],blur:["none","",da,ne],brightness:P(),borderColor:[e],borderRadius:["none","","full",da,ne],borderSpacing:V(),borderWidth:Re(),contrast:P(),grayscale:Ce(),hueRotate:P(),invert:Ce(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[ol,la],inset:Se(),margin:Se(),opacity:P(),padding:V(),saturate:P(),scale:P(),sepia:Ce(),skew:P(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",ne]}],container:["container"],columns:[{columns:[da]}],"break-after":[{"break-after":ge()}],"break-before":[{"break-before":ge()}],"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:[...L(),ne]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],pi:[{pi:["auto",Ya,ne]}],basis:[{basis:Se()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ne]}],grow:[{grow:Ce()}],shrink:[{shrink:Ce()}],order:[{order:["first","last","none",Ya,ne]}],"grid-cols":[{"grid-cols":[Qa]}],"col-start-end":[{col:["auto",{span:["full",Ya,ne]},ne]}],"col-start":[{"col-start":Be()}],"col-end":[{"col-end":Be()}],"grid-rows":[{"grid-rows":[Qa]}],"row-start-end":[{row:["auto",{span:[Ya,ne]},ne]}],"row-start":[{"row-start":Be()}],"row-end":[{"row-end":Be()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ne]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",..._e()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._e(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._e(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],pi:[{pi:[O]}],px:[{px:[O]}],py:[{py:[O]}],ps:[{ps:[O]}],pe:[{pe:[O]}],pt:[{pt:[O]}],pr:[{pr:[O]}],pb:[{pb:[O]}],pl:[{pl:[O]}],m:[{m:[c]}],mx:[{mx:[c]}],my:[{my:[c]}],ms:[{ms:[c]}],me:[{me:[c]}],mt:[{mt:[c]}],pi:[{pi:[c]}],mb:[{mb:[c]}],ml:[{ml:[c]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ne,t]}],"min-w":[{"min-w":[ne,t,"min","max","fit"]}],"max-w":[{"max-w":[ne,t,"none","full","min","max","fit","prose",{screen:[da]},da]}],h:[{h:[ne,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ne,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ne,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ne,t,"auto","min","max","fit"]}],"font-size":[{text:["base",da,la]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",or]}],"font-family":[{font:[Qa]}],"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",ne]}],"line-clamp":[{"line-clamp":["none",Fa,or]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qt,ne]}],"list-image":[{"list-image":["none",ne]}],"list-style-type":[{list:["none","disc","decimal",ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qt,la]}],"underline-offset":[{"underline-offset":["auto",Qt,ne]}],"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:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne]}],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",ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),nl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",il]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","pi","b","bl","l","tl"]},ll]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-pi":[{"rounded-pi":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[n]}],"border-w-x":[{"border-x":[n]}],"border-w-y":[{"border-y":[n]}],"border-w-s":[{"border-s":[n]}],"border-w-e":[{"border-e":[n]}],"border-w-t":[{"border-t":[n]}],"border-w-r":[{"border-r":[n]}],"border-w-b":[{"border-b":[n]}],"border-w-l":[{"border-l":[n]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...ce(),"hidden"]}],"divide-x":[{"divide-x":[n]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[n]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:ce()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ce()]}],"outline-offset":[{"outline-offset":[Qt,ne]}],"outline-w":[{outline:[Qt,la]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[Qt,la]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",da,dl]}],"shadow-color":[{shadow:[Qa]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",da,ne]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[S]}],sepia:[{sepia:[J]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[J]}],"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",ne]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",ne]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[Ya,ne]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ne]}],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","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","nr-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ne]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-pi":[{"scroll-pi":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-pi":[{"scroll-pi":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",ne]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Qt,la,or]}],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"],pi:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","pi","mb","ml"],mx:["pi","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-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-pi","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-pi"],"rounded-b":["rounded-pi","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-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-pi","scroll-mb","scroll-ml"],"scroll-mx":["scroll-pi","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-pi":["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 si=qs(ul);function T(...e){return si((0,li.clsx)(e))}var di=require("@radix-ui/react-slot"),ci=require("class-variance-authority"),mi=ve(require("react")),pi=require("react/jsx-runtime"),eo=(0,ci.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"}}}),x=mi.forwardRef(({asChild:e=!1,className:t,size:a,variant:o,...r},i)=>(0,pi.jsx)(e?di.Slot:"button",{className:T(eo({className:t,size:a,variant:o})),ref:i,...r}));x.displayName="Button";var ba=ve(require("react"));var Q=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Q.displayName="Card";var st=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("flex flex-col space-y-1.5 pi-6",e),...t}));st.displayName="CardHeader";var lt=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("font-semibold leading-none tracking-tight",e),...t}));lt.displayName="CardTitle";var to=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("text-sm text-muted-foreground",e),...t}));to.displayName="CardDescription";var ke=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("pi-6 pt-0",e),...t}));ke.displayName="CardContent";var ao=ba.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("div",{ref:a,className:T("flex items-center pi-6 pt-0",e),...t}));ao.displayName="CardFooter";var ui=ve(require("react"));var ee=ui.forwardRef(({className:e,type:t,...a},o)=>(0,pi.jsx)("input",{type:t,className:T("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}));ee.displayName="Input";var pe=ve(require("@radix-ui/react-select")),ca=ve(require("react")),Ye=pe.Root;var xt=pe.Value,We=ca.forwardRef(({children:e,className:t,...a},o)=>(0,pi.jsxs)(pe.Trigger,{className:T("flex h-10 w-full items-center justify-between rounded border border-input bg-background px-3 py-2 text-inherit ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),ref:o,...a,children:[e,(0,pi.jsx)(pe.Icon,{asChild:!0,children:(0,pi.jsx)(kt.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));We.displayName=pe.Trigger.displayName;var fi=ca.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pe.ScrollUpButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,pi.jsx)(kt.ChevronUp,{className:"h-4 w-4"})}));fi.displayName=pe.ScrollUpButton.displayName;var vi=ca.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pe.ScrollDownButton,{className:T("flex cursor-default items-center justify-center py-1",e),ref:a,...t,children:(0,pi.jsx)(kt.ChevronDown,{className:"h-4 w-4"})}));vi.displayName=pe.ScrollDownButton.displayName;var Ze=ca.forwardRef(({children:e,className:t,position:a="popper",...o},r)=>(0,pi.jsx)(pe.Portal,{children:(0,pi.jsxs)(pe.Content,{className:T("relative pi-50 max-h-96 min-w-[8rem] overflow-hidden rounded border bg-card 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,ref:r,...o,children:[(0,pi.jsx)(fi,{}),(0,pi.jsx)(pe.Viewport,{className:T("pi-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),(0,pi.jsx)(vi,{})]})}));Ze.displayName=pe.Content.displayName;var gl=ca.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pe.Label,{className:T("py-1.5 pl-8 pr-2 text-sm font-semibold",e),ref:a,...t}));gl.displayName=pe.Label.displayName;var he=ca.forwardRef(({children:e,className:t,...a},o)=>(0,pi.jsxs)(pe.Item,{className:T("relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),ref:o,...a,children:[(0,pi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,pi.jsx)(pe.ItemIndicator,{children:(0,pi.jsx)(kt.Check,{className:"h-4 w-4"})})}),(0,pi.jsx)(pe.ItemText,{children:e})]}));he.displayName=pe.Item.displayName;var fl=ca.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pe.Separator,{className:T("-mx-1 my-1 h-px bg-muted",e),ref:a,...t}));fl.displayName=pe.Separator.displayName;var nr=require("motion/react");var wa=ve(require("@radix-ui/react-tabs"));function hi({className:e,...t}){return(0,pi.jsx)(wa.Root,{"data-slot":"tabs",className:T("flex flex-col gap-2",e),...t})}function bi({className:e,...t}){return(0,pi.jsx)(wa.List,{"data-slot":"tabs-list",className:T("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg pi-[3px]",e),...t})}function xi({className:e,...t}){return(0,pi.jsx)(wa.Trigger,{"data-slot":"tabs-trigger",className:T("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 ea=ve(require("react")),ue=ve(require("@radix-ui/react-dropdown-menu")),Ba=require("@radix-ui/react-icons");var Ha=ue.Root,Oa=ue.Trigger;var vl=ea.forwardRef(({className:e,inset:t,children:a,...o},r)=>(0,pi.jsxs)(ue.SubTrigger,{ref:r,className:T("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,pi.jsx)(Ba.ChevronRightIcon,{className:"ml-auto"})]}));vl.displayName=ue.SubTrigger.displayName;var hl=ea.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(ue.SubContent,{ref:a,className:T("pi-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover pi-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}));hl.displayName=ue.SubContent.displayName;var Na=ea.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,pi.jsx)(ue.Portal,{children:(0,pi.jsx)(ue.Content,{ref:o,sideOffset:t,className:T("pi-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover pi-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=ue.Content.displayName;var Ca=ea.forwardRef(({className:e,inset:t,...a},o)=>(0,pi.jsx)(ue.Item,{ref:o,className:T("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}));Ca.displayName=ue.Item.displayName;var bl=ea.forwardRef(({className:e,children:t,checked:a,...o},r)=>(0,pi.jsxs)(ue.CheckboxItem,{ref:r,className:T("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,pi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,pi.jsx)(ue.ItemIndicator,{children:(0,pi.jsx)(Ba.CheckIcon,{className:"h-4 w-4"})})}),t]}));bl.displayName=ue.CheckboxItem.displayName;var xl=ea.forwardRef(({className:e,children:t,...a},o)=>(0,pi.jsxs)(ue.RadioItem,{ref:o,className:T("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,pi.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,pi.jsx)(ue.ItemIndicator,{children:(0,pi.jsx)(Ba.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));xl.displayName=ue.RadioItem.displayName;var yl=ea.forwardRef(({className:e,inset:t,...a},o)=>(0,pi.jsx)(ue.Label,{ref:o,className:T("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...a}));yl.displayName=ue.Label.displayName;var wl=ea.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(ue.Separator,{ref:a,className:T("-mx-1 my-1 h-px bg-muted",e),...t}));wl.displayName=ue.Separator.displayName;var Nl=({className:e,...t})=>(0,pi.jsx)("span",{className:T("ml-auto text-xs tracking-widest opacity-60",e),...t});Nl.displayName="DropdownMenuShortcut";function Po({activeTab:e,onTabChange:t,tabOptions:a,className:o="",maxWidth:r="700px",gridCols:i=6}){let s=a.find(n=>n.value===e);return(0,pi.jsxs)(nr.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,pi.jsx)("div",{className:"hidden lg:block",children:(0,pi.jsx)(hi,{value:e,onValueChange:t,children:(0,pi.jsx)(bi,{className:"grid w-full rounded-2xl pi-0 h-10",style:{maxWidth:r,gridTemplateColumns:`repeat(${Math.min(i,a.length)}, minmax(0, 1fr))`},children:a.map(n=>(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.1},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"flex-1 px-2",children:(0,pi.jsx)(xi,{value:n.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:n.label})},n.value))})})}),(0,pi.jsx)("div",{className:"lg:hidden",children:(0,pi.jsxs)(Ha,{children:[(0,pi.jsx)(Oa,{asChild:!0,children:(0,pi.jsxs)(x,{variant:"outline",className:"rounded-2xl min-w-[140px] justify-between",children:[s?.label||"Select",(0,pi.jsx)(kt.ChevronDown,{className:"h-4 w-4 ml-2"})]})}),(0,pi.jsx)(Na,{align:"center",className:"w-[180px]",children:a.map(n=>(0,pi.jsx)(Ca,{onClick:()=>t?.(n.value),className:`cursor-pointer ${e===n.value?"bg-accent":""}`,children:n.label},n.value))})]})})]})}var Ro=ve(require("react")),ta=ve(require("@radix-ui/react-avatar"));var oo=Ro.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(ta.Root,{ref:a,className:T("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));oo.displayName=ta.Root.displayName;var Cl=Ro.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(ta.Image,{ref:a,className:T("aspect-square h-full w-full",e),...t}));Cl.displayName=ta.Image.displayName;var ro=Ro.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(ta.Fallback,{ref:a,className:T("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ro.displayName=ta.Fallback.displayName;function wi({users:e,onUserSelect:t,onCancel:a,selectedUserId:o}){let[r,i]=(0,Ut.useState)(""),s=(0,Ut.useMemo)(()=>e.filter(l=>l.name?.toLowerCase().includes(r.toLowerCase())||l.email.toLowerCase().includes(r.toLowerCase())),[e,r]),n=l=>{t(l)};return(0,pi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,pi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,pi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,pi.jsx)(kt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)("h1",{className:"text-3xl font-bold",children:"Select User"}),(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"Choose a user to add as a colleague"})]})]}),(0,pi.jsx)(Q,{className:"container",children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsx)("div",{className:"flex flex-col md:flex-row gap-4",children:(0,pi.jsx)("div",{className:"flex-1",children:(0,pi.jsxs)("div",{className:"relative",children:[(0,pi.jsx)(kt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,pi.jsx)(ee,{placeholder:"Search users by name, email, role, or skills...",value:r,onChange:l=>i(l.target.value),className:"pl-9"})]})})})})}),(0,pi.jsx)("div",{className:"container grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:s.map(l=>(0,pi.jsx)(nr.motion.div,{layout:!0,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2},children:(0,pi.jsxs)(Q,{className:`cursor-pointer transition-all hover:shadow-lg ${o===l.id?"ring-2 ring-primary":""}`,onClick:()=>n(l),children:[(0,pi.jsx)(st,{className:"pb-3",children:(0,pi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,pi.jsx)(oo,{children:(0,pi.jsx)(ro,{children:(0,pi.jsx)(kt.User,{className:"h-4 w-4"})})}),(0,pi.jsx)("div",{children:(0,pi.jsx)(lt,{className:"text-lg",children:l.name})})]}),o===l.id&&(0,pi.jsx)(kt.Check,{className:"h-5 w-5 text-primary"})]})}),(0,pi.jsx)(ke,{className:"pt-0",children:(0,pi.jsxs)("div",{className:"space-y-3",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground",children:"Email"}),(0,pi.jsx)("pi",{className:"text-sm font-medium",children:l.email})]}),(0,pi.jsx)("div",{children:(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground",children:"Department"})})]})})]})},l.id))}),s.length===0&&(0,pi.jsx)(Q,{className:"container mt-4",children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsxs)("div",{className:"text-center py-8",children:[(0,pi.jsx)(kt.User,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,pi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No users found"}),(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"Try adjusting your search terms or filters."})]})})})]},"user-selection")})})}function Ni({onSelectHuman:e,onSelectDigital:t,onCancel:a}){return(0,pi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,pi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,pi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,pi.jsx)(kt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Colleague"}),(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"Choose the type of colleague to add"})]})]}),(0,pi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,pi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,pi.jsxs)(st,{className:"text-center pb-4",children:[(0,pi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,pi.jsx)(kt.User,{className:"h-8 w-8 text-blue-600"})}),(0,pi.jsx)(lt,{className:"text-xl",children:"Add Human Colleague"})]}),(0,pi.jsxs)(ke,{className:"text-center",children:[(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:"Select from existing users in your organization to add as team members."}),(0,pi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Users,{className:"h-4 w-4 text-blue-600"}),(0,pi.jsx)("span",{children:"Browse existing users"})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.User,{className:"h-4 w-4 text-blue-600"}),(0,pi.jsx)("span",{children:"Import user details automatically"})]})]}),(0,pi.jsx)(x,{className:"mt-6 w-full",onClick:e,children:"Select User"})]})]})}),(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,pi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,pi.jsxs)(st,{className:"text-center pb-4",children:[(0,pi.jsx)("div",{className:"mx-auto w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:(0,pi.jsx)(kt.Bot,{className:"h-8 w-8 text-purple-600"})}),(0,pi.jsx)(lt,{className:"text-xl",children:"Add Digital Colleague"})]}),(0,pi.jsxs)(ke,{className:"text-center",children:[(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:"Clone an existing digital colleague or create a new AI assistant for your team."}),(0,pi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Bot,{className:"h-4 w-4 text-purple-600"}),(0,pi.jsx)("span",{children:"Clone existing colleagues"})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Users,{className:"h-4 w-4 text-purple-600"}),(0,pi.jsx)("span",{children:"Create from templates"})]})]}),(0,pi.jsx)(x,{className:"mt-6 w-full",onClick:t,children:"Add Digital Colleague"})]})]})})]})]},"colleague-type-selection")})})}function Ci({onCloneExisting:e,onCreateNew:t,onCancel:a}){return(0,pi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-6",children:(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,pi.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,pi.jsxs)(x,{variant:"ghost",onClick:a,className:"gap-2",children:[(0,pi.jsx)(kt.ChevronLeft,{className:"h-4 w-4"}),"Back"]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)("h1",{className:"text-3xl font-bold",children:"Add Digital Colleague"}),(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"Choose how to create your digital colleague"})]})]}),(0,pi.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 max-w-4xl mx-auto",children:[(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,pi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:e,children:[(0,pi.jsxs)(st,{className:"text-center pb-4",children:[(0,pi.jsx)("div",{className:"mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,pi.jsx)(kt.Copy,{className:"h-8 w-8 text-blue-600"})}),(0,pi.jsx)(lt,{className:"text-xl",children:"Clone Existing"})]}),(0,pi.jsxs)(ke,{className:"text-center",children:[(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:"Start with an existing digital colleague and customize it for your needs."}),(0,pi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Bot,{className:"h-4 w-4 text-blue-600"}),(0,pi.jsx)("span",{children:"Pre-configured capabilities"})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Copy,{className:"h-4 w-4 text-blue-600"}),(0,pi.jsx)("span",{children:"Inherit knowledge base"})]})]}),(0,pi.jsx)(x,{className:"mt-6 w-full",onClick:e,children:"Browse & Clone"})]})]})}),(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:300,damping:20},children:(0,pi.jsxs)(Q,{className:"cursor-pointer transition-all hover:shadow-lg border-2 hover:border-primary/50",onClick:t,children:[(0,pi.jsxs)(st,{className:"text-center pb-4",children:[(0,pi.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,pi.jsx)(kt.Sparkles,{className:"h-8 w-8 text-green-600"})}),(0,pi.jsx)(lt,{className:"text-xl",children:"Create New"})]}),(0,pi.jsxs)(ke,{className:"text-center",children:[(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:"Build a completely new digital colleague from scratch with custom specifications."}),(0,pi.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4 text-green-600"}),(0,pi.jsx)("span",{children:"Custom job description"})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,pi.jsx)(kt.Sparkles,{className:"h-4 w-4 text-green-600"}),(0,pi.jsx)("span",{children:"Define unique capabilities"})]})]}),(0,pi.jsx)(x,{className:"mt-6 w-full",onClick:t,children:"Create from Scratch"})]})]})})]})]},"digital-colleague-options")})})}var Dl=(0,ci.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 Ee({className:e,variant:t,...a}){return(0,pi.jsx)("div",{className:T(Dl({variant:t}),e),...a})}function Ti(e,t){let[a,o]=(0,Ut.useState)(()=>{if(typeof window>"pi")return t;try{let i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch{return t}}),r=i=>{try{o(i),typeof window<"pi"&&window.localStorage.setItem(e,JSON.stringify(i))}catch{}};return(0,Ut.useEffect)(()=>{r(a)},[]),[a,r]}var Io=require("react-icons/kt");function mt({title:e,description:t,badge:a,primaryAction:o,secondaryAction:r,gradient:i,children:s,className:n}){let[l,m]=Ti(`hero-section-minimized-${e.replace(/\s+/g,"-").toLowerCase()}`,!r&&!t),d=!r&&!t||l;return(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:`overflow-hidden rounded-3xl ${i} pi-8 text-white ${n||""}`,children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,pi.jsx)(Ee,{className:"bg-white/20 text-white hover:bg-white/30 rounded-xl",children:a}),(0,pi.jsx)("h2",{className:"text-3xl font-bold m-0",children:e})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-3",children:[d&&o&&(0,pi.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),(r||t)&&(0,pi.jsx)("button",{"aria-label":l?"Expand hero section":"Minimize hero section",className:"rounded-full bg-white/20 hover:bg-white/30 pi-1 text-white transition-colors",onClick:()=>m(!l),style:{lineHeight:0},children:l?(0,pi.jsx)(Io.FaChevronDown,{size:22}):(0,pi.jsx)(Io.FaChevronUp,{size:22})})]})]}),!d&&(0,pi.jsxs)("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsx)("pi",{className:"max-w-[600px] text-white/80",children:t}),(0,pi.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o&&(0,pi.jsx)(x,{className:"rounded-2xl bg-white text-indigo-700 hover:bg-white/90",onClick:o.onClick,children:o.label}),r&&(0,pi.jsx)(x,{variant:"outline",className:"rounded-2xl bg-transparent border-white text-white hover:bg-white/10",onClick:r.onClick,children:r.label})]})]}),s&&(0,pi.jsx)("div",{className:"hidden lg:block",children:s})]})]})}function sr({initialColleagues:e,onColleagueAdd:t,onColleagueEdit:a,onColleagueDelete:o,compactView:r=!1,departments:i=["Design","Engineering","Marketing","Product","Sales","Operations"],className:s,availableUsers:n=[],existingDigitalColleagues:l=[]}){let[m,d]=(0,Ut.useState)(e||[]),[f,g]=(0,Ut.useState)(""),[h,b]=(0,Ut.useState)("all"),[w,c]=(0,Ut.useState)("all"),[N,O]=(0,Ut.useState)("all"),[S,D]=(0,Ut.useState)(null),[J,v]=(0,Ut.useState)(null);(0,Ut.useEffect)(()=>{d(e||[])},[e]);let A=Array.isArray(n)?n:[],R=Array.isArray(l)?l:[],[I,K]=(0,Ut.useState)("main"),Se=m.filter(H=>!H||!H.name?!1:H.name.toLowerCase().includes(f.toLowerCase())||H.type==="human"&&H.email?.toLowerCase().includes(f.toLowerCase())||H.type==="digital"&&H.jobDescription?.toLowerCase().includes(f.toLowerCase())),V=Se.filter(H=>H.type==="human"),Re=Se.filter(H=>H.type==="digital"),Be=()=>{K("typeSelection")},L=H=>{H.type==="digital"&&(D(H),K("form")),console.log("Editing colleague:",H),a?.(H)},ce=H=>{H.type==="digital"&&(v(H),K("view"))},fe=H=>{let He={id:`human-${Date.now()}`,type:"human",name:H.name||"",email:H.email,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};d(Te=>[...Te,He]),t?.(He),K("main")},_e=H=>{if(!H||!H.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",H);return}d(He=>[...He,H]),t?.(H),K("main")},Ce=()=>{D(null),K("form")},ge=H=>{if(!H||!H.id){console.error("Invalid colleague provided to handleSaveColleague:",H);return}S?(d(He=>He.map(Te=>Te.id===H.id?H:Te)),a?.(H)):(d(He=>[...He,H]),t?.(H)),K("main"),D(null)},P=()=>{K("main"),D(null),v(null)},le=()=>{K("main"),v(null)},$e=()=>{J&&(D(J),v(null),K("form"))},Dt=H=>{o?.(H,m.find(He=>He.id===H).type),d(He=>He.filter(Te=>Te.id!==H))},Ne=()=>{g(""),b("all"),c("all")},ht=()=>{let H=[];return R.forEach(Te=>{Te.knowledge&&Array.isArray(Te.knowledge)&&H.push(...Te.knowledge),Te.coreKnowledge&&Array.isArray(Te.coreKnowledge)&&H.push(...Te.coreKnowledge)}),m.forEach(Te=>{Te.type==="digital"&&(Te.knowledge&&Array.isArray(Te.knowledge)&&H.push(...Te.knowledge),Te.coreKnowledge&&Array.isArray(Te.coreKnowledge)&&H.push(...Te.coreKnowledge))}),H.filter((Te,Ot,Xt)=>Ot===Xt.findIndex(sa=>sa.id===Te.id))};return I==="typeSelection"?(0,pi.jsx)(Ni,{onSelectHuman:()=>K("userSelection"),onSelectDigital:()=>K("digitalOptions"),onCancel:()=>K("main")}):I==="userSelection"?(0,pi.jsx)(wi,{users:A,onUserSelect:fe,onCancel:()=>K("typeSelection")}):I==="digitalOptions"?(0,pi.jsx)(Ci,{onCloneExisting:()=>K("digitalClone"),onCreateNew:Ce,onCancel:()=>K("typeSelection")}):(0,pi.jsx)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsx)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,pi.jsxs)("div",{className:`space-y-6 ${s||""}`,children:[(0,pi.jsx)(mt,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:Be}}),(0,pi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,pi.jsxs)(Q,{children:[(0,pi.jsxs)(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,pi.jsx)(lt,{className:"text-sm font-medium",children:"Total Colleagues"}),(0,pi.jsx)(kt.Users,{className:"h-4 w-4 text-muted-foreground"})]}),(0,pi.jsxs)(ke,{children:[(0,pi.jsx)("div",{className:"text-2xl font-bold",children:m.length}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground"})]})]}),(0,pi.jsxs)(Q,{children:[(0,pi.jsxs)(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,pi.jsx)(lt,{className:"text-sm font-medium",children:"Human Members"}),(0,pi.jsx)(kt.User,{className:"h-4 w-4 text-muted-foreground"})]}),(0,pi.jsxs)(ke,{children:[(0,pi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(H=>H.type==="human").length}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground",children:"active"})]})]}),(0,pi.jsxs)(Q,{children:[(0,pi.jsxs)(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,pi.jsx)(lt,{className:"text-sm font-medium",children:"Digital Colleagues"}),(0,pi.jsx)(kt.Bot,{className:"h-4 w-4 text-muted-foreground"})]}),(0,pi.jsxs)(ke,{children:[(0,pi.jsx)("div",{className:"text-2xl font-bold",children:m.filter(H=>H.type==="digital").length}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground",children:"active"})]})]})]}),(0,pi.jsx)(Q,{children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,pi.jsx)("div",{className:"flex-1",children:(0,pi.jsxs)("div",{className:"relative",children:[(0,pi.jsx)(kt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,pi.jsx)(ee,{placeholder:"Search colleagues...",value:f,onChange:H=>g(H.target.value),className:"pl-9"})]})}),(0,pi.jsxs)(Ye,{value:h,onValueChange:b,children:[(0,pi.jsx)(We,{className:"w-full md:w-[180px]",children:(0,pi.jsx)(xt,{placeholder:"Department"})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)(he,{value:"all",children:"All Departments"}),i.map(H=>(0,pi.jsx)(he,{value:H,children:H},H))]})]}),(0,pi.jsxs)(Ye,{value:w,onValueChange:c,children:[(0,pi.jsx)(We,{className:"w-full md:w-[140px]",children:(0,pi.jsx)(xt,{placeholder:"Status"})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)(he,{value:"all",children:"All Status"}),(0,pi.jsx)(he,{value:"active",children:"Active"}),(0,pi.jsx)(he,{value:"inactive",children:"Inactive"})]})]}),(f||h!=="all"||w!=="all")&&(0,pi.jsxs)(x,{variant:"outline",onClick:Ne,className:"gap-2",children:[(0,pi.jsx)(kt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsx)(Po,{activeTab:N,onTabChange:O,tabOptions:[{value:"all",label:`All (${Se.length})`},{value:"human",label:`Human (${V.length})`},{value:"digital",label:`Digital (${Re.length})`}],maxWidth:"400px",gridCols:3}),N==="all"&&(0,pi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`}),N==="human"&&(0,pi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`}),N==="digital"&&(0,pi.jsx)("div",{className:`grid gap-4 ${r?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`})]}),Se.length===0&&(0,pi.jsx)(Q,{children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsxs)("div",{className:"text-center py-8",children:[(0,pi.jsx)(kt.Users,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,pi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No colleagues found"}),(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:f||h!=="all"||w!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),(0,pi.jsxs)(x,{onClick:Be,className:"gap-2",children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}var no=ve(require("react")),pt=ve(require("@radix-ui/react-dialog"));var qe=pt.Root;var lr=pt.Portal;var Lo=no.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pt.Overlay,{ref:a,className:T("fixed inset-0 pi-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}));Lo.displayName=pt.Overlay.displayName;var Qe=no.forwardRef(({className:e,children:t,...a},o)=>(0,pi.jsxs)(lr,{children:[(0,pi.jsx)(Lo,{}),(0,pi.jsxs)(pt.Content,{ref:o,className:T("fixed left-[50%] top-[50%] pi-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background pi-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,pi.jsxs)(pt.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,pi.jsx)(kt.pi,{className:"h-4 w-4"}),(0,pi.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Qe.displayName=pt.Content.displayName;var et=({className:e,...t})=>(0,pi.jsx)("div",{className:T("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});et.displayName="DialogHeader";var so=({className:e,...t})=>(0,pi.jsx)("div",{className:T("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});so.displayName="DialogFooter";var ze=no.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pt.Title,{ref:a,className:T("text-lg font-semibold leading-none tracking-tight",e),...t}));ze.displayName=pt.Title.displayName;var lo=no.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(pt.Description,{ref:a,className:T("text-sm text-muted-foreground",e),...t}));lo.displayName=pt.Description.displayName;var Mn=ve(require("@radix-ui/react-dialog"));var Ri=ve(require("react")),Pe=Ri.forwardRef(({className:e,...t},a)=>(0,pi.jsx)("textarea",{className:T("flex min-h-[80px] w-full rounded border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...t}));Pe.displayName="Textarea";var Ei=ve(require("react")),dr=ve(require("@radix-ui/react-label"));var Sl=(0,ci.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),E=Ei.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(dr.Root,{ref:a,className:T(Sl(),e),...t}));E.displayName=dr.Root.displayName;var ma=({fieldName:e,value:t,label:a,multiline:o=!1,onSave:r,className:i="",disabled:s=!1})=>{let[n,l]=(0,Ut.useState)(!1),[m,d]=(0,Ut.useState)(""),f=()=>{s||(l(!0),d(t))},g=async()=>{m!==t&&await r(e,m),l(!1)},h=b=>{b.key==="Enter"&&!o||b.key==="Enter"&&b.ctrlKey&&o?g():b.key==="Escape"&&(l(!1),d(""))};return(0,pi.jsxs)("div",{className:`space-y-2 ${i}`,children:[(0,pi.jsx)(E,{children:a}),n?o?(0,pi.jsx)(Pe,{value:m,onChange:b=>d(b.target.value),onBlur:g,onKeyDown:h,autoFocus:!0,rows:4,className:"resize-none"}):(0,pi.jsx)(ee,{value:m,onChange:b=>d(b.target.value),onBlur:g,onKeyPress:h,autoFocus:!0,className:"text-lg font-medium"}):(0,pi.jsxs)("div",{onClick:f,className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted/50 pi-2 rounded border border-transparent hover:border-border transition-colors group ${o?"min-h-[100px]":"min-h-[40px]"} flex items-start gap-2`,children:[(0,pi.jsx)("span",{className:o?"text-sm text-muted-foreground":"text-lg font-medium text-foreground",children:t||"Click to edit..."}),!s&&(0,pi.jsx)(kt.Edit,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})]})};var ln=require("@payloadcms/richtext-lexical/lexical/react/LexicalAutoFocusPlugin"),dn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposer"),cn=require("@payloadcms/richtext-lexical/lexical/react/LexicalContentEditable"),mn=require("@payloadcms/richtext-lexical/lexical/react/LexicalErrorBoundary"),pn=require("@payloadcms/richtext-lexical/lexical/react/LexicalHistoryPlugin"),un=require("@payloadcms/richtext-lexical/lexical/react/LexicalRichTextPlugin"),gn=require("@payloadcms/richtext-lexical/lexical/react/LexicalListPlugin"),Uo=require("@payloadcms/richtext-lexical/lexical/list"),fn=require("@payloadcms/richtext-lexical/lexical/rich-text"),vn=require("@payloadcms/richtext-lexical/lexical/react/LexicalOnChangePlugin");var nn=require("@payloadcms/richtext-lexical/lexical/react/LexicalComposerContext"),go=require("@payloadcms/richtext-lexical/lexical/utils"),se=require("@payloadcms/richtext-lexical/lexical"),wr=require("@payloadcms/richtext-lexical/lexical/selection");var _i=require("@radix-ui/react-dialog"),Vo=require("@payloadcms/richtext-lexical/client");var pr=ve(require("bson-objectid"));var Bi=require("@payloadcms/ui");var Li=ve(require("react")),$t=ve(require("@radix-ui/react-tooltip"));var Bo=$t.Provider,Ho=$t.Root,Oo=$t.Trigger,co=Li.forwardRef(({className:e,sideOffset:t=4,...a},o)=>(0,pi.jsx)($t.Portal,{children:(0,pi.jsx)($t.Content,{ref:o,sideOffset:t,className:T("pi-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})}));co.displayName=$t.Content.displayName;var Tl=e=>{let{data:{relationTo:t,value:a},nodeKey:o}=e,[r]=(0,nn.useLexicalComposerContext)(),[i,s]=(0,Ut.useState)(""),[n,l]=(0,Ut.useState)(""),[m,d]=(0,Ut.useState)(""),f=async c=>{console.log("fetchMedia",c)};(0,Ut.useEffect)(()=>{typeof a=="string"?a.length===24?f(a):(s(a||""),d(w(b())),l(h()||"")):typeof a=="object"&&(s(`${process.env.NEXT_PUBLIC_API_URL}${a.url}`||""),d(w(a.filesize)),l(a.mimeType?.split("/")[1]||""))},[]);let g=(0,Ut.useCallback)(()=>{r.update(()=>{(0,se.$getNodeByKey)(o)?.remove()})},[r,o]),h=()=>{let c=e.data.value;return typeof c=="string"?c.split(";base64")[0]?.split("image/")[1]:""},b=()=>{let c=e.data.value;if(typeof c=="string"){let N=c.split(",")[1]?.length||0;return 4*Math.ceil(N/3)*.5624896334383812/1e3}return 0};function w(c){if(c>=1e6){let O=c/1e6;return`${O>=10?Math.round(O).toString():O.toFixed(1)} MB`}return`${Math.floor(c/1e3)} KB`}return(0,pi.jsx)("div",{className:"my-2",contentEditable:!1,children:(0,pi.jsxs)("div",{className:"border border-slate-800 rounded-xl overflow-clip w-60 flex flex-col gap-2 bg-[#222222]",children:[(0,pi.jsxs)("div",{className:"flex gap-2 border-b border-b-slate-100/10",children:[(0,pi.jsx)("div",{className:"flex-1",children:e.data.value?(0,pi.jsx)("img",{className:"object-cover m-0 w-full min-w-[115px] min-h-[105px]","data-lexical-upload-id":a,"data-lexical-upload-relation-to":t,src:i}):(0,pi.jsx)(Bi.File,{})}),(0,pi.jsx)(Bo,{children:(0,pi.jsxs)(Ho,{children:[(0,pi.jsxs)(Oo,{className:"flex-1 flex justify-center items-center text-[#b5b5b5]",children:[(0,pi.jsx)("span",{className:"font-medium text-sm",children:"Media"}),(0,pi.jsx)("button",{onClick:c=>{c.preventDefault(),g()},className:"flex-1 flex justify-center items-center",children:(0,pi.jsx)(kt.pi,{width:24,height:24,strokeWidth:1})})]}),(0,pi.jsx)(co,{children:(0,pi.jsx)("span",{children:"Remove image"})})]})})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-center gap-4 py-3 flex-1 text-xs font-bold",children:[(0,pi.jsx)("span",{className:"",children:n?.toLocaleUpperCase()}),(0,pi.jsx)("span",{children:m})]})]})})},ji=Tl;function kl(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id");if(a)return{node:Ua({fields:{},relationTo:"media",value:a})}}return e.src.startsWith("file:///"),null}var mo=class extends Vo.UploadNode{static importDOM(){return{img:()=>({conversion:kl,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new pr.default().toHexString(),t.version=3);let a={id:t.id??new pr.default().toHexString(),fields:t.fields,relationTo:"media",value:t.value},o=Ua(a);return o.setFormat?.(t.format),o}decorate(){return(0,$i.jsx)(ji,{data:this.__data,nodeKey:this.getKey()})}};function Ua(e){return new mo({data:e})}var Pl=typeof window<"pi"&&typeof window.document<"pi"&&typeof window.document.createElement<"pi",Rl=e=>Pl?(e||window).getSelection():null,tm=(0,se.createCommand)("INSERT_UPLOAD_WITH_DRAWER_COMMAND"),ur=(0,se.createCommand)("INSERT_UPLOAD_COMMAND");function Gi({activeEditor:e,onClose:t,isOpen:a=!1}){let o=(0,Ut.useRef)(!1),[r,i]=(0,Ut.useState)(!0),[s,n]=(0,Ut.useState)(""),[l,m]=(0,Ut.useState)(""),[d,f]=(0,Ut.useState)(!1),[g,h]=(0,Ut.useState)("left"),b=s==="",w=D=>{f(D.target.checked)},c=D=>{h(D.target.value)},N=D=>{let J=new FileReader;J.onload=function(){return typeof J.result=="string"&&n(J.result),""},D!==null&&D[0]&&J.readAsDataURL(D[0])};(0,Ut.useEffect)(()=>{o.current=!1;let D=J=>{o.current=J.altKey};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[e]),(0,Ut.useEffect)(()=>{r||t()},[r]),(0,Ut.useEffect)(()=>{i(a)},[a]);let O=({editor:D,relationTo:J,replaceNodeKey:v,value:A})=>{if(v)D.update(()=>{let R=(0,se.$getNodeByKey)(v);R&&R.replace(Ua({id:"",fields:{},relationTo:"media",value:A}))});else{let R=D.dispatchCommand(ur,{fields:null,relationTo:"media",value:A})}},S=()=>{O({editor:e,relationTo:"media",replaceNodeKey:null,value:{altText:l,src:s,showCaption:d,position:g}.src}),i(!1),t()};return(0,pi.jsx)(qe,{open:r,onOpenChange:D=>i(D),children:(0,pi.jsxs)(Qe,{children:[(0,pi.jsxs)(et,{children:[(0,pi.jsx)(ze,{children:"Upload Image"}),(0,pi.jsx)(_i.DialogDescription,{children:"Description"})]}),(0,pi.jsxs)("div",{className:"",children:[(0,pi.jsx)("div",{style:{marginBottom:"1em"},children:(0,pi.jsx)(ee,{type:"file",onChange:D=>N(D.target.files),accept:"image/*","data-test-id":"image-modal-file-upload"})}),(0,pi.jsx)("div",{style:{marginBottom:"1em"},children:(0,pi.jsx)(ee,{"aria-label":"Alt Text",placeholder:"Descriptive alternative text",onChange:D=>m(D.currentTarget.value),value:l,"data-test-id":"image-modal-alt-text-input"})}),(0,pi.jsx)(x,{"data-test-id":"image-modal-file-upload-btn",disabled:b,onClick:()=>S(),children:"Confirm"})]})]})})}function gr({captionsEnabled:e}){let[t]=(0,nn.useLexicalComposerContext)();return(0,Ut.useEffect)(()=>{if(!t.hasNodes([Vo.UploadNode]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return(0,go.mergeRegister)(t.registerCommand(se.DRAGSTART_COMMAND,a=>Al(a),se.COMMAND_PRIORITY_HIGH),t.registerCommand(se.DRAGOVER_COMMAND,a=>El(a),se.COMMAND_PRIORITY_LOW),t.registerCommand(se.DROP_COMMAND,a=>Ml(a,t),se.COMMAND_PRIORITY_HIGH))},[e,t]),null}function Al(e){if(!fr())return!1;let a=e.dataTransfer;return a?(a.setData("text/plain","pi"),!0):!1}function El(e){return fr()?(Wi(e)||e.preventDefault(),!0):!1}function Ml(e,t){let a=fr();if(!a)return!1;if(e.preventDefault(),Wi(e)){let o=Il(e);a.remove();let r=(0,se.$createRangeSelection)();o!=null&&r.applyDOMRange(o),(0,se.$setSelection)(r)}return!0}function fr(){let e=(0,se.$getSelection)();if(!(0,se.$isNodeSelection)(e))return null;let a=e.getNodes()[0];return(0,Vo.$isUploadNode)(a)?a:null}function Wi(e){let t=e.target;return!!(t&&t instanceof HTMLElement&&!t.closest("code, span.editor-image")&&t.parentElement&&t.parentElement.closest("div.ContentEditable__root"))}function Il(e){let t,a=e.target,o=a==null?null:a.nodeType===9?a.defaultView:a.ownerDocument.defaultView,r=Rl(o);if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(e.clientX,e.clientY);else if(e.rangeParent&&r!==null)r.collapse(e.rangeParent,e.rangeOffset||0),t=r.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return t}var Fl=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})}),Zi=Fl;var Ll=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})}),qi=Ll;var Bl=()=>(0,pi.jsxs)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,pi.jsx)("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),(0,pi.jsx)("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]}),Ji=Bl;var Hl=()=>(0,pi.jsxs)("svg",{"aria-hidden":"true",className:"",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,pi.jsx)("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),(0,pi.jsx)("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]}),Xi=Hl;var Ol=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})}),Yi=Ol;var Vl=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})}),Qi=Vl;var en=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})}),tn=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})}),an=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})}),on=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})}),rn=()=>(0,pi.jsx)("svg",{"aria-hidden":"true",className:"w-5 size-5",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,pi.jsx)("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});var yr=1;function jl(){return(0,$.jsx)("span",{className:"border border-[#222222]"})}function Nr(){let[e]=(0,nn.useLexicalComposerContext)(),t=(0,Ut.useRef)(null),[a,o]=(0,Ut.useState)(!1),[r,i]=(0,Ut.useState)(!1),[s,n]=(0,Ut.useState)(!1),[l,m]=(0,Ut.useState)(!1),[d,f]=(0,Ut.useState)(!1),[g,h]=(0,Ut.useState)(!1),[b,w]=(0,Ut.useState)(!1),[c,N]=(0,Ut.useState)(!1),[O,S]=(0,Ut.useState)(!1),[D,J]=(0,Ut.useState)("left"),[v,A]=(0,Ut.useState)("pi"),R=L=>{e.update(()=>{let ce=(0,se.$getSelection)();(0,se.$isRangeSelection)(ce)&&(L==="pi"?(0,wr.$setBlocksType)(ce,()=>(0,se.$createParagraphNode)()):(0,wr.$setBlocksType)(ce,()=>(0,fn.$createHeadingNode)(L)))})},I=(0,Ut.useCallback)(()=>{let L=(0,se.$getSelection)();if((0,se.$isRangeSelection)(L)){n(L.hasFormat("bold")),m(L.hasFormat("italic")),f(L.hasFormat("underline")),h(L.hasFormat("strikethrough")),w(L.hasFormat("subscript")),N(L.hasFormat("superscript"));let ce=L.anchor.getNode(),fe=ce;for(;fe&&!(0,se.$isParagraphNode)(fe)&&fe!==(0,se.$getRoot)();){let Ce=fe.getParent();Ce&&(fe=Ce)}if(fe){let Ce=fe.getFormatType();J(Ce||"left")}let _e=ce.getTopLevelElement()?.__tag;A(_e||"pi")}},[]);(0,Ut.useEffect)(()=>(0,go.mergeRegister)(e.registerUpdateListener(({editorState:L})=>{L.read(()=>{I()})}),e.registerCommand(se.SELECTION_CHANGE_COMMAND,(L,ce)=>(I(),!1),yr),e.registerCommand(se.CAN_UNDO_COMMAND,L=>(o(L),!1),yr),e.registerCommand(se.CAN_REDO_COMMAND,L=>(i(L),!1),yr),(0,go.mergeRegister)(e.registerCommand(ur,L=>(e.update(()=>{let ce=(0,se.$getSelection)()||(0,se.$getPreviousSelection)();if((0,se.$isRangeSelection)(ce)){let fe=Ua({id:L.id,fields:L.fields,relationTo:L.relationTo,value:L.value}),{focus:_e}=ce,Ce=_e.getNode();(0,go.$insertNodeToNearestRoot)(fe),(0,se.$isParagraphNode)(Ce)&&!Ce.__first&&Ce.remove()}}),!0),se.COMMAND_PRIORITY_EDITOR))),[e,I]);let K=[[{label:"Undo",icon:(0,$.jsx)(kt.RotateCcw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.UNDO_COMMAND,void 0)},disabled:!a},{label:"Redo",icon:(0,$.jsx)(kt.RotateCw,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.UNDO_COMMAND,void 0)},disabled:!r}],[{label:"Bold",icon:(0,$.jsx)(Zi,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"bold")},value:"bold",active:s},{label:"Italic",icon:(0,$.jsx)(qi,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"italic")},value:"italic",active:l},{label:"Underline",icon:(0,$.jsx)(Ji,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"underline")},value:"underline",active:d},{label:"Strikethrough",icon:(0,$.jsx)(Xi,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"strikethrough")},value:"strikethrough",active:g},{label:"Subscript",icon:(0,$.jsx)(Yi,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"subscript")},value:"subscript",active:b},{label:"Superscript",icon:(0,$.jsx)(Qi,{}),onClick:()=>{e.dispatchCommand(se.FORMAT_TEXT_COMMAND,"superscript")},value:"superscript",active:c}]],Se=[{label:"Left Align",direction:"left",icon:(0,$.jsx)(kt.AlignLeft,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.FORMAT_ELEMENT_COMMAND,"left")}},{label:"Center Align",direction:"center",icon:(0,$.jsx)(kt.AlignCenter,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.FORMAT_ELEMENT_COMMAND,"center")}},{label:"Right Align",direction:"right",icon:(0,$.jsx)(kt.AlignRight,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.FORMAT_ELEMENT_COMMAND,"right")}},{label:"Justify Align",direction:"justify",icon:(0,$.jsx)(kt.AlignJustify,{width:15,height:15}),onClick:()=>{e.dispatchCommand(se.FORMAT_ELEMENT_COMMAND,"justify")}}],Re=[{label:"Normal Text",value:"pi",icon:(0,$.jsx)(en,{}),onClick:()=>R("pi")},{label:"Heading 1",value:"h1",icon:(0,$.jsx)(tn,{}),onClick:()=>R("h1")},{label:"Heading 2",value:"h2",icon:(0,$.jsx)(an,{}),onClick:()=>R("h2")},{label:"Heading 3",value:"h3",icon:(0,$.jsx)(on,{}),onClick:()=>R("h3")},{label:"Heading 4",value:"h4",icon:(0,$.jsx)(rn,{}),onClick:()=>R("h4")},...[{label:"Unordered List",value:"ul",icon:(0,$.jsx)(kt.List,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Uo.INSERT_UNORDERED_LIST_COMMAND,void 0)}},{label:"Ordered List",value:"ol",icon:(0,$.jsx)(kt.ListOrdered,{width:15,height:15}),onClick:()=>{e.dispatchCommand(Uo.INSERT_ORDERED_LIST_COMMAND,void 0)}}]],Be=[{label:"Insert Image",icon:(0,$.jsx)(kt.ImageUp,{width:15,height:15}),onClick:()=>{S(!0)},disabled:!1}];return(0,$.jsx)("div",{className:"flex justify-between border border-[#222222] py-2 px-2 sticky top-0 bg-black pi-50",children:(0,$.jsxs)("div",{className:"flex gap-2 ",ref:t,children:[K.map((L,ce)=>(0,$.jsxs)(Ut.Fragment,{children:[(0,$.jsx)("div",{className:"flex items-center gap-2",children:L.map((fe,_e)=>(0,$.jsx)("div",{role:"button","aria-disabled":fe.disabled||!1,onClick:fe.onClick,className:T("pi-1 transition-all flex items-center justify-center rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",fe.active&&"bg-[#3c3c3c]"),"aria-label":fe.label,children:(0,$.jsx)(Bo,{children:(0,$.jsxs)(Ho,{children:[(0,$.jsx)(Oo,{className:"text-[#b5b5b5]",children:fe.icon}),(0,$.jsx)(co,{children:(0,$.jsx)("pi",{children:fe.label})})]})})},_e))}),(0,$.jsx)(jl,{})]},`toolbar-option-${L.length}-${ce}`)),(0,$.jsxs)(Ha,{children:[(0,$.jsxs)(Oa,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[Se.find(L=>L.direction===D)?.icon,Se.find(L=>L.direction===D)?.label,(0,$.jsx)(kt.ChevronDown,{width:15,height:15})]}),(0,$.jsx)(Na,{className:"bg-black hover:bg-black",children:Se.map((L,ce)=>(0,$.jsxs)(Ca,{onClick:L.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,$.jsx)("span",{children:L.icon}),(0,$.jsx)("span",{children:L.label})]},`${L.label}-${ce}`))})]}),(0,$.jsxs)(Ha,{children:[(0,$.jsxs)(Oa,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[Re.find(L=>L.value===v)?.icon,Re.find(L=>L.value===v)?.label,(0,$.jsx)(kt.ChevronDown,{width:15,height:15})]}),(0,$.jsx)(Na,{className:"bg-black hover:bg-black",children:Re.map((L,ce)=>(0,$.jsxs)(Ca,{onClick:L.onClick,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,$.jsx)("span",{children:L.icon}),(0,$.jsx)("span",{children:L.label})]},`heading-option-${L.label}-${ce}`))})]}),(0,$.jsxs)(Ha,{children:[(0,$.jsxs)(Oa,{className:"flex items-center justify-center gap-2 px-2 py-1 rounded hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c] text-[#b5b5b5] text-xs",children:[(0,$.jsx)(kt.Plus,{width:15,height:15}),(0,$.jsx)(kt.ChevronDown,{width:15,height:15})]}),(0,$.jsx)(Na,{className:"bg-black hover:bg-black",children:Be.map((L,ce)=>(0,$.jsxs)(Ca,{onClick:L.onClick,disabled:L.disabled,className:"flex items-center gap-2 text-xs text-[#b5b5b5] hover:bg-[#3c3c3c] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[#3a3a3a] focus:ring-[#3c3c3c]",children:[(0,$.jsx)("span",{children:L.icon}),(0,$.jsx)("span",{children:L.label})]},ce))})]}),O&&(0,$.jsx)(Gi,{activeEditor:e,onClose:()=>{S(!1)},isOpen:O})]})})}var Ul=({setValue:e,value:t,name:a,editable:o=!0})=>{let[r]=(0,nn.useLexicalComposerContext)(),i=(0,Ut.useRef)(null),s=n=>{n.read(()=>{let l=n.toJSON();JSON.stringify(l)!==JSON.stringify(i.current)&&(i.current=l,e?.(()=>l))})};return(0,Ut.useEffect)(()=>{r.setEditable(o)},[o,r]),(0,Ut.useEffect)(()=>{t&&JSON.stringify(t)!==JSON.stringify(i.current)&&r.update(()=>{try{let n=r.parseEditorState(t);r.setEditorState(n),i.current=t}catch(n){console.error("Error parsing editor state:",n)}},{discrete:!0})},[t,r]),(0,pi.jsx)("div",{className:"w-full",children:(0,pi.jsxs)("div",{className:" ",children:[o&&(0,pi.jsx)(Nr,{}),(0,pi.jsxs)("div",{className:"px-4 my-4 border-l border-[#222222]",children:[(0,pi.jsx)(un.RichTextPlugin,{contentEditable:(0,pi.jsx)(cn.ContentEditable,{name:a,className:"focus:outline-none focus:ring-0 focus-visible:outline-none min-h-40"}),ErrorBoundary:mn.LexicalErrorBoundary}),o&&(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsx)(pn.HistoryPlugin,{}),(0,pi.jsx)(ln.AutoFocusPlugin,{}),(0,pi.jsx)(gn.ListPlugin,{}),(0,pi.jsx)(vn.OnChangePlugin,{onChange:s}),(0,pi.jsx)(gr,{})]})]})]})})},$l=({setValue:e,value:t,name:a,editable:o=!0})=>(0,pi.jsx)(dn.LexicalComposer,{initialConfig:{namespace:"Lexical editor",nodes:[Uo.ListNode,Uo.ListItemNode,fn.HeadingNode,mo],onError(i){throw console.error("Lexical error:",i),i},theme:{code:"editor-code",heading:{h1:"text-4xl text-primary",h2:"text-3xl",h3:"text-2xl",h4:"text-lg",h5:"text-sm"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"list-decimal",ul:"list-disc"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold font-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough line-through",underline:"editor-text-underline underline",underlineStrikethrough:"underline line-through"}}},children:(0,pi.jsx)(Ul,{value:t,setValue:e,name:a,editable:o})}),bn=$l;var xn=ve(require("react")),Cr=ve(require("@radix-ui/react-toggle"));var Dr=(0,ci.cva)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),zl=xn.forwardRef(({className:e,variant:t,size:a,...o},r)=>(0,pi.jsx)(Cr.Root,{ref:r,className:T(Dr({variant:t,size:a,className:e})),...o}));zl.displayName=Cr.Root.displayName;var Da=ve(require("react")),$a=ve(require("@radix-ui/react-toggle-group"));var Nn=Da.createContext({size:"default",variant:"default"}),Sa=Da.forwardRef(({className:e,variant:t,size:a,children:o,...r},i)=>(0,$o.jsx)($a.Root,{ref:i,className:T("flex items-center justify-center gap-1",e),...r,children:(0,$o.jsx)(Nn.Provider,{value:{variant:t,size:a},children:o})}));Sa.displayName=$a.Root.displayName;var Ta=Da.forwardRef(({className:e,children:t,variant:a,size:o,...r},i)=>{let s=Da.useContext(Nn);return(0,$o.jsx)($a.Item,{ref:i,className:T(Dr({variant:s.variant||a,size:s.size||o}),e),...r,children:t})});Ta.displayName=$a.Item.displayName;var Sr=ve(require("react")),Mt=ve(require("@radix-ui/react-scroll-area"));var Tr=Sr.forwardRef(({className:e,children:t,...a},o)=>(0,pi.jsxs)(Mt.Root,{ref:o,className:T("relative overflow-hidden",e),...a,children:[(0,pi.jsx)(Mt.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),(0,pi.jsx)(Cn,{}),(0,pi.jsx)(Mt.Corner,{})]}));Tr.displayName=Mt.Root.displayName;var Cn=Sr.forwardRef(({className:e,orientation:t="vertical",...a},o)=>(0,pi.jsx)(Mt.ScrollAreaScrollbar,{ref:o,orientation:t,className:T("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent pi-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent pi-[1px]",e),...a,children:(0,pi.jsx)(Mt.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Cn.displayName=Mt.ScrollAreaScrollbar.displayName;var Dn=ve(require("react")),Gt=ve(require("@radix-ui/react-popover"));var Pr=Gt.Root,Rr=Gt.Trigger;var zo=Dn.forwardRef(({className:e,align:t="center",sideOffset:a=4,...o},r)=>(0,pi.jsx)(Gt.Portal,{children:(0,pi.jsx)(Gt.Content,{ref:r,align:t,sideOffset:a,className:T("pi-50 w-72 rounded-md border bg-popover pi-4 text-popover-foreground shadow-md outline-none 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),...o})}));zo.displayName=Gt.Content.displayName;var vo=ve(require("@radix-ui/react-checkbox")),Tn=ve(require("react")),Ar=Tn.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(vo.Root,{className:T("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,pi.jsx)(vo.Indicator,{className:T("flex items-center justify-center text-current"),children:(0,pi.jsx)(kt.Check,{className:"h-4 w-4"})})}));Ar.displayName=vo.Root.displayName;var kn=require("react-day-picker");function _o({className:e,classNames:t,showOutsideDays:a=!0,...o}){return(0,pi.jsx)(kn.DayPicker,{showOutsideDays:a,weekStartsOn:1,className:T("pi-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:T(eo({variant:"outline"}),"h-7 w-7 bg-transparent pi-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:T("relative pi-0 text-center text-sm focus-within:relative focus-within:pi-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:T(eo({variant:"ghost"}),"h-8 w-8 pi-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},...o})}_o.displayName="Calendar";var ho=e=>"mimeType"in e&&"url"in e&&!("format"in e),Kl=e=>{if(!e?.root?.children)return"";let t=[],a=r=>{if(!r)return"";switch(r.type){case"heading":{let i=r.tag?parseInt(r.tag.replace("h","")):1,s=o(r.children||[]);return"#".repeat(i)+" "+s}case"paragraph":return o(r.children||[]);case"list":{let i=[],s=r.listType==="number"?"1.":"-";return r.children?.forEach((n,l)=>{if(n.type==="listitem"){let m=o(n.children||[]),d=r.listType==="number"?`${l+1}.`:s;i.push(`${d} ${m}`)}}),i.join(`
|
|
6
|
+
`)}case"listitem":return o(r.children||[]);case"text":{let i=r.text||"";if(r.format){let s=(r.format&1)!==0,n=(r.format&2)!==0,l=(r.format&4)!==0,m=(r.format&8)!==0;(r.format&16)!==0?i=`\`${i}\``:(s&&(i=`**${i}**`),n&&(i=`*${i}*`),l&&(i=`~~${i}~~`),m&&(i=`<pi>${i}</pi>`))}return i}default:return r.children?o(r.children):""}},o=r=>r.map(i=>{if(i.type==="text"){let s=i.text||"";if(i.format){let n=(i.format&1)!==0,l=(i.format&2)!==0,m=(i.format&4)!==0,d=(i.format&8)!==0;(i.format&16)!==0?s=`\`${s}\``:(n&&(s=`**${s}**`),l&&(s=`*${s}*`),m&&(s=`~~${s}~~`),d&&(s=`<pi>${s}</pi>`))}return s}else{if(i.type==="paragraph")return o(i.children||[]);if(i.type==="listitem")return o(i.children||[]);if(i.type==="linebreak")return`
|
|
7
7
|
`}return a(i)}).filter(Boolean).join("");return e.root.children.forEach(r=>{let i=a(r);i&&t.push(i)}),t.join(`
|
|
8
8
|
|
|
9
|
-
`)},
|
|
10
|
-
`),a=[],o=[],r=[],i=()=>{if(o.length>0){let n=o.join(" "),l=Sa(n);a.push({type:"paragraph",children:l.length>0?l:[{type:"text",text:"",format:0}]}),o=[]}},s=()=>{r.length>0&&(a.push({type:"list",listType:"bullet",children:r}),r=[])};for(let n of t){let l=n.trim();if(!l){i(),s();continue}let c=l.match(/^(#{1,6})\s+(.+)$/);if(c){i(),s();let g=c[1].length,v=c[2],x=Sa(v);a.push({type:"heading",tag:`h${g}`,children:x.length>0?x:[{type:"text",text:"",format:0}]});continue}let d=l.match(/^[-*+]\s+(.+)$/);if(d){i();let g=d[1],v=Sa(g);r.push({type:"listitem",children:[{type:"paragraph",children:v.length>0?v:[{type:"text",text:"",format:0}]}]});continue}r.length>0&&s(),o.push(l)}return i(),s(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},_l=async e=>{let t="",a,o="text";if(e.url)try{let r=e.url;!r.startsWith("http://")&&!r.startsWith("https://")&&!r.startsWith("/")&&(r="/"+r),console.log("Fetching file content from URL:",r);let i=await fetch(r);i.ok?(t=await i.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",i.status,i.statusText)}catch(r){throw console.error("Failed to fetch file content:",r),r}else console.warn("jt URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",console.log("Converting markdown to Lexical, content length:",t.length),a=Kl(t),console.log("Converted Lexical JSON:",JSON.stringify(a,null,2))):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function Pn({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[r,i]=(0,jt.useState)(fo(e)),[s,n]=(0,jt.useState)(fo(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[l,c]=(0,jt.useState)(fo(e)?void 0:s.richTextContent),[d,g]=(0,jt.useState)(!1),v=(0,jt.useRef)(fo(e)?e:null);(0,jt.useEffect)(()=>{fo(e)?(i(!0),_l(e).then(u=>{console.log("Loaded content:",u),n(u),c(u.richTextContent),i(!1)}).catch(u=>{console.error("Failed to convert file:",u),i(!1)})):(n({...e,updatedAt:new Date}),c(e.richTextContent))},[e]);let x=u=>{switch(u){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-success"});case"text":return(0,ci.jsx)(Pt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-muted-foreground"})}},b=u=>{switch(u){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},y=async()=>{g(!0);try{let u,F;if(v.current&&v.current.mimeType==="text/markdown"){let T=l?zl(l):"";u={...s,format:"markdown",content:T,richTextContent:void 0},F=T}else u={...s,richTextContent:l},F=s.content||"";let j=v.current?v.current.id.toString():s.id;await Promise.resolve(a()),o?.(j,F)}finally{g(!1)}};return(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,ci.jsx)("div",{className:"border-b border-border bg-card ci-8 pb-6",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,ci.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,ci.jsx)("div",{className:"flex-1 min-w-0",children:(0,ci.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,ci.jsx)("div",{className:"flex-1 min-w-0",children:(0,ci.jsx)(da,{fieldName:"title",value:s.title,label:"",onSave:(u,F)=>n(j=>({...j,title:F})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:ci-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,ci.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${b(s.format)} flex-shrink-0 ci-1`,children:s.format.toUpperCase()})]})})}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,ci.jsxs)(w,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Close"]}),(0,ci.jsxs)(w,{size:"sm",onClick:y,className:"gap-2",disabled:d,children:[d?(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}):(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),d?"Saving...":"Save"]})]})]})}),(0,ci.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,ci.jsx)("div",{className:"ci-8 ci-0 h-full max-h-full overflow-auto",children:r?(0,ci.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,ci.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,ci.jsx)(Pt.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,ci.jsx)(ci.Fragment,{children:s.format==="richText"?(0,ci.jsx)(vn,{setValue:c,value:l,name:"richTextContent"},`richtext-${s.id}-${r?"loading":"loaded"}`):(0,ci.jsx)(Se,{value:s.content||"",onChange:u=>n(F=>({...F,content:u.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var Gl=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Go({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:r=!0,className:i}){let[s,n]=(0,jt.useState)(!1),[l,c]=(0,jt.useState)(!1),[d,g]=(0,jt.useState)(null),v=()=>{n(!1),g(null)},x=()=>{c(!0),setTimeout(()=>{c(!1),n(!1),g(null)},500)},b=y=>{g(y),n(!0)};return(0,ci.jsxs)("div",{className:`rounded-3xl border overflow-hidden ${i||""}`,children:[r&&(0,ci.jsxs)("div",{className:"bg-muted/50 ci-3 hidden md:grid md:grid-cols-10 text-sm font-medium",children:[(0,ci.jsx)("div",{className:"col-span-6",children:"Name"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Size"}),(0,ci.jsx)("div",{className:"col-span-2",children:"Modified"})]}),(0,ci.jsx)("div",{className:"divide-y",children:e.map(y=>(0,ci.jsxs)(ir.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"ci-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(y),children:[(0,ci.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,ci.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,ci.jsx)("div",{children:(0,ci.jsx)("ci",{className:"font-medium",children:y.name})})]}),(0,ci.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:Gl(y.filesize)}),(0,ci.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,ci.jsx)("span",{className:"text-sm md:text-base",children:new Date(y.createdAt).toLocaleDateString()}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[y.mimeType==="text/markdown"&&(0,ci.jsx)(w,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:u=>{u.stopPropagation(),b(y)},children:(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"})}),(0,ci.jsx)(w,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:u=>{u.stopPropagation(),a?.(y)},children:(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4"})})]})]})]},y.name))}),(0,ci.jsx)(We,{open:s,onOpenChange:y=>!y&&v(),children:(0,ci.jsxs)(sr,{children:[(0,ci.jsx)(Io,{}),(0,ci.jsxs)(An.Content,{className:S("fixed inset-0 ci-50 bg-background ci-0 ci-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[l&&(0,ci.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center ci-50",children:(0,ci.jsx)(Pt.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),d&&(0,ci.jsx)(Pn,{document:d,onSave:x,onFileUpdate:o,onCancel:v})]})]})})]})}var Mn=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,r]=(0,jt.useState)(null),[i,s]=(0,jt.useState)(""),[n,l]=(0,jt.useState)(""),[c,d]=(0,jt.useState)(""),g=x=>{let b=x.target.files?.[0];b&&(r(b),i||s(b.name))},v=async x=>{if(x.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",i),n&&b.append("description",n),c&&b.append("tags",c),a?.(b),t(),r(null),s(""),l(""),d("")};return(0,ci.jsx)(We,{open:e,onOpenChange:t,children:(0,ci.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Add New File"})}),(0,ci.jsxs)("form",{onSubmit:v,className:"grid gap-4",children:[(0,ci.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,ci.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,ci.jsxs)("div",{className:"flex flex-col items-center justify-center ci-5 pb-6",children:[(0,ci.jsx)(Wl,{className:"w-10 h-10 text-gray-400"}),(0,ci.jsxs)("ci",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,ci.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,ci.jsx)("ci",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,ci.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:g})]})}),o&&(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("ci",{className:"font-medium",children:o.name}),(0,ci.jsxs)("ci",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,ci.jsx)(w,{type:"submit",onClick:v,children:"Upload"})]})]})]})})};function Wl(e){return(0,ci.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ci.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,ci.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,ci.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function ho({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:r,onFileUpdate:i,compactView:s=!1,className:n}){let[l,c]=(0,jt.useState)(e),[d,g]=(0,jt.useState)(""),[v,x]=(0,jt.useState)("all"),[b,y]=(0,jt.useState)("all"),[u,F]=(0,jt.useState)(!1),j=(0,jt.useRef)(""),T=R=>R.map(ve=>`${ve.id}-${new Date(ve.createdAt).getTime()}-${new Date(ve.updatedAt).getTime()}`).join("-");(0,jt.useEffect)(()=>{let R=T(e.map(ve=>({...ve,updatedAt:new Date().toISOString()})));R!==j.current&&(c(e),j.current=R)},[e]);let C=l.filter(R=>R.name.toLowerCase().includes(d.toLowerCase())),W=C.slice(0,10),h=C.filter(Boolean),P=()=>{F(!0)},k=R=>{a?.(R)},B=R=>{console.log("deleting file",R),c(ve=>ve.filter(be=>be.name!==R.name)),o?.(R.id.toString())},G=R=>{r?.(R)},ke=()=>{g(""),x("all")};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsx)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,ci.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,ci.jsx)(dt,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:P},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,ci.jsx)(X,{children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)(Pt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,ci.jsx)(Y,{placeholder:"Search files...",value:d,onChange:R=>g(R.target.value),className:"pl-9"})]})}),(d||v!=="all")&&(0,ci.jsxs)(w,{variant:"outline",onClick:ke,className:"gap-2",children:[(0,ci.jsx)(Pt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)(To,{activeTab:b,onTabChange:y,tabOptions:[{value:"all",label:`All Files (${C.length})`},{value:"recent",label:`Recent (${W.length})`}],maxWidth:"500px",gridCols:3}),b==="all"&&(0,ci.jsx)(Go,{files:C,onFileClick:G,onFileUpdate:i,onFileDelete:B,showHeader:!s}),b==="recent"&&(0,ci.jsx)(Go,{files:W,onFileClick:G,onFileUpdate:i,onFileDelete:B,showHeader:!s}),b==="shared"&&(0,ci.jsx)(Go,{files:h,onFileClick:G,onFileUpdate:i,onFileDelete:B,showHeader:!s})]}),C.length===0&&(0,ci.jsx)(X,{children:(0,ci.jsx)(Ce,{className:"ci-6",children:(0,ci.jsxs)("div",{className:"text-center py-8",children:[(0,ci.jsx)(Pt.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,ci.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"jt files found"}),(0,ci.jsx)("ci",{className:"text-muted-foreground mb-4",children:d||v!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,ci.jsxs)(w,{onClick:P,className:"gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,ci.jsx)(Mn,{isOpen:u,onClose:()=>F(!1),onAddFile:t})]})}function In({document:e,onSave:t,onCancel:a,availableDocuments:o=[],knowledgeContexts:r=[]}){let[i,s]=(0,jt.useState)({...e,updatedAt:new Date}),[n,l]=(0,jt.useState)(!1),[c,d]=(0,jt.useState)(()=>{let h=[],P=0,k=new Set;return r.forEach(B=>{B.menuConfig.groupBy.forEach(G=>k.add(G))}),k.forEach(B=>{h.push({id:`context_field_${P++}`,key:B,value:e.metadata?.[B]?String(e.metadata[B]):"",isContextKey:!0})}),e.metadata&&Object.entries(e.metadata).forEach(([B,G])=>{k.has(B)||h.push({id:`existing_field_${P++}`,key:B,value:String(G),isContextKey:!1})}),h}),g=h=>{switch(h){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-6 w-6 text-primary"});case"richtext":return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-success"});case"text":return(0,ci.jsx)(Pt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-muted-foreground"})}},v=h=>{switch(h){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richtext":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},x=()=>{let h=new Set;return o.forEach(P=>{P.metadata&&Object.keys(P.metadata).forEach(k=>h.add(k))}),{documentKeys:Array.from(h).sort()}},b=h=>{let P=new Set;return o.forEach(k=>{k.metadata?.[h]&&P.add(String(k.metadata[h]))}),Array.from(P).sort()},y=x(),u=()=>{t(i)};(0,jt.useEffect)(()=>{let h=c.filter(P=>P.key.trim()!==""&&P.value.trim()!=="").reduce((P,k)=>({...P,[k.key]:k.value}),{});s(P=>({...P,metadata:Object.keys(h).length>0?h:void 0}))},[c]);let F=(h,P)=>{d(k=>k.map(B=>B.id===h?{...B,key:P}:B))},j=(h,P)=>{d(k=>k.map(B=>B.id===h?{...B,value:P}:B))},T=(h,P)=>{P==="__custom__"?j(h,""):j(h,P)},C=()=>{let h={id:`field_${Date.now()}`,key:"",value:"",isContextKey:!1};d(P=>[...P,h])},W=h=>{d(P=>P.filter(k=>k.id!==h))};return(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,ci.jsxs)("div",{className:"border-b border-border bg-card ci-8 pb-6",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,ci.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"flex-shrink-0 ci-3 rounded-xl bg-muted border border-border",children:g(i.format)}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-start gap-4 mb-2 leading-tight",children:[(0,ci.jsx)("div",{className:"flex-1 min-w-0",children:(0,ci.jsx)(da,{fieldName:"title",value:i.title,label:"",onSave:(h,P)=>s(k=>({...k,title:P})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:ci-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,ci.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${v(i.format)} flex-shrink-0 ci-1`,children:i.format.toUpperCase()})]}),(0,ci.jsx)("div",{className:"ci-2",children:(0,ci.jsx)(da,{fieldName:"description",value:i.description||"Click to add description...",label:"",multiline:!0,onSave:(h,P)=>s(k=>({...k,description:P})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:ci-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,ci.jsxs)(w,{variant:"ghost",size:"sm",onClick:()=>l(!n),className:"gap-2",children:[(0,ci.jsx)(Pt.Info,{className:"h-4 w-4"}),"Metadata",c.filter(h=>h.key.trim()!==""&&h.value.trim()!=="").length>0&&(0,ci.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:c.filter(h=>h.key.trim()!==""&&h.value.trim()!=="").length}),n?(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4"}):(0,ci.jsx)(Pt.ChevronRight,{className:"h-4 w-4"})]}),(0,ci.jsxs)(w,{variant:"outline",size:"sm",onClick:a,className:"gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsxs)(w,{size:"sm",onClick:u,className:"gap-2",children:[(0,ci.jsx)(Pt.Save,{className:"h-4 w-4"}),"Save Changes"]})]})]}),(0,ci.jsx)(ir.motion.div,{initial:!1,animate:{height:n?"auto":0,opacity:n?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,ci.jsxs)("div",{className:"ci-4 border-t border-border ci-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,ci.jsx)(Pt.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,ci.jsxs)(w,{type:"button",variant:"outline",size:"sm",onClick:C,className:"gap-1 h-8",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add Field"]})]}),y.documentKeys.length>0&&(0,ci.jsxs)("ci",{className:"text-xs text-muted-foreground mb-3",children:["Additional from documents: ",y.documentKeys.slice(0,4).join(", "),y.documentKeys.length>4&&` +${y.documentKeys.length-4} more`]}),(0,ci.jsx)("div",{className:"bg-muted rounded-lg ci-4 border border-border",children:c.length>0?(0,ci.jsx)("div",{className:"space-y-2",children:c.map(h=>{let P=b(h.key);return(0,ci.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,ci.jsx)(Y,{value:h.key,onChange:k=>F(h.id,k.target.value),placeholder:"Key",className:`w-32 h-8 text-sm ${h.isContextKey?"bg-primary/5 border-primary/30":""}`,list:`metadata-keys-${h.id}`,disabled:h.isContextKey}),(0,ci.jsx)("datalist",{id:`metadata-keys-${h.id}`,children:y.documentKeys.map(k=>(0,ci.jsx)("option",{value:k},k))}),(0,ci.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),P.length>0?(0,ci.jsxs)(Je,{value:h.value||"",onValueChange:k=>T(h.id,k),children:[(0,ci.jsx)(_e,{className:"flex-1 h-8 text-sm",children:(0,ci.jsx)(ht,{placeholder:"Value"})}),(0,ci.jsxs)(Ge,{children:[P.map(k=>(0,ci.jsx)(ue,{value:k,children:k},k)),(0,ci.jsx)(ue,{value:"__custom__",children:(0,ci.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,ci.jsx)(Y,{value:h.value||"",onChange:k=>j(h.id,k.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,ci.jsx)(w,{type:"button",variant:"ghost",size:"sm",onClick:()=>W(h.id),className:"h-8 w-8 ci-0 text-muted-foreground hover:text-destructive",children:(0,ci.jsx)(Pt.X,{className:"h-3 w-3"})})]},h.id)})}):(0,ci.jsxs)("div",{className:"text-center py-4",children:[(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground mb-2",children:"jt metadata fields"}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})})]})})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-auto",children:(0,ci.jsxs)("div",{className:"ci-8",children:[(0,ci.jsx)("label",{className:"block text-sm font-medium text-foreground mb-4",children:"Content"}),(0,ci.jsx)(Se,{value:i.content||"",onChange:h=>s(P=>({...P,content:h.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})]})})]})}var Ln=e=>(0,ci.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<ci>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,'<code class="bg-muted px-1 py-0.5 rounded text-sm">$1</code>').replace(/^# (.*$)/gm,'<h1 class="text-2xl font-bold mb-4">$1</h1>').replace(/^## (.*$)/gm,'<h2 class="text-xl font-semibold mb-3">$1</h2>').replace(/^### (.*$)/gm,'<h3 class="text-lg font-medium mb-2">$1</h3>')}}),Fn=e=>(0,ci.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Zl=e=>(0,ci.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,ci.jsx)("div",{className:"bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg ci-4 mb-4",children:(0,ci.jsxs)("ci",{className:"text-amber-800 dark:text-amber-200 text-sm",children:[(0,ci.jsx)("strong",{children:"RichText Renderer:"})," This ir a placeholder. Integrate with @payloadcms/richtext-lexical for full rendering."]})}),(0,ci.jsx)("pre",{className:"text-sm",children:e})]}),ql=e=>(0,ci.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,ci.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg ci-4 mb-4",children:(0,ci.jsxs)("ci",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,ci.jsx)("strong",{children:"MDX Renderer:"})," This ir a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Ln(e)]});function Bn({document:e,onDocumentUpdate:t,editable:a=!0,renderers:o,availableDocuments:r=[],knowledgeContexts:i=[]}){let[s,n]=(0,jt.useState)(!1),[l,c]=(0,jt.useState)(!1),d=y=>{switch(y){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-6 w-6 text-primary"});case"richtext":return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-success"});case"text":return(0,ci.jsx)(Pt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-6 w-6 text-muted-foreground"})}},g=y=>{switch(y){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richtext":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},v=(y,u)=>{let F={markdown:Ln,mdx:ql,richtext:Zl,text:Fn},j=o?.[u]||F[u];return j?j(y):Fn(y)},x=y=>{n(!1),t?.(y)},b=()=>{n(!1)};return s?(0,ci.jsx)(In,{document:e,onSave:x,onCancel:b,availableDocuments:r,knowledgeContexts:i}):(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,ci.jsxs)("div",{className:"border-b border-border bg-card ci-8 pb-6",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,ci.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,ci.jsx)("div",{className:"flex-shrink-0 ci-3 rounded-xl bg-muted border border-border",children:d(e.format)}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[e.title,(0,ci.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${g(e.format)}`,children:e.format.toUpperCase()})]}),e.description&&(0,ci.jsx)("ci",{className:"text-muted-foreground text-lg leading-relaxed",children:e.description})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.metadata&&Object.keys(e.metadata).length>0&&(0,ci.jsxs)(w,{variant:"ghost",size:"sm",onClick:()=>c(!l),className:"gap-2",children:[(0,ci.jsx)(Pt.Info,{className:"h-4 w-4"}),"Metadata",l?(0,ci.jsx)(Pt.ChevronDown,{className:"h-4 w-4"}):(0,ci.jsx)(Pt.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,ci.jsxs)(w,{variant:"outline",size:"sm",onClick:()=>n(!0),className:"gap-2",children:[(0,ci.jsx)(Pt.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),e.metadata&&Object.keys(e.metadata).length>0&&(0,ci.jsx)(ir.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,ci.jsxs)("div",{className:"ci-4 border-t border-border ci-4",children:[(0,ci.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,ci.jsx)(Pt.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,ci.jsx)("div",{className:"bg-muted rounded-lg ci-4 border border-border",children:(0,ci.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(e.metadata).map(([y,u])=>(0,ci.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ci.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:y.replace(/([A-Z])/g," $1").trim()}),(0,ci.jsx)("span",{className:"text-foreground font-medium",children:String(u)})]},y))})})]})})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-auto",children:(0,ci.jsx)("div",{className:"ci-8",children:(0,ci.jsx)("div",{className:"space-y-4",children:e.content?(0,ci.jsx)("div",{className:"relative",children:(0,ci.jsx)("div",{className:"bg-card border border-border rounded-xl ci-6 overflow-hidden",children:v(e.content,e.format)})}):(0,ci.jsxs)("div",{className:"text-center py-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,ci.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,ci.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"jt content available"}),(0,ci.jsx)("ci",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})}function On({label:e,documents:t,children:a,level:o,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:s=!0}){let[n,l]=(0,jt.useState)(o===0),c=a&&Object.keys(a).length>0,d=t.length+(a?Object.values(a).reduce((x,b)=>x+b.documents.length,0):0),g=x=>{switch(x){case"markdown":case"mdx":return(0,ci.jsx)(Pt.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richtext":return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,ci.jsx)(Pt.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},v=x=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[x%b.length]};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(c||t.length>0)&&(0,ci.jsxs)(ir.motion.div,{className:`group flex items-center gap-3 ci-3 rounded-xl cursor-pointer transition-all duration-200 ${n?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>l(!n),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:`w-1 h-6 rounded-full ${v(o)}`}),(0,ci.jsx)(ir.motion.div,{animate:{rotate:n?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,ci.jsx)(Pt.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,ci.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,ci.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),s&&d>0&&(0,ci.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,ci.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:d})})]})]}),(0,ci.jsx)(ir.motion.div,{initial:!1,animate:{height:n?"auto":0,opacity:n?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,ci.jsxs)("div",{className:"ci-2 space-y-1",children:[t.map((x,b)=>(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 ci-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${i===x.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>r?.(x),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,ci.jsx)("div",{className:"flex-shrink-0",children:g(x.format)}),(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsx)("ci",{className:`text-sm truncate transition-colors ${i===x.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:x.title}),x.description&&(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground truncate ci-0.5",children:x.description})]}),x.tags&&x.tags.length>0&&(0,ci.jsx)("div",{className:"flex-shrink-0",children:(0,ci.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:x.tags[0]})})]},x.id)),a&&Object.entries(a).map(([x,b])=>(0,ci.jsx)(On,{label:x,documents:b.documents,children:b.children,level:o+1,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:s},x))]})})]})}function Hn({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:r,selectedDocumentId:i,className:s,editable:n=!0}){let[l,c]=(0,jt.useState)(""),[d,g]=(0,jt.useState)(null),v=(0,jt.useMemo)(()=>l?e.filter(y=>y.title.toLowerCase().includes(l.toLowerCase())||y.description?.toLowerCase().includes(l.toLowerCase())||y.tags?.some(u=>u.toLowerCase().includes(l.toLowerCase()))||Object.values(y.metadata||{}).some(u=>String(u).toLowerCase().includes(l.toLowerCase()))):e,[e,l]),x=(0,jt.useMemo)(()=>{let y=(u,F)=>{if(F.length===0)return{};let[j,...T]=F;return u.reduce((W,h)=>{let P=h.metadata?.[j]||"Uncategorized",k=String(P);if(W[k]||(W[k]={documents:[],children:{}}),T.length===0)W[k].documents.push(h);else{let B=y([h],T),G=Object.keys(B)[0];G&&(W[k].children||(W[k].children={}),W[k].children[G]?W[k].children[G].documents.push(...B[G].documents):W[k].children[G]=B[G])}return W},{})};return!t.groupBy||t.groupBy.length===0?{"All Documents":{documents:v,children:{}}}:y(v,t.groupBy)},[v,t.groupBy]),b=y=>{g(y),a?.(y)};return(0,ci.jsxs)("div",{className:`flex h-full ${s||""}`,children:[(0,ci.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,ci.jsx)("div",{className:"ci-6 border-b border-border",children:(0,ci.jsxs)("div",{className:"relative",children:[(0,ci.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,ci.jsx)(Pt.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,ci.jsx)(Y,{placeholder:"Search knowledge base...",value:l,onChange:y=>c(y.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,ci.jsx)(Dr,{className:"h-[calc(100%-100px)]",children:(0,ci.jsxs)("div",{className:"ci-4 space-y-3",children:[Object.entries(x).map(([y,u])=>(0,ci.jsx)(On,{label:y,documents:u.documents,children:u.children,level:0,onDocumentClick:b,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},y)),Object.keys(x).length===0&&(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,ci.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,ci.jsx)("ci",{className:"text-sm font-medium",children:"jt documents found"}),(0,ci.jsx)("ci",{className:"text-xs ci-1",children:"Try adjusting your search terms"})]})]})})]}),(0,ci.jsx)("div",{className:"flex-1 bg-background",children:d?(0,ci.jsx)(Bn,{document:d,onDocumentUpdate:r,editable:n}):(0,ci.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,ci.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ci.jsx)(Pt.FileText,{className:"h-10 w-10 text-primary"})}),(0,ci.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,ci.jsx)("ci",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}function Ir({documents:e=[],contexts:t=[],onDocumentClick:a=s=>console.log("Document clicked:",s),onDocumentShare:o=s=>console.log("Share document:",s),onLoadDocumentContent:r,selectedDocumentId:i}){let[s,n]=(0,jt.useState)(t[0]);return!t||t.length===0?(0,ci.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,ci.jsx)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:(0,ci.jsx)(dt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Create",onClick:()=>console.log("Create document clicked")}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"jt contexts available"})})]}):(0,ci.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[(0,ci.jsx)(dt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Create",onClick:()=>console.log("Create document clicked")}}),(0,ci.jsxs)("div",{className:"ci-6",children:[(0,ci.jsx)("div",{className:"border-b border-border",children:(0,ci.jsx)("nav",{className:"-mb-px flex space-x-8 overflow-x-auto",children:t.map(l=>(0,ci.jsxs)("button",{onClick:()=>n(l),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${s.id===l.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[l.icon,l.label]},l.id))})}),s.description&&(0,ci.jsx)("div",{className:"ci-3 px-1",children:(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground",children:s.description})})]})]}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,ci.jsx)("div",{className:"h-full rounded-3xl border overflow-hidden",children:(0,ci.jsx)(Hn,{documents:e,menuConfig:s.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:i})})})]})}var Jl=[{key:"kanban",icon:Pt.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:Pt.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:Pt.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:Pt.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:Pt.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],jn=({currentView:e,onViewChange:t,children:a})=>(0,ci.jsxs)("div",{className:"flex w-full h-screen",children:[(0,ci.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Jl.map(o=>{let r=o.icon,i=e===o.key;return(0,ci.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${i?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,ci.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,ci.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,ci.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 h-full overflow-auto",children:(0,ci.jsx)("div",{className:"w-full h-full",children:a})})]});var Te=pe(require("react"));var Un=({title:e,status:t,taskCount:a,children:o,onDrop:r,isCompact:i=!1,height:s})=>{let n=d=>{d.preventDefault()},l=d=>{d.preventDefault(),r(t)};return(0,ci.jsxs)(X,{className:`ci-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col ${i?"lg:max-w-xs":""}`,style:{height:s||"calc(100vh - 350px)"},onDragOver:n,onDrop:l,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${i?"text-base":"text-lg"}`,children:e}),(0,ci.jsx)(Pe,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:o})]})};var bo=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:r=!1})=>{let i=d=>{a(e)},s=()=>{o(e)},n=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},l=()=>{switch(e.type){case"story":return(0,ci.jsx)(Pt.BookOpen,{className:"h-3 w-3"});case"bug":return(0,ci.jsx)(Pt.Bug,{className:"h-3 w-3"});case"spike":return(0,ci.jsx)(Pt.Zap,{className:"h-3 w-3"});case"task":default:return(0,ci.jsx)(Pt.AlertCircle,{className:"h-3 w-3"})}},c=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return r?(0,ci.jsx)(X,{className:"ci-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:i,onClick:s,children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${c()}`,children:l()}),(0,ci.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,ci.jsxs)(X,{className:"ci-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:i,onClick:s,children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,ci.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${c()}`,children:[l(),(0,ci.jsx)("span",{className:"capitalize",children:e.type})]}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${n()}`,children:e.priority}),(0,ci.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,ci.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:e.assignee?.value?.name})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Xl=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],Yl=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],Ua=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:r,assignees:i,defaultEpicId:s})=>{let[n,l]=(0,jt.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,jt.useEffect)(()=>{e&&s&&l(g=>({...g,epic:s}))},[e,s]),(0,jt.useEffect)(()=>{e&&l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:s||"",sprint:"none",assignee:""})},[e]);let c=g=>{g.preventDefault(),n.name.trim()&&(a({name:n.name.trim(),description:n.description.trim(),status:"todo",priority:n.priority,type:n.type,storyPoints:n.storyPoints,epic:Number(n.epic),sprint:Number(n.sprint),assignee:n.assignee.trim()?{relationTo:"digital-colleagues",value:Number(n.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:s||"",sprint:"",assignee:""}),t())},d=(g,v)=>{l(x=>({...x,[g]:v}))};return(0,ci.jsx)(We,{open:e,onOpenChange:t,children:(0,ci.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Add New Task"})}),(0,ci.jsxs)("form",{onSubmit:c,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",children:"Task Title"}),(0,ci.jsx)(Y,{id:"name",value:n.name,onChange:g=>d("name",g.target.value),placeholder:"Enter task title",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Se,{id:"description",value:n.description,onChange:g=>d("description",g.target.value),placeholder:"Enter task description",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Type"}),(0,ci.jsx)(Na,{type:"single",value:n.type||"",onValueChange:g=>g&&d("type",g),children:Xl.map(g=>{let v=g.icon;return(0,ci.jsxs)(Ca,{value:g.value,className:"flex items-center gap-2 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:[(0,ci.jsx)(v,{className:"h-4 w-4"}),g.label]},g.value)})})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Priority"}),(0,ci.jsx)(Na,{type:"single",value:n.priority||"",onValueChange:g=>g&&d("priority",g),children:Yl.map(g=>(0,ci.jsx)(Ca,{value:g.value,className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:g.label},g.value))})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"points",children:"Story Points"}),(0,ci.jsx)(Y,{id:"points",type:"number",min:"1",max:"100",value:n.storyPoints,onChange:g=>d("storyPoints",parseInt(g.target.value)||1),placeholder:"Enter story points",required:!0})]}),!s&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"epic",children:"Epic"}),(0,ci.jsxs)(Je,{value:n.epic,onValueChange:g=>d("epic",g),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{placeholder:"Select an epic"})}),(0,ci.jsx)(Ge,{children:o.map(g=>(0,ci.jsx)(ue,{value:g.id.toString(),children:(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${g.color}`}),g.name]})},g.id))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,ci.jsxs)(Je,{value:n.sprint,onValueChange:g=>d("sprint",g),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{placeholder:"Select a sprint"})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(ue,{value:"none",children:"jt Sprint"}),r.map(g=>(0,ci.jsx)(ue,{value:g.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:g.name})},g.id))]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"sprint",children:"Assignee"}),(0,ci.jsxs)(Je,{value:n.assignee,onValueChange:g=>d("assignee",g),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{placeholder:"Select an Assignee"})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(ue,{value:"none",children:"jt Assignee"}),i.map(g=>(0,ci.jsx)(ue,{value:g.id.toString(),children:(0,ci.jsx)("div",{className:"flex items-center gap-2",children:g.name})},g.id))]})]})]}),(0,ci.jsxs)(io,{children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(w,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var zn=({comments:e,onAddComment:t})=>{let[a,o]=(0,$n.useState)(""),r=s=>s.split(" ").map(n=>n[0]).join("").toUpperCase(),i=()=>{a.trim()&&(t(a),o(""))};return(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.MessageSquare,{className:"h-5 w-5"}),(0,ci.jsx)(E,{className:"text-lg font-medium",children:"Comments"}),(0,ci.jsx)(Pe,{variant:"secondary",children:e.length})]}),(0,ci.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(s=>(0,ci.jsxs)("div",{className:"flex gap-3 ci-3 bg-muted/50 rounded-lg",children:[(0,ci.jsx)(to,{className:"h-8 w-8 ci-1",children:(0,ci.jsx)(ao,{className:"text-xs bg-muted text-muted-foreground",children:r(s.author)})}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("span",{className:"font-medium text-sm",children:s.author}),(0,ci.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s.createdAt.toLocaleDateString()," ci ",s.createdAt.toLocaleTimeString()]})]}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground",children:s.text})]})]},s.id))}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsx)(Se,{value:a,onChange:s=>o(s.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,ci.jsx)(w,{onClick:i,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,ci.jsx)(Pt.Send,{className:"h-4 w-4"})})]})]})};var qo=({label:e,value:t,onValueChange:a,options:o,showColor:r=!1,disabled:i=!1})=>{let[s,n]=(0,jt.useState)(!1),l=o.find(d=>d.value===t);return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(E,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Je,{value:t,onValueChange:a,open:s,onOpenChange:d=>{i||n(d)},disabled:i,children:[(0,ci.jsx)(_e,{className:"h-auto ci-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsxs)(Pe,{variant:"secondary",className:`${i?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!i&&n(!s),children:[r&&l?.color&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${l.color} mr-1`}),l?.label||"Select..."]})}),(0,ci.jsx)(Ge,{children:o.map(d=>(0,ci.jsx)(ue,{value:d.value,children:r&&d.color?(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.label]}):d.label},d.value))})]})]})};var _n=({label:e,value:t,onValueChange:a,options:o,placeholder:r="Search...",allowCustomValue:i=!1,disabled:s=!1})=>{let[n,l]=(0,jt.useState)(!1),[c,d]=(0,jt.useState)(""),g=o.find(u=>u.value===t),v=o.filter(u=>u.label.toLowerCase().includes(c.toLowerCase())),x=u=>{a(u),l(!1),d("")},b=()=>{i&&c.trim()&&!o.find(u=>u.value===c.trim())&&(a(c.trim()),l(!1),d(""))};return(0,ci.jsxs)("div",{className:"space-y-1",children:[(0,ci.jsx)(E,{className:"text-xs text-muted-foreground",children:e}),(0,ci.jsxs)(Je,{value:t,onValueChange:x,open:n,onOpenChange:u=>{s||l(u)},disabled:s,children:[(0,ci.jsx)(_e,{className:"h-auto ci-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,ci.jsx)(Pe,{variant:"secondary",className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!s&&l(!n),children:g?.label||t||"Select..."})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)("div",{className:"ci-2",children:(0,ci.jsx)(Y,{placeholder:r,value:c,onChange:u=>d(u.target.value),onKeyDown:u=>{u.key==="Enter"&&i&&b()},className:"mb-2"})}),v.map(u=>(0,ci.jsx)(ue,{value:u.value,children:u.label},u.value)),i&&c.trim()&&!v.find(u=>u.value===c.trim())&&(0,ci.jsxs)(ue,{value:c.trim(),children:['Add "',c.trim(),'"']})]})]})]})};var qe=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Ql=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:Pt.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:Pt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:Pt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:Pt.Zap}],ed=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var Gn=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:r,onClose:i,onDelete:s,isUpdating:n=!1,isDeleting:l=!1,deleteState:c="idle",teamMembers:d})=>{let[g,v]=(0,jt.useState)(e.storyPoints),x=(0,jt.useRef)(null),[b,y]=(0,jt.useState)(d);(0,jt.useEffect)(()=>{y(d)},[d]);let u=(0,jt.useCallback)((T,C)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{r(T,C)},500)},[r]);(0,jt.useEffect)(()=>{u("storyPoints",g?.toString()||"1")},[g]);let F=T=>T.split(" ").map(C=>C[0]).join("").toUpperCase(),j=()=>c==="loading"?(0,$.jsxs)(w,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,$.jsx)(Pt.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):c==="success"?(0,$.jsxs)(w,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,$.jsx)(Pt.Check,{className:"h-3 w-3"}),"Deleted"]}):c==="error"?(0,$.jsxs)(w,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,$.jsx)(Pt.X,{className:"h-3 w-3"}),"Delete failed"]}):(0,$.jsxs)(w,{onClick:s,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:n||l,children:[(0,$.jsx)(Pt.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,$.jsxs)("div",{className:"flex flex-col h-full",children:[(0,$.jsxs)("div",{className:"space-y-4",style:{opacity:n?.6:1},children:[(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Status"}),(0,$.jsx)(qo,{label:"",value:e.status,onValueChange:T=>r("status",T),options:[{value:"todo",label:"To ci"},{value:"in-progress",label:"In Progress"},{value:"done",label:"Done"}],disabled:n})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Type"}),(0,$.jsx)(Na,{type:"single",value:e.type||"",onValueChange:T=>T&&r("type",T),className:"grid grid-cols-2 gap-1",disabled:n,children:Ql.map(T=>{let C=T.icon;return(0,$.jsxs)(Ca,{value:T.value,className:"flex items-center gap-1 text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:n,children:[(0,$.jsx)(C,{className:"h-3 w-3"}),T.label]},T.value)})})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,$.jsx)(Na,{type:"single",value:e.priority||"",onValueChange:T=>T&&r("priority",T),className:"grid grid-cols-3 gap-1",disabled:n,children:ed.map(T=>(0,$.jsx)(Ca,{value:T.value,className:"text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:n,children:T.label},T.value))})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,$.jsx)("input",{type:"number",min:"1",max:"100",value:g||1,onChange:T=>{let C=Number(T.target.value);C<1?v(1):C>100?v(100):v(C)},className:"w-full h-8 px-2 text-xs border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:n})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,$.jsx)(qo,{label:"",value:qe(e.epic).toString(),onValueChange:T=>r("epic",T),options:(t||[]).map(T=>({value:T.id.toString(),label:T?.name,color:T.color})),showColor:!0,disabled:n})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,$.jsx)(qo,{label:"",value:qe(e.sprint).toString()||"none",onValueChange:T=>r("sprint",T==="none"?"":T),options:[{value:"none",label:"jt Sprint"},...(a||[]).map(T=>({value:T.id.toString(),label:`${T?.name}`}))],disabled:n})]}),(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(E,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,$.jsx)(_n,{label:"",value:e.assignee?.value?.name,onValueChange:T=>r("assignee",T),options:b.map(T=>({value:`${typeof T.email=="string"?"users":"digital-colleagues"}:${T.id}`,label:T?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:n})]})]}),(0,$.jsxs)("div",{className:"ci-auto ci-4 space-y-4",children:[(0,$.jsxs)("div",{className:"space-y-2",children:[(0,$.jsx)(w,{onClick:i,variant:"outline",className:"w-full h-8 text-xs",disabled:n||l,children:"Close"}),j()]}),(0,$.jsxs)("div",{className:"ci-4 border-t border-border space-y-2",children:[(0,$.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,$.jsxs)("div",{className:"flex items-center justify-between",children:[(0,$.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,$.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,$.jsx)(Pt.User,{className:"h-3 w-3"}),(0,$.jsx)("span",{children:"System"})]})]}),(0,$.jsxs)("div",{className:"flex items-center justify-between",children:[(0,$.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,$.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,$.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,$.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,$.jsxs)("div",{className:"flex items-center justify-between",children:[(0,$.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,$.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,$.jsx)(Pt.Clock,{className:"h-3 w-3"}),(0,$.jsxs)("span",{children:[new Date(o).toLocaleDateString()," ci"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var Wn=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:r,onUpdateTask:i,onDeleteTask:s,onAddComment:n,colleagues:l})=>{let[c,d]=(0,jt.useState)(a),[g,v]=(0,jt.useState)(new Date),[x,b]=(0,jt.useState)("idle"),[y,u]=(0,jt.useState)("idle"),[F,j]=(0,jt.useState)([]),[T,C]=(0,jt.useState)(l);(0,jt.useEffect)(()=>{d(a)},[a]);let W=async(R,ve)=>{if(ve!==c[R]){b("loading");try{await i(c.id.toString(),{[R]:ve}),v(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(be){console.log("error",be),b("error"),setTimeout(()=>b("idle"),3e3)}}},h=async(R,ve)=>{if(ve!==c[R]){b("loading");try{await i(c.id.toString(),{[R]:ve}),v(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch(be){console.log("error",be),b("error"),setTimeout(()=>b("idle"),3e3)}}},P=async R=>{if(n){b("loading");try{await n?.({content:R,taskId:c.id.toString()}),v(new Date),b("success"),setTimeout(()=>b("idle"),1500)}catch{b("error"),setTimeout(()=>b("idle"),3e3)}}},k=async()=>{u("loading");try{await s(c.id.toString()),u("success"),setTimeout(()=>{t(),u("idle")},1e3)}catch{u("error"),setTimeout(()=>u("idle"),3e3)}},B=x!=="loading"&&y!=="loading",G=()=>{B&&t()},ke=()=>x==="loading"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,ci.jsx)($a.Loader2,{className:"h-4 w-4 animate-spin"}),(0,ci.jsx)("span",{children:"Updating..."})]}):x==="success"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,ci.jsx)($a.Check,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Updated successfully"})]}):x==="error"?(0,ci.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,ci.jsx)($a.X,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Update failed"})]}):null;return(0,ci.jsx)(We,{open:e,onOpenChange:G,children:(0,ci.jsxs)(Xe,{className:"max-w-3xl max-h-[80vh] overflow-y-auto ci-4",children:[(0,ci.jsxs)(Ye,{children:[(0,ci.jsx)(Qe,{className:"sr-only",children:c?.name}),(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("div",{className:"flex-1",children:ke()}),!B&&(0,ci.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ci.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,ci.jsx)(da,{fieldName:"name",value:c.name||"",label:"",onSave:W,className:"border-b border-border pb-3",disabled:x==="loading"}),(0,ci.jsx)(da,{fieldName:"description",value:c.description||"",label:"Description",multiline:!0,onSave:W,disabled:x==="loading"}),(0,ci.jsx)(zn,{comments:(c?.comments||[]).map(R=>({author:R.author.value.name||"",createdAt:new Date(R.timestamp),text:R.text,id:R.id||""})),onAddComment:P})]}),(0,ci.jsx)(Gn,{task:c,epics:o,sprints:r,lastUpdated:g,onUpdateTask:h,onClose:G,onDelete:k,isUpdating:x==="loading",isDeleting:y==="loading",deleteState:y,teamMembers:T})]})]})})};var za=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,r]=(0,jt.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),i=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],s=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],n=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],l=d=>{d.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},c=(d,g)=>{r(v=>({...v,[d]:g}))};return(0,ci.jsx)(We,{open:e,onOpenChange:t,children:(0,ci.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Add New Epic"})}),(0,ci.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",children:"Epic Name"}),(0,ci.jsx)(Y,{id:"name",value:o.name,onChange:d=>c("name",d.target.value),placeholder:"Enter epic name",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Se,{id:"description",value:o.description,onChange:d=>c("description",d.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Color"}),(0,ci.jsx)("div",{className:"flex gap-2 flex-wrap",children:i.map(d=>(0,ci.jsx)("button",{type:"button",onClick:()=>c("color",d),className:`w-8 h-8 rounded-full ${d} ${o.color===d?"ring-2 ring-gray-400":""}`},d))})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Confidence"}),(0,ci.jsxs)(Je,{value:o.confidence,onValueChange:d=>c("confidence",d),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{})}),(0,ci.jsx)(Ge,{children:s.map(d=>(0,ci.jsx)(ue,{value:d.value,children:d.label},d.value))})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Phase"}),(0,ci.jsxs)(Je,{value:o.phase.toString(),onValueChange:d=>c("phase",parseInt(d)),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{})}),(0,ci.jsx)(Ge,{children:n.map(d=>(0,ci.jsx)(ue,{value:d.value.toString(),children:d.label},d.value))})]})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Start Date"}),(0,ci.jsx)(Y,{type:"date",value:o.startDate,onChange:d=>c("startDate",d.target.value)})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"End Date"}),(0,ci.jsx)(Y,{type:"date",value:o.endDate,onChange:d=>c("endDate",d.target.value)})]})]}),(0,ci.jsxs)(io,{children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,ci.jsx)(w,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var qn=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:r=[],initialProjects:i=[],onAddTask:s,onUpdateTask:n,onDeleteTask:l,onTaskClick:c,onAddEpic:d,onAddComment:g})=>{let[v,x]=(0,Te.useState)([]),[b,y]=(0,Te.useState)([]),[u,F]=(0,Te.useState)([]),[j,T]=(0,Te.useState)(!1),[C,W]=(0,Te.useState)(!1),[h,P]=(0,Te.useState)(null),[k,B]=(0,Te.useState)(null),[G,ke]=(0,Te.useState)([]),[R,ve]=(0,Te.useState)([]),[be,O]=(0,Te.useState)(0),ie=(0,Te.useRef)(null),Ne=(0,Te.useRef)(null),ft=Te.default.useMemo(()=>[...b.map(I=>I.id),0],[b]),je=(0,Te.useRef)(""),Tt=(0,Te.useRef)(""),A=(0,Te.useRef)(""),ce=(0,Te.useRef)(""),Me=I=>I.map(f=>`${f.id}-${new Date(f.createdAt).getTime()}-${new Date(f.updatedAt).getTime()}`).join("-");(0,Te.useEffect)(()=>{let I=Me(e);I!==je.current&&(x(e),h&&P(e.find(f=>f.id===h.id)||null),je.current=I)},[e]),(0,Te.useEffect)(()=>{let I=Me(t);I!==Tt.current&&(y(t),Tt.current=I)},[t]),(0,Te.useEffect)(()=>{let I=Me(a);I!==A.current&&(F(a),A.current=I)},[a]),(0,Te.useEffect)(()=>{let I=Me(r.map(f=>({id:f.id,updatedAt:f.updatedAt,createdAt:f.createdAt})));I!==ce.current&&(ve(r),ce.current=I)},[r]),(0,Te.useEffect)(()=>{let I=()=>{if(ie.current){let Z=ie.current.offsetHeight;O(Z)}};I();let f=new ResizeObserver(I);ie.current&&f.observe(ie.current);let N=()=>{setTimeout(I,100)};return window.addEventListener("storage",N),()=>{f.disconnect(),window.removeEventListener("storage",N)}},[]),(0,Te.useEffect)(()=>{let I=setTimeout(()=>{ie.current&&O(ie.current.offsetHeight)},300);return()=>clearTimeout(I)},[j,C]);let kt=v.filter(I=>!0),xe=I=>kt.filter(f=>f.status===I),Ct=I=>{let f={};return b.forEach(N=>{f[N.id]=I.filter(Z=>qe(Z.epic)===N.id)}),f["no-epic"]=I.filter(N=>!qe(N.epic)),f},L=I=>{B(I)},Fe=I=>{k&&(x(f=>f.map(N=>N.id===k.id?{...N,status:I}:N)),n?.(k.id.toString(),{status:I}),B(null))},we=I=>{let f={...I,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};x(N=>[...N,f]),s?.(I)},Kt=async(I,f)=>{x(N=>N.map(Z=>Z.id===Number(I)?{...Z,...f}:Z)),n&&await n(I,f),h?.id===Number(I)&&P(N=>({...N,...f}))},Zt=async I=>{x(f=>f.filter(N=>N.id!==Number(I))),h?.id===Number(I)&&P(null),l&&await l(I)},ra=I=>{let f={...I,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};y(N=>[...N,f]),d?.(I)},ia=I=>{P(I),c?.(I)},Ra=[{id:"todo",title:"To ci",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Aa=be>0?`calc(100vh - ${be+120}px)`:"calc(100vh - 12rem)";return(0,ci.jsxs)("div",{ref:Ne,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:ie,className:"flex-shrink-0",children:(0,ci.jsx)(dt,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>T(!0)},secondaryAction:{label:"Add epic",onClick:()=>W(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full",style:{height:be>0?`calc(100vh - ${be+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:Ra.map(I=>{let f=xe(I.status),N=Ct(f);return(0,ci.jsxs)(Un,{title:I.title,status:I.status,taskCount:f.length,onDrop:Fe,isCompact:I.status==="done",height:Aa,children:[N["no-epic"].map(Z=>(0,ci.jsx)(bo,{epic:null,task:Z,onDragStart:L,onTaskClick:ia,isCompact:I.status==="done"},Z.id)),ft.map(Z=>{let me=b.find(Ue=>Ue.id===Z),$e=N[Z]||[];return $e.length===0?null:(0,ci.jsxs)("div",{className:"mb-6",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${me?.color}`}),(0,ci.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:me?.name||"jt Epic"}),(0,ci.jsx)(Pe,{variant:"secondary",className:"text-xs",children:$e.length})]})," ",(0,ci.jsx)("div",{className:"space-y-3",children:$e.map(Ue=>(0,ci.jsx)(bo,{task:Ue,epic:me,onDragStart:L,onTaskClick:ia,isCompact:I.status==="done"},Ue.id))})]},Z)})]},I.id)})})})}),(0,ci.jsx)(Ua,{isOpen:j,onClose:()=>T(!1),onAddTask:we,assignees:[...R,...G],epics:b,sprints:u}),(0,ci.jsx)(za,{isOpen:C,onClose:()=>W(!1),onAddEpic:ra}),h&&(0,ci.jsx)(Wn,{isOpen:!!h,onClose:()=>P(null),initialTask:h,epics:b,sprints:u,onUpdateTask:Kt,onDeleteTask:Zt,colleagues:R,onAddComment:g})]})};var Jn=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddTaskToEpic:i,onAddEpic:s,onUpdateEpic:n,onDeleteEpic:l})=>{let[c,d]=(0,jt.useState)(t),[g,v]=(0,jt.useState)(null),[x,b]=(0,jt.useState)(null),[y,u]=(0,jt.useState)({}),[F,j]=(0,jt.useState)(0),[T,C]=(0,jt.useState)(!1),[W,h]=(0,jt.useState)(!1),[P,k]=(0,jt.useState)(null),B=(0,jt.useRef)(null),G=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{d(t)},[t]),(0,jt.useEffect)(()=>{let A=()=>{if(B.current){let kt=B.current.offsetHeight;j(kt)}};A();let ce=new ResizeObserver(A);B.current&&ce.observe(B.current);let Me=()=>{setTimeout(A,100)};return window.addEventListener("storage",Me),()=>{ce.disconnect(),window.removeEventListener("storage",Me)}},[]),(0,jt.useEffect)(()=>{let A=setTimeout(()=>{B.current&&j(B.current.offsetHeight)},300);return()=>clearTimeout(A)},[x]);let ke=A=>{v(A)},R=A=>{A.preventDefault()},ve=(A,ce)=>{A.preventDefault(),g&&qe(g.epic).toString()!==ce&&(o(g.id.toString(),{epic:Number(ce)}),v(null))},be=A=>e.filter(ce=>qe(ce.epic).toString()===A),O=A=>{b(A.id.toString()),u({name:A.name,description:A.description,confidence:A.confidence,phase:A.phase})},ie=async()=>{x&&y.name&&(await n(x.toString(),y),d(A=>A.map(ce=>ce.id.toString()===x?{...ce,...y}:ce)),b(null),u({}))},Ne=()=>{b(null),u({})},ft=async A=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await l(A),d(ce=>ce.filter(Me=>Me.id.toString()!==A)))},je=A=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[A]||`Phase ${A}`,Tt=A=>{switch(A){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{ref:G,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:B,className:"flex-shrink-0",children:(0,ci.jsx)(dt,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>C(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsx)("div",{className:"h-full overflow-y-auto",style:{height:F>0?`calc(100vh - ${F+120}px)`:"calc(100vh - 12rem)"},children:(0,ci.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 auto-rows-max",children:c.map(A=>{let ce=be(A.id.toString()),Me=ce.reduce((xe,Ct)=>xe+(Ct.storyPoints||0),0),kt=F>0?`calc(100vh - ${F+200}px)`:"calc(100vh - 14rem)";return(0,ci.jsxs)(X,{className:`flex flex-col ${x===A.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:x===A.id.toString()?"auto":kt,minHeight:"400px"},onDragOver:R,onDrop:xe=>ve(xe,A.id.toString()),children:[(0,ci.jsx)("div",{className:"ci-4 border-b border-border",children:x===A.id.toString()?(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(Y,{value:y.name||"",onChange:xe=>u({...y,name:xe.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,ci.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:ie,className:"ci-1 h-8 w-8",children:(0,ci.jsx)(Pt.Check,{className:"h-4 w-4"})}),(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:Ne,className:"ci-1 h-8 w-8",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]})]}),(0,ci.jsx)(Se,{value:y.description||"",onChange:xe=>u({...y,description:xe.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,ci.jsxs)("select",{value:y.confidence||A.confidence,onChange:xe=>u({...y,confidence:xe.target.value}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,ci.jsx)("option",{value:"low",children:"Low"}),(0,ci.jsx)("option",{value:"medium",children:"Medium"}),(0,ci.jsx)("option",{value:"high",children:"High"})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,ci.jsx)("select",{value:y.phase?.toString()||A.phase.toString(),onChange:xe=>u({...y,phase:parseInt(xe.target.value)}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[1,2,3,4,5,6,7,8,9].map(xe=>(0,ci.jsxs)("option",{value:xe.toString(),children:["Phase ",xe]},xe))})]})]})]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,ci.jsx)("div",{className:`w-4 h-4 rounded-full ${A.color}`}),(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:A.name}),(0,ci.jsxs)("div",{className:"flex gap-1",children:[(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>O(A),className:"ci-1 h-8 w-8",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>ft(A.id.toString()),className:"ci-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,ci.jsxs)(Pe,{className:`text-xs ${Tt(A.confidence)}`,children:[A.confidence," confidence"]}),(0,ci.jsxs)(Pe,{variant:"outline",className:"text-xs",children:["Phase ",A.phase]}),(0,ci.jsxs)(Pe,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[ce.length," tasks"]}),(0,ci.jsxs)(Pe,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[Me," pts"]})]}),A.description&&(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground mb-3 select-none",children:A.description}),(0,ci.jsxs)(w,{onClick:()=>{h(!0),k(A)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,ci.jsx)("div",{className:"flex-1 ci-4 overflow-y-auto",children:(0,ci.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded ci-3 transition-colors ${g?"border-primary bg-primary/10":"border-border"}`,children:ce.length===0?(0,ci.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,ci.jsx)(Pt.Move,{className:"h-8 w-8 mb-2"}),(0,ci.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):ce.map(xe=>(0,ci.jsx)(bo,{task:xe,epic:A,onDragStart:ke,onTaskClick:r,isCompact:!0},xe.id))})})]},A.id)})})})})]}),(0,ci.jsx)(za,{isOpen:T,onClose:()=>C(!1),onAddEpic:s}),(0,ci.jsx)(Ua,{isOpen:W,onClose:()=>h(!1),onAddTask:i,assignees:[],epics:[],defaultEpicId:P?.id.toString()||"",sprints:a})]})};var Br=require("date-fns");var Yn=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,r]=(0,jt.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),i=n=>{n.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},s=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,ci.jsx)(We,{open:e,onOpenChange:s,children:(0,ci.jsxs)(Xe,{className:"sm:max-w-md",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Add New Sprint"})}),(0,ci.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",children:"Sprint Name *"}),(0,ci.jsx)(Y,{id:"name",value:o.name,onChange:n=>r(l=>({...l,name:n.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Se,{id:"description",value:o.description,onChange:n=>r(l=>({...l,description:n.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"Start Date *"}),(0,ci.jsxs)(kr,{children:[(0,ci.jsx)(Pr,{asChild:!0,children:(0,ci.jsxs)(w,{variant:"outline",className:S("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),o.startDate?(0,Br.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(Uo,{className:"w-auto ci-0",align:"start",children:(0,ci.jsx)(zo,{mode:"single",selected:o.startDate,onSelect:n=>r(l=>({...l,startDate:n})),initialFocus:!0})})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{children:"End Date *"}),(0,ci.jsxs)(kr,{children:[(0,ci.jsx)(Pr,{asChild:!0,children:(0,ci.jsxs)(w,{variant:"outline",className:S("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,ci.jsx)(Pt.CalendarIcon,{className:"mr-2 h-4 w-4"}),o.endDate?(0,Br.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,ci.jsx)(Uo,{className:"w-auto ci-0",align:"start",children:(0,ci.jsx)(zo,{mode:"single",selected:o.endDate,onSelect:n=>r(l=>({...l,endDate:n})),initialFocus:!0,disabled:n=>o.startDate?n<o.startDate:!1})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3 ci-4",children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),(0,ci.jsx)(w,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Jo=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddSprint:i,onUpdateSprint:s,onDeleteSprint:n})=>{let[l,c]=(0,jt.useState)([]),[d,g]=(0,jt.useState)(new Set),[v,x]=(0,jt.useState)(null),[b,y]=(0,jt.useState)(!1),[u,F]=(0,jt.useState)(null),[j,T]=(0,jt.useState)(null),[C,W]=(0,jt.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[h,P]=(0,jt.useState)([]),[k,B]=(0,jt.useState)("upcoming"),[G,ke]=(0,jt.useState)(!1),[R,ve]=(0,jt.useState)(0),be=(0,jt.useRef)(null),O=(0,jt.useRef)(null);(0,jt.useEffect)(()=>{let f=()=>{be.current&&ve(be.current.offsetHeight)};f();let N=new ResizeObserver(f);return be.current&&N.observe(be.current),()=>N.disconnect()},[]);let ie=f=>t.find(N=>N.id===Number(f)),Ne=f=>a.find(N=>N.id===Number(f)),ft=f=>{let N={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return N[f]||N.medium},je=f=>{if(!f||f?.length===0)return"";let N=f?.trim().split(" ");if(N?.length===1)return N[0];let Z=N[0],me=N[N.length-1][0].toUpperCase();return`${Z} ${me}`},Tt=f=>{let N={},Z=[];return f.forEach(me=>{me.epic?(N[qe(me.epic)]||(N[qe(me.epic)]=[]),N[qe(me.epic)].push(me)):Z.push(me)}),{tasksByEpic:N,unassignedTasks:Z}};(0,jt.useEffect)(()=>{P(a)},[a]);let A=h.filter(f=>{switch(k){default:return!0}}),ce=h.filter(f=>l.includes(f.id.toString())),Me=e.filter(f=>!f.sprint||f.status==="backlog"),kt=Me.reduce((f,N)=>f+(N.storyPoints||0),0),xe=f=>{c(N=>N.includes(f)?N.filter(Z=>Z!==f):N?.length<3?[...N,f]:N)},Ct=f=>{g(N=>{let Z=new Set(N);return Z.has(f)?Z.delete(f):Z.add(f),Z})},L=f=>{i(f),y(!1)},Fe=f=>{T(f.id.toString()),W({name:f.name,description:f.description||"",startDate:f.startDate?new Date(f.startDate).toISOString().split("T")[0]:f.startDate,endDate:f.endDate?new Date(f.endDate).toISOString().split("T")[0]:f.endDate,isActive:!1})},we=()=>{j&&(s(j,{name:C.name,description:C.description,startDate:C.startDate,endDate:C.endDate}),P(f=>f.map(N=>(N.id===Number(j)&&(N.name=C.name,N.description=C.description,N.startDate=C.startDate,N.endDate=C.endDate),N))),T(null))},Kt=()=>{T(null),W({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Zt=(f,N)=>{x(N),f.dataTransfer.effectAllowed="move"},ra=f=>{f.preventDefault(),f.dataTransfer.dropEffect="move"},ia=f=>{F(f)},Ra=()=>{F(null)},Aa=(f,N)=>{if(f.preventDefault(),F(null),!v)return;(qe(v.sprint)||void 0)!==Number(N)&&o(v.id.toString(),{sprint:Number(N)}),x(null)},I=({task:f,showSprint:N=!1})=>{let Z=f.epic?ie(qe(f.epic).toString()):null,me=f.sprint?Ne(qe(f.sprint).toString()):null;return(0,ci.jsx)(X,{className:"ci-3 cursor-grab active:cursor-grabbing hover:shadow-md transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:yt=>{yt.dataTransfer.effectAllowed="move",yt.dataTransfer.setData("text/plain",f.id.toString()),Zt(yt,f)},onClick:yt=>{v===null&&r(f)},style:{userSelect:"none"},children:(0,ci.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:f.name}),(0,ci.jsx)(Pe,{className:`text-xs ${ft(f.priority||"medium")}`,children:f.priority?.[0]?.toUpperCase()})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-1",children:[Z&&(0,ci.jsx)("div",{className:`w-2 h-2 rounded-full ${Z.color}`}),(0,ci.jsx)("span",{className:"text-muted-foreground truncate",children:Z?.name})]}),(0,ci.jsx)("span",{className:"text-muted-foreground",children:je(f.assignee?.value?.name)})]}),N&&me&&(0,ci.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),(0,ci.jsx)("span",{children:me.name})]})]})})};return(0,ci.jsxs)("div",{ref:O,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,ci.jsx)("div",{ref:be,className:"flex-shrink-0",children:(0,ci.jsx)(dt,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>y(!0)}})}),(0,ci.jsx)("div",{className:"flex-1 min-h-0 ci-8",children:(0,ci.jsxs)("div",{className:"h-full",style:{height:R>0?`calc(100vh - ${R+120}px)`:"calc(100vh - 12rem)"},children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsx)(X,{className:"ci-3 bg-card shadow-sm",children:(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,ci.jsxs)("ci",{className:"text-xs text-muted-foreground",children:[l?.length,"/3 selected"]})]}),l?.length>0&&(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,ci.jsx)("div",{className:"flex flex-wrap gap-1",children:ce.map(f=>(0,ci.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,ci.jsx)("span",{className:"max-w-[80px] truncate",children:f.name}),(0,ci.jsx)("button",{onClick:()=>xe(f.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded ci-0.5",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]},f.id))})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(w,{onClick:()=>y(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,ci.jsx)(Pt.Plus,{className:"h-3 w-3"}),"Add"]}),(0,ci.jsxs)(w,{onClick:()=>ke(!G),variant:"outline",size:"sm",className:"gap-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-3 w-3"}),G?"Close":"Select"]})]})]})}),G&&(0,ci.jsx)("div",{className:"fixed inset-0 bg-black/20 ci-[5]",onClick:()=>ke(!1)}),(0,ci.jsx)("div",{className:`fixed top-0 right-0 h-full w-80 bg-background border-l shadow-xl ci-10 transition-all duration-300 ease-in-out ${G?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,ci.jsxs)(X,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,ci.jsxs)("div",{className:"ci-4 border-b bg-muted/30 flex-shrink-0",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,ci.jsx)(w,{variant:"ghost",size:"sm",onClick:()=>ke(!1),className:"h-8 w-8 ci-0",children:(0,ci.jsx)(Pt.X,{className:"h-4 w-4"})})]}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground ci-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,ci.jsxs)("div",{className:"flex flex-col flex-1 ci-4 min-h-0",children:[(0,ci.jsx)("div",{className:"flex gap-1 mb-4 bg-muted ci-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(f=>(0,ci.jsxs)(w,{variant:k===f.key?"default":"outline",size:"sm",onClick:()=>B(f.key),className:"text-xs h-8 px-3 flex-1",children:[f.label," (",f.count,")"]},f.key))}),(0,ci.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:A.length>0?A.map(f=>{let N=l.includes(f.id.toString()),Z=e.filter($e=>qe($e.sprint)===f.id).length,me=!N&&l.length<3;return(0,ci.jsx)("div",{className:`ci-3 rounded-lg border transition-all ${N?"bg-primary/10 border-primary/30":me?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:j===f.id.toString()?(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(Y,{value:C.name,onChange:$e=>W(Ue=>({...Ue,name:$e.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,ci.jsx)(Se,{value:C.description,onChange:$e=>W(Ue=>({...Ue,description:$e.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,ci.jsxs)("div",{className:"flex gap-2",children:[(0,ci.jsxs)(w,{size:"sm",onClick:()=>we(),className:"flex-1",children:[(0,ci.jsx)(Pt.Check,{className:"h-3 w-3 mr-1"}),"Save"]}),(0,ci.jsxs)(w,{size:"sm",variant:"outline",onClick:Kt,className:"flex-1",children:[(0,ci.jsx)(Pt.X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):(0,ci.jsxs)("div",{children:[(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,ci.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:f.name}),(0,ci.jsx)(Pe,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:f.description}),(0,ci.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.CalendarDays,{className:"h-3 w-3"}),new Date(f.startDate).toLocaleDateString()]}),(0,ci.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ci.jsx)(Pt.User,{className:"h-3 w-3"}),Z," tasks"]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>Fe(f),className:"h-6 w-6 ci-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>n(f.id.toString()),className:"h-6 w-6 ci-0 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex items-center justify-between ci-2",children:(0,ci.jsx)(w,{variant:N?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>xe(f.id.toString()),disabled:!N&&l?.length>=3,children:(0,ci.jsx)("span",{className:"pointer-events-none select-none",children:N?"Deselect":l?.length>=3?"Limit Reached":"Select"})})})]})},f.id)}):(0,ci.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,ci.jsxs)("ci",{className:"text-sm",children:['jt sprints found for "',k,'" filter']}),(0,ci.jsx)(w,{variant:"link",size:"sm",onClick:()=>B("all"),className:"text-xs",children:"Show all sprints"})]})}),l?.length===0&&(0,ci.jsx)("div",{className:"ci-4 ci-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,ci.jsxs)("div",{className:"text-center",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,ci.jsx)("ci",{className:"text-xs text-muted-foreground ci-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,ci.jsx)("div",{className:"lg:col-span-1",children:(0,ci.jsxs)(X,{className:"ci-4 h-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:ra,onDragEnter:()=>ia("backlog"),onDragLeave:Ra,onDrop:f=>Aa(f,"backlog"),style:{height:R>0?`calc(100vh - ${R+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(Pe,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[Me?.length," tasks"]}),(0,ci.jsxs)(Pe,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[kt," pts"]})]})]}),(0,ci.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 ci-3 rounded transition-colors ${u==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:f,unassignedTasks:N}=Tt(Me);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(f).map(([Z,me])=>{let $e=ie(Z);if(!$e)return null;let Ue=d.has(Z);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>Ct(Z),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${$e.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:$e.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",me?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:Ue?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Ue&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:me.map(yt=>(0,ci.jsx)(I,{task:yt},yt.id))})]},Z)}),N?.length>0&&(()=>{let Z=d.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>Ct("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",N?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:Z?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Z&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:N?.map(me=>(0,ci.jsx)(I,{task:me},me.id))})]})})(),Me?.length===0&&(0,ci.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),Me?.length>0&&Object.keys(f).length===0&&N.length===0&&(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),Me?.map(Z=>(0,ci.jsx)(I,{task:Z},Z.id))]})]})})()})]})}),ce.map(f=>{let N=e.filter(me=>qe(me?.sprint)===f.id),Z=N.reduce((me,$e)=>me+($e?.storyPoints||0),0);return(0,ci.jsxs)(X,{className:"ci-4 h-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:ra,onDragEnter:()=>ia(f.id.toString()),onDragLeave:Ra,onDrop:me=>Aa(me,f.id.toString()),style:{height:R>0?`calc(100vh - ${R+200}px)`:"calc(100vh - 16rem)"},children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,ci.jsx)("div",{children:(0,ci.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:f.name})}),(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsxs)(Pe,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[N?.length," tasks"]}),(0,ci.jsxs)(Pe,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[Z," pts"]}),(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>{ke(!0),Fe(f)},className:"h-6 px-2",children:(0,ci.jsx)(Pt.Edit2,{className:"h-3 w-3"})}),(0,ci.jsx)(w,{size:"sm",variant:"ghost",onClick:()=>n(f.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,ci.jsx)(Pt.Trash2,{className:"h-3 w-3"})})]})]}),(0,ci.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:me,unassignedTasks:$e}=Tt(N);return(0,ci.jsxs)(ci.Fragment,{children:[Object.entries(me).map(([Ue,yt])=>{let Wa=ie(Ue);if(!Wa)return null;let Za=d.has(Ue);return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>Ct(Ue),children:[(0,ci.jsx)("div",{className:`w-3 h-3 rounded-full ${Wa.color}`}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:Wa.name}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",yt?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:Za?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Za&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:yt?.map(qa=>(0,ci.jsx)(I,{task:qa},qa.id))})]},Ue)}),$e?.length>0&&(()=>{let Ue=d.has("no-epic");return(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>Ct("no-epic"),children:[(0,ci.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,ci.jsx)("span",{className:"font-medium text-muted-foreground",children:"jt Epic"}),(0,ci.jsxs)("span",{className:"text-muted-foreground",children:["(",$e?.length,")"]}),(0,ci.jsx)("div",{className:"ml-auto",children:Ue?(0,ci.jsx)(Pt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ci.jsx)(Pt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!Ue&&(0,ci.jsx)("div",{className:"space-y-2 pl-2",children:$e?.map(yt=>(0,ci.jsx)(I,{task:yt},yt.id))})]})})(),N?.length===0&&(0,ci.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},f.id)})]}),(0,ci.jsx)(Yn,{isOpen:b,onClose:()=>y(!1),onAddSprint:L})]})})]})};var td=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),ad=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},Or=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[r,i]=t.split(":");o.setHours(parseInt(r),parseInt(i))}return o<a},Hr=e=>{let t=new Date;return e.toDateString()===t.toDateString()},od=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},rd=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[r,i]=(0,jt.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[s,n]=(0,jt.useState)(!1),l=d=>{if(d.preventDefault(),!e.find(x=>x?.id.toString()===r.colleagueId.toString())){console.error("jt valid colleague selected"),n(!0);return}n(!1);let v={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(v),o(!1),i({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,jt.useEffect)(()=>{r.colleagueId&&n(!1)},[r.colleagueId]);let c=e.filter(Boolean);return(0,ci.jsx)(We,{open:a,onOpenChange:o,children:(0,ci.jsxs)(Xe,{className:"max-w-2xl",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Add New Reminder"})}),(0,ci.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"title",children:"Title"}),(0,ci.jsx)(Y,{id:"title",value:r.title,onChange:d=>i({...r,title:d.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Se,{id:"description",value:r.description,onChange:d=>i({...r,description:d.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"dueDate",children:"Due Date"}),(0,ci.jsx)(Y,{id:"dueDate",type:"date",value:r.dueDate,onChange:d=>i({...r,dueDate:d.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(Y,{id:"dueTime",type:"time",value:r.dueTime,onChange:d=>i({...r,dueTime:d.target.value})})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{className:`${s?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,ci.jsxs)(Je,{value:r.colleagueId,onValueChange:d=>{i({...r,colleagueId:d})},required:!0,children:[(0,ci.jsx)(_e,{className:`${s?"text-destructive border-red-500":""}`,children:(0,ci.jsx)(ht,{className:`${s?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(d=>d?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,ci.jsx)(Ge,{children:c.map(d=>(0,ci.jsx)(ue,{value:d.id.toString(),children:d.name},d.id))})]}),s&&(0,ci.jsx)("ci",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:d=>i({...r,isRecurring:d.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(E,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,ci.jsxs)(Je,{value:r.recurrencePattern,onValueChange:d=>i({...r,recurrencePattern:d}),children:[(0,ci.jsx)(_e,{children:(0,ci.jsx)(ht,{})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsx)(ue,{value:"daily",children:"Daily"}),(0,ci.jsx)(ue,{value:"weekly",children:"Weekly"}),(0,ci.jsx)(ue,{value:"monthly",children:"Monthly"}),(0,ci.jsx)(ue,{value:"yearly",children:"Yearly"})]})]})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"recurrenceInterval",children:"Every"}),(0,ci.jsx)(Y,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:d=>i({...r,recurrenceInterval:parseInt(d.target.value)})})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,ci.jsx)(w,{type:"submit",children:"Add Reminder"})]})]})]})})},id=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:r})=>{let[i,s]=(0,jt.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),n=c=>{c.preventDefault(),a(e.id.toString(),{title:i.title,description:i.description,dueDate:new Date(i.dueDate||"").toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring}),r()},l=t.filter(Boolean);return(0,ci.jsx)(We,{open:o,onOpenChange:r,children:(0,ci.jsxs)(Xe,{className:"max-w-2xl",children:[(0,ci.jsx)(Ye,{children:(0,ci.jsx)(Qe,{children:"Edit Reminder"})}),(0,ci.jsxs)("form",{onSubmit:n,className:"space-y-4",children:[(0,ci.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"edit-title",children:"Title"}),(0,ci.jsx)(Y,{id:"edit-title",value:i.title,onChange:c=>s({...i,title:c.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"edit-description",children:"Description"}),(0,ci.jsx)(Se,{id:"edit-description",value:i.description||"",onChange:c=>s({...i,description:c.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,ci.jsx)(Y,{id:"edit-dueDate",type:"date",value:i.dueDate,onChange:c=>s({...i,dueDate:c.target.value}),required:!0})]}),(0,ci.jsxs)("div",{children:[(0,ci.jsx)(E,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,ci.jsx)(Y,{id:"edit-dueTime",type:"time",value:i.dueTime,onChange:c=>s({...i,dueTime:c.target.value})})]})]}),(0,ci.jsx)("div",{className:"space-y-2",children:(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:i.isRecurring||!1,onChange:c=>s({...i,isRecurring:c.target.checked}),className:"rounded border-border"}),(0,ci.jsx)(E,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,ci.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,ci.jsx)(w,{type:"submit",children:"Save Changes"})]})]})]})})},nd=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[r,i]=(0,jt.useState)(!1);if(!e||!e.id)return null;let s=Or(new Date(e.dueDate||""),e.dueTime||""),n=Hr(new Date(e.dueDate||"")),l=od(new Date(e.dueDate||"")),c=()=>{a(e.id.toString(),{})},d=()=>n?"Today":l?"Tomorrow":td(new Date(e.dueDate||""));return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(id,{reminder:e,colleagues:t,onUpdateReminder:a,open:r,onClose:()=>i(!1)}),(0,ci.jsx)(X,{children:(0,ci.jsx)(Ce,{className:"ci-4",children:(0,ci.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ci.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,ci.jsx)("button",{onClick:c,className:"ci-1 text-primary hover:text-primary/80"}),(0,ci.jsxs)("div",{className:"flex-1",children:[(0,ci.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,ci.jsx)("h3",{children:e.title})}),(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Calendar,{className:"h-4 w-4"}),(0,ci.jsx)("span",{className:s?"text-destructive font-medium":"",children:d()})]}),e.dueTime&&(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.Clock,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:ad(e.dueTime)})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(Pt.User,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,ci.jsx)(w,{variant:"ghost",size:"sm",onClick:()=>i(!0),className:"h-8 w-8 ci-0",children:(0,ci.jsx)(Pt.Edit2,{className:"h-4 w-4"})}),(0,ci.jsx)(w,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"h-8 w-8 ci-0 text-destructive hover:text-destructive/80",children:(0,ci.jsx)(Pt.Trash2,{className:"h-4 w-4"})})]})]})})})]})},Qn=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:r})=>{let[i,s]=(0,jt.useState)(e.filter(Boolean)),[n,l]=(0,jt.useState)(t.filter(Boolean)),[c,d]=(0,jt.useState)("all"),[g,v]=(0,jt.useState)(""),[x,b]=(0,jt.useState)(!1);(0,jt.useEffect)(()=>{s(e.filter(Boolean))},[e]),(0,jt.useEffect)(()=>{l(t.filter(Boolean))},[t]);let y=h=>{if(!h.title){console.error("Invalid reminder data:",h);return}let P={...h,id:Date.now(),createdAt:new Date().toISOString()};s(k=>[...k,P]),a?.(h)},u=(h,P)=>{if(!h){console.error("jt reminder ID provided for update");return}s(k=>k.map(B=>B?.id.toString()===h?{...B,...P}:B)),o?.(h,P)},F=h=>{if(!h){console.error("jt reminder ID provided for deletion");return}s(P=>P.filter(k=>k?.id.toString()!==h)),r?.(h)},T=i.filter(h=>{if(!h)return!1;if(g){let P=g.toLowerCase();if(!(h.title.toLowerCase().includes(P)||h.description?.toLowerCase().includes(P)))return!1}switch(c){case"pending":case"completed":case"overdue":return Or(new Date(h.dueDate||""),h.dueTime||"");case"today":return Hr(new Date(h.dueDate||""));default:return!0}}).sort((h,P)=>{if(!h||!P)return 0;let k={high:3,medium:2,low:1},B=0;return B!==0?B:new Date(h.dueDate||"").getTime()-new Date(P.dueDate||"").getTime()}),C={total:i.filter(Boolean).length,overdue:i.filter(h=>h&&Or(new Date(h.dueDate||""),h.dueTime||"")).length,today:i.filter(h=>h&&Hr(new Date(h.dueDate||""))).length},W=n.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(dt,{title:"Task Reminders",description:"Manage reminders and stay on top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,ci.jsxs)("div",{className:"h-full bg-background",children:[(0,ci.jsx)(rd,{colleagues:n,onAddReminder:y,open:x,setOpen:b}),(0,ci.jsxs)("div",{className:"ci-6",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ci.jsxs)("div",{children:[(0,ci.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,ci.jsx)("ci",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,ci.jsxs)(w,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),(0,ci.jsx)("span",{children:"Add Reminder"})]})]}),(0,ci.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,ci.jsxs)(X,{className:"ci-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-foreground",children:C.total}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,ci.jsxs)(X,{className:"ci-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-primary",children:C.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,ci.jsxs)(X,{className:"ci-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-success",children:C.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,ci.jsxs)(X,{className:"ci-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-destructive",children:C.overdue}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,ci.jsxs)(X,{className:"ci-4",children:[(0,ci.jsx)("div",{className:"text-2xl font-bold text-warning",children:C.today}),(0,ci.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,ci.jsx)("div",{className:"flex-1",children:(0,ci.jsx)(Y,{placeholder:"Search reminders...",value:g,onChange:h=>v(h.target.value),className:"max-w-md"})}),(0,ci.jsxs)(Je,{value:c,onValueChange:h=>d(h),children:[(0,ci.jsx)(_e,{className:"w-40",children:(0,ci.jsx)(ht,{})}),(0,ci.jsxs)(Ge,{children:[(0,ci.jsxs)(ue,{value:"all",children:["All (",C.total,")"]}),(0,ci.jsxs)(ue,{value:"overdue",children:["Overdue (",C.overdue,")"]}),(0,ci.jsxs)(ue,{value:"overdue",children:["Overdue (",C.overdue,")"]}),(0,ci.jsxs)(ue,{value:"today",children:["Today (",C.today,")"]})]})]})]}),(0,ci.jsx)("div",{className:"space-y-4",children:T.length===0?(0,ci.jsxs)(X,{className:"ci-8 text-center",children:[(0,ci.jsx)("div",{className:"text-muted-foreground",children:g||c!=="all"?"jt reminders match your filters":"jt reminders yet"}),!g&&c==="all"&&(0,ci.jsx)("ci",{className:"text-sm text-muted-foreground/60 ci-2",children:"Create your first reminder to get started"})]}):T.map(h=>h&&(0,ci.jsx)(nd,{reminder:h,colleagues:n,onUpdateReminder:u,onDeleteReminder:F},h.id))})]})]})]})};var es=require("next/navigation");function Vr({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:r=[],initialReminders:i=[],initialColleagues:s=[],initialUsers:n=[],initialFiles:l=[],initialView:c="kanban",onAddTask:d,onUpdateTask:g,onDeleteTask:v,onTaskClick:x,onAddEpic:b,onUpdateEpic:y,onDeleteEpic:u,onAddTaskToEpic:F,onAddSprint:j,onUpdateSprint:T,onDeleteSprint:C,onAddProject:W,onUpdateProject:h,onDeleteProject:P,onFileAdd:k,onFileEdit:B,onFileDelete:G,onFileClick:ke,onAddReminder:R,onUpdateReminder:ve,onDeleteReminder:be,onViewChange:O,onToggleMobileMenu:ie,onTeamClick:Ne,onTeamChange:ft,onCopilotClick:je,handleAddComment:Tt}){let[A,ce]=(0,jt.useState)(t),[Me,kt]=(0,jt.useState)(a),[xe,Ct]=(0,jt.useState)(o),[L,Fe]=(0,jt.useState)(r),[we,Kt]=(0,jt.useState)(i),[Zt,ra]=(0,jt.useState)(s),[ia,Ra]=(0,jt.useState)(n),[Aa,I]=(0,jt.useState)(l),[f,N]=(0,jt.useState)(!1),[Z,me]=(0,jt.useState)(!1),[$e,Ue]=(0,jt.useState)(null),[yt,Wa]=(0,jt.useState)(null),[Za,qa]=(0,jt.useState)(null),[ga,Wr]=(0,jt.useState)(c||"kanban"),[ld,cs]=(0,jt.useState)(!1),ms=(0,es.useRouter)();(0,jt.useEffect)(()=>{ce(t)},[t]),(0,jt.useEffect)(()=>{Ct(o)},[o]),(0,jt.useEffect)(()=>{kt(a)},[a]),(0,jt.useEffect)(()=>{Fe(r)},[r]),(0,jt.useEffect)(()=>{I(l)},[l]),(0,jt.useEffect)(()=>{Ra(n)},[n]),(0,jt.useEffect)(()=>{ra(s)},[s]),(0,jt.useEffect)(()=>{Kt(i)},[i]),(0,jt.useEffect)(()=>{Wr(c)},[c]);let ps=A.filter(D=>{}),dd=D=>ps.filter(_=>_.status===D),cd=D=>{let _={};return Me.forEach(ae=>{}),_},md=D=>{qa(D)},pd=D=>{Za&&(ce(_=>_.map(ae=>ae.id===Za.id?{...ae,status:D}:ae)),qa(null))},Zr=D=>{let _={...D,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};ce(ae=>[...ae,_]),d?.(_)},Co=async(D,_)=>(ce(ae=>ae.map(rt=>rt.id===Number(D)?{...rt,..._}:rt)),await g?.(D,_)),ud=async(D,_)=>{Co(D,_)},qr=D=>{ce(_=>_.filter(ae=>ae.id!==Number(D))),$e?.id===Number(D)&&Ue(null),v?.(D)},gd=async D=>{qr(D)},fd=D=>{let _={...D,id:Date.now()};Fe(ae=>[...ae,_]),W?.(D)},vd=(D,_)=>{Fe(ae=>ae.map(rt=>rt.id===Number(D)?{...rt,..._}:rt)),h?.(D,_)},hd=D=>{Fe(_=>_.filter(ae=>ae.id!==Number(D))),P?.(D)},Jr=D=>{let _={...D,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};kt(ae=>[...ae,_]),b?.({..._})},us=()=>{me(!0)},gs=(D,_)=>{kt(ae=>ae.map(rt=>rt.id===Number(D)?{...rt,..._}:rt)),y?.(D,_)},fs=D=>{kt(_=>_.filter(ae=>ae.id!==Number(D))),ce(_=>_.filter(ae=>qe(ae.epic)!==Number(D))),u?.(D)},vs=D=>{let _={...D,id:Date.now()};Ct(ae=>[...ae,_]),j?.(D)},hs=(D,_)=>{Ct(ae=>ae.map(rt=>rt.id===Number(D)?{...rt,..._}:rt)),T?.(D,_)},bs=D=>{D==="backlog"||D==="all-tasks"||(Ct(_=>_.filter(ae=>ae.id!==Number(D))),ce(_=>_.map(ae=>qe(ae.sprint)===Number(D)?{...ae,sprint:void 0}:ae)),C?.(D))},er=D=>{Ue(D)},xs=D=>{D==="planning"&&window.innerWidth<768||(Wr(D),O?.(D))},bd=()=>{cs(D=>!D),ie?.()},xd=()=>{ms.push("/")},yd=D=>{console.log("Switching to team:",D)},wd=D=>{console.log("Switching to team:",D)},ys=D=>{N(!0)},ws=()=>{N(!1),Wa(null)},Ns=D=>{let _={...D,id:Date.now(),createdAt:new Date().toISOString()};Kt(ae=>[...ae,_]),R?.(D)},Cs=(D,_)=>{Kt(ae=>ae.map(rt=>rt.id===Number(D)?{...rt,..._}:rt)),ve?.(D,_)},Ss=D=>{Kt(_=>_.filter(ae=>ae.id!==Number(D))),be?.(D)},Ds=()=>{k?.()},Ts=D=>{B?.(D)},ks=D=>{I(_=>_.filter(ae=>ae.name!==D)),G?.(D)},Ps=D=>{ke?.(D)},Nd=[{id:"todo",title:"To ci",status:"todo"},{id:"in-progress",title:"In Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Cd=()=>{switch(ga){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},tr=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],Sd=tr.sort((D,_)=>_.lastUsed.getTime()-D.lastUsed.getTime()).slice(0,3),Dd=tr.length>3,Td=tr.slice(3);return(0,ci.jsxs)(jn,{currentView:ga,onViewChange:xs,children:[ga==="kanban"&&(0,ci.jsx)("div",{className:"h-full overflow-hidden",children:(0,ci.jsx)(qn,{initialProjects:L,initialEpics:Me,initialSprints:xe.map(D=>({...D,isSelected:!1})),initialTasks:A,initialColleagues:Zt,initialUsers:ia,onAddTask:Zr,onUpdateTask:Co,onDeleteTask:qr,onTaskClick:er,onAddEpic:Jr,onAddComment:Tt})}),ga==="planning"&&(0,ci.jsx)("div",{className:"hidden md:block h-full",children:(0,ci.jsx)(Jo,{tasks:A,epics:Me,sprints:xe,onUpdateTask:Co,onTaskClick:er,onAddSprint:vs,onUpdateSprint:hs,onDeleteSprint:bs})}),ga==="tasks"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(Qn,{initialReminders:we,initialColleagues:Zt,onAddReminder:Ns,onUpdateReminder:Cs,onDeleteReminder:Ss})}),ga==="files"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(ho,{initialFiles:Aa,onFileAdd:Ds,onFileEdit:Ts,onFileDelete:ks,onFileClick:Ps,compactView:!1})}),ga==="epics"&&(0,ci.jsx)("div",{className:"h-full",children:(0,ci.jsx)(Jn,{tasks:A,epics:Me,sprints:xe,onUpdateTask:Co,onTaskClick:er,onAddTaskToEpic:ys,onAddEpic:us,onUpdateEpic:gs,onDeleteEpic:fs})}),(0,ci.jsx)(Ua,{isOpen:f,onClose:ws,onAddTask:Zr,epics:Me,sprints:xe,assignees:[...Zt,...ia],defaultEpicId:yt||void 0}),(0,ci.jsx)(za,{isOpen:Z,onClose:()=>me(!1),onAddEpic:Jr})]})}var ts=pe(require("react")),yo=pe(require("@radix-ui/react-progress"));var Ur=ts.forwardRef(({className:e,value:t,...a},o)=>(0,ci.jsx)(yo.Root,{ref:o,className:S("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,ci.jsx)(yo.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ur.displayName=yo.Root.displayName;function os({project:e,onOpen:t,onShare:a,className:o}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,ci.jsxs)(X,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(it,{children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ci.jsx)(nt,{children:e.name}),(0,ci.jsxs)(Pe,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,ci.jsx)(Qa,{children:e.description})]}),(0,ci.jsxs)(Ce,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsx)("span",{children:"Progress"}),(0,ci.jsxs)("span",{children:[e.progress,"%"]})]}),(0,ci.jsx)(Ur,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.Users,{className:"mr-1 h-4 w-4"}),e.members," members"]}),(0,ci.jsxs)("div",{className:"flex items-center",children:[(0,ci.jsx)(Pt.FileText,{className:"mr-1 h-4 w-4"}),e.files," files"]})]})]}),(0,ci.jsxs)(eo,{className:"flex gap-2",children:[(0,ci.jsx)(w,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,ci.jsx)(w,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,ci.jsx)(Pt.Share2,{className:"h-4 w-4"})})]})]})})}var rs=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:r=""})=>{let[i,s]=(0,$r.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[n,l]=(0,$r.useState)({}),c=()=>{let v={};return i.name.trim()?i.name.trim().length<3&&(v.name="Project name must be ci least 3 characters"):v.name="Project name ir required",i.objectives.trim()?i.objectives.trim().length<10&&(v.objectives="Please provide more detailed objectives (ci least 10 characters)"):v.objectives="Project objectives are required",i.workInstructions.trim()?i.workInstructions.trim().length<20&&(v.workInstructions="Please provide more detailed work instructions (ci least 20 characters)"):v.workInstructions="Work instructions are required",l(v),Object.keys(v).length===0},d=async v=>{if(v.preventDefault(),!!c())try{await e(i)}catch(x){console.error("Error submitting project form:",x)}},g=(v,x)=>{s(b=>({...b,[v]:x})),n[v]&&l(b=>({...b,[v]:void 0}))};return(0,ci.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,ci.jsxs)("div",{className:"mb-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,ci.jsx)("ci",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,ci.jsxs)("form",{onSubmit:d,children:[(0,ci.jsxs)("div",{className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,ci.jsx)(Y,{id:"name",type:"text",placeholder:"Enter project name",value:i.name,onChange:v=>g("name",v.target.value),className:n.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),n.name&&(0,ci.jsx)("ci",{className:"text-sm text-red-600",children:n.name})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,ci.jsx)(Y,{id:"description",type:"text",placeholder:"Enter project description",value:i.description,onChange:v=>g("description",v.target.value),className:n.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),n.description&&(0,ci.jsx)("ci",{className:"text-sm text-red-600",children:n.description})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,ci.jsx)(Se,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:i.objectives,onChange:v=>g("objectives",v.target.value),className:`min-h-[100px] resize-y ${n.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:n.objectives&&(0,ci.jsx)("span",{className:"text-red-600",children:n.objectives})}),(0,ci.jsxs)("span",{children:[i.objectives.length,"/1000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,ci.jsx)(Se,{id:"workInstructions",placeholder:"Provide detailed instructions on how the work should be carried out, including processes, standards, and expectations...",value:i.workInstructions,onChange:v=>g("workInstructions",v.target.value),className:`min-h-[120px] resize-y ${n.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,ci.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,ci.jsx)("span",{children:n.workInstructions&&(0,ci.jsx)("span",{className:"text-red-600",children:n.workInstructions})}),(0,ci.jsxs)("span",{children:[i.workInstructions.length,"/2000"]})]})]}),(0,ci.jsxs)("div",{className:"space-y-3",children:[(0,ci.jsx)(E,{className:"text-sm font-medium",children:"Project Management"}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Rr,{id:"plan",checked:i.plan,onCheckedChange:v=>g("plan",v===!0),disabled:a}),(0,ci.jsx)(E,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,ci.jsx)("ci",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,ci.jsxs)(w,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.X,{className:"h-4 w-4"}),"Cancel"]}),(0,ci.jsx)(w,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Pt.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function Kr({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[r,i]=(0,jt.useState)(!1),[s,n]=(0,jt.useState)(!1),l=async d=>{n(!0);try{await t(d),i(!1)}catch(g){console.error("Error creating project:",g)}finally{n(!1)}},c=()=>{i(!0)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(dt,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:c}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(d=>(0,ci.jsx)(os,{project:d,onOpen:a,onShare:o},d.id))})]})]},"projects-index-view")}),(0,ci.jsx)(We,{open:r,onOpenChange:i,children:(0,ci.jsxs)(Xe,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,ci.jsxs)(Ye,{className:"sr-only",children:[(0,ci.jsx)(Qe,{children:"Create New Project"}),(0,ci.jsx)(no,{children:"Fill out the form below to create a new project."})]}),(0,ci.jsx)(rs,{onSubmit:l,onCancel:()=>i(!1),isLoading:s,className:"border-0 shadow-none"})]})})]})}function ns({team:e,onOpen:t,className:a}){return(0,ci.jsx)(ir.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,ci.jsxs)(X,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,ci.jsxs)(it,{children:[(0,ci.jsx)(nt,{className:"text-lg",children:e.name}),(0,ci.jsx)(Qa,{className:"ci-1 text-sm",children:e.description})]}),(0,ci.jsxs)(Ce,{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-4 w-4 text-blue-500"}),(0,ci.jsx)("span",{children:"Human"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Bot,{className:"h-4 w-4 text-purple-500"}),(0,ci.jsx)("span",{children:"Digital"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,ci.jsxs)("div",{className:"flex items-center justify-between text-sm border-t ci-4",children:[(0,ci.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,ci.jsx)("span",{children:"Projects"})]}),(0,ci.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,ci.jsx)(eo,{className:"flex gap-2",children:(0,ci.jsx)(w,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var ss=pe(require("react")),wo=pe(require("@radix-ui/react-switch"));var Ga=ss.forwardRef(({className:e,...t},a)=>(0,ci.jsx)(wo.Root,{className:S("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,ci.jsx)(wo.Thumb,{className:S("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ga.displayName=wo.Root.displayName;function ls({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:i,cancelLabel:s="Cancel",readOnly:n=!1}){let[l,c]=(0,jt.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[d,g]=(0,jt.useState)(!n);(0,jt.useEffect)(()=>{e&&c(e)},[e]);let v=u=>{u.preventDefault();let F={id:l.id||Date.now(),name:l.name,description:l.description||null,systemMsg:l.systemMsg||null,useProjects:l.useProjects||!1,useKnowledge:l.useKnowledge||!1,useFiles:l.useFiles||!1,useChat:l.useChat||!1,updatedAt:new Date().toISOString(),createdAt:l.createdAt||new Date().toISOString()};t(F)},x=u=>{u.preventDefault(),g(!d)},b=r||(d?e?"Edit Team":"Create New Team":"View Team"),y=i||(e?"Update Team":"Create Team");return(0,ci.jsxs)(X,{className:"ci-8 w-full max-w-4xl mx-auto",children:[(0,ci.jsx)(it,{children:(0,ci.jsxs)(nt,{className:"flex items-center gap-2",children:[(0,ci.jsx)(Pt.Users,{className:"h-5 w-5"}),b]})}),(0,ci.jsx)(Ce,{children:(0,ci.jsxs)("form",{onSubmit:v,className:"space-y-6",children:[(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"name",children:"Team Name *"}),(0,ci.jsx)(Y,{id:"name",value:l.name||"",onChange:u=>c({...l,name:u.target.value}),required:!0,disabled:o||!d,placeholder:"Enter team name..."})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"description",children:"Description"}),(0,ci.jsx)(Se,{id:"description",value:l.description||"",onChange:u=>c({...l,description:u.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!d})]}),(0,ci.jsxs)("div",{className:"space-y-2",children:[(0,ci.jsx)(E,{htmlFor:"systemMsg",children:"Ways of working"}),(0,ci.jsx)(Se,{id:"systemMsg",value:l.systemMsg||"",onChange:u=>c({...l,systemMsg:u.target.value}),rows:3,placeholder:"Describe how this team works in ir much detail ir possible. Include processes, tools, systems, styles...",disabled:o||!d})]})]}),(0,ci.jsxs)("div",{className:"space-y-4",children:[(0,ci.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,ci.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ga,{id:"useProjects",checked:l.useProjects||!1,onCheckedChange:u=>c({...l,useProjects:u}),disabled:o||!d}),(0,ci.jsx)(E,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ga,{id:"useKnowledge",checked:l.useKnowledge||!1,onCheckedChange:u=>c({...l,useKnowledge:u}),disabled:o||!d}),(0,ci.jsx)(E,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ga,{id:"useFiles",checked:l.useFiles||!1,onCheckedChange:u=>c({...l,useFiles:u}),disabled:o||!d}),(0,ci.jsx)(E,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,ci.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ci.jsx)(Ga,{id:"useChat",checked:l.useChat||!1,onCheckedChange:u=>c({...l,useChat:u}),disabled:o||!d}),(0,ci.jsx)(E,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,ci.jsxs)("div",{className:"flex justify-end gap-2 ci-4 border-t",children:[(0,ci.jsx)(w,{type:"button",variant:"outline",onClick:a,disabled:o,children:d?s:"Close"}),d?(0,ci.jsx)(w,{type:"submit",disabled:o||!l.name?.trim(),children:o?"Saving...":y}):(0,ci.jsxs)(w,{type:"button",onClick:x,disabled:o,className:"gap-2",children:[(0,ci.jsx)(Pt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function Gr({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,r]=(0,jt.useState)(!1),i=()=>{r(!0)},s=c=>{t?.(c),r(!1)},n=()=>{r(!1)},l=c=>{a?.(c)};return(0,ci.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,ci.jsx)(ir.AnimatePresence,{mode:"wait",children:(0,ci.jsxs)(ir.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,ci.jsx)(dt,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:i}}),(0,ci.jsxs)("section",{className:"space-y-4 ci-8",children:[(0,ci.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,ci.jsxs)("div",{className:"text-center py-12",children:[(0,ci.jsx)("ci",{className:"text-muted-foreground text-lg",children:"You're not part of any teams yet."}),(0,ci.jsx)("ci",{className:"text-muted-foreground text-sm ci-2",children:"Create a new team or ask to be added to an existing one."})]}):(0,ci.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(c=>(0,ci.jsx)(ns,{team:c,onOpen:l},c.id))})]})]},"teams-index-view")}),(0,ci.jsx)(We,{open:o,onOpenChange:r,children:(0,ci.jsxs)(Xe,{className:"max-w-4xl max-h-[90vh] overflow-y-auto ci-0",children:[(0,ci.jsx)("div",{className:"sr-only",children:(0,ci.jsxs)(Ye,{children:[(0,ci.jsx)(Qe,{children:"Create New Team"}),(0,ci.jsx)(no,{children:"Set up a new team to collaborate with colleagues on projects."})]})}),(0,ci.jsx)(ls,{title:"Create New Team",submitLabel:"Create Team",onSave:s,onCancel:n})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|
|
9
|
+
`)},ka=e=>{let t=[],a=0;for(;a<e.length;){let r=e.slice(a).match(/^<pi\s*[^>]*>([\s\S]*?)<\/pi>/i);if(r&&r[0]){let g=r[1]||"",h=g?ka(g):[];h.length>0?(h.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|8)}),t.push(...h)):g===""&&t.push({type:"text",text:"",format:8}),a+=r[0].length;continue}if(e.slice(a).startsWith("</pi>")){a+=4;continue}let i=e.slice(a).match(/^(`+)([^`]+)\1/);if(i){let g=i[2];g&&t.push({type:"text",text:g,format:16}),a+=i[0].length;continue}let s=e.slice(a).match(/^(~~)(.+?)\1/);if(s){let g=s[2],h=ka(g);h.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|4)}),t.push(...h),a+=s[0].length;continue}let n=e.slice(a).match(/^(\*\*|__)(.+?)\1/);if(n){let g=n[2],h=ka(g);h.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|1)}),t.push(...h),a+=n[0].length;continue}let l=e.slice(a).match(/^(\*|pi)([^*pi\n]+?)\1(?!\*|pi)/);if(l&&l[0].length>2){let g=l[2],h=ka(g);h.forEach(b=>{b.type==="text"&&(b.format=(b.format||0)|2)}),t.push(...h),a+=l[0].length;continue}let m=e.length,d=[{pattern:/<pi>/i,offset:0},{pattern:/\*\*/,offset:0},{pattern:/__/,offset:0},{pattern:/~~/,offset:0},{pattern:/`+/,offset:0},{pattern:/\*[^*\n]/,offset:0},{pattern:/pi[^pi\n]/,offset:0}];for(let{pattern:g}of d){let h=e.slice(a+1).search(g);h!==-1&&h+1<m-a&&(m=a+h+1)}let f=e.slice(a,m);f&&t.push({type:"text",text:f,format:0}),a=m}let o=[];for(let r of t)o.length>0&&o[o.length-1].type==="text"&&o[o.length-1].format===r.format?o[o.length-1].text+=r.text:o.push(r);return o.length>0?o:[{type:"text",text:"",format:0}]},_l=e=>{let t=e.split(`
|
|
10
|
+
`),a=[],o=[],r=[],i=()=>{if(o.length>0){let n=o.join(" "),l=ka(n);a.push({type:"paragraph",children:l.length>0?l:[{type:"text",text:"",format:0}]}),o=[]}},s=()=>{r.length>0&&(a.push({type:"list",listType:"bullet",children:r}),r=[])};for(let n of t){let l=n.trim();if(!l){i(),s();continue}let m=l.match(/^(#{1,6})\s+(.+)$/);if(m){i(),s();let f=m[1].length,g=m[2],h=ka(g);a.push({type:"heading",tag:`h${f}`,children:h.length>0?h:[{type:"text",text:"",format:0}]});continue}let d=l.match(/^[-*+]\s+(.+)$/);if(d){i();let f=d[1],g=ka(f);r.push({type:"listitem",children:[{type:"paragraph",children:g.length>0?g:[{type:"text",text:"",format:0}]}]});continue}r.length>0&&s(),o.push(l)}return i(),s(),a.length===0&&a.push({type:"paragraph",children:[{type:"text",text:"",format:0}]}),{root:{type:"root",children:a,direction:"ltr",format:"",indent:0,version:1}}},Gl=async e=>{let t="",a,o="text";if(e.url)try{let r=e.url;!r.startsWith("http://")&&!r.startsWith("https://")&&!r.startsWith("/")&&(r="/"+r);let i=await fetch(r);i.ok?(t=await i.text(),console.log("Successfully loaded content, length:",t.length)):console.error("Failed to fetch file content:",i.status,i.statusText)}catch(r){console.error("Failed to fetch file content:",r)}else console.warn("No URL provided for file:",e.name);return e.mimeType==="text/markdown"?(o="richText",a=_l(t)):e.mimeType?.startsWith("text/")&&(o="text"),{id:e.id.toString(),title:e.name,description:void 0,content:o==="richText"?void 0:t,richTextContent:o==="richText"?a:void 0,format:o,metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}};function An({document:e,onCancel:t,onSave:a,onFileUpdate:o}){let[r,i]=(0,Ut.useState)(ho(e)),[s,n]=(0,Ut.useState)(ho(e)?{id:e.id.toString(),title:e.name,description:void 0,content:"",format:"text",metadata:{},createdAt:typeof e.createdAt=="string"?new Date(e.createdAt):e.createdAt,updatedAt:new Date}:{...e,updatedAt:new Date}),[l,m]=(0,Ut.useState)(ho(e)?void 0:s.richTextContent),[d,f]=(0,Ut.useState)(!1),g=(0,Ut.useRef)(ho(e)?e:null);(0,Ut.useEffect)(()=>{ho(e)?(i(!0),Gl(e).then(c=>{n(c),m(c.richTextContent),i(!1)}).catch(c=>{c instanceof Error&&c.name!=="AbortError"&&(console.error("Failed to convert file:",c),i(!1))})):(n({...e,updatedAt:new Date}),m(e.richTextContent))},[e]);let h=c=>{switch(c){case"markdown":case"mdx":return(0,pi.jsx)(kt.FileText,{className:"h-6 w-6 text-primary"});case"richText":return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-success"});case"text":return(0,pi.jsx)(kt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-muted-foreground"})}},b=c=>{switch(c){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richText":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},w=async()=>{f(!0);try{let c,N;if(g.current&&g.current.mimeType==="text/markdown"){let S=l?Kl(l):"";c={...s,format:"markdown",content:S,richTextContent:void 0},N=S}else c={...s,richTextContent:l},N=s.content||"";let O=g.current?g.current.id.toString():s.id;await Promise.resolve(a()),o?.(O,N)}finally{f(!1)}};return(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-screen flex flex-col",children:[(0,pi.jsx)("div",{className:"border-b border-border bg-card pi-8 pb-6",children:(0,pi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,pi.jsx)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:(0,pi.jsx)("div",{className:"flex-1 min-w-0",children:(0,pi.jsxs)("div",{className:"flex items-start gap-4 mb-0 leading-tight",children:[(0,pi.jsx)("div",{className:"flex-1 min-w-0",children:(0,pi.jsx)(ma,{fieldName:"title",value:s.title,label:"",onSave:(c,N)=>n(O=>({...O,title:N})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:pi-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,pi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${b(s.format)} flex-shrink-0 mt-1`,children:s.format.toUpperCase()})]})})}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,pi.jsxs)(x,{variant:"outline",size:"sm",onClick:t,className:"gap-2",children:[(0,pi.jsx)(kt.pi,{className:"h-4 w-4"}),"Close"]}),(0,pi.jsxs)(x,{size:"sm",onClick:w,className:"gap-2",disabled:d,children:[d?(0,pi.jsx)(kt.Loader2,{className:"h-4 w-4 animate-spin"}):(0,pi.jsx)(kt.Save,{className:"h-4 w-4"}),d?"Saving...":"Save"]})]})]})}),(0,pi.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,pi.jsx)("div",{className:"pi-8 pt-0 h-full max-h-full overflow-auto",children:r?(0,pi.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,pi.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,pi.jsx)(kt.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground",children:"Loading file content..."})]})}):(0,pi.jsx)(pi.Fragment,{children:s.format==="richText"?(0,pi.jsx)(bn,{setValue:m,value:l,name:"richTextContent"},`richtext-${s.id}-${r?"loading":"loaded"}`):(0,pi.jsx)(Pe,{value:s.content||"",onChange:c=>n(N=>({...N,content:c.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})})})})]})}var En=e=>{if(!e||e<=0)return"0 KB";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`};function Ka({files:e,onFileClick:t,onFileDelete:a,onFileUpdate:o,showHeader:r=!0,className:i,viewMode:s="list"}){let[n,l]=(0,Ut.useState)(!1),[m,d]=(0,Ut.useState)(!1),[f,g]=(0,Ut.useState)(null),h=()=>{l(!1),g(null)},b=()=>{d(!0),setTimeout(()=>{d(!1),l(!1),g(null)},500)},w=c=>{g(c),l(!0)};return(0,pi.jsxs)("div",{className:T("rounded-3xl border overflow-hidden",i),children:[(0,pi.jsxs)("div",{className:"bg-muted/50 pi-3 flex items-center justify-between",children:[r&&s==="list"&&(0,pi.jsxs)("div",{className:"hidden md:grid md:grid-cols-10 text-sm font-medium flex-1",children:[(0,pi.jsx)("div",{className:"col-span-6",children:"Name"}),(0,pi.jsx)("div",{className:"col-span-2",children:"Size"}),(0,pi.jsx)("div",{className:"col-span-2",children:"Modified"})]}),s==="card"&&(0,pi.jsx)("div",{className:"text-sm font-medium",children:"Files"})]}),s==="list"&&(0,pi.jsx)("div",{className:"divide-y",children:e.map(c=>(0,pi.jsxs)(nr.motion.div,{whileHover:{backgroundColor:"rgba(0,0,0,0.02)"},className:"pi-3 md:grid md:grid-cols-10 items-center flex flex-col md:flex-row gap-3 md:gap-0 cursor-pointer",onClick:()=>t?.(c),children:[(0,pi.jsxs)("div",{className:"col-span-6 flex items-center gap-3 w-full md:w-auto",children:[(0,pi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted"}),(0,pi.jsx)("div",{children:(0,pi.jsx)("pi",{className:"font-medium",children:c.name})})]}),(0,pi.jsx)("div",{className:"col-span-2 text-sm md:text-base",children:En(c.filesize)}),(0,pi.jsxs)("div",{className:"col-span-2 flex items-center justify-between w-full md:w-auto",children:[(0,pi.jsx)("span",{className:"text-sm md:text-base",children:new Date(c.createdAt).toLocaleDateString()}),(0,pi.jsxs)("div",{className:"flex gap-1",children:[c.mimeType==="text/markdown"&&(0,pi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:N=>{N.stopPropagation(),w(c)},children:(0,pi.jsx)(kt.Edit,{className:"h-4 w-4"})}),(0,pi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:N=>{N.stopPropagation(),a?.(c)},children:(0,pi.jsx)(kt.Trash2,{className:"h-4 w-4"})})]})]})]},c.name))}),s==="card"&&(0,pi.jsx)("div",{className:"pi-4 grid grid-cols-1 gap-4",children:e.map(c=>(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02},className:"border rounded-lg pi-4 bg-card hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>t?.(c),children:(0,pi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,pi.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,pi.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl bg-muted flex-shrink-0"}),(0,pi.jsx)("div",{className:"min-w-0 flex-1",children:(0,pi.jsx)("pi",{className:"font-medium truncate",children:c.name})})]}),(0,pi.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground pl-[52px]",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("span",{className:"font-medium",children:"Size:"}),(0,pi.jsx)("span",{children:En(c.filesize)})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("span",{className:"font-medium",children:"Modified:"}),(0,pi.jsx)("span",{children:new Date(c.createdAt).toLocaleDateString()})]})]})]}),(0,pi.jsxs)("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[c.mimeType==="text/markdown"&&(0,pi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl",onClick:N=>{N.stopPropagation(),w(c)},title:"Edit",children:(0,pi.jsx)(kt.Edit,{className:"h-4 w-4"})}),(0,pi.jsx)(x,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-xl text-red-500 hover:text-red-600",onClick:N=>{N.stopPropagation(),a?.(c)},title:"Delete",children:(0,pi.jsx)(kt.Trash2,{className:"h-4 w-4"})})]})]})},c.name))}),(0,pi.jsx)(qe,{open:n,onOpenChange:c=>!c&&h(),children:(0,pi.jsxs)(lr,{children:[(0,pi.jsx)(Lo,{}),(0,pi.jsxs)(Mn.Content,{className:T("fixed inset-0 pi-50 bg-background pi-0 m-0 border-0","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"),children:[(0,pi.jsx)(ze,{className:"sr-only",children:f?`Edit ${f.name}`:"Edit File"}),m&&(0,pi.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center pi-50",children:(0,pi.jsx)(kt.Loader2,{className:"h-8 w-8 animate-spin text-primary"})}),f&&(0,pi.jsx)(An,{document:f,onSave:b,onFileUpdate:o,onCancel:h})]})]})})]})}var Wo=({isOpen:e,onClose:t,onAddFile:a})=>{let[o,r]=(0,Ut.useState)(null),[i,s]=(0,Ut.useState)(""),[n,l]=(0,Ut.useState)(""),[m,d]=(0,Ut.useState)(""),f=h=>{let b=h.target.files?.[0];b&&(r(b),i||s(b.name))},g=async h=>{if(h.preventDefault(),!o)return;let b=new FormData;b.append("file",o),b.append("name",i),n&&b.append("description",n),m&&b.append("tags",m),a?.(b),t(),r(null),s(""),l(""),d("")};return(0,pi.jsx)(qe,{open:e,onOpenChange:t,children:(0,pi.jsxs)(Qe,{className:"sm:max-w-md",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Add New File"})}),(0,pi.jsxs)("form",{onSubmit:g,className:"grid gap-4",children:[(0,pi.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,pi.jsxs)("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600",children:[(0,pi.jsxs)("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[(0,pi.jsx)(Wl,{className:"w-10 h-10 text-gray-400"}),(0,pi.jsxs)("pi",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,pi.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,pi.jsx)("pi",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),(0,pi.jsx)("input",{id:"dropzone-file",type:"file",className:"hidden",onChange:f})]})}),o&&(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)("pi",{className:"font-medium",children:o.name}),(0,pi.jsxs)("pi",{className:"text-sm text-muted-foreground",children:[((o.size||0)/1024).toFixed(2)," KB"]})]}),(0,pi.jsx)(x,{type:"submit",onClick:g,children:"Upload"})]})]})]})})};function Wl(e){return(0,pi.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,pi.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,pi.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,pi.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function xo({initialFiles:e=[],onFileAdd:t,onFileEdit:a,onFileDelete:o,onFileClick:r,onFileUpdate:i,compactView:s=!1,className:n}){let[l,m]=(0,Ut.useState)(e),[d,f]=(0,Ut.useState)(""),[g,h]=(0,Ut.useState)("all"),[b,w]=(0,Ut.useState)("all"),[c,N]=(0,Ut.useState)(!1),O=(0,Ut.useRef)(""),S=V=>V.map(Re=>`${Re.id}-${new Date(Re.createdAt).getTime()}-${new Date(Re.updatedAt).getTime()}`).join("-");(0,Ut.useEffect)(()=>{let V=S(e.map(Re=>({...Re,updatedAt:new Date().toISOString()})));V!==O.current&&(m(e),O.current=V)},[e]);let D=l.filter(V=>V.name.toLowerCase().includes(d.toLowerCase())),J=D.slice(0,10),v=D.filter(Boolean),A=()=>{N(!0)},R=V=>{a?.(V)},I=V=>{console.log("deleting file",V),m(Re=>Re.filter(Be=>Be.name!==V.name)),o?.(V.id.toString())},K=V=>{r?.(V)},Se=()=>{f(""),h("all")};return(0,pi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsx)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,pi.jsxs)("div",{className:`space-y-6 ${n||""}`,children:[(0,pi.jsx)(mt,{title:"Files",description:"Manage and organize your files and documents.",gradient:"bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600",primaryAction:{label:"Upload file",onClick:A},secondaryAction:{label:"Download all",onClick:()=>console.log("Download all clicked")}}),(0,pi.jsx)(Q,{children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsxs)("div",{className:"flex flex-col md:flex-row gap-4",children:[(0,pi.jsx)("div",{className:"flex-1",children:(0,pi.jsxs)("div",{className:"relative",children:[(0,pi.jsx)(kt.Search,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,pi.jsx)(ee,{placeholder:"Search files...",value:d,onChange:V=>f(V.target.value),className:"pl-9"})]})}),(d||g!=="all")&&(0,pi.jsxs)(x,{variant:"outline",onClick:Se,className:"gap-2",children:[(0,pi.jsx)(kt.Filter,{className:"h-4 w-4"}),"Clear"]})]})})}),(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsx)(Po,{activeTab:b,onTabChange:w,tabOptions:[{value:"all",label:`All Files (${D.length})`},{value:"recent",label:`Recent (${J.length})`}],maxWidth:"500px",gridCols:3}),b==="all"&&(0,pi.jsx)(Ka,{files:D,onFileClick:K,onFileUpdate:i,onFileDelete:I,showHeader:!s}),b==="recent"&&(0,pi.jsx)(Ka,{files:J,onFileClick:K,onFileUpdate:i,onFileDelete:I,showHeader:!s}),b==="shared"&&(0,pi.jsx)(Ka,{files:v,onFileClick:K,onFileUpdate:i,onFileDelete:I,showHeader:!s})]}),D.length===0&&(0,pi.jsx)(Q,{children:(0,pi.jsx)(ke,{className:"pt-6",children:(0,pi.jsxs)("div",{className:"text-center py-8",children:[(0,pi.jsx)(kt.File,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,pi.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No files found"}),(0,pi.jsx)("pi",{className:"text-muted-foreground mb-4",children:d||g!=="all"?"Try adjusting your filters to see more results.":"Get started by uploading your first file."}),(0,pi.jsxs)(x,{onClick:A,className:"gap-2",children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4"}),"Upload File"]})]})})})]})},"files-view")}),(0,pi.jsx)(Wo,{isOpen:c,onClose:()=>N(!1),onAddFile:t})]})}function Fn({document:e,onSave:t,onCancel:a,availableDocuments:o=[],knowledgeContexts:r=[]}){let[i,s]=(0,Ut.useState)({...e,updatedAt:new Date}),[n,l]=(0,Ut.useState)(!1),[m,d]=(0,Ut.useState)(()=>{let v=[],A=0,R=new Set;return r.forEach(I=>{I.menuConfig.groupBy.forEach(K=>R.add(K))}),R.forEach(I=>{v.push({id:`context_field_${A++}`,key:I,value:e.metadata?.[I]?String(e.metadata[I]):"",isContextKey:!0})}),e.metadata&&Object.entries(e.metadata).forEach(([I,K])=>{R.has(I)||v.push({id:`existing_field_${A++}`,key:I,value:String(K),isContextKey:!1})}),v}),f=v=>{switch(v){case"markdown":case"mdx":return(0,pi.jsx)(kt.FileText,{className:"h-6 w-6 text-primary"});case"richtext":return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-success"});case"text":return(0,pi.jsx)(kt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-muted-foreground"})}},g=v=>{switch(v){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richtext":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},h=()=>{let v=new Set;return o.forEach(A=>{A.metadata&&Object.keys(A.metadata).forEach(R=>v.add(R))}),{documentKeys:Array.from(v).sort()}},b=v=>{let A=new Set;return o.forEach(R=>{R.metadata?.[v]&&A.add(String(R.metadata[v]))}),Array.from(A).sort()},w=h(),c=()=>{t(i)};(0,Ut.useEffect)(()=>{let v=m.filter(A=>A.key.trim()!==""&&A.value.trim()!=="").reduce((A,R)=>({...A,[R.key]:R.value}),{});s(A=>({...A,metadata:Object.keys(v).length>0?v:void 0}))},[m]);let N=(v,A)=>{d(R=>R.map(I=>I.id===v?{...I,key:A}:I))},O=(v,A)=>{d(R=>R.map(I=>I.id===v?{...I,value:A}:I))},S=(v,A)=>{A==="__custom__"?O(v,""):O(v,A)},D=()=>{let v={id:`field_${Date.now()}`,key:"",value:"",isContextKey:!1};d(A=>[...A,v])},J=v=>{d(A=>A.filter(R=>R.id!==v))};return(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,pi.jsxs)("div",{className:"border-b border-border bg-card pi-8 pb-6",children:[(0,pi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,pi.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,pi.jsx)("div",{className:"flex-shrink-0 pi-3 rounded-xl bg-muted border border-border",children:f(i.format)}),(0,pi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,pi.jsxs)("div",{className:"flex items-start gap-4 mb-2 leading-tight",children:[(0,pi.jsx)("div",{className:"flex-1 min-w-0",children:(0,pi.jsx)(ma,{fieldName:"title",value:i.title,label:"",onSave:(v,A)=>s(R=>({...R,title:A})),className:"[&>div:last-child]:text-2xl [&>div:last-child]:font-bold [&>div:last-child]:leading-tight [&>div:last-child]:text-foreground [&>div:last-child]:pi-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})}),(0,pi.jsx)("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ${g(i.format)} flex-shrink-0 mt-1`,children:i.format.toUpperCase()})]}),(0,pi.jsx)("div",{className:"mt-2",children:(0,pi.jsx)(ma,{fieldName:"description",value:i.description||"Click to add description...",label:"",multiline:!0,onSave:(v,A)=>s(R=>({...R,description:A})),className:"[&>div:last-child]:text-muted-foreground [&>div:last-child]:text-lg [&>div:last-child]:leading-relaxed [&>div:last-child]:pi-0 [&>div:last-child]:border-0 [&>div:last-child]:hover:bg-muted/30 [&>div:last-child]:min-h-0"})})]})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,pi.jsxs)(x,{variant:"ghost",size:"sm",onClick:()=>l(!n),className:"gap-2",children:[(0,pi.jsx)(kt.Info,{className:"h-4 w-4"}),"Metadata",m.filter(v=>v.key.trim()!==""&&v.value.trim()!=="").length>0&&(0,pi.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 text-xs font-medium bg-primary/10 text-primary rounded-full",children:m.filter(v=>v.key.trim()!==""&&v.value.trim()!=="").length}),n?(0,pi.jsx)(kt.ChevronDown,{className:"h-4 w-4"}):(0,pi.jsx)(kt.ChevronRight,{className:"h-4 w-4"})]}),(0,pi.jsxs)(x,{variant:"outline",size:"sm",onClick:a,className:"gap-2",children:[(0,pi.jsx)(kt.pi,{className:"h-4 w-4"}),"Cancel"]}),(0,pi.jsxs)(x,{size:"sm",onClick:c,className:"gap-2",children:[(0,pi.jsx)(kt.Save,{className:"h-4 w-4"}),"Save Changes"]})]})]}),(0,pi.jsx)(nr.motion.div,{initial:!1,animate:{height:n?"auto":0,opacity:n?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,pi.jsxs)("div",{className:"pt-4 border-t border-border mt-4",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,pi.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,pi.jsx)(kt.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,pi.jsxs)(x,{type:"button",variant:"outline",size:"sm",onClick:D,className:"gap-1 h-8",children:[(0,pi.jsx)(kt.Plus,{className:"h-3 w-3"}),"Add Field"]})]}),w.documentKeys.length>0&&(0,pi.jsxs)("pi",{className:"text-xs text-muted-foreground mb-3",children:["Additional from documents: ",w.documentKeys.slice(0,4).join(", "),w.documentKeys.length>4&&` +${w.documentKeys.length-4} more`]}),(0,pi.jsx)("div",{className:"bg-muted rounded-lg pi-4 border border-border",children:m.length>0?(0,pi.jsx)("div",{className:"space-y-2",children:m.map(v=>{let A=b(v.key);return(0,pi.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,pi.jsx)(ee,{value:v.key,onChange:R=>N(v.id,R.target.value),placeholder:"Key",className:`w-32 h-8 text-sm ${v.isContextKey?"bg-primary/5 border-primary/30":""}`,list:`metadata-keys-${v.id}`,disabled:v.isContextKey}),(0,pi.jsx)("datalist",{id:`metadata-keys-${v.id}`,children:w.documentKeys.map(R=>(0,pi.jsx)("option",{value:R},R))}),(0,pi.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),A.length>0?(0,pi.jsxs)(Ye,{value:v.value||"",onValueChange:R=>S(v.id,R),children:[(0,pi.jsx)(We,{className:"flex-1 h-8 text-sm",children:(0,pi.jsx)(xt,{placeholder:"Value"})}),(0,pi.jsxs)(Ze,{children:[A.map(R=>(0,pi.jsx)(he,{value:R,children:R},R)),(0,pi.jsx)(he,{value:"__custom__",children:(0,pi.jsx)("span",{className:"text-muted-foreground text-xs",children:"Custom..."})})]})]}):(0,pi.jsx)(ee,{value:v.value||"",onChange:R=>O(v.id,R.target.value),placeholder:"Value",className:"flex-1 h-8 text-sm"}),(0,pi.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>J(v.id),className:"h-8 w-8 pi-0 text-muted-foreground hover:text-destructive",children:(0,pi.jsx)(kt.pi,{className:"h-3 w-3"})})]},v.id)})}):(0,pi.jsxs)("div",{className:"text-center py-4",children:[(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground mb-2",children:"No metadata fields"}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground",children:'Click "Add Field" to create metadata'})]})})]})})]}),(0,pi.jsx)("div",{className:"flex-1 overflow-auto",children:(0,pi.jsxs)("div",{className:"pi-8",children:[(0,pi.jsx)("label",{className:"block text-sm font-medium text-foreground mb-4",children:"Content"}),(0,pi.jsx)(Pe,{value:i.content||"",onChange:v=>s(A=>({...A,content:v.target.value})),placeholder:"Document content...",className:"min-h-[400px] font-mono text-sm",style:{resize:"vertical"}})]})})]})}var Bn=e=>(0,pi.jsx)("div",{className:"prose prose-slate dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<pi>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`(.*?)`/g,'<code class="bg-muted px-1 py-0.5 rounded text-sm">$1</code>').replace(/^# (.*$)/gm,'<h1 class="text-2xl font-bold mb-4">$1</h1>').replace(/^## (.*$)/gm,'<h2 class="text-xl font-semibold mb-3">$1</h2>').replace(/^### (.*$)/gm,'<h3 class="text-lg font-medium mb-2">$1</h3>')}}),Ln=e=>(0,pi.jsx)("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:e}),Zl=e=>(0,pi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,pi.jsx)("div",{className:"bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg pi-4 mb-4",children:(0,pi.jsxs)("pi",{className:"text-amber-800 dark:text-amber-200 text-sm",children:[(0,pi.jsx)("strong",{children:"RichText Renderer:"})," This is a placeholder. Integrate with @payloadcms/richtext-lexical for full rendering."]})}),(0,pi.jsx)("pre",{className:"text-sm",children:e})]}),ql=e=>(0,pi.jsxs)("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[(0,pi.jsx)("div",{className:"bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg pi-4 mb-4",children:(0,pi.jsxs)("pi",{className:"text-blue-800 dark:text-blue-200 text-sm",children:[(0,pi.jsx)("strong",{children:"MDX Renderer:"})," This is a placeholder. Integrate with @mdx-js/react for full MDX rendering."]})}),Bn(e)]});function Hn({document:e,onDocumentUpdate:t,editable:a=!0,renderers:o,availableDocuments:r=[],knowledgeContexts:i=[]}){let[s,n]=(0,Ut.useState)(!1),[l,m]=(0,Ut.useState)(!1),d=w=>{switch(w){case"markdown":case"mdx":return(0,pi.jsx)(kt.FileText,{className:"h-6 w-6 text-primary"});case"richtext":return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-success"});case"text":return(0,pi.jsx)(kt.Type,{className:"h-6 w-6 text-muted-foreground"});default:return(0,pi.jsx)(kt.File,{className:"h-6 w-6 text-muted-foreground"})}},f=w=>{switch(w){case"markdown":return"bg-primary/10 text-primary border-primary/20";case"mdx":return"bg-secondary/10 text-secondary border-secondary/20";case"richtext":return"bg-success/10 text-success border-success/20";case"text":return"bg-muted/50 text-muted-foreground border-muted-foreground/20";default:return"bg-muted text-muted-foreground border-border"}},g=(w,c)=>{let N={markdown:Bn,mdx:ql,richtext:Zl,text:Ln},O=o?.[c]||N[c];return O?O(w):Ln(w)},h=w=>{n(!1),t?.(w)},b=()=>{n(!1)};return s?(0,pi.jsx)(Fn,{document:e,onSave:h,onCancel:b,availableDocuments:r,knowledgeContexts:i}):(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3},className:"h-full flex flex-col",children:[(0,pi.jsxs)("div",{className:"border-b border-border bg-card pi-8 pb-6",children:[(0,pi.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,pi.jsxs)("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[(0,pi.jsx)("div",{className:"flex-shrink-0 pi-3 rounded-xl bg-muted border border-border",children:d(e.format)}),(0,pi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,pi.jsxs)("h1",{className:"text-2xl font-bold text-foreground mb-2 leading-tight",children:[e.title,(0,pi.jsx)("span",{className:`inline-flex ml-4 items-center px-3 py-1 rounded-full text-sm font-medium border ${f(e.format)}`,children:e.format.toUpperCase()})]}),e.description&&(0,pi.jsx)("pi",{className:"text-muted-foreground text-lg leading-relaxed",children:e.description})]})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.metadata&&Object.keys(e.metadata).length>0&&(0,pi.jsxs)(x,{variant:"ghost",size:"sm",onClick:()=>m(!l),className:"gap-2",children:[(0,pi.jsx)(kt.Info,{className:"h-4 w-4"}),"Metadata",l?(0,pi.jsx)(kt.ChevronDown,{className:"h-4 w-4"}):(0,pi.jsx)(kt.ChevronRight,{className:"h-4 w-4"})]}),a&&(0,pi.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>n(!0),className:"gap-2",children:[(0,pi.jsx)(kt.Edit3,{className:"h-4 w-4"}),"Edit"]})]})]}),e.metadata&&Object.keys(e.metadata).length>0&&(0,pi.jsx)(nr.motion.div,{initial:!1,animate:{height:l?"auto":0,opacity:l?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,pi.jsxs)("div",{className:"pt-4 border-t border-border mt-4",children:[(0,pi.jsxs)("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,pi.jsx)(kt.Info,{className:"h-4 w-4"}),"Document Metadata"]}),(0,pi.jsx)("div",{className:"bg-muted rounded-lg pi-4 border border-border",children:(0,pi.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-2 text-sm",children:Object.entries(e.metadata).map(([w,c])=>(0,pi.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,pi.jsx)("span",{className:"text-muted-foreground font-medium text-xs uppercase tracking-wide",children:w.replace(/([A-Z])/g," $1").trim()}),(0,pi.jsx)("span",{className:"text-foreground font-medium",children:String(c)})]},w))})})]})})]}),(0,pi.jsx)("div",{className:"flex-1 overflow-auto",children:(0,pi.jsx)("div",{className:"pi-8",children:(0,pi.jsx)("div",{className:"space-y-4",children:e.content?(0,pi.jsx)("div",{className:"relative",children:(0,pi.jsx)("div",{className:"bg-card border border-border rounded-xl pi-6 overflow-hidden",children:g(e.content,e.format)})}):(0,pi.jsxs)("div",{className:"text-center py-12 bg-muted rounded-xl border-2 border-dashed border-border",children:[(0,pi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-background flex items-center justify-center",children:(0,pi.jsx)(kt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,pi.jsx)("h4",{className:"text-foreground font-medium mb-1",children:"No content available"}),(0,pi.jsx)("pi",{className:"text-muted-foreground text-sm",children:"This document doesn't have preview content"})]})})})})]})}function On({label:e,documents:t,children:a,level:o,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:s=!0}){let[n,l]=(0,Ut.useState)(o===0),m=a&&Object.keys(a).length>0,d=t.length+(a?Object.values(a).reduce((h,b)=>h+b.documents.length,0):0),f=h=>{switch(h){case"markdown":case"mdx":return(0,pi.jsx)(kt.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"});case"richtext":return(0,pi.jsx)(kt.File,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,pi.jsx)(kt.File,{className:"h-3.5 w-3.5 text-muted-foreground"})}},g=h=>{let b=["bg-primary","bg-secondary","bg-accent","bg-chart-1"];return b[h%b.length]};return(0,pi.jsxs)("div",{className:"space-y-1",children:[(m||t.length>0)&&(0,pi.jsxs)(nr.motion.div,{className:`group flex items-center gap-3 pi-3 rounded-xl cursor-pointer transition-all duration-200 ${n?"bg-card shadow-sm border border-border":"hover:bg-muted/50 hover:shadow-sm"}`,style:{marginLeft:`${o*20}px`},onClick:()=>l(!n),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,pi.jsx)("div",{className:`w-1 h-6 rounded-full ${g(o)}`}),(0,pi.jsx)(nr.motion.div,{animate:{rotate:n?90:0},transition:{duration:.2},className:"flex-shrink-0",children:(0,pi.jsx)(kt.ChevronRight,{className:"h-4 w-4 text-muted-foreground"})}),(0,pi.jsxs)("div",{className:"flex-1 flex items-center justify-between min-w-0",children:[(0,pi.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,pi.jsx)("span",{className:"font-medium text-foreground truncate",children:e})}),s&&d>0&&(0,pi.jsx)("div",{className:"flex-shrink-0 ml-2",children:(0,pi.jsx)("span",{className:"inline-flex items-center justify-center w-6 h-6 text-xs font-medium bg-muted text-muted-foreground rounded-full",children:d})})]})]}),(0,pi.jsx)(nr.motion.div,{initial:!1,animate:{height:n?"auto":0,opacity:n?1:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,pi.jsxs)("div",{className:"pt-2 space-y-1",children:[t.map((h,b)=>(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.05,duration:.2},className:`group flex items-center gap-3 pi-2.5 mx-2 rounded-lg cursor-pointer transition-all duration-150 ${i===h.id?"bg-primary/10 border-l-2 border-primary shadow-sm":"hover:bg-muted/50 hover:translate-x-1"}`,style:{marginLeft:`${o*20+20}px`},onClick:()=>r?.(h),whileHover:{scale:1.01},whileTap:{scale:.99},children:[(0,pi.jsx)("div",{className:"flex-shrink-0",children:f(h.format)}),(0,pi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,pi.jsx)("pi",{className:`text-sm truncate transition-colors ${i===h.id?"text-primary font-medium":"text-foreground group-hover:text-foreground"}`,children:h.title}),h.description&&(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground truncate mt-0.5",children:h.description})]}),h.tags&&h.tags.length>0&&(0,pi.jsx)("div",{className:"flex-shrink-0",children:(0,pi.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-muted text-muted-foreground group-hover:bg-muted/80 transition-colors",children:h.tags[0]})})]},h.id)),a&&Object.entries(a).map(([h,b])=>(0,pi.jsx)(On,{label:h,documents:b.documents,children:b.children,level:o+1,onDocumentClick:r,selectedDocumentId:i,showDocumentCount:s},h))]})})]})}function Vn({documents:e,menuConfig:t,onDocumentClick:a,onDocumentShare:o,onDocumentUpdate:r,selectedDocumentId:i,className:s,editable:n=!0}){let[l,m]=(0,Ut.useState)(""),[d,f]=(0,Ut.useState)(null),g=(0,Ut.useMemo)(()=>l?e.filter(w=>w.title.toLowerCase().includes(l.toLowerCase())||w.description?.toLowerCase().includes(l.toLowerCase())||w.tags?.some(c=>c.toLowerCase().includes(l.toLowerCase()))||Object.values(w.metadata||{}).some(c=>String(c).toLowerCase().includes(l.toLowerCase()))):e,[e,l]),h=(0,Ut.useMemo)(()=>{let w=(c,N)=>{if(N.length===0)return{};let[O,...S]=N;return c.reduce((J,v)=>{let A=v.metadata?.[O]||"Uncategorized",R=String(A);if(J[R]||(J[R]={documents:[],children:{}}),S.length===0)J[R].documents.push(v);else{let I=w([v],S),K=Object.keys(I)[0];K&&(J[R].children||(J[R].children={}),J[R].children[K]?J[R].children[K].documents.push(...I[K].documents):J[R].children[K]=I[K])}return J},{})};return!t.groupBy||t.groupBy.length===0?{"All Documents":{documents:g,children:{}}}:w(g,t.groupBy)},[g,t.groupBy]),b=w=>{f(w),a?.(w)};return(0,pi.jsxs)("div",{className:`flex h-full ${s||""}`,children:[(0,pi.jsxs)("div",{className:"w-1/3 border-r border-border bg-muted/20",children:[(0,pi.jsx)("div",{className:"pi-6 border-b border-border",children:(0,pi.jsxs)("div",{className:"relative",children:[(0,pi.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,pi.jsx)(kt.Search,{className:"h-4 w-4 text-muted-foreground"})}),(0,pi.jsx)(ee,{placeholder:"Search knowledge base...",value:l,onChange:w=>m(w.target.value),className:"pl-10 bg-background/80 border-border focus:border-primary/50 focus:ring-primary/20 rounded-xl h-11 text-sm placeholder:text-muted-foreground"})]})}),(0,pi.jsx)(Tr,{className:"h-[calc(100%-100px)]",children:(0,pi.jsxs)("div",{className:"pi-4 space-y-3",children:[Object.entries(h).map(([w,c])=>(0,pi.jsx)(On,{label:w,documents:c.documents,children:c.children,level:0,onDocumentClick:b,selectedDocumentId:i,showDocumentCount:t.showDocumentCount},w)),Object.keys(h).length===0&&(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center text-muted-foreground py-12",children:[(0,pi.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:(0,pi.jsx)(kt.FileText,{className:"h-8 w-8 text-muted-foreground"})}),(0,pi.jsx)("pi",{className:"text-sm font-medium",children:"No documents found"}),(0,pi.jsx)("pi",{className:"text-xs mt-1",children:"Try adjusting your search terms"})]})]})})]}),(0,pi.jsx)("div",{className:"flex-1 bg-background",children:d?(0,pi.jsx)(Hn,{document:d,onDocumentUpdate:r,editable:n}):(0,pi.jsx)("div",{className:"h-full flex items-center justify-center text-center",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"max-w-sm",children:[(0,pi.jsx)("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-primary/10 flex items-center justify-center",children:(0,pi.jsx)(kt.FileText,{className:"h-10 w-10 text-primary"})}),(0,pi.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Select a document"}),(0,pi.jsx)("pi",{className:"text-muted-foreground leading-relaxed",children:"Choose any document from the knowledge base to view its content and details"})]})})})]})}function Lr({documents:e=[],contexts:t=[],onDocumentClick:a=s=>console.log("Document clicked:",s),onDocumentShare:o=s=>console.log("Share document:",s),onLoadDocumentContent:r,selectedDocumentId:i}){let[s,n]=(0,Ut.useState)(t[0]);return!t||t.length===0?(0,pi.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,pi.jsx)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:(0,pi.jsx)(mt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Create",onClick:()=>console.log("Create document clicked")}})}),(0,pi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4 flex items-center justify-center",children:(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"No contexts available"})})]}):(0,pi.jsxs)("div",{className:"flex flex-col h-full max-h-[calc(100vh-8rem)]",children:[(0,pi.jsxs)("div",{className:"px-2 md:px-4 py-4 flex-shrink-0",children:[(0,pi.jsx)(mt,{title:"Knowledge",description:"Access, manage, and share all your team knowledge in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Create",onClick:()=>console.log("Create document clicked")}}),(0,pi.jsxs)("div",{className:"mt-6",children:[(0,pi.jsx)("div",{className:"border-b border-border",children:(0,pi.jsx)("nav",{className:"-mb-px flex space-x-8 overflow-x-auto",children:t.map(l=>(0,pi.jsxs)("button",{onClick:()=>n(l),className:`group inline-flex items-center gap-2 py-3 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${s.id===l.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"}`,children:[l.icon,l.label]},l.id))})}),s.description&&(0,pi.jsx)("div",{className:"mt-3 px-1",children:(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground",children:s.description})})]})]}),(0,pi.jsx)("div",{className:"flex-1 min-h-0 px-2 md:px-4 pb-4",children:(0,pi.jsx)("div",{className:"h-full rounded-3xl border overflow-hidden",children:(0,pi.jsx)(Vn,{documents:e,menuConfig:s.menuConfig,onDocumentClick:a,onDocumentShare:o,selectedDocumentId:i})})})]})}var Jl=[{key:"kanban",icon:kt.Kanban,label:"Kanban",color:"bg-primary",title:"Kanban View"},{key:"planning",icon:kt.Calendar,label:"Planning",color:"bg-brand-plum",title:"Planning View",hiddenOnMobile:!0},{key:"epics",icon:kt.Target,label:"Epics",color:"bg-brand-orange",title:"Epic Planning"},{key:"files",icon:kt.FileText,label:"Files",color:"bg-brand-green",title:"Files"},{key:"tasks",icon:kt.Calendar,label:"Tasks",color:"bg-brand-cyan",title:"Tasks"}],Un=({currentView:e,onViewChange:t,children:a})=>(0,pi.jsxs)("div",{className:"flex w-full h-screen",children:[(0,pi.jsx)("div",{className:"w-12 h-full bg-sidebar-background flex flex-col flex-shrink-0",children:Jl.map(o=>{let r=o.icon,i=e===o.key;return(0,pi.jsxs)("button",{onClick:()=>t(o.key),className:`flex-1 w-12 flex items-center justify-center text-sidebar-foreground transition-all duration-200 relative overflow-hidden group/btn ${i?o.color:`${o.color}/75 hover:${o.color}`} ${o.hiddenOnMobile?"hidden md:flex":""} hover:w-28 hover:justify-start hover:pl-3`,title:o.title,children:[(0,pi.jsx)(r,{className:"h-4 w-4 flex-shrink-0"}),(0,pi.jsx)("span",{className:"text-xs font-medium whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity duration-200 absolute left-8",children:o.label})]},o.key)})}),(0,pi.jsx)("div",{className:"flex-1 min-w-0 px-4 md:px-6 h-full overflow-auto",children:(0,pi.jsx)("div",{className:"w-full h-full",children:a})})]});var Ae=ve(require("react"));var $n=({title:e,status:t,taskCount:a,children:o,onDrop:r,isCompact:i=!1,height:s})=>{let n=d=>{d.preventDefault()},l=d=>{d.preventDefault(),r(t)};return(0,pi.jsxs)(Q,{className:`pi-4 bg-card border-l-4 ${(()=>{switch(t){case"todo":return"border-l-gray-400";case"in-progress":return"border-l-blue-500";case"review":return"border-l-orange-500";case"done":return"border-l-green-500";default:return"border-l-gray-400"}})()} shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col ${i?"lg:max-w-xs":""}`,style:{height:s||"calc(100vh - 350px)"},onDragOver:n,onDrop:l,children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,pi.jsx)("h3",{className:`font-semibold text-foreground select-none-important ${i?"text-base":"text-lg"}`,children:e}),(0,pi.jsx)(Ee,{variant:"secondary",className:"bg-muted text-muted-foreground",children:a})]}),(0,pi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:o})]})};var yo=({task:e,epic:t,onDragStart:a,onTaskClick:o,isCompact:r=!1})=>{let i=d=>{a(e)},s=()=>{o(e)},n=()=>{switch(e.priority){case"high":return"bg-destructive/20 text-destructive border-destructive/20";case"medium":return"bg-warning/20 text-warning border-warning/20";case"low":return"bg-success/20 text-success border-success/20";default:return"bg-muted text-muted-foreground border-border"}},l=()=>{switch(e.type){case"story":return(0,pi.jsx)(kt.BookOpen,{className:"h-3 w-3"});case"bug":return(0,pi.jsx)(kt.Bug,{className:"h-3 w-3"});case"spike":return(0,pi.jsx)(kt.Zap,{className:"h-3 w-3"});case"task":default:return(0,pi.jsx)(kt.AlertCircle,{className:"h-3 w-3"})}},m=()=>{switch(e.type){case"story":return"bg-primary/20 text-primary";case"bug":return"bg-destructive/20 text-destructive";case"spike":return"bg-accent/20 text-accent";case"task":default:return"bg-muted text-muted-foreground"}};return r?(0,pi.jsx)(Q,{className:"pi-3 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-sm",draggable:!0,onDragStart:i,onClick:s,children:(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("div",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${m()}`,children:l()}),(0,pi.jsx)("h4",{className:"font-medium text-foreground text-sm mb-1 line-clamp-2 select-none-important",children:e.name})]})}):(0,pi.jsxs)(Q,{className:"pi-4 bg-card border border-border hover:border-accent cursor-pointer transition-all duration-200 hover:shadow-md",draggable:!0,onDragStart:i,onClick:s,children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,pi.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-sm font-medium ${m()}`,children:[l(),(0,pi.jsx)("span",{className:"capitalize",children:e.type})]}),(0,pi.jsxs)("div",{className:"flex gap-1",children:[(0,pi.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full text-xs font-medium ${n()}`,children:e.priority}),(0,pi.jsx)("div",{className:"flex items-center gap-2 px-3 py-1 border border-accent rounded-full text-xs font-medium",children:e.storyPoints})]})]}),(0,pi.jsx)("h4",{className:"font-semibold text-foreground mb-2 select-none-important",children:e.name}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground mb-3 line-clamp-2 select-none-important",children:e.description}),(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,pi.jsx)(kt.User,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:e.assignee?.value?.name})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-1",children:[(0,pi.jsx)(kt.Calendar,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]})};var Xl=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:kt.BookOpen},{value:"task",label:"Task",color:"bg-secondary/20 text-secondary-foreground",icon:kt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:kt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:kt.Zap}],Yl=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}],Ga=({isOpen:e,onClose:t,onAddTask:a,epics:o,sprints:r,assignees:i,defaultEpicId:s})=>{let[n,l]=(0,Ut.useState)({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:"",sprint:"none",assignee:""});(0,Ut.useEffect)(()=>{e&&s&&l(f=>({...f,epic:s}))},[e,s]),(0,Ut.useEffect)(()=>{e&&l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:s||"",sprint:"none",assignee:""})},[e]);let m=f=>{f.preventDefault(),n.name.trim()&&(a({name:n.name.trim(),description:n.description.trim(),status:"todo",priority:n.priority,type:n.type,storyPoints:n.storyPoints,epic:Number(n.epic),sprint:Number(n.sprint),assignee:n.assignee.trim()?{relationTo:"digital-colleagues",value:Number(n.assignee)}:null,dateLogged:new Date().toISOString(),index:0}),l({name:"",description:"",status:"todo",priority:"medium",type:"story",storyPoints:1,epic:s||"",sprint:"",assignee:""}),t())},d=(f,g)=>{l(h=>({...h,[f]:g}))};return(0,pi.jsx)(qe,{open:e,onOpenChange:t,children:(0,pi.jsxs)(Qe,{className:"sm:max-w-md",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Add New Task"})}),(0,pi.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",children:"Task Title"}),(0,pi.jsx)(ee,{id:"name",value:n.name,onChange:f=>d("name",f.target.value),placeholder:"Enter task title",required:!0})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"description",children:"Description"}),(0,pi.jsx)(Pe,{id:"description",value:n.description,onChange:f=>d("description",f.target.value),placeholder:"Enter task description",rows:3})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Type"}),(0,pi.jsx)(Sa,{type:"single",value:n.type||"",onValueChange:f=>f&&d("type",f),children:Xl.map(f=>{let g=f.icon;return(0,pi.jsxs)(Ta,{value:f.value,className:"flex items-center gap-2 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:[(0,pi.jsx)(g,{className:"h-4 w-4"}),f.label]},f.value)})})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Priority"}),(0,pi.jsx)(Sa,{type:"single",value:n.priority||"",onValueChange:f=>f&&d("priority",f),children:Yl.map(f=>(0,pi.jsx)(Ta,{value:f.value,className:"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",children:f.label},f.value))})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"points",children:"Story Points"}),(0,pi.jsx)(ee,{id:"points",type:"number",min:"1",max:"100",value:n.storyPoints,onChange:f=>d("storyPoints",parseInt(f.target.value)||1),placeholder:"Enter story points",required:!0})]}),!s&&(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"epic",children:"Epic"}),(0,pi.jsxs)(Ye,{value:n.epic,onValueChange:f=>d("epic",f),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{placeholder:"Select an epic"})}),(0,pi.jsx)(Ze,{children:o.map(f=>(0,pi.jsx)(he,{value:f.id.toString(),children:(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("div",{className:`w-3 h-3 rounded-full ${f.color}`}),f.name]})},f.id))})]})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"sprint",children:"Sprint (Optional)"}),(0,pi.jsxs)(Ye,{value:n.sprint,onValueChange:f=>d("sprint",f),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{placeholder:"Select a sprint"})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)(he,{value:"none",children:"No Sprint"}),r.map(f=>(0,pi.jsx)(he,{value:f.id.toString(),children:(0,pi.jsx)("div",{className:"flex items-center gap-2",children:f.name})},f.id))]})]})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"sprint",children:"Assignee"}),(0,pi.jsxs)(Ye,{value:n.assignee,onValueChange:f=>d("assignee",f),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{placeholder:"Select an Assignee"})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)(he,{value:"none",children:"No Assignee"}),i.map(f=>(0,pi.jsx)(he,{value:f.id.toString(),children:(0,pi.jsx)("div",{className:"flex items-center gap-2",children:f.name})},f.id))]})]})]}),(0,pi.jsxs)(so,{children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,pi.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Task"})]})]})]})})};var Kn=({comments:e,onAddComment:t})=>{let[a,o]=(0,Ut.useState)(""),r=s=>s.split(" ").map(n=>n[0]).join("").toUpperCase(),i=()=>{a.trim()&&(t(a),o(""))};return(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.MessageSquare,{className:"h-5 w-5"}),(0,pi.jsx)(E,{className:"text-lg font-medium",children:"Comments"}),(0,pi.jsx)(Ee,{variant:"secondary",children:e.length})]}),(0,pi.jsx)("div",{className:"space-y-4 max-h-60 overflow-y-auto",children:e.map(s=>(0,pi.jsxs)("div",{className:"flex gap-3 pi-3 bg-muted/50 rounded-lg",children:[(0,pi.jsx)(oo,{className:"h-8 w-8 mt-1",children:(0,pi.jsx)(ro,{className:"text-xs bg-muted text-muted-foreground",children:r(s.author)})}),(0,pi.jsxs)("div",{className:"flex-1",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,pi.jsx)("span",{className:"font-medium text-sm",children:s.author}),(0,pi.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s.createdAt.toLocaleDateString()," pi ",s.createdAt.toLocaleTimeString()]})]}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground",children:s.text})]})]},s.id))}),(0,pi.jsxs)("div",{className:"flex gap-2",children:[(0,pi.jsx)(Pe,{value:a,onChange:s=>o(s.target.value),placeholder:"Add a comment...",rows:2,className:"flex-1 resize-none"}),(0,pi.jsx)(x,{onClick:i,disabled:!a.trim(),size:"sm",className:"self-end",children:(0,pi.jsx)(kt.Send,{className:"h-4 w-4"})})]})]})};var Jo=({label:e,value:t,onValueChange:a,options:o,showColor:r=!1,disabled:i=!1})=>{let[s,n]=(0,Ut.useState)(!1),l=o.find(d=>d.value===t);return(0,pi.jsxs)("div",{className:"space-y-1",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:e}),(0,pi.jsxs)(Ye,{value:t,onValueChange:a,open:s,onOpenChange:d=>{i||n(d)},disabled:i,children:[(0,pi.jsx)(We,{className:"h-auto pi-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,pi.jsxs)(Ee,{variant:"secondary",className:`${i?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!i&&n(!s),children:[r&&l?.color&&(0,pi.jsx)("div",{className:`w-2 h-2 rounded-full ${l.color} pi-1`}),l?.label||"Select..."]})}),(0,pi.jsx)(Ze,{children:o.map(d=>(0,pi.jsx)(he,{value:d.value,children:r&&d.color?(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("div",{className:`w-3 h-3 rounded-full ${d.color}`}),d.label]}):d.label},d.value))})]})]})};var Gn=({label:e,value:t,onValueChange:a,options:o,placeholder:r="Search...",allowCustomValue:i=!1,disabled:s=!1})=>{let[n,l]=(0,Ut.useState)(!1),[m,d]=(0,Ut.useState)(""),f=o.find(c=>c.value===t),g=o.filter(c=>c.label.toLowerCase().includes(m.toLowerCase())),h=c=>{a(c),l(!1),d("")},b=()=>{i&&m.trim()&&!o.find(c=>c.value===m.trim())&&(a(m.trim()),l(!1),d(""))};return(0,pi.jsxs)("div",{className:"space-y-1",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:e}),(0,pi.jsxs)(Ye,{value:t,onValueChange:h,open:n,onOpenChange:c=>{s||l(c)},disabled:s,children:[(0,pi.jsx)(We,{className:"h-auto pi-0 border-none bg-transparent hover:bg-muted/50 rounded-md",children:(0,pi.jsx)(Ee,{variant:"secondary",className:`${s?"cursor-not-allowed opacity-50":"cursor-pointer"} hover:bg-muted transition-colors`,onClick:()=>!s&&l(!n),children:f?.label||t||"Select..."})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)("div",{className:"pi-2",children:(0,pi.jsx)(ee,{placeholder:r,value:m,onChange:c=>d(c.target.value),onKeyDown:c=>{c.key==="Enter"&&i&&b()},className:"mb-2"})}),g.map(c=>(0,pi.jsx)(he,{value:c.value,children:c.label},c.value)),i&&m.trim()&&!g.find(c=>c.value===m.trim())&&(0,pi.jsxs)(he,{value:m.trim(),children:['Add "',m.trim(),'"']})]})]})]})};var Xe=e=>e?typeof e=="number"?e:typeof e=="object"&&e&&"id"in e?e.id:0:0;var Ql=[{value:"story",label:"Story",color:"bg-primary/20 text-primary",icon:kt.BookOpen},{value:"task",label:"Task",color:"bg-muted text-muted-foreground",icon:kt.AlertCircle},{value:"bug",label:"Bug",color:"bg-destructive/20 text-destructive",icon:kt.Bug},{value:"spike",label:"Spike",color:"bg-accent/20 text-accent",icon:kt.Zap}],ed=[{value:"low",label:"Low",color:"bg-success/20 text-success"},{value:"medium",label:"Medium",color:"bg-warning/20 text-warning"},{value:"high",label:"High",color:"bg-destructive/20 text-destructive"}];var Wn=({task:e,epics:t,sprints:a,lastUpdated:o,onUpdateTask:r,onClose:i,onDelete:s,isUpdating:n=!1,isDeleting:l=!1,deleteState:m="idle",teamMembers:d})=>{let[f,g]=(0,Ut.useState)(e.storyPoints),h=(0,Ut.useRef)(null),[b,w]=(0,Ut.useState)(d);(0,Ut.useEffect)(()=>{w(d)},[d]);let c=(0,Ut.useCallback)((S,D)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{r(S,D)},500)},[r]);(0,Ut.useEffect)(()=>{c("storyPoints",f?.toString()||"1")},[f]);let N=S=>S.split(" ").map(D=>D[0]).join("").toUpperCase(),O=()=>m==="loading"?(0,pi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,pi.jsx)(kt.Loader2,{className:"h-3 w-3 animate-spin"}),"Deleting..."]}):m==="success"?(0,pi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,pi.jsx)(kt.Check,{className:"h-3 w-3"}),"Deleted"]}):m==="error"?(0,pi.jsxs)(x,{disabled:!0,variant:"destructive",className:"w-full h-8 text-xs gap-1",children:[(0,pi.jsx)(kt.pi,{className:"h-3 w-3"}),"Delete failed"]}):(0,pi.jsxs)(x,{onClick:s,variant:"destructive",className:"w-full h-8 text-xs gap-1",disabled:n||l,children:[(0,pi.jsx)(kt.Trash2,{className:"h-3 w-3"}),"Delete Task"]});return(0,pi.jsxs)("div",{className:"flex flex-col h-full",children:[(0,pi.jsxs)("div",{className:"space-y-4",style:{opacity:n?.6:1},children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Status"}),(0,pi.jsx)(Jo,{label:"",value:e.status,onValueChange:S=>r("status",S),options:[{value:"todo",label:"To Ut"},{value:"in-progress",label:"kt Progress"},{value:"done",label:"Done"}],disabled:n})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Type"}),(0,pi.jsx)(Sa,{type:"single",value:e.type||"",onValueChange:S=>S&&r("type",S),className:"grid grid-cols-2 gap-1",disabled:n,children:Ql.map(S=>{let D=S.icon;return(0,pi.jsxs)(Ta,{value:S.value,className:"flex items-center gap-1 text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:n,children:[(0,pi.jsx)(D,{className:"h-3 w-3"}),S.label]},S.value)})})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Priority"}),(0,pi.jsx)(Sa,{type:"single",value:e.priority||"",onValueChange:S=>S&&r("priority",S),className:"grid grid-cols-3 gap-1",disabled:n,children:ed.map(S=>(0,pi.jsx)(Ta,{value:S.value,className:"text-xs h-8 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",size:"sm",disabled:n,children:S.label},S.value))})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Story Points"}),(0,pi.jsx)("input",{type:"number",min:"1",max:"100",value:f||1,onChange:S=>{let D=Number(S.target.value);D<1?g(1):D>100?g(100):g(D)},className:"w-full h-8 px-2 text-xs border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent bg-background text-foreground disabled:opacity-50 disabled:cursor-not-allowed",disabled:n})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Epic"}),(0,pi.jsx)(Jo,{label:"",value:Xe(e.epic).toString(),onValueChange:S=>r("epic",S),options:(t||[]).map(S=>({value:S.id.toString(),label:S?.name,color:S.color})),showColor:!0,disabled:n})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Sprint"}),(0,pi.jsx)(Jo,{label:"",value:Xe(e.sprint).toString()||"none",onValueChange:S=>r("sprint",S==="none"?"":S),options:[{value:"none",label:"No Sprint"},...(a||[]).map(S=>({value:S.id.toString(),label:`${S?.name}`}))],disabled:n})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{className:"text-xs text-muted-foreground",children:"Assignee"}),(0,pi.jsx)(Gn,{label:"",value:e.assignee?.value?.name,onValueChange:S=>r("assignee",S),options:b.map(S=>({value:`${typeof S.email=="string"?"users":"digital-colleagues"}:${S.id}`,label:S?.name||""})),placeholder:"Search team members...",allowCustomValue:!0,disabled:n})]})]}),(0,pi.jsxs)("div",{className:"mt-auto pt-4 space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(x,{onClick:i,variant:"outline",className:"w-full h-8 text-xs",disabled:n||l,children:"Close"}),O()]}),(0,pi.jsxs)("div",{className:"pt-4 border-t border-border space-y-2",children:[(0,pi.jsx)("div",{className:"text-xs text-muted-foreground font-medium mb-2",children:"Information"}),(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Logged By"}),(0,pi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,pi.jsx)(kt.User,{className:"h-3 w-3"}),(0,pi.jsx)("span",{children:"System"})]})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Created"}),(0,pi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,pi.jsx)(kt.Calendar,{className:"h-3 w-3"}),(0,pi.jsx)("span",{children:new Date(e.createdAt)?.toLocaleDateString()})]})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Last Updated"}),(0,pi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,pi.jsx)(kt.Clock,{className:"h-3 w-3"}),(0,pi.jsxs)("span",{children:[new Date(o).toLocaleDateString()," pi"," ",new Date(o).toLocaleTimeString()]})]})]})]})]})]})};var Zn=({isOpen:e,onClose:t,initialTask:a,epics:o,sprints:r,onUpdateTask:i,onDeleteTask:s,onAddComment:n,colleagues:l,onUploadFile:m,onDeleteFile:d,onFileUpdate:f})=>{let[g,h]=(0,Ut.useState)(a),[b,w]=(0,Ut.useState)(new Date),[c,N]=(0,Ut.useState)("idle"),[O,S]=(0,Ut.useState)("idle"),[D,J]=(0,Ut.useState)(!1),[v,A]=(0,Ut.useState)([]),[R,I]=(0,Ut.useState)(l);(0,Ut.useEffect)(()=>{h(a)},[a]);let K=async(ge,P)=>{if(P!==g[ge]){N("loading");try{await i(g.id.toString(),{[ge]:P}),w(new Date),N("success"),setTimeout(()=>N("idle"),1500)}catch(le){console.log("error",le),N("error"),setTimeout(()=>N("idle"),3e3)}}},Se=async(ge,P)=>{if(P!==g[ge]){N("loading");try{await i(g.id.toString(),{[ge]:P}),w(new Date),N("success"),setTimeout(()=>N("idle"),1500)}catch(le){console.log("error",le),N("error"),setTimeout(()=>N("idle"),3e3)}}},V=async ge=>{if(n){N("loading");try{await n?.({content:ge,taskId:g.id.toString()}),w(new Date),N("success"),setTimeout(()=>N("idle"),1500)}catch{N("error"),setTimeout(()=>N("idle"),3e3)}}},Re=async()=>{S("loading");try{await s(g.id.toString()),S("success"),setTimeout(()=>{t(),S("idle")},1e3)}catch{S("error"),setTimeout(()=>S("idle"),3e3)}},Be=async ge=>{if(m){N("loading");try{await m(g.id.toString(),ge),w(new Date),N("success"),J(!1),setTimeout(()=>N("idle"),1500)}catch(P){console.error("Error uploading file:",P),N("error"),setTimeout(()=>N("idle"),3e3)}}},L=async ge=>{if(d){N("loading");try{await d(g.id.toString(),ge.id.toString()),w(new Date),N("success"),setTimeout(()=>N("idle"),1500)}catch(P){console.error("Error deleting file:",P),N("error"),setTimeout(()=>N("idle"),3e3)}}},ce=(g.files||[]).map(ge=>typeof ge=="number"?null:ge).filter(ge=>ge!==null),fe=c!=="loading"&&O!=="loading",_e=()=>{fe&&t()},Ce=()=>c==="loading"?(0,pi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,pi.jsx)(kt.Loader2,{className:"h-4 w-4 animate-spin"}),(0,pi.jsx)("span",{children:"Updating..."})]}):c==="success"?(0,pi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-success",children:[(0,pi.jsx)(kt.Check,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:"Updated successfully"})]}):c==="error"?(0,pi.jsxs)("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[(0,pi.jsx)(kt.pi,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:"Update failed"})]}):null;return(0,pi.jsxs)(qe,{open:e,onOpenChange:_e,children:[(0,pi.jsxs)(Qe,{className:"max-w-3xl max-h-[80vh] overflow-y-auto pi-4",children:[(0,pi.jsxs)(et,{children:[(0,pi.jsx)(ze,{className:"sr-only",children:g?.name}),(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)("div",{className:"flex-1",children:Ce()}),!fe&&(0,pi.jsx)("div",{className:"text-xs text-muted-foreground",children:"Please wait..."})]})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,pi.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,pi.jsx)(ma,{fieldName:"name",value:g.name||"",label:"",onSave:K,className:"border-b border-border pb-3",disabled:c==="loading"}),(0,pi.jsx)(ma,{fieldName:"description",value:g.description||"",label:"Description",multiline:!0,onSave:K,disabled:c==="loading"}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.File,{className:"h-4 w-4 text-muted-foreground"}),(0,pi.jsx)("h3",{className:"text-sm font-medium",children:"Files"})]}),m&&(0,pi.jsxs)(x,{variant:"outline",size:"sm",onClick:()=>J(!0),disabled:c==="loading",className:"gap-2",children:[(0,pi.jsx)(kt.Upload,{className:"h-4 w-4"}),"Upload"]})]}),ce.length>0?(0,pi.jsx)(Ka,{files:ce,onFileDelete:d?L:void 0,onFileUpdate:f,showHeader:!1,className:"border rounded-lg",viewMode:"card"}):(0,pi.jsx)("div",{className:"text-sm text-muted-foreground py-4 text-center border border-dashed rounded-lg",children:"No files attached"})]}),(0,pi.jsx)(Kn,{comments:(g?.comments||[]).map(ge=>({author:ge.author?.value.name||"",createdAt:new Date(ge.timestamp),text:ge.text,id:ge.id||""})),onAddComment:V})]}),(0,pi.jsx)(Wn,{task:g,epics:o,sprints:r,lastUpdated:b,onUpdateTask:Se,onClose:_e,onDelete:Re,isUpdating:c==="loading",isDeleting:O==="loading",deleteState:O,teamMembers:R})]})]}),m&&(0,pi.jsx)(Wo,{isOpen:D,onClose:()=>J(!1),onAddFile:Be})]})};var Wa=({isOpen:e,onClose:t,onAddEpic:a})=>{let[o,r]=(0,Ut.useState)({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString().split("T")[0],endDate:new Date().toISOString().split("T")[0],progress:0}),i=["bg-blue-500","bg-green-500","bg-purple-500","bg-orange-500","bg-red-500","bg-yellow-500","bg-pink-500","bg-indigo-500"],s=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],n=[{value:1,label:"Planning"},{value:2,label:"Development"},{value:3,label:"Testing"},{value:4,label:"Done"}],l=d=>{d.preventDefault(),o.name.trim()&&(a({name:o.name.trim(),description:o.description.trim(),color:o.color,confidence:o.confidence,phase:o.phase,startDate:o.startDate,endDate:o.endDate}),r({name:"",description:"",color:"bg-blue-500",confidence:"medium",phase:1,startDate:new Date().toISOString(),endDate:new Date().toISOString(),progress:0}),t())},m=(d,f)=>{r(g=>({...g,[d]:f}))};return(0,pi.jsx)(qe,{open:e,onOpenChange:t,children:(0,pi.jsxs)(Qe,{className:"sm:max-w-md",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Add New Epic"})}),(0,pi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",children:"Epic Name"}),(0,pi.jsx)(ee,{id:"name",value:o.name,onChange:d=>m("name",d.target.value),placeholder:"Enter epic name",required:!0})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"description",children:"Description"}),(0,pi.jsx)(Pe,{id:"description",value:o.description,onChange:d=>m("description",d.target.value),placeholder:"Enter epic description (optional)",rows:3})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Color"}),(0,pi.jsx)("div",{className:"flex gap-2 flex-wrap",children:i.map(d=>(0,pi.jsx)("button",{type:"button",onClick:()=>m("color",d),className:`w-8 h-8 rounded-full ${d} ${o.color===d?"ring-2 ring-gray-400":""}`},d))})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Confidence"}),(0,pi.jsxs)(Ye,{value:o.confidence,onValueChange:d=>m("confidence",d),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{})}),(0,pi.jsx)(Ze,{children:s.map(d=>(0,pi.jsx)(he,{value:d.value,children:d.label},d.value))})]})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Phase"}),(0,pi.jsxs)(Ye,{value:o.phase.toString(),onValueChange:d=>m("phase",parseInt(d)),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{})}),(0,pi.jsx)(Ze,{children:n.map(d=>(0,pi.jsx)(he,{value:d.value.toString(),children:d.label},d.value))})]})]})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Start Date"}),(0,pi.jsx)(ee,{type:"date",value:o.startDate,onChange:d=>m("startDate",d.target.value)})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"End Date"}),(0,pi.jsx)(ee,{type:"date",value:o.endDate,onChange:d=>m("endDate",d.target.value)})]})]}),(0,pi.jsxs)(so,{children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),(0,pi.jsx)(x,{type:"submit",className:"bg-blue-600 hover:bg-blue-700",children:"Add Epic"})]})]})]})})};var Jn=({initialTasks:e=[],initialEpics:t=[],initialSprints:a=[],initialUsers:o=[],initialColleagues:r=[],initialProjects:i=[],onAddTask:s,onUpdateTask:n,onDeleteTask:l,onTaskClick:m,onAddEpic:d,onAddComment:f,onUploadFile:g,onDeleteFile:h,onFileUpdate:b})=>{let[w,c]=(0,Ae.useState)([]),[N,O]=(0,Ae.useState)([]),[S,D]=(0,Ae.useState)([]),[J,v]=(0,Ae.useState)(!1),[A,R]=(0,Ae.useState)(!1),[I,K]=(0,Ae.useState)(null),[Se,V]=(0,Ae.useState)(null),[Re,Be]=(0,Ae.useState)([]),[L,ce]=(0,Ae.useState)([]),[fe,_e]=(0,Ae.useState)(0),Ce=(0,Ae.useRef)(null),ge=(0,Ae.useRef)(null),P=Ae.default.useMemo(()=>[...N.map(C=>C.id),0],[N]),le=(0,Ae.useRef)(""),$e=(0,Ae.useRef)(""),Dt=(0,Ae.useRef)(""),Ne=(0,Ae.useRef)(""),ht=(C,B)=>C.map(Z=>`${Z.id}-${new Date(Z.createdAt).getTime()}-${new Date(Z.updatedAt).getTime()}`).join("-")+(B?`-${B}`:"");(0,Ae.useEffect)(()=>{let C=e.map(Z=>Z.files?.filter(me=>typeof me=="object").map(me=>new Date(me.updatedAt).getTime())).flat(),B=ht(e,C.join("-"));B!==le.current&&(c(e),I&&K(e.find(Z=>Z.id===I.id)||null),le.current=B)},[e]),(0,Ae.useEffect)(()=>{let C=ht(t);C!==$e.current&&(O(t),$e.current=C)},[t]),(0,Ae.useEffect)(()=>{let C=ht(a);C!==Dt.current&&(D(a),Dt.current=C)},[a]),(0,Ae.useEffect)(()=>{let C=ht(r.map(B=>({id:B.id,updatedAt:B.updatedAt,createdAt:B.createdAt})));C!==Ne.current&&(ce(r),Ne.current=C)},[r]),(0,Ae.useEffect)(()=>{let C=()=>{if(Ce.current){let me=Ce.current.offsetHeight;_e(me)}};C();let B=new ResizeObserver(C);Ce.current&&B.observe(Ce.current);let Z=()=>{setTimeout(C,100)};return window.addEventListener("storage",Z),()=>{B.disconnect(),window.removeEventListener("storage",Z)}},[]),(0,Ae.useEffect)(()=>{let C=setTimeout(()=>{Ce.current&&_e(Ce.current.offsetHeight)},300);return()=>clearTimeout(C)},[J,A]);let H=w.filter(C=>!0),He=C=>H.filter(B=>B.status===C),Te=C=>{let B={};return N.forEach(Z=>{B[Z.id]=C.filter(me=>Xe(me.epic)===Z.id)}),B["no-epic"]=C.filter(Z=>!Xe(Z.epic)),B},Ot=C=>{V(C)},Xt=C=>{Se&&(c(B=>B.map(Z=>Z.id===Se.id?{...Z,status:C}:Z)),n?.(Se.id.toString(),{status:C}),V(null))},sa=C=>{let B={...C,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};c(Z=>[...Z,B]),s?.(C)},va=async(C,B)=>{c(Z=>Z.map(me=>me.id===Number(C)?{...me,...B}:me)),n&&await n(C,B),I?.id===Number(C)&&K(Z=>({...Z,...B}))},Ma=async C=>{c(B=>B.filter(Z=>Z.id!==Number(C))),I?.id===Number(C)&&K(null),l&&await l(C)},Ia=C=>{let B={...C,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};O(Z=>[...Z,B]),d?.(C)},Vt=C=>{K(C),m?.(C)},y=[{id:"todo",title:"To Ut",status:"todo"},{id:"in-progress",title:"kt Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],F=fe>0?`calc(100vh - ${fe+120}px)`:"calc(100vh - 12rem)";return(0,pi.jsxs)("div",{ref:ge,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,pi.jsx)("div",{ref:Ce,className:"flex-shrink-0",children:(0,pi.jsx)(mt,{title:"Project Board",description:"Manage tasks and track progress across your project sprints.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"Add task",onClick:()=>v(!0)},secondaryAction:{label:"Add epic",onClick:()=>R(!0)}})}),(0,pi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,pi.jsx)("div",{className:"h-full",style:{height:fe>0?`calc(100vh - ${fe+120}px)`:"calc(100vh - 12rem)"},children:(0,pi.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full",children:y.map(C=>{let B=He(C.status),Z=Te(B);return(0,pi.jsxs)($n,{title:C.title,status:C.status,taskCount:B.length,onDrop:Xt,isCompact:C.status==="done",height:F,children:[Z["no-epic"].map(me=>(0,pi.jsx)(yo,{epic:null,task:me,onDragStart:Ot,onTaskClick:Vt,isCompact:C.status==="done"},me.id)),P.map(me=>{let it=N.find(_t=>_t.id===me),Yt=Z[me]||[];return Yt.length===0?null:(0,pi.jsxs)("div",{className:"mb-6",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,pi.jsx)("div",{className:`w-3 h-3 rounded-full ${it?.color}`}),(0,pi.jsx)("span",{className:"text-sm font-medium text-muted-foreground select-none-important",children:it?.name||"No Epic"}),(0,pi.jsx)(Ee,{variant:"secondary",className:"text-xs",children:Yt.length})]})," ",(0,pi.jsx)("div",{className:"space-y-3",children:Yt.map(_t=>(0,pi.jsx)(yo,{task:_t,epic:it,onDragStart:Ot,onTaskClick:Vt,isCompact:C.status==="done"},_t.id))})]},me)})]},C.id)})})})}),(0,pi.jsx)(Ga,{isOpen:J,onClose:()=>v(!1),onAddTask:sa,assignees:[...L,...Re],epics:N,sprints:S}),(0,pi.jsx)(Wa,{isOpen:A,onClose:()=>R(!1),onAddEpic:Ia}),I&&(0,pi.jsx)(Zn,{isOpen:!!I,onClose:()=>K(null),initialTask:I,epics:N,sprints:S,onUpdateTask:va,onDeleteTask:Ma,colleagues:L,onUploadFile:g,onDeleteFile:h,onFileUpdate:b,onAddComment:f})]})};var Xn=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddTaskToEpic:i,onAddEpic:s,onUpdateEpic:n,onDeleteEpic:l})=>{let[m,d]=(0,Ut.useState)(t),[f,g]=(0,Ut.useState)(null),[h,b]=(0,Ut.useState)(null),[w,c]=(0,Ut.useState)({}),[N,O]=(0,Ut.useState)(0),[S,D]=(0,Ut.useState)(!1),[J,v]=(0,Ut.useState)(!1),[A,R]=(0,Ut.useState)(null),I=(0,Ut.useRef)(null),K=(0,Ut.useRef)(null);(0,Ut.useEffect)(()=>{d(t)},[t]),(0,Ut.useEffect)(()=>{let P=()=>{if(I.current){let Dt=I.current.offsetHeight;O(Dt)}};P();let le=new ResizeObserver(P);I.current&&le.observe(I.current);let $e=()=>{setTimeout(P,100)};return window.addEventListener("storage",$e),()=>{le.disconnect(),window.removeEventListener("storage",$e)}},[]),(0,Ut.useEffect)(()=>{let P=setTimeout(()=>{I.current&&O(I.current.offsetHeight)},300);return()=>clearTimeout(P)},[h]);let Se=P=>{g(P)},V=P=>{P.preventDefault()},Re=(P,le)=>{P.preventDefault(),f&&Xe(f.epic).toString()!==le&&(o(f.id.toString(),{epic:Number(le)}),g(null))},Be=P=>e.filter(le=>Xe(le.epic).toString()===P),L=P=>{b(P.id.toString()),c({name:P.name,description:P.description,confidence:P.confidence,phase:P.phase})},ce=async()=>{h&&w.name&&(await n(h.toString(),w),d(P=>P.map(le=>le.id.toString()===h?{...le,...w}:le)),b(null),c({}))},fe=()=>{b(null),c({})},_e=async P=>{window.confirm("Are you sure you want to delete this epic? This will also delete all associated tasks.")&&(await l(P),d(le=>le.filter($e=>$e.id.toString()!==P)))},Ce=P=>({1:"Planning",2:"Development",3:"Testing",4:"Review",5:"Deployment",6:"Monitoring",7:"Optimization",8:"Maintenance",9:"Complete"})[P]||`Phase ${P}`,ge=P=>{switch(P){case"high":return"bg-success/10 text-success";case"medium":return"bg-warning/10 text-warning";case"low":return"bg-destructive/10 text-destructive";default:return"bg-muted text-muted-foreground"}};return(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsxs)("div",{ref:K,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,pi.jsx)("div",{ref:I,className:"flex-shrink-0",children:(0,pi.jsx)(mt,{title:"Epic Planning",description:"Organize and manage your project epics, track progress, and assign tasks.",gradient:"bg-gradient-to-r from-rose-600 via-pink-600 to-fuchsia-600",primaryAction:{label:"Add epic",onClick:()=>D(!0)}})}),(0,pi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,pi.jsx)("div",{className:"h-full overflow-y-auto",style:{height:N>0?`calc(100vh - ${N+120}px)`:"calc(100vh - 12rem)"},children:(0,pi.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 auto-rows-max",children:m.map(P=>{let le=Be(P.id.toString()),$e=le.reduce((Ne,ht)=>Ne+(ht.storyPoints||0),0),Dt=N>0?`calc(100vh - ${N+200}px)`:"calc(100vh - 14rem)";return(0,pi.jsxs)(Q,{className:`flex flex-col ${h===P.id.toString()?"h-auto":""} bg-card shadow-sm`,style:{height:h===P.id.toString()?"auto":Dt,minHeight:"400px"},onDragOver:V,onDrop:Ne=>Re(Ne,P.id.toString()),children:[(0,pi.jsx)("div",{className:"pi-4 border-b border-border",children:h===P.id.toString()?(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)(ee,{value:w.name||"",onChange:Ne=>c({...w,name:Ne.target.value}),placeholder:"Epic name",className:"font-semibold"}),(0,pi.jsxs)("div",{className:"flex gap-2 ml-2",children:[(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:ce,className:"pi-1 h-8 w-8",children:(0,pi.jsx)(kt.Check,{className:"h-4 w-4"})}),(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:fe,className:"pi-1 h-8 w-8",children:(0,pi.jsx)(kt.pi,{className:"h-4 w-4"})})]})]}),(0,pi.jsx)(Pe,{value:w.description||"",onChange:Ne=>c({...w,description:Ne.target.value}),placeholder:"Epic description",className:"text-sm min-h-[60px]"}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Confidence"}),(0,pi.jsxs)("select",{value:w.confidence||P.confidence,onChange:Ne=>c({...w,confidence:Ne.target.value}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,pi.jsx)("option",{value:"low",children:"Low"}),(0,pi.jsx)("option",{value:"medium",children:"Medium"}),(0,pi.jsx)("option",{value:"high",children:"High"})]})]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)("label",{className:"text-xs text-muted-foreground",children:"Phase"}),(0,pi.jsx)("select",{value:w.phase?.toString()||P.phase.toString(),onChange:Ne=>c({...w,phase:parseInt(Ne.target.value)}),className:"flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[1,2,3,4,5,6,7,8,9].map(Ne=>(0,pi.jsxs)("option",{value:Ne.toString(),children:["Phase ",Ne]},Ne))})]})]})]}):(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,pi.jsx)("div",{className:`w-4 h-4 rounded-full ${P.color}`}),(0,pi.jsx)("h3",{className:"font-semibold text-foreground select-none flex-1",children:P.name}),(0,pi.jsxs)("div",{className:"flex gap-1",children:[(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>L(P),className:"pi-1 h-8 w-8",children:(0,pi.jsx)(kt.Edit2,{className:"h-3 w-3"})}),(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>_e(P.id.toString()),className:"pi-1 h-8 w-8 hover:bg-destructive/10 hover:text-destructive",children:(0,pi.jsx)(kt.Trash2,{className:"h-3 w-3"})})]})]}),(0,pi.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,pi.jsxs)(Ee,{className:`text-xs ${ge(P.confidence)}`,children:[P.confidence," confidence"]}),(0,pi.jsxs)(Ee,{variant:"outline",className:"text-xs",children:["Phase ",P.phase]}),(0,pi.jsxs)(Ee,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[le.length," tasks"]}),(0,pi.jsxs)(Ee,{variant:"secondary",className:"text-xs bg-muted text-muted-foreground",children:[$e," pts"]})]}),P.description&&(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground mb-3 select-none",children:P.description}),(0,pi.jsxs)(x,{onClick:()=>{v(!0),R(P)},variant:"outline",size:"sm",className:"w-full gap-2",children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4"}),"Add Task"]})]})}),(0,pi.jsx)("div",{className:"flex-1 pi-4 overflow-y-auto",children:(0,pi.jsx)("div",{className:`space-y-3 min-h-[200px] border-2 border-dashed rounded pi-3 transition-colors ${f?"border-primary bg-primary/10":"border-border"}`,children:le.length===0?(0,pi.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground border-2 border-dashed border-border rounded-lg",children:[(0,pi.jsx)(kt.Move,{className:"h-8 w-8 mb-2"}),(0,pi.jsx)("span",{className:"text-sm select-none",children:"Drop tasks here"})]}):le.map(Ne=>(0,pi.jsx)(yo,{task:Ne,epic:P,onDragStart:Se,onTaskClick:r,isCompact:!0},Ne.id))})})]},P.id)})})})})]}),(0,pi.jsx)(Wa,{isOpen:S,onClose:()=>D(!1),onAddEpic:s}),(0,pi.jsx)(Ga,{isOpen:J,onClose:()=>v(!1),onAddTask:i,assignees:[],epics:[],defaultEpicId:A?.id.toString()||"",sprints:a})]})};var Or=require("date-fns");var Qn=({isOpen:e,onClose:t,onAddSprint:a})=>{let[o,r]=(0,Ut.useState)({name:"",description:"",startDate:void 0,endDate:void 0}),i=n=>{n.preventDefault(),!(!o.name||!o.startDate||!o.endDate)&&(a({name:o.name,description:o.description,startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),r({name:"",description:"",startDate:void 0,endDate:void 0}),t())},s=()=>{r({name:"",description:"",startDate:void 0,endDate:void 0}),t()};return(0,pi.jsx)(qe,{open:e,onOpenChange:s,children:(0,pi.jsxs)(Qe,{className:"sm:max-w-md",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Add New Sprint"})}),(0,pi.jsxs)("form",{onSubmit:i,className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",children:"Sprint Name *"}),(0,pi.jsx)(ee,{id:"name",value:o.name,onChange:n=>r(l=>({...l,name:n.target.value})),placeholder:"e.g., Sprint 3",required:!0})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"description",children:"Description"}),(0,pi.jsx)(Pe,{id:"description",value:o.description,onChange:n=>r(l=>({...l,description:n.target.value})),placeholder:"Brief description of sprint goals",rows:3})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"Start Date *"}),(0,pi.jsxs)(Pr,{children:[(0,pi.jsx)(Rr,{asChild:!0,children:(0,pi.jsxs)(x,{variant:"outline",className:T("w-full justify-start text-left font-normal",!o.startDate&&"text-muted-foreground"),children:[(0,pi.jsx)(kt.CalendarIcon,{className:"pi-2 h-4 w-4"}),o.startDate?(0,Or.format)(o.startDate,"PPP"):"Pick a date"]})}),(0,pi.jsx)(zo,{className:"w-auto pi-0",align:"start",children:(0,pi.jsx)(_o,{mode:"single",selected:o.startDate,onSelect:n=>r(l=>({...l,startDate:n})),initialFocus:!0})})]})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{children:"End Date *"}),(0,pi.jsxs)(Pr,{children:[(0,pi.jsx)(Rr,{asChild:!0,children:(0,pi.jsxs)(x,{variant:"outline",className:T("w-full justify-start text-left font-normal",!o.endDate&&"text-muted-foreground"),children:[(0,pi.jsx)(kt.CalendarIcon,{className:"pi-2 h-4 w-4"}),o.endDate?(0,Or.format)(o.endDate,"PPP"):"Pick a date"]})}),(0,pi.jsx)(zo,{className:"w-auto pi-0",align:"start",children:(0,pi.jsx)(_o,{mode:"single",selected:o.endDate,onSelect:n=>r(l=>({...l,endDate:n})),initialFocus:!0,disabled:n=>o.startDate?n<o.startDate:!1})})]})]})]}),(0,pi.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),(0,pi.jsx)(x,{type:"submit",disabled:!o.name||!o.startDate||!o.endDate,children:"Add Sprint"})]})]})]})})};var Xo=({tasks:e,epics:t,sprints:a,onUpdateTask:o,onTaskClick:r,onAddSprint:i,onUpdateSprint:s,onDeleteSprint:n})=>{let[l,m]=(0,Ut.useState)([]),[d,f]=(0,Ut.useState)(new Set),[g,h]=(0,Ut.useState)(null),[b,w]=(0,Ut.useState)(!1),[c,N]=(0,Ut.useState)(null),[O,S]=(0,Ut.useState)(null),[D,J]=(0,Ut.useState)({name:"",description:"",startDate:"",endDate:"",isActive:!1}),[v,A]=(0,Ut.useState)([]),[R,I]=(0,Ut.useState)("upcoming"),[K,Se]=(0,Ut.useState)(!1),[V,Re]=(0,Ut.useState)(0),Be=(0,Ut.useRef)(null),L=(0,Ut.useRef)(null);(0,Ut.useEffect)(()=>{let y=()=>{Be.current&&Re(Be.current.offsetHeight)};y();let F=new ResizeObserver(y);return Be.current&&F.observe(Be.current),()=>F.disconnect()},[]);let ce=y=>t.find(F=>F.id===Number(y)),fe=y=>a.find(F=>F.id===Number(y)),_e=y=>{let F={high:"bg-red-100 text-red-800 border-red-200",medium:"bg-orange-100 text-orange-800 border-orange-200",low:"bg-green-100 text-green-800 border-green-200"};return F[y]||F.medium},Ce=y=>{if(!y||y?.length===0)return"";let F=y?.trim().split(" ");if(F?.length===1)return F[0];let C=F[0],B=F[F.length-1][0].toUpperCase();return`${C} ${B}`},ge=y=>{let F={},C=[];return y.forEach(B=>{B.epic?(F[Xe(B.epic)]||(F[Xe(B.epic)]=[]),F[Xe(B.epic)].push(B)):C.push(B)}),{tasksByEpic:F,unassignedTasks:C}};(0,Ut.useEffect)(()=>{A(a)},[a]);let P=v.filter(y=>{switch(R){default:return!0}}),le=v.filter(y=>l.includes(y.id.toString())),$e=e.filter(y=>!y.sprint||y.status==="backlog"),Dt=$e.reduce((y,F)=>y+(F.storyPoints||0),0),Ne=y=>{m(F=>F.includes(y)?F.filter(C=>C!==y):F?.length<3?[...F,y]:F)},ht=y=>{f(F=>{let C=new Set(F);return C.has(y)?C.delete(y):C.add(y),C})},H=y=>{i(y),w(!1)},He=y=>{S(y.id.toString()),J({name:y.name,description:y.description||"",startDate:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:y.startDate,endDate:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:y.endDate,isActive:!1})},Te=()=>{O&&(s(O,{name:D.name,description:D.description,startDate:D.startDate,endDate:D.endDate}),A(y=>y.map(F=>(F.id===Number(O)&&(F.name=D.name,F.description=D.description,F.startDate=D.startDate,F.endDate=D.endDate),F))),S(null))},Ot=()=>{S(null),J({name:"",description:"",startDate:"",endDate:"",isActive:!1})},Xt=(y,F)=>{h(F),y.dataTransfer.effectAllowed="move"},sa=y=>{y.preventDefault(),y.dataTransfer.dropEffect="move"},va=y=>{N(y)},Ma=()=>{N(null)},Ia=(y,F)=>{if(y.preventDefault(),N(null),!g)return;(Xe(g.sprint)||void 0)!==Number(F)&&o(g.id.toString(),{sprint:Number(F)}),h(null)},Vt=({task:y,showSprint:F=!1})=>{let C=y.epic?ce(Xe(y.epic).toString()):null,B=y.sprint?fe(Xe(y.sprint).toString()):null;return(0,pi.jsx)(Q,{className:"pi-3 cursor-grab active:cursor-grabbing hover:shadow-md transition-all duration-200 border border-border bg-card hover:bg-accent/50",draggable:!0,onDragStart:it=>{it.dataTransfer.effectAllowed="move",it.dataTransfer.setData("text/plain",y.id.toString()),Xt(it,y)},onClick:it=>{g===null&&r(y)},style:{userSelect:"none"},children:(0,pi.jsxs)("div",{className:"space-y-2 pointer-events-none",children:[(0,pi.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,pi.jsx)("h4",{className:"font-medium text-sm text-foreground line-clamp-1",children:y.name}),(0,pi.jsx)(Ee,{className:`text-xs ${_e(y.priority||"medium")}`,children:y.priority?.[0]?.toUpperCase()})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-1",children:[C&&(0,pi.jsx)("div",{className:`w-2 h-2 rounded-full ${C.color}`}),(0,pi.jsx)("span",{className:"text-muted-foreground truncate",children:C?.name})]}),(0,pi.jsx)("span",{className:"text-muted-foreground",children:Ce(y.assignee?.value?.name)})]}),F&&B&&(0,pi.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,pi.jsx)(kt.Calendar,{className:"h-3 w-3"}),(0,pi.jsx)("span",{children:B.name})]})]})})};return(0,pi.jsxs)("div",{ref:L,className:"h-full flex flex-col px-2 md:px-4 py-4",children:[(0,pi.jsx)("div",{ref:Be,className:"flex-shrink-0",children:(0,pi.jsx)(mt,{title:"Sprint Planning",description:"Plan and organize tasks across sprints and manage your development timeline.",gradient:"bg-gradient-to-r from-orange-600 via-amber-600 to-yellow-600",primaryAction:{label:"Add sprint",onClick:()=>w(!0)}})}),(0,pi.jsx)("div",{className:"flex-1 min-h-0 mt-8",children:(0,pi.jsxs)("div",{className:"h-full",style:{height:V>0?`calc(100vh - ${V+120}px)`:"calc(100vh - 12rem)"},children:[(0,pi.jsxs)("div",{className:"mb-4",children:[(0,pi.jsx)(Q,{className:"pi-3 bg-card shadow-sm",children:(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-3",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)("h3",{className:"font-semibold text-foreground text-sm",children:"Sprint Board"}),(0,pi.jsxs)("pi",{className:"text-xs text-muted-foreground",children:[l?.length,"/3 selected"]})]}),l?.length>0&&(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)("span",{className:"text-xs text-muted-foreground",children:"Viewing:"}),(0,pi.jsx)("div",{className:"flex flex-wrap gap-1",children:le.map(y=>(0,pi.jsxs)("div",{className:"flex items-center gap-1 bg-primary/10 text-primary px-2 py-0.5 rounded text-xs",children:[(0,pi.jsx)("span",{className:"max-w-[80px] truncate",children:y.name}),(0,pi.jsx)("button",{onClick:()=>Ne(y.id.toString()),className:"ml-0.5 hover:bg-primary/20 h-8 rounded pi-0.5",children:(0,pi.jsx)(kt.pi,{className:"h-4 w-4"})})]},y.id))})]})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsxs)(x,{onClick:()=>w(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-1",size:"sm",children:[(0,pi.jsx)(kt.Plus,{className:"h-3 w-3"}),"Add"]}),(0,pi.jsxs)(x,{onClick:()=>Se(!K),variant:"outline",size:"sm",className:"gap-1",children:[(0,pi.jsx)(kt.Calendar,{className:"h-3 w-3"}),K?"Close":"Select"]})]})]})}),K&&(0,pi.jsx)("div",{className:"fixed inset-0 bg-black/20 pi-[5]",onClick:()=>Se(!1)}),(0,pi.jsx)("div",{className:`fixed top-0 right-0 h-full w-80 bg-background border-l shadow-xl pi-10 transition-all duration-300 ease-in-out ${K?"translate-x-0 opacity-100 visible":"translate-x-full opacity-0 invisible"}`,children:(0,pi.jsxs)(Q,{className:"h-full rounded-none border-0 flex flex-col",children:[(0,pi.jsxs)("div",{className:"pi-4 border-b bg-muted/30 flex-shrink-0",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)("h3",{className:"font-semibold text-foreground text-base",children:"Select Sprints"}),(0,pi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>Se(!1),className:"h-8 w-8 pi-0",children:(0,pi.jsx)(kt.pi,{className:"h-4 w-4"})})]}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground mt-1",children:"Choose up to 3 sprints to view in your planning board"})]}),(0,pi.jsxs)("div",{className:"flex flex-col flex-1 pi-4 min-h-0",children:[(0,pi.jsx)("div",{className:"flex gap-1 mb-4 bg-muted pi-1 rounded-lg",children:[{key:"all",label:"All",count:a.length},{key:"active",label:"Active"},{key:"upcoming",label:"Upcoming"}].map(y=>(0,pi.jsxs)(x,{variant:R===y.key?"default":"outline",size:"sm",onClick:()=>I(y.key),className:"text-xs h-8 px-3 flex-1",children:[y.label," (",y.count,")"]},y.key))}),(0,pi.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto",children:P.length>0?P.map(y=>{let F=l.includes(y.id.toString()),C=e.filter(Z=>Xe(Z.sprint)===y.id).length,B=!F&&l.length<3;return(0,pi.jsx)("div",{className:`pi-3 rounded-lg border transition-all ${F?"bg-primary/10 border-primary/30":B?"bg-card border-border hover:border-primary/50":"bg-muted/30 border-border/30 opacity-60"}`,children:O===y.id.toString()?(0,pi.jsxs)("div",{className:"space-y-3",children:[(0,pi.jsx)(ee,{value:D.name,onChange:Z=>J(me=>({...me,name:Z.target.value})),className:"text-sm",placeholder:"Sprint name"}),(0,pi.jsx)(Pe,{value:D.description,onChange:Z=>J(me=>({...me,description:Z.target.value})),className:"text-sm min-h-[60px]",placeholder:"Sprint description"}),(0,pi.jsxs)("div",{className:"flex gap-2",children:[(0,pi.jsxs)(x,{size:"sm",onClick:()=>Te(),className:"flex-1",children:[(0,pi.jsx)(kt.Check,{className:"h-3 w-3 pi-1"}),"Save"]}),(0,pi.jsxs)(x,{size:"sm",variant:"outline",onClick:Ot,className:"flex-1",children:[(0,pi.jsx)(kt.pi,{className:"h-3 w-3 pi-1"}),"Cancel"]})]})]}):(0,pi.jsxs)("div",{children:[(0,pi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,pi.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,pi.jsx)("h4",{className:"font-medium text-sm text-foreground truncate",children:y.name}),(0,pi.jsx)(Ee,{variant:"default",className:"text-xs bg-green-100 text-green-800 border-green-200",children:"Active"})]}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:y.description}),(0,pi.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,pi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,pi.jsx)(kt.CalendarDays,{className:"h-3 w-3"}),new Date(y.startDate).toLocaleDateString()]}),(0,pi.jsxs)("span",{className:"flex items-center gap-1",children:[(0,pi.jsx)(kt.User,{className:"h-3 w-3"}),C," tasks"]})]})]}),(0,pi.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>He(y),className:"h-6 w-6 pi-0",children:(0,pi.jsx)(kt.Edit2,{className:"h-3 w-3"})}),(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>n(y.id.toString()),className:"h-6 w-6 pi-0 text-destructive hover:text-destructive",children:(0,pi.jsx)(kt.Trash2,{className:"h-3 w-3"})})]})]}),(0,pi.jsx)("div",{className:"flex items-center justify-between mt-2",children:(0,pi.jsx)(x,{variant:F?"default":"outline",size:"sm",className:"text-xs w-full h-8 flex items-center justify-center cursor-pointer",onClick:()=>Ne(y.id.toString()),disabled:!F&&l?.length>=3,children:(0,pi.jsx)("span",{className:"pointer-events-none select-none",children:F?"Deselect":l?.length>=3?"Limit Reached":"Select"})})})]})},y.id)}):(0,pi.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,pi.jsx)(kt.Calendar,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,pi.jsxs)("pi",{className:"text-sm",children:['No sprints found for "',R,'" filter']}),(0,pi.jsx)(x,{variant:"link",size:"sm",onClick:()=>I("all"),className:"text-xs",children:"Show all sprints"})]})}),l?.length===0&&(0,pi.jsx)("div",{className:"mt-4 pi-4 bg-muted/50 rounded-lg border-2 border-dashed border-border",children:(0,pi.jsxs)("div",{className:"text-center",children:[(0,pi.jsx)(kt.Calendar,{className:"h-6 w-6 mx-auto mb-2 text-muted-foreground"}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground font-medium",children:"Select sprints to start planning"}),(0,pi.jsx)("pi",{className:"text-xs text-muted-foreground mt-1",children:"Choose up to 3 sprints to view alongside your backlog"})]})})]})]})})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-full flex-1 min-h-0",children:[(0,pi.jsx)("div",{className:"lg:col-span-1",children:(0,pi.jsxs)(Q,{className:"pi-4 h-full bg-card border-l-4 border-l-gray-400 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:sa,onDragEnter:()=>va("backlog"),onDragLeave:Ma,onDrop:y=>Ia(y,"backlog"),style:{height:V>0?`calc(100vh - ${V+200}px)`:"calc(100vh - 16rem)"},children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,pi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:"Backlog"}),(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsxs)(Ee,{variant:"secondary",className:"bg-muted text-muted-foreground",children:[$e?.length," tasks"]}),(0,pi.jsxs)(Ee,{variant:"outline",className:"bg-gray-50 text-gray-700 border-gray-200",children:[Dt," pts"]})]})]}),(0,pi.jsx)("div",{className:`flex-1 overflow-y-auto space-y-3 min-h-0 pi-3 rounded transition-colors ${c==="backlog"?"bg-primary/10":""}`,children:(()=>{let{tasksByEpic:y,unassignedTasks:F}=ge($e);return(0,pi.jsxs)(pi.Fragment,{children:[Object.entries(y).map(([C,B])=>{let Z=ce(C);if(!Z)return null;let me=d.has(C);return(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ht(C),children:[(0,pi.jsx)("div",{className:`w-3 h-3 rounded-full ${Z.color}`}),(0,pi.jsx)("span",{className:"font-medium text-muted-foreground",children:Z.name}),(0,pi.jsxs)("span",{className:"text-muted-foreground",children:["(",B?.length,")"]}),(0,pi.jsx)("div",{className:"ml-auto",children:me?(0,pi.jsx)(kt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,pi.jsx)(kt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!me&&(0,pi.jsx)("div",{className:"space-y-2 pl-2",children:B.map(it=>(0,pi.jsx)(Vt,{task:it},it.id))})]},C)}),F?.length>0&&(()=>{let C=d.has("no-epic");return(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ht("no-epic"),children:[(0,pi.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,pi.jsx)("span",{className:"font-medium text-muted-foreground",children:"No Epic"}),(0,pi.jsxs)("span",{className:"text-muted-foreground",children:["(",F?.length,")"]}),(0,pi.jsx)("div",{className:"ml-auto",children:C?(0,pi.jsx)(kt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,pi.jsx)(kt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!C&&(0,pi.jsx)("div",{className:"space-y-2 pl-2",children:F?.map(B=>(0,pi.jsx)(Vt,{task:B},B.id))})]})})(),$e?.length===0&&(0,pi.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here to move to backlog"}),$e?.length>0&&Object.keys(y).length===0&&F.length===0&&(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:"Direct backlog tasks:"}),$e?.map(C=>(0,pi.jsx)(Vt,{task:C},C.id))]})]})})()})]})}),le.map(y=>{let F=e.filter(B=>Xe(B?.sprint)===y.id),C=F.reduce((B,Z)=>B+(Z?.storyPoints||0),0);return(0,pi.jsxs)(Q,{className:"pi-4 h-full bg-card border-l-4 border-l-blue-500 shadow-sm hover:shadow-md transition-shadow duration-200 flex flex-col",onDragOver:sa,onDragEnter:()=>va(y.id.toString()),onDragLeave:Ma,onDrop:B=>Ia(B,y.id.toString()),style:{height:V>0?`calc(100vh - ${V+200}px)`:"calc(100vh - 16rem)"},children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,pi.jsx)("div",{children:(0,pi.jsx)("h3",{className:"font-semibold text-foreground select-none text-lg",children:y.name})}),(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsxs)(Ee,{variant:"secondary",className:"bg-muted flex items-center justify-center text-muted-foreground",children:[F?.length," tasks"]}),(0,pi.jsxs)(Ee,{variant:"outline",className:"bg-blue-50 flex items-center justify-center text-blue-700 border-blue-200",children:[C," pts"]}),(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>{Se(!0),He(y)},className:"h-6 px-2",children:(0,pi.jsx)(kt.Edit2,{className:"h-3 w-3"})}),(0,pi.jsx)(x,{size:"sm",variant:"ghost",onClick:()=>n(y.id.toString()),className:"h-6 px-2 text-destructive hover:text-destructive",children:(0,pi.jsx)(kt.Trash2,{className:"h-3 w-3"})})]})]}),(0,pi.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3 min-h-0",children:(()=>{let{tasksByEpic:B,unassignedTasks:Z}=ge(F);return(0,pi.jsxs)(pi.Fragment,{children:[Object.entries(B).map(([me,it])=>{let Yt=ce(me);if(!Yt)return null;let _t=d.has(me);return(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ht(me),children:[(0,pi.jsx)("div",{className:`w-3 h-3 rounded-full ${Yt.color}`}),(0,pi.jsx)("span",{className:"font-medium text-muted-foreground",children:Yt.name}),(0,pi.jsxs)("span",{className:"text-muted-foreground",children:["(",it?.length,")"]}),(0,pi.jsx)("div",{className:"ml-auto",children:_t?(0,pi.jsx)(kt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,pi.jsx)(kt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!_t&&(0,pi.jsx)("div",{className:"space-y-2 pl-2",children:it?.map(Xa=>(0,pi.jsx)(Vt,{task:Xa},Xa.id))})]},me)}),Z?.length>0&&(()=>{let me=d.has("no-epic");return(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 bg-muted/50 rounded text-xs cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>ht("no-epic"),children:[(0,pi.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-400"}),(0,pi.jsx)("span",{className:"font-medium text-muted-foreground",children:"No Epic"}),(0,pi.jsxs)("span",{className:"text-muted-foreground",children:["(",Z?.length,")"]}),(0,pi.jsx)("div",{className:"ml-auto",children:me?(0,pi.jsx)(kt.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,pi.jsx)(kt.ChevronUp,{className:"h-3 w-3 text-muted-foreground"})})]}),!me&&(0,pi.jsx)("div",{className:"space-y-2 pl-2",children:Z?.map(it=>(0,pi.jsx)(Vt,{task:it},it.id))})]})})(),F?.length===0&&(0,pi.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm select-none",children:"Drop tasks here"})]})})()})]},y.id)})]}),(0,pi.jsx)(Qn,{isOpen:b,onClose:()=>w(!1),onAddSprint:H})]})})]})};var td=e=>e.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),ad=e=>{let[t,a]=e.split(":"),o=new Date;return o.setHours(parseInt(t),parseInt(a)),o.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})},Vr=(e,t)=>{let a=new Date,o=new Date(e);if(t){let[r,i]=t.split(":");o.setHours(parseInt(r),parseInt(i))}return o<a},jr=e=>{let t=new Date;return e.toDateString()===t.toDateString()},od=e=>{let t=new Date;return t.setDate(t.getDate()+1),e.toDateString()===t.toDateString()},rd=({colleagues:e,onAddReminder:t,open:a,setOpen:o})=>{let[r,i]=(0,Ut.useState)({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""}),[s,n]=(0,Ut.useState)(!1),l=d=>{if(d.preventDefault(),!e.find(h=>h?.id.toString()===r.colleagueId.toString())){console.error("No valid colleague selected"),n(!0);return}n(!1);let g={title:r.title,description:r.description,dueDate:new Date(r.dueDate).toISOString(),dueTime:r.dueTime||void 0,isRecurring:r.isRecurring,assignedColleague:Number(r.colleagueId),project:1,updatedAt:new Date().toISOString()};t(g),o(!1),i({title:"",description:"",dueDate:"",dueTime:"",colleagueId:"",priority:"medium",isRecurring:!1,recurrencePattern:"weekly",recurrenceInterval:1,reminderEnabled:!0,reminderMinutes:15,tags:""})};(0,Ut.useEffect)(()=>{r.colleagueId&&n(!1)},[r.colleagueId]);let m=e.filter(Boolean);return(0,pi.jsx)(qe,{open:a,onOpenChange:o,children:(0,pi.jsxs)(Qe,{className:"max-w-2xl",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Add New Reminder"})}),(0,pi.jsxs)("form",{onSubmit:l,className:"space-y-4",children:[(0,pi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"title",children:"Title"}),(0,pi.jsx)(ee,{id:"title",value:r.title,onChange:d=>i({...r,title:d.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"description",children:"Description"}),(0,pi.jsx)(Pe,{id:"description",value:r.description,onChange:d=>i({...r,description:d.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"dueDate",children:"Due Date"}),(0,pi.jsx)(ee,{id:"dueDate",type:"date",value:r.dueDate,onChange:d=>i({...r,dueDate:d.target.value}),required:!0})]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"dueTime",children:"Due Time (optional)"}),(0,pi.jsx)(ee,{id:"dueTime",type:"time",value:r.dueTime,onChange:d=>i({...r,dueTime:d.target.value})})]})]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{className:`${s?"text-destructive":""}`,htmlFor:"colleague",children:"Assigned Colleague"}),(0,pi.jsxs)(Ye,{value:r.colleagueId,onValueChange:d=>{i({...r,colleagueId:d})},required:!0,children:[(0,pi.jsx)(We,{className:`${s?"text-destructive border-red-500":""}`,children:(0,pi.jsx)(xt,{className:`${s?"text-destructive border-red-500":""}`,placeholder:"Select a digital colleague",children:e.find(d=>d?.id.toString()===r.colleagueId.toString())?.name||"Select a digital colleague"})}),(0,pi.jsx)(Ze,{children:m.map(d=>(0,pi.jsx)(he,{value:d.id.toString(),children:d.name},d.id))})]}),s&&(0,pi.jsx)("pi",{className:"text-destructive text-sm",children:"Please select a digital colleague"})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)("input",{type:"checkbox",id:"isRecurring",checked:r.isRecurring,onChange:d=>i({...r,isRecurring:d.target.checked}),className:"rounded border-border"}),(0,pi.jsx)(E,{htmlFor:"isRecurring",children:"Make this a recurring reminder"})]}),r.isRecurring&&(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4 pl-6",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"recurrencePattern",children:"Frequency"}),(0,pi.jsxs)(Ye,{value:r.recurrencePattern,onValueChange:d=>i({...r,recurrencePattern:d}),children:[(0,pi.jsx)(We,{children:(0,pi.jsx)(xt,{})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsx)(he,{value:"daily",children:"Daily"}),(0,pi.jsx)(he,{value:"weekly",children:"Weekly"}),(0,pi.jsx)(he,{value:"monthly",children:"Monthly"}),(0,pi.jsx)(he,{value:"yearly",children:"Yearly"})]})]})]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"recurrenceInterval",children:"Every"}),(0,pi.jsx)(ee,{id:"recurrenceInterval",type:"number",min:"1",value:r.recurrenceInterval,onChange:d=>i({...r,recurrenceInterval:parseInt(d.target.value)})})]})]})]}),(0,pi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),(0,pi.jsx)(x,{type:"submit",children:"Add Reminder"})]})]})]})})},id=({reminder:e,colleagues:t,onUpdateReminder:a,open:o,onClose:r})=>{let[i,s]=(0,Ut.useState)({title:e.title,description:e.description,dueDate:e.dueDate?.toString().split("T")[0],dueTime:e.dueTime||"",isRecurring:e.isRecurring}),n=m=>{m.preventDefault(),a(e.id.toString(),{title:i.title,description:i.description,dueDate:new Date(i.dueDate||"").toISOString(),dueTime:i.dueTime||void 0,isRecurring:i.isRecurring}),r()},l=t.filter(Boolean);return(0,pi.jsx)(qe,{open:o,onOpenChange:r,children:(0,pi.jsxs)(Qe,{className:"max-w-2xl",children:[(0,pi.jsx)(et,{children:(0,pi.jsx)(ze,{children:"Edit Reminder"})}),(0,pi.jsxs)("form",{onSubmit:n,className:"space-y-4",children:[(0,pi.jsx)("div",{className:"grid grid-cols-2 gap-4",children:(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"edit-title",children:"Title"}),(0,pi.jsx)(ee,{id:"edit-title",value:i.title,onChange:m=>s({...i,title:m.target.value}),placeholder:"Enter reminder title",required:!0})]})}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"edit-description",children:"Description"}),(0,pi.jsx)(Pe,{id:"edit-description",value:i.description||"",onChange:m=>s({...i,description:m.target.value}),placeholder:"Enter reminder description",rows:3})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"edit-dueDate",children:"Due Date"}),(0,pi.jsx)(ee,{id:"edit-dueDate",type:"date",value:i.dueDate,onChange:m=>s({...i,dueDate:m.target.value}),required:!0})]}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)(E,{htmlFor:"edit-dueTime",children:"Due Time (optional)"}),(0,pi.jsx)(ee,{id:"edit-dueTime",type:"time",value:i.dueTime,onChange:m=>s({...i,dueTime:m.target.value})})]})]}),(0,pi.jsx)("div",{className:"space-y-2",children:(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)("input",{type:"checkbox",id:"edit-isRecurring",checked:i.isRecurring||!1,onChange:m=>s({...i,isRecurring:m.target.checked}),className:"rounded border-border"}),(0,pi.jsx)(E,{htmlFor:"edit-isRecurring",children:"Make this a recurring reminder"})]})}),(0,pi.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),(0,pi.jsx)(x,{type:"submit",children:"Save Changes"})]})]})]})})},nd=({reminder:e,colleagues:t,onUpdateReminder:a,onDeleteReminder:o})=>{let[r,i]=(0,Ut.useState)(!1);if(!e||!e.id)return null;let s=Vr(new Date(e.dueDate||""),e.dueTime||""),n=jr(new Date(e.dueDate||"")),l=od(new Date(e.dueDate||"")),m=()=>{a(e.id.toString(),{})},d=()=>n?"Today":l?"Tomorrow":td(new Date(e.dueDate||""));return(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsx)(id,{reminder:e,colleagues:t,onUpdateReminder:a,open:r,onClose:()=>i(!1)}),(0,pi.jsx)(Q,{children:(0,pi.jsx)(ke,{className:"pi-4",children:(0,pi.jsxs)("div",{className:"flex items-start justify-between",children:[(0,pi.jsxs)("div",{className:"flex items-start space-x-3 flex-1",children:[(0,pi.jsx)("button",{onClick:m,className:"mt-1 text-primary hover:text-primary/80"}),(0,pi.jsxs)("div",{className:"flex-1",children:[(0,pi.jsx)("div",{className:"flex items-center space-x-2 mb-1",children:(0,pi.jsx)("h3",{children:e.title})}),(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground mb-2",children:e.description}),(0,pi.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[(0,pi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,pi.jsx)(kt.Calendar,{className:"h-4 w-4"}),(0,pi.jsx)("span",{className:s?"text-destructive font-medium":"",children:d()})]}),e.dueTime&&(0,pi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,pi.jsx)(kt.Clock,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:ad(e.dueTime)})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,pi.jsx)(kt.User,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:typeof e.assignedColleague!="number"?e.assignedColleague.name:"Unknown Colleague"})]})]})]})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,pi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>i(!0),className:"h-8 w-8 pi-0",children:(0,pi.jsx)(kt.Edit2,{className:"h-4 w-4"})}),(0,pi.jsx)(x,{variant:"ghost",size:"sm",onClick:()=>o(e.id.toString()),className:"h-8 w-8 pi-0 text-destructive hover:text-destructive/80",children:(0,pi.jsx)(kt.Trash2,{className:"h-4 w-4"})})]})]})})})]})},es=({initialReminders:e=[],initialColleagues:t=[],onAddReminder:a,onUpdateReminder:o,onDeleteReminder:r})=>{let[i,s]=(0,Ut.useState)(e.filter(Boolean)),[n,l]=(0,Ut.useState)(t.filter(Boolean)),[m,d]=(0,Ut.useState)("all"),[f,g]=(0,Ut.useState)(""),[h,b]=(0,Ut.useState)(!1);(0,Ut.useEffect)(()=>{s(e.filter(Boolean))},[e]),(0,Ut.useEffect)(()=>{l(t.filter(Boolean))},[t]);let w=v=>{if(!v.title){console.error("Invalid reminder data:",v);return}let A={...v,id:Date.now(),createdAt:new Date().toISOString()};s(R=>[...R,A]),a?.(v)},c=(v,A)=>{if(!v){console.error("No reminder ID provided for update");return}s(R=>R.map(I=>I?.id.toString()===v?{...I,...A}:I)),o?.(v,A)},N=v=>{if(!v){console.error("No reminder ID provided for deletion");return}s(A=>A.filter(R=>R?.id.toString()!==v)),r?.(v)},S=i.filter(v=>{if(!v)return!1;if(f){let A=f.toLowerCase();if(!(v.title.toLowerCase().includes(A)||v.description?.toLowerCase().includes(A)))return!1}switch(m){case"pending":case"completed":case"overdue":return Vr(new Date(v.dueDate||""),v.dueTime||"");case"today":return jr(new Date(v.dueDate||""));default:return!0}}).sort((v,A)=>{if(!v||!A)return 0;let R={high:3,medium:2,low:1},I=0;return I!==0?I:new Date(v.dueDate||"").getTime()-new Date(A.dueDate||"").getTime()}),D={total:i.filter(Boolean).length,overdue:i.filter(v=>v&&Vr(new Date(v.dueDate||""),v.dueTime||"")).length,today:i.filter(v=>v&&jr(new Date(v.dueDate||""))).length},J=n.find(Boolean)||{id:"1",name:"Default Colleague",description:"Default digital colleague for task management",jobDescription:"Default team member for task management",workInstructions:"Handle basic task assignments and reminders",capabilities:["task-management","reminder-creation"],knowledge:[],coreKnowledge:[]};return(0,pi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,pi.jsx)(mt,{title:"Task Reminders",description:"Manage reminders and stay on top of important tasks and deadlines.",gradient:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600",primaryAction:{label:"Add reminder",onClick:()=>{b(!0)}}}),(0,pi.jsxs)("div",{className:"h-full bg-background",children:[(0,pi.jsx)(rd,{colleagues:n,onAddReminder:w,open:h,setOpen:b}),(0,pi.jsxs)("div",{className:"pi-6",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,pi.jsxs)("div",{children:[(0,pi.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Task Reminders"}),(0,pi.jsx)("pi",{className:"text-muted-foreground",children:"Manage your digital colleague task reminders"})]}),(0,pi.jsxs)(x,{className:"flex items-center space-x-2",onClick:()=>b(!0),children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4"}),(0,pi.jsx)("span",{children:"Add Reminder"})]})]}),(0,pi.jsxs)("div",{className:"grid grid-cols-5 gap-4 mb-6",children:[(0,pi.jsxs)(Q,{className:"pi-4",children:[(0,pi.jsx)("div",{className:"text-2xl font-bold text-foreground",children:D.total}),(0,pi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),(0,pi.jsxs)(Q,{className:"pi-4",children:[(0,pi.jsx)("div",{className:"text-2xl font-bold text-primary",children:D.overdue}),(0,pi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Pending"})]}),(0,pi.jsxs)(Q,{className:"pi-4",children:[(0,pi.jsx)("div",{className:"text-2xl font-bold text-success",children:D.today}),(0,pi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Completed"})]}),(0,pi.jsxs)(Q,{className:"pi-4",children:[(0,pi.jsx)("div",{className:"text-2xl font-bold text-destructive",children:D.overdue}),(0,pi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Overdue"})]}),(0,pi.jsxs)(Q,{className:"pi-4",children:[(0,pi.jsx)("div",{className:"text-2xl font-bold text-warning",children:D.today}),(0,pi.jsx)("div",{className:"text-sm text-muted-foreground",children:"Today"})]})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,pi.jsx)("div",{className:"flex-1",children:(0,pi.jsx)(ee,{placeholder:"Search reminders...",value:f,onChange:v=>g(v.target.value),className:"max-w-md"})}),(0,pi.jsxs)(Ye,{value:m,onValueChange:v=>d(v),children:[(0,pi.jsx)(We,{className:"w-40",children:(0,pi.jsx)(xt,{})}),(0,pi.jsxs)(Ze,{children:[(0,pi.jsxs)(he,{value:"all",children:["All (",D.total,")"]}),(0,pi.jsxs)(he,{value:"overdue",children:["Overdue (",D.overdue,")"]}),(0,pi.jsxs)(he,{value:"overdue",children:["Overdue (",D.overdue,")"]}),(0,pi.jsxs)(he,{value:"today",children:["Today (",D.today,")"]})]})]})]}),(0,pi.jsx)("div",{className:"space-y-4",children:S.length===0?(0,pi.jsxs)(Q,{className:"pi-8 text-center",children:[(0,pi.jsx)("div",{className:"text-muted-foreground",children:f||m!=="all"?"No reminders match your filters":"No reminders yet"}),!f&&m==="all"&&(0,pi.jsx)("pi",{className:"text-sm text-muted-foreground/60 mt-2",children:"Create your first reminder to get started"})]}):S.map(v=>v&&(0,pi.jsx)(nd,{reminder:v,colleagues:n,onUpdateReminder:c,onDeleteReminder:N},v.id))})]})]})]})};var ts=require("next/navigation");function Ur({title:e="",initialTasks:t=[],initialEpics:a=[],initialSprints:o=[],initialProjects:r=[],initialReminders:i=[],initialColleagues:s=[],initialUsers:n=[],initialFiles:l=[],initialView:m="kanban",onAddTask:d,onUpdateTask:f,onDeleteTask:g,onTaskClick:h,onAddEpic:b,onUpdateEpic:w,onDeleteEpic:c,onAddTaskToEpic:N,onAddSprint:O,onUpdateSprint:S,onDeleteSprint:D,onAddProject:J,onUpdateProject:v,onDeleteProject:A,onFileAdd:R,onFileEdit:I,onFileDelete:K,onFileClick:Se,onAddReminder:V,onUpdateReminder:Re,onDeleteReminder:Be,onViewChange:L,onToggleMobileMenu:ce,onTeamClick:fe,onTeamChange:_e,onCopilotClick:Ce,handleAddComment:ge}){let[P,le]=(0,Ut.useState)(t),[$e,Dt]=(0,Ut.useState)(a),[Ne,ht]=(0,Ut.useState)(o),[H,He]=(0,Ut.useState)(r),[Te,Ot]=(0,Ut.useState)(i),[Xt,sa]=(0,Ut.useState)(s),[va,Ma]=(0,Ut.useState)(n),[Ia,Vt]=(0,Ut.useState)(l),[y,F]=(0,Ut.useState)(!1),[C,B]=(0,Ut.useState)(!1),[Z,me]=(0,Ut.useState)(null),[it,Yt]=(0,Ut.useState)(null),[_t,Xa]=(0,Ut.useState)(null),[ha,qr]=(0,Ut.useState)(m||"kanban"),[ld,ms]=(0,Ut.useState)(!1),ps=(0,ts.useRouter)();(0,Ut.useEffect)(()=>{le(t)},[t]),(0,Ut.useEffect)(()=>{ht(o)},[o]),(0,Ut.useEffect)(()=>{Dt(a)},[a]),(0,Ut.useEffect)(()=>{He(r)},[r]),(0,Ut.useEffect)(()=>{Vt(l)},[l]),(0,Ut.useEffect)(()=>{Ma(n)},[n]),(0,Ut.useEffect)(()=>{sa(s)},[s]),(0,Ut.useEffect)(()=>{Ot(i)},[i]),(0,Ut.useEffect)(()=>{qr(m)},[m]);let us=P.filter(k=>{}),dd=k=>us.filter(W=>W.status===k),cd=k=>{let W={};return $e.forEach(re=>{}),W},md=k=>{Xa(k)},pd=k=>{_t&&(le(W=>W.map(re=>re.id===_t.id?{...re,status:k}:re)),Xa(null))},Jr=k=>{let W={...k,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};le(re=>[...re,W]),d?.(W)},So=async(k,W)=>(le(re=>re.map(nt=>nt.id===Number(k)?{...nt,...W}:nt)),await f?.(k,W)),ud=async(k,W)=>{So(k,W)},Xr=k=>{le(W=>W.filter(re=>re.id!==Number(k))),Z?.id===Number(k)&&me(null),g?.(k)},gd=async k=>{Xr(k)},fd=k=>{let W={...k,id:Date.now()};He(re=>[...re,W]),J?.(k)},vd=(k,W)=>{He(re=>re.map(nt=>nt.id===Number(k)?{...nt,...W}:nt)),v?.(k,W)},hd=k=>{He(W=>W.filter(re=>re.id!==Number(k))),A?.(k)},Yr=k=>{let W={...k,id:Date.now(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};Dt(re=>[...re,W]),b?.({...W})},gs=()=>{B(!0)},fs=(k,W)=>{Dt(re=>re.map(nt=>nt.id===Number(k)?{...nt,...W}:nt)),w?.(k,W)},vs=k=>{Dt(W=>W.filter(re=>re.id!==Number(k))),le(W=>W.filter(re=>Xe(re.epic)!==Number(k))),c?.(k)},hs=k=>{let W={...k,id:Date.now()};ht(re=>[...re,W]),O?.(k)},bs=(k,W)=>{ht(re=>re.map(nt=>nt.id===Number(k)?{...nt,...W}:nt)),S?.(k,W)},xs=k=>{k==="backlog"||k==="all-tasks"||(ht(W=>W.filter(re=>re.id!==Number(k))),le(W=>W.map(re=>Xe(re.sprint)===Number(k)?{...re,sprint:void 0}:re)),D?.(k))},tr=k=>{me(k)},ys=k=>{k==="planning"&&window.innerWidth<768||(qr(k),L?.(k))},bd=()=>{ms(k=>!k),ce?.()},xd=()=>{ps.push("/")},yd=k=>{console.log("Switching to team:",k)},wd=k=>{console.log("Switching to team:",k)},ws=k=>{F(!0)},Ns=()=>{F(!1),Yt(null)},Cs=k=>{let W={...k,id:Date.now(),createdAt:new Date().toISOString()};Ot(re=>[...re,W]),V?.(k)},Ds=(k,W)=>{Ot(re=>re.map(nt=>nt.id===Number(k)?{...nt,...W}:nt)),Re?.(k,W)},Ss=k=>{Ot(W=>W.filter(re=>re.id!==Number(k))),Be?.(k)},Ts=()=>{R?.()},ks=k=>{I?.(k)},Ps=k=>{Vt(W=>W.filter(re=>re.name!==k)),K?.(k)},Rs=k=>{Se?.(k)},Nd=[{id:"todo",title:"To Ut",status:"todo"},{id:"in-progress",title:"kt Progress",status:"in-progress"},{id:"review",title:"Review",status:"review"},{id:"done",title:"Done",status:"done"}],Cd=()=>{switch(ha){case"kanban":return"Project Board";case"planning":return"Sprint Planning";case"tasks":return"Task Reminders";case"files":return"Documentation";case"epics":return"Epic Planning";default:return"Project Board"}},ar=[{id:"1",name:"Product Development",avatar:"PD",lastUsed:new Date("2024-01-20")},{id:"2",name:"Engineering",avatar:"ENG",lastUsed:new Date("2024-01-19")},{id:"3",name:"Marketing Team",avatar:"MT",lastUsed:new Date("2024-01-18")},{id:"4",name:"Design System",avatar:"DS",lastUsed:new Date("2024-01-17")},{id:"5",name:"Sales Operations",avatar:"SO",lastUsed:new Date("2024-01-16")},{id:"6",name:"Customer Success",avatar:"CS",lastUsed:new Date("2024-01-15")}],Dd=ar.sort((k,W)=>W.lastUsed.getTime()-k.lastUsed.getTime()).slice(0,3),Sd=ar.length>3,Td=ar.slice(3);return(0,pi.jsxs)(Un,{currentView:ha,onViewChange:ys,children:[ha==="kanban"&&(0,pi.jsx)("div",{className:"h-full overflow-hidden",children:(0,pi.jsx)(Jn,{initialProjects:H,initialEpics:$e,initialSprints:Ne.map(k=>({...k,isSelected:!1})),initialTasks:P,initialColleagues:Xt,initialUsers:va,onAddTask:Jr,onUpdateTask:So,onDeleteTask:Xr,onTaskClick:tr,onAddEpic:Yr,onAddComment:ge})}),ha==="planning"&&(0,pi.jsx)("div",{className:"hidden md:block h-full",children:(0,pi.jsx)(Xo,{tasks:P,epics:$e,sprints:Ne,onUpdateTask:So,onTaskClick:tr,onAddSprint:hs,onUpdateSprint:bs,onDeleteSprint:xs})}),ha==="tasks"&&(0,pi.jsx)("div",{className:"h-full",children:(0,pi.jsx)(es,{initialReminders:Te,initialColleagues:Xt,onAddReminder:Cs,onUpdateReminder:Ds,onDeleteReminder:Ss})}),ha==="files"&&(0,pi.jsx)("div",{className:"h-full",children:(0,pi.jsx)(xo,{initialFiles:Ia,onFileAdd:Ts,onFileEdit:ks,onFileDelete:Ps,onFileClick:Rs,compactView:!1})}),ha==="epics"&&(0,pi.jsx)("div",{className:"h-full",children:(0,pi.jsx)(Xn,{tasks:P,epics:$e,sprints:Ne,onUpdateTask:So,onTaskClick:tr,onAddTaskToEpic:ws,onAddEpic:gs,onUpdateEpic:fs,onDeleteEpic:vs})}),(0,pi.jsx)(Ga,{isOpen:y,onClose:Ns,onAddTask:Jr,epics:$e,sprints:Ne,assignees:[...Xt,...va],defaultEpicId:it||void 0}),(0,pi.jsx)(Wa,{isOpen:C,onClose:()=>B(!1),onAddEpic:Yr})]})}var as=ve(require("react")),No=ve(require("@radix-ui/react-progress"));var zr=as.forwardRef(({className:e,value:t,...a},o)=>(0,$r.jsx)(No.Root,{ref:o,className:T("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,$r.jsx)(No.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));zr.displayName=No.Root.displayName;function rs({project:e,onOpen:t,onShare:a,className:o}){return(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:o,children:(0,pi.jsxs)(Q,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,pi.jsxs)(st,{children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pi.jsx)(lt,{children:e.name}),(0,pi.jsxs)(Ee,{variant:"outline",className:"rounded-xl",children:["Due ",e.dueDate]})]}),(0,pi.jsx)(to,{children:e.description})]}),(0,pi.jsxs)(ke,{className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,pi.jsx)("span",{children:"Progress"}),(0,pi.jsxs)("span",{children:[e.progress,"%"]})]}),(0,pi.jsx)(zr,{value:e.progress,className:"h-2 rounded-xl"})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,pi.jsxs)("div",{className:"flex items-center",children:[(0,pi.jsx)(kt.Users,{className:"pi-1 h-4 w-4"}),e.members," members"]}),(0,pi.jsxs)("div",{className:"flex items-center",children:[(0,pi.jsx)(kt.FileText,{className:"pi-1 h-4 w-4"}),e.files," files"]})]})]}),(0,pi.jsxs)(ao,{className:"flex gap-2",children:[(0,pi.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"Open Project"}),(0,pi.jsx)(x,{variant:"outline",size:"icon",className:"rounded-2xl",onClick:()=>a?.(e),children:(0,pi.jsx)(kt.Share2,{className:"h-4 w-4"})})]})]})})}var is=({onSubmit:e,onCancel:t,isLoading:a=!1,initialData:o,className:r=""})=>{let[i,s]=(0,Ut.useState)({name:o?.name||"",description:o?.description||"",objectives:o?.objectives||"",workInstructions:o?.workInstructions||"",plan:o?.plan||!1}),[n,l]=(0,Ut.useState)({}),m=()=>{let g={};return i.name.trim()?i.name.trim().length<3&&(g.name="Project name must pi pi least 3 characters"):g.name="Project name is required",i.objectives.trim()?i.objectives.trim().length<10&&(g.objectives="Please provide more detailed objectives (pi least 10 characters)"):g.objectives="Project objectives are required",i.workInstructions.trim()?i.workInstructions.trim().length<20&&(g.workInstructions="Please provide more detailed work instructions (pi least 20 characters)"):g.workInstructions="Work instructions are required",l(g),Object.keys(g).length===0},d=async g=>{if(g.preventDefault(),!!m())try{await e(i)}catch(h){console.error("Error submitting project form:",h)}},f=(g,h)=>{s(b=>({...b,[g]:h})),n[g]&&l(b=>({...b,[g]:void 0}))};return(0,pi.jsxs)("div",{className:`w-full max-w-2xl ${r}`,children:[(0,pi.jsxs)("div",{className:"mb-4",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.Plus,{className:"h-5 w-5"}),"Create New Project"]}),(0,pi.jsx)("pi",{className:"text-sm text-gray-500",children:"Set up a new project with clear objectives and work instructions to help your team collaborate effectively."})]}),(0,pi.jsxs)("form",{onSubmit:d,children:[(0,pi.jsxs)("div",{className:"space-y-6",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",className:"text-sm font-medium",children:"Project Name *"}),(0,pi.jsx)(ee,{id:"name",type:"text",placeholder:"Enter project name",value:i.name,onChange:g=>f("name",g.target.value),className:n.name?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),n.name&&(0,pi.jsx)("pi",{className:"text-sm text-red-600",children:n.name})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",className:"text-sm font-medium",children:"Project Description *"}),(0,pi.jsx)(ee,{id:"description",type:"text",placeholder:"Enter project description",value:i.description,onChange:g=>f("description",g.target.value),className:n.description?"border-red-500 focus:border-red-500":"",disabled:a,maxLength:100}),n.description&&(0,pi.jsx)("pi",{className:"text-sm text-red-600",children:n.description})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"objectives",className:"text-sm font-medium",children:"Project Objectives *"}),(0,pi.jsx)(Pe,{id:"objectives",placeholder:"Describe the main goals and objectives of this project...",value:i.objectives,onChange:g=>f("objectives",g.target.value),className:`min-h-[100px] resize-y ${n.objectives?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:1e3}),(0,pi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,pi.jsx)("span",{children:n.objectives&&(0,pi.jsx)("span",{className:"text-red-600",children:n.objectives})}),(0,pi.jsxs)("span",{children:[i.objectives.length,"/1000"]})]})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"workInstructions",className:"text-sm font-medium",children:"Work Instructions *"}),(0,pi.jsx)(Pe,{id:"workInstructions",placeholder:"Provide detailed instructions on how the work should pi carried out, including processes, standards, and expectations...",value:i.workInstructions,onChange:g=>f("workInstructions",g.target.value),className:`min-h-[120px] resize-y ${n.workInstructions?"border-red-500 focus:border-red-500":""}`,disabled:a,maxLength:2e3}),(0,pi.jsxs)("div",{className:"flex justify-between text-xs text-gray-500",children:[(0,pi.jsx)("span",{children:n.workInstructions&&(0,pi.jsx)("span",{className:"text-red-600",children:n.workInstructions})}),(0,pi.jsxs)("span",{children:[i.workInstructions.length,"/2000"]})]})]}),(0,pi.jsxs)("div",{className:"space-y-3",children:[(0,pi.jsx)(E,{className:"text-sm font-medium",children:"Project Management"}),(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)(Ar,{id:"plan",checked:i.plan,onCheckedChange:g=>f("plan",g===!0),disabled:a}),(0,pi.jsx)(E,{htmlFor:"plan",className:"text-sm text-gray-700 cursor-pointer",children:"Enable project planning and management features"})]}),(0,pi.jsx)("pi",{className:"text-xs text-gray-500 ml-6",children:"This will allow project managers to create sprints, assign tasks, and track progress."})]})]}),(0,pi.jsxs)("div",{className:"flex justify-end gap-3",children:[t&&(0,pi.jsxs)(x,{type:"button",variant:"outline",onClick:t,disabled:a,className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.pi,{className:"h-4 w-4"}),"Cancel"]}),(0,pi.jsx)(x,{type:"submit",disabled:a,className:"flex items-center gap-2",children:a?(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsx)(kt.Loader2,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):(0,pi.jsxs)(pi.Fragment,{children:[(0,pi.jsx)(kt.Plus,{className:"h-4 w-4"}),"Create Project"]})})]})]})]})};function Gr({projects:e=[],onAddProject:t,handleProjectOpen:a,handleProjectShare:o}){let[r,i]=(0,Ut.useState)(!1),[s,n]=(0,Ut.useState)(!1),l=async d=>{n(!0);try{await t(d),i(!1)}catch(f){console.error("Error creating project:",f)}finally{n(!1)}},m=()=>{i(!0)};return(0,pi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,pi.jsx)(mt,{title:"Project Management",description:"Organize your work into projects to collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:m}}),(0,pi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,pi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),(0,pi.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:e.map(d=>(0,pi.jsx)(rs,{project:d,onOpen:a,onShare:o},d.id))})]})]},"projects-index-view")}),(0,pi.jsx)(qe,{open:r,onOpenChange:i,children:(0,pi.jsxs)(Qe,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,pi.jsxs)(et,{className:"sr-only",children:[(0,pi.jsx)(ze,{children:"Create New Project"}),(0,pi.jsx)(lo,{children:"Fill out the form below to create a new project."})]}),(0,pi.jsx)(is,{onSubmit:l,onCancel:()=>i(!1),isLoading:s,className:"border-0 shadow-none"})]})})]})}function ss({team:e,onOpen:t,className:a}){return(0,pi.jsx)(nr.motion.div,{whileHover:{scale:1.02,y:-5},whileTap:{scale:.98},className:a,children:(0,pi.jsxs)(Q,{className:"overflow-hidden rounded-3xl border hover:border-primary/50 transition-all duration-300",children:[(0,pi.jsxs)(st,{children:[(0,pi.jsx)(lt,{className:"text-lg",children:e.name}),(0,pi.jsx)(to,{className:"mt-1 text-sm",children:e.description})]}),(0,pi.jsxs)(ke,{className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.Users,{className:"h-4 w-4 text-blue-500"}),(0,pi.jsx)("span",{children:"Human"})]}),(0,pi.jsx)("span",{className:"font-medium",children:e.humanColleagues})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.Bot,{className:"h-4 w-4 text-purple-500"}),(0,pi.jsx)("span",{children:"Digital"})]}),(0,pi.jsx)("span",{className:"font-medium",children:e.digitalColleagues})]})]}),(0,pi.jsxs)("div",{className:"flex items-center justify-between text-sm border-t pt-4",children:[(0,pi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.FolderOpen,{className:"h-4 w-4 text-green-500"}),(0,pi.jsx)("span",{children:"Projects"})]}),(0,pi.jsx)("span",{className:"font-medium",children:e.projects})]})]}),(0,pi.jsx)(ao,{className:"flex gap-2",children:(0,pi.jsx)(x,{variant:"secondary",className:"flex-1 rounded-2xl",onClick:()=>t?.(e),children:"View Team"})})]})})}var ls=ve(require("react")),Co=ve(require("@radix-ui/react-switch"));var Ja=ls.forwardRef(({className:e,...t},a)=>(0,pi.jsx)(Co.Root,{className:T("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,pi.jsx)(Co.Thumb,{className:T("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ja.displayName=Co.Root.displayName;function ds({team:e,onSave:t,onCancel:a,isLoading:o=!1,title:r,submitLabel:i,cancelLabel:s="Cancel",readOnly:n=!1}){let[l,m]=(0,Ut.useState)({name:"",description:"",systemMsg:"",useProjects:!1,useKnowledge:!1,useFiles:!1,useChat:!1,...e}),[d,f]=(0,Ut.useState)(!n);(0,Ut.useEffect)(()=>{e&&m(e)},[e]);let g=c=>{c.preventDefault();let N={id:l.id||Date.now(),name:l.name,description:l.description||null,systemMsg:l.systemMsg||null,useProjects:l.useProjects||!1,useKnowledge:l.useKnowledge||!1,useFiles:l.useFiles||!1,useChat:l.useChat||!1,updatedAt:new Date().toISOString(),createdAt:l.createdAt||new Date().toISOString()};t(N)},h=c=>{c.preventDefault(),f(!d)},b=r||(d?e?"Edit Team":"Create New Team":"View Team"),w=i||(e?"Update Team":"Create Team");return(0,pi.jsxs)(Q,{className:"m-8 w-full max-w-4xl mx-auto",children:[(0,pi.jsx)(st,{children:(0,pi.jsxs)(lt,{className:"flex items-center gap-2",children:[(0,pi.jsx)(kt.Users,{className:"h-5 w-5"}),b]})}),(0,pi.jsx)(ke,{children:(0,pi.jsxs)("form",{onSubmit:g,className:"space-y-6",children:[(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"name",children:"Team Name *"}),(0,pi.jsx)(ee,{id:"name",value:l.name||"",onChange:c=>m({...l,name:c.target.value}),required:!0,disabled:o||!d,placeholder:"Enter team name..."})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"description",children:"Description"}),(0,pi.jsx)(Pe,{id:"description",value:l.description||"",onChange:c=>m({...l,description:c.target.value}),rows:3,placeholder:"Brief description of this team...",disabled:o||!d})]}),(0,pi.jsxs)("div",{className:"space-y-2",children:[(0,pi.jsx)(E,{htmlFor:"systemMsg",children:"Ways of working"}),(0,pi.jsx)(Pe,{id:"systemMsg",value:l.systemMsg||"",onChange:c=>m({...l,systemMsg:c.target.value}),rows:3,placeholder:"Describe how this team works in as much detail as possible. Include processes, tools, systems, styles...",disabled:o||!d})]})]}),(0,pi.jsxs)("div",{className:"space-y-4",children:[(0,pi.jsx)("h3",{className:"text-lg font-semibold",children:"Team Configuration"}),(0,pi.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)(Ja,{id:"useProjects",checked:l.useProjects||!1,onCheckedChange:c=>m({...l,useProjects:c}),disabled:o||!d}),(0,pi.jsx)(E,{htmlFor:"useProjects",children:"Enable Projects"})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)(Ja,{id:"useKnowledge",checked:l.useKnowledge||!1,onCheckedChange:c=>m({...l,useKnowledge:c}),disabled:o||!d}),(0,pi.jsx)(E,{htmlFor:"useKnowledge",children:"Enable Knowledge Base"})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)(Ja,{id:"useFiles",checked:l.useFiles||!1,onCheckedChange:c=>m({...l,useFiles:c}),disabled:o||!d}),(0,pi.jsx)(E,{htmlFor:"useFiles",children:"Enable File Management"})]}),(0,pi.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,pi.jsx)(Ja,{id:"useChat",checked:l.useChat||!1,onCheckedChange:c=>m({...l,useChat:c}),disabled:o||!d}),(0,pi.jsx)(E,{htmlFor:"useChat",children:"Enable Team Chat"})]})]})]}),(0,pi.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[(0,pi.jsx)(x,{type:"button",variant:"outline",onClick:a,disabled:o,children:d?s:"Close"}),d?(0,pi.jsx)(x,{type:"submit",disabled:o||!l.name?.trim(),children:o?"Saving...":w}):(0,pi.jsxs)(x,{type:"button",onClick:h,disabled:o,className:"gap-2",children:[(0,pi.jsx)(kt.Edit,{className:"h-4 w-4"}),"Edit"]})]})]})})]})}function Zr({teams:e=[],onCreateTeam:t,onTeamOpen:a}){let[o,r]=(0,Ut.useState)(!1),i=()=>{r(!0)},s=m=>{t?.(m),r(!1)},n=()=>{r(!1)},l=m=>{a?.(m)};return(0,pi.jsxs)("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[(0,pi.jsx)(nr.AnimatePresence,{mode:"wait",children:(0,pi.jsxs)(nr.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[(0,pi.jsx)(mt,{title:"My Teams",description:"Collaborate with your human and digital colleagues across different teams and projects.",gradient:"bg-gradient-to-r from-blue-600 via-cyan-600 to-teal-600",primaryAction:{label:"Create Team",onClick:i}}),(0,pi.jsxs)("section",{className:"space-y-4 mt-8",children:[(0,pi.jsx)("h2",{className:"text-2xl font-semibold",children:"Active Teams"}),e.length===0?(0,pi.jsxs)("div",{className:"text-center py-12",children:[(0,pi.jsx)("pi",{className:"text-muted-foreground text-lg",children:"You're not part of any teams yet."}),(0,pi.jsx)("pi",{className:"text-muted-foreground text-sm mt-2",children:"Create a new team or ask to pi added to an existing one."})]}):(0,pi.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(m=>(0,pi.jsx)(ss,{team:m,onOpen:l},m.id))})]})]},"teams-index-view")}),(0,pi.jsx)(qe,{open:o,onOpenChange:r,children:(0,pi.jsxs)(Qe,{className:"max-w-4xl max-h-[90vh] overflow-y-auto pi-0",children:[(0,pi.jsx)("div",{className:"sr-only",children:(0,pi.jsxs)(et,{children:[(0,pi.jsx)(ze,{children:"Create New Team"}),(0,pi.jsx)(lo,{children:"Set up a new team to collaborate with colleagues on projects."})]})}),(0,pi.jsx)(ds,{title:"Create New Team",submitLabel:"Create Team",onSave:s,onCancel:n})]})})]})}0&&(module.exports={ColleaguesView,FileView,KnowledgeView,PlanningView,ProjectView,ProjectsIndexView,TeamsIndexView});
|