PageSourceSearch

https://arg.ai/_next/static/immutable/chunks/0pk8i_bgjte8e.js

js arg.ai collected 2026-10-05 11:50:02 UTC 109,856 bytes, 4 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0ef58-6770-7cd1-ab20-eeebff69682d")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,219123,e=>{"use strict";var t=e.i(9384);e.i(66563);var s=e.i(868088),n=e.i(92726),i=e.i(539919),a=e.i(200510),l=e.i(407311),r=e.i(453782),o=e.i(645333),c=e.i(507196),d=e.i(346722),u=e.i(53593),m=e.i(444293),x=e.i(10641),h=e.i(120747),p=e.i(376340),f=e.i(57976);e.i(948557);var b=e.i(500081);e.i(114139);var j=e.i(358939);e.i(645559);var v=e.i(684847);e.i(804129);var g=e.i(839389),y=e.i(705333),w=e.i(142243),k=e.i(731974),N=e.i(283124),C=e.i(136431),E=e.i(434574),S=e.i(470495),A=e.i(468238);e.i(492030);var I=e.i(652441),z=e.i(107043),T=e.i(451469),R=e.i(741366),F=e.i(943015),L=e.i(456745),M=e.i(279090),P=e.i(780707),_=e.i(655153),D=e.i(788190),$=e.i(909148),U=e.i(737930),V=e.i(583037),B=e.i(931073),G=e.i(571121),O=e.i(893302),H=e.i(975239),W=e.i(306973),K=e.i(955549),q=e.i(582256),Y=e.i(48549),J=e.i(607791),X=e.i(4633),Z=e.i(719820),Q=e.i(553358),ee=e.i(888739),et=e.i(529707),es=e.i(800418),en=e.i(343408),ei=e.i(18148),ea=e.i(265332),el=e.i(597511),er=e.i(504808),eo=e.i(702738),ec=e.i(596569),ed=e.i(189527),eu=e.i(800121),em=e.i(234968),ex=e.i(613622),eh=e.i(888384),ep=e.i(104167),ef=e.i(98466),eb=e.i(566307),ej=e.i(776795),ev=e.i(532844),eg=e.i(545426),ey=e.i(930880),ew=e.i(453042),ek=e.i(41714),eN=e.i(150095);e.i(914787);var eC=e.i(307251);function eE({workspaceId:e,filePath:s,token:n,onRestore:a,onClose:l}){let{t:o}=(0,q.useLocale)(),[c,d]=(0,i.useState)([]),[u,m]=(0,i.useState)(!1),[x,h]=(0,i.useState)(!1),[p,f]=(0,i.useState)(null),[b,j]=(0,i.useState)(!1),[v,g]=(0,i.useState)(null),[y,w]=(0,i.useState)(null),[k,N]=(0,i.useState)(!1),[C,E]=(0,i.useState)(null),S=(0,i.useCallback)(async(t=0,i=!1)=>{i?h(!0):m(!0),f(null);try{let a=s.startsWith("/")?s.slice(1):s,l=await (0,eN.apiFetch)(`/api/workspaces/${e}/files/versions?path=${encodeURIComponent(a)}&limit=50&offset=${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!l.ok){let e=await l.json().catch(()=>({}));throw Error(e.detail||"Failed to fetch versions")}let r=await l.json();d(e=>i?[...e,...r.versions]:r.versions),j(r.has_more)}catch(e){f((0,r.getErrorMessage)(e,"Failed to fetch version history"))}finally{m(!1),h(!1)}},[e,s,n]),A=(0,i.useCallback)(async(t,i)=>{N(!0),w(null);try{let a=s.startsWith("/")?s.slice(1):s,l=i?`/api/workspaces/${e}/files/content?path=${encodeURIComponent(a)}`:`/api/workspaces/${e}/files/versions/${t}/content`,r=await (0,eN.apiFetch)(l,{headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw Error("Failed to fetch version content");let o=await r.json();w(o)}catch{w(null)}finally{N(!1)}},[e,s,n]),I=(0,i.useCallback)(async t=>{E(t);try{let s=await (0,eN.apiFetch)(`/api/workspaces/${e}/files/versions/${t}/restore`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json().catch(()=>({}));if("file_protected"===e.code)throw Error("Editing locked - unlock this file to restore a version");throw Error(e.detail||"Failed to restore version")}a?.(),l()}catch(e){f((0,r.getErrorMessage)(e,"Failed to restore version"))}finally{E(null)}},[e,n,a,l]);(0,i.useEffect)(()=>{S()},[S]),(0,i.useEffect)(()=>{if(v){let e=c.find(e=>e.version_id===v);A(v,e?.is_current)}},[v,A,c]),(0,i.useEffect)(()=>{g(null),w(null)},[e,s]);let z=c.find(e=>e.version_id===v);return(0,t.jsxs)(eC.EditorRightPanel,{children:[(0,t.jsxs)("div",{className:(0,r.cn)("flex items-center justify-between border-b px-3 py-2",et.border.default()),children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[v&&(0,t.jsx)("button",{type:"button",onClick:()=>{g(null),w(null)},className:(0,r.cn)("rounded px-1.5 py-0.5 text-xs transition-colors",et.text.muted(),et.hover.bgSubtle(),et.hover.textPrimary()),children:"←"}),(0,t.jsx)("span",{className:(0,r.cn)("truncate text-sm font-medium",et.text.primary()),children:o.workspace.versionHistory})]}),(0,t.jsx)("button",{type:"button",onClick:l,className:(0,r.cn)("rounded p-1 transition-colors",et.text.muted(),et.hover.bgSubtle(),et.hover.textPrimary()),children:(0,t.jsx)(ey.CloseIcon,{size:14})})]}),v?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:(0,r.cn)("shrink-0 border-b px-3 py-2",et.border.default()),children:[z&&(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)(ek.Avatar,{name:z.actor_email?.split("@")[0],email:z.actor_email||void 0,avatarUrl:z.actor_avatar_url||void 0,size:"sm"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:(0,r.cn)("truncate text-xs font-medium",et.text.primary()),children:z.actor_email?.split("@")[0]||"Unknown"}),(0,t.jsxs)("div",{className:(0,r.cn)("mt-0.5 text-[11px]",et.text.dimmed()),children:[(0,t.jsx)("span",{title:new Date(z.created_at).toLocaleStr
1ing(),children:(0,r.formatRelativeTime)(z.created_at)})," · ",(0,r.formatBytes)(z.file_size_bytes)]})]})]}),z&&!z.is_current&&(0,t.jsx)("button",{type:"button",onClick:()=>v&&I(v),disabled:null!==C,className:(0,r.cn)("mt-2 w-full rounded-lg px-3 py-1.5 text-xs font-medium transition-colors",et.bg.inverted(),et.text.inverted(),et.hover.bgInverted(),"disabled:opacity-50"),children:C===v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eg.SpinnerIcon,{size:12,className:"mr-1 inline animate-spin"}),o.workspace.restoring]}):o.workspace.restoreThisVersion})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[k&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(eg.SpinnerIcon,{size:18,className:(0,r.cn)("animate-spin",et.text.muted())})}),!k&&y&&"utf-8"===y.encoding&&(0,t.jsx)("pre",{className:(0,r.cn)("p-3 font-mono text-[11px] break-words whitespace-pre-wrap",et.text.secondary()),children:y.content}),!k&&y&&"utf-8"!==y.encoding&&z?.content_type?.startsWith("image/")&&(0,t.jsx)("div",{className:"flex items-center justify-center p-3",children:(0,t.jsx)("img",{src:`data:${y.mime_type};base64,${y.content}`,alt:"Version preview",className:"max-h-[400px] max-w-full rounded object-contain"})}),!k&&y&&"utf-8"!==y.encoding&&!z?.content_type?.startsWith("image/")&&(0,t.jsxs)("div",{className:(0,r.cn)("p-4 text-center text-xs",et.text.muted()),children:["Binary file (",(0,r.formatBytes)(y.size),")"]}),!k&&!y&&(0,t.jsx)("div",{className:(0,r.cn)("p-4 text-center text-xs",et.text.muted()),children:o.workspace.couldNotLoadPreview})]})]}):(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[u&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(eg.SpinnerIcon,{size:18,className:(0,r.cn)("animate-spin",et.text.muted())})}),p&&!u&&(0,t.jsx)("div",{className:(0,r.cn)("px-3 py-4 text-center text-xs","text-red-600 dark:text-red-400"),children:p}),!u&&!p&&0===c.length&&(0,t.jsxs)("div",{className:(0,r.cn)("p-6 text-center",et.text.muted()),children:[(0,t.jsx)(ew.HistoryIcon,{size:24,className:"mx-auto mb-2 opacity-40"}),(0,t.jsx)("p",{className:"text-xs",children:o.workspace.noVersionHistory})]}),!u&&c.length>0&&(0,t.jsxs)("div",{className:"py-1",children:[c.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>g(e.version_id),className:(0,r.cn)("flex w-full items-start gap-2.5 px-3 py-2 text-left transition-colors",et.hover.bgSubtle()),children:[(0,t.jsx)(ek.Avatar,{name:e.actor_email?.split("@")[0],email:e.actor_email||void 0,avatarUrl:e.actor_avatar_url||void 0,size:"sm"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:(0,r.cn)("truncate text-xs font-medium",et.text.primary()),children:e.actor_email?.split("@")[0]||"Unknown"}),e.is_current?(0,t.jsx)("span",{className:(0,r.cn)("inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-medium","bg-emerald-100 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-300"),children:"Current"}):e.source?(0,t.jsx)(ev.SourcePill,{source:e.source,className:"shrink-0"}):null]}),e.source&&(0,t.jsx)(ev.SourcePillSubline,{source:e.source}),(0,t.jsxs)("div",{className:(0,r.cn)("mt-0.5 flex items-center gap-1.5 text-[11px]",et.text.dimmed()),children:[(0,t.jsx)("span",{title:new Date(e.created_at).toLocaleString(),children:(0,r.formatRelativeTime)(e.created_at)}),(0,t.jsx)("span",{children:"·"}),(0,t.jsx)("span",{children:(0,r.formatBytes)(e.file_size_bytes)})]})]})]},e.id)),b&&(0,t.jsx)("div",{className:"py-2 text-center",children:(0,t.jsxs)("button",{type:"button",onClick:()=>S(c.filter(e=>!e.is_current).length,!0),disabled:x,className:(0,r.cn)("rounded-lg px-3 py-1.5 text-xs transition-colors",et.text.secondary(),et.hover.bg(),"disabled:opacity-40"),children:[x?(0,t.jsx)(eg.SpinnerIcon,{size:14,className:"mr-1 inline animate-spin"}):null,x?o.common.loading:o.workspace.loadMore]})})]})]})]})}var eS=e.i(2834),eA=e.i(890294),eI=e.i(60169);let ez=(0,n.default)(()=>e.A(749523).then(e=>
1e.AgentSkillEditor),{loadableGenerated:{modules:[495389]},ssr:!1}),eT=(0,n.default)(()=>e.A(459450).then(e=>e.AudioPlayer),{loadableGenerated:{modules:[766666]},ssr:!1}),eR=(0,n.default)(()=>e.A(858567).then(e=>e.AutomationEditor),{loadableGenerated:{modules:[875053]},ssr:!1}),eF=(0,n.default)(()=>e.A(932292).then(e=>e.WorkflowYamlEditor),{loadableGenerated:{modules:[155424]},ssr:!1}),eL=(0,n.default)(()=>e.A(741970).then(e=>e.DiaryEditor),{loadableGenerated:{modules:[903291]},ssr:!1}),eM=(0,n.default)(()=>e.A(260035).then(e=>e.ImageViewer),{loadableGenerated:{modules:[311545]},ssr:!1}),eP=(0,n.default)(()=>e.A(159966).then(e=>e.GifViewer),{loadableGenerated:{modules:[179334]},ssr:!1}),e_=(0,n.default)(()=>e.A(906540).then(e=>e.HeicViewer),{loadableGenerated:{modules:[65361]},ssr:!1}),eD=(0,n.default)(()=>e.A(778829).then(e=>e.KanbanEditor),{loadableGenerated:{modules:[112419]},ssr:!1}),e$=(0,n.default)(()=>e.A(455083).then(e=>e.LargeImageViewer),{loadableGenerated:{modules:[760635]},ssr:!1}),eU=(0,n.default)(()=>e.A(698013).then(e=>e.MermaidEditor),{loadableGenerated:{modules:[433687]},ssr:!1}),eV=(0,n.default)(()=>e.A(229644).then(e=>e.PdfEditor),{loadableGenerated:{modules:[34967]},ssr:!1}),eB=(0,n.default)(()=>e.A(274967).then(e=>e.SiteEditor),{loadableGenerated:{modules:[683165]},ssr:!1}),eG=(0,n.default)(()=>e.A(991653).then(e=>e.TableEditor),{loadableGenerated:{modules:[282349]},ssr:!1}),eO=(0,n.default)(()=>e.A(85374).then(e=>e.VideoViewer),{loadableGenerated:{modules:[603058]},ssr:!1}),eH=(0,n.default)(()=>e.A(919905).then(e=>e.ViewFileViewer),{loadableGenerated:{modules:[750931]},ssr:!1}),eW=(0,i.lazy)(()=>e.A(182908).then(e=>({default:e.FileViewsLayer})));function eK(){return(0,t.jsx)("div",{className:(0,r.cn)("flex h-full w-full items-center justify-center",et.bg.primary()),children:(0,t.jsx)("div",{className:(0,r.cn)("h-6 w-6 animate-spin rounded-full border-2 border-t-transparent",et.border.default())})})}function eq({children:e}){let[s,n]=(0,i.useState)(!1);return(0,t.jsx)("div",{className:"absolute inset-x-0 top-0 z-[60] h-3",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:(0,t.jsx)("div",{className:(0,r.cn)("absolute inset-x-0 top-0 shadow-lg transition-transform duration-200",s?"translate-y-0":"-translate-y-full"),children:e})})}let eY=(0,n.default)(()=>e.A(249009).then(e=>e.WhiteboardEditor),{loadableGenerated:{modules:[974211]},ssr:!1}),eJ=(0,n.default)(()=>e.A(568530).then(e=>e.ExcalidrawEditor),{loadableGenerated:{modules:[63527]},ssr:!1}),eX=(0,n.default)(()=>e.A(586293).then(e=>e.ThreeDViewer),{loadableGenerated:{modules:[838310]},ssr:!1}),eZ=(0,n.default)(()=>e.A(65152).then(e=>e.CadViewer),{loadableGenerated:{modules:[384976]},ssr:!1}),eQ=(0,n.default)(()=>e.A(885609).then(e=>e.CadEditor),{loadableGenerated:{modules:[334625]},ssr:!1}),e0=(0,n.default)(()=>e.A(167120).then(e=>e.ExrViewer),{loadableGenerated:{modules:[901960]},ssr:!1}),e1=(0,n.default)(()=>e.A(85706).then(e=>e.ICalEditor),{loadableGenerated:{modules:[5291]},ssr:!1}),e5=(0,n.default)(()=>e.A(730121).then(e=>e.PptxEditor),{loadableGenerated:{modules:[20153]},ssr:!1}),e2=(0,n.default)(()=>e.A(470497).then(e=>e.DocxEditor),{loadableGenerated:{modules:[634199]},ssr:!1}),e3=(0,n.default)(()=>e.A(919057).then(e=>e.PsdEditor),{loadableGenerated:{modules:[930325]},ssr:!1}),e4=(0,n.default)(()=>e.A(739156).then(e=>e.EpubViewer),{loadableGenerated:{modules:[208390]},ssr:!1}),e8=(0,n.default)(()=>e.A(778670).then(e=>e.MidiEditor),{loadableGenerated:{modules:[148398]},ssr:!1}),e9=(0,n.default)(()=>e.A(418855).then(e=>e.ArchiveViewer),{loadableGenerated:{modules:[820719]},ssr:!1}),e7=(0,n.default)(()=>e.A(41373).then(e=>e.KmlViewer),{loadableGenerated:{modules:[214738]},ssr:!1}),e6=(0,n.default)(()=>e.A(344707).then(e=>e.LinkViewer),{loadableGenerated:{modules:[708632]},ssr:!1}),te=(0,n.default)(()=>e.A(997966).then(e=>e.AppEditor),{loadableGenerated:{modules:[417029]},ssr:!1}),tt=(0,n.default)(()=>e.A(718895).then(e=>e.DesignEditor),{loadableGenerated:{modules:[683433]},ssr:!1}),ts=(0,n.default)(()=>e.A(62182).then(e=>
1e.PgnEditor),{loadableGenerated:{modules:[750567]},ssr:!1}),tn=(0,n.default)(()=>e.A(763780).then(e=>e.SqliteViewer),{loadableGenerated:{modules:[918179]},ssr:!1}),ti=(0,n.default)(()=>e.A(357319).then(e=>e.PlaylistViewer),{loadableGenerated:{modules:[355060]},ssr:!1}),ta=(0,n.default)(()=>e.A(299459).then(e=>e.SubtitleEditor),{loadableGenerated:{modules:[216108]},ssr:!1}),tl=(0,n.default)(()=>e.A(170774).then(e=>e.CastEditor),{loadableGenerated:{modules:[721440]},ssr:!1}),tr=(0,n.default)(()=>e.A(397121).then(e=>e.VCardViewer),{loadableGenerated:{modules:[505586]},ssr:!1}),to=(0,n.default)(()=>e.A(439861).then(e=>e.EmlViewer),{loadableGenerated:{modules:[612227]},ssr:!1}),tc=(0,n.default)(()=>e.A(492353).then(e=>e.DiffViewer),{loadableGenerated:{modules:[758600]},ssr:!1}),td=(0,n.default)(()=>e.A(501278).then(e=>e.FontViewer),{loadableGenerated:{modules:[74484]},ssr:!1}),tu=(0,n.default)(()=>e.A(811545).then(e=>e.NotebookViewer),{loadableGenerated:{modules:[831030]},ssr:!1}),tm=(0,n.default)(()=>e.A(520254).then(e=>e.XlsxEditor),{loadableGenerated:{modules:[740503]},ssr:!1}),tx=(0,n.default)(()=>e.A(698086).then(e=>e.SnakeEditor),{loadableGenerated:{modules:[409578]},ssr:!1}),th=(0,n.default)(()=>e.A(403959).then(e=>e.SolitaireEditor),{loadableGenerated:{modules:[455419]},ssr:!1}),tp=(0,n.default)(()=>e.A(706435).then(e=>e.SudokuEditor),{loadableGenerated:{modules:[720181]},ssr:!1}),tf=(0,n.default)(()=>e.A(360133).then(e=>e.KicadPcbEditor),{loadableGenerated:{modules:[367651]},ssr:!1}),tb=(0,n.default)(()=>e.A(690786).then(e=>e.ShadertoyEditor),{loadableGenerated:{modules:[815825]},ssr:!1}),tj=(0,n.default)(()=>e.A(937787).then(e=>e.DjEditor),{loadableGenerated:{modules:[129298]},ssr:!1}),tv=(0,n.default)(()=>e.A(893610).then(e=>e.DawEditor),{loadableGenerated:{modules:[293109]},ssr:!1}),tg=(0,n.default)(()=>e.A(755656).then(e=>e.VideoEditEditor),{loadableGenerated:{modules:[843618]},ssr:!1}),ty=new Set(["markdown","diary","text","agent-skill","docx"]);function tw(e){return(0,r.cn)("rounded p-1 transition-colors",e?"bg-zinc-200 text-zinc-800 dark:bg-zinc-700/70 dark:text-zinc-200":"text-zinc-500 hover:bg-zinc-200/50 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-700/50 dark:hover:text-white")}let tk="border-zinc-300 text-zinc-500 hover:border-zinc-400 hover:text-zinc-700 dark:border-zinc-700 dark:text-zinc-400 dark:hover:border-zinc-500 dark:hover:text-zinc-200";function tN({label:e,compactLabel:s,className:n,title:i}){return(0,t.jsxs)("span",{className:(0,r.cn)("inline-flex h-5 flex-shrink-0 items-center rounded px-1.5 py-0.5 text-[9px] leading-none font-medium tracking-normal whitespace-nowrap uppercase sm:px-2 sm:text-[10px] sm:tracking-wide",n),title:i??e,children:[(0,t.jsx)("span",{className:"sr-only",children:e}),(0,t.jsx)("span",{className:"sm:hidden","aria-hidden":!0,children:s}),(0,t.jsx)("span",{className:"hidden sm:inline","aria-hidden":!0,children:e})]})}e.s(["EditorContainer",0,function({activeTab:e,onContentChange:n,onSave:ev,onPendingChangeFlushChange:eg,honorFullViewMetadata:ey=!1,onSaveTab:ew,canSave:ek=!0,saveDisabledReason:eN,saveDisabledLabel:eC="Demo edits only",saveDisabledCompactLabel:tC="Demo",onDownload:tE,onShare:tS,onDelete:tA,lockedActions:tI,onLockedAction:tz,lockedHint:tT,collaboration:tR,onReloadActiveFile:tF,onFavourite:tL,onUnfavourite:tM,isFavourited:tP=!1,onCreateTunnel:t_,onTerminateTunnel:tD,activeTunnels:t$=[],onFetchTunnels:tU,workspaceBrowserMaximized:tV=!1,embedContext:tB,workspaceName:tG,workspaceIconEmoji:tO,onNavigate:tH,onRenameFile:tW,showAiAgent:tK=!0,onOpenAiAgent:tq,onResolveExternalUpdate:tY,onResolveAvailableUpdate:tJ,onDismissAvailableUpdate:tX}){let tZ,tQ,t0,{t:t1}=(0,q.useLocale)(),t5=(0,en.useEditorBackgrounded)(),[t2,t3]=(0,i.useState)(!1),t4=(0,i.useRef)(null),t8=(0,i.useCallback)(e=>{t4.current=e,eg?.(e)},[eg]);(0,i.useEffect)(()=>()=>{t4.current=null,eg?.(null)},[eg]);let[t9,t7]=(0,i.useState)(()=>!!e?.editorType&&ty.has(e.editorType)),[t6,se]=(0,i.useState)(!1),[st,ss]=(0,i.useState)(!1),[sn,si]=(0,i.useState)(!1),sa=(0,H.useEditorOptional)(),[sl,sr]=(0,i.useState)(null),so=sa?sa.rightPanel:sl,sc=sa?sa.setRightPanel:sr,[sd,su]=(0,i.useState)(!1),sm=(0,K.useLayoutOptional)()?.isMobile??!1,[sx,sh]=(0,Y.useAiAgentDisplayMode)(),[sp,sf]=(0,J.useAutosaveEnabled)(),[sb,sj]=(0,i.useState)(!1),[sv,sg]=(0,i.useState)(0),{publish:sy,controls:sw,controlsRef:sk}=(0,N.useEditorControls)(),[sN,sC]=(0,i.useState)(null),[sE,sS]=(0,i.useState)(!1),sA=(0,i.useRef)(null),[sI,sz]=(0,i.useState)(null),[sT,sR]=(0,i.useState)(!1),[sF,sL]=(0,i.useState)(null),sM=(0,i.useRef)(null),sP=(0,i.useRef)(null),s_=(0,ee.useChatFileContextMenu)(),{scrollRef:sD}=(0,Q.useHorizontalScroller)({keepInView:"[data-breadcrumb-tail]",revision:e?.file.path??""});(0,i.useEffect)(()=>
1{if(!sT)return;let e=e=>{let t=e.target;sP.current&&!sP.current.contains(t)&&sM.current&&!sM.current.contains(t)&&sR(!1)},t=e=>{"Escape"===e.key&&sR(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[sT]),(0,i.useLayoutEffect)(()=>{if(!sT||!sM.current)return;let e=()=>{if(!sM.current)return;let e=sM.current.getBoundingClientRect();sL({top:e.bottom+4,left:e.left})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[sT]);let{showToast:s$}=(0,B.useToast)(),[sU,sV]=(0,i.useState)(!1),sB=(0,i.useCallback)(t=>{if(!e||!tJ)return;let{conflicts:s}=tJ(e.id,t);sV(!1),"combine"===t&&s>0&&s$(`Combined with ${s} conflict${1===s?"":"s"} - resolve the marked sections, then save.`,"error")},[e,tJ,s$]),sG=(0,i.useRef)([]),[sO,sH]=(0,i.useState)(""),sW=(0,i.useCallback)(e=>{let t=e??[];sG.current=t;let s=e=>`${e.id}|${e.section??""}|${e.label}|${e.tooltip??""}|${+!!e.disabled}|${+!!e.active}|${+!!e.exportAction}|${+!!e.toolbarAction}`,n=t.map(e=>e.submenu?`${s(e)}#${e.submenu.map(s).join(",")}`:s(e)).join(";");sH(e=>e===n?e:n)},[]),sK=(0,i.useCallback)(e=>sG.current.find(t=>t.id===e),[]),[sq,sY]=(0,i.useState)(null),sJ=(0,i.useCallback)(e=>{sY(e)},[]),[sX,sZ]=(0,i.useState)(null),sQ=(0,i.useCallback)(e=>{sZ(e)},[]),[s0,s1]=(0,i.useState)(null),s5=(0,i.useCallback)(e=>{s1(e)},[]),[s2,s3]=(0,i.useState)(null),[s4,s8]=(0,i.useState)(!1),[s9,s7]=(0,i.useState)(null),s6=e?.file&&!(0,S.isViewsSidecarPath)(e.file.path)?e.file.path:null,ne=s6?(0,E.fileViewKindForPath)(s6):null,{handlers:nt}=(0,C.useAppFileHandlers)(tR?.workspaceId??null,s6??""),ns=null!==s6&&!(0,E.mountsOwnAppSwitcher)(s6)&&(null!==ne||nt.length>0),[nn,ni]=(0,i.useState)([]),na=(0,i.useCallback)(e=>{ni(t=>{let s=e??[];if(t.length!==s.length)return s;for(let e=0;e<s.length;e++){let n=t[e],i=s[e];if(n.id!==i.id||n.title!==i.title||n.lines.length!==i.lines.length)return s;for(let e=0;e<n.lines.length;e++)if(n.lines[e]!==i.lines[e])return s}return t})},[]),nl="comments"===so,nr="ai"===so,no=!!(tK&&tR?.workspaceId&&tR?.token&&e?.file),nc=e=>sc(so===e?null:e);(0,i.useEffect)(()=>{tK||"ai"!==so||sc(null)},[so,tK]),(0,i.useEffect)(()=>{let e=e=>{if(!t5){if(tq)tq();else{if(!tK)return;sc("ai")}e.preventDefault()}};return window.addEventListener("editor:open-ai-agent",e),()=>window.removeEventListener("editor:open-ai-agent",e)},[t5,tK,tq]);let nd=e?.id,nu=e?.editorType;(0,i.useEffect)(()=>{sj(!1),sC(null),sS(!1),sz(null),su(!1),sV(!1),t7(!!nu&&ty.has(nu))},[nd,nu]);let nm=e=>{let t=e.lastIndexOf(".");return t<=0?{base:e,ext:""}:{base:e.slice(0,t),ext:e.slice(t)}},nx=e?.file.name?nm(e.file.name).ext:"",nh=(0,W.useFilesContextOptional)(),np=sa?.getFileOpsForWorkspace??nh?.getFileOpsForWorkspace??null,nf=e?.workspaceId??null,nb=nh?.workspaceId??null,nj=!!nh,nv=(0,i.useMemo)(()=>{if(!nf||!np||!nj||nb===nf)return null;let e=np(nf);return{workspaceId:nf,getFileContent:e.getFileContent,getFileAssetUrl:e.getFileAssetUrl,resolveFileId:e.resolveFileId,getFileId:e.getFileId,updateFileContent:e.updateFileContent,fileTree:null}},[nf,nb,np,nj]),ng=(0,i.useMemo)(()=>nv?{workspaceId:nv.workspaceId,getFileContent:nv.getFileContent,getFileAssetUrl:nv.getFileAssetUrl}:null,[nv]),ny=e?.file.path,nw=(0,i.useMemo)(()=>e?.file?(0,c.appManifestNameForBreadcrumb)(e.file.path,e.content):null,[e?.content,e?.file.path]),nk=(0,G.useFileIcon)(ny,nf),nN=(0,G.useFileIconLookup)(),nC=!!(nh&&tW&&ny&&!e?.file.name.toLowerCase().endsWith(".app")),nE=null!==sN;(0,i.useEffect)(()=>{if(!nE)return;let e=sA.current;e&&(e.focus(),e.select())},[nE]);let nS=(0,i.useCallback)(()=>{tW&&e?.file.name&&sC(nm(e.file.name).base)},[tW,e?.file.name]),nA=(0,i.useCallback)(()=>{sC(null)},[]),nI=(0,i.useCallback)(async()=>{if(null===sN||!tW||!e||sE)return;let t=sN.trim(),{ext:s}=nm(e.file.name),n=t+s,i=e.file.name;if(!t||n===i)return void sC(null);if((0,r.hasInvalidFilenameChars)(n)){s$(t1.workspace.invalidFileName,"error"),sA.current?.focus();return}sS(!0);try{await tW(e.file.path,n),sC(null)}catch(e){s$((0,r.getErrorMessage)(e,"Failed to rename"),"error")}finally{sS(!1)}},[sN,tW,e,sE,s$,t1]),nz=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=e=>{if(t5||e.defaultPrevented||!(e.metaKey||e.ctrlKey))return;let t=nz.current;if(!t)return;let s=document.activeElement;if(s){let e=s.tagName;if("INPUT"===e||"TEXTAREA"===e||s!==document.body&&!t.contains(s)&&s.isContentEditable)return}let n=sk.current;if(!n)return;let i=(e.key??"").toLowerCase(),a="z"===i&&!e.shiftKey,l="z"===i&&e.shiftKey||"y"===i;
1a&&n.canUndo?(e.preventDefault(),n.undo()):l&&n.canRedo&&(e.preventDefault(),n.redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t5]);let[nT,nR]=(0,i.useState)(!1),[nF,nL]=(0,i.useState)(!1),[nM,nP]=(0,i.useState)(!1),[n_,nD]=(0,i.useState)(!1);(0,i.useEffect)(()=>{t5&&(ss(!1),si(!1),su(!1),sz(null),sR(!1),sV(!1),nL(!1))},[t5]);let n$=(tB?.depth??0)===0,nU=nT||nF,nV=nU&&nM,nB=nU&&"slides"===s9;(0,i.useEffect)(()=>{!nU&&nM&&nP(!1)},[nU,nM]),(0,i.useEffect)(()=>{nD(!!(document.fullscreenEnabled||document.webkitFullscreenEnabled))},[]);let nG=(0,i.useCallback)(()=>{let e=nz.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen?.().catch(()=>{}))},[]),nO=(0,i.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),nL(!1)},[]);(0,i.useEffect)(()=>{let e=()=>nR(document.fullscreenElement===nz.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,i.useEffect)(()=>{if(!nF)return;let e=e=>{!t5&&("Escape"!==e.key||e.defaultPrevented||nL(!1))},t=()=>nL(!1);return window.addEventListener("keydown",e),window.addEventListener("editor:exit-maximize",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("editor:exit-maximize",t)}},[t5,nF]);let nH=(0,i.useRef)(null),nW=(0,i.useRef)(e),nK=(0,i.useRef)(!1),[nq,nY]=(0,i.useState)("Ctrl");(0,i.useEffect)(()=>{let e=navigator.platform||"",t=navigator.userAgent||"";(/Mac|iPhone|iPad|iPod/i.test(e)||/Mac|iPhone|iPad|iPod/i.test(t))&&nY("Cmd")},[]);let nJ=`${nq}+S`,nX=`${nq}+Z`,nZ=`${nq}+Shift+Z`;nW.current=e,nK.current=t2;let nQ=e?.protection?.mode==="lock",n0=(0,en.useWriteLocked)()||nQ,{readOnly:n1,writesBlocked:n5}=(0,eu.resolveEditorWriteGating)({tabIsReadOnly:!!e?.isReadOnly,writeLocked:n0,backgrounded:t5}),n2=(0,i.useCallback)(e=>{t5||n(e)},[t5,n]),n3=!!e?.editorType&&(0,er.canEditFileType)(e.editorType)&&!n1,n4=!!(e?.isCollaborative&&!n1),n8=n3&&!ek,n9=n3&&e?.editorType!=="whiteboard",n7=!!e&&(0,er.supportsRawViewForFile)(e.file.name,e.file.path),n6=e?.editorType,ie=e?.file.path,it=e?.content??null,is=(0,i.useMemo)(()=>!!(ey&&n6&&void 0!==ie&&!(0,S.isViewsSidecarPath)(ie)&&(0,f.hasArgFullViewMeta)(n6,it)),[ey,n6,ie,it]),ii=(0,f.shouldApplyArgFullView)(is,{isDirty:e?.isDirty,isSaving:e?.isSaving,syncState:e?.syncState}),ia=(0,f.isArgFullViewActive)(ii,sb),il=(0,i.useRef)(null),[ir,io]=(0,i.useState)(!1),ic=(0,i.useRef)(void 0);ic.current=nd;let id=(0,i.useCallback)(e=>{let t=ic.current;il.current=e&&t?{tabId:t,api:e}:null,io(null!==il.current)},[]),iu=ir?il.current:null,im=iu&&iu.tabId===nd?iu.api:null,ix=(0,i.useMemo)(()=>{if(!st||!ey||!n6||void 0===ie||!(0,f.canCarryArgFullViewMeta)(n6)||(0,S.isViewsSidecarPath)(ie))return null;let e=(0,f.setArgFullViewMeta)(n6,it,!is);return null===e||e===it?null:{enabled:is,next:e}},[st,is,ey,n6,ie,it]),ih=!!(ix&&n3&&!n5&&!n0&&(n4?im:ek)),ip=(0,X.useContextualFileActions)(),ib=(0,i.useMemo)(()=>!e||n5||n0?[]:ip({name:e.file.name,path:e.file.path,type:"file"}),[e,ip,n0,n5]),ij=!!(e&&nf&&nh&&np&&(0,s.isAppEntryPath)(e.file.path)),iv=(0,i.useCallback)(async()=>{if(e&&nf&&nh&&np)try{let t=await (0,d.saveSourceAsApp)({file:e.file,fileOps:np(nf),fileExists:(0,d.appShortcutFileExists)({fileTree:nh.fileTree,fileTreeWorkspaceId:nh.fileTreeWorkspaceId,workspaceId:nf})});nh.workspaceId===nf&&nh.fetchFileTree(),s$(`${t.name} created in the workspace root.`,"success")}catch(e){s$((0,r.getErrorMessage)(e,"Failed to create app launcher"),"error")}},[e,nh,np,s$,nf]),ig=!!tF||!!tE||!!tS||!!tA,iy=sO.length>0,iw=(0,ec.useEditorToolbarHost)(),[ik,iN]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(!iw)return;let e=()=>iN(iw.clientWidth);e();let t=new ResizeObserver(e);return t.observe(iw),()=>t.disconnect()},[iw]);let iC=sG.current.some(e=>e.toolbarAction),iE=sG.current.some(e=>e.exportAction),iS=!!tS||!!tI?.has("share"),iA=(0,i.useMemo)(()=>{let e=[];return(iE&&e.push("export"),iS&&e.push("share"),iC&&e.push("promoted"),iw)?(0,ed.resolveToolbarOverflow)({availableWidth:ik,present:e}):new Set(e)},[iS,iE,iC,iw,ik]),iI=n$||n3||ij||ib.length>0||ig||n7||iy,iz=(0,i.useMemo)(()=>
1{if(e?.editorType!=="markdown"||!e.content)return null;let t=e.content;if(e.file.name.endsWith(".notes")){let s=(0,y.parseLegacyNotesJson)(e.content);if(s){let e=t=>{if("text"===t.type)return t.text||"";let s=t.content;return s?s.map(e).join(" "):""};t=e(s)}}let s=t.trim(),n=s?s.split(/\s+/).length:0,i=s.length,a=Math.ceil(n/200);return{words:n,chars:i,readingTime:a<1?"< 1 min":1===a?"1 min":`${a} min`}},[e?.editorType,e?.content,e?.file.name]),iT=(0,i.useMemo)(()=>{if(e?.editorType!=="kanban"||!e.content)return null;let{document:t,error:s}=(0,eS.parseKanbanDocument)(e.content);if(s)return null;let n=(0,eA.getColumns)(t,t.rootColumnIds);return{lists:n.length,cards:n.reduce((e,t)=>e+t.cardIds.length,0)}},[e?.editorType,e?.content]),iR=(0,i.useMemo)(()=>{if(e?.editorType!=="automation"||!e.content)return null;try{let t=JSON.parse(e.content),s=t.nodes,n=t.edges;if(!Array.isArray(s))return null;return{nodes:s.length,connections:Array.isArray(n)?n.length:0}}catch{return null}},[e?.editorType,e?.content]),iF=(0,i.useMemo)(()=>{if(e?.editorType!=="table"||!e.content)return null;try{let t=e.content.trim().split("\n").filter(e=>e.length>0);if(0===t.length)return null;let s=Math.max(0,t.length-1),n=(t[0].match(/,/g)||[]).length+1;return{rows:s,cols:n}}catch{return null}},[e?.editorType,e?.content]);(0,i.useEffect)(()=>{if(!st)return;let e=()=>{ss(!1)},t=e=>{let t=e.target;st&&nH.current&&!nH.current.contains(t)&&ss(!1)},s=t=>{"Escape"===t.key&&e()},n=()=>e();return document.addEventListener("mousedown",t),document.addEventListener("keydown",s),window.addEventListener("blur",n),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",s),window.removeEventListener("blur",n)}},[st]),(0,i.useEffect)(()=>{iI||ss(!1)},[iI]),(0,i.useEffect)(()=>{ss(!1)},[e?.file.path]);let iL=(0,i.useCallback)(async()=>{if(t5||nK.current)return;let e=nW.current;if(e?.isReadOnly||!ek||e?.isCollaborative)return;try{await t4.current?.()}catch{return}let t=nW.current;if(t?.isDirty){nK.current=!0,t3(!0);try{await ev()}finally{nK.current=!1,t3(!1)}}},[t5,ek,ev]),iM=(0,i.useCallback)(async()=>{try{await iL()}catch(e){s$((0,r.getErrorMessage)(e,"Save failed"),"error")}},[iL,s$]),iP=(0,i.useCallback)(()=>{let e=ix?.next;if(void 0!==e&&ih){if(n4)return void im?.setContent(e);(0,a.flushSync)(()=>{im?im.setContent(e):n2(e)}),iM()}},[ix,ih,im,n2,iM,n4]),i_=(0,i.useRef)(0),iD=(0,i.useCallback)(async e=>{try{nW.current?.id===e&&await t4.current?.(),ew?await ew(e):nW.current?.id===e&&await iL(),i_.current=0}catch(s){let e=Date.now(),t=e-i_.current<1e4;i_.current=e,t||s$((0,r.getErrorMessage)(s,t1.common.autosaveFailed),"error")}},[ew,iL,s$,t1]),i$=(0,i.useCallback)(async()=>{let e=nW.current;e?.isDirty&&!e.isReadOnly&&ek&&await iD(e.id)},[ek,iD]),iU=e?.content??null,iV=!!e?.isDirty,iB=!!e?.isSaving,iG=!!e?.availableUpdate,iO=!!e?.externalUpdate;(0,i.useEffect)(()=>{if(!sp||!nd||!iV||iB||iG||iO||n5||n4||!n3||!ek||Date.now()-i_.current<1e4)return;let e=setTimeout(()=>{nW.current?.id===nd&&iD(nd)},1200);return()=>{clearTimeout(e),nW.current?.id!==nd&&iD(nd)}},[sp,nd,iU,iV,iB,iG,iO,n5,n4,n3,ek,iD]);let iH=()=>
1{if(!e)return(0,t.jsx)("div",{className:(0,r.cn)("flex flex-1 items-center justify-center",et.text.dimmed()),children:(0,t.jsx)("p",{className:"text-sm",children:t1.workspace.selectFile})});if(e.isLoading)return(0,t.jsxs)("div",{className:(0,r.cn)("flex flex-1 items-center justify-center gap-2",et.text.muted()),children:[(0,t.jsx)(U.ThreeColorSpinner,{px:16}),(0,t.jsx)("span",{className:"text-sm",children:t1.common.loading})]});if(null===e.content)return(0,t.jsx)("div",{className:(0,r.cn)("flex flex-1 items-center justify-center",et.text.dimmed()),children:(0,t.jsx)("p",{className:"text-sm",children:"Failed to load file content"})});if(e.isTooLarge){if("image"===e.editorType&&e.assetUrl)return(0,t.jsx)(e$,{assetUrl:e.assetUrl,fileName:e.file.name,sizeBytes:e.assetSize??null});let s=e.assetSize?(e.assetSize/1048576).toFixed(1):"?";return(0,t.jsxs)("div",{className:(0,r.cn)("flex flex-1 flex-col items-center justify-center gap-4 px-6 text-center",et.text.secondary()),children:[(0,t.jsx)(_.FileTypeIcon,{filename:e.file.name,size:48}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-medium",children:["File too large to preview (",s," MB)"]}),(0,t.jsx)("p",{className:(0,r.cn)("mt-1 text-xs",et.text.dimmed()),children:"This file exceeds the browser's inline preview limit. Download to view locally."})]}),e.assetUrl&&(0,t.jsxs)("a",{href:e.assetUrl,download:e.file.name,className:(0,r.cn)("inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium",et.bg.inverted(),et.text.inverted(),et.hover.bgInverted()),children:[(0,t.jsx)(I.DownloadIcon,{size:14}),"Download"]})]})}let s={file:e.file,content:e.content,assetUrl:e.assetUrl??null,assetSize:e.assetSize??null,persistedRevision:e.persistedRevision??null,isLoading:e.isLoading,isDirty:e.isDirty,isSaving:e.isSaving,readOnly:n1||sb&&n4&&(0,er.isRawViewCollaborationIncompatible)(e.editorType),spellCheck:t9,wideMode:t6,onContentChange:n2,onSave:iM,onBufferApi:id,onPendingChangeFlushChange:t8,onEditorControls:sy,onEditorMenuActions:sW,onEditorStats:na,onEditorHeaderSlot:sJ,onReload:tF,onCreateTunnel:t_,onTerminateTunnel:tD,activeTunnels:t$,onFetchTunnels:tU,workspaceBrowserMaximized:tV,collaboration:{enabled:!!(tR?.workspaceId&&tR?.token&&tR?.user&&e.isCollaborative&&!(sb&&(0,er.isRawViewCollaborationIncompatible)(e.editorType))),showLiveMouseCursors:tR?.showLiveMouseCursors??!0,showLiveTextCursors:tR?.showLiveTextCursors??!0,workspaceId:tR?.workspaceId??null,organizationId:tR?.organizationId??null,token:tR?.token??null,user:tR?.user??null,onStateChange:tR?.onStateChange,onBeforeConnect:i$}};if(sb&&n7)return(0,t.jsx)(u.CodeEditor,{...s},`${e.file.path}-raw`);switch(e.editorType){case"code":return(0,t.jsx)(u.CodeEditor,{...s},e.file.path);case"react":return(0,t.jsx)(w.ReactEditor,{...s},e.file.path);case"markdown":return(0,t.jsx)(g.MarkdownEditor,{...s},e.file.path);case"agent-skill":return(0,t.jsx)(ez,{...s},e.file.path);case"image":return(0,t.jsx)(eM,{...s});case"gif":return(0,t.jsx)(eP,{...s},e.file.path);case"heic":return(0,t.jsx)(e_,{...s},e.file.path);case"exr":return(0,t.jsx)(e0,{...s},e.file.path);case"pdf":return(0,t.jsx)(eV,{...s},e.file.path);case"whiteboard":return(0,t.jsx)(eY,{...s},e.file.path);case"excalidraw":return(0,t.jsx)(eJ,{...s},e.file.path);case"kanban":return(0,t.jsx)(eD,{...s},e.file.path);case"automation":return(0,t.jsx)(eR,{...s},e.file.path);case"workflow-yaml":return(0,t.jsx)(eF,{...s},e.file.path);case"mermaid":return(0,t.jsx)(eU,{...s},e.file.path);case"json":return(0,t.jsx)(j.JsonEditor,{...s},e.file.path);case"html":if((0,S.isViewsSidecarPath)(e.file.path))return(0,t.jsx)(eH,{...s},e.file.path);return(0,t.jsx)(b.HtmlEditor,{...s},e.file.path);case"site":return(0,t.jsx)(eB,{...s,onCreateTunnel:t_,onTerminateTunnel:tD,activeTunnels:t$,onFetchTunnels:tU,workspaceBrowserMaximized:tV},e.file.path);case"table":return(0,t.jsx)(eG,{...s},e.file.path);case"audio":return(0,t.jsx)(eT,{...s},e.file.path);case"video":return(0,t.jsx)(eO,{...s},e.file.path);case"3d":return(0,t.jsx)(eX,{...s},e.file.path);case"cad":return(0,t.jsx)(eQ,{...s},e.file.path);case"cad-drawing":return(0,t.jsx)(eZ,{...s},e.file.path);case"pptx":return(0,t.jsx)(e5,{...s},e.file.path);case"docx":return(0,t.jsx)(e2,{...s},e.file.path);case"psd":return(0,t.jsx)(e3,{...s},e.file.path);
1case"lottie":return(0,t.jsx)(v.LottieEditor,{...s},e.file.path);case"diary":return(0,t.jsx)(eL,{...s},e.file.path);case"epub":return(0,t.jsx)(e4,{...s},e.file.path);case"ical":return(0,t.jsx)(e1,{...s},e.file.path);case"midi":return(0,t.jsx)(e8,{...s},e.file.path);case"archive":return(0,t.jsx)(e9,{...s},e.file.path);case"kml":return(0,t.jsx)(e7,{...s},e.file.path);case"link":return(0,t.jsx)(e6,{...s},e.file.path);case"app":return(0,t.jsx)(te,{...s},e.file.path);case"design":case"fig":return(0,t.jsx)(tt,{...s},e.file.path);case"pgn":return(0,t.jsx)(ts,{...s},e.file.path);case"sqlite":return(0,t.jsx)(tn,{...s},e.file.path);case"playlist":return(0,t.jsx)(ti,{...s},e.file.path);case"subtitle":return(0,t.jsx)(ta,{...s},e.file.path);case"cast":return(0,t.jsx)(tl,{...s},e.file.path);case"vcard":return(0,t.jsx)(tr,{...s},e.file.path);case"eml":return(0,t.jsx)(to,{...s},e.file.path);case"diff":return(0,t.jsx)(tc,{...s},e.file.path);case"font":return(0,t.jsx)(td,{...s},e.file.path);case"notebook":return(0,t.jsx)(tu,{...s},e.file.path);case"xlsx":return(0,t.jsx)(tm,{...s},e.file.path);case"snake":return(0,t.jsx)(tx,{...s},e.file.path);case"solitaire":return(0,t.jsx)(th,{...s},e.file.path);case"sudoku":return(0,t.jsx)(tp,{...s},e.file.path);case"kicad-pcb":return(0,t.jsx)(tf,{...s},e.file.path);case"shadertoy":return(0,t.jsx)(tb,{...s},e.file.path);case"dj":return(0,t.jsx)(tj,{...s},e.file.path);case"daw":return(0,t.jsx)(tv,{...s},e.file.path);case"video-edit":return(0,t.jsx)(tg,{...s},e.file.path);case"text":return(0,t.jsx)(k.TextEditor,{...s},e.file.path);default:return e.editorType,(0,t.jsx)(k.TextEditor,{...s},e.file.path)}},iW=(s=!1,n=!1)=>{let i,c;if(!e||e.isLoading||"site"===e.editorType)return null;let d=e.file.modified,u=d?new Date(d):null,m=!!(u&&!Number.isNaN(u.getTime())),x=m&&d?(0,r.formatRelativeTime)(d):null,h=m?u?.toLocaleString():void 0,p=e.file.path.split("/").filter(Boolean),f=p.slice(0,-1),b=p[p.length-1]??e.file.name,j=f.length>2,v=j?f.slice(0,-1):[],g=j?f.slice(-1):f,y=j?f.length-1:0;return(0,t.jsxs)("div",{"data-testid":"editor-toolbar",className:(0,r.cn)(n?"flex h-full min-w-0 items-center justify-end gap-1.5 pr-3":"flex h-10 items-center gap-2 border-b px-2",!n&&et.border.muted(),!n&&et.bg.primary(),s&&"[&>[data-toolbar-spacer]~*:not([data-toolbar-capability-slot]):not([data-full-view-action])]:hidden"),children:[!n&&e.file.name&&(0,t.jsxs)("div",{ref:sD,className:(0,r.cn)("scroll-fade-x scrollbar-hide flex max-w-[480px] min-w-0 items-center gap-1 overflow-x-auto px-1 text-xs",et.text.muted()),children:[tG&&(0,t.jsxs)("button",{onClick:()=>tH?.("/"),className:(0,r.cn)("flex min-w-0 flex-shrink-0 items-center gap-1 transition-colors",et.hover.textPrimary(),!tH&&"cursor-default"),title:tG,disabled:!tH,children:[(0,t.jsx)($.WorkspaceIcon,{value:tO??void 0,size:14,className:"flex-shrink-0 opacity-70"}),(0,t.jsx)("span",{className:"truncate",children:(0,r.truncateMiddle)(tG,40)})]}),j&&(0,t.jsxs)("span",{className:"flex flex-shrink-0 items-center gap-1",children:[(0,t.jsx)("span",{className:(0,r.cn)("flex-shrink-0 px-1.5 select-none",et.text.dimmed()),"aria-hidden":!0,children:"/"}),(0,t.jsx)("button",{ref:sM,onClick:()=>tH&&sR(e=>!e),className:(0,r.cn)("flex flex-shrink-0 items-center rounded px-1 py-0.5 transition-colors",et.hover.textPrimary(),et.hover.bg(),!tH&&"cursor-default"),title:v.join("/"),"aria-haspopup":"menu","aria-expanded":sT,disabled:!tH,children:(0,t.jsx)(z.MoreHorizontalIcon,{size:14,className:"opacity-70"})}),sT&&sF&&"u">typeof document&&(0,a.createPortal)((0,t.jsx)("div",{ref:sP,role:"menu",style:{position:"fixed",top:sF.top,left:sF.left},className:(0,r.cn)("z-50 max-h-[320px] min-w-[200px] overflow-y-auto rounded-lg border py-1 shadow-lg",et.bg.surface(),et.border.default()),children:v.map((e,s)=>{let n="/"+f.slice(0,s+1).join("/"),i=nN(n),{onContextMenu:a}=s_.bind({path:n,isFolder:!0});return(0,t.jsxs)("button",{role:"menuitem",onClick:()=>{tH?.(n),sR(!1)},className:(0,r.cn)("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",et.text.muted(),et.hover.bg(),et.hover.textPrimary()),style:{paddingLeft:`${12+12*s}px`},title:e,onContextMenu:a&&(e=>{sR(!1),a(e)}),children:[i?(0,t.jsx)(G.CustomFileIcon,{value:i,size:14,className:"flex-shrink-0"}):(0,t.jsx)(F.FolderOpenIcon,{size:14,className:"flex-shrink-0 opacity-70"}),(0,t.jsx)("span",{className:"truncate",children:e})]},s)})}),document.body)]}),g.map((e,s)=>{let n=y+s,i="/"+f.slice(0,n+1).join("/"),a=nN(i);return(0,t.jsxs)("span",{className:"flex min-w-0 flex-shrink-0 items-center gap-1",children:[(0,t.jsx)("span",{className:(0,r.cn)("flex-shrink-0 px-1.5 select-none",et.text.dimmed()),"aria-hidden":!0,
1children:"/"}),(0,t.jsxs)("button",{onClick:()=>tH?.(i),className:(0,r.cn)("flex min-w-0 items-center gap-1 transition-colors",et.hover.textPrimary(),!tH&&"cursor-default"),title:e,disabled:!tH,...s_.bind({path:i,isFolder:!0}),children:[a?(0,t.jsx)(G.CustomFileIcon,{value:a,size:14,className:"flex-shrink-0"}):(0,t.jsx)(F.FolderOpenIcon,{size:14,className:"flex-shrink-0 opacity-70"}),(0,t.jsx)("span",{className:"truncate",children:(0,r.truncateMiddle)(e,l.TEXT.MAX_BREADCRUMB_LENGTH)})]})]},n)}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-shrink-0 items-center gap-1","data-breadcrumb-tail":!0,children:[(tG||f.length>0)&&(0,t.jsx)("span",{className:(0,r.cn)("flex-shrink-0 px-1.5 select-none",et.text.dimmed()),"aria-hidden":!0,children:"/"}),(0,t.jsxs)("span",{className:(0,r.cn)("flex min-w-0 items-center gap-1",et.text.primary()),title:b,...s_.bind({path:e.file.path,isFolder:!1}),children:[(i=nk?(0,t.jsx)(G.CustomFileIcon,{value:nk,size:14,className:"flex-shrink-0"}):(0,t.jsx)(_.FileTypeIcon,{filename:b,size:14,className:"flex-shrink-0"}),c=(0,o.getFileTypeHoverText)(b),!nC||s?(0,t.jsx)("span",{className:"flex flex-shrink-0 items-center",title:c,children:i}):(0,t.jsx)("button",{type:"button","aria-label":t1.workspace.changeIcon,title:`${c} - ${t1.workspace.changeIcon}`,onClick:e=>{e.stopPropagation(),sz({top:e.clientY,left:e.clientX})},className:(0,r.cn)("flex flex-shrink-0 items-center justify-center rounded p-0.5",et.hover.bg()),children:i})),s||null===sN?(0,t.jsx)(O.FileInfoButton,{fileName:b,filePath:e.file.path,locationParts:[...tG?[tG]:[],...f],className:(0,r.cn)("max-w-[20rem] truncate rounded px-1 py-0.5",et.hover.bg()),onDoubleClick:!s&&tW?nS:void 0,title:!s&&tW?`${(0,o.getFileTypeHoverText)(b)}
2${t1.workspace.doubleClickToRename}`:(0,o.getFileTypeHoverText)(b),children:nw??(0,r.prettifyFilename)(b)}):(0,t.jsxs)("span",{className:"flex items-center",children:[(0,t.jsx)("input",{ref:sA,type:"text",value:sN,onChange:e=>sC(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),nI()):"Escape"===e.key&&(e.preventDefault(),nA())},onBlur:()=>void nI(),disabled:sE,spellCheck:!1,autoComplete:"off",size:Math.max(sN.length,1),className:(0,r.cn)("field-sizing-content max-w-[20rem] min-w-[4rem] rounded border-none px-1 py-0.5 text-xs outline-none",et.bg.muted(),et.text.primary(),sE&&"opacity-60")}),nx&&(0,t.jsx)("span",{className:(0,r.cn)("ml-0.5 text-xs select-none",et.text.dimmed(),sE&&"opacity-60"),"aria-hidden":!0,children:nx})]})]})]})]}),!n&&(0,t.jsx)("div",{"data-toolbar-spacer":!0,className:"flex-1"}),nQ&&(0,t.jsx)("span",{className:"flex-shrink-0",title:e?.protection?.reason?`Editing locked - ${e.protection.reason}`:"Editing locked. Unlock to make changes.",children:(0,t.jsx)(V.StatusBadge,{tone:"neutral",dot:!1,label:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(P.LockIcon,{size:11}),"Locked"]})})}),n1&&!nQ&&(0,t.jsx)(tN,{label:"Read only",compactLabel:"Read",className:et.statusBadge.neutral.bg}),n8&&(0,t.jsx)(tN,{label:eC,compactLabel:tC,className:et.statusBadge.warning.bg,title:eN||"Saving is disabled for this file"}),!n&&x&&(0,t.jsxs)("button",{type:"button",onClick:()=>nc("activity"),className:(0,r.cn)("inline-flex h-5 flex-shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] leading-none whitespace-nowrap tabular-nums transition-colors sm:text-[11px]","text-zinc-400 hover:bg-zinc-100 hover:text-zinc-600 dark:text-zinc-500 dark:hover:bg-zinc-700/50 dark:hover:text-zinc-300"),title:h,children:[(0,t.jsxs)("span",{className:"sr-only",children:["Last edited ",x]}),(0,t.jsx)("span",{className:"sm:hidden","aria-hidden":!0,children:x}),(0,t.jsxs)("span",{className:"hidden sm:inline","aria-hidden":!0,children:["Last edited ",x]})]}),sq,no&&(0,t.jsx)("button",{type:"button",onClick:()=>nc("ai"),className:tw(nr),title:t1.workspace.aiAgent,"aria-label":t1.workspace.aiAgent,"aria-pressed":nr,children:(0,t.jsx)(D.ArgLogo,{width:14,height:12})}),iA.has("promoted")&&(0,t.jsx)(eo.EditorToolbarActionButtons,{menuActions:sG.current,resolveAction:sK,buttonClassName:tk}),iA.has("export")&&(0,t.jsx)(el.EditorExportButton,{menuActions:sG.current,buttonClassName:tk}),(0,t.jsx)("div",{ref:s3,"data-toolbar-capability-slot":!0,className:"flex items-center gap-1.5 empty:hidden"}),s0,iA.has("share")&&(tS||tI?.has("share"))&&e?.file&&(0,t.jsxs)("button",{type:"button",onClick:()=>tS?tS(e.file.path,e.file.name):tz?.(),title:tS?void 0:tT??"Log in to use",className:(0,r.cn)("flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors",tk),children:[t1.workspace.share,!tS&&(0,t.jsx)(P.LockIcon,{size:11,className:"opacity-70"})]}),(tL||tM)&&e?.file&&(0,t.jsx)("button",{type:"button",onClick:()=>{tP&&tM?tM(e.file.path):!tP&&tL&&tL(e.file.path,e.file.name,!1)},title:tP?t1.sidebar.unfavourite:t1.sidebar.favourite,className:(0,r.cn)("rounded p-1 transition-colors",tP?"text-yellow-500 hover:text-yellow-400":"text-zinc-400 hover:text-zinc-600 dark:text-zinc-500 dark:hover:text-zinc-300"),children:(0,t.jsx)(R.StarIcon,{size:14,className:tP?"fill-yellow-500":""})}),tR?.workspaceId&&tR?.token&&e?.file&&(0,t.jsx)("button",{type:"button",onClick:()=>
2nc("comments"),className:tw(nl),title:"Comments","aria-label":"Comments",children:(0,t.jsx)(T.CommentsIcon,{size:14})}),sX,iI&&(0,t.jsxs)("div",{className:"relative",ref:nH,"data-full-view-action":s||void 0,children:[(0,t.jsx)("button",{type:"button",onClick:()=>ss(e=>!e),className:tw(st),title:"More","aria-label":"More","aria-haspopup":"menu","aria-expanded":st,children:(0,t.jsx)(z.MoreHorizontalIcon,{size:14})}),st&&(0,t.jsx)("div",{ref:e=>{if(e){let{top:t}=e.getBoundingClientRect();e.style.maxHeight=`${Math.max(160,window.innerHeight-t-8)}px`}},className:(0,r.cn)("absolute top-full right-0 z-50 mt-1 w-max max-w-[90vw] min-w-[200px] rounded-lg border shadow-lg","[scrollbar-gutter:stable] overflow-y-auto overscroll-contain","border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-800"),children:(0,t.jsx)(es.EditorActionsMenu,{t:t1,onRequestClose:()=>ss(!1),isEditable:n3,isSaving:t2,isDirty:e.isDirty,canSave:ek,isCollaborativeEditing:n4,saveDisabledReason:eN,saveShortcutLabel:nJ,onSave:()=>void iM(),hasEditorControls:!!sw,canUndo:sw?.canUndo??!1,canRedo:sw?.canRedo??!1,undoShortcutLabel:nX,redoShortcutLabel:nZ,onUndo:()=>sw?.undo(),onRedo:()=>sw?.redo(),autosaveEnabled:sp,onToggleAutosave:()=>sf(!sp),markdownSource:"markdown"===e.editorType?e.content??"":void 0,onError:e=>s$(e,"error"),supportsWideMode:"markdown"===e.editorType,wideMode:t6,onToggleWideMode:()=>se(e=>!e),supportsSpellCheck:n9,spellCheck:t9,onToggleSpellCheck:()=>t7(e=>!e),supportsRawView:n7,viewRaw:sb,onToggleViewRaw:()=>sj(e=>!e),fullViewApp:ii,fullViewEnabled:ix?.enabled??!1,canToggleFullView:ih,onToggleFullView:iP,onSaveAsApp:ij?iv:void 0,fileActions:ib,supportsViewModes:n$,fullscreenSupported:"html"!==e.editorType&&n_,isFullscreen:nT,onToggleFullscreen:nG,maximized:nF,onToggleMaximize:()=>nL(e=>!e),immersive:nU,onHideImmersiveUi:()=>nP(!0),editorMenuActions:sG.current.filter(e=>(!e.exportAction||!iA.has("export"))&&(!e.toolbarAction||!iA.has("promoted"))),onReload:tF,onDownload:tE?()=>tE(e.file.path,e.file.name):void 0,onShare:tS?()=>tS(e.file.path,e.file.name):void 0,onCheckReferences:nf?()=>si(!0):void 0,onActivityLog:tR?.workspaceId&&tR?.token?()=>sc("activity"):void 0,onVersionHistory:tR?.workspaceId&&tR?.token?()=>sc("history"):void 0,onDelete:tA?()=>tA(e.file.path,e.file.name):void 0,lockedActions:tI,onLockedAction:tz,lockedHint:tT,lastModifiedLabel:x,lastModifiedTitle:h,mdStats:iz,kanbanStats:iT,automationStats:iR,tableStats:iF,editorStats:nn})})]}),!t5&&!s&&sI&&nh&&ny&&(0,t.jsx)($.IconEmojiSelector,{value:nk,anchorPos:sI,resetLabel:t1.workspace.removeIcon,onChange:e=>{nh.setFileIcon(ny,e),sz(null)},onClose:()=>sz(null)})]})},iK=(0,t.jsxs)("div",{ref:nz,style:nF?{width:"100dvw",height:"100dvh"}:void 0,className:(0,r.cn)("relative flex h-full flex-col",nF&&"fixed inset-0 z-[100]",nU&&et.bg.primary()),children:[!sm&&!nV&&!nB&&(iw?(0,a.createPortal)(iW(ia,!0),iw):iW(ia)),!sm&&nB&&!nV&&(0,t.jsx)(eq,{children:iW()}),s_.menu,!t5&&nf&&e?.file&&(0,t.jsx)(ej.FileReferencesModal,{isOpen:sn,onClose:()=>si(!1),workspaceId:nf,filePath:e.file.path,fileName:e.file.name,token:tR?.token??null}),!nV&&!s4&&e?.availableUpdate&&tJ&&(0,t.jsx)(A.UpdateAvailableBanner,{hasLocalEdits:e.isDirty,onReview:()=>sV(!0),onUpdate:()=>sB("discardLocal"),onDismiss:()=>{sV(!1),tX?.(e.id)}}),(0,t.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-row overflow-hidden",children:[(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,t.jsx)(en.EditorChromeProvider,{value:{writeLocked:nQ},children:(tZ=nV||ia?(0,t.jsx)(en.EditorChromeProvider,{value:{top:!1,left:!1,right:!1,appChrome:!nV},children:(0,t.jsx)(h.EditorToolbarSlotProvider,{slot:s2,children:iH()})}):iH(),tQ=!sb&&ns&&e?.file&&tR?.workspaceId?(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(eK,{}),children:(0,t.jsx)(eW,{file:e.file,workspaceId:tR.workspaceId,user:tR.user??null,kind:ne,onHeaderSlot:sQ,onModeSlot:s5,onViewActiveChange:s8,onActiveViewTypeChange:s7,presenting:nB,readOnly:n1,children:tZ},`${tR.workspaceId}:${e.file.path}`)}):tZ,t0=`${e?.id??"no-file"}:${sb?"raw":"rendered"}:${sv}`,(0,t.jsx)(eI.RememberedEditorScroll,{restoreToken:sv,scrollKey:e?.file?`${nf??""}:${e.file.path}:${sb?"raw":"rendered"}`:null,children:(0,t.jsx)(ea.EditorErrorBoundary,{resetKey:t0,fallback:(0,t.jsx)(ei.EditorCrashFallback,{onRetry:()=>sg(e=>e+1),onViewSource:n7&&!sb?()=>sj(!0):void 0}),children:tQ})}))})}),!t5&&tR?.workspaceId&&tR?.token&&e?.file&&"comments"===so&&(0,t.jsx)(eb.FileCommentsPanel,{workspaceId:tR.workspaceId,filePath:e.file.path,token:tR.token,currentUserId:tR.user?.id??"",currentUser:(0,Z.toCommentAuthor)(tR.user),onClose:()=>sc(null),onOpenConversation:()=>su(!0),onOpenAgent:()=>{tq?tq():no&&sc("ai")}}),!t5&&tR?.workspaceId&&tR?.token&&e?.file&&"activity"===so&&(0,t.jsx)(eh.FileAuditLogPanel,{workspaceId:tR.workspaceId,filePath:e.file.path,token:tR.token,onClose:()=>sc(null)}),!t5&&tR?.workspaceId&&tR?.token&&e?.file&&"history"===so&&(0,t.jsx)(eE,{workspaceId:tR.workspaceId,filePath:e.file.path,token:tR.token,onRestore:tF,onClose:()=>sc(null)}),!t5&&no&&"ai"===so&&(0,t.jsx)(ex.FileAiAgentPanel,{onClose:()=>sc(null),displayMode:sx,onDisplayModeChange:sh}),!t5&&tR?.workspaceId&&tR?.token&&e?.file&&sd&&(0,t.jsx)(ep.FileCommentsChatView,{isOpen:sd,workspaceId:tR.workspaceId,filePath:e.file.path,token:tR.token,currentUserId:tR.user?.id??"",currentUser:(0,Z.toCommentAuthor)(tR.user),onClose:()=>su(!1)})]}),no&&"bubble"===sx&&"ai"!==so&&!nV&&(0,t.jsx)("button",{type:"button",onClick:()=>sc("ai"),"aria-label":t1.workspace.openAiAgent,title:t1.workspace.aiAgent,className:(0,r.cn)("fixed right-4 bottom-4 z-30 flex h-12 w-12 items-center justify-center rounded-full border transition-transform hover:scale-105",et.bg.surface(),et.border.default()),children:(0,t.jsx)(D.ArgLogo,{width:22,height:19})}),nV&&(0,t.jsxs)("div",{className:"absolute right-4 bottom-4 z-10 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>nP(!1),title:"Show UI",className:(0,r.cn)("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs font-medium shadow-lg",et.bg.surface(),et.border.default(),et.text.primary(),et.hover.bg()
2),children:[(0,t.jsx)(M.EyeIcon,{size:13}),"Show UI"]}),(0,t.jsxs)("button",{type:"button",onClick:nO,title:"Exit (Esc)",className:(0,r.cn)("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs font-medium shadow-lg",et.bg.surface(),et.border.default(),et.text.primary(),et.hover.bg()),children:[(0,t.jsx)(L.WindowCollapseIcon,{size:13}),"Exit"]})]}),!t5&&e?.externalUpdate&&tY&&(0,t.jsx)(m.ConflictResolutionModal,{isOpen:!0,fileName:e.file.name,localContent:e.content??"",externalContent:e.externalUpdate.content,localIsBinary:"base64"===e.encoding,externalIsBinary:"base64"===e.externalUpdate.encoding,onKeepLocal:()=>tY(e.id,"keepLocal"),onTakeExternal:()=>tY(e.id,"takeExternal")}),!t5&&e?.availableUpdate&&tJ&&(0,t.jsx)(A.UpdateAvailableModal,{isOpen:sU,fileName:e.file.name,localContent:e.content??"",externalContent:e.availableUpdate.content,localIsBinary:"base64"===e.encoding,externalIsBinary:"base64"===e.availableUpdate.encoding,onResolve:sB,onClose:()=>sV(!1)})]}),iq=!!(!t5&&tR?.workspaceId&&tR?.token&&e?.file&&("comments"===so||sd||"video"===e.editorType||"audio"===e.editorType)),iY=(0,t.jsx)(ef.FileCommentsProvider,{workspaceId:tR?.workspaceId??null,filePath:e?.file?.path??null,token:tR?.token??null,enabled:iq,currentUser:(0,Z.toCommentAuthor)(tR?.user),children:iK}),iJ=nv&&ng?(0,t.jsx)(x.EditorFileScopeContext.Provider,{value:nv,children:(0,t.jsx)(p.FilePreviewLoadContext.Provider,{value:ng,children:iY})}):iY,iX=tB?(0,t.jsx)(em.EmbedContext.Provider,{value:tB,children:iJ}):iJ;return!t5&&nF&&"u">typeof document?(0,a.createPortal)(iX,document.body):iX}],219123)},596569,e=>{"use strict";var t=e.i(9384),s=e.i(539919);let n=(0,s.createContext)(null);e.s(["EditorToolbarHostProvider",0,function({value:e,children:s}){return(0,t.jsx)(n.Provider,{value:e,children:s})},"useEditorToolbarHost",0,function(){return(0,s.useContext)(n)}])},189527,800121,e=>{"use strict";let t=["export","share","promoted"],s={export:82,share:74,promoted:90};e.s(["resolveToolbarOverflow",0,function(e){let n=new Set(e.present);if(e.availableWidth<=0)return n;let i=new Set,a=210;for(let l of t){if(!n.has(l))continue;let t=a+s[l];t>e.availableWidth||(a=t,i.add(l))}return i}],189527),e.s(["resolveEditorWriteGating",0,function({tabIsReadOnly:e,writeLocked:t,backgrounded:s}){let n=e||t;return{readOnly:n,writesBlocked:n||s}}],800121)},613622,e=>{"use strict";var t=e.i(9384),s=e.i(608982),n=e.i(539919),i=e.i(879069),a=e.i(261309),l=e.i(574218),r=e.i(975026);e.i(492030);var o=e.i(811360),c=e.i(930880),d=e.i(508383),u=e.i(107043),m=e.i(897407),x=e.i(456745),h=e.i(588011),p=e.i(912415),f=e.i(201345),b=e.i(259305),j=e.i(582256),v=e.i(39365),g=e.i(529707),y=e.i(156407),w=e.i(453782),k=e.i(307251);e.s(["FileAiAgentPanel",0,function({onClose:e,displayMode:N,onDisplayModeChange:C,side:E="right",onSideChange:S,variant:A="panel",carded:I=!1,onOpenChatWindow:z,onNewChatWindow:T,hidden:R=!1}){let{acquireChatRedirectSuppression:F,openChat:L,startNewDraft:M,releaseChat:P,conversationId:_,currentChatId:D,workspaceId:$}=(0,b.useChatRuntime)(),{chats:U,currentOrg:V}=(0,f.useAuthContext)(),{currentWorkspace:B}=(0,v.useWorkspace)(),{t:G}=(0,j.useLocale)(),O=(0,s.useRouter)(),H=_??D,W=H??null,K=(W?U.find(e=>e.id===W)?.title:null)??G.workspace.aiAgent,q=(0,n.useMemo)(()=>(0,l.workspaceChatHistory)(U,B?.id),[U,B?.id]),Y=T??(()=>M()),J=(0,n.useCallback)(()=>{O.push(H?(0,y.buildChatRoute)(V?.slug,H):"/home")},[H,V?.slug,O]);(0,n.useEffect)(()=>{if(!R)return F()},[F,R]);let[X,Z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(R)return;let t=t=>{"Escape"!==t.key||t.defaultPrevented||(X?Z(!1):e())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,X,R]);let Q=(0,w.cn)("rounded p-1 transition-colors",g.text.muted(),g.hover.bg(),g.hover.textPrimary()),ee="bare"===A&&"bubble"!==N&&!I,et=(0,t.jsxs)(i.AiAgentHeader,{title:K,titleControl:(0,t.jsx)(l.ChatPicker,{chats:q,currentChatId:W,title:W?K:"",onSelect:e=>void L(e),onNew:Y}),className:(0,w.cn)(I?p.SHELL_PANEL_HEADER_INSET:!ee&&"px-3"),children:[(0,t.jsx)("button",{type:"button",onClick:Y,className:Q,"aria-label":G.sidebar.newChat,title:G.sidebar.newChat,children:(0,t.jsx)(m.PlusIcon,{size:14})}),z&&(0,t.jsx)("button",{type:"button",onClick:()=>
2z(H,K),className:Q,"aria-label":"Open chat in window",title:"Open chat in window",children:(0,t.jsx)(h.WindowExpandIcon,{size:14})}),(0,t.jsx)(a.ChatActionsMenu,{chatId:W,chatTitle:K,canPin:!!(B?.id&&($===B.id||U.find(e=>e.id===W)?.workspace_ids?.includes(B.id))),align:"right",showSettings:!0,open:X,onOpenChange:Z,onAfterRemove:()=>{W&&P(W),M()},hostItems:(0,t.jsxs)(t.Fragment,{children:[C&&(0,t.jsx)(a.ChatActionsMenuItem,{icon:"sidebar"===N?(0,t.jsx)(x.WindowCollapseIcon,{size:14}):(0,t.jsx)(h.WindowExpandIcon,{size:14}),onClick:()=>C("sidebar"===N?"bubble":"sidebar"),children:"sidebar"===N?G.workspace.floatAiAgent:G.workspace.dockAiAgent}),S&&(0,t.jsx)(a.ChatActionsMenuItem,{icon:(0,t.jsx)(o.ArrowLeftRightIcon,{size:14}),onClick:()=>S("left"===E?"right":"left"),children:"left"===E?G.workspace.moveAiAgentRight:G.workspace.moveAiAgentLeft}),(0,t.jsx)(a.ChatActionsMenuItem,{icon:(0,t.jsx)(d.ExternalLinkIcon,{size:14}),onClick:J,children:G.workspace.openAiAgentFullPage})]}),renderTrigger:e=>(0,t.jsx)("button",{type:"button",onClick:e.onClick,"aria-expanded":e["aria-expanded"],"aria-haspopup":e["aria-haspopup"],className:Q,"aria-label":G.workspace.moreOptions,title:G.workspace.moreOptions,children:(0,t.jsx)(u.MoreHorizontalIcon,{size:14})})}),(0,t.jsx)("button",{type:"button",onClick:e,className:Q,"aria-label":G.workspace.closeAiAgent,children:(0,t.jsx)(c.CloseIcon,{size:14})})]}),es=(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,t.jsx)(r.ChatView,{embedded:!0,autoFocus:!0,sidePanel:I,composerFlushBottom:!0,composerFlushSides:ee,onSelectRecentChat:z?e=>{let t=U.find(t=>t.id===e)?.title||"Untitled chat";z(e,t)}:void 0})});return"bubble"===N?(0,t.jsxs)("div",{className:(0,w.cn)("fixed right-4 bottom-4 z-40 flex h-[600px] max-h-[calc(100vh-2rem)] w-[400px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-2xl border",g.bg.surface(),g.border.default()),role:"dialog","aria-modal":"false","aria-label":G.workspace.aiAgent,children:[et,es]}):"bare"===A?(0,t.jsxs)(t.Fragment,{children:[et,es]}):(0,t.jsxs)(k.EditorRightPanel,{initialWidth:384,children:[et,es]})}])},888384,313685,e=>{"use strict";var t=e.i(9384),s=e.i(539919),n=e.i(532844);e.i(492030);var i=e.i(545426),a=e.i(930880),l=e.i(421865),r=e.i(41714),o=e.i(201345),c=e.i(306973);function d(e){let t=e.replace(/\/{2,}/g,"/"),s=t.startsWith("/")?t:`/${t}`;return s.length>1&&s.endsWith("/")?s.slice(0,-1):s}function u({enabled:e,workspaceId:t,filePath:n,onRefetch:i}){let a=(0,c.useFilesContextOptional)(),l=a?.subscribeFileTreeChanges,r=a?.workspaceId??null,o=(0,s.useRef)(i);o.current=i;let m=(0,s.useRef)(n);m.current=n,(0,s.useEffect)(()=>{if(!e||!l||!t||r!==t)return;let s=null,n=!1,i=()=>{if("visible"!==document.visibilityState){n=!0;return}null!=s&&clearTimeout(s),s=setTimeout(()=>{s=null,o.current()},1500)},a=()=>{"visible"===document.visibilityState&&n&&(n=!1,i())};document.addEventListener("visibilitychange",a);let c=l(e=>{let t=m.current;(!t||function(e,t){if(0===e.length)return!0;let s=d(t);return e.some(e=>{let t=d(e);return"/"===t||t===s||s.startsWith(`${t}/`)})}(e,t))&&i()});return()=>{document.removeEventListener("visibilitychange",a),null!=s&&clearTimeout(s),c()}},[e,l,t,r])}e.s(["useFileTreeChangeRefetch",0,u],313685);var m=e.i(150095),x=e.i(479874),h=e.i(914787),p=e.i(453782),f=e.i(529707),b=e.i(2819),j=e.i(307251);e.s(["FileAuditLogPanel",0,function({workspaceId:e,filePath:c,token:d,onClose:v}){let{currentOrg:g}=(0,o.useAuthContext)(),y=(0,b.planIncludesActivityLog)(g?.plan),[w,k]=(0,s.useState)([]),[N,C]=(0,s.useState)(!1),[E,S]=(0,s.useState)(!1),[A,I]=(0,s.use
2State)(null),[z,T]=(0,s.useState)(!1),R=(0,s.useCallback)(t=>{let s=c?.startsWith("/")?c.slice(1):c;return s?`/api/workspaces/${e}/files/history?path=${encodeURIComponent(s)}&limit=50&offset=${t}`:`/api/workspaces/${e}/activity?limit=50&offset=${t}`},[e,c]),F=(0,s.useCallback)(async(e=0,t=!1)=>{if(y){t?S(!0):C(!0),I(null);try{let s=await (0,m.apiFetch)(R(e),{headers:{Authorization:`Bearer ${d}`}});if(!s.ok)throw Error(await (0,m.getApiErrorDetail)(s,"Failed to fetch audit log"));let n=await s.json();k(e=>t?[...e,...n.entries]:n.entries),T(n.has_more)}catch(e){I((0,p.getErrorMessage)(e,"Failed to fetch audit log"))}finally{C(!1),S(!1)}}},[R,d,y]);(0,s.useEffect)(()=>{F()},[F]);let L=(0,s.useRef)(w);L.current=w;let M=(0,s.useRef)(!1),P=(0,s.useCallback)(async()=>{if(!M.current){M.current=!0;try{let e=await (0,m.apiFetch)(R(0),{headers:{Authorization:`Bearer ${d}`}});if(!e.ok)return;let t=await e.json(),s=L.current,n=new Set(s.map(e=>e.id)),i=t.entries.filter(e=>!n.has(e.id));0===s.length||i.length===t.entries.length&&i.length>0?(k(t.entries),T(t.has_more)):i.length>0&&k(e=>[...i,...e])}catch{}finally{M.current=!1}}},[R,d]);return u({enabled:y,workspaceId:e,filePath:c,onRefetch:()=>void P()}),(0,t.jsxs)(j.EditorRightPanel,{children:[(0,t.jsxs)("div",{className:(0,p.cn)("flex items-center justify-between border-b px-3 py-2",f.border.default()),children:[(0,t.jsx)("span",{className:(0,p.cn)("text-sm font-medium",f.text.primary()),children:"Activity log"}),(0,t.jsx)("button",{type:"button",onClick:v,"aria-label":"Close activity log",className:(0,p.cn)("rounded p-1 transition-colors",f.text.muted(),f.hover.bgSubtle(),f.hover.textPrimary()),children:(0,t.jsx)(a.CloseIcon,{size:14})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[!y&&(0,t.jsxs)("div",{className:(0,p.cn)("p-6 text-center",f.text.muted()),children:[(0,t.jsx)(l.ClockIcon,{size:24,className:"mx-auto mb-2 opacity-40"}),(0,t.jsxs)("p",{className:(0,p.cn)("text-xs font-medium",f.text.primary()),children:["Available on ",b.planKeyToName.pro,", ",b.planKeyToName.team," and ",b.planKeyToName.enterprise]}),(0,t.jsx)("p",{className:"mt-1 text-xs",children:"Upgrade to see who changed what. Activity keeps being recorded in the meantime."})]}),y&&N&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(i.SpinnerIcon,{size:18,className:(0,p.cn)("animate-spin",f.text.muted())})}),y&&A&&!N&&(0,t.jsx)("div",{className:(0,p.cn)("px-3 py-4 text-center text-xs","text-red-600 dark:text-red-400"),children:A}),y&&!N&&!A&&0===w.length&&(0,t.jsxs)("div",{className:(0,p.cn)("p-6 text-center",f.text.muted()),children:[(0,t.jsx)(l.ClockIcon,{size:24,className:"mx-auto mb-2 opacity-40"}),(0,t.jsx)("p",{className:"text-xs",children:"No activity recorded yet"})]}),y&&!N&&!A&&w.length>0&&(0,t.jsxs)("div",{className:"py-1",children:[w.map(e=>{let s=(0,x.describeAuditActor)(e);return(0,t.jsxs)("div",{className:"flex items-start gap-2.5 px-3 py-2",children:[(0,t.jsx)(r.Avatar,{name:s.name,email:e.actor_email||void 0,avatarUrl:s.avatarUrl,fallbackText:s.emoji,kind:s.isService?"service":"user",seed:s.seed,size:"sm"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:(0,p.cn)("truncate text-xs font-medium",f.text.primary()),children:(0,h.getOperationLabel)(e.operation)}),(0,t.jsx)(n.SourcePill,{source:e.source,className:"shrink-0"})]}),(0,t.jsx)(n.SourcePillSubline,{source:e.source}),!c&&(0,t.jsx)("div",{className:(0,p.cn)("mt-0.5 truncate text-[11px]",f.text.secondary()),title:e.file_path,children:e.file_path}),(0,t.jsxs)("div",{className:(0,p.cn)("mt-0.5 truncate text-[11px]",f.text.dimmed()),title:s.detail??s.name,children:[s.name,s.detail&&(0,t.jsx)("span",{className:"ml-1 opacity-70",children:s.detail})]}),(0,t.jsxs)("div",{className:(0,p.cn)("mt-0.5 flex items-center gap-1.5 text-[11px]",f.text.dimmed()),children:[(0,t.jsx)("span",{title:new Date(e.created_at).toLocaleString(),children:(0,p.formatRelativeTime)(e.created_at)}),null!=e.file_size_bytes&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"·"}),(0,t.jsx)("span",{children:(0,p.formatBytes)(e.file_size_bytes)})]})]}),"move"===e.operation&&e.metadata?.destination_path!=null&&(0,t.jsxs)("div",{className:(0,p.cn)("mt-0.5 truncate text-[11px]",f.text.dimmed()),children:["→ ",String(e.metadata.destination_path)]})]})]},e.id)}),z&&(0,t.jsx)("div",{className:"py-2 text-center",children:(0,t.jsxs)("button",{type:"button",onClick:()=>F(w.length,!0),disabled:E,className:(0,p.cn)("rounded-lg px-3 py-1.5 text-xs transition-colors",f.text.secondary(),f.hover.bg(),"disabled:opacity-40"),children:[E?(0,t.jsx)(i.SpinnerIcon,{size:14,className:"mr-1 inline animate-spin"}):null,E?"Loading...":"Load more"]})})]})]})]})}],888384)},104167,e=>{"use strict";var t=e.i(9384),s=e.i(539919);e.i(492030);var n=e.i(213098),i=e.i(145904),a=e.i(930880),l=e.i(366809),r=e.i(451469),o=e.i(94836),c=e.i(249114),d=e.i(247358),u=e.i(252090),m=e.i(972296),x=e.i(70527),h=e.i(41714),p=e.i(249792),f=e.i(162621),b=e.i(719820),j=e.i(820601),v=e.i(529707),g=e.i(453782),y=e.i(98466),w=e.i(226688),k=e.i(327385);function N({thread:e,currentUserId:s,submitting:n,isActive:i,groupedWithPrevious:a=!1,onOpenThread:l,onResolve:r,onSaveEdit:o,onRequestDelete:c}){let{root:d,replies:u}=e,m=null!==d.resolved_at;return(0,t.jsx)(E,{comment:d,currentUserId:s,submitting:n,resolved:m,isActive:i,groupedWithPrevious:a,canResolve:!0,anchorText:d.anchor_text,onResolve:e=>r(d.id,e),onReplyInThread:l,onSaveEdit:o,onRequestDelete:c,footer:(0,t.jsx)(I,{replies:u,onOpen:l})})}function C({thread:e,channelName:n,conversationKind:i,currentUserId:l,submitting:c,onClose:d,onReply:u,onResolve:m,onSaveEdit:x,onRequestDelete:h}){let{root:p,replies:f}=e,b=null!==p.resolved_at,y=(0,s.useRef)(null),w=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=y.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;(!w.current||t)&&(e.scrollTop=e.scrollHeight,w.current=!0)},[f.length]);let{width:k,startResize:N,resetWidth:A,adjustWidth:I,setMinWidth:R,setMa
2xWidth:F,minWidth:L,maxWidth:M,ref:P}=(0,j.useResizable)({initialWidth:380,minWidth:300,maxWidth:640,side:"right",storageKey:"file-comments-thread-width"});return(0,t.jsxs)("aside",{ref:P,style:{width:k},className:(0,g.cn)("relative flex flex-shrink-0 flex-col border-l",v.border.default(),v.bg.surface()),children:[(0,t.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize thread panel","aria-valuemin":L,"aria-valuemax":M,"aria-valuenow":Math.round(k),tabIndex:0,onMouseDown:N,onDoubleClick:A,onKeyDown:e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),I(16);break;case"ArrowRight":e.preventDefault(),I(-16);break;case"Home":e.preventDefault(),F();break;case"End":e.preventDefault(),R();break;case"Enter":case" ":e.preventDefault(),A()}},className:"group absolute top-0 bottom-0 -left-1 z-20 w-2 cursor-col-resize focus:outline-none",children:(0,t.jsx)("span",{className:(0,g.cn)("pointer-events-none absolute inset-y-0 left-1 w-px transition-colors","group-hover:bg-selection group-focus:bg-selection group-active:bg-selection")})}),(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-shrink-0 items-center justify-between border-b px-4 py-3",v.border.default()),children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("span",{className:(0,g.cn)("text-sm font-bold",v.text.primary()),children:"Thread"}),(0,t.jsxs)("span",{className:(0,g.cn)("flex items-center gap-1 text-xs",v.text.dimmed()),children:["channel"===i?(0,t.jsx)(o.HashIcon,{size:11}):(0,t.jsx)(r.CommentsIcon,{size:11}),n]})]}),(0,t.jsx)("button",{type:"button",onClick:d,"aria-label":"Close thread",title:"Close thread",className:(0,g.cn)("rounded-lg p-1.5 transition-colors",v.text.dimmed(),v.hover.textPrimary(),v.hover.bgSubtle()),children:(0,t.jsx)(a.CloseIcon,{size:16})})]}),(0,t.jsxs)("div",{ref:y,className:"min-h-0 flex-1 overflow-y-auto py-2",children:[(0,t.jsx)(E,{comment:p,currentUserId:l,submitting:c,resolved:b,canResolve:!0,anchorText:p.anchor_text,onResolve:e=>m(p.id,e),onSaveEdit:x,onRequestDelete:h}),(0,t.jsx)(z,{count:f.length}),f.map((e,s)=>{let n=S(e,f[s-1]);return(0,t.jsx)(E,{comment:e,currentUserId:l,submitting:c,groupedWithPrevious:n,onSaveEdit:x,onRequestDelete:h},e.id)})]}),(0,t.jsx)(T,{placeholder:"Reply…",submitting:c,autoFocus:!0,onSubmit:e=>u(p.id,e)},`thread-${p.id}`)]})}function E({comment:e,currentUserId:n,submitting:a,resolved:l=!1,isActive:o=!1,groupedWithPrevious:c=!1,canResolve:d=!1,anchorText:m,onResolve:p,onReplyInThread:f,onSaveEdit:j,onRequestDelete:y,footer:N}){let C=e.author_id===n,S=(0,b.isOptimisticComment)(e.id),I=e.author_name||e.author_email||"Unknown",z=!S&&e.updated_at!==e.created_at,T=!c||S||z||l,[R,F]=(0,s.use
2State)(!1),[L,M]=(0,s.useState)(e.body),[P,D]=(0,s.useState)(!1),$=(0,w.readMediaCommentAnchor)(e),U=async()=>{let t=L.trim();if(t&&!P){D(!0);try{await j(e.id,t),F(!1)}finally{D(!1)}}},V=!$&&!!m&&m.trim().length>0;return(0,t.jsxs)("div",{className:(0,g.cn)("group relative flex gap-2 px-4 transition-colors",c?"py-0.5":"py-1.5","hover:bg-surface-muted",o&&v.status.accentBgSubtle,(l||S)&&"opacity-60"),children:[c?(0,t.jsx)("div",{className:"mt-0.5 w-8 flex-shrink-0","aria-hidden":"true"}):(0,t.jsx)(h.Avatar,{name:I,email:e.author_email||void 0,avatarUrl:e.author_avatar_url||void 0,size:"md",className:"mt-0.5 rounded-md"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[T&&(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[!c&&(0,t.jsx)("span",{className:(0,g.cn)("text-sm font-bold",v.text.primary()),children:I}),(S||!c)&&(0,t.jsx)("span",{className:(0,g.cn)("text-[11px]",v.text.dimmed()),children:S?"Sending…":new Date(e.created_at).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}),z&&(0,t.jsx)("span",{className:(0,g.cn)("text-[11px]",v.text.dimmed()),children:"(edited)"}),l&&(0,t.jsxs)("span",{className:(0,g.cn)("flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium",v.statusBadge.success.bg),children:[(0,t.jsx)(i.CheckIcon,{size:10}),"Resolved"]})]}),$&&(0,t.jsxs)("button",{type:"button",className:(0,g.cn)("mt-1 inline-flex rounded-md px-1.5 py-0.5 text-[10px] font-semibold tracking-wide uppercase transition-colors","bg-yellow-100 text-yellow-800 hover:bg-yellow-200 dark:bg-yellow-500/20 dark:text-yellow-200 dark:hover:bg-yellow-500/30"),title:`Jump to ${(0,k.formatTime)($.time)}
2 in the ${$.kind}`,onClick:()=>{(0,w.dispatchJumpToMediaComment)({workspaceId:e.workspace_id,filePath:e.file_path,time:$.time})},children:["audio"===$.kind?"Audio":"Video"," ",(0,k.formatTime)($.time)]}),V&&(0,t.jsx)("div",{className:(0,g.cn)("mt-1 border-l-2 pl-2 text-[12px] italic",v.status.warningAccentBorder,v.text.muted()),children:(0,t.jsxs)("span",{className:"line-clamp-2",children:["“",m,"”"]})}),R?(0,t.jsxs)("div",{className:"mt-1",children:[(0,t.jsx)("textarea",{value:L,onChange:e=>M(e.target.value),rows:2,autoFocus:!0,className:(0,g.cn)("w-full resize-none rounded-lg border px-3 py-2 text-sm","focus:ring-1 focus:outline-none",v.border.default(),v.bg.surface(),v.text.primary(),v.ring.default()),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&U(),"Escape"===e.key&&F(!1)}}),(0,t.jsxs)("div",{className:"mt-1.5 flex justify-end gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>F(!1),className:(0,g.cn)("rounded-md px-2.5 py-1 text-xs transition-colors",v.text.muted(),v.hover.textPrimary()),children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:U,disabled:!L.trim()||P,className:(0,g.cn)("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",L.trim()&&!P?(0,g.cn)(v.bg.inverted(),v.text.inverted(),v.hover.bgInverted()):(0,g.cn)("cursor-not-allowed",v.bg.muted(),v.text.dimmed())),children:P?"Saving…":"Save"})]})]}):(0,t.jsx)("div",{className:(0,g.cn)("mt-0.5 text-sm leading-relaxed break-words whitespace-pre-wrap",v.text.secondary()),children:(0,t.jsx)(_,{children:e.body})}),N]}),!R&&!S&&(0,t.jsxs)("div",{className:(0,g.cn)("absolute -top-3 right-3 flex items-center gap-0.5 rounded-lg border p-0.5 opacity-0 shadow-sm transition-opacity group-hover:opacity-100",v.border.default(),v.bg.surface()),children:[f&&(0,t.jsx)(A,{icon:r.CommentsIcon,title:"Reply in thread",onClick:f}),d&&p&&(0,t.jsx)(A,{icon:i.CheckIcon,title:l?"Mark unresolved":"Resolve thread",active:l,onClick:()=>p(!l)}),C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A,{icon:u.SquarePenIcon,title:"Edit",onClick:()=>{M(e.body),F(!0)},disabled:a}),(0,t.jsx)(A,{icon:x.TrashIcon,title:"Delete",danger:!0,onClick:()=>y(e.id)})]})]})]})}function S(e,t){if(!t||e.author_id!==t.author_id)return!1;let s=Date.parse(e.created_at),n=Date.parse(t.created_at);return!!Number.isFinite(s)&&!!Number.isFinite(n)&&18e4>=Math.abs(s-n)}function A({icon:e,title:s,onClick:n,active:i=!1,danger:a=!1,disabled:l=!1}){return(0,t.jsx)("button",{type:"button",onClick:n,disabled:l,title:s,"aria-label":s,className:(0,g.cn)("rounded-md p-1.5 transition-colors disabled:opacity-40",a?(0,g.cn)(v.status.dangerMuted,v.status.dangerHoverSubtle):i?(0,g.cn)(v.status.success,v.hover.bgSubtle()):(0,g.cn)(v.text.muted(),v.hover.textPrimary(),v.hover.bgSubtle())),children:(0,t.jsx)(e,{size:14})})}function I({replies:e,onOpen:s}){if(0===e.length)return null;let n=new Set,i=[];for(let t=e.length-1;t>=0&&i.length<3;t--){let s=e[t];n.has(s.author_id)||(n.add(s.author_id),i.push(s))}let a=e[e.length-1];return(0,t.jsxs)("button",{type:"button",onClick:s,className:(0,g.cn)("group/reply mt-1 -ml-1 flex items-center gap-2 rounded-md border border-transparent px-1 py-1 transition-colors","hover:border-border hover:bg-surface"),children:[(0,t.jsx)("div",{className:"flex -space-x-1.5",children:i.map(e=>(0,t.jsx)(h.Avatar,{name:e.author_name||e.author_email||"Unknown",email:e.author_email||void 0,avatarUrl:e.author_avatar_url||void 0,size:"sm",className:"ring-surface h-5 w-5 rounded-[5px] text-[9px] ring-2"},e.id))}),(0,t.jsxs)("span",{className:(0,g.cn)("text-xs font-semibold",v.status.accent),children:[e.length," ",1===e.length?"reply":"replies"]}),(0,t.jsxs)("span",{className:(0,g.cn)("text-[11px] transition-colors group-hover/reply:hidden",v.text.dimmed()),children:["Last reply ",(0,g.formatRelativeTime)(a.created_at)]}),(0,t.jsx)("span",{className:(0,g.cn)("hidden text-[11px] group-hover/reply:inline",v.status.accent),children:"View thread"})]})}function z({count:e}){return(0,t.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2",children:[(0,t.jsx)("span",{className:(0,g.cn)("flex-shrink-0 text-xs",v.text.muted()),children:0===e?"No replies yet":`${e} ${1===e?"reply":"replies"}`}),(0,t.jsx)("div",{className:(0,g.cn)("h-px flex-1","bg-border")})]})}function T({placeholder:e,submitting:i,autoFocus:a=!1,onSubmit:r}
2){let[o,u]=(0,s.useState)(""),x=(0,s.useRef)(null),h=o.trim().length>0&&!i;(0,s.useEffect)(()=>{let e=x.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)},[o]);let p=()=>{let e=o.trim();e&&!i&&(r(e),u(""),requestAnimationFrame(()=>x.current?.focus()))},f=e=>{let t=x.current;if(!t)return;let s=t.selectionStart??o.length,n=t.selectionEnd??o.length,i=o.slice(s,n);u(`${o.slice(0,s)}${e}${i}${e}${o.slice(n)}`),requestAnimationFrame(()=>{t.focus();let n=s+e.length;t.setSelectionRange(n,n+i.length)})};return(0,t.jsx)("div",{className:"flex-shrink-0 px-4 pt-1 pb-4",children:(0,t.jsxs)("div",{className:(0,g.cn)("rounded-lg border transition-colors",v.border.default(),v.bg.surface(),"focus-within:border-border-muted"),children:[(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center gap-0.5 border-b px-2 py-1",v.border.default()),children:[(0,t.jsx)(R,{icon:n.BoldIcon,title:"Bold",onClick:()=>f("*")}),(0,t.jsx)(R,{icon:c.ItalicIcon,title:"Italic",onClick:()=>f("_")}),(0,t.jsx)(R,{icon:m.StrikethroughIcon,title:"Strikethrough",onClick:()=>f("~")}),(0,t.jsx)("span",{className:(0,g.cn)("mx-1 h-4 w-px","bg-border")}),(0,t.jsx)(R,{icon:l.Code2Icon,title:"Code",onClick:()=>f("`")})]}),(0,t.jsx)("textarea",{ref:x,value:o,autoFocus:a,onChange:e=>u(e.target.value),placeholder:e,rows:1,className:(0,g.cn)("max-h-40 min-h-[2.5rem] w-full resize-none bg-transparent px-3 py-2 text-sm focus:outline-none",v.text.primary(),"placeholder:text-foreground-dimmed"),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),p())}}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5",children:[(0,t.jsxs)("span",{className:(0,g.cn)("text-[10px]",v.text.dimmed()),children:[(0,t.jsx)("kbd",{className:"font-sans font-medium",children:"Enter"})," to send ·"," ",(0,t.jsx)("kbd",{className:"font-sans font-medium",children:"Shift+Enter"})," for newline"]}),(0,t.jsx)("button",{type:"button",onClick:p,disabled:!h,"aria-label":"Send",title:"Send",className:(0,g.cn)("flex h-7 w-7 items-center justify-center rounded-md transition-colors",h?(0,g.cn)(v.bg.inverted(),v.text.inverted(),v.hover.bgInverted()):(0,g.cn)("cursor-not-allowed",v.bg.muted(),v.text.dimmed())),children:(0,t.jsx)(d.SendIcon,{size:14})})]})]})})}function R({icon:e,title:s,onClick:n}){return(0,t.jsx)("button",{type:"button",onClick:n,title:s,"aria-label":s,className:(0,g.cn)("rounded p-1 transition-colors",v.text.muted(),v.hover.textPrimary(),v.hover.bgSubtle()),children:(0,t.jsx)(e,{size:14})})}function F({value:e,onChange:s}){return(0,t.jsx)("div",{className:(0,g.cn)("flex items-center gap-0.5 rounded-lg p-0.5",v.bg.muted()),children:[{id:"all",label:"All"},{id:"open",label:"Open"},{id:"resolved",label:"Resolved"}].map(n=>(0,t.jsx)("button",{type:"button",onClick:()=>s(n.id),className:(0,g.cn)("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",e===n.id?(0,g.cn)(v.bg.surface(),v.text.primary(),"shadow-sm"):(0,g.cn)(v.text.muted(),v.hover.textPrimary())),children:n.label},n.id))})}function L({label:e}){return(0,t.jsx)("div",{className:"sticky top-0 z-10 flex items-center justify-center py-2",children:(0,t.jsx)("span",{className:(0,g.cn)("rounded-full border px-3 py-0.5 text-xs font-semibold shadow-sm",v.border.default(),v.bg.surface(),v.text.secondary()),children:e})})}function M({filter:e,channelName:s,conversationKind:n,resourceKind:i}){return(0,t.jsxs)("div",{className:"px-4 pt-6 pb-2",children:[(0,t.jsx)("div",{className:(0,g.cn)("mb-3 inline-flex rounded-full p-3",v.bg.muted()),children:(0,t.jsx)(r.CommentsIcon,{size:28,className:v.text.muted()})}),(0,t.jsx)("p",{className:(0,g.cn)("text-base font-bold",v.text.primary()),children:"all"===e?"channel"===n?`This is the start of #${s}`:`This is the start of your conversation about ${s}`:`No ${e} comments`}),(0,t.jsx)("p",{className:(0,g.cn)("mt-1 text-sm",v.text.muted()),children:"all"===e?`Comments on this ${i} show up here. Start the conversation below.`:"Try a different filter."})]})}let P=/(`[^`\n]+`)|(\*[^*\n]+\*)|(_[^_\n]+_)|(~[^~\n]+~)/g;function _({children:e}){let s,n=e??"";if(!n)return null;let i=[],a=new RegExp(P),l=0,r=0;for(;null!==(s=a.exec(n));){s.index>l&&i.push((0,t.jsx)(p.Linkify,{children:n.slice(l,s.index)},r++));let e=s[0],a=e.slice(1,-1);"`"===e[0]?i.push((0,t.jsx)("code",{className:(0,g.cn)("rounded px-1 py-0.5 font-mono text-[0.85em]",v.bg.muted(),v.text.primary()),children:a},r++)):"*"===e[0]?i.push((0,t.jsx)("strong",{className:"font-semibold",children:(0,t.jsx)(p.Linkify,{children:a})},r++)):"_"===e[0]?i.push((0,t.jsx)("em",{className:"italic",children:(0,t.jsx)(p.Linkify,{children:a})},r++)):i.push((0,t.jsx)("del",{children:(0,t.jsx)(p.Linkify,{children:a})},r++)),l=s.index+e.length}return l<n.length&&i.push((0,t.jsx)(p.Linkify,{children:n.slice(l)},r++)),(0,t.jsx)(t.Fragment,{children:i})}function D(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}e.s(["FileCommentsChatView",0,function({isOpen:e,workspaceId:n,filePath:i,displayName:l,token:c,currentUserId:d,currentUser:u,conversationKind:m="channel",resourceKind:x="file",showCloseButton:h=!0,headerActions:p,onClose:b}){let{threads:j,loading:w,error:k,addComment:E,updateComment:A,deleteComment:I,resolveThread:z}=(0,y.useFileCommentsResource)({workspaceId:n,filePath:i,token:c,currentUser:u}),R=(0,s.useMemo)(()=>
2l?.trim()||i.split("/").pop()||i,[l,i]),[P,_]=(0,s.useState)("all"),[$,U]=(0,s.useState)(null),[V,B]=(0,s.useState)(!1),[G,O]=(0,s.useState)(null),H=(0,s.useMemo)(()=>j.filter(e=>"open"===P?null===e.root.resolved_at:"resolved"!==P||null!==e.root.resolved_at),[j,P]),W=(0,s.useMemo)(()=>{let e=[];for(let t of H){let s=function(e){let t=new Date(e),s=Math.round((D(new Date)-D(t))/864e5);return 0===s?"Today":1===s?"Yesterday":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}(t.root.created_at),n=e[e.length-1];n&&n.label===s?n.threads.push(t):e.push({label:s,threads:[t]})}return e},[H]),K=(0,s.useMemo)(()=>j.find(e=>e.root.id===$)??null,[j,$]),q=(0,s.useRef)(null),Y=j.length,J=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!e)return;let t=q.current;if(!t)return;let s=t.scrollHeight-t.scrollTop-t.clientHeight<80;(!J.current||s)&&(t.scrollTop=t.scrollHeight,J.current=!0)},[e,Y]),(0,s.useEffect)(()=>{if(!e)return;let t=e=>{if("Escape"!==e.key||null!==G)return;let t=document.activeElement?.tagName;"TEXTAREA"!==t&&"INPUT"!==t&&($?U(null):h&&b())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,G,$,b,h]);let X=async e=>{B(!0);try{await E(e)}finally{B(!1)}},Z=async(e,t)=>{B(!0);try{await E(t,e)}finally{B(!1)}},Q=async(e,t)=>{await A(e,t)},ee=async(e,t)=>{try{await z(e,t)}catch{}},et=async()=>{if(G)try{await I(G)}finally{O(null)}};return e?(0,t.jsxs)("div",{role:"dialog","aria-label":`Comments - ${R}`,className:(0,g.cn)("absolute inset-0 z-30 flex flex-col",v.bg.surface()),children:[(0,t.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:(0,g.cn)("flex flex-shrink-0 items-center justify-between gap-3 border-b px-4 py-3",v.border.default()),children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:["channel"===m?(0,t.jsx)(o.HashIcon,{size:18,className:v.text.muted()}):(0,t.jsx)(r.CommentsIcon,{size:18,className:v.text.muted()}),(0,t.jsx)("span",{className:(0,g.cn)("truncate text-base font-bold",v.text.primary()),children:R})]}),(0,t.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1",children:[p,(0,t.jsx)(F,{value:P,onChange:_}),h&&(0,t.jsx)("button",{type:"button",onClick:b,"aria-label":"Close",title:"Close",className:(0,g.cn)("ml-1 rounded-lg p-1.5 transition-colors",v.text.dimmed(),v.hover.textPrimary(),v.hover.bgSubtle()),children:(0,t.jsx)(a.CloseIcon,{size:18})})]})]}),(0,t.jsx)("div",{ref:q,className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:(0,t.jsxs)("div",{className:"mt-auto",children:[w&&0===j.length&&(0,t.jsx)("div",{className:(0,g.cn)("p-8 text-center text-sm",v.text.muted()),children:"Loading comments…"}),k&&(0,t.jsx)("div",{className:(0,g.cn)("p-8 text-center text-sm",v.status.dangerMuted),children:k}),!w&&!k&&0===H.length&&(0,t.jsx)(M,{filter:P,channelName:R,conversationKind:m,resourceKind:x}),W.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)(L,{label:e.label}),e.threads.map((s,n)=>{let i=e.threads[n-1],a=S(s.root,i?.root);return(0,t.jsx)(N,{thread:s,currentUserId:d,submitting:V,isActive:s.root.id===$,groupedWithPrevious:a,onOpenThread:()=>U(s.root.id),onResolve:ee,onSaveEdit:Q,onRequestDelete:O},s.root.id)})]},e.label))]})}),(0,t.jsx)(T,{placeholder:"channel"===m?`Message #${R}`:`Message ${R}`,submitting:V,onSubmit:X},`channel-${i}`)]}),K&&(0,t.jsx)(C,{thread:K,channelName:R,conversationKind:m,currentUserId:d,submitting:V,onClose:()=>U(null),onReply:Z,onResolve:ee,onSaveEdit:Q,onRequestDelete:O},K.root.id)]}),(0,t.jsx)(f.ConfirmModal,{isOpen:null!==G,onClose:()=>O(null),onConfirm:et,title:"Delete comment",message:"This comment and any replies will be permanently deleted.",confirmText:"Delete",variant:"danger"})]}):null}])},776795,e=>{"use strict";var t=e.i(9384),s=e.i(539919);e.i(492030);var n=e.i(961225),i=e.i(545426),a=e.i(916120),l=e.i(162621),r=e.i(529707),o=e.i(316727),c=e.i(453782);function d({title:e,description:s,references:n,showSource:i=!1}){return 0===n.length?null:(0,t.jsxs)("div",{className:"space-y-2",children:[e&&(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)("h3",{className:(0,
2c.cn)("text-xs font-semibold",r.text.primary()),children:e}),s&&(0,t.jsx)("p",{className:(0,c.cn)("text-xs",r.text.dimmed()),children:s})]}),(0,t.jsx)("ul",{className:(0,c.cn)("divide-y rounded-lg border",r.border.default(),r.border.divide(),r.bg.muted()),children:n.map((e,s)=>(0,t.jsxs)("li",{className:(0,c.cn)("flex items-center justify-between gap-3 px-3 py-2",r.border.default()),children:[(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:(0,c.cn)("block truncate text-sm",r.text.primary()),children:e.name??e.raw}),(0,t.jsxs)("span",{className:(0,c.cn)("block truncate text-xs",r.text.dimmed()),children:[(0,o.referenceKindLabel)(e.kind),e.path?` - ${e.path}`:"",i?` - in ${e.referenced_by}`:""]})]}),(0,t.jsx)(u,{reference:e})]},`${e.kind}-${e.path??e.raw}-${s}`))})]})}function u({reference:e}){return e.accessible?!1===e.exists?(0,t.jsx)("span",{className:(0,c.cn)("shrink-0 text-xs",r.status.warningBannerText),title:e.path?"This file no longer exists in the workspace.":"This reference points at a file that no longer exists.",children:"Missing"}):null:(0,t.jsx)("span",{className:(0,c.cn)("shrink-0 text-xs",r.text.dimmed()),title:"You do not have access to this file, so its status cannot be checked.",children:"No access"})}e.s(["FileReferencesModal",0,function({isOpen:e,onClose:u,workspaceId:m,filePath:x,fileName:h,token:p}){let[f,b]=(0,s.useState)(null),[j,v]=(0,s.useState)(null),[g,y]=(0,s.useState)(!1),[w,k]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(!e)return;let t=!1;return y(!0),v(null),(async()=>{try{let e=await (0,o.fetchFileReferences)(m,x,{token:p});t||b(e)}catch(e){t||v((0,c.getErrorMessage)(e,"Failed to check references"))}finally{t||y(!1)}})(),()=>{t=!0}},[e,m,x,p,w]),(0,s.useEffect)(()=>{e||b(null)},[e]);let N=(0,s.useCallback)(()=>k(e=>e+1),[]),C=f?.references??[],E=C.filter(e=>1===e.depth),S=C.filter(e=>e.depth>1),A=C.filter(e=>!1===e.exists).length;return(0,t.jsxs)(l.Modal,{isOpen:e,onClose:u,size:"lg",children:[(0,t.jsx)(l.Modal.Header,{icon:(0,t.jsx)(n.LinkIcon,{size:18,className:r.text.secondary()}),description:h,children:"References"}),(0,t.jsx)(l.Modal.Body,{className:"max-h-[60vh] overflow-y-auto",children:g?(0,t.jsxs)("div",{className:(0,c.cn)("flex items-center gap-2 py-8 text-sm",r.text.dimmed()),children:[(0,t.jsx)(i.SpinnerIcon,{size:14}),(0,t.jsx)("span",{children:"Checking references..."})]}):j?(0,t.jsxs)("div",{className:"space-y-3 py-4",children:[(0,t.jsx)("p",{className:(0,c.cn)("text-sm",r.text.secondary()),children:j}),(0,t.jsx)(a.Button,{variant:"outlined",size:"sm",onClick:N,children:"Try again"})]}):0===C.length?(0,t.jsx)("p",{className:(0,c.cn)("py-8 text-sm",r.text.dimmed()),children:"This file does not reference any other files."}):(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("p",{className:(0,c.cn)("text-sm",r.text.secondary()),children:[1===C.length?"This file references 1 other file.":`This file references ${C.length} other files.`,A>0&&(1===A?" 1 is missing from the workspace.":` ${A} are missing from the workspace.`)]}),(0,t.jsx)(d,{references:E}),S.length>0&&(0,t.jsx)(d,{title:"Referenced indirectly",description:"Reached through the files above.",references:S,showSource:!0}),f?.truncated&&"depth"!==f.truncated_by&&(0,t.jsx)("p",{className:(0,c.cn)("text-xs",r.text.dimmed()),children:"This list is incomplete - the file references more than can be checked in one pass."})]})}),(0,t.jsx)(l.Modal.Footer,{children:(0,t.jsx)(a.Button,{variant:"outlined",onClick:u,children:"Close"})})]})}])},358939,283124,468238,893302,48549,607791,800418,597511,702738,e=>{"use strict";var t=e.i(8674);e.s(["JsonEditor",()=>t.JsonEditorWithProvider],358939);var s=e.i(539919);e.s(["useEditorControls",0,function(){let e=(0,s.useRef)(null),[t,n]=(0,s.useState)(null);return{publish:(0,s.useCallback)(t=>{e.current=t,n(e=>t?e&&e.canUndo===t.canUndo&&e.canRedo===t.canRedo?e:{canUndo:t.canUndo,canRedo:t.canRedo}:null===e?e:null)},[]),controls:(0,s.useMemo)(()=>t?{undo:()=>e.current?.undo(),redo:()=>e.current?.redo(),canUndo:t.canUndo,canRedo:t.canRedo}:null,[t]),controlsRef:e}}],283124);var n=e.i(9384);e.i(492030);
2var i=e.i(930880),a=e.i(169021),l=e.i(916120),r=e.i(162621),o=e.i(529707),c=e.i(453782),d=e.i(874316);e.s(["UpdateAvailableBanner",0,function({hasLocalEdits:e,onReview:t,onUpdate:s,onDismiss:r}){return(0,n.jsxs)("div",{className:(0,c.cn)("flex items-center gap-3 border-b px-3 py-2",o.border.default(),o.bg.muted()),children:[(0,n.jsx)(a.RefreshIcon,{size:15,className:(0,c.cn)("shrink-0",o.text.secondary())}),(0,n.jsxs)("p",{className:(0,c.cn)("min-w-0 flex-1 truncate text-sm",o.text.primary()),children:["A newer version of this file is available.",e&&(0,n.jsx)("span",{className:(0,c.cn)("ml-1.5 hidden sm:inline",o.text.secondary()),children:"You have unsaved changes - review before they're lost."})]}),e?(0,n.jsx)(l.Button,{size:"sm",variant:"primary",onClick:t,children:"Review changes"}):(0,n.jsx)(l.Button,{size:"sm",variant:"primary",onClick:s,children:"Update"}),(0,n.jsx)("button",{type:"button",onClick:r,"aria-label":"Dismiss update notice",title:"Dismiss",className:(0,c.cn)("flex shrink-0 items-center justify-center rounded-md p-1",o.text.muted(),o.hover.bg(),o.hover.textPrimary()),children:(0,n.jsx)(i.CloseIcon,{size:15})})]})},"UpdateAvailableModal",0,function({isOpen:e,fileName:t,localContent:i,externalContent:a,localIsBinary:u,externalIsBinary:m,onResolve:x,onClose:h}){let[p,f]=(0,s.useState)(!0),b=u||m;return(0,n.jsxs)(r.Modal,{isOpen:e,onClose:h,size:p&&!b?"full":"lg",children:[(0,n.jsx)(r.Modal.Header,{description:t,children:"A newer version is available"}),(0,n.jsx)(r.Modal.Body,{children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:(0,c.cn)("text-sm",o.text.secondary()),children:"This file changed on disk while you had unsaved edits. Choose how to handle your changes:"}),(0,n.jsxs)("ul",{className:(0,c.cn)("space-y-1.5 text-sm",o.text.secondary()),children:[(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:(0,c.cn)("font-medium",o.text.primary()),children:"Combine"})," - merge your edits with the new version. Overlapping changes are marked so you can resolve them."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:(0,c.cn)("font-medium",o.text.primary()),children:"Keep my changes"})," - overwrite the new version with your edits the next time you save."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:(0,c.cn)("font-medium",o.text.primary()),children:"Discard my changes"})," - throw away your edits and load the new version."]})]}),p&&(0,n.jsx)(d.FileDiffPanes,{leftContent:i,rightContent:a,isBinary:b,leftLabel:"Your version (unsaved)",rightLabel:"New version (on disk)"})]})}),(0,n.jsxs)(r.Modal.Footer,{className:"justify-between",children:[(0,n.jsx)(l.Button,{variant:"ghost",onClick:()=>f(e=>!e),disabled:b,title:b?"Binary content cannot be compared":void 0,children:p?"Hide diff":"View diff"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[(0,n.jsx)(l.Button,{variant:"danger-outlined",onClick:()=>x("discardLocal"),children:"Discard my changes"}),(0,n.jsx)(l.Button,{variant:"secondary",onClick:()=>x("keepLocal"),children:"Keep my changes"}),(0,n.jsx)(l.Button,{variant:"primary",onClick:()=>x("combine"),disabled:b,title:b?"Binary files can't be merged":void 0,children:"Combine"})]})]})]})}],468238);var u=e.i(255049),m=e.i(943015),x=e.i(655153),h=e.i(409197),p=e.i(582256),f=e.i(645333);e.s(["FileInfoButton",0,function({fileName:e,filePath:t,locationParts:i,title:a,className:l,onDoubleClick:r,children:d}){let{t:b}=(0,p.useLocale)(),[j,v]=(0,s.useState)(!1),[g,y]=(0,s.useState)(!1),w=(0,s.useRef)(null),k=(0,s.useRef)(null),N=i.join(" / "),C=()=>{k.current&&clearTimeout(k.current),k.current=null};(0,s.useEffect)(()=>C,[]);let E=()=>{y(!1),v(e=>!e)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{ref:w,type:"button",onClick:()=>{r?(C(),k.current=setTimeout(E,250)):E()},onDoubleClick:r?()=>{C(),v(!1),r()}:void 0,"aria-haspopup":"dialog","aria-expanded":j,title:a,className:(0,c.cn)("text-left",l),children:d}),(0,n.jsxs)(h.AnchoredPanel,{open:j,anchorRef:w,onClose:({restoreFocus:e})=>{v(!1),e&&w.current?.focus()},width:288,role:"dialog",ariaLabel:b.workspace.fileInfo,className:"rounded-xl p-3 text-xs",children:[(0,n.jsxs)("div",{className:(0,
2c.cn)("flex items-center gap-2.5 border-b pb-2.5",o.border.default()),children:[(0,n.jsx)(x.FileTypeIcon,{filename:e,size:32,className:"flex-shrink-0"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:(0,c.cn)("text-sm font-medium",o.text.primary()),children:(0,f.getFileTypeName)(e)}),(0,n.jsx)("div",{className:(0,c.cn)("truncate",o.text.muted()),title:e,children:e})]})]}),N&&(0,n.jsxs)("div",{className:(0,c.cn)("flex min-w-0 items-center gap-1.5 pt-2.5",o.text.muted()),children:[(0,n.jsx)(m.FolderOpenIcon,{size:13,className:"flex-shrink-0 opacity-70"}),(0,n.jsx)("span",{className:"truncate",title:N,children:N})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{(0,c.copyToClipboard)(t).then(()=>y(!0),()=>y(!1))},className:(0,c.cn)("mt-2.5 flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 transition-colors",o.border.default(),o.text.primary(),o.hover.bg()),children:[(0,n.jsx)(u.CopyIcon,{size:12,className:"flex-shrink-0"}),g?b.workspace.pathCopied:b.workspace.copyPath]})]})]})}],893302);var b=e.i(407311);e.s(["useAiAgentDisplayMode",0,function(){let[e,t]=(0,s.useState)("sidebar");return(0,s.useEffect)(()=>{try{let e=localStorage.getItem(b.STORAGE_KEYS.EDITOR_AI_AGENT_DISPLAY_MODE);("sidebar"===e||"bubble"===e)&&t(e)}catch{}},[]),[e,(0,s.useCallback)(e=>{t(e);try{localStorage.setItem(b.STORAGE_KEYS.EDITOR_AI_AGENT_DISPLAY_MODE,e)}catch{}},[])]}],48549);var j=e.i(590044);e.s(["useAutosaveEnabled",0,function(){return(0,j.usePersistedBoolean)(b.STORAGE_KEYS.EDITOR_AUTOSAVE_ENABLED,!0)}],607791);var v=e.i(562406),g=e.i(145904),y=e.i(675392),w=e.i(421865),k=e.i(929744),N=e.i(366809),C=e.i(652441),E=e.i(279090),S=e.i(72932),A=e.i(453042),I=e.i(961225),z=e.i(780707),T=e.i(221472),R=e.i(581224),R=R,F=e.i(583856),L=e.i(377770),M=e.i(360892),M=M,P=e.i(545426),_=e.i(70527),D=e.i(657662),D=D,$=e.i(929797),$=$,U=e.i(456745),V=e.i(588011);let B=e=>(0,c.cn)("flex w-full items-center justify-between gap-2 px-3 py-2 text-xs transition-colors",e&&"cursor-not-allowed opacity-50",(0,c.cn)(o.text.secondary(),o.hover.bg())),G=(0,c.cn)("flex w-full items-center gap-2 px-3 py-2 text-xs transition-colors",o.text.secondary(),o.hover.bg());function O({on:e,t}){return(0,n.jsx)("span",{className:(0,c.cn)("text-[11px]",e?o.status.accent:o.text.dimmed()),children:e?t.common.on:t.common.off})}function H({action:e,t}){return e.exclusive?e.active?(0,n.jsx)(g.CheckIcon,{size:13,className:o.status.accent}):null:(0,n.jsx)(O,{on:!!e.active,t:t})}function W(){return(0,n.jsx)("div",{className:(0,c.cn)("mx-2 my-1 border-t",o.border.default())})}function K(e){return e.section??""}function q({fullViewApp:e,viewRaw:t,onToggleViewRaw:s,onRequestClose:i,t:a}){return(0,n.jsxs)("button",{type:"button",onClick:()=>{s(),i()},className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[e&&t?(0,n.jsx)(E.EyeIcon,{size:13}):(0,n.jsx)(N.Code2Icon,{size:13}),(0,n.jsx)("span",{children:e?t?"View app":"View code":"View raw"})]}),!e&&(t?(0,n.jsx)(g.CheckIcon,{size:13,className:o.status.accent}):(0,n.jsx)("span",{className:(0,c.cn)("text-[11px]",o.text.dimmed()),children:a.common.off}))]})}function Y({enabled:e,onToggle:t,onRequestClose:s,t:i}){return(0,n.jsxs)("button",{type:"button",onClick:()=>{t(),s()},className:B(),title:"Saved in the file - hides the source pane for everyone who opens it",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(v.AppWindowIcon,{size:13}),(0,n.jsx)("span",{children:"Full view"})]}),(0,n.jsx)(O,{on:e,t:i})]})}function J({onSaveAsApp:e,onRequestClose:t}){return(0,n.jsx)("button",{type:"button",onClick:()=>{e(),t()},className:B(),children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(v.AppWindowIcon,{size:13}),(0,n.jsx)("span",{children:"Save as .app"})]})})}function X({actions:e,onRequestClose:t}){return(0,n.jsx)(n.Fragment,{children:e.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>{e.onClick(),t()},className:B(),children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,(0,n.jsx)("span",{children:e.label})]})},e.id))})}e.s(["EditorActionsMenu",0,function({t:e,onRequestClose:t,isEditable:i,isSaving:l,isDirty:r,canSave:d,isCollaborativeEditing:m,saveDisabledReason:x,saveShortcutLabel:h,onSave:p,hasEditorControls:f,canUndo:b,canRedo:j,undoShortcutLabel:v,redoShortcutLabel:N,onUndo:E,onRedo:Z,autosaveEnabled:Q,onToggleAutosave:ee,markdownSource:et,onError:es,supportsWideMode:en,wideMode:ei,onToggleWideMode:ea,supportsSpellCheck:el,spell
2Check:er,onToggleSpellCheck:eo,supportsRawView:ec,viewRaw:ed,onToggleViewRaw:eu,fullViewApp:em=!1,fullViewEnabled:ex=!1,canToggleFullView:eh=!1,onToggleFullView:ep,onSaveAsApp:ef,fileActions:eb=[],supportsViewModes:ej,fullscreenSupported:ev,isFullscreen:eg,onToggleFullscreen:ey,maximized:ew,onToggleMaximize:ek,immersive:eN,onHideImmersiveUi:eC,editorMenuActions:eE,onReload:eS,onDownload:eA,onShare:eI,onCheckReferences:ez,onActivityLog:eT,onVersionHistory:eR,onDelete:eF,lockedActions:eL,onLockedAction:eM,lockedHint:eP,lastModifiedLabel:e_,lastModifiedTitle:eD,mdStats:e$,kanbanStats:eU,automationStats:eV,tableStats:eB,editorStats:eG=[]}){let[eO,eH]=(0,s.useState)(null),[eW,eK]=(0,s.useState)(!1),eq=eh&&!!ep,eY=eq&&ep?(0,n.jsx)(Y,{enabled:ex,onToggle:ep,onRequestClose:t,t:e}):null;if(em&&!ed)return(0,n.jsxs)(n.Fragment,{children:[ec&&(0,n.jsx)(q,{fullViewApp:!0,viewRaw:!1,onToggleViewRaw:eu,onRequestClose:t,t:e}),eY,ef&&(0,n.jsx)(J,{onSaveAsApp:ef,onRequestClose:t}),(0,n.jsx)(X,{actions:eb,onRequestClose:t})]});let eJ=void 0!==et,eX=!!en,eZ=eE.length>0,eQ=eP??"Log in to use",e0=!eI&&!!eL?.has("share"),e1=!eT&&!!eL?.has("activityLog"),e5=!eR&&!!eL?.has("versionHistory"),e2=!eF&&!!eL?.has("delete"),e3=()=>{eM?.(),t()},e4=!!eS||!!eA||!!eI||!!eF||e0||e1||e5||e2,e8=l||!r||!d||m,e9=!f||!b,e7=!f||!j;return(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsxs)("button",{type:"button",onClick:()=>{p(),t()},disabled:e8,className:B(e8),title:m?"Collaborative files sync automatically":d?void 0:x||"Saving is disabled for this file",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[l?(0,n.jsx)(P.SpinnerIcon,{size:13,className:"animate-spin"}):(0,n.jsx)(F.SaveIcon,{size:13}),(0,n.jsx)("span",{children:e.common.save||"Save"})]}),(0,n.jsx)("span",{className:(0,c.cn)("text-[11px] tabular-nums",o.text.dimmed()),children:h})]}),i&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{E(),t()},disabled:e9,className:B(e9),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(D.Undo2,{size:13}),(0,n.jsx)("span",{children:e.common.undo})]}),(0,n.jsx)("span",{className:(0,c.cn)("text-[11px] tabular-nums",o.text.dimmed()),children:v})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{Z(),t()},disabled:e7,className:B(e7),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(R.Redo2,{size:13}),(0,n.jsx)("span",{children:e.common.redo})]}),(0,n.jsx)("span",{className:(0,c.cn)("text-[11px] tabular-nums",o.text.dimmed()),children:N})]})]}),i&&(0,n.jsxs)("button",{type:"button",onClick:()=>{ee(),t()},className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(k.CloudIcon,{size:13}),(0,n.jsx)("span",{children:e.common.autosave})]}),(0,n.jsx)(O,{on:Q,t:e})]}),i&&(eJ||eX||el||ec||eq||ef||eb.length>0||eZ||e4)&&(0,n.jsx)(W,{}),eJ&&(0,n.jsxs)("button",{type:"button",onClick:async()=>{try{await (0,c.copyToClipboard)(et??""),eK(!0),setTimeout(()=>eK(!1),1500)}catch(e){es?.((0,c.getErrorMessage)(e,"Failed to copy"))}t()},className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.CopyIcon,{size:13}),(0,n.jsx)("span",{children:"Copy markdown"})]}),eW&&(0,n.jsx)(g.CheckIcon,{size:13,className:o.status.accent})]}),eX&&(0,n.jsxs)("button",{type:"button",onClick:()=>{ea(),t()},className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)($.MoveHorizontal,{size:13}),(0,n.jsx)("span",{children:"Wide mode"})]}),ei?(0,n.jsx)(g.CheckIcon,{size:13,className:o.status.accent}):(0,n.jsx)("span",{className:(0,c.cn)("text-[11px]",o.text.dimmed()),children:e.common.off})]}),el&&(0,n.jsxs)("button",{type:"button",onClick:()=>{eo(),t()},className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(M.SpellCheck,{size:13}),(0,n.jsx)("span",{children:"Spellcheck"})]}),er?(0,n.jsx)(g.CheckIcon,{size:13,className:o.status.accent}):(0,n.jsx)("span",{className:(0,c.cn)("text-[11px]",o.text.dimmed()),children:e.common.off})]}),ec&&(0,n.jsx)(q,{fullViewApp:em,viewRaw:ed,onToggleViewRaw:eu,onRequestClose:t,t:e}),eY,ef&&(0,n.jsx)(J,{onSaveAsApp:ef,onRequestClose:t}),(0,n.jsx)(X,{actions:eb,onRequestClose:t}),ej&&(0,n.jsxs)(n.Fragment,{children:[(i||ec||eq||ef||eb.length>0)&&(0,n.jsx)(W,{}),ev&&(0,n.jsxs)("button",{type:"button",onClick:()=>{ey(),t()},className:G,children:[eg?(0,n.jsx)(U.WindowCollapseIcon,{size:13}):(0,n.jsx)(V.WindowExpandIcon,{size:13}),(0,n.jsx)("span",{children:eg?"Exit fullscreen":"Fullscreen"})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{ek(),t()},className:G,children:[(0,n.jsx)(T.MaximizeIcon,{size:13}),(0,n.jsx)("span",{children:ew?"Exit maximize":"Maximize"})]}),eN&&(0,n.jsxs)("button",{type:"button",onClick:()=>{eC(),t()},className:G,children:[(0,n.jsx)(S.EyeOffIcon,{size:13}),(0,n.jsx)("span",{children:"Hide UI"})]})]}),eZ&&(i||ec||eq||ef||ej)&&(0,n.jsx)(W,{}),eE.map((i,a)=>{let l=a>0?eE[a-1]:null,r=null!==l&&K(l)!==K(i);if(i.submenu&&i.submenu.length>0){let a=eO===i.id;return(0,n.jsxs)(s.Fragment,{children:[r&&(0,n.jsx)(W,{}),(0,n.jsxs)("button",{type:"button","aria-expanded":a,onClick:()=>eH(e=>e===i.id?null:i.id),className:B(),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[i.icon,(0,n.jsx)("span",{children:i.label})]}
2),(0,n.jsx)(y.ChevronRightIcon,{size:13,className:(0,c.cn)(o.text.dimmed(),"transition-transform",a&&"rotate-90")})]}),a&&i.submenu.map(s=>(0,n.jsxs)("button",{type:"button",disabled:s.disabled,onClick:()=>{s.onClick(),void 0===s.active&&(eH(null),t())},className:(0,c.cn)("flex w-full items-center justify-between gap-2 py-2 pr-3 pl-8 text-xs transition-colors",s.disabled&&"cursor-not-allowed opacity-50",o.text.secondary(),o.hover.bg()),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[s.icon,(0,n.jsx)("span",{children:s.label})]}),void 0!==s.active&&(0,n.jsx)(H,{action:s,t:e})]},s.id))]},i.id)}return(0,n.jsxs)(s.Fragment,{children:[r&&(0,n.jsx)(W,{}),(0,n.jsxs)("button",{type:"button",disabled:i.disabled,onClick:()=>{i.onClick(),void 0===i.active&&t()},className:B(i.disabled),children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[i.icon,(0,n.jsx)("span",{children:i.label})]}),void 0!==i.active&&(0,n.jsx)(H,{action:i,t:e})]})]},i.id)}),(i||ec||eq||ef||eZ)&&e4&&(0,n.jsx)(W,{}),eS&&(0,n.jsx)("button",{type:"button",onClick:async()=>{t(),await eS()},className:B(),children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(a.RefreshIcon,{size:13}),(0,n.jsx)("span",{children:e.common.refresh})]})}),eA&&(0,n.jsx)("button",{type:"button",onClick:()=>{eA(),t()},className:B(),children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(C.DownloadIcon,{size:13}),(0,n.jsx)("span",{children:e.common.download||"Download"})]})}),(eI||e0)&&(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e0)return e3();eI?.(),t()},className:B(),title:e0?eQ:void 0,children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.ShareIcon,{size:13}),(0,n.jsx)("span",{children:e.workspace.share})]}),e0&&(0,n.jsx)(z.LockIcon,{size:11,className:o.text.dimmed()})]}),ez&&(0,n.jsx)("button",{type:"button",onClick:()=>{ez(),t()},className:B(),children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(I.LinkIcon,{size:13}),(0,n.jsx)("span",{children:"Check references"})]})}),(eT||e1)&&(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e1)return e3();eT?.(),t()},className:B(),title:e1?eQ:void 0,children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(w.ClockIcon,{size:13}),(0,n.jsx)("span",{children:"Activity log"})]}),e1&&(0,n.jsx)(z.LockIcon,{size:11,className:o.text.dimmed()})]}),(eR||e5)&&(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e5)return e3();eR?.(),t()},className:B(),title:e5?eQ:void 0,children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(A.HistoryIcon,{size:13}),(0,n.jsx)("span",{children:e.workspace.versionHistory})]}),e5&&(0,n.jsx)(z.LockIcon,{size:11,className:o.text.dimmed()})]}),(eF||e2)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(W,{}),(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e2)return e3();eF?.(),t()},className:(0,c.cn)("flex w-full items-center justify-between gap-2 px-3 py-2 text-xs transition-colors",e2?(0,c.cn)(o.text.secondary(),o.hover.bg()):(0,c.cn)(o.status.danger,o.status.dangerHoverSubtle)),title:e2?eQ:void 0,children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(_.TrashIcon,{size:13}),(0,n.jsx)("span",{children:e.common.delete||"Delete"})]}),e2&&(0,n.jsx)(z.LockIcon,{size:11,className:o.text.dimmed()})]})]}),(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:e.workspace.lastModified}),(0,n.jsx)("div",{className:(0,c.cn)("mt-0.5 text-xs",o.text.secondary()),title:eD,children:e_??"-"})]}),e$&&(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:"Document stats"}),(0,n.jsxs)("div",{className:(0,c.cn)("mt-0.5 flex flex-col gap-0.5 text-xs",o.text.secondary()),children:[(0,n.jsxs)("span",{children:[e$.words.toLocaleString()," ",1===e$.words?"word":"words"," ·"," ",e$.chars.toLocaleStr
2ing()," ",1===e$.chars?"char":"chars"]}),e$.words>0&&(0,n.jsxs)("span",{children:[e$.readingTime," read"]})]})]}),eU&&(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:"Board stats"}),(0,n.jsx)("div",{className:(0,c.cn)("mt-0.5 text-xs",o.text.secondary()),children:(0,n.jsxs)("span",{children:[eU.lists," ",1===eU.lists?"list":"lists"," · ",eU.cards," ",1===eU.cards?"card":"cards"]})})]}),eV&&(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:"Workflow stats"}),(0,n.jsx)("div",{className:(0,c.cn)("mt-0.5 text-xs",o.text.secondary()),children:(0,n.jsxs)("span",{children:[eV.nodes," ",1===eV.nodes?"node":"nodes"," ·"," ",eV.connections," ",1===eV.connections?"connection":"connections"]})})]}),eB&&(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:"Table stats"}),(0,n.jsx)("div",{className:(0,c.cn)("mt-0.5 text-xs",o.text.secondary()),children:(0,n.jsxs)("span",{children:[eB.rows," ",1===eB.rows?"row":"rows"," · ",eB.cols," ",1===eB.cols?"column":"columns"]})})]}),eG.map(e=>(0,n.jsxs)("div",{className:(0,c.cn)("border-t px-3 py-2",o.border.default()),children:[(0,n.jsx)("div",{className:(0,c.cn)("text-[10px] tracking-wide uppercase",o.text.dimmed()),children:e.title}),(0,n.jsx)("div",{className:(0,c.cn)("mt-0.5 flex flex-col gap-0.5 text-xs",o.text.secondary()),children:e.lines.map((e,t)=>(0,n.jsx)("span",{children:e},t))})]},e.id))]})}],800418);var Z=e.i(44708);let Q=(0,c.cn)(o.border.default(),o.text.muted(),o.hover.border(),o.hover.textPrimary());e.s(["EditorExportButton",0,function({menuActions:e,buttonClassName:t,className:i}){let[a,l]=(0,s.useState)(!1),r=(0,s.useRef)(null),d=e.filter(e=>e.exportAction).flatMap(e=>e.submenu?.length?e.submenu:[e]);(0,s.useEffect)(()=>{if(!a)return;let e=()=>l(!1),t=t=>{r.current&&!r.current.contains(t.target)&&e()},s=t=>{"Escape"===t.key&&e()};return document.addEventListener("mousedown",t),document.addEventListener("keydown",s),window.addEventListener("blur",e),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",s),window.removeEventListener("blur",e)}},[a]);let u=t=>{for(let s of e){let e=s.id===t?s:s.submenu?.find(e=>e.id===t);if(e)return void e.onClick()}};if(0===d.length)return null;let m=1===d.length;return(0,n.jsxs)("div",{className:(0,c.cn)("relative",i),ref:r,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{m?u(d[0].id):l(e=>!e)},disabled:d.every(e=>e.disabled),title:m?d[0].label:void 0,"aria-haspopup":m?void 0:"menu","aria-expanded":m?void 0:a,className:(0,c.cn)("flex items-center gap-1 rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors","disabled:cursor-not-allowed disabled:opacity-50",t??Q),children:["Export",!m&&(0,n.jsx)(Z.ChevronDownIcon,{size:12,className:"opacity-70"})]}),a&&!m&&(0,n.jsx)("div",{role:"menu",className:(0,c.cn)("absolute top-full right-0 z-50 mt-1 w-max max-w-[90vw] min-w-[180px] overflow-hidden rounded-lg border shadow-lg",o.border.default(),o.bg.primary()),children:d.map(e=>(0,n.jsxs)("button",{type:"button",disabled:e.disabled,onClick:()=>{l(!1),u(e.id)},className:(0,c.cn)("flex w-full items-center gap-2 px-3 py-2 text-xs whitespace-nowrap transition-colors",e.disabled&&"cursor-not-allowed opacity-50",o.text.secondary(),o.hover.bg()),children:[e.icon,(0,n.jsx)("span",{children:e.label})]},e.id))})]})}],597511);var ee=e.i(466138);let et=(0,c.cn)(o.border.default(),o.text.muted(),o.hover.border(),o.hover.textPrimary());e.s(["EditorToolbarActionButtons",0,function({menuActions:e,buttonClassName:t,className:s,resolveAction:i}){let a=e.filter(e=>e.toolbarAction);return 0===a.length?null:(0,n.jsx)("div",{className:(0,c.cn)("flex items-center gap-1.5",s),children:a.map(e=>{let s=(0,n.jsxs)("button",{type:"button","aria-label":e.tooltip??e.label,onClick:()=>
2(i?.(e.id)??e).onClick(),disabled:e.disabled,className:(0,c.cn)("flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors","disabled:cursor-not-allowed disabled:opacity-50",t??et),children:[e.icon,e.label]},e.id);return e.tooltip?(0,n.jsx)(ee.Tooltip,{text:e.tooltip,position:"bottom",children:s},e.id):s})})}],702738)},247358,e=>{"use strict";var t=e.i(712452);e.s(["SendIcon",()=>t.Send])}]);
3
4//# chunkId=01a0ef58-6770-7cd1-ab20-eeebff69682d

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.