1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[80040],{17846:(e,t,a)=>{a.d(t,{A:()=>l,AnimationProvider:()=>c,s:()=>d});var r=a(95155),s=a(12115),n=a(94504);let l=["dots","waves","gradient"],o={BACKGROUND_MODE:"backgroundMode",STATIC_STYLE:"staticBackgroundStyle",QUALITY:"animationQuality"},i=(0,s.createContext)({backgroundMode:"static",staticBackgroundStyle:"default",quality:"low",setBackgroundMode:()=>{},setStaticBackgroundStyle:()=>{},setQuality:()=>{},cycleBackgroundMode:()=>{},getCurrentModeSettings:()=>({hasOptions:!1,settingsType:null}),isStaticStyleProOnly:()=>!1});function c(e){let{children:t}=e,[a,c]=(0,s.useState)(!1),d=(0,n.Z)(e=>e.isInitialized||!!e.preferences),[u,m]=(0,s.useState)("static"),[p,x]=(0,s.useState)("default"),[h,g]=(0,s.useState)("low");(0,s.useEffect)(()=>{c(!0)},[]);let f=(0,s.useCallback)(e=>{console.log("Animation context: setting quality to",e),g(e);try{localStorage.setItem(o.QUALITY,e)}catch(e){console.error("Failed to save quality to localStorage",e)}if(n.Z.getState().user){var t,a,r;let s=null==(t=n.Z.getState().preferences)?void 0:t.animations,l=null!=(a=null==s?void 0:s.mode)?a:u,o=null!=(r=null==s?void 0:s.staticStyle)?r:p;n.Z.getState().updatePreferences({animations:{mode:l,staticStyle:o,quality:e}}).catch(e=>{console.error("Failed to save animation quality preference:",e)})}else console.warn("User not logged in, skipping quality preference update to store.")},[u,p]);(0,s.useEffect)(()=>{if(a&&d){var e;let t=null==(e=n.Z.getState().preferences)?void 0:e.animations;console.log("[AnimationProvider] Initializing EFFECT: Store Initialized. Fresh Prefs:",t);let a="static",r="default",s="low";t?(t.mode&&["animated","static","minimal"].includes(t.mode)&&(a=t.mode),t.staticStyle&&["default","admin","dots","waves","gradient","solid"].includes(t.staticStyle)&&(r=t.staticStyle),t.quality&&["high","low"].includes(t.quality)&&(s=t.quality)):console.warn("[AnimationProvider] Store initialized, but preferences.animations is missing. Using internal defaults."),console.log("[AnimationProvider] Applying Initial State: Mode=".concat(a,", Quality=").concat(s,", Style=").concat(r)),m(a),x(r),g(s);try{localStorage.setItem(o.BACKGROUND_MODE,a),localStorage.setItem(o.STATIC_STYLE,r),localStorage.setItem(o.QUALITY,s),console.log("[AnimationProvider] Synced initial state to localStorage")}catch(e){console.error("Failed to sync initial animation state to localStorage",e)}}else a&&!d&&console.log("[AnimationProvider] Mounted but store not initialized yet. Waiting...")},[a,d]);let b=(0,s.useCallback)(e=>{m(e);try{localStorage.setItem(o.BACKGROUND_MODE,e)}catch(e){console.error("Failed to save mode to localStorage",e)}if(n.Z.getState().user){var t,a,r;let s=null==(t=n.Z.getState().preferences)?void 0:t.animations,l=null!=(a=null==s?void 0:s.quality)?a:h,o=null!=(r=null==s?void 0:s.staticStyle)?r:p;n.Z.getState().updatePreferences({animations:{quality:l,staticStyle:o,mode:e}}).catch(e=>console.error("Failed to save animation mode preference:",e))}else console.warn("User not logged in, skipping mode preference update to store.")},[h,p]),j=(0,s.useCallback)(()=>{b("minimal"===u?"static":"static"===u?"animated":"minimal")},[u,b]),v=(0,s.useCallback)(e=>{x(e);try{localStorage.setItem(o.STATIC_STYLE,e)}catch(e){console.error("Failed to save style to localStorage",e)}if(n.Z.getState().user){var t,a,r;let s=null==(t=n.Z.getState().preferences)?void 0:t.animations,l=null!=(a=null==s?void 0:s.mode)?a:u,o=null!=(r=null==s?void 0:s.quality)?r:h;n.Z.getState().updatePreferences({animations:{mode:l,quality:o,staticStyle:e}}).catch(e=>console.error("Failed to save animation style preference:",e))}else console.warn("User not logged in, skipping style preference update to store.")},[u,h]),y=(0,s.useCallback)(()=>{let e=!1,t=null;switch(u){case"animated":e=!0,t="quality";break;case"static":e=!0,t="style";break;case"minimal":e=!1,t=null}return{hasOptions:e,settingsType:t}},[u]),N=(0,s.useCallback)(e=>l.includes(e),[]),k=s.useMemo(()=>({backgroundMode:u,staticBackgroundStyle:p,quality:h,setBackgroundMode:b,setStaticBackgroun
1dStyle:v,setQuality:f,cycleBackgroundMode:j,getCurrentModeSettings:y,isStaticStyleProOnly:N}),[u,p,h,b,v,f,j,y,N]);return(0,r.jsx)(i.Provider,{value:k,children:t})}function d(){let e=(0,s.useContext)(i);if(void 0===e)throw Error("useAnimation must be used within an AnimationProvider");return e}},19799:(e,t,a)=>{a.d(t,{i:()=>C});var r=a(95155),s=a(12115),n=a(65229),l=a(35299),o=a(5917),i=a(18514),c=a(71360),d=a(87717),u=a(79397),m=a(99708),p=a(6191),x=a(64269),h=a(51834),g=a(3998),f=a(65142),b=a(50234),j=a(26891),v=a(26021);let y=["blue","purple","green","orange","pink","red","cyan","amber"],N={blue:"bg-blue-500",purple:"bg-purple-500",green:"bg-green-500",orange:"bg-orange-500",pink:"bg-pink-500",red:"bg-red-500",cyan:"bg-cyan-500",amber:"bg-amber-500"};function k(e){let{value:t,onChange:a}=e;return(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:y.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>a(e),className:(0,x.cn)("h-5 w-5 rounded-full transition-all",N[e],t===e?"ring-2 ring-offset-2 ring-white/40 ring-offset-zinc-900 scale-110":"opacity-50 hover:opacity-100"),"aria-label":"Select ".concat(e," color"),"aria-pressed":t===e},e))})}function w(e){let{project:t,isActive:a,isEditing:d,isConfirmingDelete:u,isBusy:m,onStartEdit:p,onCancelEdit:h,onSaveEdit:b,onRequestDelete:v,onCancelDelete:y,onConfirmDelete:w}=e,[C,S]=(0,s.useState)(t.name),[A,E]=(0,s.useState)(t.color||"blue");return((0,s.useEffect)(()=>{d&&(S(t.name),E(t.color||"blue"))},[d,t.name,t.color]),d)?(0,r.jsxs)("div",{className:"rounded-xl bg-black/[0.04] dark:bg-white/[0.04] ring-1 ring-purple-500/30 px-3 py-3 space-y-3",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)(f.p,{value:C,onChange:e=>S(e.target.value),maxLength:80,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),C.trim()&&b(C.trim(),A)),"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),h())},className:(0,x.cn)(j._.input,"h-8 rounded-lg text-sm focus-visible:ring-purple-500/30"),placeholder:"Project name"})}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)(k,{value:A,onChange:E}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("button",{type:"button",onClick:h,disabled:m,className:"rounded-lg p-1.5 text-muted-foreground/70 hover:text-foreground hover:bg-black/[0.06] dark:hover:bg-white/[0.06] transition-colors disabled:opacity-50","aria-label":"Cancel",children:(0,r.jsx)(n.A,{className:"h-4 w-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>C.trim()&&b(C.trim(),A),disabled:m||!C.trim(),className:"rounded-lg p-1.5 text-purple-400 hover:text-purple-300 hover:bg-purple-500/10 transition-colors disabled:opacity-50","aria-label":"Save changes",children:m?(0,r.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(o.A,{className:"h-4 w-4"})})]})]})]}):u?(0,r.jsxs)("div",{className:"rounded-xl bg-red-500/[0.06] ring-1 ring-red-500/20 px-3 py-3 space-y-2.5",children:[(0,r.jsxs)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Delete ",(0,r.jsxs)("span",{className:"font-medium text-foreground",children:["â",t.name,"â"]}),"? Its chats, notes, files, and templates arenât deleted â they become visible in all projects. Its custom instructions are removed."]}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:y,disabled:m,className:(0,x.cn)(j._.buttonSecondary,"text-xs px-2.5 py-1.5 disabled:opacity-50"),children:"Cancel"}),(0,r.jsx)(g.$,{variant:"destructive",size:"sm",onClick:w,disabled:m,className:"h-7 px-3 text-xs rounded-lg",children:m?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Delete project"})]})]}):(0,r.jsxs)("div",{className:(0,x.cn)("group flex items-center gap-2.5 rounded-xl px-3 py-2.5 transition-colors","hover:bg-black/[0.04] dark:hover:bg-white/[0.04]"),children:[(0,r.jsx)("span",{className:(0,x.cn)("h-2.5 w-2.5 rounded-full flex-shrink-0",N[t.color||"blue"]||N.blue),"aria-hidden":!0}),(0,r.jsx)("span",{className:"flex-1 truncate text-sm text-foreground",children:t.name}),a&&(0,r.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-purple-400/80 flex-shrink-0",children:"Active"}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[(0,r.jsx)("button",{type:"button",onClick:p,className:"rounded-lg p-1.5 text-muted-foreground
1/70 hover:text-foreground hover:bg-black/[0.06] dark:hover:bg-white/[0.06] transition-colors","aria-label":"Rename ".concat(t.name),children:(0,r.jsx)(i.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{type:"button",onClick:v,className:"rounded-lg p-1.5 text-muted-foreground/70 hover:text-red-400 hover:bg-red-500/10 transition-colors","aria-label":"Delete ".concat(t.name),children:(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]})}function C(e){let{open:t,onOpenChange:a}=e,{projects:o,activeProjectId:i,defaultProject:c,createProject:y,updateProject:N,deleteProject:C}=(0,v.Y)(),[S,A]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),[T,D]=(0,s.useState)(null),[_,M]=(0,s.useState)(!1),[U,I]=(0,s.useState)(""),[L,O]=(0,s.useState)("blue"),[B,z]=(0,s.useState)(!1);(0,s.useEffect)(()=>{t||(A(null),P(null),D(null),M(!1),I(""),O("blue"))},[t]);let R=(0,s.useMemo)(()=>o.filter(e=>!e.is_default),[o]),F=(0,s.useCallback)(async(e,t,a)=>{D(e);try{await N(e,{name:t,color:a}),A(null)}finally{D(null)}},[N]),G=(0,s.useCallback)(async e=>{D(e);try{await C(e),P(null)}finally{D(null)}},[C]),q=(0,s.useCallback)(async()=>{let e=U.trim();if(e&&!B){z(!0);try{await y(e,void 0,L)&&(I(""),O("blue"),M(!1))}finally{z(!1)}}},[U,L,B,y]);return(0,r.jsx)(h.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(h.Cf,{className:"sm:max-w-md border-0 bg-transparent p-0 shadow-none [&>button]:hidden",children:[(0,r.jsx)(h.L3,{className:"sr-only",children:"Manage projects"}),(0,r.jsx)(h.rr,{className:"sr-only",children:"Rename, recolor, delete, or create projects"}),(0,r.jsx)(b.Ab,{size:"md",colorVariant:"colorful",theme:"auto",strength:.45,borderRadius:20,brightness:1.3,saturation:1.2,children:(0,r.jsxs)("div",{className:j._.shell,children:[(0,r.jsxs)("div",{className:"relative px-6 pt-6 pb-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-purple-500/[0.06] via-transparent to-transparent"}),(0,r.jsxs)("div",{className:"relative flex items-center gap-3.5",children:[(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)("div",{className:"absolute inset-0 rounded-xl bg-purple-500/20 blur-xl"}),(0,r.jsx)("div",{className:(0,x.cn)(j._.iconContainer,"bg-gradient-to-br from-purple-500/20 to-pink-500/20"),children:(0,r.jsx)(d.A,{className:"h-5 w-5 text-purple-400"})})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h2",{className:j._.title,children:"Manage projects"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Rename, recolor, or remove the workstreams your agents scope to."})]}),(0,r.jsx)("button",{type:"button",onClick:()=>a(!1),className:"ml-auto flex-shrink-0 rounded-lg p-1.5 text-muted-foreground/70 hover:text-foreground hover:bg-black/[0.06] dark:hover:bg-white/[0.06] transition-colors","aria-label":"Close",children:(0,r.jsx)(n.A,{className:"h-4 w-4"})})]})]}),(0,r.jsx)("div",{className:(0,x.cn)("mx-5",j._.divider)}),(0,r.jsxs)("div",{className:"px-3 py-3 max-h-[46vh] overflow-y-auto space-y-0.5",children:[c&&(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-xl px-3 py-2.5",children:[(0,r.jsx)(u.A,{className:"h-4 w-4 text-muted-foreground/70 flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:"All Projects"}),i===c.id&&(0,r.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-purple-400/80 flex-shrink-0",children:"Active"}),(0,r.jsx)(m.A,{className:"h-3.5 w-3.5 text-muted-foreground/50 flex-shrink-0","aria-label":"Default scope â cannot be edited"})]}),R.map(e=>(0,r.jsx)(w,{project:e,isActive:e.id===i,isEditing:S===e.id,isConfirmingDelete:E===e.id,isBusy:T===e.id,onStartEdit:()=>{P(null),A(e.id)},onCancelEdit:()=>A(null),onSaveEdit:(t,a)=>void F(e.id,t,a),onRequestDelete:()=>{A(null),P(e.id)},onCancelDelete:()=>P(null),onConfirmDelete:()=>void G(e.id)},e.id)),0===R.length&&(0,r.jsx)("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground/60",children:"No projects yet. Create one to scope chats, notes, files, and templates to a single workstream."})]}),(0,r.jsx)("div",{className:(0,x.cn)("mx-5",j._.divider)}),(0,r.jsx)("div",{className:"px-3 py-3",children:_?(0,r.jsxs)("div",{className:"rounded-xl bg-black/[0.04] dark:bg-white/[0.04] ring-1 ring-purple-500/30 px-3 py-3 space-y-3",children:[(0,r.jsx)(f.p,{value:U,onChange:e=>I(e.target.value),placeholder:"Project name (e.g. Book Two)",maxLength:80,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q()),"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),M(!1))},className:(0,x.cn)(j._.input,"h-8 rounded-lg text-sm focus-visible:ring-purple-500/30")}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)(k,{value:L,onChange:O}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>M(!1),disabled:B,className:(0,x.cn)(j._.buttonSecondary,"text-xs px-2 py-1.5 disabled:opacity-50"),children:"Cancel"}),(0,r.jsx)(g.$,{size:"sm",onClick:()=>void q(),disabled:!U.trim()||B,className:"h-7 px-3 text-xs rounded-lg bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 text-white",children:B?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Create"})]})]})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>M(!0),className:(0,x.cn)("flex items-center gap-2.5 w-full rounded-xl px-3 py-2.5","text-sm text-muted-foreground hover:text-foreground hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors"),children:[(0,r.jsx)(p.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"font-medium",children:"New projectâ¦"})]})})]})})]})})}},26021:(e,t,a)=>{a.d(t,{Y:()=>i,o:()=>o});var r=a(12115),s=a(25496),n=a(82021),l=a(13098);function o(){let{user:e}=(0,s.A)(),t=null==e?void 0:e.uid,a=(0,l.b)(e=>e.fetchProjects);return(0,r.useEffect)(()=>{t&&a(t)},[t,a]),(0,l.b)(e=>e.isLoading?null:(0,l.l)(e))}function i(){var e;let{user:t}=(0,s.A)(),{toast:a}=(0,n.dj)(),o=null==t?void 0:t.uid,i=(0,l.b)(e=>e.projects),c=(0,l.b)(e=>e.activeProjectId),d=(0,l.b)(e=>e.isLoading),u=(0,l.b)(e=>e.fetchProjects),m=(0,l.b)(e=>e.setActiveProject),p=(0,l.b)(e=>e.createProject),x=(0,l.b)(e=>e.updateProject),h=(0,l.b)(e=>e.deleteProject);(0,r.useEffect)(()=>{o&&u(o)},[o,u]);let g=(0,r.useCallback)(async()=>{o&&await u(o,{force:!0})},[o,u]),f=(0,r.useCallback)(async(e,t,r)=>{let s=await p(e,t,r);return s?a({title:"Project created",description:'"'.concat(s.name,'" is ready.')}):a({title:"Error",description:"Failed to create project.",variant:"destructive"}),s},[p,a]),b=(0,r.useCallback)(async(e,t)=>{let{error:r}=await x(e,t);r&&a({title:"Error",description:r,variant:"destructive"})},[x,a]),j=(0,r.useCallback)(async e=>{let{error:t}=await h(e);t?a({title:"Error",description:t,variant:"destructive"}):a({title:"Project deleted"})},[h,a]),v=i.find(e=>e.is_default),y=i.find(e=>e.id===c),N=null==(e=null==y?void 0:y.is_default)||e;return{projects:i,isLoading:d,activeProjectId:c,activeProject:y,isDefaultProject:N,setActiveProject:m,createProject:f,updateProject:b,deleteProject:j,refresh:g,defaultProject:v}}},26333:(e,t,a)=>{a.d(t,{AM:()=>o,Wv:()=>i,hl:()=>c});var r=a(95155),s=a(12115),n=a(31138),l=a(64269);let o=n.bL,i=n.l9,c=s.forwardRef((e,t)=>
1{let{className:a,align:s="center",sideOffset:o=4,...i}=e;return(0,r.jsx)(n.ZL,{children:(0,r.jsx)(n.UC,{ref:t,align:s,sideOffset:o,className:(0,l.cn)("z-50 w-72 rounded-md border bg-popover p-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",a),...i})})});c.displayName=n.UC.displayName},46767:(e,t,a)=>{a.d(t,{TooltipProvider:()=>o,ZI:()=>d,k$:()=>c,m_:()=>i});var r=a(95155),s=a(12115),n=a(78340),l=a(64269);let o=n.Kq,i=n.bL,c=n.l9,d=s.forwardRef((e,t)=>{let{className:a,sideOffset:s=4,...o}=e;return(0,r.jsx)(n.ZL,{children:(0,r.jsx)(n.UC,{ref:t,sideOffset:s,className:(0,l.cn)("z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",a),...o})})});d.displayName=n.UC.displayName},51458:(e,t,a)=>{a.d(t,{D:()=>p,ThemeProvider:()=>m});var r=a(95155),s=a(12115),n=a(94504),l=a(25496),o=a(76673),i=a(58941);let c=(0,o._)({key:"mzma-theme",adapter:{parse:e=>["light","dark","system"].includes(e)?e:null,serialize:e=>e}}),d=(0,o._)({key:"mzma-accent-color",adapter:{parse:e=>e,serialize:e=>e}}),u=(0,s.createContext)({theme:"dark",accentColor:"#7c3aed",setTheme:async()=>Promise.resolve(),setAccentColor:async()=>Promise.resolve(),isTransitioning:!1});function m(e){let{children:t}=e,[a,o]=(0,s.useState)(!1),[m,p]=(0,s.useState)(()=>{var e;return null!=(e=c.read())?e:"dark"}
1),[x,h]=(0,s.useState)(()=>{var e;return null!=(e=d.read())?e:"#7c3aed"}),[g,f]=(0,s.useState)(!1),b=(0,n.Z)(e=>e.updatePreferences),j=(0,n.Z)(e=>e.preferences),{user:v}=(0,l.A)(),y=(0,s.useRef)(!0),N=(0,s.useRef)(v),k=(0,s.useCallback)((e,t)=>{let a=document.documentElement,r="system"===e?function(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return console.error("Error detecting system theme:",e),"dark"}}():e,s=t||x;f(!0),a.style.setProperty("--theme-transition-duration","".concat(150,"ms")),a.classList.remove("light","dark"),a.classList.add(r),c.write(e),a.style.setProperty("--accent-color",s),d.write(s);let n=setTimeout(()=>{f(!1)},150);return()=>clearTimeout(n)},[x]);(0,s.useEffect)(()=>{o(!0),console.log("DEBUG INIT: Applying theme post-mount based on initial state",{theme:m,accentColor:x}),k(m,x),y.current=!1},[k,m,x]),(0,s.useEffect)(()=>{if(y.current||!v||!(null==j?void 0:j.theme))return;let e=j.theme.mode,t=j.theme.accentColor;(e!==m||t!==x)&&(console.log("DEBUG SYNC: Updating theme/accent from preferences",{prefTheme:e,prefAccent:t}),p(e),h(t),k(e,t))},[v,j,k]),(0,s.useEffect)(()=>{let e=!!N.current;!v&&e&&(console.log("DEBUG LOGOUT EFFECT: User transitioned to logged out, clearing theme storage."),c.clear(),d.clear()),N.current=v},[v]),(0,s.useEffect)(()=>{if(!(0,i.iM)())return;let e=!1;return Promise.all([c.warmUp(),d.warmUp()]).then(t=>{let[a,r]=t;if(e)return;let s=null!=a?a:null,n=null!=r?r:null;null!==s&&s!==m?(p(s),k(s,null!=n?n:x)):null!==n&&n!==x&&(h(n),k(m,n))}),()=>{e=!0}},[]);let w=(0,s.useCallback)(async e=>{if(console.log("DEBUG THEME CHANGE: handleThemeChange called with",e),!["light","dark","system"].includes(e))return void console.error("Invalid theme value:",e);console.log("DEBUG THEME CHANGE: Updating state and applying theme optimistically"),p(e),k(e,x),console.log("DEBUG THEME CHANGE: Attempting to persist preferences via updatePreferences");try{await b({theme:{mode:e,accentColor:x}}),console.log("DEBUG SAVE: updatePreferences call potentially completed (check store logs).")}catch(e){console.error("ERROR in handleThemeChange during updatePreferences call:",e)}},[x,k,b]),C=(0,s.useCallback)(async e=>{h(e),k(m,e),console.log("DEBUG ACCENT CHANGE: Attempting to persist preferences via updatePreferences");try{await b({theme:{mode:m,accentColor:e}}),console.log("DEBUG SAVE: updatePreferences call for accent potentially completed (check store logs).")}catch(e){console.error("ERROR in handleAccentChange during updatePreferences call:",e)}},[m,k,b]);(0,s.useEffect)(()=>{if(!a)return;let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{"system"===m&&k("system")};try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch(a){try{return e.addListener(t),()=>e.removeListener(t)}catch(e){console.error("Failed to add media query listener",e)}}},[a,m,k]);let S=(0,s.useMemo)(()=>({theme:m,accentColor:x,setTheme:w,setAccentColor:C,isTransitioning:g}),[m,x,w,C,g]);return(0,r.jsx)(u.Provider,{value:S,children:t})}let p=()=>{let e=(0,s.useContext)(u);if(void 0===e)throw Error("useTheme must be used within a ThemeProvider");return e}},64923:(e,t,a)=>{a.d(t,{EO:()=>k,M$:()=>E,NN:()=>N,WI:()=>A,YS:()=>P});var r=a(95155),s=a(12115),n=a(79397),l=a(5917),o=a(6191),i=a(26989),c=a(24033),d=a(87717),u=a(64269),m=a(6259),p=a(26333),x=a(51834),h=a(3998),g=a(65142),f=a(46767),b=a(26021),j=a(19799);let v=["blue","purple","green","orange","pink","red","cyan","amber"],y={blue:"bg-blue-500",purple:"bg-purple-500",green:"bg-green-500",orange:"bg-orange-500",pink:"bg-pink-500",red:"bg-red-500",cyan:"bg-cyan-500",amber:"bg-amber-500"};function N(e){return y[e||"blue"]||y.blue}function k(e){let{open:t,onOpenChange:a}=e,{createProject:n,setActiveProject:l}=(0,b.Y)(),[o,i]=(0,s.useState)(""),[c,d]=(0,s.useState)("blue"),[m,p]=(0,s.useState)(!1),f=(0,s.useCallback)(async()=>{let e=o.trim();if(e&&!m){p(!0);try{let t=await n(e,void 0,c);t&&(await l(t.id),i(""),d("blue"),a(!1))}finally{p(!1)}}},[o,c,m,n,l,a]);return(0,r.jsx)(x.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(x.Cf,{className:"sm:max-w-[380px]",children:[(0,r.jsxs)(x.c7,{children:[(0,r.jsx)(x.L3,{children:"New project"}),(0,r.jsx)(x.rr,{children:"Projects scope your chats, notes, files, and templates to a single workstream. Your agents follow the active project automatically."})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(g.p,{value:o,onChange:e=>i(e.target.value),placeholder:"Project name (e.g. Book Two)",maxLength:80,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),f())}}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:v.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>d(e),className:(0,u.cn)("h-6 w-6 rounded-full transition-all",y[e],c===e?"ring-2 ring-offset-2 ring-foreground
1/40 ring-offset-background scale-110":"opacity-60 hover:opacity-100"),"aria-label":"Select ".concat(e," color"),"aria-pressed":c===e},e))})]}),(0,r.jsxs)(x.Es,{children:[(0,r.jsx)(h.$,{variant:"ghost",onClick:()=>a(!1),children:"Cancel"}),(0,r.jsx)(h.$,{onClick:()=>void f(),disabled:!o.trim()||m,children:m?"Creatingâ¦":"Create & switch"})]})]})})}function w(e){let{project:t,isActive:a,isAllProjects:s,onClick:o,touch:i}=e;return(0,r.jsxs)("button",{type:"button",onClick:o,className:(0,u.cn)("flex items-center gap-2.5 px-3 py-2 rounded-lg w-full text-left","text-sm transition-all duration-150",i&&"min-h-[44px]",a?"bg-purple-500/10 text-foreground font-medium":"text-foreground/80 hover:text-foreground hover:bg-muted/60"),"aria-pressed":a,children:[s?(0,r.jsx)(n.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}):(0,r.jsx)("span",{className:(0,u.cn)("h-2.5 w-2.5 rounded-full flex-shrink-0 mx-[3px]",N(null==t?void 0:t.color)),"aria-hidden":!0}),(0,r.jsx)("span",{className:"flex-1 truncate",children:s?"All Projects":null==t?void 0:t.name}),a&&(0,r.jsx)(l.A,{className:"h-4 w-4 text-purple-500 flex-shrink-0"})]})}function C(e){let{onAfterSelect:t,onNewProject:a,onManageProjects:n,touch:l}=e,{projects:c,activeProjectId:d,defaultProject:m,setActiveProject:p,isLoading:x}=(0,b.Y)(),h=(0,s.useMemo)(()=>c.filter(e=>!e.is_default),[c]),g=(0,s.useCallback)(e=>{p(e),null==t||t()},[p,t]);return x&&0===c.length?(0,r.jsx)("div",{className:"px-3 py-2 text-sm text-muted-foreground/60",children:"Loading projectsâ¦"}):(0,r.jsxs)("div",{role:"group","aria-label":"Switch project",children:[m&&(0,r.jsx)(w,{isAllProjects:!0,isActive:d===m.id,onClick:()=>g(m.id),touch:l}),h.map(e=>(0,r.jsx)(w,{project:e,isActive:d===e.id,onClick:()=>g(e.id),touch:l},e.id)),(0,r.jsx)("div",{className:"border-t border-border/30 my-1"}),(0,r.jsxs)("button",{type:"button",onClick:()=>{null==t||t(),a()},className:(0,u.cn)("flex items-center gap-2.5 px-3 py-2 rounded-lg w-full text-left","text-sm text-foreground/80 hover:text-foreground hover:bg-muted/60","transition-all duration-150",l&&"min-h-[44px]"),children:[(0,r.jsx)(o.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1 font-medium",children:"New projectâ¦"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{null==t||t(),n()},className:(0,u.cn)("flex items-center gap-2.5 px-3 py-2 rounded-lg w-full text-left","text-sm text-foreground/80 hover:text-foreground hover:bg-muted/60","transition-all duration-150",l&&"min-h-[44px]"),children:[(0,r.jsx)(i.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1 font-medium",children:"Manage projectsâ¦"})]})]})}function S(e){let{className:t}=e,{activeProject:a,isDefaultProject:s}=(0,b.Y)(),l=s||!a;return(0,r.jsxs)("span",{className:(0,u.cn)("flex items-center gap-2.5 min-w-0",t),children:[l?(0,r.jsx)(n.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}):(0,r.jsx)("span",{className:(0,u.cn)("h-2.5 w-2.5 rounded-full flex-shrink-0 mx-[3px]",N(a.color)),"aria-hidden":!0}),(0,r.jsxs)("span",{className:"flex flex-col min-w-0 text-left",children:[(0,r.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/60 leading-tight",children:"Project"}),(0,r.jsx)("span",{className:"text-sm font-medium text-foreground truncate leading-tight",children:l?"All Projects":a.name})]})]})}function A(e){let{onClose:t,onNewProject:a,onManageProjects:c}=e,{projects:d,activeProjectId:p,defaultProject:x,setActiveProject:h}=(0,b.Y)(),g=(0,s.useMemo)(()=>d.filter(e=>!e.is_default),[d]),f=(0,s.useCallback)(e=>{h(e),t()},[h,t]);return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(m.lv,{children:[(0,r.jsx)(m.nV,{className:(0,u.cn)("cursor-pointer flex items-center gap-2.5 px-3 py-2 mx-1.5 rounded-lg","text-sm hover:bg-muted/60 data-[state=open]:bg-muted/60","transition-all duration-150"),children:(0,r.jsx)(S,{className:"flex-1"})}),(0,r.jsx)(m.dc,{children:(0,r.jsxs)(m.M5,{className:(0,u.cn)("w-[220px] max-h-[min(300px,60vh)] overflow-y-auto p-1.5","bg-background/95 backdrop-blur-xl","border border-border/50 shadow-xl shadow-black/20 rounded-xl"),sideOffset:6,children:[x&&(0,r.jsxs)(m._2,{onClick:()=>f(x.id),className:(0,u.cn)("cursor-pointer flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm",p===x.id&&"bg-purple-500/10 font-medium"),children:[(0,r.jsx)(n.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 truncate",children:"All Projects"}),p===x.id&&(0,r.jsx)(l.A,{className:"h-4 w-4 text-purple-500 flex-shrink-0"})]}),g.map(e=>(0,r.jsxs)(m._2,{onClick:()=>f(e.id),className:(0,u.cn)("cursor-pointer flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm",p===e.id&&"bg-purple-500/10 font-medium"),children:[(0,r.jsx)("span",{className:(0,u.cn)("h-2.5 w-2.5 rounded-full flex-shrink-0 mx-[3px]",N(e.color)),"aria-hidden":!0}),(0,r.jsx)("span",{className:"flex-1 truncate",children:e.name}),p===e.id&&(0,r.jsx)(l.A,{className:"h-4 w-4 text-purple-500 flex-shrink-0"})]},e.id)),(0,r.jsx)(m.mB,{className:"bg-border/30"}),(0,r.jsxs)(m._2,{onClick:()=>{t(),a()},className:"cursor-pointer flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm",children:[(0,r.jsx)(o.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1 font-medium",children:"New projectâ¦"})]}),(0,r.jsxs)(m._2,{onClick:()=>{t(),c()},className:"cursor-pointer flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm",children:[(0,r.jsx)(i.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"flex-1 font-medium",children:"Manage projectsâ¦"})]})]})})]})})}function E(e){let{onNewProject:t,onManageProjects:a}
1=e,[n,l]=(0,s.useState)(!1);return(0,r.jsxs)("div",{className:"px-2 py-1.5",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>l(e=>!e),className:(0,u.cn)("flex items-center gap-2.5 px-3 py-2 rounded-lg w-full min-h-[44px]","text-sm hover:bg-muted/60 transition-all duration-150"),"aria-expanded":n,children:[(0,r.jsx)(S,{className:"flex-1"}),(0,r.jsx)(c.A,{className:(0,u.cn)("h-4 w-4 text-muted-foreground transition-transform duration-200",n&&"rotate-180")})]}),n&&(0,r.jsx)("div",{className:"mt-1 ml-2 pl-2 border-l border-border/30",children:(0,r.jsx)(C,{touch:!0,onAfterSelect:()=>l(!1),onNewProject:t,onManageProjects:a})})]})}function P(e){let{className:t,iconOnly:a}=e,{activeProject:l,isDefaultProject:o,isLoading:i}=(0,b.Y)(),[m,x]=(0,s.useState)(!1),[h,g]=(0,s.useState)(!1),[v,y]=(0,s.useState)(!1);if(i&&!l)return null;let w=!o&&!!l,S=a?(0,r.jsxs)("button",{type:"button",className:(0,u.cn)("relative inline-flex h-7 w-7 items-center justify-center rounded-lg flex-shrink-0","transition-colors",w?"text-purple-500 bg-purple-500/10 hover:bg-purple-500/20":"text-muted-foreground hover:text-foreground hover:bg-muted/60",t),"aria-label":w?"Project scope: ".concat(l.name):"Project scope: All Projects",children:[(0,r.jsx)(d.A,{className:"h-4 w-4","aria-hidden":!0}),w&&(0,r.jsx)("span",{className:(0,u.cn)("absolute top-0.5 right-0.5 h-2 w-2 rounded-full ring-[1.5px] ring-background",N(l.color)),"aria-hidden":!0})]}):(0,r.jsxs)("button",{type:"button",className:(0,u.cn)("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium","transition-colors max-w-[160px]",w?"border border-purple-200/50 dark:border-purple-800/50 bg-purple-50/80 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 hover:bg-purple-100/80 dark:hover:bg-purple-900/40":"border border-border/40 bg-muted/40 text-muted-foreground hover:bg-muted/70",t),"aria-label":"Switch project",children:[w?(0,r.jsx)("span",{className:(0,u.cn)("h-2 w-2 rounded-full flex-shrink-0",N(l.color)),"aria-hidden":!0}):(0,r.jsx)(n.A,{className:"h-3 w-3 flex-shrink-0","aria-hidden":!0}),(0,r.jsx)(d.A,{className:"h-3 w-3 flex-shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"truncate",children:w?l.name:"All Projects"}),(0,r.jsx)(c.A,{className:"h-3 w-3 flex-shrink-0 opacity-60","aria-hidden":!0})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p.AM,{open:m,onOpenChange:x,children:[(0,r.jsxs)(f.m_,{children:[(0,r.jsx)(f.k$,{asChild:!0,children:(0,r.jsx)(p.Wv,{asChild:!0,children:S})}),(0,r.jsx)(f.ZI,{side:"bottom",className:"max-w-[240px] text-xs",children:w?"Showing items in â".concat(l.name,"â plus items visible in all projects. New items are created in this project. Click to switch."):"Showing items from all projects. Click to switch to a specific project."})]}),(0,r.jsx)(p.hl,{align:"start",sideOffset:6,className:(0,u.cn)("w-[220px] max-h-[min(300px,60vh)] overflow-y-auto p-1.5","bg-background/95 backdrop-blur-xl","border border-border/50 shadow-xl shadow-black/20 rounded-xl"),children:(0,r.jsx)(C,{onAfterSelect:()=>x(!1),onNewProject:()=>g(!0),onManageProjects:()=>y(!0)})})]}),(0,r.jsx)(k,{open:h,onOpenChange:g}),(0,r.jsx)(j.i,{open:v,onOpenChange:y})]})}},90800:(e,t,a)=>{a.d(t,{Q:()=>s,z:()=>r});
1let r={contact:"[email protected]",support:"[email protected]",billing:"[email protected]",security:"[email protected]",legal:"[email protected]",privacy:"[email protected]",investors:"[email protected]",founder:"[email protected]",notifications:"[email protected]",noreply:"[email protected]"};function s(e,t,a){let s=[];t&&s.push("subject=".concat(encodeURIComponent(t))),a&&s.push("body=".concat(encodeURIComponent(a)));let n=s.length>0?"?".concat(s.join("&")):"";return"mailto:".concat(r[e]).concat(n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.