1import{r as o,j as e,D as Z,l as ee,m as j,o as f,bF as se,p as g,v,A as b,a0 as te,a1 as ae,bN as S,L as re,cm as ne,ar as oe,aC as B,aG as U,aH as K,aI as O,aJ as Y,aK as q,ac as H,aj as ie,f as le,i as J,I as ce,cQ as de,k as P,$ as ue}from"./index-Rw18IswJ.js";const z="https://vuakkixyfmtrrfrsdysn.supabase.co/functions/v1/mcp-proxy",i=({children:d,variant:h="default",size:E="default",onClick:m,disabled:u,className:w})=>{const c=()=>{u||ue.flushSync(()=>{m()})},a=r=>{r.preventDefault(),r.stopPropagation(),c()},l=r=>{r.preventDefault(),r.stopPropagation()};return e.jsx("div",{tabIndex:u?-1:0,"aria-disabled":u,"aria-label":"navigation","data-cowork-nav-button":"true","data-notestream-ignore":"true",className:ce(de({variant:h,size:E}),u&&"pointer-events-none opacity-50","cursor-pointer select-none",w),onPointerDown:a,onPointerUp:l,onMouseDown:l,onMouseUp:l,onClick:l,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&a(r)},children:d})},he=({open:d,onOpenChange:h,onComplete:E,userId:m})=>{const u=o.useRef(null),w=o.useRef(0),[c,a]=o.useState(1),[l,r]=o.useState("Assigned to AI"),[C,A]=o.useState("Complete"),[G,M]=o.useState(!1),[T,F]=o.useState(!1),[p,W]=o.useState([]),[_,I]=o.useState(!1),[L,y]=o.useState("idle");o.useEffect(()=>{if(!d||!m)return;(async()=>{const{data:x}=await J.from("custom_statuses").select("id, label, color, status_type").eq("user_id",m).is("thread_id",null).order("sort_order",{ascending:!0});x&&W(x)})()},[d,m]),o.useEffect(()=>{if(!d)return;const s=t=>{var V;if(!(t instanceof Element))return!1;const R=t.closest('[data-cowork-nav-button="true"]');return!!(R&&((V=u.current)!=null&&V.contains(R)))},x=t=>s(t)?!0:performance.now()<w.current,N=t=>{s(t.target)&&(w.current=performance.now()+500)},n=t=>{x(t.target)&&(t.preventDefault(),t.stopImmediatePropagation())},k=t=>{t instanceof KeyboardEvent&&(t.key!=="Enter"&&t.key!==" "||x(t.target)&&(t.preventDefault(),t.stopImmediatePropagation()))};return window.addEventListener("pointerdown",N,!0),document.addEventListener("pointerdown",N,!0),window.addEventListener("mousedown",n,!0),document.addEventListener("mousedown",n,!0),window.addEventListener("mouseup",n,!0),document.addEventListener("mouseup",n,!0),window.addEventListener("click",n,!0),document.addEventListener("click",n,!0),window.addEventListener("keydown",k,!0),document.addEventListener("keydown",k,!0),()=>{window.removeEventListener("pointerdown",N,!0),document.removeEventListener("pointerdown",N,!0),window.removeEventListener("mousedown",n,!0),document.removeEventListener("mousedown",n,!0),window.removeEventListener("mouseup",n,!0),document.removeEventListener("mouseup",n,!0),window.removeEventListener("click",n,!0),document.removeEventListener("click",n,!0),window.removeEventListener("keydown",k,!0),document.removeEventListener("keydown",k,!0)}},[d]);const D=JSON.stringify({mcpServers:{notestream:{url:z,headers:{Authorization:"Bearer <your-mcp-proxy-secret>","Content-Type":"application/json"}}}},null,2),$=async()=>{try{await navigator.clipboard.writeText(D)}catch{const s=document.createElement("textarea");s.value=D,document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}M(!0),P.success("MCP config copied to clipboard"),setTimeout(()=>M(!1),2e3)},Q=async()=>{I(!0),y("idle");try{(await fetch(z,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify({jsonrpc:"2.0",method:"tools/list",id:1})})).ok?y("success"):y("error")}catch{y("error")}finally{I(!1)}},X=async()=>{F(!0);try{const{error:s}=await J.from("profiles").update({cowork_setup_complete:!0,cowork_assigned_status:l.trim()||"Assigned to AI",cowork_completed_status:C.trim()||"Complete"}).eq("id",m);if(s)throw s;P.success("Cowork setup complete!"),E(),h(!1),a(1)}catch{P.error("Failed to save settings")}finally{F(!1)}};return e.jsx(Z,{open:d,onOpenChange:h,children:e.jsxs(ee,{ref:u,className:"max-w-lg max-h-[85vh] overflow-y-auto",hideClose:!0,children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:[1,2,3,4,5].map(s=>e.jsx("div",{className:`h-1.5 flex-1 rounded-full transition-colors ${s<=c?"bg-primary":"bg-muted"}`},s))}),c===1&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-5 w-5 text-primary"}),"Set Up Claude Cowork"]}),e.jsx(g,{children:"Claude Cowork uses a pull-based MCP model â Claude connects to NoteStream and picks up assigned tasks automatically. No browser extension needed."})]}),e.jsx("div",{className:"py-4 space-y-3",children:e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-4 space-y-2 text-sm",children:[e.jsx("p",{className:"font-medium",children:"How it works:"}),e.jsxs("ol",{className:"list-decimal pl-4 space-y-1.5 text-muted-foreground",children:[e.jsx("li",{children:"You assign a task to Claude Cowork in NoteStream"}),e.jsx("li",{children:"Claude pulls the task via the MCP server connection"}),e.jsx("li",{children:"Claude works on it and writes results back"}),e.jsx("li",{children:"You review the completed work in NoteStream"})]})]})}),e.jsxs(v,{children:[e.jsx(i,{variant:"ghost",onClick:()=>h(!1),children:"Cancel"}),e.jsxs(i,{onClick:()=>a(2),children:["Get Started",e.jsx(b,{className:"ml-1 h-4 w-4"})]})]})]}),c===2&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Connect MCP Server"}),e.jsx(g,{children:"Follow these steps to connect Claude to NoteStream."})]}),e.jsxs("div",{className:"py-3 space-y-3 text-sm",children:[e.jsxs("ol",{className:"list-decimal pl-4 space-y-2 text-muted-foreground",children:[e.jsxs("li",{children:["Open ",e.jsx("span",{className:"font-medium text-foreground",children:"Claude Desktop"})," â Settings â Developer, or go to ",e.jsx("span",{className:"font-medium text-foreground",children:"claude.ai"})," â Settings â MCP Servers (or Integrations)"]}),e.jsxs("li",{children:["Click ",e.jsx("span",{className:"font-medium text-foreground",children:'"Add MCP Server"'}),' (or "Edit Config" in Claude Desktop)']}),e.jsx("li",{children:"Copy and paste this configuration:"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md border border-border bg-muted/50 p-3 text-xs font-mono overflow-x-auto whitespace-pre-wrap break-all max-h-[150px] overflow-y-auto",children:D}),e.jsx(i,{variant:"secondary",size:"sm",className:"absolute top-2 right-2",onClick:$,children:G?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"mr-1 h-3 w-3"})," Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"mr-1 h-3 w-3"})," Copy"]})})]}),e.jsxs("ol",{className:"list-decimal pl-4 space-y-2 text-muted-foreground",start:4,children:[e.jsxs("li",{children:["Replace ",e.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:"<your-mcp-proxy-secret>"})," with your MCP proxy key from Settings"]}),e.jsx("li",{children:"Save and restart Claude â NoteStream will appear as a connected tool"})]})]}),e.jsxs(v,{children:[e.jsxs(i,{variant:"ghost",onClick:()=>a(1),children:[e.jsx(S,{className:"mr-1 h-4 w-4"}),"Back"]}),e.jsxs(i,{onClick:()=>a(3),children:["Next",e.jsx(b,{className:"ml-1 h-4 w-4"})]})]})]}),c===3&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Verify Connection"}),e.jsx(g,{children:"Check that the MCP server endpoint is reachable before continuing."})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-4 space-y-3 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:"Click the button below to send a test request to the NoteStream MCP endpoint. This confirms the server is online and responding."}),e.jsx(i,{onClick:Q,disabled:_,className:"w-full justify-center",children:_?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"mr-2 h-4 w-4 animate-spin"})," Verifyingâ¦"]}):"Test Connection"}),L==="success"&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(ne,{className:"h-4 w-4"}),"MCP server is reachable and responding."]}),L==="error"&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[e.jsx(oe,{className:"h-4 w-4"}),"Could not reach the MCP server. Double-check the configuration and try again."]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This only verifies the endpoint is online â Claude still needs the config from the previous step to connect."})]}),e.jsxs(v,{children:[e.jsxs(i,{variant:"ghost",onClick:()=>a(2),children:[e.jsx(S,{className:"mr-1 h-4 w-4"}),"Back"]}),e.jsxs(i,{onClick:()=>a(4),children:[L==="success"?"Next":"Skip",e.jsx(b,{className:"ml-1 h-4 w-4"})]})]})]}),c===4&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Configure Status Transitions"}),e.jsx(g,{children:"Choose what status tasks should be set to when assigned and when completed by Cowork."})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:"When assigned to Cowork"}),p.length>0?e.jsxs(U,{value:l,onValueChange:r,children:[e.jsx(K,{children:e.jsx(O,{placeholder:"Select a status"})}),e.jsx(Y,{children:p.map(s=>e.jsx(q,{value:s.label,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:s.color}}),s.label]})},s.id))})]}
1):e.jsx(H,{value:l,onChange:s=>r(s.target.value),placeholder:"e.g. Assigned to AI"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The status label applied when a task is sent to Claude Cowork."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{children:"When completed by Cowork"}),p.length>0?e.jsxs(U,{value:C,onValueChange:A,children:[e.jsx(K,{children:e.jsx(O,{placeholder:"Select a status"})}),e.jsx(Y,{children:p.map(s=>e.jsx(q,{value:s.label,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:s.color}}),s.label]})},s.id))})]}):e.jsx(H,{value:C,onChange:s=>A(s.target.value),placeholder:"e.g. Complete"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The status label applied when Claude finishes the task."})]}),p.length===0&&e.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["No custom statuses found. You can type a label above, or"," ",e.jsxs("a",{href:"/settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground inline-flex items-center gap-0.5",children:["create custom statuses in Settings",e.jsx(ie,{className:"h-3 w-3"})]}),"."]})]}),e.jsxs(v,{children:[e.jsxs(i,{variant:"ghost",onClick:()=>a(3),children:[e.jsx(S,{className:"mr-1 h-4 w-4"}),"Back"]}),e.jsxs(i,{onClick:()=>a(5),children:["Next",e.jsx(b,{className:"ml-1 h-4 w-4"})]})]})]}),c===5&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5 text-primary"}),"You're All Set!"]}),e.jsx(g,{children:"Claude Cowork is ready to use. Tasks you assign will be available for Claude to pick up via MCP."})]}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Assigned status:"}),e.jsx("span",{className:"font-medium",children:l||"Assigned to AI"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Completed status:"}),e.jsx("span",{className:"font-medium",children:C||"Complete"})]})]})}),e.jsxs(v,{children:[e.jsxs(i,{variant:"ghost",onClick:()=>a(4),children:[e.jsx(S,{className:"mr-1 h-4 w-4"}),"Back"]}),e.jsx(i,{onClick:X,disabled:T,children:T?"Saving...":"Complete Setup"})]})]})]})})};export{he as CoworkOnboardingDialog};
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.