@openchambery/web 1.19.7-beta.20 → 1.19.7-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/assets/AssistantView-sV1PVQiM.js +2 -0
  2. package/dist/assets/{DiagramView-CSXRZQ5S.js → DiagramView-D2hqP5VV.js} +1 -1
  3. package/dist/assets/MarkdownLoadingSkeleton-Vezjvk9B.js +3 -0
  4. package/dist/assets/MarkdownRenderer-x091Z--3.js +2 -0
  5. package/dist/assets/MarkdownRendererImpl-DML8BSro.js +7 -0
  6. package/dist/assets/{MarkstreamRendererImpl-CowOCU5W.js → MarkstreamRendererImpl-BK-HM2k3.js} +1 -1
  7. package/dist/assets/{MobileDetailNavigation-ACMbLTqb.js → MobileDetailNavigation-DcxkWiks.js} +1 -1
  8. package/dist/assets/{MobileShareBridge-CXR-B1xW.js → MobileShareBridge-TAGcOiyb.js} +1 -1
  9. package/dist/assets/{MobileSurface-CKBSKqUH.js → MobileSurface-zqlZzEFQ.js} +1 -1
  10. package/dist/assets/{MultiRunWindow-el9_nl25.js → MultiRunWindow-iH1d9S14.js} +1 -1
  11. package/dist/assets/{SettingsView-CVSiIRia.js → SettingsView-CzW23DZA.js} +3 -3
  12. package/dist/assets/{SettingsWindow-BXYswtp5.js → SettingsWindow-DZXCWZid.js} +1 -1
  13. package/dist/assets/{TerminalView-Bh0IQwa5.js → TerminalView-pU0wpD8s.js} +1 -1
  14. package/dist/assets/{ToolOutputDialog-XeIJ2etT.js → ToolOutputDialog-Bt7JChFG.js} +2 -2
  15. package/dist/assets/appThemeRegistry-BI7WR2Wo.js +1 -0
  16. package/dist/assets/fileReferenceActions-Di_DoDex.js +1 -0
  17. package/dist/assets/{gitApi-Uvb9w70Y.js → gitApi-CeFszLvk.js} +1 -1
  18. package/dist/assets/{insertionBoundaries-Bgec5nsP.js → insertionBoundaries-DDJNusn2.js} +1 -1
  19. package/dist/assets/{main-COfQt8Sj.js → main-CjnOsKDL.js} +8 -8
  20. package/dist/assets/{main-PPlpRj1-.js → main-j-Ij13jc.js} +2 -2
  21. package/dist/assets/markdown-worker-BuveaH3O.js +1 -0
  22. package/dist/assets/markdownHeightCache-CvUyZT4q.js +1 -0
  23. package/dist/assets/{miniChat-EZGRqQZr.js → miniChat-DgxavREE.js} +2 -2
  24. package/dist/assets/{mobile-DQNqMo5J.js → mobile-C0rwPMPM.js} +2 -2
  25. package/dist/assets/{multirun-EViX73vm.js → multirun-ot7-bKg7.js} +1 -1
  26. package/dist/assets/{projectMeta-Bv1L_nEb.js → projectMeta-3yOEc0oI.js} +1 -1
  27. package/dist/assets/{renderElectronMiniChatApp-Nsq4Wc4s.js → renderElectronMiniChatApp-BPNvFA_N.js} +2 -2
  28. package/dist/assets/renderMobileApp-CNog29Xy.js +28 -0
  29. package/dist/assets/{runtimeConfig-DKUQS4iY.js → runtimeConfig-D28kNEYO.js} +1 -1
  30. package/dist/assets/{runtimeEndpointReset-BMeu9Hqj.js → runtimeEndpointReset-CorvFIRk.js} +1 -1
  31. package/dist/assets/{sessionLookup-Sb2HN3G2.js → sessionLookup-CbatbQf7.js} +1 -1
  32. package/dist/assets/{markdownHeightCache-Bj707yG-.js → toolHelpers-DEvVP9U0.js} +1 -1
  33. package/dist/assets/{useAppFontEffects-B_6vc0u3.js → useAppFontEffects-CDpeZWK4.js} +32 -32
  34. package/dist/assets/{useDesktopWindowControlsLayout-B2L5PWHW.js → useDesktopWindowControlsLayout-D-xPByG0.js} +1 -1
  35. package/dist/assets/{useEffectiveDirectory-CBd5vt8N.js → useEffectiveDirectory-Dp-tez_r.js} +1 -1
  36. package/dist/assets/{useMobileNavigationStore-CUGaydRW.js → useMobileNavigationStore-DE1Pe9A9.js} +2 -2
  37. package/dist/assets/{useSessionAutoCleanup-Clhzc1wn.js → useSessionAutoCleanup-jNJ_WC38.js} +1 -1
  38. package/dist/assets/useWorkerHighlightedLines-MDnGj3yv.js +7 -0
  39. package/dist/index.html +2 -2
  40. package/dist/mini-chat.html +2 -2
  41. package/dist/mobile.html +2 -2
  42. package/package.json +1 -1
  43. package/server/lib/notifications/APNS.md +19 -13
  44. package/server/lib/notifications/DOCUMENTATION.md +4 -3
  45. package/server/lib/notifications/runtime.js +101 -42
  46. package/server/lib/notifications/runtime.test.js +65 -4
  47. package/dist/assets/AssistantView-C0p-8f2B.js +0 -2
  48. package/dist/assets/MarkdownRendererImpl-C6rkoZYH.js +0 -7
  49. package/dist/assets/appThemeRegistry-rSdmh4sW.js +0 -2
  50. package/dist/assets/fileReferenceActions-3pPDAJSl.js +0 -1
  51. package/dist/assets/markdown-worker-wEFz5Hm_.js +0 -3
  52. package/dist/assets/renderMobileApp-5WJDYaMR.js +0 -28
  53. package/dist/assets/useWorkerHighlightedLines-C4iQlbPQ.js +0 -7
