(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,60293,e=>{"use strict";var t=e.i(816709),a=e.i(566531);let i=(0,t.create)((e,t)=>({favorites:[],loadedWorkspaceId:null,pendingFavorite:null,load:async i=>{let{loadedWorkspaceId:s}=t();if(s!==i)try{let t=await a.sdk.codeFavorites.list(i);e({favorites:t,loadedWorkspaceId:i})}catch{e({favorites:[],loadedWorkspaceId:i})}},addFavorite:async i=>{let{loadedWorkspaceId:s}=t();if(s)try{let t=await a.sdk.codeFavorites.create(s,i);e(e=>({favorites:[t,...e.favorites]}))}catch{}},removeFavorite:async i=>{let{loadedWorkspaceId:s}=t();if(s)try{await a.sdk.codeFavorites.delete_(s,i),e(e=>({favorites:e.favorites.filter(e=>e.id!==i)}))}catch{}},clearFavorites:async t=>{try{await a.sdk.http.delete(`/api/workspaces/${t}/code-favorites`),e({favorites:[],loadedWorkspaceId:t})}catch{}},setPendingFavorite:t=>e({pendingFavorite:t})}));e.s(["useCodeFavoritesStore",0,i])},238456,e=>{"use strict";var t=e.i(738776),a=e.i(482560),i=e.i(60293),s=e.i(209988),o=e.i(260218),l=e.i(681622);function r({fav:e}){let a=e.path.split("/").pop()||e.path,i=e.endLine>e.line?`${e.line}-${e.endLine}`:`${e.line}`;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"text-sm text-muted-foreground space-y-0.5",children:[(0,t.jsx)("div",{className:"font-medium text-foreground",children:a}),(0,t.jsxs)("div",{children:[e.path,":",i]})]}),e.snippet&&(0,t.jsx)("pre",{className:"text-xs text-muted-foreground bg-muted/50 rounded-md px-3 py-2 font-mono max-h-48 overflow-auto whitespace-pre break-all",children:e.snippet})]})}e.s(["AddFavoriteDialog",0,function(){let{pendingFavorite:e,setPendingFavorite:n,addFavorite:d}=(0,i.useCodeFavoritesStore)(),[c,u]=(0,a.useState)("");if((0,a.useEffect)(()=>{e&&u("")},[e]),!e)return null;let p=()=>{d({...e,label:c.trim()||e.label}),n(null)};return(0,t.jsx)(s.Dialog,{open:!0,onOpenChange:e=>{e||n(null)},children:(0,t.jsxs)(s.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsx)(s.DialogHeader,{children:(0,t.jsx)(s.DialogTitle,{children:"添加代码收藏"})}),(0,t.jsx)(r,{fav:e}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(l.Input,{placeholder:"标题（可选）",value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&p()},autoFocus:!0})}),(0,t.jsxs)(s.DialogFooter,{children:[(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>n(null),children:"取消"}),(0,t.jsx)(o.Button,{onClick:p,children:"收藏"})]})]})})}])},722705,e=>{e.n(e.i(238456))}]);