@@ -1,7 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{_ as t}from"./useUIStore-CqqO11ZI.js";import{$t as n,kn as r,xn as i}from"./persistence-CSZp1CNB.js";import{nt as a,rt as o}from"./vendor-base-ui-CnHfUmDN.js";import{n as s}from"./platform-CenlWqxu.js";import{a as c,n as l}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as u}from"./vendor-react-DLPElpoQ.js";import{n as d}from"./clipboard-BXxLshVq.js";import{t as f}from"./utils-B0mQXN9L.js";import{n as p}from"./Icon-4My8YZwt.js";import{t as m}from"./button-Or0daT9o.js";import{i as h,n as g,t as _}from"./tooltip-BSrJYYYc.js";import{n as v}from"./useThemeSystem-DMzWVJaW.js";import{c as y,n as b,o as x,r as S,s as C}from"./markdownTheme-CVS01wHf.js";import{i as w}from"./appThemeRegistry-rSdmh4sW.js";import{a as T,o as E}from"./markdownHeightCache-Bj707yG-.js";import{n as D,t as ee}from"./markdown-worker-wEFz5Hm_.js";import{t as te}from"./vendor-tanstack-react-virtual-tlDgH6PG.js";var O=e(o(),1),k=u(),A=a(),ne=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,j={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},M=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,N=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,re=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,P=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,F=`${P} max-h-[min(22rem,50vh)] overflow-y-auto`,ie=`${P} w-full`,ae={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},I=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,oe=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,se=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ce=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,le=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ue={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},L={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},R=e=>{let t=(0,k.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:a}=d(),o=z.has(n.status)?n.status:`pending`,s=L[o],c;t[0]!==a||t[1]!==s?(c=a(s),t[0]=a,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===o?u=t[4]:(u=o===`in_progress`?(0,A.jsx)(p,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):o===`completed`?(0,A.jsx)(p,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,A.jsx)(p,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=o,t[4]=u);let m=u,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=f(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,I,y),t[5]=y,t[6]=b);let x;t[7]!==m||t[8]!==l?(x=(0,A.jsx)(h,{asChild:!0,children:(0,A.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":l,children:m})}),t[7]=m,t[8]=l,t[9]=x):x=t[9];let S;t[10]===l?S=t[11]:(S=(0,A.jsx)(g,{side:`left`,sideOffset:6,children:l}),t[10]=l,t[11]=S);let C;t[12]!==x||t[13]!==S?(C=(0,A.jsxs)(_,{children:[x,S]}),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w=ue[o],T;t[15]===w?T=t[16]:(T=f(`block whitespace-normal break-words`,w),t[15]=w,t[16]=T);let E;t[17]!==T||t[18]!==n.content?(E=(0,A.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,A.jsx)(`span`,{className:T,children:n.content})}),t[17]=T,t[18]=n.content,t[19]=E):E=t[19];let D;return t[20]!==i||t[21]!==E||t[22]!==v||t[23]!==b||t[24]!==C?(D=(0,A.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[C,E]}),t[20]=i,t[21]=E,t[22]=v,t[23]=b,t[24]=C,t[25]=D):D=t[25],D},z=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),B=`image/png`,V=c(`OpenChamberMedia`),H=e=>{let t=e.toLowerCase().split(`;`)[0]?.trim()||B;if(t===`image/jpeg`||t===`image/jpg`)return`jpg`;if(t===`image/webp`)return`webp`;if(t===`image/gif`)return`gif`;if(t===`image/svg+xml`)return`svg`;if(t===`image/png`)return`png`;let n=t.split(`/`)[1];return n&&/^[a-z0-9.+-]+$/i.test(n)?n:`png`},U=(e,t)=>{let n=`image.${H(t)}`,r=(((e||``).trim()||n).split(/[\\/]/).pop()||n).replace(/[^\w.\- ()[\]]+/g,`_`).replace(/^\.+/,``);return r?/\.[a-z0-9]{1,8}$/i.test(r)?r:`${r}.${H(t)}`:n},W=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Failed to encode image`))},r.onerror=()=>n(r.error??Error(`Failed to encode image`)),r.readAsDataURL(e)}),de=async e=>{let t=await W(e),n=t.indexOf(`,`);return n>=0?t.slice(n+1):t},fe=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},G=async(e,t)=>{let n=await fetch(e,{signal:t,cache:`no-store`});if(!n.ok)throw Error(`Image fetch failed (${n.status})`);return n.blob()},pe=async(e,t=B)=>{if(!e.naturalWidth||!e.naturalHeight)return null;let n=e.currentSrc||e.src;if(n&&(/^(?:blob:|data:|openchamber-asset:)/i.test(n)||/^https?:/i.test(n)||/^\/api(?=\/|[?#]|$)/.test(n)))try{let e=await G(n);if(e.size>0)return e}catch{}try{let n=document.createElement(`canvas`);n.width=e.naturalWidth,n.height=e.naturalHeight;let r=n.getContext(`2d`);if(!r)return null;r.drawImage(e,0,0);let i=t.startsWith(`image/`)?t:B,a=await new Promise(e=>{n.toBlob(t=>e(t),i===`image/jpg`?`image/jpeg`:i)});return a&&a.size>0?a:null}catch{return null}},me=async(e,t)=>{let n=``;try{return n=await S(e,t??new AbortController().signal),await G(n,t)}finally{n&&C(n)}},he=async(e,t)=>{let n=e.effectiveDirectory??``,i=null;e.prefetchedBlob&&e.prefetchedBlob.size>0&&(i=e.prefetchedBlob);let a=e.displayUrl?.trim();if(!i&&a)try{i=await G(a,t)}catch{i=null}if(!i){let a=e.sourceUrl.trim();if(!a)throw Error(`Image source is empty`);if(/^(?:data|blob):/i.test(a)||/^https?:/i.test(a)||/^\/api(?=\/|[?#]|$)/.test(a))i=await G(a,t);else{let e=y(a,n);if(x(e))try{i=await me(e.path,t)}catch{let n=await r(`/api/fs/raw`,{method:`GET`,cache:`no-store`,query:{path:e.path},signal:t});if(!n.ok)throw Error(`Image source request failed with status ${n.status}`);i=await n.blob()}else i=await G(e.source,t)}}if(!i||i.size<=0)throw Error(`Image is empty`);let o=(e.mimeType||(i.type&&i.type.startsWith(`image/`)?i.type:``)||B).split(`;`)[0].trim()||B;return{blob:i,filename:U(e.filename,o),mimeType:o}},ge=()=>!s()||l===void 0?!1:l.isPluginAvailable(`OpenChamberMedia`),_e=async(e,t)=>{let{blob:r,filename:a,mimeType:o}=await he(e,t);if(ge()){let e=await de(r);return await V.saveImage({dataBase64:e,mimeType:o,filename:a}),`saved`}if(n()){let e=i()?.vscode;if(e?.saveImage){let t=await W(r);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return fe(r,a),`downloaded`},ve=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),ye=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,K=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=ye(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},be=e=>`<pre><code>${ve(e)}</code></pre>`,xe=e=>{let t=(0,k.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=v(),u=O.useRef(null),d;t[0]===l?d=t[1]:(d=b(l),t[0]=l,t[1]=d);let p=d,m,h;t[2]!==n||t[3]!==o||t[4]!==c?(m=()=>{let e=u.current;e&&(e.innerHTML=be(n),K(e,c,o))},h=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=m,t[6]=h):(m=t[5],h=t[6]),O.useLayoutEffect(m,h);let g,_;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(g=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return ee(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,K(e,c,o))}),()=>{t=!1,i.abort()}},_=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=g,t[12]=_):(g=t[11],_=t[12]),O.useEffect(g,_);let y;t[13]===i?y=t[14]:(y=f(`typography-code`,i),t[13]=i,t[14]=y);let x=p,S;t[15]!==a||t[16]!==x?(S={...x,...a},t[15]=a,t[16]=x,t[17]=S):S=t[17];let C;return t[18]!==y||t[19]!==S?(C=(0,A.jsx)(`div`,{ref:u,className:y,style:S}),t[18]=y,t[19]=S,t[20]=C):C=t[20],C},Se=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Ce=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},we=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,Te=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,Ee=(e,t)=>!e||typeof e!=`object`?String(e):E(e,t||``),q=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},De=e=>{if(!e||typeof e!=`object`)return;let t=q(e.patch)??q(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=q(e.patch)??q(e.diff);if(t)return t}},Oe=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},ke=(e,t,n)=>{let r=Se(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&we(r)&&(r=Te(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=De(n);if(e)return e}return r},Ae=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
2
- `).split(`
3
- `),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},je=(e,n)=>{try{let r=e.trim().split(`
4
- `).filter(Boolean);if(r.length===0)return null;let i=[];return r.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,A.jsx)(`div`,{className:f(`w-full min-w-0 font-mono space-y-0.5`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:t.tool.popup,children:i.map((e,t)=>(0,A.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,A.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,A.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},Me={backgroundColor:`var(--status-info)`,opacity:.6},Ne=(e,n,r)=>{try{let i=e.trim().split(`
5
- `).filter(Boolean);if(i.length===0)return null;let a={};return i.forEach(e=>{let t=e.match(/^(.+?):(\d+):(.*)$/)||e.match(/^(.+?):(.*)$/);if(t){let[,e,n,r]=t,i=r===void 0?``:n,o=r===void 0?n:r;a[e]||(a[e]=[]),a[e].push({lineNum:i,content:o})}}),(0,A.jsxs)(`div`,{className:f(`space-y-2 w-full min-w-0`,r?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:t.tool.popup,children:[(0,A.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,i.length,` match`,i.length===1?``:`es`]}),Object.entries(a).map(([e,t])=>(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(`div`,{className:f(`font-medium text-muted-foreground`,n?`typography-micro`:`typography-code`),children:e}),(0,A.jsx)(`div`,{className:`pl-4 space-y-1`,children:t.map((e,t)=>!e.lineNum&&!e.content?null:(0,A.jsxs)(`div`,{className:f(`flex items-start gap-2 min-w-0`,n?`typography-micro`:`typography-code`),children:[(0,A.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 mt-1.5`,style:Me}),(0,A.jsxs)(`div`,{className:`flex gap-2 min-w-0 flex-1`,children:[e.lineNum&&(0,A.jsxs)(`span`,{className:`text-muted-foreground font-mono whitespace-nowrap`,children:[`Line `,e.lineNum,`:`]}),(0,A.jsx)(`span`,{className:`text-foreground font-mono break-words flex-1`,children:e.content||`\xA0`})]})]},t))})]},e))]})}catch{return null}},Pe={backgroundColor:`var(--status-info)`,opacity:.6},Fe=(e,n,r)=>{try{let i=e.trim().split(`
6
- `).filter(Boolean);if(i.length===0)return null;let a={};i.forEach(e=>{let t=e.lastIndexOf(`/`),n=t>0?e.substring(0,t):`/`,r=t>=0?e.substring(t+1):e;a[n]||(a[n]=[]),a[n].push(r)});let o=Object.keys(a).sort();return(0,A.jsxs)(`div`,{className:f(`space-y-2 w-full min-w-0`,r?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:t.tool.popup,children:[(0,A.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,i.length,` file`,i.length===1?``:`s`]}),o.map(e=>(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`div`,{className:f(`font-medium text-muted-foreground`,n?`typography-micro`:`typography-code`),children:[e,`/`]}),(0,A.jsx)(`div`,{className:f(`pl-4 grid gap-1`,n?`grid-cols-1`:`grid-cols-2`),children:a[e].sort().map(e=>(0,A.jsxs)(`div`,{className:f(`flex items-center gap-2 min-w-0`,n?`typography-micro`:`typography-code`),children:[(0,A.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:Pe}),(0,A.jsx)(`span`,{className:`text-foreground font-mono truncate`,children:e})]},e))})]},e))]})}catch{return null}},Ie=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),Le=(e,t,n)=>{try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let r=t.filter(e=>!!e&&typeof e==`object`&&typeof e.content==`string`&&typeof e.status==`string`&&Ie.has(e.status));if(r.length===0)return null;let i=r.find(e=>e.status===`in_progress`)??null;return(0,A.jsx)(`ul`,{className:n?.listClassName??F,children:r.map((e,t)=>(0,A.jsx)(R,{todo:e,isActive:e===i},e.id??`todo-${t}`))})}catch{return null}},Re=(e,n)=>{try{return(0,A.jsx)(`div`,{className:f(`typography-code max-w-none w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/20`),style:t.tool.popup,children:(0,A.jsx)(w,{content:e,variant:`tool`})})}catch{return null}},ze=e=>{let t=e.split(`
7
- `),n=``,r=[],i=0;for(;i<t.length;){let e=t[i];if(e.startsWith(`Index:`)||e.startsWith(`===`)||e.startsWith(`---`)||e.startsWith(`+++`)){e.startsWith(`Index:`)&&(n=e.split(` `)[1].split(`/`).pop()||`file`),i++;continue}if(e.startsWith(`@@`)){let a=e.match(/@@ -(\d+),\d+ \+(\d+),\d+ @@/),o=a?parseInt(a[1]):0,s=a?parseInt(a[2]):0,c=[],l=o,u=s,d=i+1;for(;d<t.length&&!t[d].startsWith(`@@`)&&!t[d].startsWith(`Index:`);){let e=t[d];e.startsWith(`+`)?(c.push({type:`added`,lineNumber:u,content:e.substring(1)}),u++):e.startsWith(`-`)?(c.push({type:`removed`,lineNumber:l,content:e.substring(1)}),l++):e.startsWith(` `)&&(c.push({type:`context`,lineNumber:u,content:e.substring(1)}),l++,u++),d++}r.push({file:n,oldStart:o,newStart:s,lines:c}),i=d;continue}i++}return r},Be=(e,t,n)=>T(t,e,n),Ve={maxDepth:50,maxNodes:1e5,initiallyExpandedDepth:2};function He(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`object`:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`null`}function Ue(e){if(e.length===0)return`root`;let t=`root`;for(let n of e)/^\d+$/.test(n)?t+=`[${n}]`:t+=`.${n}`;return t}var J=0;function Y(e,t,n,r,i){if(J>=i.maxNodes)return null;J++;let a=He(e),o=Ue(n),s=a===`object`||a===`array`,c={id:o,key:t,value:e,type:a,depth:r,path:n,isExpandable:s};if(s&&r<i.maxDepth){let t=a===`array`?e.map((e,t)=>[String(t),e]):Object.entries(e);c.childCount=t.length,c.children=[];for(let[e,a]of t){let t=Y(a,e,[...n,e],r+1,i);t&&c.children.push(t)}}else s&&(c.childCount=a===`array`?e.length:Object.keys(e).length);return c}function We(e,t){let n={...Ve,...t};J=0;try{let t=e.trim();return t?Y(JSON.parse(t),`root`,[],0,n):null}catch{return null}}function X(e,t){if(!e)return[];let n=[];function r(e){let i=!t.has(e.id);if(n.push({node:e,isExpanded:i}),e.isExpandable&&i&&e.children)for(let t of e.children)r(t)}return r(e),n}function Ge(e){if(!e)return[];let t=[];function n(e){if(e.isExpandable&&(t.push(e.id),e.children))for(let t of e.children)n(t)}return n(e),t}function Ke(e,t){if(!e)return[];let n=[];function r(e){if(e.isExpandable&&e.depth>=t&&n.push(e.id),e.children)for(let t of e.children)r(t)}return r(e),n}var Z=[`var(--syntax-key)`,`color-mix(in oklch, var(--syntax-key) 85%, var(--syntax-string))`,`color-mix(in oklch, var(--syntax-key) 70%, var(--syntax-number))`,`color-mix(in oklch, var(--syntax-key) 55%, var(--syntax-function))`,`color-mix(in oklch, var(--syntax-key) 40%, var(--syntax-type))`,`color-mix(in oklch, var(--syntax-key) 30%, var(--syntax-keyword))`];function qe(e){return Z[e%Z.length]}function Je(e){switch(e.type){case`string`:return`var(--syntax-string)`;case`number`:return`var(--syntax-number)`;case`boolean`:return`var(--syntax-keyword)`;case`null`:return`var(--syntax-comment)`;default:return`var(--surface-foreground)`}}function Q(e){switch(e.type){case`string`:{let t=e.value;return t.length>60?`"${t.slice(0,57)}..."`:`"${t}"`}case`number`:case`boolean`:return String(e.value);case`null`:return`null`;case`object`:return`{${e.childCount??0} ${e.childCount===1?`item`:`items`}}`;case`array`:return`[${e.childCount??0}]`;default:return String(e.value)}}function Ye(e){if(e.type===`object`){let t=e.children?.map(e=>e.key).slice(0,3)??[],n=(e.childCount??0)>3?`, ...`:``;return`{ ${t.map(e=>`"${e}": ...`).join(`, `)}${n} }`}if(e.type===`array`){let t=e.childCount??0;return t<=3?`[${e.children?.map(e=>Q(e)).join(`, `)??``}]`:`[${t} items]`}return Q(e)}var $=O.memo(e=>{let t=(0,k.c)(29),{flatNode:n,onToggle:r,onCopyPath:i}=e,{node:a,isExpanded:o}=n,s=a.depth*20,c;t[0]!==a.id||t[1]!==r?(c=()=>{r(a.id)},t[0]=a.id,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]!==a.id||t[4]!==i?(u=e=>{i&&(e.preventDefault(),i(a.id))},t[3]=a.id,t[4]=i,t[5]=u):u=t[5];let d=u,f;t[6]===a.depth?f=t[7]:(f=qe(a.depth),t[6]=a.depth,t[7]=f);let m=f,h;t[8]===a?h=t[9]:(h=Je(a),t[8]=a,t[9]=h);let g=h,_=a.isExpandable&&a.children&&a.children.length>0,v=`${s+8}px`,y;t[10]===v?y=t[11]:(y={paddingLeft:v},t[10]=v,t[11]=y);let b;t[12]!==l||t[13]!==_||t[14]!==o?(b=_?(0,A.jsx)(`button`,{type:`button`,onClick:l,className:`mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-[var(--interactive-hover)] text-muted-foreground`,children:o?(0,A.jsx)(p,{name:`arrow-down-s`,className:`h-3 w-3`}):(0,A.jsx)(p,{name:`arrow-right-s`,className:`h-3 w-3`})}):(0,A.jsx)(`span`,{className:`mr-1 w-4`}),t[12]=l,t[13]=_,t[14]=o,t[15]=b):b=t[15];let x;t[16]!==m||t[17]!==a.key?(x=a.key!==`root`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`mr-1 font-semibold`,style:{color:m},children:/^\d+$/.test(a.key)?a.key:`"${a.key}"`}),(0,A.jsx)(`span`,{className:`mr-1 text-[var(--surface-foreground)]`,children:`:`})]}),t[16]=m,t[17]=a.key,t[18]=x):x=t[18];let S;t[19]!==o||t[20]!==a||t[21]!==g?(S=a.isExpandable?o?(0,A.jsx)(`span`,{className:`text-[var(--surface-foreground)]`,children:a.type===`object`?`{`:`[`}):(0,A.jsx)(`span`,{style:{color:`var(--surface-mutedForeground)`},children:Ye(a)}):(0,A.jsx)(`span`,{style:{color:g},children:Q(a)}),t[19]=o,t[20]=a,t[21]=g,t[22]=S):S=t[22];let C;return t[23]!==d||t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,A.jsxs)(`div`,{className:`flex items-center py-0.5 px-2 hover:bg-[var(--surface-hover)] rounded-sm cursor-default font-mono text-xs leading-5 whitespace-nowrap`,style:y,onContextMenu:d,children:[b,x,S]}),t[23]=d,t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28],C});$.displayName=`JsonRow`;var Xe=200,Ze=22,Qe=O.forwardRef(function({data:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2,onCopyPath:i},a){let o=O.useMemo(()=>{try{return JSON.stringify(e)}catch{return null}},[e]),s=O.useMemo(()=>o?We(o):null,[o]),[c,l]=O.useState(()=>s?new Set(Ke(s,r)):new Set),u=O.useMemo(()=>X(s,c),[s,c]),d=u.length>Xe,f=O.useRef(null),p=te({count:u.length,enabled:d,getScrollElement:()=>f.current,estimateSize:()=>Ze,overscan:20,getItemKey:e=>u[e]?.node.id??e}),m=O.useCallback(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=O.useCallback(()=>{l(new Set)},[]),g=O.useCallback(()=>{s&&l(new Set(Ge(s)))},[s]);return O.useImperativeHandle(a,()=>({expandAll:h,collapseAll:g}),[h,g]),s?d?(0,A.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:(0,A.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(e=>{let t=u[e.index];return t?(0,A.jsx)(`div`,{"data-index":e.index,ref:p.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,A.jsx)($,{flatNode:t,onToggle:m,onCopyPath:i})},t.node.id):null})})}):(0,A.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:u.map(e=>(0,A.jsx)($,{flatNode:e,onToggle:m,onCopyPath:i},e.node.id))}):null}),$e=e=>{let t=(0,k.c)(12),{mode:n,onModeChange:r,className:i}=e,a;t[0]!==n||t[1]!==r?(a=e=>{e.stopPropagation(),r(n===`side-by-side`?`unified`:`side-by-side`)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===i?s=t[4]:(s=f(`h-5 w-5 p-0 opacity-60 hover:opacity-100`,i),t[3]=i,t[4]=s);let c=n===`side-by-side`?`Switch to unified view`:`Switch to side-by-side view`,l;t[5]===n?l=t[6]:(l=n===`side-by-side`?(0,A.jsx)(p,{name:`align-justify`,className:`h-3 w-3`}):(0,A.jsx)(p,{name:`layout-column`,className:`h-3 w-3`}),t[5]=n,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,A.jsx)(m,{size:`sm`,variant:`ghost`,className:s,onClick:o,title:c,children:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u},et=(e,t)=>{let n=(0,k.c)(4),[r,i]=O.useState(null),a,o;return n[0]!==e||n[1]!==t?(a=()=>{let n=!0,r=new AbortController;return i(null),D(e,(t||`text`).toLowerCase(),{signal:r.signal,priority:`visible`}).then(e=>{n&&i(e)}),()=>{n=!1,r.abort()}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),O.useEffect(a,o),r};export{ce as A,N as C,oe as D,j as E,ae as M,le as O,re as S,I as T,pe as _,Be as a,ne as b,ze as c,Ne as d,je as f,xe as g,Oe as h,Ce as i,ie as j,se as k,Ae as l,Re as m,$e as n,ke as o,Le as p,Qe as r,Ee as s,et as t,Fe as u,_e as v,F as w,M as x,R as y};